diff --git a/MystEditor.js b/MystEditor.js index 220bad5..c2a0d07 100644 --- a/MystEditor.js +++ b/MystEditor.js @@ -1,946 +1,955 @@ -var g3n = Object.defineProperty; -var m3n = (r, n, s) => n in r ? g3n(r, n, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[n] = s; -var YZ = (r, n, s) => (m3n(r, typeof n != "symbol" ? n + "" : n, s), s); -var AJ, qs, QAt, MM, M6t, zAt, CBe, qAt, aK = {}, VAt = [], b3n = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, B2e = Array.isArray; -function z6(r, n) { - for (var s in n) - r[s] = n[s]; - return r; -} -function UAt(r) { - var n = r.parentNode; - n && n.removeChild(r); -} -function pk(r, n, s) { - var a, l, h, f = {}; - for (h in n) - h == "key" ? a = n[h] : h == "ref" ? l = n[h] : f[h] = n[h]; - if (arguments.length > 2 && (f.children = arguments.length > 3 ? AJ.call(arguments, 2) : s), typeof r == "function" && r.defaultProps != null) - for (h in r.defaultProps) - f[h] === void 0 && (f[h] = r.defaultProps[h]); - return NX(r, f, a, l, null); -} -function NX(r, n, s, a, l) { - var h = { type: r, props: n, key: s, ref: a, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: l == null ? ++QAt : l, __i: -1, __u: 0 }; - return l == null && qs.vnode != null && qs.vnode(h), h; -} -function v3n() { +var qve = Object.defineProperty; +var Qve = (t, e, r) => e in t ? qve(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; +var Or = (t, e, r) => (Qve(t, typeof e != "symbol" ? e + "" : e, r), r), Yve = (t, e, r) => { + if (!e.has(t)) + throw TypeError("Cannot " + r); +}; +var rw = (t, e, r) => { + if (e.has(t)) + throw TypeError("Cannot add the same private member more than once"); + e instanceof WeakSet ? e.add(t) : e.set(t, r); +}; +var Tm = (t, e, r) => (Yve(t, e, "access private method"), r); +var Vb, $t, JX, dd, a$, eZ, gA, tZ, my = {}, rZ = [], Wve = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, kS = Array.isArray; +function yu(t, e) { + for (var r in e) + t[r] = e[r]; + return t; +} +function nZ(t) { + var e = t.parentNode; + e && e.removeChild(t); +} +function Rl(t, e, r) { + var n, i, s, a = {}; + for (s in e) + s == "key" ? n = e[s] : s == "ref" ? i = e[s] : a[s] = e[s]; + if (arguments.length > 2 && (a.children = arguments.length > 3 ? Vb.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) + for (s in t.defaultProps) + a[s] === void 0 && (a[s] = t.defaultProps[s]); + return zv(t, a, n, i, null); +} +function zv(t, e, r, n, i) { + var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: i == null ? ++JX : i, __i: -1, __u: 0 }; + return i == null && $t.vnode != null && $t.vnode(s), s; +} +function Gve() { return { current: null }; } -function i_(r) { - return r.children; -} -function ex(r, n) { - this.props = r, this.context = n; -} -function GB(r, n) { - if (n == null) - return r.__ ? GB(r.__, r.__i + 1) : null; - for (var s; n < r.__k.length; n++) - if ((s = r.__k[n]) != null && s.__e != null) - return s.__e; - return typeof r.type == "function" ? GB(r) : null; -} -function WAt(r) { - var n, s; - if ((r = r.__) != null && r.__c != null) { - for (r.__e = r.__c.base = null, n = 0; n < r.__k.length; n++) - if ((s = r.__k[n]) != null && s.__e != null) { - r.__e = r.__c.base = s.__e; +function Nu(t) { + return t.children; +} +function Ec(t, e) { + this.props = t, this.context = e; +} +function vg(t, e) { + if (e == null) + return t.__ ? vg(t.__, t.__i + 1) : null; + for (var r; e < t.__k.length; e++) + if ((r = t.__k[e]) != null && r.__e != null) + return r.__e; + return typeof t.type == "function" ? vg(t) : null; +} +function iZ(t) { + var e, r; + if ((t = t.__) != null && t.__c != null) { + for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) + if ((r = t.__k[e]) != null && r.__e != null) { + t.__e = t.__c.base = r.__e; break; } - return WAt(r); - } -} -function EBe(r) { - (!r.__d && (r.__d = !0) && MM.push(r) && !Nbe.__r++ || M6t !== qs.debounceRendering) && ((M6t = qs.debounceRendering) || zAt)(Nbe); -} -function Nbe() { - var r, n, s, a, l, h, f, b, w; - for (MM.sort(CBe); r = MM.shift(); ) - r.__d && (n = MM.length, a = void 0, h = (l = (s = r).__v).__e, b = [], w = [], (f = s.__P) && ((a = z6({}, l)).__v = l.__v + 1, qs.vnode && qs.vnode(a), UQe(f, a, l, s.__n, f.ownerSVGElement !== void 0, 32 & l.__u ? [h] : null, b, h == null ? GB(l) : h, !!(32 & l.__u), w), a.__.__k[a.__i] = a, GAt(b, a, w), a.__e != h && WAt(a)), MM.length > n && MM.sort(CBe)); - Nbe.__r = 0; -} -function YAt(r, n, s, a, l, h, f, b, w, O, S) { - var E, D, M, B, z, W = a && a.__k || VAt, H = n.length; - for (s.__d = w, w3n(s, n, W), w = s.__d, E = 0; E < H; E++) - (M = s.__k[E]) != null && typeof M != "boolean" && typeof M != "function" && (D = M.__i === -1 ? aK : W[M.__i] || aK, M.__i = E, UQe(r, M, D, l, h, f, b, w, O, S), B = M.__e, M.ref && D.ref != M.ref && (D.ref && WQe(D.ref, null, M), S.push(M.ref, M.__c || B, M)), z == null && B != null && (z = B), 65536 & M.__u || D.__k === M.__k ? w = HAt(M, w, r) : typeof M.type == "function" && M.__d !== void 0 ? w = M.__d : B && (w = B.nextSibling), M.__d = void 0, M.__u &= -196609); - s.__d = w, s.__e = z; -} -function w3n(r, n, s) { - var a, l, h, f, b, w = n.length, O = s.length, S = O, E = 0; - for (r.__k = [], a = 0; a < w; a++) - (l = r.__k[a] = (l = n[a]) == null || typeof l == "boolean" || typeof l == "function" ? null : typeof l == "string" || typeof l == "number" || typeof l == "bigint" || l.constructor == String ? NX(null, l, null, null, l) : B2e(l) ? NX(i_, { children: l }, null, null, null) : l.constructor === void 0 && l.__b > 0 ? NX(l.type, l.props, l.key, l.ref ? l.ref : null, l.__v) : l) != null ? (l.__ = r, l.__b = r.__b + 1, b = y3n(l, s, f = a + E, S), l.__i = b, h = null, b !== -1 && (S--, (h = s[b]) && (h.__u |= 131072)), h == null || h.__v === null ? (b == -1 && E--, typeof l.type != "function" && (l.__u |= 65536)) : b !== f && (b === f + 1 ? E++ : b > f ? S > w - f ? E += b - f : E-- : E = b < f && b == f - 1 ? b - f : 0, b !== a + E && (l.__u |= 65536))) : (h = s[a]) && h.key == null && h.__e && (h.__e == r.__d && (r.__d = GB(h)), TBe(h, h, !1), s[a] = null, S--); - if (S) - for (a = 0; a < O; a++) - (h = s[a]) != null && (131072 & h.__u) == 0 && (h.__e == r.__d && (r.__d = GB(h)), TBe(h, h)); -} -function HAt(r, n, s) { - var a, l; - if (typeof r.type == "function") { - for (a = r.__k, l = 0; a && l < a.length; l++) - a[l] && (a[l].__ = r, n = HAt(a[l], n, s)); - return n; + return iZ(t); } - return r.__e != n && (s.insertBefore(r.__e, n || null), n = r.__e), n && n.nextSibling; } -function Z6(r, n) { - return n = n || [], r == null || typeof r == "boolean" || (B2e(r) ? r.some(function(s) { - Z6(s, n); - }) : n.push(r)), n; +function mA(t) { + (!t.__d && (t.__d = !0) && dd.push(t) && !h5.__r++ || a$ !== $t.debounceRendering) && ((a$ = $t.debounceRendering) || eZ)(h5); } -function y3n(r, n, s, a) { - var l = r.key, h = r.type, f = s - 1, b = s + 1, w = n[s]; - if (w === null || w && l == w.key && h === w.type) - return s; - if (a > (w != null && (131072 & w.__u) == 0 ? 1 : 0)) - for (; f >= 0 || b < n.length; ) { - if (f >= 0) { - if ((w = n[f]) && (131072 & w.__u) == 0 && l == w.key && h === w.type) - return f; - f--; +function h5() { + var t, e, r, n, i, s, a, o, l; + for (dd.sort(gA); t = dd.shift(); ) + t.__d && (e = dd.length, n = void 0, s = (i = (r = t).__v).__e, o = [], l = [], (a = r.__P) && ((n = yu({}, i)).__v = i.__v + 1, $t.vnode && $t.vnode(n), yR(a, n, i, r.__n, a.ownerSVGElement !== void 0, 32 & i.__u ? [s] : null, o, s == null ? vg(i) : s, !!(32 & i.__u), l), n.__.__k[n.__i] = n, oZ(o, n, l), n.__e != s && iZ(n)), dd.length > e && dd.sort(gA)); + h5.__r = 0; +} +function sZ(t, e, r, n, i, s, a, o, l, u, h) { + var f, d, p, g, m, v = n && n.__k || rZ, y = e.length; + for (r.__d = l, Hve(r, e, v), l = r.__d, f = 0; f < y; f++) + (p = r.__k[f]) != null && typeof p != "boolean" && typeof p != "function" && (d = p.__i === -1 ? my : v[p.__i] || my, p.__i = f, yR(t, p, d, i, s, a, o, l, u, h), g = p.__e, p.ref && d.ref != p.ref && (d.ref && bR(d.ref, null, p), h.push(p.ref, p.__c || g, p)), m == null && g != null && (m = g), 65536 & p.__u || d.__k === p.__k ? l = aZ(p, l, t) : typeof p.type == "function" && p.__d !== void 0 ? l = p.__d : g && (l = g.nextSibling), p.__d = void 0, p.__u &= -196609); + r.__d = l, r.__e = m; +} +function Hve(t, e, r) { + var n, i, s, a, o, l = e.length, u = r.length, h = u, f = 0; + for (t.__k = [], n = 0; n < l; n++) + (i = t.__k[n] = (i = e[n]) == null || typeof i == "boolean" || typeof i == "function" ? null : typeof i == "string" || typeof i == "number" || typeof i == "bigint" || i.constructor == String ? zv(null, i, null, null, i) : kS(i) ? zv(Nu, { children: i }, null, null, null) : i.constructor === void 0 && i.__b > 0 ? zv(i.type, i.props, i.key, i.ref ? i.ref : null, i.__v) : i) != null ? (i.__ = t, i.__b = t.__b + 1, o = Xve(i, r, a = n + f, h), i.__i = o, s = null, o !== -1 && (h--, (s = r[o]) && (s.__u |= 131072)), s == null || s.__v === null ? (o == -1 && f--, typeof i.type != "function" && (i.__u |= 65536)) : o !== a && (o === a + 1 ? f++ : o > a ? h > l - a ? f += o - a : f-- : f = o < a && o == a - 1 ? o - a : 0, o !== n + f && (i.__u |= 65536))) : (s = r[n]) && s.key == null && s.__e && (s.__e == t.__d && (t.__d = vg(s)), vA(s, s, !1), r[n] = null, h--); + if (h) + for (n = 0; n < u; n++) + (s = r[n]) != null && (131072 & s.__u) == 0 && (s.__e == t.__d && (t.__d = vg(s)), vA(s, s)); +} +function aZ(t, e, r) { + var n, i; + if (typeof t.type == "function") { + for (n = t.__k, i = 0; n && i < n.length; i++) + n[i] && (n[i].__ = t, e = aZ(n[i], e, r)); + return e; + } + return t.__e != e && (r.insertBefore(t.__e, e || null), e = t.__e), e && e.nextSibling; +} +function Su(t, e) { + return e = e || [], t == null || typeof t == "boolean" || (kS(t) ? t.some(function(r) { + Su(r, e); + }) : e.push(t)), e; +} +function Xve(t, e, r, n) { + var i = t.key, s = t.type, a = r - 1, o = r + 1, l = e[r]; + if (l === null || l && i == l.key && s === l.type) + return r; + if (n > (l != null && (131072 & l.__u) == 0 ? 1 : 0)) + for (; a >= 0 || o < e.length; ) { + if (a >= 0) { + if ((l = e[a]) && (131072 & l.__u) == 0 && i == l.key && s === l.type) + return a; + a--; } - if (b < n.length) { - if ((w = n[b]) && (131072 & w.__u) == 0 && l == w.key && h === w.type) - return b; - b++; + if (o < e.length) { + if ((l = e[o]) && (131072 & l.__u) == 0 && i == l.key && s === l.type) + return o; + o++; } } return -1; } -function P6t(r, n, s) { - n[0] === "-" ? r.setProperty(n, s == null ? "" : s) : r[n] = s == null ? "" : typeof s != "number" || b3n.test(n) ? s : s + "px"; +function o$(t, e, r) { + e[0] === "-" ? t.setProperty(e, r == null ? "" : r) : t[e] = r == null ? "" : typeof r != "number" || Wve.test(e) ? r : r + "px"; } -function Age(r, n, s, a, l) { - var h; +function nw(t, e, r, n, i) { + var s; e: - if (n === "style") - if (typeof s == "string") - r.style.cssText = s; + if (e === "style") + if (typeof r == "string") + t.style.cssText = r; else { - if (typeof a == "string" && (r.style.cssText = a = ""), a) - for (n in a) - s && n in s || P6t(r.style, n, ""); - if (s) - for (n in s) - a && s[n] === a[n] || P6t(r.style, n, s[n]); - } - else if (n[0] === "o" && n[1] === "n") - h = n !== (n = n.replace(/(PointerCapture)$|Capture$/, "$1")), n = n.toLowerCase() in r ? n.toLowerCase().slice(2) : n.slice(2), r.l || (r.l = {}), r.l[n + h] = s, s ? a ? s.u = a.u : (s.u = Date.now(), r.addEventListener(n, h ? I6t : L6t, h)) : r.removeEventListener(n, h ? I6t : L6t, h); + if (typeof n == "string" && (t.style.cssText = n = ""), n) + for (e in n) + r && e in r || o$(t.style, e, ""); + if (r) + for (e in r) + n && r[e] === n[e] || o$(t.style, e, r[e]); + } + else if (e[0] === "o" && e[1] === "n") + s = e !== (e = e.replace(/(PointerCapture)$|Capture$/, "$1")), e = e.toLowerCase() in t ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = Date.now(), t.addEventListener(e, s ? c$ : l$, s)) : t.removeEventListener(e, s ? c$ : l$, s); else { - if (l) - n = n.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); - else if (n !== "width" && n !== "height" && n !== "href" && n !== "list" && n !== "form" && n !== "tabIndex" && n !== "download" && n !== "rowSpan" && n !== "colSpan" && n !== "role" && n in r) + if (i) + e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); + else if (e !== "width" && e !== "height" && e !== "href" && e !== "list" && e !== "form" && e !== "tabIndex" && e !== "download" && e !== "rowSpan" && e !== "colSpan" && e !== "role" && e in t) try { - r[n] = s == null ? "" : s; + t[e] = r == null ? "" : r; break e; } catch { } - typeof s == "function" || (s == null || s === !1 && n[4] !== "-" ? r.removeAttribute(n) : r.setAttribute(n, s)); + typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, r)); } } -function L6t(r) { - var n = this.l[r.type + !1]; - if (r.t) { - if (r.t <= n.u) +function l$(t) { + var e = this.l[t.type + !1]; + if (t.t) { + if (t.t <= e.u) return; } else - r.t = Date.now(); - return n(qs.event ? qs.event(r) : r); + t.t = Date.now(); + return e($t.event ? $t.event(t) : t); } -function I6t(r) { - return this.l[r.type + !0](qs.event ? qs.event(r) : r); +function c$(t) { + return this.l[t.type + !0]($t.event ? $t.event(t) : t); } -function UQe(r, n, s, a, l, h, f, b, w, O) { - var S, E, D, M, B, z, W, H, G, ee, le, se, he, te, be, fe = n.type; - if (n.constructor !== void 0) +function yR(t, e, r, n, i, s, a, o, l, u) { + var h, f, d, p, g, m, v, y, b, w, O, S, C, T, A, E = e.type; + if (e.constructor !== void 0) return null; - 128 & s.__u && (w = !!(32 & s.__u), h = [b = n.__e = s.__e]), (S = qs.__b) && S(n); + 128 & r.__u && (l = !!(32 & r.__u), s = [o = e.__e = r.__e]), (h = $t.__b) && h(e); e: - if (typeof fe == "function") + if (typeof E == "function") try { - if (H = n.props, G = (S = fe.contextType) && a[S.__c], ee = S ? G ? G.props.value : S.__ : a, s.__c ? W = (E = n.__c = s.__c).__ = E.__E : ("prototype" in fe && fe.prototype.render ? n.__c = E = new fe(H, ee) : (n.__c = E = new ex(H, ee), E.constructor = fe, E.render = k3n), G && G.sub(E), E.props = H, E.state || (E.state = {}), E.context = ee, E.__n = a, D = E.__d = !0, E.__h = [], E._sb = []), E.__s == null && (E.__s = E.state), fe.getDerivedStateFromProps != null && (E.__s == E.state && (E.__s = z6({}, E.__s)), z6(E.__s, fe.getDerivedStateFromProps(H, E.__s))), M = E.props, B = E.state, E.__v = n, D) - fe.getDerivedStateFromProps == null && E.componentWillMount != null && E.componentWillMount(), E.componentDidMount != null && E.__h.push(E.componentDidMount); + if (y = e.props, b = (h = E.contextType) && n[h.__c], w = h ? b ? b.props.value : h.__ : n, r.__c ? v = (f = e.__c = r.__c).__ = f.__E : ("prototype" in E && E.prototype.render ? e.__c = f = new E(y, w) : (e.__c = f = new Ec(y, w), f.constructor = E, f.render = jve), b && b.sub(f), f.props = y, f.state || (f.state = {}), f.context = w, f.__n = n, d = f.__d = !0, f.__h = [], f._sb = []), f.__s == null && (f.__s = f.state), E.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = yu({}, f.__s)), yu(f.__s, E.getDerivedStateFromProps(y, f.__s))), p = f.props, g = f.state, f.__v = e, d) + E.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), f.componentDidMount != null && f.__h.push(f.componentDidMount); else { - if (fe.getDerivedStateFromProps == null && H !== M && E.componentWillReceiveProps != null && E.componentWillReceiveProps(H, ee), !E.__e && (E.shouldComponentUpdate != null && E.shouldComponentUpdate(H, E.__s, ee) === !1 || n.__v === s.__v)) { - for (n.__v !== s.__v && (E.props = H, E.state = E.__s, E.__d = !1), n.__e = s.__e, n.__k = s.__k, n.__k.forEach(function(ae) { - ae && (ae.__ = n); - }), le = 0; le < E._sb.length; le++) - E.__h.push(E._sb[le]); - E._sb = [], E.__h.length && f.push(E); + if (E.getDerivedStateFromProps == null && y !== p && f.componentWillReceiveProps != null && f.componentWillReceiveProps(y, w), !f.__e && (f.shouldComponentUpdate != null && f.shouldComponentUpdate(y, f.__s, w) === !1 || e.__v === r.__v)) { + for (e.__v !== r.__v && (f.props = y, f.state = f.__s, f.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.forEach(function(L) { + L && (L.__ = e); + }), O = 0; O < f._sb.length; O++) + f.__h.push(f._sb[O]); + f._sb = [], f.__h.length && a.push(f); break e; } - E.componentWillUpdate != null && E.componentWillUpdate(H, E.__s, ee), E.componentDidUpdate != null && E.__h.push(function() { - E.componentDidUpdate(M, B, z); + f.componentWillUpdate != null && f.componentWillUpdate(y, f.__s, w), f.componentDidUpdate != null && f.__h.push(function() { + f.componentDidUpdate(p, g, m); }); } - if (E.context = ee, E.props = H, E.__P = r, E.__e = !1, se = qs.__r, he = 0, "prototype" in fe && fe.prototype.render) { - for (E.state = E.__s, E.__d = !1, se && se(n), S = E.render(E.props, E.state, E.context), te = 0; te < E._sb.length; te++) - E.__h.push(E._sb[te]); - E._sb = []; + if (f.context = w, f.props = y, f.__P = t, f.__e = !1, S = $t.__r, C = 0, "prototype" in E && E.prototype.render) { + for (f.state = f.__s, f.__d = !1, S && S(e), h = f.render(f.props, f.state, f.context), T = 0; T < f._sb.length; T++) + f.__h.push(f._sb[T]); + f._sb = []; } else do - E.__d = !1, se && se(n), S = E.render(E.props, E.state, E.context), E.state = E.__s; - while (E.__d && ++he < 25); - E.state = E.__s, E.getChildContext != null && (a = z6(z6({}, a), E.getChildContext())), D || E.getSnapshotBeforeUpdate == null || (z = E.getSnapshotBeforeUpdate(M, B)), YAt(r, B2e(be = S != null && S.type === i_ && S.key == null ? S.props.children : S) ? be : [be], n, s, a, l, h, f, b, w, O), E.base = n.__e, n.__u &= -161, E.__h.length && f.push(E), W && (E.__E = E.__ = null); - } catch (ae) { - n.__v = null, w || h != null ? (n.__e = b, n.__u |= w ? 160 : 32, h[h.indexOf(b)] = null) : (n.__e = s.__e, n.__k = s.__k), qs.__e(ae, n, s); + f.__d = !1, S && S(e), h = f.render(f.props, f.state, f.context), f.state = f.__s; + while (f.__d && ++C < 25); + f.state = f.__s, f.getChildContext != null && (n = yu(yu({}, n), f.getChildContext())), d || f.getSnapshotBeforeUpdate == null || (m = f.getSnapshotBeforeUpdate(p, g)), sZ(t, kS(A = h != null && h.type === Nu && h.key == null ? h.props.children : h) ? A : [A], e, r, n, i, s, a, o, l, u), f.base = e.__e, e.__u &= -161, f.__h.length && a.push(f), v && (f.__E = f.__ = null); + } catch (L) { + e.__v = null, l || s != null ? (e.__e = o, e.__u |= l ? 160 : 32, s[s.indexOf(o)] = null) : (e.__e = r.__e, e.__k = r.__k), $t.__e(L, e, r); } else - h == null && n.__v === s.__v ? (n.__k = s.__k, n.__e = s.__e) : n.__e = O3n(s.__e, n, s, a, l, h, f, w, O); - (S = qs.diffed) && S(n); -} -function GAt(r, n, s) { - n.__d = void 0; - for (var a = 0; a < s.length; a++) - WQe(s[a], s[++a], s[++a]); - qs.__c && qs.__c(n, r), r.some(function(l) { + s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : e.__e = Zve(r.__e, e, r, n, i, s, a, l, u); + (h = $t.diffed) && h(e); +} +function oZ(t, e, r) { + e.__d = void 0; + for (var n = 0; n < r.length; n++) + bR(r[n], r[++n], r[++n]); + $t.__c && $t.__c(e, t), t.some(function(i) { try { - r = l.__h, l.__h = [], r.some(function(h) { - h.call(l); + t = i.__h, i.__h = [], t.some(function(s) { + s.call(i); }); - } catch (h) { - qs.__e(h, l.__v); + } catch (s) { + $t.__e(s, i.__v); } }); } -function O3n(r, n, s, a, l, h, f, b, w) { - var O, S, E, D, M, B, z, W = s.props, H = n.props, G = n.type; - if (G === "svg" && (l = !0), h != null) { - for (O = 0; O < h.length; O++) - if ((M = h[O]) && "setAttribute" in M == !!G && (G ? M.localName === G : M.nodeType === 3)) { - r = M, h[O] = null; +function Zve(t, e, r, n, i, s, a, o, l) { + var u, h, f, d, p, g, m, v = r.props, y = e.props, b = e.type; + if (b === "svg" && (i = !0), s != null) { + for (u = 0; u < s.length; u++) + if ((p = s[u]) && "setAttribute" in p == !!b && (b ? p.localName === b : p.nodeType === 3)) { + t = p, s[u] = null; break; } } - if (r == null) { - if (G === null) - return document.createTextNode(H); - r = l ? document.createElementNS("http://www.w3.org/2000/svg", G) : document.createElement(G, H.is && H), h = null, b = !1; + if (t == null) { + if (b === null) + return document.createTextNode(y); + t = i ? document.createElementNS("http://www.w3.org/2000/svg", b) : document.createElement(b, y.is && y), s = null, o = !1; } - if (G === null) - W === H || b && r.data === H || (r.data = H); + if (b === null) + v === y || o && t.data === y || (t.data = y); else { - if (h = h && AJ.call(r.childNodes), W = s.props || aK, !b && h != null) - for (W = {}, O = 0; O < r.attributes.length; O++) - W[(M = r.attributes[O]).name] = M.value; - for (O in W) - M = W[O], O == "children" || (O == "dangerouslySetInnerHTML" ? E = M : O === "key" || O in H || Age(r, O, null, M, l)); - for (O in H) - M = H[O], O == "children" ? D = M : O == "dangerouslySetInnerHTML" ? S = M : O == "value" ? B = M : O == "checked" ? z = M : O === "key" || b && typeof M != "function" || W[O] === M || Age(r, O, M, W[O], l); - if (S) - b || E && (S.__html === E.__html || S.__html === r.innerHTML) || (r.innerHTML = S.__html), n.__k = []; - else if (E && (r.innerHTML = ""), YAt(r, B2e(D) ? D : [D], n, s, a, l && G !== "foreignObject", h, f, h ? h[0] : s.__k && GB(s, 0), b, w), h != null) - for (O = h.length; O--; ) - h[O] != null && UAt(h[O]); - b || (O = "value", B !== void 0 && (B !== r[O] || G === "progress" && !B || G === "option" && B !== W[O]) && Age(r, O, B, W[O], !1), O = "checked", z !== void 0 && z !== r[O] && Age(r, O, z, W[O], !1)); + if (s = s && Vb.call(t.childNodes), v = r.props || my, !o && s != null) + for (v = {}, u = 0; u < t.attributes.length; u++) + v[(p = t.attributes[u]).name] = p.value; + for (u in v) + p = v[u], u == "children" || (u == "dangerouslySetInnerHTML" ? f = p : u === "key" || u in y || nw(t, u, null, p, i)); + for (u in y) + p = y[u], u == "children" ? d = p : u == "dangerouslySetInnerHTML" ? h = p : u == "value" ? g = p : u == "checked" ? m = p : u === "key" || o && typeof p != "function" || v[u] === p || nw(t, u, p, v[u], i); + if (h) + o || f && (h.__html === f.__html || h.__html === t.innerHTML) || (t.innerHTML = h.__html), e.__k = []; + else if (f && (t.innerHTML = ""), sZ(t, kS(d) ? d : [d], e, r, n, i && b !== "foreignObject", s, a, s ? s[0] : r.__k && vg(r, 0), o, l), s != null) + for (u = s.length; u--; ) + s[u] != null && nZ(s[u]); + o || (u = "value", g !== void 0 && (g !== t[u] || b === "progress" && !g || b === "option" && g !== v[u]) && nw(t, u, g, v[u], !1), u = "checked", m !== void 0 && m !== t[u] && nw(t, u, m, v[u], !1)); } - return r; + return t; } -function WQe(r, n, s) { +function bR(t, e, r) { try { - typeof r == "function" ? r(n) : r.current = n; - } catch (a) { - qs.__e(a, s); + typeof t == "function" ? t(e) : t.current = e; + } catch (n) { + $t.__e(n, r); } } -function TBe(r, n, s) { - var a, l; - if (qs.unmount && qs.unmount(r), (a = r.ref) && (a.current && a.current !== r.__e || WQe(a, null, n)), (a = r.__c) != null) { - if (a.componentWillUnmount) +function vA(t, e, r) { + var n, i; + if ($t.unmount && $t.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || bR(n, null, e)), (n = t.__c) != null) { + if (n.componentWillUnmount) try { - a.componentWillUnmount(); - } catch (h) { - qs.__e(h, n); - } - a.base = a.__P = null, r.__c = void 0; - } - if (a = r.__k) - for (l = 0; l < a.length; l++) - a[l] && TBe(a[l], n, s || typeof r.type != "function"); - s || r.__e == null || UAt(r.__e), r.__ = r.__e = r.__d = void 0; -} -function k3n(r, n, s) { - return this.constructor(r, s); -} -function ZB(r, n, s) { - var a, l, h, f; - qs.__ && qs.__(r, n), l = (a = typeof s == "function") ? null : s && s.__k || n.__k, h = [], f = [], UQe(n, r = (!a && s || n).__k = pk(i_, null, [r]), l || aK, aK, n.ownerSVGElement !== void 0, !a && s ? [s] : l ? null : n.firstChild ? AJ.call(n.childNodes) : null, h, !a && s ? s : l ? l.__e : n.firstChild, a, f), GAt(h, r, f); -} -function ZAt(r, n) { - ZB(r, n, ZAt); -} -function x3n(r, n, s) { - var a, l, h, f, b = z6({}, r.props); - for (h in r.type && r.type.defaultProps && (f = r.type.defaultProps), n) - h == "key" ? a = n[h] : h == "ref" ? l = n[h] : b[h] = n[h] === void 0 && f !== void 0 ? f[h] : n[h]; - return arguments.length > 2 && (b.children = arguments.length > 3 ? AJ.call(arguments, 2) : s), NX(r.type, b, a || r.key, l || r.ref, null); -} -function S3n(r, n) { - var s = { __c: n = "__cC" + qAt++, __: r, Consumer: function(a, l) { - return a.children(l); - }, Provider: function(a) { - var l, h; - return this.getChildContext || (l = [], (h = {})[n] = this, this.getChildContext = function() { - return h; - }, this.shouldComponentUpdate = function(f) { - this.props.value !== f.value && l.some(function(b) { - b.__e = !0, EBe(b); + n.componentWillUnmount(); + } catch (s) { + $t.__e(s, e); + } + n.base = n.__P = null, t.__c = void 0; + } + if (n = t.__k) + for (i = 0; i < n.length; i++) + n[i] && vA(n[i], e, r || typeof t.type != "function"); + r || t.__e == null || nZ(t.__e), t.__ = t.__e = t.__d = void 0; +} +function jve(t, e, r) { + return this.constructor(t, r); +} +function yg(t, e, r) { + var n, i, s, a; + $t.__ && $t.__(t, e), i = (n = typeof r == "function") ? null : r && r.__k || e.__k, s = [], a = [], yR(e, t = (!n && r || e).__k = Rl(Nu, null, [t]), i || my, my, e.ownerSVGElement !== void 0, !n && r ? [r] : i ? null : e.firstChild ? Vb.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, a), oZ(s, t, a); +} +function lZ(t, e) { + yg(t, e, lZ); +} +function Kve(t, e, r) { + var n, i, s, a, o = yu({}, t.props); + for (s in t.type && t.type.defaultProps && (a = t.type.defaultProps), e) + s == "key" ? n = e[s] : s == "ref" ? i = e[s] : o[s] = e[s] === void 0 && a !== void 0 ? a[s] : e[s]; + return arguments.length > 2 && (o.children = arguments.length > 3 ? Vb.call(arguments, 2) : r), zv(t.type, o, n || t.key, i || t.ref, null); +} +function Jve(t, e) { + var r = { __c: e = "__cC" + tZ++, __: t, Consumer: function(n, i) { + return n.children(i); + }, Provider: function(n) { + var i, s; + return this.getChildContext || (i = [], (s = {})[e] = this, this.getChildContext = function() { + return s; + }, this.shouldComponentUpdate = function(a) { + this.props.value !== a.value && i.some(function(o) { + o.__e = !0, mA(o); }); - }, this.sub = function(f) { - l.push(f); - var b = f.componentWillUnmount; - f.componentWillUnmount = function() { - l.splice(l.indexOf(f), 1), b && b.call(f); + }, this.sub = function(a) { + i.push(a); + var o = a.componentWillUnmount; + a.componentWillUnmount = function() { + i.splice(i.indexOf(a), 1), o && o.call(a); }; - }), a.children; + }), n.children; } }; - return s.Provider.__ = s.Consumer.contextType = s; + return r.Provider.__ = r.Consumer.contextType = r; } -AJ = VAt.slice, qs = { __e: function(r, n, s, a) { - for (var l, h, f; n = n.__; ) - if ((l = n.__c) && !l.__) +Vb = rZ.slice, $t = { __e: function(t, e, r, n) { + for (var i, s, a; e = e.__; ) + if ((i = e.__c) && !i.__) try { - if ((h = l.constructor) && h.getDerivedStateFromError != null && (l.setState(h.getDerivedStateFromError(r)), f = l.__d), l.componentDidCatch != null && (l.componentDidCatch(r, a || {}), f = l.__d), f) - return l.__E = l; - } catch (b) { - r = b; + if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), a = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), a = i.__d), a) + return i.__E = i; + } catch (o) { + t = o; } - throw r; -} }, QAt = 0, ex.prototype.setState = function(r, n) { - var s; - s = this.__s != null && this.__s !== this.state ? this.__s : this.__s = z6({}, this.state), typeof r == "function" && (r = r(z6({}, s), this.props)), r && z6(s, r), r != null && this.__v && (n && this._sb.push(n), EBe(this)); -}, ex.prototype.forceUpdate = function(r) { - this.__v && (this.__e = !0, r && this.__h.push(r), EBe(this)); -}, ex.prototype.render = i_, MM = [], zAt = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, CBe = function(r, n) { - return r.__v.__b - n.__v.__b; -}, Nbe.__r = 0, qAt = 0; -var f8, Dh, cRe, N6t, XB = 0, XAt = [], Rme = [], R6t = qs.__b, $6t = qs.__r, B6t = qs.diffed, F6t = qs.__c, j6t = qs.unmount; -function WF(r, n) { - qs.__h && qs.__h(Dh, r, XB || n), XB = 0; - var s = Dh.__H || (Dh.__H = { __: [], __h: [] }); - return r >= s.__.length && s.__.push({ __V: Rme }), s.__[r]; -} -function _f(r) { - return XB = 1, F2e(JAt, r); -} -function F2e(r, n, s) { - var a = WF(f8++, 2); - if (a.t = r, !a.__c && (a.__ = [s ? s(n) : JAt(void 0, n), function(b) { - var w = a.__N ? a.__N[0] : a.__[0], O = a.t(w, b); - w !== O && (a.__N = [O, a.__[1]], a.__c.setState({})); - }], a.__c = Dh, !Dh.u)) { - var l = function(b, w, O) { - if (!a.__c.__H) + throw t; +} }, JX = 0, Ec.prototype.setState = function(t, e) { + var r; + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = yu({}, this.state), typeof t == "function" && (t = t(yu({}, r), this.props)), t && yu(r, t), t != null && this.__v && (e && this._sb.push(e), mA(this)); +}, Ec.prototype.forceUpdate = function(t) { + this.__v && (this.__e = !0, t && this.__h.push(t), mA(this)); +}, Ec.prototype.render = Nu, dd = [], eZ = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, gA = function(t, e) { + return t.__v.__b - e.__v.__b; +}, h5.__r = 0, tZ = 0; +var nf, vn, nE, u$, bg = 0, cZ = [], GO = [], h$ = $t.__b, f$ = $t.__r, d$ = $t.diffed, p$ = $t.__c, g$ = $t.unmount; +function R1(t, e) { + $t.__h && $t.__h(vn, t, bg || e), bg = 0; + var r = vn.__H || (vn.__H = { __: [], __h: [] }); + return t >= r.__.length && r.__.push({ __V: GO }), r.__[t]; +} +function Rn(t) { + return bg = 1, SS(hZ, t); +} +function SS(t, e, r) { + var n = R1(nf++, 2); + if (n.t = t, !n.__c && (n.__ = [r ? r(e) : hZ(void 0, e), function(o) { + var l = n.__N ? n.__N[0] : n.__[0], u = n.t(l, o); + l !== u && (n.__N = [u, n.__[1]], n.__c.setState({})); + }], n.__c = vn, !vn.u)) { + var i = function(o, l, u) { + if (!n.__c.__H) return !0; - var S = a.__c.__H.__.filter(function(D) { - return D.__c; + var h = n.__c.__H.__.filter(function(d) { + return d.__c; }); - if (S.every(function(D) { - return !D.__N; + if (h.every(function(d) { + return !d.__N; })) - return !h || h.call(this, b, w, O); - var E = !1; - return S.forEach(function(D) { - if (D.__N) { - var M = D.__[0]; - D.__ = D.__N, D.__N = void 0, M !== D.__[0] && (E = !0); - } - }), !(!E && a.__c.props === b) && (!h || h.call(this, b, w, O)); + return !s || s.call(this, o, l, u); + var f = !1; + return h.forEach(function(d) { + if (d.__N) { + var p = d.__[0]; + d.__ = d.__N, d.__N = void 0, p !== d.__[0] && (f = !0); + } + }), !(!f && n.__c.props === o) && (!s || s.call(this, o, l, u)); }; - Dh.u = !0; - var h = Dh.shouldComponentUpdate, f = Dh.componentWillUpdate; - Dh.componentWillUpdate = function(b, w, O) { + vn.u = !0; + var s = vn.shouldComponentUpdate, a = vn.componentWillUpdate; + vn.componentWillUpdate = function(o, l, u) { if (this.__e) { - var S = h; - h = void 0, l(b, w, O), h = S; + var h = s; + s = void 0, i(o, l, u), s = h; } - f && f.call(this, b, w, O); - }, Dh.shouldComponentUpdate = l; + a && a.call(this, o, l, u); + }, vn.shouldComponentUpdate = i; } - return a.__N || a.__; + return n.__N || n.__; } -function H0(r, n) { - var s = WF(f8++, 3); - !qs.__s && YQe(s.__H, n) && (s.__ = r, s.i = n, Dh.__H.__h.push(s)); +function Qi(t, e) { + var r = R1(nf++, 3); + !$t.__s && xR(r.__H, e) && (r.__ = t, r.i = e, vn.__H.__h.push(r)); } -function j2e(r, n) { - var s = WF(f8++, 4); - !qs.__s && YQe(s.__H, n) && (s.__ = r, s.i = n, Dh.__h.push(s)); +function TS(t, e) { + var r = R1(nf++, 4); + !$t.__s && xR(r.__H, e) && (r.__ = t, r.i = e, vn.__h.push(r)); } -function F2(r) { - return XB = 5, Fd(function() { - return { current: r }; +function io(t) { + return bg = 5, ei(function() { + return { current: t }; }, []); } -function _3n(r, n, s) { - XB = 6, j2e(function() { - return typeof r == "function" ? (r(n()), function() { - return r(null); - }) : r ? (r.current = n(), function() { - return r.current = null; +function eye(t, e, r) { + bg = 6, TS(function() { + return typeof t == "function" ? (t(e()), function() { + return t(null); + }) : t ? (t.current = e(), function() { + return t.current = null; }) : void 0; - }, s == null ? s : s.concat(r)); + }, r == null ? r : r.concat(t)); } -function Fd(r, n) { - var s = WF(f8++, 7); - return YQe(s.__H, n) ? (s.__V = r(), s.i = n, s.__h = r, s.__V) : s.__; +function ei(t, e) { + var r = R1(nf++, 7); + return xR(r.__H, e) ? (r.__V = t(), r.i = e, r.__h = t, r.__V) : r.__; } -function Rbe(r, n) { - return XB = 8, Fd(function() { - return r; - }, n); +function f5(t, e) { + return bg = 8, ei(function() { + return t; + }, e); } -function KAt(r) { - var n = Dh.context[r.__c], s = WF(f8++, 9); - return s.c = r, n ? (s.__ == null && (s.__ = !0, n.sub(Dh)), n.props.value) : r.__; +function uZ(t) { + var e = vn.context[t.__c], r = R1(nf++, 9); + return r.c = t, e ? (r.__ == null && (r.__ = !0, e.sub(vn)), e.props.value) : t.__; } -function ABe(r, n) { - qs.useDebugValue && qs.useDebugValue(n ? n(r) : r); +function yA(t, e) { + $t.useDebugValue && $t.useDebugValue(e ? e(t) : t); } -function C3n() { - var r = WF(f8++, 11); - if (!r.__) { - for (var n = Dh.__v; n !== null && !n.__m && n.__ !== null; ) - n = n.__; - var s = n.__m || (n.__m = [0, 0]); - r.__ = "P" + s[0] + "-" + s[1]++; +function tye() { + var t = R1(nf++, 11); + if (!t.__) { + for (var e = vn.__v; e !== null && !e.__m && e.__ !== null; ) + e = e.__; + var r = e.__m || (e.__m = [0, 0]); + t.__ = "P" + r[0] + "-" + r[1]++; } - return r.__; + return t.__; } -function E3n() { - for (var r; r = XAt.shift(); ) - if (r.__P && r.__H) +function rye() { + for (var t; t = cZ.shift(); ) + if (t.__P && t.__H) try { - r.__H.__h.forEach($me), r.__H.__h.forEach(DBe), r.__H.__h = []; - } catch (n) { - r.__H.__h = [], qs.__e(n, r.__v); - } -} -qs.__b = function(r) { - Dh = null, R6t && R6t(r); -}, qs.__r = function(r) { - $6t && $6t(r), f8 = 0; - var n = (Dh = r.__c).__H; - n && (cRe === Dh ? (n.__h = [], Dh.__h = [], n.__.forEach(function(s) { - s.__N && (s.__ = s.__N), s.__V = Rme, s.__N = s.i = void 0; - })) : (n.__h.forEach($me), n.__h.forEach(DBe), n.__h = [], f8 = 0)), cRe = Dh; -}, qs.diffed = function(r) { - B6t && B6t(r); - var n = r.__c; - n && n.__H && (n.__H.__h.length && (XAt.push(n) !== 1 && N6t === qs.requestAnimationFrame || ((N6t = qs.requestAnimationFrame) || T3n)(E3n)), n.__H.__.forEach(function(s) { - s.i && (s.__H = s.i), s.__V !== Rme && (s.__ = s.__V), s.i = void 0, s.__V = Rme; - })), cRe = Dh = null; -}, qs.__c = function(r, n) { - n.some(function(s) { + t.__H.__h.forEach(HO), t.__H.__h.forEach(bA), t.__H.__h = []; + } catch (e) { + t.__H.__h = [], $t.__e(e, t.__v); + } +} +$t.__b = function(t) { + vn = null, h$ && h$(t); +}, $t.__r = function(t) { + f$ && f$(t), nf = 0; + var e = (vn = t.__c).__H; + e && (nE === vn ? (e.__h = [], vn.__h = [], e.__.forEach(function(r) { + r.__N && (r.__ = r.__N), r.__V = GO, r.__N = r.i = void 0; + })) : (e.__h.forEach(HO), e.__h.forEach(bA), e.__h = [], nf = 0)), nE = vn; +}, $t.diffed = function(t) { + d$ && d$(t); + var e = t.__c; + e && e.__H && (e.__H.__h.length && (cZ.push(e) !== 1 && u$ === $t.requestAnimationFrame || ((u$ = $t.requestAnimationFrame) || nye)(rye)), e.__H.__.forEach(function(r) { + r.i && (r.__H = r.i), r.__V !== GO && (r.__ = r.__V), r.i = void 0, r.__V = GO; + })), nE = vn = null; +}, $t.__c = function(t, e) { + e.some(function(r) { try { - s.__h.forEach($me), s.__h = s.__h.filter(function(a) { - return !a.__ || DBe(a); + r.__h.forEach(HO), r.__h = r.__h.filter(function(n) { + return !n.__ || bA(n); }); - } catch (a) { - n.some(function(l) { - l.__h && (l.__h = []); - }), n = [], qs.__e(a, s.__v); - } - }), F6t && F6t(r, n); -}, qs.unmount = function(r) { - j6t && j6t(r); - var n, s = r.__c; - s && s.__H && (s.__H.__.forEach(function(a) { + } catch (n) { + e.some(function(i) { + i.__h && (i.__h = []); + }), e = [], $t.__e(n, r.__v); + } + }), p$ && p$(t, e); +}, $t.unmount = function(t) { + g$ && g$(t); + var e, r = t.__c; + r && r.__H && (r.__H.__.forEach(function(n) { try { - $me(a); - } catch (l) { - n = l; + HO(n); + } catch (i) { + e = i; } - }), s.__H = void 0, n && qs.__e(n, s.__v)); + }), r.__H = void 0, e && $t.__e(e, r.__v)); }; -var Q6t = typeof requestAnimationFrame == "function"; -function T3n(r) { - var n, s = function() { - clearTimeout(a), Q6t && cancelAnimationFrame(n), setTimeout(r); - }, a = setTimeout(s, 100); - Q6t && (n = requestAnimationFrame(s)); -} -function $me(r) { - var n = Dh, s = r.__c; - typeof s == "function" && (r.__c = void 0, s()), Dh = n; -} -function DBe(r) { - var n = Dh; - r.__c = r.__(), Dh = n; -} -function YQe(r, n) { - return !r || r.length !== n.length || n.some(function(s, a) { - return s !== r[a]; +var m$ = typeof requestAnimationFrame == "function"; +function nye(t) { + var e, r = function() { + clearTimeout(n), m$ && cancelAnimationFrame(e), setTimeout(t); + }, n = setTimeout(r, 100); + m$ && (e = requestAnimationFrame(r)); +} +function HO(t) { + var e = vn, r = t.__c; + typeof r == "function" && (t.__c = void 0, r()), vn = e; +} +function bA(t) { + var e = vn; + t.__c = t.__(), vn = e; +} +function xR(t, e) { + return !t || t.length !== e.length || e.some(function(r, n) { + return r !== t[n]; }); } -function JAt(r, n) { - return typeof n == "function" ? n(r) : n; +function hZ(t, e) { + return typeof e == "function" ? e(t) : e; } -var eDt = function(r, n, s, a) { - var l; - n[0] = 0; - for (var h = 1; h < n.length; h++) { - var f = n[h++], b = n[h] ? (n[0] |= f ? 1 : 2, s[n[h++]]) : n[++h]; - f === 3 ? a[0] = b : f === 4 ? a[1] = Object.assign(a[1] || {}, b) : f === 5 ? (a[1] = a[1] || {})[n[++h]] = b : f === 6 ? a[1][n[++h]] += b + "" : f ? (l = r.apply(b, eDt(r, b, s, ["", null])), a.push(l), b[0] ? n[0] |= 2 : (n[h - 2] = 0, n[h] = l)) : a.push(b); +var fZ = function(t, e, r, n) { + var i; + e[0] = 0; + for (var s = 1; s < e.length; s++) { + var a = e[s++], o = e[s] ? (e[0] |= a ? 1 : 2, r[e[s++]]) : e[++s]; + a === 3 ? n[0] = o : a === 4 ? n[1] = Object.assign(n[1] || {}, o) : a === 5 ? (n[1] = n[1] || {})[e[++s]] = o : a === 6 ? n[1][e[++s]] += o + "" : a ? (i = t.apply(o, fZ(t, o, r, ["", null])), n.push(i), o[0] ? e[0] |= 2 : (e[s - 2] = 0, e[s] = i)) : n.push(o); } - return a; -}, z6t = /* @__PURE__ */ new Map(); -function A3n(r) { - var n = z6t.get(this); - return n || (n = /* @__PURE__ */ new Map(), z6t.set(this, n)), (n = eDt(this, n.get(r) || (n.set(r, n = function(s) { - for (var a, l, h = 1, f = "", b = "", w = [0], O = function(D) { - h === 1 && (D || (f = f.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? w.push(0, D, f) : h === 3 && (D || f) ? (w.push(3, D, f), h = 2) : h === 2 && f === "..." && D ? w.push(4, D, 0) : h === 2 && f && !D ? w.push(5, 0, !0, f) : h >= 5 && ((f || !D && h === 5) && (w.push(h, 0, f, l), h = 6), D && (w.push(h, D, 0, l), h = 6)), f = ""; - }, S = 0; S < s.length; S++) { - S && (h === 1 && O(), O(S)); - for (var E = 0; E < s[S].length; E++) - a = s[S][E], h === 1 ? a === "<" ? (O(), w = [w], h = 3) : f += a : h === 4 ? f === "--" && a === ">" ? (h = 1, f = "") : f = a + f[0] : b ? a === b ? b = "" : f += a : a === '"' || a === "'" ? b = a : a === ">" ? (O(), h = 1) : h && (a === "=" ? (h = 5, l = f, f = "") : a === "/" && (h < 5 || s[S][E + 1] === ">") ? (O(), h === 3 && (w = w[0]), h = w, (w = w[0]).push(2, 0, h), h = 0) : a === " " || a === " " || a === ` -` || a === "\r" ? (O(), h = 2) : f += a), h === 3 && f === "!--" && (h = 4, w = w[0]); - } - return O(), w; - }(r)), n), arguments, [])).length > 1 ? n : n[0]; -} -var Vs = A3n.bind(pk), iv = function() { - return iv = Object.assign || function(n) { - for (var s, a = 1, l = arguments.length; a < l; a++) { - s = arguments[a]; - for (var h in s) - Object.prototype.hasOwnProperty.call(s, h) && (n[h] = s[h]); - } - return n; - }, iv.apply(this, arguments); + return n; +}, v$ = /* @__PURE__ */ new Map(); +function iye(t) { + var e = v$.get(this); + return e || (e = /* @__PURE__ */ new Map(), v$.set(this, e)), (e = fZ(this, e.get(t) || (e.set(t, e = function(r) { + for (var n, i, s = 1, a = "", o = "", l = [0], u = function(d) { + s === 1 && (d || (a = a.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? l.push(0, d, a) : s === 3 && (d || a) ? (l.push(3, d, a), s = 2) : s === 2 && a === "..." && d ? l.push(4, d, 0) : s === 2 && a && !d ? l.push(5, 0, !0, a) : s >= 5 && ((a || !d && s === 5) && (l.push(s, 0, a, i), s = 6), d && (l.push(s, d, 0, i), s = 6)), a = ""; + }, h = 0; h < r.length; h++) { + h && (s === 1 && u(), u(h)); + for (var f = 0; f < r[h].length; f++) + n = r[h][f], s === 1 ? n === "<" ? (u(), l = [l], s = 3) : a += n : s === 4 ? a === "--" && n === ">" ? (s = 1, a = "") : a = n + a[0] : o ? n === o ? o = "" : a += n : n === '"' || n === "'" ? o = n : n === ">" ? (u(), s = 1) : s && (n === "=" ? (s = 5, i = a, a = "") : n === "/" && (s < 5 || r[h][f + 1] === ">") ? (u(), s === 3 && (l = l[0]), s = l, (l = l[0]).push(2, 0, s), s = 0) : n === " " || n === " " || n === ` +` || n === "\r" ? (u(), s = 2) : a += n), s === 3 && a === "!--" && (s = 4, l = l[0]); + } + return u(), l; + }(t)), e), arguments, [])).length > 1 ? e : e[0]; +} +var Bt = iye.bind(Rl), Ra = function() { + return Ra = Object.assign || function(e) { + for (var r, n = 1, i = arguments.length; n < i; n++) { + r = arguments[n]; + for (var s in r) + Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]); + } + return e; + }, Ra.apply(this, arguments); }; -function KB(r, n, s) { - if (s || arguments.length === 2) - for (var a = 0, l = n.length, h; a < l; a++) - (h || !(a in n)) && (h || (h = Array.prototype.slice.call(n, 0, a)), h[a] = n[a]); - return r.concat(h || Array.prototype.slice.call(n)); -} -function D3n(r) { - var n = /* @__PURE__ */ Object.create(null); - return function(s) { - return n[s] === void 0 && (n[s] = r(s)), n[s]; +function xg(t, e, r) { + if (r || arguments.length === 2) + for (var n = 0, i = e.length, s; n < i; n++) + (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); + return t.concat(s || Array.prototype.slice.call(e)); +} +function sye(t) { + var e = /* @__PURE__ */ Object.create(null); + return function(r) { + return e[r] === void 0 && (e[r] = t(r)), e[r]; }; } -var M3n = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, P3n = /* @__PURE__ */ D3n( - function(r) { - return M3n.test(r) || r.charCodeAt(0) === 111 && r.charCodeAt(1) === 110 && r.charCodeAt(2) < 91; +var aye = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, oye = /* @__PURE__ */ sye( + function(t) { + return aye.test(t) || t.charCodeAt(0) === 111 && t.charCodeAt(1) === 110 && t.charCodeAt(2) < 91; } ); -function tDt(r, n) { - for (var s in n) - r[s] = n[s]; - return r; -} -function MBe(r, n) { - for (var s in r) - if (s !== "__source" && !(s in n)) +function dZ(t, e) { + for (var r in e) + t[r] = e[r]; + return t; +} +function xA(t, e) { + for (var r in t) + if (r !== "__source" && !(r in e)) return !0; - for (var a in n) - if (a !== "__source" && r[a] !== n[a]) + for (var n in e) + if (n !== "__source" && t[n] !== e[n]) return !0; return !1; } -function PBe(r) { - this.props = r; +function wA(t) { + this.props = t; } -function L3n(r, n) { - function s(l) { - var h = this.props.ref, f = h == l.ref; - return !f && h && (h.call ? h(null) : h.current = null), n ? !n(this.props, l) || !f : MBe(this.props, l); +function lye(t, e) { + function r(i) { + var s = this.props.ref, a = s == i.ref; + return !a && s && (s.call ? s(null) : s.current = null), e ? !e(this.props, i) || !a : xA(this.props, i); } - function a(l) { - return this.shouldComponentUpdate = s, pk(r, l); + function n(i) { + return this.shouldComponentUpdate = r, Rl(t, i); } - return a.displayName = "Memo(" + (r.displayName || r.name) + ")", a.prototype.isReactComponent = !0, a.__f = !0, a; + return n.displayName = "Memo(" + (t.displayName || t.name) + ")", n.prototype.isReactComponent = !0, n.__f = !0, n; } -(PBe.prototype = new ex()).isPureReactComponent = !0, PBe.prototype.shouldComponentUpdate = function(r, n) { - return MBe(this.props, r) || MBe(this.state, n); +(wA.prototype = new Ec()).isPureReactComponent = !0, wA.prototype.shouldComponentUpdate = function(t, e) { + return xA(this.props, t) || xA(this.state, e); }; -var q6t = qs.__b; -qs.__b = function(r) { - r.type && r.type.__f && r.ref && (r.props.ref = r.ref, r.ref = null), q6t && q6t(r); +var y$ = $t.__b; +$t.__b = function(t) { + t.type && t.type.__f && t.ref && (t.props.ref = t.ref, t.ref = null), y$ && y$(t); }; -var I3n = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911; -function N3n(r) { - function n(s) { - var a = tDt({}, s); - return delete a.ref, r(a, s.ref || null); - } - return n.$$typeof = I3n, n.render = n, n.prototype.isReactComponent = n.__f = !0, n.displayName = "ForwardRef(" + (r.displayName || r.name) + ")", n; -} -var V6t = function(r, n) { - return r == null ? null : Z6(Z6(r).map(n)); -}, R3n = { map: V6t, forEach: V6t, count: function(r) { - return r ? Z6(r).length : 0; -}, only: function(r) { - var n = Z6(r); - if (n.length !== 1) +var cye = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911; +function uye(t) { + function e(r) { + var n = dZ({}, r); + return delete n.ref, t(n, r.ref || null); + } + return e.$$typeof = cye, e.render = e, e.prototype.isReactComponent = e.__f = !0, e.displayName = "ForwardRef(" + (t.displayName || t.name) + ")", e; +} +var b$ = function(t, e) { + return t == null ? null : Su(Su(t).map(e)); +}, hye = { map: b$, forEach: b$, count: function(t) { + return t ? Su(t).length : 0; +}, only: function(t) { + var e = Su(t); + if (e.length !== 1) throw "Children.only"; - return n[0]; -}, toArray: Z6 }, $3n = qs.__e; -qs.__e = function(r, n, s, a) { - if (r.then) { - for (var l, h = n; h = h.__; ) - if ((l = h.__c) && l.__c) - return n.__e == null && (n.__e = s.__e, n.__k = s.__k), l.__c(r, n); - } - $3n(r, n, s, a); -}; -var U6t = qs.unmount; -function nDt(r, n, s) { - return r && (r.__c && r.__c.__H && (r.__c.__H.__.forEach(function(a) { - typeof a.__c == "function" && a.__c(); - }), r.__c.__H = null), (r = tDt({}, r)).__c != null && (r.__c.__P === s && (r.__c.__P = n), r.__c = null), r.__k = r.__k && r.__k.map(function(a) { - return nDt(a, n, s); - })), r; -} -function rDt(r, n, s) { - return r && s && (r.__v = null, r.__k = r.__k && r.__k.map(function(a) { - return rDt(a, n, s); - }), r.__c && r.__c.__P === n && (r.__e && s.appendChild(r.__e), r.__c.__e = !0, r.__c.__P = s)), r; -} -function Bme() { + return e[0]; +}, toArray: Su }, fye = $t.__e; +$t.__e = function(t, e, r, n) { + if (t.then) { + for (var i, s = e; s = s.__; ) + if ((i = s.__c) && i.__c) + return e.__e == null && (e.__e = r.__e, e.__k = r.__k), i.__c(t, e); + } + fye(t, e, r, n); +}; +var x$ = $t.unmount; +function pZ(t, e, r) { + return t && (t.__c && t.__c.__H && (t.__c.__H.__.forEach(function(n) { + typeof n.__c == "function" && n.__c(); + }), t.__c.__H = null), (t = dZ({}, t)).__c != null && (t.__c.__P === r && (t.__c.__P = e), t.__c = null), t.__k = t.__k && t.__k.map(function(n) { + return pZ(n, e, r); + })), t; +} +function gZ(t, e, r) { + return t && r && (t.__v = null, t.__k = t.__k && t.__k.map(function(n) { + return gZ(n, e, r); + }), t.__c && t.__c.__P === e && (t.__e && r.appendChild(t.__e), t.__c.__e = !0, t.__c.__P = r)), t; +} +function XO() { this.__u = 0, this.t = null, this.__b = null; } -function iDt(r) { - var n = r.__.__c; - return n && n.__a && n.__a(r); -} -function B3n(r) { - var n, s, a; - function l(h) { - if (n || (n = r()).then(function(f) { - s = f.default || f; - }, function(f) { - a = f; - }), a) - throw a; - if (!s) +function mZ(t) { + var e = t.__.__c; + return e && e.__a && e.__a(t); +} +function dye(t) { + var e, r, n; + function i(s) { + if (e || (e = t()).then(function(a) { + r = a.default || a; + }, function(a) { + n = a; + }), n) throw n; - return pk(s, h); + if (!r) + throw e; + return Rl(r, s); } - return l.displayName = "Lazy", l.__f = !0, l; + return i.displayName = "Lazy", i.__f = !0, i; } -function bX() { +function cv() { this.u = null, this.o = null; } -qs.unmount = function(r) { - var n = r.__c; - n && n.__R && n.__R(), n && 32 & r.__u && (r.type = null), U6t && U6t(r); -}, (Bme.prototype = new ex()).__c = function(r, n) { - var s = n.__c, a = this; - a.t == null && (a.t = []), a.t.push(s); - var l = iDt(a.__v), h = !1, f = function() { - h || (h = !0, s.__R = null, l ? l(b) : b()); +$t.unmount = function(t) { + var e = t.__c; + e && e.__R && e.__R(), e && 32 & t.__u && (t.type = null), x$ && x$(t); +}, (XO.prototype = new Ec()).__c = function(t, e) { + var r = e.__c, n = this; + n.t == null && (n.t = []), n.t.push(r); + var i = mZ(n.__v), s = !1, a = function() { + s || (s = !0, r.__R = null, i ? i(o) : o()); }; - s.__R = f; - var b = function() { - if (!--a.__u) { - if (a.state.__a) { - var w = a.state.__a; - a.__v.__k[0] = rDt(w, w.__c.__P, w.__c.__O); + r.__R = a; + var o = function() { + if (!--n.__u) { + if (n.state.__a) { + var l = n.state.__a; + n.__v.__k[0] = gZ(l, l.__c.__P, l.__c.__O); } - var O; - for (a.setState({ __a: a.__b = null }); O = a.t.pop(); ) - O.forceUpdate(); + var u; + for (n.setState({ __a: n.__b = null }); u = n.t.pop(); ) + u.forceUpdate(); } }; - a.__u++ || 32 & n.__u || a.setState({ __a: a.__b = a.__v.__k[0] }), r.then(f, f); -}, Bme.prototype.componentWillUnmount = function() { + n.__u++ || 32 & e.__u || n.setState({ __a: n.__b = n.__v.__k[0] }), t.then(a, a); +}, XO.prototype.componentWillUnmount = function() { this.t = []; -}, Bme.prototype.render = function(r, n) { +}, XO.prototype.render = function(t, e) { if (this.__b) { if (this.__v.__k) { - var s = document.createElement("div"), a = this.__v.__k[0].__c; - this.__v.__k[0] = nDt(this.__b, s, a.__O = a.__P); + var r = document.createElement("div"), n = this.__v.__k[0].__c; + this.__v.__k[0] = pZ(this.__b, r, n.__O = n.__P); } this.__b = null; } - var l = n.__a && pk(i_, null, r.fallback); - return l && (l.__u &= -33), [pk(i_, null, n.__a ? null : r.children), l]; + var i = e.__a && Rl(Nu, null, t.fallback); + return i && (i.__u &= -33), [Rl(Nu, null, e.__a ? null : t.children), i]; }; -var W6t = function(r, n, s) { - if (++s[1] === s[0] && r.o.delete(n), r.props.revealOrder && (r.props.revealOrder[0] !== "t" || !r.o.size)) - for (s = r.u; s; ) { - for (; s.length > 3; ) - s.pop()(); - if (s[1] < s[0]) +var w$ = function(t, e, r) { + if (++r[1] === r[0] && t.o.delete(e), t.props.revealOrder && (t.props.revealOrder[0] !== "t" || !t.o.size)) + for (r = t.u; r; ) { + for (; r.length > 3; ) + r.pop()(); + if (r[1] < r[0]) break; - r.u = s = s[2]; + t.u = r = r[2]; } }; -function F3n(r) { +function pye(t) { return this.getChildContext = function() { - return r.context; - }, r.children; -} -function j3n(r) { - var n = this, s = r.i; - n.componentWillUnmount = function() { - ZB(null, n.l), n.l = null, n.i = null; - }, n.i && n.i !== s && n.componentWillUnmount(), n.l || (n.i = s, n.l = { nodeType: 1, parentNode: s, childNodes: [], appendChild: function(a) { - this.childNodes.push(a), n.i.appendChild(a); - }, insertBefore: function(a, l) { - this.childNodes.push(a), n.i.appendChild(a); - }, removeChild: function(a) { - this.childNodes.splice(this.childNodes.indexOf(a) >>> 1, 1), n.i.removeChild(a); - } }), ZB(pk(F3n, { context: n.context }, r.__v), n.l); -} -function Q3n(r, n) { - var s = pk(j3n, { __v: r, i: n }); - return s.containerInfo = n, s; -} -(bX.prototype = new ex()).__a = function(r) { - var n = this, s = iDt(n.__v), a = n.o.get(r); - return a[0]++, function(l) { - var h = function() { - n.props.revealOrder ? (a.push(l), W6t(n, r, a)) : l(); + return t.context; + }, t.children; +} +function gye(t) { + var e = this, r = t.i; + e.componentWillUnmount = function() { + yg(null, e.l), e.l = null, e.i = null; + }, e.i && e.i !== r && e.componentWillUnmount(), e.l || (e.i = r, e.l = { nodeType: 1, parentNode: r, childNodes: [], appendChild: function(n) { + this.childNodes.push(n), e.i.appendChild(n); + }, insertBefore: function(n, i) { + this.childNodes.push(n), e.i.appendChild(n); + }, removeChild: function(n) { + this.childNodes.splice(this.childNodes.indexOf(n) >>> 1, 1), e.i.removeChild(n); + } }), yg(Rl(pye, { context: e.context }, t.__v), e.l); +} +function mye(t, e) { + var r = Rl(gye, { __v: t, i: e }); + return r.containerInfo = e, r; +} +(cv.prototype = new Ec()).__a = function(t) { + var e = this, r = mZ(e.__v), n = e.o.get(t); + return n[0]++, function(i) { + var s = function() { + e.props.revealOrder ? (n.push(i), w$(e, t, n)) : i(); }; - s ? s(h) : h(); + r ? r(s) : s(); }; -}, bX.prototype.render = function(r) { +}, cv.prototype.render = function(t) { this.u = null, this.o = /* @__PURE__ */ new Map(); - var n = Z6(r.children); - r.revealOrder && r.revealOrder[0] === "b" && n.reverse(); - for (var s = n.length; s--; ) - this.o.set(n[s], this.u = [1, 0, this.u]); - return r.children; -}, bX.prototype.componentDidUpdate = bX.prototype.componentDidMount = function() { - var r = this; - this.o.forEach(function(n, s) { - W6t(r, s, n); + var e = Su(t.children); + t.revealOrder && t.revealOrder[0] === "b" && e.reverse(); + for (var r = e.length; r--; ) + this.o.set(e[r], this.u = [1, 0, this.u]); + return t.children; +}, cv.prototype.componentDidUpdate = cv.prototype.componentDidMount = function() { + var t = this; + this.o.forEach(function(e, r) { + w$(t, r, e); }); }; -var sDt = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, z3n = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, q3n = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, V3n = /[A-Z0-9]/g, U3n = typeof document < "u", W3n = function(r) { - return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(r); +var vZ = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, vye = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, yye = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, bye = /[A-Z0-9]/g, xye = typeof document < "u", wye = function(t) { + return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(t); }; -function Y3n(r, n, s) { - return n.__k == null && (n.textContent = ""), ZB(r, n), typeof s == "function" && s(), r ? r.__c : null; +function Oye(t, e, r) { + return e.__k == null && (e.textContent = ""), yg(t, e), typeof r == "function" && r(), t ? t.__c : null; } -function H3n(r, n, s) { - return ZAt(r, n), typeof s == "function" && s(), r ? r.__c : null; +function kye(t, e, r) { + return lZ(t, e), typeof r == "function" && r(), t ? t.__c : null; } -ex.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(r) { - Object.defineProperty(ex.prototype, r, { configurable: !0, get: function() { - return this["UNSAFE_" + r]; - }, set: function(n) { - Object.defineProperty(this, r, { configurable: !0, writable: !0, value: n }); +Ec.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(t) { + Object.defineProperty(Ec.prototype, t, { configurable: !0, get: function() { + return this["UNSAFE_" + t]; + }, set: function(e) { + Object.defineProperty(this, t, { configurable: !0, writable: !0, value: e }); } }); }); -var Y6t = qs.event; -function G3n() { +var O$ = $t.event; +function Sye() { } -function Z3n() { +function Tye() { return this.cancelBubble; } -function X3n() { +function Cye() { return this.defaultPrevented; } -qs.event = function(r) { - return Y6t && (r = Y6t(r)), r.persist = G3n, r.isPropagationStopped = Z3n, r.isDefaultPrevented = X3n, r.nativeEvent = r; +$t.event = function(t) { + return O$ && (t = O$(t)), t.persist = Sye, t.isPropagationStopped = Tye, t.isDefaultPrevented = Cye, t.nativeEvent = t; }; -var HQe, K3n = { enumerable: !1, configurable: !0, get: function() { +var wR, Eye = { enumerable: !1, configurable: !0, get: function() { return this.class; -} }, H6t = qs.vnode; -qs.vnode = function(r) { - typeof r.type == "string" && function(n) { - var s = n.props, a = n.type, l = {}; - for (var h in s) { - var f = s[h]; - if (!(h === "value" && "defaultValue" in s && f == null || U3n && h === "children" && a === "noscript" || h === "class" || h === "className")) { - var b = h.toLowerCase(); - h === "defaultValue" && "value" in s && s.value == null ? h = "value" : h === "download" && f === !0 ? f = "" : b === "ondoubleclick" ? h = "ondblclick" : b !== "onchange" || a !== "input" && a !== "textarea" || W3n(s.type) ? b === "onfocus" ? h = "onfocusin" : b === "onblur" ? h = "onfocusout" : q3n.test(h) ? h = b : a.indexOf("-") === -1 && z3n.test(h) ? h = h.replace(V3n, "-$&").toLowerCase() : f === null && (f = void 0) : b = h = "oninput", b === "oninput" && l[h = b] && (h = "oninputCapture"), l[h] = f; - } - } - a == "select" && l.multiple && Array.isArray(l.value) && (l.value = Z6(s.children).forEach(function(w) { - w.props.selected = l.value.indexOf(w.props.value) != -1; - })), a == "select" && l.defaultValue != null && (l.value = Z6(s.children).forEach(function(w) { - w.props.selected = l.multiple ? l.defaultValue.indexOf(w.props.value) != -1 : l.defaultValue == w.props.value; - })), s.class && !s.className ? (l.class = s.class, Object.defineProperty(l, "className", K3n)) : (s.className && !s.class || s.class && s.className) && (l.class = l.className = s.className), n.props = l; - }(r), r.$$typeof = sDt, H6t && H6t(r); -}; -var G6t = qs.__r; -qs.__r = function(r) { - G6t && G6t(r), HQe = r.__c; -}; -var Z6t = qs.diffed; -qs.diffed = function(r) { - Z6t && Z6t(r); - var n = r.props, s = r.__e; - s != null && r.type === "textarea" && "value" in n && n.value !== s.value && (s.value = n.value == null ? "" : n.value), HQe = null; -}; -var J3n = { ReactCurrentDispatcher: { current: { readContext: function(r) { - return HQe.__n[r.__c].props.value; +} }, k$ = $t.vnode; +$t.vnode = function(t) { + typeof t.type == "string" && function(e) { + var r = e.props, n = e.type, i = {}; + for (var s in r) { + var a = r[s]; + if (!(s === "value" && "defaultValue" in r && a == null || xye && s === "children" && n === "noscript" || s === "class" || s === "className")) { + var o = s.toLowerCase(); + s === "defaultValue" && "value" in r && r.value == null ? s = "value" : s === "download" && a === !0 ? a = "" : o === "ondoubleclick" ? s = "ondblclick" : o !== "onchange" || n !== "input" && n !== "textarea" || wye(r.type) ? o === "onfocus" ? s = "onfocusin" : o === "onblur" ? s = "onfocusout" : yye.test(s) ? s = o : n.indexOf("-") === -1 && vye.test(s) ? s = s.replace(bye, "-$&").toLowerCase() : a === null && (a = void 0) : o = s = "oninput", o === "oninput" && i[s = o] && (s = "oninputCapture"), i[s] = a; + } + } + n == "select" && i.multiple && Array.isArray(i.value) && (i.value = Su(r.children).forEach(function(l) { + l.props.selected = i.value.indexOf(l.props.value) != -1; + })), n == "select" && i.defaultValue != null && (i.value = Su(r.children).forEach(function(l) { + l.props.selected = i.multiple ? i.defaultValue.indexOf(l.props.value) != -1 : i.defaultValue == l.props.value; + })), r.class && !r.className ? (i.class = r.class, Object.defineProperty(i, "className", Eye)) : (r.className && !r.class || r.class && r.className) && (i.class = i.className = r.className), e.props = i; + }(t), t.$$typeof = vZ, k$ && k$(t); +}; +var S$ = $t.__r; +$t.__r = function(t) { + S$ && S$(t), wR = t.__c; +}; +var T$ = $t.diffed; +$t.diffed = function(t) { + T$ && T$(t); + var e = t.props, r = t.__e; + r != null && t.type === "textarea" && "value" in e && e.value !== r.value && (r.value = e.value == null ? "" : e.value), wR = null; +}; +var _ye = { ReactCurrentDispatcher: { current: { readContext: function(t) { + return wR.__n[t.__c].props.value; } } } }; -function eOn(r) { - return pk.bind(null, r); -} -function Q2e(r) { - return !!r && r.$$typeof === sDt; -} -function tOn(r) { - return Q2e(r) && r.type === i_; -} -function nOn(r) { - return Q2e(r) ? x3n.apply(null, arguments) : r; -} -function rOn(r) { - return !!r.__k && (ZB(null, r), !0); -} -function iOn(r) { - return r && (r.base || r.nodeType === 1 && r) || null; -} -var sOn = function(r, n) { - return r(n); -}, oOn = function(r, n) { - return r(n); -}, aOn = i_; -function oDt(r) { - r(); -} -function cOn(r) { - return r; -} -function lOn() { - return [!1, oDt]; -} -var uOn = j2e, hOn = Q2e; -function fOn(r, n) { - var s = n(), a = _f({ h: { __: s, v: n } }), l = a[0].h, h = a[1]; - return j2e(function() { - l.__ = s, l.v = n, lRe(l) && h({ h: l }); - }, [r, s, n]), H0(function() { - return lRe(l) && h({ h: l }), r(function() { - lRe(l) && h({ h: l }); +function Aye(t) { + return Rl.bind(null, t); +} +function CS(t) { + return !!t && t.$$typeof === vZ; +} +function Lye(t) { + return CS(t) && t.type === Nu; +} +function Rye(t) { + return CS(t) ? Kve.apply(null, arguments) : t; +} +function Mye(t) { + return !!t.__k && (yg(null, t), !0); +} +function Dye(t) { + return t && (t.base || t.nodeType === 1 && t) || null; +} +var Nye = function(t, e) { + return t(e); +}, Iye = function(t, e) { + return t(e); +}, Pye = Nu; +function yZ(t) { + t(); +} +function $ye(t) { + return t; +} +function Bye() { + return [!1, yZ]; +} +var Fye = TS, zye = CS; +function Vye(t, e) { + var r = e(), n = Rn({ h: { __: r, v: e } }), i = n[0].h, s = n[1]; + return TS(function() { + i.__ = r, i.v = e, iE(i) && s({ h: i }); + }, [t, r, e]), Qi(function() { + return iE(i) && s({ h: i }), t(function() { + iE(i) && s({ h: i }); }); - }, [r]), s; + }, [t]), r; } -function lRe(r) { - var n, s, a = r.v, l = r.__; +function iE(t) { + var e, r, n = t.v, i = t.__; try { - var h = a(); - return !((n = l) === (s = h) && (n !== 0 || 1 / n == 1 / s) || n != n && s != s); + var s = n(); + return !((e = i) === (r = s) && (e !== 0 || 1 / e == 1 / r) || e != e && r != r); } catch { return !0; } } -var nP = { useState: _f, useId: C3n, useReducer: F2e, useEffect: H0, useLayoutEffect: j2e, useInsertionEffect: uOn, useTransition: lOn, useDeferredValue: cOn, useSyncExternalStore: fOn, startTransition: oDt, useRef: F2, useImperativeHandle: _3n, useMemo: Fd, useCallback: Rbe, useContext: KAt, useDebugValue: ABe, version: "17.0.2", Children: R3n, render: Y3n, hydrate: H3n, unmountComponentAtNode: rOn, createPortal: Q3n, createElement: pk, createContext: S3n, createFactory: eOn, cloneElement: nOn, createRef: v3n, Fragment: i_, isValidElement: Q2e, isElement: hOn, isFragment: tOn, findDOMNode: iOn, Component: ex, PureComponent: PBe, memo: L3n, forwardRef: N3n, flushSync: oOn, unstable_batchedUpdates: sOn, StrictMode: aOn, Suspense: Bme, SuspenseList: bX, lazy: B3n, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: J3n }, Wy = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function GQe(r) { - return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; +var Gd = { useState: Rn, useId: tye, useReducer: SS, useEffect: Qi, useLayoutEffect: TS, useInsertionEffect: Fye, useTransition: Bye, useDeferredValue: $ye, useSyncExternalStore: Vye, startTransition: yZ, useRef: io, useImperativeHandle: eye, useMemo: ei, useCallback: f5, useContext: uZ, useDebugValue: yA, version: "17.0.2", Children: hye, render: Oye, hydrate: kye, unmountComponentAtNode: Mye, createPortal: mye, createElement: Rl, createContext: Jve, createFactory: Aye, cloneElement: Rye, createRef: Gve, Fragment: Nu, isValidElement: CS, isElement: zye, isFragment: Lye, findDOMNode: Dye, Component: Ec, PureComponent: wA, memo: lye, forwardRef: uye, flushSync: Iye, unstable_batchedUpdates: Nye, StrictMode: Pye, Suspense: XO, SuspenseList: cv, lazy: dye, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: _ye }, Uc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function bZ(t) { + return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } -function aDt(r) { - var n = r.default; - if (typeof n == "function") { - var s = function() { - return n.apply(this, arguments); +function xZ(t) { + var e = t.default; + if (typeof e == "function") { + var r = function() { + return e.apply(this, arguments); }; - s.prototype = n.prototype; + r.prototype = e.prototype; } else - s = {}; - return Object.defineProperty(s, "__esModule", { + r = {}; + return Object.defineProperty(r, "__esModule", { value: !0 - }), Object.keys(r).forEach(function(a) { - var l = Object.getOwnPropertyDescriptor(r, a); - Object.defineProperty(s, a, l.get ? l : { + }), Object.keys(t).forEach(function(n) { + var i = Object.getOwnPropertyDescriptor(t, n); + Object.defineProperty(r, n, i.get ? i : { enumerable: !0, get: function() { - return r[a]; + return t[n]; } }); - }), s; + }), r; } -var dOn = function(n, s, a, l) { - var h = a ? a.call(l, n, s) : void 0; - if (h !== void 0) - return !!h; - if (n === s) +var Uye = function(e, r, n, i) { + var s = n ? n.call(i, e, r) : void 0; + if (s !== void 0) + return !!s; + if (e === r) return !0; - if (typeof n != "object" || !n || typeof s != "object" || !s) + if (typeof e != "object" || !e || typeof r != "object" || !r) return !1; - var f = Object.keys(n), b = Object.keys(s); - if (f.length !== b.length) + var a = Object.keys(e), o = Object.keys(r); + if (a.length !== o.length) return !1; - for (var w = Object.prototype.hasOwnProperty.bind(s), O = 0; O < f.length; O++) { - var S = f[O]; - if (!w(S)) + for (var l = Object.prototype.hasOwnProperty.bind(r), u = 0; u < a.length; u++) { + var h = a[u]; + if (!l(h)) return !1; - var E = n[S], D = s[S]; - if (h = a ? a.call(l, E, D, S) : void 0, h === !1 || h === void 0 && E !== D) + var f = e[h], d = r[h]; + if (s = n ? n.call(i, f, d, h) : void 0, s === !1 || s === void 0 && f !== d) return !1; } return !0; -}, Eh = "-ms-", RX = "-moz-", eu = "-webkit-", cDt = "comm", z2e = "rule", ZQe = "decl", pOn = "@import", lDt = "@keyframes", gOn = "@layer", mOn = Math.abs, XQe = String.fromCharCode, LBe = Object.assign; -function bOn(r, n) { - return U0(r, 0) ^ 45 ? (((n << 2 ^ U0(r, 0)) << 2 ^ U0(r, 1)) << 2 ^ U0(r, 2)) << 2 ^ U0(r, 3) : 0; +}, pn = "-ms-", Vv = "-moz-", Fr = "-webkit-", wZ = "comm", ES = "rule", OR = "decl", qye = "@import", OZ = "@keyframes", Qye = "@layer", Yye = Math.abs, kR = String.fromCharCode, OA = Object.assign; +function Wye(t, e) { + return Ui(t, 0) ^ 45 ? (((e << 2 ^ Ui(t, 0)) << 2 ^ Ui(t, 1)) << 2 ^ Ui(t, 2)) << 2 ^ Ui(t, 3) : 0; } -function uDt(r) { - return r.trim(); +function kZ(t) { + return t.trim(); } -function R6(r, n) { - return (r = n.exec(r)) ? r[0] : r; +function hu(t, e) { + return (t = e.exec(t)) ? t[0] : t; } -function fc(r, n, s) { - return r.replace(n, s); +function vr(t, e, r) { + return t.replace(e, r); } -function Fme(r, n) { - return r.indexOf(n); +function ZO(t, e) { + return t.indexOf(e); } -function U0(r, n) { - return r.charCodeAt(n) | 0; +function Ui(t, e) { + return t.charCodeAt(e) | 0; } -function JB(r, n, s) { - return r.slice(n, s); +function wg(t, e, r) { + return t.slice(e, r); } -function z4(r) { - return r.length; +function lc(t) { + return t.length; } -function hDt(r) { - return r.length; +function SZ(t) { + return t.length; } -function vX(r, n) { - return n.push(r), r; +function uv(t, e) { + return e.push(t), t; } -function vOn(r, n) { - return r.map(n).join(""); +function Gye(t, e) { + return t.map(e).join(""); } -function X6t(r, n) { - return r.filter(function(s) { - return !R6(s, n); +function C$(t, e) { + return t.filter(function(r) { + return !hu(r, e); }); } -var q2e = 1, eF = 1, fDt = 0, Zy = 0, d1 = 0, YF = ""; -function V2e(r, n, s, a, l, h, f, b) { - return { value: r, root: n, parent: s, type: a, props: l, children: h, line: q2e, column: eF, length: f, return: "", siblings: b }; +var _S = 1, Og = 1, TZ = 0, Vo = 0, li = 0, M1 = ""; +function AS(t, e, r, n, i, s, a, o) { + return { value: t, root: e, parent: r, type: n, props: i, children: s, line: _S, column: Og, length: a, return: "", siblings: o }; } -function FT(r, n) { - return LBe(V2e("", null, null, "", null, null, 0, r.siblings), r, { length: -r.length }, n); +function xh(t, e) { + return OA(AS("", null, null, "", null, null, 0, t.siblings), t, { length: -t.length }, e); } -function rB(r) { - for (; r.root; ) - r = FT(r.root, { children: [r] }); - vX(r, r.siblings); +function ap(t) { + for (; t.root; ) + t = xh(t.root, { children: [t] }); + uv(t, t.siblings); } -function wOn() { - return d1; +function Hye() { + return li; } -function yOn() { - return d1 = Zy > 0 ? U0(YF, --Zy) : 0, eF--, d1 === 10 && (eF = 1, q2e--), d1; +function Xye() { + return li = Vo > 0 ? Ui(M1, --Vo) : 0, Og--, li === 10 && (Og = 1, _S--), li; } -function lk() { - return d1 = Zy < fDt ? U0(YF, Zy++) : 0, eF++, d1 === 10 && (eF = 1, q2e++), d1; +function bl() { + return li = Vo < TZ ? Ui(M1, Vo++) : 0, Og++, li === 10 && (Og = 1, _S++), li; } -function YM() { - return U0(YF, Zy); +function Fd() { + return Ui(M1, Vo); } -function jme() { - return Zy; +function jO() { + return Vo; } -function U2e(r, n) { - return JB(YF, r, n); +function LS(t, e) { + return wg(M1, t, e); } -function IBe(r) { - switch (r) { +function kA(t) { + switch (t) { case 0: case 9: case 10: @@ -971,162 +980,162 @@ function IBe(r) { } return 0; } -function OOn(r) { - return q2e = eF = 1, fDt = z4(YF = r), Zy = 0, []; +function Zye(t) { + return _S = Og = 1, TZ = lc(M1 = t), Vo = 0, []; } -function kOn(r) { - return YF = "", r; +function jye(t) { + return M1 = "", t; } -function uRe(r) { - return uDt(U2e(Zy - 1, NBe(r === 91 ? r + 2 : r === 40 ? r + 1 : r))); +function sE(t) { + return kZ(LS(Vo - 1, SA(t === 91 ? t + 2 : t === 40 ? t + 1 : t))); } -function xOn(r) { - for (; (d1 = YM()) && d1 < 33; ) - lk(); - return IBe(r) > 2 || IBe(d1) > 3 ? "" : " "; +function Kye(t) { + for (; (li = Fd()) && li < 33; ) + bl(); + return kA(t) > 2 || kA(li) > 3 ? "" : " "; } -function SOn(r, n) { - for (; --n && lk() && !(d1 < 48 || d1 > 102 || d1 > 57 && d1 < 65 || d1 > 70 && d1 < 97); ) +function Jye(t, e) { + for (; --e && bl() && !(li < 48 || li > 102 || li > 57 && li < 65 || li > 70 && li < 97); ) ; - return U2e(r, jme() + (n < 6 && YM() == 32 && lk() == 32)); + return LS(t, jO() + (e < 6 && Fd() == 32 && bl() == 32)); } -function NBe(r) { - for (; lk(); ) - switch (d1) { - case r: - return Zy; +function SA(t) { + for (; bl(); ) + switch (li) { + case t: + return Vo; case 34: case 39: - r !== 34 && r !== 39 && NBe(d1); + t !== 34 && t !== 39 && SA(li); break; case 40: - r === 41 && NBe(r); + t === 41 && SA(t); break; case 92: - lk(); + bl(); break; } - return Zy; + return Vo; } -function _On(r, n) { - for (; lk() && r + d1 !== 47 + 10; ) - if (r + d1 === 42 + 42 && YM() === 47) +function e2e(t, e) { + for (; bl() && t + li !== 47 + 10; ) + if (t + li === 42 + 42 && Fd() === 47) break; - return "/*" + U2e(n, Zy - 1) + "*" + XQe(r === 47 ? r : lk()); + return "/*" + LS(e, Vo - 1) + "*" + kR(t === 47 ? t : bl()); } -function COn(r) { - for (; !IBe(YM()); ) - lk(); - return U2e(r, Zy); +function t2e(t) { + for (; !kA(Fd()); ) + bl(); + return LS(t, Vo); } -function EOn(r) { - return kOn(Qme("", null, null, null, [""], r = OOn(r), 0, [0], r)); +function r2e(t) { + return jye(KO("", null, null, null, [""], t = Zye(t), 0, [0], t)); } -function Qme(r, n, s, a, l, h, f, b, w) { - for (var O = 0, S = 0, E = f, D = 0, M = 0, B = 0, z = 1, W = 1, H = 1, G = 0, ee = "", le = l, se = h, he = a, te = ee; W; ) - switch (B = G, G = lk()) { +function KO(t, e, r, n, i, s, a, o, l) { + for (var u = 0, h = 0, f = a, d = 0, p = 0, g = 0, m = 1, v = 1, y = 1, b = 0, w = "", O = i, S = s, C = n, T = w; v; ) + switch (g = b, b = bl()) { case 40: - if (B != 108 && U0(te, E - 1) == 58) { - Fme(te += fc(uRe(G), "&", "&\f"), "&\f") != -1 && (H = -1); + if (g != 108 && Ui(T, f - 1) == 58) { + ZO(T += vr(sE(b), "&", "&\f"), "&\f") != -1 && (y = -1); break; } case 34: case 39: case 91: - te += uRe(G); + T += sE(b); break; case 9: case 10: case 13: case 32: - te += xOn(B); + T += Kye(g); break; case 92: - te += SOn(jme() - 1, 7); + T += Jye(jO() - 1, 7); continue; case 47: - switch (YM()) { + switch (Fd()) { case 42: case 47: - vX(TOn(_On(lk(), jme()), n, s, w), w); + uv(n2e(e2e(bl(), jO()), e, r, l), l); break; default: - te += "/"; + T += "/"; } break; - case 123 * z: - b[O++] = z4(te) * H; - case 125 * z: + case 123 * m: + o[u++] = lc(T) * y; + case 125 * m: case 59: case 0: - switch (G) { + switch (b) { case 0: case 125: - W = 0; - case 59 + S: - H == -1 && (te = fc(te, /\f/g, "")), M > 0 && z4(te) - E && vX(M > 32 ? J6t(te + ";", a, s, E - 1, w) : J6t(fc(te, " ", "") + ";", a, s, E - 2, w), w); + v = 0; + case 59 + h: + y == -1 && (T = vr(T, /\f/g, "")), p > 0 && lc(T) - f && uv(p > 32 ? _$(T + ";", n, r, f - 1, l) : _$(vr(T, " ", "") + ";", n, r, f - 2, l), l); break; case 59: - te += ";"; + T += ";"; default: - if (vX(he = K6t(te, n, s, O, S, l, b, ee, le = [], se = [], E, h), h), G === 123) - if (S === 0) - Qme(te, n, he, he, le, h, E, b, se); + if (uv(C = E$(T, e, r, u, h, i, o, w, O = [], S = [], f, s), s), b === 123) + if (h === 0) + KO(T, e, C, C, O, s, f, o, S); else - switch (D === 99 && U0(te, 3) === 110 ? 100 : D) { + switch (d === 99 && Ui(T, 3) === 110 ? 100 : d) { case 100: case 108: case 109: case 115: - Qme(r, he, he, a && vX(K6t(r, he, he, 0, 0, l, b, ee, l, le = [], E, se), se), l, se, E, b, a ? le : se); + KO(t, C, C, n && uv(E$(t, C, C, 0, 0, i, o, w, i, O = [], f, S), S), i, S, f, o, n ? O : S); break; default: - Qme(te, he, he, he, [""], se, 0, b, se); + KO(T, C, C, C, [""], S, 0, o, S); } } - O = S = M = 0, z = H = 1, ee = te = "", E = f; + u = h = p = 0, m = y = 1, w = T = "", f = a; break; case 58: - E = 1 + z4(te), M = B; + f = 1 + lc(T), p = g; default: - if (z < 1) { - if (G == 123) - --z; - else if (G == 125 && z++ == 0 && yOn() == 125) + if (m < 1) { + if (b == 123) + --m; + else if (b == 125 && m++ == 0 && Xye() == 125) continue; } - switch (te += XQe(G), G * z) { + switch (T += kR(b), b * m) { case 38: - H = S > 0 ? 1 : (te += "\f", -1); + y = h > 0 ? 1 : (T += "\f", -1); break; case 44: - b[O++] = (z4(te) - 1) * H, H = 1; + o[u++] = (lc(T) - 1) * y, y = 1; break; case 64: - YM() === 45 && (te += uRe(lk())), D = YM(), S = E = z4(ee = te += COn(jme())), G++; + Fd() === 45 && (T += sE(bl())), d = Fd(), h = f = lc(w = T += t2e(jO())), b++; break; case 45: - B === 45 && z4(te) == 2 && (z = 0); + g === 45 && lc(T) == 2 && (m = 0); } } - return h; + return s; } -function K6t(r, n, s, a, l, h, f, b, w, O, S, E) { - for (var D = l - 1, M = l === 0 ? h : [""], B = hDt(M), z = 0, W = 0, H = 0; z < a; ++z) - for (var G = 0, ee = JB(r, D + 1, D = mOn(W = f[z])), le = r; G < B; ++G) - (le = uDt(W > 0 ? M[G] + " " + ee : fc(ee, /&\f/g, M[G]))) && (w[H++] = le); - return V2e(r, n, s, l === 0 ? z2e : b, w, O, S, E); +function E$(t, e, r, n, i, s, a, o, l, u, h, f) { + for (var d = i - 1, p = i === 0 ? s : [""], g = SZ(p), m = 0, v = 0, y = 0; m < n; ++m) + for (var b = 0, w = wg(t, d + 1, d = Yye(v = a[m])), O = t; b < g; ++b) + (O = kZ(v > 0 ? p[b] + " " + w : vr(w, /&\f/g, p[b]))) && (l[y++] = O); + return AS(t, e, r, i === 0 ? ES : o, l, u, h, f); } -function TOn(r, n, s, a) { - return V2e(r, n, s, cDt, XQe(wOn()), JB(r, 2, -2), 0, a); +function n2e(t, e, r, n) { + return AS(t, e, r, wZ, kR(Hye()), wg(t, 2, -2), 0, n); } -function J6t(r, n, s, a, l) { - return V2e(r, n, s, ZQe, JB(r, 0, a), JB(r, a + 1, -1), a, l); +function _$(t, e, r, n, i) { + return AS(t, e, r, OR, wg(t, 0, n), wg(t, n + 1, -1), n, i); } -function dDt(r, n, s) { - switch (bOn(r, n)) { +function CZ(t, e, r) { + switch (Wye(t, e)) { case 5103: - return eu + "print-" + r + r; + return Fr + "print-" + t + t; case 5737: case 4201: case 3177: @@ -1152,73 +1161,73 @@ function dDt(r, n, s) { case 5365: case 5621: case 3829: - return eu + r + r; + return Fr + t + t; case 4789: - return RX + r + r; + return Vv + t + t; case 5349: case 4246: case 4810: case 6968: case 2756: - return eu + r + RX + r + Eh + r + r; + return Fr + t + Vv + t + pn + t + t; case 5936: - switch (U0(r, n + 11)) { + switch (Ui(t, e + 11)) { case 114: - return eu + r + Eh + fc(r, /[svh]\w+-[tblr]{2}/, "tb") + r; + return Fr + t + pn + vr(t, /[svh]\w+-[tblr]{2}/, "tb") + t; case 108: - return eu + r + Eh + fc(r, /[svh]\w+-[tblr]{2}/, "tb-rl") + r; + return Fr + t + pn + vr(t, /[svh]\w+-[tblr]{2}/, "tb-rl") + t; case 45: - return eu + r + Eh + fc(r, /[svh]\w+-[tblr]{2}/, "lr") + r; + return Fr + t + pn + vr(t, /[svh]\w+-[tblr]{2}/, "lr") + t; } case 6828: case 4268: case 2903: - return eu + r + Eh + r + r; + return Fr + t + pn + t + t; case 6165: - return eu + r + Eh + "flex-" + r + r; + return Fr + t + pn + "flex-" + t + t; case 5187: - return eu + r + fc(r, /(\w+).+(:[^]+)/, eu + "box-$1$2" + Eh + "flex-$1$2") + r; + return Fr + t + vr(t, /(\w+).+(:[^]+)/, Fr + "box-$1$2" + pn + "flex-$1$2") + t; case 5443: - return eu + r + Eh + "flex-item-" + fc(r, /flex-|-self/g, "") + (R6(r, /flex-|baseline/) ? "" : Eh + "grid-row-" + fc(r, /flex-|-self/g, "")) + r; + return Fr + t + pn + "flex-item-" + vr(t, /flex-|-self/g, "") + (hu(t, /flex-|baseline/) ? "" : pn + "grid-row-" + vr(t, /flex-|-self/g, "")) + t; case 4675: - return eu + r + Eh + "flex-line-pack" + fc(r, /align-content|flex-|-self/g, "") + r; + return Fr + t + pn + "flex-line-pack" + vr(t, /align-content|flex-|-self/g, "") + t; case 5548: - return eu + r + Eh + fc(r, "shrink", "negative") + r; + return Fr + t + pn + vr(t, "shrink", "negative") + t; case 5292: - return eu + r + Eh + fc(r, "basis", "preferred-size") + r; + return Fr + t + pn + vr(t, "basis", "preferred-size") + t; case 6060: - return eu + "box-" + fc(r, "-grow", "") + eu + r + Eh + fc(r, "grow", "positive") + r; + return Fr + "box-" + vr(t, "-grow", "") + Fr + t + pn + vr(t, "grow", "positive") + t; case 4554: - return eu + fc(r, /([^-])(transform)/g, "$1" + eu + "$2") + r; + return Fr + vr(t, /([^-])(transform)/g, "$1" + Fr + "$2") + t; case 6187: - return fc(fc(fc(r, /(zoom-|grab)/, eu + "$1"), /(image-set)/, eu + "$1"), r, "") + r; + return vr(vr(vr(t, /(zoom-|grab)/, Fr + "$1"), /(image-set)/, Fr + "$1"), t, "") + t; case 5495: case 3959: - return fc(r, /(image-set\([^]*)/, eu + "$1$`$1"); + return vr(t, /(image-set\([^]*)/, Fr + "$1$`$1"); case 4968: - return fc(fc(r, /(.+:)(flex-)?(.*)/, eu + "box-pack:$3" + Eh + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + eu + r + r; + return vr(vr(t, /(.+:)(flex-)?(.*)/, Fr + "box-pack:$3" + pn + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + Fr + t + t; case 4200: - if (!R6(r, /flex-|baseline/)) - return Eh + "grid-column-align" + JB(r, n) + r; + if (!hu(t, /flex-|baseline/)) + return pn + "grid-column-align" + wg(t, e) + t; break; case 2592: case 3360: - return Eh + fc(r, "template-", "") + r; + return pn + vr(t, "template-", "") + t; case 4384: case 3616: - return s && s.some(function(a, l) { - return n = l, R6(a.props, /grid-\w+-end/); - }) ? ~Fme(r + (s = s[n].value), "span") ? r : Eh + fc(r, "-start", "") + r + Eh + "grid-row-span:" + (~Fme(s, "span") ? R6(s, /\d+/) : +R6(s, /\d+/) - +R6(r, /\d+/)) + ";" : Eh + fc(r, "-start", "") + r; + return r && r.some(function(n, i) { + return e = i, hu(n.props, /grid-\w+-end/); + }) ? ~ZO(t + (r = r[e].value), "span") ? t : pn + vr(t, "-start", "") + t + pn + "grid-row-span:" + (~ZO(r, "span") ? hu(r, /\d+/) : +hu(r, /\d+/) - +hu(t, /\d+/)) + ";" : pn + vr(t, "-start", "") + t; case 4896: case 4128: - return s && s.some(function(a) { - return R6(a.props, /grid-\w+-start/); - }) ? r : Eh + fc(fc(r, "-end", "-span"), "span ", "") + r; + return r && r.some(function(n) { + return hu(n.props, /grid-\w+-start/); + }) ? t : pn + vr(vr(t, "-end", "-span"), "span ", "") + t; case 4095: case 3583: case 4068: case 2532: - return fc(r, /(.+)-inline(.+)/, eu + "$1$2") + r; + return vr(t, /(.+)-inline(.+)/, Fr + "$1$2") + t; case 8116: case 7059: case 5753: @@ -1231,32 +1240,32 @@ function dDt(r, n, s) { case 5789: case 5021: case 4765: - if (z4(r) - 1 - n > 6) - switch (U0(r, n + 1)) { + if (lc(t) - 1 - e > 6) + switch (Ui(t, e + 1)) { case 109: - if (U0(r, n + 4) !== 45) + if (Ui(t, e + 4) !== 45) break; case 102: - return fc(r, /(.+:)(.+)-([^]+)/, "$1" + eu + "$2-$3$1" + RX + (U0(r, n + 3) == 108 ? "$3" : "$2-$3")) + r; + return vr(t, /(.+:)(.+)-([^]+)/, "$1" + Fr + "$2-$3$1" + Vv + (Ui(t, e + 3) == 108 ? "$3" : "$2-$3")) + t; case 115: - return ~Fme(r, "stretch") ? dDt(fc(r, "stretch", "fill-available"), n, s) + r : r; + return ~ZO(t, "stretch") ? CZ(vr(t, "stretch", "fill-available"), e, r) + t : t; } break; case 5152: case 5920: - return fc(r, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function(a, l, h, f, b, w, O) { - return Eh + l + ":" + h + O + (f ? Eh + l + "-span:" + (b ? w : +w - +h) + O : "") + r; + return vr(t, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function(n, i, s, a, o, l, u) { + return pn + i + ":" + s + u + (a ? pn + i + "-span:" + (o ? l : +l - +s) + u : "") + t; }); case 4949: - if (U0(r, n + 6) === 121) - return fc(r, ":", ":" + eu) + r; + if (Ui(t, e + 6) === 121) + return vr(t, ":", ":" + Fr) + t; break; case 6444: - switch (U0(r, U0(r, 14) === 45 ? 18 : 11)) { + switch (Ui(t, Ui(t, 14) === 45 ? 18 : 11)) { case 120: - return fc(r, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + eu + (U0(r, 14) === 45 ? "inline-" : "") + "box$3$1" + eu + "$2$3$1" + Eh + "$2box$3") + r; + return vr(t, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + Fr + (Ui(t, 14) === 45 ? "inline-" : "") + "box$3$1" + Fr + "$2$3$1" + pn + "$2box$3") + t; case 100: - return fc(r, ":", ":" + Eh) + r; + return vr(t, ":", ":" + pn) + t; } break; case 5719: @@ -1264,71 +1273,71 @@ function dDt(r, n, s) { case 2135: case 3927: case 2391: - return fc(r, "scroll-", "scroll-snap-") + r; + return vr(t, "scroll-", "scroll-snap-") + t; } - return r; + return t; } -function $be(r, n) { - for (var s = "", a = 0; a < r.length; a++) - s += n(r[a], a, r, n) || ""; - return s; +function d5(t, e) { + for (var r = "", n = 0; n < t.length; n++) + r += e(t[n], n, t, e) || ""; + return r; } -function AOn(r, n, s, a) { - switch (r.type) { - case gOn: - if (r.children.length) +function i2e(t, e, r, n) { + switch (t.type) { + case Qye: + if (t.children.length) break; - case pOn: - case ZQe: - return r.return = r.return || r.value; - case cDt: + case qye: + case OR: + return t.return = t.return || t.value; + case wZ: return ""; - case lDt: - return r.return = r.value + "{" + $be(r.children, a) + "}"; - case z2e: - if (!z4(r.value = r.props.join(","))) + case OZ: + return t.return = t.value + "{" + d5(t.children, n) + "}"; + case ES: + if (!lc(t.value = t.props.join(","))) return ""; } - return z4(s = $be(r.children, a)) ? r.return = r.value + "{" + s + "}" : ""; + return lc(r = d5(t.children, n)) ? t.return = t.value + "{" + r + "}" : ""; } -function DOn(r) { - var n = hDt(r); - return function(s, a, l, h) { - for (var f = "", b = 0; b < n; b++) - f += r[b](s, a, l, h) || ""; - return f; +function s2e(t) { + var e = SZ(t); + return function(r, n, i, s) { + for (var a = "", o = 0; o < e; o++) + a += t[o](r, n, i, s) || ""; + return a; }; } -function MOn(r) { - return function(n) { - n.root || (n = n.return) && r(n); +function a2e(t) { + return function(e) { + e.root || (e = e.return) && t(e); }; } -function POn(r, n, s, a) { - if (r.length > -1 && !r.return) - switch (r.type) { - case ZQe: - r.return = dDt(r.value, r.length, s); +function o2e(t, e, r, n) { + if (t.length > -1 && !t.return) + switch (t.type) { + case OR: + t.return = CZ(t.value, t.length, r); return; - case lDt: - return $be([FT(r, { value: fc(r.value, "@", "@" + eu) })], a); - case z2e: - if (r.length) - return vOn(s = r.props, function(l) { - switch (R6(l, a = /(::plac\w+|:read-\w+)/)) { + case OZ: + return d5([xh(t, { value: vr(t.value, "@", "@" + Fr) })], n); + case ES: + if (t.length) + return Gye(r = t.props, function(i) { + switch (hu(i, n = /(::plac\w+|:read-\w+)/)) { case ":read-only": case ":read-write": - rB(FT(r, { props: [fc(l, /:(read-\w+)/, ":" + RX + "$1")] })), rB(FT(r, { props: [l] })), LBe(r, { props: X6t(s, a) }); + ap(xh(t, { props: [vr(i, /:(read-\w+)/, ":" + Vv + "$1")] })), ap(xh(t, { props: [i] })), OA(t, { props: C$(r, n) }); break; case "::placeholder": - rB(FT(r, { props: [fc(l, /:(plac\w+)/, ":" + eu + "input-$1")] })), rB(FT(r, { props: [fc(l, /:(plac\w+)/, ":" + RX + "$1")] })), rB(FT(r, { props: [fc(l, /:(plac\w+)/, Eh + "input-$1")] })), rB(FT(r, { props: [l] })), LBe(r, { props: X6t(s, a) }); + ap(xh(t, { props: [vr(i, /:(plac\w+)/, ":" + Fr + "input-$1")] })), ap(xh(t, { props: [vr(i, /:(plac\w+)/, ":" + Vv + "$1")] })), ap(xh(t, { props: [vr(i, /:(plac\w+)/, pn + "input-$1")] })), ap(xh(t, { props: [i] })), OA(t, { props: C$(r, n) }); break; } return ""; }); } } -var LOn = { +var l2e = { animationIterationCount: 1, aspectRatio: 1, borderImageOutset: 1, @@ -1375,119 +1384,119 @@ var LOn = { strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 -}, rP = typeof process < "u" && {} !== void 0 && ({}.REACT_APP_SC_ATTR || {}.SC_ATTR) || "data-styled", pDt = "active", gDt = "data-styled-version", W2e = "6.1.2", KQe = `/*!sc*/ -`, JQe = typeof window < "u" && "HTMLElement" in window, IOn = Boolean(typeof SC_DISABLE_SPEEDY == "boolean" ? SC_DISABLE_SPEEDY : typeof process < "u" && {} !== void 0 && {}.REACT_APP_SC_DISABLE_SPEEDY !== void 0 && {}.REACT_APP_SC_DISABLE_SPEEDY !== "" ? {}.REACT_APP_SC_DISABLE_SPEEDY !== "false" && {}.REACT_APP_SC_DISABLE_SPEEDY : typeof process < "u" && {} !== void 0 && {}.SC_DISABLE_SPEEDY !== void 0 && {}.SC_DISABLE_SPEEDY !== "" ? {}.SC_DISABLE_SPEEDY !== "false" && {}.SC_DISABLE_SPEEDY : {}.NODE_ENV !== "production"), e_t = /invalid hook call/i, Dge = /* @__PURE__ */ new Set(), NOn = function(r, n) { +}, Hd = typeof process < "u" && {} !== void 0 && ({}.REACT_APP_SC_ATTR || {}.SC_ATTR) || "data-styled", EZ = "active", _Z = "data-styled-version", RS = "6.1.2", SR = `/*!sc*/ +`, TR = typeof window < "u" && "HTMLElement" in window, c2e = Boolean(typeof SC_DISABLE_SPEEDY == "boolean" ? SC_DISABLE_SPEEDY : typeof process < "u" && {} !== void 0 && {}.REACT_APP_SC_DISABLE_SPEEDY !== void 0 && {}.REACT_APP_SC_DISABLE_SPEEDY !== "" ? {}.REACT_APP_SC_DISABLE_SPEEDY !== "false" && {}.REACT_APP_SC_DISABLE_SPEEDY : typeof process < "u" && {} !== void 0 && {}.SC_DISABLE_SPEEDY !== void 0 && {}.SC_DISABLE_SPEEDY !== "" ? {}.SC_DISABLE_SPEEDY !== "false" && {}.SC_DISABLE_SPEEDY : {}.NODE_ENV !== "production"), A$ = /invalid hook call/i, iw = /* @__PURE__ */ new Set(), u2e = function(t, e) { if ({}.NODE_ENV !== "production") { - var s = n ? ' with the id of "'.concat(n, '"') : "", a = "The component ".concat(r).concat(s, ` has been created dynamically. + var r = e ? ' with the id of "'.concat(e, '"') : "", n = "The component ".concat(t).concat(r, ` has been created dynamically. `) + `You may see this warning because you've called styled inside another component. -To resolve this only create new StyledComponents outside of any render method and function component.`, l = console.error; +To resolve this only create new StyledComponents outside of any render method and function component.`, i = console.error; try { - var h = !0; - console.error = function(f) { - for (var b = [], w = 1; w < arguments.length; w++) - b[w - 1] = arguments[w]; - e_t.test(f) ? (h = !1, Dge.delete(a)) : l.apply(void 0, KB([f], b, !1)); - }, F2(), h && !Dge.has(a) && (console.warn(a), Dge.add(a)); - } catch (f) { - e_t.test(f.message) && Dge.delete(a); + var s = !0; + console.error = function(a) { + for (var o = [], l = 1; l < arguments.length; l++) + o[l - 1] = arguments[l]; + A$.test(a) ? (s = !1, iw.delete(n)) : i.apply(void 0, xg([a], o, !1)); + }, io(), s && !iw.has(n) && (console.warn(n), iw.add(n)); + } catch (a) { + A$.test(a.message) && iw.delete(n); } finally { - console.error = l; + console.error = i; } } -}, Y2e = Object.freeze([]), tF = Object.freeze({}); -function ROn(r, n, s) { - return s === void 0 && (s = tF), r.theme !== s.theme && r.theme || n || s.theme; +}, MS = Object.freeze([]), kg = Object.freeze({}); +function h2e(t, e, r) { + return r === void 0 && (r = kg), t.theme !== r.theme && t.theme || e || r.theme; } -var RBe = /* @__PURE__ */ new Set(["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "u", "ul", "use", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"]), $On = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g, BOn = /(^-|-$)/g; -function t_t(r) { - return r.replace($On, "-").replace(BOn, ""); +var TA = /* @__PURE__ */ new Set(["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "u", "ul", "use", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"]), f2e = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g, d2e = /(^-|-$)/g; +function L$(t) { + return t.replace(f2e, "-").replace(d2e, ""); } -var FOn = /(a)(d)/gi, Mge = 52, n_t = function(r) { - return String.fromCharCode(r + (r > 25 ? 39 : 97)); +var p2e = /(a)(d)/gi, sw = 52, R$ = function(t) { + return String.fromCharCode(t + (t > 25 ? 39 : 97)); }; -function $Be(r) { - var n, s = ""; - for (n = Math.abs(r); n > Mge; n = n / Mge | 0) - s = n_t(n % Mge) + s; - return (n_t(n % Mge) + s).replace(FOn, "$1-$2"); -} -var hRe, mDt = 5381, PM = function(r, n) { - for (var s = n.length; s; ) - r = 33 * r ^ n.charCodeAt(--s); - return r; -}, bDt = function(r) { - return PM(mDt, r); +function CA(t) { + var e, r = ""; + for (e = Math.abs(t); e > sw; e = e / sw | 0) + r = R$(e % sw) + r; + return (R$(e % sw) + r).replace(p2e, "$1-$2"); +} +var aE, AZ = 5381, pd = function(t, e) { + for (var r = e.length; r; ) + t = 33 * t ^ e.charCodeAt(--r); + return t; +}, LZ = function(t) { + return pd(AZ, t); }; -function jOn(r) { - return $Be(bDt(r) >>> 0); -} -function vDt(r) { - return {}.NODE_ENV !== "production" && typeof r == "string" && r || r.displayName || r.name || "Component"; -} -function fRe(r) { - return typeof r == "string" && ({}.NODE_ENV === "production" || r.charAt(0) === r.charAt(0).toLowerCase()); -} -var wDt = typeof Symbol == "function" && Symbol.for, yDt = wDt ? Symbol.for("react.memo") : 60115, QOn = wDt ? Symbol.for("react.forward_ref") : 60112, zOn = { childContextTypes: !0, contextType: !0, contextTypes: !0, defaultProps: !0, displayName: !0, getDefaultProps: !0, getDerivedStateFromError: !0, getDerivedStateFromProps: !0, mixins: !0, propTypes: !0, type: !0 }, qOn = { name: !0, length: !0, prototype: !0, caller: !0, callee: !0, arguments: !0, arity: !0 }, ODt = { $$typeof: !0, compare: !0, defaultProps: !0, displayName: !0, propTypes: !0, type: !0 }, VOn = ((hRe = {})[QOn] = { $$typeof: !0, render: !0, defaultProps: !0, displayName: !0, propTypes: !0 }, hRe[yDt] = ODt, hRe); -function r_t(r) { - return ("type" in (n = r) && n.type.$$typeof) === yDt ? ODt : "$$typeof" in r ? VOn[r.$$typeof] : zOn; - var n; -} -var UOn = Object.defineProperty, WOn = Object.getOwnPropertyNames, i_t = Object.getOwnPropertySymbols, YOn = Object.getOwnPropertyDescriptor, HOn = Object.getPrototypeOf, s_t = Object.prototype; -function kDt(r, n, s) { - if (typeof n != "string") { - if (s_t) { - var a = HOn(n); - a && a !== s_t && kDt(r, a, s); - } - var l = WOn(n); - i_t && (l = l.concat(i_t(n))); - for (var h = r_t(r), f = r_t(n), b = 0; b < l.length; ++b) { - var w = l[b]; - if (!(w in qOn || s && s[w] || f && w in f || h && w in h)) { - var O = YOn(n, w); +function g2e(t) { + return CA(LZ(t) >>> 0); +} +function RZ(t) { + return {}.NODE_ENV !== "production" && typeof t == "string" && t || t.displayName || t.name || "Component"; +} +function oE(t) { + return typeof t == "string" && ({}.NODE_ENV === "production" || t.charAt(0) === t.charAt(0).toLowerCase()); +} +var MZ = typeof Symbol == "function" && Symbol.for, DZ = MZ ? Symbol.for("react.memo") : 60115, m2e = MZ ? Symbol.for("react.forward_ref") : 60112, v2e = { childContextTypes: !0, contextType: !0, contextTypes: !0, defaultProps: !0, displayName: !0, getDefaultProps: !0, getDerivedStateFromError: !0, getDerivedStateFromProps: !0, mixins: !0, propTypes: !0, type: !0 }, y2e = { name: !0, length: !0, prototype: !0, caller: !0, callee: !0, arguments: !0, arity: !0 }, NZ = { $$typeof: !0, compare: !0, defaultProps: !0, displayName: !0, propTypes: !0, type: !0 }, b2e = ((aE = {})[m2e] = { $$typeof: !0, render: !0, defaultProps: !0, displayName: !0, propTypes: !0 }, aE[DZ] = NZ, aE); +function M$(t) { + return ("type" in (e = t) && e.type.$$typeof) === DZ ? NZ : "$$typeof" in t ? b2e[t.$$typeof] : v2e; + var e; +} +var x2e = Object.defineProperty, w2e = Object.getOwnPropertyNames, D$ = Object.getOwnPropertySymbols, O2e = Object.getOwnPropertyDescriptor, k2e = Object.getPrototypeOf, N$ = Object.prototype; +function IZ(t, e, r) { + if (typeof e != "string") { + if (N$) { + var n = k2e(e); + n && n !== N$ && IZ(t, n, r); + } + var i = w2e(e); + D$ && (i = i.concat(D$(e))); + for (var s = M$(t), a = M$(e), o = 0; o < i.length; ++o) { + var l = i[o]; + if (!(l in y2e || r && r[l] || a && l in a || s && l in s)) { + var u = O2e(e, l); try { - UOn(r, w, O); + x2e(t, l, u); } catch { } } } } - return r; + return t; } -function nF(r) { - return typeof r == "function"; +function Sg(t) { + return typeof t == "function"; } -function eze(r) { - return typeof r == "object" && "styledComponentId" in r; +function CR(t) { + return typeof t == "object" && "styledComponentId" in t; } -function jM(r, n) { - return r && n ? "".concat(r, " ").concat(n) : r || n || ""; +function Td(t, e) { + return t && e ? "".concat(t, " ").concat(e) : t || e || ""; } -function o_t(r, n) { - if (r.length === 0) +function I$(t, e) { + if (t.length === 0) return ""; - for (var s = r[0], a = 1; a < r.length; a++) - s += n ? n + r[a] : r[a]; - return s; + for (var r = t[0], n = 1; n < t.length; n++) + r += e ? e + t[n] : t[n]; + return r; } -function rF(r) { - return r !== null && typeof r == "object" && r.constructor.name === Object.name && !("props" in r && r.$$typeof); +function Tg(t) { + return t !== null && typeof t == "object" && t.constructor.name === Object.name && !("props" in t && t.$$typeof); } -function BBe(r, n, s) { - if (s === void 0 && (s = !1), !s && !rF(r) && !Array.isArray(r)) - return n; - if (Array.isArray(n)) - for (var a = 0; a < n.length; a++) - r[a] = BBe(r[a], n[a]); - else if (rF(n)) - for (var a in n) - r[a] = BBe(r[a], n[a]); - return r; +function EA(t, e, r) { + if (r === void 0 && (r = !1), !r && !Tg(t) && !Array.isArray(t)) + return e; + if (Array.isArray(e)) + for (var n = 0; n < e.length; n++) + t[n] = EA(t[n], e[n]); + else if (Tg(e)) + for (var n in e) + t[n] = EA(t[n], e[n]); + return t; } -function tze(r, n) { - Object.defineProperty(r, "toString", { value: n }); +function ER(t, e) { + Object.defineProperty(t, "toString", { value: e }); } -var GOn = {}.NODE_ENV !== "production" ? { 1: `Cannot create styled-component for component: %s. +var S2e = {}.NODE_ENV !== "production" ? { 1: `Cannot create styled-component for component: %s. `, 2: `Can't collect styles once you've consumed a \`ServerStyleSheet\`'s styles! \`ServerStyleSheet\` is a one off instance for each server-side render cycle. @@ -1529,410 +1538,410 @@ as for instance in your render method then you may be running into this limitati `, 17: `CSSStyleSheet could not be found on HTMLStyleElement. Has styled-components' style tag been unmounted or altered by another script? `, 18: "ThemeProvider: Please make sure your useTheme hook is within a ``" } : {}; -function ZOn() { - for (var r = [], n = 0; n < arguments.length; n++) - r[n] = arguments[n]; - for (var s = r[0], a = [], l = 1, h = r.length; l < h; l += 1) - a.push(r[l]); - return a.forEach(function(f) { - s = s.replace(/%[a-z]/, f); - }), s; +function T2e() { + for (var t = [], e = 0; e < arguments.length; e++) + t[e] = arguments[e]; + for (var r = t[0], n = [], i = 1, s = t.length; i < s; i += 1) + n.push(t[i]); + return n.forEach(function(a) { + r = r.replace(/%[a-z]/, a); + }), r; } -function HF(r) { - for (var n = [], s = 1; s < arguments.length; s++) - n[s - 1] = arguments[s]; - return {}.NODE_ENV === "production" ? new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(r, " for more information.").concat(n.length > 0 ? " Args: ".concat(n.join(", ")) : "")) : new Error(ZOn.apply(void 0, KB([GOn[r]], n, !1)).trim()); +function D1(t) { + for (var e = [], r = 1; r < arguments.length; r++) + e[r - 1] = arguments[r]; + return {}.NODE_ENV === "production" ? new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t, " for more information.").concat(e.length > 0 ? " Args: ".concat(e.join(", ")) : "")) : new Error(T2e.apply(void 0, xg([S2e[t]], e, !1)).trim()); } -var XOn = function() { - function r(n) { - this.groupSizes = new Uint32Array(512), this.length = 512, this.tag = n; +var C2e = function() { + function t(e) { + this.groupSizes = new Uint32Array(512), this.length = 512, this.tag = e; } - return r.prototype.indexOfGroup = function(n) { - for (var s = 0, a = 0; a < n; a++) - s += this.groupSizes[a]; - return s; - }, r.prototype.insertRules = function(n, s) { - if (n >= this.groupSizes.length) { - for (var a = this.groupSizes, l = a.length, h = l; n >= h; ) - if ((h <<= 1) < 0) - throw HF(16, "".concat(n)); - this.groupSizes = new Uint32Array(h), this.groupSizes.set(a), this.length = h; - for (var f = l; f < h; f++) - this.groupSizes[f] = 0; - } - for (var b = this.indexOfGroup(n + 1), w = (f = 0, s.length); f < w; f++) - this.tag.insertRule(b, s[f]) && (this.groupSizes[n]++, b++); - }, r.prototype.clearGroup = function(n) { - if (n < this.length) { - var s = this.groupSizes[n], a = this.indexOfGroup(n), l = a + s; - this.groupSizes[n] = 0; - for (var h = a; h < l; h++) - this.tag.deleteRule(a); - } - }, r.prototype.getGroup = function(n) { - var s = ""; - if (n >= this.length || this.groupSizes[n] === 0) - return s; - for (var a = this.groupSizes[n], l = this.indexOfGroup(n), h = l + a, f = l; f < h; f++) - s += "".concat(this.tag.getRule(f)).concat(KQe); - return s; - }, r; -}(), zme = /* @__PURE__ */ new Map(), Bbe = /* @__PURE__ */ new Map(), qme = 1, Pge = function(r) { - if (zme.has(r)) - return zme.get(r); - for (; Bbe.has(qme); ) - qme++; - var n = qme++; - if ({}.NODE_ENV !== "production" && ((0 | n) < 0 || n > 1073741824)) - throw HF(16, "".concat(n)); - return zme.set(r, n), Bbe.set(n, r), n; -}, KOn = function(r, n) { - qme = n + 1, zme.set(r, n), Bbe.set(n, r); -}, JOn = "style[".concat(rP, "][").concat(gDt, '="').concat(W2e, '"]'), ekn = new RegExp("^".concat(rP, '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')), tkn = function(r, n, s) { - for (var a, l = s.split(","), h = 0, f = l.length; h < f; h++) - (a = l[h]) && r.registerName(n, a); -}, nkn = function(r, n) { - for (var s, a = ((s = n.textContent) !== null && s !== void 0 ? s : "").split(KQe), l = [], h = 0, f = a.length; h < f; h++) { - var b = a[h].trim(); - if (b) { - var w = b.match(ekn); - if (w) { - var O = 0 | parseInt(w[1], 10), S = w[2]; - O !== 0 && (KOn(S, O), tkn(r, S, w[3]), r.getTag().insertRules(O, l)), l.length = 0; + return t.prototype.indexOfGroup = function(e) { + for (var r = 0, n = 0; n < e; n++) + r += this.groupSizes[n]; + return r; + }, t.prototype.insertRules = function(e, r) { + if (e >= this.groupSizes.length) { + for (var n = this.groupSizes, i = n.length, s = i; e >= s; ) + if ((s <<= 1) < 0) + throw D1(16, "".concat(e)); + this.groupSizes = new Uint32Array(s), this.groupSizes.set(n), this.length = s; + for (var a = i; a < s; a++) + this.groupSizes[a] = 0; + } + for (var o = this.indexOfGroup(e + 1), l = (a = 0, r.length); a < l; a++) + this.tag.insertRule(o, r[a]) && (this.groupSizes[e]++, o++); + }, t.prototype.clearGroup = function(e) { + if (e < this.length) { + var r = this.groupSizes[e], n = this.indexOfGroup(e), i = n + r; + this.groupSizes[e] = 0; + for (var s = n; s < i; s++) + this.tag.deleteRule(n); + } + }, t.prototype.getGroup = function(e) { + var r = ""; + if (e >= this.length || this.groupSizes[e] === 0) + return r; + for (var n = this.groupSizes[e], i = this.indexOfGroup(e), s = i + n, a = i; a < s; a++) + r += "".concat(this.tag.getRule(a)).concat(SR); + return r; + }, t; +}(), JO = /* @__PURE__ */ new Map(), p5 = /* @__PURE__ */ new Map(), e4 = 1, aw = function(t) { + if (JO.has(t)) + return JO.get(t); + for (; p5.has(e4); ) + e4++; + var e = e4++; + if ({}.NODE_ENV !== "production" && ((0 | e) < 0 || e > 1073741824)) + throw D1(16, "".concat(e)); + return JO.set(t, e), p5.set(e, t), e; +}, E2e = function(t, e) { + e4 = e + 1, JO.set(t, e), p5.set(e, t); +}, _2e = "style[".concat(Hd, "][").concat(_Z, '="').concat(RS, '"]'), A2e = new RegExp("^".concat(Hd, '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')), L2e = function(t, e, r) { + for (var n, i = r.split(","), s = 0, a = i.length; s < a; s++) + (n = i[s]) && t.registerName(e, n); +}, R2e = function(t, e) { + for (var r, n = ((r = e.textContent) !== null && r !== void 0 ? r : "").split(SR), i = [], s = 0, a = n.length; s < a; s++) { + var o = n[s].trim(); + if (o) { + var l = o.match(A2e); + if (l) { + var u = 0 | parseInt(l[1], 10), h = l[2]; + u !== 0 && (E2e(h, u), L2e(t, h, l[3]), t.getTag().insertRules(u, i)), i.length = 0; } else - l.push(b); + i.push(o); } } }; -function rkn() { +function M2e() { return typeof __webpack_nonce__ < "u" ? __webpack_nonce__ : null; } -var xDt = function(r) { - var n = document.head, s = r || n, a = document.createElement("style"), l = function(b) { - var w = Array.from(b.querySelectorAll("style[".concat(rP, "]"))); - return w[w.length - 1]; - }(s), h = l !== void 0 ? l.nextSibling : null; - a.setAttribute(rP, pDt), a.setAttribute(gDt, W2e); - var f = rkn(); - return f && a.setAttribute("nonce", f), s.insertBefore(a, h), a; -}, ikn = function() { - function r(n) { - this.element = xDt(n), this.element.appendChild(document.createTextNode("")), this.sheet = function(s) { - if (s.sheet) - return s.sheet; - for (var a = document.styleSheets, l = 0, h = a.length; l < h; l++) { - var f = a[l]; - if (f.ownerNode === s) - return f; - } - throw HF(17); +var PZ = function(t) { + var e = document.head, r = t || e, n = document.createElement("style"), i = function(o) { + var l = Array.from(o.querySelectorAll("style[".concat(Hd, "]"))); + return l[l.length - 1]; + }(r), s = i !== void 0 ? i.nextSibling : null; + n.setAttribute(Hd, EZ), n.setAttribute(_Z, RS); + var a = M2e(); + return a && n.setAttribute("nonce", a), r.insertBefore(n, s), n; +}, D2e = function() { + function t(e) { + this.element = PZ(e), this.element.appendChild(document.createTextNode("")), this.sheet = function(r) { + if (r.sheet) + return r.sheet; + for (var n = document.styleSheets, i = 0, s = n.length; i < s; i++) { + var a = n[i]; + if (a.ownerNode === r) + return a; + } + throw D1(17); }(this.element), this.length = 0; } - return r.prototype.insertRule = function(n, s) { + return t.prototype.insertRule = function(e, r) { try { - return this.sheet.insertRule(s, n), this.length++, !0; + return this.sheet.insertRule(r, e), this.length++, !0; } catch { return !1; } - }, r.prototype.deleteRule = function(n) { - this.sheet.deleteRule(n), this.length--; - }, r.prototype.getRule = function(n) { - var s = this.sheet.cssRules[n]; - return s && s.cssText ? s.cssText : ""; - }, r; -}(), skn = function() { - function r(n) { - this.element = xDt(n), this.nodes = this.element.childNodes, this.length = 0; - } - return r.prototype.insertRule = function(n, s) { - if (n <= this.length && n >= 0) { - var a = document.createTextNode(s); - return this.element.insertBefore(a, this.nodes[n] || null), this.length++, !0; + }, t.prototype.deleteRule = function(e) { + this.sheet.deleteRule(e), this.length--; + }, t.prototype.getRule = function(e) { + var r = this.sheet.cssRules[e]; + return r && r.cssText ? r.cssText : ""; + }, t; +}(), N2e = function() { + function t(e) { + this.element = PZ(e), this.nodes = this.element.childNodes, this.length = 0; + } + return t.prototype.insertRule = function(e, r) { + if (e <= this.length && e >= 0) { + var n = document.createTextNode(r); + return this.element.insertBefore(n, this.nodes[e] || null), this.length++, !0; } return !1; - }, r.prototype.deleteRule = function(n) { - this.element.removeChild(this.nodes[n]), this.length--; - }, r.prototype.getRule = function(n) { - return n < this.length ? this.nodes[n].textContent : ""; - }, r; -}(), okn = function() { - function r(n) { + }, t.prototype.deleteRule = function(e) { + this.element.removeChild(this.nodes[e]), this.length--; + }, t.prototype.getRule = function(e) { + return e < this.length ? this.nodes[e].textContent : ""; + }, t; +}(), I2e = function() { + function t(e) { this.rules = [], this.length = 0; } - return r.prototype.insertRule = function(n, s) { - return n <= this.length && (this.rules.splice(n, 0, s), this.length++, !0); - }, r.prototype.deleteRule = function(n) { - this.rules.splice(n, 1), this.length--; - }, r.prototype.getRule = function(n) { - return n < this.length ? this.rules[n] : ""; - }, r; -}(), a_t = JQe, akn = { isServer: !JQe, useCSSOMInjection: !IOn }, SDt = function() { - function r(n, s, a) { - n === void 0 && (n = tF), s === void 0 && (s = {}); - var l = this; - this.options = iv(iv({}, akn), n), this.gs = s, this.names = new Map(a), this.server = !!n.isServer, !this.server && JQe && a_t && (a_t = !1, function(h) { - for (var f = document.querySelectorAll(JOn), b = 0, w = f.length; b < w; b++) { - var O = f[b]; - O && O.getAttribute(rP) !== pDt && (nkn(h, O), O.parentNode && O.parentNode.removeChild(O)); - } - }(this)), tze(this, function() { - return function(h) { - for (var f = h.getTag(), b = f.length, w = "", O = function(E) { - var D = function(H) { - return Bbe.get(H); - }(E); - if (D === void 0) + return t.prototype.insertRule = function(e, r) { + return e <= this.length && (this.rules.splice(e, 0, r), this.length++, !0); + }, t.prototype.deleteRule = function(e) { + this.rules.splice(e, 1), this.length--; + }, t.prototype.getRule = function(e) { + return e < this.length ? this.rules[e] : ""; + }, t; +}(), P$ = TR, P2e = { isServer: !TR, useCSSOMInjection: !c2e }, $Z = function() { + function t(e, r, n) { + e === void 0 && (e = kg), r === void 0 && (r = {}); + var i = this; + this.options = Ra(Ra({}, P2e), e), this.gs = r, this.names = new Map(n), this.server = !!e.isServer, !this.server && TR && P$ && (P$ = !1, function(s) { + for (var a = document.querySelectorAll(_2e), o = 0, l = a.length; o < l; o++) { + var u = a[o]; + u && u.getAttribute(Hd) !== EZ && (R2e(s, u), u.parentNode && u.parentNode.removeChild(u)); + } + }(this)), ER(this, function() { + return function(s) { + for (var a = s.getTag(), o = a.length, l = "", u = function(f) { + var d = function(y) { + return p5.get(y); + }(f); + if (d === void 0) return "continue"; - var M = h.names.get(D), B = f.getGroup(E); - if (M === void 0 || B.length === 0) + var p = s.names.get(d), g = a.getGroup(f); + if (p === void 0 || g.length === 0) return "continue"; - var z = "".concat(rP, ".g").concat(E, '[id="').concat(D, '"]'), W = ""; - M !== void 0 && M.forEach(function(H) { - H.length > 0 && (W += "".concat(H, ",")); - }), w += "".concat(B).concat(z, '{content:"').concat(W, '"}').concat(KQe); - }, S = 0; S < b; S++) - O(S); - return w; - }(l); + var m = "".concat(Hd, ".g").concat(f, '[id="').concat(d, '"]'), v = ""; + p !== void 0 && p.forEach(function(y) { + y.length > 0 && (v += "".concat(y, ",")); + }), l += "".concat(g).concat(m, '{content:"').concat(v, '"}').concat(SR); + }, h = 0; h < o; h++) + u(h); + return l; + }(i); }); } - return r.registerId = function(n) { - return Pge(n); - }, r.prototype.reconstructWithOptions = function(n, s) { - return s === void 0 && (s = !0), new r(iv(iv({}, this.options), n), this.gs, s && this.names || void 0); - }, r.prototype.allocateGSInstance = function(n) { - return this.gs[n] = (this.gs[n] || 0) + 1; - }, r.prototype.getTag = function() { - return this.tag || (this.tag = (n = function(s) { - var a = s.useCSSOMInjection, l = s.target; - return s.isServer ? new okn(l) : a ? new ikn(l) : new skn(l); - }(this.options), new XOn(n))); - var n; - }, r.prototype.hasNameForId = function(n, s) { - return this.names.has(n) && this.names.get(n).has(s); - }, r.prototype.registerName = function(n, s) { - if (Pge(n), this.names.has(n)) - this.names.get(n).add(s); + return t.registerId = function(e) { + return aw(e); + }, t.prototype.reconstructWithOptions = function(e, r) { + return r === void 0 && (r = !0), new t(Ra(Ra({}, this.options), e), this.gs, r && this.names || void 0); + }, t.prototype.allocateGSInstance = function(e) { + return this.gs[e] = (this.gs[e] || 0) + 1; + }, t.prototype.getTag = function() { + return this.tag || (this.tag = (e = function(r) { + var n = r.useCSSOMInjection, i = r.target; + return r.isServer ? new I2e(i) : n ? new D2e(i) : new N2e(i); + }(this.options), new C2e(e))); + var e; + }, t.prototype.hasNameForId = function(e, r) { + return this.names.has(e) && this.names.get(e).has(r); + }, t.prototype.registerName = function(e, r) { + if (aw(e), this.names.has(e)) + this.names.get(e).add(r); else { - var a = /* @__PURE__ */ new Set(); - a.add(s), this.names.set(n, a); - } - }, r.prototype.insertRules = function(n, s, a) { - this.registerName(n, s), this.getTag().insertRules(Pge(n), a); - }, r.prototype.clearNames = function(n) { - this.names.has(n) && this.names.get(n).clear(); - }, r.prototype.clearRules = function(n) { - this.getTag().clearGroup(Pge(n)), this.clearNames(n); - }, r.prototype.clearTag = function() { + var n = /* @__PURE__ */ new Set(); + n.add(r), this.names.set(e, n); + } + }, t.prototype.insertRules = function(e, r, n) { + this.registerName(e, r), this.getTag().insertRules(aw(e), n); + }, t.prototype.clearNames = function(e) { + this.names.has(e) && this.names.get(e).clear(); + }, t.prototype.clearRules = function(e) { + this.getTag().clearGroup(aw(e)), this.clearNames(e); + }, t.prototype.clearTag = function() { this.tag = void 0; - }, r; -}(), ckn = /&/g, lkn = /^\s*\/\/.*$/gm; -function _Dt(r, n) { - return r.map(function(s) { - return s.type === "rule" && (s.value = "".concat(n, " ").concat(s.value), s.value = s.value.replaceAll(",", ",".concat(n, " ")), s.props = s.props.map(function(a) { - return "".concat(n, " ").concat(a); - })), Array.isArray(s.children) && s.type !== "@keyframes" && (s.children = _Dt(s.children, n)), s; + }, t; +}(), $2e = /&/g, B2e = /^\s*\/\/.*$/gm; +function BZ(t, e) { + return t.map(function(r) { + return r.type === "rule" && (r.value = "".concat(e, " ").concat(r.value), r.value = r.value.replaceAll(",", ",".concat(e, " ")), r.props = r.props.map(function(n) { + return "".concat(e, " ").concat(n); + })), Array.isArray(r.children) && r.type !== "@keyframes" && (r.children = BZ(r.children, e)), r; }); } -function CDt(r) { - var n, s, a, l = r === void 0 ? tF : r, h = l.options, f = h === void 0 ? tF : h, b = l.plugins, w = b === void 0 ? Y2e : b, O = function(D, M, B) { - return B === s || B.startsWith(s) && B.endsWith(s) && B.replaceAll(s, "").length > 0 ? ".".concat(n) : D; - }, S = w.slice(); - S.push(function(D) { - D.type === z2e && D.value.includes("&") && (D.props[0] = D.props[0].replace(ckn, s).replace(a, O)); - }), f.prefix && S.push(POn), S.push(AOn); - var E = function(D, M, B, z) { - M === void 0 && (M = ""), B === void 0 && (B = ""), z === void 0 && (z = "&"), n = z, s = M, a = new RegExp("\\".concat(s, "\\b"), "g"); - var W = D.replace(lkn, ""), H = EOn(B || M ? "".concat(B, " ").concat(M, " { ").concat(W, " }") : W); - f.namespace && (H = _Dt(H, f.namespace)); - var G = []; - return $be(H, DOn(S.concat(MOn(function(ee) { - return G.push(ee); - })))), G; +function FZ(t) { + var e, r, n, i = t === void 0 ? kg : t, s = i.options, a = s === void 0 ? kg : s, o = i.plugins, l = o === void 0 ? MS : o, u = function(d, p, g) { + return g === r || g.startsWith(r) && g.endsWith(r) && g.replaceAll(r, "").length > 0 ? ".".concat(e) : d; + }, h = l.slice(); + h.push(function(d) { + d.type === ES && d.value.includes("&") && (d.props[0] = d.props[0].replace($2e, r).replace(n, u)); + }), a.prefix && h.push(o2e), h.push(i2e); + var f = function(d, p, g, m) { + p === void 0 && (p = ""), g === void 0 && (g = ""), m === void 0 && (m = "&"), e = m, r = p, n = new RegExp("\\".concat(r, "\\b"), "g"); + var v = d.replace(B2e, ""), y = r2e(g || p ? "".concat(g, " ").concat(p, " { ").concat(v, " }") : v); + a.namespace && (y = BZ(y, a.namespace)); + var b = []; + return d5(y, s2e(h.concat(a2e(function(w) { + return b.push(w); + })))), b; }; - return E.hash = w.length ? w.reduce(function(D, M) { - return M.name || HF(15), PM(D, M.name); - }, mDt).toString() : "", E; -} -var ukn = new SDt(), FBe = CDt(), nze = nP.createContext({ shouldForwardProp: void 0, styleSheet: ukn, stylis: FBe }); -nze.Consumer; -var hkn = nP.createContext(void 0); -function jBe() { - return KAt(nze); -} -function fkn(r) { - var n = _f(r.stylisPlugins), s = n[0], a = n[1], l = jBe().styleSheet, h = Fd(function() { - var w = l; - return r.sheet ? w = r.sheet : r.target && (w = w.reconstructWithOptions({ target: r.target }, !1)), r.disableCSSOMInjection && (w = w.reconstructWithOptions({ useCSSOMInjection: !1 })), w; - }, [r.disableCSSOMInjection, r.sheet, r.target, l]), f = Fd(function() { - return CDt({ options: { namespace: r.namespace, prefix: r.enableVendorPrefixes }, plugins: s }); - }, [r.enableVendorPrefixes, r.namespace, s]); - H0(function() { - dOn(s, r.stylisPlugins) || a(r.stylisPlugins); - }, [r.stylisPlugins]); - var b = Fd(function() { - return { shouldForwardProp: r.shouldForwardProp, styleSheet: h, stylis: f }; - }, [r.shouldForwardProp, h, f]); - return nP.createElement(nze.Provider, { value: b }, nP.createElement(hkn.Provider, { value: f }, r.children)); -} -var c_t = function() { - function r(n, s) { - var a = this; - this.inject = function(l, h) { - h === void 0 && (h = FBe); - var f = a.name + h.hash; - l.hasNameForId(a.id, f) || l.insertRules(a.id, f, h(a.rules, f, "@keyframes")); - }, this.name = n, this.id = "sc-keyframes-".concat(n), this.rules = s, tze(this, function() { - throw HF(12, String(a.name)); + return f.hash = l.length ? l.reduce(function(d, p) { + return p.name || D1(15), pd(d, p.name); + }, AZ).toString() : "", f; +} +var F2e = new $Z(), _A = FZ(), _R = Gd.createContext({ shouldForwardProp: void 0, styleSheet: F2e, stylis: _A }); +_R.Consumer; +var z2e = Gd.createContext(void 0); +function AA() { + return uZ(_R); +} +function V2e(t) { + var e = Rn(t.stylisPlugins), r = e[0], n = e[1], i = AA().styleSheet, s = ei(function() { + var l = i; + return t.sheet ? l = t.sheet : t.target && (l = l.reconstructWithOptions({ target: t.target }, !1)), t.disableCSSOMInjection && (l = l.reconstructWithOptions({ useCSSOMInjection: !1 })), l; + }, [t.disableCSSOMInjection, t.sheet, t.target, i]), a = ei(function() { + return FZ({ options: { namespace: t.namespace, prefix: t.enableVendorPrefixes }, plugins: r }); + }, [t.enableVendorPrefixes, t.namespace, r]); + Qi(function() { + Uye(r, t.stylisPlugins) || n(t.stylisPlugins); + }, [t.stylisPlugins]); + var o = ei(function() { + return { shouldForwardProp: t.shouldForwardProp, styleSheet: s, stylis: a }; + }, [t.shouldForwardProp, s, a]); + return Gd.createElement(_R.Provider, { value: o }, Gd.createElement(z2e.Provider, { value: a }, t.children)); +} +var $$ = function() { + function t(e, r) { + var n = this; + this.inject = function(i, s) { + s === void 0 && (s = _A); + var a = n.name + s.hash; + i.hasNameForId(n.id, a) || i.insertRules(n.id, a, s(n.rules, a, "@keyframes")); + }, this.name = e, this.id = "sc-keyframes-".concat(e), this.rules = r, ER(this, function() { + throw D1(12, String(n.name)); }); } - return r.prototype.getName = function(n) { - return n === void 0 && (n = FBe), this.name + n.hash; - }, r; -}(), dkn = function(r) { - return r >= "A" && r <= "Z"; + return t.prototype.getName = function(e) { + return e === void 0 && (e = _A), this.name + e.hash; + }, t; +}(), U2e = function(t) { + return t >= "A" && t <= "Z"; }; -function l_t(r) { - for (var n = "", s = 0; s < r.length; s++) { - var a = r[s]; - if (s === 1 && a === "-" && r[0] === "-") - return r; - dkn(a) ? n += "-" + a.toLowerCase() : n += a; - } - return n.startsWith("ms-") ? "-" + n : n; -} -var EDt = function(r) { - return r == null || r === !1 || r === ""; -}, TDt = function(r) { - var n, s, a = []; - for (var l in r) { - var h = r[l]; - r.hasOwnProperty(l) && !EDt(h) && (Array.isArray(h) && h.isCss || nF(h) ? a.push("".concat(l_t(l), ":"), h, ";") : rF(h) ? a.push.apply(a, KB(KB(["".concat(l, " {")], TDt(h), !1), ["}"], !1)) : a.push("".concat(l_t(l), ": ").concat((n = l, (s = h) == null || typeof s == "boolean" || s === "" ? "" : typeof s != "number" || s === 0 || n in LOn || n.startsWith("--") ? String(s).trim() : "".concat(s, "px")), ";"))); +function B$(t) { + for (var e = "", r = 0; r < t.length; r++) { + var n = t[r]; + if (r === 1 && n === "-" && t[0] === "-") + return t; + U2e(n) ? e += "-" + n.toLowerCase() : e += n; + } + return e.startsWith("ms-") ? "-" + e : e; +} +var zZ = function(t) { + return t == null || t === !1 || t === ""; +}, VZ = function(t) { + var e, r, n = []; + for (var i in t) { + var s = t[i]; + t.hasOwnProperty(i) && !zZ(s) && (Array.isArray(s) && s.isCss || Sg(s) ? n.push("".concat(B$(i), ":"), s, ";") : Tg(s) ? n.push.apply(n, xg(xg(["".concat(i, " {")], VZ(s), !1), ["}"], !1)) : n.push("".concat(B$(i), ": ").concat((e = i, (r = s) == null || typeof r == "boolean" || r === "" ? "" : typeof r != "number" || r === 0 || e in l2e || e.startsWith("--") ? String(r).trim() : "".concat(r, "px")), ";"))); } - return a; + return n; }; -function HM(r, n, s, a) { - if (EDt(r)) +function zd(t, e, r, n) { + if (zZ(t)) return []; - if (eze(r)) - return [".".concat(r.styledComponentId)]; - if (nF(r)) { - if (!nF(h = r) || h.prototype && h.prototype.isReactComponent || !n) - return [r]; - var l = r(n); - return {}.NODE_ENV === "production" || typeof l != "object" || Array.isArray(l) || l instanceof c_t || rF(l) || l === null || console.error("".concat(vDt(r), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")), HM(l, n, s, a); + if (CR(t)) + return [".".concat(t.styledComponentId)]; + if (Sg(t)) { + if (!Sg(s = t) || s.prototype && s.prototype.isReactComponent || !e) + return [t]; + var i = t(e); + return {}.NODE_ENV === "production" || typeof i != "object" || Array.isArray(i) || i instanceof $$ || Tg(i) || i === null || console.error("".concat(RZ(t), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")), zd(i, e, r, n); } - var h; - return r instanceof c_t ? s ? (r.inject(s, a), [r.getName(a)]) : [r] : rF(r) ? TDt(r) : Array.isArray(r) ? Array.prototype.concat.apply(Y2e, r.map(function(f) { - return HM(f, n, s, a); - })) : [r.toString()]; -} -function pkn(r) { - for (var n = 0; n < r.length; n += 1) { - var s = r[n]; - if (nF(s) && !eze(s)) + var s; + return t instanceof $$ ? r ? (t.inject(r, n), [t.getName(n)]) : [t] : Tg(t) ? VZ(t) : Array.isArray(t) ? Array.prototype.concat.apply(MS, t.map(function(a) { + return zd(a, e, r, n); + })) : [t.toString()]; +} +function q2e(t) { + for (var e = 0; e < t.length; e += 1) { + var r = t[e]; + if (Sg(r) && !CR(r)) return !1; } return !0; } -var gkn = bDt(W2e), mkn = function() { - function r(n, s, a) { - this.rules = n, this.staticRulesId = "", this.isStatic = {}.NODE_ENV === "production" && (a === void 0 || a.isStatic) && pkn(n), this.componentId = s, this.baseHash = PM(gkn, s), this.baseStyle = a, SDt.registerId(s); +var Q2e = LZ(RS), Y2e = function() { + function t(e, r, n) { + this.rules = e, this.staticRulesId = "", this.isStatic = {}.NODE_ENV === "production" && (n === void 0 || n.isStatic) && q2e(e), this.componentId = r, this.baseHash = pd(Q2e, r), this.baseStyle = n, $Z.registerId(r); } - return r.prototype.generateAndInjectStyles = function(n, s, a) { - var l = this.baseStyle ? this.baseStyle.generateAndInjectStyles(n, s, a) : ""; - if (this.isStatic && !a.hash) - if (this.staticRulesId && s.hasNameForId(this.componentId, this.staticRulesId)) - l = jM(l, this.staticRulesId); + return t.prototype.generateAndInjectStyles = function(e, r, n) { + var i = this.baseStyle ? this.baseStyle.generateAndInjectStyles(e, r, n) : ""; + if (this.isStatic && !n.hash) + if (this.staticRulesId && r.hasNameForId(this.componentId, this.staticRulesId)) + i = Td(i, this.staticRulesId); else { - var h = o_t(HM(this.rules, n, s, a)), f = $Be(PM(this.baseHash, h) >>> 0); - if (!s.hasNameForId(this.componentId, f)) { - var b = a(h, ".".concat(f), void 0, this.componentId); - s.insertRules(this.componentId, f, b); + var s = I$(zd(this.rules, e, r, n)), a = CA(pd(this.baseHash, s) >>> 0); + if (!r.hasNameForId(this.componentId, a)) { + var o = n(s, ".".concat(a), void 0, this.componentId); + r.insertRules(this.componentId, a, o); } - l = jM(l, f), this.staticRulesId = f; + i = Td(i, a), this.staticRulesId = a; } else { - for (var w = PM(this.baseHash, a.hash), O = "", S = 0; S < this.rules.length; S++) { - var E = this.rules[S]; - if (typeof E == "string") - O += E, {}.NODE_ENV !== "production" && (w = PM(w, E)); - else if (E) { - var D = o_t(HM(E, n, s, a)); - w = PM(w, D + S), O += D; - } - } - if (O) { - var M = $Be(w >>> 0); - s.hasNameForId(this.componentId, M) || s.insertRules(this.componentId, M, a(O, ".".concat(M), void 0, this.componentId)), l = jM(l, M); - } - } - return l; - }, r; -}(), ADt = nP.createContext(void 0); -ADt.Consumer; -var dRe = {}, u_t = /* @__PURE__ */ new Set(); -function bkn(r, n, s) { - var a = eze(r), l = r, h = !fRe(r), f = n.attrs, b = f === void 0 ? Y2e : f, w = n.componentId, O = w === void 0 ? function(le, se) { - var he = typeof le != "string" ? "sc" : t_t(le); - dRe[he] = (dRe[he] || 0) + 1; - var te = "".concat(he, "-").concat(jOn(W2e + he + dRe[he])); - return se ? "".concat(se, "-").concat(te) : te; - }(n.displayName, n.parentComponentId) : w, S = n.displayName, E = S === void 0 ? function(le) { - return fRe(le) ? "styled.".concat(le) : "Styled(".concat(vDt(le), ")"); - }(r) : S, D = n.displayName && n.componentId ? "".concat(t_t(n.displayName), "-").concat(n.componentId) : n.componentId || O, M = a && l.attrs ? l.attrs.concat(b).filter(Boolean) : b, B = n.shouldForwardProp; - if (a && l.shouldForwardProp) { - var z = l.shouldForwardProp; - if (n.shouldForwardProp) { - var W = n.shouldForwardProp; - B = function(le, se) { - return z(le, se) && W(le, se); + for (var l = pd(this.baseHash, n.hash), u = "", h = 0; h < this.rules.length; h++) { + var f = this.rules[h]; + if (typeof f == "string") + u += f, {}.NODE_ENV !== "production" && (l = pd(l, f)); + else if (f) { + var d = I$(zd(f, e, r, n)); + l = pd(l, d + h), u += d; + } + } + if (u) { + var p = CA(l >>> 0); + r.hasNameForId(this.componentId, p) || r.insertRules(this.componentId, p, n(u, ".".concat(p), void 0, this.componentId)), i = Td(i, p); + } + } + return i; + }, t; +}(), UZ = Gd.createContext(void 0); +UZ.Consumer; +var lE = {}, F$ = /* @__PURE__ */ new Set(); +function W2e(t, e, r) { + var n = CR(t), i = t, s = !oE(t), a = e.attrs, o = a === void 0 ? MS : a, l = e.componentId, u = l === void 0 ? function(O, S) { + var C = typeof O != "string" ? "sc" : L$(O); + lE[C] = (lE[C] || 0) + 1; + var T = "".concat(C, "-").concat(g2e(RS + C + lE[C])); + return S ? "".concat(S, "-").concat(T) : T; + }(e.displayName, e.parentComponentId) : l, h = e.displayName, f = h === void 0 ? function(O) { + return oE(O) ? "styled.".concat(O) : "Styled(".concat(RZ(O), ")"); + }(t) : h, d = e.displayName && e.componentId ? "".concat(L$(e.displayName), "-").concat(e.componentId) : e.componentId || u, p = n && i.attrs ? i.attrs.concat(o).filter(Boolean) : o, g = e.shouldForwardProp; + if (n && i.shouldForwardProp) { + var m = i.shouldForwardProp; + if (e.shouldForwardProp) { + var v = e.shouldForwardProp; + g = function(O, S) { + return m(O, S) && v(O, S); }; } else - B = z; - } - var H = new mkn(s, D, a ? l.componentStyle : void 0); - function G(le, se) { - return function(he, te, be) { - var fe = he.attrs, ae = he.componentStyle, ke = he.defaultProps, we = he.foldedComponentIds, Ce = he.styledComponentId, X = he.target, Ie = nP.useContext(ADt), ge = jBe(), Fe = he.shouldForwardProp || ge.shouldForwardProp; - ({}).NODE_ENV !== "production" && ABe(Ce); - var ve = function(It, cn, lt) { - for (var pr, At = iv(iv({}, cn), { className: void 0, theme: lt }), St = 0; St < It.length; St += 1) { - var yt = nF(pr = It[St]) ? pr(At) : pr; - for (var Et in yt) - At[Et] = Et === "className" ? jM(At[Et], yt[Et]) : Et === "style" ? iv(iv({}, At[Et]), yt[Et]) : yt[Et]; - } - return cn.className && (At.className = jM(At.className, cn.className)), At; - }(fe, te, ROn(te, Ie, ke) || tF), Ve = ve.as || X, tt = {}; - for (var wt in ve) - ve[wt] === void 0 || wt[0] === "$" || wt === "as" || wt === "theme" || (wt === "forwardedAs" ? tt.as = ve.forwardedAs : Fe && !Fe(wt, Ve) || (tt[wt] = ve[wt], Fe || {}.NODE_ENV !== "development" || P3n(wt) || u_t.has(wt) || !RBe.has(Ve) || (u_t.add(wt), console.warn('styled-components: it looks like an unknown prop "'.concat(wt, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)'))))); - var dt = function(It, cn) { - var lt = jBe(), pr = It.generateAndInjectStyles(cn, lt.styleSheet, lt.stylis); - return {}.NODE_ENV !== "production" && ABe(pr), pr; - }(ae, ve); - ({}).NODE_ENV !== "production" && he.warnTooManyClasses && he.warnTooManyClasses(dt); - var Dt = jM(we, Ce); - return dt && (Dt += " " + dt), ve.className && (Dt += " " + ve.className), tt[fRe(Ve) && !RBe.has(Ve) ? "class" : "className"] = Dt, tt.ref = be, pk(Ve, tt); - }(ee, le, se); - } - G.displayName = E; - var ee = nP.forwardRef(G); - return ee.attrs = M, ee.componentStyle = H, ee.displayName = E, ee.shouldForwardProp = B, ee.foldedComponentIds = a ? jM(l.foldedComponentIds, l.styledComponentId) : "", ee.styledComponentId = D, ee.target = a ? l.target : r, Object.defineProperty(ee, "defaultProps", { get: function() { + g = m; + } + var y = new Y2e(r, d, n ? i.componentStyle : void 0); + function b(O, S) { + return function(C, T, A) { + var E = C.attrs, L = C.componentStyle, _ = C.defaultProps, R = C.foldedComponentIds, $ = C.styledComponentId, k = C.target, N = Gd.useContext(UZ), M = AA(), I = C.shouldForwardProp || M.shouldForwardProp; + ({}).NODE_ENV !== "production" && yA($); + var D = function(G, ee, Y) { + for (var ne, ie = Ra(Ra({}, ee), { className: void 0, theme: Y }), U = 0; U < G.length; U += 1) { + var Z = Sg(ne = G[U]) ? ne(ie) : ne; + for (var W in Z) + ie[W] = W === "className" ? Td(ie[W], Z[W]) : W === "style" ? Ra(Ra({}, ie[W]), Z[W]) : Z[W]; + } + return ee.className && (ie.className = Td(ie.className, ee.className)), ie; + }(E, T, h2e(T, N, _) || kg), P = D.as || k, F = {}; + for (var B in D) + D[B] === void 0 || B[0] === "$" || B === "as" || B === "theme" || (B === "forwardedAs" ? F.as = D.forwardedAs : I && !I(B, P) || (F[B] = D[B], I || {}.NODE_ENV !== "development" || oye(B) || F$.has(B) || !TA.has(P) || (F$.add(B), console.warn('styled-components: it looks like an unknown prop "'.concat(B, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)'))))); + var V = function(G, ee) { + var Y = AA(), ne = G.generateAndInjectStyles(ee, Y.styleSheet, Y.stylis); + return {}.NODE_ENV !== "production" && yA(ne), ne; + }(L, D); + ({}).NODE_ENV !== "production" && C.warnTooManyClasses && C.warnTooManyClasses(V); + var Q = Td(R, $); + return V && (Q += " " + V), D.className && (Q += " " + D.className), F[oE(P) && !TA.has(P) ? "class" : "className"] = Q, F.ref = A, Rl(P, F); + }(w, O, S); + } + b.displayName = f; + var w = Gd.forwardRef(b); + return w.attrs = p, w.componentStyle = y, w.displayName = f, w.shouldForwardProp = g, w.foldedComponentIds = n ? Td(i.foldedComponentIds, i.styledComponentId) : "", w.styledComponentId = d, w.target = n ? i.target : t, Object.defineProperty(w, "defaultProps", { get: function() { return this._foldedDefaultProps; - }, set: function(le) { - this._foldedDefaultProps = a ? function(se) { - for (var he = [], te = 1; te < arguments.length; te++) - he[te - 1] = arguments[te]; - for (var be = 0, fe = he; be < fe.length; be++) - BBe(se, fe[be], !0); - return se; - }({}, l.defaultProps, le) : le; - } }), {}.NODE_ENV !== "production" && (NOn(E, D), ee.warnTooManyClasses = function(le, se) { - var he = {}, te = !1; - return function(be) { - if (!te && (he[be] = !0, Object.keys(he).length >= 200)) { - var fe = se ? ' with the id of "'.concat(se, '"') : ""; - console.warn("Over ".concat(200, " classes were generated for component ").concat(le).concat(fe, `. + }, set: function(O) { + this._foldedDefaultProps = n ? function(S) { + for (var C = [], T = 1; T < arguments.length; T++) + C[T - 1] = arguments[T]; + for (var A = 0, E = C; A < E.length; A++) + EA(S, E[A], !0); + return S; + }({}, i.defaultProps, O) : O; + } }), {}.NODE_ENV !== "production" && (u2e(f, d), w.warnTooManyClasses = function(O, S) { + var C = {}, T = !1; + return function(A) { + if (!T && (C[A] = !0, Object.keys(C).length >= 200)) { + var E = S ? ' with the id of "'.concat(S, '"') : ""; + console.warn("Over ".concat(200, " classes were generated for component ").concat(O).concat(E, `. `) + `Consider using the attrs method, together with a style object for frequently changed styles. Example: const Component = styled.div.attrs(props => ({ @@ -1941,128 +1950,128 @@ Example: }, }))\`width: 100%;\` - `), te = !0, he = {}; + `), T = !0, C = {}; } }; - }(E, D)), tze(ee, function() { - return ".".concat(ee.styledComponentId); - }), h && kDt(ee, r, { attrs: !0, componentStyle: !0, displayName: !0, foldedComponentIds: !0, shouldForwardProp: !0, styledComponentId: !0, target: !0 }), ee; + }(f, d)), ER(w, function() { + return ".".concat(w.styledComponentId); + }), s && IZ(w, t, { attrs: !0, componentStyle: !0, displayName: !0, foldedComponentIds: !0, shouldForwardProp: !0, styledComponentId: !0, target: !0 }), w; } -function h_t(r, n) { - for (var s = [r[0]], a = 0, l = n.length; a < l; a += 1) - s.push(n[a], r[a + 1]); - return s; +function z$(t, e) { + for (var r = [t[0]], n = 0, i = e.length; n < i; n += 1) + r.push(e[n], t[n + 1]); + return r; } -var f_t = function(r) { - return Object.assign(r, { isCss: !0 }); -}; -function $X(r) { - for (var n = [], s = 1; s < arguments.length; s++) - n[s - 1] = arguments[s]; - if (nF(r) || rF(r)) - return f_t(HM(h_t(Y2e, KB([r], n, !0)))); - var a = r; - return n.length === 0 && a.length === 1 && typeof a[0] == "string" ? HM(a) : f_t(HM(h_t(a, n))); -} -function QBe(r, n, s) { - if (s === void 0 && (s = tF), !n) - throw HF(1, n); - var a = function(l) { - for (var h = [], f = 1; f < arguments.length; f++) - h[f - 1] = arguments[f]; - return r(n, s, $X.apply(void 0, KB([l], h, !1))); +var V$ = function(t) { + return Object.assign(t, { isCss: !0 }); +}; +function Uv(t) { + for (var e = [], r = 1; r < arguments.length; r++) + e[r - 1] = arguments[r]; + if (Sg(t) || Tg(t)) + return V$(zd(z$(MS, xg([t], e, !0)))); + var n = t; + return e.length === 0 && n.length === 1 && typeof n[0] == "string" ? zd(n) : V$(zd(z$(n, e))); +} +function LA(t, e, r) { + if (r === void 0 && (r = kg), !e) + throw D1(1, e); + var n = function(i) { + for (var s = [], a = 1; a < arguments.length; a++) + s[a - 1] = arguments[a]; + return t(e, r, Uv.apply(void 0, xg([i], s, !1))); }; - return a.attrs = function(l) { - return QBe(r, n, iv(iv({}, s), { attrs: Array.prototype.concat(s.attrs, l).filter(Boolean) })); - }, a.withConfig = function(l) { - return QBe(r, n, iv(iv({}, s), l)); - }, a; + return n.attrs = function(i) { + return LA(t, e, Ra(Ra({}, r), { attrs: Array.prototype.concat(r.attrs, i).filter(Boolean) })); + }, n.withConfig = function(i) { + return LA(t, e, Ra(Ra({}, r), i)); + }, n; } -var DDt = function(r) { - return QBe(bkn, r); -}, ga = DDt; -RBe.forEach(function(r) { - ga[r] = DDt(r); +var qZ = function(t) { + return LA(W2e, t); +}, ar = qZ; +TA.forEach(function(t) { + ar[t] = qZ(t); }); ({}).NODE_ENV !== "production" && typeof navigator < "u" && navigator.product === "ReactNative" && console.warn(`It looks like you've imported 'styled-components' on React Native. Perhaps you're looking to import 'styled-components/native'? Read more about this at https://www.styled-components.com/docs/basics#react-native`); -var Lge = "__sc-".concat(rP, "__"); -({}).NODE_ENV !== "production" && {}.NODE_ENV !== "test" && typeof window < "u" && (window[Lge] || (window[Lge] = 0), window[Lge] === 1 && console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason. +var ow = "__sc-".concat(Hd, "__"); +({}).NODE_ENV !== "production" && {}.NODE_ENV !== "test" && typeof window < "u" && (window[ow] || (window[ow] = 0), window[ow] === 1 && console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason. -See https://s-c.sh/2BAXzed for more info.`), window[Lge] += 1); -class Al { - lineAt(n) { - if (n < 0 || n > this.length) - throw new RangeError(`Invalid position ${n} in document of length ${this.length}`); - return this.lineInner(n, !1, 1, 0); - } - line(n) { - if (n < 1 || n > this.lines) - throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`); - return this.lineInner(n, !0, 1, 0); - } - replace(n, s, a) { - [n, s] = iF(this, n, s); - let l = []; - return this.decompose(0, n, l, 2), a.length && a.decompose(0, a.length, l, 3), this.decompose(s, this.length, l, 1), U4.from(l, this.length - (s - n) + a.length); - } - append(n) { - return this.replace(this.length, this.length, n); - } - slice(n, s = this.length) { - [n, s] = iF(this, n, s); - let a = []; - return this.decompose(n, s, a, 0), U4.from(a, s - n); +See https://s-c.sh/2BAXzed for more info.`), window[ow] += 1); +class Dr { + lineAt(e) { + if (e < 0 || e > this.length) + throw new RangeError(`Invalid position ${e} in document of length ${this.length}`); + return this.lineInner(e, !1, 1, 0); + } + line(e) { + if (e < 1 || e > this.lines) + throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`); + return this.lineInner(e, !0, 1, 0); + } + replace(e, r, n) { + [e, r] = Cg(this, e, r); + let i = []; + return this.decompose(0, e, i, 2), n.length && n.decompose(0, n.length, i, 3), this.decompose(r, this.length, i, 1), hc.from(i, this.length - (r - e) + n.length); + } + append(e) { + return this.replace(this.length, this.length, e); + } + slice(e, r = this.length) { + [e, r] = Cg(this, e, r); + let n = []; + return this.decompose(e, r, n, 0), hc.from(n, r - e); } - eq(n) { - if (n == this) + eq(e) { + if (e == this) return !0; - if (n.length != this.length || n.lines != this.lines) + if (e.length != this.length || e.lines != this.lines) return !1; - let s = this.scanIdentical(n, 1), a = this.length - this.scanIdentical(n, -1), l = new BX(this), h = new BX(n); - for (let f = s, b = s; ; ) { - if (l.next(f), h.next(f), f = 0, l.lineBreak != h.lineBreak || l.done != h.done || l.value != h.value) + let r = this.scanIdentical(e, 1), n = this.length - this.scanIdentical(e, -1), i = new qv(this), s = new qv(e); + for (let a = r, o = r; ; ) { + if (i.next(a), s.next(a), a = 0, i.lineBreak != s.lineBreak || i.done != s.done || i.value != s.value) return !1; - if (b += l.value.length, l.done || b >= a) + if (o += i.value.length, i.done || o >= n) return !0; } } - iter(n = 1) { - return new BX(this, n); + iter(e = 1) { + return new qv(this, e); } - iterRange(n, s = this.length) { - return new MDt(this, n, s); + iterRange(e, r = this.length) { + return new QZ(this, e, r); } - iterLines(n, s) { - let a; - if (n == null) - a = this.iter(); + iterLines(e, r) { + let n; + if (e == null) + n = this.iter(); else { - s == null && (s = this.lines + 1); - let l = this.line(n).from; - a = this.iterRange(l, Math.max(l, s == this.lines + 1 ? this.length : s <= 1 ? 0 : this.line(s - 1).to)); + r == null && (r = this.lines + 1); + let i = this.line(e).from; + n = this.iterRange(i, Math.max(i, r == this.lines + 1 ? this.length : r <= 1 ? 0 : this.line(r - 1).to)); } - return new PDt(a); + return new YZ(n); } toString() { return this.sliceString(0); } toJSON() { - let n = []; - return this.flatten(n), n; + let e = []; + return this.flatten(e), e; } constructor() { } - static of(n) { - if (n.length == 0) + static of(e) { + if (e.length == 0) throw new RangeError("A document must have at least one line"); - return n.length == 1 && !n[0] ? Al.empty : n.length <= 32 ? new Id(n) : U4.from(Id.split(n, [])); + return e.length == 1 && !e[0] ? Dr.empty : e.length <= 32 ? new Zn(e) : hc.from(Zn.split(e, [])); } } -class Id extends Al { - constructor(n, s = vkn(n)) { - super(), this.text = n, this.length = s; +class Zn extends Dr { + constructor(e, r = G2e(e)) { + super(), this.text = e, this.length = r; } get lines() { return this.text.length; @@ -2070,635 +2079,635 @@ class Id extends Al { get children() { return null; } - lineInner(n, s, a, l) { - for (let h = 0; ; h++) { - let f = this.text[h], b = l + f.length; - if ((s ? a : b) >= n) - return new wkn(l, b, a, f); - l = b + 1, a++; + lineInner(e, r, n, i) { + for (let s = 0; ; s++) { + let a = this.text[s], o = i + a.length; + if ((r ? n : o) >= e) + return new H2e(i, o, n, a); + i = o + 1, n++; } } - decompose(n, s, a, l) { - let h = n <= 0 && s >= this.length ? this : new Id(d_t(this.text, n, s), Math.min(s, this.length) - Math.max(0, n)); - if (l & 1) { - let f = a.pop(), b = Vme(h.text, f.text.slice(), 0, h.length); - if (b.length <= 32) - a.push(new Id(b, f.length + h.length)); + decompose(e, r, n, i) { + let s = e <= 0 && r >= this.length ? this : new Zn(U$(this.text, e, r), Math.min(r, this.length) - Math.max(0, e)); + if (i & 1) { + let a = n.pop(), o = t4(s.text, a.text.slice(), 0, s.length); + if (o.length <= 32) + n.push(new Zn(o, a.length + s.length)); else { - let w = b.length >> 1; - a.push(new Id(b.slice(0, w)), new Id(b.slice(w))); + let l = o.length >> 1; + n.push(new Zn(o.slice(0, l)), new Zn(o.slice(l))); } } else - a.push(h); + n.push(s); } - replace(n, s, a) { - if (!(a instanceof Id)) - return super.replace(n, s, a); - [n, s] = iF(this, n, s); - let l = Vme(this.text, Vme(a.text, d_t(this.text, 0, n)), s), h = this.length + a.length - (s - n); - return l.length <= 32 ? new Id(l, h) : U4.from(Id.split(l, []), h); + replace(e, r, n) { + if (!(n instanceof Zn)) + return super.replace(e, r, n); + [e, r] = Cg(this, e, r); + let i = t4(this.text, t4(n.text, U$(this.text, 0, e)), r), s = this.length + n.length - (r - e); + return i.length <= 32 ? new Zn(i, s) : hc.from(Zn.split(i, []), s); } - sliceString(n, s = this.length, a = ` + sliceString(e, r = this.length, n = ` `) { - [n, s] = iF(this, n, s); - let l = ""; - for (let h = 0, f = 0; h <= s && f < this.text.length; f++) { - let b = this.text[f], w = h + b.length; - h > n && f && (l += a), n < w && s > h && (l += b.slice(Math.max(0, n - h), s - h)), h = w + 1; + [e, r] = Cg(this, e, r); + let i = ""; + for (let s = 0, a = 0; s <= r && a < this.text.length; a++) { + let o = this.text[a], l = s + o.length; + s > e && a && (i += n), e < l && r > s && (i += o.slice(Math.max(0, e - s), r - s)), s = l + 1; } - return l; + return i; } - flatten(n) { - for (let s of this.text) - n.push(s); + flatten(e) { + for (let r of this.text) + e.push(r); } scanIdentical() { return 0; } - static split(n, s) { - let a = [], l = -1; - for (let h of n) - a.push(h), l += h.length + 1, a.length == 32 && (s.push(new Id(a, l)), a = [], l = -1); - return l > -1 && s.push(new Id(a, l)), s; - } -} -class U4 extends Al { - constructor(n, s) { - super(), this.children = n, this.length = s, this.lines = 0; - for (let a of n) - this.lines += a.lines; - } - lineInner(n, s, a, l) { - for (let h = 0; ; h++) { - let f = this.children[h], b = l + f.length, w = a + f.lines - 1; - if ((s ? w : b) >= n) - return f.lineInner(n, s, a, l); - l = b + 1, a = w + 1; - } - } - decompose(n, s, a, l) { - for (let h = 0, f = 0; f <= s && h < this.children.length; h++) { - let b = this.children[h], w = f + b.length; - if (n <= w && s >= f) { - let O = l & ((f <= n ? 1 : 0) | (w >= s ? 2 : 0)); - f >= n && w <= s && !O ? a.push(b) : b.decompose(n - f, s - f, a, O); - } - f = w + 1; - } - } - replace(n, s, a) { - if ([n, s] = iF(this, n, s), a.lines < this.lines) - for (let l = 0, h = 0; l < this.children.length; l++) { - let f = this.children[l], b = h + f.length; - if (n >= h && s <= b) { - let w = f.replace(n - h, s - h, a), O = this.lines - f.lines + w.lines; - if (w.lines < O >> 5 - 1 && w.lines > O >> 5 + 1) { - let S = this.children.slice(); - return S[l] = w, new U4(S, this.length - (s - n) + a.length); + static split(e, r) { + let n = [], i = -1; + for (let s of e) + n.push(s), i += s.length + 1, n.length == 32 && (r.push(new Zn(n, i)), n = [], i = -1); + return i > -1 && r.push(new Zn(n, i)), r; + } +} +class hc extends Dr { + constructor(e, r) { + super(), this.children = e, this.length = r, this.lines = 0; + for (let n of e) + this.lines += n.lines; + } + lineInner(e, r, n, i) { + for (let s = 0; ; s++) { + let a = this.children[s], o = i + a.length, l = n + a.lines - 1; + if ((r ? l : o) >= e) + return a.lineInner(e, r, n, i); + i = o + 1, n = l + 1; + } + } + decompose(e, r, n, i) { + for (let s = 0, a = 0; a <= r && s < this.children.length; s++) { + let o = this.children[s], l = a + o.length; + if (e <= l && r >= a) { + let u = i & ((a <= e ? 1 : 0) | (l >= r ? 2 : 0)); + a >= e && l <= r && !u ? n.push(o) : o.decompose(e - a, r - a, n, u); + } + a = l + 1; + } + } + replace(e, r, n) { + if ([e, r] = Cg(this, e, r), n.lines < this.lines) + for (let i = 0, s = 0; i < this.children.length; i++) { + let a = this.children[i], o = s + a.length; + if (e >= s && r <= o) { + let l = a.replace(e - s, r - s, n), u = this.lines - a.lines + l.lines; + if (l.lines < u >> 5 - 1 && l.lines > u >> 5 + 1) { + let h = this.children.slice(); + return h[i] = l, new hc(h, this.length - (r - e) + n.length); } - return super.replace(h, b, w); + return super.replace(s, o, l); } - h = b + 1; + s = o + 1; } - return super.replace(n, s, a); + return super.replace(e, r, n); } - sliceString(n, s = this.length, a = ` + sliceString(e, r = this.length, n = ` `) { - [n, s] = iF(this, n, s); - let l = ""; - for (let h = 0, f = 0; h < this.children.length && f <= s; h++) { - let b = this.children[h], w = f + b.length; - f > n && h && (l += a), n < w && s > f && (l += b.sliceString(n - f, s - f, a)), f = w + 1; + [e, r] = Cg(this, e, r); + let i = ""; + for (let s = 0, a = 0; s < this.children.length && a <= r; s++) { + let o = this.children[s], l = a + o.length; + a > e && s && (i += n), e < l && r > a && (i += o.sliceString(e - a, r - a, n)), a = l + 1; } - return l; + return i; } - flatten(n) { - for (let s of this.children) - s.flatten(n); + flatten(e) { + for (let r of this.children) + r.flatten(e); } - scanIdentical(n, s) { - if (!(n instanceof U4)) + scanIdentical(e, r) { + if (!(e instanceof hc)) return 0; - let a = 0, [l, h, f, b] = s > 0 ? [0, 0, this.children.length, n.children.length] : [this.children.length - 1, n.children.length - 1, -1, -1]; - for (; ; l += s, h += s) { - if (l == f || h == b) - return a; - let w = this.children[l], O = n.children[h]; - if (w != O) - return a + w.scanIdentical(O, s); - a += w.length + 1; + let n = 0, [i, s, a, o] = r > 0 ? [0, 0, this.children.length, e.children.length] : [this.children.length - 1, e.children.length - 1, -1, -1]; + for (; ; i += r, s += r) { + if (i == a || s == o) + return n; + let l = this.children[i], u = e.children[s]; + if (l != u) + return n + l.scanIdentical(u, r); + n += l.length + 1; } } - static from(n, s = n.reduce((a, l) => a + l.length + 1, -1)) { - let a = 0; - for (let M of n) - a += M.lines; - if (a < 32) { - let M = []; - for (let B of n) - B.flatten(M); - return new Id(M, s); - } - let l = Math.max(32, a >> 5), h = l << 1, f = l >> 1, b = [], w = 0, O = -1, S = []; - function E(M) { - let B; - if (M.lines > h && M instanceof U4) - for (let z of M.children) - E(z); + static from(e, r = e.reduce((n, i) => n + i.length + 1, -1)) { + let n = 0; + for (let p of e) + n += p.lines; + if (n < 32) { + let p = []; + for (let g of e) + g.flatten(p); + return new Zn(p, r); + } + let i = Math.max(32, n >> 5), s = i << 1, a = i >> 1, o = [], l = 0, u = -1, h = []; + function f(p) { + let g; + if (p.lines > s && p instanceof hc) + for (let m of p.children) + f(m); else - M.lines > f && (w > f || !w) ? (D(), b.push(M)) : M instanceof Id && w && (B = S[S.length - 1]) instanceof Id && M.lines + B.lines <= 32 ? (w += M.lines, O += M.length + 1, S[S.length - 1] = new Id(B.text.concat(M.text), B.length + 1 + M.length)) : (w + M.lines > l && D(), w += M.lines, O += M.length + 1, S.push(M)); + p.lines > a && (l > a || !l) ? (d(), o.push(p)) : p instanceof Zn && l && (g = h[h.length - 1]) instanceof Zn && p.lines + g.lines <= 32 ? (l += p.lines, u += p.length + 1, h[h.length - 1] = new Zn(g.text.concat(p.text), g.length + 1 + p.length)) : (l + p.lines > i && d(), l += p.lines, u += p.length + 1, h.push(p)); } - function D() { - w != 0 && (b.push(S.length == 1 ? S[0] : U4.from(S, O)), O = -1, w = S.length = 0); + function d() { + l != 0 && (o.push(h.length == 1 ? h[0] : hc.from(h, u)), u = -1, l = h.length = 0); } - for (let M of n) - E(M); - return D(), b.length == 1 ? b[0] : new U4(b, s); + for (let p of e) + f(p); + return d(), o.length == 1 ? o[0] : new hc(o, r); } } -Al.empty = /* @__PURE__ */ new Id([""], 0); -function vkn(r) { - let n = -1; - for (let s of r) - n += s.length + 1; - return n; +Dr.empty = /* @__PURE__ */ new Zn([""], 0); +function G2e(t) { + let e = -1; + for (let r of t) + e += r.length + 1; + return e; } -function Vme(r, n, s = 0, a = 1e9) { - for (let l = 0, h = 0, f = !0; h < r.length && l <= a; h++) { - let b = r[h], w = l + b.length; - w >= s && (w > a && (b = b.slice(0, a - l)), l < s && (b = b.slice(s - l)), f ? (n[n.length - 1] += b, f = !1) : n.push(b)), l = w + 1; +function t4(t, e, r = 0, n = 1e9) { + for (let i = 0, s = 0, a = !0; s < t.length && i <= n; s++) { + let o = t[s], l = i + o.length; + l >= r && (l > n && (o = o.slice(0, n - i)), i < r && (o = o.slice(r - i)), a ? (e[e.length - 1] += o, a = !1) : e.push(o)), i = l + 1; } - return n; + return e; } -function d_t(r, n, s) { - return Vme(r, [""], n, s); +function U$(t, e, r) { + return t4(t, [""], e, r); } -class BX { - constructor(n, s = 1) { - this.dir = s, this.done = !1, this.lineBreak = !1, this.value = "", this.nodes = [n], this.offsets = [s > 0 ? 1 : (n instanceof Id ? n.text.length : n.children.length) << 1]; +class qv { + constructor(e, r = 1) { + this.dir = r, this.done = !1, this.lineBreak = !1, this.value = "", this.nodes = [e], this.offsets = [r > 0 ? 1 : (e instanceof Zn ? e.text.length : e.children.length) << 1]; } - nextInner(n, s) { + nextInner(e, r) { for (this.done = this.lineBreak = !1; ; ) { - let a = this.nodes.length - 1, l = this.nodes[a], h = this.offsets[a], f = h >> 1, b = l instanceof Id ? l.text.length : l.children.length; - if (f == (s > 0 ? b : 0)) { - if (a == 0) + let n = this.nodes.length - 1, i = this.nodes[n], s = this.offsets[n], a = s >> 1, o = i instanceof Zn ? i.text.length : i.children.length; + if (a == (r > 0 ? o : 0)) { + if (n == 0) return this.done = !0, this.value = "", this; - s > 0 && this.offsets[a - 1]++, this.nodes.pop(), this.offsets.pop(); - } else if ((h & 1) == (s > 0 ? 0 : 1)) { - if (this.offsets[a] += s, n == 0) + r > 0 && this.offsets[n - 1]++, this.nodes.pop(), this.offsets.pop(); + } else if ((s & 1) == (r > 0 ? 0 : 1)) { + if (this.offsets[n] += r, e == 0) return this.lineBreak = !0, this.value = ` `, this; - n--; - } else if (l instanceof Id) { - let w = l.text[f + (s < 0 ? -1 : 0)]; - if (this.offsets[a] += s, w.length > Math.max(0, n)) - return this.value = n == 0 ? w : s > 0 ? w.slice(n) : w.slice(0, w.length - n), this; - n -= w.length; + e--; + } else if (i instanceof Zn) { + let l = i.text[a + (r < 0 ? -1 : 0)]; + if (this.offsets[n] += r, l.length > Math.max(0, e)) + return this.value = e == 0 ? l : r > 0 ? l.slice(e) : l.slice(0, l.length - e), this; + e -= l.length; } else { - let w = l.children[f + (s < 0 ? -1 : 0)]; - n > w.length ? (n -= w.length, this.offsets[a] += s) : (s < 0 && this.offsets[a]--, this.nodes.push(w), this.offsets.push(s > 0 ? 1 : (w instanceof Id ? w.text.length : w.children.length) << 1)); + let l = i.children[a + (r < 0 ? -1 : 0)]; + e > l.length ? (e -= l.length, this.offsets[n] += r) : (r < 0 && this.offsets[n]--, this.nodes.push(l), this.offsets.push(r > 0 ? 1 : (l instanceof Zn ? l.text.length : l.children.length) << 1)); } } } - next(n = 0) { - return n < 0 && (this.nextInner(-n, -this.dir), n = this.value.length), this.nextInner(n, this.dir); + next(e = 0) { + return e < 0 && (this.nextInner(-e, -this.dir), e = this.value.length), this.nextInner(e, this.dir); } } -class MDt { - constructor(n, s, a) { - this.value = "", this.done = !1, this.cursor = new BX(n, s > a ? -1 : 1), this.pos = s > a ? n.length : 0, this.from = Math.min(s, a), this.to = Math.max(s, a); +class QZ { + constructor(e, r, n) { + this.value = "", this.done = !1, this.cursor = new qv(e, r > n ? -1 : 1), this.pos = r > n ? e.length : 0, this.from = Math.min(r, n), this.to = Math.max(r, n); } - nextInner(n, s) { - if (s < 0 ? this.pos <= this.from : this.pos >= this.to) + nextInner(e, r) { + if (r < 0 ? this.pos <= this.from : this.pos >= this.to) return this.value = "", this.done = !0, this; - n += Math.max(0, s < 0 ? this.pos - this.to : this.from - this.pos); - let a = s < 0 ? this.pos - this.from : this.to - this.pos; - n > a && (n = a), a -= n; - let { value: l } = this.cursor.next(n); - return this.pos += (l.length + n) * s, this.value = l.length <= a ? l : s < 0 ? l.slice(l.length - a) : l.slice(0, a), this.done = !this.value, this; + e += Math.max(0, r < 0 ? this.pos - this.to : this.from - this.pos); + let n = r < 0 ? this.pos - this.from : this.to - this.pos; + e > n && (e = n), n -= e; + let { value: i } = this.cursor.next(e); + return this.pos += (i.length + e) * r, this.value = i.length <= n ? i : r < 0 ? i.slice(i.length - n) : i.slice(0, n), this.done = !this.value, this; } - next(n = 0) { - return n < 0 ? n = Math.max(n, this.from - this.pos) : n > 0 && (n = Math.min(n, this.to - this.pos)), this.nextInner(n, this.cursor.dir); + next(e = 0) { + return e < 0 ? e = Math.max(e, this.from - this.pos) : e > 0 && (e = Math.min(e, this.to - this.pos)), this.nextInner(e, this.cursor.dir); } get lineBreak() { return this.cursor.lineBreak && this.value != ""; } } -class PDt { - constructor(n) { - this.inner = n, this.afterBreak = !0, this.value = "", this.done = !1; +class YZ { + constructor(e) { + this.inner = e, this.afterBreak = !0, this.value = "", this.done = !1; } - next(n = 0) { - let { done: s, lineBreak: a, value: l } = this.inner.next(n); - return s && this.afterBreak ? (this.value = "", this.afterBreak = !1) : s ? (this.done = !0, this.value = "") : a ? this.afterBreak ? this.value = "" : (this.afterBreak = !0, this.next()) : (this.value = l, this.afterBreak = !1), this; + next(e = 0) { + let { done: r, lineBreak: n, value: i } = this.inner.next(e); + return r && this.afterBreak ? (this.value = "", this.afterBreak = !1) : r ? (this.done = !0, this.value = "") : n ? this.afterBreak ? this.value = "" : (this.afterBreak = !0, this.next()) : (this.value = i, this.afterBreak = !1), this; } get lineBreak() { return !1; } } -typeof Symbol < "u" && (Al.prototype[Symbol.iterator] = function() { +typeof Symbol < "u" && (Dr.prototype[Symbol.iterator] = function() { return this.iter(); -}, BX.prototype[Symbol.iterator] = MDt.prototype[Symbol.iterator] = PDt.prototype[Symbol.iterator] = function() { +}, qv.prototype[Symbol.iterator] = QZ.prototype[Symbol.iterator] = YZ.prototype[Symbol.iterator] = function() { return this; }); -class wkn { - constructor(n, s, a, l) { - this.from = n, this.to = s, this.number = a, this.text = l; +class H2e { + constructor(e, r, n, i) { + this.from = e, this.to = r, this.number = n, this.text = i; } get length() { return this.to - this.from; } } -function iF(r, n, s) { - return n = Math.max(0, Math.min(r.length, n)), [n, Math.max(n, Math.min(r.length, s))]; +function Cg(t, e, r) { + return e = Math.max(0, Math.min(t.length, e)), [e, Math.max(e, Math.min(t.length, r))]; } -let DB = /* @__PURE__ */ "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((r) => r ? parseInt(r, 36) : 1); -for (let r = 1; r < DB.length; r++) - DB[r] += DB[r - 1]; -function ykn(r) { - for (let n = 1; n < DB.length; n += 2) - if (DB[n] > r) - return DB[n - 1] <= r; +let Qp = /* @__PURE__ */ "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((t) => t ? parseInt(t, 36) : 1); +for (let t = 1; t < Qp.length; t++) + Qp[t] += Qp[t - 1]; +function X2e(t) { + for (let e = 1; e < Qp.length; e += 2) + if (Qp[e] > t) + return Qp[e - 1] <= t; return !1; } -function p_t(r) { - return r >= 127462 && r <= 127487; -} -const g_t = 8205; -function Np(r, n, s = !0, a = !0) { - return (s ? LDt : Okn)(r, n, a); -} -function LDt(r, n, s) { - if (n == r.length) - return n; - n && IDt(r.charCodeAt(n)) && NDt(r.charCodeAt(n - 1)) && n--; - let a = Lp(r, n); - for (n += Fy(a); n < r.length; ) { - let l = Lp(r, n); - if (a == g_t || l == g_t || s && ykn(l)) - n += Fy(l), a = l; - else if (p_t(l)) { - let h = 0, f = n - 2; - for (; f >= 0 && p_t(Lp(r, f)); ) - h++, f -= 2; - if (h % 2 == 0) +function q$(t) { + return t >= 127462 && t <= 127487; +} +const Q$ = 8205; +function ls(t, e, r = !0, n = !0) { + return (r ? WZ : Z2e)(t, e, n); +} +function WZ(t, e, r) { + if (e == t.length) + return e; + e && GZ(t.charCodeAt(e)) && HZ(t.charCodeAt(e - 1)) && e--; + let n = ss(t, e); + for (e += Eo(n); e < t.length; ) { + let i = ss(t, e); + if (n == Q$ || i == Q$ || r && X2e(i)) + e += Eo(i), n = i; + else if (q$(i)) { + let s = 0, a = e - 2; + for (; a >= 0 && q$(ss(t, a)); ) + s++, a -= 2; + if (s % 2 == 0) break; - n += 2; + e += 2; } else break; } - return n; + return e; } -function Okn(r, n, s) { - for (; n > 0; ) { - let a = LDt(r, n - 2, s); - if (a < n) - return a; - n--; +function Z2e(t, e, r) { + for (; e > 0; ) { + let n = WZ(t, e - 2, r); + if (n < e) + return n; + e--; } return 0; } -function IDt(r) { - return r >= 56320 && r < 57344; +function GZ(t) { + return t >= 56320 && t < 57344; } -function NDt(r) { - return r >= 55296 && r < 56320; +function HZ(t) { + return t >= 55296 && t < 56320; } -function Lp(r, n) { - let s = r.charCodeAt(n); - if (!NDt(s) || n + 1 == r.length) - return s; - let a = r.charCodeAt(n + 1); - return IDt(a) ? (s - 55296 << 10) + (a - 56320) + 65536 : s; +function ss(t, e) { + let r = t.charCodeAt(e); + if (!HZ(r) || e + 1 == t.length) + return r; + let n = t.charCodeAt(e + 1); + return GZ(n) ? (r - 55296 << 10) + (n - 56320) + 65536 : r; } -function rze(r) { - return r <= 65535 ? String.fromCharCode(r) : (r -= 65536, String.fromCharCode((r >> 10) + 55296, (r & 1023) + 56320)); +function AR(t) { + return t <= 65535 ? String.fromCharCode(t) : (t -= 65536, String.fromCharCode((t >> 10) + 55296, (t & 1023) + 56320)); } -function Fy(r) { - return r < 65536 ? 1 : 2; +function Eo(t) { + return t < 65536 ? 1 : 2; } -const zBe = /\r\n?|\n/; -var c0 = /* @__PURE__ */ function(r) { - return r[r.Simple = 0] = "Simple", r[r.TrackDel = 1] = "TrackDel", r[r.TrackBefore = 2] = "TrackBefore", r[r.TrackAfter = 3] = "TrackAfter", r; -}(c0 || (c0 = {})); -class tx { - constructor(n) { - this.sections = n; +const RA = /\r\n?|\n/; +var Si = /* @__PURE__ */ function(t) { + return t[t.Simple = 0] = "Simple", t[t.TrackDel = 1] = "TrackDel", t[t.TrackBefore = 2] = "TrackBefore", t[t.TrackAfter = 3] = "TrackAfter", t; +}(Si || (Si = {})); +class _c { + constructor(e) { + this.sections = e; } get length() { - let n = 0; - for (let s = 0; s < this.sections.length; s += 2) - n += this.sections[s]; - return n; + let e = 0; + for (let r = 0; r < this.sections.length; r += 2) + e += this.sections[r]; + return e; } get newLength() { - let n = 0; - for (let s = 0; s < this.sections.length; s += 2) { - let a = this.sections[s + 1]; - n += a < 0 ? this.sections[s] : a; + let e = 0; + for (let r = 0; r < this.sections.length; r += 2) { + let n = this.sections[r + 1]; + e += n < 0 ? this.sections[r] : n; } - return n; + return e; } get empty() { return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; } - iterGaps(n) { - for (let s = 0, a = 0, l = 0; s < this.sections.length; ) { - let h = this.sections[s++], f = this.sections[s++]; - f < 0 ? (n(a, l, h), l += h) : l += f, a += h; + iterGaps(e) { + for (let r = 0, n = 0, i = 0; r < this.sections.length; ) { + let s = this.sections[r++], a = this.sections[r++]; + a < 0 ? (e(n, i, s), i += s) : i += a, n += s; } } - iterChangedRanges(n, s = !1) { - qBe(this, n, s); + iterChangedRanges(e, r = !1) { + MA(this, e, r); } get invertedDesc() { - let n = []; - for (let s = 0; s < this.sections.length; ) { - let a = this.sections[s++], l = this.sections[s++]; - l < 0 ? n.push(a, l) : n.push(l, a); - } - return new tx(n); - } - composeDesc(n) { - return this.empty ? n : n.empty ? this : RDt(this, n); - } - mapDesc(n, s = !1) { - return n.empty ? this : VBe(this, n, s); - } - mapPos(n, s = -1, a = c0.Simple) { - let l = 0, h = 0; - for (let f = 0; f < this.sections.length; ) { - let b = this.sections[f++], w = this.sections[f++], O = l + b; - if (w < 0) { - if (O > n) - return h + (n - l); - h += b; + let e = []; + for (let r = 0; r < this.sections.length; ) { + let n = this.sections[r++], i = this.sections[r++]; + i < 0 ? e.push(n, i) : e.push(i, n); + } + return new _c(e); + } + composeDesc(e) { + return this.empty ? e : e.empty ? this : XZ(this, e); + } + mapDesc(e, r = !1) { + return e.empty ? this : DA(this, e, r); + } + mapPos(e, r = -1, n = Si.Simple) { + let i = 0, s = 0; + for (let a = 0; a < this.sections.length; ) { + let o = this.sections[a++], l = this.sections[a++], u = i + o; + if (l < 0) { + if (u > e) + return s + (e - i); + s += o; } else { - if (a != c0.Simple && O >= n && (a == c0.TrackDel && l < n && O > n || a == c0.TrackBefore && l < n || a == c0.TrackAfter && O > n)) + if (n != Si.Simple && u >= e && (n == Si.TrackDel && i < e && u > e || n == Si.TrackBefore && i < e || n == Si.TrackAfter && u > e)) return null; - if (O > n || O == n && s < 0 && !b) - return n == l || s < 0 ? h : h + w; - h += w; + if (u > e || u == e && r < 0 && !o) + return e == i || r < 0 ? s : s + l; + s += l; } - l = O; + i = u; } - if (n > l) - throw new RangeError(`Position ${n} is out of range for changeset of length ${l}`); - return h; + if (e > i) + throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`); + return s; } - touchesRange(n, s = n) { - for (let a = 0, l = 0; a < this.sections.length && l <= s; ) { - let h = this.sections[a++], f = this.sections[a++], b = l + h; - if (f >= 0 && l <= s && b >= n) - return l < n && b > s ? "cover" : !0; - l = b; + touchesRange(e, r = e) { + for (let n = 0, i = 0; n < this.sections.length && i <= r; ) { + let s = this.sections[n++], a = this.sections[n++], o = i + s; + if (a >= 0 && i <= r && o >= e) + return i < e && o > r ? "cover" : !0; + i = o; } return !1; } toString() { - let n = ""; - for (let s = 0; s < this.sections.length; ) { - let a = this.sections[s++], l = this.sections[s++]; - n += (n ? " " : "") + a + (l >= 0 ? ":" + l : ""); + let e = ""; + for (let r = 0; r < this.sections.length; ) { + let n = this.sections[r++], i = this.sections[r++]; + e += (e ? " " : "") + n + (i >= 0 ? ":" + i : ""); } - return n; + return e; } toJSON() { return this.sections; } - static fromJSON(n) { - if (!Array.isArray(n) || n.length % 2 || n.some((s) => typeof s != "number")) + static fromJSON(e) { + if (!Array.isArray(e) || e.length % 2 || e.some((r) => typeof r != "number")) throw new RangeError("Invalid JSON representation of ChangeDesc"); - return new tx(n); + return new _c(e); } - static create(n) { - return new tx(n); + static create(e) { + return new _c(e); } } -class f1 extends tx { - constructor(n, s) { - super(n), this.inserted = s; +class ai extends _c { + constructor(e, r) { + super(e), this.inserted = r; } - apply(n) { - if (this.length != n.length) + apply(e) { + if (this.length != e.length) throw new RangeError("Applying change set to a document with the wrong length"); - return qBe(this, (s, a, l, h, f) => n = n.replace(l, l + (a - s), f), !1), n; + return MA(this, (r, n, i, s, a) => e = e.replace(i, i + (n - r), a), !1), e; } - mapDesc(n, s = !1) { - return VBe(this, n, s, !0); + mapDesc(e, r = !1) { + return DA(this, e, r, !0); } - invert(n) { - let s = this.sections.slice(), a = []; - for (let l = 0, h = 0; l < s.length; l += 2) { - let f = s[l], b = s[l + 1]; - if (b >= 0) { - s[l] = b, s[l + 1] = f; - let w = l >> 1; - for (; a.length < w; ) - a.push(Al.empty); - a.push(f ? n.slice(h, h + f) : Al.empty); + invert(e) { + let r = this.sections.slice(), n = []; + for (let i = 0, s = 0; i < r.length; i += 2) { + let a = r[i], o = r[i + 1]; + if (o >= 0) { + r[i] = o, r[i + 1] = a; + let l = i >> 1; + for (; n.length < l; ) + n.push(Dr.empty); + n.push(a ? e.slice(s, s + a) : Dr.empty); } - h += f; + s += a; } - return new f1(s, a); + return new ai(r, n); } - compose(n) { - return this.empty ? n : n.empty ? this : RDt(this, n, !0); + compose(e) { + return this.empty ? e : e.empty ? this : XZ(this, e, !0); } - map(n, s = !1) { - return n.empty ? this : VBe(this, n, s, !0); + map(e, r = !1) { + return e.empty ? this : DA(this, e, r, !0); } - iterChanges(n, s = !1) { - qBe(this, n, s); + iterChanges(e, r = !1) { + MA(this, e, r); } get desc() { - return tx.create(this.sections); + return _c.create(this.sections); } - filter(n) { - let s = [], a = [], l = [], h = new cK(this); + filter(e) { + let r = [], n = [], i = [], s = new vy(this); e: - for (let f = 0, b = 0; ; ) { - let w = f == n.length ? 1e9 : n[f++]; - for (; b < w || b == w && h.len == 0; ) { - if (h.done) + for (let a = 0, o = 0; ; ) { + let l = a == e.length ? 1e9 : e[a++]; + for (; o < l || o == l && s.len == 0; ) { + if (s.done) break e; - let S = Math.min(h.len, w - b); - kg(l, S, -1); - let E = h.ins == -1 ? -1 : h.off == 0 ? h.ins : 0; - kg(s, S, E), E > 0 && GT(a, s, h.text), h.forward(S), b += S; - } - let O = n[f++]; - for (; b < O; ) { - if (h.done) + let h = Math.min(s.len, l - o); + As(i, h, -1); + let f = s.ins == -1 ? -1 : s.off == 0 ? s.ins : 0; + As(r, h, f), f > 0 && Dh(n, r, s.text), s.forward(h), o += h; + } + let u = e[a++]; + for (; o < u; ) { + if (s.done) break e; - let S = Math.min(h.len, O - b); - kg(s, S, -1), kg(l, S, h.ins == -1 ? -1 : h.off == 0 ? h.ins : 0), h.forward(S), b += S; + let h = Math.min(s.len, u - o); + As(r, h, -1), As(i, h, s.ins == -1 ? -1 : s.off == 0 ? s.ins : 0), s.forward(h), o += h; } } return { - changes: new f1(s, a), - filtered: tx.create(l) + changes: new ai(r, n), + filtered: _c.create(i) }; } toJSON() { - let n = []; - for (let s = 0; s < this.sections.length; s += 2) { - let a = this.sections[s], l = this.sections[s + 1]; - l < 0 ? n.push(a) : l == 0 ? n.push([a]) : n.push([a].concat(this.inserted[s >> 1].toJSON())); + let e = []; + for (let r = 0; r < this.sections.length; r += 2) { + let n = this.sections[r], i = this.sections[r + 1]; + i < 0 ? e.push(n) : i == 0 ? e.push([n]) : e.push([n].concat(this.inserted[r >> 1].toJSON())); } - return n; + return e; } - static of(n, s, a) { - let l = [], h = [], f = 0, b = null; - function w(S = !1) { - if (!S && !l.length) + static of(e, r, n) { + let i = [], s = [], a = 0, o = null; + function l(h = !1) { + if (!h && !i.length) return; - f < s && kg(l, s - f, -1); - let E = new f1(l, h); - b = b ? b.compose(E.map(b)) : E, l = [], h = [], f = 0; - } - function O(S) { - if (Array.isArray(S)) - for (let E of S) - O(E); - else if (S instanceof f1) { - if (S.length != s) - throw new RangeError(`Mismatched change set length (got ${S.length}, expected ${s})`); - w(), b = b ? b.compose(S.map(b)) : S; + a < r && As(i, r - a, -1); + let f = new ai(i, s); + o = o ? o.compose(f.map(o)) : f, i = [], s = [], a = 0; + } + function u(h) { + if (Array.isArray(h)) + for (let f of h) + u(f); + else if (h instanceof ai) { + if (h.length != r) + throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${r})`); + l(), o = o ? o.compose(h.map(o)) : h; } else { - let { from: E, to: D = E, insert: M } = S; - if (E > D || E < 0 || D > s) - throw new RangeError(`Invalid change range ${E} to ${D} (in doc of length ${s})`); - let B = M ? typeof M == "string" ? Al.of(M.split(a || zBe)) : M : Al.empty, z = B.length; - if (E == D && z == 0) + let { from: f, to: d = f, insert: p } = h; + if (f > d || f < 0 || d > r) + throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${r})`); + let g = p ? typeof p == "string" ? Dr.of(p.split(n || RA)) : p : Dr.empty, m = g.length; + if (f == d && m == 0) return; - E < f && w(), E > f && kg(l, E - f, -1), kg(l, D - E, z), GT(h, l, B), f = D; + f < a && l(), f > a && As(i, f - a, -1), As(i, d - f, m), Dh(s, i, g), a = d; } } - return O(n), w(!b), b; + return u(e), l(!o), o; } - static empty(n) { - return new f1(n ? [n, -1] : [], []); + static empty(e) { + return new ai(e ? [e, -1] : [], []); } - static fromJSON(n) { - if (!Array.isArray(n)) + static fromJSON(e) { + if (!Array.isArray(e)) throw new RangeError("Invalid JSON representation of ChangeSet"); - let s = [], a = []; - for (let l = 0; l < n.length; l++) { - let h = n[l]; - if (typeof h == "number") - s.push(h, -1); + let r = [], n = []; + for (let i = 0; i < e.length; i++) { + let s = e[i]; + if (typeof s == "number") + r.push(s, -1); else { - if (!Array.isArray(h) || typeof h[0] != "number" || h.some((f, b) => b && typeof f != "string")) + if (!Array.isArray(s) || typeof s[0] != "number" || s.some((a, o) => o && typeof a != "string")) throw new RangeError("Invalid JSON representation of ChangeSet"); - if (h.length == 1) - s.push(h[0], 0); + if (s.length == 1) + r.push(s[0], 0); else { - for (; a.length < l; ) - a.push(Al.empty); - a[l] = Al.of(h.slice(1)), s.push(h[0], a[l].length); + for (; n.length < i; ) + n.push(Dr.empty); + n[i] = Dr.of(s.slice(1)), r.push(s[0], n[i].length); } } } - return new f1(s, a); + return new ai(r, n); } - static createSet(n, s) { - return new f1(n, s); + static createSet(e, r) { + return new ai(e, r); } } -function kg(r, n, s, a = !1) { - if (n == 0 && s <= 0) +function As(t, e, r, n = !1) { + if (e == 0 && r <= 0) return; - let l = r.length - 2; - l >= 0 && s <= 0 && s == r[l + 1] ? r[l] += n : n == 0 && r[l] == 0 ? r[l + 1] += s : a ? (r[l] += n, r[l + 1] += s) : r.push(n, s); + let i = t.length - 2; + i >= 0 && r <= 0 && r == t[i + 1] ? t[i] += e : e == 0 && t[i] == 0 ? t[i + 1] += r : n ? (t[i] += e, t[i + 1] += r) : t.push(e, r); } -function GT(r, n, s) { - if (s.length == 0) +function Dh(t, e, r) { + if (r.length == 0) return; - let a = n.length - 2 >> 1; - if (a < r.length) - r[r.length - 1] = r[r.length - 1].append(s); + let n = e.length - 2 >> 1; + if (n < t.length) + t[t.length - 1] = t[t.length - 1].append(r); else { - for (; r.length < a; ) - r.push(Al.empty); - r.push(s); + for (; t.length < n; ) + t.push(Dr.empty); + t.push(r); } } -function qBe(r, n, s) { - let a = r.inserted; - for (let l = 0, h = 0, f = 0; f < r.sections.length; ) { - let b = r.sections[f++], w = r.sections[f++]; - if (w < 0) - l += b, h += b; +function MA(t, e, r) { + let n = t.inserted; + for (let i = 0, s = 0, a = 0; a < t.sections.length; ) { + let o = t.sections[a++], l = t.sections[a++]; + if (l < 0) + i += o, s += o; else { - let O = l, S = h, E = Al.empty; - for (; O += b, S += w, w && a && (E = E.append(a[f - 2 >> 1])), !(s || f == r.sections.length || r.sections[f + 1] < 0); ) - b = r.sections[f++], w = r.sections[f++]; - n(l, O, h, S, E), l = O, h = S; - } - } -} -function VBe(r, n, s, a = !1) { - let l = [], h = a ? [] : null, f = new cK(r), b = new cK(n); - for (let w = -1; ; ) - if (f.ins == -1 && b.ins == -1) { - let O = Math.min(f.len, b.len); - kg(l, O, -1), f.forward(O), b.forward(O); - } else if (b.ins >= 0 && (f.ins < 0 || w == f.i || f.off == 0 && (b.len < f.len || b.len == f.len && !s))) { - let O = b.len; - for (kg(l, b.ins, -1); O; ) { - let S = Math.min(f.len, O); - f.ins >= 0 && w < f.i && f.len <= S && (kg(l, 0, f.ins), h && GT(h, l, f.text), w = f.i), f.forward(S), O -= S; - } - b.next(); - } else if (f.ins >= 0) { - let O = 0, S = f.len; - for (; S; ) - if (b.ins == -1) { - let E = Math.min(S, b.len); - O += E, S -= E, b.forward(E); - } else if (b.ins == 0 && b.len < S) - S -= b.len, b.next(); + let u = i, h = s, f = Dr.empty; + for (; u += o, h += l, l && n && (f = f.append(n[a - 2 >> 1])), !(r || a == t.sections.length || t.sections[a + 1] < 0); ) + o = t.sections[a++], l = t.sections[a++]; + e(i, u, s, h, f), i = u, s = h; + } + } +} +function DA(t, e, r, n = !1) { + let i = [], s = n ? [] : null, a = new vy(t), o = new vy(e); + for (let l = -1; ; ) + if (a.ins == -1 && o.ins == -1) { + let u = Math.min(a.len, o.len); + As(i, u, -1), a.forward(u), o.forward(u); + } else if (o.ins >= 0 && (a.ins < 0 || l == a.i || a.off == 0 && (o.len < a.len || o.len == a.len && !r))) { + let u = o.len; + for (As(i, o.ins, -1); u; ) { + let h = Math.min(a.len, u); + a.ins >= 0 && l < a.i && a.len <= h && (As(i, 0, a.ins), s && Dh(s, i, a.text), l = a.i), a.forward(h), u -= h; + } + o.next(); + } else if (a.ins >= 0) { + let u = 0, h = a.len; + for (; h; ) + if (o.ins == -1) { + let f = Math.min(h, o.len); + u += f, h -= f, o.forward(f); + } else if (o.ins == 0 && o.len < h) + h -= o.len, o.next(); else break; - kg(l, O, w < f.i ? f.ins : 0), h && w < f.i && GT(h, l, f.text), w = f.i, f.forward(f.len - S); + As(i, u, l < a.i ? a.ins : 0), s && l < a.i && Dh(s, i, a.text), l = a.i, a.forward(a.len - h); } else { - if (f.done && b.done) - return h ? f1.createSet(l, h) : tx.create(l); + if (a.done && o.done) + return s ? ai.createSet(i, s) : _c.create(i); throw new Error("Mismatched change set lengths"); } } -function RDt(r, n, s = !1) { - let a = [], l = s ? [] : null, h = new cK(r), f = new cK(n); - for (let b = !1; ; ) { - if (h.done && f.done) - return l ? f1.createSet(a, l) : tx.create(a); - if (h.ins == 0) - kg(a, h.len, 0, b), h.next(); - else if (f.len == 0 && !f.done) - kg(a, 0, f.ins, b), l && GT(l, a, f.text), f.next(); +function XZ(t, e, r = !1) { + let n = [], i = r ? [] : null, s = new vy(t), a = new vy(e); + for (let o = !1; ; ) { + if (s.done && a.done) + return i ? ai.createSet(n, i) : _c.create(n); + if (s.ins == 0) + As(n, s.len, 0, o), s.next(); + else if (a.len == 0 && !a.done) + As(n, 0, a.ins, o), i && Dh(i, n, a.text), a.next(); else { - if (h.done || f.done) + if (s.done || a.done) throw new Error("Mismatched change set lengths"); { - let w = Math.min(h.len2, f.len), O = a.length; - if (h.ins == -1) { - let S = f.ins == -1 ? -1 : f.off ? 0 : f.ins; - kg(a, w, S, b), l && S && GT(l, a, f.text); + let l = Math.min(s.len2, a.len), u = n.length; + if (s.ins == -1) { + let h = a.ins == -1 ? -1 : a.off ? 0 : a.ins; + As(n, l, h, o), i && h && Dh(i, n, a.text); } else - f.ins == -1 ? (kg(a, h.off ? 0 : h.len, w, b), l && GT(l, a, h.textBit(w))) : (kg(a, h.off ? 0 : h.len, f.off ? 0 : f.ins, b), l && !f.off && GT(l, a, f.text)); - b = (h.ins > w || f.ins >= 0 && f.len > w) && (b || a.length > O), h.forward2(w), f.forward(w); + a.ins == -1 ? (As(n, s.off ? 0 : s.len, l, o), i && Dh(i, n, s.textBit(l))) : (As(n, s.off ? 0 : s.len, a.off ? 0 : a.ins, o), i && !a.off && Dh(i, n, a.text)); + o = (s.ins > l || a.ins >= 0 && a.len > l) && (o || n.length > u), s.forward2(l), a.forward(l); } } } } -class cK { - constructor(n) { - this.set = n, this.i = 0, this.next(); +class vy { + constructor(e) { + this.set = e, this.i = 0, this.next(); } next() { - let { sections: n } = this.set; - this.i < n.length ? (this.len = n[this.i++], this.ins = n[this.i++]) : (this.len = 0, this.ins = -2), this.off = 0; + let { sections: e } = this.set; + this.i < e.length ? (this.len = e[this.i++], this.ins = e[this.i++]) : (this.len = 0, this.ins = -2), this.off = 0; } get done() { return this.ins == -2; @@ -2707,23 +2716,23 @@ class cK { return this.ins < 0 ? this.len : this.ins; } get text() { - let { inserted: n } = this.set, s = this.i - 2 >> 1; - return s >= n.length ? Al.empty : n[s]; + let { inserted: e } = this.set, r = this.i - 2 >> 1; + return r >= e.length ? Dr.empty : e[r]; } - textBit(n) { - let { inserted: s } = this.set, a = this.i - 2 >> 1; - return a >= s.length && !n ? Al.empty : s[a].slice(this.off, n == null ? void 0 : this.off + n); + textBit(e) { + let { inserted: r } = this.set, n = this.i - 2 >> 1; + return n >= r.length && !e ? Dr.empty : r[n].slice(this.off, e == null ? void 0 : this.off + e); } - forward(n) { - n == this.len ? this.next() : (this.len -= n, this.off += n); + forward(e) { + e == this.len ? this.next() : (this.len -= e, this.off += e); } - forward2(n) { - this.ins == -1 ? this.forward(n) : n == this.ins ? this.next() : (this.ins -= n, this.off += n); + forward2(e) { + this.ins == -1 ? this.forward(e) : e == this.ins ? this.next() : (this.ins -= e, this.off += e); } } -class QM { - constructor(n, s, a) { - this.from = n, this.to = s, this.flags = a; +class Cd { + constructor(e, r, n) { + this.from = e, this.to = r, this.flags = n; } get anchor() { return this.flags & 32 ? this.to : this.from; @@ -2738,50 +2747,50 @@ class QM { return this.flags & 8 ? -1 : this.flags & 16 ? 1 : 0; } get bidiLevel() { - let n = this.flags & 7; - return n == 7 ? null : n; + let e = this.flags & 7; + return e == 7 ? null : e; } get goalColumn() { - let n = this.flags >> 6; - return n == 16777215 ? void 0 : n; + let e = this.flags >> 6; + return e == 16777215 ? void 0 : e; } - map(n, s = -1) { - let a, l; - return this.empty ? a = l = n.mapPos(this.from, s) : (a = n.mapPos(this.from, 1), l = n.mapPos(this.to, -1)), a == this.from && l == this.to ? this : new QM(a, l, this.flags); + map(e, r = -1) { + let n, i; + return this.empty ? n = i = e.mapPos(this.from, r) : (n = e.mapPos(this.from, 1), i = e.mapPos(this.to, -1)), n == this.from && i == this.to ? this : new Cd(n, i, this.flags); } - extend(n, s = n) { - if (n <= this.anchor && s >= this.anchor) - return sr.range(n, s); - let a = Math.abs(n - this.anchor) > Math.abs(s - this.anchor) ? n : s; - return sr.range(this.anchor, a); + extend(e, r = e) { + if (e <= this.anchor && r >= this.anchor) + return Ve.range(e, r); + let n = Math.abs(e - this.anchor) > Math.abs(r - this.anchor) ? e : r; + return Ve.range(this.anchor, n); } - eq(n) { - return this.anchor == n.anchor && this.head == n.head; + eq(e) { + return this.anchor == e.anchor && this.head == e.head; } toJSON() { return { anchor: this.anchor, head: this.head }; } - static fromJSON(n) { - if (!n || typeof n.anchor != "number" || typeof n.head != "number") + static fromJSON(e) { + if (!e || typeof e.anchor != "number" || typeof e.head != "number") throw new RangeError("Invalid JSON representation for SelectionRange"); - return sr.range(n.anchor, n.head); + return Ve.range(e.anchor, e.head); } - static create(n, s, a) { - return new QM(n, s, a); + static create(e, r, n) { + return new Cd(e, r, n); } } -class sr { - constructor(n, s) { - this.ranges = n, this.mainIndex = s; +class Ve { + constructor(e, r) { + this.ranges = e, this.mainIndex = r; } - map(n, s = -1) { - return n.empty ? this : sr.create(this.ranges.map((a) => a.map(n, s)), this.mainIndex); + map(e, r = -1) { + return e.empty ? this : Ve.create(this.ranges.map((n) => n.map(e, r)), this.mainIndex); } - eq(n) { - if (this.ranges.length != n.ranges.length || this.mainIndex != n.mainIndex) + eq(e) { + if (this.ranges.length != e.ranges.length || this.mainIndex != e.mainIndex) return !1; - for (let s = 0; s < this.ranges.length; s++) - if (!this.ranges[s].eq(n.ranges[s])) + for (let r = 0; r < this.ranges.length; r++) + if (!this.ranges[r].eq(e.ranges[r])) return !1; return !0; } @@ -2789,386 +2798,386 @@ class sr { return this.ranges[this.mainIndex]; } asSingle() { - return this.ranges.length == 1 ? this : new sr([this.main], 0); + return this.ranges.length == 1 ? this : new Ve([this.main], 0); } - addRange(n, s = !0) { - return sr.create([n].concat(this.ranges), s ? 0 : this.mainIndex + 1); + addRange(e, r = !0) { + return Ve.create([e].concat(this.ranges), r ? 0 : this.mainIndex + 1); } - replaceRange(n, s = this.mainIndex) { - let a = this.ranges.slice(); - return a[s] = n, sr.create(a, this.mainIndex); + replaceRange(e, r = this.mainIndex) { + let n = this.ranges.slice(); + return n[r] = e, Ve.create(n, this.mainIndex); } toJSON() { - return { ranges: this.ranges.map((n) => n.toJSON()), main: this.mainIndex }; + return { ranges: this.ranges.map((e) => e.toJSON()), main: this.mainIndex }; } - static fromJSON(n) { - if (!n || !Array.isArray(n.ranges) || typeof n.main != "number" || n.main >= n.ranges.length) + static fromJSON(e) { + if (!e || !Array.isArray(e.ranges) || typeof e.main != "number" || e.main >= e.ranges.length) throw new RangeError("Invalid JSON representation for EditorSelection"); - return new sr(n.ranges.map((s) => QM.fromJSON(s)), n.main); + return new Ve(e.ranges.map((r) => Cd.fromJSON(r)), e.main); } - static single(n, s = n) { - return new sr([sr.range(n, s)], 0); + static single(e, r = e) { + return new Ve([Ve.range(e, r)], 0); } - static create(n, s = 0) { - if (n.length == 0) + static create(e, r = 0) { + if (e.length == 0) throw new RangeError("A selection needs at least one range"); - for (let a = 0, l = 0; l < n.length; l++) { - let h = n[l]; - if (h.empty ? h.from <= a : h.from < a) - return sr.normalized(n.slice(), s); - a = h.to; + for (let n = 0, i = 0; i < e.length; i++) { + let s = e[i]; + if (s.empty ? s.from <= n : s.from < n) + return Ve.normalized(e.slice(), r); + n = s.to; } - return new sr(n, s); + return new Ve(e, r); } - static cursor(n, s = 0, a, l) { - return QM.create(n, n, (s == 0 ? 0 : s < 0 ? 8 : 16) | (a == null ? 7 : Math.min(6, a)) | (l != null ? l : 16777215) << 6); + static cursor(e, r = 0, n, i) { + return Cd.create(e, e, (r == 0 ? 0 : r < 0 ? 8 : 16) | (n == null ? 7 : Math.min(6, n)) | (i != null ? i : 16777215) << 6); } - static range(n, s, a, l) { - let h = (a != null ? a : 16777215) << 6 | (l == null ? 7 : Math.min(6, l)); - return s < n ? QM.create(s, n, 48 | h) : QM.create(n, s, (s > n ? 8 : 0) | h); + static range(e, r, n, i) { + let s = (n != null ? n : 16777215) << 6 | (i == null ? 7 : Math.min(6, i)); + return r < e ? Cd.create(r, e, 48 | s) : Cd.create(e, r, (r > e ? 8 : 0) | s); } - static normalized(n, s = 0) { - let a = n[s]; - n.sort((l, h) => l.from - h.from), s = n.indexOf(a); - for (let l = 1; l < n.length; l++) { - let h = n[l], f = n[l - 1]; - if (h.empty ? h.from <= f.to : h.from < f.to) { - let b = f.from, w = Math.max(h.to, f.to); - l <= s && s--, n.splice(--l, 2, h.anchor > h.head ? sr.range(w, b) : sr.range(b, w)); + static normalized(e, r = 0) { + let n = e[r]; + e.sort((i, s) => i.from - s.from), r = e.indexOf(n); + for (let i = 1; i < e.length; i++) { + let s = e[i], a = e[i - 1]; + if (s.empty ? s.from <= a.to : s.from < a.to) { + let o = a.from, l = Math.max(s.to, a.to); + i <= r && r--, e.splice(--i, 2, s.anchor > s.head ? Ve.range(l, o) : Ve.range(o, l)); } } - return new sr(n, s); + return new Ve(e, r); } } -function $Dt(r, n) { - for (let s of r.ranges) - if (s.to > n) +function ZZ(t, e) { + for (let r of t.ranges) + if (r.to > e) throw new RangeError("Selection points outside of document"); } -let ize = 0; -class us { - constructor(n, s, a, l, h) { - this.combine = n, this.compareInput = s, this.compare = a, this.isStatic = l, this.id = ize++, this.default = n([]), this.extensions = typeof h == "function" ? h(this) : h; +let LR = 0; +class _t { + constructor(e, r, n, i, s) { + this.combine = e, this.compareInput = r, this.compare = n, this.isStatic = i, this.id = LR++, this.default = e([]), this.extensions = typeof s == "function" ? s(this) : s; } get reader() { return this; } - static define(n = {}) { - return new us(n.combine || ((s) => s), n.compareInput || ((s, a) => s === a), n.compare || (n.combine ? (s, a) => s === a : sze), !!n.static, n.enables); + static define(e = {}) { + return new _t(e.combine || ((r) => r), e.compareInput || ((r, n) => r === n), e.compare || (e.combine ? (r, n) => r === n : RR), !!e.static, e.enables); } - of(n) { - return new Ume([], this, 0, n); + of(e) { + return new r4([], this, 0, e); } - compute(n, s) { + compute(e, r) { if (this.isStatic) throw new Error("Can't compute a static facet"); - return new Ume(n, this, 1, s); + return new r4(e, this, 1, r); } - computeN(n, s) { + computeN(e, r) { if (this.isStatic) throw new Error("Can't compute a static facet"); - return new Ume(n, this, 2, s); + return new r4(e, this, 2, r); } - from(n, s) { - return s || (s = (a) => a), this.compute([n], (a) => s(a.field(n))); + from(e, r) { + return r || (r = (n) => n), this.compute([e], (n) => r(n.field(e))); } } -function sze(r, n) { - return r == n || r.length == n.length && r.every((s, a) => s === n[a]); +function RR(t, e) { + return t == e || t.length == e.length && t.every((r, n) => r === e[n]); } -class Ume { - constructor(n, s, a, l) { - this.dependencies = n, this.facet = s, this.type = a, this.value = l, this.id = ize++; +class r4 { + constructor(e, r, n, i) { + this.dependencies = e, this.facet = r, this.type = n, this.value = i, this.id = LR++; } - dynamicSlot(n) { - var s; - let a = this.value, l = this.facet.compareInput, h = this.id, f = n[h] >> 1, b = this.type == 2, w = !1, O = !1, S = []; - for (let E of this.dependencies) - E == "doc" ? w = !0 : E == "selection" ? O = !0 : (((s = n[E.id]) !== null && s !== void 0 ? s : 1) & 1) == 0 && S.push(n[E.id]); + dynamicSlot(e) { + var r; + let n = this.value, i = this.facet.compareInput, s = this.id, a = e[s] >> 1, o = this.type == 2, l = !1, u = !1, h = []; + for (let f of this.dependencies) + f == "doc" ? l = !0 : f == "selection" ? u = !0 : (((r = e[f.id]) !== null && r !== void 0 ? r : 1) & 1) == 0 && h.push(e[f.id]); return { - create(E) { - return E.values[f] = a(E), 1; + create(f) { + return f.values[a] = n(f), 1; }, - update(E, D) { - if (w && D.docChanged || O && (D.docChanged || D.selection) || UBe(E, S)) { - let M = a(E); - if (b ? !m_t(M, E.values[f], l) : !l(M, E.values[f])) - return E.values[f] = M, 1; + update(f, d) { + if (l && d.docChanged || u && (d.docChanged || d.selection) || NA(f, h)) { + let p = n(f); + if (o ? !Y$(p, f.values[a], i) : !i(p, f.values[a])) + return f.values[a] = p, 1; } return 0; }, - reconfigure: (E, D) => { - let M, B = D.config.address[h]; - if (B != null) { - let z = jbe(D, B); - if (this.dependencies.every((W) => W instanceof us ? D.facet(W) === E.facet(W) : W instanceof Ef ? D.field(W, !1) == E.field(W, !1) : !0) || (b ? m_t(M = a(E), z, l) : l(M = a(E), z))) - return E.values[f] = z, 0; + reconfigure: (f, d) => { + let p, g = d.config.address[s]; + if (g != null) { + let m = m5(d, g); + if (this.dependencies.every((v) => v instanceof _t ? d.facet(v) === f.facet(v) : v instanceof Pn ? d.field(v, !1) == f.field(v, !1) : !0) || (o ? Y$(p = n(f), m, i) : i(p = n(f), m))) + return f.values[a] = m, 0; } else - M = a(E); - return E.values[f] = M, 1; + p = n(f); + return f.values[a] = p, 1; } }; } } -function m_t(r, n, s) { - if (r.length != n.length) +function Y$(t, e, r) { + if (t.length != e.length) return !1; - for (let a = 0; a < r.length; a++) - if (!s(r[a], n[a])) + for (let n = 0; n < t.length; n++) + if (!r(t[n], e[n])) return !1; return !0; } -function UBe(r, n) { - let s = !1; - for (let a of n) - FX(r, a) & 1 && (s = !0); - return s; +function NA(t, e) { + let r = !1; + for (let n of e) + Qv(t, n) & 1 && (r = !0); + return r; } -function kkn(r, n, s) { - let a = s.map((w) => r[w.id]), l = s.map((w) => w.type), h = a.filter((w) => !(w & 1)), f = r[n.id] >> 1; - function b(w) { - let O = []; - for (let S = 0; S < a.length; S++) { - let E = jbe(w, a[S]); - if (l[S] == 2) - for (let D of E) - O.push(D); +function j2e(t, e, r) { + let n = r.map((l) => t[l.id]), i = r.map((l) => l.type), s = n.filter((l) => !(l & 1)), a = t[e.id] >> 1; + function o(l) { + let u = []; + for (let h = 0; h < n.length; h++) { + let f = m5(l, n[h]); + if (i[h] == 2) + for (let d of f) + u.push(d); else - O.push(E); + u.push(f); } - return n.combine(O); + return e.combine(u); } return { - create(w) { - for (let O of a) - FX(w, O); - return w.values[f] = b(w), 1; + create(l) { + for (let u of n) + Qv(l, u); + return l.values[a] = o(l), 1; }, - update(w, O) { - if (!UBe(w, h)) + update(l, u) { + if (!NA(l, s)) return 0; - let S = b(w); - return n.compare(S, w.values[f]) ? 0 : (w.values[f] = S, 1); + let h = o(l); + return e.compare(h, l.values[a]) ? 0 : (l.values[a] = h, 1); }, - reconfigure(w, O) { - let S = UBe(w, a), E = O.config.facets[n.id], D = O.facet(n); - if (E && !S && sze(s, E)) - return w.values[f] = D, 0; - let M = b(w); - return n.compare(M, D) ? (w.values[f] = D, 0) : (w.values[f] = M, 1); + reconfigure(l, u) { + let h = NA(l, n), f = u.config.facets[e.id], d = u.facet(e); + if (f && !h && RR(r, f)) + return l.values[a] = d, 0; + let p = o(l); + return e.compare(p, d) ? (l.values[a] = d, 0) : (l.values[a] = p, 1); } }; } -const b_t = /* @__PURE__ */ us.define({ static: !0 }); -class Ef { - constructor(n, s, a, l, h) { - this.id = n, this.createF = s, this.updateF = a, this.compareF = l, this.spec = h, this.provides = void 0; +const W$ = /* @__PURE__ */ _t.define({ static: !0 }); +class Pn { + constructor(e, r, n, i, s) { + this.id = e, this.createF = r, this.updateF = n, this.compareF = i, this.spec = s, this.provides = void 0; } - static define(n) { - let s = new Ef(ize++, n.create, n.update, n.compare || ((a, l) => a === l), n); - return n.provide && (s.provides = n.provide(s)), s; + static define(e) { + let r = new Pn(LR++, e.create, e.update, e.compare || ((n, i) => n === i), e); + return e.provide && (r.provides = e.provide(r)), r; } - create(n) { - let s = n.facet(b_t).find((a) => a.field == this); - return ((s == null ? void 0 : s.create) || this.createF)(n); + create(e) { + let r = e.facet(W$).find((n) => n.field == this); + return ((r == null ? void 0 : r.create) || this.createF)(e); } - slot(n) { - let s = n[this.id] >> 1; + slot(e) { + let r = e[this.id] >> 1; return { - create: (a) => (a.values[s] = this.create(a), 1), - update: (a, l) => { - let h = a.values[s], f = this.updateF(h, l); - return this.compareF(h, f) ? 0 : (a.values[s] = f, 1); + create: (n) => (n.values[r] = this.create(n), 1), + update: (n, i) => { + let s = n.values[r], a = this.updateF(s, i); + return this.compareF(s, a) ? 0 : (n.values[r] = a, 1); }, - reconfigure: (a, l) => l.config.address[this.id] != null ? (a.values[s] = l.field(this), 0) : (a.values[s] = this.create(a), 1) + reconfigure: (n, i) => i.config.address[this.id] != null ? (n.values[r] = i.field(this), 0) : (n.values[r] = this.create(n), 1) }; } - init(n) { - return [this, b_t.of({ field: this, create: n })]; + init(e) { + return [this, W$.of({ field: this, create: e })]; } get extension() { return this; } } -const LM = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 }; -function HZ(r) { - return (n) => new BDt(n, r); +const gd = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 }; +function Cm(t) { + return (e) => new jZ(e, t); } -const Sk = { - highest: /* @__PURE__ */ HZ(LM.highest), - high: /* @__PURE__ */ HZ(LM.high), - default: /* @__PURE__ */ HZ(LM.default), - low: /* @__PURE__ */ HZ(LM.low), - lowest: /* @__PURE__ */ HZ(LM.lowest) +const zl = { + highest: /* @__PURE__ */ Cm(gd.highest), + high: /* @__PURE__ */ Cm(gd.high), + default: /* @__PURE__ */ Cm(gd.default), + low: /* @__PURE__ */ Cm(gd.low), + lowest: /* @__PURE__ */ Cm(gd.lowest) }; -class BDt { - constructor(n, s) { - this.inner = n, this.prec = s; +class jZ { + constructor(e, r) { + this.inner = e, this.prec = r; } } -class CP { - of(n) { - return new WBe(this, n); +class D0 { + of(e) { + return new IA(this, e); } - reconfigure(n) { - return CP.reconfigure.of({ compartment: this, extension: n }); + reconfigure(e) { + return D0.reconfigure.of({ compartment: this, extension: e }); } - get(n) { - return n.config.compartments.get(this); + get(e) { + return e.config.compartments.get(this); } } -class WBe { - constructor(n, s) { - this.compartment = n, this.inner = s; +class IA { + constructor(e, r) { + this.compartment = e, this.inner = r; } } -class Fbe { - constructor(n, s, a, l, h, f) { - for (this.base = n, this.compartments = s, this.dynamicSlots = a, this.address = l, this.staticValues = h, this.facets = f, this.statusTemplate = []; this.statusTemplate.length < a.length; ) +class g5 { + constructor(e, r, n, i, s, a) { + for (this.base = e, this.compartments = r, this.dynamicSlots = n, this.address = i, this.staticValues = s, this.facets = a, this.statusTemplate = []; this.statusTemplate.length < n.length; ) this.statusTemplate.push(0); } - staticFacet(n) { - let s = this.address[n.id]; - return s == null ? n.default : this.staticValues[s >> 1]; - } - static resolve(n, s, a) { - let l = [], h = /* @__PURE__ */ Object.create(null), f = /* @__PURE__ */ new Map(); - for (let D of xkn(n, s, f)) - D instanceof Ef ? l.push(D) : (h[D.facet.id] || (h[D.facet.id] = [])).push(D); - let b = /* @__PURE__ */ Object.create(null), w = [], O = []; - for (let D of l) - b[D.id] = O.length << 1, O.push((M) => D.slot(M)); - let S = a == null ? void 0 : a.config.facets; - for (let D in h) { - let M = h[D], B = M[0].facet, z = S && S[D] || []; - if (M.every((W) => W.type == 0)) - if (b[B.id] = w.length << 1 | 1, sze(z, M)) - w.push(a.facet(B)); + staticFacet(e) { + let r = this.address[e.id]; + return r == null ? e.default : this.staticValues[r >> 1]; + } + static resolve(e, r, n) { + let i = [], s = /* @__PURE__ */ Object.create(null), a = /* @__PURE__ */ new Map(); + for (let d of K2e(e, r, a)) + d instanceof Pn ? i.push(d) : (s[d.facet.id] || (s[d.facet.id] = [])).push(d); + let o = /* @__PURE__ */ Object.create(null), l = [], u = []; + for (let d of i) + o[d.id] = u.length << 1, u.push((p) => d.slot(p)); + let h = n == null ? void 0 : n.config.facets; + for (let d in s) { + let p = s[d], g = p[0].facet, m = h && h[d] || []; + if (p.every((v) => v.type == 0)) + if (o[g.id] = l.length << 1 | 1, RR(m, p)) + l.push(n.facet(g)); else { - let W = B.combine(M.map((H) => H.value)); - w.push(a && B.compare(W, a.facet(B)) ? a.facet(B) : W); + let v = g.combine(p.map((y) => y.value)); + l.push(n && g.compare(v, n.facet(g)) ? n.facet(g) : v); } else { - for (let W of M) - W.type == 0 ? (b[W.id] = w.length << 1 | 1, w.push(W.value)) : (b[W.id] = O.length << 1, O.push((H) => W.dynamicSlot(H))); - b[B.id] = O.length << 1, O.push((W) => kkn(W, B, M)); + for (let v of p) + v.type == 0 ? (o[v.id] = l.length << 1 | 1, l.push(v.value)) : (o[v.id] = u.length << 1, u.push((y) => v.dynamicSlot(y))); + o[g.id] = u.length << 1, u.push((v) => j2e(v, g, p)); } } - let E = O.map((D) => D(b)); - return new Fbe(n, f, E, b, w, h); + let f = u.map((d) => d(o)); + return new g5(e, a, f, o, l, s); } } -function xkn(r, n, s) { - let a = [[], [], [], [], []], l = /* @__PURE__ */ new Map(); - function h(f, b) { - let w = l.get(f); - if (w != null) { - if (w <= b) +function K2e(t, e, r) { + let n = [[], [], [], [], []], i = /* @__PURE__ */ new Map(); + function s(a, o) { + let l = i.get(a); + if (l != null) { + if (l <= o) return; - let O = a[w].indexOf(f); - O > -1 && a[w].splice(O, 1), f instanceof WBe && s.delete(f.compartment); - } - if (l.set(f, b), Array.isArray(f)) - for (let O of f) - h(O, b); - else if (f instanceof WBe) { - if (s.has(f.compartment)) + let u = n[l].indexOf(a); + u > -1 && n[l].splice(u, 1), a instanceof IA && r.delete(a.compartment); + } + if (i.set(a, o), Array.isArray(a)) + for (let u of a) + s(u, o); + else if (a instanceof IA) { + if (r.has(a.compartment)) throw new RangeError("Duplicate use of compartment in extensions"); - let O = n.get(f.compartment) || f.inner; - s.set(f.compartment, O), h(O, b); - } else if (f instanceof BDt) - h(f.inner, f.prec); - else if (f instanceof Ef) - a[b].push(f), f.provides && h(f.provides, b); - else if (f instanceof Ume) - a[b].push(f), f.facet.extensions && h(f.facet.extensions, LM.default); + let u = e.get(a.compartment) || a.inner; + r.set(a.compartment, u), s(u, o); + } else if (a instanceof jZ) + s(a.inner, a.prec); + else if (a instanceof Pn) + n[o].push(a), a.provides && s(a.provides, o); + else if (a instanceof r4) + n[o].push(a), a.facet.extensions && s(a.facet.extensions, gd.default); else { - let O = f.extension; - if (!O) - throw new Error(`Unrecognized extension value in extension set (${f}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`); - h(O, b); + let u = a.extension; + if (!u) + throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`); + s(u, o); } } - return h(r, LM.default), a.reduce((f, b) => f.concat(b)); + return s(t, gd.default), n.reduce((a, o) => a.concat(o)); } -function FX(r, n) { - if (n & 1) +function Qv(t, e) { + if (e & 1) return 2; - let s = n >> 1, a = r.status[s]; - if (a == 4) + let r = e >> 1, n = t.status[r]; + if (n == 4) throw new Error("Cyclic dependency between fields and/or facets"); - if (a & 2) - return a; - r.status[s] = 4; - let l = r.computeSlot(r, r.config.dynamicSlots[s]); - return r.status[s] = 2 | l; + if (n & 2) + return n; + t.status[r] = 4; + let i = t.computeSlot(t, t.config.dynamicSlots[r]); + return t.status[r] = 2 | i; } -function jbe(r, n) { - return n & 1 ? r.config.staticValues[n >> 1] : r.values[n >> 1]; +function m5(t, e) { + return e & 1 ? t.config.staticValues[e >> 1] : t.values[e >> 1]; } -const FDt = /* @__PURE__ */ us.define(), YBe = /* @__PURE__ */ us.define({ - combine: (r) => r.some((n) => n), +const KZ = /* @__PURE__ */ _t.define(), PA = /* @__PURE__ */ _t.define({ + combine: (t) => t.some((e) => e), static: !0 -}), jDt = /* @__PURE__ */ us.define({ - combine: (r) => r.length ? r[0] : void 0, +}), JZ = /* @__PURE__ */ _t.define({ + combine: (t) => t.length ? t[0] : void 0, static: !0 -}), QDt = /* @__PURE__ */ us.define(), zDt = /* @__PURE__ */ us.define(), qDt = /* @__PURE__ */ us.define(), VDt = /* @__PURE__ */ us.define({ - combine: (r) => r.length ? r[0] : !1 +}), ej = /* @__PURE__ */ _t.define(), tj = /* @__PURE__ */ _t.define(), rj = /* @__PURE__ */ _t.define(), nj = /* @__PURE__ */ _t.define({ + combine: (t) => t.length ? t[0] : !1 }); -class _k { - constructor(n, s) { - this.type = n, this.value = s; +class Vl { + constructor(e, r) { + this.type = e, this.value = r; } static define() { - return new Skn(); + return new J2e(); } } -class Skn { - of(n) { - return new _k(this, n); +class J2e { + of(e) { + return new Vl(this, e); } } -class _kn { - constructor(n) { - this.map = n; +class ebe { + constructor(e) { + this.map = e; } - of(n) { - return new $o(this, n); + of(e) { + return new Zt(this, e); } } -class $o { - constructor(n, s) { - this.type = n, this.value = s; +class Zt { + constructor(e, r) { + this.type = e, this.value = r; } - map(n) { - let s = this.type.map(this.value, n); - return s === void 0 ? void 0 : s == this.value ? this : new $o(this.type, s); + map(e) { + let r = this.type.map(this.value, e); + return r === void 0 ? void 0 : r == this.value ? this : new Zt(this.type, r); } - is(n) { - return this.type == n; + is(e) { + return this.type == e; } - static define(n = {}) { - return new _kn(n.map || ((s) => s)); + static define(e = {}) { + return new ebe(e.map || ((r) => r)); } - static mapEffects(n, s) { - if (!n.length) - return n; - let a = []; - for (let l of n) { - let h = l.map(s); - h && a.push(h); + static mapEffects(e, r) { + if (!e.length) + return e; + let n = []; + for (let i of e) { + let s = i.map(r); + s && n.push(s); } - return a; + return n; } } -$o.reconfigure = /* @__PURE__ */ $o.define(); -$o.appendConfig = /* @__PURE__ */ $o.define(); -class v1 { - constructor(n, s, a, l, h, f) { - this.startState = n, this.changes = s, this.selection = a, this.effects = l, this.annotations = h, this.scrollIntoView = f, this._doc = null, this._state = null, a && $Dt(a, s.newLength), h.some((b) => b.type == v1.time) || (this.annotations = h.concat(v1.time.of(Date.now()))); +Zt.reconfigure = /* @__PURE__ */ Zt.define(); +Zt.appendConfig = /* @__PURE__ */ Zt.define(); +class fi { + constructor(e, r, n, i, s, a) { + this.startState = e, this.changes = r, this.selection = n, this.effects = i, this.annotations = s, this.scrollIntoView = a, this._doc = null, this._state = null, n && ZZ(n, r.newLength), s.some((o) => o.type == fi.time) || (this.annotations = s.concat(fi.time.of(Date.now()))); } - static create(n, s, a, l, h, f) { - return new v1(n, s, a, l, h, f); + static create(e, r, n, i, s, a) { + return new fi(e, r, n, i, s, a); } get newDoc() { return this._doc || (this._doc = this.changes.apply(this.startState.doc)); @@ -3179,10 +3188,10 @@ class v1 { get state() { return this._state || this.startState.applyTransaction(this), this._state; } - annotation(n) { - for (let s of this.annotations) - if (s.type == n) - return s.value; + annotation(e) { + for (let r of this.annotations) + if (r.type == e) + return r.value; } get docChanged() { return !this.changes.empty; @@ -3190,543 +3199,543 @@ class v1 { get reconfigured() { return this.startState.config != this.state.config; } - isUserEvent(n) { - let s = this.annotation(v1.userEvent); - return !!(s && (s == n || s.length > n.length && s.slice(0, n.length) == n && s[n.length] == ".")); + isUserEvent(e) { + let r = this.annotation(fi.userEvent); + return !!(r && (r == e || r.length > e.length && r.slice(0, e.length) == e && r[e.length] == ".")); } } -v1.time = /* @__PURE__ */ _k.define(); -v1.userEvent = /* @__PURE__ */ _k.define(); -v1.addToHistory = /* @__PURE__ */ _k.define(); -v1.remote = /* @__PURE__ */ _k.define(); -function Ckn(r, n) { - let s = []; - for (let a = 0, l = 0; ; ) { - let h, f; - if (a < r.length && (l == n.length || n[l] >= r[a])) - h = r[a++], f = r[a++]; - else if (l < n.length) - h = n[l++], f = n[l++]; +fi.time = /* @__PURE__ */ Vl.define(); +fi.userEvent = /* @__PURE__ */ Vl.define(); +fi.addToHistory = /* @__PURE__ */ Vl.define(); +fi.remote = /* @__PURE__ */ Vl.define(); +function tbe(t, e) { + let r = []; + for (let n = 0, i = 0; ; ) { + let s, a; + if (n < t.length && (i == e.length || e[i] >= t[n])) + s = t[n++], a = t[n++]; + else if (i < e.length) + s = e[i++], a = e[i++]; else - return s; - !s.length || s[s.length - 1] < h ? s.push(h, f) : s[s.length - 1] < f && (s[s.length - 1] = f); + return r; + !r.length || r[r.length - 1] < s ? r.push(s, a) : r[r.length - 1] < a && (r[r.length - 1] = a); } } -function UDt(r, n, s) { - var a; - let l, h, f; - return s ? (l = n.changes, h = f1.empty(n.changes.length), f = r.changes.compose(n.changes)) : (l = n.changes.map(r.changes), h = r.changes.mapDesc(n.changes, !0), f = r.changes.compose(l)), { - changes: f, - selection: n.selection ? n.selection.map(h) : (a = r.selection) === null || a === void 0 ? void 0 : a.map(l), - effects: $o.mapEffects(r.effects, l).concat($o.mapEffects(n.effects, h)), - annotations: r.annotations.length ? r.annotations.concat(n.annotations) : n.annotations, - scrollIntoView: r.scrollIntoView || n.scrollIntoView +function ij(t, e, r) { + var n; + let i, s, a; + return r ? (i = e.changes, s = ai.empty(e.changes.length), a = t.changes.compose(e.changes)) : (i = e.changes.map(t.changes), s = t.changes.mapDesc(e.changes, !0), a = t.changes.compose(i)), { + changes: a, + selection: e.selection ? e.selection.map(s) : (n = t.selection) === null || n === void 0 ? void 0 : n.map(i), + effects: Zt.mapEffects(t.effects, i).concat(Zt.mapEffects(e.effects, s)), + annotations: t.annotations.length ? t.annotations.concat(e.annotations) : e.annotations, + scrollIntoView: t.scrollIntoView || e.scrollIntoView }; } -function HBe(r, n, s) { - let a = n.selection, l = MB(n.annotations); - return n.userEvent && (l = l.concat(v1.userEvent.of(n.userEvent))), { - changes: n.changes instanceof f1 ? n.changes : f1.of(n.changes || [], s, r.facet(jDt)), - selection: a && (a instanceof sr ? a : sr.single(a.anchor, a.head)), - effects: MB(n.effects), - annotations: l, - scrollIntoView: !!n.scrollIntoView +function $A(t, e, r) { + let n = e.selection, i = Yp(e.annotations); + return e.userEvent && (i = i.concat(fi.userEvent.of(e.userEvent))), { + changes: e.changes instanceof ai ? e.changes : ai.of(e.changes || [], r, t.facet(JZ)), + selection: n && (n instanceof Ve ? n : Ve.single(n.anchor, n.head)), + effects: Yp(e.effects), + annotations: i, + scrollIntoView: !!e.scrollIntoView }; } -function WDt(r, n, s) { - let a = HBe(r, n.length ? n[0] : {}, r.doc.length); - n.length && n[0].filter === !1 && (s = !1); - for (let h = 1; h < n.length; h++) { - n[h].filter === !1 && (s = !1); - let f = !!n[h].sequential; - a = UDt(a, HBe(r, n[h], f ? a.changes.newLength : r.doc.length), f); - } - let l = v1.create(r, a.changes, a.selection, a.effects, a.annotations, a.scrollIntoView); - return Tkn(s ? Ekn(l) : l); -} -function Ekn(r) { - let n = r.startState, s = !0; - for (let l of n.facet(QDt)) { - let h = l(r); - if (h === !1) { - s = !1; +function sj(t, e, r) { + let n = $A(t, e.length ? e[0] : {}, t.doc.length); + e.length && e[0].filter === !1 && (r = !1); + for (let s = 1; s < e.length; s++) { + e[s].filter === !1 && (r = !1); + let a = !!e[s].sequential; + n = ij(n, $A(t, e[s], a ? n.changes.newLength : t.doc.length), a); + } + let i = fi.create(t, n.changes, n.selection, n.effects, n.annotations, n.scrollIntoView); + return nbe(r ? rbe(i) : i); +} +function rbe(t) { + let e = t.startState, r = !0; + for (let i of e.facet(ej)) { + let s = i(t); + if (s === !1) { + r = !1; break; } - Array.isArray(h) && (s = s === !0 ? h : Ckn(s, h)); + Array.isArray(s) && (r = r === !0 ? s : tbe(r, s)); } - if (s !== !0) { - let l, h; - if (s === !1) - h = r.changes.invertedDesc, l = f1.empty(n.doc.length); + if (r !== !0) { + let i, s; + if (r === !1) + s = t.changes.invertedDesc, i = ai.empty(e.doc.length); else { - let f = r.changes.filter(s); - l = f.changes, h = f.filtered.mapDesc(f.changes).invertedDesc; + let a = t.changes.filter(r); + i = a.changes, s = a.filtered.mapDesc(a.changes).invertedDesc; } - r = v1.create(n, l, r.selection && r.selection.map(h), $o.mapEffects(r.effects, h), r.annotations, r.scrollIntoView); + t = fi.create(e, i, t.selection && t.selection.map(s), Zt.mapEffects(t.effects, s), t.annotations, t.scrollIntoView); } - let a = n.facet(zDt); - for (let l = a.length - 1; l >= 0; l--) { - let h = a[l](r); - h instanceof v1 ? r = h : Array.isArray(h) && h.length == 1 && h[0] instanceof v1 ? r = h[0] : r = WDt(n, MB(h), !1); + let n = e.facet(tj); + for (let i = n.length - 1; i >= 0; i--) { + let s = n[i](t); + s instanceof fi ? t = s : Array.isArray(s) && s.length == 1 && s[0] instanceof fi ? t = s[0] : t = sj(e, Yp(s), !1); } - return r; + return t; } -function Tkn(r) { - let n = r.startState, s = n.facet(qDt), a = r; - for (let l = s.length - 1; l >= 0; l--) { - let h = s[l](r); - h && Object.keys(h).length && (a = UDt(a, HBe(n, h, r.changes.newLength), !0)); +function nbe(t) { + let e = t.startState, r = e.facet(rj), n = t; + for (let i = r.length - 1; i >= 0; i--) { + let s = r[i](t); + s && Object.keys(s).length && (n = ij(n, $A(e, s, t.changes.newLength), !0)); } - return a == r ? r : v1.create(n, r.changes, r.selection, a.effects, a.annotations, a.scrollIntoView); + return n == t ? t : fi.create(e, t.changes, t.selection, n.effects, n.annotations, n.scrollIntoView); } -const Akn = []; -function MB(r) { - return r == null ? Akn : Array.isArray(r) ? r : [r]; +const ibe = []; +function Yp(t) { + return t == null ? ibe : Array.isArray(t) ? t : [t]; } -var ef = /* @__PURE__ */ function(r) { - return r[r.Word = 0] = "Word", r[r.Space = 1] = "Space", r[r.Other = 2] = "Other", r; -}(ef || (ef = {})); -const Dkn = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; -let GBe; +var Sn = /* @__PURE__ */ function(t) { + return t[t.Word = 0] = "Word", t[t.Space = 1] = "Space", t[t.Other = 2] = "Other", t; +}(Sn || (Sn = {})); +const sbe = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; +let BA; try { - GBe = /* @__PURE__ */ new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u"); + BA = /* @__PURE__ */ new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u"); } catch { } -function Mkn(r) { - if (GBe) - return GBe.test(r); - for (let n = 0; n < r.length; n++) { - let s = r[n]; - if (/\w/.test(s) || s > "\x80" && (s.toUpperCase() != s.toLowerCase() || Dkn.test(s))) +function abe(t) { + if (BA) + return BA.test(t); + for (let e = 0; e < t.length; e++) { + let r = t[e]; + if (/\w/.test(r) || r > "\x80" && (r.toUpperCase() != r.toLowerCase() || sbe.test(r))) return !0; } return !1; } -function Pkn(r) { - return (n) => { - if (!/\S/.test(n)) - return ef.Space; - if (Mkn(n)) - return ef.Word; - for (let s = 0; s < r.length; s++) - if (n.indexOf(r[s]) > -1) - return ef.Word; - return ef.Other; +function obe(t) { + return (e) => { + if (!/\S/.test(e)) + return Sn.Space; + if (abe(e)) + return Sn.Word; + for (let r = 0; r < t.length; r++) + if (e.indexOf(t[r]) > -1) + return Sn.Word; + return Sn.Other; }; } -class Ga { - constructor(n, s, a, l, h, f) { - this.config = n, this.doc = s, this.selection = a, this.values = l, this.status = n.statusTemplate.slice(), this.computeSlot = h, f && (f._state = this); - for (let b = 0; b < this.config.dynamicSlots.length; b++) - FX(this, b << 1); +class dr { + constructor(e, r, n, i, s, a) { + this.config = e, this.doc = r, this.selection = n, this.values = i, this.status = e.statusTemplate.slice(), this.computeSlot = s, a && (a._state = this); + for (let o = 0; o < this.config.dynamicSlots.length; o++) + Qv(this, o << 1); this.computeSlot = null; } - field(n, s = !0) { - let a = this.config.address[n.id]; - if (a == null) { - if (s) + field(e, r = !0) { + let n = this.config.address[e.id]; + if (n == null) { + if (r) throw new RangeError("Field is not present in this state"); return; } - return FX(this, a), jbe(this, a); - } - update(...n) { - return WDt(this, n, !0); + return Qv(this, n), m5(this, n); } - applyTransaction(n) { - let s = this.config, { base: a, compartments: l } = s; - for (let b of n.effects) - b.is(CP.reconfigure) ? (s && (l = /* @__PURE__ */ new Map(), s.compartments.forEach((w, O) => l.set(O, w)), s = null), l.set(b.value.compartment, b.value.extension)) : b.is($o.reconfigure) ? (s = null, a = b.value) : b.is($o.appendConfig) && (s = null, a = MB(a).concat(b.value)); - let h; - s ? h = n.startState.values.slice() : (s = Fbe.resolve(a, l, this), h = new Ga(s, this.doc, this.selection, s.dynamicSlots.map(() => null), (w, O) => O.reconfigure(w, this), null).values); - let f = n.startState.facet(YBe) ? n.newSelection : n.newSelection.asSingle(); - new Ga(s, n.newDoc, f, h, (b, w) => w.update(b, n), n); + update(...e) { + return sj(this, e, !0); } - replaceSelection(n) { - return typeof n == "string" && (n = this.toText(n)), this.changeByRange((s) => ({ - changes: { from: s.from, to: s.to, insert: n }, - range: sr.cursor(s.from + n.length) + applyTransaction(e) { + let r = this.config, { base: n, compartments: i } = r; + for (let o of e.effects) + o.is(D0.reconfigure) ? (r && (i = /* @__PURE__ */ new Map(), r.compartments.forEach((l, u) => i.set(u, l)), r = null), i.set(o.value.compartment, o.value.extension)) : o.is(Zt.reconfigure) ? (r = null, n = o.value) : o.is(Zt.appendConfig) && (r = null, n = Yp(n).concat(o.value)); + let s; + r ? s = e.startState.values.slice() : (r = g5.resolve(n, i, this), s = new dr(r, this.doc, this.selection, r.dynamicSlots.map(() => null), (l, u) => u.reconfigure(l, this), null).values); + let a = e.startState.facet(PA) ? e.newSelection : e.newSelection.asSingle(); + new dr(r, e.newDoc, a, s, (o, l) => l.update(o, e), e); + } + replaceSelection(e) { + return typeof e == "string" && (e = this.toText(e)), this.changeByRange((r) => ({ + changes: { from: r.from, to: r.to, insert: e }, + range: Ve.cursor(r.from + e.length) })); } - changeByRange(n) { - let s = this.selection, a = n(s.ranges[0]), l = this.changes(a.changes), h = [a.range], f = MB(a.effects); - for (let b = 1; b < s.ranges.length; b++) { - let w = n(s.ranges[b]), O = this.changes(w.changes), S = O.map(l); - for (let D = 0; D < b; D++) - h[D] = h[D].map(S); - let E = l.mapDesc(O, !0); - h.push(w.range.map(E)), l = l.compose(S), f = $o.mapEffects(f, S).concat($o.mapEffects(MB(w.effects), E)); + changeByRange(e) { + let r = this.selection, n = e(r.ranges[0]), i = this.changes(n.changes), s = [n.range], a = Yp(n.effects); + for (let o = 1; o < r.ranges.length; o++) { + let l = e(r.ranges[o]), u = this.changes(l.changes), h = u.map(i); + for (let d = 0; d < o; d++) + s[d] = s[d].map(h); + let f = i.mapDesc(u, !0); + s.push(l.range.map(f)), i = i.compose(h), a = Zt.mapEffects(a, h).concat(Zt.mapEffects(Yp(l.effects), f)); } return { - changes: l, - selection: sr.create(h, s.mainIndex), - effects: f + changes: i, + selection: Ve.create(s, r.mainIndex), + effects: a }; } - changes(n = []) { - return n instanceof f1 ? n : f1.of(n, this.doc.length, this.facet(Ga.lineSeparator)); + changes(e = []) { + return e instanceof ai ? e : ai.of(e, this.doc.length, this.facet(dr.lineSeparator)); } - toText(n) { - return Al.of(n.split(this.facet(Ga.lineSeparator) || zBe)); + toText(e) { + return Dr.of(e.split(this.facet(dr.lineSeparator) || RA)); } - sliceDoc(n = 0, s = this.doc.length) { - return this.doc.sliceString(n, s, this.lineBreak); + sliceDoc(e = 0, r = this.doc.length) { + return this.doc.sliceString(e, r, this.lineBreak); } - facet(n) { - let s = this.config.address[n.id]; - return s == null ? n.default : (FX(this, s), jbe(this, s)); + facet(e) { + let r = this.config.address[e.id]; + return r == null ? e.default : (Qv(this, r), m5(this, r)); } - toJSON(n) { - let s = { + toJSON(e) { + let r = { doc: this.sliceDoc(), selection: this.selection.toJSON() }; - if (n) - for (let a in n) { - let l = n[a]; - l instanceof Ef && this.config.address[l.id] != null && (s[a] = l.spec.toJSON(this.field(n[a]), this)); + if (e) + for (let n in e) { + let i = e[n]; + i instanceof Pn && this.config.address[i.id] != null && (r[n] = i.spec.toJSON(this.field(e[n]), this)); } - return s; + return r; } - static fromJSON(n, s = {}, a) { - if (!n || typeof n.doc != "string") + static fromJSON(e, r = {}, n) { + if (!e || typeof e.doc != "string") throw new RangeError("Invalid JSON representation for EditorState"); - let l = []; - if (a) { - for (let h in a) - if (Object.prototype.hasOwnProperty.call(n, h)) { - let f = a[h], b = n[h]; - l.push(f.init((w) => f.spec.fromJSON(b, w))); + let i = []; + if (n) { + for (let s in n) + if (Object.prototype.hasOwnProperty.call(e, s)) { + let a = n[s], o = e[s]; + i.push(a.init((l) => a.spec.fromJSON(o, l))); } } - return Ga.create({ - doc: n.doc, - selection: sr.fromJSON(n.selection), - extensions: s.extensions ? l.concat([s.extensions]) : l + return dr.create({ + doc: e.doc, + selection: Ve.fromJSON(e.selection), + extensions: r.extensions ? i.concat([r.extensions]) : i }); } - static create(n = {}) { - let s = Fbe.resolve(n.extensions || [], /* @__PURE__ */ new Map()), a = n.doc instanceof Al ? n.doc : Al.of((n.doc || "").split(s.staticFacet(Ga.lineSeparator) || zBe)), l = n.selection ? n.selection instanceof sr ? n.selection : sr.single(n.selection.anchor, n.selection.head) : sr.single(0); - return $Dt(l, a.length), s.staticFacet(YBe) || (l = l.asSingle()), new Ga(s, a, l, s.dynamicSlots.map(() => null), (h, f) => f.create(h), null); + static create(e = {}) { + let r = g5.resolve(e.extensions || [], /* @__PURE__ */ new Map()), n = e.doc instanceof Dr ? e.doc : Dr.of((e.doc || "").split(r.staticFacet(dr.lineSeparator) || RA)), i = e.selection ? e.selection instanceof Ve ? e.selection : Ve.single(e.selection.anchor, e.selection.head) : Ve.single(0); + return ZZ(i, n.length), r.staticFacet(PA) || (i = i.asSingle()), new dr(r, n, i, r.dynamicSlots.map(() => null), (s, a) => a.create(s), null); } get tabSize() { - return this.facet(Ga.tabSize); + return this.facet(dr.tabSize); } get lineBreak() { - return this.facet(Ga.lineSeparator) || ` + return this.facet(dr.lineSeparator) || ` `; } get readOnly() { - return this.facet(VDt); + return this.facet(nj); } - phrase(n, ...s) { - for (let a of this.facet(Ga.phrases)) - if (Object.prototype.hasOwnProperty.call(a, n)) { - n = a[n]; + phrase(e, ...r) { + for (let n of this.facet(dr.phrases)) + if (Object.prototype.hasOwnProperty.call(n, e)) { + e = n[e]; break; } - return s.length && (n = n.replace(/\$(\$|\d*)/g, (a, l) => { - if (l == "$") + return r.length && (e = e.replace(/\$(\$|\d*)/g, (n, i) => { + if (i == "$") return "$"; - let h = +(l || 1); - return !h || h > s.length ? a : s[h - 1]; - })), n; - } - languageDataAt(n, s, a = -1) { - let l = []; - for (let h of this.facet(FDt)) - for (let f of h(this, s, a)) - Object.prototype.hasOwnProperty.call(f, n) && l.push(f[n]); - return l; - } - charCategorizer(n) { - return Pkn(this.languageDataAt("wordChars", n).join("")); - } - wordAt(n) { - let { text: s, from: a, length: l } = this.doc.lineAt(n), h = this.charCategorizer(n), f = n - a, b = n - a; - for (; f > 0; ) { - let w = Np(s, f, !1); - if (h(s.slice(w, f)) != ef.Word) + let s = +(i || 1); + return !s || s > r.length ? n : r[s - 1]; + })), e; + } + languageDataAt(e, r, n = -1) { + let i = []; + for (let s of this.facet(KZ)) + for (let a of s(this, r, n)) + Object.prototype.hasOwnProperty.call(a, e) && i.push(a[e]); + return i; + } + charCategorizer(e) { + return obe(this.languageDataAt("wordChars", e).join("")); + } + wordAt(e) { + let { text: r, from: n, length: i } = this.doc.lineAt(e), s = this.charCategorizer(e), a = e - n, o = e - n; + for (; a > 0; ) { + let l = ls(r, a, !1); + if (s(r.slice(l, a)) != Sn.Word) break; - f = w; + a = l; } - for (; b < l; ) { - let w = Np(s, b); - if (h(s.slice(b, w)) != ef.Word) + for (; o < i; ) { + let l = ls(r, o); + if (s(r.slice(o, l)) != Sn.Word) break; - b = w; + o = l; } - return f == b ? null : sr.range(f + a, b + a); + return a == o ? null : Ve.range(a + n, o + n); } } -Ga.allowMultipleSelections = YBe; -Ga.tabSize = /* @__PURE__ */ us.define({ - combine: (r) => r.length ? r[0] : 4 +dr.allowMultipleSelections = PA; +dr.tabSize = /* @__PURE__ */ _t.define({ + combine: (t) => t.length ? t[0] : 4 }); -Ga.lineSeparator = jDt; -Ga.readOnly = VDt; -Ga.phrases = /* @__PURE__ */ us.define({ - compare(r, n) { - let s = Object.keys(r), a = Object.keys(n); - return s.length == a.length && s.every((l) => r[l] == n[l]); +dr.lineSeparator = JZ; +dr.readOnly = nj; +dr.phrases = /* @__PURE__ */ _t.define({ + compare(t, e) { + let r = Object.keys(t), n = Object.keys(e); + return r.length == n.length && r.every((i) => t[i] == e[i]); } }); -Ga.languageData = FDt; -Ga.changeFilter = QDt; -Ga.transactionFilter = zDt; -Ga.transactionExtender = qDt; -CP.reconfigure = /* @__PURE__ */ $o.define(); -function px(r, n, s = {}) { - let a = {}; - for (let l of r) - for (let h of Object.keys(l)) { - let f = l[h], b = a[h]; - if (b === void 0) - a[h] = f; - else if (!(b === f || f === void 0)) - if (Object.hasOwnProperty.call(s, h)) - a[h] = s[h](b, f); +dr.languageData = KZ; +dr.changeFilter = ej; +dr.transactionFilter = tj; +dr.transactionExtender = rj; +D0.reconfigure = /* @__PURE__ */ Zt.define(); +function qc(t, e, r = {}) { + let n = {}; + for (let i of t) + for (let s of Object.keys(i)) { + let a = i[s], o = n[s]; + if (o === void 0) + n[s] = a; + else if (!(o === a || a === void 0)) + if (Object.hasOwnProperty.call(r, s)) + n[s] = r[s](o, a); else - throw new Error("Config merge conflict for field " + h); + throw new Error("Config merge conflict for field " + s); } - for (let l in n) - a[l] === void 0 && (a[l] = n[l]); - return a; + for (let i in e) + n[i] === void 0 && (n[i] = e[i]); + return n; } -class iP { - eq(n) { - return this == n; +class Xd { + eq(e) { + return this == e; } - range(n, s = n) { - return lK.create(n, s, this); + range(e, r = e) { + return yy.create(e, r, this); } } -iP.prototype.startSide = iP.prototype.endSide = 0; -iP.prototype.point = !1; -iP.prototype.mapMode = c0.TrackDel; -class lK { - constructor(n, s, a) { - this.from = n, this.to = s, this.value = a; +Xd.prototype.startSide = Xd.prototype.endSide = 0; +Xd.prototype.point = !1; +Xd.prototype.mapMode = Si.TrackDel; +class yy { + constructor(e, r, n) { + this.from = e, this.to = r, this.value = n; } - static create(n, s, a) { - return new lK(n, s, a); + static create(e, r, n) { + return new yy(e, r, n); } } -function ZBe(r, n) { - return r.from - n.from || r.value.startSide - n.value.startSide; +function FA(t, e) { + return t.from - e.from || t.value.startSide - e.value.startSide; } -class oze { - constructor(n, s, a, l) { - this.from = n, this.to = s, this.value = a, this.maxPoint = l; +class MR { + constructor(e, r, n, i) { + this.from = e, this.to = r, this.value = n, this.maxPoint = i; } get length() { return this.to[this.to.length - 1]; } - findIndex(n, s, a, l = 0) { - let h = a ? this.to : this.from; - for (let f = l, b = h.length; ; ) { - if (f == b) - return f; - let w = f + b >> 1, O = h[w] - n || (a ? this.value[w].endSide : this.value[w].startSide) - s; - if (w == f) - return O >= 0 ? f : b; - O >= 0 ? b = w : f = w + 1; + findIndex(e, r, n, i = 0) { + let s = n ? this.to : this.from; + for (let a = i, o = s.length; ; ) { + if (a == o) + return a; + let l = a + o >> 1, u = s[l] - e || (n ? this.value[l].endSide : this.value[l].startSide) - r; + if (l == a) + return u >= 0 ? a : o; + u >= 0 ? o = l : a = l + 1; } } - between(n, s, a, l) { - for (let h = this.findIndex(s, -1e9, !0), f = this.findIndex(a, 1e9, !1, h); h < f; h++) - if (l(this.from[h] + n, this.to[h] + n, this.value[h]) === !1) + between(e, r, n, i) { + for (let s = this.findIndex(r, -1e9, !0), a = this.findIndex(n, 1e9, !1, s); s < a; s++) + if (i(this.from[s] + e, this.to[s] + e, this.value[s]) === !1) return !1; } - map(n, s) { - let a = [], l = [], h = [], f = -1, b = -1; - for (let w = 0; w < this.value.length; w++) { - let O = this.value[w], S = this.from[w] + n, E = this.to[w] + n, D, M; - if (S == E) { - let B = s.mapPos(S, O.startSide, O.mapMode); - if (B == null || (D = M = B, O.startSide != O.endSide && (M = s.mapPos(S, O.endSide), M < D))) + map(e, r) { + let n = [], i = [], s = [], a = -1, o = -1; + for (let l = 0; l < this.value.length; l++) { + let u = this.value[l], h = this.from[l] + e, f = this.to[l] + e, d, p; + if (h == f) { + let g = r.mapPos(h, u.startSide, u.mapMode); + if (g == null || (d = p = g, u.startSide != u.endSide && (p = r.mapPos(h, u.endSide), p < d))) continue; - } else if (D = s.mapPos(S, O.startSide), M = s.mapPos(E, O.endSide), D > M || D == M && O.startSide > 0 && O.endSide <= 0) + } else if (d = r.mapPos(h, u.startSide), p = r.mapPos(f, u.endSide), d > p || d == p && u.startSide > 0 && u.endSide <= 0) continue; - (M - D || O.endSide - O.startSide) < 0 || (f < 0 && (f = D), O.point && (b = Math.max(b, M - D)), a.push(O), l.push(D - f), h.push(M - f)); + (p - d || u.endSide - u.startSide) < 0 || (a < 0 && (a = d), u.point && (o = Math.max(o, p - d)), n.push(u), i.push(d - a), s.push(p - a)); } - return { mapped: a.length ? new oze(l, h, a, b) : null, pos: f }; + return { mapped: n.length ? new MR(i, s, n, o) : null, pos: a }; } } -class cl { - constructor(n, s, a, l) { - this.chunkPos = n, this.chunk = s, this.nextLayer = a, this.maxPoint = l; +class Er { + constructor(e, r, n, i) { + this.chunkPos = e, this.chunk = r, this.nextLayer = n, this.maxPoint = i; } - static create(n, s, a, l) { - return new cl(n, s, a, l); + static create(e, r, n, i) { + return new Er(e, r, n, i); } get length() { - let n = this.chunk.length - 1; - return n < 0 ? 0 : Math.max(this.chunkEnd(n), this.nextLayer.length); + let e = this.chunk.length - 1; + return e < 0 ? 0 : Math.max(this.chunkEnd(e), this.nextLayer.length); } get size() { if (this.isEmpty) return 0; - let n = this.nextLayer.size; - for (let s of this.chunk) - n += s.value.length; - return n; + let e = this.nextLayer.size; + for (let r of this.chunk) + e += r.value.length; + return e; } - chunkEnd(n) { - return this.chunkPos[n] + this.chunk[n].length; + chunkEnd(e) { + return this.chunkPos[e] + this.chunk[e].length; } - update(n) { - let { add: s = [], sort: a = !1, filterFrom: l = 0, filterTo: h = this.length } = n, f = n.filter; - if (s.length == 0 && !f) + update(e) { + let { add: r = [], sort: n = !1, filterFrom: i = 0, filterTo: s = this.length } = e, a = e.filter; + if (r.length == 0 && !a) return this; - if (a && (s = s.slice().sort(ZBe)), this.isEmpty) - return s.length ? cl.of(s) : this; - let b = new YDt(this, null, -1).goto(0), w = 0, O = [], S = new G0(); - for (; b.value || w < s.length; ) - if (w < s.length && (b.from - s[w].from || b.startSide - s[w].value.startSide) >= 0) { - let E = s[w++]; - S.addInner(E.from, E.to, E.value) || O.push(E); + if (n && (r = r.slice().sort(FA)), this.isEmpty) + return r.length ? Er.of(r) : this; + let o = new aj(this, null, -1).goto(0), l = 0, u = [], h = new Hi(); + for (; o.value || l < r.length; ) + if (l < r.length && (o.from - r[l].from || o.startSide - r[l].value.startSide) >= 0) { + let f = r[l++]; + h.addInner(f.from, f.to, f.value) || u.push(f); } else - b.rangeIndex == 1 && b.chunkIndex < this.chunk.length && (w == s.length || this.chunkEnd(b.chunkIndex) < s[w].from) && (!f || l > this.chunkEnd(b.chunkIndex) || h < this.chunkPos[b.chunkIndex]) && S.addChunk(this.chunkPos[b.chunkIndex], this.chunk[b.chunkIndex]) ? b.nextChunk() : ((!f || l > b.to || h < b.from || f(b.from, b.to, b.value)) && (S.addInner(b.from, b.to, b.value) || O.push(lK.create(b.from, b.to, b.value))), b.next()); - return S.finishInner(this.nextLayer.isEmpty && !O.length ? cl.empty : this.nextLayer.update({ add: O, filter: f, filterFrom: l, filterTo: h })); + o.rangeIndex == 1 && o.chunkIndex < this.chunk.length && (l == r.length || this.chunkEnd(o.chunkIndex) < r[l].from) && (!a || i > this.chunkEnd(o.chunkIndex) || s < this.chunkPos[o.chunkIndex]) && h.addChunk(this.chunkPos[o.chunkIndex], this.chunk[o.chunkIndex]) ? o.nextChunk() : ((!a || i > o.to || s < o.from || a(o.from, o.to, o.value)) && (h.addInner(o.from, o.to, o.value) || u.push(yy.create(o.from, o.to, o.value))), o.next()); + return h.finishInner(this.nextLayer.isEmpty && !u.length ? Er.empty : this.nextLayer.update({ add: u, filter: a, filterFrom: i, filterTo: s })); } - map(n) { - if (n.empty || this.isEmpty) + map(e) { + if (e.empty || this.isEmpty) return this; - let s = [], a = [], l = -1; - for (let f = 0; f < this.chunk.length; f++) { - let b = this.chunkPos[f], w = this.chunk[f], O = n.touchesRange(b, b + w.length); - if (O === !1) - l = Math.max(l, w.maxPoint), s.push(w), a.push(n.mapPos(b)); - else if (O === !0) { - let { mapped: S, pos: E } = w.map(b, n); - S && (l = Math.max(l, S.maxPoint), s.push(S), a.push(E)); + let r = [], n = [], i = -1; + for (let a = 0; a < this.chunk.length; a++) { + let o = this.chunkPos[a], l = this.chunk[a], u = e.touchesRange(o, o + l.length); + if (u === !1) + i = Math.max(i, l.maxPoint), r.push(l), n.push(e.mapPos(o)); + else if (u === !0) { + let { mapped: h, pos: f } = l.map(o, e); + h && (i = Math.max(i, h.maxPoint), r.push(h), n.push(f)); } } - let h = this.nextLayer.map(n); - return s.length == 0 ? h : new cl(a, s, h || cl.empty, l); + let s = this.nextLayer.map(e); + return r.length == 0 ? s : new Er(n, r, s || Er.empty, i); } - between(n, s, a) { + between(e, r, n) { if (!this.isEmpty) { - for (let l = 0; l < this.chunk.length; l++) { - let h = this.chunkPos[l], f = this.chunk[l]; - if (s >= h && n <= h + f.length && f.between(h, n - h, s - h, a) === !1) + for (let i = 0; i < this.chunk.length; i++) { + let s = this.chunkPos[i], a = this.chunk[i]; + if (r >= s && e <= s + a.length && a.between(s, e - s, r - s, n) === !1) return; } - this.nextLayer.between(n, s, a); + this.nextLayer.between(e, r, n); } } - iter(n = 0) { - return uK.from([this]).goto(n); + iter(e = 0) { + return by.from([this]).goto(e); } get isEmpty() { return this.nextLayer == this; } - static iter(n, s = 0) { - return uK.from(n).goto(s); + static iter(e, r = 0) { + return by.from(e).goto(r); } - static compare(n, s, a, l, h = -1) { - let f = n.filter((E) => E.maxPoint > 0 || !E.isEmpty && E.maxPoint >= h), b = s.filter((E) => E.maxPoint > 0 || !E.isEmpty && E.maxPoint >= h), w = v_t(f, b, a), O = new GZ(f, w, h), S = new GZ(b, w, h); - a.iterGaps((E, D, M) => w_t(O, E, S, D, M, l)), a.empty && a.length == 0 && w_t(O, 0, S, 0, 0, l); + static compare(e, r, n, i, s = -1) { + let a = e.filter((f) => f.maxPoint > 0 || !f.isEmpty && f.maxPoint >= s), o = r.filter((f) => f.maxPoint > 0 || !f.isEmpty && f.maxPoint >= s), l = G$(a, o, n), u = new Em(a, l, s), h = new Em(o, l, s); + n.iterGaps((f, d, p) => H$(u, f, h, d, p, i)), n.empty && n.length == 0 && H$(u, 0, h, 0, 0, i); } - static eq(n, s, a = 0, l) { - l == null && (l = 1e9 - 1); - let h = n.filter((S) => !S.isEmpty && s.indexOf(S) < 0), f = s.filter((S) => !S.isEmpty && n.indexOf(S) < 0); - if (h.length != f.length) + static eq(e, r, n = 0, i) { + i == null && (i = 1e9 - 1); + let s = e.filter((h) => !h.isEmpty && r.indexOf(h) < 0), a = r.filter((h) => !h.isEmpty && e.indexOf(h) < 0); + if (s.length != a.length) return !1; - if (!h.length) + if (!s.length) return !0; - let b = v_t(h, f), w = new GZ(h, b, 0).goto(a), O = new GZ(f, b, 0).goto(a); + let o = G$(s, a), l = new Em(s, o, 0).goto(n), u = new Em(a, o, 0).goto(n); for (; ; ) { - if (w.to != O.to || !XBe(w.active, O.active) || w.point && (!O.point || !w.point.eq(O.point))) + if (l.to != u.to || !zA(l.active, u.active) || l.point && (!u.point || !l.point.eq(u.point))) return !1; - if (w.to > l) + if (l.to > i) return !0; - w.next(), O.next(); + l.next(), u.next(); } } - static spans(n, s, a, l, h = -1) { - let f = new GZ(n, null, h).goto(s), b = s, w = f.openStart; + static spans(e, r, n, i, s = -1) { + let a = new Em(e, null, s).goto(r), o = r, l = a.openStart; for (; ; ) { - let O = Math.min(f.to, a); - if (f.point) { - let S = f.activeForPoint(f.to), E = f.pointFrom < s ? S.length + 1 : Math.min(S.length, w); - l.point(b, O, f.point, S, E, f.pointRank), w = Math.min(f.openEnd(O), S.length); + let u = Math.min(a.to, n); + if (a.point) { + let h = a.activeForPoint(a.to), f = a.pointFrom < r ? h.length + 1 : Math.min(h.length, l); + i.point(o, u, a.point, h, f, a.pointRank), l = Math.min(a.openEnd(u), h.length); } else - O > b && (l.span(b, O, f.active, w), w = f.openEnd(O)); - if (f.to > a) - return w + (f.point && f.to > a ? 1 : 0); - b = f.to, f.next(); - } - } - static of(n, s = !1) { - let a = new G0(); - for (let l of n instanceof lK ? [n] : s ? Lkn(n) : n) - a.add(l.from, l.to, l.value); - return a.finish(); - } -} -cl.empty = /* @__PURE__ */ new cl([], [], null, -1); -function Lkn(r) { - if (r.length > 1) - for (let n = r[0], s = 1; s < r.length; s++) { - let a = r[s]; - if (ZBe(n, a) > 0) - return r.slice().sort(ZBe); - n = a; + u > o && (i.span(o, u, a.active, l), l = a.openEnd(u)); + if (a.to > n) + return l + (a.point && a.to > n ? 1 : 0); + o = a.to, a.next(); } - return r; + } + static of(e, r = !1) { + let n = new Hi(); + for (let i of e instanceof yy ? [e] : r ? lbe(e) : e) + n.add(i.from, i.to, i.value); + return n.finish(); + } } -cl.empty.nextLayer = cl.empty; -class G0 { - finishChunk(n) { - this.chunks.push(new oze(this.from, this.to, this.value, this.maxPoint)), this.chunkPos.push(this.chunkStart), this.chunkStart = -1, this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint), this.maxPoint = -1, n && (this.from = [], this.to = [], this.value = []); +Er.empty = /* @__PURE__ */ new Er([], [], null, -1); +function lbe(t) { + if (t.length > 1) + for (let e = t[0], r = 1; r < t.length; r++) { + let n = t[r]; + if (FA(e, n) > 0) + return t.slice().sort(FA); + e = n; + } + return t; +} +Er.empty.nextLayer = Er.empty; +class Hi { + finishChunk(e) { + this.chunks.push(new MR(this.from, this.to, this.value, this.maxPoint)), this.chunkPos.push(this.chunkStart), this.chunkStart = -1, this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint), this.maxPoint = -1, e && (this.from = [], this.to = [], this.value = []); } constructor() { this.chunks = [], this.chunkPos = [], this.chunkStart = -1, this.last = null, this.lastFrom = -1e9, this.lastTo = -1e9, this.from = [], this.to = [], this.value = [], this.maxPoint = -1, this.setMaxPoint = -1, this.nextLayer = null; } - add(n, s, a) { - this.addInner(n, s, a) || (this.nextLayer || (this.nextLayer = new G0())).add(n, s, a); + add(e, r, n) { + this.addInner(e, r, n) || (this.nextLayer || (this.nextLayer = new Hi())).add(e, r, n); } - addInner(n, s, a) { - let l = n - this.lastTo || a.startSide - this.last.endSide; - if (l <= 0 && (n - this.lastFrom || a.startSide - this.last.startSide) < 0) + addInner(e, r, n) { + let i = e - this.lastTo || n.startSide - this.last.endSide; + if (i <= 0 && (e - this.lastFrom || n.startSide - this.last.startSide) < 0) throw new Error("Ranges must be added sorted by `from` position and `startSide`"); - return l < 0 ? !1 : (this.from.length == 250 && this.finishChunk(!0), this.chunkStart < 0 && (this.chunkStart = n), this.from.push(n - this.chunkStart), this.to.push(s - this.chunkStart), this.last = a, this.lastFrom = n, this.lastTo = s, this.value.push(a), a.point && (this.maxPoint = Math.max(this.maxPoint, s - n)), !0); + return i < 0 ? !1 : (this.from.length == 250 && this.finishChunk(!0), this.chunkStart < 0 && (this.chunkStart = e), this.from.push(e - this.chunkStart), this.to.push(r - this.chunkStart), this.last = n, this.lastFrom = e, this.lastTo = r, this.value.push(n), n.point && (this.maxPoint = Math.max(this.maxPoint, r - e)), !0); } - addChunk(n, s) { - if ((n - this.lastTo || s.value[0].startSide - this.last.endSide) < 0) + addChunk(e, r) { + if ((e - this.lastTo || r.value[0].startSide - this.last.endSide) < 0) return !1; - this.from.length && this.finishChunk(!0), this.setMaxPoint = Math.max(this.setMaxPoint, s.maxPoint), this.chunks.push(s), this.chunkPos.push(n); - let a = s.value.length - 1; - return this.last = s.value[a], this.lastFrom = s.from[a] + n, this.lastTo = s.to[a] + n, !0; + this.from.length && this.finishChunk(!0), this.setMaxPoint = Math.max(this.setMaxPoint, r.maxPoint), this.chunks.push(r), this.chunkPos.push(e); + let n = r.value.length - 1; + return this.last = r.value[n], this.lastFrom = r.from[n] + e, this.lastTo = r.to[n] + e, !0; } finish() { - return this.finishInner(cl.empty); + return this.finishInner(Er.empty); } - finishInner(n) { + finishInner(e) { if (this.from.length && this.finishChunk(!1), this.chunks.length == 0) - return n; - let s = cl.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(n) : n, this.setMaxPoint); - return this.from = null, s; + return e; + let r = Er.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(e) : e, this.setMaxPoint); + return this.from = null, r; } } -function v_t(r, n, s) { - let a = /* @__PURE__ */ new Map(); - for (let h of r) - for (let f = 0; f < h.chunk.length; f++) - h.chunk[f].maxPoint <= 0 && a.set(h.chunk[f], h.chunkPos[f]); - let l = /* @__PURE__ */ new Set(); - for (let h of n) - for (let f = 0; f < h.chunk.length; f++) { - let b = a.get(h.chunk[f]); - b != null && (s ? s.mapPos(b) : b) == h.chunkPos[f] && !(s != null && s.touchesRange(b, b + h.chunk[f].length)) && l.add(h.chunk[f]); +function G$(t, e, r) { + let n = /* @__PURE__ */ new Map(); + for (let s of t) + for (let a = 0; a < s.chunk.length; a++) + s.chunk[a].maxPoint <= 0 && n.set(s.chunk[a], s.chunkPos[a]); + let i = /* @__PURE__ */ new Set(); + for (let s of e) + for (let a = 0; a < s.chunk.length; a++) { + let o = n.get(s.chunk[a]); + o != null && (r ? r.mapPos(o) : o) == s.chunkPos[a] && !(r != null && r.touchesRange(o, o + s.chunk[a].length)) && i.add(s.chunk[a]); } - return l; + return i; } -class YDt { - constructor(n, s, a, l = 0) { - this.layer = n, this.skip = s, this.minPoint = a, this.rank = l; +class aj { + constructor(e, r, n, i = 0) { + this.layer = e, this.skip = r, this.minPoint = n, this.rank = i; } get startSide() { return this.value ? this.value.startSide : 0; @@ -3734,24 +3743,24 @@ class YDt { get endSide() { return this.value ? this.value.endSide : 0; } - goto(n, s = -1e9) { - return this.chunkIndex = this.rangeIndex = 0, this.gotoInner(n, s, !1), this; + goto(e, r = -1e9) { + return this.chunkIndex = this.rangeIndex = 0, this.gotoInner(e, r, !1), this; } - gotoInner(n, s, a) { + gotoInner(e, r, n) { for (; this.chunkIndex < this.layer.chunk.length; ) { - let l = this.layer.chunk[this.chunkIndex]; - if (!(this.skip && this.skip.has(l) || this.layer.chunkEnd(this.chunkIndex) < n || l.maxPoint < this.minPoint)) + let i = this.layer.chunk[this.chunkIndex]; + if (!(this.skip && this.skip.has(i) || this.layer.chunkEnd(this.chunkIndex) < e || i.maxPoint < this.minPoint)) break; - this.chunkIndex++, a = !1; + this.chunkIndex++, n = !1; } if (this.chunkIndex < this.layer.chunk.length) { - let l = this.layer.chunk[this.chunkIndex].findIndex(n - this.layer.chunkPos[this.chunkIndex], s, !0); - (!a || this.rangeIndex < l) && this.setRangeIndex(l); + let i = this.layer.chunk[this.chunkIndex].findIndex(e - this.layer.chunkPos[this.chunkIndex], r, !0); + (!n || this.rangeIndex < i) && this.setRangeIndex(i); } this.next(); } - forward(n, s) { - (this.to - n || this.endSide - s) < 0 && this.gotoInner(n, s, !0); + forward(e, r) { + (this.to - e || this.endSide - r) < 0 && this.gotoInner(e, r, !0); } next() { for (; ; ) @@ -3759,120 +3768,120 @@ class YDt { this.from = this.to = 1e9, this.value = null; break; } else { - let n = this.layer.chunkPos[this.chunkIndex], s = this.layer.chunk[this.chunkIndex], a = n + s.from[this.rangeIndex]; - if (this.from = a, this.to = n + s.to[this.rangeIndex], this.value = s.value[this.rangeIndex], this.setRangeIndex(this.rangeIndex + 1), this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) + let e = this.layer.chunkPos[this.chunkIndex], r = this.layer.chunk[this.chunkIndex], n = e + r.from[this.rangeIndex]; + if (this.from = n, this.to = e + r.to[this.rangeIndex], this.value = r.value[this.rangeIndex], this.setRangeIndex(this.rangeIndex + 1), this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) break; } } - setRangeIndex(n) { - if (n == this.layer.chunk[this.chunkIndex].value.length) { + setRangeIndex(e) { + if (e == this.layer.chunk[this.chunkIndex].value.length) { if (this.chunkIndex++, this.skip) for (; this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]); ) this.chunkIndex++; this.rangeIndex = 0; } else - this.rangeIndex = n; + this.rangeIndex = e; } nextChunk() { this.chunkIndex++, this.rangeIndex = 0, this.next(); } - compare(n) { - return this.from - n.from || this.startSide - n.startSide || this.rank - n.rank || this.to - n.to || this.endSide - n.endSide; + compare(e) { + return this.from - e.from || this.startSide - e.startSide || this.rank - e.rank || this.to - e.to || this.endSide - e.endSide; } } -class uK { - constructor(n) { - this.heap = n; +class by { + constructor(e) { + this.heap = e; } - static from(n, s = null, a = -1) { - let l = []; - for (let h = 0; h < n.length; h++) - for (let f = n[h]; !f.isEmpty; f = f.nextLayer) - f.maxPoint >= a && l.push(new YDt(f, s, a, h)); - return l.length == 1 ? l[0] : new uK(l); + static from(e, r = null, n = -1) { + let i = []; + for (let s = 0; s < e.length; s++) + for (let a = e[s]; !a.isEmpty; a = a.nextLayer) + a.maxPoint >= n && i.push(new aj(a, r, n, s)); + return i.length == 1 ? i[0] : new by(i); } get startSide() { return this.value ? this.value.startSide : 0; } - goto(n, s = -1e9) { - for (let a of this.heap) - a.goto(n, s); - for (let a = this.heap.length >> 1; a >= 0; a--) - pRe(this.heap, a); + goto(e, r = -1e9) { + for (let n of this.heap) + n.goto(e, r); + for (let n = this.heap.length >> 1; n >= 0; n--) + cE(this.heap, n); return this.next(), this; } - forward(n, s) { - for (let a of this.heap) - a.forward(n, s); - for (let a = this.heap.length >> 1; a >= 0; a--) - pRe(this.heap, a); - (this.to - n || this.value.endSide - s) < 0 && this.next(); + forward(e, r) { + for (let n of this.heap) + n.forward(e, r); + for (let n = this.heap.length >> 1; n >= 0; n--) + cE(this.heap, n); + (this.to - e || this.value.endSide - r) < 0 && this.next(); } next() { if (this.heap.length == 0) this.from = this.to = 1e9, this.value = null, this.rank = -1; else { - let n = this.heap[0]; - this.from = n.from, this.to = n.to, this.value = n.value, this.rank = n.rank, n.value && n.next(), pRe(this.heap, 0); + let e = this.heap[0]; + this.from = e.from, this.to = e.to, this.value = e.value, this.rank = e.rank, e.value && e.next(), cE(this.heap, 0); } } } -function pRe(r, n) { - for (let s = r[n]; ; ) { - let a = (n << 1) + 1; - if (a >= r.length) +function cE(t, e) { + for (let r = t[e]; ; ) { + let n = (e << 1) + 1; + if (n >= t.length) break; - let l = r[a]; - if (a + 1 < r.length && l.compare(r[a + 1]) >= 0 && (l = r[a + 1], a++), s.compare(l) < 0) + let i = t[n]; + if (n + 1 < t.length && i.compare(t[n + 1]) >= 0 && (i = t[n + 1], n++), r.compare(i) < 0) break; - r[a] = s, r[n] = l, n = a; + t[n] = r, t[e] = i, e = n; } } -class GZ { - constructor(n, s, a) { - this.minPoint = a, this.active = [], this.activeTo = [], this.activeRank = [], this.minActive = -1, this.point = null, this.pointFrom = 0, this.pointRank = 0, this.to = -1e9, this.endSide = 0, this.openStart = -1, this.cursor = uK.from(n, s, a); +class Em { + constructor(e, r, n) { + this.minPoint = n, this.active = [], this.activeTo = [], this.activeRank = [], this.minActive = -1, this.point = null, this.pointFrom = 0, this.pointRank = 0, this.to = -1e9, this.endSide = 0, this.openStart = -1, this.cursor = by.from(e, r, n); } - goto(n, s = -1e9) { - return this.cursor.goto(n, s), this.active.length = this.activeTo.length = this.activeRank.length = 0, this.minActive = -1, this.to = n, this.endSide = s, this.openStart = -1, this.next(), this; + goto(e, r = -1e9) { + return this.cursor.goto(e, r), this.active.length = this.activeTo.length = this.activeRank.length = 0, this.minActive = -1, this.to = e, this.endSide = r, this.openStart = -1, this.next(), this; } - forward(n, s) { - for (; this.minActive > -1 && (this.activeTo[this.minActive] - n || this.active[this.minActive].endSide - s) < 0; ) + forward(e, r) { + for (; this.minActive > -1 && (this.activeTo[this.minActive] - e || this.active[this.minActive].endSide - r) < 0; ) this.removeActive(this.minActive); - this.cursor.forward(n, s); + this.cursor.forward(e, r); } - removeActive(n) { - Ige(this.active, n), Ige(this.activeTo, n), Ige(this.activeRank, n), this.minActive = y_t(this.active, this.activeTo); + removeActive(e) { + lw(this.active, e), lw(this.activeTo, e), lw(this.activeRank, e), this.minActive = X$(this.active, this.activeTo); } - addActive(n) { - let s = 0, { value: a, to: l, rank: h } = this.cursor; - for (; s < this.activeRank.length && this.activeRank[s] <= h; ) - s++; - Nge(this.active, s, a), Nge(this.activeTo, s, l), Nge(this.activeRank, s, h), n && Nge(n, s, this.cursor.from), this.minActive = y_t(this.active, this.activeTo); + addActive(e) { + let r = 0, { value: n, to: i, rank: s } = this.cursor; + for (; r < this.activeRank.length && this.activeRank[r] <= s; ) + r++; + cw(this.active, r, n), cw(this.activeTo, r, i), cw(this.activeRank, r, s), e && cw(e, r, this.cursor.from), this.minActive = X$(this.active, this.activeTo); } next() { - let n = this.to, s = this.point; + let e = this.to, r = this.point; this.point = null; - let a = this.openStart < 0 ? [] : null; + let n = this.openStart < 0 ? [] : null; for (; ; ) { - let l = this.minActive; - if (l > -1 && (this.activeTo[l] - this.cursor.from || this.active[l].endSide - this.cursor.startSide) < 0) { - if (this.activeTo[l] > n) { - this.to = this.activeTo[l], this.endSide = this.active[l].endSide; + let i = this.minActive; + if (i > -1 && (this.activeTo[i] - this.cursor.from || this.active[i].endSide - this.cursor.startSide) < 0) { + if (this.activeTo[i] > e) { + this.to = this.activeTo[i], this.endSide = this.active[i].endSide; break; } - this.removeActive(l), a && Ige(a, l); + this.removeActive(i), n && lw(n, i); } else if (this.cursor.value) - if (this.cursor.from > n) { + if (this.cursor.from > e) { this.to = this.cursor.from, this.endSide = this.cursor.startSide; break; } else { - let h = this.cursor.value; - if (!h.point) - this.addActive(a), this.cursor.next(); - else if (s && this.cursor.to == this.to && this.cursor.from < this.cursor.to) + let s = this.cursor.value; + if (!s.point) + this.addActive(n), this.cursor.next(); + else if (r && this.cursor.to == this.to && this.cursor.from < this.cursor.to) this.cursor.next(); else { - this.point = h, this.pointFrom = this.cursor.from, this.pointRank = this.cursor.rank, this.to = this.cursor.to, this.endSide = h.endSide, this.cursor.next(), this.forward(this.to, this.endSide); + this.point = s, this.pointFrom = this.cursor.from, this.pointRank = this.cursor.rank, this.to = this.cursor.to, this.endSide = s.endSide, this.cursor.next(), this.forward(this.to, this.endSide); break; } } @@ -3881,165 +3890,165 @@ class GZ { break; } } - if (a) { + if (n) { this.openStart = 0; - for (let l = a.length - 1; l >= 0 && a[l] < n; l--) + for (let i = n.length - 1; i >= 0 && n[i] < e; i--) this.openStart++; } } - activeForPoint(n) { + activeForPoint(e) { if (!this.active.length) return this.active; - let s = []; - for (let a = this.active.length - 1; a >= 0 && !(this.activeRank[a] < this.pointRank); a--) - (this.activeTo[a] > n || this.activeTo[a] == n && this.active[a].endSide >= this.point.endSide) && s.push(this.active[a]); - return s.reverse(); - } - openEnd(n) { - let s = 0; - for (let a = this.activeTo.length - 1; a >= 0 && this.activeTo[a] > n; a--) - s++; - return s; + let r = []; + for (let n = this.active.length - 1; n >= 0 && !(this.activeRank[n] < this.pointRank); n--) + (this.activeTo[n] > e || this.activeTo[n] == e && this.active[n].endSide >= this.point.endSide) && r.push(this.active[n]); + return r.reverse(); + } + openEnd(e) { + let r = 0; + for (let n = this.activeTo.length - 1; n >= 0 && this.activeTo[n] > e; n--) + r++; + return r; } } -function w_t(r, n, s, a, l, h) { - r.goto(n), s.goto(a); - let f = a + l, b = a, w = a - n; +function H$(t, e, r, n, i, s) { + t.goto(e), r.goto(n); + let a = n + i, o = n, l = n - e; for (; ; ) { - let O = r.to + w - s.to || r.endSide - s.endSide, S = O < 0 ? r.to + w : s.to, E = Math.min(S, f); - if (r.point || s.point ? r.point && s.point && (r.point == s.point || r.point.eq(s.point)) && XBe(r.activeForPoint(r.to), s.activeForPoint(s.to)) || h.comparePoint(b, E, r.point, s.point) : E > b && !XBe(r.active, s.active) && h.compareRange(b, E, r.active, s.active), S > f) + let u = t.to + l - r.to || t.endSide - r.endSide, h = u < 0 ? t.to + l : r.to, f = Math.min(h, a); + if (t.point || r.point ? t.point && r.point && (t.point == r.point || t.point.eq(r.point)) && zA(t.activeForPoint(t.to), r.activeForPoint(r.to)) || s.comparePoint(o, f, t.point, r.point) : f > o && !zA(t.active, r.active) && s.compareRange(o, f, t.active, r.active), h > a) break; - b = S, O <= 0 && r.next(), O >= 0 && s.next(); + o = h, u <= 0 && t.next(), u >= 0 && r.next(); } } -function XBe(r, n) { - if (r.length != n.length) +function zA(t, e) { + if (t.length != e.length) return !1; - for (let s = 0; s < r.length; s++) - if (r[s] != n[s] && !r[s].eq(n[s])) + for (let r = 0; r < t.length; r++) + if (t[r] != e[r] && !t[r].eq(e[r])) return !1; return !0; } -function Ige(r, n) { - for (let s = n, a = r.length - 1; s < a; s++) - r[s] = r[s + 1]; - r.pop(); +function lw(t, e) { + for (let r = e, n = t.length - 1; r < n; r++) + t[r] = t[r + 1]; + t.pop(); } -function Nge(r, n, s) { - for (let a = r.length - 1; a >= n; a--) - r[a + 1] = r[a]; - r[n] = s; +function cw(t, e, r) { + for (let n = t.length - 1; n >= e; n--) + t[n + 1] = t[n]; + t[e] = r; } -function y_t(r, n) { - let s = -1, a = 1e9; - for (let l = 0; l < n.length; l++) - (n[l] - a || r[l].endSide - r[s].endSide) < 0 && (s = l, a = n[l]); - return s; +function X$(t, e) { + let r = -1, n = 1e9; + for (let i = 0; i < e.length; i++) + (e[i] - n || t[i].endSide - t[r].endSide) < 0 && (r = i, n = e[i]); + return r; } -function gk(r, n, s = r.length) { - let a = 0; - for (let l = 0; l < s; ) - r.charCodeAt(l) == 9 ? (a += n - a % n, l++) : (a++, l = Np(r, l)); - return a; +function Ml(t, e, r = t.length) { + let n = 0; + for (let i = 0; i < r; ) + t.charCodeAt(i) == 9 ? (n += e - n % e, i++) : (n++, i = ls(t, i)); + return n; } -function KBe(r, n, s, a) { - for (let l = 0, h = 0; ; ) { - if (h >= n) - return l; - if (l == r.length) +function VA(t, e, r, n) { + for (let i = 0, s = 0; ; ) { + if (s >= e) + return i; + if (i == t.length) break; - h += r.charCodeAt(l) == 9 ? s - h % s : 1, l = Np(r, l); + s += t.charCodeAt(i) == 9 ? r - s % r : 1, i = ls(t, i); } - return a === !0 ? -1 : r.length; + return n === !0 ? -1 : t.length; } -const JBe = "\u037C", O_t = typeof Symbol > "u" ? "__" + JBe : Symbol.for(JBe), eFe = typeof Symbol > "u" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet"), k_t = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : {}; -class s_ { - constructor(n, s) { +const UA = "\u037C", Z$ = typeof Symbol > "u" ? "__" + UA : Symbol.for(UA), qA = typeof Symbol > "u" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet"), j$ = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : {}; +class Iu { + constructor(e, r) { this.rules = []; - let { finish: a } = s || {}; - function l(f) { - return /^@/.test(f) ? [f] : f.split(/,\s*/); - } - function h(f, b, w, O) { - let S = [], E = /^@(\w+)\b/.exec(f[0]), D = E && E[1] == "keyframes"; - if (E && b == null) - return w.push(f[0] + ";"); - for (let M in b) { - let B = b[M]; - if (/&/.test(M)) - h( - M.split(/,\s*/).map((z) => f.map((W) => z.replace(/&/, W))).reduce((z, W) => z.concat(W)), - B, - w + let { finish: n } = r || {}; + function i(a) { + return /^@/.test(a) ? [a] : a.split(/,\s*/); + } + function s(a, o, l, u) { + let h = [], f = /^@(\w+)\b/.exec(a[0]), d = f && f[1] == "keyframes"; + if (f && o == null) + return l.push(a[0] + ";"); + for (let p in o) { + let g = o[p]; + if (/&/.test(p)) + s( + p.split(/,\s*/).map((m) => a.map((v) => m.replace(/&/, v))).reduce((m, v) => m.concat(v)), + g, + l ); - else if (B && typeof B == "object") { - if (!E) - throw new RangeError("The value of a property (" + M + ") should be a primitive value."); - h(l(M), B, S, D); + else if (g && typeof g == "object") { + if (!f) + throw new RangeError("The value of a property (" + p + ") should be a primitive value."); + s(i(p), g, h, d); } else - B != null && S.push(M.replace(/_.*/, "").replace(/[A-Z]/g, (z) => "-" + z.toLowerCase()) + ": " + B + ";"); + g != null && h.push(p.replace(/_.*/, "").replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()) + ": " + g + ";"); } - (S.length || D) && w.push((a && !E && !O ? f.map(a) : f).join(", ") + " {" + S.join(" ") + "}"); + (h.length || d) && l.push((n && !f && !u ? a.map(n) : a).join(", ") + " {" + h.join(" ") + "}"); } - for (let f in n) - h(l(f), n[f], this.rules); + for (let a in e) + s(i(a), e[a], this.rules); } getRules() { return this.rules.join(` `); } static newName() { - let n = k_t[O_t] || 1; - return k_t[O_t] = n + 1, JBe + n.toString(36); + let e = j$[Z$] || 1; + return j$[Z$] = e + 1, UA + e.toString(36); } - static mount(n, s, a) { - let l = n[eFe], h = a && a.nonce; - l ? h && l.setNonce(h) : l = new Ikn(n, h), l.mount(Array.isArray(s) ? s : [s]); + static mount(e, r, n) { + let i = e[qA], s = n && n.nonce; + i ? s && i.setNonce(s) : i = new cbe(e, s), i.mount(Array.isArray(r) ? r : [r]); } } -let x_t = /* @__PURE__ */ new Map(); -class Ikn { - constructor(n, s) { - let a = n.ownerDocument || n, l = a.defaultView; - if (!n.head && n.adoptedStyleSheets && l.CSSStyleSheet) { - let h = x_t.get(a); - if (h) - return n.adoptedStyleSheets = [h.sheet, ...n.adoptedStyleSheets], n[eFe] = h; - this.sheet = new l.CSSStyleSheet(), n.adoptedStyleSheets = [this.sheet, ...n.adoptedStyleSheets], x_t.set(a, this); +let K$ = /* @__PURE__ */ new Map(); +class cbe { + constructor(e, r) { + let n = e.ownerDocument || e, i = n.defaultView; + if (!e.head && e.adoptedStyleSheets && i.CSSStyleSheet) { + let s = K$.get(n); + if (s) + return e.adoptedStyleSheets = [s.sheet, ...e.adoptedStyleSheets], e[qA] = s; + this.sheet = new i.CSSStyleSheet(), e.adoptedStyleSheets = [this.sheet, ...e.adoptedStyleSheets], K$.set(n, this); } else { - this.styleTag = a.createElement("style"), s && this.styleTag.setAttribute("nonce", s); - let h = n.head || n; - h.insertBefore(this.styleTag, h.firstChild); - } - this.modules = [], n[eFe] = this; - } - mount(n) { - let s = this.sheet, a = 0, l = 0; - for (let h = 0; h < n.length; h++) { - let f = n[h], b = this.modules.indexOf(f); - if (b < l && b > -1 && (this.modules.splice(b, 1), l--, b = -1), b == -1) { - if (this.modules.splice(l++, 0, f), s) - for (let w = 0; w < f.rules.length; w++) - s.insertRule(f.rules[w], a++); + this.styleTag = n.createElement("style"), r && this.styleTag.setAttribute("nonce", r); + let s = e.head || e; + s.insertBefore(this.styleTag, s.firstChild); + } + this.modules = [], e[qA] = this; + } + mount(e) { + let r = this.sheet, n = 0, i = 0; + for (let s = 0; s < e.length; s++) { + let a = e[s], o = this.modules.indexOf(a); + if (o < i && o > -1 && (this.modules.splice(o, 1), i--, o = -1), o == -1) { + if (this.modules.splice(i++, 0, a), r) + for (let l = 0; l < a.rules.length; l++) + r.insertRule(a.rules[l], n++); } else { - for (; l < b; ) - a += this.modules[l++].rules.length; - a += f.rules.length, l++; + for (; i < o; ) + n += this.modules[i++].rules.length; + n += a.rules.length, i++; } } - if (!s) { - let h = ""; - for (let f = 0; f < this.modules.length; f++) - h += this.modules[f].getRules() + ` + if (!r) { + let s = ""; + for (let a = 0; a < this.modules.length; a++) + s += this.modules[a].getRules() + ` `; - this.styleTag.textContent = h; + this.styleTag.textContent = s; } } - setNonce(n) { - this.styleTag && this.styleTag.getAttribute("nonce") != n && this.styleTag.setAttribute("nonce", n); + setNonce(e) { + this.styleTag && this.styleTag.getAttribute("nonce") != e && this.styleTag.setAttribute("nonce", e); } } -var d8 = { +var sf = { 8: "Backspace", 9: "Tab", 10: "Enter", @@ -4092,7 +4101,7 @@ var d8 = { 220: "\\", 221: "]", 222: "'" -}, hK = { +}, xy = { 48: ")", 49: "!", 50: "@", @@ -4117,249 +4126,249 @@ var d8 = { 220: "|", 221: "}", 222: '"' -}, Nkn = typeof navigator < "u" && /Mac/.test(navigator.platform), Rkn = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent); -for (var Ip = 0; Ip < 10; Ip++) - d8[48 + Ip] = d8[96 + Ip] = String(Ip); -for (var Ip = 1; Ip <= 24; Ip++) - d8[Ip + 111] = "F" + Ip; -for (var Ip = 65; Ip <= 90; Ip++) - d8[Ip] = String.fromCharCode(Ip + 32), hK[Ip] = String.fromCharCode(Ip); -for (var gRe in d8) - hK.hasOwnProperty(gRe) || (hK[gRe] = d8[gRe]); -function $kn(r) { - var n = Nkn && r.metaKey && r.shiftKey && !r.ctrlKey && !r.altKey || Rkn && r.shiftKey && r.key && r.key.length == 1 || r.key == "Unidentified", s = !n && r.key || (r.shiftKey ? hK : d8)[r.keyCode] || r.key || "Unidentified"; - return s == "Esc" && (s = "Escape"), s == "Del" && (s = "Delete"), s == "Left" && (s = "ArrowLeft"), s == "Up" && (s = "ArrowUp"), s == "Right" && (s = "ArrowRight"), s == "Down" && (s = "ArrowDown"), s; -} -function Qbe(r) { - let n; - return r.nodeType == 11 ? n = r.getSelection ? r : r.ownerDocument : n = r, n.getSelection(); -} -function tFe(r, n) { - return n ? r == n || r.contains(n.nodeType != 1 ? n.parentNode : n) : !1; -} -function Bkn(r) { - let n = r.activeElement; - for (; n && n.shadowRoot; ) - n = n.shadowRoot.activeElement; - return n; -} -function Wme(r, n) { - if (!n.anchorNode) +}, ube = typeof navigator < "u" && /Mac/.test(navigator.platform), hbe = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent); +for (var as = 0; as < 10; as++) + sf[48 + as] = sf[96 + as] = String(as); +for (var as = 1; as <= 24; as++) + sf[as + 111] = "F" + as; +for (var as = 65; as <= 90; as++) + sf[as] = String.fromCharCode(as + 32), xy[as] = String.fromCharCode(as); +for (var uE in sf) + xy.hasOwnProperty(uE) || (xy[uE] = sf[uE]); +function fbe(t) { + var e = ube && t.metaKey && t.shiftKey && !t.ctrlKey && !t.altKey || hbe && t.shiftKey && t.key && t.key.length == 1 || t.key == "Unidentified", r = !e && t.key || (t.shiftKey ? xy : sf)[t.keyCode] || t.key || "Unidentified"; + return r == "Esc" && (r = "Escape"), r == "Del" && (r = "Delete"), r == "Left" && (r = "ArrowLeft"), r == "Up" && (r = "ArrowUp"), r == "Right" && (r = "ArrowRight"), r == "Down" && (r = "ArrowDown"), r; +} +function v5(t) { + let e; + return t.nodeType == 11 ? e = t.getSelection ? t : t.ownerDocument : e = t, e.getSelection(); +} +function QA(t, e) { + return e ? t == e || t.contains(e.nodeType != 1 ? e.parentNode : e) : !1; +} +function dbe(t) { + let e = t.activeElement; + for (; e && e.shadowRoot; ) + e = e.shadowRoot.activeElement; + return e; +} +function n4(t, e) { + if (!e.anchorNode) return !1; try { - return tFe(r, n.anchorNode); + return QA(t, e.anchorNode); } catch { return !1; } } -function fK(r) { - return r.nodeType == 3 ? sP(r, 0, r.nodeValue.length).getClientRects() : r.nodeType == 1 ? r.getClientRects() : []; +function wy(t) { + return t.nodeType == 3 ? Zd(t, 0, t.nodeValue.length).getClientRects() : t.nodeType == 1 ? t.getClientRects() : []; } -function zbe(r, n, s, a) { - return s ? S_t(r, n, s, a, -1) || S_t(r, n, s, a, 1) : !1; +function y5(t, e, r, n) { + return r ? J$(t, e, r, n, -1) || J$(t, e, r, n, 1) : !1; } -function dK(r) { - for (var n = 0; ; n++) - if (r = r.previousSibling, !r) - return n; +function Oy(t) { + for (var e = 0; ; e++) + if (t = t.previousSibling, !t) + return e; } -function S_t(r, n, s, a, l) { +function J$(t, e, r, n, i) { for (; ; ) { - if (r == s && n == a) + if (t == r && e == n) return !0; - if (n == (l < 0 ? 0 : o_(r))) { - if (r.nodeName == "DIV") + if (e == (i < 0 ? 0 : Pu(t))) { + if (t.nodeName == "DIV") return !1; - let h = r.parentNode; - if (!h || h.nodeType != 1) + let s = t.parentNode; + if (!s || s.nodeType != 1) return !1; - n = dK(r) + (l < 0 ? 0 : 1), r = h; - } else if (r.nodeType == 1) { - if (r = r.childNodes[n + (l < 0 ? -1 : 0)], r.nodeType == 1 && r.contentEditable == "false") + e = Oy(t) + (i < 0 ? 0 : 1), t = s; + } else if (t.nodeType == 1) { + if (t = t.childNodes[e + (i < 0 ? -1 : 0)], t.nodeType == 1 && t.contentEditable == "false") return !1; - n = l < 0 ? o_(r) : 0; + e = i < 0 ? Pu(t) : 0; } else return !1; } } -function o_(r) { - return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length; +function Pu(t) { + return t.nodeType == 3 ? t.nodeValue.length : t.childNodes.length; } -function aze(r, n) { - let s = n ? r.left : r.right; - return { left: s, right: s, top: r.top, bottom: r.bottom }; +function DR(t, e) { + let r = e ? t.left : t.right; + return { left: r, right: r, top: t.top, bottom: t.bottom }; } -function Fkn(r) { +function pbe(t) { return { left: 0, - right: r.innerWidth, + right: t.innerWidth, top: 0, - bottom: r.innerHeight + bottom: t.innerHeight }; } -function HDt(r, n) { - let s = n.width / r.offsetWidth, a = n.height / r.offsetHeight; - return (s > 0.995 && s < 1.005 || !isFinite(s) || Math.abs(n.width - r.offsetWidth) < 1) && (s = 1), (a > 0.995 && a < 1.005 || !isFinite(a) || Math.abs(n.height - r.offsetHeight) < 1) && (a = 1), { scaleX: s, scaleY: a }; -} -function jkn(r, n, s, a, l, h, f, b) { - let w = r.ownerDocument, O = w.defaultView || window; - for (let S = r, E = !1; S && !E; ) - if (S.nodeType == 1) { - let D, M = S == w.body, B = 1, z = 1; - if (M) - D = Fkn(O); +function oj(t, e) { + let r = e.width / t.offsetWidth, n = e.height / t.offsetHeight; + return (r > 0.995 && r < 1.005 || !isFinite(r) || Math.abs(e.width - t.offsetWidth) < 1) && (r = 1), (n > 0.995 && n < 1.005 || !isFinite(n) || Math.abs(e.height - t.offsetHeight) < 1) && (n = 1), { scaleX: r, scaleY: n }; +} +function gbe(t, e, r, n, i, s, a, o) { + let l = t.ownerDocument, u = l.defaultView || window; + for (let h = t, f = !1; h && !f; ) + if (h.nodeType == 1) { + let d, p = h == l.body, g = 1, m = 1; + if (p) + d = pbe(u); else { - if (/^(fixed|sticky)$/.test(getComputedStyle(S).position) && (E = !0), S.scrollHeight <= S.clientHeight && S.scrollWidth <= S.clientWidth) { - S = S.assignedSlot || S.parentNode; + if (/^(fixed|sticky)$/.test(getComputedStyle(h).position) && (f = !0), h.scrollHeight <= h.clientHeight && h.scrollWidth <= h.clientWidth) { + h = h.assignedSlot || h.parentNode; continue; } - let G = S.getBoundingClientRect(); - ({ scaleX: B, scaleY: z } = HDt(S, G)), D = { - left: G.left, - right: G.left + S.clientWidth * B, - top: G.top, - bottom: G.top + S.clientHeight * z + let b = h.getBoundingClientRect(); + ({ scaleX: g, scaleY: m } = oj(h, b)), d = { + left: b.left, + right: b.left + h.clientWidth * g, + top: b.top, + bottom: b.top + h.clientHeight * m }; } - let W = 0, H = 0; - if (l == "nearest") - n.top < D.top ? (H = -(D.top - n.top + f), s > 0 && n.bottom > D.bottom + H && (H = n.bottom - D.bottom + H + f)) : n.bottom > D.bottom && (H = n.bottom - D.bottom + f, s < 0 && n.top - H < D.top && (H = -(D.top + H - n.top + f))); + let v = 0, y = 0; + if (i == "nearest") + e.top < d.top ? (y = -(d.top - e.top + a), r > 0 && e.bottom > d.bottom + y && (y = e.bottom - d.bottom + y + a)) : e.bottom > d.bottom && (y = e.bottom - d.bottom + a, r < 0 && e.top - y < d.top && (y = -(d.top + y - e.top + a))); else { - let G = n.bottom - n.top, ee = D.bottom - D.top; - H = (l == "center" && G <= ee ? n.top + G / 2 - ee / 2 : l == "start" || l == "center" && s < 0 ? n.top - f : n.bottom - ee + f) - D.top; + let b = e.bottom - e.top, w = d.bottom - d.top; + y = (i == "center" && b <= w ? e.top + b / 2 - w / 2 : i == "start" || i == "center" && r < 0 ? e.top - a : e.bottom - w + a) - d.top; } - if (a == "nearest" ? n.left < D.left ? (W = -(D.left - n.left + h), s > 0 && n.right > D.right + W && (W = n.right - D.right + W + h)) : n.right > D.right && (W = n.right - D.right + h, s < 0 && n.left < D.left + W && (W = -(D.left + W - n.left + h))) : W = (a == "center" ? n.left + (n.right - n.left) / 2 - (D.right - D.left) / 2 : a == "start" == b ? n.left - h : n.right - (D.right - D.left) + h) - D.left, W || H) - if (M) - O.scrollBy(W, H); + if (n == "nearest" ? e.left < d.left ? (v = -(d.left - e.left + s), r > 0 && e.right > d.right + v && (v = e.right - d.right + v + s)) : e.right > d.right && (v = e.right - d.right + s, r < 0 && e.left < d.left + v && (v = -(d.left + v - e.left + s))) : v = (n == "center" ? e.left + (e.right - e.left) / 2 - (d.right - d.left) / 2 : n == "start" == o ? e.left - s : e.right - (d.right - d.left) + s) - d.left, v || y) + if (p) + u.scrollBy(v, y); else { - let G = 0, ee = 0; - if (H) { - let le = S.scrollTop; - S.scrollTop += H / z, ee = (S.scrollTop - le) * z; - } - if (W) { - let le = S.scrollLeft; - S.scrollLeft += W / B, G = (S.scrollLeft - le) * B; - } - n = { - left: n.left - G, - top: n.top - ee, - right: n.right - G, - bottom: n.bottom - ee - }, G && Math.abs(G - W) < 1 && (a = "nearest"), ee && Math.abs(ee - H) < 1 && (l = "nearest"); - } - if (M) + let b = 0, w = 0; + if (y) { + let O = h.scrollTop; + h.scrollTop += y / m, w = (h.scrollTop - O) * m; + } + if (v) { + let O = h.scrollLeft; + h.scrollLeft += v / g, b = (h.scrollLeft - O) * g; + } + e = { + left: e.left - b, + top: e.top - w, + right: e.right - b, + bottom: e.bottom - w + }, b && Math.abs(b - v) < 1 && (n = "nearest"), w && Math.abs(w - y) < 1 && (i = "nearest"); + } + if (p) break; - S = S.assignedSlot || S.parentNode; - } else if (S.nodeType == 11) - S = S.host; + h = h.assignedSlot || h.parentNode; + } else if (h.nodeType == 11) + h = h.host; else break; } -function Qkn(r) { - let n = r.ownerDocument; - for (let s = r.parentNode; s && s != n.body; ) - if (s.nodeType == 1) { - if (s.scrollHeight > s.clientHeight || s.scrollWidth > s.clientWidth) - return s; - s = s.assignedSlot || s.parentNode; - } else if (s.nodeType == 11) - s = s.host; +function mbe(t) { + let e = t.ownerDocument; + for (let r = t.parentNode; r && r != e.body; ) + if (r.nodeType == 1) { + if (r.scrollHeight > r.clientHeight || r.scrollWidth > r.clientWidth) + return r; + r = r.assignedSlot || r.parentNode; + } else if (r.nodeType == 11) + r = r.host; else break; return null; } -class zkn { +class vbe { constructor() { this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0; } - eq(n) { - return this.anchorNode == n.anchorNode && this.anchorOffset == n.anchorOffset && this.focusNode == n.focusNode && this.focusOffset == n.focusOffset; + eq(e) { + return this.anchorNode == e.anchorNode && this.anchorOffset == e.anchorOffset && this.focusNode == e.focusNode && this.focusOffset == e.focusOffset; } - setRange(n) { - let { anchorNode: s, focusNode: a } = n; - this.set(s, Math.min(n.anchorOffset, s ? o_(s) : 0), a, Math.min(n.focusOffset, a ? o_(a) : 0)); + setRange(e) { + let { anchorNode: r, focusNode: n } = e; + this.set(r, Math.min(e.anchorOffset, r ? Pu(r) : 0), n, Math.min(e.focusOffset, n ? Pu(n) : 0)); } - set(n, s, a, l) { - this.anchorNode = n, this.anchorOffset = s, this.focusNode = a, this.focusOffset = l; + set(e, r, n, i) { + this.anchorNode = e, this.anchorOffset = r, this.focusNode = n, this.focusOffset = i; } } -let iB = null; -function GDt(r) { - if (r.setActive) - return r.setActive(); - if (iB) - return r.focus(iB); - let n = []; - for (let s = r; s && (n.push(s, s.scrollTop, s.scrollLeft), s != s.ownerDocument); s = s.parentNode) +let op = null; +function lj(t) { + if (t.setActive) + return t.setActive(); + if (op) + return t.focus(op); + let e = []; + for (let r = t; r && (e.push(r, r.scrollTop, r.scrollLeft), r != r.ownerDocument); r = r.parentNode) ; - if (r.focus(iB == null ? { + if (t.focus(op == null ? { get preventScroll() { - return iB = { preventScroll: !0 }, !0; + return op = { preventScroll: !0 }, !0; } - } : void 0), !iB) { - iB = !1; - for (let s = 0; s < n.length; ) { - let a = n[s++], l = n[s++], h = n[s++]; - a.scrollTop != l && (a.scrollTop = l), a.scrollLeft != h && (a.scrollLeft = h); + } : void 0), !op) { + op = !1; + for (let r = 0; r < e.length; ) { + let n = e[r++], i = e[r++], s = e[r++]; + n.scrollTop != i && (n.scrollTop = i), n.scrollLeft != s && (n.scrollLeft = s); } } } -let __t; -function sP(r, n, s = n) { - let a = __t || (__t = document.createRange()); - return a.setEnd(r, s), a.setStart(r, n), a; +let eB; +function Zd(t, e, r = e) { + let n = eB || (eB = document.createRange()); + return n.setEnd(t, r), n.setStart(t, e), n; } -function PB(r, n, s) { - let a = { key: n, code: n, keyCode: s, which: s, cancelable: !0 }, l = new KeyboardEvent("keydown", a); - l.synthetic = !0, r.dispatchEvent(l); - let h = new KeyboardEvent("keyup", a); - return h.synthetic = !0, r.dispatchEvent(h), l.defaultPrevented || h.defaultPrevented; +function Wp(t, e, r) { + let n = { key: e, code: e, keyCode: r, which: r, cancelable: !0 }, i = new KeyboardEvent("keydown", n); + i.synthetic = !0, t.dispatchEvent(i); + let s = new KeyboardEvent("keyup", n); + return s.synthetic = !0, t.dispatchEvent(s), i.defaultPrevented || s.defaultPrevented; } -function qkn(r) { - for (; r; ) { - if (r && (r.nodeType == 9 || r.nodeType == 11 && r.host)) - return r; - r = r.assignedSlot || r.parentNode; +function ybe(t) { + for (; t; ) { + if (t && (t.nodeType == 9 || t.nodeType == 11 && t.host)) + return t; + t = t.assignedSlot || t.parentNode; } return null; } -function ZDt(r) { - for (; r.attributes.length; ) - r.removeAttributeNode(r.attributes[0]); +function cj(t) { + for (; t.attributes.length; ) + t.removeAttributeNode(t.attributes[0]); } -function Vkn(r, n) { - let s = n.focusNode, a = n.focusOffset; - if (!s || n.anchorNode != s || n.anchorOffset != a) +function bbe(t, e) { + let r = e.focusNode, n = e.focusOffset; + if (!r || e.anchorNode != r || e.anchorOffset != n) return !1; - for (a = Math.min(a, o_(s)); ; ) - if (a) { - if (s.nodeType != 1) + for (n = Math.min(n, Pu(r)); ; ) + if (n) { + if (r.nodeType != 1) return !1; - let l = s.childNodes[a - 1]; - l.contentEditable == "false" ? a-- : (s = l, a = o_(s)); + let i = r.childNodes[n - 1]; + i.contentEditable == "false" ? n-- : (r = i, n = Pu(r)); } else { - if (s == r) + if (r == t) return !0; - a = dK(s), s = s.parentNode; + n = Oy(r), r = r.parentNode; } } -function XDt(r) { - return r.scrollTop > Math.max(1, r.scrollHeight - r.clientHeight - 4); +function uj(t) { + return t.scrollTop > Math.max(1, t.scrollHeight - t.clientHeight - 4); } -class xg { - constructor(n, s, a = !0) { - this.node = n, this.offset = s, this.precise = a; +class Ms { + constructor(e, r, n = !0) { + this.node = e, this.offset = r, this.precise = n; } - static before(n, s) { - return new xg(n.parentNode, dK(n), s); + static before(e, r) { + return new Ms(e.parentNode, Oy(e), r); } - static after(n, s) { - return new xg(n.parentNode, dK(n) + 1, s); + static after(e, r) { + return new Ms(e.parentNode, Oy(e) + 1, r); } } -const cze = []; -class Mh { +const NR = []; +class yn { constructor() { this.parent = null, this.dom = null, this.flags = 2; } @@ -4372,142 +4381,142 @@ class Mh { get posAtEnd() { return this.posAtStart + this.length; } - posBefore(n) { - let s = this.posAtStart; - for (let a of this.children) { - if (a == n) - return s; - s += a.length + a.breakAfter; + posBefore(e) { + let r = this.posAtStart; + for (let n of this.children) { + if (n == e) + return r; + r += n.length + n.breakAfter; } throw new RangeError("Invalid child in posBefore"); } - posAfter(n) { - return this.posBefore(n) + n.length; + posAfter(e) { + return this.posBefore(e) + e.length; } - sync(n, s) { + sync(e, r) { if (this.flags & 2) { - let a = this.dom, l = null, h; - for (let f of this.children) { - if (f.flags & 7) { - if (!f.dom && (h = l ? l.nextSibling : a.firstChild)) { - let b = Mh.get(h); - (!b || !b.parent && b.canReuseDOM(f)) && f.reuseDOM(h); - } - f.sync(n, s), f.flags &= -8; - } - if (h = l ? l.nextSibling : a.firstChild, s && !s.written && s.node == a && h != f.dom && (s.written = !0), f.dom.parentNode == a) - for (; h && h != f.dom; ) - h = C_t(h); + let n = this.dom, i = null, s; + for (let a of this.children) { + if (a.flags & 7) { + if (!a.dom && (s = i ? i.nextSibling : n.firstChild)) { + let o = yn.get(s); + (!o || !o.parent && o.canReuseDOM(a)) && a.reuseDOM(s); + } + a.sync(e, r), a.flags &= -8; + } + if (s = i ? i.nextSibling : n.firstChild, r && !r.written && r.node == n && s != a.dom && (r.written = !0), a.dom.parentNode == n) + for (; s && s != a.dom; ) + s = tB(s); else - a.insertBefore(f.dom, h); - l = f.dom; + n.insertBefore(a.dom, s); + i = a.dom; } - for (h = l ? l.nextSibling : a.firstChild, h && s && s.node == a && (s.written = !0); h; ) - h = C_t(h); + for (s = i ? i.nextSibling : n.firstChild, s && r && r.node == n && (r.written = !0); s; ) + s = tB(s); } else if (this.flags & 1) - for (let a of this.children) - a.flags & 7 && (a.sync(n, s), a.flags &= -8); + for (let n of this.children) + n.flags & 7 && (n.sync(e, r), n.flags &= -8); } - reuseDOM(n) { + reuseDOM(e) { } - localPosFromDOM(n, s) { - let a; - if (n == this.dom) - a = this.dom.childNodes[s]; + localPosFromDOM(e, r) { + let n; + if (e == this.dom) + n = this.dom.childNodes[r]; else { - let l = o_(n) == 0 ? 0 : s == 0 ? -1 : 1; + let i = Pu(e) == 0 ? 0 : r == 0 ? -1 : 1; for (; ; ) { - let h = n.parentNode; - if (h == this.dom) + let s = e.parentNode; + if (s == this.dom) break; - l == 0 && h.firstChild != h.lastChild && (n == h.firstChild ? l = -1 : l = 1), n = h; + i == 0 && s.firstChild != s.lastChild && (e == s.firstChild ? i = -1 : i = 1), e = s; } - l < 0 ? a = n : a = n.nextSibling; + i < 0 ? n = e : n = e.nextSibling; } - if (a == this.dom.firstChild) + if (n == this.dom.firstChild) return 0; - for (; a && !Mh.get(a); ) - a = a.nextSibling; - if (!a) + for (; n && !yn.get(n); ) + n = n.nextSibling; + if (!n) return this.length; - for (let l = 0, h = 0; ; l++) { - let f = this.children[l]; - if (f.dom == a) - return h; - h += f.length + f.breakAfter; + for (let i = 0, s = 0; ; i++) { + let a = this.children[i]; + if (a.dom == n) + return s; + s += a.length + a.breakAfter; } } - domBoundsAround(n, s, a = 0) { - let l = -1, h = -1, f = -1, b = -1; - for (let w = 0, O = a, S = a; w < this.children.length; w++) { - let E = this.children[w], D = O + E.length; - if (O < n && D > s) - return E.domBoundsAround(n, s, O); - if (D >= n && l == -1 && (l = w, h = O), O > s && E.dom.parentNode == this.dom) { - f = w, b = S; + domBoundsAround(e, r, n = 0) { + let i = -1, s = -1, a = -1, o = -1; + for (let l = 0, u = n, h = n; l < this.children.length; l++) { + let f = this.children[l], d = u + f.length; + if (u < e && d > r) + return f.domBoundsAround(e, r, u); + if (d >= e && i == -1 && (i = l, s = u), u > r && f.dom.parentNode == this.dom) { + a = l, o = h; break; } - S = D, O = D + E.breakAfter; + h = d, u = d + f.breakAfter; } return { - from: h, - to: b < 0 ? a + this.length : b, - startDOM: (l ? this.children[l - 1].dom.nextSibling : null) || this.dom.firstChild, - endDOM: f < this.children.length && f >= 0 ? this.children[f].dom : null + from: s, + to: o < 0 ? n + this.length : o, + startDOM: (i ? this.children[i - 1].dom.nextSibling : null) || this.dom.firstChild, + endDOM: a < this.children.length && a >= 0 ? this.children[a].dom : null }; } - markDirty(n = !1) { - this.flags |= 2, this.markParentsDirty(n); + markDirty(e = !1) { + this.flags |= 2, this.markParentsDirty(e); } - markParentsDirty(n) { - for (let s = this.parent; s; s = s.parent) { - if (n && (s.flags |= 2), s.flags & 1) + markParentsDirty(e) { + for (let r = this.parent; r; r = r.parent) { + if (e && (r.flags |= 2), r.flags & 1) return; - s.flags |= 1, n = !1; + r.flags |= 1, e = !1; } } - setParent(n) { - this.parent != n && (this.parent = n, this.flags & 7 && this.markParentsDirty(!0)); + setParent(e) { + this.parent != e && (this.parent = e, this.flags & 7 && this.markParentsDirty(!0)); } - setDOM(n) { - this.dom != n && (this.dom && (this.dom.cmView = null), this.dom = n, n.cmView = this); + setDOM(e) { + this.dom != e && (this.dom && (this.dom.cmView = null), this.dom = e, e.cmView = this); } get rootView() { - for (let n = this; ; ) { - let s = n.parent; - if (!s) - return n; - n = s; + for (let e = this; ; ) { + let r = e.parent; + if (!r) + return e; + e = r; } } - replaceChildren(n, s, a = cze) { + replaceChildren(e, r, n = NR) { this.markDirty(); - for (let l = n; l < s; l++) { - let h = this.children[l]; - h.parent == this && a.indexOf(h) < 0 && h.destroy(); + for (let i = e; i < r; i++) { + let s = this.children[i]; + s.parent == this && n.indexOf(s) < 0 && s.destroy(); } - this.children.splice(n, s - n, ...a); - for (let l = 0; l < a.length; l++) - a[l].setParent(this); + this.children.splice(e, r - e, ...n); + for (let i = 0; i < n.length; i++) + n[i].setParent(this); } - ignoreMutation(n) { + ignoreMutation(e) { return !1; } - ignoreEvent(n) { + ignoreEvent(e) { return !1; } - childCursor(n = this.length) { - return new KDt(this.children, n, this.children.length); + childCursor(e = this.length) { + return new hj(this.children, e, this.children.length); } - childPos(n, s = 1) { - return this.childCursor().findPos(n, s); + childPos(e, r = 1) { + return this.childCursor().findPos(e, r); } toString() { - let n = this.constructor.name.replace("View", ""); - return n + (this.children.length ? "(" + this.children.join() + ")" : this.length ? "[" + (n == "Text" ? this.text : this.length) + "]" : "") + (this.breakAfter ? "#" : ""); + let e = this.constructor.name.replace("View", ""); + return e + (this.children.length ? "(" + this.children.join() + ")" : this.length ? "[" + (e == "Text" ? this.text : this.length) + "]" : "") + (this.breakAfter ? "#" : ""); } - static get(n) { - return n.cmView; + static get(e) { + return e.cmView; } get isEditable() { return !0; @@ -4518,227 +4527,227 @@ class Mh { get isHidden() { return !1; } - merge(n, s, a, l, h, f) { + merge(e, r, n, i, s, a) { return !1; } - become(n) { + become(e) { return !1; } - canReuseDOM(n) { - return n.constructor == this.constructor && !((this.flags | n.flags) & 8); + canReuseDOM(e) { + return e.constructor == this.constructor && !((this.flags | e.flags) & 8); } getSide() { return 0; } destroy() { - for (let n of this.children) - n.parent == this && n.destroy(); + for (let e of this.children) + e.parent == this && e.destroy(); this.parent = null; } } -Mh.prototype.breakAfter = 0; -function C_t(r) { - let n = r.nextSibling; - return r.parentNode.removeChild(r), n; +yn.prototype.breakAfter = 0; +function tB(t) { + let e = t.nextSibling; + return t.parentNode.removeChild(t), e; } -class KDt { - constructor(n, s, a) { - this.children = n, this.pos = s, this.i = a, this.off = 0; +class hj { + constructor(e, r, n) { + this.children = e, this.pos = r, this.i = n, this.off = 0; } - findPos(n, s = 1) { + findPos(e, r = 1) { for (; ; ) { - if (n > this.pos || n == this.pos && (s > 0 || this.i == 0 || this.children[this.i - 1].breakAfter)) - return this.off = n - this.pos, this; - let a = this.children[--this.i]; - this.pos -= a.length + a.breakAfter; + if (e > this.pos || e == this.pos && (r > 0 || this.i == 0 || this.children[this.i - 1].breakAfter)) + return this.off = e - this.pos, this; + let n = this.children[--this.i]; + this.pos -= n.length + n.breakAfter; } } } -function JDt(r, n, s, a, l, h, f, b, w) { - let { children: O } = r, S = O.length ? O[n] : null, E = h.length ? h[h.length - 1] : null, D = E ? E.breakAfter : f; - if (!(n == a && S && !f && !D && h.length < 2 && S.merge(s, l, h.length ? E : null, s == 0, b, w))) { - if (a < O.length) { - let M = O[a]; - M && (l < M.length || M.breakAfter && (E == null ? void 0 : E.breakAfter)) ? (n == a && (M = M.split(l), l = 0), !D && E && M.merge(0, l, E, !0, 0, w) ? h[h.length - 1] = M : ((l || M.children.length && !M.children[0].length) && M.merge(0, l, null, !1, 0, w), h.push(M))) : M != null && M.breakAfter && (E ? E.breakAfter = 1 : f = 1), a++; +function fj(t, e, r, n, i, s, a, o, l) { + let { children: u } = t, h = u.length ? u[e] : null, f = s.length ? s[s.length - 1] : null, d = f ? f.breakAfter : a; + if (!(e == n && h && !a && !d && s.length < 2 && h.merge(r, i, s.length ? f : null, r == 0, o, l))) { + if (n < u.length) { + let p = u[n]; + p && (i < p.length || p.breakAfter && (f == null ? void 0 : f.breakAfter)) ? (e == n && (p = p.split(i), i = 0), !d && f && p.merge(0, i, f, !0, 0, l) ? s[s.length - 1] = p : ((i || p.children.length && !p.children[0].length) && p.merge(0, i, null, !1, 0, l), s.push(p))) : p != null && p.breakAfter && (f ? f.breakAfter = 1 : a = 1), n++; } - for (S && (S.breakAfter = f, s > 0 && (!f && h.length && S.merge(s, S.length, h[0], !1, b, 0) ? S.breakAfter = h.shift().breakAfter : (s < S.length || S.children.length && S.children[S.children.length - 1].length == 0) && S.merge(s, S.length, null, !1, b, 0), n++)); n < a && h.length; ) - if (O[a - 1].become(h[h.length - 1])) - a--, h.pop(), w = h.length ? 0 : b; - else if (O[n].become(h[0])) - n++, h.shift(), b = h.length ? 0 : w; + for (h && (h.breakAfter = a, r > 0 && (!a && s.length && h.merge(r, h.length, s[0], !1, o, 0) ? h.breakAfter = s.shift().breakAfter : (r < h.length || h.children.length && h.children[h.children.length - 1].length == 0) && h.merge(r, h.length, null, !1, o, 0), e++)); e < n && s.length; ) + if (u[n - 1].become(s[s.length - 1])) + n--, s.pop(), l = s.length ? 0 : o; + else if (u[e].become(s[0])) + e++, s.shift(), o = s.length ? 0 : l; else break; - !h.length && n && a < O.length && !O[n - 1].breakAfter && O[a].merge(0, 0, O[n - 1], !1, b, w) && n--, (n < a || h.length) && r.replaceChildren(n, a, h); - } -} -function eMt(r, n, s, a, l, h) { - let f = r.childCursor(), { i: b, off: w } = f.findPos(s, 1), { i: O, off: S } = f.findPos(n, -1), E = n - s; - for (let D of a) - E += D.length; - r.length += E, JDt(r, O, S, b, w, a, 0, l, h); -} -let $2 = typeof navigator < "u" ? navigator : { userAgent: "", vendor: "", platform: "" }, nFe = typeof document < "u" ? document : { documentElement: { style: {} } }; -const rFe = /* @__PURE__ */ /Edge\/(\d+)/.exec($2.userAgent), tMt = /* @__PURE__ */ /MSIE \d/.test($2.userAgent), iFe = /* @__PURE__ */ /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($2.userAgent), H2e = !!(tMt || iFe || rFe), E_t = !H2e && /* @__PURE__ */ /gecko\/(\d+)/i.test($2.userAgent), mRe = !H2e && /* @__PURE__ */ /Chrome\/(\d+)/.exec($2.userAgent), T_t = "webkitFontSmoothing" in nFe.documentElement.style, nMt = !H2e && /* @__PURE__ */ /Apple Computer/.test($2.vendor), A_t = nMt && (/* @__PURE__ */ /Mobile\/\w+/.test($2.userAgent) || $2.maxTouchPoints > 2); -var Fs = { - mac: A_t || /* @__PURE__ */ /Mac/.test($2.platform), - windows: /* @__PURE__ */ /Win/.test($2.platform), - linux: /* @__PURE__ */ /Linux|X11/.test($2.platform), - ie: H2e, - ie_version: tMt ? nFe.documentMode || 6 : iFe ? +iFe[1] : rFe ? +rFe[1] : 0, - gecko: E_t, - gecko_version: E_t ? +(/* @__PURE__ */ /Firefox\/(\d+)/.exec($2.userAgent) || [0, 0])[1] : 0, - chrome: !!mRe, - chrome_version: mRe ? +mRe[1] : 0, - ios: A_t, - android: /* @__PURE__ */ /Android\b/.test($2.userAgent), - webkit: T_t, - safari: nMt, - webkit_version: T_t ? +(/* @__PURE__ */ /\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0, - tabSize: nFe.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size" -}; -const Ukn = 256; -class a_ extends Mh { - constructor(n) { - super(), this.text = n; + !s.length && e && n < u.length && !u[e - 1].breakAfter && u[n].merge(0, 0, u[e - 1], !1, o, l) && e--, (e < n || s.length) && t.replaceChildren(e, n, s); + } +} +function dj(t, e, r, n, i, s) { + let a = t.childCursor(), { i: o, off: l } = a.findPos(r, 1), { i: u, off: h } = a.findPos(e, -1), f = e - r; + for (let d of n) + f += d.length; + t.length += f, fj(t, u, h, o, l, n, 0, i, s); +} +let ro = typeof navigator < "u" ? navigator : { userAgent: "", vendor: "", platform: "" }, YA = typeof document < "u" ? document : { documentElement: { style: {} } }; +const WA = /* @__PURE__ */ /Edge\/(\d+)/.exec(ro.userAgent), pj = /* @__PURE__ */ /MSIE \d/.test(ro.userAgent), GA = /* @__PURE__ */ /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ro.userAgent), DS = !!(pj || GA || WA), rB = !DS && /* @__PURE__ */ /gecko\/(\d+)/i.test(ro.userAgent), hE = !DS && /* @__PURE__ */ /Chrome\/(\d+)/.exec(ro.userAgent), nB = "webkitFontSmoothing" in YA.documentElement.style, gj = !DS && /* @__PURE__ */ /Apple Computer/.test(ro.vendor), iB = gj && (/* @__PURE__ */ /Mobile\/\w+/.test(ro.userAgent) || ro.maxTouchPoints > 2); +var Mt = { + mac: iB || /* @__PURE__ */ /Mac/.test(ro.platform), + windows: /* @__PURE__ */ /Win/.test(ro.platform), + linux: /* @__PURE__ */ /Linux|X11/.test(ro.platform), + ie: DS, + ie_version: pj ? YA.documentMode || 6 : GA ? +GA[1] : WA ? +WA[1] : 0, + gecko: rB, + gecko_version: rB ? +(/* @__PURE__ */ /Firefox\/(\d+)/.exec(ro.userAgent) || [0, 0])[1] : 0, + chrome: !!hE, + chrome_version: hE ? +hE[1] : 0, + ios: iB, + android: /* @__PURE__ */ /Android\b/.test(ro.userAgent), + webkit: nB, + safari: gj, + webkit_version: nB ? +(/* @__PURE__ */ /\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0, + tabSize: YA.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size" +}; +const xbe = 256; +class $u extends yn { + constructor(e) { + super(), this.text = e; } get length() { return this.text.length; } - createDOM(n) { - this.setDOM(n || document.createTextNode(this.text)); + createDOM(e) { + this.setDOM(e || document.createTextNode(this.text)); } - sync(n, s) { - this.dom || this.createDOM(), this.dom.nodeValue != this.text && (s && s.node == this.dom && (s.written = !0), this.dom.nodeValue = this.text); + sync(e, r) { + this.dom || this.createDOM(), this.dom.nodeValue != this.text && (r && r.node == this.dom && (r.written = !0), this.dom.nodeValue = this.text); } - reuseDOM(n) { - n.nodeType == 3 && this.createDOM(n); + reuseDOM(e) { + e.nodeType == 3 && this.createDOM(e); } - merge(n, s, a) { - return this.flags & 8 || a && (!(a instanceof a_) || this.length - (s - n) + a.length > Ukn || a.flags & 8) ? !1 : (this.text = this.text.slice(0, n) + (a ? a.text : "") + this.text.slice(s), this.markDirty(), !0); + merge(e, r, n) { + return this.flags & 8 || n && (!(n instanceof $u) || this.length - (r - e) + n.length > xbe || n.flags & 8) ? !1 : (this.text = this.text.slice(0, e) + (n ? n.text : "") + this.text.slice(r), this.markDirty(), !0); } - split(n) { - let s = new a_(this.text.slice(n)); - return this.text = this.text.slice(0, n), this.markDirty(), s.flags |= this.flags & 8, s; + split(e) { + let r = new $u(this.text.slice(e)); + return this.text = this.text.slice(0, e), this.markDirty(), r.flags |= this.flags & 8, r; } - localPosFromDOM(n, s) { - return n == this.dom ? s : s ? this.text.length : 0; + localPosFromDOM(e, r) { + return e == this.dom ? r : r ? this.text.length : 0; } - domAtPos(n) { - return new xg(this.dom, n); + domAtPos(e) { + return new Ms(this.dom, e); } - domBoundsAround(n, s, a) { - return { from: a, to: a + this.length, startDOM: this.dom, endDOM: this.dom.nextSibling }; + domBoundsAround(e, r, n) { + return { from: n, to: n + this.length, startDOM: this.dom, endDOM: this.dom.nextSibling }; } - coordsAt(n, s) { - return Wkn(this.dom, n, s); + coordsAt(e, r) { + return wbe(this.dom, e, r); } } -class c_ extends Mh { - constructor(n, s = [], a = 0) { - super(), this.mark = n, this.children = s, this.length = a; - for (let l of s) - l.setParent(this); +class Bu extends yn { + constructor(e, r = [], n = 0) { + super(), this.mark = e, this.children = r, this.length = n; + for (let i of r) + i.setParent(this); } - setAttrs(n) { - if (ZDt(n), this.mark.class && (n.className = this.mark.class), this.mark.attrs) - for (let s in this.mark.attrs) - n.setAttribute(s, this.mark.attrs[s]); - return n; + setAttrs(e) { + if (cj(e), this.mark.class && (e.className = this.mark.class), this.mark.attrs) + for (let r in this.mark.attrs) + e.setAttribute(r, this.mark.attrs[r]); + return e; } - canReuseDOM(n) { - return super.canReuseDOM(n) && !((this.flags | n.flags) & 8); + canReuseDOM(e) { + return super.canReuseDOM(e) && !((this.flags | e.flags) & 8); } - reuseDOM(n) { - n.nodeName == this.mark.tagName.toUpperCase() && (this.setDOM(n), this.flags |= 6); + reuseDOM(e) { + e.nodeName == this.mark.tagName.toUpperCase() && (this.setDOM(e), this.flags |= 6); } - sync(n, s) { - this.dom ? this.flags & 4 && this.setAttrs(this.dom) : this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))), super.sync(n, s); + sync(e, r) { + this.dom ? this.flags & 4 && this.setAttrs(this.dom) : this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))), super.sync(e, r); } - merge(n, s, a, l, h, f) { - return a && (!(a instanceof c_ && a.mark.eq(this.mark)) || n && h <= 0 || s < this.length && f <= 0) ? !1 : (eMt(this, n, s, a ? a.children.slice() : [], h - 1, f - 1), this.markDirty(), !0); + merge(e, r, n, i, s, a) { + return n && (!(n instanceof Bu && n.mark.eq(this.mark)) || e && s <= 0 || r < this.length && a <= 0) ? !1 : (dj(this, e, r, n ? n.children.slice() : [], s - 1, a - 1), this.markDirty(), !0); } - split(n) { - let s = [], a = 0, l = -1, h = 0; - for (let b of this.children) { - let w = a + b.length; - w > n && s.push(a < n ? b.split(n - a) : b), l < 0 && a >= n && (l = h), a = w, h++; + split(e) { + let r = [], n = 0, i = -1, s = 0; + for (let o of this.children) { + let l = n + o.length; + l > e && r.push(n < e ? o.split(e - n) : o), i < 0 && n >= e && (i = s), n = l, s++; } - let f = this.length - n; - return this.length = n, l > -1 && (this.children.length = l, this.markDirty()), new c_(this.mark, s, f); + let a = this.length - e; + return this.length = e, i > -1 && (this.children.length = i, this.markDirty()), new Bu(this.mark, r, a); } - domAtPos(n) { - return rMt(this, n); + domAtPos(e) { + return mj(this, e); } - coordsAt(n, s) { - return sMt(this, n, s); + coordsAt(e, r) { + return yj(this, e, r); } } -function Wkn(r, n, s) { - let a = r.nodeValue.length; - n > a && (n = a); - let l = n, h = n, f = 0; - n == 0 && s < 0 || n == a && s >= 0 ? Fs.chrome || Fs.gecko || (n ? (l--, f = 1) : h < a && (h++, f = -1)) : s < 0 ? l-- : h < a && h++; - let b = sP(r, l, h).getClientRects(); - if (!b.length) +function wbe(t, e, r) { + let n = t.nodeValue.length; + e > n && (e = n); + let i = e, s = e, a = 0; + e == 0 && r < 0 || e == n && r >= 0 ? Mt.chrome || Mt.gecko || (e ? (i--, a = 1) : s < n && (s++, a = -1)) : r < 0 ? i-- : s < n && s++; + let o = Zd(t, i, s).getClientRects(); + if (!o.length) return null; - let w = b[(f ? f < 0 : s >= 0) ? 0 : b.length - 1]; - return Fs.safari && !f && w.width == 0 && (w = Array.prototype.find.call(b, (O) => O.width) || w), f ? aze(w, f < 0) : w || null; + let l = o[(a ? a < 0 : r >= 0) ? 0 : o.length - 1]; + return Mt.safari && !a && l.width == 0 && (l = Array.prototype.find.call(o, (u) => u.width) || l), a ? DR(l, a < 0) : l || null; } -class ZT extends Mh { - static create(n, s, a) { - return new ZT(n, s, a); +class Nh extends yn { + static create(e, r, n) { + return new Nh(e, r, n); } - constructor(n, s, a) { - super(), this.widget = n, this.length = s, this.side = a, this.prevWidget = null; + constructor(e, r, n) { + super(), this.widget = e, this.length = r, this.side = n, this.prevWidget = null; } - split(n) { - let s = ZT.create(this.widget, this.length - n, this.side); - return this.length -= n, s; + split(e) { + let r = Nh.create(this.widget, this.length - e, this.side); + return this.length -= e, r; } - sync(n) { - (!this.dom || !this.widget.updateDOM(this.dom, n)) && (this.dom && this.prevWidget && this.prevWidget.destroy(this.dom), this.prevWidget = null, this.setDOM(this.widget.toDOM(n)), this.dom.contentEditable = "false"); + sync(e) { + (!this.dom || !this.widget.updateDOM(this.dom, e)) && (this.dom && this.prevWidget && this.prevWidget.destroy(this.dom), this.prevWidget = null, this.setDOM(this.widget.toDOM(e)), this.dom.contentEditable = "false"); } getSide() { return this.side; } - merge(n, s, a, l, h, f) { - return a && (!(a instanceof ZT) || !this.widget.compare(a.widget) || n > 0 && h <= 0 || s < this.length && f <= 0) ? !1 : (this.length = n + (a ? a.length : 0) + (this.length - s), !0); + merge(e, r, n, i, s, a) { + return n && (!(n instanceof Nh) || !this.widget.compare(n.widget) || e > 0 && s <= 0 || r < this.length && a <= 0) ? !1 : (this.length = e + (n ? n.length : 0) + (this.length - r), !0); } - become(n) { - return n instanceof ZT && n.side == this.side && this.widget.constructor == n.widget.constructor ? (this.widget.compare(n.widget) || this.markDirty(!0), this.dom && !this.prevWidget && (this.prevWidget = this.widget), this.widget = n.widget, this.length = n.length, !0) : !1; + become(e) { + return e instanceof Nh && e.side == this.side && this.widget.constructor == e.widget.constructor ? (this.widget.compare(e.widget) || this.markDirty(!0), this.dom && !this.prevWidget && (this.prevWidget = this.widget), this.widget = e.widget, this.length = e.length, !0) : !1; } ignoreMutation() { return !0; } - ignoreEvent(n) { - return this.widget.ignoreEvent(n); + ignoreEvent(e) { + return this.widget.ignoreEvent(e); } get overrideDOMText() { if (this.length == 0) - return Al.empty; - let n = this; - for (; n.parent; ) - n = n.parent; - let { view: s } = n, a = s && s.state.doc, l = this.posAtStart; - return a ? a.slice(l, l + this.length) : Al.empty; + return Dr.empty; + let e = this; + for (; e.parent; ) + e = e.parent; + let { view: r } = e, n = r && r.state.doc, i = this.posAtStart; + return n ? n.slice(i, i + this.length) : Dr.empty; } - domAtPos(n) { - return (this.length ? n == 0 : this.side > 0) ? xg.before(this.dom) : xg.after(this.dom, n == this.length); + domAtPos(e) { + return (this.length ? e == 0 : this.side > 0) ? Ms.before(this.dom) : Ms.after(this.dom, e == this.length); } domBoundsAround() { return null; } - coordsAt(n, s) { - let a = this.widget.coordsAt(this.dom, n, s); - if (a) - return a; - let l = this.dom.getClientRects(), h = null; - if (!l.length) + coordsAt(e, r) { + let n = this.widget.coordsAt(this.dom, e, r); + if (n) + return n; + let i = this.dom.getClientRects(), s = null; + if (!i.length) return null; - let f = this.side ? this.side < 0 : n > 0; - for (let b = f ? l.length - 1 : 0; h = l[b], !(n > 0 ? b == 0 : b == l.length - 1 || h.top < h.bottom); b += f ? -1 : 1) + let a = this.side ? this.side < 0 : e > 0; + for (let o = a ? i.length - 1 : 0; s = i[o], !(e > 0 ? o == 0 : o == i.length - 1 || s.top < s.bottom); o += a ? -1 : 1) ; - return aze(h, !f); + return DR(s, !a); } get isEditable() { return !1; @@ -4753,9 +4762,9 @@ class ZT extends Mh { super.destroy(), this.dom && this.widget.destroy(this.dom); } } -class sF extends Mh { - constructor(n) { - super(), this.side = n; +class Eg extends yn { + constructor(e) { + super(), this.side = e; } get length() { return 0; @@ -4763,23 +4772,23 @@ class sF extends Mh { merge() { return !1; } - become(n) { - return n instanceof sF && n.side == this.side; + become(e) { + return e instanceof Eg && e.side == this.side; } split() { - return new sF(this.side); + return new Eg(this.side); } sync() { if (!this.dom) { - let n = document.createElement("img"); - n.className = "cm-widgetBuffer", n.setAttribute("aria-hidden", "true"), this.setDOM(n); + let e = document.createElement("img"); + e.className = "cm-widgetBuffer", e.setAttribute("aria-hidden", "true"), this.setDOM(e); } } getSide() { return this.side; } - domAtPos(n) { - return this.side > 0 ? xg.before(this.dom) : xg.after(this.dom); + domAtPos(e) { + return this.side > 0 ? Ms.before(this.dom) : Ms.after(this.dom); } localPosFromDOM() { return 0; @@ -4787,239 +4796,239 @@ class sF extends Mh { domBoundsAround() { return null; } - coordsAt(n) { + coordsAt(e) { return this.dom.getBoundingClientRect(); } get overrideDOMText() { - return Al.empty; + return Dr.empty; } get isHidden() { return !0; } } -a_.prototype.children = ZT.prototype.children = sF.prototype.children = cze; -function rMt(r, n) { - let s = r.dom, { children: a } = r, l = 0; - for (let h = 0; l < a.length; l++) { - let f = a[l], b = h + f.length; - if (!(b == h && f.getSide() <= 0)) { - if (n > h && n < b && f.dom.parentNode == s) - return f.domAtPos(n - h); - if (n <= h) +$u.prototype.children = Nh.prototype.children = Eg.prototype.children = NR; +function mj(t, e) { + let r = t.dom, { children: n } = t, i = 0; + for (let s = 0; i < n.length; i++) { + let a = n[i], o = s + a.length; + if (!(o == s && a.getSide() <= 0)) { + if (e > s && e < o && a.dom.parentNode == r) + return a.domAtPos(e - s); + if (e <= s) break; - h = b; + s = o; } } - for (let h = l; h > 0; h--) { - let f = a[h - 1]; - if (f.dom.parentNode == s) - return f.domAtPos(f.length); - } - for (let h = l; h < a.length; h++) { - let f = a[h]; - if (f.dom.parentNode == s) - return f.domAtPos(0); - } - return new xg(s, 0); -} -function iMt(r, n, s) { - let a, { children: l } = r; - s > 0 && n instanceof c_ && l.length && (a = l[l.length - 1]) instanceof c_ && a.mark.eq(n.mark) ? iMt(a, n.children[0], s - 1) : (l.push(n), n.setParent(r)), r.length += n.length; -} -function sMt(r, n, s) { - let a = null, l = -1, h = null, f = -1; - function b(O, S) { - for (let E = 0, D = 0; E < O.children.length && D <= S; E++) { - let M = O.children[E], B = D + M.length; - B >= S && (M.children.length ? b(M, S - D) : (!h || h.isHidden && s > 0) && (B > S || D == B && M.getSide() > 0) ? (h = M, f = S - D) : (D < S || D == B && M.getSide() < 0 && !M.isHidden) && (a = M, l = S - D)), D = B; - } + for (let s = i; s > 0; s--) { + let a = n[s - 1]; + if (a.dom.parentNode == r) + return a.domAtPos(a.length); } - b(r, n); - let w = (s < 0 ? a : h) || a || h; - return w ? w.coordsAt(Math.max(0, w == a ? l : f), s) : Ykn(r); -} -function Ykn(r) { - let n = r.dom.lastChild; - if (!n) - return r.dom.getBoundingClientRect(); - let s = fK(n); - return s[s.length - 1] || null; -} -function sFe(r, n) { - for (let s in r) - s == "class" && n.class ? n.class += " " + r.class : s == "style" && n.style ? n.style += ";" + r.style : n[s] = r[s]; - return n; -} -const D_t = /* @__PURE__ */ Object.create(null); -function lze(r, n, s) { - if (r == n) + for (let s = i; s < n.length; s++) { + let a = n[s]; + if (a.dom.parentNode == r) + return a.domAtPos(0); + } + return new Ms(r, 0); +} +function vj(t, e, r) { + let n, { children: i } = t; + r > 0 && e instanceof Bu && i.length && (n = i[i.length - 1]) instanceof Bu && n.mark.eq(e.mark) ? vj(n, e.children[0], r - 1) : (i.push(e), e.setParent(t)), t.length += e.length; +} +function yj(t, e, r) { + let n = null, i = -1, s = null, a = -1; + function o(u, h) { + for (let f = 0, d = 0; f < u.children.length && d <= h; f++) { + let p = u.children[f], g = d + p.length; + g >= h && (p.children.length ? o(p, h - d) : (!s || s.isHidden && r > 0) && (g > h || d == g && p.getSide() > 0) ? (s = p, a = h - d) : (d < h || d == g && p.getSide() < 0 && !p.isHidden) && (n = p, i = h - d)), d = g; + } + } + o(t, e); + let l = (r < 0 ? n : s) || n || s; + return l ? l.coordsAt(Math.max(0, l == n ? i : a), r) : Obe(t); +} +function Obe(t) { + let e = t.dom.lastChild; + if (!e) + return t.dom.getBoundingClientRect(); + let r = wy(e); + return r[r.length - 1] || null; +} +function HA(t, e) { + for (let r in t) + r == "class" && e.class ? e.class += " " + t.class : r == "style" && e.style ? e.style += ";" + t.style : e[r] = t[r]; + return e; +} +const sB = /* @__PURE__ */ Object.create(null); +function IR(t, e, r) { + if (t == e) return !0; - r || (r = D_t), n || (n = D_t); - let a = Object.keys(r), l = Object.keys(n); - if (a.length - (s && a.indexOf(s) > -1 ? 1 : 0) != l.length - (s && l.indexOf(s) > -1 ? 1 : 0)) + t || (t = sB), e || (e = sB); + let n = Object.keys(t), i = Object.keys(e); + if (n.length - (r && n.indexOf(r) > -1 ? 1 : 0) != i.length - (r && i.indexOf(r) > -1 ? 1 : 0)) return !1; - for (let h of a) - if (h != s && (l.indexOf(h) == -1 || r[h] !== n[h])) + for (let s of n) + if (s != r && (i.indexOf(s) == -1 || t[s] !== e[s])) return !1; return !0; } -function oFe(r, n, s) { - let a = !1; - if (n) - for (let l in n) - s && l in s || (a = !0, l == "style" ? r.style.cssText = "" : r.removeAttribute(l)); - if (s) - for (let l in s) - n && n[l] == s[l] || (a = !0, l == "style" ? r.style.cssText = s[l] : r.setAttribute(l, s[l])); - return a; +function XA(t, e, r) { + let n = !1; + if (e) + for (let i in e) + r && i in r || (n = !0, i == "style" ? t.style.cssText = "" : t.removeAttribute(i)); + if (r) + for (let i in r) + e && e[i] == r[i] || (n = !0, i == "style" ? t.style.cssText = r[i] : t.setAttribute(i, r[i])); + return n; } -function Hkn(r) { - let n = /* @__PURE__ */ Object.create(null); - for (let s = 0; s < r.attributes.length; s++) { - let a = r.attributes[s]; - n[a.name] = a.value; +function kbe(t) { + let e = /* @__PURE__ */ Object.create(null); + for (let r = 0; r < t.attributes.length; r++) { + let n = t.attributes[r]; + e[n.name] = n.value; } - return n; + return e; } -class o0 extends Mh { +class bi extends yn { constructor() { super(...arguments), this.children = [], this.length = 0, this.prevAttrs = void 0, this.attrs = null, this.breakAfter = 0; } - merge(n, s, a, l, h, f) { - if (a) { - if (!(a instanceof o0)) + merge(e, r, n, i, s, a) { + if (n) { + if (!(n instanceof bi)) return !1; - this.dom || a.transferDOM(this); + this.dom || n.transferDOM(this); } - return l && this.setDeco(a ? a.attrs : null), eMt(this, n, s, a ? a.children.slice() : [], h, f), !0; + return i && this.setDeco(n ? n.attrs : null), dj(this, e, r, n ? n.children.slice() : [], s, a), !0; } - split(n) { - let s = new o0(); - if (s.breakAfter = this.breakAfter, this.length == 0) - return s; - let { i: a, off: l } = this.childPos(n); - l && (s.append(this.children[a].split(l), 0), this.children[a].merge(l, this.children[a].length, null, !1, 0, 0), a++); - for (let h = a; h < this.children.length; h++) - s.append(this.children[h], 0); - for (; a > 0 && this.children[a - 1].length == 0; ) - this.children[--a].destroy(); - return this.children.length = a, this.markDirty(), this.length = n, s; + split(e) { + let r = new bi(); + if (r.breakAfter = this.breakAfter, this.length == 0) + return r; + let { i: n, off: i } = this.childPos(e); + i && (r.append(this.children[n].split(i), 0), this.children[n].merge(i, this.children[n].length, null, !1, 0, 0), n++); + for (let s = n; s < this.children.length; s++) + r.append(this.children[s], 0); + for (; n > 0 && this.children[n - 1].length == 0; ) + this.children[--n].destroy(); + return this.children.length = n, this.markDirty(), this.length = e, r; } - transferDOM(n) { - !this.dom || (this.markDirty(), n.setDOM(this.dom), n.prevAttrs = this.prevAttrs === void 0 ? this.attrs : this.prevAttrs, this.prevAttrs = void 0, this.dom = null); + transferDOM(e) { + !this.dom || (this.markDirty(), e.setDOM(this.dom), e.prevAttrs = this.prevAttrs === void 0 ? this.attrs : this.prevAttrs, this.prevAttrs = void 0, this.dom = null); } - setDeco(n) { - lze(this.attrs, n) || (this.dom && (this.prevAttrs = this.attrs, this.markDirty()), this.attrs = n); + setDeco(e) { + IR(this.attrs, e) || (this.dom && (this.prevAttrs = this.attrs, this.markDirty()), this.attrs = e); } - append(n, s) { - iMt(this, n, s); + append(e, r) { + vj(this, e, r); } - addLineDeco(n) { - let s = n.spec.attributes, a = n.spec.class; - s && (this.attrs = sFe(s, this.attrs || {})), a && (this.attrs = sFe({ class: a }, this.attrs || {})); + addLineDeco(e) { + let r = e.spec.attributes, n = e.spec.class; + r && (this.attrs = HA(r, this.attrs || {})), n && (this.attrs = HA({ class: n }, this.attrs || {})); } - domAtPos(n) { - return rMt(this, n); + domAtPos(e) { + return mj(this, e); } - reuseDOM(n) { - n.nodeName == "DIV" && (this.setDOM(n), this.flags |= 6); + reuseDOM(e) { + e.nodeName == "DIV" && (this.setDOM(e), this.flags |= 6); } - sync(n, s) { - var a; - this.dom ? this.flags & 4 && (ZDt(this.dom), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0) : (this.setDOM(document.createElement("div")), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0), this.prevAttrs !== void 0 && (oFe(this.dom, this.prevAttrs, this.attrs), this.dom.classList.add("cm-line"), this.prevAttrs = void 0), super.sync(n, s); - let l = this.dom.lastChild; - for (; l && Mh.get(l) instanceof c_; ) - l = l.lastChild; - if (!l || !this.length || l.nodeName != "BR" && ((a = Mh.get(l)) === null || a === void 0 ? void 0 : a.isEditable) == !1 && (!Fs.ios || !this.children.some((h) => h instanceof a_))) { - let h = document.createElement("BR"); - h.cmIgnore = !0, this.dom.appendChild(h); + sync(e, r) { + var n; + this.dom ? this.flags & 4 && (cj(this.dom), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0) : (this.setDOM(document.createElement("div")), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0), this.prevAttrs !== void 0 && (XA(this.dom, this.prevAttrs, this.attrs), this.dom.classList.add("cm-line"), this.prevAttrs = void 0), super.sync(e, r); + let i = this.dom.lastChild; + for (; i && yn.get(i) instanceof Bu; ) + i = i.lastChild; + if (!i || !this.length || i.nodeName != "BR" && ((n = yn.get(i)) === null || n === void 0 ? void 0 : n.isEditable) == !1 && (!Mt.ios || !this.children.some((s) => s instanceof $u))) { + let s = document.createElement("BR"); + s.cmIgnore = !0, this.dom.appendChild(s); } } measureTextSize() { if (this.children.length == 0 || this.length > 20) return null; - let n = 0, s; - for (let a of this.children) { - if (!(a instanceof a_) || /[^ -~]/.test(a.text)) + let e = 0, r; + for (let n of this.children) { + if (!(n instanceof $u) || /[^ -~]/.test(n.text)) return null; - let l = fK(a.dom); - if (l.length != 1) + let i = wy(n.dom); + if (i.length != 1) return null; - n += l[0].width, s = l[0].height; + e += i[0].width, r = i[0].height; } - return n ? { + return e ? { lineHeight: this.dom.getBoundingClientRect().height, - charWidth: n / this.length, - textHeight: s + charWidth: e / this.length, + textHeight: r } : null; } - coordsAt(n, s) { - let a = sMt(this, n, s); - if (!this.children.length && a && this.parent) { - let { heightOracle: l } = this.parent.view.viewState, h = a.bottom - a.top; - if (Math.abs(h - l.lineHeight) < 2 && l.textHeight < h) { - let f = (h - l.textHeight) / 2; - return { top: a.top + f, bottom: a.bottom - f, left: a.left, right: a.left }; + coordsAt(e, r) { + let n = yj(this, e, r); + if (!this.children.length && n && this.parent) { + let { heightOracle: i } = this.parent.view.viewState, s = n.bottom - n.top; + if (Math.abs(s - i.lineHeight) < 2 && i.textHeight < s) { + let a = (s - i.textHeight) / 2; + return { top: n.top + a, bottom: n.bottom - a, left: n.left, right: n.left }; } } - return a; + return n; } - become(n) { + become(e) { return !1; } covers() { return !0; } - static find(n, s) { - for (let a = 0, l = 0; a < n.children.length; a++) { - let h = n.children[a], f = l + h.length; - if (f >= s) { - if (h instanceof o0) - return h; - if (f > s) + static find(e, r) { + for (let n = 0, i = 0; n < e.children.length; n++) { + let s = e.children[n], a = i + s.length; + if (a >= r) { + if (s instanceof bi) + return s; + if (a > r) break; } - l = f + h.breakAfter; + i = a + s.breakAfter; } return null; } } -class t8 extends Mh { - constructor(n, s, a) { - super(), this.widget = n, this.length = s, this.deco = a, this.breakAfter = 0, this.prevWidget = null; +class Yh extends yn { + constructor(e, r, n) { + super(), this.widget = e, this.length = r, this.deco = n, this.breakAfter = 0, this.prevWidget = null; } - merge(n, s, a, l, h, f) { - return a && (!(a instanceof t8) || !this.widget.compare(a.widget) || n > 0 && h <= 0 || s < this.length && f <= 0) ? !1 : (this.length = n + (a ? a.length : 0) + (this.length - s), !0); + merge(e, r, n, i, s, a) { + return n && (!(n instanceof Yh) || !this.widget.compare(n.widget) || e > 0 && s <= 0 || r < this.length && a <= 0) ? !1 : (this.length = e + (n ? n.length : 0) + (this.length - r), !0); } - domAtPos(n) { - return n == 0 ? xg.before(this.dom) : xg.after(this.dom, n == this.length); + domAtPos(e) { + return e == 0 ? Ms.before(this.dom) : Ms.after(this.dom, e == this.length); } - split(n) { - let s = this.length - n; - this.length = n; - let a = new t8(this.widget, s, this.deco); - return a.breakAfter = this.breakAfter, a; + split(e) { + let r = this.length - e; + this.length = e; + let n = new Yh(this.widget, r, this.deco); + return n.breakAfter = this.breakAfter, n; } get children() { - return cze; + return NR; } - sync(n) { - (!this.dom || !this.widget.updateDOM(this.dom, n)) && (this.dom && this.prevWidget && this.prevWidget.destroy(this.dom), this.prevWidget = null, this.setDOM(this.widget.toDOM(n)), this.dom.contentEditable = "false"); + sync(e) { + (!this.dom || !this.widget.updateDOM(this.dom, e)) && (this.dom && this.prevWidget && this.prevWidget.destroy(this.dom), this.prevWidget = null, this.setDOM(this.widget.toDOM(e)), this.dom.contentEditable = "false"); } get overrideDOMText() { - return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Al.empty; + return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Dr.empty; } domBoundsAround() { return null; } - become(n) { - return n instanceof t8 && n.widget.constructor == this.widget.constructor ? (n.widget.compare(this.widget) || this.markDirty(!0), this.dom && !this.prevWidget && (this.prevWidget = this.widget), this.widget = n.widget, this.length = n.length, this.deco = n.deco, this.breakAfter = n.breakAfter, !0) : !1; + become(e) { + return e instanceof Yh && e.widget.constructor == this.widget.constructor ? (e.widget.compare(this.widget) || this.markDirty(!0), this.dom && !this.prevWidget && (this.prevWidget = this.widget), this.widget = e.widget, this.length = e.length, this.deco = e.deco, this.breakAfter = e.breakAfter, !0) : !1; } ignoreMutation() { return !0; } - ignoreEvent(n) { - return this.widget.ignoreEvent(n); + ignoreEvent(e) { + return this.widget.ignoreEvent(e); } get isEditable() { return !1; @@ -5027,26 +5036,26 @@ class t8 extends Mh { get isWidget() { return !0; } - coordsAt(n, s) { - return this.widget.coordsAt(this.dom, n, s); + coordsAt(e, r) { + return this.widget.coordsAt(this.dom, e, r); } destroy() { super.destroy(), this.dom && this.widget.destroy(this.dom); } - covers(n) { - let { startSide: s, endSide: a } = this.deco; - return s == a ? !1 : n < 0 ? s < 0 : a > 0; + covers(e) { + let { startSide: r, endSide: n } = this.deco; + return r == n ? !1 : e < 0 ? r < 0 : n > 0; } } -class uv { - eq(n) { +class za { + eq(e) { return !1; } - updateDOM(n, s) { + updateDOM(e, r) { return !1; } - compare(n) { - return this == n || this.constructor == n.constructor && this.eq(n); + compare(e) { + return this == e || this.constructor == e.constructor && this.eq(e); } get estimatedHeight() { return -1; @@ -5054,262 +5063,262 @@ class uv { get lineBreaks() { return 0; } - ignoreEvent(n) { + ignoreEvent(e) { return !0; } - coordsAt(n, s, a) { + coordsAt(e, r, n) { return null; } get isHidden() { return !1; } - destroy(n) { + destroy(e) { } } -var Pm = /* @__PURE__ */ function(r) { - return r[r.Text = 0] = "Text", r[r.WidgetBefore = 1] = "WidgetBefore", r[r.WidgetAfter = 2] = "WidgetAfter", r[r.WidgetRange = 3] = "WidgetRange", r; -}(Pm || (Pm = {})); -class as extends iP { - constructor(n, s, a, l) { - super(), this.startSide = n, this.endSide = s, this.widget = a, this.spec = l; +var ia = /* @__PURE__ */ function(t) { + return t[t.Text = 0] = "Text", t[t.WidgetBefore = 1] = "WidgetBefore", t[t.WidgetAfter = 2] = "WidgetAfter", t[t.WidgetRange = 3] = "WidgetRange", t; +}(ia || (ia = {})); +class Et extends Xd { + constructor(e, r, n, i) { + super(), this.startSide = e, this.endSide = r, this.widget = n, this.spec = i; } get heightRelevant() { return !1; } - static mark(n) { - return new DJ(n); + static mark(e) { + return new Ub(e); } - static widget(n) { - let s = Math.max(-1e4, Math.min(1e4, n.side || 0)), a = !!n.block; - return s += a && !n.inlineOrder ? s > 0 ? 3e8 : -4e8 : s > 0 ? 1e8 : -1e8, new p8(n, s, s, a, n.widget || null, !1); + static widget(e) { + let r = Math.max(-1e4, Math.min(1e4, e.side || 0)), n = !!e.block; + return r += n && !e.inlineOrder ? r > 0 ? 3e8 : -4e8 : r > 0 ? 1e8 : -1e8, new af(e, r, r, n, e.widget || null, !1); } - static replace(n) { - let s = !!n.block, a, l; - if (n.isBlockGap) - a = -5e8, l = 4e8; + static replace(e) { + let r = !!e.block, n, i; + if (e.isBlockGap) + n = -5e8, i = 4e8; else { - let { start: h, end: f } = oMt(n, s); - a = (h ? s ? -3e8 : -1 : 5e8) - 1, l = (f ? s ? 2e8 : 1 : -6e8) + 1; + let { start: s, end: a } = bj(e, r); + n = (s ? r ? -3e8 : -1 : 5e8) - 1, i = (a ? r ? 2e8 : 1 : -6e8) + 1; } - return new p8(n, a, l, s, n.widget || null, !0); + return new af(e, n, i, r, e.widget || null, !0); } - static line(n) { - return new MJ(n); + static line(e) { + return new qb(e); } - static set(n, s = !1) { - return cl.of(n, s); + static set(e, r = !1) { + return Er.of(e, r); } hasHeight() { return this.widget ? this.widget.estimatedHeight > -1 : !1; } } -as.none = cl.empty; -class DJ extends as { - constructor(n) { - let { start: s, end: a } = oMt(n); - super(s ? -1 : 5e8, a ? 1 : -6e8, null, n), this.tagName = n.tagName || "span", this.class = n.class || "", this.attrs = n.attributes || null; +Et.none = Er.empty; +class Ub extends Et { + constructor(e) { + let { start: r, end: n } = bj(e); + super(r ? -1 : 5e8, n ? 1 : -6e8, null, e), this.tagName = e.tagName || "span", this.class = e.class || "", this.attrs = e.attributes || null; } - eq(n) { - var s, a; - return this == n || n instanceof DJ && this.tagName == n.tagName && (this.class || ((s = this.attrs) === null || s === void 0 ? void 0 : s.class)) == (n.class || ((a = n.attrs) === null || a === void 0 ? void 0 : a.class)) && lze(this.attrs, n.attrs, "class"); + eq(e) { + var r, n; + return this == e || e instanceof Ub && this.tagName == e.tagName && (this.class || ((r = this.attrs) === null || r === void 0 ? void 0 : r.class)) == (e.class || ((n = e.attrs) === null || n === void 0 ? void 0 : n.class)) && IR(this.attrs, e.attrs, "class"); } - range(n, s = n) { - if (n >= s) + range(e, r = e) { + if (e >= r) throw new RangeError("Mark decorations may not be empty"); - return super.range(n, s); + return super.range(e, r); } } -DJ.prototype.point = !1; -class MJ extends as { - constructor(n) { - super(-2e8, -2e8, null, n); +Ub.prototype.point = !1; +class qb extends Et { + constructor(e) { + super(-2e8, -2e8, null, e); } - eq(n) { - return n instanceof MJ && this.spec.class == n.spec.class && lze(this.spec.attributes, n.spec.attributes); + eq(e) { + return e instanceof qb && this.spec.class == e.spec.class && IR(this.spec.attributes, e.spec.attributes); } - range(n, s = n) { - if (s != n) + range(e, r = e) { + if (r != e) throw new RangeError("Line decoration ranges must be zero-length"); - return super.range(n, s); + return super.range(e, r); } } -MJ.prototype.mapMode = c0.TrackBefore; -MJ.prototype.point = !0; -class p8 extends as { - constructor(n, s, a, l, h, f) { - super(s, a, h, n), this.block = l, this.isReplace = f, this.mapMode = l ? s <= 0 ? c0.TrackBefore : c0.TrackAfter : c0.TrackDel; +qb.prototype.mapMode = Si.TrackBefore; +qb.prototype.point = !0; +class af extends Et { + constructor(e, r, n, i, s, a) { + super(r, n, s, e), this.block = i, this.isReplace = a, this.mapMode = i ? r <= 0 ? Si.TrackBefore : Si.TrackAfter : Si.TrackDel; } get type() { - return this.startSide != this.endSide ? Pm.WidgetRange : this.startSide <= 0 ? Pm.WidgetBefore : Pm.WidgetAfter; + return this.startSide != this.endSide ? ia.WidgetRange : this.startSide <= 0 ? ia.WidgetBefore : ia.WidgetAfter; } get heightRelevant() { return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0); } - eq(n) { - return n instanceof p8 && Gkn(this.widget, n.widget) && this.block == n.block && this.startSide == n.startSide && this.endSide == n.endSide; + eq(e) { + return e instanceof af && Sbe(this.widget, e.widget) && this.block == e.block && this.startSide == e.startSide && this.endSide == e.endSide; } - range(n, s = n) { - if (this.isReplace && (n > s || n == s && this.startSide > 0 && this.endSide <= 0)) + range(e, r = e) { + if (this.isReplace && (e > r || e == r && this.startSide > 0 && this.endSide <= 0)) throw new RangeError("Invalid range for replacement decoration"); - if (!this.isReplace && s != n) + if (!this.isReplace && r != e) throw new RangeError("Widget decorations can only have zero-length ranges"); - return super.range(n, s); + return super.range(e, r); } } -p8.prototype.point = !0; -function oMt(r, n = !1) { - let { inclusiveStart: s, inclusiveEnd: a } = r; - return s == null && (s = r.inclusive), a == null && (a = r.inclusive), { start: s != null ? s : n, end: a != null ? a : n }; +af.prototype.point = !0; +function bj(t, e = !1) { + let { inclusiveStart: r, inclusiveEnd: n } = t; + return r == null && (r = t.inclusive), n == null && (n = t.inclusive), { start: r != null ? r : e, end: n != null ? n : e }; } -function Gkn(r, n) { - return r == n || !!(r && n && r.compare(n)); +function Sbe(t, e) { + return t == e || !!(t && e && t.compare(e)); } -function aFe(r, n, s, a = 0) { - let l = s.length - 1; - l >= 0 && s[l] + a >= r ? s[l] = Math.max(s[l], n) : s.push(r, n); +function ZA(t, e, r, n = 0) { + let i = r.length - 1; + i >= 0 && r[i] + n >= t ? r[i] = Math.max(r[i], e) : r.push(t, e); } -class jX { - constructor(n, s, a, l) { - this.doc = n, this.pos = s, this.end = a, this.disallowBlockEffectsFor = l, this.content = [], this.curLine = null, this.breakAtStart = 0, this.pendingBuffer = 0, this.bufferMarks = [], this.atCursorPos = !0, this.openStart = -1, this.openEnd = -1, this.text = "", this.textOff = 0, this.cursor = n.iter(), this.skip = s; +class Yv { + constructor(e, r, n, i) { + this.doc = e, this.pos = r, this.end = n, this.disallowBlockEffectsFor = i, this.content = [], this.curLine = null, this.breakAtStart = 0, this.pendingBuffer = 0, this.bufferMarks = [], this.atCursorPos = !0, this.openStart = -1, this.openEnd = -1, this.text = "", this.textOff = 0, this.cursor = e.iter(), this.skip = r; } posCovered() { if (this.content.length == 0) return !this.breakAtStart && this.doc.lineAt(this.pos).from != this.pos; - let n = this.content[this.content.length - 1]; - return !(n.breakAfter || n instanceof t8 && n.deco.endSide < 0); + let e = this.content[this.content.length - 1]; + return !(e.breakAfter || e instanceof Yh && e.deco.endSide < 0); } getLine() { - return this.curLine || (this.content.push(this.curLine = new o0()), this.atCursorPos = !0), this.curLine; + return this.curLine || (this.content.push(this.curLine = new bi()), this.atCursorPos = !0), this.curLine; } - flushBuffer(n = this.bufferMarks) { - this.pendingBuffer && (this.curLine.append(Rge(new sF(-1), n), n.length), this.pendingBuffer = 0); + flushBuffer(e = this.bufferMarks) { + this.pendingBuffer && (this.curLine.append(uw(new Eg(-1), e), e.length), this.pendingBuffer = 0); } - addBlockWidget(n) { - this.flushBuffer(), this.curLine = null, this.content.push(n); + addBlockWidget(e) { + this.flushBuffer(), this.curLine = null, this.content.push(e); } - finish(n) { - this.pendingBuffer && n <= this.bufferMarks.length ? this.flushBuffer() : this.pendingBuffer = 0, !this.posCovered() && !(n && this.content.length && this.content[this.content.length - 1] instanceof t8) && this.getLine(); + finish(e) { + this.pendingBuffer && e <= this.bufferMarks.length ? this.flushBuffer() : this.pendingBuffer = 0, !this.posCovered() && !(e && this.content.length && this.content[this.content.length - 1] instanceof Yh) && this.getLine(); } - buildText(n, s, a) { - for (; n > 0; ) { + buildText(e, r, n) { + for (; e > 0; ) { if (this.textOff == this.text.length) { - let { value: h, lineBreak: f, done: b } = this.cursor.next(this.skip); - if (this.skip = 0, b) + let { value: s, lineBreak: a, done: o } = this.cursor.next(this.skip); + if (this.skip = 0, o) throw new Error("Ran out of text content when drawing inline views"); - if (f) { - this.posCovered() || this.getLine(), this.content.length ? this.content[this.content.length - 1].breakAfter = 1 : this.breakAtStart = 1, this.flushBuffer(), this.curLine = null, this.atCursorPos = !0, n--; + if (a) { + this.posCovered() || this.getLine(), this.content.length ? this.content[this.content.length - 1].breakAfter = 1 : this.breakAtStart = 1, this.flushBuffer(), this.curLine = null, this.atCursorPos = !0, e--; continue; } else - this.text = h, this.textOff = 0; + this.text = s, this.textOff = 0; } - let l = Math.min(this.text.length - this.textOff, n, 512); - this.flushBuffer(s.slice(s.length - a)), this.getLine().append(Rge(new a_(this.text.slice(this.textOff, this.textOff + l)), s), a), this.atCursorPos = !0, this.textOff += l, n -= l, a = 0; + let i = Math.min(this.text.length - this.textOff, e, 512); + this.flushBuffer(r.slice(r.length - n)), this.getLine().append(uw(new $u(this.text.slice(this.textOff, this.textOff + i)), r), n), this.atCursorPos = !0, this.textOff += i, e -= i, n = 0; } } - span(n, s, a, l) { - this.buildText(s - n, a, l), this.pos = s, this.openStart < 0 && (this.openStart = l); + span(e, r, n, i) { + this.buildText(r - e, n, i), this.pos = r, this.openStart < 0 && (this.openStart = i); } - point(n, s, a, l, h, f) { - if (this.disallowBlockEffectsFor[f] && a instanceof p8) { - if (a.block) + point(e, r, n, i, s, a) { + if (this.disallowBlockEffectsFor[a] && n instanceof af) { + if (n.block) throw new RangeError("Block decorations may not be specified via plugins"); - if (s > this.doc.lineAt(this.pos).to) + if (r > this.doc.lineAt(this.pos).to) throw new RangeError("Decorations that replace line breaks may not be specified via plugins"); } - let b = s - n; - if (a instanceof p8) - if (a.block) - a.startSide > 0 && !this.posCovered() && this.getLine(), this.addBlockWidget(new t8(a.widget || new M_t("div"), b, a)); + let o = r - e; + if (n instanceof af) + if (n.block) + n.startSide > 0 && !this.posCovered() && this.getLine(), this.addBlockWidget(new Yh(n.widget || new aB("div"), o, n)); else { - let w = ZT.create(a.widget || new M_t("span"), b, b ? 0 : a.startSide), O = this.atCursorPos && !w.isEditable && h <= l.length && (n < s || a.startSide > 0), S = !w.isEditable && (n < s || h > l.length || a.startSide <= 0), E = this.getLine(); - this.pendingBuffer == 2 && !O && !w.isEditable && (this.pendingBuffer = 0), this.flushBuffer(l), O && (E.append(Rge(new sF(1), l), h), h = l.length + Math.max(0, h - l.length)), E.append(Rge(w, l), h), this.atCursorPos = S, this.pendingBuffer = S ? n < s || h > l.length ? 1 : 2 : 0, this.pendingBuffer && (this.bufferMarks = l.slice()); + let l = Nh.create(n.widget || new aB("span"), o, o ? 0 : n.startSide), u = this.atCursorPos && !l.isEditable && s <= i.length && (e < r || n.startSide > 0), h = !l.isEditable && (e < r || s > i.length || n.startSide <= 0), f = this.getLine(); + this.pendingBuffer == 2 && !u && !l.isEditable && (this.pendingBuffer = 0), this.flushBuffer(i), u && (f.append(uw(new Eg(1), i), s), s = i.length + Math.max(0, s - i.length)), f.append(uw(l, i), s), this.atCursorPos = h, this.pendingBuffer = h ? e < r || s > i.length ? 1 : 2 : 0, this.pendingBuffer && (this.bufferMarks = i.slice()); } else - this.doc.lineAt(this.pos).from == this.pos && this.getLine().addLineDeco(a); - b && (this.textOff + b <= this.text.length ? this.textOff += b : (this.skip += b - (this.text.length - this.textOff), this.text = "", this.textOff = 0), this.pos = s), this.openStart < 0 && (this.openStart = h); + this.doc.lineAt(this.pos).from == this.pos && this.getLine().addLineDeco(n); + o && (this.textOff + o <= this.text.length ? this.textOff += o : (this.skip += o - (this.text.length - this.textOff), this.text = "", this.textOff = 0), this.pos = r), this.openStart < 0 && (this.openStart = s); } - static build(n, s, a, l, h) { - let f = new jX(n, s, a, h); - return f.openEnd = cl.spans(l, s, a, f), f.openStart < 0 && (f.openStart = f.openEnd), f.finish(f.openEnd), f; + static build(e, r, n, i, s) { + let a = new Yv(e, r, n, s); + return a.openEnd = Er.spans(i, r, n, a), a.openStart < 0 && (a.openStart = a.openEnd), a.finish(a.openEnd), a; } } -function Rge(r, n) { - for (let s of n) - r = new c_(s, [r], r.length); - return r; +function uw(t, e) { + for (let r of e) + t = new Bu(r, [t], t.length); + return t; } -class M_t extends uv { - constructor(n) { - super(), this.tag = n; +class aB extends za { + constructor(e) { + super(), this.tag = e; } - eq(n) { - return n.tag == this.tag; + eq(e) { + return e.tag == this.tag; } toDOM() { return document.createElement(this.tag); } - updateDOM(n) { - return n.nodeName.toLowerCase() == this.tag; + updateDOM(e) { + return e.nodeName.toLowerCase() == this.tag; } get isHidden() { return !0; } } -const aMt = /* @__PURE__ */ us.define(), cMt = /* @__PURE__ */ us.define(), lMt = /* @__PURE__ */ us.define(), uMt = /* @__PURE__ */ us.define(), cFe = /* @__PURE__ */ us.define(), hMt = /* @__PURE__ */ us.define(), fMt = /* @__PURE__ */ us.define(), dMt = /* @__PURE__ */ us.define({ - combine: (r) => r.some((n) => n) -}), pMt = /* @__PURE__ */ us.define({ - combine: (r) => r.some((n) => n) +const xj = /* @__PURE__ */ _t.define(), wj = /* @__PURE__ */ _t.define(), Oj = /* @__PURE__ */ _t.define(), kj = /* @__PURE__ */ _t.define(), jA = /* @__PURE__ */ _t.define(), Sj = /* @__PURE__ */ _t.define(), Tj = /* @__PURE__ */ _t.define(), Cj = /* @__PURE__ */ _t.define({ + combine: (t) => t.some((e) => e) +}), Ej = /* @__PURE__ */ _t.define({ + combine: (t) => t.some((e) => e) }); -class LB { - constructor(n, s = "nearest", a = "nearest", l = 5, h = 5, f = !1) { - this.range = n, this.y = s, this.x = a, this.yMargin = l, this.xMargin = h, this.isSnapshot = f; - } - map(n) { - return n.empty ? this : new LB(this.range.map(n), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot); - } - clip(n) { - return this.range.to <= n.doc.length ? this : new LB(sr.cursor(n.doc.length), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot); - } -} -const $ge = /* @__PURE__ */ $o.define({ map: (r, n) => r.map(n) }); -function Yy(r, n, s) { - let a = r.facet(uMt); - a.length ? a[0](n) : window.onerror ? window.onerror(String(n), s, void 0, void 0, n) : s ? console.error(s + ":", n) : console.error(n); -} -const G2e = /* @__PURE__ */ us.define({ combine: (r) => r.length ? r[0] : !0 }); -let Zkn = 0; -const wX = /* @__PURE__ */ us.define(); -class Zu { - constructor(n, s, a, l, h) { - this.id = n, this.create = s, this.domEventHandlers = a, this.domEventObservers = l, this.extension = h(this); - } - static define(n, s) { - const { eventHandlers: a, eventObservers: l, provide: h, decorations: f } = s || {}; - return new Zu(Zkn++, n, a, l, (b) => { - let w = [wX.of(b)]; - return f && w.push(pK.of((O) => { - let S = O.plugin(b); - return S ? f(S) : as.none; - })), h && w.push(h(b)), w; +class Gp { + constructor(e, r = "nearest", n = "nearest", i = 5, s = 5, a = !1) { + this.range = e, this.y = r, this.x = n, this.yMargin = i, this.xMargin = s, this.isSnapshot = a; + } + map(e) { + return e.empty ? this : new Gp(this.range.map(e), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot); + } + clip(e) { + return this.range.to <= e.doc.length ? this : new Gp(Ve.cursor(e.doc.length), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot); + } +} +const hw = /* @__PURE__ */ Zt.define({ map: (t, e) => t.map(e) }); +function Bo(t, e, r) { + let n = t.facet(kj); + n.length ? n[0](e) : window.onerror ? window.onerror(String(e), r, void 0, void 0, e) : r ? console.error(r + ":", e) : console.error(e); +} +const NS = /* @__PURE__ */ _t.define({ combine: (t) => t.length ? t[0] : !0 }); +let Tbe = 0; +const hv = /* @__PURE__ */ _t.define(); +class an { + constructor(e, r, n, i, s) { + this.id = e, this.create = r, this.domEventHandlers = n, this.domEventObservers = i, this.extension = s(this); + } + static define(e, r) { + const { eventHandlers: n, eventObservers: i, provide: s, decorations: a } = r || {}; + return new an(Tbe++, e, n, i, (o) => { + let l = [hv.of(o)]; + return a && l.push(ky.of((u) => { + let h = u.plugin(o); + return h ? a(h) : Et.none; + })), s && l.push(s(o)), l; }); } - static fromClass(n, s) { - return Zu.define((a) => new n(a), s); + static fromClass(e, r) { + return an.define((n) => new e(n), r); } } -class bRe { - constructor(n) { - this.spec = n, this.mustUpdate = null, this.value = null; +class fE { + constructor(e) { + this.spec = e, this.mustUpdate = null, this.value = null; } - update(n) { + update(e) { if (this.value) { if (this.mustUpdate) { - let s = this.mustUpdate; + let r = this.mustUpdate; if (this.mustUpdate = null, this.value.update) try { - this.value.update(s); - } catch (a) { - if (Yy(s.state, a, "CodeMirror plugin crashed"), this.value.destroy) + this.value.update(r); + } catch (n) { + if (Bo(r.state, n, "CodeMirror plugin crashed"), this.value.destroy) try { this.value.destroy(); } catch { @@ -5319,106 +5328,106 @@ class bRe { } } else if (this.spec) try { - this.value = this.spec.create(n); - } catch (s) { - Yy(n.state, s, "CodeMirror plugin crashed"), this.deactivate(); + this.value = this.spec.create(e); + } catch (r) { + Bo(e.state, r, "CodeMirror plugin crashed"), this.deactivate(); } return this; } - destroy(n) { - var s; - if (!((s = this.value) === null || s === void 0) && s.destroy) + destroy(e) { + var r; + if (!((r = this.value) === null || r === void 0) && r.destroy) try { this.value.destroy(); - } catch (a) { - Yy(n.state, a, "CodeMirror plugin crashed"); + } catch (n) { + Bo(e.state, n, "CodeMirror plugin crashed"); } } deactivate() { this.spec = this.value = null; } } -const gMt = /* @__PURE__ */ us.define(), uze = /* @__PURE__ */ us.define(), pK = /* @__PURE__ */ us.define(), hze = /* @__PURE__ */ us.define(), mMt = /* @__PURE__ */ us.define(); -function P_t(r, n, s) { - let a = r.state.facet(mMt); - if (!a.length) - return a; - let l = a.map((f) => f instanceof Function ? f(r) : f), h = []; - return cl.spans(l, n, s, { +const _j = /* @__PURE__ */ _t.define(), PR = /* @__PURE__ */ _t.define(), ky = /* @__PURE__ */ _t.define(), $R = /* @__PURE__ */ _t.define(), Aj = /* @__PURE__ */ _t.define(); +function oB(t, e, r) { + let n = t.state.facet(Aj); + if (!n.length) + return n; + let i = n.map((a) => a instanceof Function ? a(t) : a), s = []; + return Er.spans(i, e, r, { point() { }, - span(f, b, w, O) { - let S = h; - for (let E = w.length - 1; E >= 0; E--, O--) { - let D = w[E].spec.bidiIsolate, M; - if (D != null) - if (O > 0 && S.length && (M = S[S.length - 1]).to == f && M.direction == D) - M.to = b, S = M.inner; + span(a, o, l, u) { + let h = s; + for (let f = l.length - 1; f >= 0; f--, u--) { + let d = l[f].spec.bidiIsolate, p; + if (d != null) + if (u > 0 && h.length && (p = h[h.length - 1]).to == a && p.direction == d) + p.to = o, h = p.inner; else { - let B = { from: f, to: b, direction: D, inner: [] }; - S.push(B), S = B.inner; + let g = { from: a, to: o, direction: d, inner: [] }; + h.push(g), h = g.inner; } } } - }), h; + }), s; } -const bMt = /* @__PURE__ */ us.define(); -function vMt(r) { - let n = 0, s = 0, a = 0, l = 0; - for (let h of r.state.facet(bMt)) { - let f = h(r); - f && (f.left != null && (n = Math.max(n, f.left)), f.right != null && (s = Math.max(s, f.right)), f.top != null && (a = Math.max(a, f.top)), f.bottom != null && (l = Math.max(l, f.bottom))); +const Lj = /* @__PURE__ */ _t.define(); +function Rj(t) { + let e = 0, r = 0, n = 0, i = 0; + for (let s of t.state.facet(Lj)) { + let a = s(t); + a && (a.left != null && (e = Math.max(e, a.left)), a.right != null && (r = Math.max(r, a.right)), a.top != null && (n = Math.max(n, a.top)), a.bottom != null && (i = Math.max(i, a.bottom))); } - return { left: n, right: s, top: a, bottom: l }; + return { left: e, right: r, top: n, bottom: i }; } -const yX = /* @__PURE__ */ us.define(); -class Hy { - constructor(n, s, a, l) { - this.fromA = n, this.toA = s, this.fromB = a, this.toB = l; +const fv = /* @__PURE__ */ _t.define(); +class Fo { + constructor(e, r, n, i) { + this.fromA = e, this.toA = r, this.fromB = n, this.toB = i; } - join(n) { - return new Hy(Math.min(this.fromA, n.fromA), Math.max(this.toA, n.toA), Math.min(this.fromB, n.fromB), Math.max(this.toB, n.toB)); + join(e) { + return new Fo(Math.min(this.fromA, e.fromA), Math.max(this.toA, e.toA), Math.min(this.fromB, e.fromB), Math.max(this.toB, e.toB)); } - addToSet(n) { - let s = n.length, a = this; - for (; s > 0; s--) { - let l = n[s - 1]; - if (!(l.fromA > a.toA)) { - if (l.toA < a.fromA) + addToSet(e) { + let r = e.length, n = this; + for (; r > 0; r--) { + let i = e[r - 1]; + if (!(i.fromA > n.toA)) { + if (i.toA < n.fromA) break; - a = a.join(l), n.splice(s - 1, 1); + n = n.join(i), e.splice(r - 1, 1); } } - return n.splice(s, 0, a), n; + return e.splice(r, 0, n), e; } - static extendWithRanges(n, s) { - if (s.length == 0) - return n; - let a = []; - for (let l = 0, h = 0, f = 0, b = 0; ; l++) { - let w = l == n.length ? null : n[l], O = f - b, S = w ? w.fromB : 1e9; - for (; h < s.length && s[h] < S; ) { - let E = s[h], D = s[h + 1], M = Math.max(b, E), B = Math.min(S, D); - if (M <= B && new Hy(M + O, B + O, M, B).addToSet(a), D > S) + static extendWithRanges(e, r) { + if (r.length == 0) + return e; + let n = []; + for (let i = 0, s = 0, a = 0, o = 0; ; i++) { + let l = i == e.length ? null : e[i], u = a - o, h = l ? l.fromB : 1e9; + for (; s < r.length && r[s] < h; ) { + let f = r[s], d = r[s + 1], p = Math.max(o, f), g = Math.min(h, d); + if (p <= g && new Fo(p + u, g + u, p, g).addToSet(n), d > h) break; - h += 2; + s += 2; } - if (!w) - return a; - new Hy(w.fromA, w.toA, w.fromB, w.toB).addToSet(a), f = w.toA, b = w.toB; + if (!l) + return n; + new Fo(l.fromA, l.toA, l.fromB, l.toB).addToSet(n), a = l.toA, o = l.toB; } } } -class qbe { - constructor(n, s, a) { - this.view = n, this.state = s, this.transactions = a, this.flags = 0, this.startState = n.state, this.changes = f1.empty(this.startState.doc.length); - for (let h of a) - this.changes = this.changes.compose(h.changes); - let l = []; - this.changes.iterChangedRanges((h, f, b, w) => l.push(new Hy(h, f, b, w))), this.changedRanges = l; +class b5 { + constructor(e, r, n) { + this.view = e, this.state = r, this.transactions = n, this.flags = 0, this.startState = e.state, this.changes = ai.empty(this.startState.doc.length); + for (let s of n) + this.changes = this.changes.compose(s.changes); + let i = []; + this.changes.iterChangedRanges((s, a, o, l) => i.push(new Fo(s, a, o, l))), this.changedRanges = i; } - static create(n, s, a) { - return new qbe(n, s, a); + static create(e, r, n) { + return new b5(e, r, n); } get viewportChanged() { return (this.flags & 4) > 0; @@ -5436,1457 +5445,1457 @@ class qbe { return !this.changes.empty; } get selectionSet() { - return this.transactions.some((n) => n.selection); + return this.transactions.some((e) => e.selection); } get empty() { return this.flags == 0 && this.transactions.length == 0; } } -var Cf = /* @__PURE__ */ function(r) { - return r[r.LTR = 0] = "LTR", r[r.RTL = 1] = "RTL", r; -}(Cf || (Cf = {})); -const gK = Cf.LTR, wMt = Cf.RTL; -function yMt(r) { - let n = []; - for (let s = 0; s < r.length; s++) - n.push(1 << +r[s]); - return n; +var Nn = /* @__PURE__ */ function(t) { + return t[t.LTR = 0] = "LTR", t[t.RTL = 1] = "RTL", t; +}(Nn || (Nn = {})); +const Sy = Nn.LTR, Mj = Nn.RTL; +function Dj(t) { + let e = []; + for (let r = 0; r < t.length; r++) + e.push(1 << +t[r]); + return e; } -const Xkn = /* @__PURE__ */ yMt("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"), Kkn = /* @__PURE__ */ yMt("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"), lFe = /* @__PURE__ */ Object.create(null), I4 = []; -for (let r of ["()", "[]", "{}"]) { - let n = /* @__PURE__ */ r.charCodeAt(0), s = /* @__PURE__ */ r.charCodeAt(1); - lFe[n] = s, lFe[s] = -n; +const Cbe = /* @__PURE__ */ Dj("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"), Ebe = /* @__PURE__ */ Dj("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"), KA = /* @__PURE__ */ Object.create(null), jl = []; +for (let t of ["()", "[]", "{}"]) { + let e = /* @__PURE__ */ t.charCodeAt(0), r = /* @__PURE__ */ t.charCodeAt(1); + KA[e] = r, KA[r] = -e; } -function Jkn(r) { - return r <= 247 ? Xkn[r] : 1424 <= r && r <= 1524 ? 2 : 1536 <= r && r <= 1785 ? Kkn[r - 1536] : 1774 <= r && r <= 2220 ? 4 : 8192 <= r && r <= 8204 ? 256 : 64336 <= r && r <= 65023 ? 4 : 1; +function _be(t) { + return t <= 247 ? Cbe[t] : 1424 <= t && t <= 1524 ? 2 : 1536 <= t && t <= 1785 ? Ebe[t - 1536] : 1774 <= t && t <= 2220 ? 4 : 8192 <= t && t <= 8204 ? 256 : 64336 <= t && t <= 65023 ? 4 : 1; } -const e5n = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/; -class XT { +const Abe = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/; +class Ih { get dir() { - return this.level % 2 ? wMt : gK; + return this.level % 2 ? Mj : Sy; } - constructor(n, s, a) { - this.from = n, this.to = s, this.level = a; + constructor(e, r, n) { + this.from = e, this.to = r, this.level = n; } - side(n, s) { - return this.dir == s == n ? this.to : this.from; + side(e, r) { + return this.dir == r == e ? this.to : this.from; } - static find(n, s, a, l) { - let h = -1; - for (let f = 0; f < n.length; f++) { - let b = n[f]; - if (b.from <= s && b.to >= s) { - if (b.level == a) - return f; - (h < 0 || (l != 0 ? l < 0 ? b.from < s : b.to > s : n[h].level > b.level)) && (h = f); + static find(e, r, n, i) { + let s = -1; + for (let a = 0; a < e.length; a++) { + let o = e[a]; + if (o.from <= r && o.to >= r) { + if (o.level == n) + return a; + (s < 0 || (i != 0 ? i < 0 ? o.from < r : o.to > r : e[s].level > o.level)) && (s = a); } } - if (h < 0) + if (s < 0) throw new RangeError("Index out of range"); - return h; + return s; } } -function OMt(r, n) { - if (r.length != n.length) +function Nj(t, e) { + if (t.length != e.length) return !1; - for (let s = 0; s < r.length; s++) { - let a = r[s], l = n[s]; - if (a.from != l.from || a.to != l.to || a.direction != l.direction || !OMt(a.inner, l.inner)) + for (let r = 0; r < t.length; r++) { + let n = t[r], i = e[r]; + if (n.from != i.from || n.to != i.to || n.direction != i.direction || !Nj(n.inner, i.inner)) return !1; } return !0; } -const Wu = []; -function t5n(r, n, s, a, l) { - for (let h = 0; h <= a.length; h++) { - let f = h ? a[h - 1].to : n, b = h < a.length ? a[h].from : s, w = h ? 256 : l; - for (let O = f, S = w, E = w; O < b; O++) { - let D = Jkn(r.charCodeAt(O)); - D == 512 ? D = S : D == 8 && E == 4 && (D = 16), Wu[O] = D == 4 ? 2 : D, D & 7 && (E = D), S = D; - } - for (let O = f, S = w, E = w; O < b; O++) { - let D = Wu[O]; - if (D == 128) - O < b - 1 && S == Wu[O + 1] && S & 24 ? D = Wu[O] = S : Wu[O] = 256; - else if (D == 64) { - let M = O + 1; - for (; M < b && Wu[M] == 64; ) - M++; - let B = O && S == 8 || M < s && Wu[M] == 8 ? E == 1 ? 1 : 8 : 256; - for (let z = O; z < M; z++) - Wu[z] = B; - O = M - 1; +const en = []; +function Lbe(t, e, r, n, i) { + for (let s = 0; s <= n.length; s++) { + let a = s ? n[s - 1].to : e, o = s < n.length ? n[s].from : r, l = s ? 256 : i; + for (let u = a, h = l, f = l; u < o; u++) { + let d = _be(t.charCodeAt(u)); + d == 512 ? d = h : d == 8 && f == 4 && (d = 16), en[u] = d == 4 ? 2 : d, d & 7 && (f = d), h = d; + } + for (let u = a, h = l, f = l; u < o; u++) { + let d = en[u]; + if (d == 128) + u < o - 1 && h == en[u + 1] && h & 24 ? d = en[u] = h : en[u] = 256; + else if (d == 64) { + let p = u + 1; + for (; p < o && en[p] == 64; ) + p++; + let g = u && h == 8 || p < r && en[p] == 8 ? f == 1 ? 1 : 8 : 256; + for (let m = u; m < p; m++) + en[m] = g; + u = p - 1; } else - D == 8 && E == 1 && (Wu[O] = 1); - S = D, D & 7 && (E = D); - } - } -} -function n5n(r, n, s, a, l) { - let h = l == 1 ? 2 : 1; - for (let f = 0, b = 0, w = 0; f <= a.length; f++) { - let O = f ? a[f - 1].to : n, S = f < a.length ? a[f].from : s; - for (let E = O, D, M, B; E < S; E++) - if (M = lFe[D = r.charCodeAt(E)]) - if (M < 0) { - for (let z = b - 3; z >= 0; z -= 3) - if (I4[z + 1] == -M) { - let W = I4[z + 2], H = W & 2 ? l : W & 4 ? W & 1 ? h : l : 0; - H && (Wu[E] = Wu[I4[z]] = H), b = z; + d == 8 && f == 1 && (en[u] = 1); + h = d, d & 7 && (f = d); + } + } +} +function Rbe(t, e, r, n, i) { + let s = i == 1 ? 2 : 1; + for (let a = 0, o = 0, l = 0; a <= n.length; a++) { + let u = a ? n[a - 1].to : e, h = a < n.length ? n[a].from : r; + for (let f = u, d, p, g; f < h; f++) + if (p = KA[d = t.charCodeAt(f)]) + if (p < 0) { + for (let m = o - 3; m >= 0; m -= 3) + if (jl[m + 1] == -p) { + let v = jl[m + 2], y = v & 2 ? i : v & 4 ? v & 1 ? s : i : 0; + y && (en[f] = en[jl[m]] = y), o = m; break; } } else { - if (I4.length == 189) + if (jl.length == 189) break; - I4[b++] = E, I4[b++] = D, I4[b++] = w; - } - else if ((B = Wu[E]) == 2 || B == 1) { - let z = B == l; - w = z ? 0 : 1; - for (let W = b - 3; W >= 0; W -= 3) { - let H = I4[W + 2]; - if (H & 2) + jl[o++] = f, jl[o++] = d, jl[o++] = l; + } + else if ((g = en[f]) == 2 || g == 1) { + let m = g == i; + l = m ? 0 : 1; + for (let v = o - 3; v >= 0; v -= 3) { + let y = jl[v + 2]; + if (y & 2) break; - if (z) - I4[W + 2] |= 2; + if (m) + jl[v + 2] |= 2; else { - if (H & 4) + if (y & 4) break; - I4[W + 2] |= 4; + jl[v + 2] |= 4; } } } } } -function r5n(r, n, s, a) { - for (let l = 0, h = a; l <= s.length; l++) { - let f = l ? s[l - 1].to : r, b = l < s.length ? s[l].from : n; - for (let w = f; w < b; ) { - let O = Wu[w]; - if (O == 256) { - let S = w + 1; +function Mbe(t, e, r, n) { + for (let i = 0, s = n; i <= r.length; i++) { + let a = i ? r[i - 1].to : t, o = i < r.length ? r[i].from : e; + for (let l = a; l < o; ) { + let u = en[l]; + if (u == 256) { + let h = l + 1; for (; ; ) - if (S == b) { - if (l == s.length) + if (h == o) { + if (i == r.length) break; - S = s[l++].to, b = l < s.length ? s[l].from : n; - } else if (Wu[S] == 256) - S++; + h = r[i++].to, o = i < r.length ? r[i].from : e; + } else if (en[h] == 256) + h++; else break; - let E = h == 1, D = (S < n ? Wu[S] : a) == 1, M = E == D ? E ? 1 : 2 : a; - for (let B = S, z = l, W = z ? s[z - 1].to : r; B > w; ) - B == W && (B = s[--z].from, W = z ? s[z - 1].to : r), Wu[--B] = M; - w = S; + let f = s == 1, d = (h < e ? en[h] : n) == 1, p = f == d ? f ? 1 : 2 : n; + for (let g = h, m = i, v = m ? r[m - 1].to : t; g > l; ) + g == v && (g = r[--m].from, v = m ? r[m - 1].to : t), en[--g] = p; + l = h; } else - h = O, w++; + s = u, l++; } } } -function uFe(r, n, s, a, l, h, f) { - let b = a % 2 ? 2 : 1; - if (a % 2 == l % 2) - for (let w = n, O = 0; w < s; ) { - let S = !0, E = !1; - if (O == h.length || w < h[O].from) { - let z = Wu[w]; - z != b && (S = !1, E = z == 16); +function JA(t, e, r, n, i, s, a) { + let o = n % 2 ? 2 : 1; + if (n % 2 == i % 2) + for (let l = e, u = 0; l < r; ) { + let h = !0, f = !1; + if (u == s.length || l < s[u].from) { + let m = en[l]; + m != o && (h = !1, f = m == 16); } - let D = !S && b == 1 ? [] : null, M = S ? a : a + 1, B = w; + let d = !h && o == 1 ? [] : null, p = h ? n : n + 1, g = l; e: for (; ; ) - if (O < h.length && B == h[O].from) { - if (E) + if (u < s.length && g == s[u].from) { + if (f) break e; - let z = h[O]; - if (!S) - for (let W = z.to, H = O + 1; ; ) { - if (W == s) + let m = s[u]; + if (!h) + for (let v = m.to, y = u + 1; ; ) { + if (v == r) break e; - if (H < h.length && h[H].from == W) - W = h[H++].to; + if (y < s.length && s[y].from == v) + v = s[y++].to; else { - if (Wu[W] == b) + if (en[v] == o) break e; break; } } - if (O++, D) - D.push(z); + if (u++, d) + d.push(m); else { - z.from > w && f.push(new XT(w, z.from, M)); - let W = z.direction == gK != !(M % 2); - hFe(r, W ? a + 1 : a, l, z.inner, z.from, z.to, f), w = z.to; + m.from > l && a.push(new Ih(l, m.from, p)); + let v = m.direction == Sy != !(p % 2); + e7(t, v ? n + 1 : n, i, m.inner, m.from, m.to, a), l = m.to; } - B = z.to; + g = m.to; } else { - if (B == s || (S ? Wu[B] != b : Wu[B] == b)) + if (g == r || (h ? en[g] != o : en[g] == o)) break; - B++; + g++; } - D ? uFe(r, w, B, a + 1, l, D, f) : w < B && f.push(new XT(w, B, M)), w = B; + d ? JA(t, l, g, n + 1, i, d, a) : l < g && a.push(new Ih(l, g, p)), l = g; } else - for (let w = s, O = h.length; w > n; ) { - let S = !0, E = !1; - if (!O || w > h[O - 1].to) { - let z = Wu[w - 1]; - z != b && (S = !1, E = z == 16); + for (let l = r, u = s.length; l > e; ) { + let h = !0, f = !1; + if (!u || l > s[u - 1].to) { + let m = en[l - 1]; + m != o && (h = !1, f = m == 16); } - let D = !S && b == 1 ? [] : null, M = S ? a : a + 1, B = w; + let d = !h && o == 1 ? [] : null, p = h ? n : n + 1, g = l; e: for (; ; ) - if (O && B == h[O - 1].to) { - if (E) + if (u && g == s[u - 1].to) { + if (f) break e; - let z = h[--O]; - if (!S) - for (let W = z.from, H = O; ; ) { - if (W == n) + let m = s[--u]; + if (!h) + for (let v = m.from, y = u; ; ) { + if (v == e) break e; - if (H && h[H - 1].to == W) - W = h[--H].from; + if (y && s[y - 1].to == v) + v = s[--y].from; else { - if (Wu[W - 1] == b) + if (en[v - 1] == o) break e; break; } } - if (D) - D.push(z); + if (d) + d.push(m); else { - z.to < w && f.push(new XT(z.to, w, M)); - let W = z.direction == gK != !(M % 2); - hFe(r, W ? a + 1 : a, l, z.inner, z.from, z.to, f), w = z.from; + m.to < l && a.push(new Ih(m.to, l, p)); + let v = m.direction == Sy != !(p % 2); + e7(t, v ? n + 1 : n, i, m.inner, m.from, m.to, a), l = m.from; } - B = z.from; + g = m.from; } else { - if (B == n || (S ? Wu[B - 1] != b : Wu[B - 1] == b)) + if (g == e || (h ? en[g - 1] != o : en[g - 1] == o)) break; - B--; + g--; } - D ? uFe(r, B, w, a + 1, l, D, f) : B < w && f.push(new XT(B, w, M)), w = B; + d ? JA(t, g, l, n + 1, i, d, a) : g < l && a.push(new Ih(g, l, p)), l = g; } } -function hFe(r, n, s, a, l, h, f) { - let b = n % 2 ? 2 : 1; - t5n(r, l, h, a, b), n5n(r, l, h, a, b), r5n(l, h, a, b), uFe(r, l, h, n, s, a, f); +function e7(t, e, r, n, i, s, a) { + let o = e % 2 ? 2 : 1; + Lbe(t, i, s, n, o), Rbe(t, i, s, n, o), Mbe(i, s, n, o), JA(t, i, s, e, r, n, a); } -function i5n(r, n, s) { - if (!r) - return [new XT(0, 0, n == wMt ? 1 : 0)]; - if (n == gK && !s.length && !e5n.test(r)) - return kMt(r.length); - if (s.length) - for (; r.length > Wu.length; ) - Wu[Wu.length] = 256; - let a = [], l = n == gK ? 0 : 1; - return hFe(r, l, l, s, 0, r.length, a), a; -} -function kMt(r) { - return [new XT(0, r, 0)]; -} -let xMt = ""; -function s5n(r, n, s, a, l) { - var h; - let f = a.head - r.from, b = -1; - if (f == 0) { - if (!l || !r.length) +function Dbe(t, e, r) { + if (!t) + return [new Ih(0, 0, e == Mj ? 1 : 0)]; + if (e == Sy && !r.length && !Abe.test(t)) + return Ij(t.length); + if (r.length) + for (; t.length > en.length; ) + en[en.length] = 256; + let n = [], i = e == Sy ? 0 : 1; + return e7(t, i, i, r, 0, t.length, n), n; +} +function Ij(t) { + return [new Ih(0, t, 0)]; +} +let Pj = ""; +function Nbe(t, e, r, n, i) { + var s; + let a = n.head - t.from, o = -1; + if (a == 0) { + if (!i || !t.length) return null; - n[0].level != s && (f = n[0].side(!1, s), b = 0); - } else if (f == r.length) { - if (l) + e[0].level != r && (a = e[0].side(!1, r), o = 0); + } else if (a == t.length) { + if (i) return null; - let D = n[n.length - 1]; - D.level != s && (f = D.side(!0, s), b = n.length - 1); - } - b < 0 && (b = XT.find(n, f, (h = a.bidiLevel) !== null && h !== void 0 ? h : -1, a.assoc)); - let w = n[b]; - f == w.side(l, s) && (w = n[b += l ? 1 : -1], f = w.side(!l, s)); - let O = l == (w.dir == s), S = Np(r.text, f, O); - if (xMt = r.text.slice(Math.min(f, S), Math.max(f, S)), S > w.from && S < w.to) - return sr.cursor(S + r.from, O ? -1 : 1, w.level); - let E = b == (l ? n.length - 1 : 0) ? null : n[b + (l ? 1 : -1)]; - return !E && w.level != s ? sr.cursor(l ? r.to : r.from, l ? -1 : 1, s) : E && E.level < w.level ? sr.cursor(E.side(!l, s) + r.from, l ? 1 : -1, E.level) : sr.cursor(S + r.from, l ? -1 : 1, w.level); -} -class L_t extends Mh { + let d = e[e.length - 1]; + d.level != r && (a = d.side(!0, r), o = e.length - 1); + } + o < 0 && (o = Ih.find(e, a, (s = n.bidiLevel) !== null && s !== void 0 ? s : -1, n.assoc)); + let l = e[o]; + a == l.side(i, r) && (l = e[o += i ? 1 : -1], a = l.side(!i, r)); + let u = i == (l.dir == r), h = ls(t.text, a, u); + if (Pj = t.text.slice(Math.min(a, h), Math.max(a, h)), h > l.from && h < l.to) + return Ve.cursor(h + t.from, u ? -1 : 1, l.level); + let f = o == (i ? e.length - 1 : 0) ? null : e[o + (i ? 1 : -1)]; + return !f && l.level != r ? Ve.cursor(i ? t.to : t.from, i ? -1 : 1, r) : f && f.level < l.level ? Ve.cursor(f.side(!i, r) + t.from, i ? 1 : -1, f.level) : Ve.cursor(h + t.from, i ? -1 : 1, l.level); +} +class lB extends yn { get length() { return this.view.state.doc.length; } - constructor(n) { - super(), this.view = n, this.decorations = [], this.dynamicDecorationMap = [], this.domChanged = null, this.hasComposition = null, this.markedForComposition = /* @__PURE__ */ new Set(), this.minWidth = 0, this.minWidthFrom = 0, this.minWidthTo = 0, this.impreciseAnchor = null, this.impreciseHead = null, this.forceSelection = !1, this.lastUpdate = Date.now(), this.setDOM(n.contentDOM), this.children = [new o0()], this.children[0].setParent(this), this.updateDeco(), this.updateInner([new Hy(0, 0, 0, n.state.doc.length)], 0, null); + constructor(e) { + super(), this.view = e, this.decorations = [], this.dynamicDecorationMap = [], this.domChanged = null, this.hasComposition = null, this.markedForComposition = /* @__PURE__ */ new Set(), this.minWidth = 0, this.minWidthFrom = 0, this.minWidthTo = 0, this.impreciseAnchor = null, this.impreciseHead = null, this.forceSelection = !1, this.lastUpdate = Date.now(), this.setDOM(e.contentDOM), this.children = [new bi()], this.children[0].setParent(this), this.updateDeco(), this.updateInner([new Fo(0, 0, 0, e.state.doc.length)], 0, null); } - update(n) { - var s; - let a = n.changedRanges; - this.minWidth > 0 && a.length && (a.every(({ fromA: O, toA: S }) => S < this.minWidthFrom || O > this.minWidthTo) ? (this.minWidthFrom = n.changes.mapPos(this.minWidthFrom, 1), this.minWidthTo = n.changes.mapPos(this.minWidthTo, 1)) : this.minWidth = this.minWidthFrom = this.minWidthTo = 0); - let l = -1; - this.view.inputState.composing >= 0 && (!((s = this.domChanged) === null || s === void 0) && s.newSel ? l = this.domChanged.newSel.head : !f5n(n.changes, this.hasComposition) && !n.selectionSet && (l = n.state.selection.main.head)); - let h = l > -1 ? a5n(this.view, n.changes, l) : null; + update(e) { + var r; + let n = e.changedRanges; + this.minWidth > 0 && n.length && (n.every(({ fromA: u, toA: h }) => h < this.minWidthFrom || u > this.minWidthTo) ? (this.minWidthFrom = e.changes.mapPos(this.minWidthFrom, 1), this.minWidthTo = e.changes.mapPos(this.minWidthTo, 1)) : this.minWidth = this.minWidthFrom = this.minWidthTo = 0); + let i = -1; + this.view.inputState.composing >= 0 && (!((r = this.domChanged) === null || r === void 0) && r.newSel ? i = this.domChanged.newSel.head : !Vbe(e.changes, this.hasComposition) && !e.selectionSet && (i = e.state.selection.main.head)); + let s = i > -1 ? Pbe(this.view, e.changes, i) : null; if (this.domChanged = null, this.hasComposition) { this.markedForComposition.clear(); - let { from: O, to: S } = this.hasComposition; - a = new Hy(O, S, n.changes.mapPos(O, -1), n.changes.mapPos(S, 1)).addToSet(a.slice()); + let { from: u, to: h } = this.hasComposition; + n = new Fo(u, h, e.changes.mapPos(u, -1), e.changes.mapPos(h, 1)).addToSet(n.slice()); } - this.hasComposition = h ? { from: h.range.fromB, to: h.range.toB } : null, (Fs.ie || Fs.chrome) && !h && n && n.state.doc.lines != n.startState.doc.lines && (this.forceSelection = !0); - let f = this.decorations, b = this.updateDeco(), w = u5n(f, b, n.changes); - return a = Hy.extendWithRanges(a, w), !(this.flags & 7) && a.length == 0 ? !1 : (this.updateInner(a, n.startState.doc.length, h), n.transactions.length && (this.lastUpdate = Date.now()), !0); + this.hasComposition = s ? { from: s.range.fromB, to: s.range.toB } : null, (Mt.ie || Mt.chrome) && !s && e && e.state.doc.lines != e.startState.doc.lines && (this.forceSelection = !0); + let a = this.decorations, o = this.updateDeco(), l = Fbe(a, o, e.changes); + return n = Fo.extendWithRanges(n, l), !(this.flags & 7) && n.length == 0 ? !1 : (this.updateInner(n, e.startState.doc.length, s), e.transactions.length && (this.lastUpdate = Date.now()), !0); } - updateInner(n, s, a) { - this.view.viewState.mustMeasureContent = !0, this.updateChildren(n, s, a); - let { observer: l } = this.view; - l.ignore(() => { + updateInner(e, r, n) { + this.view.viewState.mustMeasureContent = !0, this.updateChildren(e, r, n); + let { observer: i } = this.view; + i.ignore(() => { this.dom.style.height = this.view.viewState.contentHeight / this.view.scaleY + "px", this.dom.style.flexBasis = this.minWidth ? this.minWidth + "px" : ""; - let f = Fs.chrome || Fs.ios ? { node: l.selectionRange.focusNode, written: !1 } : void 0; - this.sync(this.view, f), this.flags &= -8, f && (f.written || l.selectionRange.focusNode != f.node) && (this.forceSelection = !0), this.dom.style.height = ""; - }), this.markedForComposition.forEach((f) => f.flags &= -9); - let h = []; + let a = Mt.chrome || Mt.ios ? { node: i.selectionRange.focusNode, written: !1 } : void 0; + this.sync(this.view, a), this.flags &= -8, a && (a.written || i.selectionRange.focusNode != a.node) && (this.forceSelection = !0), this.dom.style.height = ""; + }), this.markedForComposition.forEach((a) => a.flags &= -9); + let s = []; if (this.view.viewport.from || this.view.viewport.to < this.view.state.doc.length) - for (let f of this.children) - f instanceof t8 && f.widget instanceof I_t && h.push(f.dom); - l.updateGaps(h); - } - updateChildren(n, s, a) { - let l = a ? a.range.addToSet(n.slice()) : n, h = this.childCursor(s); - for (let f = l.length - 1; ; f--) { - let b = f >= 0 ? l[f] : null; - if (!b) + for (let a of this.children) + a instanceof Yh && a.widget instanceof cB && s.push(a.dom); + i.updateGaps(s); + } + updateChildren(e, r, n) { + let i = n ? n.range.addToSet(e.slice()) : e, s = this.childCursor(r); + for (let a = i.length - 1; ; a--) { + let o = a >= 0 ? i[a] : null; + if (!o) break; - let { fromA: w, toA: O, fromB: S, toB: E } = b, D, M, B, z; - if (a && a.range.fromB < E && a.range.toB > S) { - let le = jX.build(this.view.state.doc, S, a.range.fromB, this.decorations, this.dynamicDecorationMap), se = jX.build(this.view.state.doc, a.range.toB, E, this.decorations, this.dynamicDecorationMap); - M = le.breakAtStart, B = le.openStart, z = se.openEnd; - let he = this.compositionView(a); - se.breakAtStart ? he.breakAfter = 1 : se.content.length && he.merge(he.length, he.length, se.content[0], !1, se.openStart, 0) && (he.breakAfter = se.content[0].breakAfter, se.content.shift()), le.content.length && he.merge(0, 0, le.content[le.content.length - 1], !0, 0, le.openEnd) && le.content.pop(), D = le.content.concat(he).concat(se.content); + let { fromA: l, toA: u, fromB: h, toB: f } = o, d, p, g, m; + if (n && n.range.fromB < f && n.range.toB > h) { + let O = Yv.build(this.view.state.doc, h, n.range.fromB, this.decorations, this.dynamicDecorationMap), S = Yv.build(this.view.state.doc, n.range.toB, f, this.decorations, this.dynamicDecorationMap); + p = O.breakAtStart, g = O.openStart, m = S.openEnd; + let C = this.compositionView(n); + S.breakAtStart ? C.breakAfter = 1 : S.content.length && C.merge(C.length, C.length, S.content[0], !1, S.openStart, 0) && (C.breakAfter = S.content[0].breakAfter, S.content.shift()), O.content.length && C.merge(0, 0, O.content[O.content.length - 1], !0, 0, O.openEnd) && O.content.pop(), d = O.content.concat(C).concat(S.content); } else - ({ content: D, breakAtStart: M, openStart: B, openEnd: z } = jX.build(this.view.state.doc, S, E, this.decorations, this.dynamicDecorationMap)); - let { i: W, off: H } = h.findPos(O, 1), { i: G, off: ee } = h.findPos(w, -1); - JDt(this, G, ee, W, H, D, M, B, z); - } - a && this.fixCompositionDOM(a); - } - compositionView(n) { - let s = new a_(n.text.nodeValue); - s.flags |= 8; - for (let { deco: l } of n.marks) - s = new c_(l, [s], s.length); - let a = new o0(); - return a.append(s, 0), a; - } - fixCompositionDOM(n) { - let s = (h, f) => { - f.flags |= 8 | (f.children.some((w) => w.flags & 7) ? 1 : 0), this.markedForComposition.add(f); - let b = Mh.get(h); - b && b != f && (b.dom = null), f.setDOM(h); - }, a = this.childPos(n.range.fromB, 1), l = this.children[a.i]; - s(n.line, l); - for (let h = n.marks.length - 1; h >= -1; h--) - a = l.childPos(a.off, 1), l = l.children[a.i], s(h >= 0 ? n.marks[h].node : n.text, l); - } - updateSelection(n = !1, s = !1) { - (n || !this.view.observer.selectionRange.focusNode) && this.view.observer.readSelectionRange(); - let a = this.view.root.activeElement, l = a == this.dom, h = !l && Wme(this.dom, this.view.observer.selectionRange) && !(a && this.dom.contains(a)); - if (!(l || s || h)) + ({ content: d, breakAtStart: p, openStart: g, openEnd: m } = Yv.build(this.view.state.doc, h, f, this.decorations, this.dynamicDecorationMap)); + let { i: v, off: y } = s.findPos(u, 1), { i: b, off: w } = s.findPos(l, -1); + fj(this, b, w, v, y, d, p, g, m); + } + n && this.fixCompositionDOM(n); + } + compositionView(e) { + let r = new $u(e.text.nodeValue); + r.flags |= 8; + for (let { deco: i } of e.marks) + r = new Bu(i, [r], r.length); + let n = new bi(); + return n.append(r, 0), n; + } + fixCompositionDOM(e) { + let r = (s, a) => { + a.flags |= 8 | (a.children.some((l) => l.flags & 7) ? 1 : 0), this.markedForComposition.add(a); + let o = yn.get(s); + o && o != a && (o.dom = null), a.setDOM(s); + }, n = this.childPos(e.range.fromB, 1), i = this.children[n.i]; + r(e.line, i); + for (let s = e.marks.length - 1; s >= -1; s--) + n = i.childPos(n.off, 1), i = i.children[n.i], r(s >= 0 ? e.marks[s].node : e.text, i); + } + updateSelection(e = !1, r = !1) { + (e || !this.view.observer.selectionRange.focusNode) && this.view.observer.readSelectionRange(); + let n = this.view.root.activeElement, i = n == this.dom, s = !i && n4(this.dom, this.view.observer.selectionRange) && !(n && this.dom.contains(n)); + if (!(i || r || s)) return; - let f = this.forceSelection; + let a = this.forceSelection; this.forceSelection = !1; - let b = this.view.state.selection.main, w = this.moveToLine(this.domAtPos(b.anchor)), O = b.empty ? w : this.moveToLine(this.domAtPos(b.head)); - if (Fs.gecko && b.empty && !this.hasComposition && o5n(w)) { - let E = document.createTextNode(""); - this.view.observer.ignore(() => w.node.insertBefore(E, w.node.childNodes[w.offset] || null)), w = O = new xg(E, 0), f = !0; - } - let S = this.view.observer.selectionRange; - (f || !S.focusNode || !zbe(w.node, w.offset, S.anchorNode, S.anchorOffset) || !zbe(O.node, O.offset, S.focusNode, S.focusOffset)) && (this.view.observer.ignore(() => { - Fs.android && Fs.chrome && this.dom.contains(S.focusNode) && h5n(S.focusNode, this.dom) && (this.dom.blur(), this.dom.focus({ preventScroll: !0 })); - let E = Qbe(this.view.root); - if (E) - if (b.empty) { - if (Fs.gecko) { - let D = c5n(w.node, w.offset); - if (D && D != 3) { - let M = _Mt(w.node, w.offset, D == 1 ? 1 : -1); - M && (w = new xg(M.node, M.offset)); + let o = this.view.state.selection.main, l = this.moveToLine(this.domAtPos(o.anchor)), u = o.empty ? l : this.moveToLine(this.domAtPos(o.head)); + if (Mt.gecko && o.empty && !this.hasComposition && Ibe(l)) { + let f = document.createTextNode(""); + this.view.observer.ignore(() => l.node.insertBefore(f, l.node.childNodes[l.offset] || null)), l = u = new Ms(f, 0), a = !0; + } + let h = this.view.observer.selectionRange; + (a || !h.focusNode || !y5(l.node, l.offset, h.anchorNode, h.anchorOffset) || !y5(u.node, u.offset, h.focusNode, h.focusOffset)) && (this.view.observer.ignore(() => { + Mt.android && Mt.chrome && this.dom.contains(h.focusNode) && zbe(h.focusNode, this.dom) && (this.dom.blur(), this.dom.focus({ preventScroll: !0 })); + let f = v5(this.view.root); + if (f) + if (o.empty) { + if (Mt.gecko) { + let d = $be(l.node, l.offset); + if (d && d != 3) { + let p = Bj(l.node, l.offset, d == 1 ? 1 : -1); + p && (l = new Ms(p.node, p.offset)); } } - E.collapse(w.node, w.offset), b.bidiLevel != null && E.caretBidiLevel !== void 0 && (E.caretBidiLevel = b.bidiLevel); - } else if (E.extend) { - E.collapse(w.node, w.offset); + f.collapse(l.node, l.offset), o.bidiLevel != null && f.caretBidiLevel !== void 0 && (f.caretBidiLevel = o.bidiLevel); + } else if (f.extend) { + f.collapse(l.node, l.offset); try { - E.extend(O.node, O.offset); + f.extend(u.node, u.offset); } catch { } } else { - let D = document.createRange(); - b.anchor > b.head && ([w, O] = [O, w]), D.setEnd(O.node, O.offset), D.setStart(w.node, w.offset), E.removeAllRanges(), E.addRange(D); + let d = document.createRange(); + o.anchor > o.head && ([l, u] = [u, l]), d.setEnd(u.node, u.offset), d.setStart(l.node, l.offset), f.removeAllRanges(), f.addRange(d); } - h && this.view.root.activeElement == this.dom && (this.dom.blur(), a && a.focus()); - }), this.view.observer.setSelectionRange(w, O)), this.impreciseAnchor = w.precise ? null : new xg(S.anchorNode, S.anchorOffset), this.impreciseHead = O.precise ? null : new xg(S.focusNode, S.focusOffset); + s && this.view.root.activeElement == this.dom && (this.dom.blur(), n && n.focus()); + }), this.view.observer.setSelectionRange(l, u)), this.impreciseAnchor = l.precise ? null : new Ms(h.anchorNode, h.anchorOffset), this.impreciseHead = u.precise ? null : new Ms(h.focusNode, h.focusOffset); } enforceCursorAssoc() { if (this.hasComposition) return; - let { view: n } = this, s = n.state.selection.main, a = Qbe(n.root), { anchorNode: l, anchorOffset: h } = n.observer.selectionRange; - if (!a || !s.empty || !s.assoc || !a.modify) + let { view: e } = this, r = e.state.selection.main, n = v5(e.root), { anchorNode: i, anchorOffset: s } = e.observer.selectionRange; + if (!n || !r.empty || !r.assoc || !n.modify) return; - let f = o0.find(this, s.head); - if (!f) + let a = bi.find(this, r.head); + if (!a) return; - let b = f.posAtStart; - if (s.head == b || s.head == b + f.length) + let o = a.posAtStart; + if (r.head == o || r.head == o + a.length) return; - let w = this.coordsAt(s.head, -1), O = this.coordsAt(s.head, 1); - if (!w || !O || w.bottom > O.top) + let l = this.coordsAt(r.head, -1), u = this.coordsAt(r.head, 1); + if (!l || !u || l.bottom > u.top) return; - let S = this.domAtPos(s.head + s.assoc); - a.collapse(S.node, S.offset), a.modify("move", s.assoc < 0 ? "forward" : "backward", "lineboundary"), n.observer.readSelectionRange(); - let E = n.observer.selectionRange; - n.docView.posFromDOM(E.anchorNode, E.anchorOffset) != s.from && a.collapse(l, h); - } - moveToLine(n) { - let s = this.dom, a; - if (n.node != s) - return n; - for (let l = n.offset; !a && l < s.childNodes.length; l++) { - let h = Mh.get(s.childNodes[l]); - h instanceof o0 && (a = h.domAtPos(0)); - } - for (let l = n.offset - 1; !a && l >= 0; l--) { - let h = Mh.get(s.childNodes[l]); - h instanceof o0 && (a = h.domAtPos(h.length)); - } - return a ? new xg(a.node, a.offset, !0) : n; - } - nearest(n) { - for (let s = n; s; ) { - let a = Mh.get(s); - if (a && a.rootView == this) - return a; - s = s.parentNode; + let h = this.domAtPos(r.head + r.assoc); + n.collapse(h.node, h.offset), n.modify("move", r.assoc < 0 ? "forward" : "backward", "lineboundary"), e.observer.readSelectionRange(); + let f = e.observer.selectionRange; + e.docView.posFromDOM(f.anchorNode, f.anchorOffset) != r.from && n.collapse(i, s); + } + moveToLine(e) { + let r = this.dom, n; + if (e.node != r) + return e; + for (let i = e.offset; !n && i < r.childNodes.length; i++) { + let s = yn.get(r.childNodes[i]); + s instanceof bi && (n = s.domAtPos(0)); + } + for (let i = e.offset - 1; !n && i >= 0; i--) { + let s = yn.get(r.childNodes[i]); + s instanceof bi && (n = s.domAtPos(s.length)); + } + return n ? new Ms(n.node, n.offset, !0) : e; + } + nearest(e) { + for (let r = e; r; ) { + let n = yn.get(r); + if (n && n.rootView == this) + return n; + r = r.parentNode; } return null; } - posFromDOM(n, s) { - let a = this.nearest(n); - if (!a) + posFromDOM(e, r) { + let n = this.nearest(e); + if (!n) throw new RangeError("Trying to find position for a DOM position outside of the document"); - return a.localPosFromDOM(n, s) + a.posAtStart; + return n.localPosFromDOM(e, r) + n.posAtStart; } - domAtPos(n) { - let { i: s, off: a } = this.childCursor().findPos(n, -1); - for (; s < this.children.length - 1; ) { - let l = this.children[s]; - if (a < l.length || l instanceof o0) + domAtPos(e) { + let { i: r, off: n } = this.childCursor().findPos(e, -1); + for (; r < this.children.length - 1; ) { + let i = this.children[r]; + if (n < i.length || i instanceof bi) break; - s++, a = 0; + r++, n = 0; } - return this.children[s].domAtPos(a); + return this.children[r].domAtPos(n); } - coordsAt(n, s) { - let a = null, l = 0; - for (let h = this.length, f = this.children.length - 1; f >= 0; f--) { - let b = this.children[f], w = h - b.breakAfter, O = w - b.length; - if (w < n) + coordsAt(e, r) { + let n = null, i = 0; + for (let s = this.length, a = this.children.length - 1; a >= 0; a--) { + let o = this.children[a], l = s - o.breakAfter, u = l - o.length; + if (l < e) break; - O <= n && (O < n || b.covers(-1)) && (w > n || b.covers(1)) && (!a || b instanceof o0 && !(a instanceof o0 && s >= 0)) && (a = b, l = O), h = O; + u <= e && (u < e || o.covers(-1)) && (l > e || o.covers(1)) && (!n || o instanceof bi && !(n instanceof bi && r >= 0)) && (n = o, i = u), s = u; } - return a ? a.coordsAt(n - l, s) : null; + return n ? n.coordsAt(e - i, r) : null; } - coordsForChar(n) { - let { i: s, off: a } = this.childPos(n, 1), l = this.children[s]; - if (!(l instanceof o0)) + coordsForChar(e) { + let { i: r, off: n } = this.childPos(e, 1), i = this.children[r]; + if (!(i instanceof bi)) return null; - for (; l.children.length; ) { - let { i: b, off: w } = l.childPos(a, 1); - for (; ; b++) { - if (b == l.children.length) + for (; i.children.length; ) { + let { i: o, off: l } = i.childPos(n, 1); + for (; ; o++) { + if (o == i.children.length) return null; - if ((l = l.children[b]).length) + if ((i = i.children[o]).length) break; } - a = w; + n = l; } - if (!(l instanceof a_)) + if (!(i instanceof $u)) return null; - let h = Np(l.text, a); - if (h == a) + let s = ls(i.text, n); + if (s == n) return null; - let f = sP(l.dom, a, h).getClientRects(); - for (let b = 0; b < f.length; b++) { - let w = f[b]; - if (b == f.length - 1 || w.top < w.bottom && w.left < w.right) - return w; + let a = Zd(i.dom, n, s).getClientRects(); + for (let o = 0; o < a.length; o++) { + let l = a[o]; + if (o == a.length - 1 || l.top < l.bottom && l.left < l.right) + return l; } return null; } - measureVisibleLineHeights(n) { - let s = [], { from: a, to: l } = n, h = this.view.contentDOM.clientWidth, f = h > Math.max(this.view.scrollDOM.clientWidth, this.minWidth) + 1, b = -1, w = this.view.textDirection == Cf.LTR; - for (let O = 0, S = 0; S < this.children.length; S++) { - let E = this.children[S], D = O + E.length; - if (D > l) + measureVisibleLineHeights(e) { + let r = [], { from: n, to: i } = e, s = this.view.contentDOM.clientWidth, a = s > Math.max(this.view.scrollDOM.clientWidth, this.minWidth) + 1, o = -1, l = this.view.textDirection == Nn.LTR; + for (let u = 0, h = 0; h < this.children.length; h++) { + let f = this.children[h], d = u + f.length; + if (d > i) break; - if (O >= a) { - let M = E.dom.getBoundingClientRect(); - if (s.push(M.height), f) { - let B = E.dom.lastChild, z = B ? fK(B) : []; - if (z.length) { - let W = z[z.length - 1], H = w ? W.right - M.left : M.right - W.left; - H > b && (b = H, this.minWidth = h, this.minWidthFrom = O, this.minWidthTo = D); + if (u >= n) { + let p = f.dom.getBoundingClientRect(); + if (r.push(p.height), a) { + let g = f.dom.lastChild, m = g ? wy(g) : []; + if (m.length) { + let v = m[m.length - 1], y = l ? v.right - p.left : p.right - v.left; + y > o && (o = y, this.minWidth = s, this.minWidthFrom = u, this.minWidthTo = d); } } } - O = D + E.breakAfter; + u = d + f.breakAfter; } - return s; + return r; } - textDirectionAt(n) { - let { i: s } = this.childPos(n, 1); - return getComputedStyle(this.children[s].dom).direction == "rtl" ? Cf.RTL : Cf.LTR; + textDirectionAt(e) { + let { i: r } = this.childPos(e, 1); + return getComputedStyle(this.children[r].dom).direction == "rtl" ? Nn.RTL : Nn.LTR; } measureTextSize() { - for (let h of this.children) - if (h instanceof o0) { - let f = h.measureTextSize(); - if (f) - return f; - } - let n = document.createElement("div"), s, a, l; - return n.className = "cm-line", n.style.width = "99999px", n.style.position = "absolute", n.textContent = "abc def ghi jkl mno pqr stu", this.view.observer.ignore(() => { - this.dom.appendChild(n); - let h = fK(n.firstChild)[0]; - s = n.getBoundingClientRect().height, a = h ? h.width / 27 : 7, l = h ? h.height : s, n.remove(); - }), { lineHeight: s, charWidth: a, textHeight: l }; - } - childCursor(n = this.length) { - let s = this.children.length; - return s && (n -= this.children[--s].length), new KDt(this.children, n, s); + for (let s of this.children) + if (s instanceof bi) { + let a = s.measureTextSize(); + if (a) + return a; + } + let e = document.createElement("div"), r, n, i; + return e.className = "cm-line", e.style.width = "99999px", e.style.position = "absolute", e.textContent = "abc def ghi jkl mno pqr stu", this.view.observer.ignore(() => { + this.dom.appendChild(e); + let s = wy(e.firstChild)[0]; + r = e.getBoundingClientRect().height, n = s ? s.width / 27 : 7, i = s ? s.height : r, e.remove(); + }), { lineHeight: r, charWidth: n, textHeight: i }; + } + childCursor(e = this.length) { + let r = this.children.length; + return r && (e -= this.children[--r].length), new hj(this.children, e, r); } computeBlockGapDeco() { - let n = [], s = this.view.viewState; - for (let a = 0, l = 0; ; l++) { - let h = l == s.viewports.length ? null : s.viewports[l], f = h ? h.from - 1 : this.length; - if (f > a) { - let b = (s.lineBlockAt(f).bottom - s.lineBlockAt(a).top) / this.view.scaleY; - n.push(as.replace({ - widget: new I_t(b), + let e = [], r = this.view.viewState; + for (let n = 0, i = 0; ; i++) { + let s = i == r.viewports.length ? null : r.viewports[i], a = s ? s.from - 1 : this.length; + if (a > n) { + let o = (r.lineBlockAt(a).bottom - r.lineBlockAt(n).top) / this.view.scaleY; + e.push(Et.replace({ + widget: new cB(o), block: !0, inclusive: !0, isBlockGap: !0 - }).range(a, f)); + }).range(n, a)); } - if (!h) + if (!s) break; - a = h.to + 1; + n = s.to + 1; } - return as.set(n); + return Et.set(e); } updateDeco() { - let n = this.view.state.facet(pK).map((s, a) => (this.dynamicDecorationMap[a] = typeof s == "function") ? s(this.view) : s); - for (let s = n.length; s < n.length + 3; s++) - this.dynamicDecorationMap[s] = !1; + let e = this.view.state.facet(ky).map((r, n) => (this.dynamicDecorationMap[n] = typeof r == "function") ? r(this.view) : r); + for (let r = e.length; r < e.length + 3; r++) + this.dynamicDecorationMap[r] = !1; return this.decorations = [ - ...n, + ...e, this.computeBlockGapDeco(), this.view.viewState.lineGapDeco ]; } - scrollIntoView(n) { - if (n.isSnapshot) { - let O = this.view.viewState.lineBlockAt(n.range.head); - this.view.scrollDOM.scrollTop = O.top - n.yMargin, this.view.scrollDOM.scrollLeft = n.xMargin; + scrollIntoView(e) { + if (e.isSnapshot) { + let u = this.view.viewState.lineBlockAt(e.range.head); + this.view.scrollDOM.scrollTop = u.top - e.yMargin, this.view.scrollDOM.scrollLeft = e.xMargin; return; } - let { range: s } = n, a = this.coordsAt(s.head, s.empty ? s.assoc : s.head > s.anchor ? -1 : 1), l; - if (!a) + let { range: r } = e, n = this.coordsAt(r.head, r.empty ? r.assoc : r.head > r.anchor ? -1 : 1), i; + if (!n) return; - !s.empty && (l = this.coordsAt(s.anchor, s.anchor > s.head ? -1 : 1)) && (a = { - left: Math.min(a.left, l.left), - top: Math.min(a.top, l.top), - right: Math.max(a.right, l.right), - bottom: Math.max(a.bottom, l.bottom) + !r.empty && (i = this.coordsAt(r.anchor, r.anchor > r.head ? -1 : 1)) && (n = { + left: Math.min(n.left, i.left), + top: Math.min(n.top, i.top), + right: Math.max(n.right, i.right), + bottom: Math.max(n.bottom, i.bottom) }); - let h = vMt(this.view), f = { - left: a.left - h.left, - top: a.top - h.top, - right: a.right + h.right, - bottom: a.bottom + h.bottom - }, { offsetWidth: b, offsetHeight: w } = this.view.scrollDOM; - jkn(this.view.scrollDOM, f, s.head < s.anchor ? -1 : 1, n.x, n.y, Math.max(Math.min(n.xMargin, b), -b), Math.max(Math.min(n.yMargin, w), -w), this.view.textDirection == Cf.LTR); + let s = Rj(this.view), a = { + left: n.left - s.left, + top: n.top - s.top, + right: n.right + s.right, + bottom: n.bottom + s.bottom + }, { offsetWidth: o, offsetHeight: l } = this.view.scrollDOM; + gbe(this.view.scrollDOM, a, r.head < r.anchor ? -1 : 1, e.x, e.y, Math.max(Math.min(e.xMargin, o), -o), Math.max(Math.min(e.yMargin, l), -l), this.view.textDirection == Nn.LTR); } } -function o5n(r) { - return r.node.nodeType == 1 && r.node.firstChild && (r.offset == 0 || r.node.childNodes[r.offset - 1].contentEditable == "false") && (r.offset == r.node.childNodes.length || r.node.childNodes[r.offset].contentEditable == "false"); +function Ibe(t) { + return t.node.nodeType == 1 && t.node.firstChild && (t.offset == 0 || t.node.childNodes[t.offset - 1].contentEditable == "false") && (t.offset == t.node.childNodes.length || t.node.childNodes[t.offset].contentEditable == "false"); } -class I_t extends uv { - constructor(n) { - super(), this.height = n; +class cB extends za { + constructor(e) { + super(), this.height = e; } toDOM() { - let n = document.createElement("div"); - return this.updateDOM(n), n; + let e = document.createElement("div"); + return this.updateDOM(e), e; } - eq(n) { - return n.height == this.height; + eq(e) { + return e.height == this.height; } - updateDOM(n) { - return n.style.height = this.height + "px", !0; + updateDOM(e) { + return e.style.height = this.height + "px", !0; } get estimatedHeight() { return this.height; } } -function SMt(r, n) { - let s = r.observer.selectionRange, a = s.focusNode && _Mt(s.focusNode, s.focusOffset, 0); - if (!a) +function $j(t, e) { + let r = t.observer.selectionRange, n = r.focusNode && Bj(r.focusNode, r.focusOffset, 0); + if (!n) return null; - let l = n - a.offset; - return { from: l, to: l + a.node.nodeValue.length, node: a.node }; + let i = e - n.offset; + return { from: i, to: i + n.node.nodeValue.length, node: n.node }; } -function a5n(r, n, s) { - let a = SMt(r, s); - if (!a) +function Pbe(t, e, r) { + let n = $j(t, r); + if (!n) return null; - let { node: l, from: h, to: f } = a, b = l.nodeValue; - if (/[\n\r]/.test(b) || r.state.doc.sliceString(a.from, a.to) != b) + let { node: i, from: s, to: a } = n, o = i.nodeValue; + if (/[\n\r]/.test(o) || t.state.doc.sliceString(n.from, n.to) != o) return null; - let w = n.invertedDesc, O = new Hy(w.mapPos(h), w.mapPos(f), h, f), S = []; - for (let E = l.parentNode; ; E = E.parentNode) { - let D = Mh.get(E); - if (D instanceof c_) - S.push({ node: E, deco: D.mark }); + let l = e.invertedDesc, u = new Fo(l.mapPos(s), l.mapPos(a), s, a), h = []; + for (let f = i.parentNode; ; f = f.parentNode) { + let d = yn.get(f); + if (d instanceof Bu) + h.push({ node: f, deco: d.mark }); else { - if (D instanceof o0 || E.nodeName == "DIV" && E.parentNode == r.contentDOM) - return { range: O, text: l, marks: S, line: E }; - if (E != r.contentDOM) - S.push({ node: E, deco: new DJ({ + if (d instanceof bi || f.nodeName == "DIV" && f.parentNode == t.contentDOM) + return { range: u, text: i, marks: h, line: f }; + if (f != t.contentDOM) + h.push({ node: f, deco: new Ub({ inclusive: !0, - attributes: Hkn(E), - tagName: E.tagName.toLowerCase() + attributes: kbe(f), + tagName: f.tagName.toLowerCase() }) }); else return null; } } } -function _Mt(r, n, s) { - if (s <= 0) - for (let a = r, l = n; ; ) { - if (a.nodeType == 3) - return { node: a, offset: l }; - if (a.nodeType == 1 && l > 0) - a = a.childNodes[l - 1], l = o_(a); +function Bj(t, e, r) { + if (r <= 0) + for (let n = t, i = e; ; ) { + if (n.nodeType == 3) + return { node: n, offset: i }; + if (n.nodeType == 1 && i > 0) + n = n.childNodes[i - 1], i = Pu(n); else break; } - if (s >= 0) - for (let a = r, l = n; ; ) { - if (a.nodeType == 3) - return { node: a, offset: l }; - if (a.nodeType == 1 && l < a.childNodes.length && s >= 0) - a = a.childNodes[l], l = 0; + if (r >= 0) + for (let n = t, i = e; ; ) { + if (n.nodeType == 3) + return { node: n, offset: i }; + if (n.nodeType == 1 && i < n.childNodes.length && r >= 0) + n = n.childNodes[i], i = 0; else break; } return null; } -function c5n(r, n) { - return r.nodeType != 1 ? 0 : (n && r.childNodes[n - 1].contentEditable == "false" ? 1 : 0) | (n < r.childNodes.length && r.childNodes[n].contentEditable == "false" ? 2 : 0); +function $be(t, e) { + return t.nodeType != 1 ? 0 : (e && t.childNodes[e - 1].contentEditable == "false" ? 1 : 0) | (e < t.childNodes.length && t.childNodes[e].contentEditable == "false" ? 2 : 0); } -let l5n = class { +let Bbe = class { constructor() { this.changes = []; } - compareRange(n, s) { - aFe(n, s, this.changes); + compareRange(e, r) { + ZA(e, r, this.changes); } - comparePoint(n, s) { - aFe(n, s, this.changes); + comparePoint(e, r) { + ZA(e, r, this.changes); } }; -function u5n(r, n, s) { - let a = new l5n(); - return cl.compare(r, n, s, a), a.changes; +function Fbe(t, e, r) { + let n = new Bbe(); + return Er.compare(t, e, r, n), n.changes; } -function h5n(r, n) { - for (let s = r; s && s != n; s = s.assignedSlot || s.parentNode) - if (s.nodeType == 1 && s.contentEditable == "false") +function zbe(t, e) { + for (let r = t; r && r != e; r = r.assignedSlot || r.parentNode) + if (r.nodeType == 1 && r.contentEditable == "false") return !0; return !1; } -function f5n(r, n) { - let s = !1; - return n && r.iterChangedRanges((a, l) => { - a < n.to && l > n.from && (s = !0); - }), s; +function Vbe(t, e) { + let r = !1; + return e && t.iterChangedRanges((n, i) => { + n < e.to && i > e.from && (r = !0); + }), r; } -function d5n(r, n, s = 1) { - let a = r.charCategorizer(n), l = r.doc.lineAt(n), h = n - l.from; - if (l.length == 0) - return sr.cursor(n); - h == 0 ? s = 1 : h == l.length && (s = -1); - let f = h, b = h; - s < 0 ? f = Np(l.text, h, !1) : b = Np(l.text, h); - let w = a(l.text.slice(f, b)); - for (; f > 0; ) { - let O = Np(l.text, f, !1); - if (a(l.text.slice(O, f)) != w) +function Ube(t, e, r = 1) { + let n = t.charCategorizer(e), i = t.doc.lineAt(e), s = e - i.from; + if (i.length == 0) + return Ve.cursor(e); + s == 0 ? r = 1 : s == i.length && (r = -1); + let a = s, o = s; + r < 0 ? a = ls(i.text, s, !1) : o = ls(i.text, s); + let l = n(i.text.slice(a, o)); + for (; a > 0; ) { + let u = ls(i.text, a, !1); + if (n(i.text.slice(u, a)) != l) break; - f = O; + a = u; } - for (; b < l.length; ) { - let O = Np(l.text, b); - if (a(l.text.slice(b, O)) != w) + for (; o < i.length; ) { + let u = ls(i.text, o); + if (n(i.text.slice(o, u)) != l) break; - b = O; - } - return sr.range(f + l.from, b + l.from); -} -function p5n(r, n) { - return n.left > r ? n.left - r : Math.max(0, r - n.right); -} -function g5n(r, n) { - return n.top > r ? n.top - r : Math.max(0, r - n.bottom); -} -function vRe(r, n) { - return r.top < n.bottom - 1 && r.bottom > n.top + 1; -} -function N_t(r, n) { - return n < r.top ? { top: n, left: r.left, right: r.right, bottom: r.bottom } : r; -} -function R_t(r, n) { - return n > r.bottom ? { top: r.top, left: r.left, right: r.right, bottom: n } : r; -} -function fFe(r, n, s) { - let a, l, h, f, b = !1, w, O, S, E; - for (let B = r.firstChild; B; B = B.nextSibling) { - let z = fK(B); - for (let W = 0; W < z.length; W++) { - let H = z[W]; - l && vRe(l, H) && (H = N_t(R_t(H, l.bottom), l.top)); - let G = p5n(n, H), ee = g5n(s, H); - if (G == 0 && ee == 0) - return B.nodeType == 3 ? $_t(B, n, s) : fFe(B, n, s); - if (!a || f > ee || f == ee && h > G) { - a = B, l = H, h = G, f = ee; - let le = ee ? s < H.top ? -1 : 1 : G ? n < H.left ? -1 : 1 : 0; - b = !le || (le > 0 ? W < z.length - 1 : W > 0); - } - G == 0 ? s > H.bottom && (!S || S.bottom < H.bottom) ? (w = B, S = H) : s < H.top && (!E || E.top > H.top) && (O = B, E = H) : S && vRe(S, H) ? S = R_t(S, H.bottom) : E && vRe(E, H) && (E = N_t(E, H.top)); - } - } - if (S && S.bottom >= s ? (a = w, l = S) : E && E.top <= s && (a = O, l = E), !a) - return { node: r, offset: 0 }; - let D = Math.max(l.left, Math.min(l.right, n)); - if (a.nodeType == 3) - return $_t(a, D, s); - if (b && a.contentEditable != "false") - return fFe(a, D, s); - let M = Array.prototype.indexOf.call(r.childNodes, a) + (n >= (l.left + l.right) / 2 ? 1 : 0); - return { node: r, offset: M }; -} -function $_t(r, n, s) { - let a = r.nodeValue.length, l = -1, h = 1e9, f = 0; - for (let b = 0; b < a; b++) { - let w = sP(r, b, b + 1).getClientRects(); - for (let O = 0; O < w.length; O++) { - let S = w[O]; - if (S.top == S.bottom) + o = u; + } + return Ve.range(a + i.from, o + i.from); +} +function qbe(t, e) { + return e.left > t ? e.left - t : Math.max(0, t - e.right); +} +function Qbe(t, e) { + return e.top > t ? e.top - t : Math.max(0, t - e.bottom); +} +function dE(t, e) { + return t.top < e.bottom - 1 && t.bottom > e.top + 1; +} +function uB(t, e) { + return e < t.top ? { top: e, left: t.left, right: t.right, bottom: t.bottom } : t; +} +function hB(t, e) { + return e > t.bottom ? { top: t.top, left: t.left, right: t.right, bottom: e } : t; +} +function t7(t, e, r) { + let n, i, s, a, o = !1, l, u, h, f; + for (let g = t.firstChild; g; g = g.nextSibling) { + let m = wy(g); + for (let v = 0; v < m.length; v++) { + let y = m[v]; + i && dE(i, y) && (y = uB(hB(y, i.bottom), i.top)); + let b = qbe(e, y), w = Qbe(r, y); + if (b == 0 && w == 0) + return g.nodeType == 3 ? fB(g, e, r) : t7(g, e, r); + if (!n || a > w || a == w && s > b) { + n = g, i = y, s = b, a = w; + let O = w ? r < y.top ? -1 : 1 : b ? e < y.left ? -1 : 1 : 0; + o = !O || (O > 0 ? v < m.length - 1 : v > 0); + } + b == 0 ? r > y.bottom && (!h || h.bottom < y.bottom) ? (l = g, h = y) : r < y.top && (!f || f.top > y.top) && (u = g, f = y) : h && dE(h, y) ? h = hB(h, y.bottom) : f && dE(f, y) && (f = uB(f, y.top)); + } + } + if (h && h.bottom >= r ? (n = l, i = h) : f && f.top <= r && (n = u, i = f), !n) + return { node: t, offset: 0 }; + let d = Math.max(i.left, Math.min(i.right, e)); + if (n.nodeType == 3) + return fB(n, d, r); + if (o && n.contentEditable != "false") + return t7(n, d, r); + let p = Array.prototype.indexOf.call(t.childNodes, n) + (e >= (i.left + i.right) / 2 ? 1 : 0); + return { node: t, offset: p }; +} +function fB(t, e, r) { + let n = t.nodeValue.length, i = -1, s = 1e9, a = 0; + for (let o = 0; o < n; o++) { + let l = Zd(t, o, o + 1).getClientRects(); + for (let u = 0; u < l.length; u++) { + let h = l[u]; + if (h.top == h.bottom) continue; - f || (f = n - S.left); - let E = (S.top > s ? S.top - s : s - S.bottom) - 1; - if (S.left - 1 <= n && S.right + 1 >= n && E < h) { - let D = n >= (S.left + S.right) / 2, M = D; - if ((Fs.chrome || Fs.gecko) && sP(r, b).getBoundingClientRect().left == S.right && (M = !D), E <= 0) - return { node: r, offset: b + (M ? 1 : 0) }; - l = b + (M ? 1 : 0), h = E; + a || (a = e - h.left); + let f = (h.top > r ? h.top - r : r - h.bottom) - 1; + if (h.left - 1 <= e && h.right + 1 >= e && f < s) { + let d = e >= (h.left + h.right) / 2, p = d; + if ((Mt.chrome || Mt.gecko) && Zd(t, o).getBoundingClientRect().left == h.right && (p = !d), f <= 0) + return { node: t, offset: o + (p ? 1 : 0) }; + i = o + (p ? 1 : 0), s = f; } } } - return { node: r, offset: l > -1 ? l : f > 0 ? r.nodeValue.length : 0 }; + return { node: t, offset: i > -1 ? i : a > 0 ? t.nodeValue.length : 0 }; } -function CMt(r, n, s, a = -1) { - var l, h; - let f = r.contentDOM.getBoundingClientRect(), b = f.top + r.viewState.paddingTop, w, { docHeight: O } = r.viewState, { x: S, y: E } = n, D = E - b; - if (D < 0) +function Fj(t, e, r, n = -1) { + var i, s; + let a = t.contentDOM.getBoundingClientRect(), o = a.top + t.viewState.paddingTop, l, { docHeight: u } = t.viewState, { x: h, y: f } = e, d = f - o; + if (d < 0) return 0; - if (D > O) - return r.state.doc.length; - for (let le = r.viewState.heightOracle.textHeight / 2, se = !1; w = r.elementAtHeight(D), w.type != Pm.Text; ) - for (; D = a > 0 ? w.bottom + le : w.top - le, !(D >= 0 && D <= O); ) { - if (se) - return s ? null : 0; - se = !0, a = -a; - } - E = b + D; - let M = w.from; - if (M < r.viewport.from) - return r.viewport.from == 0 ? 0 : s ? null : B_t(r, f, w, S, E); - if (M > r.viewport.to) - return r.viewport.to == r.state.doc.length ? r.state.doc.length : s ? null : B_t(r, f, w, S, E); - let B = r.dom.ownerDocument, z = r.root.elementFromPoint ? r.root : B, W = z.elementFromPoint(S, E); - W && !r.contentDOM.contains(W) && (W = null), W || (S = Math.max(f.left + 1, Math.min(f.right - 1, S)), W = z.elementFromPoint(S, E), W && !r.contentDOM.contains(W) && (W = null)); - let H, G = -1; - if (W && ((l = r.docView.nearest(W)) === null || l === void 0 ? void 0 : l.isEditable) != !1) { - if (B.caretPositionFromPoint) { - let le = B.caretPositionFromPoint(S, E); - le && ({ offsetNode: H, offset: G } = le); - } else if (B.caretRangeFromPoint) { - let le = B.caretRangeFromPoint(S, E); - le && ({ startContainer: H, startOffset: G } = le, (!r.contentDOM.contains(H) || Fs.safari && m5n(H, G, S) || Fs.chrome && b5n(H, G, S)) && (H = void 0)); - } - } - if (!H || !r.docView.dom.contains(H)) { - let le = o0.find(r.docView, M); - if (!le) - return D > w.top + w.height / 2 ? w.to : w.from; - ({ node: H, offset: G } = fFe(le.dom, S, E)); - } - let ee = r.docView.nearest(H); - if (!ee) + if (d > u) + return t.state.doc.length; + for (let O = t.viewState.heightOracle.textHeight / 2, S = !1; l = t.elementAtHeight(d), l.type != ia.Text; ) + for (; d = n > 0 ? l.bottom + O : l.top - O, !(d >= 0 && d <= u); ) { + if (S) + return r ? null : 0; + S = !0, n = -n; + } + f = o + d; + let p = l.from; + if (p < t.viewport.from) + return t.viewport.from == 0 ? 0 : r ? null : dB(t, a, l, h, f); + if (p > t.viewport.to) + return t.viewport.to == t.state.doc.length ? t.state.doc.length : r ? null : dB(t, a, l, h, f); + let g = t.dom.ownerDocument, m = t.root.elementFromPoint ? t.root : g, v = m.elementFromPoint(h, f); + v && !t.contentDOM.contains(v) && (v = null), v || (h = Math.max(a.left + 1, Math.min(a.right - 1, h)), v = m.elementFromPoint(h, f), v && !t.contentDOM.contains(v) && (v = null)); + let y, b = -1; + if (v && ((i = t.docView.nearest(v)) === null || i === void 0 ? void 0 : i.isEditable) != !1) { + if (g.caretPositionFromPoint) { + let O = g.caretPositionFromPoint(h, f); + O && ({ offsetNode: y, offset: b } = O); + } else if (g.caretRangeFromPoint) { + let O = g.caretRangeFromPoint(h, f); + O && ({ startContainer: y, startOffset: b } = O, (!t.contentDOM.contains(y) || Mt.safari && Ybe(y, b, h) || Mt.chrome && Wbe(y, b, h)) && (y = void 0)); + } + } + if (!y || !t.docView.dom.contains(y)) { + let O = bi.find(t.docView, p); + if (!O) + return d > l.top + l.height / 2 ? l.to : l.from; + ({ node: y, offset: b } = t7(O.dom, h, f)); + } + let w = t.docView.nearest(y); + if (!w) return null; - if (ee.isWidget && ((h = ee.dom) === null || h === void 0 ? void 0 : h.nodeType) == 1) { - let le = ee.dom.getBoundingClientRect(); - return n.y < le.top || n.y <= le.bottom && n.x <= (le.left + le.right) / 2 ? ee.posAtStart : ee.posAtEnd; + if (w.isWidget && ((s = w.dom) === null || s === void 0 ? void 0 : s.nodeType) == 1) { + let O = w.dom.getBoundingClientRect(); + return e.y < O.top || e.y <= O.bottom && e.x <= (O.left + O.right) / 2 ? w.posAtStart : w.posAtEnd; } else - return ee.localPosFromDOM(H, G) + ee.posAtStart; + return w.localPosFromDOM(y, b) + w.posAtStart; } -function B_t(r, n, s, a, l) { - let h = Math.round((a - n.left) * r.defaultCharacterWidth); - if (r.lineWrapping && s.height > r.defaultLineHeight * 1.5) { - let b = r.viewState.heightOracle.textHeight, w = Math.floor((l - s.top - (r.defaultLineHeight - b) * 0.5) / b); - h += w * r.viewState.heightOracle.lineLength; +function dB(t, e, r, n, i) { + let s = Math.round((n - e.left) * t.defaultCharacterWidth); + if (t.lineWrapping && r.height > t.defaultLineHeight * 1.5) { + let o = t.viewState.heightOracle.textHeight, l = Math.floor((i - r.top - (t.defaultLineHeight - o) * 0.5) / o); + s += l * t.viewState.heightOracle.lineLength; } - let f = r.state.sliceDoc(s.from, s.to); - return s.from + KBe(f, h, r.state.tabSize); + let a = t.state.sliceDoc(r.from, r.to); + return r.from + VA(a, s, t.state.tabSize); } -function m5n(r, n, s) { - let a; - if (r.nodeType != 3 || n != (a = r.nodeValue.length)) +function Ybe(t, e, r) { + let n; + if (t.nodeType != 3 || e != (n = t.nodeValue.length)) return !1; - for (let l = r.nextSibling; l; l = l.nextSibling) - if (l.nodeType != 1 || l.nodeName != "BR") + for (let i = t.nextSibling; i; i = i.nextSibling) + if (i.nodeType != 1 || i.nodeName != "BR") return !1; - return sP(r, a - 1, a).getBoundingClientRect().left > s; + return Zd(t, n - 1, n).getBoundingClientRect().left > r; } -function b5n(r, n, s) { - if (n != 0) +function Wbe(t, e, r) { + if (e != 0) return !1; - for (let l = r; ; ) { - let h = l.parentNode; - if (!h || h.nodeType != 1 || h.firstChild != l) + for (let i = t; ; ) { + let s = i.parentNode; + if (!s || s.nodeType != 1 || s.firstChild != i) return !1; - if (h.classList.contains("cm-line")) + if (s.classList.contains("cm-line")) break; - l = h; + i = s; } - let a = r.nodeType == 1 ? r.getBoundingClientRect() : sP(r, 0, Math.max(r.nodeValue.length, 1)).getBoundingClientRect(); - return s - a.left > 5; + let n = t.nodeType == 1 ? t.getBoundingClientRect() : Zd(t, 0, Math.max(t.nodeValue.length, 1)).getBoundingClientRect(); + return r - n.left > 5; } -function dFe(r, n) { - let s = r.lineBlockAt(n); - if (Array.isArray(s.type)) { - for (let a of s.type) - if (a.to > n || a.to == n && (a.to == s.to || a.type == Pm.Text)) - return a; +function r7(t, e) { + let r = t.lineBlockAt(e); + if (Array.isArray(r.type)) { + for (let n of r.type) + if (n.to > e || n.to == e && (n.to == r.to || n.type == ia.Text)) + return n; } - return s; + return r; } -function v5n(r, n, s, a) { - let l = dFe(r, n.head), h = !a || l.type != Pm.Text || !(r.lineWrapping || l.widgetLineBreaks) ? null : r.coordsAtPos(n.assoc < 0 && n.head > l.from ? n.head - 1 : n.head); - if (h) { - let f = r.dom.getBoundingClientRect(), b = r.textDirectionAt(l.from), w = r.posAtCoords({ - x: s == (b == Cf.LTR) ? f.right - 1 : f.left + 1, - y: (h.top + h.bottom) / 2 +function Gbe(t, e, r, n) { + let i = r7(t, e.head), s = !n || i.type != ia.Text || !(t.lineWrapping || i.widgetLineBreaks) ? null : t.coordsAtPos(e.assoc < 0 && e.head > i.from ? e.head - 1 : e.head); + if (s) { + let a = t.dom.getBoundingClientRect(), o = t.textDirectionAt(i.from), l = t.posAtCoords({ + x: r == (o == Nn.LTR) ? a.right - 1 : a.left + 1, + y: (s.top + s.bottom) / 2 }); - if (w != null) - return sr.cursor(w, s ? -1 : 1); - } - return sr.cursor(s ? l.to : l.from, s ? -1 : 1); -} -function F_t(r, n, s, a) { - let l = r.state.doc.lineAt(n.head), h = r.bidiSpans(l), f = r.textDirectionAt(l.from); - for (let b = n, w = null; ; ) { - let O = s5n(l, h, f, b, s), S = xMt; - if (!O) { - if (l.number == (s ? r.state.doc.lines : 1)) - return b; - S = ` -`, l = r.state.doc.line(l.number + (s ? 1 : -1)), h = r.bidiSpans(l), O = sr.cursor(s ? l.from : l.to); - } - if (w) { - if (!w(S)) - return b; + if (l != null) + return Ve.cursor(l, r ? -1 : 1); + } + return Ve.cursor(r ? i.to : i.from, r ? -1 : 1); +} +function pB(t, e, r, n) { + let i = t.state.doc.lineAt(e.head), s = t.bidiSpans(i), a = t.textDirectionAt(i.from); + for (let o = e, l = null; ; ) { + let u = Nbe(i, s, a, o, r), h = Pj; + if (!u) { + if (i.number == (r ? t.state.doc.lines : 1)) + return o; + h = ` +`, i = t.state.doc.line(i.number + (r ? 1 : -1)), s = t.bidiSpans(i), u = Ve.cursor(r ? i.from : i.to); + } + if (l) { + if (!l(h)) + return o; } else { - if (!a) - return O; - w = a(S); + if (!n) + return u; + l = n(h); } - b = O; + o = u; } } -function w5n(r, n, s) { - let a = r.state.charCategorizer(n), l = a(s); - return (h) => { - let f = a(h); - return l == ef.Space && (l = f), l == f; +function Hbe(t, e, r) { + let n = t.state.charCategorizer(e), i = n(r); + return (s) => { + let a = n(s); + return i == Sn.Space && (i = a), i == a; }; } -function y5n(r, n, s, a) { - let l = n.head, h = s ? 1 : -1; - if (l == (s ? r.state.doc.length : 0)) - return sr.cursor(l, n.assoc); - let f = n.goalColumn, b, w = r.contentDOM.getBoundingClientRect(), O = r.coordsAtPos(l, n.assoc || -1), S = r.documentTop; - if (O) - f == null && (f = O.left - w.left), b = h < 0 ? O.top : O.bottom; +function Xbe(t, e, r, n) { + let i = e.head, s = r ? 1 : -1; + if (i == (r ? t.state.doc.length : 0)) + return Ve.cursor(i, e.assoc); + let a = e.goalColumn, o, l = t.contentDOM.getBoundingClientRect(), u = t.coordsAtPos(i, e.assoc || -1), h = t.documentTop; + if (u) + a == null && (a = u.left - l.left), o = s < 0 ? u.top : u.bottom; else { - let M = r.viewState.lineBlockAt(l); - f == null && (f = Math.min(w.right - w.left, r.defaultCharacterWidth * (l - M.from))), b = (h < 0 ? M.top : M.bottom) + S; + let p = t.viewState.lineBlockAt(i); + a == null && (a = Math.min(l.right - l.left, t.defaultCharacterWidth * (i - p.from))), o = (s < 0 ? p.top : p.bottom) + h; } - let E = w.left + f, D = a != null ? a : r.viewState.heightOracle.textHeight >> 1; - for (let M = 0; ; M += 10) { - let B = b + (D + M) * h, z = CMt(r, { x: E, y: B }, !1, h); - if (B < w.top || B > w.bottom || (h < 0 ? z < l : z > l)) { - let W = r.docView.coordsForChar(z), H = !W || B < W.top ? -1 : 1; - return sr.cursor(z, H, void 0, f); + let f = l.left + a, d = n != null ? n : t.viewState.heightOracle.textHeight >> 1; + for (let p = 0; ; p += 10) { + let g = o + (d + p) * s, m = Fj(t, { x: f, y: g }, !1, s); + if (g < l.top || g > l.bottom || (s < 0 ? m < i : m > i)) { + let v = t.docView.coordsForChar(m), y = !v || g < v.top ? -1 : 1; + return Ve.cursor(m, y, void 0, a); } } } -function Yme(r, n, s) { +function i4(t, e, r) { for (; ; ) { - let a = 0; - for (let l of r) - l.between(n - 1, n + 1, (h, f, b) => { - if (n > h && n < f) { - let w = a || s || (n - h < f - n ? -1 : 1); - n = w < 0 ? h : f, a = w; + let n = 0; + for (let i of t) + i.between(e - 1, e + 1, (s, a, o) => { + if (e > s && e < a) { + let l = n || r || (e - s < a - e ? -1 : 1); + e = l < 0 ? s : a, n = l; } }); - if (!a) - return n; + if (!n) + return e; } } -function wRe(r, n, s) { - let a = Yme(r.state.facet(hze).map((l) => l(r)), s.from, n.head > s.from ? -1 : 1); - return a == s.from ? s : sr.cursor(a, a < s.from ? 1 : -1); +function pE(t, e, r) { + let n = i4(t.state.facet($R).map((i) => i(t)), r.from, e.head > r.from ? -1 : 1); + return n == r.from ? r : Ve.cursor(n, n < r.from ? 1 : -1); } -class O5n { - setSelectionOrigin(n) { - this.lastSelectionOrigin = n, this.lastSelectionTime = Date.now(); +class Zbe { + setSelectionOrigin(e) { + this.lastSelectionOrigin = e, this.lastSelectionTime = Date.now(); } - constructor(n) { - this.view = n, this.lastKeyCode = 0, this.lastKeyTime = 0, this.lastTouchTime = 0, this.lastFocusTime = 0, this.lastScrollTop = 0, this.lastScrollLeft = 0, this.pendingIOSKey = void 0, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastEscPress = 0, this.lastContextMenu = 0, this.scrollHandlers = [], this.handlers = /* @__PURE__ */ Object.create(null), this.composing = -1, this.compositionFirstChange = null, this.compositionEndedAt = 0, this.compositionPendingKey = !1, this.compositionPendingChange = !1, this.mouseSelection = null, this.draggedContent = null, this.handleEvent = this.handleEvent.bind(this), this.notifiedFocused = n.hasFocus, Fs.safari && n.contentDOM.addEventListener("input", () => null), Fs.gecko && $5n(n.contentDOM.ownerDocument); + constructor(e) { + this.view = e, this.lastKeyCode = 0, this.lastKeyTime = 0, this.lastTouchTime = 0, this.lastFocusTime = 0, this.lastScrollTop = 0, this.lastScrollLeft = 0, this.pendingIOSKey = void 0, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastEscPress = 0, this.lastContextMenu = 0, this.scrollHandlers = [], this.handlers = /* @__PURE__ */ Object.create(null), this.composing = -1, this.compositionFirstChange = null, this.compositionEndedAt = 0, this.compositionPendingKey = !1, this.compositionPendingChange = !1, this.mouseSelection = null, this.draggedContent = null, this.handleEvent = this.handleEvent.bind(this), this.notifiedFocused = e.hasFocus, Mt.safari && e.contentDOM.addEventListener("input", () => null), Mt.gecko && fxe(e.contentDOM.ownerDocument); } - handleEvent(n) { - !A5n(this.view, n) || this.ignoreDuringComposition(n) || n.type == "keydown" && this.keydown(n) || this.runHandlers(n.type, n); + handleEvent(e) { + !ixe(this.view, e) || this.ignoreDuringComposition(e) || e.type == "keydown" && this.keydown(e) || this.runHandlers(e.type, e); } - runHandlers(n, s) { - let a = this.handlers[n]; - if (a) { - for (let l of a.observers) - l(this.view, s); - for (let l of a.handlers) { - if (s.defaultPrevented) + runHandlers(e, r) { + let n = this.handlers[e]; + if (n) { + for (let i of n.observers) + i(this.view, r); + for (let i of n.handlers) { + if (r.defaultPrevented) break; - if (l(this.view, s)) { - s.preventDefault(); + if (i(this.view, r)) { + r.preventDefault(); break; } } } } - ensureHandlers(n) { - let s = k5n(n), a = this.handlers, l = this.view.contentDOM; - for (let h in s) - if (h != "scroll") { - let f = !s[h].handlers.length, b = a[h]; - b && f != !b.handlers.length && (l.removeEventListener(h, this.handleEvent), b = null), b || l.addEventListener(h, this.handleEvent, { passive: f }); + ensureHandlers(e) { + let r = jbe(e), n = this.handlers, i = this.view.contentDOM; + for (let s in r) + if (s != "scroll") { + let a = !r[s].handlers.length, o = n[s]; + o && a != !o.handlers.length && (i.removeEventListener(s, this.handleEvent), o = null), o || i.addEventListener(s, this.handleEvent, { passive: a }); } - for (let h in a) - h != "scroll" && !s[h] && l.removeEventListener(h, this.handleEvent); - this.handlers = s; + for (let s in n) + s != "scroll" && !r[s] && i.removeEventListener(s, this.handleEvent); + this.handlers = r; } - keydown(n) { - if (this.lastKeyCode = n.keyCode, this.lastKeyTime = Date.now(), n.keyCode == 9 && Date.now() < this.lastEscPress + 2e3) + keydown(e) { + if (this.lastKeyCode = e.keyCode, this.lastKeyTime = Date.now(), e.keyCode == 9 && Date.now() < this.lastEscPress + 2e3) return !0; - if (n.keyCode != 27 && TMt.indexOf(n.keyCode) < 0 && (this.view.inputState.lastEscPress = 0), Fs.android && Fs.chrome && !n.synthetic && (n.keyCode == 13 || n.keyCode == 8)) - return this.view.observer.delayAndroidKey(n.key, n.keyCode), !0; - let s; - return Fs.ios && !n.synthetic && !n.altKey && !n.metaKey && ((s = EMt.find((a) => a.keyCode == n.keyCode)) && !n.ctrlKey || x5n.indexOf(n.key) > -1 && n.ctrlKey && !n.shiftKey) ? (this.pendingIOSKey = s || n, setTimeout(() => this.flushIOSKey(), 250), !0) : (n.keyCode != 229 && this.view.observer.forceFlush(), !1); + if (e.keyCode != 27 && Vj.indexOf(e.keyCode) < 0 && (this.view.inputState.lastEscPress = 0), Mt.android && Mt.chrome && !e.synthetic && (e.keyCode == 13 || e.keyCode == 8)) + return this.view.observer.delayAndroidKey(e.key, e.keyCode), !0; + let r; + return Mt.ios && !e.synthetic && !e.altKey && !e.metaKey && ((r = zj.find((n) => n.keyCode == e.keyCode)) && !e.ctrlKey || Kbe.indexOf(e.key) > -1 && e.ctrlKey && !e.shiftKey) ? (this.pendingIOSKey = r || e, setTimeout(() => this.flushIOSKey(), 250), !0) : (e.keyCode != 229 && this.view.observer.forceFlush(), !1); } flushIOSKey() { - let n = this.pendingIOSKey; - return n ? (this.pendingIOSKey = void 0, PB(this.view.contentDOM, n.key, n.keyCode)) : !1; + let e = this.pendingIOSKey; + return e ? (this.pendingIOSKey = void 0, Wp(this.view.contentDOM, e.key, e.keyCode)) : !1; } - ignoreDuringComposition(n) { - return /^key/.test(n.type) ? this.composing > 0 ? !0 : Fs.safari && !Fs.ios && this.compositionPendingKey && Date.now() - this.compositionEndedAt < 100 ? (this.compositionPendingKey = !1, !0) : !1 : !1; + ignoreDuringComposition(e) { + return /^key/.test(e.type) ? this.composing > 0 ? !0 : Mt.safari && !Mt.ios && this.compositionPendingKey && Date.now() - this.compositionEndedAt < 100 ? (this.compositionPendingKey = !1, !0) : !1 : !1; } - startMouseSelection(n) { - this.mouseSelection && this.mouseSelection.destroy(), this.mouseSelection = n; + startMouseSelection(e) { + this.mouseSelection && this.mouseSelection.destroy(), this.mouseSelection = e; } - update(n) { - this.mouseSelection && this.mouseSelection.update(n), this.draggedContent && n.docChanged && (this.draggedContent = this.draggedContent.map(n.changes)), n.transactions.length && (this.lastKeyCode = this.lastSelectionTime = 0); + update(e) { + this.mouseSelection && this.mouseSelection.update(e), this.draggedContent && e.docChanged && (this.draggedContent = this.draggedContent.map(e.changes)), e.transactions.length && (this.lastKeyCode = this.lastSelectionTime = 0); } destroy() { this.mouseSelection && this.mouseSelection.destroy(); } } -function j_t(r, n) { - return (s, a) => { +function gB(t, e) { + return (r, n) => { try { - return n.call(r, a, s); - } catch (l) { - Yy(s.state, l); + return e.call(t, n, r); + } catch (i) { + Bo(r.state, i); } }; } -function k5n(r) { - let n = /* @__PURE__ */ Object.create(null); - function s(a) { - return n[a] || (n[a] = { observers: [], handlers: [] }); +function jbe(t) { + let e = /* @__PURE__ */ Object.create(null); + function r(n) { + return e[n] || (e[n] = { observers: [], handlers: [] }); } - for (let a of r) { - let l = a.spec; - if (l && l.domEventHandlers) - for (let h in l.domEventHandlers) { - let f = l.domEventHandlers[h]; - f && s(h).handlers.push(j_t(a.value, f)); + for (let n of t) { + let i = n.spec; + if (i && i.domEventHandlers) + for (let s in i.domEventHandlers) { + let a = i.domEventHandlers[s]; + a && r(s).handlers.push(gB(n.value, a)); } - if (l && l.domEventObservers) - for (let h in l.domEventObservers) { - let f = l.domEventObservers[h]; - f && s(h).observers.push(j_t(a.value, f)); + if (i && i.domEventObservers) + for (let s in i.domEventObservers) { + let a = i.domEventObservers[s]; + a && r(s).observers.push(gB(n.value, a)); } } - for (let a in mk) - s(a).handlers.push(mk[a]); - for (let a in bk) - s(a).observers.push(bk[a]); - return n; + for (let n in Dl) + r(n).handlers.push(Dl[n]); + for (let n in Nl) + r(n).observers.push(Nl[n]); + return e; } -const EMt = [ +const zj = [ { key: "Backspace", keyCode: 8, inputType: "deleteContentBackward" }, { key: "Enter", keyCode: 13, inputType: "insertParagraph" }, { key: "Enter", keyCode: 13, inputType: "insertLineBreak" }, { key: "Delete", keyCode: 46, inputType: "deleteContentForward" } -], x5n = "dthko", TMt = [16, 17, 18, 20, 91, 92, 224, 225], Bge = 6; -function Fge(r) { - return Math.max(0, r) * 0.7 + 8; +], Kbe = "dthko", Vj = [16, 17, 18, 20, 91, 92, 224, 225], fw = 6; +function dw(t) { + return Math.max(0, t) * 0.7 + 8; } -function S5n(r, n) { - return Math.max(Math.abs(r.clientX - n.clientX), Math.abs(r.clientY - n.clientY)); +function Jbe(t, e) { + return Math.max(Math.abs(t.clientX - e.clientX), Math.abs(t.clientY - e.clientY)); } -class _5n { - constructor(n, s, a, l) { - this.view = n, this.startEvent = s, this.style = a, this.mustSelect = l, this.scrollSpeed = { x: 0, y: 0 }, this.scrolling = -1, this.lastEvent = s, this.scrollParent = Qkn(n.contentDOM), this.atoms = n.state.facet(hze).map((f) => f(n)); - let h = n.contentDOM.ownerDocument; - h.addEventListener("mousemove", this.move = this.move.bind(this)), h.addEventListener("mouseup", this.up = this.up.bind(this)), this.extend = s.shiftKey, this.multiple = n.state.facet(Ga.allowMultipleSelections) && C5n(n, s), this.dragging = T5n(n, s) && PMt(s) == 1 ? null : !1; +class exe { + constructor(e, r, n, i) { + this.view = e, this.startEvent = r, this.style = n, this.mustSelect = i, this.scrollSpeed = { x: 0, y: 0 }, this.scrolling = -1, this.lastEvent = r, this.scrollParent = mbe(e.contentDOM), this.atoms = e.state.facet($R).map((a) => a(e)); + let s = e.contentDOM.ownerDocument; + s.addEventListener("mousemove", this.move = this.move.bind(this)), s.addEventListener("mouseup", this.up = this.up.bind(this)), this.extend = r.shiftKey, this.multiple = e.state.facet(dr.allowMultipleSelections) && txe(e, r), this.dragging = nxe(e, r) && Yj(r) == 1 ? null : !1; } - start(n) { - this.dragging === !1 && this.select(n); + start(e) { + this.dragging === !1 && this.select(e); } - move(n) { - var s; - if (n.buttons == 0) + move(e) { + var r; + if (e.buttons == 0) return this.destroy(); - if (this.dragging || this.dragging == null && S5n(this.startEvent, n) < 10) + if (this.dragging || this.dragging == null && Jbe(this.startEvent, e) < 10) return; - this.select(this.lastEvent = n); - let a = 0, l = 0, h = ((s = this.scrollParent) === null || s === void 0 ? void 0 : s.getBoundingClientRect()) || { left: 0, top: 0, right: this.view.win.innerWidth, bottom: this.view.win.innerHeight }, f = vMt(this.view); - n.clientX - f.left <= h.left + Bge ? a = -Fge(h.left - n.clientX) : n.clientX + f.right >= h.right - Bge && (a = Fge(n.clientX - h.right)), n.clientY - f.top <= h.top + Bge ? l = -Fge(h.top - n.clientY) : n.clientY + f.bottom >= h.bottom - Bge && (l = Fge(n.clientY - h.bottom)), this.setScrollSpeed(a, l); + this.select(this.lastEvent = e); + let n = 0, i = 0, s = ((r = this.scrollParent) === null || r === void 0 ? void 0 : r.getBoundingClientRect()) || { left: 0, top: 0, right: this.view.win.innerWidth, bottom: this.view.win.innerHeight }, a = Rj(this.view); + e.clientX - a.left <= s.left + fw ? n = -dw(s.left - e.clientX) : e.clientX + a.right >= s.right - fw && (n = dw(e.clientX - s.right)), e.clientY - a.top <= s.top + fw ? i = -dw(s.top - e.clientY) : e.clientY + a.bottom >= s.bottom - fw && (i = dw(e.clientY - s.bottom)), this.setScrollSpeed(n, i); } - up(n) { - this.dragging == null && this.select(this.lastEvent), this.dragging || n.preventDefault(), this.destroy(); + up(e) { + this.dragging == null && this.select(this.lastEvent), this.dragging || e.preventDefault(), this.destroy(); } destroy() { this.setScrollSpeed(0, 0); - let n = this.view.contentDOM.ownerDocument; - n.removeEventListener("mousemove", this.move), n.removeEventListener("mouseup", this.up), this.view.inputState.mouseSelection = this.view.inputState.draggedContent = null; + let e = this.view.contentDOM.ownerDocument; + e.removeEventListener("mousemove", this.move), e.removeEventListener("mouseup", this.up), this.view.inputState.mouseSelection = this.view.inputState.draggedContent = null; } - setScrollSpeed(n, s) { - this.scrollSpeed = { x: n, y: s }, n || s ? this.scrolling < 0 && (this.scrolling = setInterval(() => this.scroll(), 50)) : this.scrolling > -1 && (clearInterval(this.scrolling), this.scrolling = -1); + setScrollSpeed(e, r) { + this.scrollSpeed = { x: e, y: r }, e || r ? this.scrolling < 0 && (this.scrolling = setInterval(() => this.scroll(), 50)) : this.scrolling > -1 && (clearInterval(this.scrolling), this.scrolling = -1); } scroll() { this.scrollParent ? (this.scrollParent.scrollLeft += this.scrollSpeed.x, this.scrollParent.scrollTop += this.scrollSpeed.y) : this.view.win.scrollBy(this.scrollSpeed.x, this.scrollSpeed.y), this.dragging === !1 && this.select(this.lastEvent); } - skipAtoms(n) { - let s = null; - for (let a = 0; a < n.ranges.length; a++) { - let l = n.ranges[a], h = null; - if (l.empty) { - let f = Yme(this.atoms, l.from, 0); - f != l.from && (h = sr.cursor(f, -1)); + skipAtoms(e) { + let r = null; + for (let n = 0; n < e.ranges.length; n++) { + let i = e.ranges[n], s = null; + if (i.empty) { + let a = i4(this.atoms, i.from, 0); + a != i.from && (s = Ve.cursor(a, -1)); } else { - let f = Yme(this.atoms, l.from, -1), b = Yme(this.atoms, l.to, 1); - (f != l.from || b != l.to) && (h = sr.range(l.from == l.anchor ? f : b, l.from == l.head ? f : b)); + let a = i4(this.atoms, i.from, -1), o = i4(this.atoms, i.to, 1); + (a != i.from || o != i.to) && (s = Ve.range(i.from == i.anchor ? a : o, i.from == i.head ? a : o)); } - h && (s || (s = n.ranges.slice()), s[a] = h); + s && (r || (r = e.ranges.slice()), r[n] = s); } - return s ? sr.create(s, n.mainIndex) : n; + return r ? Ve.create(r, e.mainIndex) : e; } - select(n) { - let { view: s } = this, a = this.skipAtoms(this.style.get(n, this.extend, this.multiple)); - (this.mustSelect || !a.eq(s.state.selection) || a.main.assoc != s.state.selection.main.assoc && this.dragging === !1) && this.view.dispatch({ - selection: a, + select(e) { + let { view: r } = this, n = this.skipAtoms(this.style.get(e, this.extend, this.multiple)); + (this.mustSelect || !n.eq(r.state.selection) || n.main.assoc != r.state.selection.main.assoc && this.dragging === !1) && this.view.dispatch({ + selection: n, userEvent: "select.pointer" }), this.mustSelect = !1; } - update(n) { - this.style.update(n) && setTimeout(() => this.select(this.lastEvent), 20); + update(e) { + this.style.update(e) && setTimeout(() => this.select(this.lastEvent), 20); } } -function C5n(r, n) { - let s = r.state.facet(aMt); - return s.length ? s[0](n) : Fs.mac ? n.metaKey : n.ctrlKey; +function txe(t, e) { + let r = t.state.facet(xj); + return r.length ? r[0](e) : Mt.mac ? e.metaKey : e.ctrlKey; } -function E5n(r, n) { - let s = r.state.facet(cMt); - return s.length ? s[0](n) : Fs.mac ? !n.altKey : !n.ctrlKey; +function rxe(t, e) { + let r = t.state.facet(wj); + return r.length ? r[0](e) : Mt.mac ? !e.altKey : !e.ctrlKey; } -function T5n(r, n) { - let { main: s } = r.state.selection; - if (s.empty) +function nxe(t, e) { + let { main: r } = t.state.selection; + if (r.empty) return !1; - let a = Qbe(r.root); - if (!a || a.rangeCount == 0) + let n = v5(t.root); + if (!n || n.rangeCount == 0) return !0; - let l = a.getRangeAt(0).getClientRects(); - for (let h = 0; h < l.length; h++) { - let f = l[h]; - if (f.left <= n.clientX && f.right >= n.clientX && f.top <= n.clientY && f.bottom >= n.clientY) + let i = n.getRangeAt(0).getClientRects(); + for (let s = 0; s < i.length; s++) { + let a = i[s]; + if (a.left <= e.clientX && a.right >= e.clientX && a.top <= e.clientY && a.bottom >= e.clientY) return !0; } return !1; } -function A5n(r, n) { - if (!n.bubbles) +function ixe(t, e) { + if (!e.bubbles) return !0; - if (n.defaultPrevented) + if (e.defaultPrevented) return !1; - for (let s = n.target, a; s != r.contentDOM; s = s.parentNode) - if (!s || s.nodeType == 11 || (a = Mh.get(s)) && a.ignoreEvent(n)) + for (let r = e.target, n; r != t.contentDOM; r = r.parentNode) + if (!r || r.nodeType == 11 || (n = yn.get(r)) && n.ignoreEvent(e)) return !1; return !0; } -const mk = /* @__PURE__ */ Object.create(null), bk = /* @__PURE__ */ Object.create(null), AMt = Fs.ie && Fs.ie_version < 15 || Fs.ios && Fs.webkit_version < 604; -function D5n(r) { - let n = r.dom.parentNode; - if (!n) +const Dl = /* @__PURE__ */ Object.create(null), Nl = /* @__PURE__ */ Object.create(null), Uj = Mt.ie && Mt.ie_version < 15 || Mt.ios && Mt.webkit_version < 604; +function sxe(t) { + let e = t.dom.parentNode; + if (!e) return; - let s = n.appendChild(document.createElement("textarea")); - s.style.cssText = "position: fixed; left: -10000px; top: 10px", s.focus(), setTimeout(() => { - r.focus(), s.remove(), DMt(r, s.value); + let r = e.appendChild(document.createElement("textarea")); + r.style.cssText = "position: fixed; left: -10000px; top: 10px", r.focus(), setTimeout(() => { + t.focus(), r.remove(), qj(t, r.value); }, 50); } -function DMt(r, n) { - let { state: s } = r, a, l = 1, h = s.toText(n), f = h.lines == s.selection.ranges.length; - if (pFe != null && s.selection.ranges.every((w) => w.empty) && pFe == h.toString()) { - let w = -1; - a = s.changeByRange((O) => { - let S = s.doc.lineAt(O.from); - if (S.from == w) - return { range: O }; - w = S.from; - let E = s.toText((f ? h.line(l++).text : n) + s.lineBreak); +function qj(t, e) { + let { state: r } = t, n, i = 1, s = r.toText(e), a = s.lines == r.selection.ranges.length; + if (n7 != null && r.selection.ranges.every((l) => l.empty) && n7 == s.toString()) { + let l = -1; + n = r.changeByRange((u) => { + let h = r.doc.lineAt(u.from); + if (h.from == l) + return { range: u }; + l = h.from; + let f = r.toText((a ? s.line(i++).text : e) + r.lineBreak); return { - changes: { from: S.from, insert: E }, - range: sr.cursor(O.from + E.length) + changes: { from: h.from, insert: f }, + range: Ve.cursor(u.from + f.length) }; }); } else - f ? a = s.changeByRange((w) => { - let O = h.line(l++); + a ? n = r.changeByRange((l) => { + let u = s.line(i++); return { - changes: { from: w.from, to: w.to, insert: O.text }, - range: sr.cursor(w.from + O.length) + changes: { from: l.from, to: l.to, insert: u.text }, + range: Ve.cursor(l.from + u.length) }; - }) : a = s.replaceSelection(h); - r.dispatch(a, { + }) : n = r.replaceSelection(s); + t.dispatch(n, { userEvent: "input.paste", scrollIntoView: !0 }); } -bk.scroll = (r) => { - r.inputState.lastScrollTop = r.scrollDOM.scrollTop, r.inputState.lastScrollLeft = r.scrollDOM.scrollLeft; +Nl.scroll = (t) => { + t.inputState.lastScrollTop = t.scrollDOM.scrollTop, t.inputState.lastScrollLeft = t.scrollDOM.scrollLeft; }; -mk.keydown = (r, n) => (r.inputState.setSelectionOrigin("select"), n.keyCode == 27 && (r.inputState.lastEscPress = Date.now()), !1); -bk.touchstart = (r, n) => { - r.inputState.lastTouchTime = Date.now(), r.inputState.setSelectionOrigin("select.pointer"); +Dl.keydown = (t, e) => (t.inputState.setSelectionOrigin("select"), e.keyCode == 27 && (t.inputState.lastEscPress = Date.now()), !1); +Nl.touchstart = (t, e) => { + t.inputState.lastTouchTime = Date.now(), t.inputState.setSelectionOrigin("select.pointer"); }; -bk.touchmove = (r) => { - r.inputState.setSelectionOrigin("select.pointer"); +Nl.touchmove = (t) => { + t.inputState.setSelectionOrigin("select.pointer"); }; -mk.mousedown = (r, n) => { - if (r.observer.flush(), r.inputState.lastTouchTime > Date.now() - 2e3) +Dl.mousedown = (t, e) => { + if (t.observer.flush(), t.inputState.lastTouchTime > Date.now() - 2e3) return !1; - let s = null; - for (let a of r.state.facet(lMt)) - if (s = a(r, n), s) + let r = null; + for (let n of t.state.facet(Oj)) + if (r = n(t, e), r) break; - if (!s && n.button == 0 && (s = L5n(r, n)), s) { - let a = !r.hasFocus; - r.inputState.startMouseSelection(new _5n(r, n, s, a)), a && r.observer.ignore(() => GDt(r.contentDOM)); - let l = r.inputState.mouseSelection; - if (l) - return l.start(n), l.dragging === !1; + if (!r && e.button == 0 && (r = lxe(t, e)), r) { + let n = !t.hasFocus; + t.inputState.startMouseSelection(new exe(t, e, r, n)), n && t.observer.ignore(() => lj(t.contentDOM)); + let i = t.inputState.mouseSelection; + if (i) + return i.start(e), i.dragging === !1; } return !1; }; -function Q_t(r, n, s, a) { - if (a == 1) - return sr.cursor(n, s); - if (a == 2) - return d5n(r.state, n, s); +function mB(t, e, r, n) { + if (n == 1) + return Ve.cursor(e, r); + if (n == 2) + return Ube(t.state, e, r); { - let l = o0.find(r.docView, n), h = r.state.doc.lineAt(l ? l.posAtEnd : n), f = l ? l.posAtStart : h.from, b = l ? l.posAtEnd : h.to; - return b < r.state.doc.length && b == h.to && b++, sr.range(f, b); + let i = bi.find(t.docView, e), s = t.state.doc.lineAt(i ? i.posAtEnd : e), a = i ? i.posAtStart : s.from, o = i ? i.posAtEnd : s.to; + return o < t.state.doc.length && o == s.to && o++, Ve.range(a, o); } } -let MMt = (r, n) => r >= n.top && r <= n.bottom, z_t = (r, n, s) => MMt(n, s) && r >= s.left && r <= s.right; -function M5n(r, n, s, a) { - let l = o0.find(r.docView, n); - if (!l) +let Qj = (t, e) => t >= e.top && t <= e.bottom, vB = (t, e, r) => Qj(e, r) && t >= r.left && t <= r.right; +function axe(t, e, r, n) { + let i = bi.find(t.docView, e); + if (!i) return 1; - let h = n - l.posAtStart; - if (h == 0) + let s = e - i.posAtStart; + if (s == 0) return 1; - if (h == l.length) + if (s == i.length) return -1; - let f = l.coordsAt(h, -1); - if (f && z_t(s, a, f)) + let a = i.coordsAt(s, -1); + if (a && vB(r, n, a)) return -1; - let b = l.coordsAt(h, 1); - return b && z_t(s, a, b) ? 1 : f && MMt(a, f) ? -1 : 1; -} -function q_t(r, n) { - let s = r.posAtCoords({ x: n.clientX, y: n.clientY }, !1); - return { pos: s, bias: M5n(r, s, n.clientX, n.clientY) }; -} -const P5n = Fs.ie && Fs.ie_version <= 11; -let V_t = null, U_t = 0, W_t = 0; -function PMt(r) { - if (!P5n) - return r.detail; - let n = V_t, s = W_t; - return V_t = r, W_t = Date.now(), U_t = !n || s > Date.now() - 400 && Math.abs(n.clientX - r.clientX) < 2 && Math.abs(n.clientY - r.clientY) < 2 ? (U_t + 1) % 3 : 1; -} -function L5n(r, n) { - let s = q_t(r, n), a = PMt(n), l = r.state.selection; + let o = i.coordsAt(s, 1); + return o && vB(r, n, o) ? 1 : a && Qj(n, a) ? -1 : 1; +} +function yB(t, e) { + let r = t.posAtCoords({ x: e.clientX, y: e.clientY }, !1); + return { pos: r, bias: axe(t, r, e.clientX, e.clientY) }; +} +const oxe = Mt.ie && Mt.ie_version <= 11; +let bB = null, xB = 0, wB = 0; +function Yj(t) { + if (!oxe) + return t.detail; + let e = bB, r = wB; + return bB = t, wB = Date.now(), xB = !e || r > Date.now() - 400 && Math.abs(e.clientX - t.clientX) < 2 && Math.abs(e.clientY - t.clientY) < 2 ? (xB + 1) % 3 : 1; +} +function lxe(t, e) { + let r = yB(t, e), n = Yj(e), i = t.state.selection; return { - update(h) { - h.docChanged && (s.pos = h.changes.mapPos(s.pos), l = l.map(h.changes)); + update(s) { + s.docChanged && (r.pos = s.changes.mapPos(r.pos), i = i.map(s.changes)); }, - get(h, f, b) { - let w = q_t(r, h), O, S = Q_t(r, w.pos, w.bias, a); - if (s.pos != w.pos && !f) { - let E = Q_t(r, s.pos, s.bias, a), D = Math.min(E.from, S.from), M = Math.max(E.to, S.to); - S = D < S.from ? sr.range(D, M) : sr.range(M, D); + get(s, a, o) { + let l = yB(t, s), u, h = mB(t, l.pos, l.bias, n); + if (r.pos != l.pos && !a) { + let f = mB(t, r.pos, r.bias, n), d = Math.min(f.from, h.from), p = Math.max(f.to, h.to); + h = d < h.from ? Ve.range(d, p) : Ve.range(p, d); } - return f ? l.replaceRange(l.main.extend(S.from, S.to)) : b && a == 1 && l.ranges.length > 1 && (O = I5n(l, w.pos)) ? O : b ? l.addRange(S) : sr.create([S]); + return a ? i.replaceRange(i.main.extend(h.from, h.to)) : o && n == 1 && i.ranges.length > 1 && (u = cxe(i, l.pos)) ? u : o ? i.addRange(h) : Ve.create([h]); } }; } -function I5n(r, n) { - for (let s = 0; s < r.ranges.length; s++) { - let { from: a, to: l } = r.ranges[s]; - if (a <= n && l >= n) - return sr.create(r.ranges.slice(0, s).concat(r.ranges.slice(s + 1)), r.mainIndex == s ? 0 : r.mainIndex - (r.mainIndex > s ? 1 : 0)); +function cxe(t, e) { + for (let r = 0; r < t.ranges.length; r++) { + let { from: n, to: i } = t.ranges[r]; + if (n <= e && i >= e) + return Ve.create(t.ranges.slice(0, r).concat(t.ranges.slice(r + 1)), t.mainIndex == r ? 0 : t.mainIndex - (t.mainIndex > r ? 1 : 0)); } return null; } -mk.dragstart = (r, n) => { - let { selection: { main: s } } = r.state; - if (n.target.draggable) { - let l = r.docView.nearest(n.target); - if (l && l.isWidget) { - let h = l.posAtStart, f = h + l.length; - (h >= s.to || f <= s.from) && (s = sr.range(h, f)); +Dl.dragstart = (t, e) => { + let { selection: { main: r } } = t.state; + if (e.target.draggable) { + let i = t.docView.nearest(e.target); + if (i && i.isWidget) { + let s = i.posAtStart, a = s + i.length; + (s >= r.to || a <= r.from) && (r = Ve.range(s, a)); } } - let { inputState: a } = r; - return a.mouseSelection && (a.mouseSelection.dragging = !0), a.draggedContent = s, n.dataTransfer && (n.dataTransfer.setData("Text", r.state.sliceDoc(s.from, s.to)), n.dataTransfer.effectAllowed = "copyMove"), !1; + let { inputState: n } = t; + return n.mouseSelection && (n.mouseSelection.dragging = !0), n.draggedContent = r, e.dataTransfer && (e.dataTransfer.setData("Text", t.state.sliceDoc(r.from, r.to)), e.dataTransfer.effectAllowed = "copyMove"), !1; }; -mk.dragend = (r) => (r.inputState.draggedContent = null, !1); -function Y_t(r, n, s, a) { - if (!s) +Dl.dragend = (t) => (t.inputState.draggedContent = null, !1); +function OB(t, e, r, n) { + if (!r) return; - let l = r.posAtCoords({ x: n.clientX, y: n.clientY }, !1), { draggedContent: h } = r.inputState, f = a && h && E5n(r, n) ? { from: h.from, to: h.to } : null, b = { from: l, insert: s }, w = r.state.changes(f ? [f, b] : b); - r.focus(), r.dispatch({ - changes: w, - selection: { anchor: w.mapPos(l, -1), head: w.mapPos(l, 1) }, - userEvent: f ? "move.drop" : "input.drop" - }), r.inputState.draggedContent = null; -} -mk.drop = (r, n) => { - if (!n.dataTransfer) + let i = t.posAtCoords({ x: e.clientX, y: e.clientY }, !1), { draggedContent: s } = t.inputState, a = n && s && rxe(t, e) ? { from: s.from, to: s.to } : null, o = { from: i, insert: r }, l = t.state.changes(a ? [a, o] : o); + t.focus(), t.dispatch({ + changes: l, + selection: { anchor: l.mapPos(i, -1), head: l.mapPos(i, 1) }, + userEvent: a ? "move.drop" : "input.drop" + }), t.inputState.draggedContent = null; +} +Dl.drop = (t, e) => { + if (!e.dataTransfer) return !1; - if (r.state.readOnly) + if (t.state.readOnly) return !0; - let s = n.dataTransfer.files; - if (s && s.length) { - let a = Array(s.length), l = 0, h = () => { - ++l == s.length && Y_t(r, n, a.filter((f) => f != null).join(r.state.lineBreak), !1); + let r = e.dataTransfer.files; + if (r && r.length) { + let n = Array(r.length), i = 0, s = () => { + ++i == r.length && OB(t, e, n.filter((a) => a != null).join(t.state.lineBreak), !1); }; - for (let f = 0; f < s.length; f++) { - let b = new FileReader(); - b.onerror = h, b.onload = () => { - /[\x00-\x08\x0e-\x1f]{2}/.test(b.result) || (a[f] = b.result), h(); - }, b.readAsText(s[f]); + for (let a = 0; a < r.length; a++) { + let o = new FileReader(); + o.onerror = s, o.onload = () => { + /[\x00-\x08\x0e-\x1f]{2}/.test(o.result) || (n[a] = o.result), s(); + }, o.readAsText(r[a]); } return !0; } else { - let a = n.dataTransfer.getData("Text"); - if (a) - return Y_t(r, n, a, !0), !0; + let n = e.dataTransfer.getData("Text"); + if (n) + return OB(t, e, n, !0), !0; } return !1; }; -mk.paste = (r, n) => { - if (r.state.readOnly) +Dl.paste = (t, e) => { + if (t.state.readOnly) return !0; - r.observer.flush(); - let s = AMt ? null : n.clipboardData; - return s ? (DMt(r, s.getData("text/plain") || s.getData("text/uri-text")), !0) : (D5n(r), !1); + t.observer.flush(); + let r = Uj ? null : e.clipboardData; + return r ? (qj(t, r.getData("text/plain") || r.getData("text/uri-text")), !0) : (sxe(t), !1); }; -function N5n(r, n) { - let s = r.dom.parentNode; - if (!s) +function uxe(t, e) { + let r = t.dom.parentNode; + if (!r) return; - let a = s.appendChild(document.createElement("textarea")); - a.style.cssText = "position: fixed; left: -10000px; top: 10px", a.value = n, a.focus(), a.selectionEnd = n.length, a.selectionStart = 0, setTimeout(() => { - a.remove(), r.focus(); + let n = r.appendChild(document.createElement("textarea")); + n.style.cssText = "position: fixed; left: -10000px; top: 10px", n.value = e, n.focus(), n.selectionEnd = e.length, n.selectionStart = 0, setTimeout(() => { + n.remove(), t.focus(); }, 50); } -function R5n(r) { - let n = [], s = [], a = !1; - for (let l of r.selection.ranges) - l.empty || (n.push(r.sliceDoc(l.from, l.to)), s.push(l)); - if (!n.length) { - let l = -1; - for (let { from: h } of r.selection.ranges) { - let f = r.doc.lineAt(h); - f.number > l && (n.push(f.text), s.push({ from: f.from, to: Math.min(r.doc.length, f.to + 1) })), l = f.number; +function hxe(t) { + let e = [], r = [], n = !1; + for (let i of t.selection.ranges) + i.empty || (e.push(t.sliceDoc(i.from, i.to)), r.push(i)); + if (!e.length) { + let i = -1; + for (let { from: s } of t.selection.ranges) { + let a = t.doc.lineAt(s); + a.number > i && (e.push(a.text), r.push({ from: a.from, to: Math.min(t.doc.length, a.to + 1) })), i = a.number; } - a = !0; + n = !0; } - return { text: n.join(r.lineBreak), ranges: s, linewise: a }; + return { text: e.join(t.lineBreak), ranges: r, linewise: n }; } -let pFe = null; -mk.copy = mk.cut = (r, n) => { - let { text: s, ranges: a, linewise: l } = R5n(r.state); - if (!s && !l) +let n7 = null; +Dl.copy = Dl.cut = (t, e) => { + let { text: r, ranges: n, linewise: i } = hxe(t.state); + if (!r && !i) return !1; - pFe = l ? s : null, n.type == "cut" && !r.state.readOnly && r.dispatch({ - changes: a, + n7 = i ? r : null, e.type == "cut" && !t.state.readOnly && t.dispatch({ + changes: n, scrollIntoView: !0, userEvent: "delete.cut" }); - let h = AMt ? null : n.clipboardData; - return h ? (h.clearData(), h.setData("text/plain", s), !0) : (N5n(r, s), !1); + let s = Uj ? null : e.clipboardData; + return s ? (s.clearData(), s.setData("text/plain", r), !0) : (uxe(t, r), !1); }; -const LMt = /* @__PURE__ */ _k.define(); -function IMt(r, n) { - let s = []; - for (let a of r.facet(fMt)) { - let l = a(r, n); - l && s.push(l); +const Wj = /* @__PURE__ */ Vl.define(); +function Gj(t, e) { + let r = []; + for (let n of t.facet(Tj)) { + let i = n(t, e); + i && r.push(i); } - return s ? r.update({ effects: s, annotations: LMt.of(!0) }) : null; + return r ? t.update({ effects: r, annotations: Wj.of(!0) }) : null; } -function NMt(r) { +function Hj(t) { setTimeout(() => { - let n = r.hasFocus; - if (n != r.inputState.notifiedFocused) { - let s = IMt(r.state, n); - s ? r.dispatch(s) : r.update([]); + let e = t.hasFocus; + if (e != t.inputState.notifiedFocused) { + let r = Gj(t.state, e); + r ? t.dispatch(r) : t.update([]); } }, 10); } -bk.focus = (r) => { - r.inputState.lastFocusTime = Date.now(), !r.scrollDOM.scrollTop && (r.inputState.lastScrollTop || r.inputState.lastScrollLeft) && (r.scrollDOM.scrollTop = r.inputState.lastScrollTop, r.scrollDOM.scrollLeft = r.inputState.lastScrollLeft), NMt(r); +Nl.focus = (t) => { + t.inputState.lastFocusTime = Date.now(), !t.scrollDOM.scrollTop && (t.inputState.lastScrollTop || t.inputState.lastScrollLeft) && (t.scrollDOM.scrollTop = t.inputState.lastScrollTop, t.scrollDOM.scrollLeft = t.inputState.lastScrollLeft), Hj(t); }; -bk.blur = (r) => { - r.observer.clearSelectionRange(), NMt(r); +Nl.blur = (t) => { + t.observer.clearSelectionRange(), Hj(t); }; -bk.compositionstart = bk.compositionupdate = (r) => { - r.inputState.compositionFirstChange == null && (r.inputState.compositionFirstChange = !0), r.inputState.composing < 0 && (r.inputState.composing = 0); +Nl.compositionstart = Nl.compositionupdate = (t) => { + t.inputState.compositionFirstChange == null && (t.inputState.compositionFirstChange = !0), t.inputState.composing < 0 && (t.inputState.composing = 0); }; -bk.compositionend = (r) => { - r.inputState.composing = -1, r.inputState.compositionEndedAt = Date.now(), r.inputState.compositionPendingKey = !0, r.inputState.compositionPendingChange = r.observer.pendingRecords().length > 0, r.inputState.compositionFirstChange = null, Fs.chrome && Fs.android ? r.observer.flushSoon() : r.inputState.compositionPendingChange ? Promise.resolve().then(() => r.observer.flush()) : setTimeout(() => { - r.inputState.composing < 0 && r.docView.hasComposition && r.update([]); +Nl.compositionend = (t) => { + t.inputState.composing = -1, t.inputState.compositionEndedAt = Date.now(), t.inputState.compositionPendingKey = !0, t.inputState.compositionPendingChange = t.observer.pendingRecords().length > 0, t.inputState.compositionFirstChange = null, Mt.chrome && Mt.android ? t.observer.flushSoon() : t.inputState.compositionPendingChange ? Promise.resolve().then(() => t.observer.flush()) : setTimeout(() => { + t.inputState.composing < 0 && t.docView.hasComposition && t.update([]); }, 50); }; -bk.contextmenu = (r) => { - r.inputState.lastContextMenu = Date.now(); +Nl.contextmenu = (t) => { + t.inputState.lastContextMenu = Date.now(); }; -mk.beforeinput = (r, n) => { - var s; - let a; - if (Fs.chrome && Fs.android && (a = EMt.find((l) => l.inputType == n.inputType)) && (r.observer.delayAndroidKey(a.key, a.keyCode), a.key == "Backspace" || a.key == "Delete")) { - let l = ((s = window.visualViewport) === null || s === void 0 ? void 0 : s.height) || 0; +Dl.beforeinput = (t, e) => { + var r; + let n; + if (Mt.chrome && Mt.android && (n = zj.find((i) => i.inputType == e.inputType)) && (t.observer.delayAndroidKey(n.key, n.keyCode), n.key == "Backspace" || n.key == "Delete")) { + let i = ((r = window.visualViewport) === null || r === void 0 ? void 0 : r.height) || 0; setTimeout(() => { - var h; - (((h = window.visualViewport) === null || h === void 0 ? void 0 : h.height) || 0) > l + 10 && r.hasFocus && (r.contentDOM.blur(), r.focus()); + var s; + (((s = window.visualViewport) === null || s === void 0 ? void 0 : s.height) || 0) > i + 10 && t.hasFocus && (t.contentDOM.blur(), t.focus()); }, 100); } return !1; }; -const H_t = /* @__PURE__ */ new Set(); -function $5n(r) { - H_t.has(r) || (H_t.add(r), r.addEventListener("copy", () => { - }), r.addEventListener("cut", () => { +const kB = /* @__PURE__ */ new Set(); +function fxe(t) { + kB.has(t) || (kB.add(t), t.addEventListener("copy", () => { + }), t.addEventListener("cut", () => { })); } -const G_t = ["pre-wrap", "normal", "pre-line", "break-spaces"]; -class B5n { - constructor(n) { - this.lineWrapping = n, this.doc = Al.empty, this.heightSamples = {}, this.lineHeight = 14, this.charWidth = 7, this.textHeight = 14, this.lineLength = 30, this.heightChanged = !1; +const SB = ["pre-wrap", "normal", "pre-line", "break-spaces"]; +class dxe { + constructor(e) { + this.lineWrapping = e, this.doc = Dr.empty, this.heightSamples = {}, this.lineHeight = 14, this.charWidth = 7, this.textHeight = 14, this.lineLength = 30, this.heightChanged = !1; } - heightForGap(n, s) { - let a = this.doc.lineAt(s).number - this.doc.lineAt(n).number + 1; - return this.lineWrapping && (a += Math.max(0, Math.ceil((s - n - a * this.lineLength * 0.5) / this.lineLength))), this.lineHeight * a; + heightForGap(e, r) { + let n = this.doc.lineAt(r).number - this.doc.lineAt(e).number + 1; + return this.lineWrapping && (n += Math.max(0, Math.ceil((r - e - n * this.lineLength * 0.5) / this.lineLength))), this.lineHeight * n; } - heightForLine(n) { - return this.lineWrapping ? (1 + Math.max(0, Math.ceil((n - this.lineLength) / (this.lineLength - 5)))) * this.lineHeight : this.lineHeight; + heightForLine(e) { + return this.lineWrapping ? (1 + Math.max(0, Math.ceil((e - this.lineLength) / (this.lineLength - 5)))) * this.lineHeight : this.lineHeight; } - setDoc(n) { - return this.doc = n, this; + setDoc(e) { + return this.doc = e, this; } - mustRefreshForWrapping(n) { - return G_t.indexOf(n) > -1 != this.lineWrapping; + mustRefreshForWrapping(e) { + return SB.indexOf(e) > -1 != this.lineWrapping; } - mustRefreshForHeights(n) { - let s = !1; - for (let a = 0; a < n.length; a++) { - let l = n[a]; - l < 0 ? a++ : this.heightSamples[Math.floor(l * 10)] || (s = !0, this.heightSamples[Math.floor(l * 10)] = !0); + mustRefreshForHeights(e) { + let r = !1; + for (let n = 0; n < e.length; n++) { + let i = e[n]; + i < 0 ? n++ : this.heightSamples[Math.floor(i * 10)] || (r = !0, this.heightSamples[Math.floor(i * 10)] = !0); } - return s; + return r; } - refresh(n, s, a, l, h, f) { - let b = G_t.indexOf(n) > -1, w = Math.round(s) != Math.round(this.lineHeight) || this.lineWrapping != b; - if (this.lineWrapping = b, this.lineHeight = s, this.charWidth = a, this.textHeight = l, this.lineLength = h, w) { + refresh(e, r, n, i, s, a) { + let o = SB.indexOf(e) > -1, l = Math.round(r) != Math.round(this.lineHeight) || this.lineWrapping != o; + if (this.lineWrapping = o, this.lineHeight = r, this.charWidth = n, this.textHeight = i, this.lineLength = s, l) { this.heightSamples = {}; - for (let O = 0; O < f.length; O++) { - let S = f[O]; - S < 0 ? O++ : this.heightSamples[Math.floor(S * 10)] = !0; + for (let u = 0; u < a.length; u++) { + let h = a[u]; + h < 0 ? u++ : this.heightSamples[Math.floor(h * 10)] = !0; } } - return w; + return l; } } -class F5n { - constructor(n, s) { - this.from = n, this.heights = s, this.index = 0; +class pxe { + constructor(e, r) { + this.from = e, this.heights = r, this.index = 0; } get more() { return this.index < this.heights.length; } } -class W4 { - constructor(n, s, a, l, h) { - this.from = n, this.length = s, this.top = a, this.height = l, this._content = h; +class fc { + constructor(e, r, n, i, s) { + this.from = e, this.length = r, this.top = n, this.height = i, this._content = s; } get type() { - return typeof this._content == "number" ? Pm.Text : Array.isArray(this._content) ? this._content : this._content.type; + return typeof this._content == "number" ? ia.Text : Array.isArray(this._content) ? this._content : this._content.type; } get to() { return this.from + this.length; @@ -6895,491 +6904,491 @@ class W4 { return this.top + this.height; } get widget() { - return this._content instanceof p8 ? this._content.widget : null; + return this._content instanceof af ? this._content.widget : null; } get widgetLineBreaks() { return typeof this._content == "number" ? this._content : 0; } - join(n) { - let s = (Array.isArray(this._content) ? this._content : [this]).concat(Array.isArray(n._content) ? n._content : [n]); - return new W4(this.from, this.length + n.length, this.top, this.height + n.height, s); + join(e) { + let r = (Array.isArray(this._content) ? this._content : [this]).concat(Array.isArray(e._content) ? e._content : [e]); + return new fc(this.from, this.length + e.length, this.top, this.height + e.height, r); } } -var Ah = /* @__PURE__ */ function(r) { - return r[r.ByPos = 0] = "ByPos", r[r.ByHeight = 1] = "ByHeight", r[r.ByPosNoHeight = 2] = "ByPosNoHeight", r; -}(Ah || (Ah = {})); -const Hme = 1e-3; -class Lm { - constructor(n, s, a = 2) { - this.length = n, this.height = s, this.flags = a; +var mn = /* @__PURE__ */ function(t) { + return t[t.ByPos = 0] = "ByPos", t[t.ByHeight = 1] = "ByHeight", t[t.ByPosNoHeight = 2] = "ByPosNoHeight", t; +}(mn || (mn = {})); +const s4 = 1e-3; +class sa { + constructor(e, r, n = 2) { + this.length = e, this.height = r, this.flags = n; } get outdated() { return (this.flags & 2) > 0; } - set outdated(n) { - this.flags = (n ? 2 : 0) | this.flags & -3; + set outdated(e) { + this.flags = (e ? 2 : 0) | this.flags & -3; } - setHeight(n, s) { - this.height != s && (Math.abs(this.height - s) > Hme && (n.heightChanged = !0), this.height = s); + setHeight(e, r) { + this.height != r && (Math.abs(this.height - r) > s4 && (e.heightChanged = !0), this.height = r); } - replace(n, s, a) { - return Lm.of(a); + replace(e, r, n) { + return sa.of(n); } - decomposeLeft(n, s) { - s.push(this); + decomposeLeft(e, r) { + r.push(this); } - decomposeRight(n, s) { - s.push(this); + decomposeRight(e, r) { + r.push(this); } - applyChanges(n, s, a, l) { - let h = this, f = a.doc; - for (let b = l.length - 1; b >= 0; b--) { - let { fromA: w, toA: O, fromB: S, toB: E } = l[b], D = h.lineAt(w, Ah.ByPosNoHeight, a.setDoc(s), 0, 0), M = D.to >= O ? D : h.lineAt(O, Ah.ByPosNoHeight, a, 0, 0); - for (E += M.to - O, O = M.to; b > 0 && D.from <= l[b - 1].toA; ) - w = l[b - 1].fromA, S = l[b - 1].fromB, b--, w < D.from && (D = h.lineAt(w, Ah.ByPosNoHeight, a, 0, 0)); - S += D.from - w, w = D.from; - let B = fze.build(a.setDoc(f), n, S, E); - h = h.replace(w, O, B); + applyChanges(e, r, n, i) { + let s = this, a = n.doc; + for (let o = i.length - 1; o >= 0; o--) { + let { fromA: l, toA: u, fromB: h, toB: f } = i[o], d = s.lineAt(l, mn.ByPosNoHeight, n.setDoc(r), 0, 0), p = d.to >= u ? d : s.lineAt(u, mn.ByPosNoHeight, n, 0, 0); + for (f += p.to - u, u = p.to; o > 0 && d.from <= i[o - 1].toA; ) + l = i[o - 1].fromA, h = i[o - 1].fromB, o--, l < d.from && (d = s.lineAt(l, mn.ByPosNoHeight, n, 0, 0)); + h += d.from - l, l = d.from; + let g = BR.build(n.setDoc(a), e, h, f); + s = s.replace(l, u, g); } - return h.updateHeight(a, 0); + return s.updateHeight(n, 0); } static empty() { - return new L2(0, 0); + return new ja(0, 0); } - static of(n) { - if (n.length == 1) - return n[0]; - let s = 0, a = n.length, l = 0, h = 0; + static of(e) { + if (e.length == 1) + return e[0]; + let r = 0, n = e.length, i = 0, s = 0; for (; ; ) - if (s == a) - if (l > h * 2) { - let b = n[s - 1]; - b.break ? n.splice(--s, 1, b.left, null, b.right) : n.splice(--s, 1, b.left, b.right), a += 1 + b.break, l -= b.size; - } else if (h > l * 2) { - let b = n[a]; - b.break ? n.splice(a, 1, b.left, null, b.right) : n.splice(a, 1, b.left, b.right), a += 2 + b.break, h -= b.size; + if (r == n) + if (i > s * 2) { + let o = e[r - 1]; + o.break ? e.splice(--r, 1, o.left, null, o.right) : e.splice(--r, 1, o.left, o.right), n += 1 + o.break, i -= o.size; + } else if (s > i * 2) { + let o = e[n]; + o.break ? e.splice(n, 1, o.left, null, o.right) : e.splice(n, 1, o.left, o.right), n += 2 + o.break, s -= o.size; } else break; - else if (l < h) { - let b = n[s++]; - b && (l += b.size); + else if (i < s) { + let o = e[r++]; + o && (i += o.size); } else { - let b = n[--a]; - b && (h += b.size); + let o = e[--n]; + o && (s += o.size); } - let f = 0; - return n[s - 1] == null ? (f = 1, s--) : n[s] == null && (f = 1, a++), new j5n(Lm.of(n.slice(0, s)), f, Lm.of(n.slice(a))); + let a = 0; + return e[r - 1] == null ? (a = 1, r--) : e[r] == null && (a = 1, n++), new gxe(sa.of(e.slice(0, r)), a, sa.of(e.slice(n))); } } -Lm.prototype.size = 1; -class RMt extends Lm { - constructor(n, s, a) { - super(n, s), this.deco = a; +sa.prototype.size = 1; +class Xj extends sa { + constructor(e, r, n) { + super(e, r), this.deco = n; } - blockAt(n, s, a, l) { - return new W4(l, this.length, a, this.height, this.deco || 0); + blockAt(e, r, n, i) { + return new fc(i, this.length, n, this.height, this.deco || 0); } - lineAt(n, s, a, l, h) { - return this.blockAt(0, a, l, h); + lineAt(e, r, n, i, s) { + return this.blockAt(0, n, i, s); } - forEachLine(n, s, a, l, h, f) { - n <= h + this.length && s >= h && f(this.blockAt(0, a, l, h)); + forEachLine(e, r, n, i, s, a) { + e <= s + this.length && r >= s && a(this.blockAt(0, n, i, s)); } - updateHeight(n, s = 0, a = !1, l) { - return l && l.from <= s && l.more && this.setHeight(n, l.heights[l.index++]), this.outdated = !1, this; + updateHeight(e, r = 0, n = !1, i) { + return i && i.from <= r && i.more && this.setHeight(e, i.heights[i.index++]), this.outdated = !1, this; } toString() { return `block(${this.length})`; } } -class L2 extends RMt { - constructor(n, s) { - super(n, s, null), this.collapsed = 0, this.widgetHeight = 0, this.breaks = 0; +class ja extends Xj { + constructor(e, r) { + super(e, r, null), this.collapsed = 0, this.widgetHeight = 0, this.breaks = 0; } - blockAt(n, s, a, l) { - return new W4(l, this.length, a, this.height, this.breaks); + blockAt(e, r, n, i) { + return new fc(i, this.length, n, this.height, this.breaks); } - replace(n, s, a) { - let l = a[0]; - return a.length == 1 && (l instanceof L2 || l instanceof Pp && l.flags & 4) && Math.abs(this.length - l.length) < 10 ? (l instanceof Pp ? l = new L2(l.length, this.height) : l.height = this.height, this.outdated || (l.outdated = !1), l) : Lm.of(a); + replace(e, r, n) { + let i = n[0]; + return n.length == 1 && (i instanceof ja || i instanceof is && i.flags & 4) && Math.abs(this.length - i.length) < 10 ? (i instanceof is ? i = new ja(i.length, this.height) : i.height = this.height, this.outdated || (i.outdated = !1), i) : sa.of(n); } - updateHeight(n, s = 0, a = !1, l) { - return l && l.from <= s && l.more ? this.setHeight(n, l.heights[l.index++]) : (a || this.outdated) && this.setHeight(n, Math.max(this.widgetHeight, n.heightForLine(this.length - this.collapsed)) + this.breaks * n.lineHeight), this.outdated = !1, this; + updateHeight(e, r = 0, n = !1, i) { + return i && i.from <= r && i.more ? this.setHeight(e, i.heights[i.index++]) : (n || this.outdated) && this.setHeight(e, Math.max(this.widgetHeight, e.heightForLine(this.length - this.collapsed)) + this.breaks * e.lineHeight), this.outdated = !1, this; } toString() { return `line(${this.length}${this.collapsed ? -this.collapsed : ""}${this.widgetHeight ? ":" + this.widgetHeight : ""})`; } } -class Pp extends Lm { - constructor(n) { - super(n, 0); +class is extends sa { + constructor(e) { + super(e, 0); } - heightMetrics(n, s) { - let a = n.doc.lineAt(s).number, l = n.doc.lineAt(s + this.length).number, h = l - a + 1, f, b = 0; - if (n.lineWrapping) { - let w = Math.min(this.height, n.lineHeight * h); - f = w / h, this.length > h + 1 && (b = (this.height - w) / (this.length - h - 1)); + heightMetrics(e, r) { + let n = e.doc.lineAt(r).number, i = e.doc.lineAt(r + this.length).number, s = i - n + 1, a, o = 0; + if (e.lineWrapping) { + let l = Math.min(this.height, e.lineHeight * s); + a = l / s, this.length > s + 1 && (o = (this.height - l) / (this.length - s - 1)); } else - f = this.height / h; - return { firstLine: a, lastLine: l, perLine: f, perChar: b }; - } - blockAt(n, s, a, l) { - let { firstLine: h, lastLine: f, perLine: b, perChar: w } = this.heightMetrics(s, l); - if (s.lineWrapping) { - let O = l + Math.round(Math.max(0, Math.min(1, (n - a) / this.height)) * this.length), S = s.doc.lineAt(O), E = b + S.length * w, D = Math.max(a, n - E / 2); - return new W4(S.from, S.length, D, E, 0); + a = this.height / s; + return { firstLine: n, lastLine: i, perLine: a, perChar: o }; + } + blockAt(e, r, n, i) { + let { firstLine: s, lastLine: a, perLine: o, perChar: l } = this.heightMetrics(r, i); + if (r.lineWrapping) { + let u = i + Math.round(Math.max(0, Math.min(1, (e - n) / this.height)) * this.length), h = r.doc.lineAt(u), f = o + h.length * l, d = Math.max(n, e - f / 2); + return new fc(h.from, h.length, d, f, 0); } else { - let O = Math.max(0, Math.min(f - h, Math.floor((n - a) / b))), { from: S, length: E } = s.doc.line(h + O); - return new W4(S, E, a + b * O, b, 0); - } - } - lineAt(n, s, a, l, h) { - if (s == Ah.ByHeight) - return this.blockAt(n, a, l, h); - if (s == Ah.ByPosNoHeight) { - let { from: M, to: B } = a.doc.lineAt(n); - return new W4(M, B - M, 0, 0, 0); - } - let { firstLine: f, perLine: b, perChar: w } = this.heightMetrics(a, h), O = a.doc.lineAt(n), S = b + O.length * w, E = O.number - f, D = l + b * E + w * (O.from - h - E); - return new W4(O.from, O.length, Math.max(l, Math.min(D, l + this.height - S)), S, 0); - } - forEachLine(n, s, a, l, h, f) { - n = Math.max(n, h), s = Math.min(s, h + this.length); - let { firstLine: b, perLine: w, perChar: O } = this.heightMetrics(a, h); - for (let S = n, E = l; S <= s; ) { - let D = a.doc.lineAt(S); - if (S == n) { - let B = D.number - b; - E += w * B + O * (n - h - B); - } - let M = w + O * D.length; - f(new W4(D.from, D.length, E, M, 0)), E += M, S = D.to + 1; - } - } - replace(n, s, a) { - let l = this.length - s; - if (l > 0) { - let h = a[a.length - 1]; - h instanceof Pp ? a[a.length - 1] = new Pp(h.length + l) : a.push(null, new Pp(l - 1)); - } - if (n > 0) { - let h = a[0]; - h instanceof Pp ? a[0] = new Pp(n + h.length) : a.unshift(new Pp(n - 1), null); - } - return Lm.of(a); - } - decomposeLeft(n, s) { - s.push(new Pp(n - 1), null); - } - decomposeRight(n, s) { - s.push(null, new Pp(this.length - n - 1)); - } - updateHeight(n, s = 0, a = !1, l) { - let h = s + this.length; - if (l && l.from <= s + this.length && l.more) { - let f = [], b = Math.max(s, l.from), w = -1; - for (l.from > s && f.push(new Pp(l.from - s - 1).updateHeight(n, s)); b <= h && l.more; ) { - let S = n.doc.lineAt(b).length; - f.length && f.push(null); - let E = l.heights[l.index++]; - w == -1 ? w = E : Math.abs(E - w) >= Hme && (w = -2); - let D = new L2(S, E); - D.outdated = !1, f.push(D), b += S + 1; - } - b <= h && f.push(null, new Pp(h - b).updateHeight(n, b)); - let O = Lm.of(f); - return (w < 0 || Math.abs(O.height - this.height) >= Hme || Math.abs(w - this.heightMetrics(n, s).perLine) >= Hme) && (n.heightChanged = !0), O; + let u = Math.max(0, Math.min(a - s, Math.floor((e - n) / o))), { from: h, length: f } = r.doc.line(s + u); + return new fc(h, f, n + o * u, o, 0); + } + } + lineAt(e, r, n, i, s) { + if (r == mn.ByHeight) + return this.blockAt(e, n, i, s); + if (r == mn.ByPosNoHeight) { + let { from: p, to: g } = n.doc.lineAt(e); + return new fc(p, g - p, 0, 0, 0); + } + let { firstLine: a, perLine: o, perChar: l } = this.heightMetrics(n, s), u = n.doc.lineAt(e), h = o + u.length * l, f = u.number - a, d = i + o * f + l * (u.from - s - f); + return new fc(u.from, u.length, Math.max(i, Math.min(d, i + this.height - h)), h, 0); + } + forEachLine(e, r, n, i, s, a) { + e = Math.max(e, s), r = Math.min(r, s + this.length); + let { firstLine: o, perLine: l, perChar: u } = this.heightMetrics(n, s); + for (let h = e, f = i; h <= r; ) { + let d = n.doc.lineAt(h); + if (h == e) { + let g = d.number - o; + f += l * g + u * (e - s - g); + } + let p = l + u * d.length; + a(new fc(d.from, d.length, f, p, 0)), f += p, h = d.to + 1; + } + } + replace(e, r, n) { + let i = this.length - r; + if (i > 0) { + let s = n[n.length - 1]; + s instanceof is ? n[n.length - 1] = new is(s.length + i) : n.push(null, new is(i - 1)); + } + if (e > 0) { + let s = n[0]; + s instanceof is ? n[0] = new is(e + s.length) : n.unshift(new is(e - 1), null); + } + return sa.of(n); + } + decomposeLeft(e, r) { + r.push(new is(e - 1), null); + } + decomposeRight(e, r) { + r.push(null, new is(this.length - e - 1)); + } + updateHeight(e, r = 0, n = !1, i) { + let s = r + this.length; + if (i && i.from <= r + this.length && i.more) { + let a = [], o = Math.max(r, i.from), l = -1; + for (i.from > r && a.push(new is(i.from - r - 1).updateHeight(e, r)); o <= s && i.more; ) { + let h = e.doc.lineAt(o).length; + a.length && a.push(null); + let f = i.heights[i.index++]; + l == -1 ? l = f : Math.abs(f - l) >= s4 && (l = -2); + let d = new ja(h, f); + d.outdated = !1, a.push(d), o += h + 1; + } + o <= s && a.push(null, new is(s - o).updateHeight(e, o)); + let u = sa.of(a); + return (l < 0 || Math.abs(u.height - this.height) >= s4 || Math.abs(l - this.heightMetrics(e, r).perLine) >= s4) && (e.heightChanged = !0), u; } else - (a || this.outdated) && (this.setHeight(n, n.heightForGap(s, s + this.length)), this.outdated = !1); + (n || this.outdated) && (this.setHeight(e, e.heightForGap(r, r + this.length)), this.outdated = !1); return this; } toString() { return `gap(${this.length})`; } } -class j5n extends Lm { - constructor(n, s, a) { - super(n.length + s + a.length, n.height + a.height, s | (n.outdated || a.outdated ? 2 : 0)), this.left = n, this.right = a, this.size = n.size + a.size; +class gxe extends sa { + constructor(e, r, n) { + super(e.length + r + n.length, e.height + n.height, r | (e.outdated || n.outdated ? 2 : 0)), this.left = e, this.right = n, this.size = e.size + n.size; } get break() { return this.flags & 1; } - blockAt(n, s, a, l) { - let h = a + this.left.height; - return n < h ? this.left.blockAt(n, s, a, l) : this.right.blockAt(n, s, h, l + this.left.length + this.break); + blockAt(e, r, n, i) { + let s = n + this.left.height; + return e < s ? this.left.blockAt(e, r, n, i) : this.right.blockAt(e, r, s, i + this.left.length + this.break); } - lineAt(n, s, a, l, h) { - let f = l + this.left.height, b = h + this.left.length + this.break, w = s == Ah.ByHeight ? n < f : n < b, O = w ? this.left.lineAt(n, s, a, l, h) : this.right.lineAt(n, s, a, f, b); - if (this.break || (w ? O.to < b : O.from > b)) - return O; - let S = s == Ah.ByPosNoHeight ? Ah.ByPosNoHeight : Ah.ByPos; - return w ? O.join(this.right.lineAt(b, S, a, f, b)) : this.left.lineAt(b, S, a, l, h).join(O); + lineAt(e, r, n, i, s) { + let a = i + this.left.height, o = s + this.left.length + this.break, l = r == mn.ByHeight ? e < a : e < o, u = l ? this.left.lineAt(e, r, n, i, s) : this.right.lineAt(e, r, n, a, o); + if (this.break || (l ? u.to < o : u.from > o)) + return u; + let h = r == mn.ByPosNoHeight ? mn.ByPosNoHeight : mn.ByPos; + return l ? u.join(this.right.lineAt(o, h, n, a, o)) : this.left.lineAt(o, h, n, i, s).join(u); } - forEachLine(n, s, a, l, h, f) { - let b = l + this.left.height, w = h + this.left.length + this.break; + forEachLine(e, r, n, i, s, a) { + let o = i + this.left.height, l = s + this.left.length + this.break; if (this.break) - n < w && this.left.forEachLine(n, s, a, l, h, f), s >= w && this.right.forEachLine(n, s, a, b, w, f); + e < l && this.left.forEachLine(e, r, n, i, s, a), r >= l && this.right.forEachLine(e, r, n, o, l, a); else { - let O = this.lineAt(w, Ah.ByPos, a, l, h); - n < O.from && this.left.forEachLine(n, O.from - 1, a, l, h, f), O.to >= n && O.from <= s && f(O), s > O.to && this.right.forEachLine(O.to + 1, s, a, b, w, f); - } - } - replace(n, s, a) { - let l = this.left.length + this.break; - if (s < l) - return this.balanced(this.left.replace(n, s, a), this.right); - if (n > this.left.length) - return this.balanced(this.left, this.right.replace(n - l, s - l, a)); - let h = []; - n > 0 && this.decomposeLeft(n, h); - let f = h.length; - for (let b of a) - h.push(b); - if (n > 0 && Z_t(h, f - 1), s < this.length) { - let b = h.length; - this.decomposeRight(s, h), Z_t(h, b); - } - return Lm.of(h); - } - decomposeLeft(n, s) { - let a = this.left.length; - if (n <= a) - return this.left.decomposeLeft(n, s); - s.push(this.left), this.break && (a++, n >= a && s.push(null)), n > a && this.right.decomposeLeft(n - a, s); - } - decomposeRight(n, s) { - let a = this.left.length, l = a + this.break; - if (n >= l) - return this.right.decomposeRight(n - l, s); - n < a && this.left.decomposeRight(n, s), this.break && n < l && s.push(null), s.push(this.right); - } - balanced(n, s) { - return n.size > 2 * s.size || s.size > 2 * n.size ? Lm.of(this.break ? [n, null, s] : [n, s]) : (this.left = n, this.right = s, this.height = n.height + s.height, this.outdated = n.outdated || s.outdated, this.size = n.size + s.size, this.length = n.length + this.break + s.length, this); - } - updateHeight(n, s = 0, a = !1, l) { - let { left: h, right: f } = this, b = s + h.length + this.break, w = null; - return l && l.from <= s + h.length && l.more ? w = h = h.updateHeight(n, s, a, l) : h.updateHeight(n, s, a), l && l.from <= b + f.length && l.more ? w = f = f.updateHeight(n, b, a, l) : f.updateHeight(n, b, a), w ? this.balanced(h, f) : (this.height = this.left.height + this.right.height, this.outdated = !1, this); + let u = this.lineAt(l, mn.ByPos, n, i, s); + e < u.from && this.left.forEachLine(e, u.from - 1, n, i, s, a), u.to >= e && u.from <= r && a(u), r > u.to && this.right.forEachLine(u.to + 1, r, n, o, l, a); + } + } + replace(e, r, n) { + let i = this.left.length + this.break; + if (r < i) + return this.balanced(this.left.replace(e, r, n), this.right); + if (e > this.left.length) + return this.balanced(this.left, this.right.replace(e - i, r - i, n)); + let s = []; + e > 0 && this.decomposeLeft(e, s); + let a = s.length; + for (let o of n) + s.push(o); + if (e > 0 && TB(s, a - 1), r < this.length) { + let o = s.length; + this.decomposeRight(r, s), TB(s, o); + } + return sa.of(s); + } + decomposeLeft(e, r) { + let n = this.left.length; + if (e <= n) + return this.left.decomposeLeft(e, r); + r.push(this.left), this.break && (n++, e >= n && r.push(null)), e > n && this.right.decomposeLeft(e - n, r); + } + decomposeRight(e, r) { + let n = this.left.length, i = n + this.break; + if (e >= i) + return this.right.decomposeRight(e - i, r); + e < n && this.left.decomposeRight(e, r), this.break && e < i && r.push(null), r.push(this.right); + } + balanced(e, r) { + return e.size > 2 * r.size || r.size > 2 * e.size ? sa.of(this.break ? [e, null, r] : [e, r]) : (this.left = e, this.right = r, this.height = e.height + r.height, this.outdated = e.outdated || r.outdated, this.size = e.size + r.size, this.length = e.length + this.break + r.length, this); + } + updateHeight(e, r = 0, n = !1, i) { + let { left: s, right: a } = this, o = r + s.length + this.break, l = null; + return i && i.from <= r + s.length && i.more ? l = s = s.updateHeight(e, r, n, i) : s.updateHeight(e, r, n), i && i.from <= o + a.length && i.more ? l = a = a.updateHeight(e, o, n, i) : a.updateHeight(e, o, n), l ? this.balanced(s, a) : (this.height = this.left.height + this.right.height, this.outdated = !1, this); } toString() { return this.left + (this.break ? " " : "-") + this.right; } } -function Z_t(r, n) { - let s, a; - r[n] == null && (s = r[n - 1]) instanceof Pp && (a = r[n + 1]) instanceof Pp && r.splice(n - 1, 3, new Pp(s.length + 1 + a.length)); +function TB(t, e) { + let r, n; + t[e] == null && (r = t[e - 1]) instanceof is && (n = t[e + 1]) instanceof is && t.splice(e - 1, 3, new is(r.length + 1 + n.length)); } -const Q5n = 5; -class fze { - constructor(n, s) { - this.pos = n, this.oracle = s, this.nodes = [], this.lineStart = -1, this.lineEnd = -1, this.covering = null, this.writtenTo = n; +const mxe = 5; +class BR { + constructor(e, r) { + this.pos = e, this.oracle = r, this.nodes = [], this.lineStart = -1, this.lineEnd = -1, this.covering = null, this.writtenTo = e; } get isCovered() { return this.covering && this.nodes[this.nodes.length - 1] == this.covering; } - span(n, s) { + span(e, r) { if (this.lineStart > -1) { - let a = Math.min(s, this.lineEnd), l = this.nodes[this.nodes.length - 1]; - l instanceof L2 ? l.length += a - this.pos : (a > this.pos || !this.isCovered) && this.nodes.push(new L2(a - this.pos, -1)), this.writtenTo = a, s > a && (this.nodes.push(null), this.writtenTo++, this.lineStart = -1); + let n = Math.min(r, this.lineEnd), i = this.nodes[this.nodes.length - 1]; + i instanceof ja ? i.length += n - this.pos : (n > this.pos || !this.isCovered) && this.nodes.push(new ja(n - this.pos, -1)), this.writtenTo = n, r > n && (this.nodes.push(null), this.writtenTo++, this.lineStart = -1); } - this.pos = s; + this.pos = r; } - point(n, s, a) { - if (n < s || a.heightRelevant) { - let l = a.widget ? a.widget.estimatedHeight : 0, h = a.widget ? a.widget.lineBreaks : 0; - l < 0 && (l = this.oracle.lineHeight); - let f = s - n; - a.block ? this.addBlock(new RMt(f, l, a)) : (f || h || l >= Q5n) && this.addLineDeco(l, h, f); + point(e, r, n) { + if (e < r || n.heightRelevant) { + let i = n.widget ? n.widget.estimatedHeight : 0, s = n.widget ? n.widget.lineBreaks : 0; + i < 0 && (i = this.oracle.lineHeight); + let a = r - e; + n.block ? this.addBlock(new Xj(a, i, n)) : (a || s || i >= mxe) && this.addLineDeco(i, s, a); } else - s > n && this.span(n, s); + r > e && this.span(e, r); this.lineEnd > -1 && this.lineEnd < this.pos && (this.lineEnd = this.oracle.doc.lineAt(this.pos).to); } enterLine() { if (this.lineStart > -1) return; - let { from: n, to: s } = this.oracle.doc.lineAt(this.pos); - this.lineStart = n, this.lineEnd = s, this.writtenTo < n && ((this.writtenTo < n - 1 || this.nodes[this.nodes.length - 1] == null) && this.nodes.push(this.blankContent(this.writtenTo, n - 1)), this.nodes.push(null)), this.pos > n && this.nodes.push(new L2(this.pos - n, -1)), this.writtenTo = this.pos; + let { from: e, to: r } = this.oracle.doc.lineAt(this.pos); + this.lineStart = e, this.lineEnd = r, this.writtenTo < e && ((this.writtenTo < e - 1 || this.nodes[this.nodes.length - 1] == null) && this.nodes.push(this.blankContent(this.writtenTo, e - 1)), this.nodes.push(null)), this.pos > e && this.nodes.push(new ja(this.pos - e, -1)), this.writtenTo = this.pos; } - blankContent(n, s) { - let a = new Pp(s - n); - return this.oracle.doc.lineAt(n).to == s && (a.flags |= 4), a; + blankContent(e, r) { + let n = new is(r - e); + return this.oracle.doc.lineAt(e).to == r && (n.flags |= 4), n; } ensureLine() { this.enterLine(); - let n = this.nodes.length ? this.nodes[this.nodes.length - 1] : null; - if (n instanceof L2) - return n; - let s = new L2(0, -1); - return this.nodes.push(s), s; + let e = this.nodes.length ? this.nodes[this.nodes.length - 1] : null; + if (e instanceof ja) + return e; + let r = new ja(0, -1); + return this.nodes.push(r), r; } - addBlock(n) { + addBlock(e) { this.enterLine(); - let s = n.deco; - s && s.startSide > 0 && !this.isCovered && this.ensureLine(), this.nodes.push(n), this.writtenTo = this.pos = this.pos + n.length, s && s.endSide > 0 && (this.covering = n); - } - addLineDeco(n, s, a) { - let l = this.ensureLine(); - l.length += a, l.collapsed += a, l.widgetHeight = Math.max(l.widgetHeight, n), l.breaks += s, this.writtenTo = this.pos = this.pos + a; - } - finish(n) { - let s = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1]; - this.lineStart > -1 && !(s instanceof L2) && !this.isCovered ? this.nodes.push(new L2(0, -1)) : (this.writtenTo < this.pos || s == null) && this.nodes.push(this.blankContent(this.writtenTo, this.pos)); - let a = n; - for (let l of this.nodes) - l instanceof L2 && l.updateHeight(this.oracle, a), a += l ? l.length : 1; + let r = e.deco; + r && r.startSide > 0 && !this.isCovered && this.ensureLine(), this.nodes.push(e), this.writtenTo = this.pos = this.pos + e.length, r && r.endSide > 0 && (this.covering = e); + } + addLineDeco(e, r, n) { + let i = this.ensureLine(); + i.length += n, i.collapsed += n, i.widgetHeight = Math.max(i.widgetHeight, e), i.breaks += r, this.writtenTo = this.pos = this.pos + n; + } + finish(e) { + let r = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1]; + this.lineStart > -1 && !(r instanceof ja) && !this.isCovered ? this.nodes.push(new ja(0, -1)) : (this.writtenTo < this.pos || r == null) && this.nodes.push(this.blankContent(this.writtenTo, this.pos)); + let n = e; + for (let i of this.nodes) + i instanceof ja && i.updateHeight(this.oracle, n), n += i ? i.length : 1; return this.nodes; } - static build(n, s, a, l) { - let h = new fze(a, n); - return cl.spans(s, a, l, h, 0), h.finish(a); + static build(e, r, n, i) { + let s = new BR(n, e); + return Er.spans(r, n, i, s, 0), s.finish(n); } } -function z5n(r, n, s) { - let a = new q5n(); - return cl.compare(r, n, s, a, 0), a.changes; +function vxe(t, e, r) { + let n = new yxe(); + return Er.compare(t, e, r, n, 0), n.changes; } -class q5n { +class yxe { constructor() { this.changes = []; } compareRange() { } - comparePoint(n, s, a, l) { - (n < s || a && a.heightRelevant || l && l.heightRelevant) && aFe(n, s, this.changes, 5); + comparePoint(e, r, n, i) { + (e < r || n && n.heightRelevant || i && i.heightRelevant) && ZA(e, r, this.changes, 5); } } -function V5n(r, n) { - let s = r.getBoundingClientRect(), a = r.ownerDocument, l = a.defaultView || window, h = Math.max(0, s.left), f = Math.min(l.innerWidth, s.right), b = Math.max(0, s.top), w = Math.min(l.innerHeight, s.bottom); - for (let O = r.parentNode; O && O != a.body; ) - if (O.nodeType == 1) { - let S = O, E = window.getComputedStyle(S); - if ((S.scrollHeight > S.clientHeight || S.scrollWidth > S.clientWidth) && E.overflow != "visible") { - let D = S.getBoundingClientRect(); - h = Math.max(h, D.left), f = Math.min(f, D.right), b = Math.max(b, D.top), w = O == r.parentNode ? D.bottom : Math.min(w, D.bottom); +function bxe(t, e) { + let r = t.getBoundingClientRect(), n = t.ownerDocument, i = n.defaultView || window, s = Math.max(0, r.left), a = Math.min(i.innerWidth, r.right), o = Math.max(0, r.top), l = Math.min(i.innerHeight, r.bottom); + for (let u = t.parentNode; u && u != n.body; ) + if (u.nodeType == 1) { + let h = u, f = window.getComputedStyle(h); + if ((h.scrollHeight > h.clientHeight || h.scrollWidth > h.clientWidth) && f.overflow != "visible") { + let d = h.getBoundingClientRect(); + s = Math.max(s, d.left), a = Math.min(a, d.right), o = Math.max(o, d.top), l = u == t.parentNode ? d.bottom : Math.min(l, d.bottom); } - O = E.position == "absolute" || E.position == "fixed" ? S.offsetParent : S.parentNode; - } else if (O.nodeType == 11) - O = O.host; + u = f.position == "absolute" || f.position == "fixed" ? h.offsetParent : h.parentNode; + } else if (u.nodeType == 11) + u = u.host; else break; return { - left: h - s.left, - right: Math.max(h, f) - s.left, - top: b - (s.top + n), - bottom: Math.max(b, w) - (s.top + n) + left: s - r.left, + right: Math.max(s, a) - r.left, + top: o - (r.top + e), + bottom: Math.max(o, l) - (r.top + e) }; } -function U5n(r, n) { - let s = r.getBoundingClientRect(); +function xxe(t, e) { + let r = t.getBoundingClientRect(); return { left: 0, - right: s.right - s.left, - top: n, - bottom: s.bottom - (s.top + n) + right: r.right - r.left, + top: e, + bottom: r.bottom - (r.top + e) }; } -class yRe { - constructor(n, s, a) { - this.from = n, this.to = s, this.size = a; +class gE { + constructor(e, r, n) { + this.from = e, this.to = r, this.size = n; } - static same(n, s) { - if (n.length != s.length) + static same(e, r) { + if (e.length != r.length) return !1; - for (let a = 0; a < n.length; a++) { - let l = n[a], h = s[a]; - if (l.from != h.from || l.to != h.to || l.size != h.size) + for (let n = 0; n < e.length; n++) { + let i = e[n], s = r[n]; + if (i.from != s.from || i.to != s.to || i.size != s.size) return !1; } return !0; } - draw(n, s) { - return as.replace({ - widget: new W5n(this.size * (s ? n.scaleY : n.scaleX), s) + draw(e, r) { + return Et.replace({ + widget: new wxe(this.size * (r ? e.scaleY : e.scaleX), r) }).range(this.from, this.to); } } -class W5n extends uv { - constructor(n, s) { - super(), this.size = n, this.vertical = s; +class wxe extends za { + constructor(e, r) { + super(), this.size = e, this.vertical = r; } - eq(n) { - return n.size == this.size && n.vertical == this.vertical; + eq(e) { + return e.size == this.size && e.vertical == this.vertical; } toDOM() { - let n = document.createElement("div"); - return this.vertical ? n.style.height = this.size + "px" : (n.style.width = this.size + "px", n.style.height = "2px", n.style.display = "inline-block"), n; + let e = document.createElement("div"); + return this.vertical ? e.style.height = this.size + "px" : (e.style.width = this.size + "px", e.style.height = "2px", e.style.display = "inline-block"), e; } get estimatedHeight() { return this.vertical ? this.size : -1; } } -class X_t { - constructor(n) { - this.state = n, this.pixelViewport = { left: 0, right: window.innerWidth, top: 0, bottom: 0 }, this.inView = !0, this.paddingTop = 0, this.paddingBottom = 0, this.contentDOMWidth = 0, this.contentDOMHeight = 0, this.editorHeight = 0, this.editorWidth = 0, this.scrollTop = 0, this.scrolledToBottom = !0, this.scaleX = 1, this.scaleY = 1, this.scrollAnchorPos = 0, this.scrollAnchorHeight = -1, this.scaler = K_t, this.scrollTarget = null, this.printing = !1, this.mustMeasureContent = !0, this.defaultTextDirection = Cf.LTR, this.visibleRanges = [], this.mustEnforceCursorAssoc = !1; - let s = n.facet(uze).some((a) => typeof a != "function" && a.class == "cm-lineWrapping"); - this.heightOracle = new B5n(s), this.stateDeco = n.facet(pK).filter((a) => typeof a != "function"), this.heightMap = Lm.empty().applyChanges(this.stateDeco, Al.empty, this.heightOracle.setDoc(n.doc), [new Hy(0, 0, 0, n.doc.length)]), this.viewport = this.getViewport(0, null), this.updateViewportLines(), this.updateForViewport(), this.lineGaps = this.ensureLineGaps([]), this.lineGapDeco = as.set(this.lineGaps.map((a) => a.draw(this, !1))), this.computeVisibleRanges(); +class CB { + constructor(e) { + this.state = e, this.pixelViewport = { left: 0, right: window.innerWidth, top: 0, bottom: 0 }, this.inView = !0, this.paddingTop = 0, this.paddingBottom = 0, this.contentDOMWidth = 0, this.contentDOMHeight = 0, this.editorHeight = 0, this.editorWidth = 0, this.scrollTop = 0, this.scrolledToBottom = !0, this.scaleX = 1, this.scaleY = 1, this.scrollAnchorPos = 0, this.scrollAnchorHeight = -1, this.scaler = EB, this.scrollTarget = null, this.printing = !1, this.mustMeasureContent = !0, this.defaultTextDirection = Nn.LTR, this.visibleRanges = [], this.mustEnforceCursorAssoc = !1; + let r = e.facet(PR).some((n) => typeof n != "function" && n.class == "cm-lineWrapping"); + this.heightOracle = new dxe(r), this.stateDeco = e.facet(ky).filter((n) => typeof n != "function"), this.heightMap = sa.empty().applyChanges(this.stateDeco, Dr.empty, this.heightOracle.setDoc(e.doc), [new Fo(0, 0, 0, e.doc.length)]), this.viewport = this.getViewport(0, null), this.updateViewportLines(), this.updateForViewport(), this.lineGaps = this.ensureLineGaps([]), this.lineGapDeco = Et.set(this.lineGaps.map((n) => n.draw(this, !1))), this.computeVisibleRanges(); } updateForViewport() { - let n = [this.viewport], { main: s } = this.state.selection; - for (let a = 0; a <= 1; a++) { - let l = a ? s.head : s.anchor; - if (!n.some(({ from: h, to: f }) => l >= h && l <= f)) { - let { from: h, to: f } = this.lineBlockAt(l); - n.push(new jge(h, f)); + let e = [this.viewport], { main: r } = this.state.selection; + for (let n = 0; n <= 1; n++) { + let i = n ? r.head : r.anchor; + if (!e.some(({ from: s, to: a }) => i >= s && i <= a)) { + let { from: s, to: a } = this.lineBlockAt(i); + e.push(new pw(s, a)); } } - this.viewports = n.sort((a, l) => a.from - l.from), this.scaler = this.heightMap.height <= 7e6 ? K_t : new G5n(this.heightOracle, this.heightMap, this.viewports); + this.viewports = e.sort((n, i) => n.from - i.from), this.scaler = this.heightMap.height <= 7e6 ? EB : new Sxe(this.heightOracle, this.heightMap, this.viewports); } updateViewportLines() { - this.viewportLines = [], this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.heightOracle.setDoc(this.state.doc), 0, 0, (n) => { - this.viewportLines.push(this.scaler.scale == 1 ? n : OX(n, this.scaler)); + this.viewportLines = [], this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.heightOracle.setDoc(this.state.doc), 0, 0, (e) => { + this.viewportLines.push(this.scaler.scale == 1 ? e : dv(e, this.scaler)); }); } - update(n, s = null) { - this.state = n.state; - let a = this.stateDeco; - this.stateDeco = this.state.facet(pK).filter((S) => typeof S != "function"); - let l = n.changedRanges, h = Hy.extendWithRanges(l, z5n(a, this.stateDeco, n ? n.changes : f1.empty(this.state.doc.length))), f = this.heightMap.height, b = this.scrolledToBottom ? null : this.scrollAnchorAt(this.scrollTop); - this.heightMap = this.heightMap.applyChanges(this.stateDeco, n.startState.doc, this.heightOracle.setDoc(this.state.doc), h), this.heightMap.height != f && (n.flags |= 2), b ? (this.scrollAnchorPos = n.changes.mapPos(b.from, -1), this.scrollAnchorHeight = b.top) : (this.scrollAnchorPos = -1, this.scrollAnchorHeight = this.heightMap.height); - let w = h.length ? this.mapViewport(this.viewport, n.changes) : this.viewport; - (s && (s.range.head < w.from || s.range.head > w.to) || !this.viewportIsAppropriate(w)) && (w = this.getViewport(0, s)); - let O = !n.changes.empty || n.flags & 2 || w.from != this.viewport.from || w.to != this.viewport.to; - this.viewport = w, this.updateForViewport(), O && this.updateViewportLines(), (this.lineGaps.length || this.viewport.to - this.viewport.from > 2e3 << 1) && this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps, n.changes))), n.flags |= this.computeVisibleRanges(), s && (this.scrollTarget = s), !this.mustEnforceCursorAssoc && n.selectionSet && n.view.lineWrapping && n.state.selection.main.empty && n.state.selection.main.assoc && !n.state.facet(pMt) && (this.mustEnforceCursorAssoc = !0); - } - measure(n) { - let s = n.contentDOM, a = window.getComputedStyle(s), l = this.heightOracle, h = a.whiteSpace; - this.defaultTextDirection = a.direction == "rtl" ? Cf.RTL : Cf.LTR; - let f = this.heightOracle.mustRefreshForWrapping(h), b = s.getBoundingClientRect(), w = f || this.mustMeasureContent || this.contentDOMHeight != b.height; - this.contentDOMHeight = b.height, this.mustMeasureContent = !1; - let O = 0, S = 0; - if (b.width && b.height) { - let { scaleX: le, scaleY: se } = HDt(s, b); - (this.scaleX != le || this.scaleY != se) && (this.scaleX = le, this.scaleY = se, O |= 8, f = w = !0); - } - let E = (parseInt(a.paddingTop) || 0) * this.scaleY, D = (parseInt(a.paddingBottom) || 0) * this.scaleY; - (this.paddingTop != E || this.paddingBottom != D) && (this.paddingTop = E, this.paddingBottom = D, O |= 10), this.editorWidth != n.scrollDOM.clientWidth && (l.lineWrapping && (w = !0), this.editorWidth = n.scrollDOM.clientWidth, O |= 8); - let M = n.scrollDOM.scrollTop * this.scaleY; - this.scrollTop != M && (this.scrollAnchorHeight = -1, this.scrollTop = M), this.scrolledToBottom = XDt(n.scrollDOM); - let B = (this.printing ? U5n : V5n)(s, this.paddingTop), z = B.top - this.pixelViewport.top, W = B.bottom - this.pixelViewport.bottom; - this.pixelViewport = B; - let H = this.pixelViewport.bottom > this.pixelViewport.top && this.pixelViewport.right > this.pixelViewport.left; - if (H != this.inView && (this.inView = H, H && (w = !0)), !this.inView && !this.scrollTarget) + update(e, r = null) { + this.state = e.state; + let n = this.stateDeco; + this.stateDeco = this.state.facet(ky).filter((h) => typeof h != "function"); + let i = e.changedRanges, s = Fo.extendWithRanges(i, vxe(n, this.stateDeco, e ? e.changes : ai.empty(this.state.doc.length))), a = this.heightMap.height, o = this.scrolledToBottom ? null : this.scrollAnchorAt(this.scrollTop); + this.heightMap = this.heightMap.applyChanges(this.stateDeco, e.startState.doc, this.heightOracle.setDoc(this.state.doc), s), this.heightMap.height != a && (e.flags |= 2), o ? (this.scrollAnchorPos = e.changes.mapPos(o.from, -1), this.scrollAnchorHeight = o.top) : (this.scrollAnchorPos = -1, this.scrollAnchorHeight = this.heightMap.height); + let l = s.length ? this.mapViewport(this.viewport, e.changes) : this.viewport; + (r && (r.range.head < l.from || r.range.head > l.to) || !this.viewportIsAppropriate(l)) && (l = this.getViewport(0, r)); + let u = !e.changes.empty || e.flags & 2 || l.from != this.viewport.from || l.to != this.viewport.to; + this.viewport = l, this.updateForViewport(), u && this.updateViewportLines(), (this.lineGaps.length || this.viewport.to - this.viewport.from > 2e3 << 1) && this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps, e.changes))), e.flags |= this.computeVisibleRanges(), r && (this.scrollTarget = r), !this.mustEnforceCursorAssoc && e.selectionSet && e.view.lineWrapping && e.state.selection.main.empty && e.state.selection.main.assoc && !e.state.facet(Ej) && (this.mustEnforceCursorAssoc = !0); + } + measure(e) { + let r = e.contentDOM, n = window.getComputedStyle(r), i = this.heightOracle, s = n.whiteSpace; + this.defaultTextDirection = n.direction == "rtl" ? Nn.RTL : Nn.LTR; + let a = this.heightOracle.mustRefreshForWrapping(s), o = r.getBoundingClientRect(), l = a || this.mustMeasureContent || this.contentDOMHeight != o.height; + this.contentDOMHeight = o.height, this.mustMeasureContent = !1; + let u = 0, h = 0; + if (o.width && o.height) { + let { scaleX: O, scaleY: S } = oj(r, o); + (this.scaleX != O || this.scaleY != S) && (this.scaleX = O, this.scaleY = S, u |= 8, a = l = !0); + } + let f = (parseInt(n.paddingTop) || 0) * this.scaleY, d = (parseInt(n.paddingBottom) || 0) * this.scaleY; + (this.paddingTop != f || this.paddingBottom != d) && (this.paddingTop = f, this.paddingBottom = d, u |= 10), this.editorWidth != e.scrollDOM.clientWidth && (i.lineWrapping && (l = !0), this.editorWidth = e.scrollDOM.clientWidth, u |= 8); + let p = e.scrollDOM.scrollTop * this.scaleY; + this.scrollTop != p && (this.scrollAnchorHeight = -1, this.scrollTop = p), this.scrolledToBottom = uj(e.scrollDOM); + let g = (this.printing ? xxe : bxe)(r, this.paddingTop), m = g.top - this.pixelViewport.top, v = g.bottom - this.pixelViewport.bottom; + this.pixelViewport = g; + let y = this.pixelViewport.bottom > this.pixelViewport.top && this.pixelViewport.right > this.pixelViewport.left; + if (y != this.inView && (this.inView = y, y && (l = !0)), !this.inView && !this.scrollTarget) return 0; - let G = b.width; - if ((this.contentDOMWidth != G || this.editorHeight != n.scrollDOM.clientHeight) && (this.contentDOMWidth = b.width, this.editorHeight = n.scrollDOM.clientHeight, O |= 8), w) { - let le = n.docView.measureVisibleLineHeights(this.viewport); - if (l.mustRefreshForHeights(le) && (f = !0), f || l.lineWrapping && Math.abs(G - this.contentDOMWidth) > l.charWidth) { - let { lineHeight: se, charWidth: he, textHeight: te } = n.docView.measureTextSize(); - f = se > 0 && l.refresh(h, se, he, te, G / he, le), f && (n.docView.minWidth = 0, O |= 8); + let b = o.width; + if ((this.contentDOMWidth != b || this.editorHeight != e.scrollDOM.clientHeight) && (this.contentDOMWidth = o.width, this.editorHeight = e.scrollDOM.clientHeight, u |= 8), l) { + let O = e.docView.measureVisibleLineHeights(this.viewport); + if (i.mustRefreshForHeights(O) && (a = !0), a || i.lineWrapping && Math.abs(b - this.contentDOMWidth) > i.charWidth) { + let { lineHeight: S, charWidth: C, textHeight: T } = e.docView.measureTextSize(); + a = S > 0 && i.refresh(s, S, C, T, b / C, O), a && (e.docView.minWidth = 0, u |= 8); } - z > 0 && W > 0 ? S = Math.max(z, W) : z < 0 && W < 0 && (S = Math.min(z, W)), l.heightChanged = !1; - for (let se of this.viewports) { - let he = se.from == this.viewport.from ? le : n.docView.measureVisibleLineHeights(se); - this.heightMap = (f ? Lm.empty().applyChanges(this.stateDeco, Al.empty, this.heightOracle, [new Hy(0, 0, 0, n.state.doc.length)]) : this.heightMap).updateHeight(l, 0, f, new F5n(se.from, he)); + m > 0 && v > 0 ? h = Math.max(m, v) : m < 0 && v < 0 && (h = Math.min(m, v)), i.heightChanged = !1; + for (let S of this.viewports) { + let C = S.from == this.viewport.from ? O : e.docView.measureVisibleLineHeights(S); + this.heightMap = (a ? sa.empty().applyChanges(this.stateDeco, Dr.empty, this.heightOracle, [new Fo(0, 0, 0, e.state.doc.length)]) : this.heightMap).updateHeight(i, 0, a, new pxe(S.from, C)); } - l.heightChanged && (O |= 2); + i.heightChanged && (u |= 2); } - let ee = !this.viewportIsAppropriate(this.viewport, S) || this.scrollTarget && (this.scrollTarget.range.head < this.viewport.from || this.scrollTarget.range.head > this.viewport.to); - return ee && (this.viewport = this.getViewport(S, this.scrollTarget)), this.updateForViewport(), (O & 2 || ee) && this.updateViewportLines(), (this.lineGaps.length || this.viewport.to - this.viewport.from > 2e3 << 1) && this.updateLineGaps(this.ensureLineGaps(f ? [] : this.lineGaps, n)), O |= this.computeVisibleRanges(), this.mustEnforceCursorAssoc && (this.mustEnforceCursorAssoc = !1, n.docView.enforceCursorAssoc()), O; + let w = !this.viewportIsAppropriate(this.viewport, h) || this.scrollTarget && (this.scrollTarget.range.head < this.viewport.from || this.scrollTarget.range.head > this.viewport.to); + return w && (this.viewport = this.getViewport(h, this.scrollTarget)), this.updateForViewport(), (u & 2 || w) && this.updateViewportLines(), (this.lineGaps.length || this.viewport.to - this.viewport.from > 2e3 << 1) && this.updateLineGaps(this.ensureLineGaps(a ? [] : this.lineGaps, e)), u |= this.computeVisibleRanges(), this.mustEnforceCursorAssoc && (this.mustEnforceCursorAssoc = !1, e.docView.enforceCursorAssoc()), u; } get visibleTop() { return this.scaler.fromDOM(this.pixelViewport.top); @@ -7387,120 +7396,120 @@ class X_t { get visibleBottom() { return this.scaler.fromDOM(this.pixelViewport.bottom); } - getViewport(n, s) { - let a = 0.5 - Math.max(-0.5, Math.min(0.5, n / 1e3 / 2)), l = this.heightMap, h = this.heightOracle, { visibleTop: f, visibleBottom: b } = this, w = new jge(l.lineAt(f - a * 1e3, Ah.ByHeight, h, 0, 0).from, l.lineAt(b + (1 - a) * 1e3, Ah.ByHeight, h, 0, 0).to); - if (s) { - let { head: O } = s.range; - if (O < w.from || O > w.to) { - let S = Math.min(this.editorHeight, this.pixelViewport.bottom - this.pixelViewport.top), E = l.lineAt(O, Ah.ByPos, h, 0, 0), D; - s.y == "center" ? D = (E.top + E.bottom) / 2 - S / 2 : s.y == "start" || s.y == "nearest" && O < w.from ? D = E.top : D = E.bottom - S, w = new jge(l.lineAt(D - 1e3 / 2, Ah.ByHeight, h, 0, 0).from, l.lineAt(D + S + 1e3 / 2, Ah.ByHeight, h, 0, 0).to); + getViewport(e, r) { + let n = 0.5 - Math.max(-0.5, Math.min(0.5, e / 1e3 / 2)), i = this.heightMap, s = this.heightOracle, { visibleTop: a, visibleBottom: o } = this, l = new pw(i.lineAt(a - n * 1e3, mn.ByHeight, s, 0, 0).from, i.lineAt(o + (1 - n) * 1e3, mn.ByHeight, s, 0, 0).to); + if (r) { + let { head: u } = r.range; + if (u < l.from || u > l.to) { + let h = Math.min(this.editorHeight, this.pixelViewport.bottom - this.pixelViewport.top), f = i.lineAt(u, mn.ByPos, s, 0, 0), d; + r.y == "center" ? d = (f.top + f.bottom) / 2 - h / 2 : r.y == "start" || r.y == "nearest" && u < l.from ? d = f.top : d = f.bottom - h, l = new pw(i.lineAt(d - 1e3 / 2, mn.ByHeight, s, 0, 0).from, i.lineAt(d + h + 1e3 / 2, mn.ByHeight, s, 0, 0).to); } } - return w; + return l; } - mapViewport(n, s) { - let a = s.mapPos(n.from, -1), l = s.mapPos(n.to, 1); - return new jge(this.heightMap.lineAt(a, Ah.ByPos, this.heightOracle, 0, 0).from, this.heightMap.lineAt(l, Ah.ByPos, this.heightOracle, 0, 0).to); + mapViewport(e, r) { + let n = r.mapPos(e.from, -1), i = r.mapPos(e.to, 1); + return new pw(this.heightMap.lineAt(n, mn.ByPos, this.heightOracle, 0, 0).from, this.heightMap.lineAt(i, mn.ByPos, this.heightOracle, 0, 0).to); } - viewportIsAppropriate({ from: n, to: s }, a = 0) { + viewportIsAppropriate({ from: e, to: r }, n = 0) { if (!this.inView) return !0; - let { top: l } = this.heightMap.lineAt(n, Ah.ByPos, this.heightOracle, 0, 0), { bottom: h } = this.heightMap.lineAt(s, Ah.ByPos, this.heightOracle, 0, 0), { visibleTop: f, visibleBottom: b } = this; - return (n == 0 || l <= f - Math.max(10, Math.min(-a, 250))) && (s == this.state.doc.length || h >= b + Math.max(10, Math.min(a, 250))) && l > f - 2 * 1e3 && h < b + 2 * 1e3; + let { top: i } = this.heightMap.lineAt(e, mn.ByPos, this.heightOracle, 0, 0), { bottom: s } = this.heightMap.lineAt(r, mn.ByPos, this.heightOracle, 0, 0), { visibleTop: a, visibleBottom: o } = this; + return (e == 0 || i <= a - Math.max(10, Math.min(-n, 250))) && (r == this.state.doc.length || s >= o + Math.max(10, Math.min(n, 250))) && i > a - 2 * 1e3 && s < o + 2 * 1e3; } - mapLineGaps(n, s) { - if (!n.length || s.empty) - return n; - let a = []; - for (let l of n) - s.touchesRange(l.from, l.to) || a.push(new yRe(s.mapPos(l.from), s.mapPos(l.to), l.size)); - return a; + mapLineGaps(e, r) { + if (!e.length || r.empty) + return e; + let n = []; + for (let i of e) + r.touchesRange(i.from, i.to) || n.push(new gE(r.mapPos(i.from), r.mapPos(i.to), i.size)); + return n; } - ensureLineGaps(n, s) { - let a = this.heightOracle.lineWrapping, l = a ? 1e4 : 2e3, h = l >> 1, f = l << 1; - if (this.defaultTextDirection != Cf.LTR && !a) + ensureLineGaps(e, r) { + let n = this.heightOracle.lineWrapping, i = n ? 1e4 : 2e3, s = i >> 1, a = i << 1; + if (this.defaultTextDirection != Nn.LTR && !n) return []; - let b = [], w = (O, S, E, D) => { - if (S - O < h) + let o = [], l = (u, h, f, d) => { + if (h - u < s) return; - let M = this.state.selection.main, B = [M.from]; - M.empty || B.push(M.to); - for (let W of B) - if (W > O && W < S) { - w(O, W - 10, E, D), w(W + 10, S, E, D); + let p = this.state.selection.main, g = [p.from]; + p.empty || g.push(p.to); + for (let v of g) + if (v > u && v < h) { + l(u, v - 10, f, d), l(v + 10, h, f, d); return; } - let z = H5n(n, (W) => W.from >= E.from && W.to <= E.to && Math.abs(W.from - O) < h && Math.abs(W.to - S) < h && !B.some((H) => W.from < H && W.to > H)); - if (!z) { - if (S < E.to && s && a && s.visibleRanges.some((W) => W.from <= S && W.to >= S)) { - let W = s.moveToLineBoundary(sr.cursor(S), !1, !0).head; - W > O && (S = W); + let m = kxe(e, (v) => v.from >= f.from && v.to <= f.to && Math.abs(v.from - u) < s && Math.abs(v.to - h) < s && !g.some((y) => v.from < y && v.to > y)); + if (!m) { + if (h < f.to && r && n && r.visibleRanges.some((v) => v.from <= h && v.to >= h)) { + let v = r.moveToLineBoundary(Ve.cursor(h), !1, !0).head; + v > u && (h = v); } - z = new yRe(O, S, this.gapSize(E, O, S, D)); + m = new gE(u, h, this.gapSize(f, u, h, d)); } - b.push(z); + o.push(m); }; - for (let O of this.viewportLines) { - if (O.length < f) + for (let u of this.viewportLines) { + if (u.length < a) continue; - let S = Y5n(O.from, O.to, this.stateDeco); - if (S.total < f) + let h = Oxe(u.from, u.to, this.stateDeco); + if (h.total < a) continue; - let E = this.scrollTarget ? this.scrollTarget.range.head : null, D, M; - if (a) { - let B = l / this.heightOracle.lineLength * this.heightOracle.lineHeight, z, W; - if (E != null) { - let H = zge(S, E), G = ((this.visibleBottom - this.visibleTop) / 2 + B) / O.height; - z = H - G, W = H + G; + let f = this.scrollTarget ? this.scrollTarget.range.head : null, d, p; + if (n) { + let g = i / this.heightOracle.lineLength * this.heightOracle.lineHeight, m, v; + if (f != null) { + let y = mw(h, f), b = ((this.visibleBottom - this.visibleTop) / 2 + g) / u.height; + m = y - b, v = y + b; } else - z = (this.visibleTop - O.top - B) / O.height, W = (this.visibleBottom - O.top + B) / O.height; - D = Qge(S, z), M = Qge(S, W); + m = (this.visibleTop - u.top - g) / u.height, v = (this.visibleBottom - u.top + g) / u.height; + d = gw(h, m), p = gw(h, v); } else { - let B = S.total * this.heightOracle.charWidth, z = l * this.heightOracle.charWidth, W, H; - if (E != null) { - let G = zge(S, E), ee = ((this.pixelViewport.right - this.pixelViewport.left) / 2 + z) / B; - W = G - ee, H = G + ee; + let g = h.total * this.heightOracle.charWidth, m = i * this.heightOracle.charWidth, v, y; + if (f != null) { + let b = mw(h, f), w = ((this.pixelViewport.right - this.pixelViewport.left) / 2 + m) / g; + v = b - w, y = b + w; } else - W = (this.pixelViewport.left - z) / B, H = (this.pixelViewport.right + z) / B; - D = Qge(S, W), M = Qge(S, H); + v = (this.pixelViewport.left - m) / g, y = (this.pixelViewport.right + m) / g; + d = gw(h, v), p = gw(h, y); } - D > O.from && w(O.from, D, O, S), M < O.to && w(M, O.to, O, S); + d > u.from && l(u.from, d, u, h), p < u.to && l(p, u.to, u, h); } - return b; + return o; } - gapSize(n, s, a, l) { - let h = zge(l, a) - zge(l, s); - return this.heightOracle.lineWrapping ? n.height * h : l.total * this.heightOracle.charWidth * h; + gapSize(e, r, n, i) { + let s = mw(i, n) - mw(i, r); + return this.heightOracle.lineWrapping ? e.height * s : i.total * this.heightOracle.charWidth * s; } - updateLineGaps(n) { - yRe.same(n, this.lineGaps) || (this.lineGaps = n, this.lineGapDeco = as.set(n.map((s) => s.draw(this, this.heightOracle.lineWrapping)))); + updateLineGaps(e) { + gE.same(e, this.lineGaps) || (this.lineGaps = e, this.lineGapDeco = Et.set(e.map((r) => r.draw(this, this.heightOracle.lineWrapping)))); } computeVisibleRanges() { - let n = this.stateDeco; - this.lineGaps.length && (n = n.concat(this.lineGapDeco)); - let s = []; - cl.spans(n, this.viewport.from, this.viewport.to, { - span(l, h) { - s.push({ from: l, to: h }); + let e = this.stateDeco; + this.lineGaps.length && (e = e.concat(this.lineGapDeco)); + let r = []; + Er.spans(e, this.viewport.from, this.viewport.to, { + span(i, s) { + r.push({ from: i, to: s }); }, point() { } }, 20); - let a = s.length != this.visibleRanges.length || this.visibleRanges.some((l, h) => l.from != s[h].from || l.to != s[h].to); - return this.visibleRanges = s, a ? 4 : 0; + let n = r.length != this.visibleRanges.length || this.visibleRanges.some((i, s) => i.from != r[s].from || i.to != r[s].to); + return this.visibleRanges = r, n ? 4 : 0; } - lineBlockAt(n) { - return n >= this.viewport.from && n <= this.viewport.to && this.viewportLines.find((s) => s.from <= n && s.to >= n) || OX(this.heightMap.lineAt(n, Ah.ByPos, this.heightOracle, 0, 0), this.scaler); + lineBlockAt(e) { + return e >= this.viewport.from && e <= this.viewport.to && this.viewportLines.find((r) => r.from <= e && r.to >= e) || dv(this.heightMap.lineAt(e, mn.ByPos, this.heightOracle, 0, 0), this.scaler); } - lineBlockAtHeight(n) { - return OX(this.heightMap.lineAt(this.scaler.fromDOM(n), Ah.ByHeight, this.heightOracle, 0, 0), this.scaler); + lineBlockAtHeight(e) { + return dv(this.heightMap.lineAt(this.scaler.fromDOM(e), mn.ByHeight, this.heightOracle, 0, 0), this.scaler); } - scrollAnchorAt(n) { - let s = this.lineBlockAtHeight(n + 8); - return s.from >= this.viewport.from || this.viewportLines[0].top - n > 200 ? s : this.viewportLines[0]; + scrollAnchorAt(e) { + let r = this.lineBlockAtHeight(e + 8); + return r.from >= this.viewport.from || this.viewportLines[0].top - e > 200 ? r : this.viewportLines[0]; } - elementAtHeight(n) { - return OX(this.heightMap.blockAt(this.scaler.fromDOM(n), this.heightOracle, 0, 0), this.scaler); + elementAtHeight(e) { + return dv(this.heightMap.blockAt(this.scaler.fromDOM(e), this.heightOracle, 0, 0), this.scaler); } get docHeight() { return this.scaler.toDOM(this.heightMap.height); @@ -7509,111 +7518,111 @@ class X_t { return this.docHeight + this.paddingTop + this.paddingBottom; } } -class jge { - constructor(n, s) { - this.from = n, this.to = s; +class pw { + constructor(e, r) { + this.from = e, this.to = r; } } -function Y5n(r, n, s) { - let a = [], l = r, h = 0; - return cl.spans(s, r, n, { +function Oxe(t, e, r) { + let n = [], i = t, s = 0; + return Er.spans(r, t, e, { span() { }, - point(f, b) { - f > l && (a.push({ from: l, to: f }), h += f - l), l = b; + point(a, o) { + a > i && (n.push({ from: i, to: a }), s += a - i), i = o; } - }, 20), l < n && (a.push({ from: l, to: n }), h += n - l), { total: h, ranges: a }; + }, 20), i < e && (n.push({ from: i, to: e }), s += e - i), { total: s, ranges: n }; } -function Qge({ total: r, ranges: n }, s) { - if (s <= 0) - return n[0].from; - if (s >= 1) - return n[n.length - 1].to; - let a = Math.floor(r * s); - for (let l = 0; ; l++) { - let { from: h, to: f } = n[l], b = f - h; - if (a <= b) - return h + a; - a -= b; +function gw({ total: t, ranges: e }, r) { + if (r <= 0) + return e[0].from; + if (r >= 1) + return e[e.length - 1].to; + let n = Math.floor(t * r); + for (let i = 0; ; i++) { + let { from: s, to: a } = e[i], o = a - s; + if (n <= o) + return s + n; + n -= o; } } -function zge(r, n) { - let s = 0; - for (let { from: a, to: l } of r.ranges) { - if (n <= l) { - s += n - a; +function mw(t, e) { + let r = 0; + for (let { from: n, to: i } of t.ranges) { + if (e <= i) { + r += e - n; break; } - s += l - a; + r += i - n; } - return s / r.total; + return r / t.total; } -function H5n(r, n) { - for (let s of r) - if (n(s)) - return s; +function kxe(t, e) { + for (let r of t) + if (e(r)) + return r; } -const K_t = { - toDOM(r) { - return r; +const EB = { + toDOM(t) { + return t; }, - fromDOM(r) { - return r; + fromDOM(t) { + return t; }, scale: 1 }; -class G5n { - constructor(n, s, a) { - let l = 0, h = 0, f = 0; - this.viewports = a.map(({ from: b, to: w }) => { - let O = s.lineAt(b, Ah.ByPos, n, 0, 0).top, S = s.lineAt(w, Ah.ByPos, n, 0, 0).bottom; - return l += S - O, { from: b, to: w, top: O, bottom: S, domTop: 0, domBottom: 0 }; - }), this.scale = (7e6 - l) / (s.height - l); - for (let b of this.viewports) - b.domTop = f + (b.top - h) * this.scale, f = b.domBottom = b.domTop + (b.bottom - b.top), h = b.bottom; - } - toDOM(n) { - for (let s = 0, a = 0, l = 0; ; s++) { - let h = s < this.viewports.length ? this.viewports[s] : null; - if (!h || n < h.top) - return l + (n - a) * this.scale; - if (n <= h.bottom) - return h.domTop + (n - h.top); - a = h.bottom, l = h.domBottom; - } - } - fromDOM(n) { - for (let s = 0, a = 0, l = 0; ; s++) { - let h = s < this.viewports.length ? this.viewports[s] : null; - if (!h || n < h.domTop) - return a + (n - l) / this.scale; - if (n <= h.domBottom) - return h.top + (n - h.domTop); - a = h.bottom, l = h.domBottom; - } - } -} -function OX(r, n) { - if (n.scale == 1) - return r; - let s = n.toDOM(r.top), a = n.toDOM(r.bottom); - return new W4(r.from, r.length, s, a - s, Array.isArray(r._content) ? r._content.map((l) => OX(l, n)) : r._content); -} -const qge = /* @__PURE__ */ us.define({ combine: (r) => r.join(" ") }), gFe = /* @__PURE__ */ us.define({ combine: (r) => r.indexOf(!0) > -1 }), mFe = /* @__PURE__ */ s_.newName(), $Mt = /* @__PURE__ */ s_.newName(), BMt = /* @__PURE__ */ s_.newName(), FMt = { "&light": "." + $Mt, "&dark": "." + BMt }; -function bFe(r, n, s) { - return new s_(n, { - finish(a) { - return /&/.test(a) ? a.replace(/&\w*/, (l) => { - if (l == "&") - return r; - if (!s || !s[l]) - throw new RangeError(`Unsupported selector: ${l}`); - return s[l]; - }) : r + " " + a; +class Sxe { + constructor(e, r, n) { + let i = 0, s = 0, a = 0; + this.viewports = n.map(({ from: o, to: l }) => { + let u = r.lineAt(o, mn.ByPos, e, 0, 0).top, h = r.lineAt(l, mn.ByPos, e, 0, 0).bottom; + return i += h - u, { from: o, to: l, top: u, bottom: h, domTop: 0, domBottom: 0 }; + }), this.scale = (7e6 - i) / (r.height - i); + for (let o of this.viewports) + o.domTop = a + (o.top - s) * this.scale, a = o.domBottom = o.domTop + (o.bottom - o.top), s = o.bottom; + } + toDOM(e) { + for (let r = 0, n = 0, i = 0; ; r++) { + let s = r < this.viewports.length ? this.viewports[r] : null; + if (!s || e < s.top) + return i + (e - n) * this.scale; + if (e <= s.bottom) + return s.domTop + (e - s.top); + n = s.bottom, i = s.domBottom; + } + } + fromDOM(e) { + for (let r = 0, n = 0, i = 0; ; r++) { + let s = r < this.viewports.length ? this.viewports[r] : null; + if (!s || e < s.domTop) + return n + (e - i) / this.scale; + if (e <= s.domBottom) + return s.top + (e - s.domTop); + n = s.bottom, i = s.domBottom; + } + } +} +function dv(t, e) { + if (e.scale == 1) + return t; + let r = e.toDOM(t.top), n = e.toDOM(t.bottom); + return new fc(t.from, t.length, r, n - r, Array.isArray(t._content) ? t._content.map((i) => dv(i, e)) : t._content); +} +const vw = /* @__PURE__ */ _t.define({ combine: (t) => t.join(" ") }), i7 = /* @__PURE__ */ _t.define({ combine: (t) => t.indexOf(!0) > -1 }), s7 = /* @__PURE__ */ Iu.newName(), Zj = /* @__PURE__ */ Iu.newName(), jj = /* @__PURE__ */ Iu.newName(), Kj = { "&light": "." + Zj, "&dark": "." + jj }; +function a7(t, e, r) { + return new Iu(e, { + finish(n) { + return /&/.test(n) ? n.replace(/&\w*/, (i) => { + if (i == "&") + return t; + if (!r || !r[i]) + throw new RangeError(`Unsupported selector: ${i}`); + return r[i]; + }) : t + " " + n; } }); } -const Z5n = /* @__PURE__ */ bFe("." + mFe, { +const Txe = /* @__PURE__ */ a7("." + s7, { "&": { position: "relative !important", boxSizing: "border-box", @@ -7844,236 +7853,236 @@ const Z5n = /* @__PURE__ */ bFe("." + mFe, { border: "1px solid #555", backgroundColor: "inherit" } -}, FMt), kX = "\uFFFF"; -class X5n { - constructor(n, s) { - this.points = n, this.text = "", this.lineSeparator = s.facet(Ga.lineSeparator); +}, Kj), pv = "\uFFFF"; +class Cxe { + constructor(e, r) { + this.points = e, this.text = "", this.lineSeparator = r.facet(dr.lineSeparator); } - append(n) { - this.text += n; + append(e) { + this.text += e; } lineBreak() { - this.text += kX; + this.text += pv; } - readRange(n, s) { - if (!n) + readRange(e, r) { + if (!e) return this; - let a = n.parentNode; - for (let l = n; ; ) { - this.findPointBefore(a, l); - let h = this.text.length; - this.readNode(l); - let f = l.nextSibling; - if (f == s) + let n = e.parentNode; + for (let i = e; ; ) { + this.findPointBefore(n, i); + let s = this.text.length; + this.readNode(i); + let a = i.nextSibling; + if (a == r) break; - let b = Mh.get(l), w = Mh.get(f); - (b && w ? b.breakAfter : (b ? b.breakAfter : J_t(l)) || J_t(f) && (l.nodeName != "BR" || l.cmIgnore) && this.text.length > h) && this.lineBreak(), l = f; - } - return this.findPointBefore(a, s), this; - } - readTextNode(n) { - let s = n.nodeValue; - for (let a of this.points) - a.node == n && (a.pos = this.text.length + Math.min(a.offset, s.length)); - for (let a = 0, l = this.lineSeparator ? null : /\r\n?|\n/g; ; ) { - let h = -1, f = 1, b; - if (this.lineSeparator ? (h = s.indexOf(this.lineSeparator, a), f = this.lineSeparator.length) : (b = l.exec(s)) && (h = b.index, f = b[0].length), this.append(s.slice(a, h < 0 ? s.length : h)), h < 0) + let o = yn.get(i), l = yn.get(a); + (o && l ? o.breakAfter : (o ? o.breakAfter : _B(i)) || _B(a) && (i.nodeName != "BR" || i.cmIgnore) && this.text.length > s) && this.lineBreak(), i = a; + } + return this.findPointBefore(n, r), this; + } + readTextNode(e) { + let r = e.nodeValue; + for (let n of this.points) + n.node == e && (n.pos = this.text.length + Math.min(n.offset, r.length)); + for (let n = 0, i = this.lineSeparator ? null : /\r\n?|\n/g; ; ) { + let s = -1, a = 1, o; + if (this.lineSeparator ? (s = r.indexOf(this.lineSeparator, n), a = this.lineSeparator.length) : (o = i.exec(r)) && (s = o.index, a = o[0].length), this.append(r.slice(n, s < 0 ? r.length : s)), s < 0) break; - if (this.lineBreak(), f > 1) - for (let w of this.points) - w.node == n && w.pos > this.text.length && (w.pos -= f - 1); - a = h + f; + if (this.lineBreak(), a > 1) + for (let l of this.points) + l.node == e && l.pos > this.text.length && (l.pos -= a - 1); + n = s + a; } } - readNode(n) { - if (n.cmIgnore) + readNode(e) { + if (e.cmIgnore) return; - let s = Mh.get(n), a = s && s.overrideDOMText; - if (a != null) { - this.findPointInside(n, a.length); - for (let l = a.iter(); !l.next().done; ) - l.lineBreak ? this.lineBreak() : this.append(l.value); + let r = yn.get(e), n = r && r.overrideDOMText; + if (n != null) { + this.findPointInside(e, n.length); + for (let i = n.iter(); !i.next().done; ) + i.lineBreak ? this.lineBreak() : this.append(i.value); } else - n.nodeType == 3 ? this.readTextNode(n) : n.nodeName == "BR" ? n.nextSibling && this.lineBreak() : n.nodeType == 1 && this.readRange(n.firstChild, null); + e.nodeType == 3 ? this.readTextNode(e) : e.nodeName == "BR" ? e.nextSibling && this.lineBreak() : e.nodeType == 1 && this.readRange(e.firstChild, null); } - findPointBefore(n, s) { - for (let a of this.points) - a.node == n && n.childNodes[a.offset] == s && (a.pos = this.text.length); + findPointBefore(e, r) { + for (let n of this.points) + n.node == e && e.childNodes[n.offset] == r && (n.pos = this.text.length); } - findPointInside(n, s) { - for (let a of this.points) - (n.nodeType == 3 ? a.node == n : n.contains(a.node)) && (a.pos = this.text.length + (K5n(n, a.node, a.offset) ? s : 0)); + findPointInside(e, r) { + for (let n of this.points) + (e.nodeType == 3 ? n.node == e : e.contains(n.node)) && (n.pos = this.text.length + (Exe(e, n.node, n.offset) ? r : 0)); } } -function K5n(r, n, s) { +function Exe(t, e, r) { for (; ; ) { - if (!n || s < o_(n)) + if (!e || r < Pu(e)) return !1; - if (n == r) + if (e == t) return !0; - s = dK(n) + 1, n = n.parentNode; + r = Oy(e) + 1, e = e.parentNode; } } -function J_t(r) { - return r.nodeType == 1 && /^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName); +function _B(t) { + return t.nodeType == 1 && /^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName); } -class eCt { - constructor(n, s) { - this.node = n, this.offset = s, this.pos = -1; +class AB { + constructor(e, r) { + this.node = e, this.offset = r, this.pos = -1; } } -class J5n { - constructor(n, s, a, l) { - this.typeOver = l, this.bounds = null, this.text = ""; - let { impreciseHead: h, impreciseAnchor: f } = n.docView; - if (n.state.readOnly && s > -1) +class _xe { + constructor(e, r, n, i) { + this.typeOver = i, this.bounds = null, this.text = ""; + let { impreciseHead: s, impreciseAnchor: a } = e.docView; + if (e.state.readOnly && r > -1) this.newSel = null; - else if (s > -1 && (this.bounds = n.docView.domBoundsAround(s, a, 0))) { - let b = h || f ? [] : n4n(n), w = new X5n(b, n.state); - w.readRange(this.bounds.startDOM, this.bounds.endDOM), this.text = w.text, this.newSel = r4n(b, this.bounds.from); + else if (r > -1 && (this.bounds = e.docView.domBoundsAround(r, n, 0))) { + let o = s || a ? [] : Rxe(e), l = new Cxe(o, e.state); + l.readRange(this.bounds.startDOM, this.bounds.endDOM), this.text = l.text, this.newSel = Mxe(o, this.bounds.from); } else { - let b = n.observer.selectionRange, w = h && h.node == b.focusNode && h.offset == b.focusOffset || !tFe(n.contentDOM, b.focusNode) ? n.state.selection.main.head : n.docView.posFromDOM(b.focusNode, b.focusOffset), O = f && f.node == b.anchorNode && f.offset == b.anchorOffset || !tFe(n.contentDOM, b.anchorNode) ? n.state.selection.main.anchor : n.docView.posFromDOM(b.anchorNode, b.anchorOffset); - this.newSel = sr.single(O, w); + let o = e.observer.selectionRange, l = s && s.node == o.focusNode && s.offset == o.focusOffset || !QA(e.contentDOM, o.focusNode) ? e.state.selection.main.head : e.docView.posFromDOM(o.focusNode, o.focusOffset), u = a && a.node == o.anchorNode && a.offset == o.anchorOffset || !QA(e.contentDOM, o.anchorNode) ? e.state.selection.main.anchor : e.docView.posFromDOM(o.anchorNode, o.anchorOffset); + this.newSel = Ve.single(u, l); } } } -function jMt(r, n) { - let s, { newSel: a } = n, l = r.state.selection.main, h = r.inputState.lastKeyTime > Date.now() - 100 ? r.inputState.lastKeyCode : -1; - if (n.bounds) { - let { from: f, to: b } = n.bounds, w = l.from, O = null; - (h === 8 || Fs.android && n.text.length < b - f) && (w = l.to, O = "end"); - let S = t4n(r.state.doc.sliceString(f, b, kX), n.text, w - f, O); - S && (Fs.chrome && h == 13 && S.toB == S.from + 2 && n.text.slice(S.from, S.toB) == kX + kX && S.toB--, s = { - from: f + S.from, - to: f + S.toA, - insert: Al.of(n.text.slice(S.from, S.toB).split(kX)) +function Jj(t, e) { + let r, { newSel: n } = e, i = t.state.selection.main, s = t.inputState.lastKeyTime > Date.now() - 100 ? t.inputState.lastKeyCode : -1; + if (e.bounds) { + let { from: a, to: o } = e.bounds, l = i.from, u = null; + (s === 8 || Mt.android && e.text.length < o - a) && (l = i.to, u = "end"); + let h = Lxe(t.state.doc.sliceString(a, o, pv), e.text, l - a, u); + h && (Mt.chrome && s == 13 && h.toB == h.from + 2 && e.text.slice(h.from, h.toB) == pv + pv && h.toB--, r = { + from: a + h.from, + to: a + h.toA, + insert: Dr.of(e.text.slice(h.from, h.toB).split(pv)) }); } else - a && (!r.hasFocus && r.state.facet(G2e) || a.main.eq(l)) && (a = null); - if (!s && !a) + n && (!t.hasFocus && t.state.facet(NS) || n.main.eq(i)) && (n = null); + if (!r && !n) return !1; - if (!s && n.typeOver && !l.empty && a && a.main.empty ? s = { from: l.from, to: l.to, insert: r.state.doc.slice(l.from, l.to) } : s && s.from >= l.from && s.to <= l.to && (s.from != l.from || s.to != l.to) && l.to - l.from - (s.to - s.from) <= 4 ? s = { - from: l.from, - to: l.to, - insert: r.state.doc.slice(l.from, s.from).append(s.insert).append(r.state.doc.slice(s.to, l.to)) - } : (Fs.mac || Fs.android) && s && s.from == s.to && s.from == l.head - 1 && /^\. ?$/.test(s.insert.toString()) && r.contentDOM.getAttribute("autocorrect") == "off" ? (a && s.insert.length == 2 && (a = sr.single(a.main.anchor - 1, a.main.head - 1)), s = { from: l.from, to: l.to, insert: Al.of([" "]) }) : Fs.chrome && s && s.from == s.to && s.from == l.head && s.insert.toString() == ` - ` && r.lineWrapping && (a && (a = sr.single(a.main.anchor - 1, a.main.head - 1)), s = { from: l.from, to: l.to, insert: Al.of([" "]) }), s) { - if (Fs.ios && r.inputState.flushIOSKey() || Fs.android && (s.from == l.from && s.to == l.to && s.insert.length == 1 && s.insert.lines == 2 && PB(r.contentDOM, "Enter", 13) || (s.from == l.from - 1 && s.to == l.to && s.insert.length == 0 || h == 8 && s.insert.length < s.to - s.from && s.to > l.head) && PB(r.contentDOM, "Backspace", 8) || s.from == l.from && s.to == l.to + 1 && s.insert.length == 0 && PB(r.contentDOM, "Delete", 46))) + if (!r && e.typeOver && !i.empty && n && n.main.empty ? r = { from: i.from, to: i.to, insert: t.state.doc.slice(i.from, i.to) } : r && r.from >= i.from && r.to <= i.to && (r.from != i.from || r.to != i.to) && i.to - i.from - (r.to - r.from) <= 4 ? r = { + from: i.from, + to: i.to, + insert: t.state.doc.slice(i.from, r.from).append(r.insert).append(t.state.doc.slice(r.to, i.to)) + } : (Mt.mac || Mt.android) && r && r.from == r.to && r.from == i.head - 1 && /^\. ?$/.test(r.insert.toString()) && t.contentDOM.getAttribute("autocorrect") == "off" ? (n && r.insert.length == 2 && (n = Ve.single(n.main.anchor - 1, n.main.head - 1)), r = { from: i.from, to: i.to, insert: Dr.of([" "]) }) : Mt.chrome && r && r.from == r.to && r.from == i.head && r.insert.toString() == ` + ` && t.lineWrapping && (n && (n = Ve.single(n.main.anchor - 1, n.main.head - 1)), r = { from: i.from, to: i.to, insert: Dr.of([" "]) }), r) { + if (Mt.ios && t.inputState.flushIOSKey() || Mt.android && (r.from == i.from && r.to == i.to && r.insert.length == 1 && r.insert.lines == 2 && Wp(t.contentDOM, "Enter", 13) || (r.from == i.from - 1 && r.to == i.to && r.insert.length == 0 || s == 8 && r.insert.length < r.to - r.from && r.to > i.head) && Wp(t.contentDOM, "Backspace", 8) || r.from == i.from && r.to == i.to + 1 && r.insert.length == 0 && Wp(t.contentDOM, "Delete", 46))) return !0; - let f = s.insert.toString(); - r.inputState.composing >= 0 && r.inputState.composing++; - let b, w = () => b || (b = e4n(r, s, a)); - return r.state.facet(hMt).some((O) => O(r, s.from, s.to, f, w)) || r.dispatch(w()), !0; - } else if (a && !a.main.eq(l)) { - let f = !1, b = "select"; - return r.inputState.lastSelectionTime > Date.now() - 50 && (r.inputState.lastSelectionOrigin == "select" && (f = !0), b = r.inputState.lastSelectionOrigin), r.dispatch({ selection: a, scrollIntoView: f, userEvent: b }), !0; + let a = r.insert.toString(); + t.inputState.composing >= 0 && t.inputState.composing++; + let o, l = () => o || (o = Axe(t, r, n)); + return t.state.facet(Sj).some((u) => u(t, r.from, r.to, a, l)) || t.dispatch(l()), !0; + } else if (n && !n.main.eq(i)) { + let a = !1, o = "select"; + return t.inputState.lastSelectionTime > Date.now() - 50 && (t.inputState.lastSelectionOrigin == "select" && (a = !0), o = t.inputState.lastSelectionOrigin), t.dispatch({ selection: n, scrollIntoView: a, userEvent: o }), !0; } else return !1; } -function e4n(r, n, s) { - let a, l = r.state, h = l.selection.main; - if (n.from >= h.from && n.to <= h.to && n.to - n.from >= (h.to - h.from) / 3 && (!s || s.main.empty && s.main.from == n.from + n.insert.length) && r.inputState.composing < 0) { - let b = h.from < n.from ? l.sliceDoc(h.from, n.from) : "", w = h.to > n.to ? l.sliceDoc(n.to, h.to) : ""; - a = l.replaceSelection(r.state.toText(b + n.insert.sliceString(0, void 0, r.state.lineBreak) + w)); +function Axe(t, e, r) { + let n, i = t.state, s = i.selection.main; + if (e.from >= s.from && e.to <= s.to && e.to - e.from >= (s.to - s.from) / 3 && (!r || r.main.empty && r.main.from == e.from + e.insert.length) && t.inputState.composing < 0) { + let o = s.from < e.from ? i.sliceDoc(s.from, e.from) : "", l = s.to > e.to ? i.sliceDoc(e.to, s.to) : ""; + n = i.replaceSelection(t.state.toText(o + e.insert.sliceString(0, void 0, t.state.lineBreak) + l)); } else { - let b = l.changes(n), w = s && s.main.to <= b.newLength ? s.main : void 0; - if (l.selection.ranges.length > 1 && r.inputState.composing >= 0 && n.to <= h.to && n.to >= h.to - 10) { - let O = r.state.sliceDoc(n.from, n.to), S, E = s && SMt(r, s.main.head); - if (E) { - let B = n.insert.length - (n.to - n.from); - S = { from: E.from, to: E.to - B }; + let o = i.changes(e), l = r && r.main.to <= o.newLength ? r.main : void 0; + if (i.selection.ranges.length > 1 && t.inputState.composing >= 0 && e.to <= s.to && e.to >= s.to - 10) { + let u = t.state.sliceDoc(e.from, e.to), h, f = r && $j(t, r.main.head); + if (f) { + let g = e.insert.length - (e.to - e.from); + h = { from: f.from, to: f.to - g }; } else - S = r.state.doc.lineAt(h.head); - let D = h.to - n.to, M = h.to - h.from; - a = l.changeByRange((B) => { - if (B.from == h.from && B.to == h.to) - return { changes: b, range: w || B.map(b) }; - let z = B.to - D, W = z - O.length; - if (B.to - B.from != M || r.state.sliceDoc(W, z) != O || B.to >= S.from && B.from <= S.to) - return { range: B }; - let H = l.changes({ from: W, to: z, insert: n.insert }), G = B.to - h.to; + h = t.state.doc.lineAt(s.head); + let d = s.to - e.to, p = s.to - s.from; + n = i.changeByRange((g) => { + if (g.from == s.from && g.to == s.to) + return { changes: o, range: l || g.map(o) }; + let m = g.to - d, v = m - u.length; + if (g.to - g.from != p || t.state.sliceDoc(v, m) != u || g.to >= h.from && g.from <= h.to) + return { range: g }; + let y = i.changes({ from: v, to: m, insert: e.insert }), b = g.to - s.to; return { - changes: H, - range: w ? sr.range(Math.max(0, w.anchor + G), Math.max(0, w.head + G)) : B.map(H) + changes: y, + range: l ? Ve.range(Math.max(0, l.anchor + b), Math.max(0, l.head + b)) : g.map(y) }; }); } else - a = { - changes: b, - selection: w && l.selection.replaceRange(w) + n = { + changes: o, + selection: l && i.selection.replaceRange(l) }; } - let f = "input.type"; - return (r.composing || r.inputState.compositionPendingChange && r.inputState.compositionEndedAt > Date.now() - 50) && (r.inputState.compositionPendingChange = !1, f += ".compose", r.inputState.compositionFirstChange && (f += ".start", r.inputState.compositionFirstChange = !1)), l.update(a, { userEvent: f, scrollIntoView: !0 }); + let a = "input.type"; + return (t.composing || t.inputState.compositionPendingChange && t.inputState.compositionEndedAt > Date.now() - 50) && (t.inputState.compositionPendingChange = !1, a += ".compose", t.inputState.compositionFirstChange && (a += ".start", t.inputState.compositionFirstChange = !1)), i.update(n, { userEvent: a, scrollIntoView: !0 }); } -function t4n(r, n, s, a) { - let l = Math.min(r.length, n.length), h = 0; - for (; h < l && r.charCodeAt(h) == n.charCodeAt(h); ) - h++; - if (h == l && r.length == n.length) +function Lxe(t, e, r, n) { + let i = Math.min(t.length, e.length), s = 0; + for (; s < i && t.charCodeAt(s) == e.charCodeAt(s); ) + s++; + if (s == i && t.length == e.length) return null; - let f = r.length, b = n.length; - for (; f > 0 && b > 0 && r.charCodeAt(f - 1) == n.charCodeAt(b - 1); ) - f--, b--; - if (a == "end") { - let w = Math.max(0, h - Math.min(f, b)); - s -= f + w - h; - } - if (f < h && r.length < n.length) { - let w = s <= h && s >= f ? h - s : 0; - h -= w, b = h + (b - f), f = h; - } else if (b < h) { - let w = s <= h && s >= b ? h - s : 0; - h -= w, f = h + (f - b), b = h; - } - return { from: h, toA: f, toB: b }; -} -function n4n(r) { - let n = []; - if (r.root.activeElement != r.contentDOM) - return n; - let { anchorNode: s, anchorOffset: a, focusNode: l, focusOffset: h } = r.observer.selectionRange; - return s && (n.push(new eCt(s, a)), (l != s || h != a) && n.push(new eCt(l, h))), n; -} -function r4n(r, n) { - if (r.length == 0) + let a = t.length, o = e.length; + for (; a > 0 && o > 0 && t.charCodeAt(a - 1) == e.charCodeAt(o - 1); ) + a--, o--; + if (n == "end") { + let l = Math.max(0, s - Math.min(a, o)); + r -= a + l - s; + } + if (a < s && t.length < e.length) { + let l = r <= s && r >= a ? s - r : 0; + s -= l, o = s + (o - a), a = s; + } else if (o < s) { + let l = r <= s && r >= o ? s - r : 0; + s -= l, a = s + (a - o), o = s; + } + return { from: s, toA: a, toB: o }; +} +function Rxe(t) { + let e = []; + if (t.root.activeElement != t.contentDOM) + return e; + let { anchorNode: r, anchorOffset: n, focusNode: i, focusOffset: s } = t.observer.selectionRange; + return r && (e.push(new AB(r, n)), (i != r || s != n) && e.push(new AB(i, s))), e; +} +function Mxe(t, e) { + if (t.length == 0) return null; - let s = r[0].pos, a = r.length == 2 ? r[1].pos : s; - return s > -1 && a > -1 ? sr.single(s + n, a + n) : null; + let r = t[0].pos, n = t.length == 2 ? t[1].pos : r; + return r > -1 && n > -1 ? Ve.single(r + e, n + e) : null; } -const i4n = { +const Dxe = { childList: !0, characterData: !0, subtree: !0, attributes: !0, characterDataOldValue: !0 -}, ORe = Fs.ie && Fs.ie_version <= 11; -class s4n { - constructor(n) { - this.view = n, this.active = !1, this.selectionRange = new zkn(), this.selectionChanged = !1, this.delayedFlush = -1, this.resizeTimeout = -1, this.queue = [], this.delayedAndroidKey = null, this.flushingAndroidKey = -1, this.lastChange = 0, this.scrollTargets = [], this.intersection = null, this.resizeScroll = null, this.intersecting = !1, this.gapIntersection = null, this.gaps = [], this.parentCheck = -1, this.dom = n.contentDOM, this.observer = new MutationObserver((s) => { - for (let a of s) - this.queue.push(a); - (Fs.ie && Fs.ie_version <= 11 || Fs.ios && n.composing) && s.some((a) => a.type == "childList" && a.removedNodes.length || a.type == "characterData" && a.oldValue.length > a.target.nodeValue.length) ? this.flushSoon() : this.flush(); - }), ORe && (this.onCharData = (s) => { +}, mE = Mt.ie && Mt.ie_version <= 11; +class Nxe { + constructor(e) { + this.view = e, this.active = !1, this.selectionRange = new vbe(), this.selectionChanged = !1, this.delayedFlush = -1, this.resizeTimeout = -1, this.queue = [], this.delayedAndroidKey = null, this.flushingAndroidKey = -1, this.lastChange = 0, this.scrollTargets = [], this.intersection = null, this.resizeScroll = null, this.intersecting = !1, this.gapIntersection = null, this.gaps = [], this.parentCheck = -1, this.dom = e.contentDOM, this.observer = new MutationObserver((r) => { + for (let n of r) + this.queue.push(n); + (Mt.ie && Mt.ie_version <= 11 || Mt.ios && e.composing) && r.some((n) => n.type == "childList" && n.removedNodes.length || n.type == "characterData" && n.oldValue.length > n.target.nodeValue.length) ? this.flushSoon() : this.flush(); + }), mE && (this.onCharData = (r) => { this.queue.push({ - target: s.target, + target: r.target, type: "characterData", - oldValue: s.prevValue + oldValue: r.prevValue }), this.flushSoon(); }), this.onSelectionChange = this.onSelectionChange.bind(this), this.onResize = this.onResize.bind(this), this.onPrint = this.onPrint.bind(this), this.onScroll = this.onScroll.bind(this), typeof ResizeObserver == "function" && (this.resizeScroll = new ResizeObserver(() => { - var s; - ((s = this.view.docView) === null || s === void 0 ? void 0 : s.lastUpdate) < Date.now() - 75 && this.onResize(); - }), this.resizeScroll.observe(n.scrollDOM)), this.addWindowListeners(this.win = n.win), this.start(), typeof IntersectionObserver == "function" && (this.intersection = new IntersectionObserver((s) => { - this.parentCheck < 0 && (this.parentCheck = setTimeout(this.listenForScroll.bind(this), 1e3)), s.length > 0 && s[s.length - 1].intersectionRatio > 0 != this.intersecting && (this.intersecting = !this.intersecting, this.intersecting != this.view.inView && this.onScrollChanged(document.createEvent("Event"))); - }, { threshold: [0, 1e-3] }), this.intersection.observe(this.dom), this.gapIntersection = new IntersectionObserver((s) => { - s.length > 0 && s[s.length - 1].intersectionRatio > 0 && this.onScrollChanged(document.createEvent("Event")); + var r; + ((r = this.view.docView) === null || r === void 0 ? void 0 : r.lastUpdate) < Date.now() - 75 && this.onResize(); + }), this.resizeScroll.observe(e.scrollDOM)), this.addWindowListeners(this.win = e.win), this.start(), typeof IntersectionObserver == "function" && (this.intersection = new IntersectionObserver((r) => { + this.parentCheck < 0 && (this.parentCheck = setTimeout(this.listenForScroll.bind(this), 1e3)), r.length > 0 && r[r.length - 1].intersectionRatio > 0 != this.intersecting && (this.intersecting = !this.intersecting, this.intersecting != this.view.inView && this.onScrollChanged(document.createEvent("Event"))); + }, { threshold: [0, 1e-3] }), this.intersection.observe(this.dom), this.gapIntersection = new IntersectionObserver((r) => { + r.length > 0 && r[r.length - 1].intersectionRatio > 0 && this.onScrollChanged(document.createEvent("Event")); }, {})), this.listenForScroll(), this.readSelectionRange(); } - onScrollChanged(n) { - this.view.inputState.runHandlers("scroll", n), this.intersecting && this.view.measure(); + onScrollChanged(e) { + this.view.inputState.runHandlers("scroll", e), this.intersecting && this.view.measure(); } - onScroll(n) { - this.intersecting && this.flush(!1), this.onScrollChanged(n); + onScroll(e) { + this.intersecting && this.flush(!1), this.onScrollChanged(e); } onResize() { this.resizeTimeout < 0 && (this.resizeTimeout = setTimeout(() => { @@ -8085,89 +8094,89 @@ class s4n { this.view.viewState.printing = !1, this.view.requestMeasure(); }, 500); } - updateGaps(n) { - if (this.gapIntersection && (n.length != this.gaps.length || this.gaps.some((s, a) => s != n[a]))) { + updateGaps(e) { + if (this.gapIntersection && (e.length != this.gaps.length || this.gaps.some((r, n) => r != e[n]))) { this.gapIntersection.disconnect(); - for (let s of n) - this.gapIntersection.observe(s); - this.gaps = n; + for (let r of e) + this.gapIntersection.observe(r); + this.gaps = e; } } - onSelectionChange(n) { - let s = this.selectionChanged; + onSelectionChange(e) { + let r = this.selectionChanged; if (!this.readSelectionRange() || this.delayedAndroidKey) return; - let { view: a } = this, l = this.selectionRange; - if (a.state.facet(G2e) ? a.root.activeElement != this.dom : !Wme(a.dom, l)) + let { view: n } = this, i = this.selectionRange; + if (n.state.facet(NS) ? n.root.activeElement != this.dom : !n4(n.dom, i)) return; - let h = l.anchorNode && a.docView.nearest(l.anchorNode); - if (h && h.ignoreEvent(n)) { - s || (this.selectionChanged = !1); + let s = i.anchorNode && n.docView.nearest(i.anchorNode); + if (s && s.ignoreEvent(e)) { + r || (this.selectionChanged = !1); return; } - (Fs.ie && Fs.ie_version <= 11 || Fs.android && Fs.chrome) && !a.state.selection.main.empty && l.focusNode && zbe(l.focusNode, l.focusOffset, l.anchorNode, l.anchorOffset) ? this.flushSoon() : this.flush(!1); + (Mt.ie && Mt.ie_version <= 11 || Mt.android && Mt.chrome) && !n.state.selection.main.empty && i.focusNode && y5(i.focusNode, i.focusOffset, i.anchorNode, i.anchorOffset) ? this.flushSoon() : this.flush(!1); } readSelectionRange() { - let { view: n } = this, s = Fs.safari && n.root.nodeType == 11 && Bkn(this.dom.ownerDocument) == this.dom && o4n(this.view) || Qbe(n.root); - if (!s || this.selectionRange.eq(s)) + let { view: e } = this, r = Mt.safari && e.root.nodeType == 11 && dbe(this.dom.ownerDocument) == this.dom && Ixe(this.view) || v5(e.root); + if (!r || this.selectionRange.eq(r)) return !1; - let a = Wme(this.dom, s); - return a && !this.selectionChanged && n.inputState.lastFocusTime > Date.now() - 200 && n.inputState.lastTouchTime < Date.now() - 300 && Vkn(this.dom, s) ? (this.view.inputState.lastFocusTime = 0, n.docView.updateSelection(), !1) : (this.selectionRange.setRange(s), a && (this.selectionChanged = !0), !0); + let n = n4(this.dom, r); + return n && !this.selectionChanged && e.inputState.lastFocusTime > Date.now() - 200 && e.inputState.lastTouchTime < Date.now() - 300 && bbe(this.dom, r) ? (this.view.inputState.lastFocusTime = 0, e.docView.updateSelection(), !1) : (this.selectionRange.setRange(r), n && (this.selectionChanged = !0), !0); } - setSelectionRange(n, s) { - this.selectionRange.set(n.node, n.offset, s.node, s.offset), this.selectionChanged = !1; + setSelectionRange(e, r) { + this.selectionRange.set(e.node, e.offset, r.node, r.offset), this.selectionChanged = !1; } clearSelectionRange() { this.selectionRange.set(null, 0, null, 0); } listenForScroll() { this.parentCheck = -1; - let n = 0, s = null; - for (let a = this.dom; a; ) - if (a.nodeType == 1) - !s && n < this.scrollTargets.length && this.scrollTargets[n] == a ? n++ : s || (s = this.scrollTargets.slice(0, n)), s && s.push(a), a = a.assignedSlot || a.parentNode; - else if (a.nodeType == 11) - a = a.host; + let e = 0, r = null; + for (let n = this.dom; n; ) + if (n.nodeType == 1) + !r && e < this.scrollTargets.length && this.scrollTargets[e] == n ? e++ : r || (r = this.scrollTargets.slice(0, e)), r && r.push(n), n = n.assignedSlot || n.parentNode; + else if (n.nodeType == 11) + n = n.host; else break; - if (n < this.scrollTargets.length && !s && (s = this.scrollTargets.slice(0, n)), s) { - for (let a of this.scrollTargets) - a.removeEventListener("scroll", this.onScroll); - for (let a of this.scrollTargets = s) - a.addEventListener("scroll", this.onScroll); + if (e < this.scrollTargets.length && !r && (r = this.scrollTargets.slice(0, e)), r) { + for (let n of this.scrollTargets) + n.removeEventListener("scroll", this.onScroll); + for (let n of this.scrollTargets = r) + n.addEventListener("scroll", this.onScroll); } } - ignore(n) { + ignore(e) { if (!this.active) - return n(); + return e(); try { - return this.stop(), n(); + return this.stop(), e(); } finally { this.start(), this.clear(); } } start() { - this.active || (this.observer.observe(this.dom, i4n), ORe && this.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.active = !0); + this.active || (this.observer.observe(this.dom, Dxe), mE && this.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.active = !0); } stop() { - !this.active || (this.active = !1, this.observer.disconnect(), ORe && this.dom.removeEventListener("DOMCharacterDataModified", this.onCharData)); + !this.active || (this.active = !1, this.observer.disconnect(), mE && this.dom.removeEventListener("DOMCharacterDataModified", this.onCharData)); } clear() { this.processRecords(), this.queue.length = 0, this.selectionChanged = !1; } - delayAndroidKey(n, s) { - var a; + delayAndroidKey(e, r) { + var n; if (!this.delayedAndroidKey) { - let l = () => { - let h = this.delayedAndroidKey; - h && (this.clearDelayedAndroidKey(), this.view.inputState.lastKeyCode = h.keyCode, this.view.inputState.lastKeyTime = Date.now(), !this.flush() && h.force && PB(this.dom, h.key, h.keyCode)); + let i = () => { + let s = this.delayedAndroidKey; + s && (this.clearDelayedAndroidKey(), this.view.inputState.lastKeyCode = s.keyCode, this.view.inputState.lastKeyTime = Date.now(), !this.flush() && s.force && Wp(this.dom, s.key, s.keyCode)); }; - this.flushingAndroidKey = this.view.win.requestAnimationFrame(l); + this.flushingAndroidKey = this.view.win.requestAnimationFrame(i); } - (!this.delayedAndroidKey || n == "Enter") && (this.delayedAndroidKey = { - key: n, - keyCode: s, - force: this.lastChange < Date.now() - 50 || !!(!((a = this.delayedAndroidKey) === null || a === void 0) && a.force) + (!this.delayedAndroidKey || e == "Enter") && (this.delayedAndroidKey = { + key: e, + keyCode: r, + force: this.lastChange < Date.now() - 50 || !!(!((n = this.delayedAndroidKey) === null || n === void 0) && n.force) }); } clearDelayedAndroidKey() { @@ -8182,90 +8191,90 @@ class s4n { this.delayedFlush >= 0 && (this.view.win.cancelAnimationFrame(this.delayedFlush), this.delayedFlush = -1), this.flush(); } pendingRecords() { - for (let n of this.observer.takeRecords()) - this.queue.push(n); + for (let e of this.observer.takeRecords()) + this.queue.push(e); return this.queue; } processRecords() { - let n = this.pendingRecords(); - n.length && (this.queue = []); - let s = -1, a = -1, l = !1; - for (let h of n) { - let f = this.readMutation(h); - !f || (f.typeOver && (l = !0), s == -1 ? { from: s, to: a } = f : (s = Math.min(f.from, s), a = Math.max(f.to, a))); + let e = this.pendingRecords(); + e.length && (this.queue = []); + let r = -1, n = -1, i = !1; + for (let s of e) { + let a = this.readMutation(s); + !a || (a.typeOver && (i = !0), r == -1 ? { from: r, to: n } = a : (r = Math.min(a.from, r), n = Math.max(a.to, n))); } - return { from: s, to: a, typeOver: l }; + return { from: r, to: n, typeOver: i }; } readChange() { - let { from: n, to: s, typeOver: a } = this.processRecords(), l = this.selectionChanged && Wme(this.dom, this.selectionRange); - if (n < 0 && !l) + let { from: e, to: r, typeOver: n } = this.processRecords(), i = this.selectionChanged && n4(this.dom, this.selectionRange); + if (e < 0 && !i) return null; - n > -1 && (this.lastChange = Date.now()), this.view.inputState.lastFocusTime = 0, this.selectionChanged = !1; - let h = new J5n(this.view, n, s, a); - return this.view.docView.domChanged = { newSel: h.newSel ? h.newSel.main : null }, h; + e > -1 && (this.lastChange = Date.now()), this.view.inputState.lastFocusTime = 0, this.selectionChanged = !1; + let s = new _xe(this.view, e, r, n); + return this.view.docView.domChanged = { newSel: s.newSel ? s.newSel.main : null }, s; } - flush(n = !0) { + flush(e = !0) { if (this.delayedFlush >= 0 || this.delayedAndroidKey) return !1; - n && this.readSelectionRange(); - let s = this.readChange(); - if (!s) + e && this.readSelectionRange(); + let r = this.readChange(); + if (!r) return this.view.requestMeasure(), !1; - let a = this.view.state, l = jMt(this.view, s); - return this.view.state == a && this.view.update([]), l; + let n = this.view.state, i = Jj(this.view, r); + return this.view.state == n && this.view.update([]), i; } - readMutation(n) { - let s = this.view.docView.nearest(n.target); - if (!s || s.ignoreMutation(n)) + readMutation(e) { + let r = this.view.docView.nearest(e.target); + if (!r || r.ignoreMutation(e)) return null; - if (s.markDirty(n.type == "attributes"), n.type == "attributes" && (s.flags |= 4), n.type == "childList") { - let a = tCt(s, n.previousSibling || n.target.previousSibling, -1), l = tCt(s, n.nextSibling || n.target.nextSibling, 1); + if (r.markDirty(e.type == "attributes"), e.type == "attributes" && (r.flags |= 4), e.type == "childList") { + let n = LB(r, e.previousSibling || e.target.previousSibling, -1), i = LB(r, e.nextSibling || e.target.nextSibling, 1); return { - from: a ? s.posAfter(a) : s.posAtStart, - to: l ? s.posBefore(l) : s.posAtEnd, + from: n ? r.posAfter(n) : r.posAtStart, + to: i ? r.posBefore(i) : r.posAtEnd, typeOver: !1 }; } else - return n.type == "characterData" ? { from: s.posAtStart, to: s.posAtEnd, typeOver: n.target.nodeValue == n.oldValue } : null; + return e.type == "characterData" ? { from: r.posAtStart, to: r.posAtEnd, typeOver: e.target.nodeValue == e.oldValue } : null; } - setWindow(n) { - n != this.win && (this.removeWindowListeners(this.win), this.win = n, this.addWindowListeners(this.win)); + setWindow(e) { + e != this.win && (this.removeWindowListeners(this.win), this.win = e, this.addWindowListeners(this.win)); } - addWindowListeners(n) { - n.addEventListener("resize", this.onResize), n.addEventListener("beforeprint", this.onPrint), n.addEventListener("scroll", this.onScroll), n.document.addEventListener("selectionchange", this.onSelectionChange); + addWindowListeners(e) { + e.addEventListener("resize", this.onResize), e.addEventListener("beforeprint", this.onPrint), e.addEventListener("scroll", this.onScroll), e.document.addEventListener("selectionchange", this.onSelectionChange); } - removeWindowListeners(n) { - n.removeEventListener("scroll", this.onScroll), n.removeEventListener("resize", this.onResize), n.removeEventListener("beforeprint", this.onPrint), n.document.removeEventListener("selectionchange", this.onSelectionChange); + removeWindowListeners(e) { + e.removeEventListener("scroll", this.onScroll), e.removeEventListener("resize", this.onResize), e.removeEventListener("beforeprint", this.onPrint), e.document.removeEventListener("selectionchange", this.onSelectionChange); } destroy() { - var n, s, a; - this.stop(), (n = this.intersection) === null || n === void 0 || n.disconnect(), (s = this.gapIntersection) === null || s === void 0 || s.disconnect(), (a = this.resizeScroll) === null || a === void 0 || a.disconnect(); - for (let l of this.scrollTargets) - l.removeEventListener("scroll", this.onScroll); + var e, r, n; + this.stop(), (e = this.intersection) === null || e === void 0 || e.disconnect(), (r = this.gapIntersection) === null || r === void 0 || r.disconnect(), (n = this.resizeScroll) === null || n === void 0 || n.disconnect(); + for (let i of this.scrollTargets) + i.removeEventListener("scroll", this.onScroll); this.removeWindowListeners(this.win), clearTimeout(this.parentCheck), clearTimeout(this.resizeTimeout), this.win.cancelAnimationFrame(this.delayedFlush), this.win.cancelAnimationFrame(this.flushingAndroidKey); } } -function tCt(r, n, s) { - for (; n; ) { - let a = Mh.get(n); - if (a && a.parent == r) - return a; - let l = n.parentNode; - n = l != r.dom ? l : s > 0 ? n.nextSibling : n.previousSibling; +function LB(t, e, r) { + for (; e; ) { + let n = yn.get(e); + if (n && n.parent == t) + return n; + let i = e.parentNode; + e = i != t.dom ? i : r > 0 ? e.nextSibling : e.previousSibling; } return null; } -function o4n(r) { - let n = null; - function s(w) { - w.preventDefault(), w.stopImmediatePropagation(), n = w.getTargetRanges()[0]; +function Ixe(t) { + let e = null; + function r(l) { + l.preventDefault(), l.stopImmediatePropagation(), e = l.getTargetRanges()[0]; } - if (r.contentDOM.addEventListener("beforeinput", s, !0), r.dom.ownerDocument.execCommand("indent"), r.contentDOM.removeEventListener("beforeinput", s, !0), !n) + if (t.contentDOM.addEventListener("beforeinput", r, !0), t.dom.ownerDocument.execCommand("indent"), t.contentDOM.removeEventListener("beforeinput", r, !0), !e) return null; - let a = n.startContainer, l = n.startOffset, h = n.endContainer, f = n.endOffset, b = r.docView.domAtPos(r.state.selection.main.anchor); - return zbe(b.node, b.offset, h, f) && ([a, l, h, f] = [h, f, a, l]), { anchorNode: a, anchorOffset: l, focusNode: h, focusOffset: f }; + let n = e.startContainer, i = e.startOffset, s = e.endContainer, a = e.endOffset, o = t.docView.domAtPos(t.state.selection.main.anchor); + return y5(o.node, o.offset, s, a) && ([n, i, s, a] = [s, a, n, i]), { anchorNode: n, anchorOffset: i, focusNode: s, focusOffset: a }; } -class Ci { +class dt { get state() { return this.viewState.state; } @@ -8290,161 +8299,161 @@ class Ci { get win() { return this.dom.ownerDocument.defaultView || window; } - constructor(n = {}) { - this.plugins = [], this.pluginMap = /* @__PURE__ */ new Map(), this.editorAttrs = {}, this.contentAttrs = {}, this.bidiCache = [], this.destroyed = !1, this.updateState = 2, this.measureScheduled = -1, this.measureRequests = [], this.contentDOM = document.createElement("div"), this.scrollDOM = document.createElement("div"), this.scrollDOM.tabIndex = -1, this.scrollDOM.className = "cm-scroller", this.scrollDOM.appendChild(this.contentDOM), this.announceDOM = document.createElement("div"), this.announceDOM.className = "cm-announced", this.announceDOM.setAttribute("aria-live", "polite"), this.dom = document.createElement("div"), this.dom.appendChild(this.announceDOM), this.dom.appendChild(this.scrollDOM), n.parent && n.parent.appendChild(this.dom); - let { dispatch: s } = n; - this.dispatchTransactions = n.dispatchTransactions || s && ((a) => a.forEach((l) => s(l, this))) || ((a) => this.update(a)), this.dispatch = this.dispatch.bind(this), this._root = n.root || qkn(n.parent) || document, this.viewState = new X_t(n.state || Ga.create(n)), n.scrollTo && n.scrollTo.is($ge) && (this.viewState.scrollTarget = n.scrollTo.value.clip(this.viewState.state)), this.plugins = this.state.facet(wX).map((a) => new bRe(a)); - for (let a of this.plugins) - a.update(this); - this.observer = new s4n(this), this.inputState = new O5n(this), this.inputState.ensureHandlers(this.plugins), this.docView = new L_t(this), this.mountStyles(), this.updateAttrs(), this.updateState = 0, this.requestMeasure(); + constructor(e = {}) { + this.plugins = [], this.pluginMap = /* @__PURE__ */ new Map(), this.editorAttrs = {}, this.contentAttrs = {}, this.bidiCache = [], this.destroyed = !1, this.updateState = 2, this.measureScheduled = -1, this.measureRequests = [], this.contentDOM = document.createElement("div"), this.scrollDOM = document.createElement("div"), this.scrollDOM.tabIndex = -1, this.scrollDOM.className = "cm-scroller", this.scrollDOM.appendChild(this.contentDOM), this.announceDOM = document.createElement("div"), this.announceDOM.className = "cm-announced", this.announceDOM.setAttribute("aria-live", "polite"), this.dom = document.createElement("div"), this.dom.appendChild(this.announceDOM), this.dom.appendChild(this.scrollDOM), e.parent && e.parent.appendChild(this.dom); + let { dispatch: r } = e; + this.dispatchTransactions = e.dispatchTransactions || r && ((n) => n.forEach((i) => r(i, this))) || ((n) => this.update(n)), this.dispatch = this.dispatch.bind(this), this._root = e.root || ybe(e.parent) || document, this.viewState = new CB(e.state || dr.create(e)), e.scrollTo && e.scrollTo.is(hw) && (this.viewState.scrollTarget = e.scrollTo.value.clip(this.viewState.state)), this.plugins = this.state.facet(hv).map((n) => new fE(n)); + for (let n of this.plugins) + n.update(this); + this.observer = new Nxe(this), this.inputState = new Zbe(this), this.inputState.ensureHandlers(this.plugins), this.docView = new lB(this), this.mountStyles(), this.updateAttrs(), this.updateState = 0, this.requestMeasure(); } - dispatch(...n) { - let s = n.length == 1 && n[0] instanceof v1 ? n : n.length == 1 && Array.isArray(n[0]) ? n[0] : [this.state.update(...n)]; - this.dispatchTransactions(s, this); + dispatch(...e) { + let r = e.length == 1 && e[0] instanceof fi ? e : e.length == 1 && Array.isArray(e[0]) ? e[0] : [this.state.update(...e)]; + this.dispatchTransactions(r, this); } - update(n) { + update(e) { if (this.updateState != 0) throw new Error("Calls to EditorView.update are not allowed while an update is in progress"); - let s = !1, a = !1, l, h = this.state; - for (let D of n) { - if (D.startState != h) + let r = !1, n = !1, i, s = this.state; + for (let d of e) { + if (d.startState != s) throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state."); - h = D.state; + s = d.state; } if (this.destroyed) { - this.viewState.state = h; + this.viewState.state = s; return; } - let f = this.hasFocus, b = 0, w = null; - n.some((D) => D.annotation(LMt)) ? (this.inputState.notifiedFocused = f, b = 1) : f != this.inputState.notifiedFocused && (this.inputState.notifiedFocused = f, w = IMt(h, f), w || (b = 1)); - let O = this.observer.delayedAndroidKey, S = null; - if (O ? (this.observer.clearDelayedAndroidKey(), S = this.observer.readChange(), (S && !this.state.doc.eq(h.doc) || !this.state.selection.eq(h.selection)) && (S = null)) : this.observer.clear(), h.facet(Ga.phrases) != this.state.facet(Ga.phrases)) - return this.setState(h); - l = qbe.create(this, h, n), l.flags |= b; - let E = this.viewState.scrollTarget; + let a = this.hasFocus, o = 0, l = null; + e.some((d) => d.annotation(Wj)) ? (this.inputState.notifiedFocused = a, o = 1) : a != this.inputState.notifiedFocused && (this.inputState.notifiedFocused = a, l = Gj(s, a), l || (o = 1)); + let u = this.observer.delayedAndroidKey, h = null; + if (u ? (this.observer.clearDelayedAndroidKey(), h = this.observer.readChange(), (h && !this.state.doc.eq(s.doc) || !this.state.selection.eq(s.selection)) && (h = null)) : this.observer.clear(), s.facet(dr.phrases) != this.state.facet(dr.phrases)) + return this.setState(s); + i = b5.create(this, s, e), i.flags |= o; + let f = this.viewState.scrollTarget; try { this.updateState = 2; - for (let D of n) { - if (E && (E = E.map(D.changes)), D.scrollIntoView) { - let { main: M } = D.state.selection; - E = new LB(M.empty ? M : sr.cursor(M.head, M.head > M.anchor ? -1 : 1)); + for (let d of e) { + if (f && (f = f.map(d.changes)), d.scrollIntoView) { + let { main: p } = d.state.selection; + f = new Gp(p.empty ? p : Ve.cursor(p.head, p.head > p.anchor ? -1 : 1)); } - for (let M of D.effects) - M.is($ge) && (E = M.value.clip(this.state)); + for (let p of d.effects) + p.is(hw) && (f = p.value.clip(this.state)); } - this.viewState.update(l, E), this.bidiCache = Vbe.update(this.bidiCache, l.changes), l.empty || (this.updatePlugins(l), this.inputState.update(l)), s = this.docView.update(l), this.state.facet(yX) != this.styleModules && this.mountStyles(), a = this.updateAttrs(), this.showAnnouncements(n), this.docView.updateSelection(s, n.some((D) => D.isUserEvent("select.pointer"))); + this.viewState.update(i, f), this.bidiCache = x5.update(this.bidiCache, i.changes), i.empty || (this.updatePlugins(i), this.inputState.update(i)), r = this.docView.update(i), this.state.facet(fv) != this.styleModules && this.mountStyles(), n = this.updateAttrs(), this.showAnnouncements(e), this.docView.updateSelection(r, e.some((d) => d.isUserEvent("select.pointer"))); } finally { this.updateState = 0; } - if (l.startState.facet(qge) != l.state.facet(qge) && (this.viewState.mustMeasureContent = !0), (s || a || E || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent) && this.requestMeasure(), !l.empty) - for (let D of this.state.facet(cFe)) + if (i.startState.facet(vw) != i.state.facet(vw) && (this.viewState.mustMeasureContent = !0), (r || n || f || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent) && this.requestMeasure(), !i.empty) + for (let d of this.state.facet(jA)) try { - D(l); - } catch (M) { - Yy(this.state, M, "update listener"); + d(i); + } catch (p) { + Bo(this.state, p, "update listener"); } - (w || S) && Promise.resolve().then(() => { - w && this.state == w.startState && this.dispatch(w), S && !jMt(this, S) && O.force && PB(this.contentDOM, O.key, O.keyCode); + (l || h) && Promise.resolve().then(() => { + l && this.state == l.startState && this.dispatch(l), h && !Jj(this, h) && u.force && Wp(this.contentDOM, u.key, u.keyCode); }); } - setState(n) { + setState(e) { if (this.updateState != 0) throw new Error("Calls to EditorView.setState are not allowed while an update is in progress"); if (this.destroyed) { - this.viewState.state = n; + this.viewState.state = e; return; } this.updateState = 2; - let s = this.hasFocus; + let r = this.hasFocus; try { - for (let a of this.plugins) - a.destroy(this); - this.viewState = new X_t(n), this.plugins = n.facet(wX).map((a) => new bRe(a)), this.pluginMap.clear(); - for (let a of this.plugins) - a.update(this); - this.docView.destroy(), this.docView = new L_t(this), this.inputState.ensureHandlers(this.plugins), this.mountStyles(), this.updateAttrs(), this.bidiCache = []; + for (let n of this.plugins) + n.destroy(this); + this.viewState = new CB(e), this.plugins = e.facet(hv).map((n) => new fE(n)), this.pluginMap.clear(); + for (let n of this.plugins) + n.update(this); + this.docView.destroy(), this.docView = new lB(this), this.inputState.ensureHandlers(this.plugins), this.mountStyles(), this.updateAttrs(), this.bidiCache = []; } finally { this.updateState = 0; } - s && this.focus(), this.requestMeasure(); + r && this.focus(), this.requestMeasure(); } - updatePlugins(n) { - let s = n.startState.facet(wX), a = n.state.facet(wX); - if (s != a) { - let l = []; - for (let h of a) { - let f = s.indexOf(h); - if (f < 0) - l.push(new bRe(h)); + updatePlugins(e) { + let r = e.startState.facet(hv), n = e.state.facet(hv); + if (r != n) { + let i = []; + for (let s of n) { + let a = r.indexOf(s); + if (a < 0) + i.push(new fE(s)); else { - let b = this.plugins[f]; - b.mustUpdate = n, l.push(b); + let o = this.plugins[a]; + o.mustUpdate = e, i.push(o); } } - for (let h of this.plugins) - h.mustUpdate != n && h.destroy(this); - this.plugins = l, this.pluginMap.clear(); + for (let s of this.plugins) + s.mustUpdate != e && s.destroy(this); + this.plugins = i, this.pluginMap.clear(); } else - for (let l of this.plugins) - l.mustUpdate = n; - for (let l = 0; l < this.plugins.length; l++) - this.plugins[l].update(this); - s != a && this.inputState.ensureHandlers(this.plugins); + for (let i of this.plugins) + i.mustUpdate = e; + for (let i = 0; i < this.plugins.length; i++) + this.plugins[i].update(this); + r != n && this.inputState.ensureHandlers(this.plugins); } - measure(n = !0) { + measure(e = !0) { if (this.destroyed) return; if (this.measureScheduled > -1 && this.win.cancelAnimationFrame(this.measureScheduled), this.observer.delayedAndroidKey) { this.measureScheduled = -1, this.requestMeasure(); return; } - this.measureScheduled = 0, n && this.observer.forceFlush(); - let s = null, a = this.scrollDOM, l = a.scrollTop * this.scaleY, { scrollAnchorPos: h, scrollAnchorHeight: f } = this.viewState; - Math.abs(l - this.viewState.scrollTop) > 1 && (f = -1), this.viewState.scrollAnchorHeight = -1; + this.measureScheduled = 0, e && this.observer.forceFlush(); + let r = null, n = this.scrollDOM, i = n.scrollTop * this.scaleY, { scrollAnchorPos: s, scrollAnchorHeight: a } = this.viewState; + Math.abs(i - this.viewState.scrollTop) > 1 && (a = -1), this.viewState.scrollAnchorHeight = -1; try { - for (let b = 0; ; b++) { - if (f < 0) - if (XDt(a)) - h = -1, f = this.viewState.heightMap.height; + for (let o = 0; ; o++) { + if (a < 0) + if (uj(n)) + s = -1, a = this.viewState.heightMap.height; else { - let M = this.viewState.scrollAnchorAt(l); - h = M.from, f = M.top; + let p = this.viewState.scrollAnchorAt(i); + s = p.from, a = p.top; } this.updateState = 1; - let w = this.viewState.measure(this); - if (!w && !this.measureRequests.length && this.viewState.scrollTarget == null) + let l = this.viewState.measure(this); + if (!l && !this.measureRequests.length && this.viewState.scrollTarget == null) break; - if (b > 5) { + if (o > 5) { console.warn(this.measureRequests.length ? "Measure loop restarted more than 5 times" : "Viewport failed to stabilize"); break; } - let O = []; - w & 4 || ([this.measureRequests, O] = [O, this.measureRequests]); - let S = O.map((M) => { + let u = []; + l & 4 || ([this.measureRequests, u] = [u, this.measureRequests]); + let h = u.map((p) => { try { - return M.read(this); - } catch (B) { - return Yy(this.state, B), nCt; - } - }), E = qbe.create(this, this.state, []), D = !1; - E.flags |= w, s ? s.flags |= w : s = E, this.updateState = 2, E.empty || (this.updatePlugins(E), this.inputState.update(E), this.updateAttrs(), D = this.docView.update(E)); - for (let M = 0; M < O.length; M++) - if (S[M] != nCt) + return p.read(this); + } catch (g) { + return Bo(this.state, g), RB; + } + }), f = b5.create(this, this.state, []), d = !1; + f.flags |= l, r ? r.flags |= l : r = f, this.updateState = 2, f.empty || (this.updatePlugins(f), this.inputState.update(f), this.updateAttrs(), d = this.docView.update(f)); + for (let p = 0; p < u.length; p++) + if (h[p] != RB) try { - let B = O[M]; - B.write && B.write(S[M], this); - } catch (B) { - Yy(this.state, B); + let g = u[p]; + g.write && g.write(h[p], this); + } catch (g) { + Bo(this.state, g); } - if (D && this.docView.updateSelection(!0), !E.viewportChanged && this.measureRequests.length == 0) { + if (d && this.docView.updateSelection(!0), !f.viewportChanged && this.measureRequests.length == 0) { if (this.viewState.editorHeight) if (this.viewState.scrollTarget) { - this.docView.scrollIntoView(this.viewState.scrollTarget), this.viewState.scrollTarget = null, f = -1; + this.docView.scrollIntoView(this.viewState.scrollTarget), this.viewState.scrollTarget = null, a = -1; continue; } else { - let B = (h < 0 ? this.viewState.heightMap.height : this.viewState.lineBlockAt(h).top) - f; - if (B > 1 || B < -1) { - l = l + B, a.scrollTop = l / this.scaleY, f = -1; + let g = (s < 0 ? this.viewState.heightMap.height : this.viewState.lineBlockAt(s).top) - a; + if (g > 1 || g < -1) { + i = i + g, n.scrollTop = i / this.scaleY, a = -1; continue; } } @@ -8454,71 +8463,71 @@ class Ci { } finally { this.updateState = 0, this.measureScheduled = -1; } - if (s && !s.empty) - for (let b of this.state.facet(cFe)) - b(s); + if (r && !r.empty) + for (let o of this.state.facet(jA)) + o(r); } get themeClasses() { - return mFe + " " + (this.state.facet(gFe) ? BMt : $Mt) + " " + this.state.facet(qge); + return s7 + " " + (this.state.facet(i7) ? jj : Zj) + " " + this.state.facet(vw); } updateAttrs() { - let n = rCt(this, gMt, { + let e = MB(this, _j, { class: "cm-editor" + (this.hasFocus ? " cm-focused " : " ") + this.themeClasses - }), s = { + }), r = { spellcheck: "false", autocorrect: "off", autocapitalize: "off", translate: "no", - contenteditable: this.state.facet(G2e) ? "true" : "false", + contenteditable: this.state.facet(NS) ? "true" : "false", class: "cm-content", - style: `${Fs.tabSize}: ${this.state.tabSize}`, + style: `${Mt.tabSize}: ${this.state.tabSize}`, role: "textbox", "aria-multiline": "true" }; - this.state.readOnly && (s["aria-readonly"] = "true"), rCt(this, uze, s); - let a = this.observer.ignore(() => { - let l = oFe(this.contentDOM, this.contentAttrs, s), h = oFe(this.dom, this.editorAttrs, n); - return l || h; + this.state.readOnly && (r["aria-readonly"] = "true"), MB(this, PR, r); + let n = this.observer.ignore(() => { + let i = XA(this.contentDOM, this.contentAttrs, r), s = XA(this.dom, this.editorAttrs, e); + return i || s; }); - return this.editorAttrs = n, this.contentAttrs = s, a; - } - showAnnouncements(n) { - let s = !0; - for (let a of n) - for (let l of a.effects) - if (l.is(Ci.announce)) { - s && (this.announceDOM.textContent = ""), s = !1; - let h = this.announceDOM.appendChild(document.createElement("div")); - h.textContent = l.value; + return this.editorAttrs = e, this.contentAttrs = r, n; + } + showAnnouncements(e) { + let r = !0; + for (let n of e) + for (let i of n.effects) + if (i.is(dt.announce)) { + r && (this.announceDOM.textContent = ""), r = !1; + let s = this.announceDOM.appendChild(document.createElement("div")); + s.textContent = i.value; } } mountStyles() { - this.styleModules = this.state.facet(yX); - let n = this.state.facet(Ci.cspNonce); - s_.mount(this.root, this.styleModules.concat(Z5n).reverse(), n ? { nonce: n } : void 0); + this.styleModules = this.state.facet(fv); + let e = this.state.facet(dt.cspNonce); + Iu.mount(this.root, this.styleModules.concat(Txe).reverse(), e ? { nonce: e } : void 0); } readMeasured() { if (this.updateState == 2) throw new Error("Reading the editor layout isn't allowed during an update"); this.updateState == 0 && this.measureScheduled > -1 && this.measure(!1); } - requestMeasure(n) { - if (this.measureScheduled < 0 && (this.measureScheduled = this.win.requestAnimationFrame(() => this.measure())), n) { - if (this.measureRequests.indexOf(n) > -1) + requestMeasure(e) { + if (this.measureScheduled < 0 && (this.measureScheduled = this.win.requestAnimationFrame(() => this.measure())), e) { + if (this.measureRequests.indexOf(e) > -1) return; - if (n.key != null) { - for (let s = 0; s < this.measureRequests.length; s++) - if (this.measureRequests[s].key === n.key) { - this.measureRequests[s] = n; + if (e.key != null) { + for (let r = 0; r < this.measureRequests.length; r++) + if (this.measureRequests[r].key === e.key) { + this.measureRequests[r] = e; return; } } - this.measureRequests.push(n); + this.measureRequests.push(e); } } - plugin(n) { - let s = this.pluginMap.get(n); - return (s === void 0 || s && s.spec != n) && this.pluginMap.set(n, s = this.plugins.find((a) => a.spec == n) || null), s && s.update(this).value; + plugin(e) { + let r = this.pluginMap.get(e); + return (r === void 0 || r && r.spec != e) && this.pluginMap.set(e, r = this.plugins.find((n) => n.spec == e) || null), r && r.update(this).value; } get documentTop() { return this.contentDOM.getBoundingClientRect().top + this.viewState.paddingTop; @@ -8532,52 +8541,52 @@ class Ci { get scaleY() { return this.viewState.scaleY; } - elementAtHeight(n) { - return this.readMeasured(), this.viewState.elementAtHeight(n); + elementAtHeight(e) { + return this.readMeasured(), this.viewState.elementAtHeight(e); } - lineBlockAtHeight(n) { - return this.readMeasured(), this.viewState.lineBlockAtHeight(n); + lineBlockAtHeight(e) { + return this.readMeasured(), this.viewState.lineBlockAtHeight(e); } get viewportLineBlocks() { return this.viewState.viewportLines; } - lineBlockAt(n) { - return this.viewState.lineBlockAt(n); + lineBlockAt(e) { + return this.viewState.lineBlockAt(e); } get contentHeight() { return this.viewState.contentHeight; } - moveByChar(n, s, a) { - return wRe(this, n, F_t(this, n, s, a)); + moveByChar(e, r, n) { + return pE(this, e, pB(this, e, r, n)); } - moveByGroup(n, s) { - return wRe(this, n, F_t(this, n, s, (a) => w5n(this, n.head, a))); + moveByGroup(e, r) { + return pE(this, e, pB(this, e, r, (n) => Hbe(this, e.head, n))); } - moveToLineBoundary(n, s, a = !0) { - return v5n(this, n, s, a); + moveToLineBoundary(e, r, n = !0) { + return Gbe(this, e, r, n); } - moveVertically(n, s, a) { - return wRe(this, n, y5n(this, n, s, a)); + moveVertically(e, r, n) { + return pE(this, e, Xbe(this, e, r, n)); } - domAtPos(n) { - return this.docView.domAtPos(n); + domAtPos(e) { + return this.docView.domAtPos(e); } - posAtDOM(n, s = 0) { - return this.docView.posFromDOM(n, s); + posAtDOM(e, r = 0) { + return this.docView.posFromDOM(e, r); } - posAtCoords(n, s = !0) { - return this.readMeasured(), CMt(this, n, s); + posAtCoords(e, r = !0) { + return this.readMeasured(), Fj(this, e, r); } - coordsAtPos(n, s = 1) { + coordsAtPos(e, r = 1) { this.readMeasured(); - let a = this.docView.coordsAt(n, s); - if (!a || a.left == a.right) - return a; - let l = this.state.doc.lineAt(n), h = this.bidiSpans(l), f = h[XT.find(h, n - l.from, -1, s)]; - return aze(a, f.dir == Cf.LTR == s > 0); + let n = this.docView.coordsAt(e, r); + if (!n || n.left == n.right) + return n; + let i = this.state.doc.lineAt(e), s = this.bidiSpans(i), a = s[Ih.find(s, e - i.from, -1, r)]; + return DR(n, a.dir == Nn.LTR == r > 0); } - coordsForChar(n) { - return this.readMeasured(), this.docView.coordsForChar(n); + coordsForChar(e) { + return this.readMeasured(), this.docView.coordsForChar(e); } get defaultCharacterWidth() { return this.viewState.heightOracle.charWidth; @@ -8588,459 +8597,459 @@ class Ci { get textDirection() { return this.viewState.defaultTextDirection; } - textDirectionAt(n) { - return !this.state.facet(dMt) || n < this.viewport.from || n > this.viewport.to ? this.textDirection : (this.readMeasured(), this.docView.textDirectionAt(n)); + textDirectionAt(e) { + return !this.state.facet(Cj) || e < this.viewport.from || e > this.viewport.to ? this.textDirection : (this.readMeasured(), this.docView.textDirectionAt(e)); } get lineWrapping() { return this.viewState.heightOracle.lineWrapping; } - bidiSpans(n) { - if (n.length > a4n) - return kMt(n.length); - let s = this.textDirectionAt(n.from), a; - for (let h of this.bidiCache) - if (h.from == n.from && h.dir == s && (h.fresh || OMt(h.isolates, a = P_t(this, n.from, n.to)))) - return h.order; - a || (a = P_t(this, n.from, n.to)); - let l = i5n(n.text, s, a); - return this.bidiCache.push(new Vbe(n.from, n.to, s, a, !0, l)), l; + bidiSpans(e) { + if (e.length > Pxe) + return Ij(e.length); + let r = this.textDirectionAt(e.from), n; + for (let s of this.bidiCache) + if (s.from == e.from && s.dir == r && (s.fresh || Nj(s.isolates, n = oB(this, e.from, e.to)))) + return s.order; + n || (n = oB(this, e.from, e.to)); + let i = Dbe(e.text, r, n); + return this.bidiCache.push(new x5(e.from, e.to, r, n, !0, i)), i; } get hasFocus() { - var n; - return (this.dom.ownerDocument.hasFocus() || Fs.safari && ((n = this.inputState) === null || n === void 0 ? void 0 : n.lastContextMenu) > Date.now() - 3e4) && this.root.activeElement == this.contentDOM; + var e; + return (this.dom.ownerDocument.hasFocus() || Mt.safari && ((e = this.inputState) === null || e === void 0 ? void 0 : e.lastContextMenu) > Date.now() - 3e4) && this.root.activeElement == this.contentDOM; } focus() { this.observer.ignore(() => { - GDt(this.contentDOM), this.docView.updateSelection(); + lj(this.contentDOM), this.docView.updateSelection(); }); } - setRoot(n) { - this._root != n && (this._root = n, this.observer.setWindow((n.nodeType == 9 ? n : n.ownerDocument).defaultView || window), this.mountStyles()); + setRoot(e) { + this._root != e && (this._root = e, this.observer.setWindow((e.nodeType == 9 ? e : e.ownerDocument).defaultView || window), this.mountStyles()); } destroy() { - for (let n of this.plugins) - n.destroy(this); + for (let e of this.plugins) + e.destroy(this); this.plugins = [], this.inputState.destroy(), this.docView.destroy(), this.dom.remove(), this.observer.destroy(), this.measureScheduled > -1 && this.win.cancelAnimationFrame(this.measureScheduled), this.destroyed = !0; } - static scrollIntoView(n, s = {}) { - return $ge.of(new LB(typeof n == "number" ? sr.cursor(n) : n, s.y, s.x, s.yMargin, s.xMargin)); + static scrollIntoView(e, r = {}) { + return hw.of(new Gp(typeof e == "number" ? Ve.cursor(e) : e, r.y, r.x, r.yMargin, r.xMargin)); } scrollSnapshot() { - let { scrollTop: n, scrollLeft: s } = this.scrollDOM, a = this.viewState.scrollAnchorAt(n); - return $ge.of(new LB(sr.cursor(a.from), "start", "start", a.top - n, s, !0)); + let { scrollTop: e, scrollLeft: r } = this.scrollDOM, n = this.viewState.scrollAnchorAt(e); + return hw.of(new Gp(Ve.cursor(n.from), "start", "start", n.top - e, r, !0)); } - static domEventHandlers(n) { - return Zu.define(() => ({}), { eventHandlers: n }); + static domEventHandlers(e) { + return an.define(() => ({}), { eventHandlers: e }); } - static domEventObservers(n) { - return Zu.define(() => ({}), { eventObservers: n }); + static domEventObservers(e) { + return an.define(() => ({}), { eventObservers: e }); } - static theme(n, s) { - let a = s_.newName(), l = [qge.of(a), yX.of(bFe(`.${a}`, n))]; - return s && s.dark && l.push(gFe.of(!0)), l; + static theme(e, r) { + let n = Iu.newName(), i = [vw.of(n), fv.of(a7(`.${n}`, e))]; + return r && r.dark && i.push(i7.of(!0)), i; } - static baseTheme(n) { - return Sk.lowest(yX.of(bFe("." + mFe, n, FMt))); + static baseTheme(e) { + return zl.lowest(fv.of(a7("." + s7, e, Kj))); } - static findFromDOM(n) { - var s; - let a = n.querySelector(".cm-content"), l = a && Mh.get(a) || Mh.get(n); - return ((s = l == null ? void 0 : l.rootView) === null || s === void 0 ? void 0 : s.view) || null; - } -} -Ci.styleModule = yX; -Ci.inputHandler = hMt; -Ci.focusChangeEffect = fMt; -Ci.perLineTextDirection = dMt; -Ci.exceptionSink = uMt; -Ci.updateListener = cFe; -Ci.editable = G2e; -Ci.mouseSelectionStyle = lMt; -Ci.dragMovesSelection = cMt; -Ci.clickAddsSelectionRange = aMt; -Ci.decorations = pK; -Ci.atomicRanges = hze; -Ci.bidiIsolatedRanges = mMt; -Ci.scrollMargins = bMt; -Ci.darkTheme = gFe; -Ci.cspNonce = /* @__PURE__ */ us.define({ combine: (r) => r.length ? r[0] : "" }); -Ci.contentAttributes = uze; -Ci.editorAttributes = gMt; -Ci.lineWrapping = /* @__PURE__ */ Ci.contentAttributes.of({ class: "cm-lineWrapping" }); -Ci.announce = /* @__PURE__ */ $o.define(); -const a4n = 4096, nCt = {}; -class Vbe { - constructor(n, s, a, l, h, f) { - this.from = n, this.to = s, this.dir = a, this.isolates = l, this.fresh = h, this.order = f; - } - static update(n, s) { - if (s.empty && !n.some((h) => h.fresh)) - return n; - let a = [], l = n.length ? n[n.length - 1].dir : Cf.LTR; - for (let h = Math.max(0, n.length - 10); h < n.length; h++) { - let f = n[h]; - f.dir == l && !s.touchesRange(f.from, f.to) && a.push(new Vbe(s.mapPos(f.from, 1), s.mapPos(f.to, -1), f.dir, f.isolates, !1, f.order)); + static findFromDOM(e) { + var r; + let n = e.querySelector(".cm-content"), i = n && yn.get(n) || yn.get(e); + return ((r = i == null ? void 0 : i.rootView) === null || r === void 0 ? void 0 : r.view) || null; + } +} +dt.styleModule = fv; +dt.inputHandler = Sj; +dt.focusChangeEffect = Tj; +dt.perLineTextDirection = Cj; +dt.exceptionSink = kj; +dt.updateListener = jA; +dt.editable = NS; +dt.mouseSelectionStyle = Oj; +dt.dragMovesSelection = wj; +dt.clickAddsSelectionRange = xj; +dt.decorations = ky; +dt.atomicRanges = $R; +dt.bidiIsolatedRanges = Aj; +dt.scrollMargins = Lj; +dt.darkTheme = i7; +dt.cspNonce = /* @__PURE__ */ _t.define({ combine: (t) => t.length ? t[0] : "" }); +dt.contentAttributes = PR; +dt.editorAttributes = _j; +dt.lineWrapping = /* @__PURE__ */ dt.contentAttributes.of({ class: "cm-lineWrapping" }); +dt.announce = /* @__PURE__ */ Zt.define(); +const Pxe = 4096, RB = {}; +class x5 { + constructor(e, r, n, i, s, a) { + this.from = e, this.to = r, this.dir = n, this.isolates = i, this.fresh = s, this.order = a; + } + static update(e, r) { + if (r.empty && !e.some((s) => s.fresh)) + return e; + let n = [], i = e.length ? e[e.length - 1].dir : Nn.LTR; + for (let s = Math.max(0, e.length - 10); s < e.length; s++) { + let a = e[s]; + a.dir == i && !r.touchesRange(a.from, a.to) && n.push(new x5(r.mapPos(a.from, 1), r.mapPos(a.to, -1), a.dir, a.isolates, !1, a.order)); } - return a; + return n; } } -function rCt(r, n, s) { - for (let a = r.state.facet(n), l = a.length - 1; l >= 0; l--) { - let h = a[l], f = typeof h == "function" ? h(r) : h; - f && sFe(f, s); +function MB(t, e, r) { + for (let n = t.state.facet(e), i = n.length - 1; i >= 0; i--) { + let s = n[i], a = typeof s == "function" ? s(t) : s; + a && HA(a, r); } - return s; + return r; } -const c4n = Fs.mac ? "mac" : Fs.windows ? "win" : Fs.linux ? "linux" : "key"; -function l4n(r, n) { - const s = r.split(/-(?!$)/); - let a = s[s.length - 1]; - a == "Space" && (a = " "); - let l, h, f, b; - for (let w = 0; w < s.length - 1; ++w) { - const O = s[w]; - if (/^(cmd|meta|m)$/i.test(O)) - b = !0; - else if (/^a(lt)?$/i.test(O)) - l = !0; - else if (/^(c|ctrl|control)$/i.test(O)) - h = !0; - else if (/^s(hift)?$/i.test(O)) - f = !0; - else if (/^mod$/i.test(O)) - n == "mac" ? b = !0 : h = !0; +const $xe = Mt.mac ? "mac" : Mt.windows ? "win" : Mt.linux ? "linux" : "key"; +function Bxe(t, e) { + const r = t.split(/-(?!$)/); + let n = r[r.length - 1]; + n == "Space" && (n = " "); + let i, s, a, o; + for (let l = 0; l < r.length - 1; ++l) { + const u = r[l]; + if (/^(cmd|meta|m)$/i.test(u)) + o = !0; + else if (/^a(lt)?$/i.test(u)) + i = !0; + else if (/^(c|ctrl|control)$/i.test(u)) + s = !0; + else if (/^s(hift)?$/i.test(u)) + a = !0; + else if (/^mod$/i.test(u)) + e == "mac" ? o = !0 : s = !0; else - throw new Error("Unrecognized modifier name: " + O); - } - return l && (a = "Alt-" + a), h && (a = "Ctrl-" + a), b && (a = "Meta-" + a), f && (a = "Shift-" + a), a; -} -function Vge(r, n, s) { - return n.altKey && (r = "Alt-" + r), n.ctrlKey && (r = "Ctrl-" + r), n.metaKey && (r = "Meta-" + r), s !== !1 && n.shiftKey && (r = "Shift-" + r), r; -} -const u4n = /* @__PURE__ */ Sk.default(/* @__PURE__ */ Ci.domEventHandlers({ - keydown(r, n) { - return zMt(QMt(n.state), r, n, "editor"); - } -})), X6 = /* @__PURE__ */ us.define({ enables: u4n }), iCt = /* @__PURE__ */ new WeakMap(); -function QMt(r) { - let n = r.facet(X6), s = iCt.get(n); - return s || iCt.set(n, s = d4n(n.reduce((a, l) => a.concat(l), []))), s; -} -function h4n(r, n, s) { - return zMt(QMt(r.state), n, r, s); -} -let VT = null; -const f4n = 4e3; -function d4n(r, n = c4n) { - let s = /* @__PURE__ */ Object.create(null), a = /* @__PURE__ */ Object.create(null), l = (f, b) => { - let w = a[f]; - if (w == null) - a[f] = b; - else if (w != b) - throw new Error("Key binding " + f + " is used both as a regular binding and as a multi-stroke prefix"); - }, h = (f, b, w, O, S) => { - var E, D; - let M = s[f] || (s[f] = /* @__PURE__ */ Object.create(null)), B = b.split(/ (?!$)/).map((H) => l4n(H, n)); - for (let H = 1; H < B.length; H++) { - let G = B.slice(0, H).join(" "); - l(G, !0), M[G] || (M[G] = { + throw new Error("Unrecognized modifier name: " + u); + } + return i && (n = "Alt-" + n), s && (n = "Ctrl-" + n), o && (n = "Meta-" + n), a && (n = "Shift-" + n), n; +} +function yw(t, e, r) { + return e.altKey && (t = "Alt-" + t), e.ctrlKey && (t = "Ctrl-" + t), e.metaKey && (t = "Meta-" + t), r !== !1 && e.shiftKey && (t = "Shift-" + t), t; +} +const Fxe = /* @__PURE__ */ zl.default(/* @__PURE__ */ dt.domEventHandlers({ + keydown(t, e) { + return tK(eK(e.state), t, e, "editor"); + } +})), Tu = /* @__PURE__ */ _t.define({ enables: Fxe }), DB = /* @__PURE__ */ new WeakMap(); +function eK(t) { + let e = t.facet(Tu), r = DB.get(e); + return r || DB.set(e, r = Uxe(e.reduce((n, i) => n.concat(i), []))), r; +} +function zxe(t, e, r) { + return tK(eK(t.state), e, t, r); +} +let Ch = null; +const Vxe = 4e3; +function Uxe(t, e = $xe) { + let r = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ Object.create(null), i = (a, o) => { + let l = n[a]; + if (l == null) + n[a] = o; + else if (l != o) + throw new Error("Key binding " + a + " is used both as a regular binding and as a multi-stroke prefix"); + }, s = (a, o, l, u, h) => { + var f, d; + let p = r[a] || (r[a] = /* @__PURE__ */ Object.create(null)), g = o.split(/ (?!$)/).map((y) => Bxe(y, e)); + for (let y = 1; y < g.length; y++) { + let b = g.slice(0, y).join(" "); + i(b, !0), p[b] || (p[b] = { preventDefault: !0, stopPropagation: !1, - run: [(ee) => { - let le = VT = { view: ee, prefix: G, scope: f }; + run: [(w) => { + let O = Ch = { view: w, prefix: b, scope: a }; return setTimeout(() => { - VT == le && (VT = null); - }, f4n), !0; + Ch == O && (Ch = null); + }, Vxe), !0; }] }); } - let z = B.join(" "); - l(z, !1); - let W = M[z] || (M[z] = { + let m = g.join(" "); + i(m, !1); + let v = p[m] || (p[m] = { preventDefault: !1, stopPropagation: !1, - run: ((D = (E = M._any) === null || E === void 0 ? void 0 : E.run) === null || D === void 0 ? void 0 : D.slice()) || [] + run: ((d = (f = p._any) === null || f === void 0 ? void 0 : f.run) === null || d === void 0 ? void 0 : d.slice()) || [] }); - w && W.run.push(w), O && (W.preventDefault = !0), S && (W.stopPropagation = !0); + l && v.run.push(l), u && (v.preventDefault = !0), h && (v.stopPropagation = !0); }; - for (let f of r) { - let b = f.scope ? f.scope.split(" ") : ["editor"]; - if (f.any) - for (let O of b) { - let S = s[O] || (s[O] = /* @__PURE__ */ Object.create(null)); - S._any || (S._any = { preventDefault: !1, stopPropagation: !1, run: [] }); - for (let E in S) - S[E].run.push(f.any); - } - let w = f[n] || f.key; - if (!!w) - for (let O of b) - h(O, w, f.run, f.preventDefault, f.stopPropagation), f.shift && h(O, "Shift-" + w, f.shift, f.preventDefault, f.stopPropagation); + for (let a of t) { + let o = a.scope ? a.scope.split(" ") : ["editor"]; + if (a.any) + for (let u of o) { + let h = r[u] || (r[u] = /* @__PURE__ */ Object.create(null)); + h._any || (h._any = { preventDefault: !1, stopPropagation: !1, run: [] }); + for (let f in h) + h[f].run.push(a.any); + } + let l = a[e] || a.key; + if (!!l) + for (let u of o) + s(u, l, a.run, a.preventDefault, a.stopPropagation), a.shift && s(u, "Shift-" + l, a.shift, a.preventDefault, a.stopPropagation); } - return s; + return r; } -function zMt(r, n, s, a) { - let l = $kn(n), h = Lp(l, 0), f = Fy(h) == l.length && l != " ", b = "", w = !1, O = !1, S = !1; - VT && VT.view == s && VT.scope == a && (b = VT.prefix + " ", TMt.indexOf(n.keyCode) < 0 && (O = !0, VT = null)); - let E = /* @__PURE__ */ new Set(), D = (W) => { - if (W) { - for (let H of W.run) - if (!E.has(H) && (E.add(H), H(s, n))) - return W.stopPropagation && (S = !0), !0; - W.preventDefault && (W.stopPropagation && (S = !0), O = !0); +function tK(t, e, r, n) { + let i = fbe(e), s = ss(i, 0), a = Eo(s) == i.length && i != " ", o = "", l = !1, u = !1, h = !1; + Ch && Ch.view == r && Ch.scope == n && (o = Ch.prefix + " ", Vj.indexOf(e.keyCode) < 0 && (u = !0, Ch = null)); + let f = /* @__PURE__ */ new Set(), d = (v) => { + if (v) { + for (let y of v.run) + if (!f.has(y) && (f.add(y), y(r, e))) + return v.stopPropagation && (h = !0), !0; + v.preventDefault && (v.stopPropagation && (h = !0), u = !0); } return !1; - }, M = r[a], B, z; - return M && (D(M[b + Vge(l, n, !f)]) ? w = !0 : f && (n.altKey || n.metaKey || n.ctrlKey) && !(Fs.windows && n.ctrlKey && n.altKey) && (B = d8[n.keyCode]) && B != l ? (D(M[b + Vge(B, n, !0)]) || n.shiftKey && (z = hK[n.keyCode]) != l && z != B && D(M[b + Vge(z, n, !1)])) && (w = !0) : f && n.shiftKey && D(M[b + Vge(l, n, !0)]) && (w = !0), !w && D(M._any) && (w = !0)), O && (w = !0), w && S && n.stopPropagation(), w; + }, p = t[n], g, m; + return p && (d(p[o + yw(i, e, !a)]) ? l = !0 : a && (e.altKey || e.metaKey || e.ctrlKey) && !(Mt.windows && e.ctrlKey && e.altKey) && (g = sf[e.keyCode]) && g != i ? (d(p[o + yw(g, e, !0)]) || e.shiftKey && (m = xy[e.keyCode]) != i && m != g && d(p[o + yw(m, e, !1)])) && (l = !0) : a && e.shiftKey && d(p[o + yw(i, e, !0)]) && (l = !0), !l && d(p._any) && (l = !0)), u && (l = !0), l && h && e.stopPropagation(), l; } -class PJ { - constructor(n, s, a, l, h) { - this.className = n, this.left = s, this.top = a, this.width = l, this.height = h; +class Qb { + constructor(e, r, n, i, s) { + this.className = e, this.left = r, this.top = n, this.width = i, this.height = s; } draw() { - let n = document.createElement("div"); - return n.className = this.className, this.adjust(n), n; + let e = document.createElement("div"); + return e.className = this.className, this.adjust(e), e; } - update(n, s) { - return s.className != this.className ? !1 : (this.adjust(n), !0); + update(e, r) { + return r.className != this.className ? !1 : (this.adjust(e), !0); } - adjust(n) { - n.style.left = this.left + "px", n.style.top = this.top + "px", this.width != null && (n.style.width = this.width + "px"), n.style.height = this.height + "px"; + adjust(e) { + e.style.left = this.left + "px", e.style.top = this.top + "px", this.width != null && (e.style.width = this.width + "px"), e.style.height = this.height + "px"; } - eq(n) { - return this.left == n.left && this.top == n.top && this.width == n.width && this.height == n.height && this.className == n.className; + eq(e) { + return this.left == e.left && this.top == e.top && this.width == e.width && this.height == e.height && this.className == e.className; } - static forRange(n, s, a) { - if (a.empty) { - let l = n.coordsAtPos(a.head, a.assoc || 1); - if (!l) + static forRange(e, r, n) { + if (n.empty) { + let i = e.coordsAtPos(n.head, n.assoc || 1); + if (!i) return []; - let h = qMt(n); - return [new PJ(s, l.left - h.left, l.top - h.top, null, l.bottom - l.top)]; + let s = rK(e); + return [new Qb(r, i.left - s.left, i.top - s.top, null, i.bottom - i.top)]; } else - return p4n(n, s, a); + return qxe(e, r, n); } } -function qMt(r) { - let n = r.scrollDOM.getBoundingClientRect(); - return { left: (r.textDirection == Cf.LTR ? n.left : n.right - r.scrollDOM.clientWidth * r.scaleX) - r.scrollDOM.scrollLeft * r.scaleX, top: n.top - r.scrollDOM.scrollTop * r.scaleY }; +function rK(t) { + let e = t.scrollDOM.getBoundingClientRect(); + return { left: (t.textDirection == Nn.LTR ? e.left : e.right - t.scrollDOM.clientWidth * t.scaleX) - t.scrollDOM.scrollLeft * t.scaleX, top: e.top - t.scrollDOM.scrollTop * t.scaleY }; } -function sCt(r, n, s) { - let a = sr.cursor(n); +function NB(t, e, r) { + let n = Ve.cursor(e); return { - from: Math.max(s.from, r.moveToLineBoundary(a, !1, !0).from), - to: Math.min(s.to, r.moveToLineBoundary(a, !0, !0).from), - type: Pm.Text + from: Math.max(r.from, t.moveToLineBoundary(n, !1, !0).from), + to: Math.min(r.to, t.moveToLineBoundary(n, !0, !0).from), + type: ia.Text }; } -function p4n(r, n, s) { - if (s.to <= r.viewport.from || s.from >= r.viewport.to) +function qxe(t, e, r) { + if (r.to <= t.viewport.from || r.from >= t.viewport.to) return []; - let a = Math.max(s.from, r.viewport.from), l = Math.min(s.to, r.viewport.to), h = r.textDirection == Cf.LTR, f = r.contentDOM, b = f.getBoundingClientRect(), w = qMt(r), O = f.querySelector(".cm-line"), S = O && window.getComputedStyle(O), E = b.left + (S ? parseInt(S.paddingLeft) + Math.min(0, parseInt(S.textIndent)) : 0), D = b.right - (S ? parseInt(S.paddingRight) : 0), M = dFe(r, a), B = dFe(r, l), z = M.type == Pm.Text ? M : null, W = B.type == Pm.Text ? B : null; - if (z && (r.lineWrapping || M.widgetLineBreaks) && (z = sCt(r, a, z)), W && (r.lineWrapping || B.widgetLineBreaks) && (W = sCt(r, l, W)), z && W && z.from == W.from) - return G(ee(s.from, s.to, z)); + let n = Math.max(r.from, t.viewport.from), i = Math.min(r.to, t.viewport.to), s = t.textDirection == Nn.LTR, a = t.contentDOM, o = a.getBoundingClientRect(), l = rK(t), u = a.querySelector(".cm-line"), h = u && window.getComputedStyle(u), f = o.left + (h ? parseInt(h.paddingLeft) + Math.min(0, parseInt(h.textIndent)) : 0), d = o.right - (h ? parseInt(h.paddingRight) : 0), p = r7(t, n), g = r7(t, i), m = p.type == ia.Text ? p : null, v = g.type == ia.Text ? g : null; + if (m && (t.lineWrapping || p.widgetLineBreaks) && (m = NB(t, n, m)), v && (t.lineWrapping || g.widgetLineBreaks) && (v = NB(t, i, v)), m && v && m.from == v.from) + return b(w(r.from, r.to, m)); { - let se = z ? ee(s.from, null, z) : le(M, !1), he = W ? ee(null, s.to, W) : le(B, !0), te = []; - return (z || M).to < (W || B).from - (z && W ? 1 : 0) || M.widgetLineBreaks > 1 && se.bottom + r.defaultLineHeight / 2 < he.top ? te.push(H(E, se.bottom, D, he.top)) : se.bottom < he.top && r.elementAtHeight((se.bottom + he.top) / 2).type == Pm.Text && (se.bottom = he.top = (se.bottom + he.top) / 2), G(se).concat(te).concat(G(he)); - } - function H(se, he, te, be) { - return new PJ(n, se - w.left, he - w.top - 0.01, te - se, be - he + 0.01); - } - function G({ top: se, bottom: he, horizontal: te }) { - let be = []; - for (let fe = 0; fe < te.length; fe += 2) - be.push(H(te[fe], se, te[fe + 1], he)); - return be; - } - function ee(se, he, te) { - let be = 1e9, fe = -1e9, ae = []; - function ke(X, Ie, ge, Fe, ve) { - let Ve = r.coordsAtPos(X, X == te.to ? -2 : 2), tt = r.coordsAtPos(ge, ge == te.from ? 2 : -2); - !Ve || !tt || (be = Math.min(Ve.top, tt.top, be), fe = Math.max(Ve.bottom, tt.bottom, fe), ve == Cf.LTR ? ae.push(h && Ie ? E : Ve.left, h && Fe ? D : tt.right) : ae.push(!h && Fe ? E : tt.left, !h && Ie ? D : Ve.right)); - } - let we = se != null ? se : te.from, Ce = he != null ? he : te.to; - for (let X of r.visibleRanges) - if (X.to > we && X.from < Ce) - for (let Ie = Math.max(X.from, we), ge = Math.min(X.to, Ce); ; ) { - let Fe = r.state.doc.lineAt(Ie); - for (let ve of r.bidiSpans(Fe)) { - let Ve = ve.from + Fe.from, tt = ve.to + Fe.from; - if (Ve >= ge) + let S = m ? w(r.from, null, m) : O(p, !1), C = v ? w(null, r.to, v) : O(g, !0), T = []; + return (m || p).to < (v || g).from - (m && v ? 1 : 0) || p.widgetLineBreaks > 1 && S.bottom + t.defaultLineHeight / 2 < C.top ? T.push(y(f, S.bottom, d, C.top)) : S.bottom < C.top && t.elementAtHeight((S.bottom + C.top) / 2).type == ia.Text && (S.bottom = C.top = (S.bottom + C.top) / 2), b(S).concat(T).concat(b(C)); + } + function y(S, C, T, A) { + return new Qb(e, S - l.left, C - l.top - 0.01, T - S, A - C + 0.01); + } + function b({ top: S, bottom: C, horizontal: T }) { + let A = []; + for (let E = 0; E < T.length; E += 2) + A.push(y(T[E], S, T[E + 1], C)); + return A; + } + function w(S, C, T) { + let A = 1e9, E = -1e9, L = []; + function _(k, N, M, I, D) { + let P = t.coordsAtPos(k, k == T.to ? -2 : 2), F = t.coordsAtPos(M, M == T.from ? 2 : -2); + !P || !F || (A = Math.min(P.top, F.top, A), E = Math.max(P.bottom, F.bottom, E), D == Nn.LTR ? L.push(s && N ? f : P.left, s && I ? d : F.right) : L.push(!s && I ? f : F.left, !s && N ? d : P.right)); + } + let R = S != null ? S : T.from, $ = C != null ? C : T.to; + for (let k of t.visibleRanges) + if (k.to > R && k.from < $) + for (let N = Math.max(k.from, R), M = Math.min(k.to, $); ; ) { + let I = t.state.doc.lineAt(N); + for (let D of t.bidiSpans(I)) { + let P = D.from + I.from, F = D.to + I.from; + if (P >= M) break; - tt > Ie && ke(Math.max(Ve, Ie), se == null && Ve <= we, Math.min(tt, ge), he == null && tt >= Ce, ve.dir); + F > N && _(Math.max(P, N), S == null && P <= R, Math.min(F, M), C == null && F >= $, D.dir); } - if (Ie = Fe.to + 1, Ie >= ge) + if (N = I.to + 1, N >= M) break; } - return ae.length == 0 && ke(we, se == null, Ce, he == null, r.textDirection), { top: be, bottom: fe, horizontal: ae }; + return L.length == 0 && _(R, S == null, $, C == null, t.textDirection), { top: A, bottom: E, horizontal: L }; } - function le(se, he) { - let te = b.top + (he ? se.top : se.bottom); - return { top: te, bottom: te, horizontal: [] }; + function O(S, C) { + let T = o.top + (C ? S.top : S.bottom); + return { top: T, bottom: T, horizontal: [] }; } } -function g4n(r, n) { - return r.constructor == n.constructor && r.eq(n); +function Qxe(t, e) { + return t.constructor == e.constructor && t.eq(e); } -class m4n { - constructor(n, s) { - this.view = n, this.layer = s, this.drawn = [], this.scaleX = 1, this.scaleY = 1, this.measureReq = { read: this.measure.bind(this), write: this.draw.bind(this) }, this.dom = n.scrollDOM.appendChild(document.createElement("div")), this.dom.classList.add("cm-layer"), s.above && this.dom.classList.add("cm-layer-above"), s.class && this.dom.classList.add(s.class), this.scale(), this.dom.setAttribute("aria-hidden", "true"), this.setOrder(n.state), n.requestMeasure(this.measureReq), s.mount && s.mount(this.dom, n); +class Yxe { + constructor(e, r) { + this.view = e, this.layer = r, this.drawn = [], this.scaleX = 1, this.scaleY = 1, this.measureReq = { read: this.measure.bind(this), write: this.draw.bind(this) }, this.dom = e.scrollDOM.appendChild(document.createElement("div")), this.dom.classList.add("cm-layer"), r.above && this.dom.classList.add("cm-layer-above"), r.class && this.dom.classList.add(r.class), this.scale(), this.dom.setAttribute("aria-hidden", "true"), this.setOrder(e.state), e.requestMeasure(this.measureReq), r.mount && r.mount(this.dom, e); } - update(n) { - n.startState.facet(Gme) != n.state.facet(Gme) && this.setOrder(n.state), (this.layer.update(n, this.dom) || n.geometryChanged) && (this.scale(), n.view.requestMeasure(this.measureReq)); + update(e) { + e.startState.facet(a4) != e.state.facet(a4) && this.setOrder(e.state), (this.layer.update(e, this.dom) || e.geometryChanged) && (this.scale(), e.view.requestMeasure(this.measureReq)); } - setOrder(n) { - let s = 0, a = n.facet(Gme); - for (; s < a.length && a[s] != this.layer; ) - s++; - this.dom.style.zIndex = String((this.layer.above ? 150 : -1) - s); + setOrder(e) { + let r = 0, n = e.facet(a4); + for (; r < n.length && n[r] != this.layer; ) + r++; + this.dom.style.zIndex = String((this.layer.above ? 150 : -1) - r); } measure() { return this.layer.markers(this.view); } scale() { - let { scaleX: n, scaleY: s } = this.view; - (n != this.scaleX || s != this.scaleY) && (this.scaleX = n, this.scaleY = s, this.dom.style.transform = `scale(${1 / n}, ${1 / s})`); + let { scaleX: e, scaleY: r } = this.view; + (e != this.scaleX || r != this.scaleY) && (this.scaleX = e, this.scaleY = r, this.dom.style.transform = `scale(${1 / e}, ${1 / r})`); } - draw(n) { - if (n.length != this.drawn.length || n.some((s, a) => !g4n(s, this.drawn[a]))) { - let s = this.dom.firstChild, a = 0; - for (let l of n) - l.update && s && l.constructor && this.drawn[a].constructor && l.update(s, this.drawn[a]) ? (s = s.nextSibling, a++) : this.dom.insertBefore(l.draw(), s); - for (; s; ) { - let l = s.nextSibling; - s.remove(), s = l; + draw(e) { + if (e.length != this.drawn.length || e.some((r, n) => !Qxe(r, this.drawn[n]))) { + let r = this.dom.firstChild, n = 0; + for (let i of e) + i.update && r && i.constructor && this.drawn[n].constructor && i.update(r, this.drawn[n]) ? (r = r.nextSibling, n++) : this.dom.insertBefore(i.draw(), r); + for (; r; ) { + let i = r.nextSibling; + r.remove(), r = i; } - this.drawn = n; + this.drawn = e; } } destroy() { this.layer.destroy && this.layer.destroy(this.dom, this.view), this.dom.remove(); } } -const Gme = /* @__PURE__ */ us.define(); -function VMt(r) { +const a4 = /* @__PURE__ */ _t.define(); +function nK(t) { return [ - Zu.define((n) => new m4n(n, r)), - Gme.of(r) + an.define((e) => new Yxe(e, t)), + a4.of(t) ]; } -const UMt = !Fs.ios, mK = /* @__PURE__ */ us.define({ - combine(r) { - return px(r, { +const iK = !Mt.ios, Ty = /* @__PURE__ */ _t.define({ + combine(t) { + return qc(t, { cursorBlinkRate: 1200, drawRangeCursor: !0 }, { - cursorBlinkRate: (n, s) => Math.min(n, s), - drawRangeCursor: (n, s) => n || s + cursorBlinkRate: (e, r) => Math.min(e, r), + drawRangeCursor: (e, r) => e || r }); } }); -function WMt(r = {}) { +function sK(t = {}) { return [ - mK.of(r), - b4n, - v4n, - w4n, - pMt.of(!0) + Ty.of(t), + Wxe, + Gxe, + Hxe, + Ej.of(!0) ]; } -function YMt(r) { - return r.startState.facet(mK) != r.state.facet(mK); +function aK(t) { + return t.startState.facet(Ty) != t.state.facet(Ty); } -const b4n = /* @__PURE__ */ VMt({ +const Wxe = /* @__PURE__ */ nK({ above: !0, - markers(r) { - let { state: n } = r, s = n.facet(mK), a = []; - for (let l of n.selection.ranges) { - let h = l == n.selection.main; - if (l.empty ? !h || UMt : s.drawRangeCursor) { - let f = h ? "cm-cursor cm-cursor-primary" : "cm-cursor cm-cursor-secondary", b = l.empty ? l : sr.cursor(l.head, l.head > l.anchor ? -1 : 1); - for (let w of PJ.forRange(r, f, b)) - a.push(w); + markers(t) { + let { state: e } = t, r = e.facet(Ty), n = []; + for (let i of e.selection.ranges) { + let s = i == e.selection.main; + if (i.empty ? !s || iK : r.drawRangeCursor) { + let a = s ? "cm-cursor cm-cursor-primary" : "cm-cursor cm-cursor-secondary", o = i.empty ? i : Ve.cursor(i.head, i.head > i.anchor ? -1 : 1); + for (let l of Qb.forRange(t, a, o)) + n.push(l); } } - return a; + return n; }, - update(r, n) { - r.transactions.some((a) => a.selection) && (n.style.animationName = n.style.animationName == "cm-blink" ? "cm-blink2" : "cm-blink"); - let s = YMt(r); - return s && oCt(r.state, n), r.docChanged || r.selectionSet || s; + update(t, e) { + t.transactions.some((n) => n.selection) && (e.style.animationName = e.style.animationName == "cm-blink" ? "cm-blink2" : "cm-blink"); + let r = aK(t); + return r && IB(t.state, e), t.docChanged || t.selectionSet || r; }, - mount(r, n) { - oCt(n.state, r); + mount(t, e) { + IB(e.state, t); }, class: "cm-cursorLayer" }); -function oCt(r, n) { - n.style.animationDuration = r.facet(mK).cursorBlinkRate + "ms"; +function IB(t, e) { + e.style.animationDuration = t.facet(Ty).cursorBlinkRate + "ms"; } -const v4n = /* @__PURE__ */ VMt({ +const Gxe = /* @__PURE__ */ nK({ above: !1, - markers(r) { - return r.state.selection.ranges.map((n) => n.empty ? [] : PJ.forRange(r, "cm-selectionBackground", n)).reduce((n, s) => n.concat(s)); + markers(t) { + return t.state.selection.ranges.map((e) => e.empty ? [] : Qb.forRange(t, "cm-selectionBackground", e)).reduce((e, r) => e.concat(r)); }, - update(r, n) { - return r.docChanged || r.selectionSet || r.viewportChanged || YMt(r); + update(t, e) { + return t.docChanged || t.selectionSet || t.viewportChanged || aK(t); }, class: "cm-selectionLayer" -}), vFe = { +}), o7 = { ".cm-line": { "& ::selection": { backgroundColor: "transparent !important" }, "&::selection": { backgroundColor: "transparent !important" } } }; -UMt && (vFe[".cm-line"].caretColor = "transparent !important", vFe[".cm-content"] = { caretColor: "transparent !important" }); -const w4n = /* @__PURE__ */ Sk.highest(/* @__PURE__ */ Ci.theme(vFe)), HMt = /* @__PURE__ */ $o.define({ - map(r, n) { - return r == null ? null : n.mapPos(r); +iK && (o7[".cm-line"].caretColor = "transparent !important", o7[".cm-content"] = { caretColor: "transparent !important" }); +const Hxe = /* @__PURE__ */ zl.highest(/* @__PURE__ */ dt.theme(o7)), oK = /* @__PURE__ */ Zt.define({ + map(t, e) { + return t == null ? null : e.mapPos(t); } -}), xX = /* @__PURE__ */ Ef.define({ +}), gv = /* @__PURE__ */ Pn.define({ create() { return null; }, - update(r, n) { - return r != null && (r = n.changes.mapPos(r)), n.effects.reduce((s, a) => a.is(HMt) ? a.value : s, r); + update(t, e) { + return t != null && (t = e.changes.mapPos(t)), e.effects.reduce((r, n) => n.is(oK) ? n.value : r, t); } -}), y4n = /* @__PURE__ */ Zu.fromClass(class { - constructor(r) { - this.view = r, this.cursor = null, this.measureReq = { read: this.readPos.bind(this), write: this.drawCursor.bind(this) }; +}), Xxe = /* @__PURE__ */ an.fromClass(class { + constructor(t) { + this.view = t, this.cursor = null, this.measureReq = { read: this.readPos.bind(this), write: this.drawCursor.bind(this) }; } - update(r) { - var n; - let s = r.state.field(xX); - s == null ? this.cursor != null && ((n = this.cursor) === null || n === void 0 || n.remove(), this.cursor = null) : (this.cursor || (this.cursor = this.view.scrollDOM.appendChild(document.createElement("div")), this.cursor.className = "cm-dropCursor"), (r.startState.field(xX) != s || r.docChanged || r.geometryChanged) && this.view.requestMeasure(this.measureReq)); + update(t) { + var e; + let r = t.state.field(gv); + r == null ? this.cursor != null && ((e = this.cursor) === null || e === void 0 || e.remove(), this.cursor = null) : (this.cursor || (this.cursor = this.view.scrollDOM.appendChild(document.createElement("div")), this.cursor.className = "cm-dropCursor"), (t.startState.field(gv) != r || t.docChanged || t.geometryChanged) && this.view.requestMeasure(this.measureReq)); } readPos() { - let { view: r } = this, n = r.state.field(xX), s = n != null && r.coordsAtPos(n); - if (!s) + let { view: t } = this, e = t.state.field(gv), r = e != null && t.coordsAtPos(e); + if (!r) return null; - let a = r.scrollDOM.getBoundingClientRect(); + let n = t.scrollDOM.getBoundingClientRect(); return { - left: s.left - a.left + r.scrollDOM.scrollLeft * r.scaleX, - top: s.top - a.top + r.scrollDOM.scrollTop * r.scaleY, - height: s.bottom - s.top + left: r.left - n.left + t.scrollDOM.scrollLeft * t.scaleX, + top: r.top - n.top + t.scrollDOM.scrollTop * t.scaleY, + height: r.bottom - r.top }; } - drawCursor(r) { + drawCursor(t) { if (this.cursor) { - let { scaleX: n, scaleY: s } = this.view; - r ? (this.cursor.style.left = r.left / n + "px", this.cursor.style.top = r.top / s + "px", this.cursor.style.height = r.height / s + "px") : this.cursor.style.left = "-100000px"; + let { scaleX: e, scaleY: r } = this.view; + t ? (this.cursor.style.left = t.left / e + "px", this.cursor.style.top = t.top / r + "px", this.cursor.style.height = t.height / r + "px") : this.cursor.style.left = "-100000px"; } } destroy() { this.cursor && this.cursor.remove(); } - setDropPos(r) { - this.view.state.field(xX) != r && this.view.dispatch({ effects: HMt.of(r) }); + setDropPos(t) { + this.view.state.field(gv) != t && this.view.dispatch({ effects: oK.of(t) }); } }, { eventObservers: { - dragover(r) { - this.setDropPos(this.view.posAtCoords({ x: r.clientX, y: r.clientY })); + dragover(t) { + this.setDropPos(this.view.posAtCoords({ x: t.clientX, y: t.clientY })); }, - dragleave(r) { - (r.target == this.view.contentDOM || !this.view.contentDOM.contains(r.relatedTarget)) && this.setDropPos(null); + dragleave(t) { + (t.target == this.view.contentDOM || !this.view.contentDOM.contains(t.relatedTarget)) && this.setDropPos(null); }, dragend() { this.setDropPos(null); @@ -9050,86 +9059,86 @@ const w4n = /* @__PURE__ */ Sk.highest(/* @__PURE__ */ Ci.theme(vFe)), HMt = /* } } }); -function O4n() { - return [xX, y4n]; -} -function aCt(r, n, s, a, l) { - n.lastIndex = 0; - for (let h = r.iterRange(s, a), f = s, b; !h.next().done; f += h.value.length) - if (!h.lineBreak) - for (; b = n.exec(h.value); ) - l(f + b.index, b); -} -function k4n(r, n) { - let s = r.visibleRanges; - if (s.length == 1 && s[0].from == r.viewport.from && s[0].to == r.viewport.to) - return s; - let a = []; - for (let { from: l, to: h } of s) - l = Math.max(r.state.doc.lineAt(l).from, l - n), h = Math.min(r.state.doc.lineAt(h).to, h + n), a.length && a[a.length - 1].to >= l ? a[a.length - 1].to = h : a.push({ from: l, to: h }); - return a; +function Zxe() { + return [gv, Xxe]; +} +function PB(t, e, r, n, i) { + e.lastIndex = 0; + for (let s = t.iterRange(r, n), a = r, o; !s.next().done; a += s.value.length) + if (!s.lineBreak) + for (; o = e.exec(s.value); ) + i(a + o.index, o); +} +function jxe(t, e) { + let r = t.visibleRanges; + if (r.length == 1 && r[0].from == t.viewport.from && r[0].to == t.viewport.to) + return r; + let n = []; + for (let { from: i, to: s } of r) + i = Math.max(t.state.doc.lineAt(i).from, i - e), s = Math.min(t.state.doc.lineAt(s).to, s + e), n.length && n[n.length - 1].to >= i ? n[n.length - 1].to = s : n.push({ from: i, to: s }); + return n; } -class x4n { - constructor(n) { - const { regexp: s, decoration: a, decorate: l, boundary: h, maxLength: f = 1e3 } = n; - if (!s.global) +class Kxe { + constructor(e) { + const { regexp: r, decoration: n, decorate: i, boundary: s, maxLength: a = 1e3 } = e; + if (!r.global) throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set"); - if (this.regexp = s, l) - this.addMatch = (b, w, O, S) => l(S, O, O + b[0].length, b, w); - else if (typeof a == "function") - this.addMatch = (b, w, O, S) => { - let E = a(b, w, O); - E && S(O, O + b[0].length, E); + if (this.regexp = r, i) + this.addMatch = (o, l, u, h) => i(h, u, u + o[0].length, o, l); + else if (typeof n == "function") + this.addMatch = (o, l, u, h) => { + let f = n(o, l, u); + f && h(u, u + o[0].length, f); }; - else if (a) - this.addMatch = (b, w, O, S) => S(O, O + b[0].length, a); + else if (n) + this.addMatch = (o, l, u, h) => h(u, u + o[0].length, n); else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator"); - this.boundary = h, this.maxLength = f; - } - createDeco(n) { - let s = new G0(), a = s.add.bind(s); - for (let { from: l, to: h } of k4n(n, this.maxLength)) - aCt(n.state.doc, this.regexp, l, h, (f, b) => this.addMatch(b, n, f, a)); - return s.finish(); - } - updateDeco(n, s) { - let a = 1e9, l = -1; - return n.docChanged && n.changes.iterChanges((h, f, b, w) => { - w > n.view.viewport.from && b < n.view.viewport.to && (a = Math.min(b, a), l = Math.max(w, l)); - }), n.viewportChanged || l - a > 1e3 ? this.createDeco(n.view) : l > -1 ? this.updateRange(n.view, s.map(n.changes), a, l) : s; - } - updateRange(n, s, a, l) { - for (let h of n.visibleRanges) { - let f = Math.max(h.from, a), b = Math.min(h.to, l); - if (b > f) { - let w = n.state.doc.lineAt(f), O = w.to < b ? n.state.doc.lineAt(b) : w, S = Math.max(h.from, w.from), E = Math.min(h.to, O.to); + this.boundary = s, this.maxLength = a; + } + createDeco(e) { + let r = new Hi(), n = r.add.bind(r); + for (let { from: i, to: s } of jxe(e, this.maxLength)) + PB(e.state.doc, this.regexp, i, s, (a, o) => this.addMatch(o, e, a, n)); + return r.finish(); + } + updateDeco(e, r) { + let n = 1e9, i = -1; + return e.docChanged && e.changes.iterChanges((s, a, o, l) => { + l > e.view.viewport.from && o < e.view.viewport.to && (n = Math.min(o, n), i = Math.max(l, i)); + }), e.viewportChanged || i - n > 1e3 ? this.createDeco(e.view) : i > -1 ? this.updateRange(e.view, r.map(e.changes), n, i) : r; + } + updateRange(e, r, n, i) { + for (let s of e.visibleRanges) { + let a = Math.max(s.from, n), o = Math.min(s.to, i); + if (o > a) { + let l = e.state.doc.lineAt(a), u = l.to < o ? e.state.doc.lineAt(o) : l, h = Math.max(s.from, l.from), f = Math.min(s.to, u.to); if (this.boundary) { - for (; f > w.from; f--) - if (this.boundary.test(w.text[f - 1 - w.from])) { - S = f; + for (; a > l.from; a--) + if (this.boundary.test(l.text[a - 1 - l.from])) { + h = a; break; } - for (; b < O.to; b++) - if (this.boundary.test(O.text[b - O.from])) { - E = b; + for (; o < u.to; o++) + if (this.boundary.test(u.text[o - u.from])) { + f = o; break; } } - let D = [], M, B = (z, W, H) => D.push(H.range(z, W)); - if (w == O) - for (this.regexp.lastIndex = S - w.from; (M = this.regexp.exec(w.text)) && M.index < E - w.from; ) - this.addMatch(M, n, M.index + w.from, B); + let d = [], p, g = (m, v, y) => d.push(y.range(m, v)); + if (l == u) + for (this.regexp.lastIndex = h - l.from; (p = this.regexp.exec(l.text)) && p.index < f - l.from; ) + this.addMatch(p, e, p.index + l.from, g); else - aCt(n.state.doc, this.regexp, S, E, (z, W) => this.addMatch(W, n, z, B)); - s = s.update({ filterFrom: S, filterTo: E, filter: (z, W) => z < S || W > E, add: D }); + PB(e.state.doc, this.regexp, h, f, (m, v) => this.addMatch(v, e, m, g)); + r = r.update({ filterFrom: h, filterTo: f, filter: (m, v) => m < h || v > f, add: d }); } } - return s; + return r; } } -const wFe = /x/.unicode != null ? "gu" : "g", S4n = /* @__PURE__ */ new RegExp(`[\0-\b --\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`, wFe), _4n = { +const l7 = /x/.unicode != null ? "gu" : "g", Jxe = /* @__PURE__ */ new RegExp(`[\0-\b +-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`, l7), ewe = { 0: "null", 7: "bell", 8: "backspace", @@ -9152,257 +9161,257 @@ const wFe = /x/.unicode != null ? "gu" : "g", S4n = /* @__PURE__ */ new RegExp(` 65279: "zero width no-break space", 65532: "object replacement" }; -let kRe = null; -function C4n() { - var r; - if (kRe == null && typeof document < "u" && document.body) { - let n = document.body.style; - kRe = ((r = n.tabSize) !== null && r !== void 0 ? r : n.MozTabSize) != null; - } - return kRe || !1; -} -const Zme = /* @__PURE__ */ us.define({ - combine(r) { - let n = px(r, { +let vE = null; +function twe() { + var t; + if (vE == null && typeof document < "u" && document.body) { + let e = document.body.style; + vE = ((t = e.tabSize) !== null && t !== void 0 ? t : e.MozTabSize) != null; + } + return vE || !1; +} +const o4 = /* @__PURE__ */ _t.define({ + combine(t) { + let e = qc(t, { render: null, - specialChars: S4n, + specialChars: Jxe, addSpecialChars: null }); - return (n.replaceTabs = !C4n()) && (n.specialChars = new RegExp(" |" + n.specialChars.source, wFe)), n.addSpecialChars && (n.specialChars = new RegExp(n.specialChars.source + "|" + n.addSpecialChars.source, wFe)), n; + return (e.replaceTabs = !twe()) && (e.specialChars = new RegExp(" |" + e.specialChars.source, l7)), e.addSpecialChars && (e.specialChars = new RegExp(e.specialChars.source + "|" + e.addSpecialChars.source, l7)), e; } }); -function GMt(r = {}) { - return [Zme.of(r), E4n()]; -} -let cCt = null; -function E4n() { - return cCt || (cCt = Zu.fromClass(class { - constructor(r) { - this.view = r, this.decorations = as.none, this.decorationCache = /* @__PURE__ */ Object.create(null), this.decorator = this.makeDecorator(r.state.facet(Zme)), this.decorations = this.decorator.createDeco(r); - } - makeDecorator(r) { - return new x4n({ - regexp: r.specialChars, - decoration: (n, s, a) => { - let { doc: l } = s.state, h = Lp(n[0], 0); - if (h == 9) { - let f = l.lineAt(a), b = s.state.tabSize, w = gk(f.text, b, a - f.from); - return as.replace({ - widget: new M4n((b - w % b) * this.view.defaultCharacterWidth / this.view.scaleX) +function lK(t = {}) { + return [o4.of(t), rwe()]; +} +let $B = null; +function rwe() { + return $B || ($B = an.fromClass(class { + constructor(t) { + this.view = t, this.decorations = Et.none, this.decorationCache = /* @__PURE__ */ Object.create(null), this.decorator = this.makeDecorator(t.state.facet(o4)), this.decorations = this.decorator.createDeco(t); + } + makeDecorator(t) { + return new Kxe({ + regexp: t.specialChars, + decoration: (e, r, n) => { + let { doc: i } = r.state, s = ss(e[0], 0); + if (s == 9) { + let a = i.lineAt(n), o = r.state.tabSize, l = Ml(a.text, o, n - a.from); + return Et.replace({ + widget: new awe((o - l % o) * this.view.defaultCharacterWidth / this.view.scaleX) }); } - return this.decorationCache[h] || (this.decorationCache[h] = as.replace({ widget: new D4n(r, h) })); + return this.decorationCache[s] || (this.decorationCache[s] = Et.replace({ widget: new swe(t, s) })); }, - boundary: r.replaceTabs ? void 0 : /[^]/ + boundary: t.replaceTabs ? void 0 : /[^]/ }); } - update(r) { - let n = r.state.facet(Zme); - r.startState.facet(Zme) != n ? (this.decorator = this.makeDecorator(n), this.decorations = this.decorator.createDeco(r.view)) : this.decorations = this.decorator.updateDeco(r, this.decorations); + update(t) { + let e = t.state.facet(o4); + t.startState.facet(o4) != e ? (this.decorator = this.makeDecorator(e), this.decorations = this.decorator.createDeco(t.view)) : this.decorations = this.decorator.updateDeco(t, this.decorations); } }, { - decorations: (r) => r.decorations + decorations: (t) => t.decorations })); } -const T4n = "\u2022"; -function A4n(r) { - return r >= 32 ? T4n : r == 10 ? "\u2424" : String.fromCharCode(9216 + r); +const nwe = "\u2022"; +function iwe(t) { + return t >= 32 ? nwe : t == 10 ? "\u2424" : String.fromCharCode(9216 + t); } -class D4n extends uv { - constructor(n, s) { - super(), this.options = n, this.code = s; +class swe extends za { + constructor(e, r) { + super(), this.options = e, this.code = r; } - eq(n) { - return n.code == this.code; + eq(e) { + return e.code == this.code; } - toDOM(n) { - let s = A4n(this.code), a = n.state.phrase("Control character") + " " + (_4n[this.code] || "0x" + this.code.toString(16)), l = this.options.render && this.options.render(this.code, a, s); - if (l) - return l; - let h = document.createElement("span"); - return h.textContent = s, h.title = a, h.setAttribute("aria-label", a), h.className = "cm-specialChar", h; + toDOM(e) { + let r = iwe(this.code), n = e.state.phrase("Control character") + " " + (ewe[this.code] || "0x" + this.code.toString(16)), i = this.options.render && this.options.render(this.code, n, r); + if (i) + return i; + let s = document.createElement("span"); + return s.textContent = r, s.title = n, s.setAttribute("aria-label", n), s.className = "cm-specialChar", s; } ignoreEvent() { return !1; } } -class M4n extends uv { - constructor(n) { - super(), this.width = n; +class awe extends za { + constructor(e) { + super(), this.width = e; } - eq(n) { - return n.width == this.width; + eq(e) { + return e.width == this.width; } toDOM() { - let n = document.createElement("span"); - return n.textContent = " ", n.className = "cm-tab", n.style.width = this.width + "px", n; + let e = document.createElement("span"); + return e.textContent = " ", e.className = "cm-tab", e.style.width = this.width + "px", e; } ignoreEvent() { return !1; } } -function ZMt() { - return L4n; +function cK() { + return lwe; } -const P4n = /* @__PURE__ */ as.line({ class: "cm-activeLine" }), L4n = /* @__PURE__ */ Zu.fromClass(class { - constructor(r) { - this.decorations = this.getDeco(r); +const owe = /* @__PURE__ */ Et.line({ class: "cm-activeLine" }), lwe = /* @__PURE__ */ an.fromClass(class { + constructor(t) { + this.decorations = this.getDeco(t); } - update(r) { - (r.docChanged || r.selectionSet) && (this.decorations = this.getDeco(r.view)); + update(t) { + (t.docChanged || t.selectionSet) && (this.decorations = this.getDeco(t.view)); } - getDeco(r) { - let n = -1, s = []; - for (let a of r.state.selection.ranges) { - let l = r.lineBlockAt(a.head); - l.from > n && (s.push(P4n.range(l.from)), n = l.from); + getDeco(t) { + let e = -1, r = []; + for (let n of t.state.selection.ranges) { + let i = t.lineBlockAt(n.head); + i.from > e && (r.push(owe.range(i.from)), e = i.from); } - return as.set(s); + return Et.set(r); } }, { - decorations: (r) => r.decorations -}), yFe = 2e3; -function I4n(r, n, s) { - let a = Math.min(n.line, s.line), l = Math.max(n.line, s.line), h = []; - if (n.off > yFe || s.off > yFe || n.col < 0 || s.col < 0) { - let f = Math.min(n.off, s.off), b = Math.max(n.off, s.off); - for (let w = a; w <= l; w++) { - let O = r.doc.line(w); - O.length <= b && h.push(sr.range(O.from + f, O.to + b)); + decorations: (t) => t.decorations +}), c7 = 2e3; +function cwe(t, e, r) { + let n = Math.min(e.line, r.line), i = Math.max(e.line, r.line), s = []; + if (e.off > c7 || r.off > c7 || e.col < 0 || r.col < 0) { + let a = Math.min(e.off, r.off), o = Math.max(e.off, r.off); + for (let l = n; l <= i; l++) { + let u = t.doc.line(l); + u.length <= o && s.push(Ve.range(u.from + a, u.to + o)); } } else { - let f = Math.min(n.col, s.col), b = Math.max(n.col, s.col); - for (let w = a; w <= l; w++) { - let O = r.doc.line(w), S = KBe(O.text, f, r.tabSize, !0); - if (S < 0) - h.push(sr.cursor(O.to)); + let a = Math.min(e.col, r.col), o = Math.max(e.col, r.col); + for (let l = n; l <= i; l++) { + let u = t.doc.line(l), h = VA(u.text, a, t.tabSize, !0); + if (h < 0) + s.push(Ve.cursor(u.to)); else { - let E = KBe(O.text, b, r.tabSize); - h.push(sr.range(O.from + S, O.from + E)); + let f = VA(u.text, o, t.tabSize); + s.push(Ve.range(u.from + h, u.from + f)); } } } - return h; + return s; } -function N4n(r, n) { - let s = r.coordsAtPos(r.viewport.from); - return s ? Math.round(Math.abs((s.left - n) / r.defaultCharacterWidth)) : -1; +function uwe(t, e) { + let r = t.coordsAtPos(t.viewport.from); + return r ? Math.round(Math.abs((r.left - e) / t.defaultCharacterWidth)) : -1; } -function lCt(r, n) { - let s = r.posAtCoords({ x: n.clientX, y: n.clientY }, !1), a = r.state.doc.lineAt(s), l = s - a.from, h = l > yFe ? -1 : l == a.length ? N4n(r, n.clientX) : gk(a.text, r.state.tabSize, s - a.from); - return { line: a.number, col: h, off: l }; +function BB(t, e) { + let r = t.posAtCoords({ x: e.clientX, y: e.clientY }, !1), n = t.state.doc.lineAt(r), i = r - n.from, s = i > c7 ? -1 : i == n.length ? uwe(t, e.clientX) : Ml(n.text, t.state.tabSize, r - n.from); + return { line: n.number, col: s, off: i }; } -function R4n(r, n) { - let s = lCt(r, n), a = r.state.selection; - return s ? { - update(l) { - if (l.docChanged) { - let h = l.changes.mapPos(l.startState.doc.line(s.line).from), f = l.state.doc.lineAt(h); - s = { line: f.number, col: s.col, off: Math.min(s.off, f.length) }, a = a.map(l.changes); +function hwe(t, e) { + let r = BB(t, e), n = t.state.selection; + return r ? { + update(i) { + if (i.docChanged) { + let s = i.changes.mapPos(i.startState.doc.line(r.line).from), a = i.state.doc.lineAt(s); + r = { line: a.number, col: r.col, off: Math.min(r.off, a.length) }, n = n.map(i.changes); } }, - get(l, h, f) { - let b = lCt(r, l); - if (!b) - return a; - let w = I4n(r.state, s, b); - return w.length ? f ? sr.create(w.concat(a.ranges)) : sr.create(w) : a; + get(i, s, a) { + let o = BB(t, i); + if (!o) + return n; + let l = cwe(t.state, r, o); + return l.length ? a ? Ve.create(l.concat(n.ranges)) : Ve.create(l) : n; } } : null; } -function $4n(r) { - let n = (r == null ? void 0 : r.eventFilter) || ((s) => s.altKey && s.button == 0); - return Ci.mouseSelectionStyle.of((s, a) => n(a) ? R4n(s, a) : null); +function fwe(t) { + let e = (t == null ? void 0 : t.eventFilter) || ((r) => r.altKey && r.button == 0); + return dt.mouseSelectionStyle.of((r, n) => e(n) ? hwe(r, n) : null); } -const B4n = { - Alt: [18, (r) => !!r.altKey], - Control: [17, (r) => !!r.ctrlKey], - Shift: [16, (r) => !!r.shiftKey], - Meta: [91, (r) => !!r.metaKey] -}, F4n = { style: "cursor: crosshair" }; -function j4n(r = {}) { - let [n, s] = B4n[r.key || "Alt"], a = Zu.fromClass(class { - constructor(l) { - this.view = l, this.isDown = !1; +const dwe = { + Alt: [18, (t) => !!t.altKey], + Control: [17, (t) => !!t.ctrlKey], + Shift: [16, (t) => !!t.shiftKey], + Meta: [91, (t) => !!t.metaKey] +}, pwe = { style: "cursor: crosshair" }; +function gwe(t = {}) { + let [e, r] = dwe[t.key || "Alt"], n = an.fromClass(class { + constructor(i) { + this.view = i, this.isDown = !1; } - set(l) { - this.isDown != l && (this.isDown = l, this.view.update([])); + set(i) { + this.isDown != i && (this.isDown = i, this.view.update([])); } }, { eventObservers: { - keydown(l) { - this.set(l.keyCode == n || s(l)); + keydown(i) { + this.set(i.keyCode == e || r(i)); }, - keyup(l) { - (l.keyCode == n || !s(l)) && this.set(!1); + keyup(i) { + (i.keyCode == e || !r(i)) && this.set(!1); }, - mousemove(l) { - this.set(s(l)); + mousemove(i) { + this.set(r(i)); } } }); return [ - a, - Ci.contentAttributes.of((l) => { - var h; - return !((h = l.plugin(a)) === null || h === void 0) && h.isDown ? F4n : null; + n, + dt.contentAttributes.of((i) => { + var s; + return !((s = i.plugin(n)) === null || s === void 0) && s.isDown ? pwe : null; }) ]; } -const ZZ = "-10000px"; -class XMt { - constructor(n, s, a) { - this.facet = s, this.createTooltipView = a, this.input = n.state.facet(s), this.tooltips = this.input.filter((l) => l), this.tooltipViews = this.tooltips.map(a); +const _m = "-10000px"; +class uK { + constructor(e, r, n) { + this.facet = r, this.createTooltipView = n, this.input = e.state.facet(r), this.tooltips = this.input.filter((i) => i), this.tooltipViews = this.tooltips.map(n); } - update(n, s) { - var a; - let l = n.state.facet(this.facet), h = l.filter((w) => w); - if (l === this.input) { - for (let w of this.tooltipViews) - w.update && w.update(n); + update(e, r) { + var n; + let i = e.state.facet(this.facet), s = i.filter((l) => l); + if (i === this.input) { + for (let l of this.tooltipViews) + l.update && l.update(e); return !1; } - let f = [], b = s ? [] : null; - for (let w = 0; w < h.length; w++) { - let O = h[w], S = -1; - if (!!O) { - for (let E = 0; E < this.tooltips.length; E++) { - let D = this.tooltips[E]; - D && D.create == O.create && (S = E); - } - if (S < 0) - f[w] = this.createTooltipView(O), b && (b[w] = !!O.above); + let a = [], o = r ? [] : null; + for (let l = 0; l < s.length; l++) { + let u = s[l], h = -1; + if (!!u) { + for (let f = 0; f < this.tooltips.length; f++) { + let d = this.tooltips[f]; + d && d.create == u.create && (h = f); + } + if (h < 0) + a[l] = this.createTooltipView(u), o && (o[l] = !!u.above); else { - let E = f[w] = this.tooltipViews[S]; - b && (b[w] = s[S]), E.update && E.update(n); + let f = a[l] = this.tooltipViews[h]; + o && (o[l] = r[h]), f.update && f.update(e); } } } - for (let w of this.tooltipViews) - f.indexOf(w) < 0 && (w.dom.remove(), (a = w.destroy) === null || a === void 0 || a.call(w)); - return s && (b.forEach((w, O) => s[O] = w), s.length = b.length), this.input = l, this.tooltips = h, this.tooltipViews = f, !0; + for (let l of this.tooltipViews) + a.indexOf(l) < 0 && (l.dom.remove(), (n = l.destroy) === null || n === void 0 || n.call(l)); + return r && (o.forEach((l, u) => r[u] = l), r.length = o.length), this.input = i, this.tooltips = s, this.tooltipViews = a, !0; } } -function Q4n(r) { - let { win: n } = r; - return { top: 0, left: 0, bottom: n.innerHeight, right: n.innerWidth }; +function mwe(t) { + let { win: e } = t; + return { top: 0, left: 0, bottom: e.innerHeight, right: e.innerWidth }; } -const xRe = /* @__PURE__ */ us.define({ - combine: (r) => { - var n, s, a; +const yE = /* @__PURE__ */ _t.define({ + combine: (t) => { + var e, r, n; return { - position: Fs.ios ? "absolute" : ((n = r.find((l) => l.position)) === null || n === void 0 ? void 0 : n.position) || "fixed", - parent: ((s = r.find((l) => l.parent)) === null || s === void 0 ? void 0 : s.parent) || null, - tooltipSpace: ((a = r.find((l) => l.tooltipSpace)) === null || a === void 0 ? void 0 : a.tooltipSpace) || Q4n + position: Mt.ios ? "absolute" : ((e = t.find((i) => i.position)) === null || e === void 0 ? void 0 : e.position) || "fixed", + parent: ((r = t.find((i) => i.parent)) === null || r === void 0 ? void 0 : r.parent) || null, + tooltipSpace: ((n = t.find((i) => i.tooltipSpace)) === null || n === void 0 ? void 0 : n.tooltipSpace) || mwe }; } -}), uCt = /* @__PURE__ */ new WeakMap(), dze = /* @__PURE__ */ Zu.fromClass(class { - constructor(r) { - this.view = r, this.above = [], this.inView = !0, this.madeAbsolute = !1, this.lastTransaction = 0, this.measureTimeout = -1; - let n = r.state.facet(xRe); - this.position = n.position, this.parent = n.parent, this.classes = r.themeClasses, this.createContainer(), this.measureReq = { read: this.readMeasure.bind(this), write: this.writeMeasure.bind(this), key: this }, this.manager = new XMt(r, pze, (s) => this.createTooltip(s)), this.intersectionObserver = typeof IntersectionObserver == "function" ? new IntersectionObserver((s) => { - Date.now() > this.lastTransaction - 50 && s.length > 0 && s[s.length - 1].intersectionRatio < 1 && this.measureSoon(); - }, { threshold: [1] }) : null, this.observeIntersection(), r.win.addEventListener("resize", this.measureSoon = this.measureSoon.bind(this)), this.maybeMeasure(); +}), FB = /* @__PURE__ */ new WeakMap(), FR = /* @__PURE__ */ an.fromClass(class { + constructor(t) { + this.view = t, this.above = [], this.inView = !0, this.madeAbsolute = !1, this.lastTransaction = 0, this.measureTimeout = -1; + let e = t.state.facet(yE); + this.position = e.position, this.parent = e.parent, this.classes = t.themeClasses, this.createContainer(), this.measureReq = { read: this.readMeasure.bind(this), write: this.writeMeasure.bind(this), key: this }, this.manager = new uK(t, zR, (r) => this.createTooltip(r)), this.intersectionObserver = typeof IntersectionObserver == "function" ? new IntersectionObserver((r) => { + Date.now() > this.lastTransaction - 50 && r.length > 0 && r[r.length - 1].intersectionRatio < 1 && this.measureSoon(); + }, { threshold: [1] }) : null, this.observeIntersection(), t.win.addEventListener("resize", this.measureSoon = this.measureSoon.bind(this)), this.maybeMeasure(); } createContainer() { this.parent ? (this.container = document.createElement("div"), this.container.style.position = "relative", this.container.className = this.view.themeClasses, this.parent.appendChild(this.container)) : this.container = this.view.dom; @@ -9410,8 +9419,8 @@ const xRe = /* @__PURE__ */ us.define({ observeIntersection() { if (this.intersectionObserver) { this.intersectionObserver.disconnect(); - for (let r of this.manager.tooltipViews) - this.intersectionObserver.observe(r.dom); + for (let t of this.manager.tooltipViews) + this.intersectionObserver.observe(t.dom); } } measureSoon() { @@ -9419,112 +9428,112 @@ const xRe = /* @__PURE__ */ us.define({ this.measureTimeout = -1, this.maybeMeasure(); }, 50)); } - update(r) { - r.transactions.length && (this.lastTransaction = Date.now()); - let n = this.manager.update(r, this.above); - n && this.observeIntersection(); - let s = n || r.geometryChanged, a = r.state.facet(xRe); - if (a.position != this.position && !this.madeAbsolute) { - this.position = a.position; - for (let l of this.manager.tooltipViews) - l.dom.style.position = this.position; - s = !0; - } - if (a.parent != this.parent) { - this.parent && this.container.remove(), this.parent = a.parent, this.createContainer(); - for (let l of this.manager.tooltipViews) - this.container.appendChild(l.dom); - s = !0; + update(t) { + t.transactions.length && (this.lastTransaction = Date.now()); + let e = this.manager.update(t, this.above); + e && this.observeIntersection(); + let r = e || t.geometryChanged, n = t.state.facet(yE); + if (n.position != this.position && !this.madeAbsolute) { + this.position = n.position; + for (let i of this.manager.tooltipViews) + i.dom.style.position = this.position; + r = !0; + } + if (n.parent != this.parent) { + this.parent && this.container.remove(), this.parent = n.parent, this.createContainer(); + for (let i of this.manager.tooltipViews) + this.container.appendChild(i.dom); + r = !0; } else this.parent && this.view.themeClasses != this.classes && (this.classes = this.container.className = this.view.themeClasses); - s && this.maybeMeasure(); + r && this.maybeMeasure(); } - createTooltip(r) { - let n = r.create(this.view); - if (n.dom.classList.add("cm-tooltip"), r.arrow && !n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")) { - let s = document.createElement("div"); - s.className = "cm-tooltip-arrow", n.dom.appendChild(s); + createTooltip(t) { + let e = t.create(this.view); + if (e.dom.classList.add("cm-tooltip"), t.arrow && !e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")) { + let r = document.createElement("div"); + r.className = "cm-tooltip-arrow", e.dom.appendChild(r); } - return n.dom.style.position = this.position, n.dom.style.top = ZZ, n.dom.style.left = "0px", this.container.appendChild(n.dom), n.mount && n.mount(this.view), n; + return e.dom.style.position = this.position, e.dom.style.top = _m, e.dom.style.left = "0px", this.container.appendChild(e.dom), e.mount && e.mount(this.view), e; } destroy() { - var r, n; + var t, e; this.view.win.removeEventListener("resize", this.measureSoon); - for (let s of this.manager.tooltipViews) - s.dom.remove(), (r = s.destroy) === null || r === void 0 || r.call(s); - this.parent && this.container.remove(), (n = this.intersectionObserver) === null || n === void 0 || n.disconnect(), clearTimeout(this.measureTimeout); + for (let r of this.manager.tooltipViews) + r.dom.remove(), (t = r.destroy) === null || t === void 0 || t.call(r); + this.parent && this.container.remove(), (e = this.intersectionObserver) === null || e === void 0 || e.disconnect(), clearTimeout(this.measureTimeout); } readMeasure() { - let r = this.view.dom.getBoundingClientRect(), n = 1, s = 1, a = !1; + let t = this.view.dom.getBoundingClientRect(), e = 1, r = 1, n = !1; if (this.position == "fixed" && this.manager.tooltipViews.length) { - let { dom: l } = this.manager.tooltipViews[0]; - if (Fs.gecko) - a = l.offsetParent != this.container.ownerDocument.body; - else if (l.style.top == ZZ && l.style.left == "0px") { - let h = l.getBoundingClientRect(); - a = Math.abs(h.top + 1e4) > 1 || Math.abs(h.left) > 1; + let { dom: i } = this.manager.tooltipViews[0]; + if (Mt.gecko) + n = i.offsetParent != this.container.ownerDocument.body; + else if (i.style.top == _m && i.style.left == "0px") { + let s = i.getBoundingClientRect(); + n = Math.abs(s.top + 1e4) > 1 || Math.abs(s.left) > 1; } } - if (a || this.position == "absolute") + if (n || this.position == "absolute") if (this.parent) { - let l = this.parent.getBoundingClientRect(); - l.width && l.height && (n = l.width / this.parent.offsetWidth, s = l.height / this.parent.offsetHeight); + let i = this.parent.getBoundingClientRect(); + i.width && i.height && (e = i.width / this.parent.offsetWidth, r = i.height / this.parent.offsetHeight); } else - ({ scaleX: n, scaleY: s } = this.view.viewState); + ({ scaleX: e, scaleY: r } = this.view.viewState); return { - editor: r, - parent: this.parent ? this.container.getBoundingClientRect() : r, - pos: this.manager.tooltips.map((l, h) => { - let f = this.manager.tooltipViews[h]; - return f.getCoords ? f.getCoords(l.pos) : this.view.coordsAtPos(l.pos); + editor: t, + parent: this.parent ? this.container.getBoundingClientRect() : t, + pos: this.manager.tooltips.map((i, s) => { + let a = this.manager.tooltipViews[s]; + return a.getCoords ? a.getCoords(i.pos) : this.view.coordsAtPos(i.pos); }), - size: this.manager.tooltipViews.map(({ dom: l }) => l.getBoundingClientRect()), - space: this.view.state.facet(xRe).tooltipSpace(this.view), - scaleX: n, - scaleY: s, - makeAbsolute: a + size: this.manager.tooltipViews.map(({ dom: i }) => i.getBoundingClientRect()), + space: this.view.state.facet(yE).tooltipSpace(this.view), + scaleX: e, + scaleY: r, + makeAbsolute: n }; } - writeMeasure(r) { - var n; - if (r.makeAbsolute) { + writeMeasure(t) { + var e; + if (t.makeAbsolute) { this.madeAbsolute = !0, this.position = "absolute"; - for (let b of this.manager.tooltipViews) - b.dom.style.position = "absolute"; - } - let { editor: s, space: a, scaleX: l, scaleY: h } = r, f = []; - for (let b = 0; b < this.manager.tooltips.length; b++) { - let w = this.manager.tooltips[b], O = this.manager.tooltipViews[b], { dom: S } = O, E = r.pos[b], D = r.size[b]; - if (!E || E.bottom <= Math.max(s.top, a.top) || E.top >= Math.min(s.bottom, a.bottom) || E.right < Math.max(s.left, a.left) - 0.1 || E.left > Math.min(s.right, a.right) + 0.1) { - S.style.top = ZZ; + for (let o of this.manager.tooltipViews) + o.dom.style.position = "absolute"; + } + let { editor: r, space: n, scaleX: i, scaleY: s } = t, a = []; + for (let o = 0; o < this.manager.tooltips.length; o++) { + let l = this.manager.tooltips[o], u = this.manager.tooltipViews[o], { dom: h } = u, f = t.pos[o], d = t.size[o]; + if (!f || f.bottom <= Math.max(r.top, n.top) || f.top >= Math.min(r.bottom, n.bottom) || f.right < Math.max(r.left, n.left) - 0.1 || f.left > Math.min(r.right, n.right) + 0.1) { + h.style.top = _m; continue; } - let M = w.arrow ? O.dom.querySelector(".cm-tooltip-arrow") : null, B = M ? 7 : 0, z = D.right - D.left, W = (n = uCt.get(O)) !== null && n !== void 0 ? n : D.bottom - D.top, H = O.offset || q4n, G = this.view.textDirection == Cf.LTR, ee = D.width > a.right - a.left ? G ? a.left : a.right - D.width : G ? Math.min(E.left - (M ? 14 : 0) + H.x, a.right - z) : Math.max(a.left, E.left - z + (M ? 14 : 0) - H.x), le = this.above[b]; - !w.strictSide && (le ? E.top - (D.bottom - D.top) - H.y < a.top : E.bottom + (D.bottom - D.top) + H.y > a.bottom) && le == a.bottom - E.bottom > E.top - a.top && (le = this.above[b] = !le); - let se = (le ? E.top - a.top : a.bottom - E.bottom) - B; - if (se < W && O.resize !== !1) { - if (se < this.view.defaultLineHeight) { - S.style.top = ZZ; + let p = l.arrow ? u.dom.querySelector(".cm-tooltip-arrow") : null, g = p ? 7 : 0, m = d.right - d.left, v = (e = FB.get(u)) !== null && e !== void 0 ? e : d.bottom - d.top, y = u.offset || ywe, b = this.view.textDirection == Nn.LTR, w = d.width > n.right - n.left ? b ? n.left : n.right - d.width : b ? Math.min(f.left - (p ? 14 : 0) + y.x, n.right - m) : Math.max(n.left, f.left - m + (p ? 14 : 0) - y.x), O = this.above[o]; + !l.strictSide && (O ? f.top - (d.bottom - d.top) - y.y < n.top : f.bottom + (d.bottom - d.top) + y.y > n.bottom) && O == n.bottom - f.bottom > f.top - n.top && (O = this.above[o] = !O); + let S = (O ? f.top - n.top : n.bottom - f.bottom) - g; + if (S < v && u.resize !== !1) { + if (S < this.view.defaultLineHeight) { + h.style.top = _m; continue; } - uCt.set(O, W), S.style.height = (W = se) / h + "px"; + FB.set(u, v), h.style.height = (v = S) / s + "px"; } else - S.style.height && (S.style.height = ""); - let he = le ? E.top - W - B - H.y : E.bottom + B + H.y, te = ee + z; - if (O.overlap !== !0) - for (let be of f) - be.left < te && be.right > ee && be.top < he + W && be.bottom > he && (he = le ? be.top - W - 2 - B : be.bottom + B + 2); - if (this.position == "absolute" ? (S.style.top = (he - r.parent.top) / h + "px", S.style.left = (ee - r.parent.left) / l + "px") : (S.style.top = he / h + "px", S.style.left = ee / l + "px"), M) { - let be = E.left + (G ? H.x : -H.x) - (ee + 14 - 7); - M.style.left = be / l + "px"; + h.style.height && (h.style.height = ""); + let C = O ? f.top - v - g - y.y : f.bottom + g + y.y, T = w + m; + if (u.overlap !== !0) + for (let A of a) + A.left < T && A.right > w && A.top < C + v && A.bottom > C && (C = O ? A.top - v - 2 - g : A.bottom + g + 2); + if (this.position == "absolute" ? (h.style.top = (C - t.parent.top) / s + "px", h.style.left = (w - t.parent.left) / i + "px") : (h.style.top = C / s + "px", h.style.left = w / i + "px"), p) { + let A = f.left + (b ? y.x : -y.x) - (w + 14 - 7); + p.style.left = A / i + "px"; } - O.overlap !== !0 && f.push({ left: ee, top: he, right: te, bottom: he + W }), S.classList.toggle("cm-tooltip-above", le), S.classList.toggle("cm-tooltip-below", !le), O.positioned && O.positioned(r.space); + u.overlap !== !0 && a.push({ left: w, top: C, right: T, bottom: C + v }), h.classList.toggle("cm-tooltip-above", O), h.classList.toggle("cm-tooltip-below", !O), u.positioned && u.positioned(t.space); } } maybeMeasure() { if (this.manager.tooltips.length && (this.view.inView && this.view.requestMeasure(this.measureReq), this.inView != this.view.inView && (this.inView = this.view.inView, !this.inView))) - for (let r of this.manager.tooltipViews) - r.dom.style.top = ZZ; + for (let t of this.manager.tooltipViews) + t.dom.style.top = _m; } }, { eventObservers: { @@ -9532,7 +9541,7 @@ const xRe = /* @__PURE__ */ us.define({ this.maybeMeasure(); } } -}), z4n = /* @__PURE__ */ Ci.baseTheme({ +}), vwe = /* @__PURE__ */ dt.baseTheme({ ".cm-tooltip": { zIndex: 100, boxSizing: "border-box" @@ -9593,49 +9602,49 @@ const xRe = /* @__PURE__ */ us.define({ borderBottomColor: "transparent" } } -}), q4n = { x: 0, y: 0 }, pze = /* @__PURE__ */ us.define({ - enables: [dze, z4n] -}), Ube = /* @__PURE__ */ us.define(); -class Z2e { - static create(n) { - return new Z2e(n); +}), ywe = { x: 0, y: 0 }, zR = /* @__PURE__ */ _t.define({ + enables: [FR, vwe] +}), w5 = /* @__PURE__ */ _t.define(); +class IS { + static create(e) { + return new IS(e); } - constructor(n) { - this.view = n, this.mounted = !1, this.dom = document.createElement("div"), this.dom.classList.add("cm-tooltip-hover"), this.manager = new XMt(n, Ube, (s) => this.createHostedView(s)); + constructor(e) { + this.view = e, this.mounted = !1, this.dom = document.createElement("div"), this.dom.classList.add("cm-tooltip-hover"), this.manager = new uK(e, w5, (r) => this.createHostedView(r)); } - createHostedView(n) { - let s = n.create(this.view); - return s.dom.classList.add("cm-tooltip-section"), this.dom.appendChild(s.dom), this.mounted && s.mount && s.mount(this.view), s; + createHostedView(e) { + let r = e.create(this.view); + return r.dom.classList.add("cm-tooltip-section"), this.dom.appendChild(r.dom), this.mounted && r.mount && r.mount(this.view), r; } - mount(n) { - for (let s of this.manager.tooltipViews) - s.mount && s.mount(n); + mount(e) { + for (let r of this.manager.tooltipViews) + r.mount && r.mount(e); this.mounted = !0; } - positioned(n) { - for (let s of this.manager.tooltipViews) - s.positioned && s.positioned(n); + positioned(e) { + for (let r of this.manager.tooltipViews) + r.positioned && r.positioned(e); } - update(n) { - this.manager.update(n); + update(e) { + this.manager.update(e); } destroy() { - var n; - for (let s of this.manager.tooltipViews) - (n = s.destroy) === null || n === void 0 || n.call(s); - } - passProp(n) { - let s; - for (let a of this.manager.tooltipViews) { - let l = a[n]; - if (l !== void 0) { - if (s === void 0) - s = l; - else if (s !== l) + var e; + for (let r of this.manager.tooltipViews) + (e = r.destroy) === null || e === void 0 || e.call(r); + } + passProp(e) { + let r; + for (let n of this.manager.tooltipViews) { + let i = n[e]; + if (i !== void 0) { + if (r === void 0) + r = i; + else if (r !== i) return; } } - return s; + return r; } get offset() { return this.passProp("offset"); @@ -9650,22 +9659,22 @@ class Z2e { return this.passProp("resize"); } } -const V4n = /* @__PURE__ */ pze.compute([Ube], (r) => { - let n = r.facet(Ube).filter((s) => s); - return n.length === 0 ? null : { - pos: Math.min(...n.map((s) => s.pos)), - end: Math.max(...n.map((s) => { - var a; - return (a = s.end) !== null && a !== void 0 ? a : s.pos; +const bwe = /* @__PURE__ */ zR.compute([w5], (t) => { + let e = t.facet(w5).filter((r) => r); + return e.length === 0 ? null : { + pos: Math.min(...e.map((r) => r.pos)), + end: Math.max(...e.map((r) => { + var n; + return (n = r.end) !== null && n !== void 0 ? n : r.pos; })), - create: Z2e.create, - above: n[0].above, - arrow: n.some((s) => s.arrow) + create: IS.create, + above: e[0].above, + arrow: e.some((r) => r.arrow) }; }); -class U4n { - constructor(n, s, a, l, h) { - this.view = n, this.source = s, this.field = a, this.setHover = l, this.hoverTime = h, this.hoverTimeout = -1, this.restartTimeout = -1, this.pending = null, this.lastMove = { x: 0, y: 0, target: n.dom, time: 0 }, this.checkHover = this.checkHover.bind(this), n.dom.addEventListener("mouseleave", this.mouseleave = this.mouseleave.bind(this)), n.dom.addEventListener("mousemove", this.mousemove = this.mousemove.bind(this)); +class xwe { + constructor(e, r, n, i, s) { + this.view = e, this.source = r, this.field = n, this.setHover = i, this.hoverTime = s, this.hoverTimeout = -1, this.restartTimeout = -1, this.pending = null, this.lastMove = { x: 0, y: 0, target: e.dom, time: 0 }, this.checkHover = this.checkHover.bind(this), e.dom.addEventListener("mouseleave", this.mouseleave = this.mouseleave.bind(this)), e.dom.addEventListener("mousemove", this.mousemove = this.mousemove.bind(this)); } update() { this.pending && (this.pending = null, clearTimeout(this.restartTimeout), this.restartTimeout = setTimeout(() => this.startHover(), 20)); @@ -9676,166 +9685,166 @@ class U4n { checkHover() { if (this.hoverTimeout = -1, this.active) return; - let n = Date.now() - this.lastMove.time; - n < this.hoverTime ? this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime - n) : this.startHover(); + let e = Date.now() - this.lastMove.time; + e < this.hoverTime ? this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime - e) : this.startHover(); } startHover() { clearTimeout(this.restartTimeout); - let { view: n, lastMove: s } = this, a = n.docView.nearest(s.target); - if (!a) + let { view: e, lastMove: r } = this, n = e.docView.nearest(r.target); + if (!n) return; - let l, h = 1; - if (a instanceof ZT) - l = a.posAtStart; + let i, s = 1; + if (n instanceof Nh) + i = n.posAtStart; else { - if (l = n.posAtCoords(s), l == null) + if (i = e.posAtCoords(r), i == null) return; - let b = n.coordsAtPos(l); - if (!b || s.y < b.top || s.y > b.bottom || s.x < b.left - n.defaultCharacterWidth || s.x > b.right + n.defaultCharacterWidth) + let o = e.coordsAtPos(i); + if (!o || r.y < o.top || r.y > o.bottom || r.x < o.left - e.defaultCharacterWidth || r.x > o.right + e.defaultCharacterWidth) return; - let w = n.bidiSpans(n.state.doc.lineAt(l)).find((S) => S.from <= l && S.to >= l), O = w && w.dir == Cf.RTL ? -1 : 1; - h = s.x < b.left ? -O : O; - } - let f = this.source(n, l, h); - if (f != null && f.then) { - let b = this.pending = { pos: l }; - f.then((w) => { - this.pending == b && (this.pending = null, w && n.dispatch({ effects: this.setHover.of(w) })); - }, (w) => Yy(n.state, w, "hover tooltip")); + let l = e.bidiSpans(e.state.doc.lineAt(i)).find((h) => h.from <= i && h.to >= i), u = l && l.dir == Nn.RTL ? -1 : 1; + s = r.x < o.left ? -u : u; + } + let a = this.source(e, i, s); + if (a != null && a.then) { + let o = this.pending = { pos: i }; + a.then((l) => { + this.pending == o && (this.pending = null, l && e.dispatch({ effects: this.setHover.of(l) })); + }, (l) => Bo(e.state, l, "hover tooltip")); } else - f && n.dispatch({ effects: this.setHover.of(f) }); + a && e.dispatch({ effects: this.setHover.of(a) }); } get tooltip() { - let n = this.view.plugin(dze), s = n ? n.manager.tooltips.findIndex((a) => a.create == Z2e.create) : -1; - return s > -1 ? n.manager.tooltipViews[s] : null; + let e = this.view.plugin(FR), r = e ? e.manager.tooltips.findIndex((n) => n.create == IS.create) : -1; + return r > -1 ? e.manager.tooltipViews[r] : null; } - mousemove(n) { - var s; - this.lastMove = { x: n.clientX, y: n.clientY, target: n.target, time: Date.now() }, this.hoverTimeout < 0 && (this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime)); - let { active: a, tooltip: l } = this; - if (a && l && !W4n(l.dom, n) || this.pending) { - let { pos: h } = a || this.pending, f = (s = a == null ? void 0 : a.end) !== null && s !== void 0 ? s : h; - (h == f ? this.view.posAtCoords(this.lastMove) != h : !Y4n(this.view, h, f, n.clientX, n.clientY)) && (this.view.dispatch({ effects: this.setHover.of(null) }), this.pending = null); + mousemove(e) { + var r; + this.lastMove = { x: e.clientX, y: e.clientY, target: e.target, time: Date.now() }, this.hoverTimeout < 0 && (this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime)); + let { active: n, tooltip: i } = this; + if (n && i && !wwe(i.dom, e) || this.pending) { + let { pos: s } = n || this.pending, a = (r = n == null ? void 0 : n.end) !== null && r !== void 0 ? r : s; + (s == a ? this.view.posAtCoords(this.lastMove) != s : !Owe(this.view, s, a, e.clientX, e.clientY)) && (this.view.dispatch({ effects: this.setHover.of(null) }), this.pending = null); } } - mouseleave(n) { + mouseleave(e) { clearTimeout(this.hoverTimeout), this.hoverTimeout = -1; - let { active: s } = this; - if (s) { - let { tooltip: a } = this; - a && a.dom.contains(n.relatedTarget) ? this.watchTooltipLeave(a.dom) : this.view.dispatch({ effects: this.setHover.of(null) }); + let { active: r } = this; + if (r) { + let { tooltip: n } = this; + n && n.dom.contains(e.relatedTarget) ? this.watchTooltipLeave(n.dom) : this.view.dispatch({ effects: this.setHover.of(null) }); } } - watchTooltipLeave(n) { - let s = (a) => { - n.removeEventListener("mouseleave", s), this.active && !this.view.dom.contains(a.relatedTarget) && this.view.dispatch({ effects: this.setHover.of(null) }); + watchTooltipLeave(e) { + let r = (n) => { + e.removeEventListener("mouseleave", r), this.active && !this.view.dom.contains(n.relatedTarget) && this.view.dispatch({ effects: this.setHover.of(null) }); }; - n.addEventListener("mouseleave", s); + e.addEventListener("mouseleave", r); } destroy() { clearTimeout(this.hoverTimeout), this.view.dom.removeEventListener("mouseleave", this.mouseleave), this.view.dom.removeEventListener("mousemove", this.mousemove); } } -const Uge = 4; -function W4n(r, n) { - let s = r.getBoundingClientRect(); - return n.clientX >= s.left - Uge && n.clientX <= s.right + Uge && n.clientY >= s.top - Uge && n.clientY <= s.bottom + Uge; +const bw = 4; +function wwe(t, e) { + let r = t.getBoundingClientRect(); + return e.clientX >= r.left - bw && e.clientX <= r.right + bw && e.clientY >= r.top - bw && e.clientY <= r.bottom + bw; } -function Y4n(r, n, s, a, l, h) { - let f = r.scrollDOM.getBoundingClientRect(), b = r.documentTop + r.documentPadding.top + r.contentHeight; - if (f.left > a || f.right < a || f.top > l || Math.min(f.bottom, b) < l) +function Owe(t, e, r, n, i, s) { + let a = t.scrollDOM.getBoundingClientRect(), o = t.documentTop + t.documentPadding.top + t.contentHeight; + if (a.left > n || a.right < n || a.top > i || Math.min(a.bottom, o) < i) return !1; - let w = r.posAtCoords({ x: a, y: l }, !1); - return w >= n && w <= s; + let l = t.posAtCoords({ x: n, y: i }, !1); + return l >= e && l <= r; } -function H4n(r, n = {}) { - let s = $o.define(), a = Ef.define({ +function kwe(t, e = {}) { + let r = Zt.define(), n = Pn.define({ create() { return null; }, - update(l, h) { - if (l && (n.hideOnChange && (h.docChanged || h.selection) || n.hideOn && n.hideOn(h, l))) + update(i, s) { + if (i && (e.hideOnChange && (s.docChanged || s.selection) || e.hideOn && e.hideOn(s, i))) return null; - if (l && h.docChanged) { - let f = h.changes.mapPos(l.pos, -1, c0.TrackDel); - if (f == null) + if (i && s.docChanged) { + let a = s.changes.mapPos(i.pos, -1, Si.TrackDel); + if (a == null) return null; - let b = Object.assign(/* @__PURE__ */ Object.create(null), l); - b.pos = f, l.end != null && (b.end = h.changes.mapPos(l.end)), l = b; + let o = Object.assign(/* @__PURE__ */ Object.create(null), i); + o.pos = a, i.end != null && (o.end = s.changes.mapPos(i.end)), i = o; } - for (let f of h.effects) - f.is(s) && (l = f.value), f.is(G4n) && (l = null); - return l; + for (let a of s.effects) + a.is(r) && (i = a.value), a.is(Swe) && (i = null); + return i; }, - provide: (l) => Ube.from(l) + provide: (i) => w5.from(i) }); return [ - a, - Zu.define((l) => new U4n(l, r, a, s, n.hoverTime || 300)), - V4n + n, + an.define((i) => new xwe(i, t, n, r, e.hoverTime || 300)), + bwe ]; } -function KMt(r, n) { - let s = r.plugin(dze); - if (!s) +function hK(t, e) { + let r = t.plugin(FR); + if (!r) return null; - let a = s.manager.tooltips.indexOf(n); - return a < 0 ? null : s.manager.tooltipViews[a]; + let n = r.manager.tooltips.indexOf(e); + return n < 0 ? null : r.manager.tooltipViews[n]; } -const G4n = /* @__PURE__ */ $o.define(), hCt = /* @__PURE__ */ us.define({ - combine(r) { - let n, s; - for (let a of r) - n = n || a.topContainer, s = s || a.bottomContainer; - return { topContainer: n, bottomContainer: s }; +const Swe = /* @__PURE__ */ Zt.define(), zB = /* @__PURE__ */ _t.define({ + combine(t) { + let e, r; + for (let n of t) + e = e || n.topContainer, r = r || n.bottomContainer; + return { topContainer: e, bottomContainer: r }; } }); -function bK(r, n) { - let s = r.plugin(JMt), a = s ? s.specs.indexOf(n) : -1; - return a > -1 ? s.panels[a] : null; -} -const JMt = /* @__PURE__ */ Zu.fromClass(class { - constructor(r) { - this.input = r.state.facet(vK), this.specs = this.input.filter((s) => s), this.panels = this.specs.map((s) => s(r)); - let n = r.state.facet(hCt); - this.top = new Wge(r, !0, n.topContainer), this.bottom = new Wge(r, !1, n.bottomContainer), this.top.sync(this.panels.filter((s) => s.top)), this.bottom.sync(this.panels.filter((s) => !s.top)); - for (let s of this.panels) - s.dom.classList.add("cm-panel"), s.mount && s.mount(); - } - update(r) { - let n = r.state.facet(hCt); - this.top.container != n.topContainer && (this.top.sync([]), this.top = new Wge(r.view, !0, n.topContainer)), this.bottom.container != n.bottomContainer && (this.bottom.sync([]), this.bottom = new Wge(r.view, !1, n.bottomContainer)), this.top.syncClasses(), this.bottom.syncClasses(); - let s = r.state.facet(vK); - if (s != this.input) { - let a = s.filter((w) => w), l = [], h = [], f = [], b = []; - for (let w of a) { - let O = this.specs.indexOf(w), S; - O < 0 ? (S = w(r.view), b.push(S)) : (S = this.panels[O], S.update && S.update(r)), l.push(S), (S.top ? h : f).push(S); - } - this.specs = a, this.panels = l, this.top.sync(h), this.bottom.sync(f); - for (let w of b) - w.dom.classList.add("cm-panel"), w.mount && w.mount(); +function Cy(t, e) { + let r = t.plugin(fK), n = r ? r.specs.indexOf(e) : -1; + return n > -1 ? r.panels[n] : null; +} +const fK = /* @__PURE__ */ an.fromClass(class { + constructor(t) { + this.input = t.state.facet(Ey), this.specs = this.input.filter((r) => r), this.panels = this.specs.map((r) => r(t)); + let e = t.state.facet(zB); + this.top = new xw(t, !0, e.topContainer), this.bottom = new xw(t, !1, e.bottomContainer), this.top.sync(this.panels.filter((r) => r.top)), this.bottom.sync(this.panels.filter((r) => !r.top)); + for (let r of this.panels) + r.dom.classList.add("cm-panel"), r.mount && r.mount(); + } + update(t) { + let e = t.state.facet(zB); + this.top.container != e.topContainer && (this.top.sync([]), this.top = new xw(t.view, !0, e.topContainer)), this.bottom.container != e.bottomContainer && (this.bottom.sync([]), this.bottom = new xw(t.view, !1, e.bottomContainer)), this.top.syncClasses(), this.bottom.syncClasses(); + let r = t.state.facet(Ey); + if (r != this.input) { + let n = r.filter((l) => l), i = [], s = [], a = [], o = []; + for (let l of n) { + let u = this.specs.indexOf(l), h; + u < 0 ? (h = l(t.view), o.push(h)) : (h = this.panels[u], h.update && h.update(t)), i.push(h), (h.top ? s : a).push(h); + } + this.specs = n, this.panels = i, this.top.sync(s), this.bottom.sync(a); + for (let l of o) + l.dom.classList.add("cm-panel"), l.mount && l.mount(); } else - for (let a of this.panels) - a.update && a.update(r); + for (let n of this.panels) + n.update && n.update(t); } destroy() { this.top.sync([]), this.bottom.sync([]); } }, { - provide: (r) => Ci.scrollMargins.of((n) => { - let s = n.plugin(r); - return s && { top: s.top.scrollMargin(), bottom: s.bottom.scrollMargin() }; + provide: (t) => dt.scrollMargins.of((e) => { + let r = e.plugin(t); + return r && { top: r.top.scrollMargin(), bottom: r.bottom.scrollMargin() }; }) }); -class Wge { - constructor(n, s, a) { - this.view = n, this.top = s, this.container = a, this.dom = void 0, this.classes = "", this.panels = [], this.syncClasses(); +class xw { + constructor(e, r, n) { + this.view = e, this.top = r, this.container = n, this.dom = void 0, this.classes = "", this.panels = [], this.syncClasses(); } - sync(n) { - for (let s of this.panels) - s.destroy && n.indexOf(s) < 0 && s.destroy(); - this.panels = n, this.syncDOM(); + sync(e) { + for (let r of this.panels) + r.destroy && e.indexOf(r) < 0 && r.destroy(); + this.panels = e, this.syncDOM(); } syncDOM() { if (this.panels.length == 0) { @@ -9844,400 +9853,400 @@ class Wge { } if (!this.dom) { this.dom = document.createElement("div"), this.dom.className = this.top ? "cm-panels cm-panels-top" : "cm-panels cm-panels-bottom", this.dom.style[this.top ? "top" : "bottom"] = "0"; - let s = this.container || this.view.dom; - s.insertBefore(this.dom, this.top ? s.firstChild : null); - } - let n = this.dom.firstChild; - for (let s of this.panels) - if (s.dom.parentNode == this.dom) { - for (; n != s.dom; ) - n = fCt(n); - n = n.nextSibling; + let r = this.container || this.view.dom; + r.insertBefore(this.dom, this.top ? r.firstChild : null); + } + let e = this.dom.firstChild; + for (let r of this.panels) + if (r.dom.parentNode == this.dom) { + for (; e != r.dom; ) + e = VB(e); + e = e.nextSibling; } else - this.dom.insertBefore(s.dom, n); - for (; n; ) - n = fCt(n); + this.dom.insertBefore(r.dom, e); + for (; e; ) + e = VB(e); } scrollMargin() { return !this.dom || this.container ? 0 : Math.max(0, this.top ? this.dom.getBoundingClientRect().bottom - Math.max(0, this.view.scrollDOM.getBoundingClientRect().top) : Math.min(innerHeight, this.view.scrollDOM.getBoundingClientRect().bottom) - this.dom.getBoundingClientRect().top); } syncClasses() { if (!(!this.container || this.classes == this.view.themeClasses)) { - for (let n of this.classes.split(" ")) - n && this.container.classList.remove(n); - for (let n of (this.classes = this.view.themeClasses).split(" ")) - n && this.container.classList.add(n); + for (let e of this.classes.split(" ")) + e && this.container.classList.remove(e); + for (let e of (this.classes = this.view.themeClasses).split(" ")) + e && this.container.classList.add(e); } } } -function fCt(r) { - let n = r.nextSibling; - return r.remove(), n; +function VB(t) { + let e = t.nextSibling; + return t.remove(), e; } -const vK = /* @__PURE__ */ us.define({ - enables: JMt +const Ey = /* @__PURE__ */ _t.define({ + enables: fK }); -class Xy extends iP { - compare(n) { - return this == n || this.constructor == n.constructor && this.eq(n); +class Uo extends Xd { + compare(e) { + return this == e || this.constructor == e.constructor && this.eq(e); } - eq(n) { + eq(e) { return !1; } - destroy(n) { + destroy(e) { } } -Xy.prototype.elementClass = ""; -Xy.prototype.toDOM = void 0; -Xy.prototype.mapMode = c0.TrackBefore; -Xy.prototype.startSide = Xy.prototype.endSide = -1; -Xy.prototype.point = !0; -const Xme = /* @__PURE__ */ us.define(), Z4n = { +Uo.prototype.elementClass = ""; +Uo.prototype.toDOM = void 0; +Uo.prototype.mapMode = Si.TrackBefore; +Uo.prototype.startSide = Uo.prototype.endSide = -1; +Uo.prototype.point = !0; +const l4 = /* @__PURE__ */ _t.define(), Twe = { class: "", renderEmptyElements: !1, elementStyle: "", - markers: () => cl.empty, + markers: () => Er.empty, lineMarker: () => null, widgetMarker: () => null, lineMarkerChange: null, initialSpacer: null, updateSpacer: null, domEventHandlers: {} -}, QX = /* @__PURE__ */ us.define(); -function X2e(r) { - return [ePt(), QX.of(Object.assign(Object.assign({}, Z4n), r))]; +}, Wv = /* @__PURE__ */ _t.define(); +function PS(t) { + return [dK(), Wv.of(Object.assign(Object.assign({}, Twe), t))]; } -const OFe = /* @__PURE__ */ us.define({ - combine: (r) => r.some((n) => n) +const u7 = /* @__PURE__ */ _t.define({ + combine: (t) => t.some((e) => e) }); -function ePt(r) { - let n = [ - X4n +function dK(t) { + let e = [ + Cwe ]; - return r && r.fixed === !1 && n.push(OFe.of(!0)), n; -} -const X4n = /* @__PURE__ */ Zu.fromClass(class { - constructor(r) { - this.view = r, this.prevViewport = r.viewport, this.dom = document.createElement("div"), this.dom.className = "cm-gutters", this.dom.setAttribute("aria-hidden", "true"), this.dom.style.minHeight = this.view.contentHeight / this.view.scaleY + "px", this.gutters = r.state.facet(QX).map((n) => new pCt(r, n)); - for (let n of this.gutters) - this.dom.appendChild(n.dom); - this.fixed = !r.state.facet(OFe), this.fixed && (this.dom.style.position = "sticky"), this.syncGutters(!1), r.scrollDOM.insertBefore(this.dom, r.contentDOM); - } - update(r) { - if (this.updateGutters(r)) { - let n = this.prevViewport, s = r.view.viewport, a = Math.min(n.to, s.to) - Math.max(n.from, s.from); - this.syncGutters(a < (s.to - s.from) * 0.8); - } - r.geometryChanged && (this.dom.style.minHeight = this.view.contentHeight + "px"), this.view.state.facet(OFe) != !this.fixed && (this.fixed = !this.fixed, this.dom.style.position = this.fixed ? "sticky" : ""), this.prevViewport = r.view.viewport; - } - syncGutters(r) { - let n = this.dom.nextSibling; - r && this.dom.remove(); - let s = cl.iter(this.view.state.facet(Xme), this.view.viewport.from), a = [], l = this.gutters.map((h) => new K4n(h, this.view.viewport, -this.view.documentPadding.top)); - for (let h of this.view.viewportLineBlocks) - if (a.length && (a = []), Array.isArray(h.type)) { - let f = !0; - for (let b of h.type) - if (b.type == Pm.Text && f) { - kFe(s, a, b.from); - for (let w of l) - w.line(this.view, b, a); - f = !1; - } else if (b.widget) - for (let w of l) - w.widget(this.view, b); - } else if (h.type == Pm.Text) { - kFe(s, a, h.from); - for (let f of l) - f.line(this.view, h, a); - } else if (h.widget) - for (let f of l) - f.widget(this.view, h); - for (let h of l) - h.finish(); - r && this.view.scrollDOM.insertBefore(this.dom, n); - } - updateGutters(r) { - let n = r.startState.facet(QX), s = r.state.facet(QX), a = r.docChanged || r.heightChanged || r.viewportChanged || !cl.eq(r.startState.facet(Xme), r.state.facet(Xme), r.view.viewport.from, r.view.viewport.to); - if (n == s) - for (let l of this.gutters) - l.update(r) && (a = !0); + return t && t.fixed === !1 && e.push(u7.of(!0)), e; +} +const Cwe = /* @__PURE__ */ an.fromClass(class { + constructor(t) { + this.view = t, this.prevViewport = t.viewport, this.dom = document.createElement("div"), this.dom.className = "cm-gutters", this.dom.setAttribute("aria-hidden", "true"), this.dom.style.minHeight = this.view.contentHeight / this.view.scaleY + "px", this.gutters = t.state.facet(Wv).map((e) => new qB(t, e)); + for (let e of this.gutters) + this.dom.appendChild(e.dom); + this.fixed = !t.state.facet(u7), this.fixed && (this.dom.style.position = "sticky"), this.syncGutters(!1), t.scrollDOM.insertBefore(this.dom, t.contentDOM); + } + update(t) { + if (this.updateGutters(t)) { + let e = this.prevViewport, r = t.view.viewport, n = Math.min(e.to, r.to) - Math.max(e.from, r.from); + this.syncGutters(n < (r.to - r.from) * 0.8); + } + t.geometryChanged && (this.dom.style.minHeight = this.view.contentHeight + "px"), this.view.state.facet(u7) != !this.fixed && (this.fixed = !this.fixed, this.dom.style.position = this.fixed ? "sticky" : ""), this.prevViewport = t.view.viewport; + } + syncGutters(t) { + let e = this.dom.nextSibling; + t && this.dom.remove(); + let r = Er.iter(this.view.state.facet(l4), this.view.viewport.from), n = [], i = this.gutters.map((s) => new Ewe(s, this.view.viewport, -this.view.documentPadding.top)); + for (let s of this.view.viewportLineBlocks) + if (n.length && (n = []), Array.isArray(s.type)) { + let a = !0; + for (let o of s.type) + if (o.type == ia.Text && a) { + h7(r, n, o.from); + for (let l of i) + l.line(this.view, o, n); + a = !1; + } else if (o.widget) + for (let l of i) + l.widget(this.view, o); + } else if (s.type == ia.Text) { + h7(r, n, s.from); + for (let a of i) + a.line(this.view, s, n); + } else if (s.widget) + for (let a of i) + a.widget(this.view, s); + for (let s of i) + s.finish(); + t && this.view.scrollDOM.insertBefore(this.dom, e); + } + updateGutters(t) { + let e = t.startState.facet(Wv), r = t.state.facet(Wv), n = t.docChanged || t.heightChanged || t.viewportChanged || !Er.eq(t.startState.facet(l4), t.state.facet(l4), t.view.viewport.from, t.view.viewport.to); + if (e == r) + for (let i of this.gutters) + i.update(t) && (n = !0); else { - a = !0; - let l = []; - for (let h of s) { - let f = n.indexOf(h); - f < 0 ? l.push(new pCt(this.view, h)) : (this.gutters[f].update(r), l.push(this.gutters[f])); - } - for (let h of this.gutters) - h.dom.remove(), l.indexOf(h) < 0 && h.destroy(); - for (let h of l) - this.dom.appendChild(h.dom); - this.gutters = l; + n = !0; + let i = []; + for (let s of r) { + let a = e.indexOf(s); + a < 0 ? i.push(new qB(this.view, s)) : (this.gutters[a].update(t), i.push(this.gutters[a])); + } + for (let s of this.gutters) + s.dom.remove(), i.indexOf(s) < 0 && s.destroy(); + for (let s of i) + this.dom.appendChild(s.dom); + this.gutters = i; } - return a; + return n; } destroy() { - for (let r of this.gutters) - r.destroy(); + for (let t of this.gutters) + t.destroy(); this.dom.remove(); } }, { - provide: (r) => Ci.scrollMargins.of((n) => { - let s = n.plugin(r); - return !s || s.gutters.length == 0 || !s.fixed ? null : n.textDirection == Cf.LTR ? { left: s.dom.offsetWidth * n.scaleX } : { right: s.dom.offsetWidth * n.scaleX }; + provide: (t) => dt.scrollMargins.of((e) => { + let r = e.plugin(t); + return !r || r.gutters.length == 0 || !r.fixed ? null : e.textDirection == Nn.LTR ? { left: r.dom.offsetWidth * e.scaleX } : { right: r.dom.offsetWidth * e.scaleX }; }) }); -function dCt(r) { - return Array.isArray(r) ? r : [r]; -} -function kFe(r, n, s) { - for (; r.value && r.from <= s; ) - r.from == s && n.push(r.value), r.next(); -} -class K4n { - constructor(n, s, a) { - this.gutter = n, this.height = a, this.i = 0, this.cursor = cl.iter(n.markers, s.from); - } - addElement(n, s, a) { - let { gutter: l } = this, h = (s.top - this.height) / n.scaleY, f = s.height / n.scaleY; - if (this.i == l.elements.length) { - let b = new tPt(n, f, h, a); - l.elements.push(b), l.dom.appendChild(b.dom); +function UB(t) { + return Array.isArray(t) ? t : [t]; +} +function h7(t, e, r) { + for (; t.value && t.from <= r; ) + t.from == r && e.push(t.value), t.next(); +} +class Ewe { + constructor(e, r, n) { + this.gutter = e, this.height = n, this.i = 0, this.cursor = Er.iter(e.markers, r.from); + } + addElement(e, r, n) { + let { gutter: i } = this, s = (r.top - this.height) / e.scaleY, a = r.height / e.scaleY; + if (this.i == i.elements.length) { + let o = new pK(e, a, s, n); + i.elements.push(o), i.dom.appendChild(o.dom); } else - l.elements[this.i].update(n, f, h, a); - this.height = s.bottom, this.i++; + i.elements[this.i].update(e, a, s, n); + this.height = r.bottom, this.i++; } - line(n, s, a) { - let l = []; - kFe(this.cursor, l, s.from), a.length && (l = l.concat(a)); - let h = this.gutter.config.lineMarker(n, s, l); - h && l.unshift(h); - let f = this.gutter; - l.length == 0 && !f.config.renderEmptyElements || this.addElement(n, s, l); + line(e, r, n) { + let i = []; + h7(this.cursor, i, r.from), n.length && (i = i.concat(n)); + let s = this.gutter.config.lineMarker(e, r, i); + s && i.unshift(s); + let a = this.gutter; + i.length == 0 && !a.config.renderEmptyElements || this.addElement(e, r, i); } - widget(n, s) { - let a = this.gutter.config.widgetMarker(n, s.widget, s); - a && this.addElement(n, s, [a]); + widget(e, r) { + let n = this.gutter.config.widgetMarker(e, r.widget, r); + n && this.addElement(e, r, [n]); } finish() { - let n = this.gutter; - for (; n.elements.length > this.i; ) { - let s = n.elements.pop(); - n.dom.removeChild(s.dom), s.destroy(); - } - } -} -class pCt { - constructor(n, s) { - this.view = n, this.config = s, this.elements = [], this.spacer = null, this.dom = document.createElement("div"), this.dom.className = "cm-gutter" + (this.config.class ? " " + this.config.class : ""); - for (let a in s.domEventHandlers) - this.dom.addEventListener(a, (l) => { - let h = l.target, f; - if (h != this.dom && this.dom.contains(h)) { - for (; h.parentNode != this.dom; ) - h = h.parentNode; - let w = h.getBoundingClientRect(); - f = (w.top + w.bottom) / 2; + let e = this.gutter; + for (; e.elements.length > this.i; ) { + let r = e.elements.pop(); + e.dom.removeChild(r.dom), r.destroy(); + } + } +} +class qB { + constructor(e, r) { + this.view = e, this.config = r, this.elements = [], this.spacer = null, this.dom = document.createElement("div"), this.dom.className = "cm-gutter" + (this.config.class ? " " + this.config.class : ""); + for (let n in r.domEventHandlers) + this.dom.addEventListener(n, (i) => { + let s = i.target, a; + if (s != this.dom && this.dom.contains(s)) { + for (; s.parentNode != this.dom; ) + s = s.parentNode; + let l = s.getBoundingClientRect(); + a = (l.top + l.bottom) / 2; } else - f = l.clientY; - let b = n.lineBlockAtHeight(f - n.documentTop); - s.domEventHandlers[a](n, b, l) && l.preventDefault(); + a = i.clientY; + let o = e.lineBlockAtHeight(a - e.documentTop); + r.domEventHandlers[n](e, o, i) && i.preventDefault(); }); - this.markers = dCt(s.markers(n)), s.initialSpacer && (this.spacer = new tPt(n, 0, 0, [s.initialSpacer(n)]), this.dom.appendChild(this.spacer.dom), this.spacer.dom.style.cssText += "visibility: hidden; pointer-events: none"); + this.markers = UB(r.markers(e)), r.initialSpacer && (this.spacer = new pK(e, 0, 0, [r.initialSpacer(e)]), this.dom.appendChild(this.spacer.dom), this.spacer.dom.style.cssText += "visibility: hidden; pointer-events: none"); } - update(n) { - let s = this.markers; - if (this.markers = dCt(this.config.markers(n.view)), this.spacer && this.config.updateSpacer) { - let l = this.config.updateSpacer(this.spacer.markers[0], n); - l != this.spacer.markers[0] && this.spacer.update(n.view, 0, 0, [l]); + update(e) { + let r = this.markers; + if (this.markers = UB(this.config.markers(e.view)), this.spacer && this.config.updateSpacer) { + let i = this.config.updateSpacer(this.spacer.markers[0], e); + i != this.spacer.markers[0] && this.spacer.update(e.view, 0, 0, [i]); } - let a = n.view.viewport; - return !cl.eq(this.markers, s, a.from, a.to) || (this.config.lineMarkerChange ? this.config.lineMarkerChange(n) : !1); + let n = e.view.viewport; + return !Er.eq(this.markers, r, n.from, n.to) || (this.config.lineMarkerChange ? this.config.lineMarkerChange(e) : !1); } destroy() { - for (let n of this.elements) - n.destroy(); + for (let e of this.elements) + e.destroy(); } } -class tPt { - constructor(n, s, a, l) { - this.height = -1, this.above = 0, this.markers = [], this.dom = document.createElement("div"), this.dom.className = "cm-gutterElement", this.update(n, s, a, l); +class pK { + constructor(e, r, n, i) { + this.height = -1, this.above = 0, this.markers = [], this.dom = document.createElement("div"), this.dom.className = "cm-gutterElement", this.update(e, r, n, i); } - update(n, s, a, l) { - this.height != s && (this.height = s, this.dom.style.height = s + "px"), this.above != a && (this.dom.style.marginTop = (this.above = a) ? a + "px" : ""), J4n(this.markers, l) || this.setMarkers(n, l); + update(e, r, n, i) { + this.height != r && (this.height = r, this.dom.style.height = r + "px"), this.above != n && (this.dom.style.marginTop = (this.above = n) ? n + "px" : ""), _we(this.markers, i) || this.setMarkers(e, i); } - setMarkers(n, s) { - let a = "cm-gutterElement", l = this.dom.firstChild; - for (let h = 0, f = 0; ; ) { - let b = f, w = h < s.length ? s[h++] : null, O = !1; - if (w) { - let S = w.elementClass; - S && (a += " " + S); - for (let E = f; E < this.markers.length; E++) - if (this.markers[E].compare(w)) { - b = E, O = !0; + setMarkers(e, r) { + let n = "cm-gutterElement", i = this.dom.firstChild; + for (let s = 0, a = 0; ; ) { + let o = a, l = s < r.length ? r[s++] : null, u = !1; + if (l) { + let h = l.elementClass; + h && (n += " " + h); + for (let f = a; f < this.markers.length; f++) + if (this.markers[f].compare(l)) { + o = f, u = !0; break; } } else - b = this.markers.length; - for (; f < b; ) { - let S = this.markers[f++]; - if (S.toDOM) { - S.destroy(l); - let E = l.nextSibling; - l.remove(), l = E; + o = this.markers.length; + for (; a < o; ) { + let h = this.markers[a++]; + if (h.toDOM) { + h.destroy(i); + let f = i.nextSibling; + i.remove(), i = f; } } - if (!w) + if (!l) break; - w.toDOM && (O ? l = l.nextSibling : this.dom.insertBefore(w.toDOM(n), l)), O && f++; + l.toDOM && (u ? i = i.nextSibling : this.dom.insertBefore(l.toDOM(e), i)), u && a++; } - this.dom.className = a, this.markers = s; + this.dom.className = n, this.markers = r; } destroy() { this.setMarkers(null, []); } } -function J4n(r, n) { - if (r.length != n.length) +function _we(t, e) { + if (t.length != e.length) return !1; - for (let s = 0; s < r.length; s++) - if (!r[s].compare(n[s])) + for (let r = 0; r < t.length; r++) + if (!t[r].compare(e[r])) return !1; return !0; } -const exn = /* @__PURE__ */ us.define(), mB = /* @__PURE__ */ us.define({ - combine(r) { - return px(r, { formatNumber: String, domEventHandlers: {} }, { - domEventHandlers(n, s) { - let a = Object.assign({}, n); - for (let l in s) { - let h = a[l], f = s[l]; - a[l] = h ? (b, w, O) => h(b, w, O) || f(b, w, O) : f; +const Awe = /* @__PURE__ */ _t.define(), Ap = /* @__PURE__ */ _t.define({ + combine(t) { + return qc(t, { formatNumber: String, domEventHandlers: {} }, { + domEventHandlers(e, r) { + let n = Object.assign({}, e); + for (let i in r) { + let s = n[i], a = r[i]; + n[i] = s ? (o, l, u) => s(o, l, u) || a(o, l, u) : a; } - return a; + return n; } }); } }); -class SRe extends Xy { - constructor(n) { - super(), this.number = n; +class bE extends Uo { + constructor(e) { + super(), this.number = e; } - eq(n) { - return this.number == n.number; + eq(e) { + return this.number == e.number; } toDOM() { return document.createTextNode(this.number); } } -function _Re(r, n) { - return r.state.facet(mB).formatNumber(n, r.state); +function xE(t, e) { + return t.state.facet(Ap).formatNumber(e, t.state); } -const txn = /* @__PURE__ */ QX.compute([mB], (r) => ({ +const Lwe = /* @__PURE__ */ Wv.compute([Ap], (t) => ({ class: "cm-lineNumbers", renderEmptyElements: !1, - markers(n) { - return n.state.facet(exn); + markers(e) { + return e.state.facet(Awe); }, - lineMarker(n, s, a) { - return a.some((l) => l.toDOM) ? null : new SRe(_Re(n, n.state.doc.lineAt(s.from).number)); + lineMarker(e, r, n) { + return n.some((i) => i.toDOM) ? null : new bE(xE(e, e.state.doc.lineAt(r.from).number)); }, widgetMarker: () => null, - lineMarkerChange: (n) => n.startState.facet(mB) != n.state.facet(mB), - initialSpacer(n) { - return new SRe(_Re(n, gCt(n.state.doc.lines))); + lineMarkerChange: (e) => e.startState.facet(Ap) != e.state.facet(Ap), + initialSpacer(e) { + return new bE(xE(e, QB(e.state.doc.lines))); }, - updateSpacer(n, s) { - let a = _Re(s.view, gCt(s.view.state.doc.lines)); - return a == n.number ? n : new SRe(a); + updateSpacer(e, r) { + let n = xE(r.view, QB(r.view.state.doc.lines)); + return n == e.number ? e : new bE(n); }, - domEventHandlers: r.facet(mB).domEventHandlers + domEventHandlers: t.facet(Ap).domEventHandlers })); -function nxn(r = {}) { +function Rwe(t = {}) { return [ - mB.of(r), - ePt(), - txn + Ap.of(t), + dK(), + Lwe ]; } -function gCt(r) { - let n = 9; - for (; n < r; ) - n = n * 10 + 9; - return n; +function QB(t) { + let e = 9; + for (; e < t; ) + e = e * 10 + 9; + return e; } -const rxn = /* @__PURE__ */ new class extends Xy { +const Mwe = /* @__PURE__ */ new class extends Uo { constructor() { super(...arguments), this.elementClass = "cm-activeLineGutter"; } -}(), ixn = /* @__PURE__ */ Xme.compute(["selection"], (r) => { - let n = [], s = -1; - for (let a of r.selection.ranges) { - let l = r.doc.lineAt(a.head).from; - l > s && (s = l, n.push(rxn.range(l))); +}(), Dwe = /* @__PURE__ */ l4.compute(["selection"], (t) => { + let e = [], r = -1; + for (let n of t.selection.ranges) { + let i = t.doc.lineAt(n.head).from; + i > r && (r = i, e.push(Mwe.range(i))); } - return cl.of(n); + return Er.of(e); }); -function sxn() { - return ixn; +function Nwe() { + return Dwe; } -const nPt = 1024; -let oxn = 0; -class zy { - constructor(n, s) { - this.from = n, this.to = s; +const gK = 1024; +let Iwe = 0; +class Ro { + constructor(e, r) { + this.from = e, this.to = r; } } -class Ia { - constructor(n = {}) { - this.id = oxn++, this.perNode = !!n.perNode, this.deserialize = n.deserialize || (() => { +class lr { + constructor(e = {}) { + this.id = Iwe++, this.perNode = !!e.perNode, this.deserialize = e.deserialize || (() => { throw new Error("This node type doesn't define a deserialize function"); }); } - add(n) { + add(e) { if (this.perNode) throw new RangeError("Can't add per-node props to node types"); - return typeof n != "function" && (n = f0.match(n)), (s) => { - let a = n(s); - return a === void 0 ? null : [this, a]; + return typeof e != "function" && (e = Li.match(e)), (r) => { + let n = e(r); + return n === void 0 ? null : [this, n]; }; } } -Ia.closedBy = new Ia({ deserialize: (r) => r.split(" ") }); -Ia.openedBy = new Ia({ deserialize: (r) => r.split(" ") }); -Ia.group = new Ia({ deserialize: (r) => r.split(" ") }); -Ia.contextHash = new Ia({ perNode: !0 }); -Ia.lookAhead = new Ia({ perNode: !0 }); -Ia.mounted = new Ia({ perNode: !0 }); -class wK { - constructor(n, s, a) { - this.tree = n, this.overlay = s, this.parser = a; +lr.closedBy = new lr({ deserialize: (t) => t.split(" ") }); +lr.openedBy = new lr({ deserialize: (t) => t.split(" ") }); +lr.group = new lr({ deserialize: (t) => t.split(" ") }); +lr.contextHash = new lr({ perNode: !0 }); +lr.lookAhead = new lr({ perNode: !0 }); +lr.mounted = new lr({ perNode: !0 }); +class _y { + constructor(e, r, n) { + this.tree = e, this.overlay = r, this.parser = n; } - static get(n) { - return n && n.props && n.props[Ia.mounted.id]; + static get(e) { + return e && e.props && e.props[lr.mounted.id]; } } -const axn = /* @__PURE__ */ Object.create(null); -class f0 { - constructor(n, s, a, l = 0) { - this.name = n, this.props = s, this.id = a, this.flags = l; +const Pwe = /* @__PURE__ */ Object.create(null); +class Li { + constructor(e, r, n, i = 0) { + this.name = e, this.props = r, this.id = n, this.flags = i; } - static define(n) { - let s = n.props && n.props.length ? /* @__PURE__ */ Object.create(null) : axn, a = (n.top ? 1 : 0) | (n.skipped ? 2 : 0) | (n.error ? 4 : 0) | (n.name == null ? 8 : 0), l = new f0(n.name || "", s, n.id, a); - if (n.props) { - for (let h of n.props) - if (Array.isArray(h) || (h = h(l)), h) { - if (h[0].perNode) + static define(e) { + let r = e.props && e.props.length ? /* @__PURE__ */ Object.create(null) : Pwe, n = (e.top ? 1 : 0) | (e.skipped ? 2 : 0) | (e.error ? 4 : 0) | (e.name == null ? 8 : 0), i = new Li(e.name || "", r, e.id, n); + if (e.props) { + for (let s of e.props) + if (Array.isArray(s) || (s = s(i)), s) { + if (s[0].perNode) throw new RangeError("Can't store a per-node prop on a node type"); - s[h[0].id] = h[1]; + r[s[0].id] = s[1]; } } - return l; + return i; } - prop(n) { - return this.props[n.id]; + prop(e) { + return this.props[e.id]; } get isTop() { return (this.flags & 1) > 0; @@ -10251,132 +10260,132 @@ class f0 { get isAnonymous() { return (this.flags & 8) > 0; } - is(n) { - if (typeof n == "string") { - if (this.name == n) + is(e) { + if (typeof e == "string") { + if (this.name == e) return !0; - let s = this.prop(Ia.group); - return s ? s.indexOf(n) > -1 : !1; - } - return this.id == n; - } - static match(n) { - let s = /* @__PURE__ */ Object.create(null); - for (let a in n) - for (let l of a.split(" ")) - s[l] = n[a]; - return (a) => { - for (let l = a.prop(Ia.group), h = -1; h < (l ? l.length : 0); h++) { - let f = s[h < 0 ? a.name : l[h]]; - if (f) - return f; + let r = this.prop(lr.group); + return r ? r.indexOf(e) > -1 : !1; + } + return this.id == e; + } + static match(e) { + let r = /* @__PURE__ */ Object.create(null); + for (let n in e) + for (let i of n.split(" ")) + r[i] = e[n]; + return (n) => { + for (let i = n.prop(lr.group), s = -1; s < (i ? i.length : 0); s++) { + let a = r[s < 0 ? n.name : i[s]]; + if (a) + return a; } }; } } -f0.none = new f0("", /* @__PURE__ */ Object.create(null), 0, 8); -class LJ { - constructor(n) { - this.types = n; - for (let s = 0; s < n.length; s++) - if (n[s].id != s) +Li.none = new Li("", /* @__PURE__ */ Object.create(null), 0, 8); +class Yb { + constructor(e) { + this.types = e; + for (let r = 0; r < e.length; r++) + if (e[r].id != r) throw new RangeError("Node type ids should correspond to array positions when creating a node set"); } - extend(...n) { - let s = []; - for (let a of this.types) { - let l = null; - for (let h of n) { - let f = h(a); - f && (l || (l = Object.assign({}, a.props)), l[f[0].id] = f[1]); + extend(...e) { + let r = []; + for (let n of this.types) { + let i = null; + for (let s of e) { + let a = s(n); + a && (i || (i = Object.assign({}, n.props)), i[a[0].id] = a[1]); } - s.push(l ? new f0(a.name, l, a.id, a.flags) : a); + r.push(i ? new Li(n.name, i, n.id, n.flags) : n); } - return new LJ(s); + return new Yb(r); } } -const Yge = /* @__PURE__ */ new WeakMap(), mCt = /* @__PURE__ */ new WeakMap(); -var fh; -(function(r) { - r[r.ExcludeBuffers = 1] = "ExcludeBuffers", r[r.IncludeAnonymous = 2] = "IncludeAnonymous", r[r.IgnoreMounts = 4] = "IgnoreMounts", r[r.IgnoreOverlays = 8] = "IgnoreOverlays"; -})(fh || (fh = {})); -class tu { - constructor(n, s, a, l, h) { - if (this.type = n, this.children = s, this.positions = a, this.length = l, this.props = null, h && h.length) { +const ww = /* @__PURE__ */ new WeakMap(), YB = /* @__PURE__ */ new WeakMap(); +var un; +(function(t) { + t[t.ExcludeBuffers = 1] = "ExcludeBuffers", t[t.IncludeAnonymous = 2] = "IncludeAnonymous", t[t.IgnoreMounts = 4] = "IgnoreMounts", t[t.IgnoreOverlays = 8] = "IgnoreOverlays"; +})(un || (un = {})); +class Yr { + constructor(e, r, n, i, s) { + if (this.type = e, this.children = r, this.positions = n, this.length = i, this.props = null, s && s.length) { this.props = /* @__PURE__ */ Object.create(null); - for (let [f, b] of h) - this.props[typeof f == "number" ? f : f.id] = b; + for (let [a, o] of s) + this.props[typeof a == "number" ? a : a.id] = o; } } toString() { - let n = wK.get(this); - if (n && !n.overlay) - return n.tree.toString(); - let s = ""; - for (let a of this.children) { - let l = a.toString(); - l && (s && (s += ","), s += l); + let e = _y.get(this); + if (e && !e.overlay) + return e.tree.toString(); + let r = ""; + for (let n of this.children) { + let i = n.toString(); + i && (r && (r += ","), r += i); } - return this.type.name ? (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (s.length ? "(" + s + ")" : "") : s; + return this.type.name ? (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (r.length ? "(" + r + ")" : "") : r; } - cursor(n = 0) { - return new Wbe(this.topNode, n); + cursor(e = 0) { + return new O5(this.topNode, e); } - cursorAt(n, s = 0, a = 0) { - let l = Yge.get(this) || this.topNode, h = new Wbe(l); - return h.moveTo(n, s), Yge.set(this, h._tree), h; + cursorAt(e, r = 0, n = 0) { + let i = ww.get(this) || this.topNode, s = new O5(i); + return s.moveTo(e, r), ww.set(this, s._tree), s; } get topNode() { - return new Cg(this, 0, 0, null); + return new $s(this, 0, 0, null); } - resolve(n, s = 0) { - let a = yK(Yge.get(this) || this.topNode, n, s, !1); - return Yge.set(this, a), a; + resolve(e, r = 0) { + let n = Ay(ww.get(this) || this.topNode, e, r, !1); + return ww.set(this, n), n; } - resolveInner(n, s = 0) { - let a = yK(mCt.get(this) || this.topNode, n, s, !0); - return mCt.set(this, a), a; + resolveInner(e, r = 0) { + let n = Ay(YB.get(this) || this.topNode, e, r, !0); + return YB.set(this, n), n; } - resolveStack(n, s = 0) { - return uxn(this, n, s); + resolveStack(e, r = 0) { + return Fwe(this, e, r); } - iterate(n) { - let { enter: s, leave: a, from: l = 0, to: h = this.length } = n, f = n.mode || 0, b = (f & fh.IncludeAnonymous) > 0; - for (let w = this.cursor(f | fh.IncludeAnonymous); ; ) { - let O = !1; - if (w.from <= h && w.to >= l && (!b && w.type.isAnonymous || s(w) !== !1)) { - if (w.firstChild()) + iterate(e) { + let { enter: r, leave: n, from: i = 0, to: s = this.length } = e, a = e.mode || 0, o = (a & un.IncludeAnonymous) > 0; + for (let l = this.cursor(a | un.IncludeAnonymous); ; ) { + let u = !1; + if (l.from <= s && l.to >= i && (!o && l.type.isAnonymous || r(l) !== !1)) { + if (l.firstChild()) continue; - O = !0; + u = !0; } - for (; O && a && (b || !w.type.isAnonymous) && a(w), !w.nextSibling(); ) { - if (!w.parent()) + for (; u && n && (o || !l.type.isAnonymous) && n(l), !l.nextSibling(); ) { + if (!l.parent()) return; - O = !0; + u = !0; } } } - prop(n) { - return n.perNode ? this.props ? this.props[n.id] : void 0 : this.type.prop(n); + prop(e) { + return e.perNode ? this.props ? this.props[e.id] : void 0 : this.type.prop(e); } get propValues() { - let n = []; + let e = []; if (this.props) - for (let s in this.props) - n.push([+s, this.props[s]]); - return n; + for (let r in this.props) + e.push([+r, this.props[r]]); + return e; } - balance(n = {}) { - return this.children.length <= 8 ? this : bze(f0.none, this.children, this.positions, 0, this.children.length, 0, this.length, (s, a, l) => new tu(this.type, s, a, l, this.propValues), n.makeTree || ((s, a, l) => new tu(f0.none, s, a, l))); + balance(e = {}) { + return this.children.length <= 8 ? this : qR(Li.none, this.children, this.positions, 0, this.children.length, 0, this.length, (r, n, i) => new Yr(this.type, r, n, i, this.propValues), e.makeTree || ((r, n, i) => new Yr(Li.none, r, n, i))); } - static build(n) { - return hxn(n); + static build(e) { + return zwe(e); } } -tu.empty = new tu(f0.none, [], [], 0); -class gze { - constructor(n, s) { - this.buffer = n, this.index = s; +Yr.empty = new Yr(Li.none, [], [], 0); +class VR { + constructor(e, r) { + this.buffer = e, this.index = r; } get id() { return this.buffer[this.index - 4]; @@ -10397,110 +10406,110 @@ class gze { this.index -= 4; } fork() { - return new gze(this.buffer, this.index); + return new VR(this.buffer, this.index); } } -class g8 { - constructor(n, s, a) { - this.buffer = n, this.length = s, this.set = a; +class of { + constructor(e, r, n) { + this.buffer = e, this.length = r, this.set = n; } get type() { - return f0.none; + return Li.none; } toString() { - let n = []; - for (let s = 0; s < this.buffer.length; ) - n.push(this.childString(s)), s = this.buffer[s + 3]; - return n.join(","); + let e = []; + for (let r = 0; r < this.buffer.length; ) + e.push(this.childString(r)), r = this.buffer[r + 3]; + return e.join(","); + } + childString(e) { + let r = this.buffer[e], n = this.buffer[e + 3], i = this.set.types[r], s = i.name; + if (/\W/.test(s) && !i.isError && (s = JSON.stringify(s)), e += 4, n == e) + return s; + let a = []; + for (; e < n; ) + a.push(this.childString(e)), e = this.buffer[e + 3]; + return s + "(" + a.join(",") + ")"; } - childString(n) { - let s = this.buffer[n], a = this.buffer[n + 3], l = this.set.types[s], h = l.name; - if (/\W/.test(h) && !l.isError && (h = JSON.stringify(h)), n += 4, a == n) - return h; - let f = []; - for (; n < a; ) - f.push(this.childString(n)), n = this.buffer[n + 3]; - return h + "(" + f.join(",") + ")"; - } - findChild(n, s, a, l, h) { - let { buffer: f } = this, b = -1; - for (let w = n; w != s && !(rPt(h, l, f[w + 1], f[w + 2]) && (b = w, a > 0)); w = f[w + 3]) + findChild(e, r, n, i, s) { + let { buffer: a } = this, o = -1; + for (let l = e; l != r && !(mK(s, i, a[l + 1], a[l + 2]) && (o = l, n > 0)); l = a[l + 3]) ; - return b; + return o; } - slice(n, s, a) { - let l = this.buffer, h = new Uint16Array(s - n), f = 0; - for (let b = n, w = 0; b < s; ) { - h[w++] = l[b++], h[w++] = l[b++] - a; - let O = h[w++] = l[b++] - a; - h[w++] = l[b++] - n, f = Math.max(f, O); + slice(e, r, n) { + let i = this.buffer, s = new Uint16Array(r - e), a = 0; + for (let o = e, l = 0; o < r; ) { + s[l++] = i[o++], s[l++] = i[o++] - n; + let u = s[l++] = i[o++] - n; + s[l++] = i[o++] - e, a = Math.max(a, u); } - return new g8(h, f, this.set); + return new of(s, a, this.set); } } -function rPt(r, n, s, a) { - switch (r) { +function mK(t, e, r, n) { + switch (t) { case -2: - return s < n; + return r < e; case -1: - return a >= n && s < n; + return n >= e && r < e; case 0: - return s < n && a > n; + return r < e && n > e; case 1: - return s <= n && a > n; + return r <= e && n > e; case 2: - return a > n; + return n > e; case 4: return !0; } } -function yK(r, n, s, a) { - for (var l; r.from == r.to || (s < 1 ? r.from >= n : r.from > n) || (s > -1 ? r.to <= n : r.to < n); ) { - let f = !a && r instanceof Cg && r.index < 0 ? null : r.parent; - if (!f) - return r; - r = f; +function Ay(t, e, r, n) { + for (var i; t.from == t.to || (r < 1 ? t.from >= e : t.from > e) || (r > -1 ? t.to <= e : t.to < e); ) { + let a = !n && t instanceof $s && t.index < 0 ? null : t.parent; + if (!a) + return t; + t = a; } - let h = a ? 0 : fh.IgnoreOverlays; - if (a) - for (let f = r, b = f.parent; b; f = b, b = f.parent) - f instanceof Cg && f.index < 0 && ((l = b.enter(n, s, h)) === null || l === void 0 ? void 0 : l.from) != f.from && (r = b); + let s = n ? 0 : un.IgnoreOverlays; + if (n) + for (let a = t, o = a.parent; o; a = o, o = a.parent) + a instanceof $s && a.index < 0 && ((i = o.enter(e, r, s)) === null || i === void 0 ? void 0 : i.from) != a.from && (t = o); for (; ; ) { - let f = r.enter(n, s, h); - if (!f) - return r; - r = f; + let a = t.enter(e, r, s); + if (!a) + return t; + t = a; } } -class iPt { - cursor(n = 0) { - return new Wbe(this, n); +class vK { + cursor(e = 0) { + return new O5(this, e); } - getChild(n, s = null, a = null) { - let l = bCt(this, n, s, a); - return l.length ? l[0] : null; + getChild(e, r = null, n = null) { + let i = WB(this, e, r, n); + return i.length ? i[0] : null; } - getChildren(n, s = null, a = null) { - return bCt(this, n, s, a); + getChildren(e, r = null, n = null) { + return WB(this, e, r, n); } - resolve(n, s = 0) { - return yK(this, n, s, !1); + resolve(e, r = 0) { + return Ay(this, e, r, !1); } - resolveInner(n, s = 0) { - return yK(this, n, s, !0); + resolveInner(e, r = 0) { + return Ay(this, e, r, !0); } - matchContext(n) { - return xFe(this, n); + matchContext(e) { + return f7(this, e); } - enterUnfinishedNodesBefore(n) { - let s = this.childBefore(n), a = this; - for (; s; ) { - let l = s.lastChild; - if (!l || l.to != s.to) + enterUnfinishedNodesBefore(e) { + let r = this.childBefore(e), n = this; + for (; r; ) { + let i = r.lastChild; + if (!i || i.to != r.to) break; - l.type.isError && l.from == l.to ? (a = s, s = l.prevSibling) : s = l; + i.type.isError && i.from == i.to ? (n = r, r = i.prevSibling) : r = i; } - return a; + return n; } get node() { return this; @@ -10509,9 +10518,9 @@ class iPt { return this.parent; } } -class Cg extends iPt { - constructor(n, s, a, l) { - super(), this._tree = n, this.from = s, this.index = a, this._parent = l; +class $s extends vK { + constructor(e, r, n, i) { + super(), this._tree = e, this.from = r, this.index = n, this._parent = i; } get type() { return this._tree.type; @@ -10522,27 +10531,27 @@ class Cg extends iPt { get to() { return this.from + this._tree.length; } - nextChild(n, s, a, l, h = 0) { - for (let f = this; ; ) { - for (let { children: b, positions: w } = f._tree, O = s > 0 ? b.length : -1; n != O; n += s) { - let S = b[n], E = w[n] + f.from; - if (!!rPt(l, a, E, E + S.length)) { - if (S instanceof g8) { - if (h & fh.ExcludeBuffers) + nextChild(e, r, n, i, s = 0) { + for (let a = this; ; ) { + for (let { children: o, positions: l } = a._tree, u = r > 0 ? o.length : -1; e != u; e += r) { + let h = o[e], f = l[e] + a.from; + if (!!mK(i, n, f, f + h.length)) { + if (h instanceof of) { + if (s & un.ExcludeBuffers) continue; - let D = S.findChild(0, S.buffer.length, s, a - E, l); - if (D > -1) - return new H4(new cxn(f, S, n, E), null, D); - } else if (h & fh.IncludeAnonymous || !S.type.isAnonymous || mze(S)) { - let D; - if (!(h & fh.IgnoreMounts) && (D = wK.get(S)) && !D.overlay) - return new Cg(D.tree, E, n, f); - let M = new Cg(S, E, n, f); - return h & fh.IncludeAnonymous || !M.type.isAnonymous ? M : M.nextChild(s < 0 ? S.children.length - 1 : 0, s, a, l); + let d = h.findChild(0, h.buffer.length, r, n - f, i); + if (d > -1) + return new gc(new $we(a, h, e, f), null, d); + } else if (s & un.IncludeAnonymous || !h.type.isAnonymous || UR(h)) { + let d; + if (!(s & un.IgnoreMounts) && (d = _y.get(h)) && !d.overlay) + return new $s(d.tree, f, e, a); + let p = new $s(h, f, e, a); + return s & un.IncludeAnonymous || !p.type.isAnonymous ? p : p.nextChild(r < 0 ? h.children.length - 1 : 0, r, n, i); } } } - if (h & fh.IncludeAnonymous || !f.type.isAnonymous || (f.index >= 0 ? n = f.index + s : n = s < 0 ? -1 : f._parent._tree.children.length, f = f._parent, !f)) + if (s & un.IncludeAnonymous || !a.type.isAnonymous || (a.index >= 0 ? e = a.index + r : e = r < 0 ? -1 : a._parent._tree.children.length, a = a._parent, !a)) return null; } } @@ -10552,27 +10561,27 @@ class Cg extends iPt { get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4); } - childAfter(n) { - return this.nextChild(0, 1, n, 2); + childAfter(e) { + return this.nextChild(0, 1, e, 2); } - childBefore(n) { - return this.nextChild(this._tree.children.length - 1, -1, n, -2); + childBefore(e) { + return this.nextChild(this._tree.children.length - 1, -1, e, -2); } - enter(n, s, a = 0) { - let l; - if (!(a & fh.IgnoreOverlays) && (l = wK.get(this._tree)) && l.overlay) { - let h = n - this.from; - for (let { from: f, to: b } of l.overlay) - if ((s > 0 ? f <= h : f < h) && (s < 0 ? b >= h : b > h)) - return new Cg(l.tree, l.overlay[0].from + this.from, -1, this); + enter(e, r, n = 0) { + let i; + if (!(n & un.IgnoreOverlays) && (i = _y.get(this._tree)) && i.overlay) { + let s = e - this.from; + for (let { from: a, to: o } of i.overlay) + if ((r > 0 ? a <= s : a < s) && (r < 0 ? o >= s : o > s)) + return new $s(i.tree, i.overlay[0].from + this.from, -1, this); } - return this.nextChild(0, 1, n, s, a); + return this.nextChild(0, 1, e, r, n); } nextSignificantParent() { - let n = this; - for (; n.type.isAnonymous && n._parent; ) - n = n._parent; - return n; + let e = this; + for (; e.type.isAnonymous && e._parent; ) + e = e._parent; + return e; } get parent() { return this._parent ? this._parent.nextSignificantParent() : null; @@ -10593,40 +10602,40 @@ class Cg extends iPt { return this._tree.toString(); } } -function bCt(r, n, s, a) { - let l = r.cursor(), h = []; - if (!l.firstChild()) - return h; - if (s != null) { - for (; !l.type.is(s); ) - if (!l.nextSibling()) - return h; +function WB(t, e, r, n) { + let i = t.cursor(), s = []; + if (!i.firstChild()) + return s; + if (r != null) { + for (; !i.type.is(r); ) + if (!i.nextSibling()) + return s; } for (; ; ) { - if (a != null && l.type.is(a)) - return h; - if (l.type.is(n) && h.push(l.node), !l.nextSibling()) - return a == null ? h : []; + if (n != null && i.type.is(n)) + return s; + if (i.type.is(e) && s.push(i.node), !i.nextSibling()) + return n == null ? s : []; } } -function xFe(r, n, s = n.length - 1) { - for (let a = r.parent; s >= 0; a = a.parent) { - if (!a) +function f7(t, e, r = e.length - 1) { + for (let n = t.parent; r >= 0; n = n.parent) { + if (!n) return !1; - if (!a.type.isAnonymous) { - if (n[s] && n[s] != a.name) + if (!n.type.isAnonymous) { + if (e[r] && e[r] != n.name) return !1; - s--; + r--; } } return !0; } -class cxn { - constructor(n, s, a, l) { - this.parent = n, this.buffer = s, this.index = a, this.start = l; +class $we { + constructor(e, r, n, i) { + this.parent = e, this.buffer = r, this.index = n, this.start = i; } } -class H4 extends iPt { +class gc extends vK { get name() { return this.type.name; } @@ -10636,12 +10645,12 @@ class H4 extends iPt { get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; } - constructor(n, s, a) { - super(), this.context = n, this._parent = s, this.index = a, this.type = n.buffer.set.types[n.buffer.buffer[a]]; + constructor(e, r, n) { + super(), this.context = e, this._parent = r, this.index = n, this.type = e.buffer.set.types[e.buffer.buffer[n]]; } - child(n, s, a) { - let { buffer: l } = this.context, h = l.findChild(this.index + 4, l.buffer[this.index + 3], n, s - this.context.start, a); - return h < 0 ? null : new H4(this.context, this, h); + child(e, r, n) { + let { buffer: i } = this.context, s = i.findChild(this.index + 4, i.buffer[this.index + 3], e, r - this.context.start, n); + return s < 0 ? null : new gc(this.context, this, s); } get firstChild() { return this.child(1, 0, 4); @@ -10649,114 +10658,114 @@ class H4 extends iPt { get lastChild() { return this.child(-1, 0, 4); } - childAfter(n) { - return this.child(1, n, 2); + childAfter(e) { + return this.child(1, e, 2); } - childBefore(n) { - return this.child(-1, n, -2); + childBefore(e) { + return this.child(-1, e, -2); } - enter(n, s, a = 0) { - if (a & fh.ExcludeBuffers) + enter(e, r, n = 0) { + if (n & un.ExcludeBuffers) return null; - let { buffer: l } = this.context, h = l.findChild(this.index + 4, l.buffer[this.index + 3], s > 0 ? 1 : -1, n - this.context.start, s); - return h < 0 ? null : new H4(this.context, this, h); + let { buffer: i } = this.context, s = i.findChild(this.index + 4, i.buffer[this.index + 3], r > 0 ? 1 : -1, e - this.context.start, r); + return s < 0 ? null : new gc(this.context, this, s); } get parent() { return this._parent || this.context.parent.nextSignificantParent(); } - externalSibling(n) { - return this._parent ? null : this.context.parent.nextChild(this.context.index + n, n, 0, 4); + externalSibling(e) { + return this._parent ? null : this.context.parent.nextChild(this.context.index + e, e, 0, 4); } get nextSibling() { - let { buffer: n } = this.context, s = n.buffer[this.index + 3]; - return s < (this._parent ? n.buffer[this._parent.index + 3] : n.buffer.length) ? new H4(this.context, this._parent, s) : this.externalSibling(1); + let { buffer: e } = this.context, r = e.buffer[this.index + 3]; + return r < (this._parent ? e.buffer[this._parent.index + 3] : e.buffer.length) ? new gc(this.context, this._parent, r) : this.externalSibling(1); } get prevSibling() { - let { buffer: n } = this.context, s = this._parent ? this._parent.index + 4 : 0; - return this.index == s ? this.externalSibling(-1) : new H4(this.context, this._parent, n.findChild(s, this.index, -1, 0, 4)); + let { buffer: e } = this.context, r = this._parent ? this._parent.index + 4 : 0; + return this.index == r ? this.externalSibling(-1) : new gc(this.context, this._parent, e.findChild(r, this.index, -1, 0, 4)); } get tree() { return null; } toTree() { - let n = [], s = [], { buffer: a } = this.context, l = this.index + 4, h = a.buffer[this.index + 3]; - if (h > l) { - let f = a.buffer[this.index + 1]; - n.push(a.slice(l, h, f)), s.push(0); + let e = [], r = [], { buffer: n } = this.context, i = this.index + 4, s = n.buffer[this.index + 3]; + if (s > i) { + let a = n.buffer[this.index + 1]; + e.push(n.slice(i, s, a)), r.push(0); } - return new tu(this.type, n, s, this.to - this.from); + return new Yr(this.type, e, r, this.to - this.from); } toString() { return this.context.buffer.childString(this.index); } } -function sPt(r) { - if (!r.length) +function yK(t) { + if (!t.length) return null; - let n = 0, s = r[0]; - for (let h = 1; h < r.length; h++) { - let f = r[h]; - (f.from > s.from || f.to < s.to) && (s = f, n = h); + let e = 0, r = t[0]; + for (let s = 1; s < t.length; s++) { + let a = t[s]; + (a.from > r.from || a.to < r.to) && (r = a, e = s); } - let a = s instanceof Cg && s.index < 0 ? null : s.parent, l = r.slice(); - return a ? l[n] = a : l.splice(n, 1), new lxn(l, s); + let n = r instanceof $s && r.index < 0 ? null : r.parent, i = t.slice(); + return n ? i[e] = n : i.splice(e, 1), new Bwe(i, r); } -class lxn { - constructor(n, s) { - this.heads = n, this.node = s; +class Bwe { + constructor(e, r) { + this.heads = e, this.node = r; } get next() { - return sPt(this.heads); + return yK(this.heads); } } -function uxn(r, n, s) { - let a = r.resolveInner(n, s), l = null; - for (let h = a instanceof Cg ? a : a.context.parent; h; h = h.parent) - if (h.index < 0) { - let f = h.parent; - (l || (l = [a])).push(f.resolve(n, s)), h = f; +function Fwe(t, e, r) { + let n = t.resolveInner(e, r), i = null; + for (let s = n instanceof $s ? n : n.context.parent; s; s = s.parent) + if (s.index < 0) { + let a = s.parent; + (i || (i = [n])).push(a.resolve(e, r)), s = a; } else { - let f = wK.get(h.tree); - if (f && f.overlay && f.overlay[0].from <= n && f.overlay[f.overlay.length - 1].to >= n) { - let b = new Cg(f.tree, f.overlay[0].from + h.from, -1, h); - (l || (l = [a])).push(yK(b, n, s, !1)); + let a = _y.get(s.tree); + if (a && a.overlay && a.overlay[0].from <= e && a.overlay[a.overlay.length - 1].to >= e) { + let o = new $s(a.tree, a.overlay[0].from + s.from, -1, s); + (i || (i = [n])).push(Ay(o, e, r, !1)); } } - return l ? sPt(l) : a; + return i ? yK(i) : n; } -class Wbe { +class O5 { get name() { return this.type.name; } - constructor(n, s = 0) { - if (this.mode = s, this.buffer = null, this.stack = [], this.index = 0, this.bufferNode = null, n instanceof Cg) - this.yieldNode(n); + constructor(e, r = 0) { + if (this.mode = r, this.buffer = null, this.stack = [], this.index = 0, this.bufferNode = null, e instanceof $s) + this.yieldNode(e); else { - this._tree = n.context.parent, this.buffer = n.context; - for (let a = n._parent; a; a = a._parent) - this.stack.unshift(a.index); - this.bufferNode = n, this.yieldBuf(n.index); + this._tree = e.context.parent, this.buffer = e.context; + for (let n = e._parent; n; n = n._parent) + this.stack.unshift(n.index); + this.bufferNode = e, this.yieldBuf(e.index); } } - yieldNode(n) { - return n ? (this._tree = n, this.type = n.type, this.from = n.from, this.to = n.to, !0) : !1; + yieldNode(e) { + return e ? (this._tree = e, this.type = e.type, this.from = e.from, this.to = e.to, !0) : !1; } - yieldBuf(n, s) { - this.index = n; - let { start: a, buffer: l } = this.buffer; - return this.type = s || l.set.types[l.buffer[n]], this.from = a + l.buffer[n + 1], this.to = a + l.buffer[n + 2], !0; + yieldBuf(e, r) { + this.index = e; + let { start: n, buffer: i } = this.buffer; + return this.type = r || i.set.types[i.buffer[e]], this.from = n + i.buffer[e + 1], this.to = n + i.buffer[e + 2], !0; } - yield(n) { - return n ? n instanceof Cg ? (this.buffer = null, this.yieldNode(n)) : (this.buffer = n.context, this.yieldBuf(n.index, n.type)) : !1; + yield(e) { + return e ? e instanceof $s ? (this.buffer = null, this.yieldNode(e)) : (this.buffer = e.context, this.yieldBuf(e.index, e.type)) : !1; } toString() { return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString(); } - enterChild(n, s, a) { + enterChild(e, r, n) { if (!this.buffer) - return this.yield(this._tree.nextChild(n < 0 ? this._tree._tree.children.length - 1 : 0, n, s, a, this.mode)); - let { buffer: l } = this.buffer, h = l.findChild(this.index + 4, l.buffer[this.index + 3], n, s - this.buffer.start, a); - return h < 0 ? !1 : (this.stack.push(this.index), this.yieldBuf(h)); + return this.yield(this._tree.nextChild(e < 0 ? this._tree._tree.children.length - 1 : 0, e, r, n, this.mode)); + let { buffer: i } = this.buffer, s = i.findChild(this.index + 4, i.buffer[this.index + 3], e, r - this.buffer.start, n); + return s < 0 ? !1 : (this.stack.push(this.index), this.yieldBuf(s)); } firstChild() { return this.enterChild(1, 0, 4); @@ -10764,37 +10773,37 @@ class Wbe { lastChild() { return this.enterChild(-1, 0, 4); } - childAfter(n) { - return this.enterChild(1, n, 2); + childAfter(e) { + return this.enterChild(1, e, 2); } - childBefore(n) { - return this.enterChild(-1, n, -2); + childBefore(e) { + return this.enterChild(-1, e, -2); } - enter(n, s, a = this.mode) { - return this.buffer ? a & fh.ExcludeBuffers ? !1 : this.enterChild(1, n, s) : this.yield(this._tree.enter(n, s, a)); + enter(e, r, n = this.mode) { + return this.buffer ? n & un.ExcludeBuffers ? !1 : this.enterChild(1, e, r) : this.yield(this._tree.enter(e, r, n)); } parent() { if (!this.buffer) - return this.yieldNode(this.mode & fh.IncludeAnonymous ? this._tree._parent : this._tree.parent); + return this.yieldNode(this.mode & un.IncludeAnonymous ? this._tree._parent : this._tree.parent); if (this.stack.length) return this.yieldBuf(this.stack.pop()); - let n = this.mode & fh.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent(); - return this.buffer = null, this.yieldNode(n); + let e = this.mode & un.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent(); + return this.buffer = null, this.yieldNode(e); } - sibling(n) { + sibling(e) { if (!this.buffer) - return this._tree._parent ? this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + n, n, 0, 4, this.mode)) : !1; - let { buffer: s } = this.buffer, a = this.stack.length - 1; - if (n < 0) { - let l = a < 0 ? 0 : this.stack[a] + 4; - if (this.index != l) - return this.yieldBuf(s.findChild(l, this.index, -1, 0, 4)); + return this._tree._parent ? this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + e, e, 0, 4, this.mode)) : !1; + let { buffer: r } = this.buffer, n = this.stack.length - 1; + if (e < 0) { + let i = n < 0 ? 0 : this.stack[n] + 4; + if (this.index != i) + return this.yieldBuf(r.findChild(i, this.index, -1, 0, 4)); } else { - let l = s.buffer[this.index + 3]; - if (l < (a < 0 ? s.buffer.length : s.buffer[this.stack[a] + 3])) - return this.yieldBuf(l); + let i = r.buffer[this.index + 3]; + if (i < (n < 0 ? r.buffer.length : r.buffer[this.stack[n] + 3])) + return this.yieldBuf(i); } - return a < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + n, n, 0, 4, this.mode)) : !1; + return n < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + e, e, 0, 4, this.mode)) : !1; } nextSibling() { return this.sibling(1); @@ -10802,320 +10811,320 @@ class Wbe { prevSibling() { return this.sibling(-1); } - atLastNode(n) { - let s, a, { buffer: l } = this; - if (l) { - if (n > 0) { - if (this.index < l.buffer.buffer.length) + atLastNode(e) { + let r, n, { buffer: i } = this; + if (i) { + if (e > 0) { + if (this.index < i.buffer.buffer.length) return !1; } else - for (let h = 0; h < this.index; h++) - if (l.buffer.buffer[h + 3] < this.index) + for (let s = 0; s < this.index; s++) + if (i.buffer.buffer[s + 3] < this.index) return !1; - ({ index: s, parent: a } = l); + ({ index: r, parent: n } = i); } else - ({ index: s, _parent: a } = this._tree); - for (; a; { index: s, _parent: a } = a) - if (s > -1) - for (let h = s + n, f = n < 0 ? -1 : a._tree.children.length; h != f; h += n) { - let b = a._tree.children[h]; - if (this.mode & fh.IncludeAnonymous || b instanceof g8 || !b.type.isAnonymous || mze(b)) + ({ index: r, _parent: n } = this._tree); + for (; n; { index: r, _parent: n } = n) + if (r > -1) + for (let s = r + e, a = e < 0 ? -1 : n._tree.children.length; s != a; s += e) { + let o = n._tree.children[s]; + if (this.mode & un.IncludeAnonymous || o instanceof of || !o.type.isAnonymous || UR(o)) return !1; } return !0; } - move(n, s) { - if (s && this.enterChild(n, 0, 4)) + move(e, r) { + if (r && this.enterChild(e, 0, 4)) return !0; for (; ; ) { - if (this.sibling(n)) + if (this.sibling(e)) return !0; - if (this.atLastNode(n) || !this.parent()) + if (this.atLastNode(e) || !this.parent()) return !1; } } - next(n = !0) { - return this.move(1, n); + next(e = !0) { + return this.move(1, e); } - prev(n = !0) { - return this.move(-1, n); + prev(e = !0) { + return this.move(-1, e); } - moveTo(n, s = 0) { - for (; (this.from == this.to || (s < 1 ? this.from >= n : this.from > n) || (s > -1 ? this.to <= n : this.to < n)) && this.parent(); ) + moveTo(e, r = 0) { + for (; (this.from == this.to || (r < 1 ? this.from >= e : this.from > e) || (r > -1 ? this.to <= e : this.to < e)) && this.parent(); ) ; - for (; this.enterChild(1, n, s); ) + for (; this.enterChild(1, e, r); ) ; return this; } get node() { if (!this.buffer) return this._tree; - let n = this.bufferNode, s = null, a = 0; - if (n && n.context == this.buffer) { + let e = this.bufferNode, r = null, n = 0; + if (e && e.context == this.buffer) { e: - for (let l = this.index, h = this.stack.length; h >= 0; ) { - for (let f = n; f; f = f._parent) - if (f.index == l) { - if (l == this.index) - return f; - s = f, a = h + 1; + for (let i = this.index, s = this.stack.length; s >= 0; ) { + for (let a = e; a; a = a._parent) + if (a.index == i) { + if (i == this.index) + return a; + r = a, n = s + 1; break e; } - l = this.stack[--h]; + i = this.stack[--s]; } } - for (let l = a; l < this.stack.length; l++) - s = new H4(this.buffer, s, this.stack[l]); - return this.bufferNode = new H4(this.buffer, s, this.index); + for (let i = n; i < this.stack.length; i++) + r = new gc(this.buffer, r, this.stack[i]); + return this.bufferNode = new gc(this.buffer, r, this.index); } get tree() { return this.buffer ? null : this._tree._tree; } - iterate(n, s) { - for (let a = 0; ; ) { - let l = !1; - if (this.type.isAnonymous || n(this) !== !1) { + iterate(e, r) { + for (let n = 0; ; ) { + let i = !1; + if (this.type.isAnonymous || e(this) !== !1) { if (this.firstChild()) { - a++; + n++; continue; } - this.type.isAnonymous || (l = !0); + this.type.isAnonymous || (i = !0); } - for (; l && s && s(this), l = this.type.isAnonymous, !this.nextSibling(); ) { - if (!a) + for (; i && r && r(this), i = this.type.isAnonymous, !this.nextSibling(); ) { + if (!n) return; - this.parent(), a--, l = !0; + this.parent(), n--, i = !0; } } } - matchContext(n) { + matchContext(e) { if (!this.buffer) - return xFe(this.node, n); - let { buffer: s } = this.buffer, { types: a } = s.set; - for (let l = n.length - 1, h = this.stack.length - 1; l >= 0; h--) { - if (h < 0) - return xFe(this.node, n, l); - let f = a[s.buffer[this.stack[h]]]; - if (!f.isAnonymous) { - if (n[l] && n[l] != f.name) + return f7(this.node, e); + let { buffer: r } = this.buffer, { types: n } = r.set; + for (let i = e.length - 1, s = this.stack.length - 1; i >= 0; s--) { + if (s < 0) + return f7(this.node, e, i); + let a = n[r.buffer[this.stack[s]]]; + if (!a.isAnonymous) { + if (e[i] && e[i] != a.name) return !1; - l--; + i--; } } return !0; } } -function mze(r) { - return r.children.some((n) => n instanceof g8 || !n.type.isAnonymous || mze(n)); +function UR(t) { + return t.children.some((e) => e instanceof of || !e.type.isAnonymous || UR(e)); } -function hxn(r) { - var n; - let { buffer: s, nodeSet: a, maxBufferLength: l = nPt, reused: h = [], minRepeatType: f = a.types.length } = r, b = Array.isArray(s) ? new gze(s, s.length) : s, w = a.types, O = 0, S = 0; - function E(se, he, te, be, fe, ae) { - let { id: ke, start: we, end: Ce, size: X } = b, Ie = S; - for (; X < 0; ) - if (b.next(), X == -1) { - let tt = h[ke]; - te.push(tt), be.push(we - se); +function zwe(t) { + var e; + let { buffer: r, nodeSet: n, maxBufferLength: i = gK, reused: s = [], minRepeatType: a = n.types.length } = t, o = Array.isArray(r) ? new VR(r, r.length) : r, l = n.types, u = 0, h = 0; + function f(S, C, T, A, E, L) { + let { id: _, start: R, end: $, size: k } = o, N = h; + for (; k < 0; ) + if (o.next(), k == -1) { + let F = s[_]; + T.push(F), A.push(R - S); return; - } else if (X == -3) { - O = ke; + } else if (k == -3) { + u = _; return; - } else if (X == -4) { - S = ke; + } else if (k == -4) { + h = _; return; } else - throw new RangeError(`Unrecognized record size: ${X}`); - let ge = w[ke], Fe, ve, Ve = we - se; - if (Ce - we <= l && (ve = W(b.pos - he, fe))) { - let tt = new Uint16Array(ve.size - ve.skip), wt = b.pos - ve.size, dt = tt.length; - for (; b.pos > wt; ) - dt = H(ve.start, tt, dt); - Fe = new g8(tt, Ce - ve.start, a), Ve = ve.start - se; + throw new RangeError(`Unrecognized record size: ${k}`); + let M = l[_], I, D, P = R - S; + if ($ - R <= i && (D = v(o.pos - C, E))) { + let F = new Uint16Array(D.size - D.skip), B = o.pos - D.size, V = F.length; + for (; o.pos > B; ) + V = y(D.start, F, V); + I = new of(F, $ - D.start, n), P = D.start - S; } else { - let tt = b.pos - X; - b.next(); - let wt = [], dt = [], Dt = ke >= f ? ke : -1, It = 0, cn = Ce; - for (; b.pos > tt; ) - Dt >= 0 && b.id == Dt && b.size >= 0 ? (b.end <= cn - l && (B(wt, dt, we, It, b.end, cn, Dt, Ie), It = wt.length, cn = b.end), b.next()) : ae > 2500 ? D(we, tt, wt, dt) : E(we, tt, wt, dt, Dt, ae + 1); - if (Dt >= 0 && It > 0 && It < wt.length && B(wt, dt, we, It, we, cn, Dt, Ie), wt.reverse(), dt.reverse(), Dt > -1 && It > 0) { - let lt = M(ge); - Fe = bze(ge, wt, dt, 0, wt.length, 0, Ce - we, lt, lt); + let F = o.pos - k; + o.next(); + let B = [], V = [], Q = _ >= a ? _ : -1, G = 0, ee = $; + for (; o.pos > F; ) + Q >= 0 && o.id == Q && o.size >= 0 ? (o.end <= ee - i && (g(B, V, R, G, o.end, ee, Q, N), G = B.length, ee = o.end), o.next()) : L > 2500 ? d(R, F, B, V) : f(R, F, B, V, Q, L + 1); + if (Q >= 0 && G > 0 && G < B.length && g(B, V, R, G, R, ee, Q, N), B.reverse(), V.reverse(), Q > -1 && G > 0) { + let Y = p(M); + I = qR(M, B, V, 0, B.length, 0, $ - R, Y, Y); } else - Fe = z(ge, wt, dt, Ce - we, Ie - Ce); + I = m(M, B, V, $ - R, N - $); } - te.push(Fe), be.push(Ve); + T.push(I), A.push(P); } - function D(se, he, te, be) { - let fe = [], ae = 0, ke = -1; - for (; b.pos > he; ) { - let { id: we, start: Ce, end: X, size: Ie } = b; - if (Ie > 4) - b.next(); + function d(S, C, T, A) { + let E = [], L = 0, _ = -1; + for (; o.pos > C; ) { + let { id: R, start: $, end: k, size: N } = o; + if (N > 4) + o.next(); else { - if (ke > -1 && Ce < ke) + if (_ > -1 && $ < _) break; - ke < 0 && (ke = X - l), fe.push(we, Ce, X), ae++, b.next(); + _ < 0 && (_ = k - i), E.push(R, $, k), L++, o.next(); } } - if (ae) { - let we = new Uint16Array(ae * 4), Ce = fe[fe.length - 2]; - for (let X = fe.length - 3, Ie = 0; X >= 0; X -= 3) - we[Ie++] = fe[X], we[Ie++] = fe[X + 1] - Ce, we[Ie++] = fe[X + 2] - Ce, we[Ie++] = Ie; - te.push(new g8(we, fe[2] - Ce, a)), be.push(Ce - se); + if (L) { + let R = new Uint16Array(L * 4), $ = E[E.length - 2]; + for (let k = E.length - 3, N = 0; k >= 0; k -= 3) + R[N++] = E[k], R[N++] = E[k + 1] - $, R[N++] = E[k + 2] - $, R[N++] = N; + T.push(new of(R, E[2] - $, n)), A.push($ - S); } } - function M(se) { - return (he, te, be) => { - let fe = 0, ae = he.length - 1, ke, we; - if (ae >= 0 && (ke = he[ae]) instanceof tu) { - if (!ae && ke.type == se && ke.length == be) - return ke; - (we = ke.prop(Ia.lookAhead)) && (fe = te[ae] + ke.length + we); + function p(S) { + return (C, T, A) => { + let E = 0, L = C.length - 1, _, R; + if (L >= 0 && (_ = C[L]) instanceof Yr) { + if (!L && _.type == S && _.length == A) + return _; + (R = _.prop(lr.lookAhead)) && (E = T[L] + _.length + R); } - return z(se, he, te, be, fe); + return m(S, C, T, A, E); }; } - function B(se, he, te, be, fe, ae, ke, we) { - let Ce = [], X = []; - for (; se.length > be; ) - Ce.push(se.pop()), X.push(he.pop() + te - fe); - se.push(z(a.types[ke], Ce, X, ae - fe, we - ae)), he.push(fe - te); + function g(S, C, T, A, E, L, _, R) { + let $ = [], k = []; + for (; S.length > A; ) + $.push(S.pop()), k.push(C.pop() + T - E); + S.push(m(n.types[_], $, k, L - E, R - L)), C.push(E - T); } - function z(se, he, te, be, fe = 0, ae) { - if (O) { - let ke = [Ia.contextHash, O]; - ae = ae ? [ke].concat(ae) : [ke]; + function m(S, C, T, A, E = 0, L) { + if (u) { + let _ = [lr.contextHash, u]; + L = L ? [_].concat(L) : [_]; } - if (fe > 25) { - let ke = [Ia.lookAhead, fe]; - ae = ae ? [ke].concat(ae) : [ke]; + if (E > 25) { + let _ = [lr.lookAhead, E]; + L = L ? [_].concat(L) : [_]; } - return new tu(se, he, te, be, ae); + return new Yr(S, C, T, A, L); } - function W(se, he) { - let te = b.fork(), be = 0, fe = 0, ae = 0, ke = te.end - l, we = { size: 0, start: 0, skip: 0 }; + function v(S, C) { + let T = o.fork(), A = 0, E = 0, L = 0, _ = T.end - i, R = { size: 0, start: 0, skip: 0 }; e: - for (let Ce = te.pos - se; te.pos > Ce; ) { - let X = te.size; - if (te.id == he && X >= 0) { - we.size = be, we.start = fe, we.skip = ae, ae += 4, be += 4, te.next(); + for (let $ = T.pos - S; T.pos > $; ) { + let k = T.size; + if (T.id == C && k >= 0) { + R.size = A, R.start = E, R.skip = L, L += 4, A += 4, T.next(); continue; } - let Ie = te.pos - X; - if (X < 0 || Ie < Ce || te.start < ke) - break; - let ge = te.id >= f ? 4 : 0, Fe = te.start; - for (te.next(); te.pos > Ie; ) { - if (te.size < 0) - if (te.size == -3) - ge += 4; + let N = T.pos - k; + if (k < 0 || N < $ || T.start < _) + break; + let M = T.id >= a ? 4 : 0, I = T.start; + for (T.next(); T.pos > N; ) { + if (T.size < 0) + if (T.size == -3) + M += 4; else break e; else - te.id >= f && (ge += 4); - te.next(); + T.id >= a && (M += 4); + T.next(); } - fe = Fe, be += X, ae += ge; + E = I, A += k, L += M; } - return (he < 0 || be == se) && (we.size = be, we.start = fe, we.skip = ae), we.size > 4 ? we : void 0; + return (C < 0 || A == S) && (R.size = A, R.start = E, R.skip = L), R.size > 4 ? R : void 0; } - function H(se, he, te) { - let { id: be, start: fe, end: ae, size: ke } = b; - if (b.next(), ke >= 0 && be < f) { - let we = te; - if (ke > 4) { - let Ce = b.pos - (ke - 4); - for (; b.pos > Ce; ) - te = H(se, he, te); + function y(S, C, T) { + let { id: A, start: E, end: L, size: _ } = o; + if (o.next(), _ >= 0 && A < a) { + let R = T; + if (_ > 4) { + let $ = o.pos - (_ - 4); + for (; o.pos > $; ) + T = y(S, C, T); } - he[--te] = we, he[--te] = ae - se, he[--te] = fe - se, he[--te] = be; + C[--T] = R, C[--T] = L - S, C[--T] = E - S, C[--T] = A; } else - ke == -3 ? O = be : ke == -4 && (S = be); - return te; - } - let G = [], ee = []; - for (; b.pos > 0; ) - E(r.start || 0, r.bufferStart || 0, G, ee, -1, 0); - let le = (n = r.length) !== null && n !== void 0 ? n : G.length ? ee[0] + G[0].length : 0; - return new tu(w[r.topID], G.reverse(), ee.reverse(), le); -} -const vCt = /* @__PURE__ */ new WeakMap(); -function Kme(r, n) { - if (!r.isAnonymous || n instanceof g8 || n.type != r) + _ == -3 ? u = A : _ == -4 && (h = A); + return T; + } + let b = [], w = []; + for (; o.pos > 0; ) + f(t.start || 0, t.bufferStart || 0, b, w, -1, 0); + let O = (e = t.length) !== null && e !== void 0 ? e : b.length ? w[0] + b[0].length : 0; + return new Yr(l[t.topID], b.reverse(), w.reverse(), O); +} +const GB = /* @__PURE__ */ new WeakMap(); +function c4(t, e) { + if (!t.isAnonymous || e instanceof of || e.type != t) return 1; - let s = vCt.get(n); - if (s == null) { - s = 1; - for (let a of n.children) { - if (a.type != r || !(a instanceof tu)) { - s = 1; + let r = GB.get(e); + if (r == null) { + r = 1; + for (let n of e.children) { + if (n.type != t || !(n instanceof Yr)) { + r = 1; break; } - s += Kme(r, a); + r += c4(t, n); } - vCt.set(n, s); + GB.set(e, r); } - return s; + return r; } -function bze(r, n, s, a, l, h, f, b, w) { - let O = 0; - for (let B = a; B < l; B++) - O += Kme(r, n[B]); - let S = Math.ceil(O * 1.5 / 8), E = [], D = []; - function M(B, z, W, H, G) { - for (let ee = W; ee < H; ) { - let le = ee, se = z[ee], he = Kme(r, B[ee]); - for (ee++; ee < H; ee++) { - let te = Kme(r, B[ee]); - if (he + te >= S) - break; - he += te; - } - if (ee == le + 1) { - if (he > S) { - let te = B[le]; - M(te.children, te.positions, 0, te.children.length, z[le] + G); +function qR(t, e, r, n, i, s, a, o, l) { + let u = 0; + for (let g = n; g < i; g++) + u += c4(t, e[g]); + let h = Math.ceil(u * 1.5 / 8), f = [], d = []; + function p(g, m, v, y, b) { + for (let w = v; w < y; ) { + let O = w, S = m[w], C = c4(t, g[w]); + for (w++; w < y; w++) { + let T = c4(t, g[w]); + if (C + T >= h) + break; + C += T; + } + if (w == O + 1) { + if (C > h) { + let T = g[O]; + p(T.children, T.positions, 0, T.children.length, m[O] + b); continue; } - E.push(B[le]); + f.push(g[O]); } else { - let te = z[ee - 1] + B[ee - 1].length - se; - E.push(bze(r, B, z, le, ee, se, te, null, w)); + let T = m[w - 1] + g[w - 1].length - S; + f.push(qR(t, g, m, O, w, S, T, null, l)); } - D.push(se + G - h); + d.push(S + b - s); } } - return M(n, s, a, l, 0), (b || w)(E, D, f); + return p(e, r, n, i, 0), (o || l)(f, d, a); } -class oPt { +class bK { constructor() { this.map = /* @__PURE__ */ new WeakMap(); } - setBuffer(n, s, a) { - let l = this.map.get(n); - l || this.map.set(n, l = /* @__PURE__ */ new Map()), l.set(s, a); + setBuffer(e, r, n) { + let i = this.map.get(e); + i || this.map.set(e, i = /* @__PURE__ */ new Map()), i.set(r, n); } - getBuffer(n, s) { - let a = this.map.get(n); - return a && a.get(s); + getBuffer(e, r) { + let n = this.map.get(e); + return n && n.get(r); } - set(n, s) { - n instanceof H4 ? this.setBuffer(n.context.buffer, n.index, s) : n instanceof Cg && this.map.set(n.tree, s); + set(e, r) { + e instanceof gc ? this.setBuffer(e.context.buffer, e.index, r) : e instanceof $s && this.map.set(e.tree, r); } - get(n) { - return n instanceof H4 ? this.getBuffer(n.context.buffer, n.index) : n instanceof Cg ? this.map.get(n.tree) : void 0; + get(e) { + return e instanceof gc ? this.getBuffer(e.context.buffer, e.index) : e instanceof $s ? this.map.get(e.tree) : void 0; } - cursorSet(n, s) { - n.buffer ? this.setBuffer(n.buffer.buffer, n.index, s) : this.map.set(n.tree, s); + cursorSet(e, r) { + e.buffer ? this.setBuffer(e.buffer.buffer, e.index, r) : this.map.set(e.tree, r); } - cursorGet(n) { - return n.buffer ? this.getBuffer(n.buffer.buffer, n.index) : this.map.get(n.tree); + cursorGet(e) { + return e.buffer ? this.getBuffer(e.buffer.buffer, e.index) : this.map.get(e.tree); } } -class K6 { - constructor(n, s, a, l, h = !1, f = !1) { - this.from = n, this.to = s, this.tree = a, this.offset = l, this.open = (h ? 1 : 0) | (f ? 2 : 0); +class Cu { + constructor(e, r, n, i, s = !1, a = !1) { + this.from = e, this.to = r, this.tree = n, this.offset = i, this.open = (s ? 1 : 0) | (a ? 2 : 0); } get openStart() { return (this.open & 1) > 0; @@ -11123,407 +11132,407 @@ class K6 { get openEnd() { return (this.open & 2) > 0; } - static addTree(n, s = [], a = !1) { - let l = [new K6(0, n.length, n, 0, !1, a)]; - for (let h of s) - h.to > n.length && l.push(h); - return l; + static addTree(e, r = [], n = !1) { + let i = [new Cu(0, e.length, e, 0, !1, n)]; + for (let s of r) + s.to > e.length && i.push(s); + return i; } - static applyChanges(n, s, a = 128) { - if (!s.length) - return n; - let l = [], h = 1, f = n.length ? n[0] : null; - for (let b = 0, w = 0, O = 0; ; b++) { - let S = b < s.length ? s[b] : null, E = S ? S.fromA : 1e9; - if (E - w >= a) - for (; f && f.from < E; ) { - let D = f; - if (w >= D.from || E <= D.to || O) { - let M = Math.max(D.from, w) - O, B = Math.min(D.to, E) - O; - D = M >= B ? null : new K6(M, B, D.tree, D.offset + O, b > 0, !!S); - } - if (D && l.push(D), f.to > E) + static applyChanges(e, r, n = 128) { + if (!r.length) + return e; + let i = [], s = 1, a = e.length ? e[0] : null; + for (let o = 0, l = 0, u = 0; ; o++) { + let h = o < r.length ? r[o] : null, f = h ? h.fromA : 1e9; + if (f - l >= n) + for (; a && a.from < f; ) { + let d = a; + if (l >= d.from || f <= d.to || u) { + let p = Math.max(d.from, l) - u, g = Math.min(d.to, f) - u; + d = p >= g ? null : new Cu(p, g, d.tree, d.offset + u, o > 0, !!h); + } + if (d && i.push(d), a.to > f) break; - f = h < n.length ? n[h++] : null; + a = s < e.length ? e[s++] : null; } - if (!S) + if (!h) break; - w = S.toA, O = S.toA - S.toB; + l = h.toA, u = h.toA - h.toB; } - return l; + return i; } } -class vze { - startParse(n, s, a) { - return typeof n == "string" && (n = new fxn(n)), a = a ? a.length ? a.map((l) => new zy(l.from, l.to)) : [new zy(0, 0)] : [new zy(0, n.length)], this.createParse(n, s || [], a); +class QR { + startParse(e, r, n) { + return typeof e == "string" && (e = new Vwe(e)), n = n ? n.length ? n.map((i) => new Ro(i.from, i.to)) : [new Ro(0, 0)] : [new Ro(0, e.length)], this.createParse(e, r || [], n); } - parse(n, s, a) { - let l = this.startParse(n, s, a); + parse(e, r, n) { + let i = this.startParse(e, r, n); for (; ; ) { - let h = l.advance(); - if (h) - return h; + let s = i.advance(); + if (s) + return s; } } } -class fxn { - constructor(n) { - this.string = n; +class Vwe { + constructor(e) { + this.string = e; } get length() { return this.string.length; } - chunk(n) { - return this.string.slice(n); + chunk(e) { + return this.string.slice(e); } get lineChunks() { return !1; } - read(n, s) { - return this.string.slice(n, s); + read(e, r) { + return this.string.slice(e, r); } } -function aPt(r) { - return (n, s, a, l) => new pxn(n, r, s, a, l); +function xK(t) { + return (e, r, n, i) => new qwe(e, t, r, n, i); } -class wCt { - constructor(n, s, a, l, h) { - this.parser = n, this.parse = s, this.overlay = a, this.target = l, this.from = h; +class HB { + constructor(e, r, n, i, s) { + this.parser = e, this.parse = r, this.overlay = n, this.target = i, this.from = s; } } -function yCt(r) { - if (!r.length || r.some((n) => n.from >= n.to)) - throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(r)); +function XB(t) { + if (!t.length || t.some((e) => e.from >= e.to)) + throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(t)); } -class dxn { - constructor(n, s, a, l, h, f, b) { - this.parser = n, this.predicate = s, this.mounts = a, this.index = l, this.start = h, this.target = f, this.prev = b, this.depth = 0, this.ranges = []; +class Uwe { + constructor(e, r, n, i, s, a, o) { + this.parser = e, this.predicate = r, this.mounts = n, this.index = i, this.start = s, this.target = a, this.prev = o, this.depth = 0, this.ranges = []; } } -const SFe = new Ia({ perNode: !0 }); -class pxn { - constructor(n, s, a, l, h) { - this.nest = s, this.input = a, this.fragments = l, this.ranges = h, this.inner = [], this.innerDone = 0, this.baseTree = null, this.stoppedAt = null, this.baseParse = n; +const d7 = new lr({ perNode: !0 }); +class qwe { + constructor(e, r, n, i, s) { + this.nest = r, this.input = n, this.fragments = i, this.ranges = s, this.inner = [], this.innerDone = 0, this.baseTree = null, this.stoppedAt = null, this.baseParse = e; } advance() { if (this.baseParse) { - let a = this.baseParse.advance(); - if (!a) + let n = this.baseParse.advance(); + if (!n) return null; - if (this.baseParse = null, this.baseTree = a, this.startInner(), this.stoppedAt != null) - for (let l of this.inner) - l.parse.stopAt(this.stoppedAt); + if (this.baseParse = null, this.baseTree = n, this.startInner(), this.stoppedAt != null) + for (let i of this.inner) + i.parse.stopAt(this.stoppedAt); } if (this.innerDone == this.inner.length) { - let a = this.baseTree; - return this.stoppedAt != null && (a = new tu(a.type, a.children, a.positions, a.length, a.propValues.concat([[SFe, this.stoppedAt]]))), a; + let n = this.baseTree; + return this.stoppedAt != null && (n = new Yr(n.type, n.children, n.positions, n.length, n.propValues.concat([[d7, this.stoppedAt]]))), n; } - let n = this.inner[this.innerDone], s = n.parse.advance(); - if (s) { + let e = this.inner[this.innerDone], r = e.parse.advance(); + if (r) { this.innerDone++; - let a = Object.assign(/* @__PURE__ */ Object.create(null), n.target.props); - a[Ia.mounted.id] = new wK(s, n.overlay, n.parser), n.target.props = a; + let n = Object.assign(/* @__PURE__ */ Object.create(null), e.target.props); + n[lr.mounted.id] = new _y(r, e.overlay, e.parser), e.target.props = n; } return null; } get parsedPos() { if (this.baseParse) return 0; - let n = this.input.length; - for (let s = this.innerDone; s < this.inner.length; s++) - this.inner[s].from < n && (n = Math.min(n, this.inner[s].parse.parsedPos)); - return n; - } - stopAt(n) { - if (this.stoppedAt = n, this.baseParse) - this.baseParse.stopAt(n); + let e = this.input.length; + for (let r = this.innerDone; r < this.inner.length; r++) + this.inner[r].from < e && (e = Math.min(e, this.inner[r].parse.parsedPos)); + return e; + } + stopAt(e) { + if (this.stoppedAt = e, this.baseParse) + this.baseParse.stopAt(e); else - for (let s = this.innerDone; s < this.inner.length; s++) - this.inner[s].parse.stopAt(n); + for (let r = this.innerDone; r < this.inner.length; r++) + this.inner[r].parse.stopAt(e); } startInner() { - let n = new bxn(this.fragments), s = null, a = null, l = new Wbe(new Cg(this.baseTree, this.ranges[0].from, 0, null), fh.IncludeAnonymous | fh.IgnoreMounts); + let e = new Wwe(this.fragments), r = null, n = null, i = new O5(new $s(this.baseTree, this.ranges[0].from, 0, null), un.IncludeAnonymous | un.IgnoreMounts); e: - for (let h, f; ; ) { - let b = !0, w; - if (this.stoppedAt != null && l.from >= this.stoppedAt) - b = !1; - else if (n.hasNode(l)) { - if (s) { - let O = s.mounts.find((S) => S.frag.from <= l.from && S.frag.to >= l.to && S.mount.overlay); - if (O) - for (let S of O.mount.overlay) { - let E = S.from + O.pos, D = S.to + O.pos; - E >= l.from && D <= l.to && !s.ranges.some((M) => M.from < D && M.to > E) && s.ranges.push({ from: E, to: D }); + for (let s, a; ; ) { + let o = !0, l; + if (this.stoppedAt != null && i.from >= this.stoppedAt) + o = !1; + else if (e.hasNode(i)) { + if (r) { + let u = r.mounts.find((h) => h.frag.from <= i.from && h.frag.to >= i.to && h.mount.overlay); + if (u) + for (let h of u.mount.overlay) { + let f = h.from + u.pos, d = h.to + u.pos; + f >= i.from && d <= i.to && !r.ranges.some((p) => p.from < d && p.to > f) && r.ranges.push({ from: f, to: d }); } } - b = !1; - } else if (a && (f = gxn(a.ranges, l.from, l.to))) - b = f != 2; - else if (!l.type.isAnonymous && (h = this.nest(l, this.input)) && (l.from < l.to || !h.overlay)) { - l.tree || mxn(l); - let O = n.findMounts(l.from, h.parser); - if (typeof h.overlay == "function") - s = new dxn(h.parser, h.overlay, O, this.inner.length, l.from, l.tree, s); + o = !1; + } else if (n && (a = Qwe(n.ranges, i.from, i.to))) + o = a != 2; + else if (!i.type.isAnonymous && (s = this.nest(i, this.input)) && (i.from < i.to || !s.overlay)) { + i.tree || Ywe(i); + let u = e.findMounts(i.from, s.parser); + if (typeof s.overlay == "function") + r = new Uwe(s.parser, s.overlay, u, this.inner.length, i.from, i.tree, r); else { - let S = xCt(this.ranges, h.overlay || (l.from < l.to ? [new zy(l.from, l.to)] : [])); - S.length && yCt(S), (S.length || !h.overlay) && this.inner.push(new wCt(h.parser, S.length ? h.parser.startParse(this.input, SCt(O, S), S) : h.parser.startParse(""), h.overlay ? h.overlay.map((E) => new zy(E.from - l.from, E.to - l.from)) : null, l.tree, S.length ? S[0].from : l.from)), h.overlay ? S.length && (a = { ranges: S, depth: 0, prev: a }) : b = !1; + let h = KB(this.ranges, s.overlay || (i.from < i.to ? [new Ro(i.from, i.to)] : [])); + h.length && XB(h), (h.length || !s.overlay) && this.inner.push(new HB(s.parser, h.length ? s.parser.startParse(this.input, JB(u, h), h) : s.parser.startParse(""), s.overlay ? s.overlay.map((f) => new Ro(f.from - i.from, f.to - i.from)) : null, i.tree, h.length ? h[0].from : i.from)), s.overlay ? h.length && (n = { ranges: h, depth: 0, prev: n }) : o = !1; } } else - s && (w = s.predicate(l)) && (w === !0 && (w = new zy(l.from, l.to)), w.from < w.to && s.ranges.push(w)); - if (b && l.firstChild()) - s && s.depth++, a && a.depth++; + r && (l = r.predicate(i)) && (l === !0 && (l = new Ro(i.from, i.to)), l.from < l.to && r.ranges.push(l)); + if (o && i.firstChild()) + r && r.depth++, n && n.depth++; else - for (; !l.nextSibling(); ) { - if (!l.parent()) + for (; !i.nextSibling(); ) { + if (!i.parent()) break e; - if (s && !--s.depth) { - let O = xCt(this.ranges, s.ranges); - O.length && (yCt(O), this.inner.splice(s.index, 0, new wCt(s.parser, s.parser.startParse(this.input, SCt(s.mounts, O), O), s.ranges.map((S) => new zy(S.from - s.start, S.to - s.start)), s.target, O[0].from))), s = s.prev; + if (r && !--r.depth) { + let u = KB(this.ranges, r.ranges); + u.length && (XB(u), this.inner.splice(r.index, 0, new HB(r.parser, r.parser.startParse(this.input, JB(r.mounts, u), u), r.ranges.map((h) => new Ro(h.from - r.start, h.to - r.start)), r.target, u[0].from))), r = r.prev; } - a && !--a.depth && (a = a.prev); + n && !--n.depth && (n = n.prev); } } } } -function gxn(r, n, s) { - for (let a of r) { - if (a.from >= s) +function Qwe(t, e, r) { + for (let n of t) { + if (n.from >= r) break; - if (a.to > n) - return a.from <= n && a.to >= s ? 2 : 1; + if (n.to > e) + return n.from <= e && n.to >= r ? 2 : 1; } return 0; } -function OCt(r, n, s, a, l, h) { - if (n < s) { - let f = r.buffer[n + 1]; - a.push(r.slice(n, s, f)), l.push(f - h); +function ZB(t, e, r, n, i, s) { + if (e < r) { + let a = t.buffer[e + 1]; + n.push(t.slice(e, r, a)), i.push(a - s); } } -function mxn(r) { - let { node: n } = r, s = [], a = n.context.buffer; +function Ywe(t) { + let { node: e } = t, r = [], n = e.context.buffer; do - s.push(r.index), r.parent(); - while (!r.tree); - let l = r.tree, h = l.children.indexOf(a), f = l.children[h], b = f.buffer, w = [h]; - function O(S, E, D, M, B, z) { - let W = s[z], H = [], G = []; - OCt(f, S, W, H, G, M); - let ee = b[W + 1], le = b[W + 2]; - w.push(H.length); - let se = z ? O(W + 4, b[W + 3], f.set.types[b[W]], ee, le - ee, z - 1) : n.toTree(); - return H.push(se), G.push(ee - M), OCt(f, b[W + 3], E, H, G, M), new tu(D, H, G, B); - } - l.children[h] = O(0, b.length, f0.none, 0, f.length, s.length - 1); - for (let S of w) { - let E = r.tree.children[S], D = r.tree.positions[S]; - r.yield(new Cg(E, D + r.from, S, r._tree)); - } -} -class kCt { - constructor(n, s) { - this.offset = s, this.done = !1, this.cursor = n.cursor(fh.IncludeAnonymous | fh.IgnoreMounts); - } - moveTo(n) { - let { cursor: s } = this, a = n - this.offset; - for (; !this.done && s.from < a; ) - s.to >= n && s.enter(a, 1, fh.IgnoreOverlays | fh.ExcludeBuffers) || s.next(!1) || (this.done = !0); - } - hasNode(n) { - if (this.moveTo(n.from), !this.done && this.cursor.from + this.offset == n.from && this.cursor.tree) - for (let s = this.cursor.tree; ; ) { - if (s == n.tree) + r.push(t.index), t.parent(); + while (!t.tree); + let i = t.tree, s = i.children.indexOf(n), a = i.children[s], o = a.buffer, l = [s]; + function u(h, f, d, p, g, m) { + let v = r[m], y = [], b = []; + ZB(a, h, v, y, b, p); + let w = o[v + 1], O = o[v + 2]; + l.push(y.length); + let S = m ? u(v + 4, o[v + 3], a.set.types[o[v]], w, O - w, m - 1) : e.toTree(); + return y.push(S), b.push(w - p), ZB(a, o[v + 3], f, y, b, p), new Yr(d, y, b, g); + } + i.children[s] = u(0, o.length, Li.none, 0, a.length, r.length - 1); + for (let h of l) { + let f = t.tree.children[h], d = t.tree.positions[h]; + t.yield(new $s(f, d + t.from, h, t._tree)); + } +} +class jB { + constructor(e, r) { + this.offset = r, this.done = !1, this.cursor = e.cursor(un.IncludeAnonymous | un.IgnoreMounts); + } + moveTo(e) { + let { cursor: r } = this, n = e - this.offset; + for (; !this.done && r.from < n; ) + r.to >= e && r.enter(n, 1, un.IgnoreOverlays | un.ExcludeBuffers) || r.next(!1) || (this.done = !0); + } + hasNode(e) { + if (this.moveTo(e.from), !this.done && this.cursor.from + this.offset == e.from && this.cursor.tree) + for (let r = this.cursor.tree; ; ) { + if (r == e.tree) return !0; - if (s.children.length && s.positions[0] == 0 && s.children[0] instanceof tu) - s = s.children[0]; + if (r.children.length && r.positions[0] == 0 && r.children[0] instanceof Yr) + r = r.children[0]; else break; } return !1; } } -class bxn { - constructor(n) { - var s; - if (this.fragments = n, this.curTo = 0, this.fragI = 0, n.length) { - let a = this.curFrag = n[0]; - this.curTo = (s = a.tree.prop(SFe)) !== null && s !== void 0 ? s : a.to, this.inner = new kCt(a.tree, -a.offset); +class Wwe { + constructor(e) { + var r; + if (this.fragments = e, this.curTo = 0, this.fragI = 0, e.length) { + let n = this.curFrag = e[0]; + this.curTo = (r = n.tree.prop(d7)) !== null && r !== void 0 ? r : n.to, this.inner = new jB(n.tree, -n.offset); } else this.curFrag = this.inner = null; } - hasNode(n) { - for (; this.curFrag && n.from >= this.curTo; ) + hasNode(e) { + for (; this.curFrag && e.from >= this.curTo; ) this.nextFrag(); - return this.curFrag && this.curFrag.from <= n.from && this.curTo >= n.to && this.inner.hasNode(n); + return this.curFrag && this.curFrag.from <= e.from && this.curTo >= e.to && this.inner.hasNode(e); } nextFrag() { - var n; + var e; if (this.fragI++, this.fragI == this.fragments.length) this.curFrag = this.inner = null; else { - let s = this.curFrag = this.fragments[this.fragI]; - this.curTo = (n = s.tree.prop(SFe)) !== null && n !== void 0 ? n : s.to, this.inner = new kCt(s.tree, -s.offset); + let r = this.curFrag = this.fragments[this.fragI]; + this.curTo = (e = r.tree.prop(d7)) !== null && e !== void 0 ? e : r.to, this.inner = new jB(r.tree, -r.offset); } } - findMounts(n, s) { - var a; - let l = []; + findMounts(e, r) { + var n; + let i = []; if (this.inner) { - this.inner.cursor.moveTo(n, 1); - for (let h = this.inner.cursor.node; h; h = h.parent) { - let f = (a = h.tree) === null || a === void 0 ? void 0 : a.prop(Ia.mounted); - if (f && f.parser == s) - for (let b = this.fragI; b < this.fragments.length; b++) { - let w = this.fragments[b]; - if (w.from >= h.to) + this.inner.cursor.moveTo(e, 1); + for (let s = this.inner.cursor.node; s; s = s.parent) { + let a = (n = s.tree) === null || n === void 0 ? void 0 : n.prop(lr.mounted); + if (a && a.parser == r) + for (let o = this.fragI; o < this.fragments.length; o++) { + let l = this.fragments[o]; + if (l.from >= s.to) break; - w.tree == this.curFrag.tree && l.push({ - frag: w, - pos: h.from - w.offset, - mount: f + l.tree == this.curFrag.tree && i.push({ + frag: l, + pos: s.from - l.offset, + mount: a }); } } } - return l; + return i; } } -function xCt(r, n) { - let s = null, a = n; - for (let l = 1, h = 0; l < r.length; l++) { - let f = r[l - 1].to, b = r[l].from; - for (; h < a.length; h++) { - let w = a[h]; - if (w.from >= b) +function KB(t, e) { + let r = null, n = e; + for (let i = 1, s = 0; i < t.length; i++) { + let a = t[i - 1].to, o = t[i].from; + for (; s < n.length; s++) { + let l = n[s]; + if (l.from >= o) break; - w.to <= f || (s || (a = s = n.slice()), w.from < f ? (s[h] = new zy(w.from, f), w.to > b && s.splice(h + 1, 0, new zy(b, w.to))) : w.to > b ? s[h--] = new zy(b, w.to) : s.splice(h--, 1)); + l.to <= a || (r || (n = r = e.slice()), l.from < a ? (r[s] = new Ro(l.from, a), l.to > o && r.splice(s + 1, 0, new Ro(o, l.to))) : l.to > o ? r[s--] = new Ro(o, l.to) : r.splice(s--, 1)); } } - return a; + return n; } -function vxn(r, n, s, a) { - let l = 0, h = 0, f = !1, b = !1, w = -1e9, O = []; +function Gwe(t, e, r, n) { + let i = 0, s = 0, a = !1, o = !1, l = -1e9, u = []; for (; ; ) { - let S = l == r.length ? 1e9 : f ? r[l].to : r[l].from, E = h == n.length ? 1e9 : b ? n[h].to : n[h].from; - if (f != b) { - let D = Math.max(w, s), M = Math.min(S, E, a); - D < M && O.push(new zy(D, M)); + let h = i == t.length ? 1e9 : a ? t[i].to : t[i].from, f = s == e.length ? 1e9 : o ? e[s].to : e[s].from; + if (a != o) { + let d = Math.max(l, r), p = Math.min(h, f, n); + d < p && u.push(new Ro(d, p)); } - if (w = Math.min(S, E), w == 1e9) + if (l = Math.min(h, f), l == 1e9) break; - S == w && (f ? (f = !1, l++) : f = !0), E == w && (b ? (b = !1, h++) : b = !0); + h == l && (a ? (a = !1, i++) : a = !0), f == l && (o ? (o = !1, s++) : o = !0); } - return O; + return u; } -function SCt(r, n) { - let s = []; - for (let { pos: a, mount: l, frag: h } of r) { - let f = a + (l.overlay ? l.overlay[0].from : 0), b = f + l.tree.length, w = Math.max(h.from, f), O = Math.min(h.to, b); - if (l.overlay) { - let S = l.overlay.map((D) => new zy(D.from + a, D.to + a)), E = vxn(n, S, w, O); - for (let D = 0, M = w; ; D++) { - let B = D == E.length, z = B ? O : E[D].from; - if (z > M && s.push(new K6(M, z, l.tree, -f, h.from >= M || h.openStart, h.to <= z || h.openEnd)), B) +function JB(t, e) { + let r = []; + for (let { pos: n, mount: i, frag: s } of t) { + let a = n + (i.overlay ? i.overlay[0].from : 0), o = a + i.tree.length, l = Math.max(s.from, a), u = Math.min(s.to, o); + if (i.overlay) { + let h = i.overlay.map((d) => new Ro(d.from + n, d.to + n)), f = Gwe(e, h, l, u); + for (let d = 0, p = l; ; d++) { + let g = d == f.length, m = g ? u : f[d].from; + if (m > p && r.push(new Cu(p, m, i.tree, -a, s.from >= p || s.openStart, s.to <= m || s.openEnd)), g) break; - M = E[D].to; + p = f[d].to; } } else - s.push(new K6(w, O, l.tree, -f, h.from >= f || h.openStart, h.to <= b || h.openEnd)); + r.push(new Cu(l, u, i.tree, -a, s.from >= a || s.openStart, s.to <= o || s.openEnd)); } - return s; + return r; } -let wxn = 0; -class nk { - constructor(n, s, a) { - this.set = n, this.base = s, this.modified = a, this.id = wxn++; +let Hwe = 0; +class dl { + constructor(e, r, n) { + this.set = e, this.base = r, this.modified = n, this.id = Hwe++; } - static define(n) { - if (n != null && n.base) + static define(e) { + if (e != null && e.base) throw new Error("Can not derive from a modified tag"); - let s = new nk([], null, []); - if (s.set.push(s), n) - for (let a of n.set) - s.set.push(a); - return s; + let r = new dl([], null, []); + if (r.set.push(r), e) + for (let n of e.set) + r.set.push(n); + return r; } static defineModifier() { - let n = new Ybe(); - return (s) => s.modified.indexOf(n) > -1 ? s : Ybe.get(s.base || s, s.modified.concat(n).sort((a, l) => a.id - l.id)); + let e = new k5(); + return (r) => r.modified.indexOf(e) > -1 ? r : k5.get(r.base || r, r.modified.concat(e).sort((n, i) => n.id - i.id)); } } -let yxn = 0; -class Ybe { +let Xwe = 0; +class k5 { constructor() { - this.instances = [], this.id = yxn++; + this.instances = [], this.id = Xwe++; } - static get(n, s) { - if (!s.length) + static get(e, r) { + if (!r.length) + return e; + let n = r[0].instances.find((o) => o.base == e && Zwe(r, o.modified)); + if (n) return n; - let a = s[0].instances.find((b) => b.base == n && Oxn(s, b.modified)); - if (a) - return a; - let l = [], h = new nk(l, n, s); - for (let b of s) - b.instances.push(h); - let f = kxn(s); - for (let b of n.set) - if (!b.modified.length) - for (let w of f) - l.push(Ybe.get(b, w)); - return h; + let i = [], s = new dl(i, e, r); + for (let o of r) + o.instances.push(s); + let a = jwe(r); + for (let o of e.set) + if (!o.modified.length) + for (let l of a) + i.push(k5.get(o, l)); + return s; } } -function Oxn(r, n) { - return r.length == n.length && r.every((s, a) => s == n[a]); -} -function kxn(r) { - let n = [[]]; - for (let s = 0; s < r.length; s++) - for (let a = 0, l = n.length; a < l; a++) - n.push(n[a].concat(r[s])); - return n.sort((s, a) => a.length - s.length); -} -function GF(r) { - let n = /* @__PURE__ */ Object.create(null); - for (let s in r) { - let a = r[s]; - Array.isArray(a) || (a = [a]); - for (let l of s.split(" ")) - if (l) { - let h = [], f = 2, b = l; - for (let E = 0; ; ) { - if (b == "..." && E > 0 && E + 3 == l.length) { - f = 1; +function Zwe(t, e) { + return t.length == e.length && t.every((r, n) => r == e[n]); +} +function jwe(t) { + let e = [[]]; + for (let r = 0; r < t.length; r++) + for (let n = 0, i = e.length; n < i; n++) + e.push(e[n].concat(t[r])); + return e.sort((r, n) => n.length - r.length); +} +function N1(t) { + let e = /* @__PURE__ */ Object.create(null); + for (let r in t) { + let n = t[r]; + Array.isArray(n) || (n = [n]); + for (let i of r.split(" ")) + if (i) { + let s = [], a = 2, o = i; + for (let f = 0; ; ) { + if (o == "..." && f > 0 && f + 3 == i.length) { + a = 1; break; } - let D = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(b); - if (!D) - throw new RangeError("Invalid path: " + l); - if (h.push(D[0] == "*" ? "" : D[0][0] == '"' ? JSON.parse(D[0]) : D[0]), E += D[0].length, E == l.length) + let d = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o); + if (!d) + throw new RangeError("Invalid path: " + i); + if (s.push(d[0] == "*" ? "" : d[0][0] == '"' ? JSON.parse(d[0]) : d[0]), f += d[0].length, f == i.length) break; - let M = l[E++]; - if (E == l.length && M == "!") { - f = 0; + let p = i[f++]; + if (f == i.length && p == "!") { + a = 0; break; } - if (M != "/") - throw new RangeError("Invalid path: " + l); - b = l.slice(E); + if (p != "/") + throw new RangeError("Invalid path: " + i); + o = i.slice(f); } - let w = h.length - 1, O = h[w]; - if (!O) - throw new RangeError("Invalid path: " + l); - let S = new Hbe(a, f, w > 0 ? h.slice(0, w) : null); - n[O] = S.sort(n[O]); + let l = s.length - 1, u = s[l]; + if (!u) + throw new RangeError("Invalid path: " + i); + let h = new S5(n, a, l > 0 ? s.slice(0, l) : null); + e[u] = h.sort(e[u]); } } - return cPt.add(n); + return wK.add(e); } -const cPt = new Ia(); -class Hbe { - constructor(n, s, a, l) { - this.tags = n, this.mode = s, this.context = a, this.next = l; +const wK = new lr(); +class S5 { + constructor(e, r, n, i) { + this.tags = e, this.mode = r, this.context = n, this.next = i; } get opaque() { return this.mode == 0; @@ -11531,436 +11540,436 @@ class Hbe { get inherit() { return this.mode == 1; } - sort(n) { - return !n || n.depth < this.depth ? (this.next = n, this) : (n.next = this.sort(n.next), n); + sort(e) { + return !e || e.depth < this.depth ? (this.next = e, this) : (e.next = this.sort(e.next), e); } get depth() { return this.context ? this.context.length : 0; } } -Hbe.empty = new Hbe([], 2, null); -function lPt(r, n) { - let s = /* @__PURE__ */ Object.create(null); - for (let h of r) - if (!Array.isArray(h.tag)) - s[h.tag.id] = h.class; +S5.empty = new S5([], 2, null); +function OK(t, e) { + let r = /* @__PURE__ */ Object.create(null); + for (let s of t) + if (!Array.isArray(s.tag)) + r[s.tag.id] = s.class; else - for (let f of h.tag) - s[f.id] = h.class; - let { scope: a, all: l = null } = n || {}; + for (let a of s.tag) + r[a.id] = s.class; + let { scope: n, all: i = null } = e || {}; return { - style: (h) => { - let f = l; - for (let b of h) - for (let w of b.set) { - let O = s[w.id]; - if (O) { - f = f ? f + " " + O : O; + style: (s) => { + let a = i; + for (let o of s) + for (let l of o.set) { + let u = r[l.id]; + if (u) { + a = a ? a + " " + u : u; break; } } - return f; + return a; }, - scope: a + scope: n }; } -function xxn(r, n) { - let s = null; - for (let a of r) { - let l = a.style(n); - l && (s = s ? s + " " + l : l); +function Kwe(t, e) { + let r = null; + for (let n of t) { + let i = n.style(e); + i && (r = r ? r + " " + i : i); } - return s; + return r; } -function Sxn(r, n, s, a = 0, l = r.length) { - let h = new _xn(a, Array.isArray(n) ? n : [n], s); - h.highlightRange(r.cursor(), a, l, "", h.highlighters), h.flush(l); +function Jwe(t, e, r, n = 0, i = t.length) { + let s = new eOe(n, Array.isArray(e) ? e : [e], r); + s.highlightRange(t.cursor(), n, i, "", s.highlighters), s.flush(i); } -class _xn { - constructor(n, s, a) { - this.at = n, this.highlighters = s, this.span = a, this.class = ""; +class eOe { + constructor(e, r, n) { + this.at = e, this.highlighters = r, this.span = n, this.class = ""; } - startSpan(n, s) { - s != this.class && (this.flush(n), n > this.at && (this.at = n), this.class = s); + startSpan(e, r) { + r != this.class && (this.flush(e), e > this.at && (this.at = e), this.class = r); } - flush(n) { - n > this.at && this.class && this.span(this.at, n, this.class); + flush(e) { + e > this.at && this.class && this.span(this.at, e, this.class); } - highlightRange(n, s, a, l, h) { - let { type: f, from: b, to: w } = n; - if (b >= a || w <= s) + highlightRange(e, r, n, i, s) { + let { type: a, from: o, to: l } = e; + if (o >= n || l <= r) return; - f.isTop && (h = this.highlighters.filter((M) => !M.scope || M.scope(f))); - let O = l, S = Cxn(n) || Hbe.empty, E = xxn(h, S.tags); - if (E && (O && (O += " "), O += E, S.mode == 1 && (l += (l ? " " : "") + E)), this.startSpan(Math.max(s, b), O), S.opaque) + a.isTop && (s = this.highlighters.filter((p) => !p.scope || p.scope(a))); + let u = i, h = tOe(e) || S5.empty, f = Kwe(s, h.tags); + if (f && (u && (u += " "), u += f, h.mode == 1 && (i += (i ? " " : "") + f)), this.startSpan(Math.max(r, o), u), h.opaque) return; - let D = n.tree && n.tree.prop(Ia.mounted); - if (D && D.overlay) { - let M = n.node.enter(D.overlay[0].from + b, 1), B = this.highlighters.filter((W) => !W.scope || W.scope(D.tree.type)), z = n.firstChild(); - for (let W = 0, H = b; ; W++) { - let G = W < D.overlay.length ? D.overlay[W] : null, ee = G ? G.from + b : w, le = Math.max(s, H), se = Math.min(a, ee); - if (le < se && z) - for (; n.from < se && (this.highlightRange(n, le, se, l, h), this.startSpan(Math.min(se, n.to), O), !(n.to >= ee || !n.nextSibling())); ) + let d = e.tree && e.tree.prop(lr.mounted); + if (d && d.overlay) { + let p = e.node.enter(d.overlay[0].from + o, 1), g = this.highlighters.filter((v) => !v.scope || v.scope(d.tree.type)), m = e.firstChild(); + for (let v = 0, y = o; ; v++) { + let b = v < d.overlay.length ? d.overlay[v] : null, w = b ? b.from + o : l, O = Math.max(r, y), S = Math.min(n, w); + if (O < S && m) + for (; e.from < S && (this.highlightRange(e, O, S, i, s), this.startSpan(Math.min(S, e.to), u), !(e.to >= w || !e.nextSibling())); ) ; - if (!G || ee > a) + if (!b || w > n) break; - H = G.to + b, H > s && (this.highlightRange(M.cursor(), Math.max(s, G.from + b), Math.min(a, H), "", B), this.startSpan(Math.min(a, H), O)); + y = b.to + o, y > r && (this.highlightRange(p.cursor(), Math.max(r, b.from + o), Math.min(n, y), "", g), this.startSpan(Math.min(n, y), u)); } - z && n.parent(); - } else if (n.firstChild()) { - D && (l = ""); + m && e.parent(); + } else if (e.firstChild()) { + d && (i = ""); do - if (!(n.to <= s)) { - if (n.from >= a) + if (!(e.to <= r)) { + if (e.from >= n) break; - this.highlightRange(n, s, a, l, h), this.startSpan(Math.min(a, n.to), O); - } - while (n.nextSibling()); - n.parent(); - } - } -} -function Cxn(r) { - let n = r.type.prop(cPt); - for (; n && n.context && !r.matchContext(n.context); ) - n = n.next; - return n || null; -} -const Yi = nk.define, Hge = Yi(), QT = Yi(), _Ct = Yi(QT), CCt = Yi(QT), zT = Yi(), Gge = Yi(zT), CRe = Yi(zT), j4 = Yi(), OM = Yi(j4), N4 = Yi(), R4 = Yi(), _Fe = Yi(), XZ = Yi(_Fe), Zge = Yi(), Ft = { - comment: Hge, - lineComment: Yi(Hge), - blockComment: Yi(Hge), - docComment: Yi(Hge), - name: QT, - variableName: Yi(QT), - typeName: _Ct, - tagName: Yi(_Ct), - propertyName: CCt, - attributeName: Yi(CCt), - className: Yi(QT), - labelName: Yi(QT), - namespace: Yi(QT), - macroName: Yi(QT), - literal: zT, - string: Gge, - docString: Yi(Gge), - character: Yi(Gge), - attributeValue: Yi(Gge), - number: CRe, - integer: Yi(CRe), - float: Yi(CRe), - bool: Yi(zT), - regexp: Yi(zT), - escape: Yi(zT), - color: Yi(zT), - url: Yi(zT), - keyword: N4, - self: Yi(N4), - null: Yi(N4), - atom: Yi(N4), - unit: Yi(N4), - modifier: Yi(N4), - operatorKeyword: Yi(N4), - controlKeyword: Yi(N4), - definitionKeyword: Yi(N4), - moduleKeyword: Yi(N4), - operator: R4, - derefOperator: Yi(R4), - arithmeticOperator: Yi(R4), - logicOperator: Yi(R4), - bitwiseOperator: Yi(R4), - compareOperator: Yi(R4), - updateOperator: Yi(R4), - definitionOperator: Yi(R4), - typeOperator: Yi(R4), - controlOperator: Yi(R4), - punctuation: _Fe, - separator: Yi(_Fe), - bracket: XZ, - angleBracket: Yi(XZ), - squareBracket: Yi(XZ), - paren: Yi(XZ), - brace: Yi(XZ), - content: j4, - heading: OM, - heading1: Yi(OM), - heading2: Yi(OM), - heading3: Yi(OM), - heading4: Yi(OM), - heading5: Yi(OM), - heading6: Yi(OM), - contentSeparator: Yi(j4), - list: Yi(j4), - quote: Yi(j4), - emphasis: Yi(j4), - strong: Yi(j4), - link: Yi(j4), - monospace: Yi(j4), - strikethrough: Yi(j4), - inserted: Yi(), - deleted: Yi(), - changed: Yi(), - invalid: Yi(), - meta: Zge, - documentMeta: Yi(Zge), - annotation: Yi(Zge), - processingInstruction: Yi(Zge), - definition: nk.defineModifier(), - constant: nk.defineModifier(), - function: nk.defineModifier(), - standard: nk.defineModifier(), - local: nk.defineModifier(), - special: nk.defineModifier() -}; -lPt([ - { tag: Ft.link, class: "tok-link" }, - { tag: Ft.heading, class: "tok-heading" }, - { tag: Ft.emphasis, class: "tok-emphasis" }, - { tag: Ft.strong, class: "tok-strong" }, - { tag: Ft.keyword, class: "tok-keyword" }, - { tag: Ft.atom, class: "tok-atom" }, - { tag: Ft.bool, class: "tok-bool" }, - { tag: Ft.url, class: "tok-url" }, - { tag: Ft.labelName, class: "tok-labelName" }, - { tag: Ft.inserted, class: "tok-inserted" }, - { tag: Ft.deleted, class: "tok-deleted" }, - { tag: Ft.literal, class: "tok-literal" }, - { tag: Ft.string, class: "tok-string" }, - { tag: Ft.number, class: "tok-number" }, - { tag: [Ft.regexp, Ft.escape, Ft.special(Ft.string)], class: "tok-string2" }, - { tag: Ft.variableName, class: "tok-variableName" }, - { tag: Ft.local(Ft.variableName), class: "tok-variableName tok-local" }, - { tag: Ft.definition(Ft.variableName), class: "tok-variableName tok-definition" }, - { tag: Ft.special(Ft.variableName), class: "tok-variableName2" }, - { tag: Ft.definition(Ft.propertyName), class: "tok-propertyName tok-definition" }, - { tag: Ft.typeName, class: "tok-typeName" }, - { tag: Ft.namespace, class: "tok-namespace" }, - { tag: Ft.className, class: "tok-className" }, - { tag: Ft.macroName, class: "tok-macroName" }, - { tag: Ft.propertyName, class: "tok-propertyName" }, - { tag: Ft.operator, class: "tok-operator" }, - { tag: Ft.comment, class: "tok-comment" }, - { tag: Ft.meta, class: "tok-meta" }, - { tag: Ft.invalid, class: "tok-invalid" }, - { tag: Ft.punctuation, class: "tok-punctuation" } + this.highlightRange(e, r, n, i, s), this.startSpan(Math.min(n, e.to), u); + } + while (e.nextSibling()); + e.parent(); + } + } +} +function tOe(t) { + let e = t.type.prop(wK); + for (; e && e.context && !t.matchContext(e.context); ) + e = e.next; + return e || null; +} +const xt = dl.define, Ow = xt(), Oh = xt(), eF = xt(Oh), tF = xt(Oh), kh = xt(), kw = xt(kh), wE = xt(kh), nc = xt(), Xf = xt(nc), Kl = xt(), Jl = xt(), p7 = xt(), Am = xt(p7), Sw = xt(), Se = { + comment: Ow, + lineComment: xt(Ow), + blockComment: xt(Ow), + docComment: xt(Ow), + name: Oh, + variableName: xt(Oh), + typeName: eF, + tagName: xt(eF), + propertyName: tF, + attributeName: xt(tF), + className: xt(Oh), + labelName: xt(Oh), + namespace: xt(Oh), + macroName: xt(Oh), + literal: kh, + string: kw, + docString: xt(kw), + character: xt(kw), + attributeValue: xt(kw), + number: wE, + integer: xt(wE), + float: xt(wE), + bool: xt(kh), + regexp: xt(kh), + escape: xt(kh), + color: xt(kh), + url: xt(kh), + keyword: Kl, + self: xt(Kl), + null: xt(Kl), + atom: xt(Kl), + unit: xt(Kl), + modifier: xt(Kl), + operatorKeyword: xt(Kl), + controlKeyword: xt(Kl), + definitionKeyword: xt(Kl), + moduleKeyword: xt(Kl), + operator: Jl, + derefOperator: xt(Jl), + arithmeticOperator: xt(Jl), + logicOperator: xt(Jl), + bitwiseOperator: xt(Jl), + compareOperator: xt(Jl), + updateOperator: xt(Jl), + definitionOperator: xt(Jl), + typeOperator: xt(Jl), + controlOperator: xt(Jl), + punctuation: p7, + separator: xt(p7), + bracket: Am, + angleBracket: xt(Am), + squareBracket: xt(Am), + paren: xt(Am), + brace: xt(Am), + content: nc, + heading: Xf, + heading1: xt(Xf), + heading2: xt(Xf), + heading3: xt(Xf), + heading4: xt(Xf), + heading5: xt(Xf), + heading6: xt(Xf), + contentSeparator: xt(nc), + list: xt(nc), + quote: xt(nc), + emphasis: xt(nc), + strong: xt(nc), + link: xt(nc), + monospace: xt(nc), + strikethrough: xt(nc), + inserted: xt(), + deleted: xt(), + changed: xt(), + invalid: xt(), + meta: Sw, + documentMeta: xt(Sw), + annotation: xt(Sw), + processingInstruction: xt(Sw), + definition: dl.defineModifier(), + constant: dl.defineModifier(), + function: dl.defineModifier(), + standard: dl.defineModifier(), + local: dl.defineModifier(), + special: dl.defineModifier() +}; +OK([ + { tag: Se.link, class: "tok-link" }, + { tag: Se.heading, class: "tok-heading" }, + { tag: Se.emphasis, class: "tok-emphasis" }, + { tag: Se.strong, class: "tok-strong" }, + { tag: Se.keyword, class: "tok-keyword" }, + { tag: Se.atom, class: "tok-atom" }, + { tag: Se.bool, class: "tok-bool" }, + { tag: Se.url, class: "tok-url" }, + { tag: Se.labelName, class: "tok-labelName" }, + { tag: Se.inserted, class: "tok-inserted" }, + { tag: Se.deleted, class: "tok-deleted" }, + { tag: Se.literal, class: "tok-literal" }, + { tag: Se.string, class: "tok-string" }, + { tag: Se.number, class: "tok-number" }, + { tag: [Se.regexp, Se.escape, Se.special(Se.string)], class: "tok-string2" }, + { tag: Se.variableName, class: "tok-variableName" }, + { tag: Se.local(Se.variableName), class: "tok-variableName tok-local" }, + { tag: Se.definition(Se.variableName), class: "tok-variableName tok-definition" }, + { tag: Se.special(Se.variableName), class: "tok-variableName2" }, + { tag: Se.definition(Se.propertyName), class: "tok-propertyName tok-definition" }, + { tag: Se.typeName, class: "tok-typeName" }, + { tag: Se.namespace, class: "tok-namespace" }, + { tag: Se.className, class: "tok-className" }, + { tag: Se.macroName, class: "tok-macroName" }, + { tag: Se.propertyName, class: "tok-propertyName" }, + { tag: Se.operator, class: "tok-operator" }, + { tag: Se.comment, class: "tok-comment" }, + { tag: Se.meta, class: "tok-meta" }, + { tag: Se.invalid, class: "tok-invalid" }, + { tag: Se.punctuation, class: "tok-punctuation" } ]); -var ERe; -const zM = /* @__PURE__ */ new Ia(); -function wze(r) { - return us.define({ - combine: r ? (n) => n.concat(r) : void 0 +var OE; +const Ed = /* @__PURE__ */ new lr(); +function YR(t) { + return _t.define({ + combine: t ? (e) => e.concat(t) : void 0 }); } -const yze = /* @__PURE__ */ new Ia(); -class qy { - constructor(n, s, a = [], l = "") { - this.data = n, this.name = l, Ga.prototype.hasOwnProperty("tree") || Object.defineProperty(Ga.prototype, "tree", { get() { - return dh(this); - } }), this.parser = s, this.extension = [ - m8.of(this), - Ga.languageData.of((h, f, b) => { - let w = ECt(h, f, b), O = w.type.prop(zM); - if (!O) +const WR = /* @__PURE__ */ new lr(); +class Mo { + constructor(e, r, n = [], i = "") { + this.data = e, this.name = i, dr.prototype.hasOwnProperty("tree") || Object.defineProperty(dr.prototype, "tree", { get() { + return fn(this); + } }), this.parser = r, this.extension = [ + lf.of(this), + dr.languageData.of((s, a, o) => { + let l = rF(s, a, o), u = l.type.prop(Ed); + if (!u) return []; - let S = h.facet(O), E = w.type.prop(yze); - if (E) { - let D = w.resolve(f - w.from, b); - for (let M of E) - if (M.test(D, h)) { - let B = h.facet(M.facet); - return M.type == "replace" ? B : B.concat(S); + let h = s.facet(u), f = l.type.prop(WR); + if (f) { + let d = l.resolve(a - l.from, o); + for (let p of f) + if (p.test(d, s)) { + let g = s.facet(p.facet); + return p.type == "replace" ? g : g.concat(h); } } - return S; + return h; }) - ].concat(a); + ].concat(n); } - isActiveAt(n, s, a = -1) { - return ECt(n, s, a).type.prop(zM) == this.data; + isActiveAt(e, r, n = -1) { + return rF(e, r, n).type.prop(Ed) == this.data; } - findRegions(n) { - let s = n.facet(m8); - if ((s == null ? void 0 : s.data) == this.data) - return [{ from: 0, to: n.doc.length }]; - if (!s || !s.allowsNesting) + findRegions(e) { + let r = e.facet(lf); + if ((r == null ? void 0 : r.data) == this.data) + return [{ from: 0, to: e.doc.length }]; + if (!r || !r.allowsNesting) return []; - let a = [], l = (h, f) => { - if (h.prop(zM) == this.data) { - a.push({ from: f, to: f + h.length }); + let n = [], i = (s, a) => { + if (s.prop(Ed) == this.data) { + n.push({ from: a, to: a + s.length }); return; } - let b = h.prop(Ia.mounted); - if (b) { - if (b.tree.prop(zM) == this.data) { - if (b.overlay) - for (let w of b.overlay) - a.push({ from: w.from + f, to: w.to + f }); + let o = s.prop(lr.mounted); + if (o) { + if (o.tree.prop(Ed) == this.data) { + if (o.overlay) + for (let l of o.overlay) + n.push({ from: l.from + a, to: l.to + a }); else - a.push({ from: f, to: f + h.length }); + n.push({ from: a, to: a + s.length }); return; - } else if (b.overlay) { - let w = a.length; - if (l(b.tree, b.overlay[0].from + f), a.length > w) + } else if (o.overlay) { + let l = n.length; + if (i(o.tree, o.overlay[0].from + a), n.length > l) return; } } - for (let w = 0; w < h.children.length; w++) { - let O = h.children[w]; - O instanceof tu && l(O, h.positions[w] + f); + for (let l = 0; l < s.children.length; l++) { + let u = s.children[l]; + u instanceof Yr && i(u, s.positions[l] + a); } }; - return l(dh(n), 0), a; + return i(fn(e), 0), n; } get allowsNesting() { return !0; } } -qy.setState = /* @__PURE__ */ $o.define(); -function ECt(r, n, s) { - let a = r.facet(m8), l = dh(r).topNode; - if (!a || a.allowsNesting) - for (let h = l; h; h = h.enter(n, s, fh.ExcludeBuffers)) - h.type.isTop && (l = h); - return l; +Mo.setState = /* @__PURE__ */ Zt.define(); +function rF(t, e, r) { + let n = t.facet(lf), i = fn(t).topNode; + if (!n || n.allowsNesting) + for (let s = i; s; s = s.enter(e, r, un.ExcludeBuffers)) + s.type.isTop && (i = s); + return i; } -class oF extends qy { - constructor(n, s, a) { - super(n, s, [], a), this.parser = s; +class _g extends Mo { + constructor(e, r, n) { + super(e, r, [], n), this.parser = r; } - static define(n) { - let s = wze(n.languageData); - return new oF(s, n.parser.configure({ - props: [zM.add((a) => a.isTop ? s : void 0)] - }), n.name); + static define(e) { + let r = YR(e.languageData); + return new _g(r, e.parser.configure({ + props: [Ed.add((n) => n.isTop ? r : void 0)] + }), e.name); } - configure(n, s) { - return new oF(this.data, this.parser.configure(n), s || this.name); + configure(e, r) { + return new _g(this.data, this.parser.configure(e), r || this.name); } get allowsNesting() { return this.parser.hasWrappers(); } } -function dh(r) { - let n = r.field(qy.state, !1); - return n ? n.tree : tu.empty; +function fn(t) { + let e = t.field(Mo.state, !1); + return e ? e.tree : Yr.empty; } -class Exn { - constructor(n) { - this.doc = n, this.cursorPos = 0, this.string = "", this.cursor = n.iter(); +class rOe { + constructor(e) { + this.doc = e, this.cursorPos = 0, this.string = "", this.cursor = e.iter(); } get length() { return this.doc.length; } - syncTo(n) { - return this.string = this.cursor.next(n - this.cursorPos).value, this.cursorPos = n + this.string.length, this.cursorPos - this.string.length; + syncTo(e) { + return this.string = this.cursor.next(e - this.cursorPos).value, this.cursorPos = e + this.string.length, this.cursorPos - this.string.length; } - chunk(n) { - return this.syncTo(n), this.string; + chunk(e) { + return this.syncTo(e), this.string; } get lineChunks() { return !0; } - read(n, s) { - let a = this.cursorPos - this.string.length; - return n < a || s >= this.cursorPos ? this.doc.sliceString(n, s) : this.string.slice(n - a, s - a); + read(e, r) { + let n = this.cursorPos - this.string.length; + return e < n || r >= this.cursorPos ? this.doc.sliceString(e, r) : this.string.slice(e - n, r - n); } } -let KZ = null; -class OK { - constructor(n, s, a = [], l, h, f, b, w) { - this.parser = n, this.state = s, this.fragments = a, this.tree = l, this.treeLen = h, this.viewport = f, this.skipped = b, this.scheduleOn = w, this.parse = null, this.tempSkipped = []; +let Lm = null; +class Ly { + constructor(e, r, n = [], i, s, a, o, l) { + this.parser = e, this.state = r, this.fragments = n, this.tree = i, this.treeLen = s, this.viewport = a, this.skipped = o, this.scheduleOn = l, this.parse = null, this.tempSkipped = []; } - static create(n, s, a) { - return new OK(n, s, [], tu.empty, 0, a, [], null); + static create(e, r, n) { + return new Ly(e, r, [], Yr.empty, 0, n, [], null); } startParse() { - return this.parser.startParse(new Exn(this.state.doc), this.fragments); - } - work(n, s) { - return s != null && s >= this.state.doc.length && (s = void 0), this.tree != tu.empty && this.isDone(s != null ? s : this.state.doc.length) ? (this.takeTree(), !0) : this.withContext(() => { - var a; - if (typeof n == "number") { - let l = Date.now() + n; - n = () => Date.now() > l; - } - for (this.parse || (this.parse = this.startParse()), s != null && (this.parse.stoppedAt == null || this.parse.stoppedAt > s) && s < this.state.doc.length && this.parse.stopAt(s); ; ) { - let l = this.parse.advance(); - if (l) - if (this.fragments = this.withoutTempSkipped(K6.addTree(l, this.fragments, this.parse.stoppedAt != null)), this.treeLen = (a = this.parse.stoppedAt) !== null && a !== void 0 ? a : this.state.doc.length, this.tree = l, this.parse = null, this.treeLen < (s != null ? s : this.state.doc.length)) + return this.parser.startParse(new rOe(this.state.doc), this.fragments); + } + work(e, r) { + return r != null && r >= this.state.doc.length && (r = void 0), this.tree != Yr.empty && this.isDone(r != null ? r : this.state.doc.length) ? (this.takeTree(), !0) : this.withContext(() => { + var n; + if (typeof e == "number") { + let i = Date.now() + e; + e = () => Date.now() > i; + } + for (this.parse || (this.parse = this.startParse()), r != null && (this.parse.stoppedAt == null || this.parse.stoppedAt > r) && r < this.state.doc.length && this.parse.stopAt(r); ; ) { + let i = this.parse.advance(); + if (i) + if (this.fragments = this.withoutTempSkipped(Cu.addTree(i, this.fragments, this.parse.stoppedAt != null)), this.treeLen = (n = this.parse.stoppedAt) !== null && n !== void 0 ? n : this.state.doc.length, this.tree = i, this.parse = null, this.treeLen < (r != null ? r : this.state.doc.length)) this.parse = this.startParse(); else return !0; - if (n()) + if (e()) return !1; } }); } takeTree() { - let n, s; - this.parse && (n = this.parse.parsedPos) >= this.treeLen && ((this.parse.stoppedAt == null || this.parse.stoppedAt > n) && this.parse.stopAt(n), this.withContext(() => { - for (; !(s = this.parse.advance()); ) + let e, r; + this.parse && (e = this.parse.parsedPos) >= this.treeLen && ((this.parse.stoppedAt == null || this.parse.stoppedAt > e) && this.parse.stopAt(e), this.withContext(() => { + for (; !(r = this.parse.advance()); ) ; - }), this.treeLen = n, this.tree = s, this.fragments = this.withoutTempSkipped(K6.addTree(this.tree, this.fragments, !0)), this.parse = null); + }), this.treeLen = e, this.tree = r, this.fragments = this.withoutTempSkipped(Cu.addTree(this.tree, this.fragments, !0)), this.parse = null); } - withContext(n) { - let s = KZ; - KZ = this; + withContext(e) { + let r = Lm; + Lm = this; try { - return n(); + return e(); } finally { - KZ = s; + Lm = r; } } - withoutTempSkipped(n) { - for (let s; s = this.tempSkipped.pop(); ) - n = TCt(n, s.from, s.to); - return n; + withoutTempSkipped(e) { + for (let r; r = this.tempSkipped.pop(); ) + e = nF(e, r.from, r.to); + return e; } - changes(n, s) { - let { fragments: a, tree: l, treeLen: h, viewport: f, skipped: b } = this; - if (this.takeTree(), !n.empty) { - let w = []; - if (n.iterChangedRanges((O, S, E, D) => w.push({ fromA: O, toA: S, fromB: E, toB: D })), a = K6.applyChanges(a, w), l = tu.empty, h = 0, f = { from: n.mapPos(f.from, -1), to: n.mapPos(f.to, 1) }, this.skipped.length) { - b = []; - for (let O of this.skipped) { - let S = n.mapPos(O.from, 1), E = n.mapPos(O.to, -1); - S < E && b.push({ from: S, to: E }); + changes(e, r) { + let { fragments: n, tree: i, treeLen: s, viewport: a, skipped: o } = this; + if (this.takeTree(), !e.empty) { + let l = []; + if (e.iterChangedRanges((u, h, f, d) => l.push({ fromA: u, toA: h, fromB: f, toB: d })), n = Cu.applyChanges(n, l), i = Yr.empty, s = 0, a = { from: e.mapPos(a.from, -1), to: e.mapPos(a.to, 1) }, this.skipped.length) { + o = []; + for (let u of this.skipped) { + let h = e.mapPos(u.from, 1), f = e.mapPos(u.to, -1); + h < f && o.push({ from: h, to: f }); } } } - return new OK(this.parser, s, a, l, h, f, b, this.scheduleOn); + return new Ly(this.parser, r, n, i, s, a, o, this.scheduleOn); } - updateViewport(n) { - if (this.viewport.from == n.from && this.viewport.to == n.to) + updateViewport(e) { + if (this.viewport.from == e.from && this.viewport.to == e.to) return !1; - this.viewport = n; - let s = this.skipped.length; - for (let a = 0; a < this.skipped.length; a++) { - let { from: l, to: h } = this.skipped[a]; - l < n.to && h > n.from && (this.fragments = TCt(this.fragments, l, h), this.skipped.splice(a--, 1)); + this.viewport = e; + let r = this.skipped.length; + for (let n = 0; n < this.skipped.length; n++) { + let { from: i, to: s } = this.skipped[n]; + i < e.to && s > e.from && (this.fragments = nF(this.fragments, i, s), this.skipped.splice(n--, 1)); } - return this.skipped.length >= s ? !1 : (this.reset(), !0); + return this.skipped.length >= r ? !1 : (this.reset(), !0); } reset() { this.parse && (this.takeTree(), this.parse = null); } - skipUntilInView(n, s) { - this.skipped.push({ from: n, to: s }); + skipUntilInView(e, r) { + this.skipped.push({ from: e, to: r }); } - static getSkippingParser(n) { - return new class extends vze { - createParse(s, a, l) { - let h = l[0].from, f = l[l.length - 1].to; + static getSkippingParser(e) { + return new class extends QR { + createParse(r, n, i) { + let s = i[0].from, a = i[i.length - 1].to; return { - parsedPos: h, + parsedPos: s, advance() { - let w = KZ; - if (w) { - for (let O of l) - w.tempSkipped.push(O); - n && (w.scheduleOn = w.scheduleOn ? Promise.all([w.scheduleOn, n]) : n); + let l = Lm; + if (l) { + for (let u of i) + l.tempSkipped.push(u); + e && (l.scheduleOn = l.scheduleOn ? Promise.all([l.scheduleOn, e]) : e); } - return this.parsedPos = f, new tu(f0.none, [], [], f - h); + return this.parsedPos = a, new Yr(Li.none, [], [], a - s); }, stoppedAt: null, stopAt() { @@ -11969,79 +11978,79 @@ class OK { } }(); } - isDone(n) { - n = Math.min(n, this.state.doc.length); - let s = this.fragments; - return this.treeLen >= n && s.length && s[0].from == 0 && s[0].to >= n; + isDone(e) { + e = Math.min(e, this.state.doc.length); + let r = this.fragments; + return this.treeLen >= e && r.length && r[0].from == 0 && r[0].to >= e; } static get() { - return KZ; + return Lm; } } -function TCt(r, n, s) { - return K6.applyChanges(r, [{ fromA: n, toA: s, fromB: n, toB: s }]); +function nF(t, e, r) { + return Cu.applyChanges(t, [{ fromA: e, toA: r, fromB: e, toB: r }]); } -class aF { - constructor(n) { - this.context = n, this.tree = n.tree; +class Ag { + constructor(e) { + this.context = e, this.tree = e.tree; } - apply(n) { - if (!n.docChanged && this.tree == this.context.tree) + apply(e) { + if (!e.docChanged && this.tree == this.context.tree) return this; - let s = this.context.changes(n.changes, n.state), a = this.context.treeLen == n.startState.doc.length ? void 0 : Math.max(n.changes.mapPos(this.context.treeLen), s.viewport.to); - return s.work(20, a) || s.takeTree(), new aF(s); + let r = this.context.changes(e.changes, e.state), n = this.context.treeLen == e.startState.doc.length ? void 0 : Math.max(e.changes.mapPos(this.context.treeLen), r.viewport.to); + return r.work(20, n) || r.takeTree(), new Ag(r); } - static init(n) { - let s = Math.min(3e3, n.doc.length), a = OK.create(n.facet(m8).parser, n, { from: 0, to: s }); - return a.work(20, s) || a.takeTree(), new aF(a); + static init(e) { + let r = Math.min(3e3, e.doc.length), n = Ly.create(e.facet(lf).parser, e, { from: 0, to: r }); + return n.work(20, r) || n.takeTree(), new Ag(n); } } -qy.state = /* @__PURE__ */ Ef.define({ - create: aF.init, - update(r, n) { - for (let s of n.effects) - if (s.is(qy.setState)) - return s.value; - return n.startState.facet(m8) != n.state.facet(m8) ? aF.init(n.state) : r.apply(n); +Mo.state = /* @__PURE__ */ Pn.define({ + create: Ag.init, + update(t, e) { + for (let r of e.effects) + if (r.is(Mo.setState)) + return r.value; + return e.startState.facet(lf) != e.state.facet(lf) ? Ag.init(e.state) : t.apply(e); } }); -let uPt = (r) => { - let n = setTimeout(() => r(), 500); - return () => clearTimeout(n); +let kK = (t) => { + let e = setTimeout(() => t(), 500); + return () => clearTimeout(e); }; -typeof requestIdleCallback < "u" && (uPt = (r) => { - let n = -1, s = setTimeout(() => { - n = requestIdleCallback(r, { timeout: 500 - 100 }); +typeof requestIdleCallback < "u" && (kK = (t) => { + let e = -1, r = setTimeout(() => { + e = requestIdleCallback(t, { timeout: 500 - 100 }); }, 100); - return () => n < 0 ? clearTimeout(s) : cancelIdleCallback(n); + return () => e < 0 ? clearTimeout(r) : cancelIdleCallback(e); }); -const TRe = typeof navigator < "u" && ((ERe = navigator.scheduling) === null || ERe === void 0 ? void 0 : ERe.isInputPending) ? () => navigator.scheduling.isInputPending() : null, Txn = /* @__PURE__ */ Zu.fromClass(class { - constructor(n) { - this.view = n, this.working = null, this.workScheduled = 0, this.chunkEnd = -1, this.chunkBudget = -1, this.work = this.work.bind(this), this.scheduleWork(); +const kE = typeof navigator < "u" && ((OE = navigator.scheduling) === null || OE === void 0 ? void 0 : OE.isInputPending) ? () => navigator.scheduling.isInputPending() : null, nOe = /* @__PURE__ */ an.fromClass(class { + constructor(e) { + this.view = e, this.working = null, this.workScheduled = 0, this.chunkEnd = -1, this.chunkBudget = -1, this.work = this.work.bind(this), this.scheduleWork(); } - update(n) { - let s = this.view.state.field(qy.state).context; - (s.updateViewport(n.view.viewport) || this.view.viewport.to > s.treeLen) && this.scheduleWork(), (n.docChanged || n.selectionSet) && (this.view.hasFocus && (this.chunkBudget += 50), this.scheduleWork()), this.checkAsyncSchedule(s); + update(e) { + let r = this.view.state.field(Mo.state).context; + (r.updateViewport(e.view.viewport) || this.view.viewport.to > r.treeLen) && this.scheduleWork(), (e.docChanged || e.selectionSet) && (this.view.hasFocus && (this.chunkBudget += 50), this.scheduleWork()), this.checkAsyncSchedule(r); } scheduleWork() { if (this.working) return; - let { state: n } = this.view, s = n.field(qy.state); - (s.tree != s.context.tree || !s.context.isDone(n.doc.length)) && (this.working = uPt(this.work)); + let { state: e } = this.view, r = e.field(Mo.state); + (r.tree != r.context.tree || !r.context.isDone(e.doc.length)) && (this.working = kK(this.work)); } - work(n) { + work(e) { this.working = null; - let s = Date.now(); - if (this.chunkEnd < s && (this.chunkEnd < 0 || this.view.hasFocus) && (this.chunkEnd = s + 3e4, this.chunkBudget = 3e3), this.chunkBudget <= 0) + let r = Date.now(); + if (this.chunkEnd < r && (this.chunkEnd < 0 || this.view.hasFocus) && (this.chunkEnd = r + 3e4, this.chunkBudget = 3e3), this.chunkBudget <= 0) return; - let { state: a, viewport: { to: l } } = this.view, h = a.field(qy.state); - if (h.tree == h.context.tree && h.context.isDone(l + 1e5)) + let { state: n, viewport: { to: i } } = this.view, s = n.field(Mo.state); + if (s.tree == s.context.tree && s.context.isDone(i + 1e5)) return; - let f = Date.now() + Math.min(this.chunkBudget, 100, n && !TRe ? Math.max(25, n.timeRemaining() - 5) : 1e9), b = h.context.treeLen < l && a.doc.length > l + 1e3, w = h.context.work(() => TRe && TRe() || Date.now() > f, l + (b ? 0 : 1e5)); - this.chunkBudget -= Date.now() - s, (w || this.chunkBudget <= 0) && (h.context.takeTree(), this.view.dispatch({ effects: qy.setState.of(new aF(h.context)) })), this.chunkBudget > 0 && !(w && !b) && this.scheduleWork(), this.checkAsyncSchedule(h.context); + let a = Date.now() + Math.min(this.chunkBudget, 100, e && !kE ? Math.max(25, e.timeRemaining() - 5) : 1e9), o = s.context.treeLen < i && n.doc.length > i + 1e3, l = s.context.work(() => kE && kE() || Date.now() > a, i + (o ? 0 : 1e5)); + this.chunkBudget -= Date.now() - r, (l || this.chunkBudget <= 0) && (s.context.takeTree(), this.view.dispatch({ effects: Mo.setState.of(new Ag(s.context)) })), this.chunkBudget > 0 && !(l && !o) && this.scheduleWork(), this.checkAsyncSchedule(s.context); } - checkAsyncSchedule(n) { - n.scheduleOn && (this.workScheduled++, n.scheduleOn.then(() => this.scheduleWork()).catch((s) => Yy(this.view.state, s)).then(() => this.workScheduled--), n.scheduleOn = null); + checkAsyncSchedule(e) { + e.scheduleOn && (this.workScheduled++, e.scheduleOn.then(() => this.scheduleWork()).catch((r) => Bo(this.view.state, r)).then(() => this.workScheduled--), e.scheduleOn = null); } destroy() { this.working && this.working(); @@ -12053,184 +12062,184 @@ const TRe = typeof navigator < "u" && ((ERe = navigator.scheduling) === null || eventHandlers: { focus() { this.scheduleWork(); } } -}), m8 = /* @__PURE__ */ us.define({ - combine(r) { - return r.length ? r[0] : null; - }, - enables: (r) => [ - qy.state, - Txn, - Ci.contentAttributes.compute([r], (n) => { - let s = n.facet(r); - return s && s.name ? { "data-language": s.name } : {}; +}), lf = /* @__PURE__ */ _t.define({ + combine(t) { + return t.length ? t[0] : null; + }, + enables: (t) => [ + Mo.state, + nOe, + dt.contentAttributes.compute([t], (e) => { + let r = e.facet(t); + return r && r.name ? { "data-language": r.name } : {}; }) ] }); -class kK { - constructor(n, s = []) { - this.language = n, this.support = s, this.extension = [n, s]; +class Ry { + constructor(e, r = []) { + this.language = e, this.support = r, this.extension = [e, r]; } } -class Gbe { - constructor(n, s, a, l, h, f = void 0) { - this.name = n, this.alias = s, this.extensions = a, this.filename = l, this.loadFunc = h, this.support = f, this.loading = null; +class T5 { + constructor(e, r, n, i, s, a = void 0) { + this.name = e, this.alias = r, this.extensions = n, this.filename = i, this.loadFunc = s, this.support = a, this.loading = null; } load() { - return this.loading || (this.loading = this.loadFunc().then((n) => this.support = n, (n) => { - throw this.loading = null, n; + return this.loading || (this.loading = this.loadFunc().then((e) => this.support = e, (e) => { + throw this.loading = null, e; })); } - static of(n) { - let { load: s, support: a } = n; - if (!s) { - if (!a) + static of(e) { + let { load: r, support: n } = e; + if (!r) { + if (!n) throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of"); - s = () => Promise.resolve(a); + r = () => Promise.resolve(n); } - return new Gbe(n.name, (n.alias || []).concat(n.name).map((l) => l.toLowerCase()), n.extensions || [], n.filename, s, a); + return new T5(e.name, (e.alias || []).concat(e.name).map((i) => i.toLowerCase()), e.extensions || [], e.filename, r, n); } - static matchFilename(n, s) { - for (let l of n) - if (l.filename && l.filename.test(s)) - return l; - let a = /\.([^.]+)$/.exec(s); - if (a) { - for (let l of n) - if (l.extensions.indexOf(a[1]) > -1) - return l; + static matchFilename(e, r) { + for (let i of e) + if (i.filename && i.filename.test(r)) + return i; + let n = /\.([^.]+)$/.exec(r); + if (n) { + for (let i of e) + if (i.extensions.indexOf(n[1]) > -1) + return i; } return null; } - static matchLanguageName(n, s, a = !0) { - s = s.toLowerCase(); - for (let l of n) - if (l.alias.some((h) => h == s)) - return l; - if (a) - for (let l of n) - for (let h of l.alias) { - let f = s.indexOf(h); - if (f > -1 && (h.length > 2 || !/\w/.test(s[f - 1]) && !/\w/.test(s[f + h.length]))) - return l; + static matchLanguageName(e, r, n = !0) { + r = r.toLowerCase(); + for (let i of e) + if (i.alias.some((s) => s == r)) + return i; + if (n) + for (let i of e) + for (let s of i.alias) { + let a = r.indexOf(s); + if (a > -1 && (s.length > 2 || !/\w/.test(r[a - 1]) && !/\w/.test(r[a + s.length]))) + return i; } return null; } } -const Axn = /* @__PURE__ */ us.define(), IJ = /* @__PURE__ */ us.define({ - combine: (r) => { - if (!r.length) +const iOe = /* @__PURE__ */ _t.define(), Wb = /* @__PURE__ */ _t.define({ + combine: (t) => { + if (!t.length) return " "; - let n = r[0]; - if (!n || /\S/.test(n) || Array.from(n).some((s) => s != n[0])) - throw new Error("Invalid indent unit: " + JSON.stringify(r[0])); - return n; + let e = t[0]; + if (!e || /\S/.test(e) || Array.from(e).some((r) => r != e[0])) + throw new Error("Invalid indent unit: " + JSON.stringify(t[0])); + return e; } }); -function Zbe(r) { - let n = r.facet(IJ); - return n.charCodeAt(0) == 9 ? r.tabSize * n.length : n.length; -} -function xK(r, n) { - let s = "", a = r.tabSize, l = r.facet(IJ)[0]; - if (l == " ") { - for (; n >= a; ) - s += " ", n -= a; - l = " "; - } - for (let h = 0; h < n; h++) - s += l; - return s; +function C5(t) { + let e = t.facet(Wb); + return e.charCodeAt(0) == 9 ? t.tabSize * e.length : e.length; +} +function My(t, e) { + let r = "", n = t.tabSize, i = t.facet(Wb)[0]; + if (i == " ") { + for (; e >= n; ) + r += " ", e -= n; + i = " "; + } + for (let s = 0; s < e; s++) + r += i; + return r; } -function Oze(r, n) { - r instanceof Ga && (r = new K2e(r)); - for (let a of r.state.facet(Axn)) { - let l = a(r, n); - if (l !== void 0) - return l; +function GR(t, e) { + t instanceof dr && (t = new $S(t)); + for (let n of t.state.facet(iOe)) { + let i = n(t, e); + if (i !== void 0) + return i; } - let s = dh(r.state); - return s.length >= n ? Dxn(r, s, n) : null; + let r = fn(t.state); + return r.length >= e ? sOe(t, r, e) : null; } -class K2e { - constructor(n, s = {}) { - this.state = n, this.options = s, this.unit = Zbe(n); +class $S { + constructor(e, r = {}) { + this.state = e, this.options = r, this.unit = C5(e); } - lineAt(n, s = 1) { - let a = this.state.doc.lineAt(n), { simulateBreak: l, simulateDoubleBreak: h } = this.options; - return l != null && l >= a.from && l <= a.to ? h && l == n ? { text: "", from: n } : (s < 0 ? l < n : l <= n) ? { text: a.text.slice(l - a.from), from: l } : { text: a.text.slice(0, l - a.from), from: a.from } : a; + lineAt(e, r = 1) { + let n = this.state.doc.lineAt(e), { simulateBreak: i, simulateDoubleBreak: s } = this.options; + return i != null && i >= n.from && i <= n.to ? s && i == e ? { text: "", from: e } : (r < 0 ? i < e : i <= e) ? { text: n.text.slice(i - n.from), from: i } : { text: n.text.slice(0, i - n.from), from: n.from } : n; } - textAfterPos(n, s = 1) { - if (this.options.simulateDoubleBreak && n == this.options.simulateBreak) + textAfterPos(e, r = 1) { + if (this.options.simulateDoubleBreak && e == this.options.simulateBreak) return ""; - let { text: a, from: l } = this.lineAt(n, s); - return a.slice(n - l, Math.min(a.length, n + 100 - l)); + let { text: n, from: i } = this.lineAt(e, r); + return n.slice(e - i, Math.min(n.length, e + 100 - i)); } - column(n, s = 1) { - let { text: a, from: l } = this.lineAt(n, s), h = this.countColumn(a, n - l), f = this.options.overrideIndentation ? this.options.overrideIndentation(l) : -1; - return f > -1 && (h += f - this.countColumn(a, a.search(/\S|$/))), h; + column(e, r = 1) { + let { text: n, from: i } = this.lineAt(e, r), s = this.countColumn(n, e - i), a = this.options.overrideIndentation ? this.options.overrideIndentation(i) : -1; + return a > -1 && (s += a - this.countColumn(n, n.search(/\S|$/))), s; } - countColumn(n, s = n.length) { - return gk(n, this.state.tabSize, s); + countColumn(e, r = e.length) { + return Ml(e, this.state.tabSize, r); } - lineIndent(n, s = 1) { - let { text: a, from: l } = this.lineAt(n, s), h = this.options.overrideIndentation; - if (h) { - let f = h(l); - if (f > -1) - return f; + lineIndent(e, r = 1) { + let { text: n, from: i } = this.lineAt(e, r), s = this.options.overrideIndentation; + if (s) { + let a = s(i); + if (a > -1) + return a; } - return this.countColumn(a, a.search(/\S|$/)); + return this.countColumn(n, n.search(/\S|$/)); } get simulatedBreak() { return this.options.simulateBreak || null; } } -const NJ = /* @__PURE__ */ new Ia(); -function Dxn(r, n, s) { - let a = n.resolveStack(s), l = a.node.enterUnfinishedNodesBefore(s); - if (l != a.node) { - let h = []; - for (let f = l; f != a.node; f = f.parent) - h.push(f); - for (let f = h.length - 1; f >= 0; f--) - a = { node: h[f], next: a }; +const Gb = /* @__PURE__ */ new lr(); +function sOe(t, e, r) { + let n = e.resolveStack(r), i = n.node.enterUnfinishedNodesBefore(r); + if (i != n.node) { + let s = []; + for (let a = i; a != n.node; a = a.parent) + s.push(a); + for (let a = s.length - 1; a >= 0; a--) + n = { node: s[a], next: n }; } - return hPt(a, r, s); + return SK(n, t, r); } -function hPt(r, n, s) { - for (let a = r; a; a = a.next) { - let l = Pxn(a.node); - if (l) - return l(kze.create(n, s, a)); +function SK(t, e, r) { + for (let n = t; n; n = n.next) { + let i = oOe(n.node); + if (i) + return i(HR.create(e, r, n)); } return 0; } -function Mxn(r) { - return r.pos == r.options.simulateBreak && r.options.simulateDoubleBreak; +function aOe(t) { + return t.pos == t.options.simulateBreak && t.options.simulateDoubleBreak; } -function Pxn(r) { - let n = r.type.prop(NJ); - if (n) - return n; - let s = r.firstChild, a; - if (s && (a = s.type.prop(Ia.closedBy))) { - let l = r.lastChild, h = l && a.indexOf(l.name) > -1; - return (f) => fPt(f, !0, 1, void 0, h && !Mxn(f) ? l.from : void 0); +function oOe(t) { + let e = t.type.prop(Gb); + if (e) + return e; + let r = t.firstChild, n; + if (r && (n = r.type.prop(lr.closedBy))) { + let i = t.lastChild, s = i && n.indexOf(i.name) > -1; + return (a) => TK(a, !0, 1, void 0, s && !aOe(a) ? i.from : void 0); } - return r.parent == null ? Lxn : null; + return t.parent == null ? lOe : null; } -function Lxn() { +function lOe() { return 0; } -class kze extends K2e { - constructor(n, s, a) { - super(n.state, n.options), this.base = n, this.pos = s, this.context = a; +class HR extends $S { + constructor(e, r, n) { + super(e.state, e.options), this.base = e, this.pos = r, this.context = n; } get node() { return this.context.node; } - static create(n, s, a) { - return new kze(n, s, a); + static create(e, r, n) { + return new HR(e, r, n); } get textAfter() { return this.textAfterPos(this.pos); @@ -12238,342 +12247,342 @@ class kze extends K2e { get baseIndent() { return this.baseIndentFor(this.node); } - baseIndentFor(n) { - let s = this.state.doc.lineAt(n.from); + baseIndentFor(e) { + let r = this.state.doc.lineAt(e.from); for (; ; ) { - let a = n.resolve(s.from); - for (; a.parent && a.parent.from == a.from; ) - a = a.parent; - if (Ixn(a, n)) + let n = e.resolve(r.from); + for (; n.parent && n.parent.from == n.from; ) + n = n.parent; + if (cOe(n, e)) break; - s = this.state.doc.lineAt(a.from); + r = this.state.doc.lineAt(n.from); } - return this.lineIndent(s.from); + return this.lineIndent(r.from); } continue() { - return hPt(this.context.next, this.base, this.pos); + return SK(this.context.next, this.base, this.pos); } } -function Ixn(r, n) { - for (let s = n; s; s = s.parent) - if (r == s) +function cOe(t, e) { + for (let r = e; r; r = r.parent) + if (t == r) return !0; return !1; } -function Nxn(r) { - let n = r.node, s = n.childAfter(n.from), a = n.lastChild; - if (!s) +function uOe(t) { + let e = t.node, r = e.childAfter(e.from), n = e.lastChild; + if (!r) return null; - let l = r.options.simulateBreak, h = r.state.doc.lineAt(s.from), f = l == null || l <= h.from ? h.to : Math.min(h.to, l); - for (let b = s.to; ; ) { - let w = n.childAfter(b); - if (!w || w == a) + let i = t.options.simulateBreak, s = t.state.doc.lineAt(r.from), a = i == null || i <= s.from ? s.to : Math.min(s.to, i); + for (let o = r.to; ; ) { + let l = e.childAfter(o); + if (!l || l == n) return null; - if (!w.type.isSkipped) - return w.from < f ? s : null; - b = w.to; + if (!l.type.isSkipped) + return l.from < a ? r : null; + o = l.to; } } -function Rxn({ closing: r, align: n = !0, units: s = 1 }) { - return (a) => fPt(a, n, s, r); +function hOe({ closing: t, align: e = !0, units: r = 1 }) { + return (n) => TK(n, e, r, t); } -function fPt(r, n, s, a, l) { - let h = r.textAfter, f = h.match(/^\s*/)[0].length, b = a && h.slice(f, f + a.length) == a || l == r.pos + f, w = n ? Nxn(r) : null; - return w ? b ? r.column(w.from) : r.column(w.to) : r.baseIndent + (b ? 0 : r.unit * s); +function TK(t, e, r, n, i) { + let s = t.textAfter, a = s.match(/^\s*/)[0].length, o = n && s.slice(a, a + n.length) == n || i == t.pos + a, l = e ? uOe(t) : null; + return l ? o ? t.column(l.from) : t.column(l.to) : t.baseIndent + (o ? 0 : t.unit * r); } -const $xn = (r) => r.baseIndent; -function Jme({ except: r, units: n = 1 } = {}) { - return (s) => { - let a = r && r.test(s.textAfter); - return s.baseIndent + (a ? 0 : n * s.unit); +const fOe = (t) => t.baseIndent; +function u4({ except: t, units: e = 1 } = {}) { + return (r) => { + let n = t && t.test(r.textAfter); + return r.baseIndent + (n ? 0 : e * r.unit); }; } -const Bxn = 200; -function Fxn() { - return Ga.transactionFilter.of((r) => { - if (!r.docChanged || !r.isUserEvent("input.type") && !r.isUserEvent("input.complete")) - return r; - let n = r.startState.languageDataAt("indentOnInput", r.startState.selection.main.head); - if (!n.length) - return r; - let s = r.newDoc, { head: a } = r.newSelection.main, l = s.lineAt(a); - if (a > l.from + Bxn) - return r; - let h = s.sliceString(l.from, a); - if (!n.some((O) => O.test(h))) - return r; - let { state: f } = r, b = -1, w = []; - for (let { head: O } of f.selection.ranges) { - let S = f.doc.lineAt(O); - if (S.from == b) +const dOe = 200; +function pOe() { + return dr.transactionFilter.of((t) => { + if (!t.docChanged || !t.isUserEvent("input.type") && !t.isUserEvent("input.complete")) + return t; + let e = t.startState.languageDataAt("indentOnInput", t.startState.selection.main.head); + if (!e.length) + return t; + let r = t.newDoc, { head: n } = t.newSelection.main, i = r.lineAt(n); + if (n > i.from + dOe) + return t; + let s = r.sliceString(i.from, n); + if (!e.some((u) => u.test(s))) + return t; + let { state: a } = t, o = -1, l = []; + for (let { head: u } of a.selection.ranges) { + let h = a.doc.lineAt(u); + if (h.from == o) continue; - b = S.from; - let E = Oze(f, S.from); - if (E == null) + o = h.from; + let f = GR(a, h.from); + if (f == null) continue; - let D = /^\s*/.exec(S.text)[0], M = xK(f, E); - D != M && w.push({ from: S.from, to: S.from + D.length, insert: M }); + let d = /^\s*/.exec(h.text)[0], p = My(a, f); + d != p && l.push({ from: h.from, to: h.from + d.length, insert: p }); } - return w.length ? [r, { changes: w, sequential: !0 }] : r; + return l.length ? [t, { changes: l, sequential: !0 }] : t; }); } -const dPt = /* @__PURE__ */ us.define(), ZF = /* @__PURE__ */ new Ia(); -function pPt(r) { - let n = r.firstChild, s = r.lastChild; - return n && n.to < s.from ? { from: n.to, to: s.type.isError ? r.to : s.from } : null; +const CK = /* @__PURE__ */ _t.define(), I1 = /* @__PURE__ */ new lr(); +function EK(t) { + let e = t.firstChild, r = t.lastChild; + return e && e.to < r.from ? { from: e.to, to: r.type.isError ? t.to : r.from } : null; } -function jxn(r, n, s) { - let a = dh(r); - if (a.length < s) +function gOe(t, e, r) { + let n = fn(t); + if (n.length < r) return null; - let l = a.resolveStack(s, 1), h = null; - for (let f = l; f; f = f.next) { - let b = f.node; - if (b.to <= s || b.from > s) + let i = n.resolveStack(r, 1), s = null; + for (let a = i; a; a = a.next) { + let o = a.node; + if (o.to <= r || o.from > r) continue; - if (h && b.from < n) + if (s && o.from < e) break; - let w = b.type.prop(ZF); - if (w && (b.to < a.length - 50 || a.length == r.doc.length || !Qxn(b))) { - let O = w(b, r); - O && O.from <= s && O.from >= n && O.to > s && (h = O); + let l = o.type.prop(I1); + if (l && (o.to < n.length - 50 || n.length == t.doc.length || !mOe(o))) { + let u = l(o, t); + u && u.from <= r && u.from >= e && u.to > r && (s = u); } } - return h; + return s; } -function Qxn(r) { - let n = r.lastChild; - return n && n.to == r.to && n.type.isError; +function mOe(t) { + let e = t.lastChild; + return e && e.to == t.to && e.type.isError; } -function Xbe(r, n, s) { - for (let a of r.facet(dPt)) { - let l = a(r, n, s); - if (l) - return l; +function E5(t, e, r) { + for (let n of t.facet(CK)) { + let i = n(t, e, r); + if (i) + return i; } - return jxn(r, n, s); + return gOe(t, e, r); } -function gPt(r, n) { - let s = n.mapPos(r.from, 1), a = n.mapPos(r.to, -1); - return s >= a ? void 0 : { from: s, to: a }; +function _K(t, e) { + let r = e.mapPos(t.from, 1), n = e.mapPos(t.to, -1); + return r >= n ? void 0 : { from: r, to: n }; } -const b8 = /* @__PURE__ */ $o.define({ map: gPt }), EP = /* @__PURE__ */ $o.define({ map: gPt }); -function mPt(r) { - let n = []; - for (let { head: s } of r.state.selection.ranges) - n.some((a) => a.from <= s && a.to >= s) || n.push(r.lineBlockAt(s)); - return n; +const cf = /* @__PURE__ */ Zt.define({ map: _K }), N0 = /* @__PURE__ */ Zt.define({ map: _K }); +function AK(t) { + let e = []; + for (let { head: r } of t.state.selection.ranges) + e.some((n) => n.from <= r && n.to >= r) || e.push(t.lineBlockAt(r)); + return e; } -const v8 = /* @__PURE__ */ Ef.define({ +const uf = /* @__PURE__ */ Pn.define({ create() { - return as.none; - }, - update(r, n) { - r = r.map(n.changes); - for (let s of n.effects) - if (s.is(b8) && !qxn(r, s.value.from, s.value.to)) { - let { preparePlaceholder: a } = n.state.facet(xze), l = a ? as.replace({ widget: new Zxn(a(n.state, s.value)) }) : ACt; - r = r.update({ add: [l.range(s.value.from, s.value.to)] }); + return Et.none; + }, + update(t, e) { + t = t.map(e.changes); + for (let r of e.effects) + if (r.is(cf) && !yOe(t, r.value.from, r.value.to)) { + let { preparePlaceholder: n } = e.state.facet(XR), i = n ? Et.replace({ widget: new TOe(n(e.state, r.value)) }) : iF; + t = t.update({ add: [i.range(r.value.from, r.value.to)] }); } else - s.is(EP) && (r = r.update({ - filter: (a, l) => s.value.from != a || s.value.to != l, - filterFrom: s.value.from, - filterTo: s.value.to + r.is(N0) && (t = t.update({ + filter: (n, i) => r.value.from != n || r.value.to != i, + filterFrom: r.value.from, + filterTo: r.value.to })); - if (n.selection) { - let s = !1, { head: a } = n.selection.main; - r.between(a, a, (l, h) => { - l < a && h > a && (s = !0); - }), s && (r = r.update({ - filterFrom: a, - filterTo: a, - filter: (l, h) => h <= a || l >= a + if (e.selection) { + let r = !1, { head: n } = e.selection.main; + t.between(n, n, (i, s) => { + i < n && s > n && (r = !0); + }), r && (t = t.update({ + filterFrom: n, + filterTo: n, + filter: (i, s) => s <= n || i >= n })); } - return r; + return t; }, - provide: (r) => Ci.decorations.from(r), - toJSON(r, n) { - let s = []; - return r.between(0, n.doc.length, (a, l) => { - s.push(a, l); - }), s; + provide: (t) => dt.decorations.from(t), + toJSON(t, e) { + let r = []; + return t.between(0, e.doc.length, (n, i) => { + r.push(n, i); + }), r; }, - fromJSON(r) { - if (!Array.isArray(r) || r.length % 2) + fromJSON(t) { + if (!Array.isArray(t) || t.length % 2) throw new RangeError("Invalid JSON for fold state"); - let n = []; - for (let s = 0; s < r.length; ) { - let a = r[s++], l = r[s++]; - if (typeof a != "number" || typeof l != "number") + let e = []; + for (let r = 0; r < t.length; ) { + let n = t[r++], i = t[r++]; + if (typeof n != "number" || typeof i != "number") throw new RangeError("Invalid JSON for fold state"); - n.push(ACt.range(a, l)); + e.push(iF.range(n, i)); } - return as.set(n, !0); + return Et.set(e, !0); } }); -function zxn(r) { - return r.field(v8, !1) || cl.empty; +function vOe(t) { + return t.field(uf, !1) || Er.empty; } -function Kbe(r, n, s) { - var a; - let l = null; - return (a = r.field(v8, !1)) === null || a === void 0 || a.between(n, s, (h, f) => { - (!l || l.from > h) && (l = { from: h, to: f }); - }), l; -} -function qxn(r, n, s) { - let a = !1; - return r.between(n, n, (l, h) => { - l == n && h == s && (a = !0); - }), a; +function _5(t, e, r) { + var n; + let i = null; + return (n = t.field(uf, !1)) === null || n === void 0 || n.between(e, r, (s, a) => { + (!i || i.from > s) && (i = { from: s, to: a }); + }), i; +} +function yOe(t, e, r) { + let n = !1; + return t.between(e, e, (i, s) => { + i == e && s == r && (n = !0); + }), n; } -function bPt(r, n) { - return r.field(v8, !1) ? n : n.concat($o.appendConfig.of(wPt())); +function LK(t, e) { + return t.field(uf, !1) ? e : e.concat(Zt.appendConfig.of(MK())); } -const Vxn = (r) => { - for (let n of mPt(r)) { - let s = Xbe(r.state, n.from, n.to); - if (s) - return r.dispatch({ effects: bPt(r.state, [b8.of(s), vPt(r, s)]) }), !0; +const bOe = (t) => { + for (let e of AK(t)) { + let r = E5(t.state, e.from, e.to); + if (r) + return t.dispatch({ effects: LK(t.state, [cf.of(r), RK(t, r)]) }), !0; } return !1; -}, Uxn = (r) => { - if (!r.state.field(v8, !1)) +}, xOe = (t) => { + if (!t.state.field(uf, !1)) return !1; - let n = []; - for (let s of mPt(r)) { - let a = Kbe(r.state, s.from, s.to); - a && n.push(EP.of(a), vPt(r, a, !1)); - } - return n.length && r.dispatch({ effects: n }), n.length > 0; -}; -function vPt(r, n, s = !0) { - let a = r.state.doc.lineAt(n.from).number, l = r.state.doc.lineAt(n.to).number; - return Ci.announce.of(`${r.state.phrase(s ? "Folded lines" : "Unfolded lines")} ${a} ${r.state.phrase("to")} ${l}.`); -} -const Wxn = (r) => { - let { state: n } = r, s = []; - for (let a = 0; a < n.doc.length; ) { - let l = r.lineBlockAt(a), h = Xbe(n, l.from, l.to); - h && s.push(b8.of(h)), a = (h ? r.lineBlockAt(h.to) : l).to + 1; - } - return s.length && r.dispatch({ effects: bPt(r.state, s) }), !!s.length; -}, Yxn = (r) => { - let n = r.state.field(v8, !1); - if (!n || !n.size) + let e = []; + for (let r of AK(t)) { + let n = _5(t.state, r.from, r.to); + n && e.push(N0.of(n), RK(t, n, !1)); + } + return e.length && t.dispatch({ effects: e }), e.length > 0; +}; +function RK(t, e, r = !0) { + let n = t.state.doc.lineAt(e.from).number, i = t.state.doc.lineAt(e.to).number; + return dt.announce.of(`${t.state.phrase(r ? "Folded lines" : "Unfolded lines")} ${n} ${t.state.phrase("to")} ${i}.`); +} +const wOe = (t) => { + let { state: e } = t, r = []; + for (let n = 0; n < e.doc.length; ) { + let i = t.lineBlockAt(n), s = E5(e, i.from, i.to); + s && r.push(cf.of(s)), n = (s ? t.lineBlockAt(s.to) : i).to + 1; + } + return r.length && t.dispatch({ effects: LK(t.state, r) }), !!r.length; +}, OOe = (t) => { + let e = t.state.field(uf, !1); + if (!e || !e.size) return !1; - let s = []; - return n.between(0, r.state.doc.length, (a, l) => { - s.push(EP.of({ from: a, to: l })); - }), r.dispatch({ effects: s }), !0; -}, Hxn = [ - { key: "Ctrl-Shift-[", mac: "Cmd-Alt-[", run: Vxn }, - { key: "Ctrl-Shift-]", mac: "Cmd-Alt-]", run: Uxn }, - { key: "Ctrl-Alt-[", run: Wxn }, - { key: "Ctrl-Alt-]", run: Yxn } -], Gxn = { + let r = []; + return e.between(0, t.state.doc.length, (n, i) => { + r.push(N0.of({ from: n, to: i })); + }), t.dispatch({ effects: r }), !0; +}, kOe = [ + { key: "Ctrl-Shift-[", mac: "Cmd-Alt-[", run: bOe }, + { key: "Ctrl-Shift-]", mac: "Cmd-Alt-]", run: xOe }, + { key: "Ctrl-Alt-[", run: wOe }, + { key: "Ctrl-Alt-]", run: OOe } +], SOe = { placeholderDOM: null, preparePlaceholder: null, placeholderText: "\u2026" -}, xze = /* @__PURE__ */ us.define({ - combine(r) { - return px(r, Gxn); +}, XR = /* @__PURE__ */ _t.define({ + combine(t) { + return qc(t, SOe); } }); -function wPt(r) { - let n = [v8, Jxn]; - return r && n.push(xze.of(r)), n; -} -function yPt(r, n) { - let { state: s } = r, a = s.facet(xze), l = (f) => { - let b = r.lineBlockAt(r.posAtDOM(f.target)), w = Kbe(r.state, b.from, b.to); - w && r.dispatch({ effects: EP.of(w) }), f.preventDefault(); +function MK(t) { + let e = [uf, _Oe]; + return t && e.push(XR.of(t)), e; +} +function DK(t, e) { + let { state: r } = t, n = r.facet(XR), i = (a) => { + let o = t.lineBlockAt(t.posAtDOM(a.target)), l = _5(t.state, o.from, o.to); + l && t.dispatch({ effects: N0.of(l) }), a.preventDefault(); }; - if (a.placeholderDOM) - return a.placeholderDOM(r, l, n); - let h = document.createElement("span"); - return h.textContent = a.placeholderText, h.setAttribute("aria-label", s.phrase("folded code")), h.title = s.phrase("unfold"), h.className = "cm-foldPlaceholder", h.onclick = l, h; + if (n.placeholderDOM) + return n.placeholderDOM(t, i, e); + let s = document.createElement("span"); + return s.textContent = n.placeholderText, s.setAttribute("aria-label", r.phrase("folded code")), s.title = r.phrase("unfold"), s.className = "cm-foldPlaceholder", s.onclick = i, s; } -const ACt = /* @__PURE__ */ as.replace({ widget: /* @__PURE__ */ new class extends uv { - toDOM(r) { - return yPt(r, null); +const iF = /* @__PURE__ */ Et.replace({ widget: /* @__PURE__ */ new class extends za { + toDOM(t) { + return DK(t, null); } }() }); -class Zxn extends uv { - constructor(n) { - super(), this.value = n; +class TOe extends za { + constructor(e) { + super(), this.value = e; } - eq(n) { - return this.value == n.value; + eq(e) { + return this.value == e.value; } - toDOM(n) { - return yPt(n, this.value); + toDOM(e) { + return DK(e, this.value); } } -const Xxn = { +const COe = { openText: "\u2304", closedText: "\u203A", markerDOM: null, domEventHandlers: {}, foldingChanged: () => !1 }; -class ARe extends Xy { - constructor(n, s) { - super(), this.config = n, this.open = s; +class SE extends Uo { + constructor(e, r) { + super(), this.config = e, this.open = r; } - eq(n) { - return this.config == n.config && this.open == n.open; + eq(e) { + return this.config == e.config && this.open == e.open; } - toDOM(n) { + toDOM(e) { if (this.config.markerDOM) return this.config.markerDOM(this.open); - let s = document.createElement("span"); - return s.textContent = this.open ? this.config.openText : this.config.closedText, s.title = n.state.phrase(this.open ? "Fold line" : "Unfold line"), s; + let r = document.createElement("span"); + return r.textContent = this.open ? this.config.openText : this.config.closedText, r.title = e.state.phrase(this.open ? "Fold line" : "Unfold line"), r; } } -function Kxn(r = {}) { - let n = Object.assign(Object.assign({}, Xxn), r), s = new ARe(n, !0), a = new ARe(n, !1), l = Zu.fromClass(class { - constructor(f) { - this.from = f.viewport.from, this.markers = this.buildMarkers(f); +function EOe(t = {}) { + let e = Object.assign(Object.assign({}, COe), t), r = new SE(e, !0), n = new SE(e, !1), i = an.fromClass(class { + constructor(a) { + this.from = a.viewport.from, this.markers = this.buildMarkers(a); } - update(f) { - (f.docChanged || f.viewportChanged || f.startState.facet(m8) != f.state.facet(m8) || f.startState.field(v8, !1) != f.state.field(v8, !1) || dh(f.startState) != dh(f.state) || n.foldingChanged(f)) && (this.markers = this.buildMarkers(f.view)); + update(a) { + (a.docChanged || a.viewportChanged || a.startState.facet(lf) != a.state.facet(lf) || a.startState.field(uf, !1) != a.state.field(uf, !1) || fn(a.startState) != fn(a.state) || e.foldingChanged(a)) && (this.markers = this.buildMarkers(a.view)); } - buildMarkers(f) { - let b = new G0(); - for (let w of f.viewportLineBlocks) { - let O = Kbe(f.state, w.from, w.to) ? a : Xbe(f.state, w.from, w.to) ? s : null; - O && b.add(w.from, w.from, O); + buildMarkers(a) { + let o = new Hi(); + for (let l of a.viewportLineBlocks) { + let u = _5(a.state, l.from, l.to) ? n : E5(a.state, l.from, l.to) ? r : null; + u && o.add(l.from, l.from, u); } - return b.finish(); + return o.finish(); } - }), { domEventHandlers: h } = n; + }), { domEventHandlers: s } = e; return [ - l, - X2e({ + i, + PS({ class: "cm-foldGutter", - markers(f) { - var b; - return ((b = f.plugin(l)) === null || b === void 0 ? void 0 : b.markers) || cl.empty; + markers(a) { + var o; + return ((o = a.plugin(i)) === null || o === void 0 ? void 0 : o.markers) || Er.empty; }, initialSpacer() { - return new ARe(n, !1); + return new SE(e, !1); }, - domEventHandlers: Object.assign(Object.assign({}, h), { click: (f, b, w) => { - if (h.click && h.click(f, b, w)) + domEventHandlers: Object.assign(Object.assign({}, s), { click: (a, o, l) => { + if (s.click && s.click(a, o, l)) return !0; - let O = Kbe(f.state, b.from, b.to); - if (O) - return f.dispatch({ effects: EP.of(O) }), !0; - let S = Xbe(f.state, b.from, b.to); - return S ? (f.dispatch({ effects: b8.of(S) }), !0) : !1; + let u = _5(a.state, o.from, o.to); + if (u) + return a.dispatch({ effects: N0.of(u) }), !0; + let h = E5(a.state, o.from, o.to); + return h ? (a.dispatch({ effects: cf.of(h) }), !0) : !1; } }) }), - wPt() + MK() ]; } -const Jxn = /* @__PURE__ */ Ci.baseTheme({ +const _Oe = /* @__PURE__ */ dt.baseTheme({ ".cm-foldPlaceholder": { backgroundColor: "#eee", border: "1px solid #ddd", @@ -12588,258 +12597,258 @@ const Jxn = /* @__PURE__ */ Ci.baseTheme({ cursor: "pointer" } }); -class J2e { - constructor(n, s) { - this.specs = n; - let a; - function l(b) { - let w = s_.newName(); - return (a || (a = /* @__PURE__ */ Object.create(null)))["." + w] = b, w; - } - const h = typeof s.all == "string" ? s.all : s.all ? l(s.all) : void 0, f = s.scope; - this.scope = f instanceof qy ? (b) => b.prop(zM) == f.data : f ? (b) => b == f : void 0, this.style = lPt(n.map((b) => ({ - tag: b.tag, - class: b.class || l(Object.assign({}, b, { tag: null })) +class BS { + constructor(e, r) { + this.specs = e; + let n; + function i(o) { + let l = Iu.newName(); + return (n || (n = /* @__PURE__ */ Object.create(null)))["." + l] = o, l; + } + const s = typeof r.all == "string" ? r.all : r.all ? i(r.all) : void 0, a = r.scope; + this.scope = a instanceof Mo ? (o) => o.prop(Ed) == a.data : a ? (o) => o == a : void 0, this.style = OK(e.map((o) => ({ + tag: o.tag, + class: o.class || i(Object.assign({}, o, { tag: null })) })), { - all: h - }).style, this.module = a ? new s_(a) : null, this.themeType = s.themeType; + all: s + }).style, this.module = n ? new Iu(n) : null, this.themeType = r.themeType; } - static define(n, s) { - return new J2e(n, s || {}); + static define(e, r) { + return new BS(e, r || {}); } } -const CFe = /* @__PURE__ */ us.define(), OPt = /* @__PURE__ */ us.define({ - combine(r) { - return r.length ? [r[0]] : null; +const g7 = /* @__PURE__ */ _t.define(), NK = /* @__PURE__ */ _t.define({ + combine(t) { + return t.length ? [t[0]] : null; } }); -function DRe(r) { - let n = r.facet(CFe); - return n.length ? n : r.facet(OPt); -} -function kPt(r, n) { - let s = [tSn], a; - return r instanceof J2e && (r.module && s.push(Ci.styleModule.of(r.module)), a = r.themeType), n != null && n.fallback ? s.push(OPt.of(r)) : a ? s.push(CFe.computeN([Ci.darkTheme], (l) => l.facet(Ci.darkTheme) == (a == "dark") ? [r] : [])) : s.push(CFe.of(r)), s; -} -class eSn { - constructor(n) { - this.markCache = /* @__PURE__ */ Object.create(null), this.tree = dh(n.state), this.decorations = this.buildDeco(n, DRe(n.state)); - } - update(n) { - let s = dh(n.state), a = DRe(n.state), l = a != DRe(n.startState); - s.length < n.view.viewport.to && !l && s.type == this.tree.type ? this.decorations = this.decorations.map(n.changes) : (s != this.tree || n.viewportChanged || l) && (this.tree = s, this.decorations = this.buildDeco(n.view, a)); - } - buildDeco(n, s) { - if (!s || !this.tree.length) - return as.none; - let a = new G0(); - for (let { from: l, to: h } of n.visibleRanges) - Sxn(this.tree, s, (f, b, w) => { - a.add(f, b, this.markCache[w] || (this.markCache[w] = as.mark({ class: w }))); - }, l, h); - return a.finish(); - } -} -const tSn = /* @__PURE__ */ Sk.high(/* @__PURE__ */ Zu.fromClass(eSn, { - decorations: (r) => r.decorations -})), xPt = /* @__PURE__ */ J2e.define([ +function TE(t) { + let e = t.facet(g7); + return e.length ? e : t.facet(NK); +} +function IK(t, e) { + let r = [LOe], n; + return t instanceof BS && (t.module && r.push(dt.styleModule.of(t.module)), n = t.themeType), e != null && e.fallback ? r.push(NK.of(t)) : n ? r.push(g7.computeN([dt.darkTheme], (i) => i.facet(dt.darkTheme) == (n == "dark") ? [t] : [])) : r.push(g7.of(t)), r; +} +class AOe { + constructor(e) { + this.markCache = /* @__PURE__ */ Object.create(null), this.tree = fn(e.state), this.decorations = this.buildDeco(e, TE(e.state)); + } + update(e) { + let r = fn(e.state), n = TE(e.state), i = n != TE(e.startState); + r.length < e.view.viewport.to && !i && r.type == this.tree.type ? this.decorations = this.decorations.map(e.changes) : (r != this.tree || e.viewportChanged || i) && (this.tree = r, this.decorations = this.buildDeco(e.view, n)); + } + buildDeco(e, r) { + if (!r || !this.tree.length) + return Et.none; + let n = new Hi(); + for (let { from: i, to: s } of e.visibleRanges) + Jwe(this.tree, r, (a, o, l) => { + n.add(a, o, this.markCache[l] || (this.markCache[l] = Et.mark({ class: l }))); + }, i, s); + return n.finish(); + } +} +const LOe = /* @__PURE__ */ zl.high(/* @__PURE__ */ an.fromClass(AOe, { + decorations: (t) => t.decorations +})), PK = /* @__PURE__ */ BS.define([ { - tag: Ft.meta, + tag: Se.meta, color: "#404740" }, { - tag: Ft.link, + tag: Se.link, textDecoration: "underline" }, { - tag: Ft.heading, + tag: Se.heading, textDecoration: "underline", fontWeight: "bold" }, { - tag: Ft.emphasis, + tag: Se.emphasis, fontStyle: "italic" }, { - tag: Ft.strong, + tag: Se.strong, fontWeight: "bold" }, { - tag: Ft.strikethrough, + tag: Se.strikethrough, textDecoration: "line-through" }, { - tag: Ft.keyword, + tag: Se.keyword, color: "#708" }, { - tag: [Ft.atom, Ft.bool, Ft.url, Ft.contentSeparator, Ft.labelName], + tag: [Se.atom, Se.bool, Se.url, Se.contentSeparator, Se.labelName], color: "#219" }, { - tag: [Ft.literal, Ft.inserted], + tag: [Se.literal, Se.inserted], color: "#164" }, { - tag: [Ft.string, Ft.deleted], + tag: [Se.string, Se.deleted], color: "#a11" }, { - tag: [Ft.regexp, Ft.escape, /* @__PURE__ */ Ft.special(Ft.string)], + tag: [Se.regexp, Se.escape, /* @__PURE__ */ Se.special(Se.string)], color: "#e40" }, { - tag: /* @__PURE__ */ Ft.definition(Ft.variableName), + tag: /* @__PURE__ */ Se.definition(Se.variableName), color: "#00f" }, { - tag: /* @__PURE__ */ Ft.local(Ft.variableName), + tag: /* @__PURE__ */ Se.local(Se.variableName), color: "#30a" }, { - tag: [Ft.typeName, Ft.namespace], + tag: [Se.typeName, Se.namespace], color: "#085" }, { - tag: Ft.className, + tag: Se.className, color: "#167" }, { - tag: [/* @__PURE__ */ Ft.special(Ft.variableName), Ft.macroName], + tag: [/* @__PURE__ */ Se.special(Se.variableName), Se.macroName], color: "#256" }, { - tag: /* @__PURE__ */ Ft.definition(Ft.propertyName), + tag: /* @__PURE__ */ Se.definition(Se.propertyName), color: "#00c" }, { - tag: Ft.comment, + tag: Se.comment, color: "#940" }, { - tag: Ft.invalid, + tag: Se.invalid, color: "#f00" } -]), nSn = /* @__PURE__ */ Ci.baseTheme({ +]), ROe = /* @__PURE__ */ dt.baseTheme({ "&.cm-focused .cm-matchingBracket": { backgroundColor: "#328c8252" }, "&.cm-focused .cm-nonmatchingBracket": { backgroundColor: "#bb555544" } -}), SPt = 1e4, _Pt = "()[]{}", CPt = /* @__PURE__ */ us.define({ - combine(r) { - return px(r, { +}), $K = 1e4, BK = "()[]{}", FK = /* @__PURE__ */ _t.define({ + combine(t) { + return qc(t, { afterCursor: !0, - brackets: _Pt, - maxScanDistance: SPt, - renderMatch: sSn + brackets: BK, + maxScanDistance: $K, + renderMatch: NOe }); } -}), rSn = /* @__PURE__ */ as.mark({ class: "cm-matchingBracket" }), iSn = /* @__PURE__ */ as.mark({ class: "cm-nonmatchingBracket" }); -function sSn(r) { - let n = [], s = r.matched ? rSn : iSn; - return n.push(s.range(r.start.from, r.start.to)), r.end && n.push(s.range(r.end.from, r.end.to)), n; +}), MOe = /* @__PURE__ */ Et.mark({ class: "cm-matchingBracket" }), DOe = /* @__PURE__ */ Et.mark({ class: "cm-nonmatchingBracket" }); +function NOe(t) { + let e = [], r = t.matched ? MOe : DOe; + return e.push(r.range(t.start.from, t.start.to)), t.end && e.push(r.range(t.end.from, t.end.to)), e; } -const oSn = /* @__PURE__ */ Ef.define({ +const IOe = /* @__PURE__ */ Pn.define({ create() { - return as.none; + return Et.none; }, - update(r, n) { - if (!n.docChanged && !n.selection) - return r; - let s = [], a = n.state.facet(CPt); - for (let l of n.state.selection.ranges) { - if (!l.empty) + update(t, e) { + if (!e.docChanged && !e.selection) + return t; + let r = [], n = e.state.facet(FK); + for (let i of e.state.selection.ranges) { + if (!i.empty) continue; - let h = G4(n.state, l.head, -1, a) || l.head > 0 && G4(n.state, l.head - 1, 1, a) || a.afterCursor && (G4(n.state, l.head, 1, a) || l.head < n.state.doc.length && G4(n.state, l.head + 1, -1, a)); - h && (s = s.concat(a.renderMatch(h, n.state))); + let s = mc(e.state, i.head, -1, n) || i.head > 0 && mc(e.state, i.head - 1, 1, n) || n.afterCursor && (mc(e.state, i.head, 1, n) || i.head < e.state.doc.length && mc(e.state, i.head + 1, -1, n)); + s && (r = r.concat(n.renderMatch(s, e.state))); } - return as.set(s, !0); + return Et.set(r, !0); }, - provide: (r) => Ci.decorations.from(r) -}), aSn = [ - oSn, - nSn + provide: (t) => dt.decorations.from(t) +}), POe = [ + IOe, + ROe ]; -function cSn(r = {}) { - return [CPt.of(r), aSn]; +function $Oe(t = {}) { + return [FK.of(t), POe]; } -const EPt = /* @__PURE__ */ new Ia(); -function EFe(r, n, s) { - let a = r.prop(n < 0 ? Ia.openedBy : Ia.closedBy); - if (a) - return a; - if (r.name.length == 1) { - let l = s.indexOf(r.name); - if (l > -1 && l % 2 == (n < 0 ? 1 : 0)) - return [s[l + n]]; +const zK = /* @__PURE__ */ new lr(); +function m7(t, e, r) { + let n = t.prop(e < 0 ? lr.openedBy : lr.closedBy); + if (n) + return n; + if (t.name.length == 1) { + let i = r.indexOf(t.name); + if (i > -1 && i % 2 == (e < 0 ? 1 : 0)) + return [r[i + e]]; } return null; } -function TFe(r) { - let n = r.type.prop(EPt); - return n ? n(r.node) : r; +function v7(t) { + let e = t.type.prop(zK); + return e ? e(t.node) : t; } -function G4(r, n, s, a = {}) { - let l = a.maxScanDistance || SPt, h = a.brackets || _Pt, f = dh(r), b = f.resolveInner(n, s); - for (let w = b; w; w = w.parent) { - let O = EFe(w.type, s, h); - if (O && w.from < w.to) { - let S = TFe(w); - if (S && (s > 0 ? n >= S.from && n < S.to : n > S.from && n <= S.to)) - return lSn(r, n, s, w, S, O, h); +function mc(t, e, r, n = {}) { + let i = n.maxScanDistance || $K, s = n.brackets || BK, a = fn(t), o = a.resolveInner(e, r); + for (let l = o; l; l = l.parent) { + let u = m7(l.type, r, s); + if (u && l.from < l.to) { + let h = v7(l); + if (h && (r > 0 ? e >= h.from && e < h.to : e > h.from && e <= h.to)) + return BOe(t, e, r, l, h, u, s); } } - return uSn(r, n, s, f, b.type, l, h); + return FOe(t, e, r, a, o.type, i, s); } -function lSn(r, n, s, a, l, h, f) { - let b = a.parent, w = { from: l.from, to: l.to }, O = 0, S = b == null ? void 0 : b.cursor(); - if (S && (s < 0 ? S.childBefore(a.from) : S.childAfter(a.to))) +function BOe(t, e, r, n, i, s, a) { + let o = n.parent, l = { from: i.from, to: i.to }, u = 0, h = o == null ? void 0 : o.cursor(); + if (h && (r < 0 ? h.childBefore(n.from) : h.childAfter(n.to))) do - if (s < 0 ? S.to <= a.from : S.from >= a.to) { - if (O == 0 && h.indexOf(S.type.name) > -1 && S.from < S.to) { - let E = TFe(S); - return { start: w, end: E ? { from: E.from, to: E.to } : void 0, matched: !0 }; - } else if (EFe(S.type, s, f)) - O++; - else if (EFe(S.type, -s, f)) { - if (O == 0) { - let E = TFe(S); + if (r < 0 ? h.to <= n.from : h.from >= n.to) { + if (u == 0 && s.indexOf(h.type.name) > -1 && h.from < h.to) { + let f = v7(h); + return { start: l, end: f ? { from: f.from, to: f.to } : void 0, matched: !0 }; + } else if (m7(h.type, r, a)) + u++; + else if (m7(h.type, -r, a)) { + if (u == 0) { + let f = v7(h); return { - start: w, - end: E && E.from < E.to ? { from: E.from, to: E.to } : void 0, + start: l, + end: f && f.from < f.to ? { from: f.from, to: f.to } : void 0, matched: !1 }; } - O--; + u--; } } - while (s < 0 ? S.prevSibling() : S.nextSibling()); - return { start: w, matched: !1 }; + while (r < 0 ? h.prevSibling() : h.nextSibling()); + return { start: l, matched: !1 }; } -function uSn(r, n, s, a, l, h, f) { - let b = s < 0 ? r.sliceDoc(n - 1, n) : r.sliceDoc(n, n + 1), w = f.indexOf(b); - if (w < 0 || w % 2 == 0 != s > 0) +function FOe(t, e, r, n, i, s, a) { + let o = r < 0 ? t.sliceDoc(e - 1, e) : t.sliceDoc(e, e + 1), l = a.indexOf(o); + if (l < 0 || l % 2 == 0 != r > 0) return null; - let O = { from: s < 0 ? n - 1 : n, to: s > 0 ? n + 1 : n }, S = r.doc.iterRange(n, s > 0 ? r.doc.length : 0), E = 0; - for (let D = 0; !S.next().done && D <= h; ) { - let M = S.value; - s < 0 && (D += M.length); - let B = n + D * s; - for (let z = s > 0 ? 0 : M.length - 1, W = s > 0 ? M.length : -1; z != W; z += s) { - let H = f.indexOf(M[z]); - if (!(H < 0 || a.resolveInner(B + z, 1).type != l)) - if (H % 2 == 0 == s > 0) - E++; + let u = { from: r < 0 ? e - 1 : e, to: r > 0 ? e + 1 : e }, h = t.doc.iterRange(e, r > 0 ? t.doc.length : 0), f = 0; + for (let d = 0; !h.next().done && d <= s; ) { + let p = h.value; + r < 0 && (d += p.length); + let g = e + d * r; + for (let m = r > 0 ? 0 : p.length - 1, v = r > 0 ? p.length : -1; m != v; m += r) { + let y = a.indexOf(p[m]); + if (!(y < 0 || n.resolveInner(g + m, 1).type != i)) + if (y % 2 == 0 == r > 0) + f++; else { - if (E == 1) - return { start: O, end: { from: B + z, to: B + z + 1 }, matched: H >> 1 == w >> 1 }; - E--; + if (f == 1) + return { start: u, end: { from: g + m, to: g + m + 1 }, matched: y >> 1 == l >> 1 }; + f--; } } - s > 0 && (D += M.length); + r > 0 && (d += p.length); } - return S.done ? { start: O, matched: !1 } : null; + return h.done ? { start: u, matched: !1 } : null; } -const hSn = /* @__PURE__ */ Object.create(null), DCt = [f0.none], MCt = [], PCt = /* @__PURE__ */ Object.create(null), fSn = /* @__PURE__ */ Object.create(null); -for (let [r, n] of [ +const zOe = /* @__PURE__ */ Object.create(null), sF = [Li.none], aF = [], oF = /* @__PURE__ */ Object.create(null), VOe = /* @__PURE__ */ Object.create(null); +for (let [t, e] of [ ["variable", "variableName"], ["variable-2", "variableName.special"], ["string-2", "string.special"], @@ -12853,767 +12862,767 @@ for (let [r, n] of [ ["header", "heading"], ["property", "propertyName"] ]) - fSn[r] = /* @__PURE__ */ dSn(hSn, n); -function MRe(r, n) { - MCt.indexOf(r) > -1 || (MCt.push(r), console.warn(n)); + VOe[t] = /* @__PURE__ */ UOe(zOe, e); +function CE(t, e) { + aF.indexOf(t) > -1 || (aF.push(t), console.warn(e)); } -function dSn(r, n) { - let s = []; - for (let b of n.split(" ")) { - let w = []; - for (let O of b.split(".")) { - let S = r[O] || Ft[O]; - S ? typeof S == "function" ? w.length ? w = w.map(S) : MRe(O, `Modifier ${O} used at start of tag`) : w.length ? MRe(O, `Tag ${O} used as modifier`) : w = Array.isArray(S) ? S : [S] : MRe(O, `Unknown highlighting tag ${O}`); +function UOe(t, e) { + let r = []; + for (let o of e.split(" ")) { + let l = []; + for (let u of o.split(".")) { + let h = t[u] || Se[u]; + h ? typeof h == "function" ? l.length ? l = l.map(h) : CE(u, `Modifier ${u} used at start of tag`) : l.length ? CE(u, `Tag ${u} used as modifier`) : l = Array.isArray(h) ? h : [h] : CE(u, `Unknown highlighting tag ${u}`); } - for (let O of w) - s.push(O); + for (let u of l) + r.push(u); } - if (!s.length) + if (!r.length) return 0; - let a = n.replace(/ /g, "_"), l = a + " " + s.map((b) => b.id), h = PCt[l]; - if (h) - return h.id; - let f = PCt[l] = f0.define({ - id: DCt.length, - name: a, - props: [GF({ [a]: s })] + let n = e.replace(/ /g, "_"), i = n + " " + r.map((o) => o.id), s = oF[i]; + if (s) + return s.id; + let a = oF[i] = Li.define({ + id: sF.length, + name: n, + props: [N1({ [n]: r })] }); - return DCt.push(f), f.id; + return sF.push(a), a.id; } -const pSn = (r) => { - let { state: n } = r, s = n.doc.lineAt(n.selection.main.from), a = _ze(r.state, s.from); - return a.line ? gSn(r) : a.block ? bSn(r) : !1; +const qOe = (t) => { + let { state: e } = t, r = e.doc.lineAt(e.selection.main.from), n = jR(t.state, r.from); + return n.line ? QOe(t) : n.block ? WOe(t) : !1; }; -function Sze(r, n) { - return ({ state: s, dispatch: a }) => { - if (s.readOnly) +function ZR(t, e) { + return ({ state: r, dispatch: n }) => { + if (r.readOnly) return !1; - let l = r(n, s); - return l ? (a(s.update(l)), !0) : !1; + let i = t(e, r); + return i ? (n(r.update(i)), !0) : !1; }; } -const gSn = /* @__PURE__ */ Sze(ySn, 0), mSn = /* @__PURE__ */ Sze(TPt, 0), bSn = /* @__PURE__ */ Sze((r, n) => TPt(r, n, wSn(n)), 0); -function _ze(r, n) { - let s = r.languageDataAt("commentTokens", n); - return s.length ? s[0] : {}; +const QOe = /* @__PURE__ */ ZR(XOe, 0), YOe = /* @__PURE__ */ ZR(VK, 0), WOe = /* @__PURE__ */ ZR((t, e) => VK(t, e, HOe(e)), 0); +function jR(t, e) { + let r = t.languageDataAt("commentTokens", e); + return r.length ? r[0] : {}; } -const JZ = 50; -function vSn(r, { open: n, close: s }, a, l) { - let h = r.sliceDoc(a - JZ, a), f = r.sliceDoc(l, l + JZ), b = /\s*$/.exec(h)[0].length, w = /^\s*/.exec(f)[0].length, O = h.length - b; - if (h.slice(O - n.length, O) == n && f.slice(w, w + s.length) == s) +const Rm = 50; +function GOe(t, { open: e, close: r }, n, i) { + let s = t.sliceDoc(n - Rm, n), a = t.sliceDoc(i, i + Rm), o = /\s*$/.exec(s)[0].length, l = /^\s*/.exec(a)[0].length, u = s.length - o; + if (s.slice(u - e.length, u) == e && a.slice(l, l + r.length) == r) return { - open: { pos: a - b, margin: b && 1 }, - close: { pos: l + w, margin: w && 1 } + open: { pos: n - o, margin: o && 1 }, + close: { pos: i + l, margin: l && 1 } }; - let S, E; - l - a <= 2 * JZ ? S = E = r.sliceDoc(a, l) : (S = r.sliceDoc(a, a + JZ), E = r.sliceDoc(l - JZ, l)); - let D = /^\s*/.exec(S)[0].length, M = /\s*$/.exec(E)[0].length, B = E.length - M - s.length; - return S.slice(D, D + n.length) == n && E.slice(B, B + s.length) == s ? { + let h, f; + i - n <= 2 * Rm ? h = f = t.sliceDoc(n, i) : (h = t.sliceDoc(n, n + Rm), f = t.sliceDoc(i - Rm, i)); + let d = /^\s*/.exec(h)[0].length, p = /\s*$/.exec(f)[0].length, g = f.length - p - r.length; + return h.slice(d, d + e.length) == e && f.slice(g, g + r.length) == r ? { open: { - pos: a + D + n.length, - margin: /\s/.test(S.charAt(D + n.length)) ? 1 : 0 + pos: n + d + e.length, + margin: /\s/.test(h.charAt(d + e.length)) ? 1 : 0 }, close: { - pos: l - M - s.length, - margin: /\s/.test(E.charAt(B - 1)) ? 1 : 0 + pos: i - p - r.length, + margin: /\s/.test(f.charAt(g - 1)) ? 1 : 0 } } : null; } -function wSn(r) { - let n = []; - for (let s of r.selection.ranges) { - let a = r.doc.lineAt(s.from), l = s.to <= a.to ? a : r.doc.lineAt(s.to), h = n.length - 1; - h >= 0 && n[h].to > a.from ? n[h].to = l.to : n.push({ from: a.from + /^\s*/.exec(a.text)[0].length, to: l.to }); +function HOe(t) { + let e = []; + for (let r of t.selection.ranges) { + let n = t.doc.lineAt(r.from), i = r.to <= n.to ? n : t.doc.lineAt(r.to), s = e.length - 1; + s >= 0 && e[s].to > n.from ? e[s].to = i.to : e.push({ from: n.from + /^\s*/.exec(n.text)[0].length, to: i.to }); } - return n; + return e; } -function TPt(r, n, s = n.selection.ranges) { - let a = s.map((h) => _ze(n, h.from).block); - if (!a.every((h) => h)) +function VK(t, e, r = e.selection.ranges) { + let n = r.map((s) => jR(e, s.from).block); + if (!n.every((s) => s)) return null; - let l = s.map((h, f) => vSn(n, a[f], h.from, h.to)); - if (r != 2 && !l.every((h) => h)) - return { changes: n.changes(s.map((h, f) => l[f] ? [] : [{ from: h.from, insert: a[f].open + " " }, { from: h.to, insert: " " + a[f].close }])) }; - if (r != 1 && l.some((h) => h)) { - let h = []; - for (let f = 0, b; f < l.length; f++) - if (b = l[f]) { - let w = a[f], { open: O, close: S } = b; - h.push({ from: O.pos - w.open.length, to: O.pos + O.margin }, { from: S.pos - S.margin, to: S.pos + w.close.length }); - } - return { changes: h }; + let i = r.map((s, a) => GOe(e, n[a], s.from, s.to)); + if (t != 2 && !i.every((s) => s)) + return { changes: e.changes(r.map((s, a) => i[a] ? [] : [{ from: s.from, insert: n[a].open + " " }, { from: s.to, insert: " " + n[a].close }])) }; + if (t != 1 && i.some((s) => s)) { + let s = []; + for (let a = 0, o; a < i.length; a++) + if (o = i[a]) { + let l = n[a], { open: u, close: h } = o; + s.push({ from: u.pos - l.open.length, to: u.pos + u.margin }, { from: h.pos - h.margin, to: h.pos + l.close.length }); + } + return { changes: s }; } return null; } -function ySn(r, n, s = n.selection.ranges) { - let a = [], l = -1; - for (let { from: h, to: f } of s) { - let b = a.length, w = 1e9, O = _ze(n, h).line; - if (!!O) { - for (let S = h; S <= f; ) { - let E = n.doc.lineAt(S); - if (E.from > l && (h == f || f > E.from)) { - l = E.from; - let D = /^\s*/.exec(E.text)[0].length, M = D == E.length, B = E.text.slice(D, D + O.length) == O ? D : -1; - D < E.text.length && D < w && (w = D), a.push({ line: E, comment: B, token: O, indent: D, empty: M, single: !1 }); +function XOe(t, e, r = e.selection.ranges) { + let n = [], i = -1; + for (let { from: s, to: a } of r) { + let o = n.length, l = 1e9, u = jR(e, s).line; + if (!!u) { + for (let h = s; h <= a; ) { + let f = e.doc.lineAt(h); + if (f.from > i && (s == a || a > f.from)) { + i = f.from; + let d = /^\s*/.exec(f.text)[0].length, p = d == f.length, g = f.text.slice(d, d + u.length) == u ? d : -1; + d < f.text.length && d < l && (l = d), n.push({ line: f, comment: g, token: u, indent: d, empty: p, single: !1 }); } - S = E.to + 1; + h = f.to + 1; } - if (w < 1e9) - for (let S = b; S < a.length; S++) - a[S].indent < a[S].line.text.length && (a[S].indent = w); - a.length == b + 1 && (a[b].single = !0); + if (l < 1e9) + for (let h = o; h < n.length; h++) + n[h].indent < n[h].line.text.length && (n[h].indent = l); + n.length == o + 1 && (n[o].single = !0); } } - if (r != 2 && a.some((h) => h.comment < 0 && (!h.empty || h.single))) { - let h = []; - for (let { line: b, token: w, indent: O, empty: S, single: E } of a) - (E || !S) && h.push({ from: b.from + O, insert: w + " " }); - let f = n.changes(h); - return { changes: f, selection: n.selection.map(f, 1) }; - } else if (r != 1 && a.some((h) => h.comment >= 0)) { - let h = []; - for (let { line: f, comment: b, token: w } of a) - if (b >= 0) { - let O = f.from + b, S = O + w.length; - f.text[S - f.from] == " " && S++, h.push({ from: O, to: S }); + if (t != 2 && n.some((s) => s.comment < 0 && (!s.empty || s.single))) { + let s = []; + for (let { line: o, token: l, indent: u, empty: h, single: f } of n) + (f || !h) && s.push({ from: o.from + u, insert: l + " " }); + let a = e.changes(s); + return { changes: a, selection: e.selection.map(a, 1) }; + } else if (t != 1 && n.some((s) => s.comment >= 0)) { + let s = []; + for (let { line: a, comment: o, token: l } of n) + if (o >= 0) { + let u = a.from + o, h = u + l.length; + a.text[h - a.from] == " " && h++, s.push({ from: u, to: h }); } - return { changes: h }; + return { changes: s }; } return null; } -const AFe = /* @__PURE__ */ _k.define(), OSn = /* @__PURE__ */ _k.define(), kSn = /* @__PURE__ */ us.define(), APt = /* @__PURE__ */ us.define({ - combine(r) { - return px(r, { +const y7 = /* @__PURE__ */ Vl.define(), ZOe = /* @__PURE__ */ Vl.define(), jOe = /* @__PURE__ */ _t.define(), UK = /* @__PURE__ */ _t.define({ + combine(t) { + return qc(t, { minDepth: 100, newGroupDelay: 500, - joinToEvent: (n, s) => s + joinToEvent: (e, r) => r }, { minDepth: Math.max, newGroupDelay: Math.min, - joinToEvent: (n, s) => (a, l) => n(a, l) || s(a, l) + joinToEvent: (e, r) => (n, i) => e(n, i) || r(n, i) }); } -}), DPt = /* @__PURE__ */ Ef.define({ +}), qK = /* @__PURE__ */ Pn.define({ create() { - return Z4.empty; + return vc.empty; }, - update(r, n) { - let s = n.state.facet(APt), a = n.annotation(AFe); - if (a) { - let w = sv.fromTransaction(n, a.selection), O = a.side, S = O == 0 ? r.undone : r.done; - return w ? S = eve(S, S.length, s.minDepth, w) : S = LPt(S, n.startState.selection), new Z4(O == 0 ? a.rest : S, O == 0 ? S : a.rest); - } - let l = n.annotation(OSn); - if ((l == "full" || l == "before") && (r = r.isolate()), n.annotation(v1.addToHistory) === !1) - return n.changes.empty ? r : r.addMapping(n.changes.desc); - let h = sv.fromTransaction(n), f = n.annotation(v1.time), b = n.annotation(v1.userEvent); - return h ? r = r.addChanges(h, f, b, s, n) : n.selection && (r = r.addSelection(n.startState.selection, f, b, s.newGroupDelay)), (l == "full" || l == "after") && (r = r.isolate()), r; + update(t, e) { + let r = e.state.facet(UK), n = e.annotation(y7); + if (n) { + let l = Ma.fromTransaction(e, n.selection), u = n.side, h = u == 0 ? t.undone : t.done; + return l ? h = L5(h, h.length, r.minDepth, l) : h = WK(h, e.startState.selection), new vc(u == 0 ? n.rest : h, u == 0 ? h : n.rest); + } + let i = e.annotation(ZOe); + if ((i == "full" || i == "before") && (t = t.isolate()), e.annotation(fi.addToHistory) === !1) + return e.changes.empty ? t : t.addMapping(e.changes.desc); + let s = Ma.fromTransaction(e), a = e.annotation(fi.time), o = e.annotation(fi.userEvent); + return s ? t = t.addChanges(s, a, o, r, e) : e.selection && (t = t.addSelection(e.startState.selection, a, o, r.newGroupDelay)), (i == "full" || i == "after") && (t = t.isolate()), t; }, - toJSON(r) { - return { done: r.done.map((n) => n.toJSON()), undone: r.undone.map((n) => n.toJSON()) }; + toJSON(t) { + return { done: t.done.map((e) => e.toJSON()), undone: t.undone.map((e) => e.toJSON()) }; }, - fromJSON(r) { - return new Z4(r.done.map(sv.fromJSON), r.undone.map(sv.fromJSON)); + fromJSON(t) { + return new vc(t.done.map(Ma.fromJSON), t.undone.map(Ma.fromJSON)); } }); -function Cze(r = {}) { +function KR(t = {}) { return [ - DPt, - APt.of(r), - Ci.domEventHandlers({ - beforeinput(n, s) { - let a = n.inputType == "historyUndo" ? MPt : n.inputType == "historyRedo" ? Jbe : null; - return a ? (n.preventDefault(), a(s)) : !1; + qK, + UK.of(t), + dt.domEventHandlers({ + beforeinput(e, r) { + let n = e.inputType == "historyUndo" ? QK : e.inputType == "historyRedo" ? A5 : null; + return n ? (e.preventDefault(), n(r)) : !1; } }) ]; } -function ewe(r, n) { - return function({ state: s, dispatch: a }) { - if (!n && s.readOnly) +function FS(t, e) { + return function({ state: r, dispatch: n }) { + if (!e && r.readOnly) return !1; - let l = s.field(DPt, !1); - if (!l) + let i = r.field(qK, !1); + if (!i) return !1; - let h = l.pop(r, s, n); - return h ? (a(h), !0) : !1; + let s = i.pop(t, r, e); + return s ? (n(s), !0) : !1; }; } -const MPt = /* @__PURE__ */ ewe(0, !1), Jbe = /* @__PURE__ */ ewe(1, !1), xSn = /* @__PURE__ */ ewe(0, !0), SSn = /* @__PURE__ */ ewe(1, !0); -class sv { - constructor(n, s, a, l, h) { - this.changes = n, this.effects = s, this.mapped = a, this.startSelection = l, this.selectionsAfter = h; +const QK = /* @__PURE__ */ FS(0, !1), A5 = /* @__PURE__ */ FS(1, !1), KOe = /* @__PURE__ */ FS(0, !0), JOe = /* @__PURE__ */ FS(1, !0); +class Ma { + constructor(e, r, n, i, s) { + this.changes = e, this.effects = r, this.mapped = n, this.startSelection = i, this.selectionsAfter = s; } - setSelAfter(n) { - return new sv(this.changes, this.effects, this.mapped, this.startSelection, n); + setSelAfter(e) { + return new Ma(this.changes, this.effects, this.mapped, this.startSelection, e); } toJSON() { - var n, s, a; + var e, r, n; return { - changes: (n = this.changes) === null || n === void 0 ? void 0 : n.toJSON(), - mapped: (s = this.mapped) === null || s === void 0 ? void 0 : s.toJSON(), - startSelection: (a = this.startSelection) === null || a === void 0 ? void 0 : a.toJSON(), - selectionsAfter: this.selectionsAfter.map((l) => l.toJSON()) + changes: (e = this.changes) === null || e === void 0 ? void 0 : e.toJSON(), + mapped: (r = this.mapped) === null || r === void 0 ? void 0 : r.toJSON(), + startSelection: (n = this.startSelection) === null || n === void 0 ? void 0 : n.toJSON(), + selectionsAfter: this.selectionsAfter.map((i) => i.toJSON()) }; } - static fromJSON(n) { - return new sv(n.changes && f1.fromJSON(n.changes), [], n.mapped && tx.fromJSON(n.mapped), n.startSelection && sr.fromJSON(n.startSelection), n.selectionsAfter.map(sr.fromJSON)); + static fromJSON(e) { + return new Ma(e.changes && ai.fromJSON(e.changes), [], e.mapped && _c.fromJSON(e.mapped), e.startSelection && Ve.fromJSON(e.startSelection), e.selectionsAfter.map(Ve.fromJSON)); } - static fromTransaction(n, s) { - let a = Vy; - for (let l of n.startState.facet(kSn)) { - let h = l(n); - h.length && (a = a.concat(h)); + static fromTransaction(e, r) { + let n = Do; + for (let i of e.startState.facet(jOe)) { + let s = i(e); + s.length && (n = n.concat(s)); } - return !a.length && n.changes.empty ? null : new sv(n.changes.invert(n.startState.doc), a, void 0, s || n.startState.selection, Vy); + return !n.length && e.changes.empty ? null : new Ma(e.changes.invert(e.startState.doc), n, void 0, r || e.startState.selection, Do); } - static selection(n) { - return new sv(void 0, Vy, void 0, void 0, n); + static selection(e) { + return new Ma(void 0, Do, void 0, void 0, e); } } -function eve(r, n, s, a) { - let l = n + 1 > s + 20 ? n - s - 1 : 0, h = r.slice(l, n); - return h.push(a), h; +function L5(t, e, r, n) { + let i = e + 1 > r + 20 ? e - r - 1 : 0, s = t.slice(i, e); + return s.push(n), s; } -function _Sn(r, n) { - let s = [], a = !1; - return r.iterChangedRanges((l, h) => s.push(l, h)), n.iterChangedRanges((l, h, f, b) => { - for (let w = 0; w < s.length; ) { - let O = s[w++], S = s[w++]; - b >= O && f <= S && (a = !0); +function e4e(t, e) { + let r = [], n = !1; + return t.iterChangedRanges((i, s) => r.push(i, s)), e.iterChangedRanges((i, s, a, o) => { + for (let l = 0; l < r.length; ) { + let u = r[l++], h = r[l++]; + o >= u && a <= h && (n = !0); } - }), a; + }), n; } -function CSn(r, n) { - return r.ranges.length == n.ranges.length && r.ranges.filter((s, a) => s.empty != n.ranges[a].empty).length === 0; +function t4e(t, e) { + return t.ranges.length == e.ranges.length && t.ranges.filter((r, n) => r.empty != e.ranges[n].empty).length === 0; } -function PPt(r, n) { - return r.length ? n.length ? r.concat(n) : r : n; +function YK(t, e) { + return t.length ? e.length ? t.concat(e) : t : e; } -const Vy = [], ESn = 200; -function LPt(r, n) { - if (r.length) { - let s = r[r.length - 1], a = s.selectionsAfter.slice(Math.max(0, s.selectionsAfter.length - ESn)); - return a.length && a[a.length - 1].eq(n) ? r : (a.push(n), eve(r, r.length - 1, 1e9, s.setSelAfter(a))); +const Do = [], r4e = 200; +function WK(t, e) { + if (t.length) { + let r = t[t.length - 1], n = r.selectionsAfter.slice(Math.max(0, r.selectionsAfter.length - r4e)); + return n.length && n[n.length - 1].eq(e) ? t : (n.push(e), L5(t, t.length - 1, 1e9, r.setSelAfter(n))); } else - return [sv.selection([n])]; + return [Ma.selection([e])]; } -function TSn(r) { - let n = r[r.length - 1], s = r.slice(); - return s[r.length - 1] = n.setSelAfter(n.selectionsAfter.slice(0, n.selectionsAfter.length - 1)), s; +function n4e(t) { + let e = t[t.length - 1], r = t.slice(); + return r[t.length - 1] = e.setSelAfter(e.selectionsAfter.slice(0, e.selectionsAfter.length - 1)), r; } -function PRe(r, n) { - if (!r.length) - return r; - let s = r.length, a = Vy; - for (; s; ) { - let l = ASn(r[s - 1], n, a); - if (l.changes && !l.changes.empty || l.effects.length) { - let h = r.slice(0, s); - return h[s - 1] = l, h; +function EE(t, e) { + if (!t.length) + return t; + let r = t.length, n = Do; + for (; r; ) { + let i = i4e(t[r - 1], e, n); + if (i.changes && !i.changes.empty || i.effects.length) { + let s = t.slice(0, r); + return s[r - 1] = i, s; } else - n = l.mapped, s--, a = l.selectionsAfter; + e = i.mapped, r--, n = i.selectionsAfter; } - return a.length ? [sv.selection(a)] : Vy; + return n.length ? [Ma.selection(n)] : Do; } -function ASn(r, n, s) { - let a = PPt(r.selectionsAfter.length ? r.selectionsAfter.map((b) => b.map(n)) : Vy, s); - if (!r.changes) - return sv.selection(a); - let l = r.changes.map(n), h = n.mapDesc(r.changes, !0), f = r.mapped ? r.mapped.composeDesc(h) : h; - return new sv(l, $o.mapEffects(r.effects, n), f, r.startSelection.map(h), a); +function i4e(t, e, r) { + let n = YK(t.selectionsAfter.length ? t.selectionsAfter.map((o) => o.map(e)) : Do, r); + if (!t.changes) + return Ma.selection(n); + let i = t.changes.map(e), s = e.mapDesc(t.changes, !0), a = t.mapped ? t.mapped.composeDesc(s) : s; + return new Ma(i, Zt.mapEffects(t.effects, e), a, t.startSelection.map(s), n); } -const DSn = /^(input\.type|delete)($|\.)/; -class Z4 { - constructor(n, s, a = 0, l = void 0) { - this.done = n, this.undone = s, this.prevTime = a, this.prevUserEvent = l; +const s4e = /^(input\.type|delete)($|\.)/; +class vc { + constructor(e, r, n = 0, i = void 0) { + this.done = e, this.undone = r, this.prevTime = n, this.prevUserEvent = i; } isolate() { - return this.prevTime ? new Z4(this.done, this.undone) : this; + return this.prevTime ? new vc(this.done, this.undone) : this; } - addChanges(n, s, a, l, h) { - let f = this.done, b = f[f.length - 1]; - return b && b.changes && !b.changes.empty && n.changes && (!a || DSn.test(a)) && (!b.selectionsAfter.length && s - this.prevTime < l.newGroupDelay && l.joinToEvent(h, _Sn(b.changes, n.changes)) || a == "input.type.compose") ? f = eve(f, f.length - 1, l.minDepth, new sv(n.changes.compose(b.changes), PPt(n.effects, b.effects), b.mapped, b.startSelection, Vy)) : f = eve(f, f.length, l.minDepth, n), new Z4(f, Vy, s, a); + addChanges(e, r, n, i, s) { + let a = this.done, o = a[a.length - 1]; + return o && o.changes && !o.changes.empty && e.changes && (!n || s4e.test(n)) && (!o.selectionsAfter.length && r - this.prevTime < i.newGroupDelay && i.joinToEvent(s, e4e(o.changes, e.changes)) || n == "input.type.compose") ? a = L5(a, a.length - 1, i.minDepth, new Ma(e.changes.compose(o.changes), YK(e.effects, o.effects), o.mapped, o.startSelection, Do)) : a = L5(a, a.length, i.minDepth, e), new vc(a, Do, r, n); } - addSelection(n, s, a, l) { - let h = this.done.length ? this.done[this.done.length - 1].selectionsAfter : Vy; - return h.length > 0 && s - this.prevTime < l && a == this.prevUserEvent && a && /^select($|\.)/.test(a) && CSn(h[h.length - 1], n) ? this : new Z4(LPt(this.done, n), this.undone, s, a); + addSelection(e, r, n, i) { + let s = this.done.length ? this.done[this.done.length - 1].selectionsAfter : Do; + return s.length > 0 && r - this.prevTime < i && n == this.prevUserEvent && n && /^select($|\.)/.test(n) && t4e(s[s.length - 1], e) ? this : new vc(WK(this.done, e), this.undone, r, n); } - addMapping(n) { - return new Z4(PRe(this.done, n), PRe(this.undone, n), this.prevTime, this.prevUserEvent); + addMapping(e) { + return new vc(EE(this.done, e), EE(this.undone, e), this.prevTime, this.prevUserEvent); } - pop(n, s, a) { - let l = n == 0 ? this.done : this.undone; - if (l.length == 0) + pop(e, r, n) { + let i = e == 0 ? this.done : this.undone; + if (i.length == 0) return null; - let h = l[l.length - 1], f = h.selectionsAfter[0] || s.selection; - if (a && h.selectionsAfter.length) - return s.update({ - selection: h.selectionsAfter[h.selectionsAfter.length - 1], - annotations: AFe.of({ side: n, rest: TSn(l), selection: f }), - userEvent: n == 0 ? "select.undo" : "select.redo", + let s = i[i.length - 1], a = s.selectionsAfter[0] || r.selection; + if (n && s.selectionsAfter.length) + return r.update({ + selection: s.selectionsAfter[s.selectionsAfter.length - 1], + annotations: y7.of({ side: e, rest: n4e(i), selection: a }), + userEvent: e == 0 ? "select.undo" : "select.redo", scrollIntoView: !0 }); - if (h.changes) { - let b = l.length == 1 ? Vy : l.slice(0, l.length - 1); - return h.mapped && (b = PRe(b, h.mapped)), s.update({ - changes: h.changes, - selection: h.startSelection, - effects: h.effects, - annotations: AFe.of({ side: n, rest: b, selection: f }), + if (s.changes) { + let o = i.length == 1 ? Do : i.slice(0, i.length - 1); + return s.mapped && (o = EE(o, s.mapped)), r.update({ + changes: s.changes, + selection: s.startSelection, + effects: s.effects, + annotations: y7.of({ side: e, rest: o, selection: a }), filter: !1, - userEvent: n == 0 ? "undo" : "redo", + userEvent: e == 0 ? "undo" : "redo", scrollIntoView: !0 }); } else return null; } } -Z4.empty = /* @__PURE__ */ new Z4(Vy, Vy); -const IPt = [ - { key: "Mod-z", run: MPt, preventDefault: !0 }, - { key: "Mod-y", mac: "Mod-Shift-z", run: Jbe, preventDefault: !0 }, - { linux: "Ctrl-Shift-z", run: Jbe, preventDefault: !0 }, - { key: "Mod-u", run: xSn, preventDefault: !0 }, - { key: "Alt-u", mac: "Mod-Shift-u", run: SSn, preventDefault: !0 } +vc.empty = /* @__PURE__ */ new vc(Do, Do); +const GK = [ + { key: "Mod-z", run: QK, preventDefault: !0 }, + { key: "Mod-y", mac: "Mod-Shift-z", run: A5, preventDefault: !0 }, + { linux: "Ctrl-Shift-z", run: A5, preventDefault: !0 }, + { key: "Mod-u", run: KOe, preventDefault: !0 }, + { key: "Alt-u", mac: "Mod-Shift-u", run: JOe, preventDefault: !0 } ]; -function XF(r, n) { - return sr.create(r.ranges.map(n), r.mainIndex); +function P1(t, e) { + return Ve.create(t.ranges.map(e), t.mainIndex); } -function gx(r, n) { - return r.update({ selection: n, scrollIntoView: !0, userEvent: "select" }); +function Qc(t, e) { + return t.update({ selection: e, scrollIntoView: !0, userEvent: "select" }); } -function Ck({ state: r, dispatch: n }, s) { - let a = XF(r.selection, s); - return a.eq(r.selection) ? !1 : (n(gx(r, a)), !0); +function Ul({ state: t, dispatch: e }, r) { + let n = P1(t.selection, r); + return n.eq(t.selection) ? !1 : (e(Qc(t, n)), !0); } -function twe(r, n) { - return sr.cursor(n ? r.to : r.from); +function zS(t, e) { + return Ve.cursor(e ? t.to : t.from); } -function NPt(r, n) { - return Ck(r, (s) => s.empty ? r.moveByChar(s, n) : twe(s, n)); +function HK(t, e) { + return Ul(t, (r) => r.empty ? t.moveByChar(r, e) : zS(r, e)); } -function Tg(r) { - return r.textDirectionAt(r.state.selection.main.head) == Cf.LTR; +function Us(t) { + return t.textDirectionAt(t.state.selection.main.head) == Nn.LTR; } -const RPt = (r) => NPt(r, !Tg(r)), $Pt = (r) => NPt(r, Tg(r)); -function BPt(r, n) { - return Ck(r, (s) => s.empty ? r.moveByGroup(s, n) : twe(s, n)); +const XK = (t) => HK(t, !Us(t)), ZK = (t) => HK(t, Us(t)); +function jK(t, e) { + return Ul(t, (r) => r.empty ? t.moveByGroup(r, e) : zS(r, e)); } -const MSn = (r) => BPt(r, !Tg(r)), PSn = (r) => BPt(r, Tg(r)); -function LSn(r, n, s) { - if (n.type.prop(s)) +const a4e = (t) => jK(t, !Us(t)), o4e = (t) => jK(t, Us(t)); +function l4e(t, e, r) { + if (e.type.prop(r)) return !0; - let a = n.to - n.from; - return a && (a > 2 || /[^\s,.;:]/.test(r.sliceDoc(n.from, n.to))) || n.firstChild; -} -function nwe(r, n, s) { - let a = dh(r).resolveInner(n.head), l = s ? Ia.closedBy : Ia.openedBy; - for (let w = n.head; ; ) { - let O = s ? a.childAfter(w) : a.childBefore(w); - if (!O) + let n = e.to - e.from; + return n && (n > 2 || /[^\s,.;:]/.test(t.sliceDoc(e.from, e.to))) || e.firstChild; +} +function VS(t, e, r) { + let n = fn(t).resolveInner(e.head), i = r ? lr.closedBy : lr.openedBy; + for (let l = e.head; ; ) { + let u = r ? n.childAfter(l) : n.childBefore(l); + if (!u) break; - LSn(r, O, l) ? a = O : w = s ? O.to : O.from; - } - let h = a.type.prop(l), f, b; - return h && (f = s ? G4(r, a.from, 1) : G4(r, a.to, -1)) && f.matched ? b = s ? f.end.to : f.end.from : b = s ? a.to : a.from, sr.cursor(b, s ? -1 : 1); -} -const ISn = (r) => Ck(r, (n) => nwe(r.state, n, !Tg(r))), NSn = (r) => Ck(r, (n) => nwe(r.state, n, Tg(r))); -function FPt(r, n) { - return Ck(r, (s) => { - if (!s.empty) - return twe(s, n); - let a = r.moveVertically(s, n); - return a.head != s.head ? a : r.moveToLineBoundary(s, n); + l4e(t, u, i) ? n = u : l = r ? u.to : u.from; + } + let s = n.type.prop(i), a, o; + return s && (a = r ? mc(t, n.from, 1) : mc(t, n.to, -1)) && a.matched ? o = r ? a.end.to : a.end.from : o = r ? n.to : n.from, Ve.cursor(o, r ? -1 : 1); +} +const c4e = (t) => Ul(t, (e) => VS(t.state, e, !Us(t))), u4e = (t) => Ul(t, (e) => VS(t.state, e, Us(t))); +function KK(t, e) { + return Ul(t, (r) => { + if (!r.empty) + return zS(r, e); + let n = t.moveVertically(r, e); + return n.head != r.head ? n : t.moveToLineBoundary(r, e); }); } -const jPt = (r) => FPt(r, !1), QPt = (r) => FPt(r, !0); -function zPt(r) { - let n = r.scrollDOM.clientHeight < r.scrollDOM.scrollHeight - 2, s = 0, a = 0, l; - if (n) { - for (let h of r.state.facet(Ci.scrollMargins)) { - let f = h(r); - f != null && f.top && (s = Math.max(f == null ? void 0 : f.top, s)), f != null && f.bottom && (a = Math.max(f == null ? void 0 : f.bottom, a)); +const JK = (t) => KK(t, !1), eJ = (t) => KK(t, !0); +function tJ(t) { + let e = t.scrollDOM.clientHeight < t.scrollDOM.scrollHeight - 2, r = 0, n = 0, i; + if (e) { + for (let s of t.state.facet(dt.scrollMargins)) { + let a = s(t); + a != null && a.top && (r = Math.max(a == null ? void 0 : a.top, r)), a != null && a.bottom && (n = Math.max(a == null ? void 0 : a.bottom, n)); } - l = r.scrollDOM.clientHeight - s - a; + i = t.scrollDOM.clientHeight - r - n; } else - l = (r.dom.ownerDocument.defaultView || window).innerHeight; + i = (t.dom.ownerDocument.defaultView || window).innerHeight; return { - marginTop: s, - marginBottom: a, - selfScroll: n, - height: Math.max(r.defaultLineHeight, l - 5) + marginTop: r, + marginBottom: n, + selfScroll: e, + height: Math.max(t.defaultLineHeight, i - 5) }; } -function qPt(r, n) { - let s = zPt(r), { state: a } = r, l = XF(a.selection, (f) => f.empty ? r.moveVertically(f, n, s.height) : twe(f, n)); - if (l.eq(a.selection)) +function rJ(t, e) { + let r = tJ(t), { state: n } = t, i = P1(n.selection, (a) => a.empty ? t.moveVertically(a, e, r.height) : zS(a, e)); + if (i.eq(n.selection)) return !1; - let h; - if (s.selfScroll) { - let f = r.coordsAtPos(a.selection.main.head), b = r.scrollDOM.getBoundingClientRect(), w = b.top + s.marginTop, O = b.bottom - s.marginBottom; - f && f.top > w && f.bottom < O && (h = Ci.scrollIntoView(l.main.head, { y: "start", yMargin: f.top - w })); - } - return r.dispatch(gx(a, l), { effects: h }), !0; -} -const LCt = (r) => qPt(r, !1), DFe = (r) => qPt(r, !0); -function E8(r, n, s) { - let a = r.lineBlockAt(n.head), l = r.moveToLineBoundary(n, s); - if (l.head == n.head && l.head != (s ? a.to : a.from) && (l = r.moveToLineBoundary(n, s, !1)), !s && l.head == a.from && a.length) { - let h = /^\s*/.exec(r.state.sliceDoc(a.from, Math.min(a.from + 100, a.to)))[0].length; - h && n.head != a.from + h && (l = sr.cursor(a.from + h)); - } - return l; -} -const RSn = (r) => Ck(r, (n) => E8(r, n, !0)), $Sn = (r) => Ck(r, (n) => E8(r, n, !1)), BSn = (r) => Ck(r, (n) => E8(r, n, !Tg(r))), FSn = (r) => Ck(r, (n) => E8(r, n, Tg(r))), jSn = (r) => Ck(r, (n) => sr.cursor(r.lineBlockAt(n.head).from, 1)), QSn = (r) => Ck(r, (n) => sr.cursor(r.lineBlockAt(n.head).to, -1)); -function zSn(r, n, s) { - let a = !1, l = XF(r.selection, (h) => { - let f = G4(r, h.head, -1) || G4(r, h.head, 1) || h.head > 0 && G4(r, h.head - 1, 1) || h.head < r.doc.length && G4(r, h.head + 1, -1); - if (!f || !f.end) - return h; - a = !0; - let b = f.start.from == h.head ? f.end.to : f.end.from; - return s ? sr.range(h.anchor, b) : sr.cursor(b); + let s; + if (r.selfScroll) { + let a = t.coordsAtPos(n.selection.main.head), o = t.scrollDOM.getBoundingClientRect(), l = o.top + r.marginTop, u = o.bottom - r.marginBottom; + a && a.top > l && a.bottom < u && (s = dt.scrollIntoView(i.main.head, { y: "start", yMargin: a.top - l })); + } + return t.dispatch(Qc(n, i), { effects: s }), !0; +} +const lF = (t) => rJ(t, !1), b7 = (t) => rJ(t, !0); +function $f(t, e, r) { + let n = t.lineBlockAt(e.head), i = t.moveToLineBoundary(e, r); + if (i.head == e.head && i.head != (r ? n.to : n.from) && (i = t.moveToLineBoundary(e, r, !1)), !r && i.head == n.from && n.length) { + let s = /^\s*/.exec(t.state.sliceDoc(n.from, Math.min(n.from + 100, n.to)))[0].length; + s && e.head != n.from + s && (i = Ve.cursor(n.from + s)); + } + return i; +} +const h4e = (t) => Ul(t, (e) => $f(t, e, !0)), f4e = (t) => Ul(t, (e) => $f(t, e, !1)), d4e = (t) => Ul(t, (e) => $f(t, e, !Us(t))), p4e = (t) => Ul(t, (e) => $f(t, e, Us(t))), g4e = (t) => Ul(t, (e) => Ve.cursor(t.lineBlockAt(e.head).from, 1)), m4e = (t) => Ul(t, (e) => Ve.cursor(t.lineBlockAt(e.head).to, -1)); +function v4e(t, e, r) { + let n = !1, i = P1(t.selection, (s) => { + let a = mc(t, s.head, -1) || mc(t, s.head, 1) || s.head > 0 && mc(t, s.head - 1, 1) || s.head < t.doc.length && mc(t, s.head + 1, -1); + if (!a || !a.end) + return s; + n = !0; + let o = a.start.from == s.head ? a.end.to : a.end.from; + return r ? Ve.range(s.anchor, o) : Ve.cursor(o); }); - return a ? (n(gx(r, l)), !0) : !1; + return n ? (e(Qc(t, i)), !0) : !1; } -const qSn = ({ state: r, dispatch: n }) => zSn(r, n, !1); -function i3(r, n) { - let s = XF(r.state.selection, (a) => { - let l = n(a); - return sr.range(a.anchor, l.head, l.goalColumn, l.bidiLevel || void 0); +const y4e = ({ state: t, dispatch: e }) => v4e(t, e, !1); +function tl(t, e) { + let r = P1(t.state.selection, (n) => { + let i = e(n); + return Ve.range(n.anchor, i.head, i.goalColumn, i.bidiLevel || void 0); }); - return s.eq(r.state.selection) ? !1 : (r.dispatch(gx(r.state, s)), !0); -} -function VPt(r, n) { - return i3(r, (s) => r.moveByChar(s, n)); -} -const UPt = (r) => VPt(r, !Tg(r)), WPt = (r) => VPt(r, Tg(r)); -function YPt(r, n) { - return i3(r, (s) => r.moveByGroup(s, n)); -} -const VSn = (r) => YPt(r, !Tg(r)), USn = (r) => YPt(r, Tg(r)), WSn = (r) => i3(r, (n) => nwe(r.state, n, !Tg(r))), YSn = (r) => i3(r, (n) => nwe(r.state, n, Tg(r))); -function HPt(r, n) { - return i3(r, (s) => r.moveVertically(s, n)); -} -const GPt = (r) => HPt(r, !1), ZPt = (r) => HPt(r, !0); -function XPt(r, n) { - return i3(r, (s) => r.moveVertically(s, n, zPt(r).height)); -} -const ICt = (r) => XPt(r, !1), NCt = (r) => XPt(r, !0), HSn = (r) => i3(r, (n) => E8(r, n, !0)), GSn = (r) => i3(r, (n) => E8(r, n, !1)), ZSn = (r) => i3(r, (n) => E8(r, n, !Tg(r))), XSn = (r) => i3(r, (n) => E8(r, n, Tg(r))), KSn = (r) => i3(r, (n) => sr.cursor(r.lineBlockAt(n.head).from)), JSn = (r) => i3(r, (n) => sr.cursor(r.lineBlockAt(n.head).to)), RCt = ({ state: r, dispatch: n }) => (n(gx(r, { anchor: 0 })), !0), $Ct = ({ state: r, dispatch: n }) => (n(gx(r, { anchor: r.doc.length })), !0), BCt = ({ state: r, dispatch: n }) => (n(gx(r, { anchor: r.selection.main.anchor, head: 0 })), !0), FCt = ({ state: r, dispatch: n }) => (n(gx(r, { anchor: r.selection.main.anchor, head: r.doc.length })), !0), e6n = ({ state: r, dispatch: n }) => (n(r.update({ selection: { anchor: 0, head: r.doc.length }, userEvent: "select" })), !0), t6n = ({ state: r, dispatch: n }) => { - let s = rwe(r).map(({ from: a, to: l }) => sr.range(a, Math.min(l + 1, r.doc.length))); - return n(r.update({ selection: sr.create(s), userEvent: "select" })), !0; -}, n6n = ({ state: r, dispatch: n }) => { - let s = XF(r.selection, (a) => { - var l; - let h = dh(r).resolveStack(a.from, 1); - for (let f = h; f; f = f.next) { - let { node: b } = f; - if ((b.from < a.from && b.to >= a.to || b.to > a.to && b.from <= a.from) && ((l = b.parent) === null || l === void 0 ? void 0 : l.parent)) - return sr.range(b.to, b.from); + return r.eq(t.state.selection) ? !1 : (t.dispatch(Qc(t.state, r)), !0); +} +function nJ(t, e) { + return tl(t, (r) => t.moveByChar(r, e)); +} +const iJ = (t) => nJ(t, !Us(t)), sJ = (t) => nJ(t, Us(t)); +function aJ(t, e) { + return tl(t, (r) => t.moveByGroup(r, e)); +} +const b4e = (t) => aJ(t, !Us(t)), x4e = (t) => aJ(t, Us(t)), w4e = (t) => tl(t, (e) => VS(t.state, e, !Us(t))), O4e = (t) => tl(t, (e) => VS(t.state, e, Us(t))); +function oJ(t, e) { + return tl(t, (r) => t.moveVertically(r, e)); +} +const lJ = (t) => oJ(t, !1), cJ = (t) => oJ(t, !0); +function uJ(t, e) { + return tl(t, (r) => t.moveVertically(r, e, tJ(t).height)); +} +const cF = (t) => uJ(t, !1), uF = (t) => uJ(t, !0), k4e = (t) => tl(t, (e) => $f(t, e, !0)), S4e = (t) => tl(t, (e) => $f(t, e, !1)), T4e = (t) => tl(t, (e) => $f(t, e, !Us(t))), C4e = (t) => tl(t, (e) => $f(t, e, Us(t))), E4e = (t) => tl(t, (e) => Ve.cursor(t.lineBlockAt(e.head).from)), _4e = (t) => tl(t, (e) => Ve.cursor(t.lineBlockAt(e.head).to)), hF = ({ state: t, dispatch: e }) => (e(Qc(t, { anchor: 0 })), !0), fF = ({ state: t, dispatch: e }) => (e(Qc(t, { anchor: t.doc.length })), !0), dF = ({ state: t, dispatch: e }) => (e(Qc(t, { anchor: t.selection.main.anchor, head: 0 })), !0), pF = ({ state: t, dispatch: e }) => (e(Qc(t, { anchor: t.selection.main.anchor, head: t.doc.length })), !0), A4e = ({ state: t, dispatch: e }) => (e(t.update({ selection: { anchor: 0, head: t.doc.length }, userEvent: "select" })), !0), L4e = ({ state: t, dispatch: e }) => { + let r = US(t).map(({ from: n, to: i }) => Ve.range(n, Math.min(i + 1, t.doc.length))); + return e(t.update({ selection: Ve.create(r), userEvent: "select" })), !0; +}, R4e = ({ state: t, dispatch: e }) => { + let r = P1(t.selection, (n) => { + var i; + let s = fn(t).resolveStack(n.from, 1); + for (let a = s; a; a = a.next) { + let { node: o } = a; + if ((o.from < n.from && o.to >= n.to || o.to > n.to && o.from <= n.from) && ((i = o.parent) === null || i === void 0 ? void 0 : i.parent)) + return Ve.range(o.to, o.from); } - return a; + return n; }); - return n(gx(r, s)), !0; -}, r6n = ({ state: r, dispatch: n }) => { - let s = r.selection, a = null; - return s.ranges.length > 1 ? a = sr.create([s.main]) : s.main.empty || (a = sr.create([sr.cursor(s.main.head)])), a ? (n(gx(r, a)), !0) : !1; + return e(Qc(t, r)), !0; +}, M4e = ({ state: t, dispatch: e }) => { + let r = t.selection, n = null; + return r.ranges.length > 1 ? n = Ve.create([r.main]) : r.main.empty || (n = Ve.create([Ve.cursor(r.main.head)])), n ? (e(Qc(t, n)), !0) : !1; }; -function RJ(r, n) { - if (r.state.readOnly) +function Hb(t, e) { + if (t.state.readOnly) return !1; - let s = "delete.selection", { state: a } = r, l = a.changeByRange((h) => { - let { from: f, to: b } = h; - if (f == b) { - let w = n(h); - w < f ? (s = "delete.backward", w = Xge(r, w, !1)) : w > f && (s = "delete.forward", w = Xge(r, w, !0)), f = Math.min(f, w), b = Math.max(b, w); + let r = "delete.selection", { state: n } = t, i = n.changeByRange((s) => { + let { from: a, to: o } = s; + if (a == o) { + let l = e(s); + l < a ? (r = "delete.backward", l = Tw(t, l, !1)) : l > a && (r = "delete.forward", l = Tw(t, l, !0)), a = Math.min(a, l), o = Math.max(o, l); } else - f = Xge(r, f, !1), b = Xge(r, b, !0); - return f == b ? { range: h } : { changes: { from: f, to: b }, range: sr.cursor(f, f < h.head ? -1 : 1) }; + a = Tw(t, a, !1), o = Tw(t, o, !0); + return a == o ? { range: s } : { changes: { from: a, to: o }, range: Ve.cursor(a, a < s.head ? -1 : 1) }; }); - return l.changes.empty ? !1 : (r.dispatch(a.update(l, { + return i.changes.empty ? !1 : (t.dispatch(n.update(i, { scrollIntoView: !0, - userEvent: s, - effects: s == "delete.selection" ? Ci.announce.of(a.phrase("Selection deleted")) : void 0 + userEvent: r, + effects: r == "delete.selection" ? dt.announce.of(n.phrase("Selection deleted")) : void 0 })), !0); } -function Xge(r, n, s) { - if (r instanceof Ci) - for (let a of r.state.facet(Ci.atomicRanges).map((l) => l(r))) - a.between(n, n, (l, h) => { - l < n && h > n && (n = s ? h : l); +function Tw(t, e, r) { + if (t instanceof dt) + for (let n of t.state.facet(dt.atomicRanges).map((i) => i(t))) + n.between(e, e, (i, s) => { + i < e && s > e && (e = r ? s : i); }); - return n; -} -const KPt = (r, n) => RJ(r, (s) => { - let a = s.from, { state: l } = r, h = l.doc.lineAt(a), f, b; - if (!n && a > h.from && a < h.from + 200 && !/[^ \t]/.test(f = h.text.slice(0, a - h.from))) { - if (f[f.length - 1] == " ") - return a - 1; - let w = gk(f, l.tabSize), O = w % Zbe(l) || Zbe(l); - for (let S = 0; S < O && f[f.length - 1 - S] == " "; S++) - a--; - b = a; + return e; +} +const hJ = (t, e) => Hb(t, (r) => { + let n = r.from, { state: i } = t, s = i.doc.lineAt(n), a, o; + if (!e && n > s.from && n < s.from + 200 && !/[^ \t]/.test(a = s.text.slice(0, n - s.from))) { + if (a[a.length - 1] == " ") + return n - 1; + let l = Ml(a, i.tabSize), u = l % C5(i) || C5(i); + for (let h = 0; h < u && a[a.length - 1 - h] == " "; h++) + n--; + o = n; } else - b = Np(h.text, a - h.from, n, n) + h.from, b == a && h.number != (n ? l.doc.lines : 1) ? b += n ? 1 : -1 : !n && /[\ufe00-\ufe0f]/.test(h.text.slice(b - h.from, a - h.from)) && (b = Np(h.text, b - h.from, !1, !1) + h.from); - return b; -}), MFe = (r) => KPt(r, !1), JPt = (r) => KPt(r, !0), eLt = (r, n) => RJ(r, (s) => { - let a = s.head, { state: l } = r, h = l.doc.lineAt(a), f = l.charCategorizer(a); - for (let b = null; ; ) { - if (a == (n ? h.to : h.from)) { - a == s.head && h.number != (n ? l.doc.lines : 1) && (a += n ? 1 : -1); + o = ls(s.text, n - s.from, e, e) + s.from, o == n && s.number != (e ? i.doc.lines : 1) ? o += e ? 1 : -1 : !e && /[\ufe00-\ufe0f]/.test(s.text.slice(o - s.from, n - s.from)) && (o = ls(s.text, o - s.from, !1, !1) + s.from); + return o; +}), x7 = (t) => hJ(t, !1), fJ = (t) => hJ(t, !0), dJ = (t, e) => Hb(t, (r) => { + let n = r.head, { state: i } = t, s = i.doc.lineAt(n), a = i.charCategorizer(n); + for (let o = null; ; ) { + if (n == (e ? s.to : s.from)) { + n == r.head && s.number != (e ? i.doc.lines : 1) && (n += e ? 1 : -1); break; } - let w = Np(h.text, a - h.from, n) + h.from, O = h.text.slice(Math.min(a, w) - h.from, Math.max(a, w) - h.from), S = f(O); - if (b != null && S != b) + let l = ls(s.text, n - s.from, e) + s.from, u = s.text.slice(Math.min(n, l) - s.from, Math.max(n, l) - s.from), h = a(u); + if (o != null && h != o) break; - (O != " " || a != s.head) && (b = S), a = w; + (u != " " || n != r.head) && (o = h), n = l; } - return a; -}), tLt = (r) => eLt(r, !1), i6n = (r) => eLt(r, !0), s6n = (r) => RJ(r, (n) => { - let s = r.lineBlockAt(n.head).to; - return n.head < s ? s : Math.min(r.state.doc.length, n.head + 1); -}), o6n = (r) => RJ(r, (n) => { - let s = r.moveToLineBoundary(n, !1).head; - return n.head > s ? s : Math.max(0, n.head - 1); -}), a6n = (r) => RJ(r, (n) => { - let s = r.moveToLineBoundary(n, !0).head; - return n.head < s ? s : Math.min(r.state.doc.length, n.head + 1); -}), c6n = ({ state: r, dispatch: n }) => { - if (r.readOnly) + return n; +}), pJ = (t) => dJ(t, !1), D4e = (t) => dJ(t, !0), N4e = (t) => Hb(t, (e) => { + let r = t.lineBlockAt(e.head).to; + return e.head < r ? r : Math.min(t.state.doc.length, e.head + 1); +}), I4e = (t) => Hb(t, (e) => { + let r = t.moveToLineBoundary(e, !1).head; + return e.head > r ? r : Math.max(0, e.head - 1); +}), P4e = (t) => Hb(t, (e) => { + let r = t.moveToLineBoundary(e, !0).head; + return e.head < r ? r : Math.min(t.state.doc.length, e.head + 1); +}), $4e = ({ state: t, dispatch: e }) => { + if (t.readOnly) return !1; - let s = r.changeByRange((a) => ({ - changes: { from: a.from, to: a.to, insert: Al.of(["", ""]) }, - range: sr.cursor(a.from) + let r = t.changeByRange((n) => ({ + changes: { from: n.from, to: n.to, insert: Dr.of(["", ""]) }, + range: Ve.cursor(n.from) })); - return n(r.update(s, { scrollIntoView: !0, userEvent: "input" })), !0; -}, l6n = ({ state: r, dispatch: n }) => { - if (r.readOnly) + return e(t.update(r, { scrollIntoView: !0, userEvent: "input" })), !0; +}, B4e = ({ state: t, dispatch: e }) => { + if (t.readOnly) return !1; - let s = r.changeByRange((a) => { - if (!a.empty || a.from == 0 || a.from == r.doc.length) - return { range: a }; - let l = a.from, h = r.doc.lineAt(l), f = l == h.from ? l - 1 : Np(h.text, l - h.from, !1) + h.from, b = l == h.to ? l + 1 : Np(h.text, l - h.from, !0) + h.from; + let r = t.changeByRange((n) => { + if (!n.empty || n.from == 0 || n.from == t.doc.length) + return { range: n }; + let i = n.from, s = t.doc.lineAt(i), a = i == s.from ? i - 1 : ls(s.text, i - s.from, !1) + s.from, o = i == s.to ? i + 1 : ls(s.text, i - s.from, !0) + s.from; return { - changes: { from: f, to: b, insert: r.doc.slice(l, b).append(r.doc.slice(f, l)) }, - range: sr.cursor(b) + changes: { from: a, to: o, insert: t.doc.slice(i, o).append(t.doc.slice(a, i)) }, + range: Ve.cursor(o) }; }); - return s.changes.empty ? !1 : (n(r.update(s, { scrollIntoView: !0, userEvent: "move.character" })), !0); -}; -function rwe(r) { - let n = [], s = -1; - for (let a of r.selection.ranges) { - let l = r.doc.lineAt(a.from), h = r.doc.lineAt(a.to); - if (!a.empty && a.to == h.from && (h = r.doc.lineAt(a.to - 1)), s >= l.number) { - let f = n[n.length - 1]; - f.to = h.to, f.ranges.push(a); + return r.changes.empty ? !1 : (e(t.update(r, { scrollIntoView: !0, userEvent: "move.character" })), !0); +}; +function US(t) { + let e = [], r = -1; + for (let n of t.selection.ranges) { + let i = t.doc.lineAt(n.from), s = t.doc.lineAt(n.to); + if (!n.empty && n.to == s.from && (s = t.doc.lineAt(n.to - 1)), r >= i.number) { + let a = e[e.length - 1]; + a.to = s.to, a.ranges.push(n); } else - n.push({ from: l.from, to: h.to, ranges: [a] }); - s = h.number + 1; + e.push({ from: i.from, to: s.to, ranges: [n] }); + r = s.number + 1; } - return n; + return e; } -function nLt(r, n, s) { - if (r.readOnly) +function gJ(t, e, r) { + if (t.readOnly) return !1; - let a = [], l = []; - for (let h of rwe(r)) { - if (s ? h.to == r.doc.length : h.from == 0) + let n = [], i = []; + for (let s of US(t)) { + if (r ? s.to == t.doc.length : s.from == 0) continue; - let f = r.doc.lineAt(s ? h.to + 1 : h.from - 1), b = f.length + 1; - if (s) { - a.push({ from: h.to, to: f.to }, { from: h.from, insert: f.text + r.lineBreak }); - for (let w of h.ranges) - l.push(sr.range(Math.min(r.doc.length, w.anchor + b), Math.min(r.doc.length, w.head + b))); + let a = t.doc.lineAt(r ? s.to + 1 : s.from - 1), o = a.length + 1; + if (r) { + n.push({ from: s.to, to: a.to }, { from: s.from, insert: a.text + t.lineBreak }); + for (let l of s.ranges) + i.push(Ve.range(Math.min(t.doc.length, l.anchor + o), Math.min(t.doc.length, l.head + o))); } else { - a.push({ from: f.from, to: h.from }, { from: h.to, insert: r.lineBreak + f.text }); - for (let w of h.ranges) - l.push(sr.range(w.anchor - b, w.head - b)); + n.push({ from: a.from, to: s.from }, { from: s.to, insert: t.lineBreak + a.text }); + for (let l of s.ranges) + i.push(Ve.range(l.anchor - o, l.head - o)); } } - return a.length ? (n(r.update({ - changes: a, + return n.length ? (e(t.update({ + changes: n, scrollIntoView: !0, - selection: sr.create(l, r.selection.mainIndex), + selection: Ve.create(i, t.selection.mainIndex), userEvent: "move.line" })), !0) : !1; } -const u6n = ({ state: r, dispatch: n }) => nLt(r, n, !1), h6n = ({ state: r, dispatch: n }) => nLt(r, n, !0); -function rLt(r, n, s) { - if (r.readOnly) +const F4e = ({ state: t, dispatch: e }) => gJ(t, e, !1), z4e = ({ state: t, dispatch: e }) => gJ(t, e, !0); +function mJ(t, e, r) { + if (t.readOnly) return !1; - let a = []; - for (let l of rwe(r)) - s ? a.push({ from: l.from, insert: r.doc.slice(l.from, l.to) + r.lineBreak }) : a.push({ from: l.to, insert: r.lineBreak + r.doc.slice(l.from, l.to) }); - return n(r.update({ changes: a, scrollIntoView: !0, userEvent: "input.copyline" })), !0; + let n = []; + for (let i of US(t)) + r ? n.push({ from: i.from, insert: t.doc.slice(i.from, i.to) + t.lineBreak }) : n.push({ from: i.to, insert: t.lineBreak + t.doc.slice(i.from, i.to) }); + return e(t.update({ changes: n, scrollIntoView: !0, userEvent: "input.copyline" })), !0; } -const f6n = ({ state: r, dispatch: n }) => rLt(r, n, !1), d6n = ({ state: r, dispatch: n }) => rLt(r, n, !0), p6n = (r) => { - if (r.state.readOnly) +const V4e = ({ state: t, dispatch: e }) => mJ(t, e, !1), U4e = ({ state: t, dispatch: e }) => mJ(t, e, !0), q4e = (t) => { + if (t.state.readOnly) return !1; - let { state: n } = r, s = n.changes(rwe(n).map(({ from: l, to: h }) => (l > 0 ? l-- : h < n.doc.length && h++, { from: l, to: h }))), a = XF(n.selection, (l) => r.moveVertically(l, !0)).map(s); - return r.dispatch({ changes: s, selection: a, scrollIntoView: !0, userEvent: "delete.line" }), !0; -}; -function g6n(r, n) { - if (/\(\)|\[\]|\{\}/.test(r.sliceDoc(n - 1, n + 1))) - return { from: n, to: n }; - let s = dh(r).resolveInner(n), a = s.childBefore(n), l = s.childAfter(n), h; - return a && l && a.to <= n && l.from >= n && (h = a.type.prop(Ia.closedBy)) && h.indexOf(l.name) > -1 && r.doc.lineAt(a.to).from == r.doc.lineAt(l.from).from && !/\S/.test(r.sliceDoc(a.to, l.from)) ? { from: a.to, to: l.from } : null; -} -const m6n = /* @__PURE__ */ iLt(!1), b6n = /* @__PURE__ */ iLt(!0); -function iLt(r) { - return ({ state: n, dispatch: s }) => { - if (n.readOnly) + let { state: e } = t, r = e.changes(US(e).map(({ from: i, to: s }) => (i > 0 ? i-- : s < e.doc.length && s++, { from: i, to: s }))), n = P1(e.selection, (i) => t.moveVertically(i, !0)).map(r); + return t.dispatch({ changes: r, selection: n, scrollIntoView: !0, userEvent: "delete.line" }), !0; +}; +function Q4e(t, e) { + if (/\(\)|\[\]|\{\}/.test(t.sliceDoc(e - 1, e + 1))) + return { from: e, to: e }; + let r = fn(t).resolveInner(e), n = r.childBefore(e), i = r.childAfter(e), s; + return n && i && n.to <= e && i.from >= e && (s = n.type.prop(lr.closedBy)) && s.indexOf(i.name) > -1 && t.doc.lineAt(n.to).from == t.doc.lineAt(i.from).from && !/\S/.test(t.sliceDoc(n.to, i.from)) ? { from: n.to, to: i.from } : null; +} +const Y4e = /* @__PURE__ */ vJ(!1), W4e = /* @__PURE__ */ vJ(!0); +function vJ(t) { + return ({ state: e, dispatch: r }) => { + if (e.readOnly) return !1; - let a = n.changeByRange((l) => { - let { from: h, to: f } = l, b = n.doc.lineAt(h), w = !r && h == f && g6n(n, h); - r && (h = f = (f <= b.to ? b : n.doc.lineAt(f)).to); - let O = new K2e(n, { simulateBreak: h, simulateDoubleBreak: !!w }), S = Oze(O, h); - for (S == null && (S = gk(/^\s*/.exec(n.doc.lineAt(h).text)[0], n.tabSize)); f < b.to && /\s/.test(b.text[f - b.from]); ) - f++; - w ? { from: h, to: f } = w : h > b.from && h < b.from + 100 && !/\S/.test(b.text.slice(0, h)) && (h = b.from); - let E = ["", xK(n, S)]; - return w && E.push(xK(n, O.lineIndent(b.from, -1))), { - changes: { from: h, to: f, insert: Al.of(E) }, - range: sr.cursor(h + 1 + E[1].length) + let n = e.changeByRange((i) => { + let { from: s, to: a } = i, o = e.doc.lineAt(s), l = !t && s == a && Q4e(e, s); + t && (s = a = (a <= o.to ? o : e.doc.lineAt(a)).to); + let u = new $S(e, { simulateBreak: s, simulateDoubleBreak: !!l }), h = GR(u, s); + for (h == null && (h = Ml(/^\s*/.exec(e.doc.lineAt(s).text)[0], e.tabSize)); a < o.to && /\s/.test(o.text[a - o.from]); ) + a++; + l ? { from: s, to: a } = l : s > o.from && s < o.from + 100 && !/\S/.test(o.text.slice(0, s)) && (s = o.from); + let f = ["", My(e, h)]; + return l && f.push(My(e, u.lineIndent(o.from, -1))), { + changes: { from: s, to: a, insert: Dr.of(f) }, + range: Ve.cursor(s + 1 + f[1].length) }; }); - return s(n.update(a, { scrollIntoView: !0, userEvent: "input" })), !0; + return r(e.update(n, { scrollIntoView: !0, userEvent: "input" })), !0; }; } -function Eze(r, n) { - let s = -1; - return r.changeByRange((a) => { - let l = []; - for (let f = a.from; f <= a.to; ) { - let b = r.doc.lineAt(f); - b.number > s && (a.empty || a.to > b.from) && (n(b, l, a), s = b.number), f = b.to + 1; +function JR(t, e) { + let r = -1; + return t.changeByRange((n) => { + let i = []; + for (let a = n.from; a <= n.to; ) { + let o = t.doc.lineAt(a); + o.number > r && (n.empty || n.to > o.from) && (e(o, i, n), r = o.number), a = o.to + 1; } - let h = r.changes(l); + let s = t.changes(i); return { - changes: l, - range: sr.range(h.mapPos(a.anchor, 1), h.mapPos(a.head, 1)) + changes: i, + range: Ve.range(s.mapPos(n.anchor, 1), s.mapPos(n.head, 1)) }; }); } -const v6n = ({ state: r, dispatch: n }) => { - if (r.readOnly) +const G4e = ({ state: t, dispatch: e }) => { + if (t.readOnly) return !1; - let s = /* @__PURE__ */ Object.create(null), a = new K2e(r, { overrideIndentation: (h) => { - let f = s[h]; - return f == null ? -1 : f; - } }), l = Eze(r, (h, f, b) => { - let w = Oze(a, h.from); - if (w == null) + let r = /* @__PURE__ */ Object.create(null), n = new $S(t, { overrideIndentation: (s) => { + let a = r[s]; + return a == null ? -1 : a; + } }), i = JR(t, (s, a, o) => { + let l = GR(n, s.from); + if (l == null) return; - /\S/.test(h.text) || (w = 0); - let O = /^\s*/.exec(h.text)[0], S = xK(r, w); - (O != S || b.from < h.from + O.length) && (s[h.from] = w, f.push({ from: h.from, to: h.from + O.length, insert: S })); + /\S/.test(s.text) || (l = 0); + let u = /^\s*/.exec(s.text)[0], h = My(t, l); + (u != h || o.from < s.from + u.length) && (r[s.from] = l, a.push({ from: s.from, to: s.from + u.length, insert: h })); }); - return l.changes.empty || n(r.update(l, { userEvent: "indent" })), !0; -}, sLt = ({ state: r, dispatch: n }) => r.readOnly ? !1 : (n(r.update(Eze(r, (s, a) => { - a.push({ from: s.from, insert: r.facet(IJ) }); -}), { userEvent: "input.indent" })), !0), oLt = ({ state: r, dispatch: n }) => r.readOnly ? !1 : (n(r.update(Eze(r, (s, a) => { - let l = /^\s*/.exec(s.text)[0]; - if (!l) + return i.changes.empty || e(t.update(i, { userEvent: "indent" })), !0; +}, yJ = ({ state: t, dispatch: e }) => t.readOnly ? !1 : (e(t.update(JR(t, (r, n) => { + n.push({ from: r.from, insert: t.facet(Wb) }); +}), { userEvent: "input.indent" })), !0), bJ = ({ state: t, dispatch: e }) => t.readOnly ? !1 : (e(t.update(JR(t, (r, n) => { + let i = /^\s*/.exec(r.text)[0]; + if (!i) return; - let h = gk(l, r.tabSize), f = 0, b = xK(r, Math.max(0, h - Zbe(r))); - for (; f < l.length && f < b.length && l.charCodeAt(f) == b.charCodeAt(f); ) - f++; - a.push({ from: s.from + f, to: s.from + l.length, insert: b.slice(f) }); -}), { userEvent: "delete.dedent" })), !0), w6n = [ - { key: "Ctrl-b", run: RPt, shift: UPt, preventDefault: !0 }, - { key: "Ctrl-f", run: $Pt, shift: WPt }, - { key: "Ctrl-p", run: jPt, shift: GPt }, - { key: "Ctrl-n", run: QPt, shift: ZPt }, - { key: "Ctrl-a", run: jSn, shift: KSn }, - { key: "Ctrl-e", run: QSn, shift: JSn }, - { key: "Ctrl-d", run: JPt }, - { key: "Ctrl-h", run: MFe }, - { key: "Ctrl-k", run: s6n }, - { key: "Ctrl-Alt-h", run: tLt }, - { key: "Ctrl-o", run: c6n }, - { key: "Ctrl-t", run: l6n }, - { key: "Ctrl-v", run: DFe } -], y6n = /* @__PURE__ */ [ - { key: "ArrowLeft", run: RPt, shift: UPt, preventDefault: !0 }, - { key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: MSn, shift: VSn, preventDefault: !0 }, - { mac: "Cmd-ArrowLeft", run: BSn, shift: ZSn, preventDefault: !0 }, - { key: "ArrowRight", run: $Pt, shift: WPt, preventDefault: !0 }, - { key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: PSn, shift: USn, preventDefault: !0 }, - { mac: "Cmd-ArrowRight", run: FSn, shift: XSn, preventDefault: !0 }, - { key: "ArrowUp", run: jPt, shift: GPt, preventDefault: !0 }, - { mac: "Cmd-ArrowUp", run: RCt, shift: BCt }, - { mac: "Ctrl-ArrowUp", run: LCt, shift: ICt }, - { key: "ArrowDown", run: QPt, shift: ZPt, preventDefault: !0 }, - { mac: "Cmd-ArrowDown", run: $Ct, shift: FCt }, - { mac: "Ctrl-ArrowDown", run: DFe, shift: NCt }, - { key: "PageUp", run: LCt, shift: ICt }, - { key: "PageDown", run: DFe, shift: NCt }, - { key: "Home", run: $Sn, shift: GSn, preventDefault: !0 }, - { key: "Mod-Home", run: RCt, shift: BCt }, - { key: "End", run: RSn, shift: HSn, preventDefault: !0 }, - { key: "Mod-End", run: $Ct, shift: FCt }, - { key: "Enter", run: m6n }, - { key: "Mod-a", run: e6n }, - { key: "Backspace", run: MFe, shift: MFe }, - { key: "Delete", run: JPt }, - { key: "Mod-Backspace", mac: "Alt-Backspace", run: tLt }, - { key: "Mod-Delete", mac: "Alt-Delete", run: i6n }, - { mac: "Mod-Backspace", run: o6n }, - { mac: "Mod-Delete", run: a6n } -].concat(/* @__PURE__ */ w6n.map((r) => ({ mac: r.key, run: r.run, shift: r.shift }))), aLt = /* @__PURE__ */ [ - { key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: ISn, shift: WSn }, - { key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: NSn, shift: YSn }, - { key: "Alt-ArrowUp", run: u6n }, - { key: "Shift-Alt-ArrowUp", run: f6n }, - { key: "Alt-ArrowDown", run: h6n }, - { key: "Shift-Alt-ArrowDown", run: d6n }, - { key: "Escape", run: r6n }, - { key: "Mod-Enter", run: b6n }, - { key: "Alt-l", mac: "Ctrl-l", run: t6n }, - { key: "Mod-i", run: n6n, preventDefault: !0 }, - { key: "Mod-[", run: oLt }, - { key: "Mod-]", run: sLt }, - { key: "Mod-Alt-\\", run: v6n }, - { key: "Shift-Mod-k", run: p6n }, - { key: "Shift-Mod-\\", run: qSn }, - { key: "Mod-/", run: pSn }, - { key: "Alt-A", run: mSn } -].concat(y6n), O6n = { key: "Tab", run: sLt, shift: oLt }; -function hh() { - var r = arguments[0]; - typeof r == "string" && (r = document.createElement(r)); - var n = 1, s = arguments[1]; - if (s && typeof s == "object" && s.nodeType == null && !Array.isArray(s)) { - for (var a in s) - if (Object.prototype.hasOwnProperty.call(s, a)) { - var l = s[a]; - typeof l == "string" ? r.setAttribute(a, l) : l != null && (r[a] = l); - } - n++; - } - for (; n < arguments.length; n++) - cLt(r, arguments[n]); - return r; -} -function cLt(r, n) { - if (typeof n == "string") - r.appendChild(document.createTextNode(n)); - else if (n != null) - if (n.nodeType != null) - r.appendChild(n); - else if (Array.isArray(n)) - for (var s = 0; s < n.length; s++) - cLt(r, n[s]); + let s = Ml(i, t.tabSize), a = 0, o = My(t, Math.max(0, s - C5(t))); + for (; a < i.length && a < o.length && i.charCodeAt(a) == o.charCodeAt(a); ) + a++; + n.push({ from: r.from + a, to: r.from + i.length, insert: o.slice(a) }); +}), { userEvent: "delete.dedent" })), !0), H4e = [ + { key: "Ctrl-b", run: XK, shift: iJ, preventDefault: !0 }, + { key: "Ctrl-f", run: ZK, shift: sJ }, + { key: "Ctrl-p", run: JK, shift: lJ }, + { key: "Ctrl-n", run: eJ, shift: cJ }, + { key: "Ctrl-a", run: g4e, shift: E4e }, + { key: "Ctrl-e", run: m4e, shift: _4e }, + { key: "Ctrl-d", run: fJ }, + { key: "Ctrl-h", run: x7 }, + { key: "Ctrl-k", run: N4e }, + { key: "Ctrl-Alt-h", run: pJ }, + { key: "Ctrl-o", run: $4e }, + { key: "Ctrl-t", run: B4e }, + { key: "Ctrl-v", run: b7 } +], X4e = /* @__PURE__ */ [ + { key: "ArrowLeft", run: XK, shift: iJ, preventDefault: !0 }, + { key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: a4e, shift: b4e, preventDefault: !0 }, + { mac: "Cmd-ArrowLeft", run: d4e, shift: T4e, preventDefault: !0 }, + { key: "ArrowRight", run: ZK, shift: sJ, preventDefault: !0 }, + { key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: o4e, shift: x4e, preventDefault: !0 }, + { mac: "Cmd-ArrowRight", run: p4e, shift: C4e, preventDefault: !0 }, + { key: "ArrowUp", run: JK, shift: lJ, preventDefault: !0 }, + { mac: "Cmd-ArrowUp", run: hF, shift: dF }, + { mac: "Ctrl-ArrowUp", run: lF, shift: cF }, + { key: "ArrowDown", run: eJ, shift: cJ, preventDefault: !0 }, + { mac: "Cmd-ArrowDown", run: fF, shift: pF }, + { mac: "Ctrl-ArrowDown", run: b7, shift: uF }, + { key: "PageUp", run: lF, shift: cF }, + { key: "PageDown", run: b7, shift: uF }, + { key: "Home", run: f4e, shift: S4e, preventDefault: !0 }, + { key: "Mod-Home", run: hF, shift: dF }, + { key: "End", run: h4e, shift: k4e, preventDefault: !0 }, + { key: "Mod-End", run: fF, shift: pF }, + { key: "Enter", run: Y4e }, + { key: "Mod-a", run: A4e }, + { key: "Backspace", run: x7, shift: x7 }, + { key: "Delete", run: fJ }, + { key: "Mod-Backspace", mac: "Alt-Backspace", run: pJ }, + { key: "Mod-Delete", mac: "Alt-Delete", run: D4e }, + { mac: "Mod-Backspace", run: I4e }, + { mac: "Mod-Delete", run: P4e } +].concat(/* @__PURE__ */ H4e.map((t) => ({ mac: t.key, run: t.run, shift: t.shift }))), xJ = /* @__PURE__ */ [ + { key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: c4e, shift: w4e }, + { key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: u4e, shift: O4e }, + { key: "Alt-ArrowUp", run: F4e }, + { key: "Shift-Alt-ArrowUp", run: V4e }, + { key: "Alt-ArrowDown", run: z4e }, + { key: "Shift-Alt-ArrowDown", run: U4e }, + { key: "Escape", run: M4e }, + { key: "Mod-Enter", run: W4e }, + { key: "Alt-l", mac: "Ctrl-l", run: L4e }, + { key: "Mod-i", run: R4e, preventDefault: !0 }, + { key: "Mod-[", run: bJ }, + { key: "Mod-]", run: yJ }, + { key: "Mod-Alt-\\", run: G4e }, + { key: "Shift-Mod-k", run: q4e }, + { key: "Shift-Mod-\\", run: y4e }, + { key: "Mod-/", run: qOe }, + { key: "Alt-A", run: YOe } +].concat(X4e), Z4e = { key: "Tab", run: yJ, shift: bJ }; +function cn() { + var t = arguments[0]; + typeof t == "string" && (t = document.createElement(t)); + var e = 1, r = arguments[1]; + if (r && typeof r == "object" && r.nodeType == null && !Array.isArray(r)) { + for (var n in r) + if (Object.prototype.hasOwnProperty.call(r, n)) { + var i = r[n]; + typeof i == "string" ? t.setAttribute(n, i) : i != null && (t[n] = i); + } + e++; + } + for (; e < arguments.length; e++) + wJ(t, arguments[e]); + return t; +} +function wJ(t, e) { + if (typeof e == "string") + t.appendChild(document.createTextNode(e)); + else if (e != null) + if (e.nodeType != null) + t.appendChild(e); + else if (Array.isArray(e)) + for (var r = 0; r < e.length; r++) + wJ(t, e[r]); else - throw new RangeError("Unsupported child node: " + n); + throw new RangeError("Unsupported child node: " + e); } -const jCt = typeof String.prototype.normalize == "function" ? (r) => r.normalize("NFKD") : (r) => r; -class cF { - constructor(n, s, a = 0, l = n.length, h, f) { - this.test = f, this.value = { from: 0, to: 0 }, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = n.iterRange(a, l), this.bufferStart = a, this.normalize = h ? (b) => h(jCt(b)) : jCt, this.query = this.normalize(s); +const gF = typeof String.prototype.normalize == "function" ? (t) => t.normalize("NFKD") : (t) => t; +class Lg { + constructor(e, r, n = 0, i = e.length, s, a) { + this.test = a, this.value = { from: 0, to: 0 }, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(n, i), this.bufferStart = n, this.normalize = s ? (o) => s(gF(o)) : gF, this.query = this.normalize(r); } peek() { if (this.bufferPos == this.buffer.length) { @@ -13621,7 +13630,7 @@ class cF { return -1; this.bufferPos = 0, this.buffer = this.iter.value; } - return Lp(this.buffer, this.bufferPos); + return ss(this.buffer, this.bufferPos); } next() { for (; this.matches.length; ) @@ -13630,678 +13639,678 @@ class cF { } nextOverlapping() { for (; ; ) { - let n = this.peek(); - if (n < 0) + let e = this.peek(); + if (e < 0) return this.done = !0, this; - let s = rze(n), a = this.bufferStart + this.bufferPos; - this.bufferPos += Fy(n); - let l = this.normalize(s); - for (let h = 0, f = a; ; h++) { - let b = l.charCodeAt(h), w = this.match(b, f); - if (h == l.length - 1) { - if (w) - return this.value = w, this; + let r = AR(e), n = this.bufferStart + this.bufferPos; + this.bufferPos += Eo(e); + let i = this.normalize(r); + for (let s = 0, a = n; ; s++) { + let o = i.charCodeAt(s), l = this.match(o, a); + if (s == i.length - 1) { + if (l) + return this.value = l, this; break; } - f == a && h < s.length && s.charCodeAt(h) == b && f++; + a == n && s < r.length && r.charCodeAt(s) == o && a++; } } } - match(n, s) { - let a = null; - for (let l = 0; l < this.matches.length; l += 2) { - let h = this.matches[l], f = !1; - this.query.charCodeAt(h) == n && (h == this.query.length - 1 ? a = { from: this.matches[l + 1], to: s + 1 } : (this.matches[l]++, f = !0)), f || (this.matches.splice(l, 2), l -= 2); + match(e, r) { + let n = null; + for (let i = 0; i < this.matches.length; i += 2) { + let s = this.matches[i], a = !1; + this.query.charCodeAt(s) == e && (s == this.query.length - 1 ? n = { from: this.matches[i + 1], to: r + 1 } : (this.matches[i]++, a = !0)), a || (this.matches.splice(i, 2), i -= 2); } - return this.query.charCodeAt(0) == n && (this.query.length == 1 ? a = { from: s, to: s + 1 } : this.matches.push(1, s)), a && this.test && !this.test(a.from, a.to, this.buffer, this.bufferStart) && (a = null), a; + return this.query.charCodeAt(0) == e && (this.query.length == 1 ? n = { from: r, to: r + 1 } : this.matches.push(1, r)), n && this.test && !this.test(n.from, n.to, this.buffer, this.bufferStart) && (n = null), n; } } -typeof Symbol < "u" && (cF.prototype[Symbol.iterator] = function() { +typeof Symbol < "u" && (Lg.prototype[Symbol.iterator] = function() { return this; }); -const lLt = { from: -1, to: -1, match: /* @__PURE__ */ /.*/.exec("") }, Tze = "gm" + (/x/.unicode == null ? "" : "u"); -class uLt { - constructor(n, s, a, l = 0, h = n.length) { - if (this.text = n, this.to = h, this.curLine = "", this.done = !1, this.value = lLt, /\\[sWDnr]|\n|\r|\[\^/.test(s)) - return new hLt(n, s, a, l, h); - this.re = new RegExp(s, Tze + (a != null && a.ignoreCase ? "i" : "")), this.test = a == null ? void 0 : a.test, this.iter = n.iter(); - let f = n.lineAt(l); - this.curLineStart = f.from, this.matchPos = tve(n, l), this.getLine(this.curLineStart); - } - getLine(n) { - this.iter.next(n), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next()); +const OJ = { from: -1, to: -1, match: /* @__PURE__ */ /.*/.exec("") }, eM = "gm" + (/x/.unicode == null ? "" : "u"); +class kJ { + constructor(e, r, n, i = 0, s = e.length) { + if (this.text = e, this.to = s, this.curLine = "", this.done = !1, this.value = OJ, /\\[sWDnr]|\n|\r|\[\^/.test(r)) + return new SJ(e, r, n, i, s); + this.re = new RegExp(r, eM + (n != null && n.ignoreCase ? "i" : "")), this.test = n == null ? void 0 : n.test, this.iter = e.iter(); + let a = e.lineAt(i); + this.curLineStart = a.from, this.matchPos = R5(e, i), this.getLine(this.curLineStart); + } + getLine(e) { + this.iter.next(e), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next()); } nextLine() { this.curLineStart = this.curLineStart + this.curLine.length + 1, this.curLineStart > this.to ? this.curLine = "" : this.getLine(0); } next() { - for (let n = this.matchPos - this.curLineStart; ; ) { - this.re.lastIndex = n; - let s = this.matchPos <= this.to && this.re.exec(this.curLine); - if (s) { - let a = this.curLineStart + s.index, l = a + s[0].length; - if (this.matchPos = tve(this.text, l + (a == l ? 1 : 0)), a == this.curLineStart + this.curLine.length && this.nextLine(), (a < l || a > this.value.to) && (!this.test || this.test(a, l, s))) - return this.value = { from: a, to: l, match: s }, this; - n = this.matchPos - this.curLineStart; + for (let e = this.matchPos - this.curLineStart; ; ) { + this.re.lastIndex = e; + let r = this.matchPos <= this.to && this.re.exec(this.curLine); + if (r) { + let n = this.curLineStart + r.index, i = n + r[0].length; + if (this.matchPos = R5(this.text, i + (n == i ? 1 : 0)), n == this.curLineStart + this.curLine.length && this.nextLine(), (n < i || n > this.value.to) && (!this.test || this.test(n, i, r))) + return this.value = { from: n, to: i, match: r }, this; + e = this.matchPos - this.curLineStart; } else if (this.curLineStart + this.curLine.length < this.to) - this.nextLine(), n = 0; + this.nextLine(), e = 0; else return this.done = !0, this; } } } -const LRe = /* @__PURE__ */ new WeakMap(); -class IB { - constructor(n, s) { - this.from = n, this.text = s; +const _E = /* @__PURE__ */ new WeakMap(); +class Hp { + constructor(e, r) { + this.from = e, this.text = r; } get to() { return this.from + this.text.length; } - static get(n, s, a) { - let l = LRe.get(n); - if (!l || l.from >= a || l.to <= s) { - let b = new IB(s, n.sliceString(s, a)); - return LRe.set(n, b), b; + static get(e, r, n) { + let i = _E.get(e); + if (!i || i.from >= n || i.to <= r) { + let o = new Hp(r, e.sliceString(r, n)); + return _E.set(e, o), o; } - if (l.from == s && l.to == a) - return l; - let { text: h, from: f } = l; - return f > s && (h = n.sliceString(s, f) + h, f = s), l.to < a && (h += n.sliceString(l.to, a)), LRe.set(n, new IB(f, h)), new IB(s, h.slice(s - f, a - f)); + if (i.from == r && i.to == n) + return i; + let { text: s, from: a } = i; + return a > r && (s = e.sliceString(r, a) + s, a = r), i.to < n && (s += e.sliceString(i.to, n)), _E.set(e, new Hp(a, s)), new Hp(r, s.slice(r - a, n - a)); } } -class hLt { - constructor(n, s, a, l, h) { - this.text = n, this.to = h, this.done = !1, this.value = lLt, this.matchPos = tve(n, l), this.re = new RegExp(s, Tze + (a != null && a.ignoreCase ? "i" : "")), this.test = a == null ? void 0 : a.test, this.flat = IB.get(n, l, this.chunkEnd(l + 5e3)); +class SJ { + constructor(e, r, n, i, s) { + this.text = e, this.to = s, this.done = !1, this.value = OJ, this.matchPos = R5(e, i), this.re = new RegExp(r, eM + (n != null && n.ignoreCase ? "i" : "")), this.test = n == null ? void 0 : n.test, this.flat = Hp.get(e, i, this.chunkEnd(i + 5e3)); } - chunkEnd(n) { - return n >= this.to ? this.to : this.text.lineAt(n).to; + chunkEnd(e) { + return e >= this.to ? this.to : this.text.lineAt(e).to; } next() { for (; ; ) { - let n = this.re.lastIndex = this.matchPos - this.flat.from, s = this.re.exec(this.flat.text); - if (s && !s[0] && s.index == n && (this.re.lastIndex = n + 1, s = this.re.exec(this.flat.text)), s) { - let a = this.flat.from + s.index, l = a + s[0].length; - if ((this.flat.to >= this.to || s.index + s[0].length <= this.flat.text.length - 10) && (!this.test || this.test(a, l, s))) - return this.value = { from: a, to: l, match: s }, this.matchPos = tve(this.text, l + (a == l ? 1 : 0)), this; + let e = this.re.lastIndex = this.matchPos - this.flat.from, r = this.re.exec(this.flat.text); + if (r && !r[0] && r.index == e && (this.re.lastIndex = e + 1, r = this.re.exec(this.flat.text)), r) { + let n = this.flat.from + r.index, i = n + r[0].length; + if ((this.flat.to >= this.to || r.index + r[0].length <= this.flat.text.length - 10) && (!this.test || this.test(n, i, r))) + return this.value = { from: n, to: i, match: r }, this.matchPos = R5(this.text, i + (n == i ? 1 : 0)), this; } if (this.flat.to == this.to) return this.done = !0, this; - this.flat = IB.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2)); + this.flat = Hp.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2)); } } } -typeof Symbol < "u" && (uLt.prototype[Symbol.iterator] = hLt.prototype[Symbol.iterator] = function() { +typeof Symbol < "u" && (kJ.prototype[Symbol.iterator] = SJ.prototype[Symbol.iterator] = function() { return this; }); -function k6n(r) { +function j4e(t) { try { - return new RegExp(r, Tze), !0; + return new RegExp(t, eM), !0; } catch { return !1; } } -function tve(r, n) { - if (n >= r.length) - return n; - let s = r.lineAt(n), a; - for (; n < s.to && (a = s.text.charCodeAt(n - s.from)) >= 56320 && a < 57344; ) - n++; - return n; +function R5(t, e) { + if (e >= t.length) + return e; + let r = t.lineAt(e), n; + for (; e < r.to && (n = r.text.charCodeAt(e - r.from)) >= 56320 && n < 57344; ) + e++; + return e; } -function PFe(r) { - let n = String(r.state.doc.lineAt(r.state.selection.main.head).number), s = hh("input", { class: "cm-textfield", name: "line", value: n }), a = hh("form", { +function w7(t) { + let e = String(t.state.doc.lineAt(t.state.selection.main.head).number), r = cn("input", { class: "cm-textfield", name: "line", value: e }), n = cn("form", { class: "cm-gotoLine", - onkeydown: (h) => { - h.keyCode == 27 ? (h.preventDefault(), r.dispatch({ effects: nve.of(!1) }), r.focus()) : h.keyCode == 13 && (h.preventDefault(), l()); + onkeydown: (s) => { + s.keyCode == 27 ? (s.preventDefault(), t.dispatch({ effects: M5.of(!1) }), t.focus()) : s.keyCode == 13 && (s.preventDefault(), i()); }, - onsubmit: (h) => { - h.preventDefault(), l(); + onsubmit: (s) => { + s.preventDefault(), i(); } - }, hh("label", r.state.phrase("Go to line"), ": ", s), " ", hh("button", { class: "cm-button", type: "submit" }, r.state.phrase("go"))); - function l() { - let h = /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.value); - if (!h) + }, cn("label", t.state.phrase("Go to line"), ": ", r), " ", cn("button", { class: "cm-button", type: "submit" }, t.state.phrase("go"))); + function i() { + let s = /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value); + if (!s) return; - let { state: f } = r, b = f.doc.lineAt(f.selection.main.head), [, w, O, S, E] = h, D = S ? +S.slice(1) : 0, M = O ? +O : b.number; - if (O && E) { - let W = M / 100; - w && (W = W * (w == "-" ? -1 : 1) + b.number / f.doc.lines), M = Math.round(f.doc.lines * W); + let { state: a } = t, o = a.doc.lineAt(a.selection.main.head), [, l, u, h, f] = s, d = h ? +h.slice(1) : 0, p = u ? +u : o.number; + if (u && f) { + let v = p / 100; + l && (v = v * (l == "-" ? -1 : 1) + o.number / a.doc.lines), p = Math.round(a.doc.lines * v); } else - O && w && (M = M * (w == "-" ? -1 : 1) + b.number); - let B = f.doc.line(Math.max(1, Math.min(f.doc.lines, M))), z = sr.cursor(B.from + Math.max(0, Math.min(D, B.length))); - r.dispatch({ - effects: [nve.of(!1), Ci.scrollIntoView(z.from, { y: "center" })], - selection: z - }), r.focus(); + u && l && (p = p * (l == "-" ? -1 : 1) + o.number); + let g = a.doc.line(Math.max(1, Math.min(a.doc.lines, p))), m = Ve.cursor(g.from + Math.max(0, Math.min(d, g.length))); + t.dispatch({ + effects: [M5.of(!1), dt.scrollIntoView(m.from, { y: "center" })], + selection: m + }), t.focus(); } - return { dom: a }; + return { dom: n }; } -const nve = /* @__PURE__ */ $o.define(), QCt = /* @__PURE__ */ Ef.define({ +const M5 = /* @__PURE__ */ Zt.define(), mF = /* @__PURE__ */ Pn.define({ create() { return !0; }, - update(r, n) { - for (let s of n.effects) - s.is(nve) && (r = s.value); - return r; + update(t, e) { + for (let r of e.effects) + r.is(M5) && (t = r.value); + return t; }, - provide: (r) => vK.from(r, (n) => n ? PFe : null) -}), x6n = (r) => { - let n = bK(r, PFe); - if (!n) { - let s = [nve.of(!0)]; - r.state.field(QCt, !1) == null && s.push($o.appendConfig.of([QCt, S6n])), r.dispatch({ effects: s }), n = bK(r, PFe); - } - return n && n.dom.querySelector("input").select(), !0; -}, S6n = /* @__PURE__ */ Ci.baseTheme({ + provide: (t) => Ey.from(t, (e) => e ? w7 : null) +}), K4e = (t) => { + let e = Cy(t, w7); + if (!e) { + let r = [M5.of(!0)]; + t.state.field(mF, !1) == null && r.push(Zt.appendConfig.of([mF, J4e])), t.dispatch({ effects: r }), e = Cy(t, w7); + } + return e && e.dom.querySelector("input").select(), !0; +}, J4e = /* @__PURE__ */ dt.baseTheme({ ".cm-panel.cm-gotoLine": { padding: "2px 6px 4px", "& label": { fontSize: "80%" } } -}), _6n = { +}), e5e = { highlightWordAroundCursor: !1, minSelectionLength: 1, maxMatches: 100, wholeWords: !1 -}, fLt = /* @__PURE__ */ us.define({ - combine(r) { - return px(r, _6n, { - highlightWordAroundCursor: (n, s) => n || s, +}, TJ = /* @__PURE__ */ _t.define({ + combine(t) { + return qc(t, e5e, { + highlightWordAroundCursor: (e, r) => e || r, minSelectionLength: Math.min, maxMatches: Math.min }); } }); -function C6n(r) { - let n = [M6n, D6n]; - return r && n.push(fLt.of(r)), n; -} -const E6n = /* @__PURE__ */ as.mark({ class: "cm-selectionMatch" }), T6n = /* @__PURE__ */ as.mark({ class: "cm-selectionMatch cm-selectionMatch-main" }); -function zCt(r, n, s, a) { - return (s == 0 || r(n.sliceDoc(s - 1, s)) != ef.Word) && (a == n.doc.length || r(n.sliceDoc(a, a + 1)) != ef.Word); -} -function A6n(r, n, s, a) { - return r(n.sliceDoc(s, s + 1)) == ef.Word && r(n.sliceDoc(a - 1, a)) == ef.Word; -} -const D6n = /* @__PURE__ */ Zu.fromClass(class { - constructor(r) { - this.decorations = this.getDeco(r); - } - update(r) { - (r.selectionSet || r.docChanged || r.viewportChanged) && (this.decorations = this.getDeco(r.view)); - } - getDeco(r) { - let n = r.state.facet(fLt), { state: s } = r, a = s.selection; - if (a.ranges.length > 1) - return as.none; - let l = a.main, h, f = null; - if (l.empty) { - if (!n.highlightWordAroundCursor) - return as.none; - let w = s.wordAt(l.head); - if (!w) - return as.none; - f = s.charCategorizer(l.head), h = s.sliceDoc(w.from, w.to); +function t5e(t) { + let e = [a5e, s5e]; + return t && e.push(TJ.of(t)), e; +} +const r5e = /* @__PURE__ */ Et.mark({ class: "cm-selectionMatch" }), n5e = /* @__PURE__ */ Et.mark({ class: "cm-selectionMatch cm-selectionMatch-main" }); +function vF(t, e, r, n) { + return (r == 0 || t(e.sliceDoc(r - 1, r)) != Sn.Word) && (n == e.doc.length || t(e.sliceDoc(n, n + 1)) != Sn.Word); +} +function i5e(t, e, r, n) { + return t(e.sliceDoc(r, r + 1)) == Sn.Word && t(e.sliceDoc(n - 1, n)) == Sn.Word; +} +const s5e = /* @__PURE__ */ an.fromClass(class { + constructor(t) { + this.decorations = this.getDeco(t); + } + update(t) { + (t.selectionSet || t.docChanged || t.viewportChanged) && (this.decorations = this.getDeco(t.view)); + } + getDeco(t) { + let e = t.state.facet(TJ), { state: r } = t, n = r.selection; + if (n.ranges.length > 1) + return Et.none; + let i = n.main, s, a = null; + if (i.empty) { + if (!e.highlightWordAroundCursor) + return Et.none; + let l = r.wordAt(i.head); + if (!l) + return Et.none; + a = r.charCategorizer(i.head), s = r.sliceDoc(l.from, l.to); } else { - let w = l.to - l.from; - if (w < n.minSelectionLength || w > 200) - return as.none; - if (n.wholeWords) { - if (h = s.sliceDoc(l.from, l.to), f = s.charCategorizer(l.head), !(zCt(f, s, l.from, l.to) && A6n(f, s, l.from, l.to))) - return as.none; - } else if (h = s.sliceDoc(l.from, l.to).trim(), !h) - return as.none; - } - let b = []; - for (let w of r.visibleRanges) { - let O = new cF(s.doc, h, w.from, w.to); - for (; !O.next().done; ) { - let { from: S, to: E } = O.value; - if ((!f || zCt(f, s, S, E)) && (l.empty && S <= l.from && E >= l.to ? b.push(T6n.range(S, E)) : (S >= l.to || E <= l.from) && b.push(E6n.range(S, E)), b.length > n.maxMatches)) - return as.none; - } - } - return as.set(b); + let l = i.to - i.from; + if (l < e.minSelectionLength || l > 200) + return Et.none; + if (e.wholeWords) { + if (s = r.sliceDoc(i.from, i.to), a = r.charCategorizer(i.head), !(vF(a, r, i.from, i.to) && i5e(a, r, i.from, i.to))) + return Et.none; + } else if (s = r.sliceDoc(i.from, i.to).trim(), !s) + return Et.none; + } + let o = []; + for (let l of t.visibleRanges) { + let u = new Lg(r.doc, s, l.from, l.to); + for (; !u.next().done; ) { + let { from: h, to: f } = u.value; + if ((!a || vF(a, r, h, f)) && (i.empty && h <= i.from && f >= i.to ? o.push(n5e.range(h, f)) : (h >= i.to || f <= i.from) && o.push(r5e.range(h, f)), o.length > e.maxMatches)) + return Et.none; + } + } + return Et.set(o); } }, { - decorations: (r) => r.decorations -}), M6n = /* @__PURE__ */ Ci.baseTheme({ + decorations: (t) => t.decorations +}), a5e = /* @__PURE__ */ dt.baseTheme({ ".cm-selectionMatch": { backgroundColor: "#99ff7780" }, ".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" } -}), P6n = ({ state: r, dispatch: n }) => { - let { selection: s } = r, a = sr.create(s.ranges.map((l) => r.wordAt(l.head) || sr.cursor(l.head)), s.mainIndex); - return a.eq(s) ? !1 : (n(r.update({ selection: a })), !0); -}; -function L6n(r, n) { - let { main: s, ranges: a } = r.selection, l = r.wordAt(s.head), h = l && l.from == s.from && l.to == s.to; - for (let f = !1, b = new cF(r.doc, n, a[a.length - 1].to); ; ) - if (b.next(), b.done) { - if (f) +}), o5e = ({ state: t, dispatch: e }) => { + let { selection: r } = t, n = Ve.create(r.ranges.map((i) => t.wordAt(i.head) || Ve.cursor(i.head)), r.mainIndex); + return n.eq(r) ? !1 : (e(t.update({ selection: n })), !0); +}; +function l5e(t, e) { + let { main: r, ranges: n } = t.selection, i = t.wordAt(r.head), s = i && i.from == r.from && i.to == r.to; + for (let a = !1, o = new Lg(t.doc, e, n[n.length - 1].to); ; ) + if (o.next(), o.done) { + if (a) return null; - b = new cF(r.doc, n, 0, Math.max(0, a[a.length - 1].from - 1)), f = !0; + o = new Lg(t.doc, e, 0, Math.max(0, n[n.length - 1].from - 1)), a = !0; } else { - if (f && a.some((w) => w.from == b.value.from)) + if (a && n.some((l) => l.from == o.value.from)) continue; - if (h) { - let w = r.wordAt(b.value.from); - if (!w || w.from != b.value.from || w.to != b.value.to) + if (s) { + let l = t.wordAt(o.value.from); + if (!l || l.from != o.value.from || l.to != o.value.to) continue; } - return b.value; + return o.value; } } -const I6n = ({ state: r, dispatch: n }) => { - let { ranges: s } = r.selection; - if (s.some((h) => h.from === h.to)) - return P6n({ state: r, dispatch: n }); - let a = r.sliceDoc(s[0].from, s[0].to); - if (r.selection.ranges.some((h) => r.sliceDoc(h.from, h.to) != a)) +const c5e = ({ state: t, dispatch: e }) => { + let { ranges: r } = t.selection; + if (r.some((s) => s.from === s.to)) + return o5e({ state: t, dispatch: e }); + let n = t.sliceDoc(r[0].from, r[0].to); + if (t.selection.ranges.some((s) => t.sliceDoc(s.from, s.to) != n)) return !1; - let l = L6n(r, a); - return l ? (n(r.update({ - selection: r.selection.addRange(sr.range(l.from, l.to), !1), - effects: Ci.scrollIntoView(l.to) + let i = l5e(t, n); + return i ? (e(t.update({ + selection: t.selection.addRange(Ve.range(i.from, i.to), !1), + effects: dt.scrollIntoView(i.to) })), !0) : !1; -}, KF = /* @__PURE__ */ us.define({ - combine(r) { - return px(r, { +}, $1 = /* @__PURE__ */ _t.define({ + combine(t) { + return qc(t, { top: !1, caseSensitive: !1, literal: !1, regexp: !1, wholeWord: !1, - createPanel: (n) => new W6n(n), - scrollToMatch: (n) => Ci.scrollIntoView(n) + createPanel: (e) => new w5e(e), + scrollToMatch: (e) => dt.scrollIntoView(e) }); } }); -class dLt { - constructor(n) { - this.search = n.search, this.caseSensitive = !!n.caseSensitive, this.literal = !!n.literal, this.regexp = !!n.regexp, this.replace = n.replace || "", this.valid = !!this.search && (!this.regexp || k6n(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!n.wholeWord; +class CJ { + constructor(e) { + this.search = e.search, this.caseSensitive = !!e.caseSensitive, this.literal = !!e.literal, this.regexp = !!e.regexp, this.replace = e.replace || "", this.valid = !!this.search && (!this.regexp || j4e(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e.wholeWord; } - unquote(n) { - return this.literal ? n : n.replace(/\\([nrt\\])/g, (s, a) => a == "n" ? ` -` : a == "r" ? "\r" : a == "t" ? " " : "\\"); + unquote(e) { + return this.literal ? e : e.replace(/\\([nrt\\])/g, (r, n) => n == "n" ? ` +` : n == "r" ? "\r" : n == "t" ? " " : "\\"); } - eq(n) { - return this.search == n.search && this.replace == n.replace && this.caseSensitive == n.caseSensitive && this.regexp == n.regexp && this.wholeWord == n.wholeWord; + eq(e) { + return this.search == e.search && this.replace == e.replace && this.caseSensitive == e.caseSensitive && this.regexp == e.regexp && this.wholeWord == e.wholeWord; } create() { - return this.regexp ? new B6n(this) : new R6n(this); + return this.regexp ? new d5e(this) : new h5e(this); } - getCursor(n, s = 0, a) { - let l = n.doc ? n : Ga.create({ doc: n }); - return a == null && (a = l.doc.length), this.regexp ? uB(this, l, s, a) : lB(this, l, s, a); + getCursor(e, r = 0, n) { + let i = e.doc ? e : dr.create({ doc: e }); + return n == null && (n = i.doc.length), this.regexp ? Op(this, i, r, n) : wp(this, i, r, n); } } -class pLt { - constructor(n) { - this.spec = n; +class EJ { + constructor(e) { + this.spec = e; } } -function lB(r, n, s, a) { - return new cF(n.doc, r.unquoted, s, a, r.caseSensitive ? void 0 : (l) => l.toLowerCase(), r.wholeWord ? N6n(n.doc, n.charCategorizer(n.selection.main.head)) : void 0); +function wp(t, e, r, n) { + return new Lg(e.doc, t.unquoted, r, n, t.caseSensitive ? void 0 : (i) => i.toLowerCase(), t.wholeWord ? u5e(e.doc, e.charCategorizer(e.selection.main.head)) : void 0); } -function N6n(r, n) { - return (s, a, l, h) => ((h > s || h + l.length < a) && (h = Math.max(0, s - 2), l = r.sliceString(h, Math.min(r.length, a + 2))), (n(rve(l, s - h)) != ef.Word || n(ive(l, s - h)) != ef.Word) && (n(ive(l, a - h)) != ef.Word || n(rve(l, a - h)) != ef.Word)); +function u5e(t, e) { + return (r, n, i, s) => ((s > r || s + i.length < n) && (s = Math.max(0, r - 2), i = t.sliceString(s, Math.min(t.length, n + 2))), (e(D5(i, r - s)) != Sn.Word || e(N5(i, r - s)) != Sn.Word) && (e(N5(i, n - s)) != Sn.Word || e(D5(i, n - s)) != Sn.Word)); } -class R6n extends pLt { - constructor(n) { - super(n); +class h5e extends EJ { + constructor(e) { + super(e); } - nextMatch(n, s, a) { - let l = lB(this.spec, n, a, n.doc.length).nextOverlapping(); - return l.done && (l = lB(this.spec, n, 0, s).nextOverlapping()), l.done ? null : l.value; + nextMatch(e, r, n) { + let i = wp(this.spec, e, n, e.doc.length).nextOverlapping(); + return i.done && (i = wp(this.spec, e, 0, r).nextOverlapping()), i.done ? null : i.value; } - prevMatchInRange(n, s, a) { - for (let l = a; ; ) { - let h = Math.max(s, l - 1e4 - this.spec.unquoted.length), f = lB(this.spec, n, h, l), b = null; - for (; !f.nextOverlapping().done; ) - b = f.value; - if (b) - return b; - if (h == s) + prevMatchInRange(e, r, n) { + for (let i = n; ; ) { + let s = Math.max(r, i - 1e4 - this.spec.unquoted.length), a = wp(this.spec, e, s, i), o = null; + for (; !a.nextOverlapping().done; ) + o = a.value; + if (o) + return o; + if (s == r) return null; - l -= 1e4; + i -= 1e4; } } - prevMatch(n, s, a) { - return this.prevMatchInRange(n, 0, s) || this.prevMatchInRange(n, a, n.doc.length); + prevMatch(e, r, n) { + return this.prevMatchInRange(e, 0, r) || this.prevMatchInRange(e, n, e.doc.length); } - getReplacement(n) { + getReplacement(e) { return this.spec.unquote(this.spec.replace); } - matchAll(n, s) { - let a = lB(this.spec, n, 0, n.doc.length), l = []; - for (; !a.next().done; ) { - if (l.length >= s) + matchAll(e, r) { + let n = wp(this.spec, e, 0, e.doc.length), i = []; + for (; !n.next().done; ) { + if (i.length >= r) return null; - l.push(a.value); + i.push(n.value); } - return l; + return i; } - highlight(n, s, a, l) { - let h = lB(this.spec, n, Math.max(0, s - this.spec.unquoted.length), Math.min(a + this.spec.unquoted.length, n.doc.length)); - for (; !h.next().done; ) - l(h.value.from, h.value.to); + highlight(e, r, n, i) { + let s = wp(this.spec, e, Math.max(0, r - this.spec.unquoted.length), Math.min(n + this.spec.unquoted.length, e.doc.length)); + for (; !s.next().done; ) + i(s.value.from, s.value.to); } } -function uB(r, n, s, a) { - return new uLt(n.doc, r.search, { - ignoreCase: !r.caseSensitive, - test: r.wholeWord ? $6n(n.charCategorizer(n.selection.main.head)) : void 0 - }, s, a); +function Op(t, e, r, n) { + return new kJ(e.doc, t.search, { + ignoreCase: !t.caseSensitive, + test: t.wholeWord ? f5e(e.charCategorizer(e.selection.main.head)) : void 0 + }, r, n); } -function rve(r, n) { - return r.slice(Np(r, n, !1), n); +function D5(t, e) { + return t.slice(ls(t, e, !1), e); } -function ive(r, n) { - return r.slice(n, Np(r, n)); +function N5(t, e) { + return t.slice(e, ls(t, e)); } -function $6n(r) { - return (n, s, a) => !a[0].length || (r(rve(a.input, a.index)) != ef.Word || r(ive(a.input, a.index)) != ef.Word) && (r(ive(a.input, a.index + a[0].length)) != ef.Word || r(rve(a.input, a.index + a[0].length)) != ef.Word); +function f5e(t) { + return (e, r, n) => !n[0].length || (t(D5(n.input, n.index)) != Sn.Word || t(N5(n.input, n.index)) != Sn.Word) && (t(N5(n.input, n.index + n[0].length)) != Sn.Word || t(D5(n.input, n.index + n[0].length)) != Sn.Word); } -class B6n extends pLt { - nextMatch(n, s, a) { - let l = uB(this.spec, n, a, n.doc.length).next(); - return l.done && (l = uB(this.spec, n, 0, s).next()), l.done ? null : l.value; +class d5e extends EJ { + nextMatch(e, r, n) { + let i = Op(this.spec, e, n, e.doc.length).next(); + return i.done && (i = Op(this.spec, e, 0, r).next()), i.done ? null : i.value; } - prevMatchInRange(n, s, a) { - for (let l = 1; ; l++) { - let h = Math.max(s, a - l * 1e4), f = uB(this.spec, n, h, a), b = null; - for (; !f.next().done; ) - b = f.value; - if (b && (h == s || b.from > h + 10)) - return b; - if (h == s) + prevMatchInRange(e, r, n) { + for (let i = 1; ; i++) { + let s = Math.max(r, n - i * 1e4), a = Op(this.spec, e, s, n), o = null; + for (; !a.next().done; ) + o = a.value; + if (o && (s == r || o.from > s + 10)) + return o; + if (s == r) return null; } } - prevMatch(n, s, a) { - return this.prevMatchInRange(n, 0, s) || this.prevMatchInRange(n, a, n.doc.length); + prevMatch(e, r, n) { + return this.prevMatchInRange(e, 0, r) || this.prevMatchInRange(e, n, e.doc.length); } - getReplacement(n) { - return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g, (s, a) => a == "$" ? "$" : a == "&" ? n.match[0] : a != "0" && +a < n.match.length ? n.match[a] : s); + getReplacement(e) { + return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g, (r, n) => n == "$" ? "$" : n == "&" ? e.match[0] : n != "0" && +n < e.match.length ? e.match[n] : r); } - matchAll(n, s) { - let a = uB(this.spec, n, 0, n.doc.length), l = []; - for (; !a.next().done; ) { - if (l.length >= s) + matchAll(e, r) { + let n = Op(this.spec, e, 0, e.doc.length), i = []; + for (; !n.next().done; ) { + if (i.length >= r) return null; - l.push(a.value); + i.push(n.value); } - return l; + return i; } - highlight(n, s, a, l) { - let h = uB(this.spec, n, Math.max(0, s - 250), Math.min(a + 250, n.doc.length)); - for (; !h.next().done; ) - l(h.value.from, h.value.to); + highlight(e, r, n, i) { + let s = Op(this.spec, e, Math.max(0, r - 250), Math.min(n + 250, e.doc.length)); + for (; !s.next().done; ) + i(s.value.from, s.value.to); } } -const SK = /* @__PURE__ */ $o.define(), Aze = /* @__PURE__ */ $o.define(), n8 = /* @__PURE__ */ Ef.define({ - create(r) { - return new IRe(LFe(r).create(), null); +const Dy = /* @__PURE__ */ Zt.define(), tM = /* @__PURE__ */ Zt.define(), Wh = /* @__PURE__ */ Pn.define({ + create(t) { + return new AE(O7(t).create(), null); }, - update(r, n) { - for (let s of n.effects) - s.is(SK) ? r = new IRe(s.value.create(), r.panel) : s.is(Aze) && (r = new IRe(r.query, s.value ? Dze : null)); - return r; + update(t, e) { + for (let r of e.effects) + r.is(Dy) ? t = new AE(r.value.create(), t.panel) : r.is(tM) && (t = new AE(t.query, r.value ? rM : null)); + return t; }, - provide: (r) => vK.from(r, (n) => n.panel) + provide: (t) => Ey.from(t, (e) => e.panel) }); -class IRe { - constructor(n, s) { - this.query = n, this.panel = s; - } -} -const F6n = /* @__PURE__ */ as.mark({ class: "cm-searchMatch" }), j6n = /* @__PURE__ */ as.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), Q6n = /* @__PURE__ */ Zu.fromClass(class { - constructor(r) { - this.view = r, this.decorations = this.highlight(r.state.field(n8)); - } - update(r) { - let n = r.state.field(n8); - (n != r.startState.field(n8) || r.docChanged || r.selectionSet || r.viewportChanged) && (this.decorations = this.highlight(n)); - } - highlight({ query: r, panel: n }) { - if (!n || !r.spec.valid) - return as.none; - let { view: s } = this, a = new G0(); - for (let l = 0, h = s.visibleRanges, f = h.length; l < f; l++) { - let { from: b, to: w } = h[l]; - for (; l < f - 1 && w > h[l + 1].from - 2 * 250; ) - w = h[++l].to; - r.highlight(s.state, b, w, (O, S) => { - let E = s.state.selection.ranges.some((D) => D.from == O && D.to == S); - a.add(O, S, E ? j6n : F6n); +class AE { + constructor(e, r) { + this.query = e, this.panel = r; + } +} +const p5e = /* @__PURE__ */ Et.mark({ class: "cm-searchMatch" }), g5e = /* @__PURE__ */ Et.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), m5e = /* @__PURE__ */ an.fromClass(class { + constructor(t) { + this.view = t, this.decorations = this.highlight(t.state.field(Wh)); + } + update(t) { + let e = t.state.field(Wh); + (e != t.startState.field(Wh) || t.docChanged || t.selectionSet || t.viewportChanged) && (this.decorations = this.highlight(e)); + } + highlight({ query: t, panel: e }) { + if (!e || !t.spec.valid) + return Et.none; + let { view: r } = this, n = new Hi(); + for (let i = 0, s = r.visibleRanges, a = s.length; i < a; i++) { + let { from: o, to: l } = s[i]; + for (; i < a - 1 && l > s[i + 1].from - 2 * 250; ) + l = s[++i].to; + t.highlight(r.state, o, l, (u, h) => { + let f = r.state.selection.ranges.some((d) => d.from == u && d.to == h); + n.add(u, h, f ? g5e : p5e); }); } - return a.finish(); + return n.finish(); } }, { - decorations: (r) => r.decorations + decorations: (t) => t.decorations }); -function $J(r) { - return (n) => { - let s = n.state.field(n8, !1); - return s && s.query.spec.valid ? r(n, s) : bLt(n); +function Xb(t) { + return (e) => { + let r = e.state.field(Wh, !1); + return r && r.query.spec.valid ? t(e, r) : LJ(e); }; } -const sve = /* @__PURE__ */ $J((r, { query: n }) => { - let { to: s } = r.state.selection.main, a = n.nextMatch(r.state, s, s); - if (!a) +const I5 = /* @__PURE__ */ Xb((t, { query: e }) => { + let { to: r } = t.state.selection.main, n = e.nextMatch(t.state, r, r); + if (!n) return !1; - let l = sr.single(a.from, a.to), h = r.state.facet(KF); - return r.dispatch({ - selection: l, - effects: [Mze(r, a), h.scrollToMatch(l.main, r)], + let i = Ve.single(n.from, n.to), s = t.state.facet($1); + return t.dispatch({ + selection: i, + effects: [nM(t, n), s.scrollToMatch(i.main, t)], userEvent: "select.search" - }), mLt(r), !0; -}), ove = /* @__PURE__ */ $J((r, { query: n }) => { - let { state: s } = r, { from: a } = s.selection.main, l = n.prevMatch(s, a, a); - if (!l) + }), AJ(t), !0; +}), P5 = /* @__PURE__ */ Xb((t, { query: e }) => { + let { state: r } = t, { from: n } = r.selection.main, i = e.prevMatch(r, n, n); + if (!i) return !1; - let h = sr.single(l.from, l.to), f = r.state.facet(KF); - return r.dispatch({ - selection: h, - effects: [Mze(r, l), f.scrollToMatch(h.main, r)], + let s = Ve.single(i.from, i.to), a = t.state.facet($1); + return t.dispatch({ + selection: s, + effects: [nM(t, i), a.scrollToMatch(s.main, t)], userEvent: "select.search" - }), mLt(r), !0; -}), z6n = /* @__PURE__ */ $J((r, { query: n }) => { - let s = n.matchAll(r.state, 1e3); - return !s || !s.length ? !1 : (r.dispatch({ - selection: sr.create(s.map((a) => sr.range(a.from, a.to))), + }), AJ(t), !0; +}), v5e = /* @__PURE__ */ Xb((t, { query: e }) => { + let r = e.matchAll(t.state, 1e3); + return !r || !r.length ? !1 : (t.dispatch({ + selection: Ve.create(r.map((n) => Ve.range(n.from, n.to))), userEvent: "select.search.matches" }), !0); -}), q6n = ({ state: r, dispatch: n }) => { - let s = r.selection; - if (s.ranges.length > 1 || s.main.empty) +}), y5e = ({ state: t, dispatch: e }) => { + let r = t.selection; + if (r.ranges.length > 1 || r.main.empty) return !1; - let { from: a, to: l } = s.main, h = [], f = 0; - for (let b = new cF(r.doc, r.sliceDoc(a, l)); !b.next().done; ) { - if (h.length > 1e3) + let { from: n, to: i } = r.main, s = [], a = 0; + for (let o = new Lg(t.doc, t.sliceDoc(n, i)); !o.next().done; ) { + if (s.length > 1e3) return !1; - b.value.from == a && (f = h.length), h.push(sr.range(b.value.from, b.value.to)); + o.value.from == n && (a = s.length), s.push(Ve.range(o.value.from, o.value.to)); } - return n(r.update({ - selection: sr.create(h, f), + return e(t.update({ + selection: Ve.create(s, a), userEvent: "select.search.matches" })), !0; -}, qCt = /* @__PURE__ */ $J((r, { query: n }) => { - let { state: s } = r, { from: a, to: l } = s.selection.main; - if (s.readOnly) +}, yF = /* @__PURE__ */ Xb((t, { query: e }) => { + let { state: r } = t, { from: n, to: i } = r.selection.main; + if (r.readOnly) return !1; - let h = n.nextMatch(s, a, a); - if (!h) + let s = e.nextMatch(r, n, n); + if (!s) return !1; - let f = [], b, w, O = []; - if (h.from == a && h.to == l && (w = s.toText(n.getReplacement(h)), f.push({ from: h.from, to: h.to, insert: w }), h = n.nextMatch(s, h.from, h.to), O.push(Ci.announce.of(s.phrase("replaced match on line $", s.doc.lineAt(a).number) + "."))), h) { - let S = f.length == 0 || f[0].from >= h.to ? 0 : h.to - h.from - w.length; - b = sr.single(h.from - S, h.to - S), O.push(Mze(r, h)), O.push(s.facet(KF).scrollToMatch(b.main, r)); - } - return r.dispatch({ - changes: f, - selection: b, - effects: O, + let a = [], o, l, u = []; + if (s.from == n && s.to == i && (l = r.toText(e.getReplacement(s)), a.push({ from: s.from, to: s.to, insert: l }), s = e.nextMatch(r, s.from, s.to), u.push(dt.announce.of(r.phrase("replaced match on line $", r.doc.lineAt(n).number) + "."))), s) { + let h = a.length == 0 || a[0].from >= s.to ? 0 : s.to - s.from - l.length; + o = Ve.single(s.from - h, s.to - h), u.push(nM(t, s)), u.push(r.facet($1).scrollToMatch(o.main, t)); + } + return t.dispatch({ + changes: a, + selection: o, + effects: u, userEvent: "input.replace" }), !0; -}), V6n = /* @__PURE__ */ $J((r, { query: n }) => { - if (r.state.readOnly) +}), b5e = /* @__PURE__ */ Xb((t, { query: e }) => { + if (t.state.readOnly) return !1; - let s = n.matchAll(r.state, 1e9).map((l) => { - let { from: h, to: f } = l; - return { from: h, to: f, insert: n.getReplacement(l) }; + let r = e.matchAll(t.state, 1e9).map((i) => { + let { from: s, to: a } = i; + return { from: s, to: a, insert: e.getReplacement(i) }; }); - if (!s.length) + if (!r.length) return !1; - let a = r.state.phrase("replaced $ matches", s.length) + "."; - return r.dispatch({ - changes: s, - effects: Ci.announce.of(a), + let n = t.state.phrase("replaced $ matches", r.length) + "."; + return t.dispatch({ + changes: r, + effects: dt.announce.of(n), userEvent: "input.replace.all" }), !0; }); -function Dze(r) { - return r.state.facet(KF).createPanel(r); -} -function LFe(r, n) { - var s, a, l, h, f; - let b = r.selection.main, w = b.empty || b.to > b.from + 100 ? "" : r.sliceDoc(b.from, b.to); - if (n && !w) - return n; - let O = r.facet(KF); - return new dLt({ - search: ((s = n == null ? void 0 : n.literal) !== null && s !== void 0 ? s : O.literal) ? w : w.replace(/\n/g, "\\n"), - caseSensitive: (a = n == null ? void 0 : n.caseSensitive) !== null && a !== void 0 ? a : O.caseSensitive, - literal: (l = n == null ? void 0 : n.literal) !== null && l !== void 0 ? l : O.literal, - regexp: (h = n == null ? void 0 : n.regexp) !== null && h !== void 0 ? h : O.regexp, - wholeWord: (f = n == null ? void 0 : n.wholeWord) !== null && f !== void 0 ? f : O.wholeWord +function rM(t) { + return t.state.facet($1).createPanel(t); +} +function O7(t, e) { + var r, n, i, s, a; + let o = t.selection.main, l = o.empty || o.to > o.from + 100 ? "" : t.sliceDoc(o.from, o.to); + if (e && !l) + return e; + let u = t.facet($1); + return new CJ({ + search: ((r = e == null ? void 0 : e.literal) !== null && r !== void 0 ? r : u.literal) ? l : l.replace(/\n/g, "\\n"), + caseSensitive: (n = e == null ? void 0 : e.caseSensitive) !== null && n !== void 0 ? n : u.caseSensitive, + literal: (i = e == null ? void 0 : e.literal) !== null && i !== void 0 ? i : u.literal, + regexp: (s = e == null ? void 0 : e.regexp) !== null && s !== void 0 ? s : u.regexp, + wholeWord: (a = e == null ? void 0 : e.wholeWord) !== null && a !== void 0 ? a : u.wholeWord }); } -function gLt(r) { - let n = bK(r, Dze); - return n && n.dom.querySelector("[main-field]"); +function _J(t) { + let e = Cy(t, rM); + return e && e.dom.querySelector("[main-field]"); } -function mLt(r) { - let n = gLt(r); - n && n == r.root.activeElement && n.select(); +function AJ(t) { + let e = _J(t); + e && e == t.root.activeElement && e.select(); } -const bLt = (r) => { - let n = r.state.field(n8, !1); - if (n && n.panel) { - let s = gLt(r); - if (s && s != r.root.activeElement) { - let a = LFe(r.state, n.query.spec); - a.valid && r.dispatch({ effects: SK.of(a) }), s.focus(), s.select(); +const LJ = (t) => { + let e = t.state.field(Wh, !1); + if (e && e.panel) { + let r = _J(t); + if (r && r != t.root.activeElement) { + let n = O7(t.state, e.query.spec); + n.valid && t.dispatch({ effects: Dy.of(n) }), r.focus(), r.select(); } } else - r.dispatch({ effects: [ - Aze.of(!0), - n ? SK.of(LFe(r.state, n.query.spec)) : $o.appendConfig.of(H6n) + t.dispatch({ effects: [ + tM.of(!0), + e ? Dy.of(O7(t.state, e.query.spec)) : Zt.appendConfig.of(k5e) ] }); return !0; -}, vLt = (r) => { - let n = r.state.field(n8, !1); - if (!n || !n.panel) +}, RJ = (t) => { + let e = t.state.field(Wh, !1); + if (!e || !e.panel) return !1; - let s = bK(r, Dze); - return s && s.dom.contains(r.root.activeElement) && r.focus(), r.dispatch({ effects: Aze.of(!1) }), !0; -}, U6n = [ - { key: "Mod-f", run: bLt, scope: "editor search-panel" }, - { key: "F3", run: sve, shift: ove, scope: "editor search-panel", preventDefault: !0 }, - { key: "Mod-g", run: sve, shift: ove, scope: "editor search-panel", preventDefault: !0 }, - { key: "Escape", run: vLt, scope: "editor search-panel" }, - { key: "Mod-Shift-l", run: q6n }, - { key: "Mod-Alt-g", run: x6n }, - { key: "Mod-d", run: I6n, preventDefault: !0 } + let r = Cy(t, rM); + return r && r.dom.contains(t.root.activeElement) && t.focus(), t.dispatch({ effects: tM.of(!1) }), !0; +}, x5e = [ + { key: "Mod-f", run: LJ, scope: "editor search-panel" }, + { key: "F3", run: I5, shift: P5, scope: "editor search-panel", preventDefault: !0 }, + { key: "Mod-g", run: I5, shift: P5, scope: "editor search-panel", preventDefault: !0 }, + { key: "Escape", run: RJ, scope: "editor search-panel" }, + { key: "Mod-Shift-l", run: y5e }, + { key: "Mod-Alt-g", run: K4e }, + { key: "Mod-d", run: c5e, preventDefault: !0 } ]; -class W6n { - constructor(n) { - this.view = n; - let s = this.query = n.state.field(n8).query.spec; - this.commit = this.commit.bind(this), this.searchField = hh("input", { - value: s.search, - placeholder: T2(n, "Find"), - "aria-label": T2(n, "Find"), +class w5e { + constructor(e) { + this.view = e; + let r = this.query = e.state.field(Wh).query.spec; + this.commit = this.commit.bind(this), this.searchField = cn("input", { + value: r.search, + placeholder: Wa(e, "Find"), + "aria-label": Wa(e, "Find"), class: "cm-textfield", name: "search", form: "", "main-field": "true", onchange: this.commit, onkeyup: this.commit - }), this.replaceField = hh("input", { - value: s.replace, - placeholder: T2(n, "Replace"), - "aria-label": T2(n, "Replace"), + }), this.replaceField = cn("input", { + value: r.replace, + placeholder: Wa(e, "Replace"), + "aria-label": Wa(e, "Replace"), class: "cm-textfield", name: "replace", form: "", onchange: this.commit, onkeyup: this.commit - }), this.caseField = hh("input", { + }), this.caseField = cn("input", { type: "checkbox", name: "case", form: "", - checked: s.caseSensitive, + checked: r.caseSensitive, onchange: this.commit - }), this.reField = hh("input", { + }), this.reField = cn("input", { type: "checkbox", name: "re", form: "", - checked: s.regexp, + checked: r.regexp, onchange: this.commit - }), this.wordField = hh("input", { + }), this.wordField = cn("input", { type: "checkbox", name: "word", form: "", - checked: s.wholeWord, + checked: r.wholeWord, onchange: this.commit }); - function a(l, h, f) { - return hh("button", { class: "cm-button", name: l, onclick: h, type: "button" }, f); + function n(i, s, a) { + return cn("button", { class: "cm-button", name: i, onclick: s, type: "button" }, a); } - this.dom = hh("div", { onkeydown: (l) => this.keydown(l), class: "cm-search" }, [ + this.dom = cn("div", { onkeydown: (i) => this.keydown(i), class: "cm-search" }, [ this.searchField, - a("next", () => sve(n), [T2(n, "next")]), - a("prev", () => ove(n), [T2(n, "previous")]), - a("select", () => z6n(n), [T2(n, "all")]), - hh("label", null, [this.caseField, T2(n, "match case")]), - hh("label", null, [this.reField, T2(n, "regexp")]), - hh("label", null, [this.wordField, T2(n, "by word")]), - ...n.state.readOnly ? [] : [ - hh("br"), + n("next", () => I5(e), [Wa(e, "next")]), + n("prev", () => P5(e), [Wa(e, "previous")]), + n("select", () => v5e(e), [Wa(e, "all")]), + cn("label", null, [this.caseField, Wa(e, "match case")]), + cn("label", null, [this.reField, Wa(e, "regexp")]), + cn("label", null, [this.wordField, Wa(e, "by word")]), + ...e.state.readOnly ? [] : [ + cn("br"), this.replaceField, - a("replace", () => qCt(n), [T2(n, "replace")]), - a("replaceAll", () => V6n(n), [T2(n, "replace all")]) + n("replace", () => yF(e), [Wa(e, "replace")]), + n("replaceAll", () => b5e(e), [Wa(e, "replace all")]) ], - hh("button", { + cn("button", { name: "close", - onclick: () => vLt(n), - "aria-label": T2(n, "close"), + onclick: () => RJ(e), + "aria-label": Wa(e, "close"), type: "button" }, ["\xD7"]) ]); } commit() { - let n = new dLt({ + let e = new CJ({ search: this.searchField.value, caseSensitive: this.caseField.checked, regexp: this.reField.checked, wholeWord: this.wordField.checked, replace: this.replaceField.value }); - n.eq(this.query) || (this.query = n, this.view.dispatch({ effects: SK.of(n) })); + e.eq(this.query) || (this.query = e, this.view.dispatch({ effects: Dy.of(e) })); } - keydown(n) { - h4n(this.view, n, "search-panel") ? n.preventDefault() : n.keyCode == 13 && n.target == this.searchField ? (n.preventDefault(), (n.shiftKey ? ove : sve)(this.view)) : n.keyCode == 13 && n.target == this.replaceField && (n.preventDefault(), qCt(this.view)); + keydown(e) { + zxe(this.view, e, "search-panel") ? e.preventDefault() : e.keyCode == 13 && e.target == this.searchField ? (e.preventDefault(), (e.shiftKey ? P5 : I5)(this.view)) : e.keyCode == 13 && e.target == this.replaceField && (e.preventDefault(), yF(this.view)); } - update(n) { - for (let s of n.transactions) - for (let a of s.effects) - a.is(SK) && !a.value.eq(this.query) && this.setQuery(a.value); + update(e) { + for (let r of e.transactions) + for (let n of r.effects) + n.is(Dy) && !n.value.eq(this.query) && this.setQuery(n.value); } - setQuery(n) { - this.query = n, this.searchField.value = n.search, this.replaceField.value = n.replace, this.caseField.checked = n.caseSensitive, this.reField.checked = n.regexp, this.wordField.checked = n.wholeWord; + setQuery(e) { + this.query = e, this.searchField.value = e.search, this.replaceField.value = e.replace, this.caseField.checked = e.caseSensitive, this.reField.checked = e.regexp, this.wordField.checked = e.wholeWord; } mount() { this.searchField.select(); @@ -14310,32 +14319,32 @@ class W6n { return 80; } get top() { - return this.view.state.facet(KF).top; + return this.view.state.facet($1).top; } } -function T2(r, n) { - return r.state.phrase(n); +function Wa(t, e) { + return t.state.phrase(e); } -const Kge = 30, Jge = /[\s\.,:;?!]/; -function Mze(r, { from: n, to: s }) { - let a = r.state.doc.lineAt(n), l = r.state.doc.lineAt(s).to, h = Math.max(a.from, n - Kge), f = Math.min(l, s + Kge), b = r.state.sliceDoc(h, f); - if (h != a.from) { - for (let w = 0; w < Kge; w++) - if (!Jge.test(b[w + 1]) && Jge.test(b[w])) { - b = b.slice(w); +const Cw = 30, Ew = /[\s\.,:;?!]/; +function nM(t, { from: e, to: r }) { + let n = t.state.doc.lineAt(e), i = t.state.doc.lineAt(r).to, s = Math.max(n.from, e - Cw), a = Math.min(i, r + Cw), o = t.state.sliceDoc(s, a); + if (s != n.from) { + for (let l = 0; l < Cw; l++) + if (!Ew.test(o[l + 1]) && Ew.test(o[l])) { + o = o.slice(l); break; } } - if (f != l) { - for (let w = b.length - 1; w > b.length - Kge; w--) - if (!Jge.test(b[w - 1]) && Jge.test(b[w])) { - b = b.slice(0, w); + if (a != i) { + for (let l = o.length - 1; l > o.length - Cw; l--) + if (!Ew.test(o[l - 1]) && Ew.test(o[l])) { + o = o.slice(0, l); break; } } - return Ci.announce.of(`${r.state.phrase("current match")}. ${b} ${r.state.phrase("on line")} ${a.number}.`); + return dt.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${n.number}.`); } -const Y6n = /* @__PURE__ */ Ci.baseTheme({ +const O5e = /* @__PURE__ */ dt.baseTheme({ ".cm-panel.cm-search": { padding: "2px 6px 4px", position: "relative", @@ -14364,160 +14373,160 @@ const Y6n = /* @__PURE__ */ Ci.baseTheme({ "&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" }, "&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" }, "&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" } -}), H6n = [ - n8, - /* @__PURE__ */ Sk.low(Q6n), - Y6n +}), k5e = [ + Wh, + /* @__PURE__ */ zl.low(m5e), + O5e ]; -class Pze { - constructor(n, s, a) { - this.state = n, this.pos = s, this.explicit = a, this.abortListeners = []; - } - tokenBefore(n) { - let s = dh(this.state).resolveInner(this.pos, -1); - for (; s && n.indexOf(s.name) < 0; ) - s = s.parent; - return s ? { - from: s.from, +class iM { + constructor(e, r, n) { + this.state = e, this.pos = r, this.explicit = n, this.abortListeners = []; + } + tokenBefore(e) { + let r = fn(this.state).resolveInner(this.pos, -1); + for (; r && e.indexOf(r.name) < 0; ) + r = r.parent; + return r ? { + from: r.from, to: this.pos, - text: this.state.sliceDoc(s.from, this.pos), - type: s.type + text: this.state.sliceDoc(r.from, this.pos), + type: r.type } : null; } - matchBefore(n) { - let s = this.state.doc.lineAt(this.pos), a = Math.max(s.from, this.pos - 250), l = s.text.slice(a - s.from, this.pos - s.from), h = l.search(yLt(n, !1)); - return h < 0 ? null : { from: a + h, to: this.pos, text: l.slice(h) }; + matchBefore(e) { + let r = this.state.doc.lineAt(this.pos), n = Math.max(r.from, this.pos - 250), i = r.text.slice(n - r.from, this.pos - r.from), s = i.search(DJ(e, !1)); + return s < 0 ? null : { from: n + s, to: this.pos, text: i.slice(s) }; } get aborted() { return this.abortListeners == null; } - addEventListener(n, s) { - n == "abort" && this.abortListeners && this.abortListeners.push(s); + addEventListener(e, r) { + e == "abort" && this.abortListeners && this.abortListeners.push(r); } } -function VCt(r) { - let n = Object.keys(r).join(""), s = /\w/.test(n); - return s && (n = n.replace(/\w/g, "")), `[${s ? "\\w" : ""}${n.replace(/[^\w\s]/g, "\\$&")}]`; +function bF(t) { + let e = Object.keys(t).join(""), r = /\w/.test(e); + return r && (e = e.replace(/\w/g, "")), `[${r ? "\\w" : ""}${e.replace(/[^\w\s]/g, "\\$&")}]`; } -function G6n(r) { - let n = /* @__PURE__ */ Object.create(null), s = /* @__PURE__ */ Object.create(null); - for (let { label: l } of r) { - n[l[0]] = !0; - for (let h = 1; h < l.length; h++) - s[l[h]] = !0; +function S5e(t) { + let e = /* @__PURE__ */ Object.create(null), r = /* @__PURE__ */ Object.create(null); + for (let { label: i } of t) { + e[i[0]] = !0; + for (let s = 1; s < i.length; s++) + r[i[s]] = !0; } - let a = VCt(n) + VCt(s) + "*$"; - return [new RegExp("^" + a), new RegExp(a)]; + let n = bF(e) + bF(r) + "*$"; + return [new RegExp("^" + n), new RegExp(n)]; } -function wLt(r) { - let n = r.map((l) => typeof l == "string" ? { label: l } : l), [s, a] = n.every((l) => /^\w+$/.test(l.label)) ? [/\w*$/, /\w+$/] : G6n(n); - return (l) => { - let h = l.matchBefore(a); - return h || l.explicit ? { from: h ? h.from : l.pos, options: n, validFor: s } : null; +function MJ(t) { + let e = t.map((i) => typeof i == "string" ? { label: i } : i), [r, n] = e.every((i) => /^\w+$/.test(i.label)) ? [/\w*$/, /\w+$/] : S5e(e); + return (i) => { + let s = i.matchBefore(n); + return s || i.explicit ? { from: s ? s.from : i.pos, options: e, validFor: r } : null; }; } -function Z6n(r, n) { - return (s) => { - for (let a = dh(s.state).resolveInner(s.pos, -1); a; a = a.parent) { - if (r.indexOf(a.name) > -1) +function T5e(t, e) { + return (r) => { + for (let n = fn(r.state).resolveInner(r.pos, -1); n; n = n.parent) { + if (t.indexOf(n.name) > -1) return null; - if (a.type.isTop) + if (n.type.isTop) break; } - return n(s); + return e(r); }; } -class UCt { - constructor(n, s, a, l) { - this.completion = n, this.source = s, this.match = a, this.score = l; +class xF { + constructor(e, r, n, i) { + this.completion = e, this.source = r, this.match = n, this.score = i; } } -function r8(r) { - return r.selection.main.from; +function Gh(t) { + return t.selection.main.from; } -function yLt(r, n) { - var s; - let { source: a } = r, l = n && a[0] != "^", h = a[a.length - 1] != "$"; - return !l && !h ? r : new RegExp(`${l ? "^" : ""}(?:${a})${h ? "$" : ""}`, (s = r.flags) !== null && s !== void 0 ? s : r.ignoreCase ? "i" : ""); -} -const OLt = /* @__PURE__ */ _k.define(); -function X6n(r, n, s, a) { - let { main: l } = r.selection, h = s - l.from, f = a - l.from; - return Object.assign(Object.assign({}, r.changeByRange((b) => b != l && s != a && r.sliceDoc(b.from + h, b.from + f) != r.sliceDoc(s, a) ? { range: b } : { - changes: { from: b.from + h, to: a == l.from ? b.to : b.from + f, insert: n }, - range: sr.cursor(b.from + h + n.length) +function DJ(t, e) { + var r; + let { source: n } = t, i = e && n[0] != "^", s = n[n.length - 1] != "$"; + return !i && !s ? t : new RegExp(`${i ? "^" : ""}(?:${n})${s ? "$" : ""}`, (r = t.flags) !== null && r !== void 0 ? r : t.ignoreCase ? "i" : ""); +} +const NJ = /* @__PURE__ */ Vl.define(); +function C5e(t, e, r, n) { + let { main: i } = t.selection, s = r - i.from, a = n - i.from; + return Object.assign(Object.assign({}, t.changeByRange((o) => o != i && r != n && t.sliceDoc(o.from + s, o.from + a) != t.sliceDoc(r, n) ? { range: o } : { + changes: { from: o.from + s, to: n == i.from ? o.to : o.from + a, insert: e }, + range: Ve.cursor(o.from + s + e.length) })), { scrollIntoView: !0, userEvent: "input.complete" }); } -const WCt = /* @__PURE__ */ new WeakMap(); -function K6n(r) { - if (!Array.isArray(r)) - return r; - let n = WCt.get(r); - return n || WCt.set(r, n = wLt(r)), n; -} -const Lze = /* @__PURE__ */ $o.define(), _K = /* @__PURE__ */ $o.define(); -class J6n { - constructor(n) { - this.pattern = n, this.chars = [], this.folded = [], this.any = [], this.precise = [], this.byWord = [], this.score = 0, this.matched = []; - for (let s = 0; s < n.length; ) { - let a = Lp(n, s), l = Fy(a); - this.chars.push(a); - let h = n.slice(s, s + l), f = h.toUpperCase(); - this.folded.push(Lp(f == h ? h.toLowerCase() : f, 0)), s += l; - } - this.astral = n.length != this.chars.length; - } - ret(n, s) { - return this.score = n, this.matched = s, !0; - } - match(n) { +const wF = /* @__PURE__ */ new WeakMap(); +function E5e(t) { + if (!Array.isArray(t)) + return t; + let e = wF.get(t); + return e || wF.set(t, e = MJ(t)), e; +} +const sM = /* @__PURE__ */ Zt.define(), Ny = /* @__PURE__ */ Zt.define(); +class _5e { + constructor(e) { + this.pattern = e, this.chars = [], this.folded = [], this.any = [], this.precise = [], this.byWord = [], this.score = 0, this.matched = []; + for (let r = 0; r < e.length; ) { + let n = ss(e, r), i = Eo(n); + this.chars.push(n); + let s = e.slice(r, r + i), a = s.toUpperCase(); + this.folded.push(ss(a == s ? s.toLowerCase() : a, 0)), r += i; + } + this.astral = e.length != this.chars.length; + } + ret(e, r) { + return this.score = e, this.matched = r, !0; + } + match(e) { if (this.pattern.length == 0) return this.ret(-100, []); - if (n.length < this.pattern.length) + if (e.length < this.pattern.length) return !1; - let { chars: s, folded: a, any: l, precise: h, byWord: f } = this; - if (s.length == 1) { - let G = Lp(n, 0), ee = Fy(G), le = ee == n.length ? 0 : -100; - if (G != s[0]) - if (G == a[0]) - le += -200; + let { chars: r, folded: n, any: i, precise: s, byWord: a } = this; + if (r.length == 1) { + let b = ss(e, 0), w = Eo(b), O = w == e.length ? 0 : -100; + if (b != r[0]) + if (b == n[0]) + O += -200; else return !1; - return this.ret(le, [0, ee]); - } - let b = n.indexOf(this.pattern); - if (b == 0) - return this.ret(n.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]); - let w = s.length, O = 0; - if (b < 0) { - for (let G = 0, ee = Math.min(n.length, 200); G < ee && O < w; ) { - let le = Lp(n, G); - (le == s[O] || le == a[O]) && (l[O++] = G), G += Fy(le); - } - if (O < w) + return this.ret(O, [0, w]); + } + let o = e.indexOf(this.pattern); + if (o == 0) + return this.ret(e.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]); + let l = r.length, u = 0; + if (o < 0) { + for (let b = 0, w = Math.min(e.length, 200); b < w && u < l; ) { + let O = ss(e, b); + (O == r[u] || O == n[u]) && (i[u++] = b), b += Eo(O); + } + if (u < l) return !1; } - let S = 0, E = 0, D = !1, M = 0, B = -1, z = -1, W = /[a-z]/.test(n), H = !0; - for (let G = 0, ee = Math.min(n.length, 200), le = 0; G < ee && E < w; ) { - let se = Lp(n, G); - b < 0 && (S < w && se == s[S] && (h[S++] = G), M < w && (se == s[M] || se == a[M] ? (M == 0 && (B = G), z = G + 1, M++) : M = 0)); - let he, te = se < 255 ? se >= 48 && se <= 57 || se >= 97 && se <= 122 ? 2 : se >= 65 && se <= 90 ? 1 : 0 : (he = rze(se)) != he.toLowerCase() ? 1 : he != he.toUpperCase() ? 2 : 0; - (!G || te == 1 && W || le == 0 && te != 0) && (s[E] == se || a[E] == se && (D = !0) ? f[E++] = G : f.length && (H = !1)), le = te, G += Fy(se); + let h = 0, f = 0, d = !1, p = 0, g = -1, m = -1, v = /[a-z]/.test(e), y = !0; + for (let b = 0, w = Math.min(e.length, 200), O = 0; b < w && f < l; ) { + let S = ss(e, b); + o < 0 && (h < l && S == r[h] && (s[h++] = b), p < l && (S == r[p] || S == n[p] ? (p == 0 && (g = b), m = b + 1, p++) : p = 0)); + let C, T = S < 255 ? S >= 48 && S <= 57 || S >= 97 && S <= 122 ? 2 : S >= 65 && S <= 90 ? 1 : 0 : (C = AR(S)) != C.toLowerCase() ? 1 : C != C.toUpperCase() ? 2 : 0; + (!b || T == 1 && v || O == 0 && T != 0) && (r[f] == S || n[f] == S && (d = !0) ? a[f++] = b : a.length && (y = !1)), O = T, b += Eo(S); } - return E == w && f[0] == 0 && H ? this.result(-100 + (D ? -200 : 0), f, n) : M == w && B == 0 ? this.ret(-200 - n.length + (z == n.length ? 0 : -100), [0, z]) : b > -1 ? this.ret(-700 - n.length, [b, b + this.pattern.length]) : M == w ? this.ret(-200 + -700 - n.length, [B, z]) : E == w ? this.result(-100 + (D ? -200 : 0) + -700 + (H ? 0 : -1100), f, n) : s.length == 2 ? !1 : this.result((l[0] ? -700 : 0) + -200 + -1100, l, n); + return f == l && a[0] == 0 && y ? this.result(-100 + (d ? -200 : 0), a, e) : p == l && g == 0 ? this.ret(-200 - e.length + (m == e.length ? 0 : -100), [0, m]) : o > -1 ? this.ret(-700 - e.length, [o, o + this.pattern.length]) : p == l ? this.ret(-200 + -700 - e.length, [g, m]) : f == l ? this.result(-100 + (d ? -200 : 0) + -700 + (y ? 0 : -1100), a, e) : r.length == 2 ? !1 : this.result((i[0] ? -700 : 0) + -200 + -1100, i, e); } - result(n, s, a) { - let l = [], h = 0; - for (let f of s) { - let b = f + (this.astral ? Fy(Lp(a, f)) : 1); - h && l[h - 1] == f ? l[h - 1] = b : (l[h++] = f, l[h++] = b); + result(e, r, n) { + let i = [], s = 0; + for (let a of r) { + let o = a + (this.astral ? Eo(ss(n, a)) : 1); + s && i[s - 1] == a ? i[s - 1] = o : (i[s++] = a, i[s++] = o); } - return this.ret(n - a.length, l); + return this.ret(e - n.length, i); } } -const Sg = /* @__PURE__ */ us.define({ - combine(r) { - return px(r, { +const Ds = /* @__PURE__ */ _t.define({ + combine(t) { + return qc(t, { activateOnTyping: !0, selectOnOpen: !0, override: null, @@ -14529,201 +14538,201 @@ const Sg = /* @__PURE__ */ us.define({ aboveCursor: !1, icons: !0, addToOptions: [], - positionInfo: e_n, - compareCompletions: (n, s) => n.label.localeCompare(s.label), + positionInfo: A5e, + compareCompletions: (e, r) => e.label.localeCompare(r.label), interactionDelay: 75, updateSyncTime: 100 }, { - defaultKeymap: (n, s) => n && s, - closeOnBlur: (n, s) => n && s, - icons: (n, s) => n && s, - tooltipClass: (n, s) => (a) => YCt(n(a), s(a)), - optionClass: (n, s) => (a) => YCt(n(a), s(a)), - addToOptions: (n, s) => n.concat(s) + defaultKeymap: (e, r) => e && r, + closeOnBlur: (e, r) => e && r, + icons: (e, r) => e && r, + tooltipClass: (e, r) => (n) => OF(e(n), r(n)), + optionClass: (e, r) => (n) => OF(e(n), r(n)), + addToOptions: (e, r) => e.concat(r) }); } }); -function YCt(r, n) { - return r ? n ? r + " " + n : r : n; +function OF(t, e) { + return t ? e ? t + " " + e : t : e; } -function e_n(r, n, s, a, l, h) { - let f = r.textDirection == Cf.RTL, b = f, w = !1, O = "top", S, E, D = n.left - l.left, M = l.right - n.right, B = a.right - a.left, z = a.bottom - a.top; - if (b && D < Math.min(B, M) ? b = !1 : !b && M < Math.min(B, D) && (b = !0), B <= (b ? D : M)) - S = Math.max(l.top, Math.min(s.top, l.bottom - z)) - n.top, E = Math.min(400, b ? D : M); +function A5e(t, e, r, n, i, s) { + let a = t.textDirection == Nn.RTL, o = a, l = !1, u = "top", h, f, d = e.left - i.left, p = i.right - e.right, g = n.right - n.left, m = n.bottom - n.top; + if (o && d < Math.min(g, p) ? o = !1 : !o && p < Math.min(g, d) && (o = !0), g <= (o ? d : p)) + h = Math.max(i.top, Math.min(r.top, i.bottom - m)) - e.top, f = Math.min(400, o ? d : p); else { - w = !0, E = Math.min(400, (f ? n.right : l.right - n.left) - 30); - let G = l.bottom - n.bottom; - G >= z || G > n.top ? S = s.bottom - n.top : (O = "bottom", S = n.bottom - s.top); + l = !0, f = Math.min(400, (a ? e.right : i.right - e.left) - 30); + let b = i.bottom - e.bottom; + b >= m || b > e.top ? h = r.bottom - e.top : (u = "bottom", h = e.bottom - r.top); } - let W = (n.bottom - n.top) / h.offsetHeight, H = (n.right - n.left) / h.offsetWidth; + let v = (e.bottom - e.top) / s.offsetHeight, y = (e.right - e.left) / s.offsetWidth; return { - style: `${O}: ${S / W}px; max-width: ${E / H}px`, - class: "cm-completionInfo-" + (w ? f ? "left-narrow" : "right-narrow" : b ? "left" : "right") + style: `${u}: ${h / v}px; max-width: ${f / y}px`, + class: "cm-completionInfo-" + (l ? a ? "left-narrow" : "right-narrow" : o ? "left" : "right") }; } -function t_n(r) { - let n = r.addToOptions.slice(); - return r.icons && n.push({ - render(s) { - let a = document.createElement("div"); - return a.classList.add("cm-completionIcon"), s.type && a.classList.add(...s.type.split(/\s+/g).map((l) => "cm-completionIcon-" + l)), a.setAttribute("aria-hidden", "true"), a; +function L5e(t) { + let e = t.addToOptions.slice(); + return t.icons && e.push({ + render(r) { + let n = document.createElement("div"); + return n.classList.add("cm-completionIcon"), r.type && n.classList.add(...r.type.split(/\s+/g).map((i) => "cm-completionIcon-" + i)), n.setAttribute("aria-hidden", "true"), n; }, position: 20 - }), n.push({ - render(s, a, l, h) { - let f = document.createElement("span"); - f.className = "cm-completionLabel"; - let b = s.displayLabel || s.label, w = 0; - for (let O = 0; O < h.length; ) { - let S = h[O++], E = h[O++]; - S > w && f.appendChild(document.createTextNode(b.slice(w, S))); - let D = f.appendChild(document.createElement("span")); - D.appendChild(document.createTextNode(b.slice(S, E))), D.className = "cm-completionMatchedText", w = E; - } - return w < b.length && f.appendChild(document.createTextNode(b.slice(w))), f; + }), e.push({ + render(r, n, i, s) { + let a = document.createElement("span"); + a.className = "cm-completionLabel"; + let o = r.displayLabel || r.label, l = 0; + for (let u = 0; u < s.length; ) { + let h = s[u++], f = s[u++]; + h > l && a.appendChild(document.createTextNode(o.slice(l, h))); + let d = a.appendChild(document.createElement("span")); + d.appendChild(document.createTextNode(o.slice(h, f))), d.className = "cm-completionMatchedText", l = f; + } + return l < o.length && a.appendChild(document.createTextNode(o.slice(l))), a; }, position: 50 }, { - render(s) { - if (!s.detail) + render(r) { + if (!r.detail) return null; - let a = document.createElement("span"); - return a.className = "cm-completionDetail", a.textContent = s.detail, a; + let n = document.createElement("span"); + return n.className = "cm-completionDetail", n.textContent = r.detail, n; }, position: 80 - }), n.sort((s, a) => s.position - a.position).map((s) => s.render); + }), e.sort((r, n) => r.position - n.position).map((r) => r.render); } -function NRe(r, n, s) { - if (r <= s) - return { from: 0, to: r }; - if (n < 0 && (n = 0), n <= r >> 1) { - let l = Math.floor(n / s); - return { from: l * s, to: (l + 1) * s }; +function LE(t, e, r) { + if (t <= r) + return { from: 0, to: t }; + if (e < 0 && (e = 0), e <= t >> 1) { + let i = Math.floor(e / r); + return { from: i * r, to: (i + 1) * r }; } - let a = Math.floor((r - n) / s); - return { from: r - (a + 1) * s, to: r - a * s }; + let n = Math.floor((t - e) / r); + return { from: t - (n + 1) * r, to: t - n * r }; } -class n_n { - constructor(n, s, a) { - this.view = n, this.stateField = s, this.applyCompletion = a, this.info = null, this.infoDestroy = null, this.placeInfoReq = { +class R5e { + constructor(e, r, n) { + this.view = e, this.stateField = r, this.applyCompletion = n, this.info = null, this.infoDestroy = null, this.placeInfoReq = { read: () => this.measureInfo(), - write: (w) => this.placeInfo(w), + write: (l) => this.placeInfo(l), key: this }, this.space = null, this.currentClass = ""; - let l = n.state.field(s), { options: h, selected: f } = l.open, b = n.state.facet(Sg); - this.optionContent = t_n(b), this.optionClass = b.optionClass, this.tooltipClass = b.tooltipClass, this.range = NRe(h.length, f, b.maxRenderedOptions), this.dom = document.createElement("div"), this.dom.className = "cm-tooltip-autocomplete", this.updateTooltipClass(n.state), this.dom.addEventListener("mousedown", (w) => { - let { options: O } = n.state.field(s).open; - for (let S = w.target, E; S && S != this.dom; S = S.parentNode) - if (S.nodeName == "LI" && (E = /-(\d+)$/.exec(S.id)) && +E[1] < O.length) { - this.applyCompletion(n, O[+E[1]]), w.preventDefault(); + let i = e.state.field(r), { options: s, selected: a } = i.open, o = e.state.facet(Ds); + this.optionContent = L5e(o), this.optionClass = o.optionClass, this.tooltipClass = o.tooltipClass, this.range = LE(s.length, a, o.maxRenderedOptions), this.dom = document.createElement("div"), this.dom.className = "cm-tooltip-autocomplete", this.updateTooltipClass(e.state), this.dom.addEventListener("mousedown", (l) => { + let { options: u } = e.state.field(r).open; + for (let h = l.target, f; h && h != this.dom; h = h.parentNode) + if (h.nodeName == "LI" && (f = /-(\d+)$/.exec(h.id)) && +f[1] < u.length) { + this.applyCompletion(e, u[+f[1]]), l.preventDefault(); return; } - }), this.dom.addEventListener("focusout", (w) => { - let O = n.state.field(this.stateField, !1); - O && O.tooltip && n.state.facet(Sg).closeOnBlur && w.relatedTarget != n.contentDOM && n.dispatch({ effects: _K.of(null) }); - }), this.showOptions(h, l.id); + }), this.dom.addEventListener("focusout", (l) => { + let u = e.state.field(this.stateField, !1); + u && u.tooltip && e.state.facet(Ds).closeOnBlur && l.relatedTarget != e.contentDOM && e.dispatch({ effects: Ny.of(null) }); + }), this.showOptions(s, i.id); } mount() { this.updateSel(); } - showOptions(n, s) { - this.list && this.list.remove(), this.list = this.dom.appendChild(this.createListBox(n, s, this.range)), this.list.addEventListener("scroll", () => { + showOptions(e, r) { + this.list && this.list.remove(), this.list = this.dom.appendChild(this.createListBox(e, r, this.range)), this.list.addEventListener("scroll", () => { this.info && this.view.requestMeasure(this.placeInfoReq); }); } - update(n) { - var s; - let a = n.state.field(this.stateField), l = n.startState.field(this.stateField); - if (this.updateTooltipClass(n.state), a != l) { - let { options: h, selected: f, disabled: b } = a.open; - (!l.open || l.open.options != h) && (this.range = NRe(h.length, f, n.state.facet(Sg).maxRenderedOptions), this.showOptions(h, a.id)), this.updateSel(), b != ((s = l.open) === null || s === void 0 ? void 0 : s.disabled) && this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!b); + update(e) { + var r; + let n = e.state.field(this.stateField), i = e.startState.field(this.stateField); + if (this.updateTooltipClass(e.state), n != i) { + let { options: s, selected: a, disabled: o } = n.open; + (!i.open || i.open.options != s) && (this.range = LE(s.length, a, e.state.facet(Ds).maxRenderedOptions), this.showOptions(s, n.id)), this.updateSel(), o != ((r = i.open) === null || r === void 0 ? void 0 : r.disabled) && this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!o); } } - updateTooltipClass(n) { - let s = this.tooltipClass(n); - if (s != this.currentClass) { - for (let a of this.currentClass.split(" ")) - a && this.dom.classList.remove(a); - for (let a of s.split(" ")) - a && this.dom.classList.add(a); - this.currentClass = s; + updateTooltipClass(e) { + let r = this.tooltipClass(e); + if (r != this.currentClass) { + for (let n of this.currentClass.split(" ")) + n && this.dom.classList.remove(n); + for (let n of r.split(" ")) + n && this.dom.classList.add(n); + this.currentClass = r; } } - positioned(n) { - this.space = n, this.info && this.view.requestMeasure(this.placeInfoReq); + positioned(e) { + this.space = e, this.info && this.view.requestMeasure(this.placeInfoReq); } updateSel() { - let n = this.view.state.field(this.stateField), s = n.open; - if ((s.selected > -1 && s.selected < this.range.from || s.selected >= this.range.to) && (this.range = NRe(s.options.length, s.selected, this.view.state.facet(Sg).maxRenderedOptions), this.showOptions(s.options, n.id)), this.updateSelectedOption(s.selected)) { + let e = this.view.state.field(this.stateField), r = e.open; + if ((r.selected > -1 && r.selected < this.range.from || r.selected >= this.range.to) && (this.range = LE(r.options.length, r.selected, this.view.state.facet(Ds).maxRenderedOptions), this.showOptions(r.options, e.id)), this.updateSelectedOption(r.selected)) { this.destroyInfo(); - let { completion: a } = s.options[s.selected], { info: l } = a; - if (!l) + let { completion: n } = r.options[r.selected], { info: i } = n; + if (!i) return; - let h = typeof l == "string" ? document.createTextNode(l) : l(a); - if (!h) + let s = typeof i == "string" ? document.createTextNode(i) : i(n); + if (!s) return; - "then" in h ? h.then((f) => { - f && this.view.state.field(this.stateField, !1) == n && this.addInfoPane(f, a); - }).catch((f) => Yy(this.view.state, f, "completion info")) : this.addInfoPane(h, a); + "then" in s ? s.then((a) => { + a && this.view.state.field(this.stateField, !1) == e && this.addInfoPane(a, n); + }).catch((a) => Bo(this.view.state, a, "completion info")) : this.addInfoPane(s, n); } } - addInfoPane(n, s) { + addInfoPane(e, r) { this.destroyInfo(); - let a = this.info = document.createElement("div"); - if (a.className = "cm-tooltip cm-completionInfo", n.nodeType != null) - a.appendChild(n), this.infoDestroy = null; + let n = this.info = document.createElement("div"); + if (n.className = "cm-tooltip cm-completionInfo", e.nodeType != null) + n.appendChild(e), this.infoDestroy = null; else { - let { dom: l, destroy: h } = n; - a.appendChild(l), this.infoDestroy = h || null; + let { dom: i, destroy: s } = e; + n.appendChild(i), this.infoDestroy = s || null; } - this.dom.appendChild(a), this.view.requestMeasure(this.placeInfoReq); + this.dom.appendChild(n), this.view.requestMeasure(this.placeInfoReq); } - updateSelectedOption(n) { - let s = null; - for (let a = this.list.firstChild, l = this.range.from; a; a = a.nextSibling, l++) - a.nodeName != "LI" || !a.id ? l-- : l == n ? a.hasAttribute("aria-selected") || (a.setAttribute("aria-selected", "true"), s = a) : a.hasAttribute("aria-selected") && a.removeAttribute("aria-selected"); - return s && i_n(this.list, s), s; + updateSelectedOption(e) { + let r = null; + for (let n = this.list.firstChild, i = this.range.from; n; n = n.nextSibling, i++) + n.nodeName != "LI" || !n.id ? i-- : i == e ? n.hasAttribute("aria-selected") || (n.setAttribute("aria-selected", "true"), r = n) : n.hasAttribute("aria-selected") && n.removeAttribute("aria-selected"); + return r && D5e(this.list, r), r; } measureInfo() { - let n = this.dom.querySelector("[aria-selected]"); - if (!n || !this.info) + let e = this.dom.querySelector("[aria-selected]"); + if (!e || !this.info) return null; - let s = this.dom.getBoundingClientRect(), a = this.info.getBoundingClientRect(), l = n.getBoundingClientRect(), h = this.space; - if (!h) { - let f = this.dom.ownerDocument.defaultView || window; - h = { left: 0, top: 0, right: f.innerWidth, bottom: f.innerHeight }; + let r = this.dom.getBoundingClientRect(), n = this.info.getBoundingClientRect(), i = e.getBoundingClientRect(), s = this.space; + if (!s) { + let a = this.dom.ownerDocument.defaultView || window; + s = { left: 0, top: 0, right: a.innerWidth, bottom: a.innerHeight }; } - return l.top > Math.min(h.bottom, s.bottom) - 10 || l.bottom < Math.max(h.top, s.top) + 10 ? null : this.view.state.facet(Sg).positionInfo(this.view, s, l, a, h, this.dom); + return i.top > Math.min(s.bottom, r.bottom) - 10 || i.bottom < Math.max(s.top, r.top) + 10 ? null : this.view.state.facet(Ds).positionInfo(this.view, r, i, n, s, this.dom); } - placeInfo(n) { - this.info && (n ? (n.style && (this.info.style.cssText = n.style), this.info.className = "cm-tooltip cm-completionInfo " + (n.class || "")) : this.info.style.cssText = "top: -1e6px"); + placeInfo(e) { + this.info && (e ? (e.style && (this.info.style.cssText = e.style), this.info.className = "cm-tooltip cm-completionInfo " + (e.class || "")) : this.info.style.cssText = "top: -1e6px"); } - createListBox(n, s, a) { - const l = document.createElement("ul"); - l.id = s, l.setAttribute("role", "listbox"), l.setAttribute("aria-expanded", "true"), l.setAttribute("aria-label", this.view.state.phrase("Completions")); - let h = null; - for (let f = a.from; f < a.to; f++) { - let { completion: b, match: w } = n[f], { section: O } = b; - if (O) { - let D = typeof O == "string" ? O : O.name; - if (D != h && (f > a.from || a.from == 0)) - if (h = D, typeof O != "string" && O.header) - l.appendChild(O.header(O)); + createListBox(e, r, n) { + const i = document.createElement("ul"); + i.id = r, i.setAttribute("role", "listbox"), i.setAttribute("aria-expanded", "true"), i.setAttribute("aria-label", this.view.state.phrase("Completions")); + let s = null; + for (let a = n.from; a < n.to; a++) { + let { completion: o, match: l } = e[a], { section: u } = o; + if (u) { + let d = typeof u == "string" ? u : u.name; + if (d != s && (a > n.from || n.from == 0)) + if (s = d, typeof u != "string" && u.header) + i.appendChild(u.header(u)); else { - let M = l.appendChild(document.createElement("completion-section")); - M.textContent = D; + let p = i.appendChild(document.createElement("completion-section")); + p.textContent = d; } } - const S = l.appendChild(document.createElement("li")); - S.id = s + "-" + f, S.setAttribute("role", "option"); - let E = this.optionClass(b); - E && (S.className = E); - for (let D of this.optionContent) { - let M = D(b, this.view.state, this.view, w); - M && S.appendChild(M); + const h = i.appendChild(document.createElement("li")); + h.id = r + "-" + a, h.setAttribute("role", "option"); + let f = this.optionClass(o); + f && (h.className = f); + for (let d of this.optionContent) { + let p = d(o, this.view.state, this.view, l); + p && h.appendChild(p); } } - return a.from && l.classList.add("cm-completionListIncompleteTop"), a.to < n.length && l.classList.add("cm-completionListIncompleteBottom"), l; + return n.from && i.classList.add("cm-completionListIncompleteTop"), n.to < e.length && i.classList.add("cm-completionListIncompleteBottom"), i; } destroyInfo() { this.info && (this.infoDestroy && this.infoDestroy(), this.info.remove(), this.info = null); @@ -14732,337 +14741,337 @@ class n_n { this.destroyInfo(); } } -function r_n(r, n) { - return (s) => new n_n(s, r, n); +function M5e(t, e) { + return (r) => new R5e(r, t, e); } -function i_n(r, n) { - let s = r.getBoundingClientRect(), a = n.getBoundingClientRect(), l = s.height / r.offsetHeight; - a.top < s.top ? r.scrollTop -= (s.top - a.top) / l : a.bottom > s.bottom && (r.scrollTop += (a.bottom - s.bottom) / l); +function D5e(t, e) { + let r = t.getBoundingClientRect(), n = e.getBoundingClientRect(), i = r.height / t.offsetHeight; + n.top < r.top ? t.scrollTop -= (r.top - n.top) / i : n.bottom > r.bottom && (t.scrollTop += (n.bottom - r.bottom) / i); } -function HCt(r) { - return (r.boost || 0) * 100 + (r.apply ? 10 : 0) + (r.info ? 5 : 0) + (r.type ? 1 : 0); +function kF(t) { + return (t.boost || 0) * 100 + (t.apply ? 10 : 0) + (t.info ? 5 : 0) + (t.type ? 1 : 0); } -function s_n(r, n) { - let s = [], a = null, l = (w) => { - s.push(w); - let { section: O } = w.completion; - if (O) { - a || (a = []); - let S = typeof O == "string" ? O : O.name; - a.some((E) => E.name == S) || a.push(typeof O == "string" ? { name: S } : O); +function N5e(t, e) { + let r = [], n = null, i = (l) => { + r.push(l); + let { section: u } = l.completion; + if (u) { + n || (n = []); + let h = typeof u == "string" ? u : u.name; + n.some((f) => f.name == h) || n.push(typeof u == "string" ? { name: h } : u); } }; - for (let w of r) - if (w.hasResult()) { - let O = w.result.getMatch; - if (w.result.filter === !1) - for (let S of w.result.options) - l(new UCt(S, w.source, O ? O(S) : [], 1e9 - s.length)); + for (let l of t) + if (l.hasResult()) { + let u = l.result.getMatch; + if (l.result.filter === !1) + for (let h of l.result.options) + i(new xF(h, l.source, u ? u(h) : [], 1e9 - r.length)); else { - let S = new J6n(n.sliceDoc(w.from, w.to)); - for (let E of w.result.options) - if (S.match(E.label)) { - let D = E.displayLabel ? O ? O(E, S.matched) : [] : S.matched; - l(new UCt(E, w.source, D, S.score + (E.boost || 0))); + let h = new _5e(e.sliceDoc(l.from, l.to)); + for (let f of l.result.options) + if (h.match(f.label)) { + let d = f.displayLabel ? u ? u(f, h.matched) : [] : h.matched; + i(new xF(f, l.source, d, h.score + (f.boost || 0))); } } } - if (a) { - let w = /* @__PURE__ */ Object.create(null), O = 0, S = (E, D) => { - var M, B; - return ((M = E.rank) !== null && M !== void 0 ? M : 1e9) - ((B = D.rank) !== null && B !== void 0 ? B : 1e9) || (E.name < D.name ? -1 : 1); + if (n) { + let l = /* @__PURE__ */ Object.create(null), u = 0, h = (f, d) => { + var p, g; + return ((p = f.rank) !== null && p !== void 0 ? p : 1e9) - ((g = d.rank) !== null && g !== void 0 ? g : 1e9) || (f.name < d.name ? -1 : 1); }; - for (let E of a.sort(S)) - O -= 1e5, w[E.name] = O; - for (let E of s) { - let { section: D } = E.completion; - D && (E.score += w[typeof D == "string" ? D : D.name]); + for (let f of n.sort(h)) + u -= 1e5, l[f.name] = u; + for (let f of r) { + let { section: d } = f.completion; + d && (f.score += l[typeof d == "string" ? d : d.name]); } } - let h = [], f = null, b = n.facet(Sg).compareCompletions; - for (let w of s.sort((O, S) => S.score - O.score || b(O.completion, S.completion))) { - let O = w.completion; - !f || f.label != O.label || f.detail != O.detail || f.type != null && O.type != null && f.type != O.type || f.apply != O.apply || f.boost != O.boost ? h.push(w) : HCt(w.completion) > HCt(f) && (h[h.length - 1] = w), f = w.completion; + let s = [], a = null, o = e.facet(Ds).compareCompletions; + for (let l of r.sort((u, h) => h.score - u.score || o(u.completion, h.completion))) { + let u = l.completion; + !a || a.label != u.label || a.detail != u.detail || a.type != null && u.type != null && a.type != u.type || a.apply != u.apply || a.boost != u.boost ? s.push(l) : kF(l.completion) > kF(a) && (s[s.length - 1] = l), a = l.completion; } - return h; + return s; } -class bB { - constructor(n, s, a, l, h, f) { - this.options = n, this.attrs = s, this.tooltip = a, this.timestamp = l, this.selected = h, this.disabled = f; +class Lp { + constructor(e, r, n, i, s, a) { + this.options = e, this.attrs = r, this.tooltip = n, this.timestamp = i, this.selected = s, this.disabled = a; } - setSelected(n, s) { - return n == this.selected || n >= this.options.length ? this : new bB(this.options, GCt(s, n), this.tooltip, this.timestamp, n, this.disabled); + setSelected(e, r) { + return e == this.selected || e >= this.options.length ? this : new Lp(this.options, SF(r, e), this.tooltip, this.timestamp, e, this.disabled); } - static build(n, s, a, l, h) { - let f = s_n(n, s); - if (!f.length) - return l && n.some((w) => w.state == 1) ? new bB(l.options, l.attrs, l.tooltip, l.timestamp, l.selected, !0) : null; - let b = s.facet(Sg).selectOnOpen ? 0 : -1; - if (l && l.selected != b && l.selected != -1) { - let w = l.options[l.selected].completion; - for (let O = 0; O < f.length; O++) - if (f[O].completion == w) { - b = O; + static build(e, r, n, i, s) { + let a = N5e(e, r); + if (!a.length) + return i && e.some((l) => l.state == 1) ? new Lp(i.options, i.attrs, i.tooltip, i.timestamp, i.selected, !0) : null; + let o = r.facet(Ds).selectOnOpen ? 0 : -1; + if (i && i.selected != o && i.selected != -1) { + let l = i.options[i.selected].completion; + for (let u = 0; u < a.length; u++) + if (a[u].completion == l) { + o = u; break; } } - return new bB(f, GCt(a, b), { - pos: n.reduce((w, O) => O.hasResult() ? Math.min(w, O.from) : w, 1e8), - create: u_n, - above: h.aboveCursor - }, l ? l.timestamp : Date.now(), b, !1); + return new Lp(a, SF(n, o), { + pos: e.reduce((l, u) => u.hasResult() ? Math.min(l, u.from) : l, 1e8), + create: F5e, + above: s.aboveCursor + }, i ? i.timestamp : Date.now(), o, !1); } - map(n) { - return new bB(this.options, this.attrs, Object.assign(Object.assign({}, this.tooltip), { pos: n.mapPos(this.tooltip.pos) }), this.timestamp, this.selected, this.disabled); + map(e) { + return new Lp(this.options, this.attrs, Object.assign(Object.assign({}, this.tooltip), { pos: e.mapPos(this.tooltip.pos) }), this.timestamp, this.selected, this.disabled); } } -class ave { - constructor(n, s, a) { - this.active = n, this.id = s, this.open = a; +class $5 { + constructor(e, r, n) { + this.active = e, this.id = r, this.open = n; } static start() { - return new ave(c_n, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null); + return new $5($5e, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null); } - update(n) { - let { state: s } = n, a = s.facet(Sg), h = (a.override || s.languageDataAt("autocomplete", r8(s)).map(K6n)).map((b) => (this.active.find((O) => O.source == b) || new Kb(b, this.active.some((O) => O.state != 0) ? 1 : 0)).update(n, a)); - h.length == this.active.length && h.every((b, w) => b == this.active[w]) && (h = this.active); - let f = this.open; - f && n.docChanged && (f = f.map(n.changes)), n.selection || h.some((b) => b.hasResult() && n.changes.touchesRange(b.from, b.to)) || !o_n(h, this.active) ? f = bB.build(h, s, this.id, f, a) : f && f.disabled && !h.some((b) => b.state == 1) && (f = null), !f && h.every((b) => b.state != 1) && h.some((b) => b.hasResult()) && (h = h.map((b) => b.hasResult() ? new Kb(b.source, 0) : b)); - for (let b of n.effects) - b.is(xLt) && (f = f && f.setSelected(b.value, this.id)); - return h == this.active && f == this.open ? this : new ave(h, this.id, f); + update(e) { + let { state: r } = e, n = r.facet(Ds), s = (n.override || r.languageDataAt("autocomplete", Gh(r)).map(E5e)).map((o) => (this.active.find((u) => u.source == o) || new ka(o, this.active.some((u) => u.state != 0) ? 1 : 0)).update(e, n)); + s.length == this.active.length && s.every((o, l) => o == this.active[l]) && (s = this.active); + let a = this.open; + a && e.docChanged && (a = a.map(e.changes)), e.selection || s.some((o) => o.hasResult() && e.changes.touchesRange(o.from, o.to)) || !I5e(s, this.active) ? a = Lp.build(s, r, this.id, a, n) : a && a.disabled && !s.some((o) => o.state == 1) && (a = null), !a && s.every((o) => o.state != 1) && s.some((o) => o.hasResult()) && (s = s.map((o) => o.hasResult() ? new ka(o.source, 0) : o)); + for (let o of e.effects) + o.is(PJ) && (a = a && a.setSelected(o.value, this.id)); + return s == this.active && a == this.open ? this : new $5(s, this.id, a); } get tooltip() { return this.open ? this.open.tooltip : null; } get attrs() { - return this.open ? this.open.attrs : a_n; + return this.open ? this.open.attrs : P5e; } } -function o_n(r, n) { - if (r == n) +function I5e(t, e) { + if (t == e) return !0; - for (let s = 0, a = 0; ; ) { - for (; s < r.length && !r[s].hasResult; ) - s++; - for (; a < n.length && !n[a].hasResult; ) - a++; - let l = s == r.length, h = a == n.length; - if (l || h) - return l == h; - if (r[s++].result != n[a++].result) + for (let r = 0, n = 0; ; ) { + for (; r < t.length && !t[r].hasResult; ) + r++; + for (; n < e.length && !e[n].hasResult; ) + n++; + let i = r == t.length, s = n == e.length; + if (i || s) + return i == s; + if (t[r++].result != e[n++].result) return !1; } } -const a_n = { +const P5e = { "aria-autocomplete": "list" }; -function GCt(r, n) { - let s = { +function SF(t, e) { + let r = { "aria-autocomplete": "list", "aria-haspopup": "listbox", - "aria-controls": r + "aria-controls": t }; - return n > -1 && (s["aria-activedescendant"] = r + "-" + n), s; + return e > -1 && (r["aria-activedescendant"] = t + "-" + e), r; } -const c_n = []; -function IFe(r) { - return r.isUserEvent("input.type") ? "input" : r.isUserEvent("delete.backward") ? "delete" : null; +const $5e = []; +function k7(t) { + return t.isUserEvent("input.type") ? "input" : t.isUserEvent("delete.backward") ? "delete" : null; } -class Kb { - constructor(n, s, a = -1) { - this.source = n, this.state = s, this.explicitPos = a; +class ka { + constructor(e, r, n = -1) { + this.source = e, this.state = r, this.explicitPos = n; } hasResult() { return !1; } - update(n, s) { - let a = IFe(n), l = this; - a ? l = l.handleUserEvent(n, a, s) : n.docChanged ? l = l.handleChange(n) : n.selection && l.state != 0 && (l = new Kb(l.source, 0)); - for (let h of n.effects) - if (h.is(Lze)) - l = new Kb(l.source, 1, h.value ? r8(n.state) : -1); - else if (h.is(_K)) - l = new Kb(l.source, 0); - else if (h.is(kLt)) - for (let f of h.value) - f.source == l.source && (l = f); - return l; + update(e, r) { + let n = k7(e), i = this; + n ? i = i.handleUserEvent(e, n, r) : e.docChanged ? i = i.handleChange(e) : e.selection && i.state != 0 && (i = new ka(i.source, 0)); + for (let s of e.effects) + if (s.is(sM)) + i = new ka(i.source, 1, s.value ? Gh(e.state) : -1); + else if (s.is(Ny)) + i = new ka(i.source, 0); + else if (s.is(IJ)) + for (let a of s.value) + a.source == i.source && (i = a); + return i; } - handleUserEvent(n, s, a) { - return s == "delete" || !a.activateOnTyping ? this.map(n.changes) : new Kb(this.source, 1); + handleUserEvent(e, r, n) { + return r == "delete" || !n.activateOnTyping ? this.map(e.changes) : new ka(this.source, 1); } - handleChange(n) { - return n.changes.touchesRange(r8(n.startState)) ? new Kb(this.source, 0) : this.map(n.changes); + handleChange(e) { + return e.changes.touchesRange(Gh(e.startState)) ? new ka(this.source, 0) : this.map(e.changes); } - map(n) { - return n.empty || this.explicitPos < 0 ? this : new Kb(this.source, this.state, n.mapPos(this.explicitPos)); + map(e) { + return e.empty || this.explicitPos < 0 ? this : new ka(this.source, this.state, e.mapPos(this.explicitPos)); } } -class NB extends Kb { - constructor(n, s, a, l, h) { - super(n, 2, s), this.result = a, this.from = l, this.to = h; +class Xp extends ka { + constructor(e, r, n, i, s) { + super(e, 2, r), this.result = n, this.from = i, this.to = s; } hasResult() { return !0; } - handleUserEvent(n, s, a) { - var l; - let h = n.changes.mapPos(this.from), f = n.changes.mapPos(this.to, 1), b = r8(n.state); - if ((this.explicitPos < 0 ? b <= h : b < this.from) || b > f || s == "delete" && r8(n.startState) == this.from) - return new Kb(this.source, s == "input" && a.activateOnTyping ? 1 : 0); - let w = this.explicitPos < 0 ? -1 : n.changes.mapPos(this.explicitPos), O; - return l_n(this.result.validFor, n.state, h, f) ? new NB(this.source, w, this.result, h, f) : this.result.update && (O = this.result.update(this.result, h, f, new Pze(n.state, b, w >= 0))) ? new NB(this.source, w, O, O.from, (l = O.to) !== null && l !== void 0 ? l : r8(n.state)) : new Kb(this.source, 1, w); + handleUserEvent(e, r, n) { + var i; + let s = e.changes.mapPos(this.from), a = e.changes.mapPos(this.to, 1), o = Gh(e.state); + if ((this.explicitPos < 0 ? o <= s : o < this.from) || o > a || r == "delete" && Gh(e.startState) == this.from) + return new ka(this.source, r == "input" && n.activateOnTyping ? 1 : 0); + let l = this.explicitPos < 0 ? -1 : e.changes.mapPos(this.explicitPos), u; + return B5e(this.result.validFor, e.state, s, a) ? new Xp(this.source, l, this.result, s, a) : this.result.update && (u = this.result.update(this.result, s, a, new iM(e.state, o, l >= 0))) ? new Xp(this.source, l, u, u.from, (i = u.to) !== null && i !== void 0 ? i : Gh(e.state)) : new ka(this.source, 1, l); } - handleChange(n) { - return n.changes.touchesRange(this.from, this.to) ? new Kb(this.source, 0) : this.map(n.changes); + handleChange(e) { + return e.changes.touchesRange(this.from, this.to) ? new ka(this.source, 0) : this.map(e.changes); } - map(n) { - return n.empty ? this : new NB(this.source, this.explicitPos < 0 ? -1 : n.mapPos(this.explicitPos), this.result, n.mapPos(this.from), n.mapPos(this.to, 1)); + map(e) { + return e.empty ? this : new Xp(this.source, this.explicitPos < 0 ? -1 : e.mapPos(this.explicitPos), this.result, e.mapPos(this.from), e.mapPos(this.to, 1)); } } -function l_n(r, n, s, a) { - if (!r) +function B5e(t, e, r, n) { + if (!t) return !1; - let l = n.sliceDoc(s, a); - return typeof r == "function" ? r(l, s, a, n) : yLt(r, !0).test(l); + let i = e.sliceDoc(r, n); + return typeof t == "function" ? t(i, r, n, e) : DJ(t, !0).test(i); } -const kLt = /* @__PURE__ */ $o.define({ - map(r, n) { - return r.map((s) => s.map(n)); +const IJ = /* @__PURE__ */ Zt.define({ + map(t, e) { + return t.map((r) => r.map(e)); } -}), xLt = /* @__PURE__ */ $o.define(), N2 = /* @__PURE__ */ Ef.define({ +}), PJ = /* @__PURE__ */ Zt.define(), to = /* @__PURE__ */ Pn.define({ create() { - return ave.start(); + return $5.start(); }, - update(r, n) { - return r.update(n); + update(t, e) { + return t.update(e); }, - provide: (r) => [ - pze.from(r, (n) => n.tooltip), - Ci.contentAttributes.from(r, (n) => n.attrs) + provide: (t) => [ + zR.from(t, (e) => e.tooltip), + dt.contentAttributes.from(t, (e) => e.attrs) ] }); -function SLt(r, n) { - const s = n.completion.apply || n.completion.label; - let a = r.state.field(N2).active.find((l) => l.source == n.source); - return a instanceof NB ? (typeof s == "string" ? r.dispatch(Object.assign(Object.assign({}, X6n(r.state, s, a.from, a.to)), { annotations: OLt.of(n.completion) })) : s(r, n.completion, a.from, a.to), !0) : !1; -} -const u_n = /* @__PURE__ */ r_n(N2, SLt); -function eme(r, n = "option") { - return (s) => { - let a = s.state.field(N2, !1); - if (!a || !a.open || a.open.disabled || Date.now() - a.open.timestamp < s.state.facet(Sg).interactionDelay) +function $J(t, e) { + const r = e.completion.apply || e.completion.label; + let n = t.state.field(to).active.find((i) => i.source == e.source); + return n instanceof Xp ? (typeof r == "string" ? t.dispatch(Object.assign(Object.assign({}, C5e(t.state, r, n.from, n.to)), { annotations: NJ.of(e.completion) })) : r(t, e.completion, n.from, n.to), !0) : !1; +} +const F5e = /* @__PURE__ */ M5e(to, $J); +function _w(t, e = "option") { + return (r) => { + let n = r.state.field(to, !1); + if (!n || !n.open || n.open.disabled || Date.now() - n.open.timestamp < r.state.facet(Ds).interactionDelay) return !1; - let l = 1, h; - n == "page" && (h = KMt(s, a.open.tooltip)) && (l = Math.max(2, Math.floor(h.dom.offsetHeight / h.dom.querySelector("li").offsetHeight) - 1)); - let { length: f } = a.open.options, b = a.open.selected > -1 ? a.open.selected + l * (r ? 1 : -1) : r ? 0 : f - 1; - return b < 0 ? b = n == "page" ? 0 : f - 1 : b >= f && (b = n == "page" ? f - 1 : 0), s.dispatch({ effects: xLt.of(b) }), !0; + let i = 1, s; + e == "page" && (s = hK(r, n.open.tooltip)) && (i = Math.max(2, Math.floor(s.dom.offsetHeight / s.dom.querySelector("li").offsetHeight) - 1)); + let { length: a } = n.open.options, o = n.open.selected > -1 ? n.open.selected + i * (t ? 1 : -1) : t ? 0 : a - 1; + return o < 0 ? o = e == "page" ? 0 : a - 1 : o >= a && (o = e == "page" ? a - 1 : 0), r.dispatch({ effects: PJ.of(o) }), !0; }; } -const h_n = (r) => { - let n = r.state.field(N2, !1); - return r.state.readOnly || !n || !n.open || n.open.selected < 0 || n.open.disabled || Date.now() - n.open.timestamp < r.state.facet(Sg).interactionDelay ? !1 : SLt(r, n.open.options[n.open.selected]); -}, f_n = (r) => r.state.field(N2, !1) ? (r.dispatch({ effects: Lze.of(!0) }), !0) : !1, d_n = (r) => { - let n = r.state.field(N2, !1); - return !n || !n.active.some((s) => s.state != 0) ? !1 : (r.dispatch({ effects: _K.of(null) }), !0); +const z5e = (t) => { + let e = t.state.field(to, !1); + return t.state.readOnly || !e || !e.open || e.open.selected < 0 || e.open.disabled || Date.now() - e.open.timestamp < t.state.facet(Ds).interactionDelay ? !1 : $J(t, e.open.options[e.open.selected]); +}, V5e = (t) => t.state.field(to, !1) ? (t.dispatch({ effects: sM.of(!0) }), !0) : !1, U5e = (t) => { + let e = t.state.field(to, !1); + return !e || !e.active.some((r) => r.state != 0) ? !1 : (t.dispatch({ effects: Ny.of(null) }), !0); }; -class p_n { - constructor(n, s) { - this.active = n, this.context = s, this.time = Date.now(), this.updates = [], this.done = void 0; +class q5e { + constructor(e, r) { + this.active = e, this.context = r, this.time = Date.now(), this.updates = [], this.done = void 0; } } -const g_n = 50, m_n = 1e3, b_n = /* @__PURE__ */ Zu.fromClass(class { - constructor(r) { - this.view = r, this.debounceUpdate = -1, this.running = [], this.debounceAccept = -1, this.composing = 0; - for (let n of r.state.field(N2).active) - n.state == 1 && this.startQuery(n); +const Q5e = 50, Y5e = 1e3, W5e = /* @__PURE__ */ an.fromClass(class { + constructor(t) { + this.view = t, this.debounceUpdate = -1, this.running = [], this.debounceAccept = -1, this.composing = 0; + for (let e of t.state.field(to).active) + e.state == 1 && this.startQuery(e); } - update(r) { - let n = r.state.field(N2); - if (!r.selectionSet && !r.docChanged && r.startState.field(N2) == n) + update(t) { + let e = t.state.field(to); + if (!t.selectionSet && !t.docChanged && t.startState.field(to) == e) return; - let s = r.transactions.some((a) => (a.selection || a.docChanged) && !IFe(a)); - for (let a = 0; a < this.running.length; a++) { - let l = this.running[a]; - if (s || l.updates.length + r.transactions.length > g_n && Date.now() - l.time > m_n) { - for (let h of l.context.abortListeners) + let r = t.transactions.some((n) => (n.selection || n.docChanged) && !k7(n)); + for (let n = 0; n < this.running.length; n++) { + let i = this.running[n]; + if (r || i.updates.length + t.transactions.length > Q5e && Date.now() - i.time > Y5e) { + for (let s of i.context.abortListeners) try { - h(); - } catch (f) { - Yy(this.view.state, f); + s(); + } catch (a) { + Bo(this.view.state, a); } - l.context.abortListeners = null, this.running.splice(a--, 1); + i.context.abortListeners = null, this.running.splice(n--, 1); } else - l.updates.push(...r.transactions); + i.updates.push(...t.transactions); } - if (this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), this.debounceUpdate = n.active.some((a) => a.state == 1 && !this.running.some((l) => l.active.source == a.source)) ? setTimeout(() => this.startUpdate(), 50) : -1, this.composing != 0) - for (let a of r.transactions) - IFe(a) == "input" ? this.composing = 2 : this.composing == 2 && a.selection && (this.composing = 3); + if (this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), this.debounceUpdate = e.active.some((n) => n.state == 1 && !this.running.some((i) => i.active.source == n.source)) ? setTimeout(() => this.startUpdate(), 50) : -1, this.composing != 0) + for (let n of t.transactions) + k7(n) == "input" ? this.composing = 2 : this.composing == 2 && n.selection && (this.composing = 3); } startUpdate() { this.debounceUpdate = -1; - let { state: r } = this.view, n = r.field(N2); - for (let s of n.active) - s.state == 1 && !this.running.some((a) => a.active.source == s.source) && this.startQuery(s); - } - startQuery(r) { - let { state: n } = this.view, s = r8(n), a = new Pze(n, s, r.explicitPos == s), l = new p_n(r, a); - this.running.push(l), Promise.resolve(r.source(a)).then((h) => { - l.context.aborted || (l.done = h || null, this.scheduleAccept()); - }, (h) => { - this.view.dispatch({ effects: _K.of(null) }), Yy(this.view.state, h); + let { state: t } = this.view, e = t.field(to); + for (let r of e.active) + r.state == 1 && !this.running.some((n) => n.active.source == r.source) && this.startQuery(r); + } + startQuery(t) { + let { state: e } = this.view, r = Gh(e), n = new iM(e, r, t.explicitPos == r), i = new q5e(t, n); + this.running.push(i), Promise.resolve(t.source(n)).then((s) => { + i.context.aborted || (i.done = s || null, this.scheduleAccept()); + }, (s) => { + this.view.dispatch({ effects: Ny.of(null) }), Bo(this.view.state, s); }); } scheduleAccept() { - this.running.every((r) => r.done !== void 0) ? this.accept() : this.debounceAccept < 0 && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(Sg).updateSyncTime)); + this.running.every((t) => t.done !== void 0) ? this.accept() : this.debounceAccept < 0 && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(Ds).updateSyncTime)); } accept() { - var r; + var t; this.debounceAccept > -1 && clearTimeout(this.debounceAccept), this.debounceAccept = -1; - let n = [], s = this.view.state.facet(Sg); - for (let a = 0; a < this.running.length; a++) { - let l = this.running[a]; - if (l.done === void 0) + let e = [], r = this.view.state.facet(Ds); + for (let n = 0; n < this.running.length; n++) { + let i = this.running[n]; + if (i.done === void 0) continue; - if (this.running.splice(a--, 1), l.done) { - let f = new NB(l.active.source, l.active.explicitPos, l.done, l.done.from, (r = l.done.to) !== null && r !== void 0 ? r : r8(l.updates.length ? l.updates[0].startState : this.view.state)); - for (let b of l.updates) - f = f.update(b, s); - if (f.hasResult()) { - n.push(f); + if (this.running.splice(n--, 1), i.done) { + let a = new Xp(i.active.source, i.active.explicitPos, i.done, i.done.from, (t = i.done.to) !== null && t !== void 0 ? t : Gh(i.updates.length ? i.updates[0].startState : this.view.state)); + for (let o of i.updates) + a = a.update(o, r); + if (a.hasResult()) { + e.push(a); continue; } } - let h = this.view.state.field(N2).active.find((f) => f.source == l.active.source); - if (h && h.state == 1) - if (l.done == null) { - let f = new Kb(l.active.source, 0); - for (let b of l.updates) - f = f.update(b, s); - f.state != 1 && n.push(f); + let s = this.view.state.field(to).active.find((a) => a.source == i.active.source); + if (s && s.state == 1) + if (i.done == null) { + let a = new ka(i.active.source, 0); + for (let o of i.updates) + a = a.update(o, r); + a.state != 1 && e.push(a); } else - this.startQuery(h); + this.startQuery(s); } - n.length && this.view.dispatch({ effects: kLt.of(n) }); + e.length && this.view.dispatch({ effects: IJ.of(e) }); } }, { eventHandlers: { - blur(r) { - let n = this.view.state.field(N2, !1); - if (n && n.tooltip && this.view.state.facet(Sg).closeOnBlur) { - let s = n.open && KMt(this.view, n.open.tooltip); - (!s || !s.dom.contains(r.relatedTarget)) && this.view.dispatch({ effects: _K.of(null) }); + blur(t) { + let e = this.view.state.field(to, !1); + if (e && e.tooltip && this.view.state.facet(Ds).closeOnBlur) { + let r = e.open && hK(this.view, e.open.tooltip); + (!r || !r.dom.contains(t.relatedTarget)) && this.view.dispatch({ effects: Ny.of(null) }); } }, compositionstart() { this.composing = 1; }, compositionend() { - this.composing == 3 && setTimeout(() => this.view.dispatch({ effects: Lze.of(!1) }), 20), this.composing = 0; + this.composing == 3 && setTimeout(() => this.view.dispatch({ effects: sM.of(!1) }), 20), this.composing = 0; } } -}), _Lt = /* @__PURE__ */ Ci.baseTheme({ +}), BJ = /* @__PURE__ */ dt.baseTheme({ ".cm-tooltip.cm-tooltip-autocomplete": { "& > ul": { fontFamily: "monospace", @@ -15184,660 +15193,660 @@ const g_n = 50, m_n = 1e3, b_n = /* @__PURE__ */ Zu.fromClass(class { "&:after": { content: "'abc'", fontSize: "50%", verticalAlign: "middle" } } }); -class v_n { - constructor(n, s, a, l) { - this.field = n, this.line = s, this.from = a, this.to = l; +class G5e { + constructor(e, r, n, i) { + this.field = e, this.line = r, this.from = n, this.to = i; } } -class Ize { - constructor(n, s, a) { - this.field = n, this.from = s, this.to = a; +class aM { + constructor(e, r, n) { + this.field = e, this.from = r, this.to = n; } - map(n) { - let s = n.mapPos(this.from, -1, c0.TrackDel), a = n.mapPos(this.to, 1, c0.TrackDel); - return s == null || a == null ? null : new Ize(this.field, s, a); + map(e) { + let r = e.mapPos(this.from, -1, Si.TrackDel), n = e.mapPos(this.to, 1, Si.TrackDel); + return r == null || n == null ? null : new aM(this.field, r, n); } } -class Nze { - constructor(n, s) { - this.lines = n, this.fieldPositions = s; +class oM { + constructor(e, r) { + this.lines = e, this.fieldPositions = r; } - instantiate(n, s) { - let a = [], l = [s], h = n.doc.lineAt(s), f = /^\s*/.exec(h.text)[0]; - for (let w of this.lines) { - if (a.length) { - let O = f, S = /^\t*/.exec(w)[0].length; - for (let E = 0; E < S; E++) - O += n.facet(IJ); - l.push(s + O.length - S), w = O + w.slice(S); - } - a.push(w), s += w.length + 1; - } - let b = this.fieldPositions.map((w) => new Ize(w.field, l[w.line] + w.from, l[w.line] + w.to)); - return { text: a, ranges: b }; - } - static parse(n) { - let s = [], a = [], l = [], h; - for (let f of n.split(/\r\n?|\n/)) { - for (; h = /[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(f); ) { - let b = h[1] ? +h[1] : null, w = h[2] || h[3] || "", O = -1; - for (let S = 0; S < s.length; S++) - (b != null ? s[S].seq == b : w ? s[S].name == w : !1) && (O = S); - if (O < 0) { - let S = 0; - for (; S < s.length && (b == null || s[S].seq != null && s[S].seq < b); ) - S++; - s.splice(S, 0, { seq: b, name: w }), O = S; - for (let E of l) - E.field >= O && E.field++; + instantiate(e, r) { + let n = [], i = [r], s = e.doc.lineAt(r), a = /^\s*/.exec(s.text)[0]; + for (let l of this.lines) { + if (n.length) { + let u = a, h = /^\t*/.exec(l)[0].length; + for (let f = 0; f < h; f++) + u += e.facet(Wb); + i.push(r + u.length - h), l = u + l.slice(h); + } + n.push(l), r += l.length + 1; + } + let o = this.fieldPositions.map((l) => new aM(l.field, i[l.line] + l.from, i[l.line] + l.to)); + return { text: n, ranges: o }; + } + static parse(e) { + let r = [], n = [], i = [], s; + for (let a of e.split(/\r\n?|\n/)) { + for (; s = /[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(a); ) { + let o = s[1] ? +s[1] : null, l = s[2] || s[3] || "", u = -1; + for (let h = 0; h < r.length; h++) + (o != null ? r[h].seq == o : l ? r[h].name == l : !1) && (u = h); + if (u < 0) { + let h = 0; + for (; h < r.length && (o == null || r[h].seq != null && r[h].seq < o); ) + h++; + r.splice(h, 0, { seq: o, name: l }), u = h; + for (let f of i) + f.field >= u && f.field++; } - l.push(new v_n(O, a.length, h.index, h.index + w.length)), f = f.slice(0, h.index) + w + f.slice(h.index + h[0].length); + i.push(new G5e(u, n.length, s.index, s.index + l.length)), a = a.slice(0, s.index) + l + a.slice(s.index + s[0].length); } - for (let b; b = /\\([{}])/.exec(f); ) { - f = f.slice(0, b.index) + b[1] + f.slice(b.index + b[0].length); - for (let w of l) - w.line == a.length && w.from > b.index && (w.from--, w.to--); + for (let o; o = /\\([{}])/.exec(a); ) { + a = a.slice(0, o.index) + o[1] + a.slice(o.index + o[0].length); + for (let l of i) + l.line == n.length && l.from > o.index && (l.from--, l.to--); } - a.push(f); + n.push(a); } - return new Nze(a, l); + return new oM(n, i); } } -let w_n = /* @__PURE__ */ as.widget({ widget: /* @__PURE__ */ new class extends uv { +let H5e = /* @__PURE__ */ Et.widget({ widget: /* @__PURE__ */ new class extends za { toDOM() { - let r = document.createElement("span"); - return r.className = "cm-snippetFieldPosition", r; + let t = document.createElement("span"); + return t.className = "cm-snippetFieldPosition", t; } ignoreEvent() { return !1; } -}() }), y_n = /* @__PURE__ */ as.mark({ class: "cm-snippetField" }); -class JF { - constructor(n, s) { - this.ranges = n, this.active = s, this.deco = as.set(n.map((a) => (a.from == a.to ? w_n : y_n).range(a.from, a.to))); +}() }), X5e = /* @__PURE__ */ Et.mark({ class: "cm-snippetField" }); +class B1 { + constructor(e, r) { + this.ranges = e, this.active = r, this.deco = Et.set(e.map((n) => (n.from == n.to ? H5e : X5e).range(n.from, n.to))); } - map(n) { - let s = []; - for (let a of this.ranges) { - let l = a.map(n); - if (!l) + map(e) { + let r = []; + for (let n of this.ranges) { + let i = n.map(e); + if (!i) return null; - s.push(l); + r.push(i); } - return new JF(s, this.active); + return new B1(r, this.active); } - selectionInsideField(n) { - return n.ranges.every((s) => this.ranges.some((a) => a.field == this.active && a.from <= s.from && a.to >= s.to)); + selectionInsideField(e) { + return e.ranges.every((r) => this.ranges.some((n) => n.field == this.active && n.from <= r.from && n.to >= r.to)); } } -const BJ = /* @__PURE__ */ $o.define({ - map(r, n) { - return r && r.map(n); +const Zb = /* @__PURE__ */ Zt.define({ + map(t, e) { + return t && t.map(e); } -}), O_n = /* @__PURE__ */ $o.define(), CK = /* @__PURE__ */ Ef.define({ +}), Z5e = /* @__PURE__ */ Zt.define(), Iy = /* @__PURE__ */ Pn.define({ create() { return null; }, - update(r, n) { - for (let s of n.effects) { - if (s.is(BJ)) - return s.value; - if (s.is(O_n) && r) - return new JF(r.ranges, s.value); - } - return r && n.docChanged && (r = r.map(n.changes)), r && n.selection && !r.selectionInsideField(n.selection) && (r = null), r; + update(t, e) { + for (let r of e.effects) { + if (r.is(Zb)) + return r.value; + if (r.is(Z5e) && t) + return new B1(t.ranges, r.value); + } + return t && e.docChanged && (t = t.map(e.changes)), t && e.selection && !t.selectionInsideField(e.selection) && (t = null), t; }, - provide: (r) => Ci.decorations.from(r, (n) => n ? n.deco : as.none) + provide: (t) => dt.decorations.from(t, (e) => e ? e.deco : Et.none) }); -function Rze(r, n) { - return sr.create(r.filter((s) => s.field == n).map((s) => sr.range(s.from, s.to))); -} -function k_n(r) { - let n = Nze.parse(r); - return (s, a, l, h) => { - let { text: f, ranges: b } = n.instantiate(s.state, l), w = { - changes: { from: l, to: h, insert: Al.of(f) }, +function lM(t, e) { + return Ve.create(t.filter((r) => r.field == e).map((r) => Ve.range(r.from, r.to))); +} +function j5e(t) { + let e = oM.parse(t); + return (r, n, i, s) => { + let { text: a, ranges: o } = e.instantiate(r.state, i), l = { + changes: { from: i, to: s, insert: Dr.of(a) }, scrollIntoView: !0, - annotations: a ? OLt.of(a) : void 0 + annotations: n ? NJ.of(n) : void 0 }; - if (b.length && (w.selection = Rze(b, 0)), b.length > 1) { - let O = new JF(b, 0), S = w.effects = [BJ.of(O)]; - s.state.field(CK, !1) === void 0 && S.push($o.appendConfig.of([CK, E_n, T_n, _Lt])); + if (o.length && (l.selection = lM(o, 0)), o.length > 1) { + let u = new B1(o, 0), h = l.effects = [Zb.of(u)]; + r.state.field(Iy, !1) === void 0 && h.push(Zt.appendConfig.of([Iy, r3e, n3e, BJ])); } - s.dispatch(s.state.update(w)); + r.dispatch(r.state.update(l)); }; } -function CLt(r) { - return ({ state: n, dispatch: s }) => { - let a = n.field(CK, !1); - if (!a || r < 0 && a.active == 0) +function FJ(t) { + return ({ state: e, dispatch: r }) => { + let n = e.field(Iy, !1); + if (!n || t < 0 && n.active == 0) return !1; - let l = a.active + r, h = r > 0 && !a.ranges.some((f) => f.field == l + r); - return s(n.update({ - selection: Rze(a.ranges, l), - effects: BJ.of(h ? null : new JF(a.ranges, l)), + let i = n.active + t, s = t > 0 && !n.ranges.some((a) => a.field == i + t); + return r(e.update({ + selection: lM(n.ranges, i), + effects: Zb.of(s ? null : new B1(n.ranges, i)), scrollIntoView: !0 })), !0; }; } -const x_n = ({ state: r, dispatch: n }) => r.field(CK, !1) ? (n(r.update({ effects: BJ.of(null) })), !0) : !1, S_n = /* @__PURE__ */ CLt(1), __n = /* @__PURE__ */ CLt(-1), C_n = [ - { key: "Tab", run: S_n, shift: __n }, - { key: "Escape", run: x_n } -], ZCt = /* @__PURE__ */ us.define({ - combine(r) { - return r.length ? r[0] : C_n; - } -}), E_n = /* @__PURE__ */ Sk.highest(/* @__PURE__ */ X6.compute([ZCt], (r) => r.facet(ZCt))); -function Xb(r, n) { - return Object.assign(Object.assign({}, n), { apply: k_n(r) }); -} -const T_n = /* @__PURE__ */ Ci.domEventHandlers({ - mousedown(r, n) { - let s = n.state.field(CK, !1), a; - if (!s || (a = n.posAtCoords({ x: r.clientX, y: r.clientY })) == null) +const K5e = ({ state: t, dispatch: e }) => t.field(Iy, !1) ? (e(t.update({ effects: Zb.of(null) })), !0) : !1, J5e = /* @__PURE__ */ FJ(1), e3e = /* @__PURE__ */ FJ(-1), t3e = [ + { key: "Tab", run: J5e, shift: e3e }, + { key: "Escape", run: K5e } +], TF = /* @__PURE__ */ _t.define({ + combine(t) { + return t.length ? t[0] : t3e; + } +}), r3e = /* @__PURE__ */ zl.highest(/* @__PURE__ */ Tu.compute([TF], (t) => t.facet(TF))); +function ya(t, e) { + return Object.assign(Object.assign({}, e), { apply: j5e(t) }); +} +const n3e = /* @__PURE__ */ dt.domEventHandlers({ + mousedown(t, e) { + let r = e.state.field(Iy, !1), n; + if (!r || (n = e.posAtCoords({ x: t.clientX, y: t.clientY })) == null) return !1; - let l = s.ranges.find((h) => h.from <= a && h.to >= a); - return !l || l.field == s.active ? !1 : (n.dispatch({ - selection: Rze(s.ranges, l.field), - effects: BJ.of(s.ranges.some((h) => h.field > l.field) ? new JF(s.ranges, l.field) : null), + let i = r.ranges.find((s) => s.from <= n && s.to >= n); + return !i || i.field == r.active ? !1 : (e.dispatch({ + selection: lM(r.ranges, i.field), + effects: Zb.of(r.ranges.some((s) => s.field > i.field) ? new B1(r.ranges, i.field) : null), scrollIntoView: !0 }), !0); } -}), EK = { +}), Py = { brackets: ["(", "[", "{", "'", '"'], before: ")]}:;>", stringPrefixes: [] -}, qM = /* @__PURE__ */ $o.define({ - map(r, n) { - let s = n.mapPos(r, -1, c0.TrackAfter); - return s == null ? void 0 : s; +}, _d = /* @__PURE__ */ Zt.define({ + map(t, e) { + let r = e.mapPos(t, -1, Si.TrackAfter); + return r == null ? void 0 : r; } -}), $ze = /* @__PURE__ */ new class extends iP { +}), cM = /* @__PURE__ */ new class extends Xd { }(); -$ze.startSide = 1; -$ze.endSide = -1; -const ELt = /* @__PURE__ */ Ef.define({ +cM.startSide = 1; +cM.endSide = -1; +const zJ = /* @__PURE__ */ Pn.define({ create() { - return cl.empty; + return Er.empty; }, - update(r, n) { - if (r = r.map(n.changes), n.selection) { - let s = n.state.doc.lineAt(n.selection.main.head); - r = r.update({ filter: (a) => a >= s.from && a <= s.to }); + update(t, e) { + if (t = t.map(e.changes), e.selection) { + let r = e.state.doc.lineAt(e.selection.main.head); + t = t.update({ filter: (n) => n >= r.from && n <= r.to }); } - for (let s of n.effects) - s.is(qM) && (r = r.update({ add: [$ze.range(s.value, s.value + 1)] })); - return r; + for (let r of e.effects) + r.is(_d) && (t = t.update({ add: [cM.range(r.value, r.value + 1)] })); + return t; } }); -function A_n() { - return [M_n, ELt]; +function i3e() { + return [a3e, zJ]; } -const RRe = "()[]{}<>"; -function TLt(r) { - for (let n = 0; n < RRe.length; n += 2) - if (RRe.charCodeAt(n) == r) - return RRe.charAt(n + 1); - return rze(r < 128 ? r : r + 1); +const RE = "()[]{}<>"; +function VJ(t) { + for (let e = 0; e < RE.length; e += 2) + if (RE.charCodeAt(e) == t) + return RE.charAt(e + 1); + return AR(t < 128 ? t : t + 1); } -function ALt(r, n) { - return r.languageDataAt("closeBrackets", n)[0] || EK; +function UJ(t, e) { + return t.languageDataAt("closeBrackets", e)[0] || Py; } -const D_n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent), M_n = /* @__PURE__ */ Ci.inputHandler.of((r, n, s, a) => { - if ((D_n ? r.composing : r.compositionStarted) || r.state.readOnly) +const s3e = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent), a3e = /* @__PURE__ */ dt.inputHandler.of((t, e, r, n) => { + if ((s3e ? t.composing : t.compositionStarted) || t.state.readOnly) return !1; - let l = r.state.selection.main; - if (a.length > 2 || a.length == 2 && Fy(Lp(a, 0)) == 1 || n != l.from || s != l.to) + let i = t.state.selection.main; + if (n.length > 2 || n.length == 2 && Eo(ss(n, 0)) == 1 || e != i.from || r != i.to) return !1; - let h = I_n(r.state, a); - return h ? (r.dispatch(h), !0) : !1; -}), P_n = ({ state: r, dispatch: n }) => { - if (r.readOnly) + let s = c3e(t.state, n); + return s ? (t.dispatch(s), !0) : !1; +}), o3e = ({ state: t, dispatch: e }) => { + if (t.readOnly) return !1; - let a = ALt(r, r.selection.main.head).brackets || EK.brackets, l = null, h = r.changeByRange((f) => { - if (f.empty) { - let b = N_n(r.doc, f.head); - for (let w of a) - if (w == b && iwe(r.doc, f.head) == TLt(Lp(w, 0))) + let n = UJ(t, t.selection.main.head).brackets || Py.brackets, i = null, s = t.changeByRange((a) => { + if (a.empty) { + let o = u3e(t.doc, a.head); + for (let l of n) + if (l == o && qS(t.doc, a.head) == VJ(ss(l, 0))) return { - changes: { from: f.head - w.length, to: f.head + w.length }, - range: sr.cursor(f.head - w.length) + changes: { from: a.head - l.length, to: a.head + l.length }, + range: Ve.cursor(a.head - l.length) }; } - return { range: l = f }; + return { range: i = a }; }); - return l || n(r.update(h, { scrollIntoView: !0, userEvent: "delete.backward" })), !l; -}, L_n = [ - { key: "Backspace", run: P_n } + return i || e(t.update(s, { scrollIntoView: !0, userEvent: "delete.backward" })), !i; +}, l3e = [ + { key: "Backspace", run: o3e } ]; -function I_n(r, n) { - let s = ALt(r, r.selection.main.head), a = s.brackets || EK.brackets; - for (let l of a) { - let h = TLt(Lp(l, 0)); - if (n == l) - return h == l ? B_n(r, l, a.indexOf(l + l + l) > -1, s) : R_n(r, l, h, s.before || EK.before); - if (n == h && DLt(r, r.selection.main.from)) - return $_n(r, l, h); +function c3e(t, e) { + let r = UJ(t, t.selection.main.head), n = r.brackets || Py.brackets; + for (let i of n) { + let s = VJ(ss(i, 0)); + if (e == i) + return s == i ? d3e(t, i, n.indexOf(i + i + i) > -1, r) : h3e(t, i, s, r.before || Py.before); + if (e == s && qJ(t, t.selection.main.from)) + return f3e(t, i, s); } return null; } -function DLt(r, n) { - let s = !1; - return r.field(ELt).between(0, r.doc.length, (a) => { - a == n && (s = !0); - }), s; +function qJ(t, e) { + let r = !1; + return t.field(zJ).between(0, t.doc.length, (n) => { + n == e && (r = !0); + }), r; } -function iwe(r, n) { - let s = r.sliceString(n, n + 2); - return s.slice(0, Fy(Lp(s, 0))); +function qS(t, e) { + let r = t.sliceString(e, e + 2); + return r.slice(0, Eo(ss(r, 0))); } -function N_n(r, n) { - let s = r.sliceString(n - 2, n); - return Fy(Lp(s, 0)) == s.length ? s : s.slice(1); +function u3e(t, e) { + let r = t.sliceString(e - 2, e); + return Eo(ss(r, 0)) == r.length ? r : r.slice(1); } -function R_n(r, n, s, a) { - let l = null, h = r.changeByRange((f) => { - if (!f.empty) +function h3e(t, e, r, n) { + let i = null, s = t.changeByRange((a) => { + if (!a.empty) return { - changes: [{ insert: n, from: f.from }, { insert: s, from: f.to }], - effects: qM.of(f.to + n.length), - range: sr.range(f.anchor + n.length, f.head + n.length) + changes: [{ insert: e, from: a.from }, { insert: r, from: a.to }], + effects: _d.of(a.to + e.length), + range: Ve.range(a.anchor + e.length, a.head + e.length) }; - let b = iwe(r.doc, f.head); - return !b || /\s/.test(b) || a.indexOf(b) > -1 ? { - changes: { insert: n + s, from: f.head }, - effects: qM.of(f.head + n.length), - range: sr.cursor(f.head + n.length) - } : { range: l = f }; + let o = qS(t.doc, a.head); + return !o || /\s/.test(o) || n.indexOf(o) > -1 ? { + changes: { insert: e + r, from: a.head }, + effects: _d.of(a.head + e.length), + range: Ve.cursor(a.head + e.length) + } : { range: i = a }; }); - return l ? null : r.update(h, { + return i ? null : t.update(s, { scrollIntoView: !0, userEvent: "input.type" }); } -function $_n(r, n, s) { - let a = null, l = r.changeByRange((h) => h.empty && iwe(r.doc, h.head) == s ? { - changes: { from: h.head, to: h.head + s.length, insert: s }, - range: sr.cursor(h.head + s.length) - } : a = { range: h }); - return a ? null : r.update(l, { +function f3e(t, e, r) { + let n = null, i = t.changeByRange((s) => s.empty && qS(t.doc, s.head) == r ? { + changes: { from: s.head, to: s.head + r.length, insert: r }, + range: Ve.cursor(s.head + r.length) + } : n = { range: s }); + return n ? null : t.update(i, { scrollIntoView: !0, userEvent: "input.type" }); } -function B_n(r, n, s, a) { - let l = a.stringPrefixes || EK.stringPrefixes, h = null, f = r.changeByRange((b) => { - if (!b.empty) +function d3e(t, e, r, n) { + let i = n.stringPrefixes || Py.stringPrefixes, s = null, a = t.changeByRange((o) => { + if (!o.empty) return { - changes: [{ insert: n, from: b.from }, { insert: n, from: b.to }], - effects: qM.of(b.to + n.length), - range: sr.range(b.anchor + n.length, b.head + n.length) + changes: [{ insert: e, from: o.from }, { insert: e, from: o.to }], + effects: _d.of(o.to + e.length), + range: Ve.range(o.anchor + e.length, o.head + e.length) }; - let w = b.head, O = iwe(r.doc, w), S; - if (O == n) { - if (XCt(r, w)) + let l = o.head, u = qS(t.doc, l), h; + if (u == e) { + if (CF(t, l)) return { - changes: { insert: n + n, from: w }, - effects: qM.of(w + n.length), - range: sr.cursor(w + n.length) + changes: { insert: e + e, from: l }, + effects: _d.of(l + e.length), + range: Ve.cursor(l + e.length) }; - if (DLt(r, w)) { - let D = s && r.sliceDoc(w, w + n.length * 3) == n + n + n ? n + n + n : n; + if (qJ(t, l)) { + let d = r && t.sliceDoc(l, l + e.length * 3) == e + e + e ? e + e + e : e; return { - changes: { from: w, to: w + D.length, insert: D }, - range: sr.cursor(w + D.length) + changes: { from: l, to: l + d.length, insert: d }, + range: Ve.cursor(l + d.length) }; } } else { - if (s && r.sliceDoc(w - 2 * n.length, w) == n + n && (S = KCt(r, w - 2 * n.length, l)) > -1 && XCt(r, S)) + if (r && t.sliceDoc(l - 2 * e.length, l) == e + e && (h = EF(t, l - 2 * e.length, i)) > -1 && CF(t, h)) return { - changes: { insert: n + n + n + n, from: w }, - effects: qM.of(w + n.length), - range: sr.cursor(w + n.length) + changes: { insert: e + e + e + e, from: l }, + effects: _d.of(l + e.length), + range: Ve.cursor(l + e.length) }; - if (r.charCategorizer(w)(O) != ef.Word && KCt(r, w, l) > -1 && !F_n(r, w, n, l)) + if (t.charCategorizer(l)(u) != Sn.Word && EF(t, l, i) > -1 && !p3e(t, l, e, i)) return { - changes: { insert: n + n, from: w }, - effects: qM.of(w + n.length), - range: sr.cursor(w + n.length) + changes: { insert: e + e, from: l }, + effects: _d.of(l + e.length), + range: Ve.cursor(l + e.length) }; } - return { range: h = b }; + return { range: s = o }; }); - return h ? null : r.update(f, { + return s ? null : t.update(a, { scrollIntoView: !0, userEvent: "input.type" }); } -function XCt(r, n) { - let s = dh(r).resolveInner(n + 1); - return s.parent && s.from == n; -} -function F_n(r, n, s, a) { - let l = dh(r).resolveInner(n, -1), h = a.reduce((f, b) => Math.max(f, b.length), 0); - for (let f = 0; f < 5; f++) { - let b = r.sliceDoc(l.from, Math.min(l.to, l.from + s.length + h)), w = b.indexOf(s); - if (!w || w > -1 && a.indexOf(b.slice(0, w)) > -1) { - let S = l.firstChild; - for (; S && S.from == l.from && S.to - S.from > s.length + w; ) { - if (r.sliceDoc(S.to - s.length, S.to) == s) +function CF(t, e) { + let r = fn(t).resolveInner(e + 1); + return r.parent && r.from == e; +} +function p3e(t, e, r, n) { + let i = fn(t).resolveInner(e, -1), s = n.reduce((a, o) => Math.max(a, o.length), 0); + for (let a = 0; a < 5; a++) { + let o = t.sliceDoc(i.from, Math.min(i.to, i.from + r.length + s)), l = o.indexOf(r); + if (!l || l > -1 && n.indexOf(o.slice(0, l)) > -1) { + let h = i.firstChild; + for (; h && h.from == i.from && h.to - h.from > r.length + l; ) { + if (t.sliceDoc(h.to - r.length, h.to) == r) return !1; - S = S.firstChild; + h = h.firstChild; } return !0; } - let O = l.to == n && l.parent; - if (!O) + let u = i.to == e && i.parent; + if (!u) break; - l = O; + i = u; } return !1; } -function KCt(r, n, s) { - let a = r.charCategorizer(n); - if (a(r.sliceDoc(n - 1, n)) != ef.Word) - return n; - for (let l of s) { - let h = n - l.length; - if (r.sliceDoc(h, n) == l && a(r.sliceDoc(h - 1, h)) != ef.Word) - return h; +function EF(t, e, r) { + let n = t.charCategorizer(e); + if (n(t.sliceDoc(e - 1, e)) != Sn.Word) + return e; + for (let i of r) { + let s = e - i.length; + if (t.sliceDoc(s, e) == i && n(t.sliceDoc(s - 1, s)) != Sn.Word) + return s; } return -1; } -function j_n(r = {}) { +function g3e(t = {}) { return [ - N2, - Sg.of(r), - b_n, - Q_n, - _Lt + to, + Ds.of(t), + W5e, + m3e, + BJ ]; } -const MLt = [ - { key: "Ctrl-Space", run: f_n }, - { key: "Escape", run: d_n }, - { key: "ArrowDown", run: /* @__PURE__ */ eme(!0) }, - { key: "ArrowUp", run: /* @__PURE__ */ eme(!1) }, - { key: "PageDown", run: /* @__PURE__ */ eme(!0, "page") }, - { key: "PageUp", run: /* @__PURE__ */ eme(!1, "page") }, - { key: "Enter", run: h_n } -], Q_n = /* @__PURE__ */ Sk.highest(/* @__PURE__ */ X6.computeN([Sg], (r) => r.facet(Sg).defaultKeymap ? [MLt] : [])); -class z_n { - constructor(n, s, a) { - this.from = n, this.to = s, this.diagnostic = a; - } -} -class IM { - constructor(n, s, a) { - this.diagnostics = n, this.panel = s, this.selected = a; - } - static init(n, s, a) { - let l = n, h = a.facet(ILt).markerFilter; - h && (l = h(l)); - let f = as.set(l.map((b) => b.from == b.to || b.from == b.to - 1 && a.doc.lineAt(b.from).to == b.from ? as.widget({ - widget: new X_n(b), - diagnostic: b - }).range(b.from) : as.mark({ - attributes: { class: "cm-lintRange cm-lintRange-" + b.severity + (b.markClass ? " " + b.markClass : "") }, - diagnostic: b - }).range(b.from, b.to)), !0); - return new IM(f, s, lF(f)); - } -} -function lF(r, n = null, s = 0) { - let a = null; - return r.between(s, 1e9, (l, h, { spec: f }) => { - if (!(n && f.diagnostic != n)) - return a = new z_n(l, h, f.diagnostic), !1; - }), a; +const QJ = [ + { key: "Ctrl-Space", run: V5e }, + { key: "Escape", run: U5e }, + { key: "ArrowDown", run: /* @__PURE__ */ _w(!0) }, + { key: "ArrowUp", run: /* @__PURE__ */ _w(!1) }, + { key: "PageDown", run: /* @__PURE__ */ _w(!0, "page") }, + { key: "PageUp", run: /* @__PURE__ */ _w(!1, "page") }, + { key: "Enter", run: z5e } +], m3e = /* @__PURE__ */ zl.highest(/* @__PURE__ */ Tu.computeN([Ds], (t) => t.facet(Ds).defaultKeymap ? [QJ] : [])); +class v3e { + constructor(e, r, n) { + this.from = e, this.to = r, this.diagnostic = n; + } +} +class md { + constructor(e, r, n) { + this.diagnostics = e, this.panel = r, this.selected = n; + } + static init(e, r, n) { + let i = e, s = n.facet(GJ).markerFilter; + s && (i = s(i)); + let a = Et.set(i.map((o) => o.from == o.to || o.from == o.to - 1 && n.doc.lineAt(o.from).to == o.from ? Et.widget({ + widget: new C3e(o), + diagnostic: o + }).range(o.from) : Et.mark({ + attributes: { class: "cm-lintRange cm-lintRange-" + o.severity + (o.markClass ? " " + o.markClass : "") }, + diagnostic: o + }).range(o.from, o.to)), !0); + return new md(a, r, Rg(a)); + } +} +function Rg(t, e = null, r = 0) { + let n = null; + return t.between(r, 1e9, (i, s, { spec: a }) => { + if (!(e && a.diagnostic != e)) + return n = new v3e(i, s, a.diagnostic), !1; + }), n; } -function q_n(r, n) { - let s = r.startState.doc.lineAt(n.pos); - return !!(r.effects.some((a) => a.is(PLt)) || r.changes.touchesRange(s.from, s.to)); +function y3e(t, e) { + let r = t.startState.doc.lineAt(e.pos); + return !!(t.effects.some((n) => n.is(YJ)) || t.changes.touchesRange(r.from, r.to)); } -function V_n(r, n) { - return r.field(B2, !1) ? n : n.concat($o.appendConfig.of(eCn)); +function b3e(t, e) { + return t.field(no, !1) ? e : e.concat(Zt.appendConfig.of(A3e)); } -const PLt = /* @__PURE__ */ $o.define(), Bze = /* @__PURE__ */ $o.define(), LLt = /* @__PURE__ */ $o.define(), B2 = /* @__PURE__ */ Ef.define({ +const YJ = /* @__PURE__ */ Zt.define(), uM = /* @__PURE__ */ Zt.define(), WJ = /* @__PURE__ */ Zt.define(), no = /* @__PURE__ */ Pn.define({ create() { - return new IM(as.none, null, null); + return new md(Et.none, null, null); }, - update(r, n) { - if (n.docChanged) { - let s = r.diagnostics.map(n.changes), a = null; - if (r.selected) { - let l = n.changes.mapPos(r.selected.from, 1); - a = lF(s, r.selected.diagnostic, l) || lF(s, null, l); - } - r = new IM(s, r.panel, a); - } - for (let s of n.effects) - s.is(PLt) ? r = IM.init(s.value, r.panel, n.state) : s.is(Bze) ? r = new IM(r.diagnostics, s.value ? swe.open : null, r.selected) : s.is(LLt) && (r = new IM(r.diagnostics, r.panel, s.value)); - return r; + update(t, e) { + if (e.docChanged) { + let r = t.diagnostics.map(e.changes), n = null; + if (t.selected) { + let i = e.changes.mapPos(t.selected.from, 1); + n = Rg(r, t.selected.diagnostic, i) || Rg(r, null, i); + } + t = new md(r, t.panel, n); + } + for (let r of e.effects) + r.is(YJ) ? t = md.init(r.value, t.panel, e.state) : r.is(uM) ? t = new md(t.diagnostics, r.value ? QS.open : null, t.selected) : r.is(WJ) && (t = new md(t.diagnostics, t.panel, r.value)); + return t; }, - provide: (r) => [ - vK.from(r, (n) => n.panel), - Ci.decorations.from(r, (n) => n.diagnostics) + provide: (t) => [ + Ey.from(t, (e) => e.panel), + dt.decorations.from(t, (e) => e.diagnostics) ] -}), U_n = /* @__PURE__ */ as.mark({ class: "cm-lintRange cm-lintRange-active" }); -function W_n(r, n, s) { - let { diagnostics: a } = r.state.field(B2), l = [], h = 2e8, f = 0; - a.between(n - (s < 0 ? 1 : 0), n + (s > 0 ? 1 : 0), (w, O, { spec: S }) => { - n >= w && n <= O && (w == O || (n > w || s > 0) && (n < O || s < 0)) && (l.push(S.diagnostic), h = Math.min(w, h), f = Math.max(O, f)); +}), x3e = /* @__PURE__ */ Et.mark({ class: "cm-lintRange cm-lintRange-active" }); +function w3e(t, e, r) { + let { diagnostics: n } = t.state.field(no), i = [], s = 2e8, a = 0; + n.between(e - (r < 0 ? 1 : 0), e + (r > 0 ? 1 : 0), (l, u, { spec: h }) => { + e >= l && e <= u && (l == u || (e > l || r > 0) && (e < u || r < 0)) && (i.push(h.diagnostic), s = Math.min(l, s), a = Math.max(u, a)); }); - let b = r.state.facet(ILt).tooltipFilter; - return b && (l = b(l)), l.length ? { - pos: h, - end: f, - above: r.state.doc.lineAt(h).to < f, + let o = t.state.facet(GJ).tooltipFilter; + return o && (i = o(i)), i.length ? { + pos: s, + end: a, + above: t.state.doc.lineAt(s).to < a, create() { - return { dom: Y_n(r, l) }; + return { dom: O3e(t, i) }; } } : null; } -function Y_n(r, n) { - return hh("ul", { class: "cm-tooltip-lint" }, n.map((s) => RLt(r, s, !1))); -} -const H_n = (r) => { - let n = r.state.field(B2, !1); - (!n || !n.panel) && r.dispatch({ effects: V_n(r.state, [Bze.of(!0)]) }); - let s = bK(r, swe.open); - return s && s.dom.querySelector(".cm-panel-lint ul").focus(), !0; -}, JCt = (r) => { - let n = r.state.field(B2, !1); - return !n || !n.panel ? !1 : (r.dispatch({ effects: Bze.of(!1) }), !0); -}, G_n = (r) => { - let n = r.state.field(B2, !1); - if (!n) +function O3e(t, e) { + return cn("ul", { class: "cm-tooltip-lint" }, e.map((r) => XJ(t, r, !1))); +} +const k3e = (t) => { + let e = t.state.field(no, !1); + (!e || !e.panel) && t.dispatch({ effects: b3e(t.state, [uM.of(!0)]) }); + let r = Cy(t, QS.open); + return r && r.dom.querySelector(".cm-panel-lint ul").focus(), !0; +}, _F = (t) => { + let e = t.state.field(no, !1); + return !e || !e.panel ? !1 : (t.dispatch({ effects: uM.of(!1) }), !0); +}, S3e = (t) => { + let e = t.state.field(no, !1); + if (!e) return !1; - let s = r.state.selection.main, a = n.diagnostics.iter(s.to + 1); - return !a.value && (a = n.diagnostics.iter(0), !a.value || a.from == s.from && a.to == s.to) ? !1 : (r.dispatch({ selection: { anchor: a.from, head: a.to }, scrollIntoView: !0 }), !0); -}, Z_n = [ - { key: "Mod-Shift-m", run: H_n, preventDefault: !0 }, - { key: "F8", run: G_n } -], ILt = /* @__PURE__ */ us.define({ - combine(r) { - return Object.assign({ sources: r.map((n) => n.source) }, px(r.map((n) => n.config), { + let r = t.state.selection.main, n = e.diagnostics.iter(r.to + 1); + return !n.value && (n = e.diagnostics.iter(0), !n.value || n.from == r.from && n.to == r.to) ? !1 : (t.dispatch({ selection: { anchor: n.from, head: n.to }, scrollIntoView: !0 }), !0); +}, T3e = [ + { key: "Mod-Shift-m", run: k3e, preventDefault: !0 }, + { key: "F8", run: S3e } +], GJ = /* @__PURE__ */ _t.define({ + combine(t) { + return Object.assign({ sources: t.map((e) => e.source) }, qc(t.map((e) => e.config), { delay: 750, markerFilter: null, tooltipFilter: null, needsRefresh: null }, { - needsRefresh: (n, s) => n ? s ? (a) => n(a) || s(a) : n : s + needsRefresh: (e, r) => e ? r ? (n) => e(n) || r(n) : e : r })); } }); -function NLt(r) { - let n = []; - if (r) +function HJ(t) { + let e = []; + if (t) e: - for (let { name: s } of r) { - for (let a = 0; a < s.length; a++) { - let l = s[a]; - if (/[a-zA-Z]/.test(l) && !n.some((h) => h.toLowerCase() == l.toLowerCase())) { - n.push(l); + for (let { name: r } of t) { + for (let n = 0; n < r.length; n++) { + let i = r[n]; + if (/[a-zA-Z]/.test(i) && !e.some((s) => s.toLowerCase() == i.toLowerCase())) { + e.push(i); continue e; } } - n.push(""); + e.push(""); } - return n; + return e; } -function RLt(r, n, s) { - var a; - let l = s ? NLt(n.actions) : []; - return hh("li", { class: "cm-diagnostic cm-diagnostic-" + n.severity }, hh("span", { class: "cm-diagnosticText" }, n.renderMessage ? n.renderMessage() : n.message), (a = n.actions) === null || a === void 0 ? void 0 : a.map((h, f) => { - let b = !1, w = (D) => { - if (D.preventDefault(), b) +function XJ(t, e, r) { + var n; + let i = r ? HJ(e.actions) : []; + return cn("li", { class: "cm-diagnostic cm-diagnostic-" + e.severity }, cn("span", { class: "cm-diagnosticText" }, e.renderMessage ? e.renderMessage() : e.message), (n = e.actions) === null || n === void 0 ? void 0 : n.map((s, a) => { + let o = !1, l = (d) => { + if (d.preventDefault(), o) return; - b = !0; - let M = lF(r.state.field(B2).diagnostics, n); - M && h.apply(r, M.from, M.to); - }, { name: O } = h, S = l[f] ? O.indexOf(l[f]) : -1, E = S < 0 ? O : [ - O.slice(0, S), - hh("u", O.slice(S, S + 1)), - O.slice(S + 1) + o = !0; + let p = Rg(t.state.field(no).diagnostics, e); + p && s.apply(t, p.from, p.to); + }, { name: u } = s, h = i[a] ? u.indexOf(i[a]) : -1, f = h < 0 ? u : [ + u.slice(0, h), + cn("u", u.slice(h, h + 1)), + u.slice(h + 1) ]; - return hh("button", { + return cn("button", { type: "button", class: "cm-diagnosticAction", - onclick: w, - onmousedown: w, - "aria-label": ` Action: ${O}${S < 0 ? "" : ` (access key "${l[f]})"`}.` - }, E); - }), n.source && hh("div", { class: "cm-diagnosticSource" }, n.source)); + onclick: l, + onmousedown: l, + "aria-label": ` Action: ${u}${h < 0 ? "" : ` (access key "${i[a]})"`}.` + }, f); + }), e.source && cn("div", { class: "cm-diagnosticSource" }, e.source)); } -class X_n extends uv { - constructor(n) { - super(), this.diagnostic = n; +class C3e extends za { + constructor(e) { + super(), this.diagnostic = e; } - eq(n) { - return n.diagnostic == this.diagnostic; + eq(e) { + return e.diagnostic == this.diagnostic; } toDOM() { - return hh("span", { class: "cm-lintPoint cm-lintPoint-" + this.diagnostic.severity }); + return cn("span", { class: "cm-lintPoint cm-lintPoint-" + this.diagnostic.severity }); } } -class eEt { - constructor(n, s) { - this.diagnostic = s, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = RLt(n, s, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option"); +class AF { + constructor(e, r) { + this.diagnostic = r, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = XJ(e, r, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option"); } } -class swe { - constructor(n) { - this.view = n, this.items = []; - let s = (l) => { - if (l.keyCode == 27) - JCt(this.view), this.view.focus(); - else if (l.keyCode == 38 || l.keyCode == 33) +class QS { + constructor(e) { + this.view = e, this.items = []; + let r = (i) => { + if (i.keyCode == 27) + _F(this.view), this.view.focus(); + else if (i.keyCode == 38 || i.keyCode == 33) this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length); - else if (l.keyCode == 40 || l.keyCode == 34) + else if (i.keyCode == 40 || i.keyCode == 34) this.moveSelection((this.selectedIndex + 1) % this.items.length); - else if (l.keyCode == 36) + else if (i.keyCode == 36) this.moveSelection(0); - else if (l.keyCode == 35) + else if (i.keyCode == 35) this.moveSelection(this.items.length - 1); - else if (l.keyCode == 13) + else if (i.keyCode == 13) this.view.focus(); - else if (l.keyCode >= 65 && l.keyCode <= 90 && this.selectedIndex >= 0) { - let { diagnostic: h } = this.items[this.selectedIndex], f = NLt(h.actions); - for (let b = 0; b < f.length; b++) - if (f[b].toUpperCase().charCodeAt(0) == l.keyCode) { - let w = lF(this.view.state.field(B2).diagnostics, h); - w && h.actions[b].apply(n, w.from, w.to); + else if (i.keyCode >= 65 && i.keyCode <= 90 && this.selectedIndex >= 0) { + let { diagnostic: s } = this.items[this.selectedIndex], a = HJ(s.actions); + for (let o = 0; o < a.length; o++) + if (a[o].toUpperCase().charCodeAt(0) == i.keyCode) { + let l = Rg(this.view.state.field(no).diagnostics, s); + l && s.actions[o].apply(e, l.from, l.to); } } else return; - l.preventDefault(); - }, a = (l) => { - for (let h = 0; h < this.items.length; h++) - this.items[h].dom.contains(l.target) && this.moveSelection(h); + i.preventDefault(); + }, n = (i) => { + for (let s = 0; s < this.items.length; s++) + this.items[s].dom.contains(i.target) && this.moveSelection(s); }; - this.list = hh("ul", { + this.list = cn("ul", { tabIndex: 0, role: "listbox", "aria-label": this.view.state.phrase("Diagnostics"), - onkeydown: s, - onclick: a - }), this.dom = hh("div", { class: "cm-panel-lint" }, this.list, hh("button", { + onkeydown: r, + onclick: n + }), this.dom = cn("div", { class: "cm-panel-lint" }, this.list, cn("button", { type: "button", name: "close", "aria-label": this.view.state.phrase("close"), - onclick: () => JCt(this.view) + onclick: () => _F(this.view) }, "\xD7")), this.update(); } get selectedIndex() { - let n = this.view.state.field(B2).selected; - if (!n) + let e = this.view.state.field(no).selected; + if (!e) return -1; - for (let s = 0; s < this.items.length; s++) - if (this.items[s].diagnostic == n.diagnostic) - return s; + for (let r = 0; r < this.items.length; r++) + if (this.items[r].diagnostic == e.diagnostic) + return r; return -1; } update() { - let { diagnostics: n, selected: s } = this.view.state.field(B2), a = 0, l = !1, h = null; - for (n.between(0, this.view.state.doc.length, (f, b, { spec: w }) => { - let O = -1, S; - for (let E = a; E < this.items.length; E++) - if (this.items[E].diagnostic == w.diagnostic) { - O = E; - break; - } - O < 0 ? (S = new eEt(this.view, w.diagnostic), this.items.splice(a, 0, S), l = !0) : (S = this.items[O], O > a && (this.items.splice(a, O - a), l = !0)), s && S.diagnostic == s.diagnostic ? S.dom.hasAttribute("aria-selected") || (S.dom.setAttribute("aria-selected", "true"), h = S) : S.dom.hasAttribute("aria-selected") && S.dom.removeAttribute("aria-selected"), a++; - }); a < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0); ) - l = !0, this.items.pop(); - this.items.length == 0 && (this.items.push(new eEt(this.view, { + let { diagnostics: e, selected: r } = this.view.state.field(no), n = 0, i = !1, s = null; + for (e.between(0, this.view.state.doc.length, (a, o, { spec: l }) => { + let u = -1, h; + for (let f = n; f < this.items.length; f++) + if (this.items[f].diagnostic == l.diagnostic) { + u = f; + break; + } + u < 0 ? (h = new AF(this.view, l.diagnostic), this.items.splice(n, 0, h), i = !0) : (h = this.items[u], u > n && (this.items.splice(n, u - n), i = !0)), r && h.diagnostic == r.diagnostic ? h.dom.hasAttribute("aria-selected") || (h.dom.setAttribute("aria-selected", "true"), s = h) : h.dom.hasAttribute("aria-selected") && h.dom.removeAttribute("aria-selected"), n++; + }); n < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0); ) + i = !0, this.items.pop(); + this.items.length == 0 && (this.items.push(new AF(this.view, { from: -1, to: -1, severity: "info", message: this.view.state.phrase("No diagnostics") - })), l = !0), h ? (this.list.setAttribute("aria-activedescendant", h.id), this.view.requestMeasure({ + })), i = !0), s ? (this.list.setAttribute("aria-activedescendant", s.id), this.view.requestMeasure({ key: this, - read: () => ({ sel: h.dom.getBoundingClientRect(), panel: this.list.getBoundingClientRect() }), - write: ({ sel: f, panel: b }) => { - let w = b.height / this.list.offsetHeight; - f.top < b.top ? this.list.scrollTop -= (b.top - f.top) / w : f.bottom > b.bottom && (this.list.scrollTop += (f.bottom - b.bottom) / w); + read: () => ({ sel: s.dom.getBoundingClientRect(), panel: this.list.getBoundingClientRect() }), + write: ({ sel: a, panel: o }) => { + let l = o.height / this.list.offsetHeight; + a.top < o.top ? this.list.scrollTop -= (o.top - a.top) / l : a.bottom > o.bottom && (this.list.scrollTop += (a.bottom - o.bottom) / l); } - })) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), l && this.sync(); + })) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), i && this.sync(); } sync() { - let n = this.list.firstChild; - function s() { - let a = n; - n = a.nextSibling, a.remove(); - } - for (let a of this.items) - if (a.dom.parentNode == this.list) { - for (; n != a.dom; ) - s(); - n = a.dom.nextSibling; + let e = this.list.firstChild; + function r() { + let n = e; + e = n.nextSibling, n.remove(); + } + for (let n of this.items) + if (n.dom.parentNode == this.list) { + for (; e != n.dom; ) + r(); + e = n.dom.nextSibling; } else - this.list.insertBefore(a.dom, n); - for (; n; ) - s(); + this.list.insertBefore(n.dom, e); + for (; e; ) + r(); } - moveSelection(n) { + moveSelection(e) { if (this.selectedIndex < 0) return; - let s = this.view.state.field(B2), a = lF(s.diagnostics, this.items[n].diagnostic); - !a || this.view.dispatch({ - selection: { anchor: a.from, head: a.to }, + let r = this.view.state.field(no), n = Rg(r.diagnostics, this.items[e].diagnostic); + !n || this.view.dispatch({ + selection: { anchor: n.from, head: n.to }, scrollIntoView: !0, - effects: LLt.of(a) + effects: WJ.of(n) }); } - static open(n) { - return new swe(n); + static open(e) { + return new QS(e); } } -function K_n(r, n = 'viewBox="0 0 40 40"') { - return `url('data:image/svg+xml,${encodeURIComponent(r)}')`; +function E3e(t, e = 'viewBox="0 0 40 40"') { + return `url('data:image/svg+xml,${encodeURIComponent(t)}')`; } -function tme(r) { - return K_n(``, 'width="6" height="3"'); +function Aw(t) { + return E3e(``, 'width="6" height="3"'); } -const J_n = /* @__PURE__ */ Ci.baseTheme({ +const _3e = /* @__PURE__ */ dt.baseTheme({ ".cm-diagnostic": { padding: "3px 6px 3px 8px", marginLeft: "-1px", @@ -15867,10 +15876,10 @@ const J_n = /* @__PURE__ */ Ci.baseTheme({ backgroundRepeat: "repeat-x", paddingBottom: "0.7px" }, - ".cm-lintRange-error": { backgroundImage: /* @__PURE__ */ tme("#d11") }, - ".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */ tme("orange") }, - ".cm-lintRange-info": { backgroundImage: /* @__PURE__ */ tme("#999") }, - ".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */ tme("#66d") }, + ".cm-lintRange-error": { backgroundImage: /* @__PURE__ */ Aw("#d11") }, + ".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */ Aw("orange") }, + ".cm-lintRange-info": { backgroundImage: /* @__PURE__ */ Aw("#999") }, + ".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */ Aw("#66d") }, ".cm-lintRange-active": { backgroundColor: "#ffdd9980" }, ".cm-tooltip-lint": { padding: 0, @@ -15927,874 +15936,874 @@ const J_n = /* @__PURE__ */ Ci.baseTheme({ margin: 0 } } -}), eCn = [ - B2, - /* @__PURE__ */ Ci.decorations.compute([B2], (r) => { - let { selected: n, panel: s } = r.field(B2); - return !n || !s || n.from == n.to ? as.none : as.set([ - U_n.range(n.from, n.to) +}), A3e = [ + no, + /* @__PURE__ */ dt.decorations.compute([no], (t) => { + let { selected: e, panel: r } = t.field(no); + return !e || !r || e.from == e.to ? Et.none : Et.set([ + x3e.range(e.from, e.to) ]); }), - /* @__PURE__ */ H4n(W_n, { hideOn: q_n }), - J_n -], tCn = /* @__PURE__ */ (() => [ - nxn(), - sxn(), - GMt(), - Cze(), - Kxn(), - WMt(), - O4n(), - Ga.allowMultipleSelections.of(!0), - Fxn(), - kPt(xPt, { fallback: !0 }), - cSn(), - A_n(), - j_n(), - $4n(), - j4n(), - ZMt(), - C6n(), - X6.of([ - ...L_n, - ...aLt, - ...U6n, - ...IPt, - ...Hxn, - ...MLt, - ...Z_n + /* @__PURE__ */ kwe(w3e, { hideOn: y3e }), + _3e +], L3e = /* @__PURE__ */ (() => [ + Rwe(), + Nwe(), + lK(), + KR(), + EOe(), + sK(), + Zxe(), + dr.allowMultipleSelections.of(!0), + pOe(), + IK(PK, { fallback: !0 }), + $Oe(), + i3e(), + g3e(), + fwe(), + gwe(), + cK(), + t5e(), + Tu.of([ + ...l3e, + ...xJ, + ...x5e, + ...GK, + ...kOe, + ...QJ, + ...T3e ]) -])(), nCn = /* @__PURE__ */ (() => [ - GMt(), - Cze(), - WMt(), - kPt(xPt, { fallback: !0 }), - X6.of([ - ...aLt, - ...IPt +])(), R3e = /* @__PURE__ */ (() => [ + lK(), + KR(), + sK(), + IK(PK, { fallback: !0 }), + Tu.of([ + ...xJ, + ...GK ]) -])(), uk = () => /* @__PURE__ */ new Map(), NFe = (r) => { - const n = uk(); - return r.forEach((s, a) => { - n.set(a, s); - }), n; -}, g_ = (r, n, s) => { - let a = r.get(n); - return a === void 0 && r.set(n, a = s()), a; -}, rCn = (r, n) => { - const s = []; - for (const [a, l] of r) - s.push(n(l, a)); - return s; -}, iCn = (r, n) => { - for (const [s, a] of r) - if (n(a, s)) +])(), xl = () => /* @__PURE__ */ new Map(), S7 = (t) => { + const e = xl(); + return t.forEach((r, n) => { + e.set(n, r); + }), e; +}, rh = (t, e, r) => { + let n = t.get(e); + return n === void 0 && t.set(e, n = r()), n; +}, M3e = (t, e) => { + const r = []; + for (const [n, i] of t) + r.push(e(i, n)); + return r; +}, D3e = (t, e) => { + for (const [r, n] of t) + if (e(n, r)) return !0; return !1; -}, oP = () => /* @__PURE__ */ new Set(), $Re = (r) => r[r.length - 1], sCn = (r, n) => { - for (let s = 0; s < n.length; s++) - r.push(n[s]); -}, w8 = Array.from, oCn = (r, n) => { - for (let s = 0; s < r.length; s++) - if (n(r[s], s, r)) +}, jd = () => /* @__PURE__ */ new Set(), ME = (t) => t[t.length - 1], N3e = (t, e) => { + for (let r = 0; r < e.length; r++) + t.push(e[r]); +}, hf = Array.from, I3e = (t, e) => { + for (let r = 0; r < t.length; r++) + if (e(t[r], r, t)) return !0; return !1; -}, RFe = Array.isArray; -class owe { +}, T7 = Array.isArray; +class YS { constructor() { - this._observers = uk(); + this._observers = xl(); } - on(n, s) { - g_(this._observers, n, oP).add(s); + on(e, r) { + rh(this._observers, e, jd).add(r); } - once(n, s) { - const a = (...l) => { - this.off(n, a), s(...l); + once(e, r) { + const n = (...i) => { + this.off(e, n), r(...i); }; - this.on(n, a); + this.on(e, n); } - off(n, s) { - const a = this._observers.get(n); - a !== void 0 && (a.delete(s), a.size === 0 && this._observers.delete(n)); + off(e, r) { + const n = this._observers.get(e); + n !== void 0 && (n.delete(r), n.size === 0 && this._observers.delete(e)); } - emit(n, s) { - return w8((this._observers.get(n) || uk()).values()).forEach((a) => a(...s)); + emit(e, r) { + return hf((this._observers.get(e) || xl()).values()).forEach((n) => n(...r)); } destroy() { - this._observers = uk(); + this._observers = xl(); } } -const l_ = Math.floor, ebe = Math.abs, awe = (r, n) => r < n ? r : n, T8 = (r, n) => r > n ? r : n, aCn = Math.pow, $Lt = (r) => r !== 0 ? r < 0 : 1 / r < 0, tEt = 1, nEt = 2, BRe = 4, FRe = 8, TK = 32, J6 = 64, j2 = 128, cwe = 31, $Fe = 63, GM = 127, cCn = 2147483647, BLt = Number.MAX_SAFE_INTEGER, lCn = Number.isInteger || ((r) => typeof r == "number" && isFinite(r) && l_(r) === r), uCn = String.fromCharCode, hCn = (r) => r.toLowerCase(), fCn = /^\s*/g, dCn = (r) => r.replace(fCn, ""), pCn = /([A-Z])/g, rEt = (r, n) => dCn(r.replace(pCn, (s) => `${n}${hCn(s)}`)), gCn = (r) => { - const n = unescape(encodeURIComponent(r)), s = n.length, a = new Uint8Array(s); - for (let l = 0; l < s; l++) - a[l] = n.codePointAt(l); - return a; -}, AK = typeof TextEncoder < "u" ? new TextEncoder() : null, mCn = (r) => AK.encode(r), bCn = AK ? mCn : gCn; -let zX = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 }); -zX && zX.decode(new Uint8Array()).length === 1 && (zX = null); -class FJ { +const Fu = Math.floor, h4 = Math.abs, WS = (t, e) => t < e ? t : e, Bf = (t, e) => t > e ? t : e, P3e = Math.pow, ZJ = (t) => t !== 0 ? t < 0 : 1 / t < 0, LF = 1, RF = 2, DE = 4, NE = 8, $y = 32, Eu = 64, so = 128, GS = 31, C7 = 63, Vd = 127, $3e = 2147483647, jJ = Number.MAX_SAFE_INTEGER, B3e = Number.isInteger || ((t) => typeof t == "number" && isFinite(t) && Fu(t) === t), F3e = String.fromCharCode, z3e = (t) => t.toLowerCase(), V3e = /^\s*/g, U3e = (t) => t.replace(V3e, ""), q3e = /([A-Z])/g, MF = (t, e) => U3e(t.replace(q3e, (r) => `${e}${z3e(r)}`)), Q3e = (t) => { + const e = unescape(encodeURIComponent(t)), r = e.length, n = new Uint8Array(r); + for (let i = 0; i < r; i++) + n[i] = e.codePointAt(i); + return n; +}, By = typeof TextEncoder < "u" ? new TextEncoder() : null, Y3e = (t) => By.encode(t), W3e = By ? Y3e : Q3e; +let Gv = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 }); +Gv && Gv.decode(new Uint8Array()).length === 1 && (Gv = null); +class jb { constructor() { this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = []; } } -const Og = () => new FJ(), Fze = (r) => { - let n = r.cpos; - for (let s = 0; s < r.bufs.length; s++) - n += r.bufs[s].length; - return n; -}, Sf = (r) => { - const n = new Uint8Array(Fze(r)); - let s = 0; - for (let a = 0; a < r.bufs.length; a++) { - const l = r.bufs[a]; - n.set(l, s), s += l.length; - } - return n.set(new Uint8Array(r.cbuf.buffer, 0, r.cpos), s), n; -}, vCn = (r, n) => { - const s = r.cbuf.length; - s - r.cpos < n && (r.bufs.push(new Uint8Array(r.cbuf.buffer, 0, r.cpos)), r.cbuf = new Uint8Array(T8(s, n) * 2), r.cpos = 0); -}, V0 = (r, n) => { - const s = r.cbuf.length; - r.cpos === s && (r.bufs.push(r.cbuf), r.cbuf = new Uint8Array(s * 2), r.cpos = 0), r.cbuf[r.cpos++] = n; -}, BFe = V0, Eo = (r, n) => { - for (; n > GM; ) - V0(r, j2 | GM & n), n = l_(n / 128); - V0(r, GM & n); -}, jze = (r, n) => { - const s = $Lt(n); - for (s && (n = -n), V0(r, (n > $Fe ? j2 : 0) | (s ? J6 : 0) | $Fe & n), n = l_(n / 64); n > 0; ) - V0(r, (n > GM ? j2 : 0) | GM & n), n = l_(n / 128); -}, FFe = new Uint8Array(3e4), wCn = FFe.length / 3, yCn = (r, n) => { - if (n.length < wCn) { - const s = AK.encodeInto(n, FFe).written || 0; - Eo(r, s); - for (let a = 0; a < s; a++) - V0(r, FFe[a]); +const _s = () => new jb(), hM = (t) => { + let e = t.cpos; + for (let r = 0; r < t.bufs.length; r++) + e += t.bufs[r].length; + return e; +}, Ln = (t) => { + const e = new Uint8Array(hM(t)); + let r = 0; + for (let n = 0; n < t.bufs.length; n++) { + const i = t.bufs[n]; + e.set(i, r), r += i.length; + } + return e.set(new Uint8Array(t.cbuf.buffer, 0, t.cpos), r), e; +}, G3e = (t, e) => { + const r = t.cbuf.length; + r - t.cpos < e && (t.bufs.push(new Uint8Array(t.cbuf.buffer, 0, t.cpos)), t.cbuf = new Uint8Array(Bf(r, e) * 2), t.cpos = 0); +}, Vi = (t, e) => { + const r = t.cbuf.length; + t.cpos === r && (t.bufs.push(t.cbuf), t.cbuf = new Uint8Array(r * 2), t.cpos = 0), t.cbuf[t.cpos++] = e; +}, E7 = Vi, Wt = (t, e) => { + for (; e > Vd; ) + Vi(t, so | Vd & e), e = Fu(e / 128); + Vi(t, Vd & e); +}, fM = (t, e) => { + const r = ZJ(e); + for (r && (e = -e), Vi(t, (e > C7 ? so : 0) | (r ? Eu : 0) | C7 & e), e = Fu(e / 64); e > 0; ) + Vi(t, (e > Vd ? so : 0) | Vd & e), e = Fu(e / 128); +}, _7 = new Uint8Array(3e4), H3e = _7.length / 3, X3e = (t, e) => { + if (e.length < H3e) { + const r = By.encodeInto(e, _7).written || 0; + Wt(t, r); + for (let n = 0; n < r; n++) + Vi(t, _7[n]); } else - Ld(r, bCn(n)); -}, OCn = (r, n) => { - const s = unescape(encodeURIComponent(n)), a = s.length; - Eo(r, a); - for (let l = 0; l < a; l++) - V0(r, s.codePointAt(l)); -}, ZM = AK && AK.encodeInto ? yCn : OCn, lwe = (r, n) => { - const s = r.cbuf.length, a = r.cpos, l = awe(s - a, n.length), h = n.length - l; - r.cbuf.set(n.subarray(0, l), a), r.cpos += l, h > 0 && (r.bufs.push(r.cbuf), r.cbuf = new Uint8Array(T8(s * 2, h)), r.cbuf.set(n.subarray(l)), r.cpos = h); -}, Ld = (r, n) => { - Eo(r, n.byteLength), lwe(r, n); -}, Qze = (r, n) => { - vCn(r, n); - const s = new DataView(r.cbuf.buffer, r.cpos, n); - return r.cpos += n, s; -}, kCn = (r, n) => Qze(r, 4).setFloat32(0, n, !1), xCn = (r, n) => Qze(r, 8).setFloat64(0, n, !1), SCn = (r, n) => Qze(r, 8).setBigInt64(0, n, !1), iEt = new DataView(new ArrayBuffer(4)), _Cn = (r) => (iEt.setFloat32(0, r), iEt.getFloat32(0) === r), DK = (r, n) => { - switch (typeof n) { + Xn(t, W3e(e)); +}, Z3e = (t, e) => { + const r = unescape(encodeURIComponent(e)), n = r.length; + Wt(t, n); + for (let i = 0; i < n; i++) + Vi(t, r.codePointAt(i)); +}, Ud = By && By.encodeInto ? X3e : Z3e, HS = (t, e) => { + const r = t.cbuf.length, n = t.cpos, i = WS(r - n, e.length), s = e.length - i; + t.cbuf.set(e.subarray(0, i), n), t.cpos += i, s > 0 && (t.bufs.push(t.cbuf), t.cbuf = new Uint8Array(Bf(r * 2, s)), t.cbuf.set(e.subarray(i)), t.cpos = s); +}, Xn = (t, e) => { + Wt(t, e.byteLength), HS(t, e); +}, dM = (t, e) => { + G3e(t, e); + const r = new DataView(t.cbuf.buffer, t.cpos, e); + return t.cpos += e, r; +}, j3e = (t, e) => dM(t, 4).setFloat32(0, e, !1), K3e = (t, e) => dM(t, 8).setFloat64(0, e, !1), J3e = (t, e) => dM(t, 8).setBigInt64(0, e, !1), DF = new DataView(new ArrayBuffer(4)), eke = (t) => (DF.setFloat32(0, t), DF.getFloat32(0) === t), Fy = (t, e) => { + switch (typeof e) { case "string": - V0(r, 119), ZM(r, n); + Vi(t, 119), Ud(t, e); break; case "number": - lCn(n) && ebe(n) <= cCn ? (V0(r, 125), jze(r, n)) : _Cn(n) ? (V0(r, 124), kCn(r, n)) : (V0(r, 123), xCn(r, n)); + B3e(e) && h4(e) <= $3e ? (Vi(t, 125), fM(t, e)) : eke(e) ? (Vi(t, 124), j3e(t, e)) : (Vi(t, 123), K3e(t, e)); break; case "bigint": - V0(r, 122), SCn(r, n); + Vi(t, 122), J3e(t, e); break; case "object": - if (n === null) - V0(r, 126); - else if (RFe(n)) { - V0(r, 117), Eo(r, n.length); - for (let s = 0; s < n.length; s++) - DK(r, n[s]); - } else if (n instanceof Uint8Array) - V0(r, 116), Ld(r, n); + if (e === null) + Vi(t, 126); + else if (T7(e)) { + Vi(t, 117), Wt(t, e.length); + for (let r = 0; r < e.length; r++) + Fy(t, e[r]); + } else if (e instanceof Uint8Array) + Vi(t, 116), Xn(t, e); else { - V0(r, 118); - const s = Object.keys(n); - Eo(r, s.length); - for (let a = 0; a < s.length; a++) { - const l = s[a]; - ZM(r, l), DK(r, n[l]); + Vi(t, 118); + const r = Object.keys(e); + Wt(t, r.length); + for (let n = 0; n < r.length; n++) { + const i = r[n]; + Ud(t, i), Fy(t, e[i]); } } break; case "boolean": - V0(r, n ? 120 : 121); + Vi(t, e ? 120 : 121); break; default: - V0(r, 127); + Vi(t, 127); } }; -class sEt extends FJ { - constructor(n) { - super(), this.w = n, this.s = null, this.count = 0; +class NF extends jb { + constructor(e) { + super(), this.w = e, this.s = null, this.count = 0; } - write(n) { - this.s === n ? this.count++ : (this.count > 0 && Eo(this, this.count - 1), this.count = 1, this.w(this, n), this.s = n); + write(e) { + this.s === e ? this.count++ : (this.count > 0 && Wt(this, this.count - 1), this.count = 1, this.w(this, e), this.s = e); } } -const oEt = (r) => { - r.count > 0 && (jze(r.encoder, r.count === 1 ? r.s : -r.s), r.count > 1 && Eo(r.encoder, r.count - 2)); +const IF = (t) => { + t.count > 0 && (fM(t.encoder, t.count === 1 ? t.s : -t.s), t.count > 1 && Wt(t.encoder, t.count - 2)); }; -class tbe { +class f4 { constructor() { - this.encoder = new FJ(), this.s = 0, this.count = 0; + this.encoder = new jb(), this.s = 0, this.count = 0; } - write(n) { - this.s === n ? this.count++ : (oEt(this), this.count = 1, this.s = n); + write(e) { + this.s === e ? this.count++ : (IF(this), this.count = 1, this.s = e); } toUint8Array() { - return oEt(this), Sf(this.encoder); + return IF(this), Ln(this.encoder); } } -const aEt = (r) => { - if (r.count > 0) { - const n = r.diff * 2 + (r.count === 1 ? 0 : 1); - jze(r.encoder, n), r.count > 1 && Eo(r.encoder, r.count - 2); +const PF = (t) => { + if (t.count > 0) { + const e = t.diff * 2 + (t.count === 1 ? 0 : 1); + fM(t.encoder, e), t.count > 1 && Wt(t.encoder, t.count - 2); } }; -class jRe { +class IE { constructor() { - this.encoder = new FJ(), this.s = 0, this.count = 0, this.diff = 0; + this.encoder = new jb(), this.s = 0, this.count = 0, this.diff = 0; } - write(n) { - this.diff === n - this.s ? (this.s = n, this.count++) : (aEt(this), this.count = 1, this.diff = n - this.s, this.s = n); + write(e) { + this.diff === e - this.s ? (this.s = e, this.count++) : (PF(this), this.count = 1, this.diff = e - this.s, this.s = e); } toUint8Array() { - return aEt(this), Sf(this.encoder); + return PF(this), Ln(this.encoder); } } -class CCn { +class tke { constructor() { - this.sarr = [], this.s = "", this.lensE = new tbe(); + this.sarr = [], this.s = "", this.lensE = new f4(); } - write(n) { - this.s += n, this.s.length > 19 && (this.sarr.push(this.s), this.s = ""), this.lensE.write(n.length); + write(e) { + this.s += e, this.s.length > 19 && (this.sarr.push(this.s), this.s = ""), this.lensE.write(e.length); } toUint8Array() { - const n = new FJ(); - return this.sarr.push(this.s), this.s = "", ZM(n, this.sarr.join("")), lwe(n, this.lensE.toUint8Array()), Sf(n); - } -} -const y8 = (r) => new Error(r), nx = () => { - throw y8("Method unimplemented"); -}, vk = () => { - throw y8("Unexpected case"); -}, FLt = y8("Unexpected end of array"), jLt = y8("Integer out of Range"); -class uwe { - constructor(n) { - this.arr = n, this.pos = 0; - } -} -const A8 = (r) => new uwe(r), ECn = (r) => r.pos !== r.arr.length, TCn = (r, n) => { - const s = new Uint8Array(r.arr.buffer, r.pos + r.arr.byteOffset, n); - return r.pos += n, s; -}, wg = (r) => TCn(r, Pa(r)), uF = (r) => r.arr[r.pos++], Pa = (r) => { - let n = 0, s = 1; - const a = r.arr.length; - for (; r.pos < a; ) { - const l = r.arr[r.pos++]; - if (n = n + (l & GM) * s, s *= 128, l < j2) - return n; - if (n > BLt) - throw jLt; - } - throw FLt; -}, zze = (r) => { - let n = r.arr[r.pos++], s = n & $Fe, a = 64; - const l = (n & J6) > 0 ? -1 : 1; - if ((n & j2) === 0) - return l * s; - const h = r.arr.length; - for (; r.pos < h; ) { - if (n = r.arr[r.pos++], s = s + (n & GM) * a, a *= 128, n < j2) - return l * s; - if (s > BLt) - throw jLt; - } - throw FLt; -}, ACn = (r) => { - let n = Pa(r); - if (n === 0) + const e = new jb(); + return this.sarr.push(this.s), this.s = "", Ud(e, this.sarr.join("")), HS(e, this.lensE.toUint8Array()), Ln(e); + } +} +const ff = (t) => new Error(t), Ac = () => { + throw ff("Method unimplemented"); +}, Il = () => { + throw ff("Unexpected case"); +}, KJ = ff("Unexpected end of array"), JJ = ff("Integer out of Range"); +class XS { + constructor(e) { + this.arr = e, this.pos = 0; + } +} +const Ff = (t) => new XS(t), rke = (t) => t.pos !== t.arr.length, nke = (t, e) => { + const r = new Uint8Array(t.arr.buffer, t.pos + t.arr.byteOffset, e); + return t.pos += e, r; +}, Es = (t) => nke(t, or(t)), Mg = (t) => t.arr[t.pos++], or = (t) => { + let e = 0, r = 1; + const n = t.arr.length; + for (; t.pos < n; ) { + const i = t.arr[t.pos++]; + if (e = e + (i & Vd) * r, r *= 128, i < so) + return e; + if (e > jJ) + throw JJ; + } + throw KJ; +}, pM = (t) => { + let e = t.arr[t.pos++], r = e & C7, n = 64; + const i = (e & Eu) > 0 ? -1 : 1; + if ((e & so) === 0) + return i * r; + const s = t.arr.length; + for (; t.pos < s; ) { + if (e = t.arr[t.pos++], r = r + (e & Vd) * n, n *= 128, e < so) + return i * r; + if (r > jJ) + throw JJ; + } + throw KJ; +}, ike = (t) => { + let e = or(t); + if (e === 0) return ""; { - let s = String.fromCodePoint(uF(r)); - if (--n < 100) - for (; n--; ) - s += String.fromCodePoint(uF(r)); + let r = String.fromCodePoint(Mg(t)); + if (--e < 100) + for (; e--; ) + r += String.fromCodePoint(Mg(t)); else - for (; n > 0; ) { - const a = n < 1e4 ? n : 1e4, l = r.arr.subarray(r.pos, r.pos + a); - r.pos += a, s += String.fromCodePoint.apply(null, l), n -= a; - } - return decodeURIComponent(escape(s)); - } -}, DCn = (r) => zX.decode(wg(r)), i8 = zX ? DCn : ACn, qze = (r, n) => { - const s = new DataView(r.arr.buffer, r.arr.byteOffset + r.pos, n); - return r.pos += n, s; -}, MCn = (r) => qze(r, 4).getFloat32(0, !1), PCn = (r) => qze(r, 8).getFloat64(0, !1), LCn = (r) => qze(r, 8).getBigInt64(0, !1), ICn = [ - (r) => { - }, - (r) => null, - zze, - MCn, - PCn, - LCn, - (r) => !1, - (r) => !0, - i8, - (r) => { - const n = Pa(r), s = {}; - for (let a = 0; a < n; a++) { - const l = i8(r); - s[l] = MK(r); + for (; e > 0; ) { + const n = e < 1e4 ? e : 1e4, i = t.arr.subarray(t.pos, t.pos + n); + t.pos += n, r += String.fromCodePoint.apply(null, i), e -= n; + } + return decodeURIComponent(escape(r)); + } +}, ske = (t) => Gv.decode(Es(t)), Hh = Gv ? ske : ike, gM = (t, e) => { + const r = new DataView(t.arr.buffer, t.arr.byteOffset + t.pos, e); + return t.pos += e, r; +}, ake = (t) => gM(t, 4).getFloat32(0, !1), oke = (t) => gM(t, 8).getFloat64(0, !1), lke = (t) => gM(t, 8).getBigInt64(0, !1), cke = [ + (t) => { + }, + (t) => null, + pM, + ake, + oke, + lke, + (t) => !1, + (t) => !0, + Hh, + (t) => { + const e = or(t), r = {}; + for (let n = 0; n < e; n++) { + const i = Hh(t); + r[i] = zy(t); } - return s; + return r; }, - (r) => { - const n = Pa(r), s = []; - for (let a = 0; a < n; a++) - s.push(MK(r)); - return s; + (t) => { + const e = or(t), r = []; + for (let n = 0; n < e; n++) + r.push(zy(t)); + return r; }, - wg -], MK = (r) => ICn[127 - uF(r)](r); -class cEt extends uwe { - constructor(n, s) { - super(n), this.reader = s, this.s = null, this.count = 0; + Es +], zy = (t) => cke[127 - Mg(t)](t); +class $F extends XS { + constructor(e, r) { + super(e), this.reader = r, this.s = null, this.count = 0; } read() { - return this.count === 0 && (this.s = this.reader(this), ECn(this) ? this.count = Pa(this) + 1 : this.count = -1), this.count--, this.s; + return this.count === 0 && (this.s = this.reader(this), rke(this) ? this.count = or(this) + 1 : this.count = -1), this.count--, this.s; } } -class nbe extends uwe { - constructor(n) { - super(n), this.s = 0, this.count = 0; +class d4 extends XS { + constructor(e) { + super(e), this.s = 0, this.count = 0; } read() { if (this.count === 0) { - this.s = zze(this); - const n = $Lt(this.s); - this.count = 1, n && (this.s = -this.s, this.count = Pa(this) + 2); + this.s = pM(this); + const e = ZJ(this.s); + this.count = 1, e && (this.s = -this.s, this.count = or(this) + 2); } return this.count--, this.s; } } -class QRe extends uwe { - constructor(n) { - super(n), this.s = 0, this.count = 0, this.diff = 0; +class PE extends XS { + constructor(e) { + super(e), this.s = 0, this.count = 0, this.diff = 0; } read() { if (this.count === 0) { - const n = zze(this), s = n & 1; - this.diff = l_(n / 2), this.count = 1, s && (this.count = Pa(this) + 2); + const e = pM(this), r = e & 1; + this.diff = Fu(e / 2), this.count = 1, r && (this.count = or(this) + 2); } return this.s += this.diff, this.count--, this.s; } } -class NCn { - constructor(n) { - this.decoder = new nbe(n), this.str = i8(this.decoder), this.spos = 0; +class uke { + constructor(e) { + this.decoder = new d4(e), this.str = Hh(this.decoder), this.spos = 0; } read() { - const n = this.spos + this.decoder.read(), s = this.str.slice(this.spos, n); - return this.spos = n, s; + const e = this.spos + this.decoder.read(), r = this.str.slice(this.spos, e); + return this.spos = e, r; } } -const RCn = crypto.getRandomValues.bind(crypto), QLt = () => RCn(new Uint32Array(1))[0], $Cn = [1e7] + -1e3 + -4e3 + -8e3 + -1e11, BCn = () => $Cn.replace( +const hke = crypto.getRandomValues.bind(crypto), eee = () => hke(new Uint32Array(1))[0], fke = [1e7] + -1e3 + -4e3 + -8e3 + -1e11, dke = () => fke.replace( /[018]/g, - (r) => (r ^ QLt() & 15 >> r / 4).toString(16) -), O8 = Date.now, lEt = (r) => new Promise(r); + (t) => (t ^ eee() & 15 >> t / 4).toString(16) +), df = Date.now, BF = (t) => new Promise(t); Promise.all.bind(Promise); -const uEt = (r) => r === void 0 ? null : r; -class FCn { +const FF = (t) => t === void 0 ? null : t; +class pke { constructor() { this.map = /* @__PURE__ */ new Map(); } - setItem(n, s) { - this.map.set(n, s); + setItem(e, r) { + this.map.set(e, r); } - getItem(n) { - return this.map.get(n); + getItem(e) { + return this.map.get(e); } } -let zLt = new FCn(), Vze = !0; +let tee = new pke(), mM = !0; try { - typeof localStorage < "u" && localStorage && (zLt = localStorage, Vze = !1); + typeof localStorage < "u" && localStorage && (tee = localStorage, mM = !1); } catch { } -const qLt = zLt, jCn = (r) => Vze || addEventListener("storage", r), QCn = (r) => Vze || removeEventListener("storage", r), zCn = Object.assign, qCn = Object.keys, VCn = (r, n) => { - for (const s in r) - n(r[s], s); -}, UCn = (r, n) => { - const s = []; - for (const a in r) - s.push(n(r[a], a)); - return s; -}, cve = (r) => qCn(r).length, WCn = (r) => { - for (const n in r) +const ree = tee, gke = (t) => mM || addEventListener("storage", t), mke = (t) => mM || removeEventListener("storage", t), vke = Object.assign, yke = Object.keys, bke = (t, e) => { + for (const r in t) + e(t[r], r); +}, xke = (t, e) => { + const r = []; + for (const n in t) + r.push(e(t[n], n)); + return r; +}, B5 = (t) => yke(t).length, wke = (t) => { + for (const e in t) return !1; return !0; -}, YCn = (r, n) => { - for (const s in r) - if (!n(r[s], s)) +}, Oke = (t, e) => { + for (const r in t) + if (!e(t[r], r)) return !1; return !0; -}, VLt = (r, n) => Object.prototype.hasOwnProperty.call(r, n), HCn = (r, n) => r === n || cve(r) === cve(n) && YCn(r, (s, a) => (s !== void 0 || VLt(n, a)) && n[a] === s), Uze = (r, n, s = 0) => { +}, nee = (t, e) => Object.prototype.hasOwnProperty.call(t, e), kke = (t, e) => t === e || B5(t) === B5(e) && Oke(t, (r, n) => (r !== void 0 || nee(e, n)) && e[n] === r), vM = (t, e, r = 0) => { try { - for (; s < r.length; s++) - r[s](...n); + for (; r < t.length; r++) + t[r](...e); } finally { - s < r.length && Uze(r, n, s + 1); + r < t.length && vM(t, e, r + 1); } -}, GCn = (r) => r, ZCn = (r, n) => r === n, qX = (r, n) => { - if (r == null || n == null) - return ZCn(r, n); - if (r.constructor !== n.constructor) +}, Ske = (t) => t, Tke = (t, e) => t === e, Hv = (t, e) => { + if (t == null || e == null) + return Tke(t, e); + if (t.constructor !== e.constructor) return !1; - if (r === n) + if (t === e) return !0; - switch (r.constructor) { + switch (t.constructor) { case ArrayBuffer: - r = new Uint8Array(r), n = new Uint8Array(n); + t = new Uint8Array(t), e = new Uint8Array(e); case Uint8Array: { - if (r.byteLength !== n.byteLength) + if (t.byteLength !== e.byteLength) return !1; - for (let s = 0; s < r.length; s++) - if (r[s] !== n[s]) + for (let r = 0; r < t.length; r++) + if (t[r] !== e[r]) return !1; break; } case Set: { - if (r.size !== n.size) + if (t.size !== e.size) return !1; - for (const s of r) - if (!n.has(s)) + for (const r of t) + if (!e.has(r)) return !1; break; } case Map: { - if (r.size !== n.size) + if (t.size !== e.size) return !1; - for (const s of r.keys()) - if (!n.has(s) || !qX(r.get(s), n.get(s))) + for (const r of t.keys()) + if (!e.has(r) || !Hv(t.get(r), e.get(r))) return !1; break; } case Object: - if (cve(r) !== cve(n)) + if (B5(t) !== B5(e)) return !1; - for (const s in r) - if (!VLt(r, s) || !qX(r[s], n[s])) + for (const r in t) + if (!nee(t, r) || !Hv(t[r], e[r])) return !1; break; case Array: - if (r.length !== n.length) + if (t.length !== e.length) return !1; - for (let s = 0; s < r.length; s++) - if (!qX(r[s], n[s])) + for (let r = 0; r < t.length; r++) + if (!Hv(t[r], e[r])) return !1; break; default: return !1; } return !0; -}, XCn = (r, n) => n.includes(r), hF = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", ULt = typeof window < "u" && typeof document < "u" && !hF; +}, Cke = (t, e) => e.includes(t), Dg = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", iee = typeof window < "u" && typeof document < "u" && !Dg; typeof navigator < "u" && /Mac/.test(navigator.platform); -let $4; -const KCn = () => { - if ($4 === void 0) - if (hF) { - $4 = uk(); - const r = process.argv; - let n = null; - for (let s = 0; s < r.length; s++) { - const a = r[s]; - a[0] === "-" ? (n !== null && $4.set(n, ""), n = a) : n !== null && ($4.set(n, a), n = null); - } - n !== null && $4.set(n, ""); +let ec; +const Eke = () => { + if (ec === void 0) + if (Dg) { + ec = xl(); + const t = process.argv; + let e = null; + for (let r = 0; r < t.length; r++) { + const n = t[r]; + n[0] === "-" ? (e !== null && ec.set(e, ""), e = n) : e !== null && (ec.set(e, n), e = null); + } + e !== null && ec.set(e, ""); } else - typeof location == "object" ? ($4 = uk(), (location.search || "?").slice(1).split("&").forEach((r) => { - if (r.length !== 0) { - const [n, s] = r.split("="); - $4.set(`--${rEt(n, "-")}`, s), $4.set(`-${rEt(n, "-")}`, s); - } - })) : $4 = uk(); - return $4; -}, jFe = (r) => KCn().has(r), QFe = (r) => uEt(hF ? {}[r.toUpperCase()] : qLt.getItem(r)), JCn = (r) => jFe("--" + r) || QFe(r) !== null; -JCn("production"); -const hEt = hF && XCn({}.FORCE_COLOR, ["true", "1", "2"]), eEn = !jFe("no-colors") && (!hF || process.stdout.isTTY || hEt) && (!hF || jFe("color") || hEt || QFe("COLORTERM") !== null || (QFe("TERM") || "").includes("color")), WLt = (r) => new Uint8Array(r), tEn = (r, n, s) => new Uint8Array(r, n, s), nEn = (r) => new Uint8Array(r), rEn = (r) => { - let n = ""; - for (let s = 0; s < r.byteLength; s++) - n += uCn(r[s]); - return btoa(n); -}, iEn = (r) => Buffer.from(r.buffer, r.byteOffset, r.byteLength).toString("base64"), sEn = (r) => { - const n = atob(r), s = WLt(n.length); - for (let a = 0; a < n.length; a++) - s[a] = n.charCodeAt(a); - return s; -}, oEn = (r) => { - const n = Buffer.from(r, "base64"); - return tEn(n.buffer, n.byteOffset, n.byteLength); -}, aEn = ULt ? rEn : iEn, cEn = ULt ? sEn : oEn, lEn = (r) => { - const n = WLt(r.byteLength); - return n.set(r), n; + typeof location == "object" ? (ec = xl(), (location.search || "?").slice(1).split("&").forEach((t) => { + if (t.length !== 0) { + const [e, r] = t.split("="); + ec.set(`--${MF(e, "-")}`, r), ec.set(`-${MF(e, "-")}`, r); + } + })) : ec = xl(); + return ec; +}, A7 = (t) => Eke().has(t), L7 = (t) => FF(Dg ? {}[t.toUpperCase()] : ree.getItem(t)), _ke = (t) => A7("--" + t) || L7(t) !== null; +_ke("production"); +const zF = Dg && Cke({}.FORCE_COLOR, ["true", "1", "2"]), Ake = !A7("no-colors") && (!Dg || process.stdout.isTTY || zF) && (!Dg || A7("color") || zF || L7("COLORTERM") !== null || (L7("TERM") || "").includes("color")), see = (t) => new Uint8Array(t), Lke = (t, e, r) => new Uint8Array(t, e, r), Rke = (t) => new Uint8Array(t), Mke = (t) => { + let e = ""; + for (let r = 0; r < t.byteLength; r++) + e += F3e(t[r]); + return btoa(e); +}, Dke = (t) => Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("base64"), Nke = (t) => { + const e = atob(t), r = see(e.length); + for (let n = 0; n < e.length; n++) + r[n] = e.charCodeAt(n); + return r; +}, Ike = (t) => { + const e = Buffer.from(t, "base64"); + return Lke(e.buffer, e.byteOffset, e.byteLength); +}, Pke = iee ? Mke : Dke, $ke = iee ? Nke : Ike, Bke = (t) => { + const e = see(t.byteLength); + return e.set(t), e; }; -class uEn { - constructor(n, s) { - this.left = n, this.right = s; +class Fke { + constructor(e, r) { + this.left = e, this.right = r; } } -const P2 = (r, n) => new uEn(r, n), hEn = (r, n) => r.forEach((s) => n(s.left, s.right)), mx = typeof document < "u" ? document : {}, fEn = (r) => mx.createElement(r), dEn = () => mx.createDocumentFragment(), pEn = (r) => mx.createTextNode(r); +const Za = (t, e) => new Fke(t, e), zke = (t, e) => t.forEach((r) => e(r.left, r.right)), Yc = typeof document < "u" ? document : {}, Vke = (t) => Yc.createElement(t), Uke = () => Yc.createDocumentFragment(), qke = (t) => Yc.createTextNode(t); typeof DOMParser < "u" && new DOMParser(); -const gEn = (r, n) => (hEn(n, (s, a) => { - a === !1 ? r.removeAttribute(s) : a === !0 ? r.setAttribute(s, "") : r.setAttribute(s, a); -}), r), mEn = (r) => { - const n = dEn(); - for (let s = 0; s < r.length; s++) - YLt(n, r[s]); - return n; -}, bEn = (r, n) => (YLt(r, mEn(n)), r), zRe = (r, n = [], s = []) => bEn(gEn(fEn(r), n), s), nme = pEn, vEn = (r) => rCn(r, (n, s) => `${s}:${n};`).join(""), YLt = (r, n) => r.appendChild(n); -mx.ELEMENT_NODE; -mx.TEXT_NODE; -mx.CDATA_SECTION_NODE; -mx.COMMENT_NODE; -mx.DOCUMENT_NODE; -mx.DOCUMENT_TYPE_NODE; -mx.DOCUMENT_FRAGMENT_NODE; -const m_ = Symbol, HLt = m_(), GLt = m_(), wEn = m_(), yEn = m_(), OEn = m_(), ZLt = m_(), kEn = m_(), Wze = m_(), xEn = m_(), SEn = (r) => { - const n = []; - let s = 0; - for (; s < r.length; s++) { - const a = r[s]; - a.constructor === String || a.constructor === Number || a.constructor === Object && n.push(JSON.stringify(a)); - } - return n; -}, _En = { - [HLt]: P2("font-weight", "bold"), - [GLt]: P2("font-weight", "normal"), - [wEn]: P2("color", "blue"), - [OEn]: P2("color", "green"), - [yEn]: P2("color", "grey"), - [ZLt]: P2("color", "red"), - [kEn]: P2("color", "purple"), - [Wze]: P2("color", "orange"), - [xEn]: P2("color", "black") -}, CEn = (r) => { - const n = [], s = [], a = uk(); - let l = [], h = 0; - for (; h < r.length; h++) { - const f = r[h], b = _En[f]; - if (b !== void 0) - a.set(b.left, b.right); - else if (f.constructor === String || f.constructor === Number) { - const w = vEn(a); - h > 0 || w.length > 0 ? (n.push("%c" + f), s.push(w)) : n.push(f); +const Qke = (t, e) => (zke(e, (r, n) => { + n === !1 ? t.removeAttribute(r) : n === !0 ? t.setAttribute(r, "") : t.setAttribute(r, n); +}), t), Yke = (t) => { + const e = Uke(); + for (let r = 0; r < t.length; r++) + aee(e, t[r]); + return e; +}, Wke = (t, e) => (aee(t, Yke(e)), t), $E = (t, e = [], r = []) => Wke(Qke(Vke(t), e), r), Lw = qke, Gke = (t) => M3e(t, (e, r) => `${r}:${e};`).join(""), aee = (t, e) => t.appendChild(e); +Yc.ELEMENT_NODE; +Yc.TEXT_NODE; +Yc.CDATA_SECTION_NODE; +Yc.COMMENT_NODE; +Yc.DOCUMENT_NODE; +Yc.DOCUMENT_TYPE_NODE; +Yc.DOCUMENT_FRAGMENT_NODE; +const nh = Symbol, oee = nh(), lee = nh(), Hke = nh(), Xke = nh(), Zke = nh(), cee = nh(), jke = nh(), yM = nh(), Kke = nh(), Jke = (t) => { + const e = []; + let r = 0; + for (; r < t.length; r++) { + const n = t[r]; + n.constructor === String || n.constructor === Number || n.constructor === Object && e.push(JSON.stringify(n)); + } + return e; +}, eSe = { + [oee]: Za("font-weight", "bold"), + [lee]: Za("font-weight", "normal"), + [Hke]: Za("color", "blue"), + [Zke]: Za("color", "green"), + [Xke]: Za("color", "grey"), + [cee]: Za("color", "red"), + [jke]: Za("color", "purple"), + [yM]: Za("color", "orange"), + [Kke]: Za("color", "black") +}, tSe = (t) => { + const e = [], r = [], n = xl(); + let i = [], s = 0; + for (; s < t.length; s++) { + const a = t[s], o = eSe[a]; + if (o !== void 0) + n.set(o.left, o.right); + else if (a.constructor === String || a.constructor === Number) { + const l = Gke(n); + s > 0 || l.length > 0 ? (e.push("%c" + a), r.push(l)) : e.push(a); } else break; } - for (h > 0 && (l = s, l.unshift(n.join(""))); h < r.length; h++) { - const f = r[h]; - f instanceof Symbol || l.push(f); + for (s > 0 && (i = r, i.unshift(e.join(""))); s < t.length; s++) { + const a = t[s]; + a instanceof Symbol || i.push(a); } - return l; -}, XLt = eEn ? CEn : SEn, EEn = (...r) => { - console.log(...XLt(r)), KLt.forEach((n) => n.print(r)); -}, TEn = (...r) => { - console.warn(...XLt(r)), r.unshift(Wze), KLt.forEach((n) => n.print(r)); -}, KLt = oP(), JLt = (r) => ({ + return i; +}, uee = Ake ? tSe : Jke, rSe = (...t) => { + console.log(...uee(t)), hee.forEach((e) => e.print(t)); +}, nSe = (...t) => { + console.warn(...uee(t)), t.unshift(yM), hee.forEach((e) => e.print(t)); +}, hee = jd(), fee = (t) => ({ [Symbol.iterator]() { return this; }, - next: r -}), AEn = (r, n) => JLt(() => { - let s; + next: t +}), iSe = (t, e) => fee(() => { + let r; do - s = r.next(); - while (!s.done && !n(s.value)); - return s; -}), qRe = (r, n) => JLt(() => { - const { done: s, value: a } = r.next(); - return { done: s, value: s ? void 0 : n(a) }; + r = t.next(); + while (!r.done && !e(r.value)); + return r; +}), BE = (t, e) => fee(() => { + const { done: r, value: n } = t.next(); + return { done: r, value: r ? void 0 : e(n) }; }); -class Yze { - constructor(n, s) { - this.clock = n, this.len = s; +class bM { + constructor(e, r) { + this.clock = e, this.len = r; } } -class ej { +class F1 { constructor() { this.clients = /* @__PURE__ */ new Map(); } } -const fF = (r, n, s) => n.clients.forEach((a, l) => { - const h = r.doc.store.clients.get(l); - for (let f = 0; f < a.length; f++) { - const b = a[f]; - pIt(r, h, b.clock, b.len, s); - } -}), DEn = (r, n) => { - let s = 0, a = r.length - 1; - for (; s <= a; ) { - const l = l_((s + a) / 2), h = r[l], f = h.clock; - if (f <= n) { - if (n < f + h.len) - return l; - s = l + 1; +const Ng = (t, e, r) => e.clients.forEach((n, i) => { + const s = t.doc.store.clients.get(i); + for (let a = 0; a < n.length; a++) { + const o = n[a]; + Eee(t, s, o.clock, o.len, r); + } +}), sSe = (t, e) => { + let r = 0, n = t.length - 1; + for (; r <= n; ) { + const i = Fu((r + n) / 2), s = t[i], a = s.clock; + if (a <= e) { + if (e < a + s.len) + return i; + r = i + 1; } else - a = l - 1; + n = i - 1; } return null; -}, jJ = (r, n) => { - const s = r.clients.get(n.client); - return s !== void 0 && DEn(s, n.clock) !== null; -}, Hze = (r) => { - r.clients.forEach((n) => { - n.sort((l, h) => l.clock - h.clock); - let s, a; - for (s = 1, a = 1; s < n.length; s++) { - const l = n[a - 1], h = n[s]; - l.clock + l.len >= h.clock ? l.len = T8(l.len, h.clock + h.len - l.clock) : (a < s && (n[a] = h), a++); - } - n.length = a; +}, Kb = (t, e) => { + const r = t.clients.get(e.client); + return r !== void 0 && sSe(r, e.clock) !== null; +}, xM = (t) => { + t.clients.forEach((e) => { + e.sort((i, s) => i.clock - s.clock); + let r, n; + for (r = 1, n = 1; r < e.length; r++) { + const i = e[n - 1], s = e[r]; + i.clock + i.len >= s.clock ? i.len = Bf(i.len, s.clock + s.len - i.clock) : (n < r && (e[n] = s), n++); + } + e.length = n; }); -}, zFe = (r) => { - const n = new ej(); - for (let s = 0; s < r.length; s++) - r[s].clients.forEach((a, l) => { - if (!n.clients.has(l)) { - const h = a.slice(); - for (let f = s + 1; f < r.length; f++) - sCn(h, r[f].clients.get(l) || []); - n.clients.set(l, h); +}, R7 = (t) => { + const e = new F1(); + for (let r = 0; r < t.length; r++) + t[r].clients.forEach((n, i) => { + if (!e.clients.has(i)) { + const s = n.slice(); + for (let a = r + 1; a < t.length; a++) + N3e(s, t[a].clients.get(i) || []); + e.clients.set(i, s); } }); - return Hze(n), n; -}, PK = (r, n, s, a) => { - g_(r.clients, n, () => []).push(new Yze(s, a)); -}, eIt = () => new ej(), MEn = (r) => { - const n = eIt(); - return r.clients.forEach((s, a) => { - const l = []; - for (let h = 0; h < s.length; h++) { - const f = s[h]; - if (f.deleted) { - const b = f.id.clock; - let w = f.length; - if (h + 1 < s.length) - for (let O = s[h + 1]; h + 1 < s.length && O.deleted; O = s[++h + 1]) - w += O.length; - l.push(new Yze(b, w)); - } - } - l.length > 0 && n.clients.set(a, l); - }), n; -}, tj = (r, n) => { - Eo(r.restEncoder, n.clients.size), w8(n.clients.entries()).sort((s, a) => a[0] - s[0]).forEach(([s, a]) => { - r.resetDsCurVal(), Eo(r.restEncoder, s); - const l = a.length; - Eo(r.restEncoder, l); - for (let h = 0; h < l; h++) { - const f = a[h]; - r.writeDsClock(f.clock), r.writeDsLen(f.len); + return xM(e), e; +}, Vy = (t, e, r, n) => { + rh(t.clients, e, () => []).push(new bM(r, n)); +}, dee = () => new F1(), aSe = (t) => { + const e = dee(); + return t.clients.forEach((r, n) => { + const i = []; + for (let s = 0; s < r.length; s++) { + const a = r[s]; + if (a.deleted) { + const o = a.id.clock; + let l = a.length; + if (s + 1 < r.length) + for (let u = r[s + 1]; s + 1 < r.length && u.deleted; u = r[++s + 1]) + l += u.length; + i.push(new bM(o, l)); + } + } + i.length > 0 && e.clients.set(n, i); + }), e; +}, z1 = (t, e) => { + Wt(t.restEncoder, e.clients.size), hf(e.clients.entries()).sort((r, n) => n[0] - r[0]).forEach(([r, n]) => { + t.resetDsCurVal(), Wt(t.restEncoder, r); + const i = n.length; + Wt(t.restEncoder, i); + for (let s = 0; s < i; s++) { + const a = n[s]; + t.writeDsClock(a.clock), t.writeDsLen(a.len); } }); -}, Gze = (r) => { - const n = new ej(), s = Pa(r.restDecoder); - for (let a = 0; a < s; a++) { - r.resetDsCurVal(); - const l = Pa(r.restDecoder), h = Pa(r.restDecoder); - if (h > 0) { - const f = g_(n.clients, l, () => []); - for (let b = 0; b < h; b++) - f.push(new Yze(r.readDsClock(), r.readDsLen())); - } - } - return n; -}, fEt = (r, n, s) => { - const a = new ej(), l = Pa(r.restDecoder); - for (let h = 0; h < l; h++) { - r.resetDsCurVal(); - const f = Pa(r.restDecoder), b = Pa(r.restDecoder), w = s.clients.get(f) || [], O = jd(s, f); - for (let S = 0; S < b; S++) { - const E = r.readDsClock(), D = E + r.readDsLen(); - if (E < O) { - O < D && PK(a, f, O, D - O); - let M = lx(w, E), B = w[M]; - for (!B.deleted && B.id.clock < E && (w.splice(M + 1, 0, mve(n, B, E - B.id.clock)), M++); M < w.length && (B = w[M++], B.id.clock < D); ) - B.deleted || (D < B.id.clock + B.length && w.splice(M, 0, mve(n, B, D - B.id.clock)), B.delete(n)); +}, wM = (t) => { + const e = new F1(), r = or(t.restDecoder); + for (let n = 0; n < r; n++) { + t.resetDsCurVal(); + const i = or(t.restDecoder), s = or(t.restDecoder); + if (s > 0) { + const a = rh(e.clients, i, () => []); + for (let o = 0; o < s; o++) + a.push(new bM(t.readDsClock(), t.readDsLen())); + } + } + return e; +}, VF = (t, e, r) => { + const n = new F1(), i = or(t.restDecoder); + for (let s = 0; s < i; s++) { + t.resetDsCurVal(); + const a = or(t.restDecoder), o = or(t.restDecoder), l = r.clients.get(a) || [], u = ti(r, a); + for (let h = 0; h < o; h++) { + const f = t.readDsClock(), d = f + t.readDsLen(); + if (f < u) { + u < d && Vy(n, a, u, d - u); + let p = Nc(l, f), g = l[p]; + for (!g.deleted && g.id.clock < f && (l.splice(p + 1, 0, W5(e, g, f - g.id.clock)), p++); p < l.length && (g = l[p++], g.id.clock < d); ) + g.deleted || (d < g.id.clock + g.length && l.splice(p, 0, W5(e, g, d - g.id.clock)), g.delete(e)); } else - PK(a, f, E, D - E); + Vy(n, a, f, d - f); } } - if (a.clients.size > 0) { - const h = new aP(); - return Eo(h.restEncoder, 0), tj(h, a), h.toUint8Array(); + if (n.clients.size > 0) { + const s = new Kd(); + return Wt(s.restEncoder, 0), z1(s, n), s.toUint8Array(); } return null; -}, tIt = QLt; -class nj extends owe { - constructor({ guid: n = BCn(), collectionid: s = null, gc: a = !0, gcFilter: l = () => !0, meta: h = null, autoLoad: f = !1, shouldLoad: b = !0 } = {}) { - super(), this.gc = a, this.gcFilter = l, this.clientID = tIt(), this.guid = n, this.collectionid = s, this.share = /* @__PURE__ */ new Map(), this.store = new fIt(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = b, this.autoLoad = f, this.meta = h, this.isLoaded = !1, this.isSynced = !1, this.whenLoaded = lEt((O) => { +}, pee = eee; +class V1 extends YS { + constructor({ guid: e = dke(), collectionid: r = null, gc: n = !0, gcFilter: i = () => !0, meta: s = null, autoLoad: a = !1, shouldLoad: o = !0 } = {}) { + super(), this.gc = n, this.gcFilter = i, this.clientID = pee(), this.guid = e, this.collectionid = r, this.share = /* @__PURE__ */ new Map(), this.store = new Tee(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = o, this.autoLoad = a, this.meta = s, this.isLoaded = !1, this.isSynced = !1, this.whenLoaded = BF((u) => { this.on("load", () => { - this.isLoaded = !0, O(this); + this.isLoaded = !0, u(this); }); }); - const w = () => lEt((O) => { - const S = (E) => { - (E === void 0 || E === !0) && (this.off("sync", S), O()); + const l = () => BF((u) => { + const h = (f) => { + (f === void 0 || f === !0) && (this.off("sync", h), u()); }; - this.on("sync", S); + this.on("sync", h); }); - this.on("sync", (O) => { - O === !1 && this.isSynced && (this.whenSynced = w()), this.isSynced = O === void 0 || O === !0, this.isSynced && !this.isLoaded && this.emit("load", []); - }), this.whenSynced = w(); + this.on("sync", (u) => { + u === !1 && this.isSynced && (this.whenSynced = l()), this.isSynced = u === void 0 || u === !0, this.isSynced && !this.isLoaded && this.emit("load", []); + }), this.whenSynced = l(); } load() { - const n = this._item; - n !== null && !this.shouldLoad && Yu(n.parent.doc, (s) => { - s.subdocsLoaded.add(this); + const e = this._item; + e !== null && !this.shouldLoad && tn(e.parent.doc, (r) => { + r.subdocsLoaded.add(this); }, null, !0), this.shouldLoad = !0; } getSubdocs() { return this.subdocs; } getSubdocGuids() { - return new Set(w8(this.subdocs).map((n) => n.guid)); - } - transact(n, s = null) { - return Yu(this, n, s); - } - get(n, s = Rp) { - const a = g_(this.share, n, () => { - const h = new s(); - return h._integrate(this, null), h; - }), l = a.constructor; - if (s !== Rp && l !== s) - if (l === Rp) { - const h = new s(); - h._map = a._map, a._map.forEach((f) => { - for (; f !== null; f = f.left) - f.parent = h; - }), h._start = a._start; - for (let f = h._start; f !== null; f = f.right) - f.parent = h; - return h._length = a._length, this.share.set(n, h), h._integrate(this, null), h; + return new Set(hf(this.subdocs).map((e) => e.guid)); + } + transact(e, r = null) { + return tn(this, e, r); + } + get(e, r = us) { + const n = rh(this.share, e, () => { + const s = new r(); + return s._integrate(this, null), s; + }), i = n.constructor; + if (r !== us && i !== r) + if (i === us) { + const s = new r(); + s._map = n._map, n._map.forEach((a) => { + for (; a !== null; a = a.left) + a.parent = s; + }), s._start = n._start; + for (let a = s._start; a !== null; a = a.right) + a.parent = s; + return s._length = n._length, this.share.set(e, s), s._integrate(this, null), s; } else - throw new Error(`Type with the name ${n} has already been defined with a different constructor`); - return a; + throw new Error(`Type with the name ${e} has already been defined with a different constructor`); + return n; } - getArray(n = "") { - return this.get(n, $B); + getArray(e = "") { + return this.get(e, jp); } - getText(n = "") { - return this.get(n, pF); + getText(e = "") { + return this.get(e, Pg); } - getMap(n = "") { - return this.get(n, e_); + getMap(e = "") { + return this.get(e, _u); } - getXmlFragment(n = "") { - return this.get(n, cP); + getXmlFragment(e = "") { + return this.get(e, Jd); } toJSON() { - const n = {}; - return this.share.forEach((s, a) => { - n[a] = s.toJSON(); - }), n; + const e = {}; + return this.share.forEach((r, n) => { + e[n] = r.toJSON(); + }), e; } destroy() { - w8(this.subdocs).forEach((s) => s.destroy()); - const n = this._item; - if (n !== null) { + hf(this.subdocs).forEach((r) => r.destroy()); + const e = this._item; + if (e !== null) { this._item = null; - const s = n.content; - s.doc = new nj({ guid: this.guid, ...s.opts, shouldLoad: !1 }), s.doc._item = n, Yu(n.parent.doc, (a) => { - const l = s.doc; - n.deleted || a.subdocsAdded.add(l), a.subdocsRemoved.add(this); + const r = e.content; + r.doc = new V1({ guid: this.guid, ...r.opts, shouldLoad: !1 }), r.doc._item = e, tn(e.parent.doc, (n) => { + const i = r.doc; + e.deleted || n.subdocsAdded.add(i), n.subdocsRemoved.add(this); }, null, !0); } this.emit("destroyed", [!0]), this.emit("destroy", [this]), super.destroy(); } - on(n, s) { - super.on(n, s); + on(e, r) { + super.on(e, r); } - off(n, s) { - super.off(n, s); + off(e, r) { + super.off(e, r); } } -class nIt { - constructor(n) { - this.restDecoder = n; +class gee { + constructor(e) { + this.restDecoder = e; } resetDsCurVal() { } readDsClock() { - return Pa(this.restDecoder); + return or(this.restDecoder); } readDsLen() { - return Pa(this.restDecoder); + return or(this.restDecoder); } } -class rIt extends nIt { +class mee extends gee { readLeftID() { - return Za(Pa(this.restDecoder), Pa(this.restDecoder)); + return pr(or(this.restDecoder), or(this.restDecoder)); } readRightID() { - return Za(Pa(this.restDecoder), Pa(this.restDecoder)); + return pr(or(this.restDecoder), or(this.restDecoder)); } readClient() { - return Pa(this.restDecoder); + return or(this.restDecoder); } readInfo() { - return uF(this.restDecoder); + return Mg(this.restDecoder); } readString() { - return i8(this.restDecoder); + return Hh(this.restDecoder); } readParentInfo() { - return Pa(this.restDecoder) === 1; + return or(this.restDecoder) === 1; } readTypeRef() { - return Pa(this.restDecoder); + return or(this.restDecoder); } readLen() { - return Pa(this.restDecoder); + return or(this.restDecoder); } readAny() { - return MK(this.restDecoder); + return zy(this.restDecoder); } readBuf() { - return lEn(wg(this.restDecoder)); + return Bke(Es(this.restDecoder)); } readJSON() { - return JSON.parse(i8(this.restDecoder)); + return JSON.parse(Hh(this.restDecoder)); } readKey() { - return i8(this.restDecoder); + return Hh(this.restDecoder); } } -class PEn { - constructor(n) { - this.dsCurrVal = 0, this.restDecoder = n; +class oSe { + constructor(e) { + this.dsCurrVal = 0, this.restDecoder = e; } resetDsCurVal() { this.dsCurrVal = 0; } readDsClock() { - return this.dsCurrVal += Pa(this.restDecoder), this.dsCurrVal; + return this.dsCurrVal += or(this.restDecoder), this.dsCurrVal; } readDsLen() { - const n = Pa(this.restDecoder) + 1; - return this.dsCurrVal += n, n; + const e = or(this.restDecoder) + 1; + return this.dsCurrVal += e, e; } } -class dF extends PEn { - constructor(n) { - super(n), this.keys = [], Pa(n), this.keyClockDecoder = new QRe(wg(n)), this.clientDecoder = new nbe(wg(n)), this.leftClockDecoder = new QRe(wg(n)), this.rightClockDecoder = new QRe(wg(n)), this.infoDecoder = new cEt(wg(n), uF), this.stringDecoder = new NCn(wg(n)), this.parentInfoDecoder = new cEt(wg(n), uF), this.typeRefDecoder = new nbe(wg(n)), this.lenDecoder = new nbe(wg(n)); +class Ig extends oSe { + constructor(e) { + super(e), this.keys = [], or(e), this.keyClockDecoder = new PE(Es(e)), this.clientDecoder = new d4(Es(e)), this.leftClockDecoder = new PE(Es(e)), this.rightClockDecoder = new PE(Es(e)), this.infoDecoder = new $F(Es(e), Mg), this.stringDecoder = new uke(Es(e)), this.parentInfoDecoder = new $F(Es(e), Mg), this.typeRefDecoder = new d4(Es(e)), this.lenDecoder = new d4(Es(e)); } readLeftID() { - return new RB(this.clientDecoder.read(), this.leftClockDecoder.read()); + return new Zp(this.clientDecoder.read(), this.leftClockDecoder.read()); } readRightID() { - return new RB(this.clientDecoder.read(), this.rightClockDecoder.read()); + return new Zp(this.clientDecoder.read(), this.rightClockDecoder.read()); } readClient() { return this.clientDecoder.read(); @@ -16815,686 +16824,686 @@ class dF extends PEn { return this.lenDecoder.read(); } readAny() { - return MK(this.restDecoder); + return zy(this.restDecoder); } readBuf() { - return wg(this.restDecoder); + return Es(this.restDecoder); } readJSON() { - return MK(this.restDecoder); + return zy(this.restDecoder); } readKey() { - const n = this.keyClockDecoder.read(); - if (n < this.keys.length) - return this.keys[n]; + const e = this.keyClockDecoder.read(); + if (e < this.keys.length) + return this.keys[e]; { - const s = this.stringDecoder.read(); - return this.keys.push(s), s; + const r = this.stringDecoder.read(); + return this.keys.push(r), r; } } } -class iIt { +class vee { constructor() { - this.restEncoder = Og(); + this.restEncoder = _s(); } toUint8Array() { - return Sf(this.restEncoder); + return Ln(this.restEncoder); } resetDsCurVal() { } - writeDsClock(n) { - Eo(this.restEncoder, n); + writeDsClock(e) { + Wt(this.restEncoder, e); } - writeDsLen(n) { - Eo(this.restEncoder, n); + writeDsLen(e) { + Wt(this.restEncoder, e); } } -class QJ extends iIt { - writeLeftID(n) { - Eo(this.restEncoder, n.client), Eo(this.restEncoder, n.clock); +class Jb extends vee { + writeLeftID(e) { + Wt(this.restEncoder, e.client), Wt(this.restEncoder, e.clock); } - writeRightID(n) { - Eo(this.restEncoder, n.client), Eo(this.restEncoder, n.clock); + writeRightID(e) { + Wt(this.restEncoder, e.client), Wt(this.restEncoder, e.clock); } - writeClient(n) { - Eo(this.restEncoder, n); + writeClient(e) { + Wt(this.restEncoder, e); } - writeInfo(n) { - BFe(this.restEncoder, n); + writeInfo(e) { + E7(this.restEncoder, e); } - writeString(n) { - ZM(this.restEncoder, n); + writeString(e) { + Ud(this.restEncoder, e); } - writeParentInfo(n) { - Eo(this.restEncoder, n ? 1 : 0); + writeParentInfo(e) { + Wt(this.restEncoder, e ? 1 : 0); } - writeTypeRef(n) { - Eo(this.restEncoder, n); + writeTypeRef(e) { + Wt(this.restEncoder, e); } - writeLen(n) { - Eo(this.restEncoder, n); + writeLen(e) { + Wt(this.restEncoder, e); } - writeAny(n) { - DK(this.restEncoder, n); + writeAny(e) { + Fy(this.restEncoder, e); } - writeBuf(n) { - Ld(this.restEncoder, n); + writeBuf(e) { + Xn(this.restEncoder, e); } - writeJSON(n) { - ZM(this.restEncoder, JSON.stringify(n)); + writeJSON(e) { + Ud(this.restEncoder, JSON.stringify(e)); } - writeKey(n) { - ZM(this.restEncoder, n); + writeKey(e) { + Ud(this.restEncoder, e); } } -class sIt { +class yee { constructor() { - this.restEncoder = Og(), this.dsCurrVal = 0; + this.restEncoder = _s(), this.dsCurrVal = 0; } toUint8Array() { - return Sf(this.restEncoder); + return Ln(this.restEncoder); } resetDsCurVal() { this.dsCurrVal = 0; } - writeDsClock(n) { - const s = n - this.dsCurrVal; - this.dsCurrVal = n, Eo(this.restEncoder, s); + writeDsClock(e) { + const r = e - this.dsCurrVal; + this.dsCurrVal = e, Wt(this.restEncoder, r); } - writeDsLen(n) { - n === 0 && vk(), Eo(this.restEncoder, n - 1), this.dsCurrVal += n; + writeDsLen(e) { + e === 0 && Il(), Wt(this.restEncoder, e - 1), this.dsCurrVal += e; } } -class aP extends sIt { +class Kd extends yee { constructor() { - super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new jRe(), this.clientEncoder = new tbe(), this.leftClockEncoder = new jRe(), this.rightClockEncoder = new jRe(), this.infoEncoder = new sEt(BFe), this.stringEncoder = new CCn(), this.parentInfoEncoder = new sEt(BFe), this.typeRefEncoder = new tbe(), this.lenEncoder = new tbe(); + super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new IE(), this.clientEncoder = new f4(), this.leftClockEncoder = new IE(), this.rightClockEncoder = new IE(), this.infoEncoder = new NF(E7), this.stringEncoder = new tke(), this.parentInfoEncoder = new NF(E7), this.typeRefEncoder = new f4(), this.lenEncoder = new f4(); } toUint8Array() { - const n = Og(); - return Eo(n, 0), Ld(n, this.keyClockEncoder.toUint8Array()), Ld(n, this.clientEncoder.toUint8Array()), Ld(n, this.leftClockEncoder.toUint8Array()), Ld(n, this.rightClockEncoder.toUint8Array()), Ld(n, Sf(this.infoEncoder)), Ld(n, this.stringEncoder.toUint8Array()), Ld(n, Sf(this.parentInfoEncoder)), Ld(n, this.typeRefEncoder.toUint8Array()), Ld(n, this.lenEncoder.toUint8Array()), lwe(n, Sf(this.restEncoder)), Sf(n); + const e = _s(); + return Wt(e, 0), Xn(e, this.keyClockEncoder.toUint8Array()), Xn(e, this.clientEncoder.toUint8Array()), Xn(e, this.leftClockEncoder.toUint8Array()), Xn(e, this.rightClockEncoder.toUint8Array()), Xn(e, Ln(this.infoEncoder)), Xn(e, this.stringEncoder.toUint8Array()), Xn(e, Ln(this.parentInfoEncoder)), Xn(e, this.typeRefEncoder.toUint8Array()), Xn(e, this.lenEncoder.toUint8Array()), HS(e, Ln(this.restEncoder)), Ln(e); } - writeLeftID(n) { - this.clientEncoder.write(n.client), this.leftClockEncoder.write(n.clock); + writeLeftID(e) { + this.clientEncoder.write(e.client), this.leftClockEncoder.write(e.clock); } - writeRightID(n) { - this.clientEncoder.write(n.client), this.rightClockEncoder.write(n.clock); + writeRightID(e) { + this.clientEncoder.write(e.client), this.rightClockEncoder.write(e.clock); } - writeClient(n) { - this.clientEncoder.write(n); + writeClient(e) { + this.clientEncoder.write(e); } - writeInfo(n) { - this.infoEncoder.write(n); + writeInfo(e) { + this.infoEncoder.write(e); } - writeString(n) { - this.stringEncoder.write(n); + writeString(e) { + this.stringEncoder.write(e); } - writeParentInfo(n) { - this.parentInfoEncoder.write(n ? 1 : 0); + writeParentInfo(e) { + this.parentInfoEncoder.write(e ? 1 : 0); } - writeTypeRef(n) { - this.typeRefEncoder.write(n); + writeTypeRef(e) { + this.typeRefEncoder.write(e); } - writeLen(n) { - this.lenEncoder.write(n); + writeLen(e) { + this.lenEncoder.write(e); } - writeAny(n) { - DK(this.restEncoder, n); + writeAny(e) { + Fy(this.restEncoder, e); } - writeBuf(n) { - Ld(this.restEncoder, n); + writeBuf(e) { + Xn(this.restEncoder, e); } - writeJSON(n) { - DK(this.restEncoder, n); + writeJSON(e) { + Fy(this.restEncoder, e); } - writeKey(n) { - const s = this.keyMap.get(n); - s === void 0 ? (this.keyClockEncoder.write(this.keyClock++), this.stringEncoder.write(n)) : this.keyClockEncoder.write(s); + writeKey(e) { + const r = this.keyMap.get(e); + r === void 0 ? (this.keyClockEncoder.write(this.keyClock++), this.stringEncoder.write(e)) : this.keyClockEncoder.write(r); } } -const LEn = (r, n, s, a) => { - a = T8(a, n[0].id.clock); - const l = lx(n, a); - Eo(r.restEncoder, n.length - l), r.writeClient(s), Eo(r.restEncoder, a); - const h = n[l]; - h.write(r, a - h.id.clock); - for (let f = l + 1; f < n.length; f++) - n[f].write(r, 0); -}, Zze = (r, n, s) => { - const a = /* @__PURE__ */ new Map(); - s.forEach((l, h) => { - jd(n, h) > l && a.set(h, l); - }), hwe(n).forEach((l, h) => { - s.has(h) || a.set(h, 0); - }), Eo(r.restEncoder, a.size), w8(a.entries()).sort((l, h) => h[0] - l[0]).forEach(([l, h]) => { - LEn(r, n.clients.get(l), l, h); +const lSe = (t, e, r, n) => { + n = Bf(n, e[0].id.clock); + const i = Nc(e, n); + Wt(t.restEncoder, e.length - i), t.writeClient(r), Wt(t.restEncoder, n); + const s = e[i]; + s.write(t, n - s.id.clock); + for (let a = i + 1; a < e.length; a++) + e[a].write(t, 0); +}, OM = (t, e, r) => { + const n = /* @__PURE__ */ new Map(); + r.forEach((i, s) => { + ti(e, s) > i && n.set(s, i); + }), ZS(e).forEach((i, s) => { + r.has(s) || n.set(s, 0); + }), Wt(t.restEncoder, n.size), hf(n.entries()).sort((i, s) => s[0] - i[0]).forEach(([i, s]) => { + lSe(t, e.clients.get(i), i, s); }); -}, IEn = (r, n) => { - const s = uk(), a = Pa(r.restDecoder); - for (let l = 0; l < a; l++) { - const h = Pa(r.restDecoder), f = new Array(h), b = r.readClient(); - let w = Pa(r.restDecoder); - s.set(b, { i: 0, refs: f }); - for (let O = 0; O < h; O++) { - const S = r.readInfo(); - switch (cwe & S) { +}, cSe = (t, e) => { + const r = xl(), n = or(t.restDecoder); + for (let i = 0; i < n; i++) { + const s = or(t.restDecoder), a = new Array(s), o = t.readClient(); + let l = or(t.restDecoder); + r.set(o, { i: 0, refs: a }); + for (let u = 0; u < s; u++) { + const h = t.readInfo(); + switch (GS & h) { case 0: { - const E = r.readLen(); - f[O] = new jy(Za(b, w), E), w += E; + const f = t.readLen(); + a[u] = new _o(pr(o, l), f), l += f; break; } case 10: { - const E = Pa(r.restDecoder); - f[O] = new Qy(Za(b, w), E), w += E; + const f = or(t.restDecoder); + a[u] = new Ao(pr(o, l), f), l += f; break; } default: { - const E = (S & (J6 | j2)) === 0, D = new Gu( - Za(b, w), + const f = (h & (Eu | so)) === 0, d = new rn( + pr(o, l), null, - (S & j2) === j2 ? r.readLeftID() : null, + (h & so) === so ? t.readLeftID() : null, null, - (S & J6) === J6 ? r.readRightID() : null, - E ? r.readParentInfo() ? n.get(r.readString()) : r.readLeftID() : null, - E && (S & TK) === TK ? r.readString() : null, - IIt(r, S) + (h & Eu) === Eu ? t.readRightID() : null, + f ? t.readParentInfo() ? e.get(t.readString()) : t.readLeftID() : null, + f && (h & $y) === $y ? t.readString() : null, + Gee(t, h) ); - f[O] = D, w += D.length; + a[u] = d, l += d.length; } } } } - return s; -}, NEn = (r, n, s) => { - const a = []; - let l = w8(s.keys()).sort((M, B) => M - B); - if (l.length === 0) + return r; +}, uSe = (t, e, r) => { + const n = []; + let i = hf(r.keys()).sort((p, g) => p - g); + if (i.length === 0) return null; - const h = () => { - if (l.length === 0) + const s = () => { + if (i.length === 0) return null; - let M = s.get(l[l.length - 1]); - for (; M.refs.length === M.i; ) - if (l.pop(), l.length > 0) - M = s.get(l[l.length - 1]); + let p = r.get(i[i.length - 1]); + for (; p.refs.length === p.i; ) + if (i.pop(), i.length > 0) + p = r.get(i[i.length - 1]); else return null; - return M; + return p; }; - let f = h(); - if (f === null) + let a = s(); + if (a === null) return null; - const b = new fIt(), w = /* @__PURE__ */ new Map(), O = (M, B) => { - const z = w.get(M); - (z == null || z > B) && w.set(M, B); + const o = new Tee(), l = /* @__PURE__ */ new Map(), u = (p, g) => { + const m = l.get(p); + (m == null || m > g) && l.set(p, g); }; - let S = f.refs[f.i++]; - const E = /* @__PURE__ */ new Map(), D = () => { - for (const M of a) { - const B = M.id.client, z = s.get(B); - z ? (z.i--, b.clients.set(B, z.refs.slice(z.i)), s.delete(B), z.i = 0, z.refs = []) : b.clients.set(B, [M]), l = l.filter((W) => W !== B); + let h = a.refs[a.i++]; + const f = /* @__PURE__ */ new Map(), d = () => { + for (const p of n) { + const g = p.id.client, m = r.get(g); + m ? (m.i--, o.clients.set(g, m.refs.slice(m.i)), r.delete(g), m.i = 0, m.refs = []) : o.clients.set(g, [p]), i = i.filter((v) => v !== g); } - a.length = 0; + n.length = 0; }; for (; ; ) { - if (S.constructor !== Qy) { - const B = g_(E, S.id.client, () => jd(n, S.id.client)) - S.id.clock; - if (B < 0) - a.push(S), O(S.id.client, S.id.clock - 1), D(); + if (h.constructor !== Ao) { + const g = rh(f, h.id.client, () => ti(e, h.id.client)) - h.id.clock; + if (g < 0) + n.push(h), u(h.id.client, h.id.clock - 1), d(); else { - const z = S.getMissing(r, n); - if (z !== null) { - a.push(S); - const W = s.get(z) || { refs: [], i: 0 }; - if (W.refs.length === W.i) - O(z, jd(n, z)), D(); + const m = h.getMissing(t, e); + if (m !== null) { + n.push(h); + const v = r.get(m) || { refs: [], i: 0 }; + if (v.refs.length === v.i) + u(m, ti(e, m)), d(); else { - S = W.refs[W.i++]; + h = v.refs[v.i++]; continue; } } else - (B === 0 || B < S.length) && (S.integrate(r, B), E.set(S.id.client, S.id.clock + S.length)); + (g === 0 || g < h.length) && (h.integrate(t, g), f.set(h.id.client, h.id.clock + h.length)); } } - if (a.length > 0) - S = a.pop(); - else if (f !== null && f.i < f.refs.length) - S = f.refs[f.i++]; + if (n.length > 0) + h = n.pop(); + else if (a !== null && a.i < a.refs.length) + h = a.refs[a.i++]; else { - if (f = h(), f === null) + if (a = s(), a === null) break; - S = f.refs[f.i++]; + h = a.refs[a.i++]; } } - if (b.clients.size > 0) { - const M = new aP(); - return Zze(M, b, /* @__PURE__ */ new Map()), Eo(M.restEncoder, 0), { missing: w, update: M.toUint8Array() }; + if (o.clients.size > 0) { + const p = new Kd(); + return OM(p, o, /* @__PURE__ */ new Map()), Wt(p.restEncoder, 0), { missing: l, update: p.toUint8Array() }; } return null; -}, REn = (r, n) => Zze(r, n.doc.store, n.beforeState), $En = (r, n, s, a = new dF(r)) => Yu(n, (l) => { - l.local = !1; - let h = !1; - const f = l.doc, b = f.store, w = IEn(a, f), O = NEn(l, b, w), S = b.pendingStructs; - if (S) { - for (const [D, M] of S.missing) - if (M < jd(b, D)) { - h = !0; +}, hSe = (t, e) => OM(t, e.doc.store, e.beforeState), fSe = (t, e, r, n = new Ig(t)) => tn(e, (i) => { + i.local = !1; + let s = !1; + const a = i.doc, o = a.store, l = cSe(n, a), u = uSe(i, o, l), h = o.pendingStructs; + if (h) { + for (const [d, p] of h.missing) + if (p < ti(o, d)) { + s = !0; break; } - if (O) { - for (const [D, M] of O.missing) { - const B = S.missing.get(D); - (B == null || B > M) && S.missing.set(D, M); + if (u) { + for (const [d, p] of u.missing) { + const g = h.missing.get(d); + (g == null || g > p) && h.missing.set(d, p); } - S.update = uve([S.update, O.update]); + h.update = z5([h.update, u.update]); } } else - b.pendingStructs = O; - const E = fEt(a, l, b); - if (b.pendingDs) { - const D = new dF(A8(b.pendingDs)); - Pa(D.restDecoder); - const M = fEt(D, l, b); - E && M ? b.pendingDs = uve([E, M]) : b.pendingDs = E || M; + o.pendingStructs = u; + const f = VF(n, i, o); + if (o.pendingDs) { + const d = new Ig(Ff(o.pendingDs)); + or(d.restDecoder); + const p = VF(d, i, o); + f && p ? o.pendingDs = z5([f, p]) : o.pendingDs = f || p; } else - b.pendingDs = E; - if (h) { - const D = b.pendingStructs.update; - b.pendingStructs = null, oIt(l.doc, D); - } -}, s, !1), oIt = (r, n, s, a = dF) => { - const l = A8(n); - $En(l, r, s, new a(l)); -}, BEn = (r, n, s) => oIt(r, n, s, rIt), FEn = (r, n, s = /* @__PURE__ */ new Map()) => { - Zze(r, n.store, s), tj(r, MEn(n.store)); -}, jEn = (r, n = new Uint8Array([0]), s = new aP()) => { - const a = aIt(n); - FEn(s, r, a); - const l = [s.toUint8Array()]; - if (r.store.pendingDs && l.push(r.store.pendingDs), r.store.pendingStructs && l.push(oTn(r.store.pendingStructs.update, n)), l.length > 1) { - if (s.constructor === QJ) - return iTn(l.map((h, f) => f === 0 ? h : cTn(h))); - if (s.constructor === aP) - return uve(l); - } - return l[0]; -}, QEn = (r, n) => jEn(r, n, new QJ()), zEn = (r) => { - const n = /* @__PURE__ */ new Map(), s = Pa(r.restDecoder); - for (let a = 0; a < s; a++) { - const l = Pa(r.restDecoder), h = Pa(r.restDecoder); - n.set(l, h); - } - return n; -}, aIt = (r) => zEn(new nIt(A8(r))), cIt = (r, n) => (Eo(r.restEncoder, n.size), w8(n.entries()).sort((s, a) => a[0] - s[0]).forEach(([s, a]) => { - Eo(r.restEncoder, s), Eo(r.restEncoder, a); -}), r), qEn = (r, n) => cIt(r, hwe(n.store)), VEn = (r, n = new sIt()) => (r instanceof Map ? cIt(n, r) : qEn(n, r), n.toUint8Array()), UEn = (r) => VEn(r, new iIt()); -class WEn { + o.pendingDs = f; + if (s) { + const d = o.pendingStructs.update; + o.pendingStructs = null, bee(i.doc, d); + } +}, r, !1), bee = (t, e, r, n = Ig) => { + const i = Ff(e); + fSe(i, t, r, new n(i)); +}, dSe = (t, e, r) => bee(t, e, r, mee), pSe = (t, e, r = /* @__PURE__ */ new Map()) => { + OM(t, e.store, r), z1(t, aSe(e.store)); +}, gSe = (t, e = new Uint8Array([0]), r = new Kd()) => { + const n = xee(e); + pSe(r, t, n); + const i = [r.toUint8Array()]; + if (t.store.pendingDs && i.push(t.store.pendingDs), t.store.pendingStructs && i.push(ISe(t.store.pendingStructs.update, e)), i.length > 1) { + if (r.constructor === Jb) + return DSe(i.map((s, a) => a === 0 ? s : $Se(s))); + if (r.constructor === Kd) + return z5(i); + } + return i[0]; +}, mSe = (t, e) => gSe(t, e, new Jb()), vSe = (t) => { + const e = /* @__PURE__ */ new Map(), r = or(t.restDecoder); + for (let n = 0; n < r; n++) { + const i = or(t.restDecoder), s = or(t.restDecoder); + e.set(i, s); + } + return e; +}, xee = (t) => vSe(new gee(Ff(t))), wee = (t, e) => (Wt(t.restEncoder, e.size), hf(e.entries()).sort((r, n) => n[0] - r[0]).forEach(([r, n]) => { + Wt(t.restEncoder, r), Wt(t.restEncoder, n); +}), t), ySe = (t, e) => wee(t, ZS(e.store)), bSe = (t, e = new yee()) => (t instanceof Map ? wee(e, t) : ySe(e, t), e.toUint8Array()), xSe = (t) => bSe(t, new vee()); +class wSe { constructor() { this.l = []; } } -const dEt = () => new WEn(), pEt = (r, n) => r.l.push(n), gEt = (r, n) => { - const s = r.l, a = s.length; - r.l = s.filter((l) => n !== l), a === r.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist."); -}, lIt = (r, n, s) => Uze(r.l, [n, s]); -class RB { - constructor(n, s) { - this.client = n, this.clock = s; +const UF = () => new wSe(), qF = (t, e) => t.l.push(e), QF = (t, e) => { + const r = t.l, n = r.length; + t.l = r.filter((i) => e !== i), n === t.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist."); +}, Oee = (t, e, r) => vM(t.l, [e, r]); +class Zp { + constructor(e, r) { + this.client = e, this.clock = r; } } -const vB = (r, n) => r === n || r !== null && n !== null && r.client === n.client && r.clock === n.clock, Za = (r, n) => new RB(r, n), uIt = (r) => { - for (const [n, s] of r.doc.share.entries()) - if (s === r) - return n; - throw vk(); -}, lve = (r, n) => { - for (; n !== null; ) { - if (n.parent === r) +const Rp = (t, e) => t === e || t !== null && e !== null && t.client === e.client && t.clock === e.clock, pr = (t, e) => new Zp(t, e), kee = (t) => { + for (const [e, r] of t.doc.share.entries()) + if (r === t) + return e; + throw Il(); +}, F5 = (t, e) => { + for (; e !== null; ) { + if (e.parent === t) return !0; - n = n.parent._item; + e = e.parent._item; } return !1; }; -class hIt { - constructor(n, s, a, l = 0) { - this.type = n, this.tname = s, this.item = a, this.assoc = l; +class See { + constructor(e, r, n, i = 0) { + this.type = e, this.tname = r, this.item = n, this.assoc = i; + } +} +const YF = (t) => { + const e = {}; + return t.type && (e.type = t.type), t.tname && (e.tname = t.tname), t.item && (e.item = t.item), t.assoc != null && (e.assoc = t.assoc), e; +}, Uy = (t) => new See(t.type == null ? null : pr(t.type.client, t.type.clock), t.tname || null, t.item == null ? null : pr(t.item.client, t.item.clock), t.assoc == null ? 0 : t.assoc); +class OSe { + constructor(e, r, n = 0) { + this.type = e, this.index = r, this.assoc = n; + } +} +const kSe = (t, e, r = 0) => new OSe(t, e, r), Rw = (t, e, r) => { + let n = null, i = null; + return t._item === null ? i = kee(t) : n = pr(t._item.id.client, t._item.id.clock), new See(n, i, e, r); +}, M7 = (t, e, r = 0) => { + let n = t._start; + if (r < 0) { + if (e === 0) + return Rw(t, null, r); + e--; } -} -const mEt = (r) => { - const n = {}; - return r.type && (n.type = r.type), r.tname && (n.tname = r.tname), r.item && (n.item = r.item), r.assoc != null && (n.assoc = r.assoc), n; -}, LK = (r) => new hIt(r.type == null ? null : Za(r.type.client, r.type.clock), r.tname || null, r.item == null ? null : Za(r.item.client, r.item.clock), r.assoc == null ? 0 : r.assoc); -class YEn { - constructor(n, s, a = 0) { - this.type = n, this.index = s, this.assoc = a; - } -} -const HEn = (r, n, s = 0) => new YEn(r, n, s), rme = (r, n, s) => { - let a = null, l = null; - return r._item === null ? l = uIt(r) : a = Za(r._item.id.client, r._item.id.clock), new hIt(a, l, n, s); -}, qFe = (r, n, s = 0) => { - let a = r._start; - if (s < 0) { - if (n === 0) - return rme(r, null, s); - n--; + for (; n !== null; ) { + if (!n.deleted && n.countable) { + if (n.length > e) + return Rw(t, pr(n.id.client, n.id.clock + e), r); + e -= n.length; + } + if (n.right === null && r < 0) + return Rw(t, n.lastId, r); + n = n.right; } - for (; a !== null; ) { - if (!a.deleted && a.countable) { - if (a.length > n) - return rme(r, Za(a.id.client, a.id.clock + n), s); - n -= a.length; - } - if (a.right === null && s < 0) - return rme(r, a.lastId, s); - a = a.right; - } - return rme(r, null, s); -}, VFe = (r, n) => { - const s = n.store, a = r.item, l = r.type, h = r.tname, f = r.assoc; - let b = null, w = 0; - if (a !== null) { - if (jd(s, a.client) <= a.clock) + return Rw(t, null, r); +}, D7 = (t, e) => { + const r = e.store, n = t.item, i = t.type, s = t.tname, a = t.assoc; + let o = null, l = 0; + if (n !== null) { + if (ti(r, n.client) <= n.clock) return null; - const O = HFe(s, a), S = O.item; - if (!(S instanceof Gu)) + const u = $7(r, n), h = u.item; + if (!(h instanceof rn)) return null; - if (b = S.parent, b._item === null || !b._item.deleted) { - w = S.deleted || !S.countable ? 0 : O.diff + (f >= 0 ? 0 : 1); - let E = S.left; - for (; E !== null; ) - !E.deleted && E.countable && (w += E.length), E = E.left; + if (o = h.parent, o._item === null || !o._item.deleted) { + l = h.deleted || !h.countable ? 0 : u.diff + (a >= 0 ? 0 : 1); + let f = h.left; + for (; f !== null; ) + !f.deleted && f.countable && (l += f.length), f = f.left; } } else { - if (h !== null) - b = n.get(h); - else if (l !== null) { - if (jd(s, l.client) <= l.clock) + if (s !== null) + o = e.get(s); + else if (i !== null) { + if (ti(r, i.client) <= i.clock) return null; - const { item: O } = HFe(s, l); - if (O instanceof Gu && O.content instanceof bx) - b = O.content.type; + const { item: u } = $7(r, i); + if (u instanceof rn && u.content instanceof Wc) + o = u.content.type; else return null; } else - throw vk(); - f >= 0 ? w = b._length : w = 0; - } - return HEn(b, w, r.assoc); -}, bEt = (r, n) => r === n || r !== null && n !== null && r.tname === n.tname && vB(r.item, n.item) && vB(r.type, n.type) && r.assoc === n.assoc; -class GEn { - constructor(n, s) { - this.ds = n, this.sv = s; - } -} -const ZEn = (r, n) => new GEn(r, n); -ZEn(eIt(), /* @__PURE__ */ new Map()); -const hB = (r, n) => n === void 0 ? !r.deleted : n.sv.has(r.id.client) && (n.sv.get(r.id.client) || 0) > r.id.clock && !jJ(n.ds, r.id), UFe = (r, n) => { - const s = g_(r.meta, UFe, oP), a = r.doc.store; - s.has(n) || (n.sv.forEach((l, h) => { - l < jd(a, h) && tv(r, Za(h, l)); - }), fF(r, n.ds, (l) => { - }), s.add(n)); -}; -class fIt { + throw Il(); + a >= 0 ? l = o._length : l = 0; + } + return kSe(o, l, t.assoc); +}, WF = (t, e) => t === e || t !== null && e !== null && t.tname === e.tname && Rp(t.item, e.item) && Rp(t.type, e.type) && t.assoc === e.assoc; +class SSe { + constructor(e, r) { + this.ds = e, this.sv = r; + } +} +const TSe = (t, e) => new SSe(t, e); +TSe(dee(), /* @__PURE__ */ new Map()); +const kp = (t, e) => e === void 0 ? !t.deleted : e.sv.has(t.id.client) && (e.sv.get(t.id.client) || 0) > t.id.clock && !Kb(e.ds, t.id), N7 = (t, e) => { + const r = rh(t.meta, N7, jd), n = t.doc.store; + r.has(e) || (e.sv.forEach((i, s) => { + i < ti(n, s) && Ca(t, pr(s, i)); + }), Ng(t, e.ds, (i) => { + }), r.add(e)); +}; +class Tee { constructor() { this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null; } } -const hwe = (r) => { - const n = /* @__PURE__ */ new Map(); - return r.clients.forEach((s, a) => { - const l = s[s.length - 1]; - n.set(a, l.id.clock + l.length); - }), n; -}, jd = (r, n) => { - const s = r.clients.get(n); - if (s === void 0) +const ZS = (t) => { + const e = /* @__PURE__ */ new Map(); + return t.clients.forEach((r, n) => { + const i = r[r.length - 1]; + e.set(n, i.id.clock + i.length); + }), e; +}, ti = (t, e) => { + const r = t.clients.get(e); + if (r === void 0) return 0; - const a = s[s.length - 1]; - return a.id.clock + a.length; -}, dIt = (r, n) => { - let s = r.clients.get(n.id.client); - if (s === void 0) - s = [], r.clients.set(n.id.client, s); + const n = r[r.length - 1]; + return n.id.clock + n.length; +}, Cee = (t, e) => { + let r = t.clients.get(e.id.client); + if (r === void 0) + r = [], t.clients.set(e.id.client, r); else { - const a = s[s.length - 1]; - if (a.id.clock + a.length !== n.id.clock) - throw vk(); - } - s.push(n); -}, lx = (r, n) => { - let s = 0, a = r.length - 1, l = r[a], h = l.id.clock; - if (h === n) - return a; - let f = l_(n / (h + l.length - 1) * a); - for (; s <= a; ) { - if (l = r[f], h = l.id.clock, h <= n) { - if (n < h + l.length) - return f; - s = f + 1; + const n = r[r.length - 1]; + if (n.id.clock + n.length !== e.id.clock) + throw Il(); + } + r.push(e); +}, Nc = (t, e) => { + let r = 0, n = t.length - 1, i = t[n], s = i.id.clock; + if (s === e) + return n; + let a = Fu(e / (s + i.length - 1) * n); + for (; r <= n; ) { + if (i = t[a], s = i.id.clock, s <= e) { + if (e < s + i.length) + return a; + r = a + 1; } else - a = f - 1; - f = l_((s + a) / 2); - } - throw vk(); -}, XEn = (r, n) => { - const s = r.clients.get(n.client); - return s[lx(s, n.clock)]; -}, rbe = XEn, WFe = (r, n, s) => { - const a = lx(n, s), l = n[a]; - return l.id.clock < s && l instanceof Gu ? (n.splice(a + 1, 0, mve(r, l, s - l.id.clock)), a + 1) : a; -}, tv = (r, n) => { - const s = r.doc.store.clients.get(n.client); - return s[WFe(r, s, n.clock)]; -}, vEt = (r, n, s) => { - const a = n.clients.get(s.client), l = lx(a, s.clock), h = a[l]; - return s.clock !== h.id.clock + h.length - 1 && h.constructor !== jy && a.splice(l + 1, 0, mve(r, h, s.clock - h.id.clock + 1)), h; -}, KEn = (r, n, s) => { - const a = r.clients.get(n.id.client); - a[lx(a, n.id.clock)] = s; -}, pIt = (r, n, s, a, l) => { - if (a === 0) + n = a - 1; + a = Fu((r + n) / 2); + } + throw Il(); +}, CSe = (t, e) => { + const r = t.clients.get(e.client); + return r[Nc(r, e.clock)]; +}, p4 = CSe, I7 = (t, e, r) => { + const n = Nc(e, r), i = e[n]; + return i.id.clock < r && i instanceof rn ? (e.splice(n + 1, 0, W5(t, i, r - i.id.clock)), n + 1) : n; +}, Ca = (t, e) => { + const r = t.doc.store.clients.get(e.client); + return r[I7(t, r, e.clock)]; +}, GF = (t, e, r) => { + const n = e.clients.get(r.client), i = Nc(n, r.clock), s = n[i]; + return r.clock !== s.id.clock + s.length - 1 && s.constructor !== _o && n.splice(i + 1, 0, W5(t, s, r.clock - s.id.clock + 1)), s; +}, ESe = (t, e, r) => { + const n = t.clients.get(e.id.client); + n[Nc(n, e.id.clock)] = r; +}, Eee = (t, e, r, n, i) => { + if (n === 0) return; - const h = s + a; - let f = WFe(r, n, s), b; + const s = r + n; + let a = I7(t, e, r), o; do - b = n[f++], h < b.id.clock + b.length && WFe(r, n, h), l(b); - while (f < n.length && n[f].id.clock < h); -}; -class JEn { - constructor(n, s, a) { - this.doc = n, this.deleteSet = new ej(), this.beforeState = hwe(n.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = s, this.meta = /* @__PURE__ */ new Map(), this.local = a, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1; - } -} -const wEt = (r, n) => n.deleteSet.clients.size === 0 && !iCn(n.afterState, (s, a) => n.beforeState.get(a) !== s) ? !1 : (Hze(n.deleteSet), REn(r, n), tj(r, n.deleteSet), !0), yEt = (r, n, s) => { - const a = n._item; - (a === null || a.id.clock < (r.beforeState.get(a.id.client) || 0) && !a.deleted) && g_(r.changed, n, oP).add(s); -}, ibe = (r, n) => { - let s = r[n], a = r[n - 1], l = n; - for (; l > 0; s = a, a = r[--l - 1]) { - if (a.deleted === s.deleted && a.constructor === s.constructor && a.mergeWith(s)) { - s instanceof Gu && s.parentSub !== null && s.parent._map.get(s.parentSub) === s && s.parent._map.set(s.parentSub, a); + o = e[a++], s < o.id.clock + o.length && I7(t, e, s), i(o); + while (a < e.length && e[a].id.clock < s); +}; +class _Se { + constructor(e, r, n) { + this.doc = e, this.deleteSet = new F1(), this.beforeState = ZS(e.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = r, this.meta = /* @__PURE__ */ new Map(), this.local = n, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1; + } +} +const HF = (t, e) => e.deleteSet.clients.size === 0 && !D3e(e.afterState, (r, n) => e.beforeState.get(n) !== r) ? !1 : (xM(e.deleteSet), hSe(t, e), z1(t, e.deleteSet), !0), XF = (t, e, r) => { + const n = e._item; + (n === null || n.id.clock < (t.beforeState.get(n.id.client) || 0) && !n.deleted) && rh(t.changed, e, jd).add(r); +}, g4 = (t, e) => { + let r = t[e], n = t[e - 1], i = e; + for (; i > 0; r = n, n = t[--i - 1]) { + if (n.deleted === r.deleted && n.constructor === r.constructor && n.mergeWith(r)) { + r instanceof rn && r.parentSub !== null && r.parent._map.get(r.parentSub) === r && r.parent._map.set(r.parentSub, n); continue; } break; } - const h = n - l; - return h && r.splice(n + 1 - h, h), h; -}, eTn = (r, n, s) => { - for (const [a, l] of r.clients.entries()) { - const h = n.clients.get(a); - for (let f = l.length - 1; f >= 0; f--) { - const b = l[f], w = b.clock + b.len; - for (let O = lx(h, b.clock), S = h[O]; O < h.length && S.id.clock < w; S = h[++O]) { - const E = h[O]; - if (b.clock + b.len <= E.id.clock) + const s = e - i; + return s && t.splice(e + 1 - s, s), s; +}, ASe = (t, e, r) => { + for (const [n, i] of t.clients.entries()) { + const s = e.clients.get(n); + for (let a = i.length - 1; a >= 0; a--) { + const o = i[a], l = o.clock + o.len; + for (let u = Nc(s, o.clock), h = s[u]; u < s.length && h.id.clock < l; h = s[++u]) { + const f = s[u]; + if (o.clock + o.len <= f.id.clock) break; - E instanceof Gu && E.deleted && !E.keep && s(E) && E.gc(n, !1); + f instanceof rn && f.deleted && !f.keep && r(f) && f.gc(e, !1); } } } -}, tTn = (r, n) => { - r.clients.forEach((s, a) => { - const l = n.clients.get(a); - for (let h = s.length - 1; h >= 0; h--) { - const f = s[h], b = awe(l.length - 1, 1 + lx(l, f.clock + f.len - 1)); - for (let w = b, O = l[w]; w > 0 && O.id.clock >= f.clock; O = l[w]) - w -= 1 + ibe(l, w); +}, LSe = (t, e) => { + t.clients.forEach((r, n) => { + const i = e.clients.get(n); + for (let s = r.length - 1; s >= 0; s--) { + const a = r[s], o = WS(i.length - 1, 1 + Nc(i, a.clock + a.len - 1)); + for (let l = o, u = i[l]; l > 0 && u.id.clock >= a.clock; u = i[l]) + l -= 1 + g4(i, l); } }); -}, gIt = (r, n) => { - if (n < r.length) { - const s = r[n], a = s.doc, l = a.store, h = s.deleteSet, f = s._mergeStructs; +}, _ee = (t, e) => { + if (e < t.length) { + const r = t[e], n = r.doc, i = n.store, s = r.deleteSet, a = r._mergeStructs; try { - Hze(h), s.afterState = hwe(s.doc.store), a.emit("beforeObserverCalls", [s, a]); - const b = []; - s.changed.forEach( - (w, O) => b.push(() => { - (O._item === null || !O._item.deleted) && O._callObserver(s, w); + xM(s), r.afterState = ZS(r.doc.store), n.emit("beforeObserverCalls", [r, n]); + const o = []; + r.changed.forEach( + (l, u) => o.push(() => { + (u._item === null || !u._item.deleted) && u._callObserver(r, l); }) - ), b.push(() => { - s.changedParentTypes.forEach((w, O) => { - O._dEH.l.length > 0 && (O._item === null || !O._item.deleted) && (w = w.filter( - (S) => S.target._item === null || !S.target._item.deleted - ), w.forEach((S) => { - S.currentTarget = O, S._path = null; - }), w.sort((S, E) => S.path.length - E.path.length), lIt(O._dEH, w, s)); + ), o.push(() => { + r.changedParentTypes.forEach((l, u) => { + u._dEH.l.length > 0 && (u._item === null || !u._item.deleted) && (l = l.filter( + (h) => h.target._item === null || !h.target._item.deleted + ), l.forEach((h) => { + h.currentTarget = u, h._path = null; + }), l.sort((h, f) => h.path.length - f.path.length), Oee(u._dEH, l, r)); }); - }), b.push(() => a.emit("afterTransaction", [s, a])), Uze(b, []), s._needFormattingCleanup && kTn(s); + }), o.push(() => n.emit("afterTransaction", [r, n])), vM(o, []), r._needFormattingCleanup && jSe(r); } finally { - a.gc && eTn(h, l, a.gcFilter), tTn(h, l), s.afterState.forEach((S, E) => { - const D = s.beforeState.get(E) || 0; - if (D !== S) { - const M = l.clients.get(E), B = T8(lx(M, D), 1); - for (let z = M.length - 1; z >= B; ) - z -= 1 + ibe(M, z); + n.gc && ASe(s, i, n.gcFilter), LSe(s, i), r.afterState.forEach((h, f) => { + const d = r.beforeState.get(f) || 0; + if (d !== h) { + const p = i.clients.get(f), g = Bf(Nc(p, d), 1); + for (let m = p.length - 1; m >= g; ) + m -= 1 + g4(p, m); } }); - for (let S = f.length - 1; S >= 0; S--) { - const { client: E, clock: D } = f[S].id, M = l.clients.get(E), B = lx(M, D); - B + 1 < M.length && ibe(M, B + 1) > 1 || B > 0 && ibe(M, B); + for (let h = a.length - 1; h >= 0; h--) { + const { client: f, clock: d } = a[h].id, p = i.clients.get(f), g = Nc(p, d); + g + 1 < p.length && g4(p, g + 1) > 1 || g > 0 && g4(p, g); } - if (!s.local && s.afterState.get(a.clientID) !== s.beforeState.get(a.clientID) && (EEn(Wze, HLt, "[yjs] ", GLt, ZLt, "Changed the client-id because another client seems to be using it."), a.clientID = tIt()), a.emit("afterTransactionCleanup", [s, a]), a._observers.has("update")) { - const S = new QJ(); - wEt(S, s) && a.emit("update", [S.toUint8Array(), s.origin, a, s]); + if (!r.local && r.afterState.get(n.clientID) !== r.beforeState.get(n.clientID) && (rSe(yM, oee, "[yjs] ", lee, cee, "Changed the client-id because another client seems to be using it."), n.clientID = pee()), n.emit("afterTransactionCleanup", [r, n]), n._observers.has("update")) { + const h = new Jb(); + HF(h, r) && n.emit("update", [h.toUint8Array(), r.origin, n, r]); } - if (a._observers.has("updateV2")) { - const S = new aP(); - wEt(S, s) && a.emit("updateV2", [S.toUint8Array(), s.origin, a, s]); + if (n._observers.has("updateV2")) { + const h = new Kd(); + HF(h, r) && n.emit("updateV2", [h.toUint8Array(), r.origin, n, r]); } - const { subdocsAdded: b, subdocsLoaded: w, subdocsRemoved: O } = s; - (b.size > 0 || O.size > 0 || w.size > 0) && (b.forEach((S) => { - S.clientID = a.clientID, S.collectionid == null && (S.collectionid = a.collectionid), a.subdocs.add(S); - }), O.forEach((S) => a.subdocs.delete(S)), a.emit("subdocs", [{ loaded: w, added: b, removed: O }, a, s]), O.forEach((S) => S.destroy())), r.length <= n + 1 ? (a._transactionCleanups = [], a.emit("afterAllTransactions", [a, r])) : gIt(r, n + 1); + const { subdocsAdded: o, subdocsLoaded: l, subdocsRemoved: u } = r; + (o.size > 0 || u.size > 0 || l.size > 0) && (o.forEach((h) => { + h.clientID = n.clientID, h.collectionid == null && (h.collectionid = n.collectionid), n.subdocs.add(h); + }), u.forEach((h) => n.subdocs.delete(h)), n.emit("subdocs", [{ loaded: l, added: o, removed: u }, n, r]), u.forEach((h) => h.destroy())), t.length <= e + 1 ? (n._transactionCleanups = [], n.emit("afterAllTransactions", [n, t])) : _ee(t, e + 1); } } -}, Yu = (r, n, s = null, a = !0) => { - const l = r._transactionCleanups; - let h = !1, f = null; - r._transaction === null && (h = !0, r._transaction = new JEn(r, s, a), l.push(r._transaction), l.length === 1 && r.emit("beforeAllTransactions", [r]), r.emit("beforeTransaction", [r._transaction, r])); +}, tn = (t, e, r = null, n = !0) => { + const i = t._transactionCleanups; + let s = !1, a = null; + t._transaction === null && (s = !0, t._transaction = new _Se(t, r, n), i.push(t._transaction), i.length === 1 && t.emit("beforeAllTransactions", [t]), t.emit("beforeTransaction", [t._transaction, t])); try { - f = n(r._transaction); + a = e(t._transaction); } finally { - if (h) { - const b = r._transaction === l[0]; - r._transaction = null, b && gIt(l, 0); + if (s) { + const o = t._transaction === i[0]; + t._transaction = null, o && _ee(i, 0); } } - return f; + return a; }; -class nTn { - constructor(n, s) { - this.insertions = s, this.deletions = n, this.meta = /* @__PURE__ */ new Map(); +class RSe { + constructor(e, r) { + this.insertions = r, this.deletions = e, this.meta = /* @__PURE__ */ new Map(); } } -const OEt = (r, n, s) => { - fF(r, s.deletions, (a) => { - a instanceof Gu && n.scope.some((l) => lve(l, a)) && sqe(a, !1); +const ZF = (t, e, r) => { + Ng(t, r.deletions, (n) => { + n instanceof rn && e.scope.some((i) => F5(i, n)) && RM(n, !1); }); -}, kEt = (r, n, s) => { - let a = null, l = null; - const h = r.doc, f = r.scope; - if (Yu(h, (b) => { - for (; n.length > 0 && a === null; ) { - const w = h.store, O = n.pop(), S = /* @__PURE__ */ new Set(), E = []; - let D = !1; - fF(b, O.insertions, (M) => { - if (M instanceof Gu) { - if (M.redone !== null) { - let { item: B, diff: z } = HFe(w, M.id); - z > 0 && (B = tv(b, Za(B.id.client, B.id.clock + z))), M = B; - } - !M.deleted && f.some((B) => lve(B, M)) && E.push(M); - } - }), fF(b, O.deletions, (M) => { - M instanceof Gu && f.some((B) => lve(B, M)) && !jJ(O.insertions, M.id) && S.add(M); - }), S.forEach((M) => { - D = LIt(b, M, S, O.insertions, r.ignoreRemoteMapChanges, r) !== null || D; +}, jF = (t, e, r) => { + let n = null, i = null; + const s = t.doc, a = t.scope; + if (tn(s, (o) => { + for (; e.length > 0 && n === null; ) { + const l = s.store, u = e.pop(), h = /* @__PURE__ */ new Set(), f = []; + let d = !1; + Ng(o, u.insertions, (p) => { + if (p instanceof rn) { + if (p.redone !== null) { + let { item: g, diff: m } = $7(l, p.id); + m > 0 && (g = Ca(o, pr(g.id.client, g.id.clock + m))), p = g; + } + !p.deleted && a.some((g) => F5(g, p)) && f.push(p); + } + }), Ng(o, u.deletions, (p) => { + p instanceof rn && a.some((g) => F5(g, p)) && !Kb(u.insertions, p.id) && h.add(p); + }), h.forEach((p) => { + d = Wee(o, p, h, u.insertions, t.ignoreRemoteMapChanges, t) !== null || d; }); - for (let M = E.length - 1; M >= 0; M--) { - const B = E[M]; - r.deleteFilter(B) && (B.delete(b), D = !0); + for (let p = f.length - 1; p >= 0; p--) { + const g = f[p]; + t.deleteFilter(g) && (g.delete(o), d = !0); } - a = D ? O : null; + n = d ? u : null; } - b.changed.forEach((w, O) => { - w.has(null) && O._searchMarker && (O._searchMarker.length = 0); - }), l = b; - }, r), a != null) { - const b = l.changedParentTypes; - r.emit("stack-item-popped", [{ stackItem: a, type: s, changedParentTypes: b }, r]); + o.changed.forEach((l, u) => { + l.has(null) && u._searchMarker && (u._searchMarker.length = 0); + }), i = o; + }, t), n != null) { + const o = i.changedParentTypes; + t.emit("stack-item-popped", [{ stackItem: n, type: r, changedParentTypes: o }, t]); } - return a; + return n; }; -class Xze extends owe { - constructor(n, { - captureTimeout: s = 500, - captureTransaction: a = (w) => !0, - deleteFilter: l = () => !0, - trackedOrigins: h = /* @__PURE__ */ new Set([null]), - ignoreRemoteMapChanges: f = !1, - doc: b = RFe(n) ? n[0].doc : n.doc +class kM extends YS { + constructor(e, { + captureTimeout: r = 500, + captureTransaction: n = (l) => !0, + deleteFilter: i = () => !0, + trackedOrigins: s = /* @__PURE__ */ new Set([null]), + ignoreRemoteMapChanges: a = !1, + doc: o = T7(e) ? e[0].doc : e.doc } = {}) { - super(), this.scope = [], this.doc = b, this.addToScope(n), this.deleteFilter = l, h.add(this), this.trackedOrigins = h, this.captureTransaction = a, this.undoStack = [], this.redoStack = [], this.undoing = !1, this.redoing = !1, this.lastChange = 0, this.ignoreRemoteMapChanges = f, this.captureTimeout = s, this.afterTransactionHandler = (w) => { - if (!this.captureTransaction(w) || !this.scope.some((W) => w.changedParentTypes.has(W)) || !this.trackedOrigins.has(w.origin) && (!w.origin || !this.trackedOrigins.has(w.origin.constructor))) + super(), this.scope = [], this.doc = o, this.addToScope(e), this.deleteFilter = i, s.add(this), this.trackedOrigins = s, this.captureTransaction = n, this.undoStack = [], this.redoStack = [], this.undoing = !1, this.redoing = !1, this.lastChange = 0, this.ignoreRemoteMapChanges = a, this.captureTimeout = r, this.afterTransactionHandler = (l) => { + if (!this.captureTransaction(l) || !this.scope.some((v) => l.changedParentTypes.has(v)) || !this.trackedOrigins.has(l.origin) && (!l.origin || !this.trackedOrigins.has(l.origin.constructor))) return; - const O = this.undoing, S = this.redoing, E = O ? this.redoStack : this.undoStack; - O ? this.stopCapturing() : S || this.clear(!1, !0); - const D = new ej(); - w.afterState.forEach((W, H) => { - const G = w.beforeState.get(H) || 0, ee = W - G; - ee > 0 && PK(D, H, G, ee); + const u = this.undoing, h = this.redoing, f = u ? this.redoStack : this.undoStack; + u ? this.stopCapturing() : h || this.clear(!1, !0); + const d = new F1(); + l.afterState.forEach((v, y) => { + const b = l.beforeState.get(y) || 0, w = v - b; + w > 0 && Vy(d, y, b, w); }); - const M = O8(); - let B = !1; - if (this.lastChange > 0 && M - this.lastChange < this.captureTimeout && E.length > 0 && !O && !S) { - const W = E[E.length - 1]; - W.deletions = zFe([W.deletions, w.deleteSet]), W.insertions = zFe([W.insertions, D]); + const p = df(); + let g = !1; + if (this.lastChange > 0 && p - this.lastChange < this.captureTimeout && f.length > 0 && !u && !h) { + const v = f[f.length - 1]; + v.deletions = R7([v.deletions, l.deleteSet]), v.insertions = R7([v.insertions, d]); } else - E.push(new nTn(w.deleteSet, D)), B = !0; - !O && !S && (this.lastChange = M), fF(w, w.deleteSet, (W) => { - W instanceof Gu && this.scope.some((H) => lve(H, W)) && sqe(W, !0); + f.push(new RSe(l.deleteSet, d)), g = !0; + !u && !h && (this.lastChange = p), Ng(l, l.deleteSet, (v) => { + v instanceof rn && this.scope.some((y) => F5(y, v)) && RM(v, !0); }); - const z = [{ stackItem: E[E.length - 1], origin: w.origin, type: O ? "redo" : "undo", changedParentTypes: w.changedParentTypes }, this]; - B ? this.emit("stack-item-added", z) : this.emit("stack-item-updated", z); + const m = [{ stackItem: f[f.length - 1], origin: l.origin, type: u ? "redo" : "undo", changedParentTypes: l.changedParentTypes }, this]; + g ? this.emit("stack-item-added", m) : this.emit("stack-item-updated", m); }, this.doc.on("afterTransaction", this.afterTransactionHandler), this.doc.on("destroy", () => { this.destroy(); }); } - addToScope(n) { - n = RFe(n) ? n : [n], n.forEach((s) => { - this.scope.every((a) => a !== s) && (s.doc !== this.doc && TEn("[yjs#509] Not same Y.Doc"), this.scope.push(s)); + addToScope(e) { + e = T7(e) ? e : [e], e.forEach((r) => { + this.scope.every((n) => n !== r) && (r.doc !== this.doc && nSe("[yjs#509] Not same Y.Doc"), this.scope.push(r)); }); } - addTrackedOrigin(n) { - this.trackedOrigins.add(n); + addTrackedOrigin(e) { + this.trackedOrigins.add(e); } - removeTrackedOrigin(n) { - this.trackedOrigins.delete(n); + removeTrackedOrigin(e) { + this.trackedOrigins.delete(e); } - clear(n = !0, s = !0) { - (n && this.canUndo() || s && this.canRedo()) && this.doc.transact((a) => { - n && (this.undoStack.forEach((l) => OEt(a, this, l)), this.undoStack = []), s && (this.redoStack.forEach((l) => OEt(a, this, l)), this.redoStack = []), this.emit("stack-cleared", [{ undoStackCleared: n, redoStackCleared: s }]); + clear(e = !0, r = !0) { + (e && this.canUndo() || r && this.canRedo()) && this.doc.transact((n) => { + e && (this.undoStack.forEach((i) => ZF(n, this, i)), this.undoStack = []), r && (this.redoStack.forEach((i) => ZF(n, this, i)), this.redoStack = []), this.emit("stack-cleared", [{ undoStackCleared: e, redoStackCleared: r }]); }); } stopCapturing() { @@ -17502,23 +17511,23 @@ class Xze extends owe { } undo() { this.undoing = !0; - let n; + let e; try { - n = kEt(this, this.undoStack, "undo"); + e = jF(this, this.undoStack, "undo"); } finally { this.undoing = !1; } - return n; + return e; } redo() { this.redoing = !0; - let n; + let e; try { - n = kEt(this, this.redoStack, "redo"); + e = jF(this, this.redoStack, "redo"); } finally { this.redoing = !1; } - return n; + return e; } canUndo() { return this.undoStack.length > 0; @@ -17530,703 +17539,703 @@ class Xze extends owe { this.trackedOrigins.delete(this), this.doc.off("afterTransaction", this.afterTransactionHandler), super.destroy(); } } -function* rTn(r) { - const n = Pa(r.restDecoder); - for (let s = 0; s < n; s++) { - const a = Pa(r.restDecoder), l = r.readClient(); - let h = Pa(r.restDecoder); - for (let f = 0; f < a; f++) { - const b = r.readInfo(); - if (b === 10) { - const w = Pa(r.restDecoder); - yield new Qy(Za(l, h), w), h += w; - } else if ((cwe & b) !== 0) { - const w = (b & (J6 | j2)) === 0, O = new Gu( - Za(l, h), +function* MSe(t) { + const e = or(t.restDecoder); + for (let r = 0; r < e; r++) { + const n = or(t.restDecoder), i = t.readClient(); + let s = or(t.restDecoder); + for (let a = 0; a < n; a++) { + const o = t.readInfo(); + if (o === 10) { + const l = or(t.restDecoder); + yield new Ao(pr(i, s), l), s += l; + } else if ((GS & o) !== 0) { + const l = (o & (Eu | so)) === 0, u = new rn( + pr(i, s), null, - (b & j2) === j2 ? r.readLeftID() : null, + (o & so) === so ? t.readLeftID() : null, null, - (b & J6) === J6 ? r.readRightID() : null, - w ? r.readParentInfo() ? r.readString() : r.readLeftID() : null, - w && (b & TK) === TK ? r.readString() : null, - IIt(r, b) + (o & Eu) === Eu ? t.readRightID() : null, + l ? t.readParentInfo() ? t.readString() : t.readLeftID() : null, + l && (o & $y) === $y ? t.readString() : null, + Gee(t, o) ); - yield O, h += O.length; + yield u, s += u.length; } else { - const w = r.readLen(); - yield new jy(Za(l, h), w), h += w; + const l = t.readLen(); + yield new _o(pr(i, s), l), s += l; } } } } -class Kze { - constructor(n, s) { - this.gen = rTn(n), this.curr = null, this.done = !1, this.filterSkips = s, this.next(); +class SM { + constructor(e, r) { + this.gen = MSe(e), this.curr = null, this.done = !1, this.filterSkips = r, this.next(); } next() { do this.curr = this.gen.next().value || null; - while (this.filterSkips && this.curr !== null && this.curr.constructor === Qy); + while (this.filterSkips && this.curr !== null && this.curr.constructor === Ao); return this.curr; } } -class Jze { - constructor(n) { - this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = n, this.clientStructs = []; +class TM { + constructor(e) { + this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = e, this.clientStructs = []; } } -const iTn = (r) => uve(r, rIt, QJ), sTn = (r, n) => { - if (r.constructor === jy) { - const { client: s, clock: a } = r.id; - return new jy(Za(s, a + n), r.length - n); - } else if (r.constructor === Qy) { - const { client: s, clock: a } = r.id; - return new Qy(Za(s, a + n), r.length - n); +const DSe = (t) => z5(t, mee, Jb), NSe = (t, e) => { + if (t.constructor === _o) { + const { client: r, clock: n } = t.id; + return new _o(pr(r, n + e), t.length - e); + } else if (t.constructor === Ao) { + const { client: r, clock: n } = t.id; + return new Ao(pr(r, n + e), t.length - e); } else { - const s = r, { client: a, clock: l } = s.id; - return new Gu( - Za(a, l + n), + const r = t, { client: n, clock: i } = r.id; + return new rn( + pr(n, i + e), null, - Za(a, l + n - 1), + pr(n, i + e - 1), null, - s.rightOrigin, - s.parent, - s.parentSub, - s.content.splice(n) + r.rightOrigin, + r.parent, + r.parentSub, + r.content.splice(e) ); } -}, uve = (r, n = dF, s = aP) => { - if (r.length === 1) - return r[0]; - const a = r.map((S) => new n(A8(S))); - let l = a.map((S) => new Kze(S, !0)), h = null; - const f = new s(), b = new Jze(f); - for (; l = l.filter((D) => D.curr !== null), l.sort( - (D, M) => { - if (D.curr.id.client === M.curr.id.client) { - const B = D.curr.id.clock - M.curr.id.clock; - return B === 0 ? D.curr.constructor === M.curr.constructor ? 0 : D.curr.constructor === Qy ? 1 : -1 : B; +}, z5 = (t, e = Ig, r = Kd) => { + if (t.length === 1) + return t[0]; + const n = t.map((h) => new e(Ff(h))); + let i = n.map((h) => new SM(h, !0)), s = null; + const a = new r(), o = new TM(a); + for (; i = i.filter((d) => d.curr !== null), i.sort( + (d, p) => { + if (d.curr.id.client === p.curr.id.client) { + const g = d.curr.id.clock - p.curr.id.clock; + return g === 0 ? d.curr.constructor === p.curr.constructor ? 0 : d.curr.constructor === Ao ? 1 : -1 : g; } else - return M.curr.id.client - D.curr.id.client; - } - ), l.length !== 0; ) { - const S = l[0], E = S.curr.id.client; - if (h !== null) { - let D = S.curr, M = !1; - for (; D !== null && D.id.clock + D.length <= h.struct.id.clock + h.struct.length && D.id.client >= h.struct.id.client; ) - D = S.next(), M = !0; - if (D === null || D.id.client !== E || M && D.id.clock > h.struct.id.clock + h.struct.length) + return p.curr.id.client - d.curr.id.client; + } + ), i.length !== 0; ) { + const h = i[0], f = h.curr.id.client; + if (s !== null) { + let d = h.curr, p = !1; + for (; d !== null && d.id.clock + d.length <= s.struct.id.clock + s.struct.length && d.id.client >= s.struct.id.client; ) + d = h.next(), p = !0; + if (d === null || d.id.client !== f || p && d.id.clock > s.struct.id.clock + s.struct.length) continue; - if (E !== h.struct.id.client) - UT(b, h.struct, h.offset), h = { struct: D, offset: 0 }, S.next(); - else if (h.struct.id.clock + h.struct.length < D.id.clock) - if (h.struct.constructor === Qy) - h.struct.length = D.id.clock + D.length - h.struct.id.clock; + if (f !== s.struct.id.client) + Eh(o, s.struct, s.offset), s = { struct: d, offset: 0 }, h.next(); + else if (s.struct.id.clock + s.struct.length < d.id.clock) + if (s.struct.constructor === Ao) + s.struct.length = d.id.clock + d.length - s.struct.id.clock; else { - UT(b, h.struct, h.offset); - const B = D.id.clock - h.struct.id.clock - h.struct.length; - h = { struct: new Qy(Za(E, h.struct.id.clock + h.struct.length), B), offset: 0 }; + Eh(o, s.struct, s.offset); + const g = d.id.clock - s.struct.id.clock - s.struct.length; + s = { struct: new Ao(pr(f, s.struct.id.clock + s.struct.length), g), offset: 0 }; } else { - const B = h.struct.id.clock + h.struct.length - D.id.clock; - B > 0 && (h.struct.constructor === Qy ? h.struct.length -= B : D = sTn(D, B)), h.struct.mergeWith(D) || (UT(b, h.struct, h.offset), h = { struct: D, offset: 0 }, S.next()); + const g = s.struct.id.clock + s.struct.length - d.id.clock; + g > 0 && (s.struct.constructor === Ao ? s.struct.length -= g : d = NSe(d, g)), s.struct.mergeWith(d) || (Eh(o, s.struct, s.offset), s = { struct: d, offset: 0 }, h.next()); } } else - h = { struct: S.curr, offset: 0 }, S.next(); - for (let D = S.curr; D !== null && D.id.client === E && D.id.clock === h.struct.id.clock + h.struct.length && D.constructor !== Qy; D = S.next()) - UT(b, h.struct, h.offset), h = { struct: D, offset: 0 }; - } - h !== null && (UT(b, h.struct, h.offset), h = null), eqe(b); - const w = a.map((S) => Gze(S)), O = zFe(w); - return tj(f, O), f.toUint8Array(); -}, oTn = (r, n, s = dF, a = aP) => { - const l = aIt(n), h = new a(), f = new Jze(h), b = new s(A8(r)), w = new Kze(b, !1); - for (; w.curr; ) { - const S = w.curr, E = S.id.client, D = l.get(E) || 0; - if (w.curr.constructor === Qy) { - w.next(); + s = { struct: h.curr, offset: 0 }, h.next(); + for (let d = h.curr; d !== null && d.id.client === f && d.id.clock === s.struct.id.clock + s.struct.length && d.constructor !== Ao; d = h.next()) + Eh(o, s.struct, s.offset), s = { struct: d, offset: 0 }; + } + s !== null && (Eh(o, s.struct, s.offset), s = null), CM(o); + const l = n.map((h) => wM(h)), u = R7(l); + return z1(a, u), a.toUint8Array(); +}, ISe = (t, e, r = Ig, n = Kd) => { + const i = xee(e), s = new n(), a = new TM(s), o = new r(Ff(t)), l = new SM(o, !1); + for (; l.curr; ) { + const h = l.curr, f = h.id.client, d = i.get(f) || 0; + if (l.curr.constructor === Ao) { + l.next(); continue; } - if (S.id.clock + S.length > D) - for (UT(f, S, T8(D - S.id.clock, 0)), w.next(); w.curr && w.curr.id.client === E; ) - UT(f, w.curr, 0), w.next(); + if (h.id.clock + h.length > d) + for (Eh(a, h, Bf(d - h.id.clock, 0)), l.next(); l.curr && l.curr.id.client === f; ) + Eh(a, l.curr, 0), l.next(); else - for (; w.curr && w.curr.id.client === E && w.curr.id.clock + w.curr.length <= D; ) - w.next(); - } - eqe(f); - const O = Gze(b); - return tj(h, O), h.toUint8Array(); -}, mIt = (r) => { - r.written > 0 && (r.clientStructs.push({ written: r.written, restEncoder: Sf(r.encoder.restEncoder) }), r.encoder.restEncoder = Og(), r.written = 0); -}, UT = (r, n, s) => { - r.written > 0 && r.currClient !== n.id.client && mIt(r), r.written === 0 && (r.currClient = n.id.client, r.encoder.writeClient(n.id.client), Eo(r.encoder.restEncoder, n.id.clock + s)), n.write(r.encoder, s), r.written++; -}, eqe = (r) => { - mIt(r); - const n = r.encoder.restEncoder; - Eo(n, r.clientStructs.length); - for (let s = 0; s < r.clientStructs.length; s++) { - const a = r.clientStructs[s]; - Eo(n, a.written), lwe(n, a.restEncoder); - } -}, aTn = (r, n, s, a) => { - const l = new s(A8(r)), h = new Kze(l, !1), f = new a(), b = new Jze(f); - for (let O = h.curr; O !== null; O = h.next()) - UT(b, n(O), 0); - eqe(b); - const w = Gze(l); - return tj(f, w), f.toUint8Array(); -}, cTn = (r) => aTn(r, GCn, dF, QJ), xEt = "You must not compute changes after the event-handler fired."; -class fwe { - constructor(n, s) { - this.target = n, this.currentTarget = n, this.transaction = s, this._changes = null, this._keys = null, this._delta = null, this._path = null; + for (; l.curr && l.curr.id.client === f && l.curr.id.clock + l.curr.length <= d; ) + l.next(); + } + CM(a); + const u = wM(o); + return z1(s, u), s.toUint8Array(); +}, Aee = (t) => { + t.written > 0 && (t.clientStructs.push({ written: t.written, restEncoder: Ln(t.encoder.restEncoder) }), t.encoder.restEncoder = _s(), t.written = 0); +}, Eh = (t, e, r) => { + t.written > 0 && t.currClient !== e.id.client && Aee(t), t.written === 0 && (t.currClient = e.id.client, t.encoder.writeClient(e.id.client), Wt(t.encoder.restEncoder, e.id.clock + r)), e.write(t.encoder, r), t.written++; +}, CM = (t) => { + Aee(t); + const e = t.encoder.restEncoder; + Wt(e, t.clientStructs.length); + for (let r = 0; r < t.clientStructs.length; r++) { + const n = t.clientStructs[r]; + Wt(e, n.written), HS(e, n.restEncoder); + } +}, PSe = (t, e, r, n) => { + const i = new r(Ff(t)), s = new SM(i, !1), a = new n(), o = new TM(a); + for (let u = s.curr; u !== null; u = s.next()) + Eh(o, e(u), 0); + CM(o); + const l = wM(i); + return z1(a, l), a.toUint8Array(); +}, $Se = (t) => PSe(t, Ske, Ig, Jb), KF = "You must not compute changes after the event-handler fired."; +class jS { + constructor(e, r) { + this.target = e, this.currentTarget = e, this.transaction = r, this._changes = null, this._keys = null, this._delta = null, this._path = null; } get path() { - return this._path || (this._path = lTn(this.currentTarget, this.target)); + return this._path || (this._path = BSe(this.currentTarget, this.target)); } - deletes(n) { - return jJ(this.transaction.deleteSet, n.id); + deletes(e) { + return Kb(this.transaction.deleteSet, e.id); } get keys() { if (this._keys === null) { if (this.transaction.doc._transactionCleanups.length === 0) - throw y8(xEt); - const n = /* @__PURE__ */ new Map(), s = this.target; - this.transaction.changed.get(s).forEach((l) => { - if (l !== null) { - const h = s._map.get(l); - let f, b; - if (this.adds(h)) { - let w = h.left; - for (; w !== null && this.adds(w); ) - w = w.left; - if (this.deletes(h)) - if (w !== null && this.deletes(w)) - f = "delete", b = $Re(w.content.getContent()); + throw ff(KF); + const e = /* @__PURE__ */ new Map(), r = this.target; + this.transaction.changed.get(r).forEach((i) => { + if (i !== null) { + const s = r._map.get(i); + let a, o; + if (this.adds(s)) { + let l = s.left; + for (; l !== null && this.adds(l); ) + l = l.left; + if (this.deletes(s)) + if (l !== null && this.deletes(l)) + a = "delete", o = ME(l.content.getContent()); else return; else - w !== null && this.deletes(w) ? (f = "update", b = $Re(w.content.getContent())) : (f = "add", b = void 0); - } else if (this.deletes(h)) - f = "delete", b = $Re(h.content.getContent()); + l !== null && this.deletes(l) ? (a = "update", o = ME(l.content.getContent())) : (a = "add", o = void 0); + } else if (this.deletes(s)) + a = "delete", o = ME(s.content.getContent()); else return; - n.set(l, { action: f, oldValue: b }); + e.set(i, { action: a, oldValue: o }); } - }), this._keys = n; + }), this._keys = e; } return this._keys; } get delta() { return this.changes.delta; } - adds(n) { - return n.id.clock >= (this.transaction.beforeState.get(n.id.client) || 0); + adds(e) { + return e.id.clock >= (this.transaction.beforeState.get(e.id.client) || 0); } get changes() { - let n = this._changes; - if (n === null) { + let e = this._changes; + if (e === null) { if (this.transaction.doc._transactionCleanups.length === 0) - throw y8(xEt); - const s = this.target, a = oP(), l = oP(), h = []; - if (n = { - added: a, - deleted: l, - delta: h, + throw ff(KF); + const r = this.target, n = jd(), i = jd(), s = []; + if (e = { + added: n, + deleted: i, + delta: s, keys: this.keys - }, this.transaction.changed.get(s).has(null)) { - let b = null; - const w = () => { - b && h.push(b); + }, this.transaction.changed.get(r).has(null)) { + let o = null; + const l = () => { + o && s.push(o); }; - for (let O = s._start; O !== null; O = O.right) - O.deleted ? this.deletes(O) && !this.adds(O) && ((b === null || b.delete === void 0) && (w(), b = { delete: 0 }), b.delete += O.length, l.add(O)) : this.adds(O) ? ((b === null || b.insert === void 0) && (w(), b = { insert: [] }), b.insert = b.insert.concat(O.content.getContent()), a.add(O)) : ((b === null || b.retain === void 0) && (w(), b = { retain: 0 }), b.retain += O.length); - b !== null && b.retain === void 0 && w(); + for (let u = r._start; u !== null; u = u.right) + u.deleted ? this.deletes(u) && !this.adds(u) && ((o === null || o.delete === void 0) && (l(), o = { delete: 0 }), o.delete += u.length, i.add(u)) : this.adds(u) ? ((o === null || o.insert === void 0) && (l(), o = { insert: [] }), o.insert = o.insert.concat(u.content.getContent()), n.add(u)) : ((o === null || o.retain === void 0) && (l(), o = { retain: 0 }), o.retain += u.length); + o !== null && o.retain === void 0 && l(); } - this._changes = n; + this._changes = e; } - return n; + return e; } } -const lTn = (r, n) => { - const s = []; - for (; n._item !== null && n !== r; ) { - if (n._item.parentSub !== null) - s.unshift(n._item.parentSub); +const BSe = (t, e) => { + const r = []; + for (; e._item !== null && e !== t; ) { + if (e._item.parentSub !== null) + r.unshift(e._item.parentSub); else { - let a = 0, l = n._item.parent._start; - for (; l !== n._item && l !== null; ) - l.deleted || a++, l = l.right; - s.unshift(a); + let n = 0, i = e._item.parent._start; + for (; i !== e._item && i !== null; ) + i.deleted || n++, i = i.right; + r.unshift(n); } - n = n._item.parent; + e = e._item.parent; } - return s; -}, bIt = 80; -let tqe = 0; -class uTn { - constructor(n, s) { - n.marker = !0, this.p = n, this.index = s, this.timestamp = tqe++; - } -} -const hTn = (r) => { - r.timestamp = tqe++; -}, vIt = (r, n, s) => { - r.p.marker = !1, r.p = n, n.marker = !0, r.index = s, r.timestamp = tqe++; -}, fTn = (r, n, s) => { - if (r.length >= bIt) { - const a = r.reduce((l, h) => l.timestamp < h.timestamp ? l : h); - return vIt(a, n, s), a; + return r; +}, Lee = 80; +let EM = 0; +class FSe { + constructor(e, r) { + e.marker = !0, this.p = e, this.index = r, this.timestamp = EM++; + } +} +const zSe = (t) => { + t.timestamp = EM++; +}, Ree = (t, e, r) => { + t.p.marker = !1, t.p = e, e.marker = !0, t.index = r, t.timestamp = EM++; +}, VSe = (t, e, r) => { + if (t.length >= Lee) { + const n = t.reduce((i, s) => i.timestamp < s.timestamp ? i : s); + return Ree(n, e, r), n; } else { - const a = new uTn(n, s); - return r.push(a), a; + const n = new FSe(e, r); + return t.push(n), n; } -}, dwe = (r, n) => { - if (r._start === null || n === 0 || r._searchMarker === null) +}, KS = (t, e) => { + if (t._start === null || e === 0 || t._searchMarker === null) return null; - const s = r._searchMarker.length === 0 ? null : r._searchMarker.reduce((h, f) => ebe(n - h.index) < ebe(n - f.index) ? h : f); - let a = r._start, l = 0; - for (s !== null && (a = s.p, l = s.index, hTn(s)); a.right !== null && l < n; ) { - if (!a.deleted && a.countable) { - if (n < l + a.length) + const r = t._searchMarker.length === 0 ? null : t._searchMarker.reduce((s, a) => h4(e - s.index) < h4(e - a.index) ? s : a); + let n = t._start, i = 0; + for (r !== null && (n = r.p, i = r.index, zSe(r)); n.right !== null && i < e; ) { + if (!n.deleted && n.countable) { + if (e < i + n.length) break; - l += a.length; - } - a = a.right; - } - for (; a.left !== null && l > n; ) - a = a.left, !a.deleted && a.countable && (l -= a.length); - for (; a.left !== null && a.left.id.client === a.id.client && a.left.id.clock + a.left.length === a.id.clock; ) - a = a.left, !a.deleted && a.countable && (l -= a.length); - return s !== null && ebe(s.index - l) < a.parent.length / bIt ? (vIt(s, a, l), s) : fTn(r._searchMarker, a, l); -}, IK = (r, n, s) => { - for (let a = r.length - 1; a >= 0; a--) { - const l = r[a]; - if (s > 0) { - let h = l.p; - for (h.marker = !1; h && (h.deleted || !h.countable); ) - h = h.left, h && !h.deleted && h.countable && (l.index -= h.length); - if (h === null || h.marker === !0) { - r.splice(a, 1); + i += n.length; + } + n = n.right; + } + for (; n.left !== null && i > e; ) + n = n.left, !n.deleted && n.countable && (i -= n.length); + for (; n.left !== null && n.left.id.client === n.id.client && n.left.id.clock + n.left.length === n.id.clock; ) + n = n.left, !n.deleted && n.countable && (i -= n.length); + return r !== null && h4(r.index - i) < n.parent.length / Lee ? (Ree(r, n, i), r) : VSe(t._searchMarker, n, i); +}, qy = (t, e, r) => { + for (let n = t.length - 1; n >= 0; n--) { + const i = t[n]; + if (r > 0) { + let s = i.p; + for (s.marker = !1; s && (s.deleted || !s.countable); ) + s = s.left, s && !s.deleted && s.countable && (i.index -= s.length); + if (s === null || s.marker === !0) { + t.splice(n, 1); continue; } - l.p = h, h.marker = !0; + i.p = s, s.marker = !0; } - (n < l.index || s > 0 && n === l.index) && (l.index = T8(n, l.index + s)); + (e < i.index || r > 0 && e === i.index) && (i.index = Bf(e, i.index + r)); } -}, pwe = (r, n, s) => { - const a = r, l = n.changedParentTypes; - for (; g_(l, r, () => []).push(s), r._item !== null; ) - r = r._item.parent; - lIt(a._eH, s, n); +}, JS = (t, e, r) => { + const n = t, i = e.changedParentTypes; + for (; rh(i, t, () => []).push(r), t._item !== null; ) + t = t._item.parent; + Oee(n._eH, r, e); }; -class Rp { +class us { constructor() { - this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = dEt(), this._dEH = dEt(), this._searchMarker = null; + this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = UF(), this._dEH = UF(), this._searchMarker = null; } get parent() { return this._item ? this._item.parent : null; } - _integrate(n, s) { - this.doc = n, this._item = s; + _integrate(e, r) { + this.doc = e, this._item = r; } _copy() { - throw nx(); + throw Ac(); } clone() { - throw nx(); + throw Ac(); } - _write(n) { + _write(e) { } get _first() { - let n = this._start; - for (; n !== null && n.deleted; ) - n = n.right; - return n; + let e = this._start; + for (; e !== null && e.deleted; ) + e = e.right; + return e; } - _callObserver(n, s) { - !n.local && this._searchMarker && (this._searchMarker.length = 0); + _callObserver(e, r) { + !e.local && this._searchMarker && (this._searchMarker.length = 0); } - observe(n) { - pEt(this._eH, n); + observe(e) { + qF(this._eH, e); } - observeDeep(n) { - pEt(this._dEH, n); + observeDeep(e) { + qF(this._dEH, e); } - unobserve(n) { - gEt(this._eH, n); + unobserve(e) { + QF(this._eH, e); } - unobserveDeep(n) { - gEt(this._dEH, n); + unobserveDeep(e) { + QF(this._dEH, e); } toJSON() { } } -const wIt = (r, n, s) => { - n < 0 && (n = r._length + n), s < 0 && (s = r._length + s); - let a = s - n; - const l = []; - let h = r._start; - for (; h !== null && a > 0; ) { - if (h.countable && !h.deleted) { - const f = h.content.getContent(); - if (f.length <= n) - n -= f.length; +const Mee = (t, e, r) => { + e < 0 && (e = t._length + e), r < 0 && (r = t._length + r); + let n = r - e; + const i = []; + let s = t._start; + for (; s !== null && n > 0; ) { + if (s.countable && !s.deleted) { + const a = s.content.getContent(); + if (a.length <= e) + e -= a.length; else { - for (let b = n; b < f.length && a > 0; b++) - l.push(f[b]), a--; - n = 0; + for (let o = e; o < a.length && n > 0; o++) + i.push(a[o]), n--; + e = 0; } } - h = h.right; + s = s.right; } - return l; -}, yIt = (r) => { - const n = []; - let s = r._start; - for (; s !== null; ) { - if (s.countable && !s.deleted) { - const a = s.content.getContent(); - for (let l = 0; l < a.length; l++) - n.push(a[l]); + return i; +}, Dee = (t) => { + const e = []; + let r = t._start; + for (; r !== null; ) { + if (r.countable && !r.deleted) { + const n = r.content.getContent(); + for (let i = 0; i < n.length; i++) + e.push(n[i]); } - s = s.right; + r = r.right; } - return n; -}, NK = (r, n) => { - let s = 0, a = r._start; - for (; a !== null; ) { - if (a.countable && !a.deleted) { - const l = a.content.getContent(); - for (let h = 0; h < l.length; h++) - n(l[h], s++, r); + return e; +}, Qy = (t, e) => { + let r = 0, n = t._start; + for (; n !== null; ) { + if (n.countable && !n.deleted) { + const i = n.content.getContent(); + for (let s = 0; s < i.length; s++) + e(i[s], r++, t); } - a = a.right; + n = n.right; } -}, OIt = (r, n) => { - const s = []; - return NK(r, (a, l) => { - s.push(n(a, l, r)); - }), s; -}, dTn = (r) => { - let n = r._start, s = null, a = 0; +}, Nee = (t, e) => { + const r = []; + return Qy(t, (n, i) => { + r.push(e(n, i, t)); + }), r; +}, USe = (t) => { + let e = t._start, r = null, n = 0; return { [Symbol.iterator]() { return this; }, next: () => { - if (s === null) { - for (; n !== null && n.deleted; ) - n = n.right; - if (n === null) + if (r === null) { + for (; e !== null && e.deleted; ) + e = e.right; + if (e === null) return { done: !0, value: void 0 }; - s = n.content.getContent(), a = 0, n = n.right; + r = e.content.getContent(), n = 0, e = e.right; } - const l = s[a++]; - return s.length <= a && (s = null), { + const i = r[n++]; + return r.length <= n && (r = null), { done: !1, - value: l + value: i }; } }; -}, kIt = (r, n) => { - const s = dwe(r, n); - let a = r._start; - for (s !== null && (a = s.p, n -= s.index); a !== null; a = a.right) - if (!a.deleted && a.countable) { - if (n < a.length) - return a.content.getContent()[n]; - n -= a.length; - } -}, hve = (r, n, s, a) => { - let l = s; - const h = r.doc, f = h.clientID, b = h.store, w = s === null ? n._start : s.right; - let O = []; - const S = () => { - O.length > 0 && (l = new Gu(Za(f, jd(b, f)), l, l && l.lastId, w, w && w.id, n, null, new lP(O)), l.integrate(r, 0), O = []); +}, Iee = (t, e) => { + const r = KS(t, e); + let n = t._start; + for (r !== null && (n = r.p, e -= r.index); n !== null; n = n.right) + if (!n.deleted && n.countable) { + if (e < n.length) + return n.content.getContent()[e]; + e -= n.length; + } +}, V5 = (t, e, r, n) => { + let i = r; + const s = t.doc, a = s.clientID, o = s.store, l = r === null ? e._start : r.right; + let u = []; + const h = () => { + u.length > 0 && (i = new rn(pr(a, ti(o, a)), i, i && i.lastId, l, l && l.id, e, null, new e0(u)), i.integrate(t, 0), u = []); }; - a.forEach((E) => { - if (E === null) - O.push(E); + n.forEach((f) => { + if (f === null) + u.push(f); else - switch (E.constructor) { + switch (f.constructor) { case Number: case Object: case Boolean: case Array: case String: - O.push(E); + u.push(f); break; default: - switch (S(), E.constructor) { + switch (h(), f.constructor) { case Uint8Array: case ArrayBuffer: - l = new Gu(Za(f, jd(b, f)), l, l && l.lastId, w, w && w.id, n, null, new zJ(new Uint8Array(E))), l.integrate(r, 0); + i = new rn(pr(a, ti(o, a)), i, i && i.lastId, l, l && l.id, e, null, new ex(new Uint8Array(f))), i.integrate(t, 0); break; - case nj: - l = new Gu(Za(f, jd(b, f)), l, l && l.lastId, w, w && w.id, n, null, new qJ(E)), l.integrate(r, 0); + case V1: + i = new rn(pr(a, ti(o, a)), i, i && i.lastId, l, l && l.id, e, null, new tx(f)), i.integrate(t, 0); break; default: - if (E instanceof Rp) - l = new Gu(Za(f, jd(b, f)), l, l && l.lastId, w, w && w.id, n, null, new bx(E)), l.integrate(r, 0); + if (f instanceof us) + i = new rn(pr(a, ti(o, a)), i, i && i.lastId, l, l && l.id, e, null, new Wc(f)), i.integrate(t, 0); else throw new Error("Unexpected content type in insert operation"); } } - }), S(); -}, xIt = () => y8("Length exceeded!"), SIt = (r, n, s, a) => { - if (s > n._length) - throw xIt(); - if (s === 0) - return n._searchMarker && IK(n._searchMarker, s, a.length), hve(r, n, null, a); - const l = s, h = dwe(n, s); - let f = n._start; - for (h !== null && (f = h.p, s -= h.index, s === 0 && (f = f.prev, s += f && f.countable && !f.deleted ? f.length : 0)); f !== null; f = f.right) - if (!f.deleted && f.countable) { - if (s <= f.length) { - s < f.length && tv(r, Za(f.id.client, f.id.clock + s)); + }), h(); +}, Pee = () => ff("Length exceeded!"), $ee = (t, e, r, n) => { + if (r > e._length) + throw Pee(); + if (r === 0) + return e._searchMarker && qy(e._searchMarker, r, n.length), V5(t, e, null, n); + const i = r, s = KS(e, r); + let a = e._start; + for (s !== null && (a = s.p, r -= s.index, r === 0 && (a = a.prev, r += a && a.countable && !a.deleted ? a.length : 0)); a !== null; a = a.right) + if (!a.deleted && a.countable) { + if (r <= a.length) { + r < a.length && Ca(t, pr(a.id.client, a.id.clock + r)); break; } - s -= f.length; - } - return n._searchMarker && IK(n._searchMarker, l, a.length), hve(r, n, f, a); -}, pTn = (r, n, s) => { - let l = (n._searchMarker || []).reduce((h, f) => f.index > h.index ? f : h, { index: 0, p: n._start }).p; - if (l) - for (; l.right; ) - l = l.right; - return hve(r, n, l, s); -}, _It = (r, n, s, a) => { - if (a === 0) + r -= a.length; + } + return e._searchMarker && qy(e._searchMarker, i, n.length), V5(t, e, a, n); +}, qSe = (t, e, r) => { + let i = (e._searchMarker || []).reduce((s, a) => a.index > s.index ? a : s, { index: 0, p: e._start }).p; + if (i) + for (; i.right; ) + i = i.right; + return V5(t, e, i, r); +}, Bee = (t, e, r, n) => { + if (n === 0) return; - const l = s, h = a, f = dwe(n, s); - let b = n._start; - for (f !== null && (b = f.p, s -= f.index); b !== null && s > 0; b = b.right) - !b.deleted && b.countable && (s < b.length && tv(r, Za(b.id.client, b.id.clock + s)), s -= b.length); - for (; a > 0 && b !== null; ) - b.deleted || (a < b.length && tv(r, Za(b.id.client, b.id.clock + a)), b.delete(r), a -= b.length), b = b.right; - if (a > 0) - throw xIt(); - n._searchMarker && IK(n._searchMarker, l, -h + a); -}, fve = (r, n, s) => { - const a = n._map.get(s); - a !== void 0 && a.delete(r); -}, nqe = (r, n, s, a) => { - const l = n._map.get(s) || null, h = r.doc, f = h.clientID; - let b; - if (a == null) - b = new lP([a]); + const i = r, s = n, a = KS(e, r); + let o = e._start; + for (a !== null && (o = a.p, r -= a.index); o !== null && r > 0; o = o.right) + !o.deleted && o.countable && (r < o.length && Ca(t, pr(o.id.client, o.id.clock + r)), r -= o.length); + for (; n > 0 && o !== null; ) + o.deleted || (n < o.length && Ca(t, pr(o.id.client, o.id.clock + n)), o.delete(t), n -= o.length), o = o.right; + if (n > 0) + throw Pee(); + e._searchMarker && qy(e._searchMarker, i, -s + n); +}, U5 = (t, e, r) => { + const n = e._map.get(r); + n !== void 0 && n.delete(t); +}, _M = (t, e, r, n) => { + const i = e._map.get(r) || null, s = t.doc, a = s.clientID; + let o; + if (n == null) + o = new e0([n]); else - switch (a.constructor) { + switch (n.constructor) { case Number: case Object: case Boolean: case Array: case String: - b = new lP([a]); + o = new e0([n]); break; case Uint8Array: - b = new zJ(a); + o = new ex(n); break; - case nj: - b = new qJ(a); + case V1: + o = new tx(n); break; default: - if (a instanceof Rp) - b = new bx(a); + if (n instanceof us) + o = new Wc(n); else throw new Error("Unexpected content type"); } - new Gu(Za(f, jd(h.store, f)), l, l && l.lastId, null, null, n, s, b).integrate(r, 0); -}, rqe = (r, n) => { - const s = r._map.get(n); - return s !== void 0 && !s.deleted ? s.content.getContent()[s.length - 1] : void 0; -}, CIt = (r) => { - const n = {}; - return r._map.forEach((s, a) => { - s.deleted || (n[a] = s.content.getContent()[s.length - 1]); - }), n; -}, EIt = (r, n) => { - const s = r._map.get(n); - return s !== void 0 && !s.deleted; -}, gTn = (r, n) => { - const s = {}; - return r._map.forEach((a, l) => { - let h = a; - for (; h !== null && (!n.sv.has(h.id.client) || h.id.clock >= (n.sv.get(h.id.client) || 0)); ) - h = h.left; - h !== null && hB(h, n) && (s[l] = h.content.getContent()[h.length - 1]); - }), s; -}, ime = (r) => AEn(r.entries(), (n) => !n[1].deleted); -class mTn extends fwe { - constructor(n, s) { - super(n, s), this._transaction = s; + new rn(pr(a, ti(s.store, a)), i, i && i.lastId, null, null, e, r, o).integrate(t, 0); +}, AM = (t, e) => { + const r = t._map.get(e); + return r !== void 0 && !r.deleted ? r.content.getContent()[r.length - 1] : void 0; +}, Fee = (t) => { + const e = {}; + return t._map.forEach((r, n) => { + r.deleted || (e[n] = r.content.getContent()[r.length - 1]); + }), e; +}, zee = (t, e) => { + const r = t._map.get(e); + return r !== void 0 && !r.deleted; +}, QSe = (t, e) => { + const r = {}; + return t._map.forEach((n, i) => { + let s = n; + for (; s !== null && (!e.sv.has(s.id.client) || s.id.clock >= (e.sv.get(s.id.client) || 0)); ) + s = s.left; + s !== null && kp(s, e) && (r[i] = s.content.getContent()[s.length - 1]); + }), r; +}, Mw = (t) => iSe(t.entries(), (e) => !e[1].deleted); +class YSe extends jS { + constructor(e, r) { + super(e, r), this._transaction = r; } } -class $B extends Rp { +class jp extends us { constructor() { super(), this._prelimContent = [], this._searchMarker = []; } - static from(n) { - const s = new $B(); - return s.push(n), s; + static from(e) { + const r = new jp(); + return r.push(e), r; } - _integrate(n, s) { - super._integrate(n, s), this.insert(0, this._prelimContent), this._prelimContent = null; + _integrate(e, r) { + super._integrate(e, r), this.insert(0, this._prelimContent), this._prelimContent = null; } _copy() { - return new $B(); + return new jp(); } clone() { - const n = new $B(); - return n.insert(0, this.toArray().map( - (s) => s instanceof Rp ? s.clone() : s - )), n; + const e = new jp(); + return e.insert(0, this.toArray().map( + (r) => r instanceof us ? r.clone() : r + )), e; } get length() { return this._prelimContent === null ? this._length : this._prelimContent.length; } - _callObserver(n, s) { - super._callObserver(n, s), pwe(this, n, new mTn(this, n)); + _callObserver(e, r) { + super._callObserver(e, r), JS(this, e, new YSe(this, e)); } - insert(n, s) { - this.doc !== null ? Yu(this.doc, (a) => { - SIt(a, this, n, s); - }) : this._prelimContent.splice(n, 0, ...s); + insert(e, r) { + this.doc !== null ? tn(this.doc, (n) => { + $ee(n, this, e, r); + }) : this._prelimContent.splice(e, 0, ...r); } - push(n) { - this.doc !== null ? Yu(this.doc, (s) => { - pTn(s, this, n); - }) : this._prelimContent.push(...n); + push(e) { + this.doc !== null ? tn(this.doc, (r) => { + qSe(r, this, e); + }) : this._prelimContent.push(...e); } - unshift(n) { - this.insert(0, n); + unshift(e) { + this.insert(0, e); } - delete(n, s = 1) { - this.doc !== null ? Yu(this.doc, (a) => { - _It(a, this, n, s); - }) : this._prelimContent.splice(n, s); + delete(e, r = 1) { + this.doc !== null ? tn(this.doc, (n) => { + Bee(n, this, e, r); + }) : this._prelimContent.splice(e, r); } - get(n) { - return kIt(this, n); + get(e) { + return Iee(this, e); } toArray() { - return yIt(this); + return Dee(this); } - slice(n = 0, s = this.length) { - return wIt(this, n, s); + slice(e = 0, r = this.length) { + return Mee(this, e, r); } toJSON() { - return this.map((n) => n instanceof Rp ? n.toJSON() : n); + return this.map((e) => e instanceof us ? e.toJSON() : e); } - map(n) { - return OIt(this, n); + map(e) { + return Nee(this, e); } - forEach(n) { - NK(this, n); + forEach(e) { + Qy(this, e); } [Symbol.iterator]() { - return dTn(this); + return USe(this); } - _write(n) { - n.writeTypeRef(jTn); + _write(e) { + e.writeTypeRef(gTe); } } -const bTn = (r) => new $B(); -class vTn extends fwe { - constructor(n, s, a) { - super(n, s), this.keysChanged = a; +const WSe = (t) => new jp(); +class GSe extends jS { + constructor(e, r, n) { + super(e, r), this.keysChanged = n; } } -class e_ extends Rp { - constructor(n) { - super(), this._prelimContent = null, n === void 0 ? this._prelimContent = /* @__PURE__ */ new Map() : this._prelimContent = new Map(n); +class _u extends us { + constructor(e) { + super(), this._prelimContent = null, e === void 0 ? this._prelimContent = /* @__PURE__ */ new Map() : this._prelimContent = new Map(e); } - _integrate(n, s) { - super._integrate(n, s), this._prelimContent.forEach((a, l) => { - this.set(l, a); + _integrate(e, r) { + super._integrate(e, r), this._prelimContent.forEach((n, i) => { + this.set(i, n); }), this._prelimContent = null; } _copy() { - return new e_(); + return new _u(); } clone() { - const n = new e_(); - return this.forEach((s, a) => { - n.set(a, s instanceof Rp ? s.clone() : s); - }), n; + const e = new _u(); + return this.forEach((r, n) => { + e.set(n, r instanceof us ? r.clone() : r); + }), e; } - _callObserver(n, s) { - pwe(this, n, new vTn(this, n, s)); + _callObserver(e, r) { + JS(this, e, new GSe(this, e, r)); } toJSON() { - const n = {}; - return this._map.forEach((s, a) => { - if (!s.deleted) { - const l = s.content.getContent()[s.length - 1]; - n[a] = l instanceof Rp ? l.toJSON() : l; + const e = {}; + return this._map.forEach((r, n) => { + if (!r.deleted) { + const i = r.content.getContent()[r.length - 1]; + e[n] = i instanceof us ? i.toJSON() : i; } - }), n; + }), e; } get size() { - return [...ime(this._map)].length; + return [...Mw(this._map)].length; } keys() { - return qRe(ime(this._map), (n) => n[0]); + return BE(Mw(this._map), (e) => e[0]); } values() { - return qRe(ime(this._map), (n) => n[1].content.getContent()[n[1].length - 1]); + return BE(Mw(this._map), (e) => e[1].content.getContent()[e[1].length - 1]); } entries() { - return qRe(ime(this._map), (n) => [n[0], n[1].content.getContent()[n[1].length - 1]]); + return BE(Mw(this._map), (e) => [e[0], e[1].content.getContent()[e[1].length - 1]]); } - forEach(n) { - this._map.forEach((s, a) => { - s.deleted || n(s.content.getContent()[s.length - 1], a, this); + forEach(e) { + this._map.forEach((r, n) => { + r.deleted || e(r.content.getContent()[r.length - 1], n, this); }); } [Symbol.iterator]() { return this.entries(); } - delete(n) { - this.doc !== null ? Yu(this.doc, (s) => { - fve(s, this, n); - }) : this._prelimContent.delete(n); + delete(e) { + this.doc !== null ? tn(this.doc, (r) => { + U5(r, this, e); + }) : this._prelimContent.delete(e); } - set(n, s) { - return this.doc !== null ? Yu(this.doc, (a) => { - nqe(a, this, n, s); - }) : this._prelimContent.set(n, s), s; + set(e, r) { + return this.doc !== null ? tn(this.doc, (n) => { + _M(n, this, e, r); + }) : this._prelimContent.set(e, r), r; } - get(n) { - return rqe(this, n); + get(e) { + return AM(this, e); } - has(n) { - return EIt(this, n); + has(e) { + return zee(this, e); } clear() { - this.doc !== null ? Yu(this.doc, (n) => { - this.forEach(function(s, a, l) { - fve(n, l, a); + this.doc !== null ? tn(this.doc, (e) => { + this.forEach(function(r, n, i) { + U5(e, i, n); }); }) : this._prelimContent.clear(); } - _write(n) { - n.writeTypeRef(QTn); + _write(e) { + e.writeTypeRef(mTe); } } -const wTn = (r) => new e_(), KT = (r, n) => r === n || typeof r == "object" && typeof n == "object" && r && n && HCn(r, n); -class YFe { - constructor(n, s, a, l) { - this.left = n, this.right = s, this.index = a, this.currentAttributes = l; +const HSe = (t) => new _u(), Ph = (t, e) => t === e || typeof t == "object" && typeof e == "object" && t && e && kke(t, e); +class P7 { + constructor(e, r, n, i) { + this.left = e, this.right = r, this.index = n, this.currentAttributes = i; } forward() { - switch (this.right === null && vk(), this.right.content.constructor) { - case d0: - this.right.deleted || rj(this.currentAttributes, this.right.content); + switch (this.right === null && Il(), this.right.content.constructor) { + case Ri: + this.right.deleted || U1(this.currentAttributes, this.right.content); break; default: this.right.deleted || (this.index += this.right.length); @@ -18235,750 +18244,750 @@ class YFe { this.left = this.right, this.right = this.right.right; } } -const SEt = (r, n, s) => { - for (; n.right !== null && s > 0; ) { - switch (n.right.content.constructor) { - case d0: - n.right.deleted || rj(n.currentAttributes, n.right.content); +const JF = (t, e, r) => { + for (; e.right !== null && r > 0; ) { + switch (e.right.content.constructor) { + case Ri: + e.right.deleted || U1(e.currentAttributes, e.right.content); break; default: - n.right.deleted || (s < n.right.length && tv(r, Za(n.right.id.client, n.right.id.clock + s)), n.index += n.right.length, s -= n.right.length); + e.right.deleted || (r < e.right.length && Ca(t, pr(e.right.id.client, e.right.id.clock + r)), e.index += e.right.length, r -= e.right.length); break; } - n.left = n.right, n.right = n.right.right; + e.left = e.right, e.right = e.right.right; } - return n; -}, sme = (r, n, s) => { - const a = /* @__PURE__ */ new Map(), l = dwe(n, s); - if (l) { - const h = new YFe(l.p.left, l.p, l.index, a); - return SEt(r, h, s - l.index); + return e; +}, Dw = (t, e, r) => { + const n = /* @__PURE__ */ new Map(), i = KS(e, r); + if (i) { + const s = new P7(i.p.left, i.p, i.index, n); + return JF(t, s, r - i.index); } else { - const h = new YFe(null, n._start, 0, a); - return SEt(r, h, s); - } -}, TIt = (r, n, s, a) => { - for (; s.right !== null && (s.right.deleted === !0 || s.right.content.constructor === d0 && KT(a.get(s.right.content.key), s.right.content.value)); ) - s.right.deleted || a.delete(s.right.content.key), s.forward(); - const l = r.doc, h = l.clientID; - a.forEach((f, b) => { - const w = s.left, O = s.right, S = new Gu(Za(h, jd(l.store, h)), w, w && w.lastId, O, O && O.id, n, null, new d0(b, f)); - S.integrate(r, 0), s.right = S, s.forward(); + const s = new P7(null, e._start, 0, n); + return JF(t, s, r); + } +}, Vee = (t, e, r, n) => { + for (; r.right !== null && (r.right.deleted === !0 || r.right.content.constructor === Ri && Ph(n.get(r.right.content.key), r.right.content.value)); ) + r.right.deleted || n.delete(r.right.content.key), r.forward(); + const i = t.doc, s = i.clientID; + n.forEach((a, o) => { + const l = r.left, u = r.right, h = new rn(pr(s, ti(i.store, s)), l, l && l.lastId, u, u && u.id, e, null, new Ri(o, a)); + h.integrate(t, 0), r.right = h, r.forward(); }); -}, rj = (r, n) => { - const { key: s, value: a } = n; - a === null ? r.delete(s) : r.set(s, a); -}, AIt = (r, n) => { - for (; r.right !== null; ) { - if (!(r.right.deleted || r.right.content.constructor === d0 && KT(n[r.right.content.key] || null, r.right.content.value))) +}, U1 = (t, e) => { + const { key: r, value: n } = e; + n === null ? t.delete(r) : t.set(r, n); +}, Uee = (t, e) => { + for (; t.right !== null; ) { + if (!(t.right.deleted || t.right.content.constructor === Ri && Ph(e[t.right.content.key] || null, t.right.content.value))) break; - r.forward(); + t.forward(); } -}, DIt = (r, n, s, a) => { - const l = r.doc, h = l.clientID, f = /* @__PURE__ */ new Map(); - for (const b in a) { - const w = a[b], O = s.currentAttributes.get(b) || null; - if (!KT(O, w)) { - f.set(b, O); - const { left: S, right: E } = s; - s.right = new Gu(Za(h, jd(l.store, h)), S, S && S.lastId, E, E && E.id, n, null, new d0(b, w)), s.right.integrate(r, 0), s.forward(); +}, qee = (t, e, r, n) => { + const i = t.doc, s = i.clientID, a = /* @__PURE__ */ new Map(); + for (const o in n) { + const l = n[o], u = r.currentAttributes.get(o) || null; + if (!Ph(u, l)) { + a.set(o, u); + const { left: h, right: f } = r; + r.right = new rn(pr(s, ti(i.store, s)), h, h && h.lastId, f, f && f.id, e, null, new Ri(o, l)), r.right.integrate(t, 0), r.forward(); } } - return f; -}, VRe = (r, n, s, a, l) => { - s.currentAttributes.forEach((D, M) => { - l[M] === void 0 && (l[M] = null); + return a; +}, FE = (t, e, r, n, i) => { + r.currentAttributes.forEach((d, p) => { + i[p] === void 0 && (i[p] = null); }); - const h = r.doc, f = h.clientID; - AIt(s, l); - const b = DIt(r, n, s, l), w = a.constructor === String ? new ux(a) : a instanceof Rp ? new bx(a) : new TP(a); - let { left: O, right: S, index: E } = s; - n._searchMarker && IK(n._searchMarker, s.index, w.getLength()), S = new Gu(Za(f, jd(h.store, f)), O, O && O.lastId, S, S && S.id, n, null, w), S.integrate(r, 0), s.right = S, s.index = E, s.forward(), TIt(r, n, s, b); -}, _Et = (r, n, s, a, l) => { - const h = r.doc, f = h.clientID; - AIt(s, l); - const b = DIt(r, n, s, l); + const s = t.doc, a = s.clientID; + Uee(r, i); + const o = qee(t, e, r, i), l = n.constructor === String ? new Ic(n) : n instanceof us ? new Wc(n) : new I0(n); + let { left: u, right: h, index: f } = r; + e._searchMarker && qy(e._searchMarker, r.index, l.getLength()), h = new rn(pr(a, ti(s.store, a)), u, u && u.lastId, h, h && h.id, e, null, l), h.integrate(t, 0), r.right = h, r.index = f, r.forward(), Vee(t, e, r, o); +}, ez = (t, e, r, n, i) => { + const s = t.doc, a = s.clientID; + Uee(r, i); + const o = qee(t, e, r, i); e: - for (; s.right !== null && (a > 0 || b.size > 0 && (s.right.deleted || s.right.content.constructor === d0)); ) { - if (!s.right.deleted) - switch (s.right.content.constructor) { - case d0: { - const { key: w, value: O } = s.right.content, S = l[w]; - if (S !== void 0) { - if (KT(S, O)) - b.delete(w); + for (; r.right !== null && (n > 0 || o.size > 0 && (r.right.deleted || r.right.content.constructor === Ri)); ) { + if (!r.right.deleted) + switch (r.right.content.constructor) { + case Ri: { + const { key: l, value: u } = r.right.content, h = i[l]; + if (h !== void 0) { + if (Ph(h, u)) + o.delete(l); else { - if (a === 0) + if (n === 0) break e; - b.set(w, O); + o.set(l, u); } - s.right.delete(r); + r.right.delete(t); } else - s.currentAttributes.set(w, O); + r.currentAttributes.set(l, u); break; } default: - a < s.right.length && tv(r, Za(s.right.id.client, s.right.id.clock + a)), a -= s.right.length; + n < r.right.length && Ca(t, pr(r.right.id.client, r.right.id.clock + n)), n -= r.right.length; break; } - s.forward(); + r.forward(); } - if (a > 0) { - let w = ""; - for (; a > 0; a--) - w += ` + if (n > 0) { + let l = ""; + for (; n > 0; n--) + l += ` `; - s.right = new Gu(Za(f, jd(h.store, f)), s.left, s.left && s.left.lastId, s.right, s.right && s.right.id, n, null, new ux(w)), s.right.integrate(r, 0), s.forward(); - } - TIt(r, n, s, b); -}, MIt = (r, n, s, a, l) => { - let h = n; - const f = uk(); - for (; h && (!h.countable || h.deleted); ) { - if (!h.deleted && h.content.constructor === d0) { - const O = h.content; - f.set(O.key, O); - } - h = h.right; - } - let b = 0, w = !1; - for (; n !== h; ) { - if (s === n && (w = !0), !n.deleted) { - const O = n.content; - switch (O.constructor) { - case d0: { - const { key: S, value: E } = O, D = a.get(S) || null; - (f.get(S) !== O || D === E) && (n.delete(r), b++, !w && (l.get(S) || null) === E && D !== E && (D === null ? l.delete(S) : l.set(S, D))), !w && !n.deleted && rj(l, O); - break; - } - } - } - n = n.right; + r.right = new rn(pr(a, ti(s.store, a)), r.left, r.left && r.left.lastId, r.right, r.right && r.right.id, e, null, new Ic(l)), r.right.integrate(t, 0), r.forward(); } - return b; -}, yTn = (r, n) => { - for (; n && n.right && (n.right.deleted || !n.right.countable); ) - n = n.right; - const s = /* @__PURE__ */ new Set(); - for (; n && (n.deleted || !n.countable); ) { - if (!n.deleted && n.content.constructor === d0) { - const a = n.content.key; - s.has(a) ? n.delete(r) : s.add(a); + Vee(t, e, r, o); +}, Qee = (t, e, r, n, i) => { + let s = e; + const a = xl(); + for (; s && (!s.countable || s.deleted); ) { + if (!s.deleted && s.content.constructor === Ri) { + const u = s.content; + a.set(u.key, u); } - n = n.left; + s = s.right; } -}, OTn = (r) => { - let n = 0; - return Yu(r.doc, (s) => { - let a = r._start, l = r._start, h = uk(); - const f = NFe(h); - for (; l; ) { - if (l.deleted === !1) - switch (l.content.constructor) { - case d0: - rj(f, l.content); + let o = 0, l = !1; + for (; e !== s; ) { + if (r === e && (l = !0), !e.deleted) { + const u = e.content; + switch (u.constructor) { + case Ri: { + const { key: h, value: f } = u, d = n.get(h) || null; + (a.get(h) !== u || d === f) && (e.delete(t), o++, !l && (i.get(h) || null) === f && d !== f && (d === null ? i.delete(h) : i.set(h, d))), !l && !e.deleted && U1(i, u); + break; + } + } + } + e = e.right; + } + return o; +}, XSe = (t, e) => { + for (; e && e.right && (e.right.deleted || !e.right.countable); ) + e = e.right; + const r = /* @__PURE__ */ new Set(); + for (; e && (e.deleted || !e.countable); ) { + if (!e.deleted && e.content.constructor === Ri) { + const n = e.content.key; + r.has(n) ? e.delete(t) : r.add(n); + } + e = e.left; + } +}, ZSe = (t) => { + let e = 0; + return tn(t.doc, (r) => { + let n = t._start, i = t._start, s = xl(); + const a = S7(s); + for (; i; ) { + if (i.deleted === !1) + switch (i.content.constructor) { + case Ri: + U1(a, i.content); break; default: - n += MIt(s, a, l, h, f), h = NFe(f), a = l; + e += Qee(r, n, i, s, a), s = S7(a), n = i; break; } - l = l.right; + i = i.right; } - }), n; -}, kTn = (r) => { - const n = /* @__PURE__ */ new Set(), s = r.doc; - for (const [a, l] of r.afterState.entries()) { - const h = r.beforeState.get(a) || 0; - l !== h && pIt(r, s.store.clients.get(a), h, l, (f) => { - !f.deleted && f.content.constructor === d0 && f.constructor !== jy && n.add(f.parent); + }), e; +}, jSe = (t) => { + const e = /* @__PURE__ */ new Set(), r = t.doc; + for (const [n, i] of t.afterState.entries()) { + const s = t.beforeState.get(n) || 0; + i !== s && Eee(t, r.store.clients.get(n), s, i, (a) => { + !a.deleted && a.content.constructor === Ri && a.constructor !== _o && e.add(a.parent); }); } - Yu(s, (a) => { - fF(r, r.deleteSet, (l) => { - if (l instanceof jy || !l.parent._hasFormatting || n.has(l.parent)) + tn(r, (n) => { + Ng(t, t.deleteSet, (i) => { + if (i instanceof _o || !i.parent._hasFormatting || e.has(i.parent)) return; - const h = l.parent; - l.content.constructor === d0 ? n.add(h) : yTn(a, l); + const s = i.parent; + i.content.constructor === Ri ? e.add(s) : XSe(n, i); }); - for (const l of n) - OTn(l); + for (const i of e) + ZSe(i); }); -}, CEt = (r, n, s) => { - const a = s, l = NFe(n.currentAttributes), h = n.right; - for (; s > 0 && n.right !== null; ) { - if (n.right.deleted === !1) - switch (n.right.content.constructor) { - case bx: - case TP: - case ux: - s < n.right.length && tv(r, Za(n.right.id.client, n.right.id.clock + s)), s -= n.right.length, n.right.delete(r); - break; - } - n.forward(); - } - h && MIt(r, h, n.right, l, n.currentAttributes); - const f = (n.left || n.right).parent; - return f._searchMarker && IK(f._searchMarker, n.index, -a + s), n; -}; -class xTn extends fwe { - constructor(n, s, a) { - super(n, s), this.childListChanged = !1, this.keysChanged = /* @__PURE__ */ new Set(), a.forEach((l) => { - l === null ? this.childListChanged = !0 : this.keysChanged.add(l); +}, tz = (t, e, r) => { + const n = r, i = S7(e.currentAttributes), s = e.right; + for (; r > 0 && e.right !== null; ) { + if (e.right.deleted === !1) + switch (e.right.content.constructor) { + case Wc: + case I0: + case Ic: + r < e.right.length && Ca(t, pr(e.right.id.client, e.right.id.clock + r)), r -= e.right.length, e.right.delete(t); + break; + } + e.forward(); + } + s && Qee(t, s, e.right, i, e.currentAttributes); + const a = (e.left || e.right).parent; + return a._searchMarker && qy(a._searchMarker, e.index, -n + r), e; +}; +class KSe extends jS { + constructor(e, r, n) { + super(e, r), this.childListChanged = !1, this.keysChanged = /* @__PURE__ */ new Set(), n.forEach((i) => { + i === null ? this.childListChanged = !0 : this.keysChanged.add(i); }); } get changes() { if (this._changes === null) { - const n = { + const e = { keys: this.keys, delta: this.delta, added: /* @__PURE__ */ new Set(), deleted: /* @__PURE__ */ new Set() }; - this._changes = n; + this._changes = e; } return this._changes; } get delta() { if (this._delta === null) { - const n = this.target.doc, s = []; - Yu(n, (a) => { - const l = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(); - let f = this.target._start, b = null; - const w = {}; - let O = "", S = 0, E = 0; - const D = () => { - if (b !== null) { - let M = null; - switch (b) { + const e = this.target.doc, r = []; + tn(e, (n) => { + const i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(); + let a = this.target._start, o = null; + const l = {}; + let u = "", h = 0, f = 0; + const d = () => { + if (o !== null) { + let p = null; + switch (o) { case "delete": - E > 0 && (M = { delete: E }), E = 0; + f > 0 && (p = { delete: f }), f = 0; break; case "insert": - (typeof O == "object" || O.length > 0) && (M = { insert: O }, l.size > 0 && (M.attributes = {}, l.forEach((B, z) => { - B !== null && (M.attributes[z] = B); - }))), O = ""; + (typeof u == "object" || u.length > 0) && (p = { insert: u }, i.size > 0 && (p.attributes = {}, i.forEach((g, m) => { + g !== null && (p.attributes[m] = g); + }))), u = ""; break; case "retain": - S > 0 && (M = { retain: S }, WCn(w) || (M.attributes = zCn({}, w))), S = 0; + h > 0 && (p = { retain: h }, wke(l) || (p.attributes = vke({}, l))), h = 0; break; } - M && s.push(M), b = null; + p && r.push(p), o = null; } }; - for (; f !== null; ) { - switch (f.content.constructor) { - case bx: - case TP: - this.adds(f) ? this.deletes(f) || (D(), b = "insert", O = f.content.getContent()[0], D()) : this.deletes(f) ? (b !== "delete" && (D(), b = "delete"), E += 1) : f.deleted || (b !== "retain" && (D(), b = "retain"), S += 1); + for (; a !== null; ) { + switch (a.content.constructor) { + case Wc: + case I0: + this.adds(a) ? this.deletes(a) || (d(), o = "insert", u = a.content.getContent()[0], d()) : this.deletes(a) ? (o !== "delete" && (d(), o = "delete"), f += 1) : a.deleted || (o !== "retain" && (d(), o = "retain"), h += 1); break; - case ux: - this.adds(f) ? this.deletes(f) || (b !== "insert" && (D(), b = "insert"), O += f.content.str) : this.deletes(f) ? (b !== "delete" && (D(), b = "delete"), E += f.length) : f.deleted || (b !== "retain" && (D(), b = "retain"), S += f.length); + case Ic: + this.adds(a) ? this.deletes(a) || (o !== "insert" && (d(), o = "insert"), u += a.content.str) : this.deletes(a) ? (o !== "delete" && (d(), o = "delete"), f += a.length) : a.deleted || (o !== "retain" && (d(), o = "retain"), h += a.length); break; - case d0: { - const { key: M, value: B } = f.content; - if (this.adds(f)) { - if (!this.deletes(f)) { - const z = l.get(M) || null; - KT(z, B) ? B !== null && f.delete(a) : (b === "retain" && D(), KT(B, h.get(M) || null) ? delete w[M] : w[M] = B); + case Ri: { + const { key: p, value: g } = a.content; + if (this.adds(a)) { + if (!this.deletes(a)) { + const m = i.get(p) || null; + Ph(m, g) ? g !== null && a.delete(n) : (o === "retain" && d(), Ph(g, s.get(p) || null) ? delete l[p] : l[p] = g); } - } else if (this.deletes(f)) { - h.set(M, B); - const z = l.get(M) || null; - KT(z, B) || (b === "retain" && D(), w[M] = z); - } else if (!f.deleted) { - h.set(M, B); - const z = w[M]; - z !== void 0 && (KT(z, B) ? z !== null && f.delete(a) : (b === "retain" && D(), B === null ? delete w[M] : w[M] = B)); + } else if (this.deletes(a)) { + s.set(p, g); + const m = i.get(p) || null; + Ph(m, g) || (o === "retain" && d(), l[p] = m); + } else if (!a.deleted) { + s.set(p, g); + const m = l[p]; + m !== void 0 && (Ph(m, g) ? m !== null && a.delete(n) : (o === "retain" && d(), g === null ? delete l[p] : l[p] = g)); } - f.deleted || (b === "insert" && D(), rj(l, f.content)); + a.deleted || (o === "insert" && d(), U1(i, a.content)); break; } } - f = f.right; + a = a.right; } - for (D(); s.length > 0; ) { - const M = s[s.length - 1]; - if (M.retain !== void 0 && M.attributes === void 0) - s.pop(); + for (d(); r.length > 0; ) { + const p = r[r.length - 1]; + if (p.retain !== void 0 && p.attributes === void 0) + r.pop(); else break; } - }), this._delta = s; + }), this._delta = r; } return this._delta; } } -class pF extends Rp { - constructor(n) { - super(), this._pending = n !== void 0 ? [() => this.insert(0, n)] : [], this._searchMarker = [], this._hasFormatting = !1; +class Pg extends us { + constructor(e) { + super(), this._pending = e !== void 0 ? [() => this.insert(0, e)] : [], this._searchMarker = [], this._hasFormatting = !1; } get length() { return this._length; } - _integrate(n, s) { - super._integrate(n, s); + _integrate(e, r) { + super._integrate(e, r); try { - this._pending.forEach((a) => a()); - } catch (a) { - console.error(a); + this._pending.forEach((n) => n()); + } catch (n) { + console.error(n); } this._pending = null; } _copy() { - return new pF(); + return new Pg(); } clone() { - const n = new pF(); - return n.applyDelta(this.toDelta()), n; + const e = new Pg(); + return e.applyDelta(this.toDelta()), e; } - _callObserver(n, s) { - super._callObserver(n, s); - const a = new xTn(this, n, s); - pwe(this, n, a), !n.local && this._hasFormatting && (n._needFormattingCleanup = !0); + _callObserver(e, r) { + super._callObserver(e, r); + const n = new KSe(this, e, r); + JS(this, e, n), !e.local && this._hasFormatting && (e._needFormattingCleanup = !0); } toString() { - let n = "", s = this._start; - for (; s !== null; ) - !s.deleted && s.countable && s.content.constructor === ux && (n += s.content.str), s = s.right; - return n; + let e = "", r = this._start; + for (; r !== null; ) + !r.deleted && r.countable && r.content.constructor === Ic && (e += r.content.str), r = r.right; + return e; } toJSON() { return this.toString(); } - applyDelta(n, { sanitize: s = !0 } = {}) { - this.doc !== null ? Yu(this.doc, (a) => { - const l = new YFe(null, this._start, 0, /* @__PURE__ */ new Map()); - for (let h = 0; h < n.length; h++) { - const f = n[h]; - if (f.insert !== void 0) { - const b = !s && typeof f.insert == "string" && h === n.length - 1 && l.right === null && f.insert.slice(-1) === ` -` ? f.insert.slice(0, -1) : f.insert; - (typeof b != "string" || b.length > 0) && VRe(a, this, l, b, f.attributes || {}); + applyDelta(e, { sanitize: r = !0 } = {}) { + this.doc !== null ? tn(this.doc, (n) => { + const i = new P7(null, this._start, 0, /* @__PURE__ */ new Map()); + for (let s = 0; s < e.length; s++) { + const a = e[s]; + if (a.insert !== void 0) { + const o = !r && typeof a.insert == "string" && s === e.length - 1 && i.right === null && a.insert.slice(-1) === ` +` ? a.insert.slice(0, -1) : a.insert; + (typeof o != "string" || o.length > 0) && FE(n, this, i, o, a.attributes || {}); } else - f.retain !== void 0 ? _Et(a, this, l, f.retain, f.attributes || {}) : f.delete !== void 0 && CEt(a, l, f.delete); - } - }) : this._pending.push(() => this.applyDelta(n)); - } - toDelta(n, s, a) { - const l = [], h = /* @__PURE__ */ new Map(), f = this.doc; - let b = "", w = this._start; - function O() { - if (b.length > 0) { - const E = {}; - let D = !1; - h.forEach((B, z) => { - D = !0, E[z] = B; + a.retain !== void 0 ? ez(n, this, i, a.retain, a.attributes || {}) : a.delete !== void 0 && tz(n, i, a.delete); + } + }) : this._pending.push(() => this.applyDelta(e)); + } + toDelta(e, r, n) { + const i = [], s = /* @__PURE__ */ new Map(), a = this.doc; + let o = "", l = this._start; + function u() { + if (o.length > 0) { + const f = {}; + let d = !1; + s.forEach((g, m) => { + d = !0, f[m] = g; }); - const M = { insert: b }; - D && (M.attributes = E), l.push(M), b = ""; + const p = { insert: o }; + d && (p.attributes = f), i.push(p), o = ""; } } - const S = () => { - for (; w !== null; ) { - if (hB(w, n) || s !== void 0 && hB(w, s)) - switch (w.content.constructor) { - case ux: { - const E = h.get("ychange"); - n !== void 0 && !hB(w, n) ? (E === void 0 || E.user !== w.id.client || E.type !== "removed") && (O(), h.set("ychange", a ? a("removed", w.id) : { type: "removed" })) : s !== void 0 && !hB(w, s) ? (E === void 0 || E.user !== w.id.client || E.type !== "added") && (O(), h.set("ychange", a ? a("added", w.id) : { type: "added" })) : E !== void 0 && (O(), h.delete("ychange")), b += w.content.str; + const h = () => { + for (; l !== null; ) { + if (kp(l, e) || r !== void 0 && kp(l, r)) + switch (l.content.constructor) { + case Ic: { + const f = s.get("ychange"); + e !== void 0 && !kp(l, e) ? (f === void 0 || f.user !== l.id.client || f.type !== "removed") && (u(), s.set("ychange", n ? n("removed", l.id) : { type: "removed" })) : r !== void 0 && !kp(l, r) ? (f === void 0 || f.user !== l.id.client || f.type !== "added") && (u(), s.set("ychange", n ? n("added", l.id) : { type: "added" })) : f !== void 0 && (u(), s.delete("ychange")), o += l.content.str; break; } - case bx: - case TP: { - O(); - const E = { - insert: w.content.getContent()[0] + case Wc: + case I0: { + u(); + const f = { + insert: l.content.getContent()[0] }; - if (h.size > 0) { - const D = {}; - E.attributes = D, h.forEach((M, B) => { - D[B] = M; + if (s.size > 0) { + const d = {}; + f.attributes = d, s.forEach((p, g) => { + d[g] = p; }); } - l.push(E); + i.push(f); break; } - case d0: - hB(w, n) && (O(), rj(h, w.content)); + case Ri: + kp(l, e) && (u(), U1(s, l.content)); break; } - w = w.right; + l = l.right; } - O(); + u(); }; - return n || s ? Yu(f, (E) => { - n && UFe(E, n), s && UFe(E, s), S(); - }, "cleanup") : S(), l; + return e || r ? tn(a, (f) => { + e && N7(f, e), r && N7(f, r), h(); + }, "cleanup") : h(), i; } - insert(n, s, a) { - if (s.length <= 0) + insert(e, r, n) { + if (r.length <= 0) return; - const l = this.doc; - l !== null ? Yu(l, (h) => { - const f = sme(h, this, n); - a || (a = {}, f.currentAttributes.forEach((b, w) => { - a[w] = b; - })), VRe(h, this, f, s, a); - }) : this._pending.push(() => this.insert(n, s, a)); - } - insertEmbed(n, s, a = {}) { - const l = this.doc; - l !== null ? Yu(l, (h) => { - const f = sme(h, this, n); - VRe(h, this, f, s, a); - }) : this._pending.push(() => this.insertEmbed(n, s, a)); - } - delete(n, s) { - if (s === 0) + const i = this.doc; + i !== null ? tn(i, (s) => { + const a = Dw(s, this, e); + n || (n = {}, a.currentAttributes.forEach((o, l) => { + n[l] = o; + })), FE(s, this, a, r, n); + }) : this._pending.push(() => this.insert(e, r, n)); + } + insertEmbed(e, r, n = {}) { + const i = this.doc; + i !== null ? tn(i, (s) => { + const a = Dw(s, this, e); + FE(s, this, a, r, n); + }) : this._pending.push(() => this.insertEmbed(e, r, n)); + } + delete(e, r) { + if (r === 0) return; - const a = this.doc; - a !== null ? Yu(a, (l) => { - CEt(l, sme(l, this, n), s); - }) : this._pending.push(() => this.delete(n, s)); + const n = this.doc; + n !== null ? tn(n, (i) => { + tz(i, Dw(i, this, e), r); + }) : this._pending.push(() => this.delete(e, r)); } - format(n, s, a) { - if (s === 0) + format(e, r, n) { + if (r === 0) return; - const l = this.doc; - l !== null ? Yu(l, (h) => { - const f = sme(h, this, n); - f.right !== null && _Et(h, this, f, s, a); - }) : this._pending.push(() => this.format(n, s, a)); + const i = this.doc; + i !== null ? tn(i, (s) => { + const a = Dw(s, this, e); + a.right !== null && ez(s, this, a, r, n); + }) : this._pending.push(() => this.format(e, r, n)); } - removeAttribute(n) { - this.doc !== null ? Yu(this.doc, (s) => { - fve(s, this, n); - }) : this._pending.push(() => this.removeAttribute(n)); + removeAttribute(e) { + this.doc !== null ? tn(this.doc, (r) => { + U5(r, this, e); + }) : this._pending.push(() => this.removeAttribute(e)); } - setAttribute(n, s) { - this.doc !== null ? Yu(this.doc, (a) => { - nqe(a, this, n, s); - }) : this._pending.push(() => this.setAttribute(n, s)); + setAttribute(e, r) { + this.doc !== null ? tn(this.doc, (n) => { + _M(n, this, e, r); + }) : this._pending.push(() => this.setAttribute(e, r)); } - getAttribute(n) { - return rqe(this, n); + getAttribute(e) { + return AM(this, e); } getAttributes() { - return CIt(this); + return Fee(this); } - _write(n) { - n.writeTypeRef(zTn); + _write(e) { + e.writeTypeRef(vTe); } } -const STn = (r) => new pF(); -class URe { - constructor(n, s = () => !0) { - this._filter = s, this._root = n, this._currentNode = n._start, this._firstCall = !0; +const JSe = (t) => new Pg(); +class zE { + constructor(e, r = () => !0) { + this._filter = r, this._root = e, this._currentNode = e._start, this._firstCall = !0; } [Symbol.iterator]() { return this; } next() { - let n = this._currentNode, s = n && n.content && n.content.type; - if (n !== null && (!this._firstCall || n.deleted || !this._filter(s))) + let e = this._currentNode, r = e && e.content && e.content.type; + if (e !== null && (!this._firstCall || e.deleted || !this._filter(r))) do - if (s = n.content.type, !n.deleted && (s.constructor === RK || s.constructor === cP) && s._start !== null) - n = s._start; + if (r = e.content.type, !e.deleted && (r.constructor === Yy || r.constructor === Jd) && r._start !== null) + e = r._start; else - for (; n !== null; ) - if (n.right !== null) { - n = n.right; + for (; e !== null; ) + if (e.right !== null) { + e = e.right; break; } else - n.parent === this._root ? n = null : n = n.parent._item; - while (n !== null && (n.deleted || !this._filter(n.content.type))); - return this._firstCall = !1, n === null ? { value: void 0, done: !0 } : (this._currentNode = n, { value: n.content.type, done: !1 }); + e.parent === this._root ? e = null : e = e.parent._item; + while (e !== null && (e.deleted || !this._filter(e.content.type))); + return this._firstCall = !1, e === null ? { value: void 0, done: !0 } : (this._currentNode = e, { value: e.content.type, done: !1 }); } } -class cP extends Rp { +class Jd extends us { constructor() { super(), this._prelimContent = []; } get firstChild() { - const n = this._first; - return n ? n.content.getContent()[0] : null; + const e = this._first; + return e ? e.content.getContent()[0] : null; } - _integrate(n, s) { - super._integrate(n, s), this.insert(0, this._prelimContent), this._prelimContent = null; + _integrate(e, r) { + super._integrate(e, r), this.insert(0, this._prelimContent), this._prelimContent = null; } _copy() { - return new cP(); + return new Jd(); } clone() { - const n = new cP(); - return n.insert(0, this.toArray().map((s) => s instanceof Rp ? s.clone() : s)), n; + const e = new Jd(); + return e.insert(0, this.toArray().map((r) => r instanceof us ? r.clone() : r)), e; } get length() { return this._prelimContent === null ? this._length : this._prelimContent.length; } - createTreeWalker(n) { - return new URe(this, n); + createTreeWalker(e) { + return new zE(this, e); } - querySelector(n) { - n = n.toUpperCase(); - const a = new URe(this, (l) => l.nodeName && l.nodeName.toUpperCase() === n).next(); - return a.done ? null : a.value; + querySelector(e) { + e = e.toUpperCase(); + const n = new zE(this, (i) => i.nodeName && i.nodeName.toUpperCase() === e).next(); + return n.done ? null : n.value; } - querySelectorAll(n) { - return n = n.toUpperCase(), w8(new URe(this, (s) => s.nodeName && s.nodeName.toUpperCase() === n)); + querySelectorAll(e) { + return e = e.toUpperCase(), hf(new zE(this, (r) => r.nodeName && r.nodeName.toUpperCase() === e)); } - _callObserver(n, s) { - pwe(this, n, new ETn(this, s, n)); + _callObserver(e, r) { + JS(this, e, new rTe(this, r, e)); } toString() { - return OIt(this, (n) => n.toString()).join(""); + return Nee(this, (e) => e.toString()).join(""); } toJSON() { return this.toString(); } - toDOM(n = document, s = {}, a) { - const l = n.createDocumentFragment(); - return a !== void 0 && a._createAssociation(l, this), NK(this, (h) => { - l.insertBefore(h.toDOM(n, s, a), null); - }), l; + toDOM(e = document, r = {}, n) { + const i = e.createDocumentFragment(); + return n !== void 0 && n._createAssociation(i, this), Qy(this, (s) => { + i.insertBefore(s.toDOM(e, r, n), null); + }), i; } - insert(n, s) { - this.doc !== null ? Yu(this.doc, (a) => { - SIt(a, this, n, s); - }) : this._prelimContent.splice(n, 0, ...s); + insert(e, r) { + this.doc !== null ? tn(this.doc, (n) => { + $ee(n, this, e, r); + }) : this._prelimContent.splice(e, 0, ...r); } - insertAfter(n, s) { + insertAfter(e, r) { if (this.doc !== null) - Yu(this.doc, (a) => { - const l = n && n instanceof Rp ? n._item : n; - hve(a, this, l, s); + tn(this.doc, (n) => { + const i = e && e instanceof us ? e._item : e; + V5(n, this, i, r); }); else { - const a = this._prelimContent, l = n === null ? 0 : a.findIndex((h) => h === n) + 1; - if (l === 0 && n !== null) - throw y8("Reference item not found"); - a.splice(l, 0, ...s); + const n = this._prelimContent, i = e === null ? 0 : n.findIndex((s) => s === e) + 1; + if (i === 0 && e !== null) + throw ff("Reference item not found"); + n.splice(i, 0, ...r); } } - delete(n, s = 1) { - this.doc !== null ? Yu(this.doc, (a) => { - _It(a, this, n, s); - }) : this._prelimContent.splice(n, s); + delete(e, r = 1) { + this.doc !== null ? tn(this.doc, (n) => { + Bee(n, this, e, r); + }) : this._prelimContent.splice(e, r); } toArray() { - return yIt(this); + return Dee(this); } - push(n) { - this.insert(this.length, n); + push(e) { + this.insert(this.length, e); } - unshift(n) { - this.insert(0, n); + unshift(e) { + this.insert(0, e); } - get(n) { - return kIt(this, n); + get(e) { + return Iee(this, e); } - slice(n = 0, s = this.length) { - return wIt(this, n, s); + slice(e = 0, r = this.length) { + return Mee(this, e, r); } - forEach(n) { - NK(this, n); + forEach(e) { + Qy(this, e); } - _write(n) { - n.writeTypeRef(VTn); + _write(e) { + e.writeTypeRef(bTe); } } -const _Tn = (r) => new cP(); -class RK extends cP { - constructor(n = "UNDEFINED") { - super(), this.nodeName = n, this._prelimAttrs = /* @__PURE__ */ new Map(); +const eTe = (t) => new Jd(); +class Yy extends Jd { + constructor(e = "UNDEFINED") { + super(), this.nodeName = e, this._prelimAttrs = /* @__PURE__ */ new Map(); } get nextSibling() { - const n = this._item ? this._item.next : null; - return n ? n.content.type : null; + const e = this._item ? this._item.next : null; + return e ? e.content.type : null; } get prevSibling() { - const n = this._item ? this._item.prev : null; - return n ? n.content.type : null; + const e = this._item ? this._item.prev : null; + return e ? e.content.type : null; } - _integrate(n, s) { - super._integrate(n, s), this._prelimAttrs.forEach((a, l) => { - this.setAttribute(l, a); + _integrate(e, r) { + super._integrate(e, r), this._prelimAttrs.forEach((n, i) => { + this.setAttribute(i, n); }), this._prelimAttrs = null; } _copy() { - return new RK(this.nodeName); + return new Yy(this.nodeName); } clone() { - const n = new RK(this.nodeName), s = this.getAttributes(); - return VCn(s, (a, l) => { - typeof a == "string" && n.setAttribute(l, a); - }), n.insert(0, this.toArray().map((a) => a instanceof Rp ? a.clone() : a)), n; + const e = new Yy(this.nodeName), r = this.getAttributes(); + return bke(r, (n, i) => { + typeof n == "string" && e.setAttribute(i, n); + }), e.insert(0, this.toArray().map((n) => n instanceof us ? n.clone() : n)), e; } toString() { - const n = this.getAttributes(), s = [], a = []; - for (const b in n) - a.push(b); - a.sort(); - const l = a.length; - for (let b = 0; b < l; b++) { - const w = a[b]; - s.push(w + '="' + n[w] + '"'); - } - const h = this.nodeName.toLocaleLowerCase(), f = s.length > 0 ? " " + s.join(" ") : ""; - return `<${h}${f}>${super.toString()}`; - } - removeAttribute(n) { - this.doc !== null ? Yu(this.doc, (s) => { - fve(s, this, n); - }) : this._prelimAttrs.delete(n); - } - setAttribute(n, s) { - this.doc !== null ? Yu(this.doc, (a) => { - nqe(a, this, n, s); - }) : this._prelimAttrs.set(n, s); - } - getAttribute(n) { - return rqe(this, n); - } - hasAttribute(n) { - return EIt(this, n); - } - getAttributes(n) { - return n ? gTn(this, n) : CIt(this); - } - toDOM(n = document, s = {}, a) { - const l = n.createElement(this.nodeName), h = this.getAttributes(); - for (const f in h) { - const b = h[f]; - typeof b == "string" && l.setAttribute(f, b); - } - return NK(this, (f) => { - l.appendChild(f.toDOM(n, s, a)); - }), a !== void 0 && a._createAssociation(l, this), l; - } - _write(n) { - n.writeTypeRef(qTn), n.writeKey(this.nodeName); - } -} -const CTn = (r) => new RK(r.readKey()); -class ETn extends fwe { - constructor(n, s, a) { - super(n, a), this.childListChanged = !1, this.attributesChanged = /* @__PURE__ */ new Set(), s.forEach((l) => { - l === null ? this.childListChanged = !0 : this.attributesChanged.add(l); + const e = this.getAttributes(), r = [], n = []; + for (const o in e) + n.push(o); + n.sort(); + const i = n.length; + for (let o = 0; o < i; o++) { + const l = n[o]; + r.push(l + '="' + e[l] + '"'); + } + const s = this.nodeName.toLocaleLowerCase(), a = r.length > 0 ? " " + r.join(" ") : ""; + return `<${s}${a}>${super.toString()}`; + } + removeAttribute(e) { + this.doc !== null ? tn(this.doc, (r) => { + U5(r, this, e); + }) : this._prelimAttrs.delete(e); + } + setAttribute(e, r) { + this.doc !== null ? tn(this.doc, (n) => { + _M(n, this, e, r); + }) : this._prelimAttrs.set(e, r); + } + getAttribute(e) { + return AM(this, e); + } + hasAttribute(e) { + return zee(this, e); + } + getAttributes(e) { + return e ? QSe(this, e) : Fee(this); + } + toDOM(e = document, r = {}, n) { + const i = e.createElement(this.nodeName), s = this.getAttributes(); + for (const a in s) { + const o = s[a]; + typeof o == "string" && i.setAttribute(a, o); + } + return Qy(this, (a) => { + i.appendChild(a.toDOM(e, r, n)); + }), n !== void 0 && n._createAssociation(i, this), i; + } + _write(e) { + e.writeTypeRef(yTe), e.writeKey(this.nodeName); + } +} +const tTe = (t) => new Yy(t.readKey()); +class rTe extends jS { + constructor(e, r, n) { + super(e, n), this.childListChanged = !1, this.attributesChanged = /* @__PURE__ */ new Set(), r.forEach((i) => { + i === null ? this.childListChanged = !0 : this.attributesChanged.add(i); }); } } -class dve extends e_ { - constructor(n) { - super(), this.hookName = n; +class q5 extends _u { + constructor(e) { + super(), this.hookName = e; } _copy() { - return new dve(this.hookName); + return new q5(this.hookName); } clone() { - const n = new dve(this.hookName); - return this.forEach((s, a) => { - n.set(a, s); - }), n; + const e = new q5(this.hookName); + return this.forEach((r, n) => { + e.set(n, r); + }), e; } - toDOM(n = document, s = {}, a) { - const l = s[this.hookName]; - let h; - return l !== void 0 ? h = l.createDom(this) : h = document.createElement(this.hookName), h.setAttribute("data-yjs-hook", this.hookName), a !== void 0 && a._createAssociation(h, this), h; + toDOM(e = document, r = {}, n) { + const i = r[this.hookName]; + let s; + return i !== void 0 ? s = i.createDom(this) : s = document.createElement(this.hookName), s.setAttribute("data-yjs-hook", this.hookName), n !== void 0 && n._createAssociation(s, this), s; } - _write(n) { - n.writeTypeRef(UTn), n.writeKey(this.hookName); + _write(e) { + e.writeTypeRef(xTe), e.writeKey(this.hookName); } } -const TTn = (r) => new dve(r.readKey()); -class pve extends pF { +const nTe = (t) => new q5(t.readKey()); +class Q5 extends Pg { get nextSibling() { - const n = this._item ? this._item.next : null; - return n ? n.content.type : null; + const e = this._item ? this._item.next : null; + return e ? e.content.type : null; } get prevSibling() { - const n = this._item ? this._item.prev : null; - return n ? n.content.type : null; + const e = this._item ? this._item.prev : null; + return e ? e.content.type : null; } _copy() { - return new pve(); + return new Q5(); } clone() { - const n = new pve(); - return n.applyDelta(this.toDelta()), n; + const e = new Q5(); + return e.applyDelta(this.toDelta()), e; } - toDOM(n = document, s, a) { - const l = n.createTextNode(this.toString()); - return a !== void 0 && a._createAssociation(l, this), l; + toDOM(e = document, r, n) { + const i = e.createTextNode(this.toString()); + return n !== void 0 && n._createAssociation(i, this), i; } toString() { - return this.toDelta().map((n) => { - const s = []; - for (const l in n.attributes) { - const h = []; - for (const f in n.attributes[l]) - h.push({ key: f, value: n.attributes[l][f] }); - h.sort((f, b) => f.key < b.key ? -1 : 1), s.push({ nodeName: l, attrs: h }); - } - s.sort((l, h) => l.nodeName < h.nodeName ? -1 : 1); - let a = ""; - for (let l = 0; l < s.length; l++) { - const h = s[l]; - a += `<${h.nodeName}`; - for (let f = 0; f < h.attrs.length; f++) { - const b = h.attrs[f]; - a += ` ${b.key}="${b.value}"`; - } - a += ">"; - } - a += n.insert; - for (let l = s.length - 1; l >= 0; l--) - a += ``; - return a; + return this.toDelta().map((e) => { + const r = []; + for (const i in e.attributes) { + const s = []; + for (const a in e.attributes[i]) + s.push({ key: a, value: e.attributes[i][a] }); + s.sort((a, o) => a.key < o.key ? -1 : 1), r.push({ nodeName: i, attrs: s }); + } + r.sort((i, s) => i.nodeName < s.nodeName ? -1 : 1); + let n = ""; + for (let i = 0; i < r.length; i++) { + const s = r[i]; + n += `<${s.nodeName}`; + for (let a = 0; a < s.attrs.length; a++) { + const o = s.attrs[a]; + n += ` ${o.key}="${o.value}"`; + } + n += ">"; + } + n += e.insert; + for (let i = r.length - 1; i >= 0; i--) + n += ``; + return n; }).join(""); } toJSON() { return this.toString(); } - _write(n) { - n.writeTypeRef(WTn); + _write(e) { + e.writeTypeRef(wTe); } } -const ATn = (r) => new pve(); -class iqe { - constructor(n, s) { - this.id = n, this.length = s; +const iTe = (t) => new Q5(); +class LM { + constructor(e, r) { + this.id = e, this.length = r; } get deleted() { - throw nx(); + throw Ac(); } - mergeWith(n) { + mergeWith(e) { return !1; } - write(n, s, a) { - throw nx(); + write(e, r, n) { + throw Ac(); } - integrate(n, s) { - throw nx(); + integrate(e, r) { + throw Ac(); } } -const DTn = 0; -class jy extends iqe { +const sTe = 0; +class _o extends LM { get deleted() { return !0; } delete() { } - mergeWith(n) { - return this.constructor !== n.constructor ? !1 : (this.length += n.length, !0); + mergeWith(e) { + return this.constructor !== e.constructor ? !1 : (this.length += e.length, !0); } - integrate(n, s) { - s > 0 && (this.id.clock += s, this.length -= s), dIt(n.doc.store, this); + integrate(e, r) { + r > 0 && (this.id.clock += r, this.length -= r), Cee(e.doc.store, this); } - write(n, s) { - n.writeInfo(DTn), n.writeLen(this.length - s); + write(e, r) { + e.writeInfo(sTe), e.writeLen(this.length - r); } - getMissing(n, s) { + getMissing(e, r) { return null; } } -class zJ { - constructor(n) { - this.content = n; +class ex { + constructor(e) { + this.content = e; } getLength() { return 1; @@ -18990,31 +18999,31 @@ class zJ { return !0; } copy() { - return new zJ(this.content); + return new ex(this.content); } - splice(n) { - throw nx(); + splice(e) { + throw Ac(); } - mergeWith(n) { + mergeWith(e) { return !1; } - integrate(n, s) { + integrate(e, r) { } - delete(n) { + delete(e) { } - gc(n) { + gc(e) { } - write(n, s) { - n.writeBuf(this.content); + write(e, r) { + e.writeBuf(this.content); } getRef() { return 3; } } -const MTn = (r) => new zJ(r.readBuf()); -class $K { - constructor(n) { - this.len = n; +const aTe = (t) => new ex(t.readBuf()); +class Wy { + constructor(e) { + this.len = e; } getLength() { return this.len; @@ -19026,35 +19035,35 @@ class $K { return !1; } copy() { - return new $K(this.len); + return new Wy(this.len); } - splice(n) { - const s = new $K(this.len - n); - return this.len = n, s; + splice(e) { + const r = new Wy(this.len - e); + return this.len = e, r; } - mergeWith(n) { - return this.len += n.len, !0; + mergeWith(e) { + return this.len += e.len, !0; } - integrate(n, s) { - PK(n.deleteSet, s.id.client, s.id.clock, this.len), s.markDeleted(); + integrate(e, r) { + Vy(e.deleteSet, r.id.client, r.id.clock, this.len), r.markDeleted(); } - delete(n) { + delete(e) { } - gc(n) { + gc(e) { } - write(n, s) { - n.writeLen(this.len - s); + write(e, r) { + e.writeLen(this.len - r); } getRef() { return 1; } } -const PTn = (r) => new $K(r.readLen()), PIt = (r, n) => new nj({ guid: r, ...n, shouldLoad: n.shouldLoad || n.autoLoad || !1 }); -class qJ { - constructor(n) { - n._item && console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."), this.doc = n; - const s = {}; - this.opts = s, n.gc || (s.gc = !1), n.autoLoad && (s.autoLoad = !0), n.meta !== null && (s.meta = n.meta); +const oTe = (t) => new Wy(t.readLen()), Yee = (t, e) => new V1({ guid: t, ...e, shouldLoad: e.shouldLoad || e.autoLoad || !1 }); +class tx { + constructor(e) { + e._item && console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."), this.doc = e; + const r = {}; + this.opts = r, e.gc || (r.gc = !1), e.autoLoad && (r.autoLoad = !0), e.meta !== null && (r.meta = e.meta); } getLength() { return 1; @@ -19066,33 +19075,33 @@ class qJ { return !0; } copy() { - return new qJ(PIt(this.doc.guid, this.opts)); + return new tx(Yee(this.doc.guid, this.opts)); } - splice(n) { - throw nx(); + splice(e) { + throw Ac(); } - mergeWith(n) { + mergeWith(e) { return !1; } - integrate(n, s) { - this.doc._item = s, n.subdocsAdded.add(this.doc), this.doc.shouldLoad && n.subdocsLoaded.add(this.doc); + integrate(e, r) { + this.doc._item = r, e.subdocsAdded.add(this.doc), this.doc.shouldLoad && e.subdocsLoaded.add(this.doc); } - delete(n) { - n.subdocsAdded.has(this.doc) ? n.subdocsAdded.delete(this.doc) : n.subdocsRemoved.add(this.doc); + delete(e) { + e.subdocsAdded.has(this.doc) ? e.subdocsAdded.delete(this.doc) : e.subdocsRemoved.add(this.doc); } - gc(n) { + gc(e) { } - write(n, s) { - n.writeString(this.doc.guid), n.writeAny(this.opts); + write(e, r) { + e.writeString(this.doc.guid), e.writeAny(this.opts); } getRef() { return 9; } } -const LTn = (r) => new qJ(PIt(r.readString(), r.readAny())); -class TP { - constructor(n) { - this.embed = n; +const lTe = (t) => new tx(Yee(t.readString(), t.readAny())); +class I0 { + constructor(e) { + this.embed = e; } getLength() { return 1; @@ -19104,31 +19113,31 @@ class TP { return !0; } copy() { - return new TP(this.embed); + return new I0(this.embed); } - splice(n) { - throw nx(); + splice(e) { + throw Ac(); } - mergeWith(n) { + mergeWith(e) { return !1; } - integrate(n, s) { + integrate(e, r) { } - delete(n) { + delete(e) { } - gc(n) { + gc(e) { } - write(n, s) { - n.writeJSON(this.embed); + write(e, r) { + e.writeJSON(this.embed); } getRef() { return 5; } } -const ITn = (r) => new TP(r.readJSON()); -class d0 { - constructor(n, s) { - this.key = n, this.value = s; +const cTe = (t) => new I0(t.readJSON()); +class Ri { + constructor(e, r) { + this.key = e, this.value = r; } getLength() { return 1; @@ -19140,33 +19149,33 @@ class d0 { return !1; } copy() { - return new d0(this.key, this.value); + return new Ri(this.key, this.value); } - splice(n) { - throw nx(); + splice(e) { + throw Ac(); } - mergeWith(n) { + mergeWith(e) { return !1; } - integrate(n, s) { - const a = s.parent; - a._searchMarker = null, a._hasFormatting = !0; + integrate(e, r) { + const n = r.parent; + n._searchMarker = null, n._hasFormatting = !0; } - delete(n) { + delete(e) { } - gc(n) { + gc(e) { } - write(n, s) { - n.writeKey(this.key), n.writeJSON(this.value); + write(e, r) { + e.writeKey(this.key), e.writeJSON(this.value); } getRef() { return 6; } } -const NTn = (r) => new d0(r.readKey(), r.readJSON()); -class gve { - constructor(n) { - this.arr = n; +const uTe = (t) => new Ri(t.readKey(), t.readJSON()); +class Y5 { + constructor(e) { + this.arr = e; } getLength() { return this.arr.length; @@ -19178,44 +19187,44 @@ class gve { return !0; } copy() { - return new gve(this.arr); + return new Y5(this.arr); } - splice(n) { - const s = new gve(this.arr.slice(n)); - return this.arr = this.arr.slice(0, n), s; + splice(e) { + const r = new Y5(this.arr.slice(e)); + return this.arr = this.arr.slice(0, e), r; } - mergeWith(n) { - return this.arr = this.arr.concat(n.arr), !0; + mergeWith(e) { + return this.arr = this.arr.concat(e.arr), !0; } - integrate(n, s) { + integrate(e, r) { } - delete(n) { + delete(e) { } - gc(n) { + gc(e) { } - write(n, s) { - const a = this.arr.length; - n.writeLen(a - s); - for (let l = s; l < a; l++) { - const h = this.arr[l]; - n.writeString(h === void 0 ? "undefined" : JSON.stringify(h)); + write(e, r) { + const n = this.arr.length; + e.writeLen(n - r); + for (let i = r; i < n; i++) { + const s = this.arr[i]; + e.writeString(s === void 0 ? "undefined" : JSON.stringify(s)); } } getRef() { return 2; } } -const RTn = (r) => { - const n = r.readLen(), s = []; - for (let a = 0; a < n; a++) { - const l = r.readString(); - l === "undefined" ? s.push(void 0) : s.push(JSON.parse(l)); +const hTe = (t) => { + const e = t.readLen(), r = []; + for (let n = 0; n < e; n++) { + const i = t.readString(); + i === "undefined" ? r.push(void 0) : r.push(JSON.parse(i)); } - return new gve(s); + return new Y5(r); }; -class lP { - constructor(n) { - this.arr = n; +class e0 { + constructor(e) { + this.arr = e; } getLength() { return this.arr.length; @@ -19227,42 +19236,42 @@ class lP { return !0; } copy() { - return new lP(this.arr); + return new e0(this.arr); } - splice(n) { - const s = new lP(this.arr.slice(n)); - return this.arr = this.arr.slice(0, n), s; + splice(e) { + const r = new e0(this.arr.slice(e)); + return this.arr = this.arr.slice(0, e), r; } - mergeWith(n) { - return this.arr = this.arr.concat(n.arr), !0; + mergeWith(e) { + return this.arr = this.arr.concat(e.arr), !0; } - integrate(n, s) { + integrate(e, r) { } - delete(n) { + delete(e) { } - gc(n) { + gc(e) { } - write(n, s) { - const a = this.arr.length; - n.writeLen(a - s); - for (let l = s; l < a; l++) { - const h = this.arr[l]; - n.writeAny(h); + write(e, r) { + const n = this.arr.length; + e.writeLen(n - r); + for (let i = r; i < n; i++) { + const s = this.arr[i]; + e.writeAny(s); } } getRef() { return 8; } } -const $Tn = (r) => { - const n = r.readLen(), s = []; - for (let a = 0; a < n; a++) - s.push(r.readAny()); - return new lP(s); +const fTe = (t) => { + const e = t.readLen(), r = []; + for (let n = 0; n < e; n++) + r.push(t.readAny()); + return new e0(r); }; -class ux { - constructor(n) { - this.str = n; +class Ic { + constructor(e) { + this.str = e; } getLength() { return this.str.length; @@ -19274,42 +19283,42 @@ class ux { return !0; } copy() { - return new ux(this.str); + return new Ic(this.str); } - splice(n) { - const s = new ux(this.str.slice(n)); - this.str = this.str.slice(0, n); - const a = this.str.charCodeAt(n - 1); - return a >= 55296 && a <= 56319 && (this.str = this.str.slice(0, n - 1) + "\uFFFD", s.str = "\uFFFD" + s.str.slice(1)), s; + splice(e) { + const r = new Ic(this.str.slice(e)); + this.str = this.str.slice(0, e); + const n = this.str.charCodeAt(e - 1); + return n >= 55296 && n <= 56319 && (this.str = this.str.slice(0, e - 1) + "\uFFFD", r.str = "\uFFFD" + r.str.slice(1)), r; } - mergeWith(n) { - return this.str += n.str, !0; + mergeWith(e) { + return this.str += e.str, !0; } - integrate(n, s) { + integrate(e, r) { } - delete(n) { + delete(e) { } - gc(n) { + gc(e) { } - write(n, s) { - n.writeString(s === 0 ? this.str : this.str.slice(s)); + write(e, r) { + e.writeString(r === 0 ? this.str : this.str.slice(r)); } getRef() { return 4; } } -const BTn = (r) => new ux(r.readString()), FTn = [ - bTn, - wTn, - STn, - CTn, - _Tn, - TTn, - ATn -], jTn = 0, QTn = 1, zTn = 2, qTn = 3, VTn = 4, UTn = 5, WTn = 6; -class bx { - constructor(n) { - this.type = n; +const dTe = (t) => new Ic(t.readString()), pTe = [ + WSe, + HSe, + JSe, + tTe, + eTe, + nTe, + iTe +], gTe = 0, mTe = 1, vTe = 2, yTe = 3, bTe = 4, xTe = 5, wTe = 6; +class Wc { + constructor(e) { + this.type = e; } getLength() { return 1; @@ -19321,365 +19330,365 @@ class bx { return !0; } copy() { - return new bx(this.type._copy()); + return new Wc(this.type._copy()); } - splice(n) { - throw nx(); + splice(e) { + throw Ac(); } - mergeWith(n) { + mergeWith(e) { return !1; } - integrate(n, s) { - this.type._integrate(n.doc, s); - } - delete(n) { - let s = this.type._start; - for (; s !== null; ) - s.deleted ? s.id.clock < (n.beforeState.get(s.id.client) || 0) && n._mergeStructs.push(s) : s.delete(n), s = s.right; - this.type._map.forEach((a) => { - a.deleted ? a.id.clock < (n.beforeState.get(a.id.client) || 0) && n._mergeStructs.push(a) : a.delete(n); - }), n.changed.delete(this.type); - } - gc(n) { - let s = this.type._start; - for (; s !== null; ) - s.gc(n, !0), s = s.right; - this.type._start = null, this.type._map.forEach((a) => { - for (; a !== null; ) - a.gc(n, !0), a = a.left; + integrate(e, r) { + this.type._integrate(e.doc, r); + } + delete(e) { + let r = this.type._start; + for (; r !== null; ) + r.deleted ? r.id.clock < (e.beforeState.get(r.id.client) || 0) && e._mergeStructs.push(r) : r.delete(e), r = r.right; + this.type._map.forEach((n) => { + n.deleted ? n.id.clock < (e.beforeState.get(n.id.client) || 0) && e._mergeStructs.push(n) : n.delete(e); + }), e.changed.delete(this.type); + } + gc(e) { + let r = this.type._start; + for (; r !== null; ) + r.gc(e, !0), r = r.right; + this.type._start = null, this.type._map.forEach((n) => { + for (; n !== null; ) + n.gc(e, !0), n = n.left; }), this.type._map = /* @__PURE__ */ new Map(); } - write(n, s) { - this.type._write(n); + write(e, r) { + this.type._write(e); } getRef() { return 7; } } -const YTn = (r) => new bx(FTn[r.readTypeRef()](r)), HFe = (r, n) => { - let s = n, a = 0, l; +const OTe = (t) => new Wc(pTe[t.readTypeRef()](t)), $7 = (t, e) => { + let r = e, n = 0, i; do - a > 0 && (s = Za(s.client, s.clock + a)), l = rbe(r, s), a = s.clock - l.id.clock, s = l.redone; - while (s !== null && l instanceof Gu); + n > 0 && (r = pr(r.client, r.clock + n)), i = p4(t, r), n = r.clock - i.id.clock, r = i.redone; + while (r !== null && i instanceof rn); return { - item: l, - diff: a + item: i, + diff: n }; -}, sqe = (r, n) => { - for (; r !== null && r.keep !== n; ) - r.keep = n, r = r.parent._item; -}, mve = (r, n, s) => { - const { client: a, clock: l } = n.id, h = new Gu( - Za(a, l + s), - n, - Za(a, l + s - 1), - n.right, - n.rightOrigin, - n.parent, - n.parentSub, - n.content.splice(s) +}, RM = (t, e) => { + for (; t !== null && t.keep !== e; ) + t.keep = e, t = t.parent._item; +}, W5 = (t, e, r) => { + const { client: n, clock: i } = e.id, s = new rn( + pr(n, i + r), + e, + pr(n, i + r - 1), + e.right, + e.rightOrigin, + e.parent, + e.parentSub, + e.content.splice(r) ); - return n.deleted && h.markDeleted(), n.keep && (h.keep = !0), n.redone !== null && (h.redone = Za(n.redone.client, n.redone.clock + s)), n.right = h, h.right !== null && (h.right.left = h), r._mergeStructs.push(h), h.parentSub !== null && h.right === null && h.parent._map.set(h.parentSub, h), n.length = s, h; -}, EEt = (r, n) => oCn(r, (s) => jJ(s.deletions, n)), LIt = (r, n, s, a, l, h) => { - const f = r.doc, b = f.store, w = f.clientID, O = n.redone; - if (O !== null) - return tv(r, O); - let S = n.parent._item, E = null, D; - if (S !== null && S.deleted === !0) { - if (S.redone === null && (!s.has(S) || LIt(r, S, s, a, l, h) === null)) + return e.deleted && s.markDeleted(), e.keep && (s.keep = !0), e.redone !== null && (s.redone = pr(e.redone.client, e.redone.clock + r)), e.right = s, s.right !== null && (s.right.left = s), t._mergeStructs.push(s), s.parentSub !== null && s.right === null && s.parent._map.set(s.parentSub, s), e.length = r, s; +}, rz = (t, e) => I3e(t, (r) => Kb(r.deletions, e)), Wee = (t, e, r, n, i, s) => { + const a = t.doc, o = a.store, l = a.clientID, u = e.redone; + if (u !== null) + return Ca(t, u); + let h = e.parent._item, f = null, d; + if (h !== null && h.deleted === !0) { + if (h.redone === null && (!r.has(h) || Wee(t, h, r, n, i, s) === null)) return null; - for (; S.redone !== null; ) - S = tv(r, S.redone); - } - const M = S === null ? n.parent : S.content.type; - if (n.parentSub === null) { - for (E = n.left, D = n; E !== null; ) { - let H = E; - for (; H !== null && H.parent._item !== S; ) - H = H.redone === null ? null : tv(r, H.redone); - if (H !== null && H.parent._item === S) { - E = H; + for (; h.redone !== null; ) + h = Ca(t, h.redone); + } + const p = h === null ? e.parent : h.content.type; + if (e.parentSub === null) { + for (f = e.left, d = e; f !== null; ) { + let y = f; + for (; y !== null && y.parent._item !== h; ) + y = y.redone === null ? null : Ca(t, y.redone); + if (y !== null && y.parent._item === h) { + f = y; break; } - E = E.left; + f = f.left; } - for (; D !== null; ) { - let H = D; - for (; H !== null && H.parent._item !== S; ) - H = H.redone === null ? null : tv(r, H.redone); - if (H !== null && H.parent._item === S) { - D = H; + for (; d !== null; ) { + let y = d; + for (; y !== null && y.parent._item !== h; ) + y = y.redone === null ? null : Ca(t, y.redone); + if (y !== null && y.parent._item === h) { + d = y; break; } - D = D.right; + d = d.right; } - } else if (D = null, n.right && !l) { - for (E = n; E !== null && E.right !== null && (E.right.redone || jJ(a, E.right.id) || EEt(h.undoStack, E.right.id) || EEt(h.redoStack, E.right.id)); ) - for (E = E.right; E.redone; ) - E = tv(r, E.redone); - if (E && E.right !== null) + } else if (d = null, e.right && !i) { + for (f = e; f !== null && f.right !== null && (f.right.redone || Kb(n, f.right.id) || rz(s.undoStack, f.right.id) || rz(s.redoStack, f.right.id)); ) + for (f = f.right; f.redone; ) + f = Ca(t, f.redone); + if (f && f.right !== null) return null; } else - E = M._map.get(n.parentSub) || null; - const B = jd(b, w), z = Za(w, B), W = new Gu( - z, - E, - E && E.lastId, - D, - D && D.id, - M, - n.parentSub, - n.content.copy() + f = p._map.get(e.parentSub) || null; + const g = ti(o, l), m = pr(l, g), v = new rn( + m, + f, + f && f.lastId, + d, + d && d.id, + p, + e.parentSub, + e.content.copy() ); - return n.redone = z, sqe(W, !0), W.integrate(r, 0), W; + return e.redone = m, RM(v, !0), v.integrate(t, 0), v; }; -class Gu extends iqe { - constructor(n, s, a, l, h, f, b, w) { - super(n, w.getLength()), this.origin = a, this.left = s, this.right = l, this.rightOrigin = h, this.parent = f, this.parentSub = b, this.redone = null, this.content = w, this.info = this.content.isCountable() ? nEt : 0; +class rn extends LM { + constructor(e, r, n, i, s, a, o, l) { + super(e, l.getLength()), this.origin = n, this.left = r, this.right = i, this.rightOrigin = s, this.parent = a, this.parentSub = o, this.redone = null, this.content = l, this.info = this.content.isCountable() ? RF : 0; } - set marker(n) { - (this.info & FRe) > 0 !== n && (this.info ^= FRe); + set marker(e) { + (this.info & NE) > 0 !== e && (this.info ^= NE); } get marker() { - return (this.info & FRe) > 0; + return (this.info & NE) > 0; } get keep() { - return (this.info & tEt) > 0; + return (this.info & LF) > 0; } - set keep(n) { - this.keep !== n && (this.info ^= tEt); + set keep(e) { + this.keep !== e && (this.info ^= LF); } get countable() { - return (this.info & nEt) > 0; + return (this.info & RF) > 0; } get deleted() { - return (this.info & BRe) > 0; + return (this.info & DE) > 0; } - set deleted(n) { - this.deleted !== n && (this.info ^= BRe); + set deleted(e) { + this.deleted !== e && (this.info ^= DE); } markDeleted() { - this.info |= BRe; + this.info |= DE; } - getMissing(n, s) { - if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= jd(s, this.origin.client)) + getMissing(e, r) { + if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= ti(r, this.origin.client)) return this.origin.client; - if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= jd(s, this.rightOrigin.client)) + if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= ti(r, this.rightOrigin.client)) return this.rightOrigin.client; - if (this.parent && this.parent.constructor === RB && this.id.client !== this.parent.client && this.parent.clock >= jd(s, this.parent.client)) + if (this.parent && this.parent.constructor === Zp && this.id.client !== this.parent.client && this.parent.clock >= ti(r, this.parent.client)) return this.parent.client; - if (this.origin && (this.left = vEt(n, s, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = tv(n, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === jy || this.right && this.right.constructor === jy) + if (this.origin && (this.left = GF(e, r, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = Ca(e, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === _o || this.right && this.right.constructor === _o) this.parent = null; else if (!this.parent) - this.left && this.left.constructor === Gu && (this.parent = this.left.parent, this.parentSub = this.left.parentSub), this.right && this.right.constructor === Gu && (this.parent = this.right.parent, this.parentSub = this.right.parentSub); - else if (this.parent.constructor === RB) { - const a = rbe(s, this.parent); - a.constructor === jy ? this.parent = null : this.parent = a.content.type; + this.left && this.left.constructor === rn && (this.parent = this.left.parent, this.parentSub = this.left.parentSub), this.right && this.right.constructor === rn && (this.parent = this.right.parent, this.parentSub = this.right.parentSub); + else if (this.parent.constructor === Zp) { + const n = p4(r, this.parent); + n.constructor === _o ? this.parent = null : this.parent = n.content.type; } return null; } - integrate(n, s) { - if (s > 0 && (this.id.clock += s, this.left = vEt(n, n.doc.store, Za(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(s), this.length -= s), this.parent) { + integrate(e, r) { + if (r > 0 && (this.id.clock += r, this.left = GF(e, e.doc.store, pr(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(r), this.length -= r), this.parent) { if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) { - let a = this.left, l; - if (a !== null) - l = a.right; + let n = this.left, i; + if (n !== null) + i = n.right; else if (this.parentSub !== null) - for (l = this.parent._map.get(this.parentSub) || null; l !== null && l.left !== null; ) - l = l.left; + for (i = this.parent._map.get(this.parentSub) || null; i !== null && i.left !== null; ) + i = i.left; else - l = this.parent._start; - const h = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(); - for (; l !== null && l !== this.right; ) { - if (f.add(l), h.add(l), vB(this.origin, l.origin)) { - if (l.id.client < this.id.client) - a = l, h.clear(); - else if (vB(this.rightOrigin, l.rightOrigin)) + i = this.parent._start; + const s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(); + for (; i !== null && i !== this.right; ) { + if (a.add(i), s.add(i), Rp(this.origin, i.origin)) { + if (i.id.client < this.id.client) + n = i, s.clear(); + else if (Rp(this.rightOrigin, i.rightOrigin)) break; - } else if (l.origin !== null && f.has(rbe(n.doc.store, l.origin))) - h.has(rbe(n.doc.store, l.origin)) || (a = l, h.clear()); + } else if (i.origin !== null && a.has(p4(e.doc.store, i.origin))) + s.has(p4(e.doc.store, i.origin)) || (n = i, s.clear()); else break; - l = l.right; + i = i.right; } - this.left = a; + this.left = n; } if (this.left !== null) { - const a = this.left.right; - this.right = a, this.left.right = this; + const n = this.left.right; + this.right = n, this.left.right = this; } else { - let a; + let n; if (this.parentSub !== null) - for (a = this.parent._map.get(this.parentSub) || null; a !== null && a.left !== null; ) - a = a.left; + for (n = this.parent._map.get(this.parentSub) || null; n !== null && n.left !== null; ) + n = n.left; else - a = this.parent._start, this.parent._start = this; - this.right = a; + n = this.parent._start, this.parent._start = this; + this.right = n; } - this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(n)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), dIt(n.doc.store, this), this.content.integrate(n, this), yEt(n, this.parent, this.parentSub), (this.parent._item !== null && this.parent._item.deleted || this.parentSub !== null && this.right !== null) && this.delete(n); + this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(e)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), Cee(e.doc.store, this), this.content.integrate(e, this), XF(e, this.parent, this.parentSub), (this.parent._item !== null && this.parent._item.deleted || this.parentSub !== null && this.right !== null) && this.delete(e); } else - new jy(this.id, this.length).integrate(n, 0); + new _o(this.id, this.length).integrate(e, 0); } get next() { - let n = this.right; - for (; n !== null && n.deleted; ) - n = n.right; - return n; + let e = this.right; + for (; e !== null && e.deleted; ) + e = e.right; + return e; } get prev() { - let n = this.left; - for (; n !== null && n.deleted; ) - n = n.left; - return n; + let e = this.left; + for (; e !== null && e.deleted; ) + e = e.left; + return e; } get lastId() { - return this.length === 1 ? this.id : Za(this.id.client, this.id.clock + this.length - 1); + return this.length === 1 ? this.id : pr(this.id.client, this.id.clock + this.length - 1); } - mergeWith(n) { - if (this.constructor === n.constructor && vB(n.origin, this.lastId) && this.right === n && vB(this.rightOrigin, n.rightOrigin) && this.id.client === n.id.client && this.id.clock + this.length === n.id.clock && this.deleted === n.deleted && this.redone === null && n.redone === null && this.content.constructor === n.content.constructor && this.content.mergeWith(n.content)) { - const s = this.parent._searchMarker; - return s && s.forEach((a) => { - a.p === n && (a.p = this, !this.deleted && this.countable && (a.index -= this.length)); - }), n.keep && (this.keep = !0), this.right = n.right, this.right !== null && (this.right.left = this), this.length += n.length, !0; + mergeWith(e) { + if (this.constructor === e.constructor && Rp(e.origin, this.lastId) && this.right === e && Rp(this.rightOrigin, e.rightOrigin) && this.id.client === e.id.client && this.id.clock + this.length === e.id.clock && this.deleted === e.deleted && this.redone === null && e.redone === null && this.content.constructor === e.content.constructor && this.content.mergeWith(e.content)) { + const r = this.parent._searchMarker; + return r && r.forEach((n) => { + n.p === e && (n.p = this, !this.deleted && this.countable && (n.index -= this.length)); + }), e.keep && (this.keep = !0), this.right = e.right, this.right !== null && (this.right.left = this), this.length += e.length, !0; } return !1; } - delete(n) { + delete(e) { if (!this.deleted) { - const s = this.parent; - this.countable && this.parentSub === null && (s._length -= this.length), this.markDeleted(), PK(n.deleteSet, this.id.client, this.id.clock, this.length), yEt(n, s, this.parentSub), this.content.delete(n); + const r = this.parent; + this.countable && this.parentSub === null && (r._length -= this.length), this.markDeleted(), Vy(e.deleteSet, this.id.client, this.id.clock, this.length), XF(e, r, this.parentSub), this.content.delete(e); } } - gc(n, s) { + gc(e, r) { if (!this.deleted) - throw vk(); - this.content.gc(n), s ? KEn(n, this, new jy(this.id, this.length)) : this.content = new $K(this.length); - } - write(n, s) { - const a = s > 0 ? Za(this.id.client, this.id.clock + s - 1) : this.origin, l = this.rightOrigin, h = this.parentSub, f = this.content.getRef() & cwe | (a === null ? 0 : j2) | (l === null ? 0 : J6) | (h === null ? 0 : TK); - if (n.writeInfo(f), a !== null && n.writeLeftID(a), l !== null && n.writeRightID(l), a === null && l === null) { - const b = this.parent; - if (b._item !== void 0) { - const w = b._item; - if (w === null) { - const O = uIt(b); - n.writeParentInfo(!0), n.writeString(O); + throw Il(); + this.content.gc(e), r ? ESe(e, this, new _o(this.id, this.length)) : this.content = new Wy(this.length); + } + write(e, r) { + const n = r > 0 ? pr(this.id.client, this.id.clock + r - 1) : this.origin, i = this.rightOrigin, s = this.parentSub, a = this.content.getRef() & GS | (n === null ? 0 : so) | (i === null ? 0 : Eu) | (s === null ? 0 : $y); + if (e.writeInfo(a), n !== null && e.writeLeftID(n), i !== null && e.writeRightID(i), n === null && i === null) { + const o = this.parent; + if (o._item !== void 0) { + const l = o._item; + if (l === null) { + const u = kee(o); + e.writeParentInfo(!0), e.writeString(u); } else - n.writeParentInfo(!1), n.writeLeftID(w.id); + e.writeParentInfo(!1), e.writeLeftID(l.id); } else - b.constructor === String ? (n.writeParentInfo(!0), n.writeString(b)) : b.constructor === RB ? (n.writeParentInfo(!1), n.writeLeftID(b)) : vk(); - h !== null && n.writeString(h); + o.constructor === String ? (e.writeParentInfo(!0), e.writeString(o)) : o.constructor === Zp ? (e.writeParentInfo(!1), e.writeLeftID(o)) : Il(); + s !== null && e.writeString(s); } - this.content.write(n, s); + this.content.write(e, r); } } -const IIt = (r, n) => HTn[n & cwe](r), HTn = [ +const Gee = (t, e) => kTe[e & GS](t), kTe = [ () => { - vk(); - }, - PTn, - RTn, - MTn, - BTn, - ITn, - NTn, - YTn, - $Tn, - LTn, + Il(); + }, + oTe, + hTe, + aTe, + dTe, + cTe, + uTe, + OTe, + fTe, + lTe, () => { - vk(); + Il(); } -], GTn = 10; -class Qy extends iqe { +], STe = 10; +class Ao extends LM { get deleted() { return !0; } delete() { } - mergeWith(n) { - return this.constructor !== n.constructor ? !1 : (this.length += n.length, !0); + mergeWith(e) { + return this.constructor !== e.constructor ? !1 : (this.length += e.length, !0); } - integrate(n, s) { - vk(); + integrate(e, r) { + Il(); } - write(n, s) { - n.writeInfo(GTn), Eo(n.restEncoder, this.length - s); + write(e, r) { + e.writeInfo(STe), Wt(e.restEncoder, this.length - r); } - getMissing(n, s) { + getMissing(e, r) { return null; } } -const NIt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}, RIt = "__ $YJS$ __"; -NIt[RIt] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"); -NIt[RIt] = !0; -class oqe { - constructor(n, s) { - this.yanchor = n, this.yhead = s; +const Hee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}, Xee = "__ $YJS$ __"; +Hee[Xee] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"); +Hee[Xee] = !0; +class MM { + constructor(e, r) { + this.yanchor = e, this.yhead = r; } toJSON() { return { - yanchor: mEt(this.yanchor), - yhead: mEt(this.yhead) + yanchor: YF(this.yanchor), + yhead: YF(this.yhead) }; } - static fromJSON(n) { - return new oqe(LK(n.yanchor), LK(n.yhead)); + static fromJSON(e) { + return new MM(Uy(e.yanchor), Uy(e.yhead)); } } -class ZTn { - constructor(n, s) { - this.ytext = n, this.awareness = s, this.undoManager = new Xze(n); +class TTe { + constructor(e, r) { + this.ytext = e, this.awareness = r, this.undoManager = new kM(e); } - toYPos(n, s = 0) { - return qFe(this.ytext, n, s); + toYPos(e, r = 0) { + return M7(this.ytext, e, r); } - fromYPos(n) { - const s = VFe(LK(n), this.ytext.doc); - if (s == null || s.type !== this.ytext) + fromYPos(e) { + const r = D7(Uy(e), this.ytext.doc); + if (r == null || r.type !== this.ytext) throw new Error("[y-codemirror] The position you want to retrieve was created by a different document"); return { - pos: s.index, - assoc: s.assoc + pos: r.index, + assoc: r.assoc }; } - toYRange(n) { - const s = n.assoc, a = this.toYPos(n.anchor, s), l = this.toYPos(n.head, s); - return new oqe(a, l); - } - fromYRange(n) { - const s = this.fromYPos(n.yanchor), a = this.fromYPos(n.yhead); - return s.pos === a.pos ? sr.cursor(a.pos, a.assoc) : sr.range(s.pos, a.pos); - } -} -const gwe = us.define({ - combine(r) { - return r[r.length - 1]; - } -}), GFe = _k.define(); -class XTn { - constructor(n) { - this.view = n, this.conf = n.state.facet(gwe), this._observer = (s, a) => { - if (a.origin !== this.conf) { - const l = s.delta, h = []; - let f = 0; - for (let b = 0; b < l.length; b++) { - const w = l[b]; - w.insert != null ? h.push({ from: f, to: f, insert: w.insert }) : w.delete != null ? (h.push({ from: f, to: f + w.delete, insert: "" }), f += w.delete) : f += w.retain; + toYRange(e) { + const r = e.assoc, n = this.toYPos(e.anchor, r), i = this.toYPos(e.head, r); + return new MM(n, i); + } + fromYRange(e) { + const r = this.fromYPos(e.yanchor), n = this.fromYPos(e.yhead); + return r.pos === n.pos ? Ve.cursor(n.pos, n.assoc) : Ve.range(r.pos, n.pos); + } +} +const eT = _t.define({ + combine(t) { + return t[t.length - 1]; + } +}), B7 = Vl.define(); +class CTe { + constructor(e) { + this.view = e, this.conf = e.state.facet(eT), this._observer = (r, n) => { + if (n.origin !== this.conf) { + const i = r.delta, s = []; + let a = 0; + for (let o = 0; o < i.length; o++) { + const l = i[o]; + l.insert != null ? s.push({ from: a, to: a, insert: l.insert }) : l.delete != null ? (s.push({ from: a, to: a + l.delete, insert: "" }), a += l.delete) : a += l.retain; } - n.dispatch({ changes: h, annotations: [GFe.of(this.conf)] }); + e.dispatch({ changes: s, annotations: [B7.of(this.conf)] }); } }, this._ytext = this.conf.ytext, this._ytext.observe(this._observer); } - update(n) { - if (!n.docChanged || n.transactions.length > 0 && n.transactions[0].annotation(GFe) === this.conf) + update(e) { + if (!e.docChanged || e.transactions.length > 0 && e.transactions[0].annotation(B7) === this.conf) return; - const s = this.conf.ytext; - s.doc.transact(() => { - let a = 0; - n.changes.iterChanges((l, h, f, b, w) => { - const O = w.sliceString(0, w.length, ` + const r = this.conf.ytext; + r.doc.transact(() => { + let n = 0; + e.changes.iterChanges((i, s, a, o, l) => { + const u = l.sliceString(0, l.length, ` `); - l !== h && s.delete(l + a, h - l), O.length > 0 && s.insert(l + a, O), a += O.length - (h - l); + i !== s && r.delete(i + n, s - i), u.length > 0 && r.insert(i + n, u), n += u.length - (s - i); }); }, this.conf); } @@ -19687,7 +19696,7 @@ class XTn { this._ytext.unobserve(this._observer); } } -const KTn = Zu.fromClass(XTn), JTn = Ci.baseTheme({ +const ETe = an.fromClass(CTe), _Te = dt.baseTheme({ ".cm-ySelection": {}, ".cm-yLineSelection": { padding: 0, @@ -19741,31 +19750,31 @@ const KTn = Zu.fromClass(XTn), JTn = Ci.baseTheme({ opacity: 1, transitionDelay: "0s" } -}), e8n = _k.define(); -class t8n extends uv { - constructor(n, s) { - super(), this.color = n, this.name = s; +}), ATe = Vl.define(); +class LTe extends za { + constructor(e, r) { + super(), this.color = e, this.name = r; } toDOM() { - return zRe("span", [P2("class", "cm-ySelectionCaret"), P2("style", `background-color: ${this.color}; border-color: ${this.color}`)], [ - nme("\u2060"), - zRe("div", [ - P2("class", "cm-ySelectionCaretDot") + return $E("span", [Za("class", "cm-ySelectionCaret"), Za("style", `background-color: ${this.color}; border-color: ${this.color}`)], [ + Lw("\u2060"), + $E("div", [ + Za("class", "cm-ySelectionCaretDot") ]), - nme("\u2060"), - zRe("div", [ - P2("class", "cm-ySelectionInfo") + Lw("\u2060"), + $E("div", [ + Za("class", "cm-ySelectionInfo") ], [ - nme(this.name) + Lw(this.name) ]), - nme("\u2060") + Lw("\u2060") ]); } - eq(n) { - return n.color === this.color; + eq(e) { + return e.color === this.color; } - compare(n) { - return n.color === this.color; + compare(e) { + return e.color === this.color; } updateDOM() { return !1; @@ -19777,111 +19786,111 @@ class t8n extends uv { return !0; } } -class n8n { - constructor(n) { - this.conf = n.state.facet(gwe), this._listener = ({ added: s, updated: a, removed: l }, h, f) => { - s.concat(a).concat(l).findIndex((w) => w !== this.conf.awareness.doc.clientID) >= 0 && n.dispatch({ annotations: [e8n.of([])] }); - }, this._awareness = this.conf.awareness, this._awareness.on("change", this._listener), this.decorations = cl.of([]); +class RTe { + constructor(e) { + this.conf = e.state.facet(eT), this._listener = ({ added: r, updated: n, removed: i }, s, a) => { + r.concat(n).concat(i).findIndex((l) => l !== this.conf.awareness.doc.clientID) >= 0 && e.dispatch({ annotations: [ATe.of([])] }); + }, this._awareness = this.conf.awareness, this._awareness.on("change", this._listener), this.decorations = Er.of([]); } destroy() { this._awareness.off("change", this._listener); } - update(n) { - const s = this.conf.ytext, a = s.doc, l = this.conf.awareness, h = [], f = this.conf.awareness.getLocalState(); - if (f != null) { - const b = n.view.hasFocus && n.view.dom.ownerDocument.hasFocus(), w = b ? n.state.selection.main : null, O = f.cursor == null ? null : LK(f.cursor.anchor), S = f.cursor == null ? null : LK(f.cursor.head); - if (w != null) { - const E = qFe(s, w.anchor), D = qFe(s, w.head); - (f.cursor == null || !bEt(O, E) || !bEt(S, D)) && l.setLocalStateField("cursor", { - anchor: E, - head: D + update(e) { + const r = this.conf.ytext, n = r.doc, i = this.conf.awareness, s = [], a = this.conf.awareness.getLocalState(); + if (a != null) { + const o = e.view.hasFocus && e.view.dom.ownerDocument.hasFocus(), l = o ? e.state.selection.main : null, u = a.cursor == null ? null : Uy(a.cursor.anchor), h = a.cursor == null ? null : Uy(a.cursor.head); + if (l != null) { + const f = M7(r, l.anchor), d = M7(r, l.head); + (a.cursor == null || !WF(u, f) || !WF(h, d)) && i.setLocalStateField("cursor", { + anchor: f, + head: d }); } else - f.cursor != null && b && l.setLocalStateField("cursor", null); + a.cursor != null && o && i.setLocalStateField("cursor", null); } - l.getStates().forEach((b, w) => { - if (w === l.doc.clientID) + i.getStates().forEach((o, l) => { + if (l === i.doc.clientID) return; - const O = b.cursor; - if (O == null || O.anchor == null || O.head == null) + const u = o.cursor; + if (u == null || u.anchor == null || u.head == null) return; - const S = VFe(O.anchor, a), E = VFe(O.head, a); - if (S == null || E == null || S.type !== s || E.type !== s) + const h = D7(u.anchor, n), f = D7(u.head, n); + if (h == null || f == null || h.type !== r || f.type !== r) return; - const { color: D = "#30bced", name: M = "Anonymous" } = b.user || {}, B = b.user && b.user.colorLight || D + "33", z = awe(S.index, E.index), W = T8(S.index, E.index), H = n.view.state.doc.lineAt(z), G = n.view.state.doc.lineAt(W); - if (H.number === G.number) - h.push({ - from: z, - to: W, - value: as.mark({ - attributes: { style: `background-color: ${B}` }, + const { color: d = "#30bced", name: p = "Anonymous" } = o.user || {}, g = o.user && o.user.colorLight || d + "33", m = WS(h.index, f.index), v = Bf(h.index, f.index), y = e.view.state.doc.lineAt(m), b = e.view.state.doc.lineAt(v); + if (y.number === b.number) + s.push({ + from: m, + to: v, + value: Et.mark({ + attributes: { style: `background-color: ${g}` }, class: "cm-ySelection" }) }); else { - h.push({ - from: z, - to: H.from + H.length, - value: as.mark({ - attributes: { style: `background-color: ${B}` }, + s.push({ + from: m, + to: y.from + y.length, + value: Et.mark({ + attributes: { style: `background-color: ${g}` }, class: "cm-ySelection" }) - }), h.push({ - from: G.from, - to: W, - value: as.mark({ - attributes: { style: `background-color: ${B}` }, + }), s.push({ + from: b.from, + to: v, + value: Et.mark({ + attributes: { style: `background-color: ${g}` }, class: "cm-ySelection" }) }); - for (let ee = H.number + 1; ee < G.number; ee++) { - const le = n.view.state.doc.line(ee).from; - h.push({ - from: le, - to: le, - value: as.line({ - attributes: { style: `background-color: ${B}`, class: "cm-yLineSelection" } + for (let w = y.number + 1; w < b.number; w++) { + const O = e.view.state.doc.line(w).from; + s.push({ + from: O, + to: O, + value: Et.line({ + attributes: { style: `background-color: ${g}`, class: "cm-yLineSelection" } }) }); } } - h.push({ - from: E.index, - to: E.index, - value: as.widget({ - side: E.index - S.index > 0 ? -1 : 1, + s.push({ + from: f.index, + to: f.index, + value: Et.widget({ + side: f.index - h.index > 0 ? -1 : 1, block: !1, - widget: new t8n(D, M) + widget: new LTe(d, p) }) }); - }), this.decorations = as.set(h, !0); + }), this.decorations = Et.set(s, !0); } } -const r8n = Zu.fromClass(n8n, { - decorations: (r) => r.decorations -}), i8n = () => { - let r = !0; - return (n, s) => { - if (r) { - r = !1; +const MTe = an.fromClass(RTe, { + decorations: (t) => t.decorations +}), DTe = () => { + let t = !0; + return (e, r) => { + if (t) { + t = !1; try { - n(); + e(); } finally { - r = !0; + t = !0; } } else - s !== void 0 && s(); + r !== void 0 && r(); }; }; -class s8n { - constructor(n) { - this.undoManager = n; +class NTe { + constructor(e) { + this.undoManager = e; } - addTrackedOrigin(n) { - this.undoManager.addTrackedOrigin(n); + addTrackedOrigin(e) { + this.undoManager.addTrackedOrigin(e); } - removeTrackedOrigin(n) { - this.undoManager.removeTrackedOrigin(n); + removeTrackedOrigin(e) { + this.undoManager.removeTrackedOrigin(e); } undo() { return this.undoManager.undo() != null; @@ -19890,78 +19899,78 @@ class s8n { return this.undoManager.redo() != null; } } -const mwe = us.define({ - combine(r) { - return r[r.length - 1]; +const tT = _t.define({ + combine(t) { + return t[t.length - 1]; } }); -class o8n { - constructor(n) { - this.view = n, this.conf = n.state.facet(mwe), this._undoManager = this.conf.undoManager, this.syncConf = n.state.facet(gwe), this._beforeChangeSelection = null, this._mux = i8n(), this._onStackItemAdded = ({ stackItem: s, changedParentTypes: a }) => { - a.has(this.syncConf.ytext) && this._beforeChangeSelection && !s.meta.has(this) && s.meta.set(this, this._beforeChangeSelection); - }, this._onStackItemPopped = ({ stackItem: s }) => { - const a = s.meta.get(this); - if (a) { - const l = this.syncConf.fromYRange(a); - n.dispatch(n.state.update({ selection: l })), this._storeSelection(); +class ITe { + constructor(e) { + this.view = e, this.conf = e.state.facet(tT), this._undoManager = this.conf.undoManager, this.syncConf = e.state.facet(eT), this._beforeChangeSelection = null, this._mux = DTe(), this._onStackItemAdded = ({ stackItem: r, changedParentTypes: n }) => { + n.has(this.syncConf.ytext) && this._beforeChangeSelection && !r.meta.has(this) && r.meta.set(this, this._beforeChangeSelection); + }, this._onStackItemPopped = ({ stackItem: r }) => { + const n = r.meta.get(this); + if (n) { + const i = this.syncConf.fromYRange(n); + e.dispatch(e.state.update({ selection: i })), this._storeSelection(); } }, this._storeSelection = () => { this._beforeChangeSelection = this.syncConf.toYRange(this.view.state.selection.main); }, this._undoManager.on("stack-item-added", this._onStackItemAdded), this._undoManager.on("stack-item-popped", this._onStackItemPopped), this._undoManager.addTrackedOrigin(this.syncConf); } - update(n) { - n.selectionSet && (n.transactions.length === 0 || n.transactions[0].annotation(GFe) !== this.syncConf) && this._storeSelection(); + update(e) { + e.selectionSet && (e.transactions.length === 0 || e.transactions[0].annotation(B7) !== this.syncConf) && this._storeSelection(); } destroy() { this._undoManager.off("stack-item-added", this._onStackItemAdded), this._undoManager.off("stack-item-popped", this._onStackItemPopped), this._undoManager.removeTrackedOrigin(this.syncConf); } } -const a8n = Zu.fromClass(o8n), c8n = ({ state: r, dispatch: n }) => r.facet(mwe).undo() || !0, l8n = ({ state: r, dispatch: n }) => r.facet(mwe).redo() || !0, u8n = (r, n, { undoManager: s = new Xze(r) } = {}) => { - const a = new ZTn(r, n), l = [ - gwe.of(a), - KTn +const PTe = an.fromClass(ITe), $Te = ({ state: t, dispatch: e }) => t.facet(tT).undo() || !0, BTe = ({ state: t, dispatch: e }) => t.facet(tT).redo() || !0, FTe = (t, e, { undoManager: r = new kM(t) } = {}) => { + const n = new TTe(t, e), i = [ + eT.of(n), + ETe ]; - return n && l.push( - JTn, - r8n - ), s !== !1 && l.push( - mwe.of(new s8n(s)), - a8n, - Ci.domEventHandlers({ - beforeinput(h, f) { - return h.inputType === "historyUndo" ? c8n(f) : h.inputType === "historyRedo" ? l8n(f) : !1; + return e && i.push( + _Te, + MTe + ), r !== !1 && i.push( + tT.of(new NTe(r)), + PTe, + dt.domEventHandlers({ + beforeinput(s, a) { + return s.inputType === "historyUndo" ? $Te(a) : s.inputType === "historyRedo" ? BTe(a) : !1; } }) - ), l; + ), i; }; -class bve { - static create(n, s, a, l, h) { - let f = l + (l << 8) + n + (s << 4) | 0; - return new bve(n, s, a, f, h, [], []); +class G5 { + static create(e, r, n, i, s) { + let a = i + (i << 8) + e + (r << 4) | 0; + return new G5(e, r, n, a, s, [], []); } - constructor(n, s, a, l, h, f, b) { - this.type = n, this.value = s, this.from = a, this.hash = l, this.end = h, this.children = f, this.positions = b, this.hashProp = [[Ia.contextHash, l]]; + constructor(e, r, n, i, s, a, o) { + this.type = e, this.value = r, this.from = n, this.hash = i, this.end = s, this.children = a, this.positions = o, this.hashProp = [[lr.contextHash, i]]; } - addChild(n, s) { - n.prop(Ia.contextHash) != this.hash && (n = new tu(n.type, n.children, n.positions, n.length, this.hashProp)), this.children.push(n), this.positions.push(s); + addChild(e, r) { + e.prop(lr.contextHash) != this.hash && (e = new Yr(e.type, e.children, e.positions, e.length, this.hashProp)), this.children.push(e), this.positions.push(r); } - toTree(n, s = this.end) { - let a = this.children.length - 1; - return a >= 0 && (s = Math.max(s, this.positions[a] + this.children[a].length + this.from)), new tu(n.types[this.type], this.children, this.positions, s - this.from).balance({ - makeTree: (l, h, f) => new tu(f0.none, l, h, f, this.hashProp) + toTree(e, r = this.end) { + let n = this.children.length - 1; + return n >= 0 && (r = Math.max(r, this.positions[n] + this.children[n].length + this.from)), new Yr(e.types[this.type], this.children, this.positions, r - this.from).balance({ + makeTree: (i, s, a) => new Yr(Li.none, i, s, a, this.hashProp) }); } } -var Ri; -(function(r) { - r[r.Document = 1] = "Document", r[r.CodeBlock = 2] = "CodeBlock", r[r.FencedCode = 3] = "FencedCode", r[r.Blockquote = 4] = "Blockquote", r[r.HorizontalRule = 5] = "HorizontalRule", r[r.BulletList = 6] = "BulletList", r[r.OrderedList = 7] = "OrderedList", r[r.ListItem = 8] = "ListItem", r[r.ATXHeading1 = 9] = "ATXHeading1", r[r.ATXHeading2 = 10] = "ATXHeading2", r[r.ATXHeading3 = 11] = "ATXHeading3", r[r.ATXHeading4 = 12] = "ATXHeading4", r[r.ATXHeading5 = 13] = "ATXHeading5", r[r.ATXHeading6 = 14] = "ATXHeading6", r[r.SetextHeading1 = 15] = "SetextHeading1", r[r.SetextHeading2 = 16] = "SetextHeading2", r[r.HTMLBlock = 17] = "HTMLBlock", r[r.LinkReference = 18] = "LinkReference", r[r.Paragraph = 19] = "Paragraph", r[r.CommentBlock = 20] = "CommentBlock", r[r.ProcessingInstructionBlock = 21] = "ProcessingInstructionBlock", r[r.Escape = 22] = "Escape", r[r.Entity = 23] = "Entity", r[r.HardBreak = 24] = "HardBreak", r[r.Emphasis = 25] = "Emphasis", r[r.StrongEmphasis = 26] = "StrongEmphasis", r[r.Link = 27] = "Link", r[r.Image = 28] = "Image", r[r.InlineCode = 29] = "InlineCode", r[r.HTMLTag = 30] = "HTMLTag", r[r.Comment = 31] = "Comment", r[r.ProcessingInstruction = 32] = "ProcessingInstruction", r[r.URL = 33] = "URL", r[r.HeaderMark = 34] = "HeaderMark", r[r.QuoteMark = 35] = "QuoteMark", r[r.ListMark = 36] = "ListMark", r[r.LinkMark = 37] = "LinkMark", r[r.EmphasisMark = 38] = "EmphasisMark", r[r.CodeMark = 39] = "CodeMark", r[r.CodeText = 40] = "CodeText", r[r.CodeInfo = 41] = "CodeInfo", r[r.LinkTitle = 42] = "LinkTitle", r[r.LinkLabel = 43] = "LinkLabel"; -})(Ri || (Ri = {})); -class h8n { - constructor(n, s) { - this.start = n, this.content = s, this.marks = [], this.parsers = []; +var mt; +(function(t) { + t[t.Document = 1] = "Document", t[t.CodeBlock = 2] = "CodeBlock", t[t.FencedCode = 3] = "FencedCode", t[t.Blockquote = 4] = "Blockquote", t[t.HorizontalRule = 5] = "HorizontalRule", t[t.BulletList = 6] = "BulletList", t[t.OrderedList = 7] = "OrderedList", t[t.ListItem = 8] = "ListItem", t[t.ATXHeading1 = 9] = "ATXHeading1", t[t.ATXHeading2 = 10] = "ATXHeading2", t[t.ATXHeading3 = 11] = "ATXHeading3", t[t.ATXHeading4 = 12] = "ATXHeading4", t[t.ATXHeading5 = 13] = "ATXHeading5", t[t.ATXHeading6 = 14] = "ATXHeading6", t[t.SetextHeading1 = 15] = "SetextHeading1", t[t.SetextHeading2 = 16] = "SetextHeading2", t[t.HTMLBlock = 17] = "HTMLBlock", t[t.LinkReference = 18] = "LinkReference", t[t.Paragraph = 19] = "Paragraph", t[t.CommentBlock = 20] = "CommentBlock", t[t.ProcessingInstructionBlock = 21] = "ProcessingInstructionBlock", t[t.Escape = 22] = "Escape", t[t.Entity = 23] = "Entity", t[t.HardBreak = 24] = "HardBreak", t[t.Emphasis = 25] = "Emphasis", t[t.StrongEmphasis = 26] = "StrongEmphasis", t[t.Link = 27] = "Link", t[t.Image = 28] = "Image", t[t.InlineCode = 29] = "InlineCode", t[t.HTMLTag = 30] = "HTMLTag", t[t.Comment = 31] = "Comment", t[t.ProcessingInstruction = 32] = "ProcessingInstruction", t[t.URL = 33] = "URL", t[t.HeaderMark = 34] = "HeaderMark", t[t.QuoteMark = 35] = "QuoteMark", t[t.ListMark = 36] = "ListMark", t[t.LinkMark = 37] = "LinkMark", t[t.EmphasisMark = 38] = "EmphasisMark", t[t.CodeMark = 39] = "CodeMark", t[t.CodeText = 40] = "CodeText", t[t.CodeInfo = 41] = "CodeInfo", t[t.LinkTitle = 42] = "LinkTitle", t[t.LinkLabel = 43] = "LinkLabel"; +})(mt || (mt = {})); +class zTe { + constructor(e, r) { + this.start = e, this.content = r, this.marks = [], this.parsers = []; } } -class f8n { +class VTe { constructor() { this.text = "", this.baseIndent = 0, this.basePos = 0, this.depth = 0, this.markers = [], this.pos = 0, this.indent = 0, this.next = -1; } @@ -19969,384 +19978,384 @@ class f8n { this.basePos > this.pos && this.forwardInner(); } forwardInner() { - let n = this.skipSpace(this.basePos); - this.indent = this.countIndent(n, this.pos, this.indent), this.pos = n, this.next = n == this.text.length ? -1 : this.text.charCodeAt(n); + let e = this.skipSpace(this.basePos); + this.indent = this.countIndent(e, this.pos, this.indent), this.pos = e, this.next = e == this.text.length ? -1 : this.text.charCodeAt(e); } - skipSpace(n) { - return VX(this.text, n); + skipSpace(e) { + return Xv(this.text, e); } - reset(n) { - for (this.text = n, this.baseIndent = this.basePos = this.pos = this.indent = 0, this.forwardInner(), this.depth = 1; this.markers.length; ) + reset(e) { + for (this.text = e, this.baseIndent = this.basePos = this.pos = this.indent = 0, this.forwardInner(), this.depth = 1; this.markers.length; ) this.markers.pop(); } - moveBase(n) { - this.basePos = n, this.baseIndent = this.countIndent(n, this.pos, this.indent); + moveBase(e) { + this.basePos = e, this.baseIndent = this.countIndent(e, this.pos, this.indent); } - moveBaseColumn(n) { - this.baseIndent = n, this.basePos = this.findColumn(n); + moveBaseColumn(e) { + this.baseIndent = e, this.basePos = this.findColumn(e); } - addMarker(n) { - this.markers.push(n); + addMarker(e) { + this.markers.push(e); } - countIndent(n, s = 0, a = 0) { - for (let l = s; l < n; l++) - a += this.text.charCodeAt(l) == 9 ? 4 - a % 4 : 1; - return a; + countIndent(e, r = 0, n = 0) { + for (let i = r; i < e; i++) + n += this.text.charCodeAt(i) == 9 ? 4 - n % 4 : 1; + return n; } - findColumn(n) { - let s = 0; - for (let a = 0; s < this.text.length && a < n; s++) - a += this.text.charCodeAt(s) == 9 ? 4 - a % 4 : 1; - return s; + findColumn(e) { + let r = 0; + for (let n = 0; r < this.text.length && n < e; r++) + n += this.text.charCodeAt(r) == 9 ? 4 - n % 4 : 1; + return r; } scrub() { if (!this.baseIndent) return this.text; - let n = ""; - for (let s = 0; s < this.basePos; s++) - n += " "; - return n + this.text.slice(this.basePos); + let e = ""; + for (let r = 0; r < this.basePos; r++) + e += " "; + return e + this.text.slice(this.basePos); } } -function TEt(r, n, s) { - if (s.pos == s.text.length || r != n.block && s.indent >= n.stack[s.depth + 1].value + s.baseIndent) +function nz(t, e, r) { + if (r.pos == r.text.length || t != e.block && r.indent >= e.stack[r.depth + 1].value + r.baseIndent) return !0; - if (s.indent >= s.baseIndent + 4) + if (r.indent >= r.baseIndent + 4) return !1; - let a = (r.type == Ri.OrderedList ? lqe : cqe)(s, n, !1); - return a > 0 && (r.type != Ri.BulletList || aqe(s, n, !1) < 0) && s.text.charCodeAt(s.pos + a - 1) == r.value; + let n = (t.type == mt.OrderedList ? IM : NM)(r, e, !1); + return n > 0 && (t.type != mt.BulletList || DM(r, e, !1) < 0) && r.text.charCodeAt(r.pos + n - 1) == t.value; } -const $It = { - [Ri.Blockquote](r, n, s) { - return s.next != 62 ? !1 : (s.markers.push(zl(Ri.QuoteMark, n.lineStart + s.pos, n.lineStart + s.pos + 1)), s.moveBase(s.pos + (s3(s.text.charCodeAt(s.pos + 1)) ? 2 : 1)), r.end = n.lineStart + s.text.length, !0); +const Zee = { + [mt.Blockquote](t, e, r) { + return r.next != 62 ? !1 : (r.markers.push(Pr(mt.QuoteMark, e.lineStart + r.pos, e.lineStart + r.pos + 1)), r.moveBase(r.pos + (rl(r.text.charCodeAt(r.pos + 1)) ? 2 : 1)), t.end = e.lineStart + r.text.length, !0); }, - [Ri.ListItem](r, n, s) { - return s.indent < s.baseIndent + r.value && s.next > -1 ? !1 : (s.moveBaseColumn(s.baseIndent + r.value), !0); + [mt.ListItem](t, e, r) { + return r.indent < r.baseIndent + t.value && r.next > -1 ? !1 : (r.moveBaseColumn(r.baseIndent + t.value), !0); }, - [Ri.OrderedList]: TEt, - [Ri.BulletList]: TEt, - [Ri.Document]() { + [mt.OrderedList]: nz, + [mt.BulletList]: nz, + [mt.Document]() { return !0; } }; -function s3(r) { - return r == 32 || r == 9 || r == 10 || r == 13; +function rl(t) { + return t == 32 || t == 9 || t == 10 || t == 13; } -function VX(r, n = 0) { - for (; n < r.length && s3(r.charCodeAt(n)); ) - n++; - return n; +function Xv(t, e = 0) { + for (; e < t.length && rl(t.charCodeAt(e)); ) + e++; + return e; } -function AEt(r, n, s) { - for (; n > s && s3(r.charCodeAt(n - 1)); ) - n--; - return n; +function iz(t, e, r) { + for (; e > r && rl(t.charCodeAt(e - 1)); ) + e--; + return e; } -function BIt(r) { - if (r.next != 96 && r.next != 126) +function jee(t) { + if (t.next != 96 && t.next != 126) return -1; - let n = r.pos + 1; - for (; n < r.text.length && r.text.charCodeAt(n) == r.next; ) - n++; - if (n < r.pos + 3) + let e = t.pos + 1; + for (; e < t.text.length && t.text.charCodeAt(e) == t.next; ) + e++; + if (e < t.pos + 3) return -1; - if (r.next == 96) { - for (let s = n; s < r.text.length; s++) - if (r.text.charCodeAt(s) == 96) + if (t.next == 96) { + for (let r = e; r < t.text.length; r++) + if (t.text.charCodeAt(r) == 96) return -1; } - return n; + return e; } -function FIt(r) { - return r.next != 62 ? -1 : r.text.charCodeAt(r.pos + 1) == 32 ? 2 : 1; +function Kee(t) { + return t.next != 62 ? -1 : t.text.charCodeAt(t.pos + 1) == 32 ? 2 : 1; } -function aqe(r, n, s) { - if (r.next != 42 && r.next != 45 && r.next != 95) +function DM(t, e, r) { + if (t.next != 42 && t.next != 45 && t.next != 95) return -1; - let a = 1; - for (let l = r.pos + 1; l < r.text.length; l++) { - let h = r.text.charCodeAt(l); - if (h == r.next) - a++; - else if (!s3(h)) + let n = 1; + for (let i = t.pos + 1; i < t.text.length; i++) { + let s = t.text.charCodeAt(i); + if (s == t.next) + n++; + else if (!rl(s)) return -1; } - return s && r.next == 45 && zIt(r) > -1 && r.depth == n.stack.length || a < 3 ? -1 : 1; + return r && t.next == 45 && tte(t) > -1 && t.depth == e.stack.length || n < 3 ? -1 : 1; } -function jIt(r, n) { - for (let s = r.stack.length - 1; s >= 0; s--) - if (r.stack[s].type == n) +function Jee(t, e) { + for (let r = t.stack.length - 1; r >= 0; r--) + if (t.stack[r].type == e) return !0; return !1; } -function cqe(r, n, s) { - return (r.next == 45 || r.next == 43 || r.next == 42) && (r.pos == r.text.length - 1 || s3(r.text.charCodeAt(r.pos + 1))) && (!s || jIt(n, Ri.BulletList) || r.skipSpace(r.pos + 2) < r.text.length) ? 1 : -1; +function NM(t, e, r) { + return (t.next == 45 || t.next == 43 || t.next == 42) && (t.pos == t.text.length - 1 || rl(t.text.charCodeAt(t.pos + 1))) && (!r || Jee(e, mt.BulletList) || t.skipSpace(t.pos + 2) < t.text.length) ? 1 : -1; } -function lqe(r, n, s) { - let a = r.pos, l = r.next; - for (; l >= 48 && l <= 57; ) { - a++; - if (a == r.text.length) +function IM(t, e, r) { + let n = t.pos, i = t.next; + for (; i >= 48 && i <= 57; ) { + n++; + if (n == t.text.length) return -1; - l = r.text.charCodeAt(a); + i = t.text.charCodeAt(n); } - return a == r.pos || a > r.pos + 9 || l != 46 && l != 41 || a < r.text.length - 1 && !s3(r.text.charCodeAt(a + 1)) || s && !jIt(n, Ri.OrderedList) && (r.skipSpace(a + 1) == r.text.length || a > r.pos + 1 || r.next != 49) ? -1 : a + 1 - r.pos; + return n == t.pos || n > t.pos + 9 || i != 46 && i != 41 || n < t.text.length - 1 && !rl(t.text.charCodeAt(n + 1)) || r && !Jee(e, mt.OrderedList) && (t.skipSpace(n + 1) == t.text.length || n > t.pos + 1 || t.next != 49) ? -1 : n + 1 - t.pos; } -function QIt(r) { - if (r.next != 35) +function ete(t) { + if (t.next != 35) return -1; - let n = r.pos + 1; - for (; n < r.text.length && r.text.charCodeAt(n) == 35; ) - n++; - if (n < r.text.length && r.text.charCodeAt(n) != 32) + let e = t.pos + 1; + for (; e < t.text.length && t.text.charCodeAt(e) == 35; ) + e++; + if (e < t.text.length && t.text.charCodeAt(e) != 32) return -1; - let s = n - r.pos; - return s > 6 ? -1 : s; + let r = e - t.pos; + return r > 6 ? -1 : r; } -function zIt(r) { - if (r.next != 45 && r.next != 61 || r.indent >= r.baseIndent + 4) +function tte(t) { + if (t.next != 45 && t.next != 61 || t.indent >= t.baseIndent + 4) return -1; - let n = r.pos + 1; - for (; n < r.text.length && r.text.charCodeAt(n) == r.next; ) - n++; - let s = n; - for (; n < r.text.length && s3(r.text.charCodeAt(n)); ) - n++; - return n == r.text.length ? s : -1; -} -const ZFe = /^[ \t]*$/, qIt = /-->/, VIt = /\?>/, XFe = [ + let e = t.pos + 1; + for (; e < t.text.length && t.text.charCodeAt(e) == t.next; ) + e++; + let r = e; + for (; e < t.text.length && rl(t.text.charCodeAt(e)); ) + e++; + return e == t.text.length ? r : -1; +} +const F7 = /^[ \t]*$/, rte = /-->/, nte = /\?>/, z7 = [ [/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i], - [/^\s*/i.exec(a); - if (h) - return r.append(zl(Ri.Comment, s, s + 1 + h[0].length)); - let f = /^\?[^]*?\?>/.exec(a); - if (f) - return r.append(zl(Ri.ProcessingInstruction, s, s + 1 + f[0].length)); - let b = /^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(a); - return b ? r.append(zl(Ri.HTMLTag, s, s + 1 + b[0].length)) : -1; - }, - Emphasis(r, n, s) { - if (n != 95 && n != 42) + let n = t.slice(r + 1, t.end), i = /^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(n); + if (i) + return t.append(Pr(mt.URL, r, r + 1 + i[0].length)); + let s = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(n); + if (s) + return t.append(Pr(mt.Comment, r, r + 1 + s[0].length)); + let a = /^\?[^]*?\?>/.exec(n); + if (a) + return t.append(Pr(mt.ProcessingInstruction, r, r + 1 + a[0].length)); + let o = /^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n); + return o ? t.append(Pr(mt.HTMLTag, r, r + 1 + o[0].length)) : -1; + }, + Emphasis(t, e, r) { + if (e != 95 && e != 42) return -1; - let a = s + 1; - for (; r.char(a) == n; ) - a++; - let l = r.slice(s - 1, s), h = r.slice(a, a + 1), f = FK.test(l), b = FK.test(h), w = /\s|^$/.test(l), O = /\s|^$/.test(h), S = !O && (!b || w || f), E = !w && (!f || O || b), D = S && (n == 42 || !E || f), M = E && (n == 42 || !S || b); - return r.append(new rk(n == 95 ? ZIt : XIt, s, a, (D ? 1 : 0) | (M ? 2 : 0))); - }, - HardBreak(r, n, s) { - if (n == 92 && r.char(s + 1) == 10) - return r.append(zl(Ri.HardBreak, s, s + 2)); - if (n == 32) { - let a = s + 1; - for (; r.char(a) == 32; ) - a++; - if (r.char(a) == 10 && a >= s + 2) - return r.append(zl(Ri.HardBreak, s, a + 1)); + let n = r + 1; + for (; t.char(n) == e; ) + n++; + let i = t.slice(r - 1, r), s = t.slice(n, n + 1), a = Hy.test(i), o = Hy.test(s), l = /\s|^$/.test(i), u = /\s|^$/.test(s), h = !u && (!o || l || a), f = !l && (!a || u || o), d = h && (e == 42 || !f || a), p = f && (e == 42 || !h || o); + return t.append(new pl(e == 95 ? cte : ute, r, n, (d ? 1 : 0) | (p ? 2 : 0))); + }, + HardBreak(t, e, r) { + if (e == 92 && t.char(r + 1) == 10) + return t.append(Pr(mt.HardBreak, r, r + 2)); + if (e == 32) { + let n = r + 1; + for (; t.char(n) == 32; ) + n++; + if (t.char(n) == 10 && n >= r + 2) + return t.append(Pr(mt.HardBreak, r, n + 1)); } return -1; }, - Link(r, n, s) { - return n == 91 ? r.append(new rk(tX, s, s + 1, 1)) : -1; + Link(t, e, r) { + return e == 91 ? t.append(new pl(Dm, r, r + 1, 1)) : -1; }, - Image(r, n, s) { - return n == 33 && r.char(s + 1) == 91 ? r.append(new rk(MEt, s, s + 2, 1)) : -1; + Image(t, e, r) { + return e == 33 && t.char(r + 1) == 91 ? t.append(new pl(az, r, r + 2, 1)) : -1; }, - LinkEnd(r, n, s) { - if (n != 93) + LinkEnd(t, e, r) { + if (e != 93) return -1; - for (let a = r.parts.length - 1; a >= 0; a--) { - let l = r.parts[a]; - if (l instanceof rk && (l.type == tX || l.type == MEt)) { - if (!l.side || r.skipSpace(l.to) == s && !/[(\[]/.test(r.slice(s + 1, s + 2))) - return r.parts[a] = null, -1; - let h = r.takeContent(a), f = r.parts[a] = w8n(r, h, l.type == tX ? Ri.Link : Ri.Image, l.from, s + 1); - if (l.type == tX) - for (let b = 0; b < a; b++) { - let w = r.parts[b]; - w instanceof rk && w.type == tX && (w.side = 0); + for (let n = t.parts.length - 1; n >= 0; n--) { + let i = t.parts[n]; + if (i instanceof pl && (i.type == Dm || i.type == az)) { + if (!i.side || t.skipSpace(i.to) == r && !/[(\[]/.test(t.slice(r + 1, r + 2))) + return t.parts[n] = null, -1; + let s = t.takeContent(n), a = t.parts[n] = HTe(t, s, i.type == Dm ? mt.Link : mt.Image, i.from, r + 1); + if (i.type == Dm) + for (let o = 0; o < n; o++) { + let l = t.parts[o]; + l instanceof pl && l.type == Dm && (l.side = 0); } - return f.to; + return a.to; } } return -1; } }; -function w8n(r, n, s, a, l) { - let { text: h } = r, f = r.char(l), b = l; - if (n.unshift(zl(Ri.LinkMark, a, a + (s == Ri.Image ? 2 : 1))), n.push(zl(Ri.LinkMark, l - 1, l)), f == 40) { - let w = r.skipSpace(l + 1), O = KIt(h, w - r.offset, r.offset), S; - O && (w = r.skipSpace(O.to), S = JIt(h, w - r.offset, r.offset), S && (w = r.skipSpace(S.to))), r.char(w) == 41 && (n.push(zl(Ri.LinkMark, l, l + 1)), b = w + 1, O && n.push(O), S && n.push(S), n.push(zl(Ri.LinkMark, w, b))); - } else if (f == 91) { - let w = eNt(h, l - r.offset, r.offset, !1); - w && (n.push(w), b = w.to); - } - return zl(s, a, b, n); -} -function KIt(r, n, s) { - if (r.charCodeAt(n) == 60) { - for (let l = n + 1; l < r.length; l++) { - let h = r.charCodeAt(l); - if (h == 62) - return zl(Ri.URL, n + s, l + 1 + s); - if (h == 60 || h == 10) +function HTe(t, e, r, n, i) { + let { text: s } = t, a = t.char(i), o = i; + if (e.unshift(Pr(mt.LinkMark, n, n + (r == mt.Image ? 2 : 1))), e.push(Pr(mt.LinkMark, i - 1, i)), a == 40) { + let l = t.skipSpace(i + 1), u = hte(s, l - t.offset, t.offset), h; + u && (l = t.skipSpace(u.to), h = fte(s, l - t.offset, t.offset), h && (l = t.skipSpace(h.to))), t.char(l) == 41 && (e.push(Pr(mt.LinkMark, i, i + 1)), o = l + 1, u && e.push(u), h && e.push(h), e.push(Pr(mt.LinkMark, l, o))); + } else if (a == 91) { + let l = dte(s, i - t.offset, t.offset, !1); + l && (e.push(l), o = l.to); + } + return Pr(r, n, o, e); +} +function hte(t, e, r) { + if (t.charCodeAt(e) == 60) { + for (let i = e + 1; i < t.length; i++) { + let s = t.charCodeAt(i); + if (s == 62) + return Pr(mt.URL, e + r, i + 1 + r); + if (s == 60 || s == 10) return !1; } return null; } else { - let l = 0, h = n; - for (let f = !1; h < r.length; h++) { - let b = r.charCodeAt(h); - if (s3(b)) + let i = 0, s = e; + for (let a = !1; s < t.length; s++) { + let o = t.charCodeAt(s); + if (rl(o)) break; - if (f) - f = !1; - else if (b == 40) - l++; - else if (b == 41) { - if (!l) + if (a) + a = !1; + else if (o == 40) + i++; + else if (o == 41) { + if (!i) break; - l--; + i--; } else - b == 92 && (f = !0); + o == 92 && (a = !0); } - return h > n ? zl(Ri.URL, n + s, h + s) : h == r.length ? null : !1; + return s > e ? Pr(mt.URL, e + r, s + r) : s == t.length ? null : !1; } } -function JIt(r, n, s) { - let a = r.charCodeAt(n); - if (a != 39 && a != 34 && a != 40) +function fte(t, e, r) { + let n = t.charCodeAt(e); + if (n != 39 && n != 34 && n != 40) return !1; - let l = a == 40 ? 41 : a; - for (let h = n + 1, f = !1; h < r.length; h++) { - let b = r.charCodeAt(h); - if (f) - f = !1; + let i = n == 40 ? 41 : n; + for (let s = e + 1, a = !1; s < t.length; s++) { + let o = t.charCodeAt(s); + if (a) + a = !1; else { - if (b == l) - return zl(Ri.LinkTitle, n + s, h + 1 + s); - b == 92 && (f = !0); + if (o == i) + return Pr(mt.LinkTitle, e + r, s + 1 + r); + o == 92 && (a = !0); } } return null; } -function eNt(r, n, s, a) { - for (let l = !1, h = n + 1, f = Math.min(r.length, h + 999); h < f; h++) { - let b = r.charCodeAt(h); - if (l) - l = !1; +function dte(t, e, r, n) { + for (let i = !1, s = e + 1, a = Math.min(t.length, s + 999); s < a; s++) { + let o = t.charCodeAt(s); + if (i) + i = !1; else { - if (b == 93) - return a ? !1 : zl(Ri.LinkLabel, n + s, h + 1 + s); - if (a && !s3(b) && (a = !1), b == 91) + if (o == 93) + return n ? !1 : Pr(mt.LinkLabel, e + r, s + 1 + r); + if (n && !rl(o) && (n = !1), o == 91) return !1; - b == 92 && (l = !0); + o == 92 && (i = !0); } } return null; } -class y8n { - constructor(n, s, a) { - this.parser = n, this.text = s, this.offset = a, this.parts = []; +class XTe { + constructor(e, r, n) { + this.parser = e, this.text = r, this.offset = n, this.parts = []; } - char(n) { - return n >= this.end ? -1 : this.text.charCodeAt(n - this.offset); + char(e) { + return e >= this.end ? -1 : this.text.charCodeAt(e - this.offset); } get end() { return this.offset + this.text.length; } - slice(n, s) { - return this.text.slice(n - this.offset, s - this.offset); + slice(e, r) { + return this.text.slice(e - this.offset, r - this.offset); } - append(n) { - return this.parts.push(n), n.to; + append(e) { + return this.parts.push(e), e.to; } - addDelimiter(n, s, a, l, h) { - return this.append(new rk(n, s, a, (l ? 1 : 0) | (h ? 2 : 0))); + addDelimiter(e, r, n, i, s) { + return this.append(new pl(e, r, n, (i ? 1 : 0) | (s ? 2 : 0))); } - addElement(n) { - return this.append(n); + addElement(e) { + return this.append(e); } - resolveMarkers(n) { - for (let a = n; a < this.parts.length; a++) { - let l = this.parts[a]; - if (!(l instanceof rk && l.type.resolve && l.side & 2)) + resolveMarkers(e) { + for (let n = e; n < this.parts.length; n++) { + let i = this.parts[n]; + if (!(i instanceof pl && i.type.resolve && i.side & 2)) continue; - let h = l.type == ZIt || l.type == XIt, f = l.to - l.from, b, w = a - 1; - for (; w >= n; w--) { - let z = this.parts[w]; - if (z instanceof rk && z.side & 1 && z.type == l.type && !(h && (l.side & 1 || z.side & 2) && (z.to - z.from + f) % 3 == 0 && ((z.to - z.from) % 3 || f % 3))) { - b = z; + let s = i.type == cte || i.type == ute, a = i.to - i.from, o, l = n - 1; + for (; l >= e; l--) { + let m = this.parts[l]; + if (m instanceof pl && m.side & 1 && m.type == i.type && !(s && (i.side & 1 || m.side & 2) && (m.to - m.from + a) % 3 == 0 && ((m.to - m.from) % 3 || a % 3))) { + o = m; break; } } - if (!b) + if (!o) continue; - let O = l.type.resolve, S = [], E = b.from, D = l.to; - if (h) { - let z = Math.min(2, b.to - b.from, f); - E = b.to - z, D = l.from + z, O = z == 1 ? "Emphasis" : "StrongEmphasis"; + let u = i.type.resolve, h = [], f = o.from, d = i.to; + if (s) { + let m = Math.min(2, o.to - o.from, a); + f = o.to - m, d = i.from + m, u = m == 1 ? "Emphasis" : "StrongEmphasis"; } - b.type.mark && S.push(this.elt(b.type.mark, E, b.to)); - for (let z = w + 1; z < a; z++) - this.parts[z] instanceof BK && S.push(this.parts[z]), this.parts[z] = null; - l.type.mark && S.push(this.elt(l.type.mark, l.from, D)); - let M = this.elt(O, E, D, S); - this.parts[w] = h && b.from != E ? new rk(b.type, b.from, E, b.side) : null, (this.parts[a] = h && l.to != D ? new rk(l.type, D, l.to, l.side) : null) ? this.parts.splice(a, 0, M) : this.parts[a] = M; + o.type.mark && h.push(this.elt(o.type.mark, f, o.to)); + for (let m = l + 1; m < n; m++) + this.parts[m] instanceof Gy && h.push(this.parts[m]), this.parts[m] = null; + i.type.mark && h.push(this.elt(i.type.mark, i.from, d)); + let p = this.elt(u, f, d, h); + this.parts[l] = s && o.from != f ? new pl(o.type, o.from, f, o.side) : null, (this.parts[n] = s && i.to != d ? new pl(i.type, d, i.to, i.side) : null) ? this.parts.splice(n, 0, p) : this.parts[n] = p; } - let s = []; - for (let a = n; a < this.parts.length; a++) { - let l = this.parts[a]; - l instanceof BK && s.push(l); + let r = []; + for (let n = e; n < this.parts.length; n++) { + let i = this.parts[n]; + i instanceof Gy && r.push(i); } - return s; + return r; } - findOpeningDelimiter(n) { - for (let s = this.parts.length - 1; s >= 0; s--) { - let a = this.parts[s]; - if (a instanceof rk && a.type == n) - return s; + findOpeningDelimiter(e) { + for (let r = this.parts.length - 1; r >= 0; r--) { + let n = this.parts[r]; + if (n instanceof pl && n.type == e) + return r; } return null; } - takeContent(n) { - let s = this.resolveMarkers(n); - return this.parts.length = n, s; + takeContent(e) { + let r = this.resolveMarkers(e); + return this.parts.length = e, r; } - skipSpace(n) { - return VX(this.text, n - this.offset) + this.offset; + skipSpace(e) { + return Xv(this.text, e - this.offset) + this.offset; } - elt(n, s, a, l) { - return typeof n == "string" ? zl(this.parser.getNodeType(n), s, a, l) : new GIt(n, s); + elt(e, r, n, i) { + return typeof e == "string" ? Pr(this.parser.getNodeType(e), r, n, i) : new lte(e, r); } } -function JFe(r, n) { - if (!n.length) - return r; - if (!r.length) - return n; - let s = r.slice(), a = 0; - for (let l of n) { - for (; a < s.length && s[a].to < l.to; ) - a++; - if (a < s.length && s[a].from < l.from) { - let h = s[a]; - h instanceof BK && (s[a] = new BK(h.type, h.from, h.to, JFe(h.children, [l]))); +function U7(t, e) { + if (!e.length) + return t; + if (!t.length) + return e; + let r = t.slice(), n = 0; + for (let i of e) { + for (; n < r.length && r[n].to < i.to; ) + n++; + if (n < r.length && r[n].from < i.from) { + let s = r[n]; + s instanceof Gy && (r[n] = new Gy(s.type, s.from, s.to, U7(s.children, [i]))); } else - s.splice(a++, 0, l); + r.splice(n++, 0, i); } - return s; + return r; } -const O8n = [Ri.CodeBlock, Ri.ListItem, Ri.OrderedList, Ri.BulletList]; -class k8n { - constructor(n, s) { - this.fragments = n, this.input = s, this.i = 0, this.fragment = null, this.fragmentEnd = -1, this.cursor = null, n.length && (this.fragment = n[this.i++]); +const ZTe = [mt.CodeBlock, mt.ListItem, mt.OrderedList, mt.BulletList]; +class jTe { + constructor(e, r) { + this.fragments = e, this.input = r, this.i = 0, this.fragment = null, this.fragmentEnd = -1, this.cursor = null, e.length && (this.fragment = e[this.i++]); } nextFragment() { this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null, this.cursor = null, this.fragmentEnd = -1; } - moveTo(n, s) { - for (; this.fragment && this.fragment.to <= n; ) + moveTo(e, r) { + for (; this.fragment && this.fragment.to <= e; ) this.nextFragment(); - if (!this.fragment || this.fragment.from > (n ? n - 1 : 0)) + if (!this.fragment || this.fragment.from > (e ? e - 1 : 0)) return !1; if (this.fragmentEnd < 0) { - let h = this.fragment.to; - for (; h > 0 && this.input.read(h - 1, h) != ` + let s = this.fragment.to; + for (; s > 0 && this.input.read(s - 1, s) != ` `; ) - h--; - this.fragmentEnd = h ? h - 1 : 0; - } - let a = this.cursor; - a || (a = this.cursor = this.fragment.tree.cursor(), a.firstChild()); - let l = n + this.fragment.offset; - for (; a.to <= l; ) - if (!a.parent()) + s--; + this.fragmentEnd = s ? s - 1 : 0; + } + let n = this.cursor; + n || (n = this.cursor = this.fragment.tree.cursor(), n.firstChild()); + let i = e + this.fragment.offset; + for (; n.to <= i; ) + if (!n.parent()) return !1; for (; ; ) { - if (a.from >= l) - return this.fragment.from <= s; - if (!a.childAfter(l)) + if (n.from >= i) + return this.fragment.from <= r; + if (!n.childAfter(i)) return !1; } } - matches(n) { - let s = this.cursor.tree; - return s && s.prop(Ia.contextHash) == n; + matches(e) { + let r = this.cursor.tree; + return r && r.prop(lr.contextHash) == e; } - takeNodes(n) { - let s = this.cursor, a = this.fragment.offset, l = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0), h = n.absoluteLineStart, f = h, b = n.block.children.length, w = f, O = b; + takeNodes(e) { + let r = this.cursor, n = this.fragment.offset, i = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0), s = e.absoluteLineStart, a = s, o = e.block.children.length, l = a, u = o; for (; ; ) { - if (s.to - a > l) { - if (s.type.isAnonymous && s.firstChild()) + if (r.to - n > i) { + if (r.type.isAnonymous && r.firstChild()) continue; break; } - let S = tNt(s.from - a, n.ranges); - if (s.to - a <= n.ranges[n.rangeI].to) - n.addNode(s.tree, S); + let h = pte(r.from - n, e.ranges); + if (r.to - n <= e.ranges[e.rangeI].to) + e.addNode(r.tree, h); else { - let E = new tu(n.parser.nodeSet.types[Ri.Paragraph], [], [], 0, n.block.hashProp); - n.reusePlaceholders.set(E, s.tree), n.addNode(E, S); + let f = new Yr(e.parser.nodeSet.types[mt.Paragraph], [], [], 0, e.block.hashProp); + e.reusePlaceholders.set(f, r.tree), e.addNode(f, h); } - if (s.type.is("Block") && (O8n.indexOf(s.type.id) < 0 ? (f = s.to - a, b = n.block.children.length) : (f = w, b = O, w = s.to - a, O = n.block.children.length)), !s.nextSibling()) + if (r.type.is("Block") && (ZTe.indexOf(r.type.id) < 0 ? (a = r.to - n, o = e.block.children.length) : (a = l, o = u, l = r.to - n, u = e.block.children.length)), !r.nextSibling()) break; } - for (; n.block.children.length > b; ) - n.block.children.pop(), n.block.positions.pop(); - return f - h; + for (; e.block.children.length > o; ) + e.block.children.pop(), e.block.positions.pop(); + return a - s; } } -function tNt(r, n) { - let s = r; - for (let a = 1; a < n.length; a++) { - let l = n[a - 1].to, h = n[a].from; - l < r && (s -= h - l); +function pte(t, e) { + let r = t; + for (let n = 1; n < e.length; n++) { + let i = e[n - 1].to, s = e[n].from; + i < t && (r -= s - i); } - return s; + return r; } -const x8n = GF({ - "Blockquote/...": Ft.quote, - HorizontalRule: Ft.contentSeparator, - "ATXHeading1/... SetextHeading1/...": Ft.heading1, - "ATXHeading2/... SetextHeading2/...": Ft.heading2, - "ATXHeading3/...": Ft.heading3, - "ATXHeading4/...": Ft.heading4, - "ATXHeading5/...": Ft.heading5, - "ATXHeading6/...": Ft.heading6, - "Comment CommentBlock": Ft.comment, - Escape: Ft.escape, - Entity: Ft.character, - "Emphasis/...": Ft.emphasis, - "StrongEmphasis/...": Ft.strong, - "Link/... Image/...": Ft.link, - "OrderedList/... BulletList/...": Ft.list, - "BlockQuote/...": Ft.quote, - "InlineCode CodeText": Ft.monospace, - URL: Ft.url, - "HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": Ft.processingInstruction, - "CodeInfo LinkLabel": Ft.labelName, - LinkTitle: Ft.string, - Paragraph: Ft.content -}), S8n = new bwe(new LJ(YIt).extend(x8n), Object.keys(ome).map((r) => ome[r]), Object.keys(ome).map((r) => g8n[r]), Object.keys(ome), m8n, $It, Object.keys(YRe).map((r) => YRe[r]), Object.keys(YRe), []); -function _8n(r, n, s) { - let a = []; - for (let l = r.firstChild, h = n; ; l = l.nextSibling) { - let f = l ? l.from : s; - if (f > h && a.push({ from: h, to: f }), !l) +const KTe = N1({ + "Blockquote/...": Se.quote, + HorizontalRule: Se.contentSeparator, + "ATXHeading1/... SetextHeading1/...": Se.heading1, + "ATXHeading2/... SetextHeading2/...": Se.heading2, + "ATXHeading3/...": Se.heading3, + "ATXHeading4/...": Se.heading4, + "ATXHeading5/...": Se.heading5, + "ATXHeading6/...": Se.heading6, + "Comment CommentBlock": Se.comment, + Escape: Se.escape, + Entity: Se.character, + "Emphasis/...": Se.emphasis, + "StrongEmphasis/...": Se.strong, + "Link/... Image/...": Se.link, + "OrderedList/... BulletList/...": Se.list, + "BlockQuote/...": Se.quote, + "InlineCode CodeText": Se.monospace, + URL: Se.url, + "HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": Se.processingInstruction, + "CodeInfo LinkLabel": Se.labelName, + LinkTitle: Se.string, + Paragraph: Se.content +}), JTe = new rT(new Yb(ate).extend(KTe), Object.keys(Nw).map((t) => Nw[t]), Object.keys(Nw).map((t) => QTe[t]), Object.keys(Nw), YTe, Zee, Object.keys(UE).map((t) => UE[t]), Object.keys(UE), []); +function eCe(t, e, r) { + let n = []; + for (let i = t.firstChild, s = e; ; i = i.nextSibling) { + let a = i ? i.from : r; + if (a > s && n.push({ from: s, to: a }), !i) break; - h = l.to; + s = i.to; } - return a; + return n; } -function C8n(r) { - let { codeParser: n, htmlParser: s } = r; - return { wrap: aPt((l, h) => { - let f = l.type.id; - if (n && (f == Ri.CodeBlock || f == Ri.FencedCode)) { - let b = ""; - if (f == Ri.FencedCode) { - let O = l.node.getChild(Ri.CodeInfo); - O && (b = h.read(O.from, O.to)); - } - let w = n(b); - if (w) - return { parser: w, overlay: (O) => O.type.id == Ri.CodeText }; - } else if (s && (f == Ri.HTMLBlock || f == Ri.HTMLTag)) - return { parser: s, overlay: _8n(l.node, l.from, l.to) }; +function tCe(t) { + let { codeParser: e, htmlParser: r } = t; + return { wrap: xK((i, s) => { + let a = i.type.id; + if (e && (a == mt.CodeBlock || a == mt.FencedCode)) { + let o = ""; + if (a == mt.FencedCode) { + let u = i.node.getChild(mt.CodeInfo); + u && (o = s.read(u.from, u.to)); + } + let l = e(o); + if (l) + return { parser: l, overlay: (u) => u.type.id == mt.CodeText }; + } else if (r && (a == mt.HTMLBlock || a == mt.HTMLTag)) + return { parser: r, overlay: eCe(i.node, i.from, i.to) }; return null; }) }; } -const E8n = { resolve: "Strikethrough", mark: "StrikethroughMark" }, T8n = { +const rCe = { resolve: "Strikethrough", mark: "StrikethroughMark" }, nCe = { defineNodes: [{ name: "Strikethrough", - style: { "Strikethrough/...": Ft.strikethrough } + style: { "Strikethrough/...": Se.strikethrough } }, { name: "StrikethroughMark", - style: Ft.processingInstruction + style: Se.processingInstruction }], parseInline: [{ name: "Strikethrough", - parse(r, n, s) { - if (n != 126 || r.char(s + 1) != 126 || r.char(s + 2) == 126) + parse(t, e, r) { + if (e != 126 || t.char(r + 1) != 126 || t.char(r + 2) == 126) return -1; - let a = r.slice(s - 1, s), l = r.slice(s + 2, s + 3), h = /\s|^$/.test(a), f = /\s|^$/.test(l), b = FK.test(a), w = FK.test(l); - return r.addDelimiter(E8n, s, s + 2, !f && (!w || h || b), !h && (!b || f || w)); + let n = t.slice(r - 1, r), i = t.slice(r + 2, r + 3), s = /\s|^$/.test(n), a = /\s|^$/.test(i), o = Hy.test(n), l = Hy.test(i); + return t.addDelimiter(rCe, r, r + 2, !a && (!l || s || o), !s && (!o || a || l)); }, after: "Emphasis" }] }; -function UX(r, n, s = 0, a, l = 0) { - let h = 0, f = !0, b = -1, w = -1, O = !1, S = () => { - a.push(r.elt("TableCell", l + b, l + w, r.parser.parseInline(n.slice(b, w), l + b))); +function Zv(t, e, r = 0, n, i = 0) { + let s = 0, a = !0, o = -1, l = -1, u = !1, h = () => { + n.push(t.elt("TableCell", i + o, i + l, t.parser.parseInline(e.slice(o, l), i + o))); }; - for (let E = s; E < n.length; E++) { - let D = n.charCodeAt(E); - D == 124 && !O ? ((!f || b > -1) && h++, f = !1, a && (b > -1 && S(), a.push(r.elt("TableDelimiter", E + l, E + l + 1))), b = w = -1) : (O || D != 32 && D != 9) && (b < 0 && (b = E), w = E + 1), O = !O && D == 92; + for (let f = r; f < e.length; f++) { + let d = e.charCodeAt(f); + d == 124 && !u ? ((!a || o > -1) && s++, a = !1, n && (o > -1 && h(), n.push(t.elt("TableDelimiter", f + i, f + i + 1))), o = l = -1) : (u || d != 32 && d != 9) && (o < 0 && (o = f), l = f + 1), u = !u && d == 92; } - return b > -1 && (h++, a && S()), h; + return o > -1 && (s++, n && h()), s; } -function LEt(r, n) { - for (let s = n; s < r.length; s++) { - let a = r.charCodeAt(s); - if (a == 124) +function lz(t, e) { + for (let r = e; r < t.length; r++) { + let n = t.charCodeAt(r); + if (n == 124) return !0; - a == 92 && s++; + n == 92 && r++; } return !1; } -const nNt = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/; -class IEt { +const gte = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/; +class cz { constructor() { this.rows = null; } - nextLine(n, s, a) { + nextLine(e, r, n) { if (this.rows == null) { this.rows = !1; - let l; - if ((s.next == 45 || s.next == 58 || s.next == 124) && nNt.test(l = s.text.slice(s.pos))) { - let h = []; - UX(n, a.content, 0, h, a.start) == UX(n, l, s.pos) && (this.rows = [ - n.elt("TableHeader", a.start, a.start + a.content.length, h), - n.elt("TableDelimiter", n.lineStart + s.pos, n.lineStart + s.text.length) + let i; + if ((r.next == 45 || r.next == 58 || r.next == 124) && gte.test(i = r.text.slice(r.pos))) { + let s = []; + Zv(e, n.content, 0, s, n.start) == Zv(e, i, r.pos) && (this.rows = [ + e.elt("TableHeader", n.start, n.start + n.content.length, s), + e.elt("TableDelimiter", e.lineStart + r.pos, e.lineStart + r.text.length) ]); } } else if (this.rows) { - let l = []; - UX(n, s.text, s.pos, l, n.lineStart), this.rows.push(n.elt("TableRow", n.lineStart + s.pos, n.lineStart + s.text.length, l)); + let i = []; + Zv(e, r.text, r.pos, i, e.lineStart), this.rows.push(e.elt("TableRow", e.lineStart + r.pos, e.lineStart + r.text.length, i)); } return !1; } - finish(n, s) { - return this.rows ? (n.addLeafElement(s, n.elt("Table", s.start, s.start + s.content.length, this.rows)), !0) : !1; + finish(e, r) { + return this.rows ? (e.addLeafElement(r, e.elt("Table", r.start, r.start + r.content.length, this.rows)), !0) : !1; } } -const A8n = { +const iCe = { defineNodes: [ { name: "Table", block: !0 }, - { name: "TableHeader", style: { "TableHeader/...": Ft.heading } }, + { name: "TableHeader", style: { "TableHeader/...": Se.heading } }, "TableRow", - { name: "TableCell", style: Ft.content }, - { name: "TableDelimiter", style: Ft.processingInstruction } + { name: "TableCell", style: Se.content }, + { name: "TableDelimiter", style: Se.processingInstruction } ], parseBlock: [{ name: "Table", - leaf(r, n) { - return LEt(n.content, 0) ? new IEt() : null; + leaf(t, e) { + return lz(e.content, 0) ? new cz() : null; }, - endLeaf(r, n, s) { - if (s.parsers.some((l) => l instanceof IEt) || !LEt(n.text, n.basePos)) + endLeaf(t, e, r) { + if (r.parsers.some((i) => i instanceof cz) || !lz(e.text, e.basePos)) return !1; - let a = r.scanLine(r.absoluteLineEnd + 1).text; - return nNt.test(a) && UX(r, n.text, n.basePos) == UX(r, a, n.basePos); + let n = t.scanLine(t.absoluteLineEnd + 1).text; + return gte.test(n) && Zv(t, e.text, e.basePos) == Zv(t, n, e.basePos); }, before: "SetextHeading" }] }; -class D8n { +class sCe { nextLine() { return !1; } - finish(n, s) { - return n.addLeafElement(s, n.elt("Task", s.start, s.start + s.content.length, [ - n.elt("TaskMarker", s.start, s.start + 3), - ...n.parser.parseInline(s.content.slice(3), s.start + 3) + finish(e, r) { + return e.addLeafElement(r, e.elt("Task", r.start, r.start + r.content.length, [ + e.elt("TaskMarker", r.start, r.start + 3), + ...e.parser.parseInline(r.content.slice(3), r.start + 3) ])), !0; } } -const M8n = { +const aCe = { defineNodes: [ - { name: "Task", block: !0, style: Ft.list }, - { name: "TaskMarker", style: Ft.atom } + { name: "Task", block: !0, style: Se.list }, + { name: "TaskMarker", style: Se.atom } ], parseBlock: [{ name: "TaskList", - leaf(r, n) { - return /^\[[ xX]\][ \t]/.test(n.content) && r.parentType().name == "ListItem" ? new D8n() : null; + leaf(t, e) { + return /^\[[ xX]\][ \t]/.test(e.content) && t.parentType().name == "ListItem" ? new sCe() : null; }, after: "SetextHeading" }] -}, NEt = /(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy, REt = /[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy, P8n = /[\w-]+\.[\w-]+($|\/)/, $Et = /[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy, BEt = /\/[a-zA-Z\d@.]+/gy; -function FEt(r, n, s, a) { - let l = 0; - for (let h = n; h < s; h++) - r[h] == a && l++; - return l; -} -function L8n(r, n) { - REt.lastIndex = n; - let s = REt.exec(r); - if (!s || P8n.exec(s[0])[0].indexOf("_") > -1) +}, uz = /(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy, hz = /[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy, oCe = /[\w-]+\.[\w-]+($|\/)/, fz = /[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy, dz = /\/[a-zA-Z\d@.]+/gy; +function pz(t, e, r, n) { + let i = 0; + for (let s = e; s < r; s++) + t[s] == n && i++; + return i; +} +function lCe(t, e) { + hz.lastIndex = e; + let r = hz.exec(t); + if (!r || oCe.exec(r[0])[0].indexOf("_") > -1) return -1; - let a = n + s[0].length; + let n = e + r[0].length; for (; ; ) { - let l = r[a - 1], h; - if (/[?!.,:*_~]/.test(l) || l == ")" && FEt(r, n, a, ")") > FEt(r, n, a, "(")) - a--; - else if (l == ";" && (h = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(r.slice(n, a)))) - a = n + h.index; + let i = t[n - 1], s; + if (/[?!.,:*_~]/.test(i) || i == ")" && pz(t, e, n, ")") > pz(t, e, n, "(")) + n--; + else if (i == ";" && (s = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e, n)))) + n = e + s.index; else break; } - return a; + return n; } -function jEt(r, n) { - $Et.lastIndex = n; - let s = $Et.exec(r); - if (!s) +function gz(t, e) { + fz.lastIndex = e; + let r = fz.exec(t); + if (!r) return -1; - let a = s[0][s[0].length - 1]; - return a == "_" || a == "-" ? -1 : n + s[0].length - (a == "." ? 1 : 0); + let n = r[0][r[0].length - 1]; + return n == "_" || n == "-" ? -1 : e + r[0].length - (n == "." ? 1 : 0); } -const I8n = { +const cCe = { parseInline: [{ name: "Autolink", - parse(r, n, s) { - let a = s - r.offset; - NEt.lastIndex = a; - let l = NEt.exec(r.text), h = -1; - return !l || (l[1] || l[2] ? h = L8n(r.text, a + l[0].length) : l[3] ? h = jEt(r.text, a) : (h = jEt(r.text, a + l[0].length), h > -1 && l[0] == "xmpp:" && (BEt.lastIndex = h, l = BEt.exec(r.text), l && (h = l.index + l[0].length))), h < 0) ? -1 : (r.addElement(r.elt("URL", s, h + r.offset)), h + r.offset); + parse(t, e, r) { + let n = r - t.offset; + uz.lastIndex = n; + let i = uz.exec(t.text), s = -1; + return !i || (i[1] || i[2] ? s = lCe(t.text, n + i[0].length) : i[3] ? s = gz(t.text, n) : (s = gz(t.text, n + i[0].length), s > -1 && i[0] == "xmpp:" && (dz.lastIndex = s, i = dz.exec(t.text), i && (s = i.index + i[0].length))), s < 0) ? -1 : (t.addElement(t.elt("URL", r, s + t.offset)), s + t.offset); } }] -}, N8n = [A8n, M8n, T8n, I8n]; -function rNt(r, n, s) { - return (a, l, h) => { - if (l != r || a.char(h + 1) == r) +}, uCe = [iCe, aCe, nCe, cCe]; +function mte(t, e, r) { + return (n, i, s) => { + if (i != t || n.char(s + 1) == t) return -1; - let f = [a.elt(s, h, h + 1)]; - for (let b = h + 1; b < a.end; b++) { - let w = a.char(b); - if (w == r) - return a.addElement(a.elt(n, h, b + 1, f.concat(a.elt(s, b, b + 1)))); - if (w == 92 && f.push(a.elt("Escape", b, b++ + 2)), s3(w)) + let a = [n.elt(r, s, s + 1)]; + for (let o = s + 1; o < n.end; o++) { + let l = n.char(o); + if (l == t) + return n.addElement(n.elt(e, s, o + 1, a.concat(n.elt(r, o, o + 1)))); + if (l == 92 && a.push(n.elt("Escape", o, o++ + 2)), rl(l)) break; } return -1; }; } -const R8n = { +const hCe = { defineNodes: [ - { name: "Superscript", style: Ft.special(Ft.content) }, - { name: "SuperscriptMark", style: Ft.processingInstruction } + { name: "Superscript", style: Se.special(Se.content) }, + { name: "SuperscriptMark", style: Se.processingInstruction } ], parseInline: [{ name: "Superscript", - parse: rNt(94, "Superscript", "SuperscriptMark") + parse: mte(94, "Superscript", "SuperscriptMark") }] -}, $8n = { +}, fCe = { defineNodes: [ - { name: "Subscript", style: Ft.special(Ft.content) }, - { name: "SubscriptMark", style: Ft.processingInstruction } + { name: "Subscript", style: Se.special(Se.content) }, + { name: "SubscriptMark", style: Se.processingInstruction } ], parseInline: [{ name: "Subscript", - parse: rNt(126, "Subscript", "SubscriptMark") + parse: mte(126, "Subscript", "SubscriptMark") }] -}, B8n = { - defineNodes: [{ name: "Emoji", style: Ft.character }], +}, dCe = { + defineNodes: [{ name: "Emoji", style: Se.character }], parseInline: [{ name: "Emoji", - parse(r, n, s) { - let a; - return n != 58 || !(a = /^[a-zA-Z_0-9]+:/.exec(r.slice(s + 1, r.end))) ? -1 : r.addElement(r.elt("Emoji", s, s + 1 + a[0].length)); + parse(t, e, r) { + let n; + return e != 58 || !(n = /^[a-zA-Z_0-9]+:/.exec(t.slice(r + 1, t.end))) ? -1 : t.addElement(t.elt("Emoji", r, r + 1 + n[0].length)); } }] }; -class vve { - constructor(n, s, a, l, h, f, b, w, O, S = 0, E) { - this.p = n, this.stack = s, this.state = a, this.reducePos = l, this.pos = h, this.score = f, this.buffer = b, this.bufferBase = w, this.curContext = O, this.lookAhead = S, this.parent = E; +class H5 { + constructor(e, r, n, i, s, a, o, l, u, h = 0, f) { + this.p = e, this.stack = r, this.state = n, this.reducePos = i, this.pos = s, this.score = a, this.buffer = o, this.bufferBase = l, this.curContext = u, this.lookAhead = h, this.parent = f; } toString() { - return `[${this.stack.filter((n, s) => s % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`; + return `[${this.stack.filter((e, r) => r % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`; } - static start(n, s, a = 0) { - let l = n.parser.context; - return new vve(n, [], s, a, a, 0, [], 0, l ? new QEt(l, l.start) : null, 0, null); + static start(e, r, n = 0) { + let i = e.parser.context; + return new H5(e, [], r, n, n, 0, [], 0, i ? new mz(i, i.start) : null, 0, null); } get context() { return this.curContext ? this.curContext.context : null; } - pushState(n, s) { - this.stack.push(this.state, s, this.bufferBase + this.buffer.length), this.state = n; + pushState(e, r) { + this.stack.push(this.state, r, this.bufferBase + this.buffer.length), this.state = e; } - reduce(n) { - var s; - let a = n >> 19, l = n & 65535, { parser: h } = this.p, f = h.dynamicPrecedence(l); - if (f && (this.score += f), a == 0) { - this.pushState(h.getGoto(this.state, l, !0), this.reducePos), l < h.minRepeatTerm && this.storeNode(l, this.reducePos, this.reducePos, 4, !0), this.reduceContext(l, this.reducePos); + reduce(e) { + var r; + let n = e >> 19, i = e & 65535, { parser: s } = this.p, a = s.dynamicPrecedence(i); + if (a && (this.score += a), n == 0) { + this.pushState(s.getGoto(this.state, i, !0), this.reducePos), i < s.minRepeatTerm && this.storeNode(i, this.reducePos, this.reducePos, 4, !0), this.reduceContext(i, this.reducePos); return; } - let b = this.stack.length - (a - 1) * 3 - (n & 262144 ? 6 : 0), w = b ? this.stack[b - 2] : this.p.ranges[0].from, O = this.reducePos - w; - O >= 2e3 && !(!((s = this.p.parser.nodeSet.types[l]) === null || s === void 0) && s.isAnonymous) && (w == this.p.lastBigReductionStart ? (this.p.bigReductionCount++, this.p.lastBigReductionSize = O) : this.p.lastBigReductionSize < O && (this.p.bigReductionCount = 1, this.p.lastBigReductionStart = w, this.p.lastBigReductionSize = O)); - let S = b ? this.stack[b - 1] : 0, E = this.bufferBase + this.buffer.length - S; - if (l < h.minRepeatTerm || n & 131072) { - let D = h.stateFlag(this.state, 1) ? this.pos : this.reducePos; - this.storeNode(l, w, D, E + 4, !0); + let o = this.stack.length - (n - 1) * 3 - (e & 262144 ? 6 : 0), l = o ? this.stack[o - 2] : this.p.ranges[0].from, u = this.reducePos - l; + u >= 2e3 && !(!((r = this.p.parser.nodeSet.types[i]) === null || r === void 0) && r.isAnonymous) && (l == this.p.lastBigReductionStart ? (this.p.bigReductionCount++, this.p.lastBigReductionSize = u) : this.p.lastBigReductionSize < u && (this.p.bigReductionCount = 1, this.p.lastBigReductionStart = l, this.p.lastBigReductionSize = u)); + let h = o ? this.stack[o - 1] : 0, f = this.bufferBase + this.buffer.length - h; + if (i < s.minRepeatTerm || e & 131072) { + let d = s.stateFlag(this.state, 1) ? this.pos : this.reducePos; + this.storeNode(i, l, d, f + 4, !0); } - if (n & 262144) - this.state = this.stack[b]; + if (e & 262144) + this.state = this.stack[o]; else { - let D = this.stack[b - 3]; - this.state = h.getGoto(D, l, !0); + let d = this.stack[o - 3]; + this.state = s.getGoto(d, i, !0); } - for (; this.stack.length > b; ) + for (; this.stack.length > o; ) this.stack.pop(); - this.reduceContext(l, w); + this.reduceContext(i, l); } - storeNode(n, s, a, l = 4, h = !1) { - if (n == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) { - let f = this, b = this.buffer.length; - if (b == 0 && f.parent && (b = f.bufferBase - f.parent.bufferBase, f = f.parent), b > 0 && f.buffer[b - 4] == 0 && f.buffer[b - 1] > -1) { - if (s == a) + storeNode(e, r, n, i = 4, s = !1) { + if (e == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) { + let a = this, o = this.buffer.length; + if (o == 0 && a.parent && (o = a.bufferBase - a.parent.bufferBase, a = a.parent), o > 0 && a.buffer[o - 4] == 0 && a.buffer[o - 1] > -1) { + if (r == n) return; - if (f.buffer[b - 2] >= s) { - f.buffer[b - 2] = a; + if (a.buffer[o - 2] >= r) { + a.buffer[o - 2] = n; return; } } } - if (!h || this.pos == a) - this.buffer.push(n, s, a, l); + if (!s || this.pos == n) + this.buffer.push(e, r, n, i); else { - let f = this.buffer.length; - if (f > 0 && this.buffer[f - 4] != 0) - for (; f > 0 && this.buffer[f - 2] > a; ) - this.buffer[f] = this.buffer[f - 4], this.buffer[f + 1] = this.buffer[f - 3], this.buffer[f + 2] = this.buffer[f - 2], this.buffer[f + 3] = this.buffer[f - 1], f -= 4, l > 4 && (l -= 4); - this.buffer[f] = n, this.buffer[f + 1] = s, this.buffer[f + 2] = a, this.buffer[f + 3] = l; - } - } - shift(n, s, a, l) { - if (n & 131072) - this.pushState(n & 65535, this.pos); - else if ((n & 262144) == 0) { - let h = n, { parser: f } = this.p; - (l > this.pos || s <= f.maxNode) && (this.pos = l, f.stateFlag(h, 1) || (this.reducePos = l)), this.pushState(h, a), this.shiftContext(s, a), s <= f.maxNode && this.buffer.push(s, a, l, 4); + let a = this.buffer.length; + if (a > 0 && this.buffer[a - 4] != 0) + for (; a > 0 && this.buffer[a - 2] > n; ) + this.buffer[a] = this.buffer[a - 4], this.buffer[a + 1] = this.buffer[a - 3], this.buffer[a + 2] = this.buffer[a - 2], this.buffer[a + 3] = this.buffer[a - 1], a -= 4, i > 4 && (i -= 4); + this.buffer[a] = e, this.buffer[a + 1] = r, this.buffer[a + 2] = n, this.buffer[a + 3] = i; + } + } + shift(e, r, n, i) { + if (e & 131072) + this.pushState(e & 65535, this.pos); + else if ((e & 262144) == 0) { + let s = e, { parser: a } = this.p; + (i > this.pos || r <= a.maxNode) && (this.pos = i, a.stateFlag(s, 1) || (this.reducePos = i)), this.pushState(s, n), this.shiftContext(r, n), r <= a.maxNode && this.buffer.push(r, n, i, 4); } else - this.pos = l, this.shiftContext(s, a), s <= this.p.parser.maxNode && this.buffer.push(s, a, l, 4); + this.pos = i, this.shiftContext(r, n), r <= this.p.parser.maxNode && this.buffer.push(r, n, i, 4); } - apply(n, s, a, l) { - n & 65536 ? this.reduce(n) : this.shift(n, s, a, l); + apply(e, r, n, i) { + e & 65536 ? this.reduce(e) : this.shift(e, r, n, i); } - useNode(n, s) { - let a = this.p.reused.length - 1; - (a < 0 || this.p.reused[a] != n) && (this.p.reused.push(n), a++); - let l = this.pos; - this.reducePos = this.pos = l + n.length, this.pushState(s, l), this.buffer.push(a, l, this.reducePos, -1), this.curContext && this.updateContext(this.curContext.tracker.reuse(this.curContext.context, n, this, this.p.stream.reset(this.pos - n.length))); + useNode(e, r) { + let n = this.p.reused.length - 1; + (n < 0 || this.p.reused[n] != e) && (this.p.reused.push(e), n++); + let i = this.pos; + this.reducePos = this.pos = i + e.length, this.pushState(r, i), this.buffer.push(n, i, this.reducePos, -1), this.curContext && this.updateContext(this.curContext.tracker.reuse(this.curContext.context, e, this, this.p.stream.reset(this.pos - e.length))); } split() { - let n = this, s = n.buffer.length; - for (; s > 0 && n.buffer[s - 2] > n.reducePos; ) - s -= 4; - let a = n.buffer.slice(s), l = n.bufferBase + s; - for (; n && l == n.bufferBase; ) - n = n.parent; - return new vve(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, a, l, this.curContext, this.lookAhead, n); - } - recoverByDelete(n, s) { - let a = n <= this.p.parser.maxNode; - a && this.storeNode(n, this.pos, s, 4), this.storeNode(0, this.pos, s, a ? 8 : 4), this.pos = this.reducePos = s, this.score -= 190; - } - canShift(n) { - for (let s = new F8n(this); ; ) { - let a = this.p.parser.stateSlot(s.state, 4) || this.p.parser.hasAction(s.state, n); - if (a == 0) + let e = this, r = e.buffer.length; + for (; r > 0 && e.buffer[r - 2] > e.reducePos; ) + r -= 4; + let n = e.buffer.slice(r), i = e.bufferBase + r; + for (; e && i == e.bufferBase; ) + e = e.parent; + return new H5(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, n, i, this.curContext, this.lookAhead, e); + } + recoverByDelete(e, r) { + let n = e <= this.p.parser.maxNode; + n && this.storeNode(e, this.pos, r, 4), this.storeNode(0, this.pos, r, n ? 8 : 4), this.pos = this.reducePos = r, this.score -= 190; + } + canShift(e) { + for (let r = new pCe(this); ; ) { + let n = this.p.parser.stateSlot(r.state, 4) || this.p.parser.hasAction(r.state, e); + if (n == 0) return !1; - if ((a & 65536) == 0) + if ((n & 65536) == 0) return !0; - s.reduce(a); + r.reduce(n); } } - recoverByInsert(n) { + recoverByInsert(e) { if (this.stack.length >= 300) return []; - let s = this.p.parser.nextStates(this.state); - if (s.length > 4 << 1 || this.stack.length >= 120) { - let l = []; - for (let h = 0, f; h < s.length; h += 2) - (f = s[h + 1]) != this.state && this.p.parser.hasAction(f, n) && l.push(s[h], f); + let r = this.p.parser.nextStates(this.state); + if (r.length > 4 << 1 || this.stack.length >= 120) { + let i = []; + for (let s = 0, a; s < r.length; s += 2) + (a = r[s + 1]) != this.state && this.p.parser.hasAction(a, e) && i.push(r[s], a); if (this.stack.length < 120) - for (let h = 0; l.length < 4 << 1 && h < s.length; h += 2) { - let f = s[h + 1]; - l.some((b, w) => w & 1 && b == f) || l.push(s[h], f); + for (let s = 0; i.length < 4 << 1 && s < r.length; s += 2) { + let a = r[s + 1]; + i.some((o, l) => l & 1 && o == a) || i.push(r[s], a); } - s = l; + r = i; } - let a = []; - for (let l = 0; l < s.length && a.length < 4; l += 2) { - let h = s[l + 1]; - if (h == this.state) + let n = []; + for (let i = 0; i < r.length && n.length < 4; i += 2) { + let s = r[i + 1]; + if (s == this.state) continue; - let f = this.split(); - f.pushState(h, this.pos), f.storeNode(0, f.pos, f.pos, 4, !0), f.shiftContext(s[l], this.pos), f.reducePos = this.pos, f.score -= 200, a.push(f); + let a = this.split(); + a.pushState(s, this.pos), a.storeNode(0, a.pos, a.pos, 4, !0), a.shiftContext(r[i], this.pos), a.reducePos = this.pos, a.score -= 200, n.push(a); } - return a; + return n; } forceReduce() { - let { parser: n } = this.p, s = n.stateSlot(this.state, 5); - if ((s & 65536) == 0) + let { parser: e } = this.p, r = e.stateSlot(this.state, 5); + if ((r & 65536) == 0) return !1; - if (!n.validAction(this.state, s)) { - let a = s >> 19, l = s & 65535, h = this.stack.length - a * 3; - if (h < 0 || n.getGoto(this.stack[h], l, !1) < 0) { - let f = this.findForcedReduction(); - if (f == null) + if (!e.validAction(this.state, r)) { + let n = r >> 19, i = r & 65535, s = this.stack.length - n * 3; + if (s < 0 || e.getGoto(this.stack[s], i, !1) < 0) { + let a = this.findForcedReduction(); + if (a == null) return !1; - s = f; + r = a; } this.storeNode(0, this.pos, this.pos, 4, !0), this.score -= 100; } - return this.reducePos = this.pos, this.reduce(s), !0; + return this.reducePos = this.pos, this.reduce(r), !0; } findForcedReduction() { - let { parser: n } = this.p, s = [], a = (l, h) => { - if (!s.includes(l)) - return s.push(l), n.allActions(l, (f) => { - if (!(f & 393216)) - if (f & 65536) { - let b = (f >> 19) - h; - if (b > 1) { - let w = f & 65535, O = this.stack.length - b * 3; - if (O >= 0 && n.getGoto(this.stack[O], w, !1) >= 0) - return b << 19 | 65536 | w; + let { parser: e } = this.p, r = [], n = (i, s) => { + if (!r.includes(i)) + return r.push(i), e.allActions(i, (a) => { + if (!(a & 393216)) + if (a & 65536) { + let o = (a >> 19) - s; + if (o > 1) { + let l = a & 65535, u = this.stack.length - o * 3; + if (u >= 0 && e.getGoto(this.stack[u], l, !1) >= 0) + return o << 19 | 65536 | l; } } else { - let b = a(f, h + 1); - if (b != null) - return b; + let o = n(a, s + 1); + if (o != null) + return o; } }); }; - return a(this.state, 0); + return n(this.state, 0); } forceAll() { for (; !this.p.parser.stateFlag(this.state, 2); ) @@ -21477,79 +21486,79 @@ class vve { get deadEnd() { if (this.stack.length != 3) return !1; - let { parser: n } = this.p; - return n.data[n.stateSlot(this.state, 1)] == 65535 && !n.stateSlot(this.state, 4); + let { parser: e } = this.p; + return e.data[e.stateSlot(this.state, 1)] == 65535 && !e.stateSlot(this.state, 4); } restart() { this.storeNode(0, this.pos, this.pos, 4, !0), this.state = this.stack[0], this.stack.length = 0; } - sameState(n) { - if (this.state != n.state || this.stack.length != n.stack.length) + sameState(e) { + if (this.state != e.state || this.stack.length != e.stack.length) return !1; - for (let s = 0; s < this.stack.length; s += 3) - if (this.stack[s] != n.stack[s]) + for (let r = 0; r < this.stack.length; r += 3) + if (this.stack[r] != e.stack[r]) return !1; return !0; } get parser() { return this.p.parser; } - dialectEnabled(n) { - return this.p.parser.dialect.flags[n]; + dialectEnabled(e) { + return this.p.parser.dialect.flags[e]; } - shiftContext(n, s) { - this.curContext && this.updateContext(this.curContext.tracker.shift(this.curContext.context, n, this, this.p.stream.reset(s))); + shiftContext(e, r) { + this.curContext && this.updateContext(this.curContext.tracker.shift(this.curContext.context, e, this, this.p.stream.reset(r))); } - reduceContext(n, s) { - this.curContext && this.updateContext(this.curContext.tracker.reduce(this.curContext.context, n, this, this.p.stream.reset(s))); + reduceContext(e, r) { + this.curContext && this.updateContext(this.curContext.tracker.reduce(this.curContext.context, e, this, this.p.stream.reset(r))); } emitContext() { - let n = this.buffer.length - 1; - (n < 0 || this.buffer[n] != -3) && this.buffer.push(this.curContext.hash, this.pos, this.pos, -3); + let e = this.buffer.length - 1; + (e < 0 || this.buffer[e] != -3) && this.buffer.push(this.curContext.hash, this.pos, this.pos, -3); } emitLookAhead() { - let n = this.buffer.length - 1; - (n < 0 || this.buffer[n] != -4) && this.buffer.push(this.lookAhead, this.pos, this.pos, -4); + let e = this.buffer.length - 1; + (e < 0 || this.buffer[e] != -4) && this.buffer.push(this.lookAhead, this.pos, this.pos, -4); } - updateContext(n) { - if (n != this.curContext.context) { - let s = new QEt(this.curContext.tracker, n); - s.hash != this.curContext.hash && this.emitContext(), this.curContext = s; + updateContext(e) { + if (e != this.curContext.context) { + let r = new mz(this.curContext.tracker, e); + r.hash != this.curContext.hash && this.emitContext(), this.curContext = r; } } - setLookAhead(n) { - n > this.lookAhead && (this.emitLookAhead(), this.lookAhead = n); + setLookAhead(e) { + e > this.lookAhead && (this.emitLookAhead(), this.lookAhead = e); } close() { this.curContext && this.curContext.tracker.strict && this.emitContext(), this.lookAhead > 0 && this.emitLookAhead(); } } -class QEt { - constructor(n, s) { - this.tracker = n, this.context = s, this.hash = n.strict ? n.hash(s) : 0; +class mz { + constructor(e, r) { + this.tracker = e, this.context = r, this.hash = e.strict ? e.hash(r) : 0; } } -class F8n { - constructor(n) { - this.start = n, this.state = n.state, this.stack = n.stack, this.base = this.stack.length; +class pCe { + constructor(e) { + this.start = e, this.state = e.state, this.stack = e.stack, this.base = this.stack.length; } - reduce(n) { - let s = n & 65535, a = n >> 19; - a == 0 ? (this.stack == this.start.stack && (this.stack = this.stack.slice()), this.stack.push(this.state, 0, 0), this.base += 3) : this.base -= (a - 1) * 3; - let l = this.start.p.parser.getGoto(this.stack[this.base - 3], s, !0); - this.state = l; + reduce(e) { + let r = e & 65535, n = e >> 19; + n == 0 ? (this.stack == this.start.stack && (this.stack = this.stack.slice()), this.stack.push(this.state, 0, 0), this.base += 3) : this.base -= (n - 1) * 3; + let i = this.start.p.parser.getGoto(this.stack[this.base - 3], r, !0); + this.state = i; } } -class wve { - constructor(n, s, a) { - this.stack = n, this.pos = s, this.index = a, this.buffer = n.buffer, this.index == 0 && this.maybeNext(); +class X5 { + constructor(e, r, n) { + this.stack = e, this.pos = r, this.index = n, this.buffer = e.buffer, this.index == 0 && this.maybeNext(); } - static create(n, s = n.bufferBase + n.buffer.length) { - return new wve(n, s, s - n.bufferBase); + static create(e, r = e.bufferBase + e.buffer.length) { + return new X5(e, r, r - e.bufferBase); } maybeNext() { - let n = this.stack.parent; - n != null && (this.index = this.stack.bufferBase - n.bufferBase, this.stack = n, this.buffer = n.buffer); + let e = this.stack.parent; + e != null && (this.index = this.stack.bufferBase - e.bufferBase, this.stack = e, this.buffer = e.buffer); } get id() { return this.buffer[this.index - 4]; @@ -21567,667 +21576,667 @@ class wve { this.index -= 4, this.pos -= 4, this.index == 0 && this.maybeNext(); } fork() { - return new wve(this.stack, this.pos, this.index); + return new X5(this.stack, this.pos, this.index); } } -function SX(r, n = Uint16Array) { - if (typeof r != "string") - return r; - let s = null; - for (let a = 0, l = 0; a < r.length; ) { - let h = 0; +function mv(t, e = Uint16Array) { + if (typeof t != "string") + return t; + let r = null; + for (let n = 0, i = 0; n < t.length; ) { + let s = 0; for (; ; ) { - let f = r.charCodeAt(a++), b = !1; - if (f == 126) { - h = 65535; + let a = t.charCodeAt(n++), o = !1; + if (a == 126) { + s = 65535; break; } - f >= 92 && f--, f >= 34 && f--; - let w = f - 32; - if (w >= 46 && (w -= 46, b = !0), h += w, b) + a >= 92 && a--, a >= 34 && a--; + let l = a - 32; + if (l >= 46 && (l -= 46, o = !0), s += l, o) break; - h *= 46; + s *= 46; } - s ? s[l++] = h : s = new n(h); + r ? r[i++] = s : r = new e(s); } - return s; + return r; } -class sbe { +class m4 { constructor() { this.start = -1, this.value = -1, this.end = -1, this.extended = -1, this.lookAhead = 0, this.mask = 0, this.context = 0; } } -const zEt = new sbe(); -class j8n { - constructor(n, s) { - this.input = n, this.ranges = s, this.chunk = "", this.chunkOff = 0, this.chunk2 = "", this.chunk2Pos = 0, this.next = -1, this.token = zEt, this.rangeIndex = 0, this.pos = this.chunkPos = s[0].from, this.range = s[0], this.end = s[s.length - 1].to, this.readNext(); +const vz = new m4(); +class gCe { + constructor(e, r) { + this.input = e, this.ranges = r, this.chunk = "", this.chunkOff = 0, this.chunk2 = "", this.chunk2Pos = 0, this.next = -1, this.token = vz, this.rangeIndex = 0, this.pos = this.chunkPos = r[0].from, this.range = r[0], this.end = r[r.length - 1].to, this.readNext(); } - resolveOffset(n, s) { - let a = this.range, l = this.rangeIndex, h = this.pos + n; - for (; h < a.from; ) { - if (!l) + resolveOffset(e, r) { + let n = this.range, i = this.rangeIndex, s = this.pos + e; + for (; s < n.from; ) { + if (!i) return null; - let f = this.ranges[--l]; - h -= a.from - f.to, a = f; + let a = this.ranges[--i]; + s -= n.from - a.to, n = a; } - for (; s < 0 ? h > a.to : h >= a.to; ) { - if (l == this.ranges.length - 1) + for (; r < 0 ? s > n.to : s >= n.to; ) { + if (i == this.ranges.length - 1) return null; - let f = this.ranges[++l]; - h += f.from - a.to, a = f; + let a = this.ranges[++i]; + s += a.from - n.to, n = a; } - return h; + return s; } - clipPos(n) { - if (n >= this.range.from && n < this.range.to) - return n; - for (let s of this.ranges) - if (s.to > n) - return Math.max(n, s.from); + clipPos(e) { + if (e >= this.range.from && e < this.range.to) + return e; + for (let r of this.ranges) + if (r.to > e) + return Math.max(e, r.from); return this.end; } - peek(n) { - let s = this.chunkOff + n, a, l; - if (s >= 0 && s < this.chunk.length) - a = this.pos + n, l = this.chunk.charCodeAt(s); + peek(e) { + let r = this.chunkOff + e, n, i; + if (r >= 0 && r < this.chunk.length) + n = this.pos + e, i = this.chunk.charCodeAt(r); else { - let h = this.resolveOffset(n, 1); - if (h == null) + let s = this.resolveOffset(e, 1); + if (s == null) return -1; - if (a = h, a >= this.chunk2Pos && a < this.chunk2Pos + this.chunk2.length) - l = this.chunk2.charCodeAt(a - this.chunk2Pos); + if (n = s, n >= this.chunk2Pos && n < this.chunk2Pos + this.chunk2.length) + i = this.chunk2.charCodeAt(n - this.chunk2Pos); else { - let f = this.rangeIndex, b = this.range; - for (; b.to <= a; ) - b = this.ranges[++f]; - this.chunk2 = this.input.chunk(this.chunk2Pos = a), a + this.chunk2.length > b.to && (this.chunk2 = this.chunk2.slice(0, b.to - a)), l = this.chunk2.charCodeAt(0); + let a = this.rangeIndex, o = this.range; + for (; o.to <= n; ) + o = this.ranges[++a]; + this.chunk2 = this.input.chunk(this.chunk2Pos = n), n + this.chunk2.length > o.to && (this.chunk2 = this.chunk2.slice(0, o.to - n)), i = this.chunk2.charCodeAt(0); } } - return a >= this.token.lookAhead && (this.token.lookAhead = a + 1), l; + return n >= this.token.lookAhead && (this.token.lookAhead = n + 1), i; } - acceptToken(n, s = 0) { - let a = s ? this.resolveOffset(s, -1) : this.pos; - if (a == null || a < this.token.start) + acceptToken(e, r = 0) { + let n = r ? this.resolveOffset(r, -1) : this.pos; + if (n == null || n < this.token.start) throw new RangeError("Token end out of bounds"); - this.token.value = n, this.token.end = a; + this.token.value = e, this.token.end = n; } getChunk() { if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) { - let { chunk: n, chunkPos: s } = this; - this.chunk = this.chunk2, this.chunkPos = this.chunk2Pos, this.chunk2 = n, this.chunk2Pos = s, this.chunkOff = this.pos - this.chunkPos; + let { chunk: e, chunkPos: r } = this; + this.chunk = this.chunk2, this.chunkPos = this.chunk2Pos, this.chunk2 = e, this.chunk2Pos = r, this.chunkOff = this.pos - this.chunkPos; } else { this.chunk2 = this.chunk, this.chunk2Pos = this.chunkPos; - let n = this.input.chunk(this.pos), s = this.pos + n.length; - this.chunk = s > this.range.to ? n.slice(0, this.range.to - this.pos) : n, this.chunkPos = this.pos, this.chunkOff = 0; + let e = this.input.chunk(this.pos), r = this.pos + e.length; + this.chunk = r > this.range.to ? e.slice(0, this.range.to - this.pos) : e, this.chunkPos = this.pos, this.chunkOff = 0; } } readNext() { return this.chunkOff >= this.chunk.length && (this.getChunk(), this.chunkOff == this.chunk.length) ? this.next = -1 : this.next = this.chunk.charCodeAt(this.chunkOff); } - advance(n = 1) { - for (this.chunkOff += n; this.pos + n >= this.range.to; ) { + advance(e = 1) { + for (this.chunkOff += e; this.pos + e >= this.range.to; ) { if (this.rangeIndex == this.ranges.length - 1) return this.setDone(); - n -= this.range.to - this.pos, this.range = this.ranges[++this.rangeIndex], this.pos = this.range.from; + e -= this.range.to - this.pos, this.range = this.ranges[++this.rangeIndex], this.pos = this.range.from; } - return this.pos += n, this.pos >= this.token.lookAhead && (this.token.lookAhead = this.pos + 1), this.readNext(); + return this.pos += e, this.pos >= this.token.lookAhead && (this.token.lookAhead = this.pos + 1), this.readNext(); } setDone() { return this.pos = this.chunkPos = this.end, this.range = this.ranges[this.rangeIndex = this.ranges.length - 1], this.chunk = "", this.next = -1; } - reset(n, s) { - if (s ? (this.token = s, s.start = n, s.lookAhead = n + 1, s.value = s.extended = -1) : this.token = zEt, this.pos != n) { - if (this.pos = n, n == this.end) + reset(e, r) { + if (r ? (this.token = r, r.start = e, r.lookAhead = e + 1, r.value = r.extended = -1) : this.token = vz, this.pos != e) { + if (this.pos = e, e == this.end) return this.setDone(), this; - for (; n < this.range.from; ) + for (; e < this.range.from; ) this.range = this.ranges[--this.rangeIndex]; - for (; n >= this.range.to; ) + for (; e >= this.range.to; ) this.range = this.ranges[++this.rangeIndex]; - n >= this.chunkPos && n < this.chunkPos + this.chunk.length ? this.chunkOff = n - this.chunkPos : (this.chunk = "", this.chunkOff = 0), this.readNext(); + e >= this.chunkPos && e < this.chunkPos + this.chunk.length ? this.chunkOff = e - this.chunkPos : (this.chunk = "", this.chunkOff = 0), this.readNext(); } return this; } - read(n, s) { - if (n >= this.chunkPos && s <= this.chunkPos + this.chunk.length) - return this.chunk.slice(n - this.chunkPos, s - this.chunkPos); - if (n >= this.chunk2Pos && s <= this.chunk2Pos + this.chunk2.length) - return this.chunk2.slice(n - this.chunk2Pos, s - this.chunk2Pos); - if (n >= this.range.from && s <= this.range.to) - return this.input.read(n, s); - let a = ""; - for (let l of this.ranges) { - if (l.from >= s) + read(e, r) { + if (e >= this.chunkPos && r <= this.chunkPos + this.chunk.length) + return this.chunk.slice(e - this.chunkPos, r - this.chunkPos); + if (e >= this.chunk2Pos && r <= this.chunk2Pos + this.chunk2.length) + return this.chunk2.slice(e - this.chunk2Pos, r - this.chunk2Pos); + if (e >= this.range.from && r <= this.range.to) + return this.input.read(e, r); + let n = ""; + for (let i of this.ranges) { + if (i.from >= r) break; - l.to > n && (a += this.input.read(Math.max(l.from, n), Math.min(l.to, s))); + i.to > e && (n += this.input.read(Math.max(i.from, e), Math.min(i.to, r))); } - return a; + return n; } } -class BB { - constructor(n, s) { - this.data = n, this.id = s; +class Kp { + constructor(e, r) { + this.data = e, this.id = r; } - token(n, s) { - let { parser: a } = s.p; - iNt(this.data, n, s, this.id, a.data, a.tokenPrecTable); + token(e, r) { + let { parser: n } = r.p; + vte(this.data, e, r, this.id, n.data, n.tokenPrecTable); } } -BB.prototype.contextual = BB.prototype.fallback = BB.prototype.extend = !1; -class yve { - constructor(n, s, a) { - this.precTable = s, this.elseToken = a, this.data = typeof n == "string" ? SX(n) : n; +Kp.prototype.contextual = Kp.prototype.fallback = Kp.prototype.extend = !1; +class Z5 { + constructor(e, r, n) { + this.precTable = r, this.elseToken = n, this.data = typeof e == "string" ? mv(e) : e; } - token(n, s) { - let a = n.pos, l = 0; + token(e, r) { + let n = e.pos, i = 0; for (; ; ) { - let h = n.next < 0, f = n.resolveOffset(1, 1); - if (iNt(this.data, n, s, 0, this.data, this.precTable), n.token.value > -1) + let s = e.next < 0, a = e.resolveOffset(1, 1); + if (vte(this.data, e, r, 0, this.data, this.precTable), e.token.value > -1) break; if (this.elseToken == null) return; - if (h || l++, f == null) + if (s || i++, a == null) break; - n.reset(f, n.token); + e.reset(a, e.token); } - l && (n.reset(a, n.token), n.acceptToken(this.elseToken, l)); + i && (e.reset(n, e.token), e.acceptToken(this.elseToken, i)); } } -yve.prototype.contextual = BB.prototype.fallback = BB.prototype.extend = !1; -class Ek { - constructor(n, s = {}) { - this.token = n, this.contextual = !!s.contextual, this.fallback = !!s.fallback, this.extend = !!s.extend; +Z5.prototype.contextual = Kp.prototype.fallback = Kp.prototype.extend = !1; +class ql { + constructor(e, r = {}) { + this.token = e, this.contextual = !!r.contextual, this.fallback = !!r.fallback, this.extend = !!r.extend; } } -function iNt(r, n, s, a, l, h) { - let f = 0, b = 1 << a, { dialect: w } = s.p.parser; +function vte(t, e, r, n, i, s) { + let a = 0, o = 1 << n, { dialect: l } = r.p.parser; e: - for (; (b & r[f]) != 0; ) { - let O = r[f + 1]; - for (let M = f + 3; M < O; M += 2) - if ((r[M + 1] & b) > 0) { - let B = r[M]; - if (w.allows(B) && (n.token.value == -1 || n.token.value == B || Q8n(B, n.token.value, l, h))) { - n.acceptToken(B); + for (; (o & t[a]) != 0; ) { + let u = t[a + 1]; + for (let p = a + 3; p < u; p += 2) + if ((t[p + 1] & o) > 0) { + let g = t[p]; + if (l.allows(g) && (e.token.value == -1 || e.token.value == g || mCe(g, e.token.value, i, s))) { + e.acceptToken(g); break; } } - let S = n.next, E = 0, D = r[f + 2]; - if (n.next < 0 && D > E && r[O + D * 3 - 3] == 65535) { - f = r[O + D * 3 - 1]; + let h = e.next, f = 0, d = t[a + 2]; + if (e.next < 0 && d > f && t[u + d * 3 - 3] == 65535) { + a = t[u + d * 3 - 1]; continue e; } - for (; E < D; ) { - let M = E + D >> 1, B = O + M + (M << 1), z = r[B], W = r[B + 1] || 65536; - if (S < z) - D = M; - else if (S >= W) - E = M + 1; + for (; f < d; ) { + let p = f + d >> 1, g = u + p + (p << 1), m = t[g], v = t[g + 1] || 65536; + if (h < m) + d = p; + else if (h >= v) + f = p + 1; else { - f = r[B + 2], n.advance(); + a = t[g + 2], e.advance(); continue e; } } break; } } -function qEt(r, n, s) { - for (let a = n, l; (l = r[a]) != 65535; a++) - if (l == s) - return a - n; +function yz(t, e, r) { + for (let n = e, i; (i = t[n]) != 65535; n++) + if (i == r) + return n - e; return -1; } -function Q8n(r, n, s, a) { - let l = qEt(s, a, n); - return l < 0 || qEt(s, a, r) < l; +function mCe(t, e, r, n) { + let i = yz(r, n, e); + return i < 0 || yz(r, n, t) < i; } -const A2 = typeof process < "u" && {} && /\bparse\b/.test({}.LOG); -let HRe = null; -function VEt(r, n, s) { - let a = r.cursor(fh.IncludeAnonymous); - for (a.moveTo(n); ; ) - if (!(s < 0 ? a.childBefore(n) : a.childAfter(n))) +const Ga = typeof process < "u" && {} && /\bparse\b/.test({}.LOG); +let qE = null; +function bz(t, e, r) { + let n = t.cursor(un.IncludeAnonymous); + for (n.moveTo(e); ; ) + if (!(r < 0 ? n.childBefore(e) : n.childAfter(e))) for (; ; ) { - if ((s < 0 ? a.to < n : a.from > n) && !a.type.isError) - return s < 0 ? Math.max(0, Math.min(a.to - 1, n - 25)) : Math.min(r.length, Math.max(a.from + 1, n + 25)); - if (s < 0 ? a.prevSibling() : a.nextSibling()) + if ((r < 0 ? n.to < e : n.from > e) && !n.type.isError) + return r < 0 ? Math.max(0, Math.min(n.to - 1, e - 25)) : Math.min(t.length, Math.max(n.from + 1, e + 25)); + if (r < 0 ? n.prevSibling() : n.nextSibling()) break; - if (!a.parent()) - return s < 0 ? 0 : r.length; + if (!n.parent()) + return r < 0 ? 0 : t.length; } } -class z8n { - constructor(n, s) { - this.fragments = n, this.nodeSet = s, this.i = 0, this.fragment = null, this.safeFrom = -1, this.safeTo = -1, this.trees = [], this.start = [], this.index = [], this.nextFragment(); +class vCe { + constructor(e, r) { + this.fragments = e, this.nodeSet = r, this.i = 0, this.fragment = null, this.safeFrom = -1, this.safeTo = -1, this.trees = [], this.start = [], this.index = [], this.nextFragment(); } nextFragment() { - let n = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++]; - if (n) { - for (this.safeFrom = n.openStart ? VEt(n.tree, n.from + n.offset, 1) - n.offset : n.from, this.safeTo = n.openEnd ? VEt(n.tree, n.to + n.offset, -1) - n.offset : n.to; this.trees.length; ) + let e = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++]; + if (e) { + for (this.safeFrom = e.openStart ? bz(e.tree, e.from + e.offset, 1) - e.offset : e.from, this.safeTo = e.openEnd ? bz(e.tree, e.to + e.offset, -1) - e.offset : e.to; this.trees.length; ) this.trees.pop(), this.start.pop(), this.index.pop(); - this.trees.push(n.tree), this.start.push(-n.offset), this.index.push(0), this.nextStart = this.safeFrom; + this.trees.push(e.tree), this.start.push(-e.offset), this.index.push(0), this.nextStart = this.safeFrom; } else this.nextStart = 1e9; } - nodeAt(n) { - if (n < this.nextStart) + nodeAt(e) { + if (e < this.nextStart) return null; - for (; this.fragment && this.safeTo <= n; ) + for (; this.fragment && this.safeTo <= e; ) this.nextFragment(); if (!this.fragment) return null; for (; ; ) { - let s = this.trees.length - 1; - if (s < 0) + let r = this.trees.length - 1; + if (r < 0) return this.nextFragment(), null; - let a = this.trees[s], l = this.index[s]; - if (l == a.children.length) { + let n = this.trees[r], i = this.index[r]; + if (i == n.children.length) { this.trees.pop(), this.start.pop(), this.index.pop(); continue; } - let h = a.children[l], f = this.start[s] + a.positions[l]; - if (f > n) - return this.nextStart = f, null; - if (h instanceof tu) { - if (f == n) { - if (f < this.safeFrom) + let s = n.children[i], a = this.start[r] + n.positions[i]; + if (a > e) + return this.nextStart = a, null; + if (s instanceof Yr) { + if (a == e) { + if (a < this.safeFrom) return null; - let b = f + h.length; - if (b <= this.safeTo) { - let w = h.prop(Ia.lookAhead); - if (!w || b + w < this.fragment.to) - return h; + let o = a + s.length; + if (o <= this.safeTo) { + let l = s.prop(lr.lookAhead); + if (!l || o + l < this.fragment.to) + return s; } } - this.index[s]++, f + h.length >= Math.max(this.safeFrom, n) && (this.trees.push(h), this.start.push(f), this.index.push(0)); + this.index[r]++, a + s.length >= Math.max(this.safeFrom, e) && (this.trees.push(s), this.start.push(a), this.index.push(0)); } else - this.index[s]++, this.nextStart = f + h.length; + this.index[r]++, this.nextStart = a + s.length; } } } -class q8n { - constructor(n, s) { - this.stream = s, this.tokens = [], this.mainToken = null, this.actions = [], this.tokens = n.tokenizers.map((a) => new sbe()); +class yCe { + constructor(e, r) { + this.stream = r, this.tokens = [], this.mainToken = null, this.actions = [], this.tokens = e.tokenizers.map((n) => new m4()); } - getActions(n) { - let s = 0, a = null, { parser: l } = n.p, { tokenizers: h } = l, f = l.stateSlot(n.state, 3), b = n.curContext ? n.curContext.hash : 0, w = 0; - for (let O = 0; O < h.length; O++) { - if ((1 << O & f) == 0) + getActions(e) { + let r = 0, n = null, { parser: i } = e.p, { tokenizers: s } = i, a = i.stateSlot(e.state, 3), o = e.curContext ? e.curContext.hash : 0, l = 0; + for (let u = 0; u < s.length; u++) { + if ((1 << u & a) == 0) continue; - let S = h[O], E = this.tokens[O]; - if (!(a && !S.fallback) && ((S.contextual || E.start != n.pos || E.mask != f || E.context != b) && (this.updateCachedToken(E, S, n), E.mask = f, E.context = b), E.lookAhead > E.end + 25 && (w = Math.max(E.lookAhead, w)), E.value != 0)) { - let D = s; - if (E.extended > -1 && (s = this.addActions(n, E.extended, E.end, s)), s = this.addActions(n, E.value, E.end, s), !S.extend && (a = E, s > D)) + let h = s[u], f = this.tokens[u]; + if (!(n && !h.fallback) && ((h.contextual || f.start != e.pos || f.mask != a || f.context != o) && (this.updateCachedToken(f, h, e), f.mask = a, f.context = o), f.lookAhead > f.end + 25 && (l = Math.max(f.lookAhead, l)), f.value != 0)) { + let d = r; + if (f.extended > -1 && (r = this.addActions(e, f.extended, f.end, r)), r = this.addActions(e, f.value, f.end, r), !h.extend && (n = f, r > d)) break; } } - for (; this.actions.length > s; ) + for (; this.actions.length > r; ) this.actions.pop(); - return w && n.setLookAhead(w), !a && n.pos == this.stream.end && (a = new sbe(), a.value = n.p.parser.eofTerm, a.start = a.end = n.pos, s = this.addActions(n, a.value, a.end, s)), this.mainToken = a, this.actions; + return l && e.setLookAhead(l), !n && e.pos == this.stream.end && (n = new m4(), n.value = e.p.parser.eofTerm, n.start = n.end = e.pos, r = this.addActions(e, n.value, n.end, r)), this.mainToken = n, this.actions; } - getMainToken(n) { + getMainToken(e) { if (this.mainToken) return this.mainToken; - let s = new sbe(), { pos: a, p: l } = n; - return s.start = a, s.end = Math.min(a + 1, l.stream.end), s.value = a == l.stream.end ? l.parser.eofTerm : 0, s; - } - updateCachedToken(n, s, a) { - let l = this.stream.clipPos(a.pos); - if (s.token(this.stream.reset(l, n), a), n.value > -1) { - let { parser: h } = a.p; - for (let f = 0; f < h.specialized.length; f++) - if (h.specialized[f] == n.value) { - let b = h.specializers[f](this.stream.read(n.start, n.end), a); - if (b >= 0 && a.p.parser.dialect.allows(b >> 1)) { - (b & 1) == 0 ? n.value = b >> 1 : n.extended = b >> 1; + let r = new m4(), { pos: n, p: i } = e; + return r.start = n, r.end = Math.min(n + 1, i.stream.end), r.value = n == i.stream.end ? i.parser.eofTerm : 0, r; + } + updateCachedToken(e, r, n) { + let i = this.stream.clipPos(n.pos); + if (r.token(this.stream.reset(i, e), n), e.value > -1) { + let { parser: s } = n.p; + for (let a = 0; a < s.specialized.length; a++) + if (s.specialized[a] == e.value) { + let o = s.specializers[a](this.stream.read(e.start, e.end), n); + if (o >= 0 && n.p.parser.dialect.allows(o >> 1)) { + (o & 1) == 0 ? e.value = o >> 1 : e.extended = o >> 1; break; } } } else - n.value = 0, n.end = this.stream.clipPos(l + 1); + e.value = 0, e.end = this.stream.clipPos(i + 1); } - putAction(n, s, a, l) { - for (let h = 0; h < l; h += 3) - if (this.actions[h] == n) - return l; - return this.actions[l++] = n, this.actions[l++] = s, this.actions[l++] = a, l; - } - addActions(n, s, a, l) { - let { state: h } = n, { parser: f } = n.p, { data: b } = f; - for (let w = 0; w < 2; w++) - for (let O = f.stateSlot(h, w ? 2 : 1); ; O += 3) { - if (b[O] == 65535) - if (b[O + 1] == 1) - O = B6(b, O + 2); + putAction(e, r, n, i) { + for (let s = 0; s < i; s += 3) + if (this.actions[s] == e) + return i; + return this.actions[i++] = e, this.actions[i++] = r, this.actions[i++] = n, i; + } + addActions(e, r, n, i) { + let { state: s } = e, { parser: a } = e.p, { data: o } = a; + for (let l = 0; l < 2; l++) + for (let u = a.stateSlot(s, l ? 2 : 1); ; u += 3) { + if (o[u] == 65535) + if (o[u + 1] == 1) + u = du(o, u + 2); else { - l == 0 && b[O + 1] == 2 && (l = this.putAction(B6(b, O + 2), s, a, l)); + i == 0 && o[u + 1] == 2 && (i = this.putAction(du(o, u + 2), r, n, i)); break; } - b[O] == s && (l = this.putAction(B6(b, O + 1), s, a, l)); + o[u] == r && (i = this.putAction(du(o, u + 1), r, n, i)); } - return l; + return i; } } -class V8n { - constructor(n, s, a, l) { - this.parser = n, this.input = s, this.ranges = l, 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 j8n(s, l), this.tokens = new q8n(n, this.stream), this.topTerm = n.top[1]; - let { from: h } = l[0]; - this.stacks = [vve.start(this, n.top[0], h)], this.fragments = a.length && this.stream.end - h > n.bufferLength * 4 ? new z8n(a, n.nodeSet) : null; +class bCe { + constructor(e, r, n, i) { + this.parser = e, this.input = r, this.ranges = i, 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 gCe(r, i), this.tokens = new yCe(e, this.stream), this.topTerm = e.top[1]; + let { from: s } = i[0]; + this.stacks = [H5.start(this, e.top[0], s)], this.fragments = n.length && this.stream.end - s > e.bufferLength * 4 ? new vCe(n, e.nodeSet) : null; } get parsedPos() { return this.minStackPos; } advance() { - let n = this.stacks, s = this.minStackPos, a = this.stacks = [], l, h; - if (this.bigReductionCount > 300 && n.length == 1) { - let [f] = n; - for (; f.forceReduce() && f.stack.length && f.stack[f.stack.length - 2] >= this.lastBigReductionStart; ) + let e = this.stacks, r = this.minStackPos, n = this.stacks = [], i, s; + if (this.bigReductionCount > 300 && e.length == 1) { + let [a] = e; + for (; a.forceReduce() && a.stack.length && a.stack[a.stack.length - 2] >= this.lastBigReductionStart; ) ; this.bigReductionCount = this.lastBigReductionSize = 0; } - for (let f = 0; f < n.length; f++) { - let b = n[f]; + for (let a = 0; a < e.length; a++) { + let o = e[a]; for (; ; ) { - if (this.tokens.mainToken = null, b.pos > s) - a.push(b); + if (this.tokens.mainToken = null, o.pos > r) + n.push(o); else { - if (this.advanceStack(b, a, n)) + if (this.advanceStack(o, n, e)) continue; { - l || (l = [], h = []), l.push(b); - let w = this.tokens.getMainToken(b); - h.push(w.value, w.end); + i || (i = [], s = []), i.push(o); + let l = this.tokens.getMainToken(o); + s.push(l.value, l.end); } } break; } } - if (!a.length) { - let f = l && W8n(l); - if (f) - return A2 && console.log("Finish with " + this.stackID(f)), this.stackToTree(f); + if (!n.length) { + let a = i && wCe(i); + if (a) + return Ga && console.log("Finish with " + this.stackID(a)), this.stackToTree(a); if (this.parser.strict) - throw A2 && l && console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none")), new SyntaxError("No parse at " + s); + throw Ga && i && console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none")), new SyntaxError("No parse at " + r); this.recovering || (this.recovering = 5); } - if (this.recovering && l) { - let f = this.stoppedAt != null && l[0].pos > this.stoppedAt ? l[0] : this.runRecovery(l, h, a); - if (f) - return A2 && console.log("Force-finish " + this.stackID(f)), this.stackToTree(f.forceAll()); + if (this.recovering && i) { + let a = this.stoppedAt != null && i[0].pos > this.stoppedAt ? i[0] : this.runRecovery(i, s, n); + if (a) + return Ga && console.log("Force-finish " + this.stackID(a)), this.stackToTree(a.forceAll()); } if (this.recovering) { - let f = this.recovering == 1 ? 1 : this.recovering * 3; - if (a.length > f) - for (a.sort((b, w) => w.score - b.score); a.length > f; ) - a.pop(); - a.some((b) => b.reducePos > s) && this.recovering--; - } else if (a.length > 1) { + let a = this.recovering == 1 ? 1 : this.recovering * 3; + if (n.length > a) + for (n.sort((o, l) => l.score - o.score); n.length > a; ) + n.pop(); + n.some((o) => o.reducePos > r) && this.recovering--; + } else if (n.length > 1) { e: - for (let f = 0; f < a.length - 1; f++) { - let b = a[f]; - for (let w = f + 1; w < a.length; w++) { - let O = a[w]; - if (b.sameState(O) || b.buffer.length > 500 && O.buffer.length > 500) - if ((b.score - O.score || b.buffer.length - O.buffer.length) > 0) - a.splice(w--, 1); + for (let a = 0; a < n.length - 1; a++) { + let o = n[a]; + for (let l = a + 1; l < n.length; l++) { + let u = n[l]; + if (o.sameState(u) || o.buffer.length > 500 && u.buffer.length > 500) + if ((o.score - u.score || o.buffer.length - u.buffer.length) > 0) + n.splice(l--, 1); else { - a.splice(f--, 1); + n.splice(a--, 1); continue e; } } } - a.length > 12 && a.splice(12, a.length - 12); + n.length > 12 && n.splice(12, n.length - 12); } - this.minStackPos = a[0].pos; - for (let f = 1; f < a.length; f++) - a[f].pos < this.minStackPos && (this.minStackPos = a[f].pos); + this.minStackPos = n[0].pos; + for (let a = 1; a < n.length; a++) + n[a].pos < this.minStackPos && (this.minStackPos = n[a].pos); return null; } - stopAt(n) { - if (this.stoppedAt != null && this.stoppedAt < n) + stopAt(e) { + if (this.stoppedAt != null && this.stoppedAt < e) throw new RangeError("Can't move stoppedAt forward"); - this.stoppedAt = n; + this.stoppedAt = e; } - advanceStack(n, s, a) { - let l = n.pos, { parser: h } = this, f = A2 ? this.stackID(n) + " -> " : ""; - if (this.stoppedAt != null && l > this.stoppedAt) - return n.forceReduce() ? n : null; + advanceStack(e, r, n) { + let i = e.pos, { parser: s } = this, a = Ga ? this.stackID(e) + " -> " : ""; + if (this.stoppedAt != null && i > this.stoppedAt) + return e.forceReduce() ? e : null; if (this.fragments) { - let O = n.curContext && n.curContext.tracker.strict, S = O ? n.curContext.hash : 0; - for (let E = this.fragments.nodeAt(l); E; ) { - let D = this.parser.nodeSet.types[E.type.id] == E.type ? h.getGoto(n.state, E.type.id) : -1; - if (D > -1 && E.length && (!O || (E.prop(Ia.contextHash) || 0) == S)) - return n.useNode(E, D), A2 && console.log(f + this.stackID(n) + ` (via reuse of ${h.getName(E.type.id)})`), !0; - if (!(E instanceof tu) || E.children.length == 0 || E.positions[0] > 0) - break; - let M = E.children[0]; - if (M instanceof tu && E.positions[0] == 0) - E = M; + let u = e.curContext && e.curContext.tracker.strict, h = u ? e.curContext.hash : 0; + for (let f = this.fragments.nodeAt(i); f; ) { + let d = this.parser.nodeSet.types[f.type.id] == f.type ? s.getGoto(e.state, f.type.id) : -1; + if (d > -1 && f.length && (!u || (f.prop(lr.contextHash) || 0) == h)) + return e.useNode(f, d), Ga && console.log(a + this.stackID(e) + ` (via reuse of ${s.getName(f.type.id)})`), !0; + if (!(f instanceof Yr) || f.children.length == 0 || f.positions[0] > 0) + break; + let p = f.children[0]; + if (p instanceof Yr && f.positions[0] == 0) + f = p; else break; } } - let b = h.stateSlot(n.state, 4); - if (b > 0) - return n.reduce(b), A2 && console.log(f + this.stackID(n) + ` (via always-reduce ${h.getName(b & 65535)})`), !0; - if (n.stack.length >= 8400) - for (; n.stack.length > 6e3 && n.forceReduce(); ) + let o = s.stateSlot(e.state, 4); + if (o > 0) + return e.reduce(o), Ga && console.log(a + this.stackID(e) + ` (via always-reduce ${s.getName(o & 65535)})`), !0; + if (e.stack.length >= 8400) + for (; e.stack.length > 6e3 && e.forceReduce(); ) ; - let w = this.tokens.getActions(n); - for (let O = 0; O < w.length; ) { - let S = w[O++], E = w[O++], D = w[O++], M = O == w.length || !a, B = M ? n : n.split(), z = this.tokens.mainToken; - if (B.apply(S, E, z ? z.start : B.pos, D), A2 && console.log(f + this.stackID(B) + ` (via ${(S & 65536) == 0 ? "shift" : `reduce of ${h.getName(S & 65535)}`} for ${h.getName(E)} @ ${l}${B == n ? "" : ", split"})`), M) + let l = this.tokens.getActions(e); + for (let u = 0; u < l.length; ) { + let h = l[u++], f = l[u++], d = l[u++], p = u == l.length || !n, g = p ? e : e.split(), m = this.tokens.mainToken; + if (g.apply(h, f, m ? m.start : g.pos, d), Ga && console.log(a + this.stackID(g) + ` (via ${(h & 65536) == 0 ? "shift" : `reduce of ${s.getName(h & 65535)}`} for ${s.getName(f)} @ ${i}${g == e ? "" : ", split"})`), p) return !0; - B.pos > l ? s.push(B) : a.push(B); + g.pos > i ? r.push(g) : n.push(g); } return !1; } - advanceFully(n, s) { - let a = n.pos; + advanceFully(e, r) { + let n = e.pos; for (; ; ) { - if (!this.advanceStack(n, null, null)) + if (!this.advanceStack(e, null, null)) return !1; - if (n.pos > a) - return UEt(n, s), !0; + if (e.pos > n) + return xz(e, r), !0; } } - runRecovery(n, s, a) { - let l = null, h = !1; - for (let f = 0; f < n.length; f++) { - let b = n[f], w = s[f << 1], O = s[(f << 1) + 1], S = A2 ? this.stackID(b) + " -> " : ""; - if (b.deadEnd && (h || (h = !0, b.restart(), A2 && console.log(S + this.stackID(b) + " (restarted)"), this.advanceFully(b, a)))) + runRecovery(e, r, n) { + let i = null, s = !1; + for (let a = 0; a < e.length; a++) { + let o = e[a], l = r[a << 1], u = r[(a << 1) + 1], h = Ga ? this.stackID(o) + " -> " : ""; + if (o.deadEnd && (s || (s = !0, o.restart(), Ga && console.log(h + this.stackID(o) + " (restarted)"), this.advanceFully(o, n)))) continue; - let E = b.split(), D = S; - for (let M = 0; E.forceReduce() && M < 10 && (A2 && console.log(D + this.stackID(E) + " (via force-reduce)"), !this.advanceFully(E, a)); M++) - A2 && (D = this.stackID(E) + " -> "); - for (let M of b.recoverByInsert(w)) - A2 && console.log(S + this.stackID(M) + " (via recover-insert)"), this.advanceFully(M, a); - this.stream.end > b.pos ? (O == b.pos && (O++, w = 0), b.recoverByDelete(w, O), A2 && console.log(S + this.stackID(b) + ` (via recover-delete ${this.parser.getName(w)})`), UEt(b, a)) : (!l || l.score < b.score) && (l = b); - } - return l; - } - stackToTree(n) { - return n.close(), tu.build({ - buffer: wve.create(n), + let f = o.split(), d = h; + for (let p = 0; f.forceReduce() && p < 10 && (Ga && console.log(d + this.stackID(f) + " (via force-reduce)"), !this.advanceFully(f, n)); p++) + Ga && (d = this.stackID(f) + " -> "); + for (let p of o.recoverByInsert(l)) + Ga && console.log(h + this.stackID(p) + " (via recover-insert)"), this.advanceFully(p, n); + this.stream.end > o.pos ? (u == o.pos && (u++, l = 0), o.recoverByDelete(l, u), Ga && console.log(h + this.stackID(o) + ` (via recover-delete ${this.parser.getName(l)})`), xz(o, n)) : (!i || i.score < o.score) && (i = o); + } + return i; + } + stackToTree(e) { + return e.close(), Yr.build({ + buffer: X5.create(e), nodeSet: this.parser.nodeSet, topID: this.topTerm, maxBufferLength: this.parser.bufferLength, reused: this.reused, start: this.ranges[0].from, - length: n.pos - this.ranges[0].from, + length: e.pos - this.ranges[0].from, minRepeatType: this.parser.minRepeatTerm }); } - stackID(n) { - let s = (HRe || (HRe = /* @__PURE__ */ new WeakMap())).get(n); - return s || HRe.set(n, s = String.fromCodePoint(this.nextStackID++)), s + n; + stackID(e) { + let r = (qE || (qE = /* @__PURE__ */ new WeakMap())).get(e); + return r || qE.set(e, r = String.fromCodePoint(this.nextStackID++)), r + e; } } -function UEt(r, n) { - for (let s = 0; s < n.length; s++) { - let a = n[s]; - if (a.pos == r.pos && a.sameState(r)) { - n[s].score < r.score && (n[s] = r); +function xz(t, e) { + for (let r = 0; r < e.length; r++) { + let n = e[r]; + if (n.pos == t.pos && n.sameState(t)) { + e[r].score < t.score && (e[r] = t); return; } } - n.push(r); -} -class U8n { - constructor(n, s, a) { - this.source = n, this.flags = s, this.disabled = a; - } - allows(n) { - return !this.disabled || this.disabled[n] == 0; - } -} -const GRe = (r) => r; -class sNt { - constructor(n) { - this.start = n.start, this.shift = n.shift || GRe, this.reduce = n.reduce || GRe, this.reuse = n.reuse || GRe, this.hash = n.hash || (() => 0), this.strict = n.strict !== !1; - } -} -class mF extends vze { - constructor(n) { - if (super(), this.wrappers = [], n.version != 14) - throw new RangeError(`Parser version (${n.version}) doesn't match runtime version (${14})`); - let s = n.nodeNames.split(" "); - this.minRepeatTerm = s.length; - for (let b = 0; b < n.repeatNodeCount; b++) - s.push(""); - let a = Object.keys(n.topRules).map((b) => n.topRules[b][1]), l = []; - for (let b = 0; b < s.length; b++) - l.push([]); - function h(b, w, O) { - l[b].push([w, w.deserialize(String(O))]); - } - if (n.nodeProps) - for (let b of n.nodeProps) { - let w = b[0]; - typeof w == "string" && (w = Ia[w]); - for (let O = 1; O < b.length; ) { - let S = b[O++]; - if (S >= 0) - h(S, w, b[O++]); + e.push(t); +} +class xCe { + constructor(e, r, n) { + this.source = e, this.flags = r, this.disabled = n; + } + allows(e) { + return !this.disabled || this.disabled[e] == 0; + } +} +const QE = (t) => t; +class yte { + constructor(e) { + this.start = e.start, this.shift = e.shift || QE, this.reduce = e.reduce || QE, this.reuse = e.reuse || QE, this.hash = e.hash || (() => 0), this.strict = e.strict !== !1; + } +} +class Bg extends QR { + constructor(e) { + if (super(), this.wrappers = [], e.version != 14) + throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (${14})`); + let r = e.nodeNames.split(" "); + this.minRepeatTerm = r.length; + for (let o = 0; o < e.repeatNodeCount; o++) + r.push(""); + let n = Object.keys(e.topRules).map((o) => e.topRules[o][1]), i = []; + for (let o = 0; o < r.length; o++) + i.push([]); + function s(o, l, u) { + i[o].push([l, l.deserialize(String(u))]); + } + if (e.nodeProps) + for (let o of e.nodeProps) { + let l = o[0]; + typeof l == "string" && (l = lr[l]); + for (let u = 1; u < o.length; ) { + let h = o[u++]; + if (h >= 0) + s(h, l, o[u++]); else { - let E = b[O + -S]; - for (let D = -S; D > 0; D--) - h(b[O++], w, E); - O++; - } - } - } - this.nodeSet = new LJ(s.map((b, w) => f0.define({ - name: w >= this.minRepeatTerm ? void 0 : b, - id: w, - props: l[w], - top: a.indexOf(w) > -1, - error: w == 0, - skipped: n.skippedNodes && n.skippedNodes.indexOf(w) > -1 - }))), n.propSources && (this.nodeSet = this.nodeSet.extend(...n.propSources)), this.strict = !1, this.bufferLength = nPt; - let f = SX(n.tokenData); - this.context = n.context, this.specializerSpecs = n.specialized || [], this.specialized = new Uint16Array(this.specializerSpecs.length); - for (let b = 0; b < this.specializerSpecs.length; b++) - this.specialized[b] = this.specializerSpecs[b].term; - this.specializers = this.specializerSpecs.map(WEt), this.states = SX(n.states, Uint32Array), this.data = SX(n.stateData), this.goto = SX(n.goto), this.maxTerm = n.maxTerm, this.tokenizers = n.tokenizers.map((b) => typeof b == "number" ? new BB(f, b) : b), this.topRules = n.topRules, this.dialects = n.dialects || {}, this.dynamicPrecedences = n.dynamicPrecedences || null, this.tokenPrecTable = n.tokenPrec, this.termNames = n.termNames || null, this.maxNode = this.nodeSet.types.length - 1, this.dialect = this.parseDialect(), this.top = this.topRules[Object.keys(this.topRules)[0]]; - } - createParse(n, s, a) { - let l = new V8n(this, n, s, a); - for (let h of this.wrappers) - l = h(l, n, s, a); - return l; - } - getGoto(n, s, a = !1) { - let l = this.goto; - if (s >= l[0]) + let f = o[u + -h]; + for (let d = -h; d > 0; d--) + s(o[u++], l, f); + u++; + } + } + } + this.nodeSet = new Yb(r.map((o, l) => Li.define({ + name: l >= this.minRepeatTerm ? void 0 : o, + id: l, + props: i[l], + top: n.indexOf(l) > -1, + error: l == 0, + skipped: e.skippedNodes && e.skippedNodes.indexOf(l) > -1 + }))), e.propSources && (this.nodeSet = this.nodeSet.extend(...e.propSources)), this.strict = !1, this.bufferLength = gK; + let a = mv(e.tokenData); + this.context = e.context, this.specializerSpecs = e.specialized || [], this.specialized = new Uint16Array(this.specializerSpecs.length); + for (let o = 0; o < this.specializerSpecs.length; o++) + this.specialized[o] = this.specializerSpecs[o].term; + this.specializers = this.specializerSpecs.map(wz), this.states = mv(e.states, Uint32Array), this.data = mv(e.stateData), this.goto = mv(e.goto), this.maxTerm = e.maxTerm, this.tokenizers = e.tokenizers.map((o) => typeof o == "number" ? new Kp(a, o) : o), this.topRules = e.topRules, this.dialects = e.dialects || {}, this.dynamicPrecedences = e.dynamicPrecedences || null, this.tokenPrecTable = e.tokenPrec, this.termNames = e.termNames || null, this.maxNode = this.nodeSet.types.length - 1, this.dialect = this.parseDialect(), this.top = this.topRules[Object.keys(this.topRules)[0]]; + } + createParse(e, r, n) { + let i = new bCe(this, e, r, n); + for (let s of this.wrappers) + i = s(i, e, r, n); + return i; + } + getGoto(e, r, n = !1) { + let i = this.goto; + if (r >= i[0]) return -1; - for (let h = l[s + 1]; ; ) { - let f = l[h++], b = f & 1, w = l[h++]; - if (b && a) - return w; - for (let O = h + (f >> 1); h < O; h++) - if (l[h] == n) - return w; - if (b) + for (let s = i[r + 1]; ; ) { + let a = i[s++], o = a & 1, l = i[s++]; + if (o && n) + return l; + for (let u = s + (a >> 1); s < u; s++) + if (i[s] == e) + return l; + if (o) return -1; } } - hasAction(n, s) { - let a = this.data; - for (let l = 0; l < 2; l++) - for (let h = this.stateSlot(n, l ? 2 : 1), f; ; h += 3) { - if ((f = a[h]) == 65535) - if (a[h + 1] == 1) - f = a[h = B6(a, h + 2)]; + hasAction(e, r) { + let n = this.data; + for (let i = 0; i < 2; i++) + for (let s = this.stateSlot(e, i ? 2 : 1), a; ; s += 3) { + if ((a = n[s]) == 65535) + if (n[s + 1] == 1) + a = n[s = du(n, s + 2)]; else { - if (a[h + 1] == 2) - return B6(a, h + 2); + if (n[s + 1] == 2) + return du(n, s + 2); break; } - if (f == s || f == 0) - return B6(a, h + 1); + if (a == r || a == 0) + return du(n, s + 1); } return 0; } - stateSlot(n, s) { - return this.states[n * 6 + s]; + stateSlot(e, r) { + return this.states[e * 6 + r]; } - stateFlag(n, s) { - return (this.stateSlot(n, 0) & s) > 0; + stateFlag(e, r) { + return (this.stateSlot(e, 0) & r) > 0; } - validAction(n, s) { - return !!this.allActions(n, (a) => a == s ? !0 : null); + validAction(e, r) { + return !!this.allActions(e, (n) => n == r ? !0 : null); } - allActions(n, s) { - let a = this.stateSlot(n, 4), l = a ? s(a) : void 0; - for (let h = this.stateSlot(n, 1); l == null; h += 3) { - if (this.data[h] == 65535) - if (this.data[h + 1] == 1) - h = B6(this.data, h + 2); + allActions(e, r) { + let n = this.stateSlot(e, 4), i = n ? r(n) : void 0; + for (let s = this.stateSlot(e, 1); i == null; s += 3) { + if (this.data[s] == 65535) + if (this.data[s + 1] == 1) + s = du(this.data, s + 2); else break; - l = s(B6(this.data, h + 1)); + i = r(du(this.data, s + 1)); } - return l; + return i; } - nextStates(n) { - let s = []; - for (let a = this.stateSlot(n, 1); ; a += 3) { - if (this.data[a] == 65535) - if (this.data[a + 1] == 1) - a = B6(this.data, a + 2); + nextStates(e) { + let r = []; + for (let n = this.stateSlot(e, 1); ; n += 3) { + if (this.data[n] == 65535) + if (this.data[n + 1] == 1) + n = du(this.data, n + 2); else break; - if ((this.data[a + 2] & 1) == 0) { - let l = this.data[a + 1]; - s.some((h, f) => f & 1 && h == l) || s.push(this.data[a], l); + if ((this.data[n + 2] & 1) == 0) { + let i = this.data[n + 1]; + r.some((s, a) => a & 1 && s == i) || r.push(this.data[n], i); } } - return s; + return r; } - configure(n) { - let s = Object.assign(Object.create(mF.prototype), this); - if (n.props && (s.nodeSet = this.nodeSet.extend(...n.props)), n.top) { - let a = this.topRules[n.top]; - if (!a) - throw new RangeError(`Invalid top rule name ${n.top}`); - s.top = a; - } - return n.tokenizers && (s.tokenizers = this.tokenizers.map((a) => { - let l = n.tokenizers.find((h) => h.from == a); - return l ? l.to : a; - })), n.specializers && (s.specializers = this.specializers.slice(), s.specializerSpecs = this.specializerSpecs.map((a, l) => { - let h = n.specializers.find((b) => b.from == a.external); - if (!h) - return a; - let f = Object.assign(Object.assign({}, a), { external: h.to }); - return s.specializers[l] = WEt(f), f; - })), n.contextTracker && (s.context = n.contextTracker), n.dialect && (s.dialect = this.parseDialect(n.dialect)), n.strict != null && (s.strict = n.strict), n.wrap && (s.wrappers = s.wrappers.concat(n.wrap)), n.bufferLength != null && (s.bufferLength = n.bufferLength), s; + configure(e) { + let r = Object.assign(Object.create(Bg.prototype), this); + if (e.props && (r.nodeSet = this.nodeSet.extend(...e.props)), e.top) { + let n = this.topRules[e.top]; + if (!n) + throw new RangeError(`Invalid top rule name ${e.top}`); + r.top = n; + } + return e.tokenizers && (r.tokenizers = this.tokenizers.map((n) => { + let i = e.tokenizers.find((s) => s.from == n); + return i ? i.to : n; + })), e.specializers && (r.specializers = this.specializers.slice(), r.specializerSpecs = this.specializerSpecs.map((n, i) => { + let s = e.specializers.find((o) => o.from == n.external); + if (!s) + return n; + let a = Object.assign(Object.assign({}, n), { external: s.to }); + return r.specializers[i] = wz(a), a; + })), e.contextTracker && (r.context = e.contextTracker), e.dialect && (r.dialect = this.parseDialect(e.dialect)), e.strict != null && (r.strict = e.strict), e.wrap && (r.wrappers = r.wrappers.concat(e.wrap)), e.bufferLength != null && (r.bufferLength = e.bufferLength), r; } hasWrappers() { return this.wrappers.length > 0; } - getName(n) { - return this.termNames ? this.termNames[n] : String(n <= this.maxNode && this.nodeSet.types[n].name || n); + getName(e) { + return this.termNames ? this.termNames[e] : String(e <= this.maxNode && this.nodeSet.types[e].name || e); } get eofTerm() { return this.maxNode + 1; @@ -22235,47 +22244,47 @@ class mF extends vze { get topNode() { return this.nodeSet.types[this.top[1]]; } - dynamicPrecedence(n) { - let s = this.dynamicPrecedences; - return s == null ? 0 : s[n] || 0; + dynamicPrecedence(e) { + let r = this.dynamicPrecedences; + return r == null ? 0 : r[e] || 0; } - parseDialect(n) { - let s = Object.keys(this.dialects), a = s.map(() => !1); - if (n) - for (let h of n.split(" ")) { - let f = s.indexOf(h); - f >= 0 && (a[f] = !0); + parseDialect(e) { + let r = Object.keys(this.dialects), n = r.map(() => !1); + if (e) + for (let s of e.split(" ")) { + let a = r.indexOf(s); + a >= 0 && (n[a] = !0); } - let l = null; - for (let h = 0; h < s.length; h++) - if (!a[h]) - for (let f = this.dialects[s[h]], b; (b = this.data[f++]) != 65535; ) - (l || (l = new Uint8Array(this.maxTerm + 1)))[b] = 1; - return new U8n(n, a, l); + let i = null; + for (let s = 0; s < r.length; s++) + if (!n[s]) + for (let a = this.dialects[r[s]], o; (o = this.data[a++]) != 65535; ) + (i || (i = new Uint8Array(this.maxTerm + 1)))[o] = 1; + return new xCe(e, n, i); } - static deserialize(n) { - return new mF(n); + static deserialize(e) { + return new Bg(e); } } -function B6(r, n) { - return r[n] | r[n + 1] << 16; +function du(t, e) { + return t[e] | t[e + 1] << 16; } -function W8n(r) { - let n = null; - for (let s of r) { - let a = s.p.stoppedAt; - (s.pos == s.p.stream.end || a != null && s.pos > a) && s.p.parser.stateFlag(s.state, 2) && (!n || n.score < s.score) && (n = s); +function wCe(t) { + let e = null; + for (let r of t) { + let n = r.p.stoppedAt; + (r.pos == r.p.stream.end || n != null && r.pos > n) && r.p.parser.stateFlag(r.state, 2) && (!e || e.score < r.score) && (e = r); } - return n; + return e; } -function WEt(r) { - if (r.external) { - let n = r.extend ? 1 : 0; - return (s, a) => r.external(s, a) << 1 | n; +function wz(t) { + if (t.external) { + let e = t.extend ? 1 : 0; + return (r, n) => t.external(r, n) << 1 | e; } - return r.get; + return t.get; } -const Y8n = 54, H8n = 1, G8n = 55, Z8n = 2, X8n = 56, K8n = 3, YEt = 4, J8n = 5, Ove = 6, oNt = 7, aNt = 8, cNt = 9, lNt = 10, e7n = 11, t7n = 12, n7n = 13, ZRe = 57, r7n = 14, HEt = 58, uNt = 20, i7n = 22, hNt = 23, s7n = 24, eje = 26, fNt = 27, o7n = 28, a7n = 31, c7n = 34, l7n = 36, u7n = 37, h7n = 0, f7n = 1, d7n = { +const OCe = 54, kCe = 1, SCe = 55, TCe = 2, CCe = 56, ECe = 3, Oz = 4, _Ce = 5, j5 = 6, bte = 7, xte = 8, wte = 9, Ote = 10, ACe = 11, LCe = 12, RCe = 13, YE = 57, MCe = 14, kz = 58, kte = 20, DCe = 22, Ste = 23, NCe = 24, q7 = 26, Tte = 27, ICe = 28, PCe = 31, $Ce = 34, BCe = 36, FCe = 37, zCe = 0, VCe = 1, UCe = { area: !0, base: !0, br: !0, @@ -22294,7 +22303,7 @@ const Y8n = 54, H8n = 1, G8n = 55, Z8n = 2, X8n = 56, K8n = 3, YEt = 4, J8n = 5, track: !0, wbr: !0, menuitem: !0 -}, p7n = { +}, qCe = { dd: !0, li: !0, optgroup: !0, @@ -22307,7 +22316,7 @@ const Y8n = 54, H8n = 1, G8n = 55, Z8n = 2, X8n = 56, K8n = 3, YEt = 4, J8n = 5, tfoot: !0, th: !0, tr: !0 -}, GEt = { +}, Sz = { dd: { dd: !0, dt: !0 }, dt: { dd: !0, dt: !0 }, li: { li: !0 }, @@ -22351,237 +22360,237 @@ const Y8n = 54, H8n = 1, G8n = 55, Z8n = 2, X8n = 56, K8n = 3, YEt = 4, J8n = 5, thead: { tbody: !0, tfoot: !0 }, tr: { tr: !0 } }; -function g7n(r) { - return r == 45 || r == 46 || r == 58 || r >= 65 && r <= 90 || r == 95 || r >= 97 && r <= 122 || r >= 161; -} -function dNt(r) { - return r == 9 || r == 10 || r == 13 || r == 32; -} -let ZEt = null, XEt = null, KEt = 0; -function tje(r, n) { - let s = r.pos + n; - if (KEt == s && XEt == r) - return ZEt; - let a = r.peek(n); - for (; dNt(a); ) - a = r.peek(++n); - let l = ""; - for (; g7n(a); ) - l += String.fromCharCode(a), a = r.peek(++n); - return XEt = r, KEt = s, ZEt = l ? l.toLowerCase() : a == m7n || a == b7n ? void 0 : null; -} -const pNt = 60, kve = 62, uqe = 47, m7n = 63, b7n = 33, v7n = 45; -function JEt(r, n) { - this.name = r, this.parent = n, this.hash = n ? n.hash : 0; - for (let s = 0; s < r.length; s++) - this.hash += (this.hash << 4) + r.charCodeAt(s) + (r.charCodeAt(s) << 8); -} -const w7n = [Ove, lNt, oNt, aNt, cNt], y7n = new sNt({ +function QCe(t) { + return t == 45 || t == 46 || t == 58 || t >= 65 && t <= 90 || t == 95 || t >= 97 && t <= 122 || t >= 161; +} +function Cte(t) { + return t == 9 || t == 10 || t == 13 || t == 32; +} +let Tz = null, Cz = null, Ez = 0; +function Q7(t, e) { + let r = t.pos + e; + if (Ez == r && Cz == t) + return Tz; + let n = t.peek(e); + for (; Cte(n); ) + n = t.peek(++e); + let i = ""; + for (; QCe(n); ) + i += String.fromCharCode(n), n = t.peek(++e); + return Cz = t, Ez = r, Tz = i ? i.toLowerCase() : n == YCe || n == WCe ? void 0 : null; +} +const Ete = 60, K5 = 62, PM = 47, YCe = 63, WCe = 33, GCe = 45; +function _z(t, e) { + this.name = t, this.parent = e, this.hash = e ? e.hash : 0; + for (let r = 0; r < t.length; r++) + this.hash += (this.hash << 4) + t.charCodeAt(r) + (t.charCodeAt(r) << 8); +} +const HCe = [j5, Ote, bte, xte, wte], XCe = new yte({ start: null, - shift(r, n, s, a) { - return w7n.indexOf(n) > -1 ? new JEt(tje(a, 1) || "", r) : r; + shift(t, e, r, n) { + return HCe.indexOf(e) > -1 ? new _z(Q7(n, 1) || "", t) : t; }, - reduce(r, n) { - return n == uNt && r ? r.parent : r; + reduce(t, e) { + return e == kte && t ? t.parent : t; }, - reuse(r, n, s, a) { - let l = n.type.id; - return l == Ove || l == l7n ? new JEt(tje(a, 1) || "", r) : r; + reuse(t, e, r, n) { + let i = e.type.id; + return i == j5 || i == BCe ? new _z(Q7(n, 1) || "", t) : t; }, - hash(r) { - return r ? r.hash : 0; + hash(t) { + return t ? t.hash : 0; }, strict: !1 -}), O7n = new Ek((r, n) => { - if (r.next != pNt) { - r.next < 0 && n.context && r.acceptToken(ZRe); +}), ZCe = new ql((t, e) => { + if (t.next != Ete) { + t.next < 0 && e.context && t.acceptToken(YE); return; } - r.advance(); - let s = r.next == uqe; - s && r.advance(); - let a = tje(r, 0); - if (a === void 0) + t.advance(); + let r = t.next == PM; + r && t.advance(); + let n = Q7(t, 0); + if (n === void 0) return; - if (!a) - return r.acceptToken(s ? r7n : Ove); - let l = n.context ? n.context.name : null; - if (s) { - if (a == l) - return r.acceptToken(e7n); - if (l && p7n[l]) - return r.acceptToken(ZRe, -2); - if (n.dialectEnabled(h7n)) - return r.acceptToken(t7n); - for (let h = n.context; h; h = h.parent) - if (h.name == a) + if (!n) + return t.acceptToken(r ? MCe : j5); + let i = e.context ? e.context.name : null; + if (r) { + if (n == i) + return t.acceptToken(ACe); + if (i && qCe[i]) + return t.acceptToken(YE, -2); + if (e.dialectEnabled(zCe)) + return t.acceptToken(LCe); + for (let s = e.context; s; s = s.parent) + if (s.name == n) return; - r.acceptToken(n7n); + t.acceptToken(RCe); } else { - if (a == "script") - return r.acceptToken(oNt); - if (a == "style") - return r.acceptToken(aNt); - if (a == "textarea") - return r.acceptToken(cNt); - if (d7n.hasOwnProperty(a)) - return r.acceptToken(lNt); - l && GEt[l] && GEt[l][a] ? r.acceptToken(ZRe, -1) : r.acceptToken(Ove); - } -}, { contextual: !0 }), k7n = new Ek((r) => { - for (let n = 0, s = 0; ; s++) { - if (r.next < 0) { - s && r.acceptToken(HEt); + if (n == "script") + return t.acceptToken(bte); + if (n == "style") + return t.acceptToken(xte); + if (n == "textarea") + return t.acceptToken(wte); + if (UCe.hasOwnProperty(n)) + return t.acceptToken(Ote); + i && Sz[i] && Sz[i][n] ? t.acceptToken(YE, -1) : t.acceptToken(j5); + } +}, { contextual: !0 }), jCe = new ql((t) => { + for (let e = 0, r = 0; ; r++) { + if (t.next < 0) { + r && t.acceptToken(kz); break; } - if (r.next == v7n) - n++; - else if (r.next == kve && n >= 2) { - s >= 3 && r.acceptToken(HEt, -2); + if (t.next == GCe) + e++; + else if (t.next == K5 && e >= 2) { + r >= 3 && t.acceptToken(kz, -2); break; } else - n = 0; - r.advance(); + e = 0; + t.advance(); } }); -function x7n(r) { - for (; r; r = r.parent) - if (r.name == "svg" || r.name == "math") +function KCe(t) { + for (; t; t = t.parent) + if (t.name == "svg" || t.name == "math") return !0; return !1; } -const S7n = new Ek((r, n) => { - if (r.next == uqe && r.peek(1) == kve) { - let s = n.dialectEnabled(f7n) || x7n(n.context); - r.acceptToken(s ? J8n : YEt, 2); +const JCe = new ql((t, e) => { + if (t.next == PM && t.peek(1) == K5) { + let r = e.dialectEnabled(VCe) || KCe(e.context); + t.acceptToken(r ? _Ce : Oz, 2); } else - r.next == kve && r.acceptToken(YEt, 1); + t.next == K5 && t.acceptToken(Oz, 1); }); -function hqe(r, n, s) { - let a = 2 + r.length; - return new Ek((l) => { - for (let h = 0, f = 0, b = 0; ; b++) { - if (l.next < 0) { - b && l.acceptToken(n); +function $M(t, e, r) { + let n = 2 + t.length; + return new ql((i) => { + for (let s = 0, a = 0, o = 0; ; o++) { + if (i.next < 0) { + o && i.acceptToken(e); break; } - if (h == 0 && l.next == pNt || h == 1 && l.next == uqe || h >= 2 && h < a && l.next == r.charCodeAt(h - 2)) - h++, f++; - else if ((h == 2 || h == a) && dNt(l.next)) - f++; - else if (h == a && l.next == kve) { - b > f ? l.acceptToken(n, -f) : l.acceptToken(s, -(f - 2)); + if (s == 0 && i.next == Ete || s == 1 && i.next == PM || s >= 2 && s < n && i.next == t.charCodeAt(s - 2)) + s++, a++; + else if ((s == 2 || s == n) && Cte(i.next)) + a++; + else if (s == n && i.next == K5) { + o > a ? i.acceptToken(e, -a) : i.acceptToken(r, -(a - 2)); break; - } else if ((l.next == 10 || l.next == 13) && b) { - l.acceptToken(n, 1); + } else if ((i.next == 10 || i.next == 13) && o) { + i.acceptToken(e, 1); break; } else - h = f = 0; - l.advance(); + s = a = 0; + i.advance(); } }); } -const _7n = hqe("script", Y8n, H8n), C7n = hqe("style", G8n, Z8n), E7n = hqe("textarea", X8n, K8n), T7n = GF({ - "Text RawText": Ft.content, - "StartTag StartCloseTag SelfClosingEndTag EndTag": Ft.angleBracket, - TagName: Ft.tagName, - "MismatchedCloseTag/TagName": [Ft.tagName, Ft.invalid], - AttributeName: Ft.attributeName, - "AttributeValue UnquotedAttributeValue": Ft.attributeValue, - Is: Ft.definitionOperator, - "EntityReference CharacterReference": Ft.character, - Comment: Ft.blockComment, - ProcessingInst: Ft.processingInstruction, - DoctypeDecl: Ft.documentMeta -}), A7n = mF.deserialize({ +const eEe = $M("script", OCe, kCe), tEe = $M("style", SCe, TCe), rEe = $M("textarea", CCe, ECe), nEe = N1({ + "Text RawText": Se.content, + "StartTag StartCloseTag SelfClosingEndTag EndTag": Se.angleBracket, + TagName: Se.tagName, + "MismatchedCloseTag/TagName": [Se.tagName, Se.invalid], + AttributeName: Se.attributeName, + "AttributeValue UnquotedAttributeValue": Se.attributeValue, + Is: Se.definitionOperator, + "EntityReference CharacterReference": Se.character, + Comment: Se.blockComment, + ProcessingInst: Se.processingInstruction, + DoctypeDecl: Se.documentMeta +}), iEe = Bg.deserialize({ version: 14, states: ",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOOb7+$l7+$lOOOd7+$o7+$oOOO`7+$r7+$rOOO`7+$t7+$tO)rQ#|O,59eO)wQ#|O,59hO)|Q#|O,59kOOO`1G/X1G/XO*RO7[O'#CvO*dOMhO'#CvOOQW1G.y1G.yOOO`1G/P1G/POOO`1G/S1G/SOOO`1G/V1G/VOOOO'#D['#D[O*uO7[O,59bOOQW,59b,59bOOOO'#D]'#D]O+WOMhO,59bOOOO-E7Y-E7YOOQW1G.|1G.|OOOO-E7Z-E7Z", stateData: "+s~O!^OS~OUSOVPOWQOXROYTO[]O][O^^O`^Oa^Ob^Oc^Ox^O{_O!dZO~OfaO~OfbO~OfcO~OfdO~OfeO~O!WfOPlP!ZlP~O!XiOQoP!ZoP~O!YlORrP!ZrP~OUSOVPOWQOXROYTOZqO[]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~", goto: "%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp", nodeNames: "\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl", maxTerm: 67, - context: y7n, + context: XCe, nodeProps: [ ["closedBy", -10, 1, 2, 3, 7, 8, 9, 10, 11, 12, 13, "EndTag", 6, "EndTag SelfClosingEndTag", -4, 21, 30, 33, 36, "CloseTag"], ["openedBy", 4, "StartTag StartCloseTag", 5, "StartTag", -4, 29, 32, 35, 37, "OpenTag"], ["group", -9, 14, 17, 18, 19, 20, 39, 40, 41, 42, "Entity", 16, "Entity TextContent", -3, 28, 31, 34, "TextContent Entity"] ], - propSources: [T7n], + propSources: [nEe], skippedNodes: [0], repeatNodeCount: 9, tokenData: "!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zbkWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOa!R!R7tP;=`<%l7S!Z8OYkWa!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{ihSkWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbhSkWa!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXhSa!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TakWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOb!R!RAwP;=`<%lAY!ZBRYkWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbhSkWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbhSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXhSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!bx`P!a`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYlhS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_khS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_X`P!a`!cp!eQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZhSfQ`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!a`!cpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!a`!cp!dPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!a`!cpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!a`!cpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!a`!cpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!a`!cpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!a`!cpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!a`!cpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!a`!cpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!cpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO{PP!-nP;=`<%l!-Sq!-xS!cp{POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!a`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!a`{POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!a`!cp{POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!a`!cpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!a`!cpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!a`!cpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!a`!cpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!a`!cpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!a`!cpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!cpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOxPP!7TP;=`<%l!6Vq!7]V!cpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!cpxPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!a`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!a`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!a`xPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V! { - let O = b.type.id; - if (O == o7n) - return XRe(b, w, s); - if (O == a7n) - return XRe(b, w, a); - if (O == c7n) - return XRe(b, w, l); - if (O == uNt && h.length) { - let S = b.node, E = S.firstChild, D = E && eTt(E, w), M; - if (D) { - for (let B of h) - if (B.tag == D && (!B.attrs || B.attrs(M || (M = gNt(S, w))))) { - let z = S.lastChild, W = z.type.id == u7n ? z.from : S.to; - if (W > E.to) - return { parser: B.parser, overlay: [{ from: E.to, to: W }] }; - } - } - } - if (f && O == hNt) { - let S = b.node, E; - if (E = S.firstChild) { - let D = f[w.read(E.from, E.to)]; - if (D) - for (let M of D) { - if (M.tagName && M.tagName != eTt(S.parent, w)) +function Ate(t = [], e = []) { + let r = [], n = [], i = [], s = []; + for (let o of t) + (o.tag == "script" ? r : o.tag == "style" ? n : o.tag == "textarea" ? i : s).push(o); + let a = e.length ? /* @__PURE__ */ Object.create(null) : null; + for (let o of e) + (a[o.name] || (a[o.name] = [])).push(o); + return xK((o, l) => { + let u = o.type.id; + if (u == ICe) + return WE(o, l, r); + if (u == PCe) + return WE(o, l, n); + if (u == $Ce) + return WE(o, l, i); + if (u == kte && s.length) { + let h = o.node, f = h.firstChild, d = f && Az(f, l), p; + if (d) { + for (let g of s) + if (g.tag == d && (!g.attrs || g.attrs(p || (p = _te(h, l))))) { + let m = h.lastChild, v = m.type.id == FCe ? m.from : h.to; + if (v > f.to) + return { parser: g.parser, overlay: [{ from: f.to, to: v }] }; + } + } + } + if (a && u == Ste) { + let h = o.node, f; + if (f = h.firstChild) { + let d = a[l.read(f.from, f.to)]; + if (d) + for (let p of d) { + if (p.tagName && p.tagName != Az(h.parent, l)) continue; - let B = S.lastChild; - if (B.type.id == eje) { - let z = B.from + 1, W = B.lastChild, H = B.to - (W && W.isError ? 0 : 1); - if (H > z) - return { parser: M.parser, overlay: [{ from: z, to: H }] }; - } else if (B.type.id == fNt) - return { parser: M.parser, overlay: [{ from: B.from, to: B.to }] }; + let g = h.lastChild; + if (g.type.id == q7) { + let m = g.from + 1, v = g.lastChild, y = g.to - (v && v.isError ? 0 : 1); + if (y > m) + return { parser: p.parser, overlay: [{ from: m, to: y }] }; + } else if (g.type.id == Tte) + return { parser: p.parser, overlay: [{ from: g.from, to: g.to }] }; } } } return null; }); } -const D7n = 96, tTt = 1, M7n = 97, P7n = 98, nTt = 2, bNt = [ +const sEe = 96, Lz = 1, aEe = 97, oEe = 98, Rz = 2, Lte = [ 9, 10, 11, @@ -22607,74 +22616,74 @@ const D7n = 96, tTt = 1, M7n = 97, P7n = 98, nTt = 2, bNt = [ 8239, 8287, 12288 -], L7n = 58, I7n = 40, vNt = 95, N7n = 91, obe = 45, R7n = 46, $7n = 35, B7n = 37, F7n = 38, j7n = 92, Q7n = 10; -function xve(r) { - return r >= 65 && r <= 90 || r >= 97 && r <= 122 || r >= 161; -} -function z7n(r) { - return r >= 48 && r <= 57; -} -const q7n = new Ek((r, n) => { - for (let s = !1, a = 0, l = 0; ; l++) { - let { next: h } = r; - if (xve(h) || h == obe || h == vNt || s && z7n(h)) - !s && (h != obe || l > 0) && (s = !0), a === l && h == obe && a++, r.advance(); - else if (h == j7n && r.peek(1) != Q7n) - r.advance(), r.next > -1 && r.advance(), s = !0; +], lEe = 58, cEe = 40, Rte = 95, uEe = 91, v4 = 45, hEe = 46, fEe = 35, dEe = 37, pEe = 38, gEe = 92, mEe = 10; +function J5(t) { + return t >= 65 && t <= 90 || t >= 97 && t <= 122 || t >= 161; +} +function vEe(t) { + return t >= 48 && t <= 57; +} +const yEe = new ql((t, e) => { + for (let r = !1, n = 0, i = 0; ; i++) { + let { next: s } = t; + if (J5(s) || s == v4 || s == Rte || r && vEe(s)) + !r && (s != v4 || i > 0) && (r = !0), n === i && s == v4 && n++, t.advance(); + else if (s == gEe && t.peek(1) != mEe) + t.advance(), t.next > -1 && t.advance(), r = !0; else { - s && r.acceptToken(h == I7n ? M7n : a == 2 && n.canShift(nTt) ? nTt : P7n); + r && t.acceptToken(s == cEe ? aEe : n == 2 && e.canShift(Rz) ? Rz : oEe); break; } } -}), V7n = new Ek((r) => { - if (bNt.includes(r.peek(-1))) { - let { next: n } = r; - (xve(n) || n == vNt || n == $7n || n == R7n || n == N7n || n == L7n || n == obe || n == F7n) && r.acceptToken(D7n); +}), bEe = new ql((t) => { + if (Lte.includes(t.peek(-1))) { + let { next: e } = t; + (J5(e) || e == Rte || e == fEe || e == hEe || e == uEe || e == lEe || e == v4 || e == pEe) && t.acceptToken(sEe); } -}), U7n = new Ek((r) => { - if (!bNt.includes(r.peek(-1))) { - let { next: n } = r; - if (n == B7n && (r.advance(), r.acceptToken(tTt)), xve(n)) { +}), xEe = new ql((t) => { + if (!Lte.includes(t.peek(-1))) { + let { next: e } = t; + if (e == dEe && (t.advance(), t.acceptToken(Lz)), J5(e)) { do - r.advance(); - while (xve(r.next)); - r.acceptToken(tTt); - } - } -}), W7n = GF({ - "AtKeyword import charset namespace keyframes media supports": Ft.definitionKeyword, - "from to selector": Ft.keyword, - NamespaceName: Ft.namespace, - KeyframeName: Ft.labelName, - KeyframeRangeName: Ft.operatorKeyword, - TagName: Ft.tagName, - ClassName: Ft.className, - PseudoClassName: Ft.constant(Ft.className), - IdName: Ft.labelName, - "FeatureName PropertyName": Ft.propertyName, - AttributeName: Ft.attributeName, - NumberLiteral: Ft.number, - KeywordQuery: Ft.keyword, - UnaryQueryOp: Ft.operatorKeyword, - "CallTag ValueName": Ft.atom, - VariableName: Ft.variableName, - Callee: Ft.operatorKeyword, - Unit: Ft.unit, - "UniversalSelector NestingSelector": Ft.definitionOperator, - MatchOp: Ft.compareOperator, - "ChildOp SiblingOp, LogicOp": Ft.logicOperator, - BinOp: Ft.arithmeticOperator, - Important: Ft.modifier, - Comment: Ft.blockComment, - ColorLiteral: Ft.color, - "ParenthesizedContent StringLiteral": Ft.string, - ":": Ft.punctuation, - "PseudoOp #": Ft.derefOperator, - "; ,": Ft.separator, - "( )": Ft.paren, - "[ ]": Ft.squareBracket, - "{ }": Ft.brace -}), Y7n = { __proto__: null, lang: 32, "nth-child": 32, "nth-last-child": 32, "nth-of-type": 32, "nth-last-of-type": 32, dir: 32, "host-context": 32, url: 60, "url-prefix": 60, domain: 60, regexp: 60, selector: 134 }, H7n = { __proto__: null, "@import": 114, "@media": 138, "@charset": 142, "@namespace": 146, "@keyframes": 152, "@supports": 164 }, G7n = { __proto__: null, not: 128, only: 128 }, Z7n = mF.deserialize({ + t.advance(); + while (J5(t.next)); + t.acceptToken(Lz); + } + } +}), wEe = N1({ + "AtKeyword import charset namespace keyframes media supports": Se.definitionKeyword, + "from to selector": Se.keyword, + NamespaceName: Se.namespace, + KeyframeName: Se.labelName, + KeyframeRangeName: Se.operatorKeyword, + TagName: Se.tagName, + ClassName: Se.className, + PseudoClassName: Se.constant(Se.className), + IdName: Se.labelName, + "FeatureName PropertyName": Se.propertyName, + AttributeName: Se.attributeName, + NumberLiteral: Se.number, + KeywordQuery: Se.keyword, + UnaryQueryOp: Se.operatorKeyword, + "CallTag ValueName": Se.atom, + VariableName: Se.variableName, + Callee: Se.operatorKeyword, + Unit: Se.unit, + "UniversalSelector NestingSelector": Se.definitionOperator, + MatchOp: Se.compareOperator, + "ChildOp SiblingOp, LogicOp": Se.logicOperator, + BinOp: Se.arithmeticOperator, + Important: Se.modifier, + Comment: Se.blockComment, + ColorLiteral: Se.color, + "ParenthesizedContent StringLiteral": Se.string, + ":": Se.punctuation, + "PseudoOp #": Se.derefOperator, + "; ,": Se.separator, + "( )": Se.paren, + "[ ]": Se.squareBracket, + "{ }": Se.brace +}), OEe = { __proto__: null, lang: 32, "nth-child": 32, "nth-last-child": 32, "nth-of-type": 32, "nth-last-of-type": 32, dir: 32, "host-context": 32, url: 60, "url-prefix": 60, domain: 60, regexp: 60, selector: 134 }, kEe = { __proto__: null, "@import": 114, "@media": 138, "@charset": 142, "@namespace": 146, "@keyframes": 152, "@supports": 164 }, SEe = { __proto__: null, not: 128, only: 128 }, TEe = Bg.deserialize({ version: 14, states: "9bQYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DPO$vQ[O'#DTOOQP'#Ej'#EjO${QdO'#DeO%gQ[O'#DrO${QdO'#DtO%xQ[O'#DvO&TQ[O'#DyO&]Q[O'#EPO&kQ[O'#EROOQS'#Ei'#EiOOQS'#EU'#EUQYQ[OOO&rQXO'#CdO'gQWO'#DaO'lQWO'#EpO'wQ[O'#EpQOQWOOP(RO#tO'#C_POOO)C@X)C@XOOQP'#Cg'#CgOOQP,59Q,59QO#kQ[O,59QO(^Q[O'#EXO(xQWO,58{O)QQ[O,59SO$qQ[O,59kO$vQ[O,59oO(^Q[O,59sO(^Q[O,59uO(^Q[O,59vO)]Q[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)dQWO,59SO)iQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)nQ`O,59oOOQS'#Cp'#CpO${QdO'#CqO)vQvO'#CsO+TQtO,5:POOQO'#Cx'#CxO)iQWO'#CwO+iQWO'#CyOOQS'#Em'#EmOOQO'#Dh'#DhO+nQ[O'#DoO+|QWO'#EqO&]Q[O'#DmO,[QWO'#DpOOQO'#Er'#ErO({QWO,5:^O,aQpO,5:`OOQS'#Dx'#DxO,iQWO,5:bO,nQ[O,5:bOOQO'#D{'#D{O,vQWO,5:eO,{QWO,5:kO-TQWO,5:mOOQS-E8S-E8SO${QdO,59{O-]Q[O'#EZO-jQWO,5;[O-jQWO,5;[POOO'#ET'#ETP-uO#tO,58yPOOO,58y,58yOOQP1G.l1G.lO.lQXO,5:sOOQO-E8V-E8VOOQS1G.g1G.gOOQP1G.n1G.nO)dQWO1G.nO)iQWO1G.nOOQP1G/V1G/VO.yQ`O1G/ZO/dQXO1G/_O/zQXO1G/aO0bQXO1G/bO0xQWO,59zO0}Q[O'#DOO1UQdO'#CoOOQP1G/Z1G/ZO${QdO1G/ZO1]QpO,59]OOQS,59_,59_O${QdO,59aO1eQWO1G/kOOQS,59c,59cO1jQ!bO,59eO1rQWO'#DhO1}QWO,5:TO2SQWO,5:ZO&]Q[O,5:VO&]Q[O'#E[O2[QWO,5;]O2gQWO,5:XO(^Q[O,5:[OOQS1G/x1G/xOOQS1G/z1G/zOOQS1G/|1G/|O2xQWO1G/|O2}QdO'#D|OOQS1G0P1G0POOQS1G0V1G0VOOQS1G0X1G0XO3YQtO1G/gOOQO,5:u,5:uO3pQ[O,5:uOOQO-E8X-E8XO3}QWO1G0vPOOO-E8R-E8RPOOO1G.e1G.eOOQP7+$Y7+$YOOQP7+$u7+$uO${QdO7+$uOOQS1G/f1G/fO4YQXO'#EoO4aQWO,59jO4fQtO'#EVO5ZQdO'#ElO5eQWO,59ZO5jQpO7+$uOOQS1G.w1G.wOOQS1G.{1G.{OOQS7+%V7+%VO5rQWO1G/PO${QdO1G/oOOQO1G/u1G/uOOQO1G/q1G/qO5wQWO,5:vOOQO-E8Y-E8YO6VQXO1G/vOOQS7+%h7+%hO6^QYO'#CsOOQO'#EO'#EOO6iQ`O'#D}OOQO'#D}'#D}O6tQWO'#E]O6|QdO,5:hOOQS,5:h,5:hO7XQtO'#EYO${QdO'#EYO8VQdO7+%ROOQO7+%R7+%ROOQO1G0a1G0aO8jQpO< { ["openedBy", 17, "(", 48, "{"], ["closedBy", 18, ")", 49, "}"] ], - propSources: [W7n], + propSources: [wEe], skippedNodes: [0, 3, 85], repeatNodeCount: 10, tokenData: "J^~R!^OX$}X^%u^p$}pq%uqr)Xrs.Rst/utu6duv$}vw7^wx7oxy9^yz9oz{9t{|:_|}?Q}!O?c!O!P@Q!P!Q@i!Q![Ab![!]B]!]!^CX!^!_$}!_!`Cj!`!aC{!a!b$}!b!cDw!c!}$}!}#OFa#O#P$}#P#QFr#Q#R6d#R#T$}#T#UGT#U#c$}#c#dHf#d#o$}#o#pH{#p#q6d#q#rI^#r#sIo#s#y$}#y#z%u#z$f$}$f$g%u$g#BY$}#BY#BZ%u#BZ$IS$}$IS$I_%u$I_$I|$}$I|$JO%u$JO$JT$}$JT$JU%u$JU$KV$}$KV$KW%u$KW&FU$}&FU&FV%u&FV;'S$};'S;=`JW<%lO$}`%QSOy%^z;'S%^;'S;=`%o<%lO%^`%cSo`Oy%^z;'S%^;'S;=`%o<%lO%^`%rP;=`<%l%^~%zh#W~OX%^X^'f^p%^pq'fqy%^z#y%^#y#z'f#z$f%^$f$g'f$g#BY%^#BY#BZ'f#BZ$IS%^$IS$I_'f$I_$I|%^$I|$JO'f$JO$JT%^$JT$JU'f$JU$KV%^$KV$KW'f$KW&FU%^&FU&FV'f&FV;'S%^;'S;=`%o<%lO%^~'mh#W~o`OX%^X^'f^p%^pq'fqy%^z#y%^#y#z'f#z$f%^$f$g'f$g#BY%^#BY#BZ'f#BZ$IS%^$IS$I_'f$I_$I|%^$I|$JO'f$JO$JT%^$JT$JU'f$JU$KV%^$KV$KW'f$KW&FU%^&FU&FV'f&FV;'S%^;'S;=`%o<%lO%^l)[UOy%^z#]%^#]#^)n#^;'S%^;'S;=`%o<%lO%^l)sUo`Oy%^z#a%^#a#b*V#b;'S%^;'S;=`%o<%lO%^l*[Uo`Oy%^z#d%^#d#e*n#e;'S%^;'S;=`%o<%lO%^l*sUo`Oy%^z#c%^#c#d+V#d;'S%^;'S;=`%o<%lO%^l+[Uo`Oy%^z#f%^#f#g+n#g;'S%^;'S;=`%o<%lO%^l+sUo`Oy%^z#h%^#h#i,V#i;'S%^;'S;=`%o<%lO%^l,[Uo`Oy%^z#T%^#T#U,n#U;'S%^;'S;=`%o<%lO%^l,sUo`Oy%^z#b%^#b#c-V#c;'S%^;'S;=`%o<%lO%^l-[Uo`Oy%^z#h%^#h#i-n#i;'S%^;'S;=`%o<%lO%^l-uS!V[o`Oy%^z;'S%^;'S;=`%o<%lO%^~.UWOY.RZr.Rrs.ns#O.R#O#P.s#P;'S.R;'S;=`/o<%lO.R~.sOh~~.vRO;'S.R;'S;=`/P;=`O.R~/SXOY.RZr.Rrs.ns#O.R#O#P.s#P;'S.R;'S;=`/o;=`<%l.R<%lO.R~/rP;=`<%l.Rn/zYtQOy%^z!Q%^!Q![0j![!c%^!c!i0j!i#T%^#T#Z0j#Z;'S%^;'S;=`%o<%lO%^l0oYo`Oy%^z!Q%^!Q![1_![!c%^!c!i1_!i#T%^#T#Z1_#Z;'S%^;'S;=`%o<%lO%^l1dYo`Oy%^z!Q%^!Q![2S![!c%^!c!i2S!i#T%^#T#Z2S#Z;'S%^;'S;=`%o<%lO%^l2ZYf[o`Oy%^z!Q%^!Q![2y![!c%^!c!i2y!i#T%^#T#Z2y#Z;'S%^;'S;=`%o<%lO%^l3QYf[o`Oy%^z!Q%^!Q![3p![!c%^!c!i3p!i#T%^#T#Z3p#Z;'S%^;'S;=`%o<%lO%^l3uYo`Oy%^z!Q%^!Q![4e![!c%^!c!i4e!i#T%^#T#Z4e#Z;'S%^;'S;=`%o<%lO%^l4lYf[o`Oy%^z!Q%^!Q![5[![!c%^!c!i5[!i#T%^#T#Z5[#Z;'S%^;'S;=`%o<%lO%^l5aYo`Oy%^z!Q%^!Q![6P![!c%^!c!i6P!i#T%^#T#Z6P#Z;'S%^;'S;=`%o<%lO%^l6WSf[o`Oy%^z;'S%^;'S;=`%o<%lO%^d6gUOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^d7QSzSo`Oy%^z;'S%^;'S;=`%o<%lO%^b7cSXQOy%^z;'S%^;'S;=`%o<%lO%^~7rWOY7oZw7owx.nx#O7o#O#P8[#P;'S7o;'S;=`9W<%lO7o~8_RO;'S7o;'S;=`8h;=`O7o~8kXOY7oZw7owx.nx#O7o#O#P8[#P;'S7o;'S;=`9W;=`<%l7o<%lO7o~9ZP;=`<%l7on9cSb^Oy%^z;'S%^;'S;=`%o<%lO%^~9tOa~n9{UUQjWOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^n:fWjW!PQOy%^z!O%^!O!P;O!P!Q%^!Q![>T![;'S%^;'S;=`%o<%lO%^l;TUo`Oy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^l;nYo`#b[Oy%^z!Q%^!Q![;g![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^l[[o`#b[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^n?VSp^Oy%^z;'S%^;'S;=`%o<%lO%^l?hWjWOy%^z!O%^!O!P;O!P!Q%^!Q![>T![;'S%^;'S;=`%o<%lO%^n@VU#_QOy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^~@nTjWOy%^z{@}{;'S%^;'S;=`%o<%lO%^~AUSo`#X~Oy%^z;'S%^;'S;=`%o<%lO%^lAg[#b[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^bBbU]QOy%^z![%^![!]Bt!];'S%^;'S;=`%o<%lO%^bB{S^Qo`Oy%^z;'S%^;'S;=`%o<%lO%^nC^S!W^Oy%^z;'S%^;'S;=`%o<%lO%^dCoSzSOy%^z;'S%^;'S;=`%o<%lO%^bDQU|QOy%^z!`%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS|Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[!YQo`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bFfSxQOy%^z;'S%^;'S;=`%o<%lO%^lFwSv[Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUo`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!`Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!RUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!Q^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!PQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}", - tokenizers: [V7n, U7n, q7n, 1, 2, 3, 4, new yve("m~RRYZ[z{a~~g~aO#Z~~dP!P!Qg~lO#[~~", 28, 102)], + tokenizers: [bEe, xEe, yEe, 1, 2, 3, 4, new Z5("m~RRYZ[z{a~~g~aO#Z~~dP!P!Qg~lO#[~~", 28, 102)], topRules: { StyleSheet: [0, 4], Styles: [1, 84] }, - specialized: [{ term: 97, get: (r) => Y7n[r] || -1 }, { term: 56, get: (r) => H7n[r] || -1 }, { term: 98, get: (r) => G7n[r] || -1 }], + specialized: [{ term: 97, get: (t) => OEe[t] || -1 }, { term: 56, get: (t) => kEe[t] || -1 }, { term: 98, get: (t) => SEe[t] || -1 }], tokenPrec: 1169 }); -let KRe = null; -function JRe() { - if (!KRe && typeof document == "object" && document.body) { - let { style: r } = document.body, n = [], s = /* @__PURE__ */ new Set(); - for (let a in r) - a != "cssText" && a != "cssFloat" && typeof r[a] == "string" && (/[A-Z]/.test(a) && (a = a.replace(/[A-Z]/g, (l) => "-" + l.toLowerCase())), s.has(a) || (n.push(a), s.add(a))); - KRe = n.sort().map((a) => ({ type: "property", label: a })); +let GE = null; +function HE() { + if (!GE && typeof document == "object" && document.body) { + let { style: t } = document.body, e = [], r = /* @__PURE__ */ new Set(); + for (let n in t) + n != "cssText" && n != "cssFloat" && typeof t[n] == "string" && (/[A-Z]/.test(n) && (n = n.replace(/[A-Z]/g, (i) => "-" + i.toLowerCase())), r.has(n) || (e.push(n), r.add(n))); + GE = e.sort().map((n) => ({ type: "property", label: n })); } - return KRe || []; + return GE || []; } -const rTt = /* @__PURE__ */ [ +const Mz = /* @__PURE__ */ [ "active", "after", "any-link", @@ -22768,7 +22777,7 @@ const rTt = /* @__PURE__ */ [ "valid", "visited", "where" -].map((r) => ({ type: "class", label: r })), iTt = /* @__PURE__ */ [ +].map((t) => ({ type: "class", label: t })), Dz = /* @__PURE__ */ [ "above", "absolute", "activeborder", @@ -23188,7 +23197,7 @@ const rTt = /* @__PURE__ */ [ "xor", "xx-large", "xx-small" -].map((r) => ({ type: "keyword", label: r })).concat(/* @__PURE__ */ [ +].map((t) => ({ type: "keyword", label: t })).concat(/* @__PURE__ */ [ "aliceblue", "antiquewhite", "aqua", @@ -23331,7 +23340,7 @@ const rTt = /* @__PURE__ */ [ "whitesmoke", "yellow", "yellowgreen" -].map((r) => ({ type: "constant", label: r }))), X7n = /* @__PURE__ */ [ +].map((t) => ({ type: "constant", label: t }))), CEe = /* @__PURE__ */ [ "a", "abbr", "address", @@ -23410,79 +23419,79 @@ const rTt = /* @__PURE__ */ [ "tr", "u", "ul" -].map((r) => ({ type: "type", label: r })), BT = /^(\w[\w-]*|-\w[\w-]*|)$/, K7n = /^-(-[\w-]*)?$/; -function J7n(r, n) { - var s; - if ((r.name == "(" || r.type.isError) && (r = r.parent || r), r.name != "ArgList") +].map((t) => ({ type: "type", label: t })), dh = /^(\w[\w-]*|-\w[\w-]*|)$/, EEe = /^-(-[\w-]*)?$/; +function _Ee(t, e) { + var r; + if ((t.name == "(" || t.type.isError) && (t = t.parent || t), t.name != "ArgList") return !1; - let a = (s = r.parent) === null || s === void 0 ? void 0 : s.firstChild; - return (a == null ? void 0 : a.name) != "Callee" ? !1 : n.sliceString(a.from, a.to) == "var"; + let n = (r = t.parent) === null || r === void 0 ? void 0 : r.firstChild; + return (n == null ? void 0 : n.name) != "Callee" ? !1 : e.sliceString(n.from, n.to) == "var"; } -const sTt = /* @__PURE__ */ new oPt(), e9n = ["Declaration"]; -function t9n(r) { - for (let n = r; ; ) { - if (n.type.isTop) - return n; - if (!(n = n.parent)) - return r; +const Nz = /* @__PURE__ */ new bK(), AEe = ["Declaration"]; +function LEe(t) { + for (let e = t; ; ) { + if (e.type.isTop) + return e; + if (!(e = e.parent)) + return t; } } -function wNt(r, n, s) { - if (n.to - n.from > 4096) { - let a = sTt.get(n); - if (a) - return a; - let l = [], h = /* @__PURE__ */ new Set(), f = n.cursor(fh.IncludeAnonymous); - if (f.firstChild()) +function Mte(t, e, r) { + if (e.to - e.from > 4096) { + let n = Nz.get(e); + if (n) + return n; + let i = [], s = /* @__PURE__ */ new Set(), a = e.cursor(un.IncludeAnonymous); + if (a.firstChild()) do - for (let b of wNt(r, f.node, s)) - h.has(b.label) || (h.add(b.label), l.push(b)); - while (f.nextSibling()); - return sTt.set(n, l), l; + for (let o of Mte(t, a.node, r)) + s.has(o.label) || (s.add(o.label), i.push(o)); + while (a.nextSibling()); + return Nz.set(e, i), i; } else { - let a = [], l = /* @__PURE__ */ new Set(); - return n.cursor().iterate((h) => { - var f; - if (s(h) && h.matchContext(e9n) && ((f = h.node.nextSibling) === null || f === void 0 ? void 0 : f.name) == ":") { - let b = r.sliceString(h.from, h.to); - l.has(b) || (l.add(b), a.push({ label: b, type: "variable" })); + let n = [], i = /* @__PURE__ */ new Set(); + return e.cursor().iterate((s) => { + var a; + if (r(s) && s.matchContext(AEe) && ((a = s.node.nextSibling) === null || a === void 0 ? void 0 : a.name) == ":") { + let o = t.sliceString(s.from, s.to); + i.has(o) || (i.add(o), n.push({ label: o, type: "variable" })); } - }), a; + }), n; } } -const n9n = (r) => (n) => { - let { state: s, pos: a } = n, l = dh(s).resolveInner(a, -1), h = l.type.isError && l.from == l.to - 1 && s.doc.sliceString(l.from, l.to) == "-"; - if (l.name == "PropertyName" || (h || l.name == "TagName") && /^(Block|Styles)$/.test(l.resolve(l.to).name)) - return { from: l.from, options: JRe(), validFor: BT }; - if (l.name == "ValueName") - return { from: l.from, options: iTt, validFor: BT }; - if (l.name == "PseudoClassName") - return { from: l.from, options: rTt, validFor: BT }; - if (r(l) || (n.explicit || h) && J7n(l, s.doc)) +const REe = (t) => (e) => { + let { state: r, pos: n } = e, i = fn(r).resolveInner(n, -1), s = i.type.isError && i.from == i.to - 1 && r.doc.sliceString(i.from, i.to) == "-"; + if (i.name == "PropertyName" || (s || i.name == "TagName") && /^(Block|Styles)$/.test(i.resolve(i.to).name)) + return { from: i.from, options: HE(), validFor: dh }; + if (i.name == "ValueName") + return { from: i.from, options: Dz, validFor: dh }; + if (i.name == "PseudoClassName") + return { from: i.from, options: Mz, validFor: dh }; + if (t(i) || (e.explicit || s) && _Ee(i, r.doc)) return { - from: r(l) || h ? l.from : a, - options: wNt(s.doc, t9n(l), r), - validFor: K7n + from: t(i) || s ? i.from : n, + options: Mte(r.doc, LEe(i), t), + validFor: EEe }; - if (l.name == "TagName") { - for (let { parent: w } = l; w; w = w.parent) - if (w.name == "Block") - return { from: l.from, options: JRe(), validFor: BT }; - return { from: l.from, options: X7n, validFor: BT }; + if (i.name == "TagName") { + for (let { parent: l } = i; l; l = l.parent) + if (l.name == "Block") + return { from: i.from, options: HE(), validFor: dh }; + return { from: i.from, options: CEe, validFor: dh }; } - if (!n.explicit) + if (!e.explicit) return null; - let f = l.resolve(a), b = f.childBefore(a); - return b && b.name == ":" && f.name == "PseudoClassSelector" ? { from: a, options: rTt, validFor: BT } : b && b.name == ":" && f.name == "Declaration" || f.name == "ArgList" ? { from: a, options: iTt, validFor: BT } : f.name == "Block" || f.name == "Styles" ? { from: a, options: JRe(), validFor: BT } : null; -}, r9n = /* @__PURE__ */ n9n((r) => r.name == "VariableName"), Sve = /* @__PURE__ */ oF.define({ + let a = i.resolve(n), o = a.childBefore(n); + return o && o.name == ":" && a.name == "PseudoClassSelector" ? { from: n, options: Mz, validFor: dh } : o && o.name == ":" && a.name == "Declaration" || a.name == "ArgList" ? { from: n, options: Dz, validFor: dh } : a.name == "Block" || a.name == "Styles" ? { from: n, options: HE(), validFor: dh } : null; +}, MEe = /* @__PURE__ */ REe((t) => t.name == "VariableName"), e3 = /* @__PURE__ */ _g.define({ name: "css", - parser: /* @__PURE__ */ Z7n.configure({ + parser: /* @__PURE__ */ TEe.configure({ props: [ - /* @__PURE__ */ NJ.add({ - Declaration: /* @__PURE__ */ Jme() + /* @__PURE__ */ Gb.add({ + Declaration: /* @__PURE__ */ u4() }), - /* @__PURE__ */ ZF.add({ - "Block KeyframeList": pPt + /* @__PURE__ */ I1.add({ + "Block KeyframeList": EK }) ] }), @@ -23492,10 +23501,10 @@ const n9n = (r) => (n) => { wordChars: "-" } }); -function i9n() { - return new kK(Sve, Sve.data.of({ autocomplete: r9n })); +function DEe() { + return new Ry(e3, e3.data.of({ autocomplete: MEe })); } -const s9n = 309, oTt = 1, o9n = 2, a9n = 3, c9n = 310, l9n = 312, u9n = 313, h9n = 4, f9n = 5, d9n = 0, nje = [ +const NEe = 309, Iz = 1, IEe = 2, PEe = 3, $Ee = 310, BEe = 312, FEe = 313, zEe = 4, VEe = 5, UEe = 0, Y7 = [ 9, 10, 11, @@ -23521,160 +23530,160 @@ const s9n = 309, oTt = 1, o9n = 2, a9n = 3, c9n = 310, l9n = 312, u9n = 313, h9n 8239, 8287, 12288 -], yNt = 125, p9n = 59, rje = 47, g9n = 42, m9n = 43, b9n = 45, v9n = 60, w9n = 44, y9n = new sNt({ +], Dte = 125, qEe = 59, W7 = 47, QEe = 42, YEe = 43, WEe = 45, GEe = 60, HEe = 44, XEe = new yte({ start: !1, - shift(r, n) { - return n == h9n || n == f9n || n == l9n ? r : n == u9n; + shift(t, e) { + return e == zEe || e == VEe || e == BEe ? t : e == FEe; }, strict: !1 -}), O9n = new Ek((r, n) => { - let { next: s } = r; - (s == yNt || s == -1 || n.context) && r.acceptToken(c9n); -}, { contextual: !0, fallback: !0 }), k9n = new Ek((r, n) => { - let { next: s } = r, a; - nje.indexOf(s) > -1 || s == rje && ((a = r.peek(1)) == rje || a == g9n) || s != yNt && s != p9n && s != -1 && !n.context && r.acceptToken(s9n); -}, { contextual: !0 }), x9n = new Ek((r, n) => { - let { next: s } = r; - if ((s == m9n || s == b9n) && (r.advance(), s == r.next)) { - r.advance(); - let a = !n.context && n.canShift(oTt); - r.acceptToken(a ? oTt : o9n); +}), ZEe = new ql((t, e) => { + let { next: r } = t; + (r == Dte || r == -1 || e.context) && t.acceptToken($Ee); +}, { contextual: !0, fallback: !0 }), jEe = new ql((t, e) => { + let { next: r } = t, n; + Y7.indexOf(r) > -1 || r == W7 && ((n = t.peek(1)) == W7 || n == QEe) || r != Dte && r != qEe && r != -1 && !e.context && t.acceptToken(NEe); +}, { contextual: !0 }), KEe = new ql((t, e) => { + let { next: r } = t; + if ((r == YEe || r == WEe) && (t.advance(), r == t.next)) { + t.advance(); + let n = !e.context && e.canShift(Iz); + t.acceptToken(n ? Iz : IEe); } }, { contextual: !0 }); -function e$e(r, n) { - return r >= 65 && r <= 90 || r >= 97 && r <= 122 || r == 95 || r >= 192 || !n && r >= 48 && r <= 57; +function XE(t, e) { + return t >= 65 && t <= 90 || t >= 97 && t <= 122 || t == 95 || t >= 192 || !e && t >= 48 && t <= 57; } -const S9n = new Ek((r, n) => { - if (r.next != v9n || !n.dialectEnabled(d9n) || (r.advance(), r.next == rje)) +const JEe = new ql((t, e) => { + if (t.next != GEe || !e.dialectEnabled(UEe) || (t.advance(), t.next == W7)) return; - let s = 0; - for (; nje.indexOf(r.next) > -1; ) - r.advance(), s++; - if (e$e(r.next, !0)) { - for (r.advance(), s++; e$e(r.next, !1); ) - r.advance(), s++; - for (; nje.indexOf(r.next) > -1; ) - r.advance(), s++; - if (r.next == w9n) + let r = 0; + for (; Y7.indexOf(t.next) > -1; ) + t.advance(), r++; + if (XE(t.next, !0)) { + for (t.advance(), r++; XE(t.next, !1); ) + t.advance(), r++; + for (; Y7.indexOf(t.next) > -1; ) + t.advance(), r++; + if (t.next == HEe) return; - for (let a = 0; ; a++) { - if (a == 7) { - if (!e$e(r.next, !0)) + for (let n = 0; ; n++) { + if (n == 7) { + if (!XE(t.next, !0)) return; break; } - if (r.next != "extends".charCodeAt(a)) + if (t.next != "extends".charCodeAt(n)) break; - r.advance(), s++; - } - } - r.acceptToken(a9n, -s); -}), _9n = GF({ - "get set async static": Ft.modifier, - "for while do if else switch try catch finally return throw break continue default case": Ft.controlKeyword, - "in of await yield void typeof delete instanceof": Ft.operatorKeyword, - "let var const using function class extends": Ft.definitionKeyword, - "import export from": Ft.moduleKeyword, - "with debugger as new": Ft.keyword, - TemplateString: Ft.special(Ft.string), - super: Ft.atom, - BooleanLiteral: Ft.bool, - this: Ft.self, - null: Ft.null, - Star: Ft.modifier, - VariableName: Ft.variableName, - "CallExpression/VariableName TaggedTemplateExpression/VariableName": Ft.function(Ft.variableName), - VariableDefinition: Ft.definition(Ft.variableName), - Label: Ft.labelName, - PropertyName: Ft.propertyName, - PrivatePropertyName: Ft.special(Ft.propertyName), - "CallExpression/MemberExpression/PropertyName": Ft.function(Ft.propertyName), - "FunctionDeclaration/VariableDefinition": Ft.function(Ft.definition(Ft.variableName)), - "ClassDeclaration/VariableDefinition": Ft.definition(Ft.className), - PropertyDefinition: Ft.definition(Ft.propertyName), - PrivatePropertyDefinition: Ft.definition(Ft.special(Ft.propertyName)), - UpdateOp: Ft.updateOperator, - "LineComment Hashbang": Ft.lineComment, - BlockComment: Ft.blockComment, - Number: Ft.number, - String: Ft.string, - Escape: Ft.escape, - ArithOp: Ft.arithmeticOperator, - LogicOp: Ft.logicOperator, - BitOp: Ft.bitwiseOperator, - CompareOp: Ft.compareOperator, - RegExp: Ft.regexp, - Equals: Ft.definitionOperator, - Arrow: Ft.function(Ft.punctuation), - ": Spread": Ft.punctuation, - "( )": Ft.paren, - "[ ]": Ft.squareBracket, - "{ }": Ft.brace, - "InterpolationStart InterpolationEnd": Ft.special(Ft.brace), - ".": Ft.derefOperator, - ", ;": Ft.separator, - "@": Ft.meta, - TypeName: Ft.typeName, - TypeDefinition: Ft.definition(Ft.typeName), - "type enum interface implements namespace module declare": Ft.definitionKeyword, - "abstract global Privacy readonly override": Ft.modifier, - "is keyof unique infer": Ft.operatorKeyword, - JSXAttributeValue: Ft.attributeValue, - JSXText: Ft.content, - "JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag": Ft.angleBracket, - "JSXIdentifier JSXNameSpacedName": Ft.tagName, - "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": Ft.attributeName, - "JSXBuiltin/JSXIdentifier": Ft.standard(Ft.tagName) -}), C9n = { __proto__: null, export: 18, as: 23, from: 31, default: 34, async: 39, function: 40, extends: 52, this: 56, true: 64, false: 64, null: 76, void: 80, typeof: 84, super: 102, new: 136, delete: 152, yield: 161, await: 165, class: 170, public: 227, private: 227, protected: 227, readonly: 229, instanceof: 248, satisfies: 251, in: 252, const: 254, import: 286, keyof: 339, unique: 343, infer: 349, is: 385, abstract: 405, implements: 407, type: 409, let: 412, var: 414, using: 417, interface: 423, enum: 427, namespace: 433, module: 435, declare: 439, global: 443, for: 462, of: 471, while: 474, with: 478, do: 482, if: 486, else: 488, switch: 492, case: 498, try: 504, catch: 508, finally: 512, return: 516, throw: 520, break: 524, continue: 528, debugger: 532 }, E9n = { __proto__: null, async: 123, get: 125, set: 127, declare: 187, public: 189, private: 189, protected: 189, static: 191, abstract: 193, override: 195, readonly: 201, accessor: 203, new: 389 }, T9n = { __proto__: null, "<": 143 }, A9n = mF.deserialize({ + t.advance(), r++; + } + } + t.acceptToken(PEe, -r); +}), e6e = N1({ + "get set async static": Se.modifier, + "for while do if else switch try catch finally return throw break continue default case": Se.controlKeyword, + "in of await yield void typeof delete instanceof": Se.operatorKeyword, + "let var const using function class extends": Se.definitionKeyword, + "import export from": Se.moduleKeyword, + "with debugger as new": Se.keyword, + TemplateString: Se.special(Se.string), + super: Se.atom, + BooleanLiteral: Se.bool, + this: Se.self, + null: Se.null, + Star: Se.modifier, + VariableName: Se.variableName, + "CallExpression/VariableName TaggedTemplateExpression/VariableName": Se.function(Se.variableName), + VariableDefinition: Se.definition(Se.variableName), + Label: Se.labelName, + PropertyName: Se.propertyName, + PrivatePropertyName: Se.special(Se.propertyName), + "CallExpression/MemberExpression/PropertyName": Se.function(Se.propertyName), + "FunctionDeclaration/VariableDefinition": Se.function(Se.definition(Se.variableName)), + "ClassDeclaration/VariableDefinition": Se.definition(Se.className), + PropertyDefinition: Se.definition(Se.propertyName), + PrivatePropertyDefinition: Se.definition(Se.special(Se.propertyName)), + UpdateOp: Se.updateOperator, + "LineComment Hashbang": Se.lineComment, + BlockComment: Se.blockComment, + Number: Se.number, + String: Se.string, + Escape: Se.escape, + ArithOp: Se.arithmeticOperator, + LogicOp: Se.logicOperator, + BitOp: Se.bitwiseOperator, + CompareOp: Se.compareOperator, + RegExp: Se.regexp, + Equals: Se.definitionOperator, + Arrow: Se.function(Se.punctuation), + ": Spread": Se.punctuation, + "( )": Se.paren, + "[ ]": Se.squareBracket, + "{ }": Se.brace, + "InterpolationStart InterpolationEnd": Se.special(Se.brace), + ".": Se.derefOperator, + ", ;": Se.separator, + "@": Se.meta, + TypeName: Se.typeName, + TypeDefinition: Se.definition(Se.typeName), + "type enum interface implements namespace module declare": Se.definitionKeyword, + "abstract global Privacy readonly override": Se.modifier, + "is keyof unique infer": Se.operatorKeyword, + JSXAttributeValue: Se.attributeValue, + JSXText: Se.content, + "JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag": Se.angleBracket, + "JSXIdentifier JSXNameSpacedName": Se.tagName, + "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": Se.attributeName, + "JSXBuiltin/JSXIdentifier": Se.standard(Se.tagName) +}), t6e = { __proto__: null, export: 18, as: 23, from: 31, default: 34, async: 39, function: 40, extends: 52, this: 56, true: 64, false: 64, null: 76, void: 80, typeof: 84, super: 102, new: 136, delete: 152, yield: 161, await: 165, class: 170, public: 227, private: 227, protected: 227, readonly: 229, instanceof: 248, satisfies: 251, in: 252, const: 254, import: 286, keyof: 339, unique: 343, infer: 349, is: 385, abstract: 405, implements: 407, type: 409, let: 412, var: 414, using: 417, interface: 423, enum: 427, namespace: 433, module: 435, declare: 439, global: 443, for: 462, of: 471, while: 474, with: 478, do: 482, if: 486, else: 488, switch: 492, case: 498, try: 504, catch: 508, finally: 512, return: 516, throw: 520, break: 524, continue: 528, debugger: 532 }, r6e = { __proto__: null, async: 123, get: 125, set: 127, declare: 187, public: 189, private: 189, protected: 189, static: 191, abstract: 193, override: 195, readonly: 201, accessor: 203, new: 389 }, n6e = { __proto__: null, "<": 143 }, i6e = Bg.deserialize({ version: 14, states: "$RQWO'#CdO>cQWO'#H[O>kQWO'#HbO>kQWO'#HdO`Q^O'#HfO>kQWO'#HhO>kQWO'#HkO>pQWO'#HqO>uQ07iO'#HwO%[Q^O'#HyO?QQ07iO'#H{O?]Q07iO'#H}O9kQ07hO'#IPO?hQ08SO'#ChO@jQ`O'#DiQOQWOOO%[Q^O'#EPOAQQWO'#ESO:RQ7[O'#EjOA]QWO'#EjOAhQpO'#FbOOQU'#Cf'#CfOOQ07`'#Dn'#DnOOQ07`'#Jm'#JmO%[Q^O'#JmOOQO'#Jq'#JqOOQO'#Ib'#IbOBhQ`O'#EcOOQ07`'#Eb'#EbOCdQ07pO'#EcOCnQ`O'#EVOOQO'#Jp'#JpODSQ`O'#JqOEaQ`O'#EVOCnQ`O'#EcPEnO!0LbO'#CaPOOO)CDu)CDuOOOO'#IX'#IXOEyO!bO,59TOOQ07b,59T,59TOOOO'#IY'#IYOFXO#tO,59TO%[Q^O'#D`OOOO'#I['#I[OFgO?MpO,59xOOQ07b,59x,59xOFuQ^O'#I]OGYQWO'#JkOI[QrO'#JkO+}Q^O'#JkOIcQWO,5:OOIyQWO'#ElOJWQWO'#JyOJcQWO'#JxOJcQWO'#JxOJkQWO,5;YOJpQWO'#JwOOQ07f,5:Z,5:ZOJwQ^O,5:ZOLxQ08SO,5:eOMiQWO,5:mONSQ07hO'#JvONZQWO'#JuO9ZQWO'#JuONoQWO'#JuONwQWO,5;XON|QWO'#JuO!#UQrO'#JjOOQ07b'#Ch'#ChO%[Q^O'#ERO!#tQpO,5:rOOQO'#Jr'#JrOOQO-EmOOQU'#J`'#J`OOQU,5>n,5>nOOQU-EpQWO'#HQO9aQWO'#HSO!CgQWO'#HSO:RQ7[O'#HUO!ClQWO'#HUOOQU,5=j,5=jO!CqQWO'#HVO!DSQWO'#CnO!DXQWO,59OO!DcQWO,59OO!FhQ^O,59OOOQU,59O,59OO!FxQ07hO,59OO%[Q^O,59OO!ITQ^O'#H^OOQU'#H_'#H_OOQU'#H`'#H`O`Q^O,5=vO!IkQWO,5=vO`Q^O,5=|O`Q^O,5>OO!IpQWO,5>QO`Q^O,5>SO!IuQWO,5>VO!IzQ^O,5>]OOQU,5>c,5>cO%[Q^O,5>cO9kQ07hO,5>eOOQU,5>g,5>gO!NUQWO,5>gOOQU,5>i,5>iO!NUQWO,5>iOOQU,5>k,5>kO!NZQ`O'#D[O%[Q^O'#JmO!NxQ`O'#JmO# gQ`O'#DjO# xQ`O'#DjO#$ZQ^O'#DjO#$bQWO'#JlO#$jQWO,5:TO#$oQWO'#EpO#$}QWO'#JzO#%VQWO,5;ZO#%[Q`O'#DjO#%iQ`O'#EUOOQ07b,5:n,5:nO%[Q^O,5:nO#%pQWO,5:nO>pQWO,5;UO!@}Q`O,5;UO!AVQ7[O,5;UO:RQ7[O,5;UO#%xQWO,5@XO#%}Q$ISO,5:rOOQO-E<`-E<`O#'TQ07pO,5:}OCnQ`O,5:qO#'_Q`O,5:qOCnQ`O,5:}O!@rQ07hO,5:qOOQ07`'#Ef'#EfOOQO,5:},5:}O%[Q^O,5:}O#'lQ07hO,5:}O#'wQ07hO,5:}O!@}Q`O,5:qOOQO,5;T,5;TO#(VQ07hO,5:}POOO'#IV'#IVP#(kO!0LbO,58{POOO,58{,58{OOOO-EwO+}Q^O,5>wOOQO,5>},5>}O#)VQ^O'#I]OOQO-EpQ08SO1G0{O#>wQ08SO1G0{O#@oQ08SO1G0{O#CoQ(CYO'#ChO#EmQ(CYO1G1^O#EtQ(CYO'#JjO!,lQWO1G1dO#FUQ08SO,5?TOOQ07`-EkQWO1G3lO$2^Q^O1G3nO$6bQ^O'#HmOOQU1G3q1G3qO$6oQWO'#HsO>pQWO'#HuOOQU1G3w1G3wO$6wQ^O1G3wO9kQ07hO1G3}OOQU1G4P1G4POOQ07`'#GY'#GYO9kQ07hO1G4RO9kQ07hO1G4TO$;OQWO,5@XO!*fQ^O,5;[O9ZQWO,5;[O>pQWO,5:UO!*fQ^O,5:UO!@}Q`O,5:UO$;TQ(CYO,5:UOOQO,5;[,5;[O$;_Q`O'#I^O$;uQWO,5@WOOQ07b1G/o1G/oO$;}Q`O'#IdO$pQWO1G0pO!@}Q`O1G0pO!AVQ7[O1G0pOOQ07`1G5s1G5sO!@rQ07hO1G0]OOQO1G0i1G0iO%[Q^O1G0iO$wO$>TQWO1G5qO$>]QWO1G6OO$>eQrO1G6PO9ZQWO,5>}O$>oQ08SO1G5|O%[Q^O1G5|O$?PQ07hO1G5|O$?bQWO1G5{O$?bQWO1G5{O9ZQWO1G5{O$?jQWO,5?QO9ZQWO,5?QOOQO,5?Q,5?QO$@OQWO,5?QO$'TQWO,5?QOOQO-EXOOQU,5>X,5>XO%[Q^O'#HnO%7^QWO'#HpOOQU,5>_,5>_O9ZQWO,5>_OOQU,5>a,5>aOOQU7+)c7+)cOOQU7+)i7+)iOOQU7+)m7+)mOOQU7+)o7+)oO%7cQ`O1G5sO%7wQ(CYO1G0vO%8RQWO1G0vOOQO1G/p1G/pO%8^Q(CYO1G/pO>pQWO1G/pO!*fQ^O'#DjOOQO,5>x,5>xOOQO-E<[-E<[OOQO,5?O,5?OOOQO-EpQWO7+&[O!@}Q`O7+&[OOQO7+%w7+%wO$=gQ08SO7+&TOOQO7+&T7+&TO%[Q^O7+&TO%8hQ07hO7+&TO!@rQ07hO7+%wO!@}Q`O7+%wO%8sQ07hO7+&TO%9RQ08SO7++hO%[Q^O7++hO%9cQWO7++gO%9cQWO7++gOOQO1G4l1G4lO9ZQWO1G4lO%9kQWO1G4lOOQO7+%|7+%|O#%sQWO<tQ08SO1G2ZO%AVQ08SO1G2mO%CbQ08SO1G2oO%EmQ7[O,5>yOOQO-E<]-E<]O%EwQrO,5>zO%[Q^O,5>zOOQO-E<^-E<^O%FRQWO1G5uOOQ07b<YOOQU,5>[,5>[O&5cQWO1G3yO9ZQWO7+&bO!*fQ^O7+&bOOQO7+%[7+%[O&5hQ(CYO1G6PO>pQWO7+%[OOQ07b<pQWO<pQWO7+)eO'&gQWO<}AN>}O%[Q^OAN?ZOOQO<eQ(CYOG26}O!*fQ^O'#DyO1PQWO'#EWO'@ZQrO'#JiO!*fQ^O'#DqO'@bQ^O'#D}O'@iQrO'#ChO'CPQrO'#ChO!*fQ^O'#EPO'CaQ^O,5;VO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O'#IiO'EdQWO,5a#@O#@^#@d#Ax#BW#Cr#DQ#DW#D^#Dd#Dn#Dt#Dz#EU#Eh#EnPPPPPPPPPP#EtPPPPPPP#Fi#Ip#KP#KW#K`PPPP$!d$%Z$+r$+u$+x$,q$,t$,w$-O$-WPP$-^$-b$.Y$/X$/]$/qPP$/u$/{$0PP$0S$0W$0Z$1P$1h$2P$2T$2W$2Z$2a$2d$2h$2lR!{RoqOXst!Z#c%j&m&o&p&r,h,m1w1zY!uQ'Z-Y1[5]Q%pvQ%xyQ&P|Q&e!VS'R!e-QQ'a!iS'g!r!xS*c$|*hQ+f%yQ+s&RQ,X&_Q-W'YQ-b'bQ-j'hQ/|*jQ1f,YR;Y:g%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%j%p%}&f&i&m&o&p&r&v'O']'m'}(P(V(^(r(v(z)y+O+S,e,h,m-^-f-t-z.l.s0[0a0q1_1o1p1r1t1w1z1|2m2s3Z5Y5d5t5u5x6]7w7|8]8gS#p]:d!r)[$[$m'S)n,y,|.{2]3p5W6S9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]Q*u%ZQ+k%{Q,Z&bQ,b&jQ.c;QQ0h+^Q0l+`Q0w+lQ1n,`Q2{.[Q4v0rQ5k1gQ6i3PQ6u;RQ7h4wR8m6j&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%j%p%}&f&i&j&m&o&p&r&v'O'S']'m'}(P(V(^(r(v(z)n)y+O+S+^,e,h,m,y,|-^-f-t-z.[.l.s.{0[0a0q1_1o1p1r1t1w1z1|2]2m2s3P3Z3p5W5Y5d5t5u5x6S6]6j7w7|8]8g9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]t!nQ!r!u!x!y'R'Y'Z'g'h'i-Q-W-Y-j1[5]5_$v$si#u#w$c$d$x${%O%Q%[%]%a)u){)}*P*R*Y*`*p*q+]+`+w+z.Z.i/Z/j/k/m0Q0S0^1R1U1^3O3x4S4[4f4n4p5c6g7T7^7y8j8w9[9n:O:W:y:z:|:};O;P;S;T;U;V;W;X;_;`;a;b;c;d;g;h;i;j;k;l;m;n;q;r < 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 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 using 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: 371, - context: y9n, + context: XEe, nodeProps: [ ["group", -26, 8, 16, 18, 65, 201, 205, 209, 210, 212, 215, 218, 228, 230, 236, 238, 240, 242, 245, 251, 257, 259, 261, 263, 265, 267, 268, "Statement", -32, 12, 13, 28, 31, 32, 38, 48, 51, 52, 54, 59, 67, 75, 79, 81, 83, 84, 106, 107, 116, 117, 134, 137, 139, 140, 141, 142, 144, 145, 164, 165, 167, "Expression", -23, 27, 29, 33, 37, 39, 41, 168, 170, 172, 173, 175, 176, 177, 179, 180, 181, 183, 184, 185, 195, 197, 199, 200, "Type", -3, 87, 99, 105, "ClassItem"], ["openedBy", 22, "<", 34, "InterpolationStart", 53, "[", 57, "{", 72, "(", 157, "JSXStartCloseTag"], ["closedBy", 23, ">", 36, "InterpolationEnd", 47, "]", 58, "}", 73, ")", 162, "JSXEndTag"] ], - propSources: [_9n], + propSources: [e6e], skippedNodes: [0, 4, 5, 271], repeatNodeCount: 37, tokenData: "$Fj(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Ns!`!a$#_!a!b$(l!b!c$,k!c!}Er!}#O$-u#O#P$/P#P#Q$4h#Q#R$5r#R#SEr#S#T$7P#T#o$8Z#o#p$q#r#s$?}#s$f%Z$f$g+g$g#BYEr#BY#BZ$AX#BZ$ISEr$IS$I_$AX$I_$I|Er$I|$I}$Dd$I}$JO$Dd$JO$JTEr$JT$JU$AX$JU$KVEr$KV$KW$AX$KW&FUEr&FU&FV$AX&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$AX?HUOEr(n%d_$f&j(Op(R!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$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$f&j(OpOY(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(OpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Op(R!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$f&j(Op(R!b't(;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(P#S$f&j'u(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$f&j(Op(R!b'u(;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`$f&j!o$Ip(Op(R!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`#t$Id$f&j(Op(R!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_#t$Id$f&j(Op(R!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$/|3l_'}$(n$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$f&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$a`$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$a``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$a`$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(R!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$a`(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k#%|:hh$f&j(Op(R!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXVS$f&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSVSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWVS(R!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]VS$f&j(OpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWVS(OpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYVS(Op(R!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%lQ^$f&j!USOY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@Y!_!}!=y!}#O!Bw#O#P!Dj#P#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!?Ta$f&j!USO!^&c!_#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&cS!@_X!USOY!@YZ!P!@Y!P!Q!@z!Q!}!@Y!}#O!Ac#O#P!Bb#P;'S!@Y;'S;=`!Bq<%lO!@YS!APU!US#Z#[!@z#]#^!@z#a#b!@z#g#h!@z#i#j!@z#m#n!@zS!AfVOY!AcZ#O!Ac#O#P!A{#P#Q!@Y#Q;'S!Ac;'S;=`!B[<%lO!AcS!BOSOY!AcZ;'S!Ac;'S;=`!B[<%lO!AcS!B_P;=`<%l!AcS!BeSOY!@YZ;'S!@Y;'S;=`!Bq<%lO!@YS!BtP;=`<%l!@Y&n!B|[$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#O!Bw#O#P!Cr#P#Q!=y#Q#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!CwX$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!DgP;=`<%l!Bw&n!DoX$f&jOY!=yYZ&cZ!^!=y!^!_!@Y!_#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!E_P;=`<%l!=y(Q!Eki$f&j(R!b!USOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!Eb#[#]&}#]#^!Eb#^#a&}#a#b!Eb#b#g&}#g#h!Eb#h#i&}#i#j!Eb#j#m&}#m#n!Eb#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!GaZ(R!b!USOY!GYZw!GYwx!@Yx!P!GY!P!Q!HS!Q!}!GY!}#O!Ic#O#P!Bb#P;'S!GY;'S;=`!JZ<%lO!GY!f!HZb(R!b!USOY'}Zw'}x#O'}#P#Z'}#Z#[!HS#[#]'}#]#^!HS#^#a'}#a#b!HS#b#g'}#g#h!HS#h#i'}#i#j!HS#j#m'}#m#n!HS#n;'S'};'S;=`(f<%lO'}!f!IhX(R!bOY!IcZw!Icwx!Acx#O!Ic#O#P!A{#P#Q!GY#Q;'S!Ic;'S;=`!JT<%lO!Ic!f!JWP;=`<%l!Ic!f!J^P;=`<%l!GY(Q!Jh^$f&j(R!bOY!JaYZ&cZw!Jawx!Bwx!^!Ja!^!_!Ic!_#O!Ja#O#P!Cr#P#Q!Q#V#X%Z#X#Y!4|#Y#b%Z#b#c#Zd$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#?tf$f&j(Op(R!bo$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c# C9n[r] || -1 }, { term: 334, get: (r) => E9n[r] || -1 }, { term: 70, get: (r) => T9n[r] || -1 }], + specialized: [{ term: 319, get: (t) => t6e[t] || -1 }, { term: 334, get: (t) => r6e[t] || -1 }, { term: 70, get: (t) => n6e[t] || -1 }], tokenPrec: 14626 -}), ONt = [ - /* @__PURE__ */ Xb("function ${name}(${params}) {\n ${}\n}", { +}), Nte = [ + /* @__PURE__ */ ya("function ${name}(${params}) {\n ${}\n}", { label: "function", detail: "definition", type: "keyword" }), - /* @__PURE__ */ Xb("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}", { + /* @__PURE__ */ ya("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}", { label: "for", detail: "loop", type: "keyword" }), - /* @__PURE__ */ Xb("for (let ${name} of ${collection}) {\n ${}\n}", { + /* @__PURE__ */ ya("for (let ${name} of ${collection}) {\n ${}\n}", { label: "for", detail: "of loop", type: "keyword" }), - /* @__PURE__ */ Xb("do {\n ${}\n} while (${})", { + /* @__PURE__ */ ya("do {\n ${}\n} while (${})", { label: "do", detail: "loop", type: "keyword" }), - /* @__PURE__ */ Xb("while (${}) {\n ${}\n}", { + /* @__PURE__ */ ya("while (${}) {\n ${}\n}", { label: "while", detail: "loop", type: "keyword" }), - /* @__PURE__ */ Xb(`try { + /* @__PURE__ */ ya(`try { \${} } catch (\${error}) { \${} @@ -23683,12 +23692,12 @@ const S9n = new Ek((r, n) => { detail: "/ catch block", type: "keyword" }), - /* @__PURE__ */ Xb("if (${}) {\n ${}\n}", { + /* @__PURE__ */ ya("if (${}) {\n ${}\n}", { label: "if", detail: "block", type: "keyword" }), - /* @__PURE__ */ Xb(`if (\${}) { + /* @__PURE__ */ ya(`if (\${}) { \${} } else { \${} @@ -23697,7 +23706,7 @@ const S9n = new Ek((r, n) => { detail: "/ else block", type: "keyword" }), - /* @__PURE__ */ Xb(`class \${name} { + /* @__PURE__ */ ya(`class \${name} { constructor(\${params}) { \${} } @@ -23706,33 +23715,33 @@ const S9n = new Ek((r, n) => { detail: "definition", type: "keyword" }), - /* @__PURE__ */ Xb('import {${names}} from "${module}"\n${}', { + /* @__PURE__ */ ya('import {${names}} from "${module}"\n${}', { label: "import", detail: "named", type: "keyword" }), - /* @__PURE__ */ Xb('import ${name} from "${module}"\n${}', { + /* @__PURE__ */ ya('import ${name} from "${module}"\n${}', { label: "import", detail: "default", type: "keyword" }) -], D9n = /* @__PURE__ */ ONt.concat([ - /* @__PURE__ */ Xb("interface ${name} {\n ${}\n}", { +], s6e = /* @__PURE__ */ Nte.concat([ + /* @__PURE__ */ ya("interface ${name} {\n ${}\n}", { label: "interface", detail: "definition", type: "keyword" }), - /* @__PURE__ */ Xb("type ${name} = ${type}", { + /* @__PURE__ */ ya("type ${name} = ${type}", { label: "type", detail: "definition", type: "keyword" }), - /* @__PURE__ */ Xb("enum ${name} {\n ${}\n}", { + /* @__PURE__ */ ya("enum ${name} {\n ${}\n}", { label: "enum", detail: "definition", type: "keyword" }) -]), aTt = /* @__PURE__ */ new oPt(), kNt = /* @__PURE__ */ new Set([ +]), Pz = /* @__PURE__ */ new bK(), Ite = /* @__PURE__ */ new Set([ "Script", "Block", "FunctionExpression", @@ -23741,51 +23750,51 @@ const S9n = new Ek((r, n) => { "MethodDeclaration", "ForStatement" ]); -function nX(r) { - return (n, s) => { - let a = n.node.getChild("VariableDefinition"); - return a && s(a, r), !0; +function Nm(t) { + return (e, r) => { + let n = e.node.getChild("VariableDefinition"); + return n && r(n, t), !0; }; } -const M9n = ["FunctionDeclaration"], P9n = { - FunctionDeclaration: /* @__PURE__ */ nX("function"), - ClassDeclaration: /* @__PURE__ */ nX("class"), +const a6e = ["FunctionDeclaration"], o6e = { + FunctionDeclaration: /* @__PURE__ */ Nm("function"), + ClassDeclaration: /* @__PURE__ */ Nm("class"), ClassExpression: () => !0, - EnumDeclaration: /* @__PURE__ */ nX("constant"), - TypeAliasDeclaration: /* @__PURE__ */ nX("type"), - NamespaceDeclaration: /* @__PURE__ */ nX("namespace"), - VariableDefinition(r, n) { - r.matchContext(M9n) || n(r, "variable"); + EnumDeclaration: /* @__PURE__ */ Nm("constant"), + TypeAliasDeclaration: /* @__PURE__ */ Nm("type"), + NamespaceDeclaration: /* @__PURE__ */ Nm("namespace"), + VariableDefinition(t, e) { + t.matchContext(a6e) || e(t, "variable"); }, - TypeDefinition(r, n) { - n(r, "type"); + TypeDefinition(t, e) { + e(t, "type"); }, __proto__: null }; -function xNt(r, n) { - let s = aTt.get(n); - if (s) - return s; - let a = [], l = !0; - function h(f, b) { - let w = r.sliceString(f.from, f.to); - a.push({ label: w, type: b }); - } - return n.cursor(fh.IncludeAnonymous).iterate((f) => { - if (l) - l = !1; - else if (f.name) { - let b = P9n[f.name]; - if (b && b(f, h) || kNt.has(f.name)) +function Pte(t, e) { + let r = Pz.get(e); + if (r) + return r; + let n = [], i = !0; + function s(a, o) { + let l = t.sliceString(a.from, a.to); + n.push({ label: l, type: o }); + } + return e.cursor(un.IncludeAnonymous).iterate((a) => { + if (i) + i = !1; + else if (a.name) { + let o = o6e[a.name]; + if (o && o(a, s) || Ite.has(a.name)) return !1; - } else if (f.to - f.from > 8192) { - for (let b of xNt(r, f.node)) - a.push(b); + } else if (a.to - a.from > 8192) { + for (let o of Pte(t, a.node)) + n.push(o); return !1; } - }), aTt.set(n, a), a; + }), Pz.set(e, n), n; } -const cTt = /^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/, SNt = [ +const $z = /^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/, $te = [ "TemplateString", "String", "RegExp", @@ -23801,54 +23810,54 @@ const cTt = /^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/, SNt = [ ".", "?." ]; -function L9n(r) { - let n = dh(r.state).resolveInner(r.pos, -1); - if (SNt.indexOf(n.name) > -1) +function l6e(t) { + let e = fn(t.state).resolveInner(t.pos, -1); + if ($te.indexOf(e.name) > -1) return null; - let s = n.name == "VariableName" || n.to - n.from < 20 && cTt.test(r.state.sliceDoc(n.from, n.to)); - if (!s && !r.explicit) + let r = e.name == "VariableName" || e.to - e.from < 20 && $z.test(t.state.sliceDoc(e.from, e.to)); + if (!r && !t.explicit) return null; - let a = []; - for (let l = n; l; l = l.parent) - kNt.has(l.name) && (a = a.concat(xNt(r.state.doc, l))); + let n = []; + for (let i = e; i; i = i.parent) + Ite.has(i.name) && (n = n.concat(Pte(t.state.doc, i))); return { - options: a, - from: s ? n.from : r.pos, - validFor: cTt + options: n, + from: r ? e.from : t.pos, + validFor: $z }; } -const rx = /* @__PURE__ */ oF.define({ +const Lc = /* @__PURE__ */ _g.define({ name: "javascript", - parser: /* @__PURE__ */ A9n.configure({ + parser: /* @__PURE__ */ i6e.configure({ props: [ - /* @__PURE__ */ NJ.add({ - IfStatement: /* @__PURE__ */ Jme({ except: /^\s*({|else\b)/ }), - TryStatement: /* @__PURE__ */ Jme({ except: /^\s*({|catch\b|finally\b)/ }), - LabeledStatement: $xn, - SwitchBody: (r) => { - let n = r.textAfter, s = /^\s*\}/.test(n), a = /^\s*(case|default)\b/.test(n); - return r.baseIndent + (s ? 0 : a ? 1 : 2) * r.unit; + /* @__PURE__ */ Gb.add({ + IfStatement: /* @__PURE__ */ u4({ except: /^\s*({|else\b)/ }), + TryStatement: /* @__PURE__ */ u4({ except: /^\s*({|catch\b|finally\b)/ }), + LabeledStatement: fOe, + SwitchBody: (t) => { + let e = t.textAfter, r = /^\s*\}/.test(e), n = /^\s*(case|default)\b/.test(e); + return t.baseIndent + (r ? 0 : n ? 1 : 2) * t.unit; }, - Block: /* @__PURE__ */ Rxn({ closing: "}" }), - ArrowFunction: (r) => r.baseIndent + r.unit, + Block: /* @__PURE__ */ hOe({ closing: "}" }), + ArrowFunction: (t) => t.baseIndent + t.unit, "TemplateString BlockComment": () => null, - "Statement Property": /* @__PURE__ */ Jme({ except: /^{/ }), - JSXElement(r) { - let n = /^\s*<\//.test(r.textAfter); - return r.lineIndent(r.node.from) + (n ? 0 : r.unit); + "Statement Property": /* @__PURE__ */ u4({ except: /^{/ }), + JSXElement(t) { + let e = /^\s*<\//.test(t.textAfter); + return t.lineIndent(t.node.from) + (e ? 0 : t.unit); }, - JSXEscape(r) { - let n = /\s*\}/.test(r.textAfter); - return r.lineIndent(r.node.from) + (n ? 0 : r.unit); + JSXEscape(t) { + let e = /\s*\}/.test(t.textAfter); + return t.lineIndent(t.node.from) + (e ? 0 : t.unit); }, - "JSXOpenTag JSXSelfClosingTag"(r) { - return r.column(r.node.from) + r.unit; + "JSXOpenTag JSXSelfClosingTag"(t) { + return t.column(t.node.from) + t.unit; } }), - /* @__PURE__ */ ZF.add({ - "Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType": pPt, - BlockComment(r) { - return { from: r.from + 2, to: r.to - 2 }; + /* @__PURE__ */ I1.add({ + "Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType": EK, + BlockComment(t) { + return { from: t.from + 2, to: t.to - 2 }; } }) ] @@ -23859,85 +23868,85 @@ const rx = /* @__PURE__ */ oF.define({ indentOnInput: /^\s*(?:case |default:|\{|\}|<\/)$/, wordChars: "$" } -}), _Nt = { - test: (r) => /^JSX/.test(r.name), - facet: /* @__PURE__ */ wze({ commentTokens: { block: { open: "{/*", close: "*/}" } } }) -}, CNt = /* @__PURE__ */ rx.configure({ dialect: "ts" }, "typescript"), ENt = /* @__PURE__ */ rx.configure({ +}), Bte = { + test: (t) => /^JSX/.test(t.name), + facet: /* @__PURE__ */ YR({ commentTokens: { block: { open: "{/*", close: "*/}" } } }) +}, Fte = /* @__PURE__ */ Lc.configure({ dialect: "ts" }, "typescript"), zte = /* @__PURE__ */ Lc.configure({ dialect: "jsx", - props: [/* @__PURE__ */ yze.add((r) => r.isTop ? [_Nt] : void 0)] -}), TNt = /* @__PURE__ */ rx.configure({ + props: [/* @__PURE__ */ WR.add((t) => t.isTop ? [Bte] : void 0)] +}), Vte = /* @__PURE__ */ Lc.configure({ dialect: "jsx ts", - props: [/* @__PURE__ */ yze.add((r) => r.isTop ? [_Nt] : void 0)] + props: [/* @__PURE__ */ WR.add((t) => t.isTop ? [Bte] : void 0)] }, "typescript"); -let ANt = (r) => ({ label: r, type: "keyword" }); -const DNt = /* @__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(ANt), I9n = /* @__PURE__ */ DNt.concat(/* @__PURE__ */ ["declare", "implements", "private", "protected", "public"].map(ANt)); -function N9n(r = {}) { - let n = r.jsx ? r.typescript ? TNt : ENt : r.typescript ? CNt : rx, s = r.typescript ? D9n.concat(I9n) : ONt.concat(DNt); - return new kK(n, [ - rx.data.of({ - autocomplete: Z6n(SNt, wLt(s)) +let Ute = (t) => ({ label: t, type: "keyword" }); +const qte = /* @__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(Ute), c6e = /* @__PURE__ */ qte.concat(/* @__PURE__ */ ["declare", "implements", "private", "protected", "public"].map(Ute)); +function u6e(t = {}) { + let e = t.jsx ? t.typescript ? Vte : zte : t.typescript ? Fte : Lc, r = t.typescript ? s6e.concat(c6e) : Nte.concat(qte); + return new Ry(e, [ + Lc.data.of({ + autocomplete: T5e($te, MJ(r)) }), - rx.data.of({ - autocomplete: L9n + Lc.data.of({ + autocomplete: l6e }), - r.jsx ? B9n : [] + t.jsx ? d6e : [] ]); } -function R9n(r) { +function h6e(t) { for (; ; ) { - if (r.name == "JSXOpenTag" || r.name == "JSXSelfClosingTag" || r.name == "JSXFragmentTag") - return r; - if (r.name == "JSXEscape" || !r.parent) + if (t.name == "JSXOpenTag" || t.name == "JSXSelfClosingTag" || t.name == "JSXFragmentTag") + return t; + if (t.name == "JSXEscape" || !t.parent) return null; - r = r.parent; + t = t.parent; } } -function lTt(r, n, s = r.length) { - for (let a = n == null ? void 0 : n.firstChild; a; a = a.nextSibling) - if (a.name == "JSXIdentifier" || a.name == "JSXBuiltin" || a.name == "JSXNamespacedName" || a.name == "JSXMemberExpression") - return r.sliceString(a.from, Math.min(a.to, s)); +function Bz(t, e, r = t.length) { + for (let n = e == null ? void 0 : e.firstChild; n; n = n.nextSibling) + if (n.name == "JSXIdentifier" || n.name == "JSXBuiltin" || n.name == "JSXNamespacedName" || n.name == "JSXMemberExpression") + return t.sliceString(n.from, Math.min(n.to, r)); return ""; } -const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent), B9n = /* @__PURE__ */ Ci.inputHandler.of((r, n, s, a, l) => { - if (($9n ? r.composing : r.compositionStarted) || r.state.readOnly || n != s || a != ">" && a != "/" || !rx.isActiveAt(r.state, n, -1)) +const f6e = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent), d6e = /* @__PURE__ */ dt.inputHandler.of((t, e, r, n, i) => { + if ((f6e ? t.composing : t.compositionStarted) || t.state.readOnly || e != r || n != ">" && n != "/" || !Lc.isActiveAt(t.state, e, -1)) return !1; - let h = l(), { state: f } = h, b = f.changeByRange((w) => { - var O; - let { head: S } = w, E = dh(f).resolveInner(S - 1, -1), D; - if (E.name == "JSXStartTag" && (E = E.parent), !(f.doc.sliceString(S - 1, S) != a || E.name == "JSXAttributeValue" && E.to > S)) { - if (a == ">" && E.name == "JSXFragmentTag") - return { range: w, changes: { from: S, insert: "" } }; - if (a == "/" && E.name == "JSXStartCloseTag") { - let M = E.parent, B = M.parent; - if (B && M.from == S - 2 && ((D = lTt(f.doc, B.firstChild, S)) || ((O = B.firstChild) === null || O === void 0 ? void 0 : O.name) == "JSXFragmentTag")) { - let z = `${D}>`; - return { range: sr.cursor(S + z.length, -1), changes: { from: S, insert: z } }; - } - } else if (a == ">") { - let M = R9n(E); - if (M && !/^\/?>|^<\//.test(f.doc.sliceString(S, S + 2)) && (D = lTt(f.doc, M, S))) - return { range: w, changes: { from: S, insert: `` } }; - } - } - return { range: w }; + let s = i(), { state: a } = s, o = a.changeByRange((l) => { + var u; + let { head: h } = l, f = fn(a).resolveInner(h - 1, -1), d; + if (f.name == "JSXStartTag" && (f = f.parent), !(a.doc.sliceString(h - 1, h) != n || f.name == "JSXAttributeValue" && f.to > h)) { + if (n == ">" && f.name == "JSXFragmentTag") + return { range: l, changes: { from: h, insert: "" } }; + if (n == "/" && f.name == "JSXStartCloseTag") { + let p = f.parent, g = p.parent; + if (g && p.from == h - 2 && ((d = Bz(a.doc, g.firstChild, h)) || ((u = g.firstChild) === null || u === void 0 ? void 0 : u.name) == "JSXFragmentTag")) { + let m = `${d}>`; + return { range: Ve.cursor(h + m.length, -1), changes: { from: h, insert: m } }; + } + } else if (n == ">") { + let p = h6e(f); + if (p && !/^\/?>|^<\//.test(a.doc.sliceString(h, h + 2)) && (d = Bz(a.doc, p, h))) + return { range: l, changes: { from: h, insert: `` } }; + } + } + return { range: l }; }); - return b.changes.empty ? !1 : (r.dispatch([ - h, - f.update(b, { userEvent: "input.complete", scrollIntoView: !0 }) + return o.changes.empty ? !1 : (t.dispatch([ + s, + a.update(o, { userEvent: "input.complete", scrollIntoView: !0 }) ]), !0); -}), rX = ["_blank", "_self", "_top", "_parent"], t$e = ["ascii", "utf-8", "utf-16", "latin1", "latin1"], n$e = ["get", "post", "put", "delete"], r$e = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], D2 = ["true", "false"], zs = {}, F9n = { +}), Im = ["_blank", "_self", "_top", "_parent"], ZE = ["ascii", "utf-8", "utf-16", "latin1", "latin1"], jE = ["get", "post", "put", "delete"], KE = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], Ha = ["true", "false"], Pt = {}, p6e = { a: { attrs: { href: null, ping: null, type: null, media: null, - target: rX, + target: Im, hreflang: null } }, - abbr: zs, - address: zs, + abbr: Pt, + address: Pt, area: { attrs: { alt: null, @@ -23951,8 +23960,8 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav shape: ["default", "rect", "circle", "poly"] } }, - article: zs, - aside: zs, + article: Pt, + aside: Pt, audio: { attrs: { src: null, @@ -23964,13 +23973,13 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav controls: ["controls"] } }, - b: zs, - base: { attrs: { href: null, target: rX } }, - bdi: zs, - bdo: zs, + b: Pt, + base: { attrs: { href: null, target: Im } }, + bdi: Pt, + bdo: Pt, blockquote: { attrs: { cite: null } }, - body: zs, - br: zs, + body: Pt, + br: Pt, button: { attrs: { form: null, @@ -23979,18 +23988,18 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav value: null, autofocus: ["autofocus"], disabled: ["autofocus"], - formenctype: r$e, - formmethod: n$e, + formenctype: KE, + formmethod: jE, formnovalidate: ["novalidate"], - formtarget: rX, + formtarget: Im, type: ["submit", "reset", "button"] } }, canvas: { attrs: { width: null, height: null } }, - caption: zs, - center: zs, - cite: zs, - code: zs, + caption: Pt, + center: Pt, + cite: Pt, + code: Pt, col: { attrs: { span: null } }, colgroup: { attrs: { span: null } }, command: { @@ -24008,48 +24017,48 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav data: { attrs: { value: null } }, datagrid: { attrs: { disabled: ["disabled"], multiple: ["multiple"] } }, datalist: { attrs: { data: null } }, - dd: zs, + dd: Pt, del: { attrs: { cite: null, datetime: null } }, details: { attrs: { open: ["open"] } }, - dfn: zs, - div: zs, - dl: zs, - dt: zs, - em: zs, + dfn: Pt, + div: Pt, + dl: Pt, + dt: Pt, + em: Pt, embed: { attrs: { src: null, type: null, width: null, height: null } }, eventsource: { attrs: { src: null } }, fieldset: { attrs: { disabled: ["disabled"], form: null, name: null } }, - figcaption: zs, - figure: zs, - footer: zs, + figcaption: Pt, + figure: Pt, + footer: Pt, form: { attrs: { action: null, name: null, - "accept-charset": t$e, + "accept-charset": ZE, autocomplete: ["on", "off"], - enctype: r$e, - method: n$e, + enctype: KE, + method: jE, novalidate: ["novalidate"], - target: rX + target: Im } }, - h1: zs, - h2: zs, - h3: zs, - h4: zs, - h5: zs, - h6: zs, + h1: Pt, + h2: Pt, + h3: Pt, + h4: Pt, + h5: Pt, + h6: Pt, head: { children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"] }, - header: zs, - hgroup: zs, - hr: zs, + header: Pt, + hgroup: Pt, + hr: Pt, html: { attrs: { manifest: null } }, - i: zs, + i: Pt, iframe: { attrs: { src: null, @@ -24096,10 +24105,10 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav autofocus: ["autofocus"], checked: ["checked"], disabled: ["disabled"], - formenctype: r$e, - formmethod: n$e, + formenctype: KE, + formmethod: jE, formnovalidate: ["novalidate"], - formtarget: rX, + formtarget: Im, multiple: ["multiple"], readonly: ["readonly"], required: ["required"], @@ -24131,7 +24140,7 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav } }, ins: { attrs: { cite: null, datetime: null } }, - kbd: zs, + kbd: Pt, keygen: { attrs: { challenge: null, @@ -24143,7 +24152,7 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav } }, label: { attrs: { for: null, form: null } }, - legend: zs, + legend: Pt, li: { attrs: { value: null } }, link: { attrs: { @@ -24155,19 +24164,19 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav } }, map: { attrs: { name: null } }, - mark: zs, + mark: Pt, menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } }, meta: { attrs: { content: null, - charset: t$e, + charset: ZE, name: ["viewport", "application-name", "author", "description", "generator", "keywords"], "http-equiv": ["content-language", "content-type", "default-style", "refresh"] } }, meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } }, - nav: zs, - noscript: zs, + nav: Pt, + noscript: Pt, object: { attrs: { data: null, @@ -24187,25 +24196,25 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav optgroup: { attrs: { disabled: ["disabled"], label: null } }, option: { attrs: { disabled: ["disabled"], label: null, selected: ["selected"], value: null } }, output: { attrs: { for: null, form: null, name: null } }, - p: zs, + p: Pt, param: { attrs: { name: null, value: null } }, - pre: zs, + pre: Pt, progress: { attrs: { value: null, max: null } }, q: { attrs: { cite: null } }, - rp: zs, - rt: zs, - ruby: zs, - samp: zs, + rp: Pt, + rt: Pt, + ruby: Pt, + samp: Pt, script: { attrs: { type: ["text/javascript"], src: null, async: ["async"], defer: ["defer"], - charset: t$e + charset: ZE } }, - section: zs, + section: Pt, select: { attrs: { form: null, @@ -24217,10 +24226,10 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav } }, slot: { attrs: { name: null } }, - small: zs, + small: Pt, source: { attrs: { src: null, type: null, media: null } }, - span: zs, - strong: zs, + span: Pt, + strong: Pt, style: { attrs: { type: ["text/css"], @@ -24228,13 +24237,13 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav scoped: null } }, - sub: zs, - summary: zs, - sup: zs, - table: zs, - tbody: zs, + sub: Pt, + summary: Pt, + sup: Pt, + table: Pt, + tbody: Pt, td: { attrs: { colspan: null, rowspan: null, headers: null } }, - template: zs, + template: Pt, textarea: { attrs: { dirname: null, @@ -24251,12 +24260,12 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav wrap: ["soft", "hard"] } }, - tfoot: zs, + tfoot: Pt, th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } }, - thead: zs, + thead: Pt, time: { attrs: { datetime: null } }, - title: zs, - tr: zs, + title: Pt, + tr: Pt, track: { attrs: { src: null, @@ -24267,7 +24276,7 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav } }, ul: { children: ["li", "script", "template", "ul", "ol"] }, - var: zs, + var: Pt, video: { attrs: { src: null, @@ -24282,11 +24291,11 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav controls: ["controls"] } }, - wbr: zs -}, MNt = { + wbr: Pt +}, Qte = { accesskey: null, class: null, - contenteditable: D2, + contenteditable: Ha, contextmenu: null, dir: ["ltr", "rtl", "auto"], draggable: ["true", "false", "auto"], @@ -24300,9 +24309,9 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav itemscope: ["itemscope"], itemtype: null, lang: ["ar", "bn", "de", "en-GB", "en-US", "es", "fr", "hi", "id", "ja", "pa", "pt", "ru", "tr", "zh"], - spellcheck: D2, - autocorrect: D2, - autocapitalize: D2, + spellcheck: Ha, + autocorrect: Ha, + autocapitalize: Ha, style: null, tabindex: null, title: null, @@ -24310,32 +24319,32 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"], role: /* @__PURE__ */ "alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "), "aria-activedescendant": null, - "aria-atomic": D2, + "aria-atomic": Ha, "aria-autocomplete": ["inline", "list", "both", "none"], - "aria-busy": D2, + "aria-busy": Ha, "aria-checked": ["true", "false", "mixed", "undefined"], "aria-controls": null, "aria-describedby": null, - "aria-disabled": D2, + "aria-disabled": Ha, "aria-dropeffect": null, "aria-expanded": ["true", "false", "undefined"], "aria-flowto": null, "aria-grabbed": ["true", "false", "undefined"], - "aria-haspopup": D2, - "aria-hidden": D2, + "aria-haspopup": Ha, + "aria-hidden": Ha, "aria-invalid": ["true", "false", "grammar", "spelling"], "aria-label": null, "aria-labelledby": null, "aria-level": null, "aria-live": ["off", "polite", "assertive"], - "aria-multiline": D2, - "aria-multiselectable": D2, + "aria-multiline": Ha, + "aria-multiselectable": Ha, "aria-owns": null, "aria-posinset": null, "aria-pressed": ["true", "false", "mixed", "undefined"], - "aria-readonly": D2, + "aria-readonly": Ha, "aria-relevant": null, - "aria-required": D2, + "aria-required": Ha, "aria-selected": ["true", "false", "undefined"], "aria-setsize": null, "aria-sort": ["ascending", "descending", "none", "other"], @@ -24343,195 +24352,195 @@ const $9n = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(nav "aria-valuemin": null, "aria-valuenow": null, "aria-valuetext": null -}, PNt = /* @__PURE__ */ "beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((r) => "on" + r); -for (let r of PNt) - MNt[r] = null; -class jK { - constructor(n, s) { - this.tags = Object.assign(Object.assign({}, F9n), n), this.globalAttrs = Object.assign(Object.assign({}, MNt), s), this.allTags = Object.keys(this.tags), this.globalAttrNames = Object.keys(this.globalAttrs); +}, Yte = /* @__PURE__ */ "beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t) => "on" + t); +for (let t of Yte) + Qte[t] = null; +class Xy { + constructor(e, r) { + this.tags = Object.assign(Object.assign({}, p6e), e), this.globalAttrs = Object.assign(Object.assign({}, Qte), r), this.allTags = Object.keys(this.tags), this.globalAttrNames = Object.keys(this.globalAttrs); } } -jK.default = /* @__PURE__ */ new jK(); -function bF(r, n, s = r.length) { - if (!n) +Xy.default = /* @__PURE__ */ new Xy(); +function Fg(t, e, r = t.length) { + if (!e) return ""; - let a = n.firstChild, l = a && a.getChild("TagName"); - return l ? r.sliceString(l.from, Math.min(l.to, s)) : ""; -} -function vF(r, n = !1) { - for (; r; r = r.parent) - if (r.name == "Element") - if (n) - n = !1; + let n = e.firstChild, i = n && n.getChild("TagName"); + return i ? t.sliceString(i.from, Math.min(i.to, r)) : ""; +} +function zg(t, e = !1) { + for (; t; t = t.parent) + if (t.name == "Element") + if (e) + e = !1; else - return r; + return t; return null; } -function LNt(r, n, s) { - let a = s.tags[bF(r, vF(n))]; - return (a == null ? void 0 : a.children) || s.allTags; +function Wte(t, e, r) { + let n = r.tags[Fg(t, zg(e))]; + return (n == null ? void 0 : n.children) || r.allTags; } -function fqe(r, n) { - let s = []; - for (let a = vF(n); a && !a.type.isTop; a = vF(a.parent)) { - let l = bF(r, a); - if (l && a.lastChild.name == "CloseTag") +function BM(t, e) { + let r = []; + for (let n = zg(e); n && !n.type.isTop; n = zg(n.parent)) { + let i = Fg(t, n); + if (i && n.lastChild.name == "CloseTag") break; - l && s.indexOf(l) < 0 && (n.name == "EndTag" || n.from >= a.firstChild.to) && s.push(l); + i && r.indexOf(i) < 0 && (e.name == "EndTag" || e.from >= n.firstChild.to) && r.push(i); } - return s; + return r; } -const INt = /^[:\-\.\w\u00b7-\uffff]*$/; -function uTt(r, n, s, a, l) { - let h = /\s*>/.test(r.sliceDoc(l, l + 5)) ? "" : ">", f = vF(s, !0); +const Gte = /^[:\-\.\w\u00b7-\uffff]*$/; +function Fz(t, e, r, n, i) { + let s = /\s*>/.test(t.sliceDoc(i, i + 5)) ? "" : ">", a = zg(r, !0); return { - from: a, - to: l, - options: LNt(r.doc, f, n).map((b) => ({ label: b, type: "type" })).concat(fqe(r.doc, s).map((b, w) => ({ - label: "/" + b, - apply: "/" + b + h, + from: n, + to: i, + options: Wte(t.doc, a, e).map((o) => ({ label: o, type: "type" })).concat(BM(t.doc, r).map((o, l) => ({ + label: "/" + o, + apply: "/" + o + s, type: "type", - boost: 99 - w + boost: 99 - l }))), validFor: /^\/?[:\-\.\w\u00b7-\uffff]*$/ }; } -function hTt(r, n, s, a) { - let l = /\s*>/.test(r.sliceDoc(a, a + 5)) ? "" : ">"; +function zz(t, e, r, n) { + let i = /\s*>/.test(t.sliceDoc(n, n + 5)) ? "" : ">"; return { - from: s, - to: a, - options: fqe(r.doc, n).map((h, f) => ({ label: h, apply: h + l, type: "type", boost: 99 - f })), - validFor: INt + from: r, + to: n, + options: BM(t.doc, e).map((s, a) => ({ label: s, apply: s + i, type: "type", boost: 99 - a })), + validFor: Gte }; } -function j9n(r, n, s, a) { - let l = [], h = 0; - for (let f of LNt(r.doc, s, n)) - l.push({ label: "<" + f, type: "type" }); - for (let f of fqe(r.doc, s)) - l.push({ label: "", type: "type", boost: 99 - h++ }); - return { from: a, to: a, options: l, validFor: /^<\/?[:\-\.\w\u00b7-\uffff]*$/ }; +function g6e(t, e, r, n) { + let i = [], s = 0; + for (let a of Wte(t.doc, r, e)) + i.push({ label: "<" + a, type: "type" }); + for (let a of BM(t.doc, r)) + i.push({ label: "", type: "type", boost: 99 - s++ }); + return { from: n, to: n, options: i, validFor: /^<\/?[:\-\.\w\u00b7-\uffff]*$/ }; } -function Q9n(r, n, s, a, l) { - let h = vF(s), f = h ? n.tags[bF(r.doc, h)] : null, b = f && f.attrs ? Object.keys(f.attrs) : [], w = f && f.globalAttrs === !1 ? b : b.length ? b.concat(n.globalAttrNames) : n.globalAttrNames; +function m6e(t, e, r, n, i) { + let s = zg(r), a = s ? e.tags[Fg(t.doc, s)] : null, o = a && a.attrs ? Object.keys(a.attrs) : [], l = a && a.globalAttrs === !1 ? o : o.length ? o.concat(e.globalAttrNames) : e.globalAttrNames; return { - from: a, - to: l, - options: w.map((O) => ({ label: O, type: "property" })), - validFor: INt + from: n, + to: i, + options: l.map((u) => ({ label: u, type: "property" })), + validFor: Gte }; } -function z9n(r, n, s, a, l) { - var h; - let f = (h = s.parent) === null || h === void 0 ? void 0 : h.getChild("AttributeName"), b = [], w; - if (f) { - let O = r.sliceDoc(f.from, f.to), S = n.globalAttrs[O]; - if (!S) { - let E = vF(s), D = E ? n.tags[bF(r.doc, E)] : null; - S = (D == null ? void 0 : D.attrs) && D.attrs[O]; +function v6e(t, e, r, n, i) { + var s; + let a = (s = r.parent) === null || s === void 0 ? void 0 : s.getChild("AttributeName"), o = [], l; + if (a) { + let u = t.sliceDoc(a.from, a.to), h = e.globalAttrs[u]; + if (!h) { + let f = zg(r), d = f ? e.tags[Fg(t.doc, f)] : null; + h = (d == null ? void 0 : d.attrs) && d.attrs[u]; } - if (S) { - let E = r.sliceDoc(a, l).toLowerCase(), D = '"', M = '"'; - /^['"]/.test(E) ? (w = E[0] == '"' ? /^[^"]*$/ : /^[^']*$/, D = "", M = r.sliceDoc(l, l + 1) == E[0] ? "" : E[0], E = E.slice(1), a++) : w = /^[^\s<>='"]*$/; - for (let B of S) - b.push({ label: B, apply: D + B + M, type: "constant" }); + if (h) { + let f = t.sliceDoc(n, i).toLowerCase(), d = '"', p = '"'; + /^['"]/.test(f) ? (l = f[0] == '"' ? /^[^"]*$/ : /^[^']*$/, d = "", p = t.sliceDoc(i, i + 1) == f[0] ? "" : f[0], f = f.slice(1), n++) : l = /^[^\s<>='"]*$/; + for (let g of h) + o.push({ label: g, apply: d + g + p, type: "constant" }); } } - return { from: a, to: l, options: b, validFor: w }; + return { from: n, to: i, options: o, validFor: l }; } -function NNt(r, n) { - let { state: s, pos: a } = n, l = dh(s).resolveInner(a, -1), h = l.resolve(a); - for (let f = a, b; h == l && (b = l.childBefore(f)); ) { - let w = b.lastChild; - if (!w || !w.type.isError || w.from < w.to) +function Hte(t, e) { + let { state: r, pos: n } = e, i = fn(r).resolveInner(n, -1), s = i.resolve(n); + for (let a = n, o; s == i && (o = i.childBefore(a)); ) { + let l = o.lastChild; + if (!l || !l.type.isError || l.from < l.to) break; - h = l = b, f = w.from; + s = i = o, a = l.from; } - return l.name == "TagName" ? l.parent && /CloseTag$/.test(l.parent.name) ? hTt(s, l, l.from, a) : uTt(s, r, l, l.from, a) : l.name == "StartTag" ? uTt(s, r, l, a, a) : l.name == "StartCloseTag" || l.name == "IncompleteCloseTag" ? hTt(s, l, a, a) : n.explicit && (l.name == "OpenTag" || l.name == "SelfClosingTag") || l.name == "AttributeName" ? Q9n(s, r, l, l.name == "AttributeName" ? l.from : a, a) : l.name == "Is" || l.name == "AttributeValue" || l.name == "UnquotedAttributeValue" ? z9n(s, r, l, l.name == "Is" ? a : l.from, a) : n.explicit && (h.name == "Element" || h.name == "Text" || h.name == "Document") ? j9n(s, r, l, a) : null; + return i.name == "TagName" ? i.parent && /CloseTag$/.test(i.parent.name) ? zz(r, i, i.from, n) : Fz(r, t, i, i.from, n) : i.name == "StartTag" ? Fz(r, t, i, n, n) : i.name == "StartCloseTag" || i.name == "IncompleteCloseTag" ? zz(r, i, n, n) : e.explicit && (i.name == "OpenTag" || i.name == "SelfClosingTag") || i.name == "AttributeName" ? m6e(r, t, i, i.name == "AttributeName" ? i.from : n, n) : i.name == "Is" || i.name == "AttributeValue" || i.name == "UnquotedAttributeValue" ? v6e(r, t, i, i.name == "Is" ? n : i.from, n) : e.explicit && (s.name == "Element" || s.name == "Text" || s.name == "Document") ? g6e(r, t, i, n) : null; } -function q9n(r) { - return NNt(jK.default, r); +function y6e(t) { + return Hte(Xy.default, t); } -function V9n(r) { - let { extraTags: n, extraGlobalAttributes: s } = r, a = s || n ? new jK(n, s) : jK.default; - return (l) => NNt(a, l); +function b6e(t) { + let { extraTags: e, extraGlobalAttributes: r } = t, n = r || e ? new Xy(e, r) : Xy.default; + return (i) => Hte(n, i); } -const U9n = /* @__PURE__ */ rx.parser.configure({ top: "SingleExpression" }), RNt = [ +const x6e = /* @__PURE__ */ Lc.parser.configure({ top: "SingleExpression" }), Xte = [ { tag: "script", - attrs: (r) => r.type == "text/typescript" || r.lang == "ts", - parser: CNt.parser + attrs: (t) => t.type == "text/typescript" || t.lang == "ts", + parser: Fte.parser }, { tag: "script", - attrs: (r) => r.type == "text/babel" || r.type == "text/jsx", - parser: ENt.parser + attrs: (t) => t.type == "text/babel" || t.type == "text/jsx", + parser: zte.parser }, { tag: "script", - attrs: (r) => r.type == "text/typescript-jsx", - parser: TNt.parser + attrs: (t) => t.type == "text/typescript-jsx", + parser: Vte.parser }, { tag: "script", - attrs(r) { - return /^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(r.type); + attrs(t) { + return /^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type); }, - parser: U9n + parser: x6e }, { tag: "script", - attrs(r) { - return !r.type || /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(r.type); + attrs(t) { + return !t.type || /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type); }, - parser: rx.parser + parser: Lc.parser }, { tag: "style", - attrs(r) { - return (!r.lang || r.lang == "css") && (!r.type || /^(text\/)?(x-)?(stylesheet|css)$/i.test(r.type)); + attrs(t) { + return (!t.lang || t.lang == "css") && (!t.type || /^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)); }, - parser: Sve.parser + parser: e3.parser } -], $Nt = /* @__PURE__ */ [ +], Zte = /* @__PURE__ */ [ { name: "style", - parser: /* @__PURE__ */ Sve.parser.configure({ top: "Styles" }) + parser: /* @__PURE__ */ e3.parser.configure({ top: "Styles" }) } -].concat(/* @__PURE__ */ PNt.map((r) => ({ name: r, parser: rx.parser }))), BNt = /* @__PURE__ */ oF.define({ +].concat(/* @__PURE__ */ Yte.map((t) => ({ name: t, parser: Lc.parser }))), jte = /* @__PURE__ */ _g.define({ name: "html", - parser: /* @__PURE__ */ A7n.configure({ + parser: /* @__PURE__ */ iEe.configure({ props: [ - /* @__PURE__ */ NJ.add({ - Element(r) { - let n = /^(\s*)(<\/)?/.exec(r.textAfter); - return r.node.to <= r.pos + n[0].length ? r.continue() : r.lineIndent(r.node.from) + (n[2] ? 0 : r.unit); + /* @__PURE__ */ Gb.add({ + Element(t) { + let e = /^(\s*)(<\/)?/.exec(t.textAfter); + return t.node.to <= t.pos + e[0].length ? t.continue() : t.lineIndent(t.node.from) + (e[2] ? 0 : t.unit); }, - "OpenTag CloseTag SelfClosingTag"(r) { - return r.column(r.node.from) + r.unit; + "OpenTag CloseTag SelfClosingTag"(t) { + return t.column(t.node.from) + t.unit; }, - Document(r) { - if (r.pos + /\s*/.exec(r.textAfter)[0].length < r.node.to) - return r.continue(); - let n = null, s; - for (let a = r.node; ; ) { - let l = a.lastChild; - if (!l || l.name != "Element" || l.to != a.to) + Document(t) { + if (t.pos + /\s*/.exec(t.textAfter)[0].length < t.node.to) + return t.continue(); + let e = null, r; + for (let n = t.node; ; ) { + let i = n.lastChild; + if (!i || i.name != "Element" || i.to != n.to) break; - n = a = l; + e = n = i; } - return n && !((s = n.lastChild) && (s.name == "CloseTag" || s.name == "SelfClosingTag")) ? r.lineIndent(n.from) + r.unit : null; + return e && !((r = e.lastChild) && (r.name == "CloseTag" || r.name == "SelfClosingTag")) ? t.lineIndent(e.from) + t.unit : null; } }), - /* @__PURE__ */ ZF.add({ - Element(r) { - let n = r.firstChild, s = r.lastChild; - return !n || n.name != "OpenTag" ? null : { from: n.to, to: s.name == "CloseTag" ? s.from : r.to }; + /* @__PURE__ */ I1.add({ + Element(t) { + let e = t.firstChild, r = t.lastChild; + return !e || e.name != "OpenTag" ? null : { from: e.to, to: r.name == "CloseTag" ? r.from : t.to }; } }), - /* @__PURE__ */ EPt.add({ - "OpenTag CloseTag": (r) => r.getChild("TagName") + /* @__PURE__ */ zK.add({ + "OpenTag CloseTag": (t) => t.getChild("TagName") }) ] }), @@ -24540,766 +24549,766 @@ const U9n = /* @__PURE__ */ rx.parser.configure({ top: "SingleExpression" }), RN indentOnInput: /^\s*<\/\w+\W$/, wordChars: "-._" } -}), abe = /* @__PURE__ */ BNt.configure({ - wrap: /* @__PURE__ */ mNt(RNt, $Nt) +}), y4 = /* @__PURE__ */ jte.configure({ + wrap: /* @__PURE__ */ Ate(Xte, Zte) }); -function W9n(r = {}) { - let n = "", s; - r.matchClosingTags === !1 && (n = "noMatch"), r.selfClosingTags === !0 && (n = (n ? n + " " : "") + "selfClosing"), (r.nestedLanguages && r.nestedLanguages.length || r.nestedAttributes && r.nestedAttributes.length) && (s = mNt((r.nestedLanguages || []).concat(RNt), (r.nestedAttributes || []).concat($Nt))); - let a = s ? BNt.configure({ wrap: s, dialect: n }) : n ? abe.configure({ dialect: n }) : abe; - return new kK(a, [ - abe.data.of({ autocomplete: V9n(r) }), - r.autoCloseTags !== !1 ? Y9n : [], - N9n().support, - i9n().support +function w6e(t = {}) { + let e = "", r; + t.matchClosingTags === !1 && (e = "noMatch"), t.selfClosingTags === !0 && (e = (e ? e + " " : "") + "selfClosing"), (t.nestedLanguages && t.nestedLanguages.length || t.nestedAttributes && t.nestedAttributes.length) && (r = Ate((t.nestedLanguages || []).concat(Xte), (t.nestedAttributes || []).concat(Zte))); + let n = r ? jte.configure({ wrap: r, dialect: e }) : e ? y4.configure({ dialect: e }) : y4; + return new Ry(n, [ + y4.data.of({ autocomplete: b6e(t) }), + t.autoCloseTags !== !1 ? O6e : [], + u6e().support, + DEe().support ]); } -const fTt = /* @__PURE__ */ new Set(/* @__PURE__ */ "area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")), Y9n = /* @__PURE__ */ Ci.inputHandler.of((r, n, s, a, l) => { - if (r.composing || r.state.readOnly || n != s || a != ">" && a != "/" || !abe.isActiveAt(r.state, n, -1)) +const Vz = /* @__PURE__ */ new Set(/* @__PURE__ */ "area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")), O6e = /* @__PURE__ */ dt.inputHandler.of((t, e, r, n, i) => { + if (t.composing || t.state.readOnly || e != r || n != ">" && n != "/" || !y4.isActiveAt(t.state, e, -1)) return !1; - let h = l(), { state: f } = h, b = f.changeByRange((w) => { - var O, S, E; - let D = f.doc.sliceString(w.from - 1, w.to) == a, { head: M } = w, B = dh(f).resolveInner(M - 1, -1), z; - if ((B.name == "TagName" || B.name == "StartTag") && (B = B.parent), D && a == ">" && B.name == "OpenTag") { - if (((S = (O = B.parent) === null || O === void 0 ? void 0 : O.lastChild) === null || S === void 0 ? void 0 : S.name) != "CloseTag" && (z = bF(f.doc, B.parent, M)) && !fTt.has(z)) { - let W = M + (f.doc.sliceString(M, M + 1) === ">" ? 1 : 0), H = ``; - return { range: w, changes: { from: M, to: W, insert: H } }; - } - } else if (D && a == "/" && B.name == "IncompleteCloseTag") { - let W = B.parent; - if (B.from == M - 2 && ((E = W.lastChild) === null || E === void 0 ? void 0 : E.name) != "CloseTag" && (z = bF(f.doc, W, M)) && !fTt.has(z)) { - let H = M + (f.doc.sliceString(M, M + 1) === ">" ? 1 : 0), G = `${z}>`; + let s = i(), { state: a } = s, o = a.changeByRange((l) => { + var u, h, f; + let d = a.doc.sliceString(l.from - 1, l.to) == n, { head: p } = l, g = fn(a).resolveInner(p - 1, -1), m; + if ((g.name == "TagName" || g.name == "StartTag") && (g = g.parent), d && n == ">" && g.name == "OpenTag") { + if (((h = (u = g.parent) === null || u === void 0 ? void 0 : u.lastChild) === null || h === void 0 ? void 0 : h.name) != "CloseTag" && (m = Fg(a.doc, g.parent, p)) && !Vz.has(m)) { + let v = p + (a.doc.sliceString(p, p + 1) === ">" ? 1 : 0), y = ``; + return { range: l, changes: { from: p, to: v, insert: y } }; + } + } else if (d && n == "/" && g.name == "IncompleteCloseTag") { + let v = g.parent; + if (g.from == p - 2 && ((f = v.lastChild) === null || f === void 0 ? void 0 : f.name) != "CloseTag" && (m = Fg(a.doc, v, p)) && !Vz.has(m)) { + let y = p + (a.doc.sliceString(p, p + 1) === ">" ? 1 : 0), b = `${m}>`; return { - range: sr.cursor(M + G.length, -1), - changes: { from: M, to: H, insert: G } + range: Ve.cursor(p + b.length, -1), + changes: { from: p, to: y, insert: b } }; } } - return { range: w }; + return { range: l }; }); - return b.changes.empty ? !1 : (r.dispatch([ - h, - f.update(b, { + return o.changes.empty ? !1 : (t.dispatch([ + s, + a.update(o, { userEvent: "input.complete", scrollIntoView: !0 }) ]), !0); -}), FNt = /* @__PURE__ */ wze({ commentTokens: { block: { open: "" } } }), jNt = /* @__PURE__ */ new Ia(), QNt = /* @__PURE__ */ S8n.configure({ +}), Kte = /* @__PURE__ */ YR({ commentTokens: { block: { open: "" } } }), Jte = /* @__PURE__ */ new lr(), ere = /* @__PURE__ */ JTe.configure({ props: [ - /* @__PURE__ */ ZF.add((r) => !r.is("Block") || r.is("Document") || ije(r) != null ? void 0 : (n, s) => ({ from: s.doc.lineAt(n.from).to, to: n.to })), - /* @__PURE__ */ jNt.add(ije), - /* @__PURE__ */ NJ.add({ + /* @__PURE__ */ I1.add((t) => !t.is("Block") || t.is("Document") || G7(t) != null ? void 0 : (e, r) => ({ from: r.doc.lineAt(e.from).to, to: e.to })), + /* @__PURE__ */ Jte.add(G7), + /* @__PURE__ */ Gb.add({ Document: () => null }), - /* @__PURE__ */ zM.add({ - Document: FNt + /* @__PURE__ */ Ed.add({ + Document: Kte }) ] }); -function ije(r) { - let n = /^(?:ATX|Setext)Heading(\d)$/.exec(r.name); - return n ? +n[1] : void 0; +function G7(t) { + let e = /^(?:ATX|Setext)Heading(\d)$/.exec(t.name); + return e ? +e[1] : void 0; } -function H9n(r, n) { - let s = r; +function k6e(t, e) { + let r = t; for (; ; ) { - let a = s.nextSibling, l; - if (!a || (l = ije(a.type)) != null && l <= n) + let n = r.nextSibling, i; + if (!n || (i = G7(n.type)) != null && i <= e) break; - s = a; + r = n; } - return s.to; + return r.to; } -const G9n = /* @__PURE__ */ dPt.of((r, n, s) => { - for (let a = dh(r).resolveInner(s, -1); a && !(a.from < n); a = a.parent) { - let l = a.type.prop(jNt); - if (l == null) +const S6e = /* @__PURE__ */ CK.of((t, e, r) => { + for (let n = fn(t).resolveInner(r, -1); n && !(n.from < e); n = n.parent) { + let i = n.type.prop(Jte); + if (i == null) continue; - let h = H9n(a, l); - if (h > s) - return { from: s, to: h }; + let s = k6e(n, i); + if (s > r) + return { from: r, to: s }; } return null; }); -function dqe(r) { - return new qy(FNt, r, [G9n], "markdown"); +function FM(t) { + return new Mo(Kte, t, [S6e], "markdown"); } -const Z9n = /* @__PURE__ */ dqe(QNt), X9n = /* @__PURE__ */ QNt.configure([N8n, $8n, R8n, B8n, { +const T6e = /* @__PURE__ */ FM(ere), C6e = /* @__PURE__ */ ere.configure([uCe, fCe, hCe, dCe, { props: [ - /* @__PURE__ */ ZF.add({ - Table: (r, n) => ({ from: n.doc.lineAt(r.from).to, to: r.to }) + /* @__PURE__ */ I1.add({ + Table: (t, e) => ({ from: e.doc.lineAt(t.from).to, to: t.to }) }) ] -}]), zNt = /* @__PURE__ */ dqe(X9n); -function K9n(r, n) { - return (s) => { - if (s && r) { - let a = null; - if (s = /\S*/.exec(s)[0], typeof r == "function" ? a = r(s) : a = Gbe.matchLanguageName(r, s, !0), a instanceof Gbe) - return a.support ? a.support.language.parser : OK.getSkippingParser(a.load()); - if (a) - return a.parser; +}]), tre = /* @__PURE__ */ FM(C6e); +function E6e(t, e) { + return (r) => { + if (r && t) { + let n = null; + if (r = /\S*/.exec(r)[0], typeof t == "function" ? n = t(r) : n = T5.matchLanguageName(t, r, !0), n instanceof T5) + return n.support ? n.support.language.parser : Ly.getSkippingParser(n.load()); + if (n) + return n.parser; } - return n ? n.parser : null; + return e ? e.parser : null; }; } -class cme { - constructor(n, s, a, l, h, f, b) { - this.node = n, this.from = s, this.to = a, this.spaceBefore = l, this.spaceAfter = h, this.type = f, this.item = b; +class Pw { + constructor(e, r, n, i, s, a, o) { + this.node = e, this.from = r, this.to = n, this.spaceBefore = i, this.spaceAfter = s, this.type = a, this.item = o; } - blank(n, s = !0) { - let a = this.spaceBefore + (this.node.name == "Blockquote" ? ">" : ""); - if (n != null) { - for (; a.length < n; ) - a += " "; - return a; + blank(e, r = !0) { + let n = this.spaceBefore + (this.node.name == "Blockquote" ? ">" : ""); + if (e != null) { + for (; n.length < e; ) + n += " "; + return n; } else { - for (let l = this.to - this.from - a.length - this.spaceAfter.length; l > 0; l--) - a += " "; - return a + (s ? this.spaceAfter : ""); + for (let i = this.to - this.from - n.length - this.spaceAfter.length; i > 0; i--) + n += " "; + return n + (r ? this.spaceAfter : ""); } } - marker(n, s) { - let a = this.node.name == "OrderedList" ? String(+VNt(this.item, n)[2] + s) : ""; - return this.spaceBefore + a + this.type + this.spaceAfter; + marker(e, r) { + let n = this.node.name == "OrderedList" ? String(+nre(this.item, e)[2] + r) : ""; + return this.spaceBefore + n + this.type + this.spaceAfter; } } -function qNt(r, n) { - let s = []; - for (let l = r; l && l.name != "Document"; l = l.parent) - (l.name == "ListItem" || l.name == "Blockquote" || l.name == "FencedCode") && s.push(l); - let a = []; - for (let l = s.length - 1; l >= 0; l--) { - let h = s[l], f, b = n.lineAt(h.from), w = h.from - b.from; - if (h.name == "FencedCode") - a.push(new cme(h, w, w, "", "", "", null)); - else if (h.name == "Blockquote" && (f = /^ *>( ?)/.exec(b.text.slice(w)))) - a.push(new cme(h, w, w + f[0].length, "", f[1], ">", null)); - else if (h.name == "ListItem" && h.parent.name == "OrderedList" && (f = /^( *)\d+([.)])( *)/.exec(b.text.slice(w)))) { - let O = f[3], S = f[0].length; - O.length >= 4 && (O = O.slice(0, O.length - 4), S -= 4), a.push(new cme(h.parent, w, w + S, f[1], O, f[2], h)); - } else if (h.name == "ListItem" && h.parent.name == "BulletList" && (f = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(b.text.slice(w)))) { - let O = f[4], S = f[0].length; - O.length > 4 && (O = O.slice(0, O.length - 4), S -= 4); - let E = f[2]; - f[3] && (E += f[3].replace(/[xX]/, " ")), a.push(new cme(h.parent, w, w + S, f[1], O, E, h)); +function rre(t, e) { + let r = []; + for (let i = t; i && i.name != "Document"; i = i.parent) + (i.name == "ListItem" || i.name == "Blockquote" || i.name == "FencedCode") && r.push(i); + let n = []; + for (let i = r.length - 1; i >= 0; i--) { + let s = r[i], a, o = e.lineAt(s.from), l = s.from - o.from; + if (s.name == "FencedCode") + n.push(new Pw(s, l, l, "", "", "", null)); + else if (s.name == "Blockquote" && (a = /^ *>( ?)/.exec(o.text.slice(l)))) + n.push(new Pw(s, l, l + a[0].length, "", a[1], ">", null)); + else if (s.name == "ListItem" && s.parent.name == "OrderedList" && (a = /^( *)\d+([.)])( *)/.exec(o.text.slice(l)))) { + let u = a[3], h = a[0].length; + u.length >= 4 && (u = u.slice(0, u.length - 4), h -= 4), n.push(new Pw(s.parent, l, l + h, a[1], u, a[2], s)); + } else if (s.name == "ListItem" && s.parent.name == "BulletList" && (a = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(l)))) { + let u = a[4], h = a[0].length; + u.length > 4 && (u = u.slice(0, u.length - 4), h -= 4); + let f = a[2]; + a[3] && (f += a[3].replace(/[xX]/, " ")), n.push(new Pw(s.parent, l, l + h, a[1], u, f, s)); } } - return a; + return n; } -function VNt(r, n) { - return /^(\s*)(\d+)(?=[.)])/.exec(n.sliceString(r.from, r.from + 10)); +function nre(t, e) { + return /^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from, t.from + 10)); } -function i$e(r, n, s, a = 0) { - for (let l = -1, h = r; ; ) { - if (h.name == "ListItem") { - let b = VNt(h, n), w = +b[2]; - if (l >= 0) { - if (w != l + 1) +function JE(t, e, r, n = 0) { + for (let i = -1, s = t; ; ) { + if (s.name == "ListItem") { + let o = nre(s, e), l = +o[2]; + if (i >= 0) { + if (l != i + 1) return; - s.push({ from: h.from + b[1].length, to: h.from + b[0].length, insert: String(l + 2 + a) }); + r.push({ from: s.from + o[1].length, to: s.from + o[0].length, insert: String(i + 2 + n) }); } - l = w; + i = l; } - let f = h.nextSibling; - if (!f) + let a = s.nextSibling; + if (!a) break; - h = f; + s = a; } } -function sje(r, n) { - let s = /^[ \t]*/.exec(r)[0].length; - if (!s || n.facet(IJ) != " ") - return r; - let a = gk(r, 4, s), l = ""; - for (let h = a; h > 0; ) - h >= 4 ? (l += " ", h -= 4) : (l += " ", h--); - return l + r.slice(s); -} -const J9n = ({ state: r, dispatch: n }) => { - let s = dh(r), { doc: a } = r, l = null, h = r.changeByRange((f) => { - if (!f.empty || !zNt.isActiveAt(r, f.from)) - return l = { range: f }; - let b = f.from, w = a.lineAt(b), O = qNt(s.resolveInner(b, -1), a); - for (; O.length && O[O.length - 1].from > b - w.from; ) - O.pop(); - if (!O.length) - return l = { range: f }; - let S = O[O.length - 1]; - if (S.to - S.spaceAfter.length > b - w.from) - return l = { range: f }; - let E = b >= S.to - S.spaceAfter.length && !/\S/.test(w.text.slice(S.to)); - if (S.item && E) - if (S.node.firstChild.to >= b || w.from > 0 && !/[^\s>]/.test(a.lineAt(w.from - 1).text)) { - let W = O.length > 1 ? O[O.length - 2] : null, H, G = ""; - W && W.item ? (H = w.from + W.from, G = W.marker(a, 1)) : H = w.from + (W ? W.to : 0); - let ee = [{ from: H, to: b, insert: G }]; - return S.node.name == "OrderedList" && i$e(S.item, a, ee, -2), W && W.node.name == "OrderedList" && i$e(W.item, a, ee), { range: sr.cursor(H + G.length), changes: ee }; +function H7(t, e) { + let r = /^[ \t]*/.exec(t)[0].length; + if (!r || e.facet(Wb) != " ") + return t; + let n = Ml(t, 4, r), i = ""; + for (let s = n; s > 0; ) + s >= 4 ? (i += " ", s -= 4) : (i += " ", s--); + return i + t.slice(r); +} +const _6e = ({ state: t, dispatch: e }) => { + let r = fn(t), { doc: n } = t, i = null, s = t.changeByRange((a) => { + if (!a.empty || !tre.isActiveAt(t, a.from)) + return i = { range: a }; + let o = a.from, l = n.lineAt(o), u = rre(r.resolveInner(o, -1), n); + for (; u.length && u[u.length - 1].from > o - l.from; ) + u.pop(); + if (!u.length) + return i = { range: a }; + let h = u[u.length - 1]; + if (h.to - h.spaceAfter.length > o - l.from) + return i = { range: a }; + let f = o >= h.to - h.spaceAfter.length && !/\S/.test(l.text.slice(h.to)); + if (h.item && f) + if (h.node.firstChild.to >= o || l.from > 0 && !/[^\s>]/.test(n.lineAt(l.from - 1).text)) { + let v = u.length > 1 ? u[u.length - 2] : null, y, b = ""; + v && v.item ? (y = l.from + v.from, b = v.marker(n, 1)) : y = l.from + (v ? v.to : 0); + let w = [{ from: y, to: o, insert: b }]; + return h.node.name == "OrderedList" && JE(h.item, n, w, -2), v && v.node.name == "OrderedList" && JE(v.item, n, w), { range: Ve.cursor(y + b.length), changes: w }; } else { - let W = ""; - for (let H = 0, G = O.length - 2; H <= G; H++) - W += O[H].blank(H < G ? gk(w.text, 4, O[H + 1].from) - W.length : null, H < G); - return W = sje(W, r), { - range: sr.cursor(b + W.length + 1), - changes: { from: w.from, insert: W + r.lineBreak } + let v = ""; + for (let y = 0, b = u.length - 2; y <= b; y++) + v += u[y].blank(y < b ? Ml(l.text, 4, u[y + 1].from) - v.length : null, y < b); + return v = H7(v, t), { + range: Ve.cursor(o + v.length + 1), + changes: { from: l.from, insert: v + t.lineBreak } }; } - if (S.node.name == "Blockquote" && E && w.from) { - let W = a.lineAt(w.from - 1), H = />\s*$/.exec(W.text); - if (H && H.index == S.from) { - let G = r.changes([ - { from: W.from + H.index, to: W.to }, - { from: w.from + S.from, to: w.to } + if (h.node.name == "Blockquote" && f && l.from) { + let v = n.lineAt(l.from - 1), y = />\s*$/.exec(v.text); + if (y && y.index == h.from) { + let b = t.changes([ + { from: v.from + y.index, to: v.to }, + { from: l.from + h.from, to: l.to } ]); - return { range: f.map(G), changes: G }; - } - } - let D = []; - S.node.name == "OrderedList" && i$e(S.item, a, D); - let M = S.item && S.item.from < w.from, B = ""; - if (!M || /^[\s\d.)\-+*>]*/.exec(w.text)[0].length >= S.to) - for (let W = 0, H = O.length - 1; W <= H; W++) - B += W == H && !M ? O[W].marker(a, 1) : O[W].blank(W < H ? gk(w.text, 4, O[W + 1].from) - B.length : null); - let z = b; - for (; z > w.from && /\s/.test(w.text.charAt(z - w.from - 1)); ) - z--; - return B = sje(B, r), D.push({ from: z, to: b, insert: r.lineBreak + B }), { range: sr.cursor(z + B.length + 1), changes: D }; + return { range: a.map(b), changes: b }; + } + } + let d = []; + h.node.name == "OrderedList" && JE(h.item, n, d); + let p = h.item && h.item.from < l.from, g = ""; + if (!p || /^[\s\d.)\-+*>]*/.exec(l.text)[0].length >= h.to) + for (let v = 0, y = u.length - 1; v <= y; v++) + g += v == y && !p ? u[v].marker(n, 1) : u[v].blank(v < y ? Ml(l.text, 4, u[v + 1].from) - g.length : null); + let m = o; + for (; m > l.from && /\s/.test(l.text.charAt(m - l.from - 1)); ) + m--; + return g = H7(g, t), d.push({ from: m, to: o, insert: t.lineBreak + g }), { range: Ve.cursor(m + g.length + 1), changes: d }; }); - return l ? !1 : (n(r.update(h, { scrollIntoView: !0, userEvent: "input" })), !0); -}; -function dTt(r) { - return r.name == "QuoteMark" || r.name == "ListMark"; -} -function eAn(r, n) { - let s = r.resolveInner(n, -1), a = n; - dTt(s) && (a = s.from, s = s.parent); - for (let l; l = s.childBefore(a); ) - if (dTt(l)) - a = l.from; - else if (l.name == "OrderedList" || l.name == "BulletList") - s = l.lastChild, a = s.to; + return i ? !1 : (e(t.update(s, { scrollIntoView: !0, userEvent: "input" })), !0); +}; +function Uz(t) { + return t.name == "QuoteMark" || t.name == "ListMark"; +} +function A6e(t, e) { + let r = t.resolveInner(e, -1), n = e; + Uz(r) && (n = r.from, r = r.parent); + for (let i; i = r.childBefore(n); ) + if (Uz(i)) + n = i.from; + else if (i.name == "OrderedList" || i.name == "BulletList") + r = i.lastChild, n = r.to; else break; - return s; + return r; } -const tAn = ({ state: r, dispatch: n }) => { - let s = dh(r), a = null, l = r.changeByRange((h) => { - let f = h.from, { doc: b } = r; - if (h.empty && zNt.isActiveAt(r, h.from)) { - let w = b.lineAt(f), O = qNt(eAn(s, f), b); - if (O.length) { - let S = O[O.length - 1], E = S.to - S.spaceAfter.length + (S.spaceAfter ? 1 : 0); - if (f - w.from > E && !/\S/.test(w.text.slice(E, f - w.from))) +const L6e = ({ state: t, dispatch: e }) => { + let r = fn(t), n = null, i = t.changeByRange((s) => { + let a = s.from, { doc: o } = t; + if (s.empty && tre.isActiveAt(t, s.from)) { + let l = o.lineAt(a), u = rre(A6e(r, a), o); + if (u.length) { + let h = u[u.length - 1], f = h.to - h.spaceAfter.length + (h.spaceAfter ? 1 : 0); + if (a - l.from > f && !/\S/.test(l.text.slice(f, a - l.from))) return { - range: sr.cursor(w.from + E), - changes: { from: w.from + E, to: f } + range: Ve.cursor(l.from + f), + changes: { from: l.from + f, to: a } }; - if (f - w.from == E && (!S.item || w.from <= S.item.from || !/\S/.test(w.text.slice(0, S.to)))) { - let D = w.from + S.from; - if (S.item && S.node.from < S.item.from && /\S/.test(w.text.slice(S.from, S.to))) { - let M = S.blank(gk(w.text, 4, S.to) - gk(w.text, 4, S.from)); - return D == w.from && (M = sje(M, r)), { - range: sr.cursor(D + M.length), - changes: { from: D, to: w.from + S.to, insert: M } + if (a - l.from == f && (!h.item || l.from <= h.item.from || !/\S/.test(l.text.slice(0, h.to)))) { + let d = l.from + h.from; + if (h.item && h.node.from < h.item.from && /\S/.test(l.text.slice(h.from, h.to))) { + let p = h.blank(Ml(l.text, 4, h.to) - Ml(l.text, 4, h.from)); + return d == l.from && (p = H7(p, t)), { + range: Ve.cursor(d + p.length), + changes: { from: d, to: l.from + h.to, insert: p } }; } - if (D < f) - return { range: sr.cursor(D), changes: { from: D, to: f } }; + if (d < a) + return { range: Ve.cursor(d), changes: { from: d, to: a } }; } } } - return a = { range: h }; + return n = { range: s }; }); - return a ? !1 : (n(r.update(l, { scrollIntoView: !0, userEvent: "delete" })), !0); -}, nAn = [ - { key: "Enter", run: J9n }, - { key: "Backspace", run: tAn } -], oje = /* @__PURE__ */ W9n({ matchClosingTags: !1 }); -function rAn(r = {}) { - let { codeLanguages: n, defaultCodeLanguage: s, addKeymap: a = !0, base: { parser: l } = Z9n, completeHTMLTags: h = !0 } = r; - if (!(l instanceof bwe)) + return n ? !1 : (e(t.update(i, { scrollIntoView: !0, userEvent: "delete" })), !0); +}, R6e = [ + { key: "Enter", run: _6e }, + { key: "Backspace", run: L6e } +], X7 = /* @__PURE__ */ w6e({ matchClosingTags: !1 }); +function M6e(t = {}) { + let { codeLanguages: e, defaultCodeLanguage: r, addKeymap: n = !0, base: { parser: i } = T6e, completeHTMLTags: s = !0 } = t; + if (!(i instanceof rT)) throw new RangeError("Base parser provided to `markdown` should be a Markdown parser"); - let f = r.extensions ? [r.extensions] : [], b = [oje.support], w; - s instanceof kK ? (b.push(s.support), w = s.language) : s && (w = s); - let O = n || w ? K9n(n, w) : void 0; - f.push(C8n({ codeParser: O, htmlParser: oje.language.parser })), a && b.push(Sk.high(X6.of(nAn))); - let S = dqe(l.configure(f)); - return h && b.push(S.data.of({ autocomplete: iAn })), new kK(S, b); -} -function iAn(r) { - let { state: n, pos: s } = r, a = /<[:\-\.\w\u00b7-\uffff]*$/.exec(n.sliceDoc(s - 25, s)); - if (!a) + let a = t.extensions ? [t.extensions] : [], o = [X7.support], l; + r instanceof Ry ? (o.push(r.support), l = r.language) : r && (l = r); + let u = e || l ? E6e(e, l) : void 0; + a.push(tCe({ codeParser: u, htmlParser: X7.language.parser })), n && o.push(zl.high(Tu.of(R6e))); + let h = FM(i.configure(a)); + return s && o.push(h.data.of({ autocomplete: D6e })), new Ry(h, o); +} +function D6e(t) { + let { state: e, pos: r } = t, n = /<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(r - 25, r)); + if (!n) return null; - let l = dh(n).resolveInner(s, -1); - for (; l && !l.type.isTop; ) { - if (l.name == "CodeBlock" || l.name == "FencedCode" || l.name == "ProcessingInstructionBlock" || l.name == "CommentBlock" || l.name == "Link" || l.name == "Image") + let i = fn(e).resolveInner(r, -1); + for (; i && !i.type.isTop; ) { + if (i.name == "CodeBlock" || i.name == "FencedCode" || i.name == "ProcessingInstructionBlock" || i.name == "CommentBlock" || i.name == "Link" || i.name == "Image") return null; - l = l.parent; + i = i.parent; } return { - from: s - a[0].length, - to: s, - options: sAn(), + from: r - n[0].length, + to: r, + options: N6e(), validFor: /^<[:\-\.\w\u00b7-\uffff]*$/ }; } -let s$e = null; -function sAn() { - if (s$e) - return s$e; - let r = q9n(new Pze(Ga.create({ extensions: oje }), 0, !0)); - return s$e = r ? r.options : []; +let e6 = null; +function N6e() { + if (e6) + return e6; + let t = y6e(new iM(dr.create({ extensions: X7 }), 0, !0)); + return e6 = t ? t.options : []; } -function _X(r) { - throw new Error('Could not dynamically require "' + r + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); +function I6e(t) { + throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } -var UNt = { exports: {} }; -const oAn = {}, aAn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +var ire = { exports: {} }; +const P6e = {}, $6e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - default: oAn -}, Symbol.toStringTag, { value: "Module" })), cAn = /* @__PURE__ */ aDt(aAn); -(function(r) { - var n; + default: P6e +}, Symbol.toStringTag, { value: "Module" })), B6e = /* @__PURE__ */ xZ($6e); +(function(t) { + var e; (function() { - n = function(s, a, l, h) { - h = h || {}, this.dictionary = null, this.rules = {}, this.dictionaryTable = {}, this.compoundRules = [], this.compoundRuleCodes = {}, this.replacementTable = [], this.flags = h.flags || {}, this.memoized = {}, this.loaded = !1; - var f = this, b, w, O, S, E; - s && (f.dictionary = s, a && l ? z() : typeof window < "u" && "chrome" in window && "extension" in window.chrome && "getURL" in window.chrome.extension ? (h.dictionaryPath ? b = h.dictionaryPath : b = "typo/dictionaries", a || D(chrome.extension.getURL(b + "/" + s + "/" + s + ".aff"), M), l || D(chrome.extension.getURL(b + "/" + s + "/" + s + ".dic"), B)) : (h.dictionaryPath ? b = h.dictionaryPath : typeof __dirname < "u" ? b = __dirname + "/dictionaries" : b = "./dictionaries", a || D(b + "/" + s + "/" + s + ".aff", M), l || D(b + "/" + s + "/" + s + ".dic", B))); - function D(W, H) { - var G = f._readFile(W, null, h.asyncLoad); - h.asyncLoad ? G.then(function(ee) { - H(ee); - }) : H(G); - } - function M(W) { - a = W, l && z(); - } - function B(W) { - l = W, a && z(); - } - function z() { - for (f.rules = f._parseAFF(a), f.compoundRuleCodes = {}, w = 0, S = f.compoundRules.length; w < S; w++) { - var W = f.compoundRules[w]; - for (O = 0, E = W.length; O < E; O++) - f.compoundRuleCodes[W[O]] = []; - } - "ONLYINCOMPOUND" in f.flags && (f.compoundRuleCodes[f.flags.ONLYINCOMPOUND] = []), f.dictionaryTable = f._parseDIC(l); - for (w in f.compoundRuleCodes) - f.compoundRuleCodes[w].length === 0 && delete f.compoundRuleCodes[w]; - for (w = 0, S = f.compoundRules.length; w < S; w++) { - var H = f.compoundRules[w], G = ""; - for (O = 0, E = H.length; O < E; O++) { - var ee = H[O]; - ee in f.compoundRuleCodes ? G += "(" + f.compoundRuleCodes[ee].join("|") + ")" : G += ee; - } - f.compoundRules[w] = new RegExp(G, "i"); - } - f.loaded = !0, h.asyncLoad && h.loadedCallback && h.loadedCallback(f); + e = function(r, n, i, s) { + s = s || {}, this.dictionary = null, this.rules = {}, this.dictionaryTable = {}, this.compoundRules = [], this.compoundRuleCodes = {}, this.replacementTable = [], this.flags = s.flags || {}, this.memoized = {}, this.loaded = !1; + var a = this, o, l, u, h, f; + r && (a.dictionary = r, n && i ? m() : typeof window < "u" && "chrome" in window && "extension" in window.chrome && "getURL" in window.chrome.extension ? (s.dictionaryPath ? o = s.dictionaryPath : o = "typo/dictionaries", n || d(chrome.extension.getURL(o + "/" + r + "/" + r + ".aff"), p), i || d(chrome.extension.getURL(o + "/" + r + "/" + r + ".dic"), g)) : (s.dictionaryPath ? o = s.dictionaryPath : typeof __dirname < "u" ? o = __dirname + "/dictionaries" : o = "./dictionaries", n || d(o + "/" + r + "/" + r + ".aff", p), i || d(o + "/" + r + "/" + r + ".dic", g))); + function d(v, y) { + var b = a._readFile(v, null, s.asyncLoad); + s.asyncLoad ? b.then(function(w) { + y(w); + }) : y(b); + } + function p(v) { + n = v, i && m(); + } + function g(v) { + i = v, n && m(); + } + function m() { + for (a.rules = a._parseAFF(n), a.compoundRuleCodes = {}, l = 0, h = a.compoundRules.length; l < h; l++) { + var v = a.compoundRules[l]; + for (u = 0, f = v.length; u < f; u++) + a.compoundRuleCodes[v[u]] = []; + } + "ONLYINCOMPOUND" in a.flags && (a.compoundRuleCodes[a.flags.ONLYINCOMPOUND] = []), a.dictionaryTable = a._parseDIC(i); + for (l in a.compoundRuleCodes) + a.compoundRuleCodes[l].length === 0 && delete a.compoundRuleCodes[l]; + for (l = 0, h = a.compoundRules.length; l < h; l++) { + var y = a.compoundRules[l], b = ""; + for (u = 0, f = y.length; u < f; u++) { + var w = y[u]; + w in a.compoundRuleCodes ? b += "(" + a.compoundRuleCodes[w].join("|") + ")" : b += w; + } + a.compoundRules[l] = new RegExp(b, "i"); + } + a.loaded = !0, s.asyncLoad && s.loadedCallback && s.loadedCallback(a); } return this; - }, n.prototype = { - load: function(s) { - for (var a in s) - s.hasOwnProperty(a) && (this[a] = s[a]); + }, e.prototype = { + load: function(r) { + for (var n in r) + r.hasOwnProperty(n) && (this[n] = r[n]); return this; }, - _readFile: function(s, a, l) { - if (a = a || "utf8", typeof XMLHttpRequest < "u") { - var h, f = new XMLHttpRequest(); - return f.open("GET", s, l), l && (h = new Promise(function(w, O) { - f.onload = function() { - f.status === 200 ? w(f.responseText) : O(f.statusText); - }, f.onerror = function() { - O(f.statusText); + _readFile: function(r, n, i) { + if (n = n || "utf8", typeof XMLHttpRequest < "u") { + var s, a = new XMLHttpRequest(); + return a.open("GET", r, i), i && (s = new Promise(function(l, u) { + a.onload = function() { + a.status === 200 ? l(a.responseText) : u(a.statusText); + }, a.onerror = function() { + u(a.statusText); }; - })), f.overrideMimeType && f.overrideMimeType("text/plain; charset=" + a), f.send(null), l ? h : f.responseText; - } else if (typeof _X < "u") { - var b = cAn; + })), a.overrideMimeType && a.overrideMimeType("text/plain; charset=" + n), a.send(null), i ? s : a.responseText; + } else if (typeof I6e < "u") { + var o = B6e; try { - if (b.existsSync(s)) - return b.readFileSync(s, a); - console.log("Path " + s + " does not exist."); - } catch (w) { - return console.log(w), ""; - } - } - }, - _parseAFF: function(s) { - var a = {}, l, h, f, b, w, O, S, E, D = s.split(/\r?\n/); - for (w = 0, S = D.length; w < S; w++) - if (l = this._removeAffixComments(D[w]), l = l.trim(), !!l) { - var M = l.split(/\s+/), B = M[0]; - if (B == "PFX" || B == "SFX") { - var z = M[1], W = M[2]; - f = parseInt(M[3], 10); - var H = []; - for (O = w + 1, E = w + 1 + f; O < E; O++) { - h = D[O], b = h.split(/\s+/); - var G = b[2], ee = b[3].split("/"), le = ee[0]; - le === "0" && (le = ""); - var se = this.parseRuleCodes(ee[1]), he = b[4], te = {}; - te.add = le, se.length > 0 && (te.continuationClasses = se), he !== "." && (B === "SFX" ? te.match = new RegExp(he + "$") : te.match = new RegExp("^" + he)), G != "0" && (B === "SFX" ? te.remove = new RegExp(G + "$") : te.remove = G), H.push(te); + if (o.existsSync(r)) + return o.readFileSync(r, n); + console.log("Path " + r + " does not exist."); + } catch (l) { + return console.log(l), ""; + } + } + }, + _parseAFF: function(r) { + var n = {}, i, s, a, o, l, u, h, f, d = r.split(/\r?\n/); + for (l = 0, h = d.length; l < h; l++) + if (i = this._removeAffixComments(d[l]), i = i.trim(), !!i) { + var p = i.split(/\s+/), g = p[0]; + if (g == "PFX" || g == "SFX") { + var m = p[1], v = p[2]; + a = parseInt(p[3], 10); + var y = []; + for (u = l + 1, f = l + 1 + a; u < f; u++) { + s = d[u], o = s.split(/\s+/); + var b = o[2], w = o[3].split("/"), O = w[0]; + O === "0" && (O = ""); + var S = this.parseRuleCodes(w[1]), C = o[4], T = {}; + T.add = O, S.length > 0 && (T.continuationClasses = S), C !== "." && (g === "SFX" ? T.match = new RegExp(C + "$") : T.match = new RegExp("^" + C)), b != "0" && (g === "SFX" ? T.remove = new RegExp(b + "$") : T.remove = b), y.push(T); } - a[z] = { type: B, combineable: W == "Y", entries: H }, w += f; - } else if (B === "COMPOUNDRULE") { - for (f = parseInt(M[1], 10), O = w + 1, E = w + 1 + f; O < E; O++) - l = D[O], b = l.split(/\s+/), this.compoundRules.push(b[1]); - w += f; + n[m] = { type: g, combineable: v == "Y", entries: y }, l += a; + } else if (g === "COMPOUNDRULE") { + for (a = parseInt(p[1], 10), u = l + 1, f = l + 1 + a; u < f; u++) + i = d[u], o = i.split(/\s+/), this.compoundRules.push(o[1]); + l += a; } else - B === "REP" ? (b = l.split(/\s+/), b.length === 3 && this.replacementTable.push([b[1], b[2]])) : this.flags[B] = M[1]; + g === "REP" ? (o = i.split(/\s+/), o.length === 3 && this.replacementTable.push([o[1], o[2]])) : this.flags[g] = p[1]; } - return a; - }, - _removeAffixComments: function(s) { - return s.match(/^\s*#/, "") ? "" : s; + return n; }, - _parseDIC: function(s) { - s = this._removeDicComments(s); - var a = s.split(/\r?\n/), l = {}; - function h(ke, we) { - l.hasOwnProperty(ke) || (l[ke] = null), we.length > 0 && (l[ke] === null && (l[ke] = []), l[ke].push(we)); - } - for (var f = 1, b = a.length; f < b; f++) { - var w = a[f]; - if (!!w) { - var O = w.split("/", 2), S = O[0]; - if (O.length > 1) { - var E = this.parseRuleCodes(O[1]); - (!("NEEDAFFIX" in this.flags) || E.indexOf(this.flags.NEEDAFFIX) == -1) && h(S, E); - for (var D = 0, M = E.length; D < M; D++) { - var B = E[D], z = this.rules[B]; - if (z) - for (var W = this._applyRule(S, z), H = 0, G = W.length; H < G; H++) { - var ee = W[H]; - if (h(ee, []), z.combineable) - for (var le = D + 1; le < M; le++) { - var se = E[le], he = this.rules[se]; - if (he && he.combineable && z.type != he.type) - for (var te = this._applyRule(ee, he), be = 0, fe = te.length; be < fe; be++) { - var ae = te[be]; - h(ae, []); + _removeAffixComments: function(r) { + return r.match(/^\s*#/, "") ? "" : r; + }, + _parseDIC: function(r) { + r = this._removeDicComments(r); + var n = r.split(/\r?\n/), i = {}; + function s(_, R) { + i.hasOwnProperty(_) || (i[_] = null), R.length > 0 && (i[_] === null && (i[_] = []), i[_].push(R)); + } + for (var a = 1, o = n.length; a < o; a++) { + var l = n[a]; + if (!!l) { + var u = l.split("/", 2), h = u[0]; + if (u.length > 1) { + var f = this.parseRuleCodes(u[1]); + (!("NEEDAFFIX" in this.flags) || f.indexOf(this.flags.NEEDAFFIX) == -1) && s(h, f); + for (var d = 0, p = f.length; d < p; d++) { + var g = f[d], m = this.rules[g]; + if (m) + for (var v = this._applyRule(h, m), y = 0, b = v.length; y < b; y++) { + var w = v[y]; + if (s(w, []), m.combineable) + for (var O = d + 1; O < p; O++) { + var S = f[O], C = this.rules[S]; + if (C && C.combineable && m.type != C.type) + for (var T = this._applyRule(w, C), A = 0, E = T.length; A < E; A++) { + var L = T[A]; + s(L, []); } } } - B in this.compoundRuleCodes && this.compoundRuleCodes[B].push(S); + g in this.compoundRuleCodes && this.compoundRuleCodes[g].push(h); } } else - h(S.trim(), []); + s(h.trim(), []); } } - return l; + return i; }, - _removeDicComments: function(s) { - return s = s.replace(/^\t.*$/mg, ""), s; + _removeDicComments: function(r) { + return r = r.replace(/^\t.*$/mg, ""), r; }, - parseRuleCodes: function(s) { - if (s) + parseRuleCodes: function(r) { + if (r) if ("FLAG" in this.flags) if (this.flags.FLAG === "long") { - for (var a = [], l = 0, h = s.length; l < h; l += 2) - a.push(s.substr(l, 2)); - return a; + for (var n = [], i = 0, s = r.length; i < s; i += 2) + n.push(r.substr(i, 2)); + return n; } else - return this.flags.FLAG === "num" ? s.split(",") : this.flags.FLAG === "UTF-8" ? Array.from(s) : s.split(""); + return this.flags.FLAG === "num" ? r.split(",") : this.flags.FLAG === "UTF-8" ? Array.from(r) : r.split(""); else - return s.split(""); + return r.split(""); else return []; }, - _applyRule: function(s, a) { - for (var l = a.entries, h = [], f = 0, b = l.length; f < b; f++) { - var w = l[f]; - if (!w.match || s.match(w.match)) { - var O = s; - if (w.remove && (O = O.replace(w.remove, "")), a.type === "SFX" ? O = O + w.add : O = w.add + O, h.push(O), "continuationClasses" in w) - for (var S = 0, E = w.continuationClasses.length; S < E; S++) { - var D = this.rules[w.continuationClasses[S]]; - D && (h = h.concat(this._applyRule(O, D))); + _applyRule: function(r, n) { + for (var i = n.entries, s = [], a = 0, o = i.length; a < o; a++) { + var l = i[a]; + if (!l.match || r.match(l.match)) { + var u = r; + if (l.remove && (u = u.replace(l.remove, "")), n.type === "SFX" ? u = u + l.add : u = l.add + u, s.push(u), "continuationClasses" in l) + for (var h = 0, f = l.continuationClasses.length; h < f; h++) { + var d = this.rules[l.continuationClasses[h]]; + d && (s = s.concat(this._applyRule(u, d))); } } } - return h; + return s; }, - check: function(s) { + check: function(r) { if (!this.loaded) throw "Dictionary not loaded."; - var a = s.replace(/^\s\s*/, "").replace(/\s\s*$/, ""); - if (this.checkExact(a)) + var n = r.replace(/^\s\s*/, "").replace(/\s\s*$/, ""); + if (this.checkExact(n)) return !0; - if (a.toUpperCase() === a) { - var l = a[0] + a.substring(1).toLowerCase(); - if (this.hasFlag(l, "KEEPCASE")) + if (n.toUpperCase() === n) { + var i = n[0] + n.substring(1).toLowerCase(); + if (this.hasFlag(i, "KEEPCASE")) return !1; - if (this.checkExact(l) || this.checkExact(a.toLowerCase())) + if (this.checkExact(i) || this.checkExact(n.toLowerCase())) return !0; } - var h = a[0].toLowerCase() + a.substring(1); - if (h !== a) { - if (this.hasFlag(h, "KEEPCASE")) + var s = n[0].toLowerCase() + n.substring(1); + if (s !== n) { + if (this.hasFlag(s, "KEEPCASE")) return !1; - if (this.checkExact(h)) + if (this.checkExact(s)) return !0; } return !1; }, - checkExact: function(s) { + checkExact: function(r) { if (!this.loaded) throw "Dictionary not loaded."; - var a = this.dictionaryTable[s], l, h; - if (typeof a > "u") { - if ("COMPOUNDMIN" in this.flags && s.length >= this.flags.COMPOUNDMIN) { - for (l = 0, h = this.compoundRules.length; l < h; l++) - if (s.match(this.compoundRules[l])) + var n = this.dictionaryTable[r], i, s; + if (typeof n > "u") { + if ("COMPOUNDMIN" in this.flags && r.length >= this.flags.COMPOUNDMIN) { + for (i = 0, s = this.compoundRules.length; i < s; i++) + if (r.match(this.compoundRules[i])) return !0; } } else { - if (a === null) + if (n === null) return !0; - if (typeof a == "object") { - for (l = 0, h = a.length; l < h; l++) - if (!this.hasFlag(s, "ONLYINCOMPOUND", a[l])) + if (typeof n == "object") { + for (i = 0, s = n.length; i < s; i++) + if (!this.hasFlag(r, "ONLYINCOMPOUND", n[i])) return !0; } } return !1; }, - hasFlag: function(s, a, l) { + hasFlag: function(r, n, i) { if (!this.loaded) throw "Dictionary not loaded."; - return !!(a in this.flags && (typeof l > "u" && (l = Array.prototype.concat.apply([], this.dictionaryTable[s])), l && l.indexOf(this.flags[a]) !== -1)); + return !!(n in this.flags && (typeof i > "u" && (i = Array.prototype.concat.apply([], this.dictionaryTable[r])), i && i.indexOf(this.flags[n]) !== -1)); }, alphabet: "", - suggest: function(s, a) { + suggest: function(r, n) { if (!this.loaded) throw "Dictionary not loaded."; - if (a = a || 5, this.memoized.hasOwnProperty(s)) { - var l = this.memoized[s].limit; - if (a <= l || this.memoized[s].suggestions.length < l) - return this.memoized[s].suggestions.slice(0, a); + if (n = n || 5, this.memoized.hasOwnProperty(r)) { + var i = this.memoized[r].limit; + if (n <= i || this.memoized[r].suggestions.length < i) + return this.memoized[r].suggestions.slice(0, n); } - if (this.check(s)) + if (this.check(r)) return []; - for (var h = 0, f = this.replacementTable.length; h < f; h++) { - var b = this.replacementTable[h]; - if (s.indexOf(b[0]) !== -1) { - var w = s.replace(b[0], b[1]); - if (this.check(w)) - return [w]; + for (var s = 0, a = this.replacementTable.length; s < a; s++) { + var o = this.replacementTable[s]; + if (r.indexOf(o[0]) !== -1) { + var l = r.replace(o[0], o[1]); + if (this.check(l)) + return [l]; } } if (!this.alphabet) { this.alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "TRY" in this.flags && (this.alphabet += this.flags.TRY), "WORDCHARS" in this.flags && (this.alphabet += this.flags.WORDCHARS); - var O = this.alphabet.split(""); - O.sort(); - for (var S = {}, h = 0; h < O.length; h++) - S[O[h]] = !0; + var u = this.alphabet.split(""); + u.sort(); + for (var h = {}, s = 0; s < u.length; s++) + h[u[s]] = !0; this.alphabet = ""; - for (var h in S) - this.alphabet += h; - } - var E = this; - function D(B, z) { - var W = {}, H, G, ee, le, se = E.alphabet.length; - if (typeof B == "string") { - var he = B; - B = {}, B[he] = !0; - } - for (var he in B) - for (H = 0, ee = he.length + 1; H < ee; H++) { - var te = [he.substring(0, H), he.substring(H)]; - if (te[1] && (le = te[0] + te[1].substring(1), (!z || E.check(le)) && (le in W ? W[le] += 1 : W[le] = 1)), te[1].length > 1 && te[1][1] !== te[1][0] && (le = te[0] + te[1][1] + te[1][0] + te[1].substring(2), (!z || E.check(le)) && (le in W ? W[le] += 1 : W[le] = 1)), te[1]) { - var be = te[1].substring(0, 1).toUpperCase() === te[1].substring(0, 1) ? "uppercase" : "lowercase"; - for (G = 0; G < se; G++) { - var fe = E.alphabet[G]; - be === "uppercase" && (fe = fe.toUpperCase()), fe != te[1].substring(0, 1) && (le = te[0] + fe + te[1].substring(1), (!z || E.check(le)) && (le in W ? W[le] += 1 : W[le] = 1)); + for (var s in h) + this.alphabet += s; + } + var f = this; + function d(g, m) { + var v = {}, y, b, w, O, S = f.alphabet.length; + if (typeof g == "string") { + var C = g; + g = {}, g[C] = !0; + } + for (var C in g) + for (y = 0, w = C.length + 1; y < w; y++) { + var T = [C.substring(0, y), C.substring(y)]; + if (T[1] && (O = T[0] + T[1].substring(1), (!m || f.check(O)) && (O in v ? v[O] += 1 : v[O] = 1)), T[1].length > 1 && T[1][1] !== T[1][0] && (O = T[0] + T[1][1] + T[1][0] + T[1].substring(2), (!m || f.check(O)) && (O in v ? v[O] += 1 : v[O] = 1)), T[1]) { + var A = T[1].substring(0, 1).toUpperCase() === T[1].substring(0, 1) ? "uppercase" : "lowercase"; + for (b = 0; b < S; b++) { + var E = f.alphabet[b]; + A === "uppercase" && (E = E.toUpperCase()), E != T[1].substring(0, 1) && (O = T[0] + E + T[1].substring(1), (!m || f.check(O)) && (O in v ? v[O] += 1 : v[O] = 1)); } } - if (te[1]) - for (G = 0; G < se; G++) { - var be = te[0].substring(-1).toUpperCase() === te[0].substring(-1) && te[1].substring(0, 1).toUpperCase() === te[1].substring(0, 1) ? "uppercase" : "lowercase", fe = E.alphabet[G]; - be === "uppercase" && (fe = fe.toUpperCase()), le = te[0] + fe + te[1], (!z || E.check(le)) && (le in W ? W[le] += 1 : W[le] = 1); + if (T[1]) + for (b = 0; b < S; b++) { + var A = T[0].substring(-1).toUpperCase() === T[0].substring(-1) && T[1].substring(0, 1).toUpperCase() === T[1].substring(0, 1) ? "uppercase" : "lowercase", E = f.alphabet[b]; + A === "uppercase" && (E = E.toUpperCase()), O = T[0] + E + T[1], (!m || f.check(O)) && (O in v ? v[O] += 1 : v[O] = 1); } } - return W; - } - function M(B) { - var z = D(B), W = D(z, !0), H = W; - for (var G in z) - !E.check(G) || (G in H ? H[G] += z[G] : H[G] = z[G]); - var ee, le = []; - for (ee in H) - H.hasOwnProperty(ee) && le.push([ee, H[ee]]); - function se(fe, ae) { - var ke = fe[1], we = ae[1]; - return ke < we ? -1 : ke > we ? 1 : ae[0].localeCompare(fe[0]); - } - le.sort(se).reverse(); - var he = [], te = "lowercase"; - B.toUpperCase() === B ? te = "uppercase" : B.substr(0, 1).toUpperCase() + B.substr(1).toLowerCase() === B && (te = "capitalized"); - var be = a; - for (ee = 0; ee < Math.min(be, le.length); ee++) - te === "uppercase" ? le[ee][0] = le[ee][0].toUpperCase() : te === "capitalized" && (le[ee][0] = le[ee][0].substr(0, 1).toUpperCase() + le[ee][0].substr(1)), !E.hasFlag(le[ee][0], "NOSUGGEST") && he.indexOf(le[ee][0]) == -1 ? he.push(le[ee][0]) : be++; - return he; - } - return this.memoized[s] = { - suggestions: M(s), - limit: a - }, this.memoized[s].suggestions; + return v; + } + function p(g) { + var m = d(g), v = d(m, !0), y = v; + for (var b in m) + !f.check(b) || (b in y ? y[b] += m[b] : y[b] = m[b]); + var w, O = []; + for (w in y) + y.hasOwnProperty(w) && O.push([w, y[w]]); + function S(E, L) { + var _ = E[1], R = L[1]; + return _ < R ? -1 : _ > R ? 1 : L[0].localeCompare(E[0]); + } + O.sort(S).reverse(); + var C = [], T = "lowercase"; + g.toUpperCase() === g ? T = "uppercase" : g.substr(0, 1).toUpperCase() + g.substr(1).toLowerCase() === g && (T = "capitalized"); + var A = n; + for (w = 0; w < Math.min(A, O.length); w++) + T === "uppercase" ? O[w][0] = O[w][0].toUpperCase() : T === "capitalized" && (O[w][0] = O[w][0].substr(0, 1).toUpperCase() + O[w][0].substr(1)), !f.hasFlag(O[w][0], "NOSUGGEST") && C.indexOf(O[w][0]) == -1 ? C.push(O[w][0]) : A++; + return C; + } + return this.memoized[r] = { + suggestions: p(r), + limit: n + }, this.memoized[r].suggestions; } }; - })(), r.exports = n; -})(UNt); -const lAn = UNt.exports, WNt = us.define({ - combine: (r) => r[r.length - 1] -}), uAn = as.mark({ + })(), t.exports = e; +})(ire); +const F6e = ire.exports, sre = _t.define({ + combine: (t) => t[t.length - 1] +}), z6e = Et.mark({ class: "cm-error" -}), hAn = (r) => Object.keys(r.rules).length > 0; -function pTt(r) { - var h, f; - let n = ((h = r.visibleRanges[0]) == null ? void 0 : h.from) || 0, s = ((f = r.visibleRanges[0]) == null ? void 0 : f.to) || void 0; - const a = new G0(), l = r.state.facet(WNt); - return hAn(l) && r.state.doc.sliceString(n, s).replaceAll(/\w+/g, (b, w) => !l.check(b) && a.add(n + w, n + w + b.length, uAn)), a.finish(); +}), V6e = (t) => Object.keys(t.rules).length > 0; +function qz(t) { + var s, a; + let e = ((s = t.visibleRanges[0]) == null ? void 0 : s.from) || 0, r = ((a = t.visibleRanges[0]) == null ? void 0 : a.to) || void 0; + const n = new Hi(), i = t.state.facet(sre); + return V6e(i) && t.state.doc.sliceString(e, r).replaceAll(/\w+/g, (o, l) => !i.check(o) && n.add(e + l, e + l + o.length, z6e)), n.finish(); } -const fAn = Zu.fromClass(class { - constructor(r) { - this.decorations = pTt(r); +const U6e = an.fromClass(class { + constructor(t) { + this.decorations = qz(t); } - update(r) { - (r.docChanged || r.viewportChanged) && (this.decorations = pTt(r.view)); + update(t) { + (t.docChanged || t.viewportChanged) && (this.decorations = qz(t.view)); } }, { - decorations: (r) => r.decorations + decorations: (t) => t.decorations }); -function dAn(r) { - if (!r) +function q6e(t) { + if (!t) return []; let { - dict: n = "en_US", - dictionaryPath: s = "/dictionaries" - } = r; - return [WNt.of(new lAn(n, null, null, { - dictionaryPath: s - })), fAn]; -} -const pAn = "cm-link", gAn = [{ + dict: e = "en_US", + dictionaryPath: r = "/dictionaries" + } = t; + return [sre.of(new F6e(e, null, null, { + dictionaryPath: r + })), U6e]; +} +const Q6e = "cm-link", Y6e = [{ target: /`[^`\n]+`/g, cssClass: "cm-mono" }]; -function gTt(r, n, s, a) { - var w, O; - let l = ((w = r.visibleRanges[0]) == null ? void 0 : w.from) || 0, h = ((O = r.visibleRanges[0]) == null ? void 0 : O.to) || void 0; - const f = new G0(), b = r.state.doc.sliceString(l, h); - return n.flatMap((S) => { - const E = S.id ? r.state.doc.line(parseInt(a.get(S.id))).text : b, D = S.id ? r.state.doc.line(parseInt(a.get(S.id))).from : l; - return [...E.matchAll(S.target)].map((M) => ({ - match: M, +function Qz(t, e, r, n) { + var l, u; + let i = ((l = t.visibleRanges[0]) == null ? void 0 : l.from) || 0, s = ((u = t.visibleRanges[0]) == null ? void 0 : u.to) || void 0; + const a = new Hi(), o = t.state.doc.sliceString(i, s); + return e.flatMap((h) => { + const f = h.id ? t.state.doc.line(parseInt(n.get(h.id))).text : o, d = h.id ? t.state.doc.line(parseInt(n.get(h.id))).from : i; + return [...f.matchAll(h.target)].map((p) => ({ + match: p, hl: { - ...S, - from: D + ...h, + from: d } })); - }).sort((S, E) => S.hl.from + S.match.index - (E.hl.from + E.match.index)).forEach(({ - hl: S, - match: E + }).sort((h, f) => h.hl.from + h.match.index - (f.hl.from + f.match.index)).forEach(({ + hl: h, + match: f }) => { - let D = { - class: pAn + let d = { + class: Q6e }; - S.cssClass && (D.class = S.cssClass); - let M; - s && (M = s({ - builder: f, - from: S.from, - match: E, - hl: S, - markParams: D, - view: r - })), f.add(S.from + E.index, S.from + E.index + E[0].length, as.mark(D)), M == null || M(); - }), f.finish(); -} -const pqe = (r, n, s) => { - r || (r = []); - const a = r.concat(gAn); - return Zu.fromClass(class { - constructor(l) { - this.decorations = gTt(l, a, n, s); - } - update(l) { - (l.docChanged || l.viewportChanged) && (this.decorations = gTt(l.view, a, n, s)); + h.cssClass && (d.class = h.cssClass); + let p; + r && (p = r({ + builder: a, + from: h.from, + match: f, + hl: h, + markParams: d, + view: t + })), a.add(h.from + f.index, h.from + f.index + f[0].length, Et.mark(d)), p == null || p(); + }), a.finish(); +} +const zM = (t, e, r) => { + t || (t = []); + const n = t.concat(Y6e); + return an.fromClass(class { + constructor(i) { + this.decorations = Qz(i, n, e, r); + } + update(i) { + (i.docChanged || i.viewportChanged) && (this.decorations = Qz(i.view, n, e, r)); } }, { - decorations: (l) => l.decorations + decorations: (i) => i.decorations }); -}, YNt = /* @__PURE__ */ new Map(); -class mAn { - constructor(n) { - this.room = n, this.onmessage = null, this._onChange = (s) => s.key === n && this.onmessage !== null && this.onmessage({ data: cEn(s.newValue || "") }), jCn(this._onChange); +}, are = /* @__PURE__ */ new Map(); +class W6e { + constructor(e) { + this.room = e, this.onmessage = null, this._onChange = (r) => r.key === e && this.onmessage !== null && this.onmessage({ data: $ke(r.newValue || "") }), gke(this._onChange); } - postMessage(n) { - qLt.setItem(this.room, aEn(nEn(n))); + postMessage(e) { + ree.setItem(this.room, Pke(Rke(e))); } close() { - QCn(this._onChange); + mke(this._onChange); } } -const bAn = typeof BroadcastChannel > "u" ? mAn : BroadcastChannel, gqe = (r) => g_(YNt, r, () => { - const n = oP(), s = new bAn(r); - return s.onmessage = (a) => n.forEach((l) => l(a.data, "broadcastchannel")), { - bc: s, - subs: n +const G6e = typeof BroadcastChannel > "u" ? W6e : BroadcastChannel, VM = (t) => rh(are, t, () => { + const e = jd(), r = new G6e(t); + return r.onmessage = (n) => e.forEach((i) => i(n.data, "broadcastchannel")), { + bc: r, + subs: e }; -}), vAn = (r, n) => (gqe(r).subs.add(n), n), wAn = (r, n) => { - const s = gqe(r), a = s.subs.delete(n); - return a && s.subs.size === 0 && (s.bc.close(), YNt.delete(r)), a; -}, fB = (r, n, s = null) => { - const a = gqe(r); - a.bc.postMessage(n), a.subs.forEach((l) => l(n, s)); -}, HNt = 0, mqe = 1, GNt = 2, aje = (r, n) => { - Eo(r, HNt); - const s = UEn(n); - Ld(r, s); -}, ZNt = (r, n, s) => { - Eo(r, mqe), Ld(r, QEn(n, s)); -}, yAn = (r, n, s) => ZNt(n, s, wg(r)), XNt = (r, n, s) => { +}), H6e = (t, e) => (VM(t).subs.add(e), e), X6e = (t, e) => { + const r = VM(t), n = r.subs.delete(e); + return n && r.subs.size === 0 && (r.bc.close(), are.delete(t)), n; +}, Sp = (t, e, r = null) => { + const n = VM(t); + n.bc.postMessage(e), n.subs.forEach((i) => i(e, r)); +}, ore = 0, UM = 1, lre = 2, Z7 = (t, e) => { + Wt(t, ore); + const r = xSe(e); + Xn(t, r); +}, cre = (t, e, r) => { + Wt(t, UM), Xn(t, mSe(e, r)); +}, Z6e = (t, e, r) => cre(e, r, Es(t)), ure = (t, e, r) => { try { - BEn(n, wg(r), s); - } catch (a) { - console.error("Caught error while handling a Yjs update", a); - } -}, OAn = (r, n) => { - Eo(r, GNt), Ld(r, n); -}, kAn = XNt, xAn = (r, n, s, a) => { - const l = Pa(r); - switch (l) { - case HNt: - yAn(r, n, s); + dSe(e, Es(t), r); + } catch (n) { + console.error("Caught error while handling a Yjs update", n); + } +}, j6e = (t, e) => { + Wt(t, lre), Xn(t, e); +}, K6e = ure, J6e = (t, e, r, n) => { + const i = or(t); + switch (i) { + case ore: + Z6e(t, e, r); break; - case mqe: - XNt(r, s, a); + case UM: + ure(t, r, n); break; - case GNt: - kAn(r, s, a); + case lre: + K6e(t, r, n); break; default: throw new Error("Unknown message type"); } - return l; -}, SAn = 0, _An = (r, n, s) => { - switch (Pa(r)) { - case SAn: - s(n, i8(r)); - } -}, o$e = 3e4; -class KNt extends owe { - constructor(n) { - super(), this.doc = n, this.clientID = n.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = setInterval(() => { - const s = O8(); - this.getLocalState() !== null && o$e / 2 <= s - this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState()); - const a = []; - this.meta.forEach((l, h) => { - h !== this.clientID && o$e <= s - l.lastUpdated && this.states.has(h) && a.push(h); - }), a.length > 0 && bqe(this, a, "timeout"); - }, l_(o$e / 10)), n.on("destroy", () => { + return i; +}, e_e = 0, t_e = (t, e, r) => { + switch (or(t)) { + case e_e: + r(e, Hh(t)); + } +}, t6 = 3e4; +class hre extends YS { + constructor(e) { + super(), this.doc = e, this.clientID = e.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = setInterval(() => { + const r = df(); + this.getLocalState() !== null && t6 / 2 <= r - this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState()); + const n = []; + this.meta.forEach((i, s) => { + s !== this.clientID && t6 <= r - i.lastUpdated && this.states.has(s) && n.push(s); + }), n.length > 0 && qM(this, n, "timeout"); + }, Fu(t6 / 10)), e.on("destroy", () => { this.destroy(); }), this.setLocalState({}); } @@ -25309,205 +25318,205 @@ class KNt extends owe { getLocalState() { return this.states.get(this.clientID) || null; } - setLocalState(n) { - const s = this.clientID, a = this.meta.get(s), l = a === void 0 ? 0 : a.clock + 1, h = this.states.get(s); - n === null ? this.states.delete(s) : this.states.set(s, n), this.meta.set(s, { - clock: l, - lastUpdated: O8() + setLocalState(e) { + const r = this.clientID, n = this.meta.get(r), i = n === void 0 ? 0 : n.clock + 1, s = this.states.get(r); + e === null ? this.states.delete(r) : this.states.set(r, e), this.meta.set(r, { + clock: i, + lastUpdated: df() }); - const f = [], b = [], w = [], O = []; - n === null ? O.push(s) : h == null ? n != null && f.push(s) : (b.push(s), qX(h, n) || w.push(s)), (f.length > 0 || w.length > 0 || O.length > 0) && this.emit("change", [{ added: f, updated: w, removed: O }, "local"]), this.emit("update", [{ added: f, updated: b, removed: O }, "local"]); - } - setLocalStateField(n, s) { - const a = this.getLocalState(); - a !== null && this.setLocalState({ - ...a, - [n]: s + const a = [], o = [], l = [], u = []; + e === null ? u.push(r) : s == null ? e != null && a.push(r) : (o.push(r), Hv(s, e) || l.push(r)), (a.length > 0 || l.length > 0 || u.length > 0) && this.emit("change", [{ added: a, updated: l, removed: u }, "local"]), this.emit("update", [{ added: a, updated: o, removed: u }, "local"]); + } + setLocalStateField(e, r) { + const n = this.getLocalState(); + n !== null && this.setLocalState({ + ...n, + [e]: r }); } getStates() { return this.states; } } -const bqe = (r, n, s) => { - const a = []; - for (let l = 0; l < n.length; l++) { - const h = n[l]; - if (r.states.has(h)) { - if (r.states.delete(h), h === r.clientID) { - const f = r.meta.get(h); - r.meta.set(h, { - clock: f.clock + 1, - lastUpdated: O8() +const qM = (t, e, r) => { + const n = []; + for (let i = 0; i < e.length; i++) { + const s = e[i]; + if (t.states.has(s)) { + if (t.states.delete(s), s === t.clientID) { + const a = t.meta.get(s); + t.meta.set(s, { + clock: a.clock + 1, + lastUpdated: df() }); } - a.push(h); + n.push(s); } } - a.length > 0 && (r.emit("change", [{ added: [], updated: [], removed: a }, s]), r.emit("update", [{ added: [], updated: [], removed: a }, s])); -}, WX = (r, n, s = r.states) => { - const a = n.length, l = Og(); - Eo(l, a); - for (let h = 0; h < a; h++) { - const f = n[h], b = s.get(f) || null, w = r.meta.get(f).clock; - Eo(l, f), Eo(l, w), ZM(l, JSON.stringify(b)); - } - return Sf(l); -}, CAn = (r, n, s) => { - const a = A8(n), l = O8(), h = [], f = [], b = [], w = [], O = Pa(a); - for (let S = 0; S < O; S++) { - const E = Pa(a); - let D = Pa(a); - const M = JSON.parse(i8(a)), B = r.meta.get(E), z = r.states.get(E), W = B === void 0 ? 0 : B.clock; - (W < D || W === D && M === null && r.states.has(E)) && (M === null ? E === r.clientID && r.getLocalState() != null ? D++ : r.states.delete(E) : r.states.set(E, M), r.meta.set(E, { - clock: D, - lastUpdated: l - }), B === void 0 && M !== null ? h.push(E) : B !== void 0 && M === null ? w.push(E) : M !== null && (qX(M, z) || b.push(E), f.push(E))); - } - (h.length > 0 || b.length > 0 || w.length > 0) && r.emit("change", [{ - added: h, - updated: b, - removed: w - }, s]), (h.length > 0 || f.length > 0 || w.length > 0) && r.emit("update", [{ - added: h, - updated: f, - removed: w - }, s]); -}, EAn = (r) => UCn(r, (n, s) => `${encodeURIComponent(s)}=${encodeURIComponent(n)}`).join("&"), VM = 0, JNt = 3, FB = 1, TAn = 2, VJ = []; -VJ[VM] = (r, n, s, a, l) => { - Eo(r, VM); - const h = xAn( - n, - r, - s.doc, - s + n.length > 0 && (t.emit("change", [{ added: [], updated: [], removed: n }, r]), t.emit("update", [{ added: [], updated: [], removed: n }, r])); +}, jv = (t, e, r = t.states) => { + const n = e.length, i = _s(); + Wt(i, n); + for (let s = 0; s < n; s++) { + const a = e[s], o = r.get(a) || null, l = t.meta.get(a).clock; + Wt(i, a), Wt(i, l), Ud(i, JSON.stringify(o)); + } + return Ln(i); +}, r_e = (t, e, r) => { + const n = Ff(e), i = df(), s = [], a = [], o = [], l = [], u = or(n); + for (let h = 0; h < u; h++) { + const f = or(n); + let d = or(n); + const p = JSON.parse(Hh(n)), g = t.meta.get(f), m = t.states.get(f), v = g === void 0 ? 0 : g.clock; + (v < d || v === d && p === null && t.states.has(f)) && (p === null ? f === t.clientID && t.getLocalState() != null ? d++ : t.states.delete(f) : t.states.set(f, p), t.meta.set(f, { + clock: d, + lastUpdated: i + }), g === void 0 && p !== null ? s.push(f) : g !== void 0 && p === null ? l.push(f) : p !== null && (Hv(p, m) || o.push(f), a.push(f))); + } + (s.length > 0 || o.length > 0 || l.length > 0) && t.emit("change", [{ + added: s, + updated: o, + removed: l + }, r]), (s.length > 0 || a.length > 0 || l.length > 0) && t.emit("update", [{ + added: s, + updated: a, + removed: l + }, r]); +}, n_e = (t) => xke(t, (e, r) => `${encodeURIComponent(r)}=${encodeURIComponent(e)}`).join("&"), Ad = 0, fre = 3, Jp = 1, i_e = 2, rx = []; +rx[Ad] = (t, e, r, n, i) => { + Wt(t, Ad); + const s = J6e( + e, + t, + r.doc, + r ); - a && h === mqe && !s.synced && (s.synced = !0); + n && s === UM && !r.synced && (r.synced = !0); }; -VJ[JNt] = (r, n, s, a, l) => { - Eo(r, FB), Ld( - r, - WX( - s.awareness, - Array.from(s.awareness.getStates().keys()) +rx[fre] = (t, e, r, n, i) => { + Wt(t, Jp), Xn( + t, + jv( + r.awareness, + Array.from(r.awareness.getStates().keys()) ) ); }; -VJ[FB] = (r, n, s, a, l) => { - CAn( - s.awareness, - wg(n), - s +rx[Jp] = (t, e, r, n, i) => { + r_e( + r.awareness, + Es(e), + r ); }; -VJ[TAn] = (r, n, s, a, l) => { - _An( - n, - s.doc, - (h, f) => AAn(s, f) +rx[i_e] = (t, e, r, n, i) => { + t_e( + e, + r.doc, + (s, a) => s_e(r, a) ); }; -const mTt = 3e4, AAn = (r, n) => console.warn(`Permission denied to access ${r.url}. -${n}`), eRt = (r, n, s) => { - const a = A8(n), l = Og(), h = Pa(a), f = r.messageHandlers[h]; - return f ? f(l, a, r, s, h) : console.error("Unable to compute message"), l; -}, tRt = (r) => { - if (r.shouldConnect && r.ws === null) { - const n = new r._WS(r.url); - n.binaryType = "arraybuffer", r.ws = n, r.wsconnecting = !0, r.wsconnected = !1, r.synced = !1, n.onmessage = (s) => { - r.wsLastMessageReceived = O8(); - const a = eRt(r, new Uint8Array(s.data), !0); - Fze(a) > 1 && n.send(Sf(a)); - }, n.onerror = (s) => { - r.emit("connection-error", [s, r]); - }, n.onclose = (s) => { - r.emit("connection-close", [s, r]), r.ws = null, r.wsconnecting = !1, r.wsconnected ? (r.wsconnected = !1, r.synced = !1, bqe( - r.awareness, - Array.from(r.awareness.getStates().keys()).filter( - (a) => a !== r.doc.clientID +const Yz = 3e4, s_e = (t, e) => console.warn(`Permission denied to access ${t.url}. +${e}`), dre = (t, e, r) => { + const n = Ff(e), i = _s(), s = or(n), a = t.messageHandlers[s]; + return a ? a(i, n, t, r, s) : console.error("Unable to compute message"), i; +}, pre = (t) => { + if (t.shouldConnect && t.ws === null) { + const e = new t._WS(t.url); + e.binaryType = "arraybuffer", t.ws = e, t.wsconnecting = !0, t.wsconnected = !1, t.synced = !1, e.onmessage = (r) => { + t.wsLastMessageReceived = df(); + const n = dre(t, new Uint8Array(r.data), !0); + hM(n) > 1 && e.send(Ln(n)); + }, e.onerror = (r) => { + t.emit("connection-error", [r, t]); + }, e.onclose = (r) => { + t.emit("connection-close", [r, t]), t.ws = null, t.wsconnecting = !1, t.wsconnected ? (t.wsconnected = !1, t.synced = !1, qM( + t.awareness, + Array.from(t.awareness.getStates().keys()).filter( + (n) => n !== t.doc.clientID ), - r - ), r.emit("status", [{ + t + ), t.emit("status", [{ status: "disconnected" - }])) : r.wsUnsuccessfulReconnects++, setTimeout( - tRt, - awe( - aCn(2, r.wsUnsuccessfulReconnects) * 100, - r.maxBackoffTime + }])) : t.wsUnsuccessfulReconnects++, setTimeout( + pre, + WS( + P3e(2, t.wsUnsuccessfulReconnects) * 100, + t.maxBackoffTime ), - r + t ); - }, n.onopen = () => { - r.wsLastMessageReceived = O8(), r.wsconnecting = !1, r.wsconnected = !0, r.wsUnsuccessfulReconnects = 0, r.emit("status", [{ + }, e.onopen = () => { + t.wsLastMessageReceived = df(), t.wsconnecting = !1, t.wsconnected = !0, t.wsUnsuccessfulReconnects = 0, t.emit("status", [{ status: "connected" }]); - const s = Og(); - if (Eo(s, VM), aje(s, r.doc), n.send(Sf(s)), r.awareness.getLocalState() !== null) { - const a = Og(); - Eo(a, FB), Ld( - a, - WX(r.awareness, [ - r.doc.clientID + const r = _s(); + if (Wt(r, Ad), Z7(r, t.doc), e.send(Ln(r)), t.awareness.getLocalState() !== null) { + const n = _s(); + Wt(n, Jp), Xn( + n, + jv(t.awareness, [ + t.doc.clientID ]) - ), n.send(Sf(a)); + ), e.send(Ln(n)); } - }, r.emit("status", [{ + }, t.emit("status", [{ status: "connecting" }]); } -}, a$e = (r, n) => { - const s = r.ws; - r.wsconnected && s && s.readyState === s.OPEN && s.send(n), r.bcconnected && fB(r.bcChannel, n, r); -}; -class nRt extends owe { - constructor(n, s, a, { - connect: l = !0, - awareness: h = new KNt(a), - params: f = {}, - WebSocketPolyfill: b = WebSocket, - resyncInterval: w = -1, - maxBackoffTime: O = 2500, - disableBc: S = !1 +}, r6 = (t, e) => { + const r = t.ws; + t.wsconnected && r && r.readyState === r.OPEN && r.send(e), t.bcconnected && Sp(t.bcChannel, e, t); +}; +class gre extends YS { + constructor(e, r, n, { + connect: i = !0, + awareness: s = new hre(n), + params: a = {}, + WebSocketPolyfill: o = WebSocket, + resyncInterval: l = -1, + maxBackoffTime: u = 2500, + disableBc: h = !1 } = {}) { - for (super(); n[n.length - 1] === "/"; ) - n = n.slice(0, n.length - 1); - const E = EAn(f); - this.maxBackoffTime = O, this.bcChannel = n + "/" + s, this.url = n + "/" + s + (E.length === 0 ? "" : "?" + E), this.roomname = s, this.doc = a, this._WS = b, this.awareness = h, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = S, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = VJ.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = l, this._resyncInterval = 0, w > 0 && (this._resyncInterval = setInterval(() => { + for (super(); e[e.length - 1] === "/"; ) + e = e.slice(0, e.length - 1); + const f = n_e(a); + this.maxBackoffTime = u, this.bcChannel = e + "/" + r, this.url = e + "/" + r + (f.length === 0 ? "" : "?" + f), this.roomname = r, this.doc = n, this._WS = o, this.awareness = s, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = h, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = rx.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = i, this._resyncInterval = 0, l > 0 && (this._resyncInterval = setInterval(() => { if (this.ws && this.ws.readyState === WebSocket.OPEN) { - const D = Og(); - Eo(D, VM), aje(D, a), this.ws.send(Sf(D)); - } - }, w)), this._bcSubscriber = (D, M) => { - if (M !== this) { - const B = eRt(this, new Uint8Array(D), !1); - Fze(B) > 1 && fB(this.bcChannel, Sf(B), this); - } - }, this._updateHandler = (D, M) => { - if (M !== this) { - const B = Og(); - Eo(B, VM), OAn(B, D), a$e(this, Sf(B)); - } - }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: D, updated: M, removed: B }, z) => { - const W = D.concat(M).concat(B), H = Og(); - Eo(H, FB), Ld( - H, - WX(h, W) - ), a$e(this, Sf(H)); + const d = _s(); + Wt(d, Ad), Z7(d, n), this.ws.send(Ln(d)); + } + }, l)), this._bcSubscriber = (d, p) => { + if (p !== this) { + const g = dre(this, new Uint8Array(d), !1); + hM(g) > 1 && Sp(this.bcChannel, Ln(g), this); + } + }, this._updateHandler = (d, p) => { + if (p !== this) { + const g = _s(); + Wt(g, Ad), j6e(g, d), r6(this, Ln(g)); + } + }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: d, updated: p, removed: g }, m) => { + const v = d.concat(p).concat(g), y = _s(); + Wt(y, Jp), Xn( + y, + jv(s, v) + ), r6(this, Ln(y)); }, this._unloadHandler = () => { - bqe( + qM( this.awareness, - [a.clientID], + [n.clientID], "window unload" ); - }, typeof window < "u" ? window.addEventListener("unload", this._unloadHandler) : typeof process < "u" && process.on("exit", this._unloadHandler), h.on("update", this._awarenessUpdateHandler), this._checkInterval = setInterval(() => { - this.wsconnected && mTt < O8() - this.wsLastMessageReceived && this.ws.close(); - }, mTt / 10), l && this.connect(); + }, typeof window < "u" ? window.addEventListener("unload", this._unloadHandler) : typeof process < "u" && process.on("exit", this._unloadHandler), s.on("update", this._awarenessUpdateHandler), this._checkInterval = setInterval(() => { + this.wsconnected && Yz < df() - this.wsLastMessageReceived && this.ws.close(); + }, Yz / 10), i && this.connect(); } get synced() { return this._synced; } - set synced(n) { - this._synced !== n && (this._synced = n, this.emit("synced", [n]), this.emit("sync", [n])); + set synced(e) { + this._synced !== e && (this._synced = e, this.emit("synced", [e]), this.emit("sync", [e])); } destroy() { this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(), typeof window < "u" ? window.removeEventListener("unload", this._unloadHandler) : typeof process < "u" && process.off("exit", this._unloadHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.doc.off("update", this._updateHandler), super.destroy(); @@ -25515,125 +25524,125 @@ class nRt extends owe { connectBc() { if (this.disableBc) return; - this.bcconnected || (vAn(this.bcChannel, this._bcSubscriber), this.bcconnected = !0); - const n = Og(); - Eo(n, VM), aje(n, this.doc), fB(this.bcChannel, Sf(n), this); - const s = Og(); - Eo(s, VM), ZNt(s, this.doc), fB(this.bcChannel, Sf(s), this); - const a = Og(); - Eo(a, JNt), fB( + this.bcconnected || (H6e(this.bcChannel, this._bcSubscriber), this.bcconnected = !0); + const e = _s(); + Wt(e, Ad), Z7(e, this.doc), Sp(this.bcChannel, Ln(e), this); + const r = _s(); + Wt(r, Ad), cre(r, this.doc), Sp(this.bcChannel, Ln(r), this); + const n = _s(); + Wt(n, fre), Sp( this.bcChannel, - Sf(a), + Ln(n), this ); - const l = Og(); - Eo(l, FB), Ld( - l, - WX(this.awareness, [ + const i = _s(); + Wt(i, Jp), Xn( + i, + jv(this.awareness, [ this.doc.clientID ]) - ), fB( + ), Sp( this.bcChannel, - Sf(l), + Ln(i), this ); } disconnectBc() { - const n = Og(); - Eo(n, FB), Ld( - n, - WX(this.awareness, [ + const e = _s(); + Wt(e, Jp), Xn( + e, + jv(this.awareness, [ this.doc.clientID ], /* @__PURE__ */ new Map()) - ), a$e(this, Sf(n)), this.bcconnected && (wAn(this.bcChannel, this._bcSubscriber), this.bcconnected = !1); + ), r6(this, Ln(e)), this.bcconnected && (X6e(this.bcChannel, this._bcSubscriber), this.bcconnected = !1); } disconnect() { this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && this.ws.close(); } connect() { - this.shouldConnect = !0, !this.wsconnected && this.ws === null && (tRt(this), this.connectBc()); + this.shouldConnect = !0, !this.wsconnected && this.ws === null && (pre(this), this.connectBc()); } } -const DAn = (r) => ["input", "delete", "undo", "redo"].some((n) => r.isUserEvent(n)), QK = us.define({ - combine: (r) => r[r.length - 1], +const a_e = (t) => ["input", "delete", "undo", "redo"].some((e) => t.isUserEvent(e)), Zy = _t.define({ + combine: (t) => t[t.length - 1], static: !0 -}), rRt = $o.define(), MAn = Zu.fromClass(class { - constructor(r) { - this.decorations = this.colorEditorLines(r); +}), mre = Zt.define(), o_e = an.fromClass(class { + constructor(t) { + this.decorations = this.colorEditorLines(t); } - markAuthor(r, n) { - return as.line({ + markAuthor(t, e) { + return Et.line({ attributes: { - "data-line-number": n, + "data-line-number": e, style: ` - --bg: ${r.color + "99"}; - border-left: 2px solid ${r.color}; + --bg: ${t.color + "99"}; + border-left: 2px solid ${t.color}; position: relative; ` }, class: "cm-comment-author-colored" }); } - colorEditorLines(r) { - const n = r.state.facet(QK), s = new G0(); - for (let a = 1; a <= r.state.doc.lines; a++) { - const l = r.state.doc.line(a), h = n.get(a); - h && s.add(l.from, l.from, this.markAuthor(h, a)); + colorEditorLines(t) { + const e = t.state.facet(Zy), r = new Hi(); + for (let n = 1; n <= t.state.doc.lines; n++) { + const i = t.state.doc.line(n), s = e.get(n); + s && r.add(i.from, i.from, this.markAuthor(s, n)); } - return s.finish(); + return r.finish(); } - markLinesEditedInTransaction(r) { - const n = r.state.facet(QK); - r.changes.iterChangedRanges((s, a, l, h) => { - const f = r.newDoc.lineAt(l), b = r.newDoc.lineAt(h), w = r.newDoc.slice(l, h).toString().trim().length == 0, O = r.state.doc.lines - r.startState.doc.lines; - if (O > 0 && (w && !b.length ? n.insert(f.number + 1, O) : f.from == l ? n.insert(f.number, O) : (n.insert(f.number, O), n.mark(b.number))), O < 0) { - const S = r.startState.doc.length > h ? r.startState.doc.lineAt(h) : null; - w && b.to == l ? n.remove(f.number + 1, -O) : w && !(S != null && S.length) ? n.remove(f.number, -O) : (n.remove(f.number + 1, -O), n.mark(f.number)); + markLinesEditedInTransaction(t) { + const e = t.state.facet(Zy); + t.changes.iterChangedRanges((r, n, i, s) => { + const a = t.newDoc.lineAt(i), o = t.newDoc.lineAt(s), l = t.newDoc.slice(i, s).toString().trim().length == 0, u = t.state.doc.lines - t.startState.doc.lines; + if (u > 0 && (l && !o.length ? e.insert(a.number + 1, u) : a.from == i ? e.insert(a.number, u) : (e.insert(a.number, u), e.mark(o.number))), u < 0) { + const h = t.startState.doc.length > s ? t.startState.doc.lineAt(s) : null; + l && o.to == i ? e.remove(a.number + 1, -u) : l && !(h != null && h.length) ? e.remove(a.number, -u) : (e.remove(a.number + 1, -u), e.mark(a.number)); } - O == 0 && !n.get(f.number) && n.mark(f.number); + u == 0 && !e.get(a.number) && e.mark(a.number); }); } - update(r) { - (r.docChanged || r.viewportChanged || r.transactions.some((n) => n.effects.some((s) => s.is(rRt)))) && (r.transactions.filter(DAn).forEach((n) => this.markLinesEditedInTransaction(n)), this.decorations = this.colorEditorLines(r.view)), r.view.dom.onmouseleave = () => r.view.dispatch({ - effects: cje.of(null) - }), r.view.dom.querySelectorAll(".cm-line").forEach((n) => { - n.onmouseenter = (s) => r.view.dispatch({ - effects: cje.of(parseInt(s.target.dataset.lineNumber)) + update(t) { + (t.docChanged || t.viewportChanged || t.transactions.some((e) => e.effects.some((r) => r.is(mre)))) && (t.transactions.filter(a_e).forEach((e) => this.markLinesEditedInTransaction(e)), this.decorations = this.colorEditorLines(t.view)), t.view.dom.onmouseleave = () => t.view.dispatch({ + effects: j7.of(null) + }), t.view.dom.querySelectorAll(".cm-line").forEach((e) => { + e.onmouseenter = (r) => t.view.dispatch({ + effects: j7.of(parseInt(r.target.dataset.lineNumber)) }); }); } }, { - decorations: (r) => r.decorations -}), cje = $o.define(), _ve = Ef.define({ + decorations: (t) => t.decorations +}), j7 = Zt.define(), t3 = Pn.define({ create() { return null; }, - update(r, n) { - var l; - const s = n.state.facet(QK), a = (l = n.effects.find((h) => h.is(cje))) == null ? void 0 : l.value; - return a ? s.firstLineOfSection(a) : null; + update(t, e) { + var i; + const r = e.state.facet(Zy), n = (i = e.effects.find((s) => s.is(j7))) == null ? void 0 : i.value; + return n ? r.firstLineOfSection(n) : null; } }); -class bTt extends Xy { - constructor(n, s) { - super(), s && n && (this.lineNumber = s.state.doc.lineAt(n.to).number, this.lineAuthors = s.state.facet(QK), this.selectedLine = s.state.facet(_ve)); +class Wz extends Uo { + constructor(e, r) { + super(), r && e && (this.lineNumber = r.state.doc.lineAt(e.to).number, this.lineAuthors = r.state.facet(Zy), this.selectedLine = r.state.facet(t3)); } authorAvatar() { const { - avatar: n + avatar: e } = this.lineAuthors.get(this.lineNumber); - let s = document.createElement("img"); - return s.classList.add("author-avatar"), s.src = n, s; + let r = document.createElement("img"); + return r.classList.add("author-avatar"), r.src = e, r; } toDOM() { return this.selectedLine && this.selectedLine == this.lineNumber ? this.authorAvatar() : document.createElement("div"); } } -const PAn = X2e({ - lineMarker: (r, n) => new bTt(n, r), - lineMarkerChange: (r) => r.startState.field(_ve) != r.state.field(_ve), - initialSpacer: () => new bTt(null, null) -}), LAn = (r) => [QK.of(r), _ve.init(null), PAn, MAn], AP = ga.button` +const l_e = PS({ + lineMarker: (t, e) => new Wz(e, t), + lineMarkerChange: (t) => t.startState.field(t3) != t.state.field(t3), + initialSpacer: () => new Wz(null, null) +}), c_e = (t) => [Zy.of(t), t3.init(null), l_e, o_e], P0 = ar.button` &:focus { outline: 0 !important; } @@ -25659,70 +25668,70 @@ const PAn = X2e({ margin: 5px; } `; -$o.define(); -const iRt = new CP(); -function IAn(r) { - return r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); -} -function NAn({ - commentId: r, - text: n, - color: s +Zt.define(); +const vre = new D0(); +function u_e(t) { + return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function h_e({ + commentId: t, + text: e, + color: r }) { - const a = []; - for (; n !== ""; ) { - n = n.slice(n.indexOf("|") + 1); - const l = n.indexOf("|"); - if (l === -1) + const n = []; + for (; e !== ""; ) { + e = e.slice(e.indexOf("|") + 1); + const i = e.indexOf("|"); + if (i === -1) break; - let h = n.slice(0, l), f = ""; - h.includes("->") && (f = h.slice(h.indexOf("->") + 2).trimStart(), h = h.slice(0, h.indexOf("->")).trimEnd()), h.length !== 0 && a.push({ - targetRegexSrc: `(?<=^|[ \\t\\r\\.]|\\W)${IAn(h)}(?=$|[\\s\\.]|\\W)`, + let s = e.slice(0, i), a = ""; + s.includes("->") && (a = s.slice(s.indexOf("->") + 2).trimStart(), s = s.slice(0, s.indexOf("->")).trimEnd()), s.length !== 0 && n.push({ + targetRegexSrc: `(?<=^|[ \\t\\r\\.]|\\W)${u_e(s)}(?=$|[\\s\\.]|\\W)`, targetRegexFlags: "gm", - id: r, + id: t, cssClass: "cm-suggestion", - replacement: f, - color: s - }), n = n.slice(l + 1); + replacement: a, + color: r + }), e = e.slice(i + 1); } - return a; + return n; } -function RAn({ - builder: r, - from: n, - match: s, - hl: a, - markParams: l, - view: h +function f_e({ + builder: t, + from: e, + match: r, + hl: n, + markParams: i, + view: s }) { - if (a.color && (l.attributes = { - style: `color: ${a.color}` - }), a.replacement) - return l.class += " replaced", () => { - r.add(n + s.index + s[0].length, n + s.index + s[0].length, as.widget({ - widget: new $An({ - text: a.replacement, - color: a.color, - from: n + s.index, - to: n + s.index + s[0].length, - view: h + if (n.color && (i.attributes = { + style: `color: ${n.color}` + }), n.replacement) + return i.class += " replaced", () => { + t.add(e + r.index + r[0].length, e + r.index + r[0].length, Et.widget({ + widget: new d_e({ + text: n.replacement, + color: n.color, + from: e + r.index, + to: e + r.index + r[0].length, + view: s }) })); }; } -class $An extends uv { +class d_e extends za { constructor({ - text: n, - color: s, - from: a, - to: l, - view: h + text: e, + color: r, + from: n, + to: i, + view: s }) { - super(), this.text = n, this.color = s, this.from = a, this.to = l, this.view = h; + super(), this.text = e, this.color = r, this.from = n, this.to = i, this.view = s; } toDOM() { - const n = document.createElement("span"); - return n.innerText = this.text, n.style.color = this.color, n.classList.add("cm-replacement"), n.title = "Accept suggestion", n.addEventListener("mouseup", () => { + const e = document.createElement("span"); + return e.innerText = this.text, e.style.color = this.color, e.classList.add("cm-replacement"), e.title = "Accept suggestion", e.addEventListener("mouseup", () => { this.view.dispatch({ changes: { from: this.from, @@ -25730,46 +25739,46 @@ class $An extends uv { insert: this.text } }); - }), n; + }), e; } } -function BAn(r, n, s) { - const a = s.current.querySelector(".myst-add-suggestion"), l = r.state.selection.main, h = l.head === l.anchor, f = r.state.doc.lineAt(l.head).number !== r.state.doc.lineAt(l.anchor).number; - if (!r.selectionSet || h || f) { - a.style.display = "none"; +function p_e(t, e, r) { + const n = r.current.querySelector(".myst-add-suggestion"), i = t.state.selection.main, s = i.head === i.anchor, a = t.state.doc.lineAt(i.head).number !== t.state.doc.lineAt(i.anchor).number; + if (!t.selectionSet || s || a) { + n.style.display = "none"; return; } - const b = r.view.dom.getBoundingClientRect(), w = r.view.coordsAtPos(l.from), O = r.view.coordsAtPos(l.to), S = (w.left + O.left) / 2; - a.style.top = `${w.top - b.top - r.view.defaultLineHeight - 12}px`, a.style.left = `${S - b.left}px`, a.style.display = "block", a.onmousedown = async (E) => { - var le; - E.preventDefault(); - const D = r.state.doc.lineAt(l.from); - let M = l.from; - const B = /[ \t\r\W]/; - let z; - for (z = M - 1; z >= D.from && !B.test(r.state.doc.sliceString(z, z + 1)); z--) + const o = t.view.dom.getBoundingClientRect(), l = t.view.coordsAtPos(i.from), u = t.view.coordsAtPos(i.to), h = (l.left + u.left) / 2; + n.style.top = `${l.top - o.top - t.view.defaultLineHeight - 12}px`, n.style.left = `${h - o.left}px`, n.style.display = "block", n.onmousedown = async (f) => { + var O; + f.preventDefault(); + const d = t.state.doc.lineAt(i.from); + let p = i.from; + const g = /[ \t\r\W]/; + let m; + for (m = p - 1; m >= d.from && !g.test(t.state.doc.sliceString(m, m + 1)); m--) ; - M = z + 1; - let W = l.to; - for (z = W; z <= D.to && !B.test(r.state.doc.sliceString(z, z + 1)); z++) + p = m + 1; + let v = i.to; + for (m = v; m <= d.to && !g.test(t.state.doc.sliceString(m, m + 1)); m++) ; - W = z; - let H = `|${r.state.doc.sliceString(M, W)} -> |`, G = (le = n.findCommentOn(D.number)) == null ? void 0 : le.commentId; - G ? H = ` -` + H : G = n.newComment(D.number), n.ydoc.transact(() => { - const se = n.getTextForComment(G); - se.insert(se.length, H); - const he = n.lineAuthors(G); - he.mark(he.lineAuthors.length); - }, n.provider.awareness.clientID), n.display().setVisibility(G, !0), n.updateMainCodeMirror(); - const ee = await n.getEditorForComment(G); - ee.focus(), ee.dispatch({ - selection: sr.create([sr.range(ee.state.doc.length - 1, ee.state.doc.length - 1)]), - effects: rRt.of(null) + v = m; + let y = `|${t.state.doc.sliceString(p, v)} -> |`, b = (O = e.findCommentOn(d.number)) == null ? void 0 : O.commentId; + b ? y = ` +` + y : b = e.newComment(d.number), e.ydoc.transact(() => { + const S = e.getTextForComment(b); + S.insert(S.length, y); + const C = e.lineAuthors(b); + C.mark(C.lineAuthors.length); + }, e.provider.awareness.clientID), e.display().setVisibility(b, !0), e.updateMainCodeMirror(); + const w = await e.getEditorForComment(b); + w.focus(), w.dispatch({ + selection: Ve.create([Ve.range(w.state.doc.length - 1, w.state.doc.length - 1)]), + effects: mre.of(null) }); }; } -const FAn = ga(AP)` +const g_e = ar(P0)` position: absolute; z-index: 10; display: none; @@ -25797,170 +25806,170 @@ const FAn = ga(AP)` border-right: 10px solid transparent; border-top: 10px solid var(--icon-border); } -`, jAn = () => "comment-" + Math.random().toString().replace(".", ""); -class QAn { - constructor(n, s, a, l) { - this.user = s.awareness.getLocalState().user, this.lineAuthors = n.getArray(l + "/commentLineAuthors"), this.ydoc = n, this.getAvatar = a, this.commentId = l; +`, m_e = () => "comment-" + Math.random().toString().replace(".", ""); +class v_e { + constructor(e, r, n, i) { + this.user = r.awareness.getLocalState().user, this.lineAuthors = e.getArray(i + "/commentLineAuthors"), this.ydoc = e, this.getAvatar = n, this.commentId = i; } - get(n) { - var a; - const s = (a = this.lineAuthors.get(n - 1)) == null ? void 0 : a.get("author"); - if (!!s) - return s.avatar = this.getAvatar(s.name), s; + get(e) { + var n; + const r = (n = this.lineAuthors.get(e - 1)) == null ? void 0 : n.get("author"); + if (!!r) + return r.avatar = this.getAvatar(r.name), r; } - appendFrom(n) { - this.lineAuthors.length !== 0 && this.lineAuthors.delete(this.lineAuthors.length - 1), this.lineAuthors.push(n.toArray().map((s) => s.clone())); + appendFrom(e) { + this.lineAuthors.length !== 0 && this.lineAuthors.delete(this.lineAuthors.length - 1), this.lineAuthors.push(e.toArray().map((r) => r.clone())); } delete() { this.lineAuthors.delete(0, this.lineAuthors.length); } - mark(n) { - for (; n >= this.lineAuthors.length; ) - this.lineAuthors.push([new e_()]); - this.lineAuthors.get(n - 1).set("author", this.user); + mark(e) { + for (; e >= this.lineAuthors.length; ) + this.lineAuthors.push([new _u()]); + this.lineAuthors.get(e - 1).set("author", this.user); } - remove(n, s) { - this.lineAuthors.delete(n - 1, s); + remove(e, r) { + this.lineAuthors.delete(e - 1, r); } - insert(n, s) { - n - 1 > this.lineAuthors.length && this.lineAuthors.push( - [...Array(n - 1 - this.lineAuthors.length).keys()].map((a) => new e_()) - ), this.lineAuthors.insert(n - 1, [...Array(s).keys()].map((a) => new e_([["author", this.user]]))); + insert(e, r) { + e - 1 > this.lineAuthors.length && this.lineAuthors.push( + [...Array(e - 1 - this.lineAuthors.length).keys()].map((n) => new _u()) + ), this.lineAuthors.insert(e - 1, [...Array(r).keys()].map((n) => new _u([["author", this.user]]))); } - firstLineOfSection(n) { - const s = this.get(n).name; - return this.lineAuthors.slice(0, n).map((a, l) => ({ - ...a.get("author"), - lineNumber: l + 1 + firstLineOfSection(e) { + const r = this.get(e).name; + return this.lineAuthors.slice(0, e).map((n, i) => ({ + ...n.get("author"), + lineNumber: i + 1 })).reduceRight( - (a, { - name: l, - lineNumber: h - }) => l == s && h == a - 1 ? h : a, - n + (n, { + name: i, + lineNumber: s + }) => i == r && s == n - 1 ? s : n, + e ); } } -class zAn { - constructor(n, s) { - this.commentPositions = n.getMap(YX.dataPath), this.ycomments = s; +class y_e { + constructor(e, r) { + this.commentPositions = e.getMap(Kv.dataPath), this.ycomments = r; } iter() { - return [...this.commentPositions.entries()].map(([n, s]) => ({ - commentId: n, - lineNumber: parseInt(s) + return [...this.commentPositions.entries()].map(([e, r]) => ({ + commentId: e, + lineNumber: parseInt(r) })); } - move(n, s, a = !0) { - s > 0 && !this.isOccupied(s) && this.commentPositions.set(n, s), a && this.ycomments.syncSuggestions(n); + move(e, r, n = !0) { + r > 0 && !this.isOccupied(r) && this.commentPositions.set(e, r), n && this.ycomments.syncSuggestions(e); } - shift(n, s, a, l) { - s < 0 && this.iter().filter((f) => n + s < f.lineNumber && f.lineNumber <= n).forEach((f) => this.del(f.commentId)); - const h = this.iter().filter((f) => l ? f.lineNumber > n : f.lineNumber >= n).filter((f) => f.lineNumber + s <= a); - h.forEach((f) => this.move(f.commentId, f.lineNumber + s, !1)), this.ycomments.syncSuggestions(...h.map((f) => f.commentId)); + shift(e, r, n, i) { + r < 0 && this.iter().filter((a) => e + r < a.lineNumber && a.lineNumber <= e).forEach((a) => this.del(a.commentId)); + const s = this.iter().filter((a) => i ? a.lineNumber > e : a.lineNumber >= e).filter((a) => a.lineNumber + r <= n); + s.forEach((a) => this.move(a.commentId, a.lineNumber + r, !1)), this.ycomments.syncSuggestions(...s.map((a) => a.commentId)); } - isOccupied(n) { - return this.iter().some((s) => s.lineNumber == n); + isOccupied(e) { + return this.iter().some((r) => r.lineNumber == e); } - get(n) { - return this.commentPositions.get(n); + get(e) { + return this.commentPositions.get(e); } - set(n, s) { - return this.commentPositions.set(n, s); + set(e, r) { + return this.commentPositions.set(e, r); } - del(n) { - this.commentPositions.delete(n); + del(e) { + this.commentPositions.delete(e); } } -class qAn { +class b_e { constructor() { this.comments = {}, this._onUpdate = () => { }; } - onUpdate(n) { - this._onUpdate = n; + onUpdate(e) { + this._onUpdate = e; } - switchVisibility(n) { - const a = !this.isShown(n); - return this.setVisibility(n, a), a; + switchVisibility(e) { + const n = !this.isShown(e); + return this.setVisibility(e, n), n; } - setVisibility(n, s) { - this.update((a) => (a[n] || (a[n] = {}), a[n].isShown = s, a)); + setVisibility(e, r) { + this.update((n) => (n[e] || (n[e] = {}), n[e].isShown = r, n)); } - setHeight(n, s) { - this.update((a) => (a[n] || (a[n] = {}), a[n].height = s, a)); + setHeight(e, r) { + this.update((n) => (n[e] || (n[e] = {}), n[e].height = r, n)); } - offset(n) { - return this.comments[n].top; + offset(e) { + return this.comments[e].top; } - isShown(n) { - return this.comments[n] ? this.comments[n].isShown && this.comments[n].top : !0; + isShown(e) { + return this.comments[e] ? this.comments[e].isShown && this.comments[e].top : !0; } - del(n) { - this.update((s) => (delete s[n], s)); + del(e) { + this.update((r) => (delete r[e], r)); } - new(n) { - this.update((s) => (s[n] = { + new(e) { + this.update((r) => (r[e] = { height: 18, isShown: !1 - }, s)); + }, r)); } - update(n) { - n && (this.comments = n(this.comments)), this._onUpdate(); + update(e) { + e && (this.comments = e(this.comments)), this._onUpdate(); } - show(n) { - this.setVisibility(n, !0); + show(e) { + this.setVisibility(e, !0); } } -class VAn { - constructor(n, s) { - this.user = n.awareness.getLocalState().user, this.resolvedComments = s.getMap("resolved-comments"); +class x_e { + constructor(e, r) { + this.user = e.awareness.getLocalState().user, this.resolvedComments = r.getMap("resolved-comments"); } - resolve(n, s, a, l) { - this.resolvedComments.set(n, JSON.stringify({ - resolvedLine: s, - lineNumber: a, + resolve(e, r, n, i) { + this.resolvedComments.set(e, JSON.stringify({ + resolvedLine: r, + lineNumber: n, resolvedBy: this.user, resolvedDate: Date.now(), - pos: l + pos: i })); } - delete(n) { - this.resolvedComments.delete(n); + delete(e) { + this.resolvedComments.delete(e); } resolved() { - return [...this.resolvedComments.entries()].map(([n, s]) => ({ - commentId: n, - ...JSON.parse(s) + return [...this.resolvedComments.entries()].map(([e, r]) => ({ + commentId: e, + ...JSON.parse(r) })); } - updateComment(n, s) { - this.resolvedComments.set(n, JSON.stringify({ - ...JSON.parse(this.resolvedComments.get(n)), - ...s + updateComment(e, r) { + this.resolvedComments.set(e, JSON.stringify({ + ...JSON.parse(this.resolvedComments.get(e)), + ...r })); } - onUpdate(n) { - this.resolvedComments.observe(() => n(this.resolved())); + onUpdate(e) { + this.resolvedComments.observe(() => e(this.resolved())); } } -const yUe = class { - constructor(n, s, a) { - this.ydoc = n, this.provider = s, this.getAvatar = a, this.mainCodeMirror = null, this.newLocalComment = !1, this.positionManager = new zAn(n, this), this.displayManager = new qAn(s), this.commentResolver = new VAn(s, n), this.draggedComment = null, this.commentWithPopup = null, this.commentEditorsListeners = /* @__PURE__ */ new Map(), this.commentEditors = /* @__PURE__ */ new Map(), this.suggestions = n.getMap("suggestions"), this.suggestions.observe(() => { +const r$ = class { + constructor(e, r, n) { + this.ydoc = e, this.provider = r, this.getAvatar = n, this.mainCodeMirror = null, this.newLocalComment = !1, this.positionManager = new y_e(e, this), this.displayManager = new b_e(r), this.commentResolver = new x_e(r, e), this.draggedComment = null, this.commentWithPopup = null, this.commentEditorsListeners = /* @__PURE__ */ new Map(), this.commentEditors = /* @__PURE__ */ new Map(), this.suggestions = e.getMap("suggestions"), this.suggestions.observe(() => { if (!this.mainCodeMirror) return; - const l = [...this.suggestions.values()].flat().map((h) => ({ - ...h, - target: new RegExp(h.targetRegexSrc, h.targetRegexFlags) + const i = [...this.suggestions.values()].flat().map((s) => ({ + ...s, + target: new RegExp(s.targetRegexSrc, s.targetRegexFlags) })); this.mainCodeMirror.dispatch({ - effects: iRt.reconfigure(pqe(l, RAn, this.positions())), - annotations: v1.userEvent.of("suggestion") + effects: vre.reconfigure(zM(i, f_e, this.positions())), + annotations: fi.userEvent.of("suggestion") }); }), this.positionManager.commentPositions.observeDeep(() => this.updateMainCodeMirror()); } - lineAuthors(n) { - return new QAn(this.ydoc, this.provider, this.getAvatar, n); + lineAuthors(e) { + return new v_e(this.ydoc, this.provider, this.getAvatar, e); } positions() { return this.positionManager; @@ -25971,581 +25980,581 @@ const yUe = class { resolver() { return this.commentResolver; } - registerCodeMirror(n) { - this.mainCodeMirror = n; + registerCodeMirror(e) { + this.mainCodeMirror = e; } marginLeft() { return this.mainCodeMirror.dom.querySelector(".cm-gutters").offsetWidth; } - getTextForComment(n) { - return this.ydoc.getText(yUe.commentsPrefix + n); + getTextForComment(e) { + return this.ydoc.getText(r$.commentsPrefix + e); } - delText(n) { - let s = this.getTextForComment(n); - s != null && s.parent && s.delete(); + delText(e) { + let r = this.getTextForComment(e); + r != null && r.parent && r.delete(); } - newComment(n) { - const s = jAn(); - return this.positions().set(s, n.toString()), this.display().new(s), this.lineAuthors(s).mark(1), this.newLocalComment = !0, s; + newComment(e) { + const r = m_e(); + return this.positions().set(r, e.toString()), this.display().new(r), this.lineAuthors(r).mark(1), this.newLocalComment = !0, r; } - deleteComment(n) { - this.positions().del(n), this.display().del(n), this.delText(n), this.suggestions.set(n, []); + deleteComment(e) { + this.positions().del(e), this.display().del(e), this.delText(e), this.suggestions.set(e, []); } - resolveComment(n) { - const s = this.positions().get(n), a = this.mainCodeMirror.state.doc.line(s).from; - this.positions().del(n), this.display().del(n); - const l = this.mainCodeMirror.state.doc.line(s); - this.resolver().resolve(n, l.text, s, a); + resolveComment(e) { + const r = this.positions().get(e), n = this.mainCodeMirror.state.doc.line(r).from; + this.positions().del(e), this.display().del(e); + const i = this.mainCodeMirror.state.doc.line(r); + this.resolver().resolve(e, i.text, r, n); } - isEmpty(n) { - return this.getTextForComment(n).length === 0; + isEmpty(e) { + return this.getTextForComment(e).length === 0; } - findCommentOn(n) { - return this.positions().iter().find((s) => s.lineNumber == n); + findCommentOn(e) { + return this.positions().iter().find((r) => r.lineNumber == e); } - parentLineHeight(n) { - var l, h; - let s = (l = this.mainCodeMirror.dom.querySelector("#" + n)) == null ? void 0 : l.previousSibling; - if (s) - return s.clientHeight; - let a = this.positionManager.get(n); - return (h = [...this.mainCodeMirror.dom.querySelectorAll(".cm-gutterElement")].find((f) => f.textContent == a)) == null ? void 0 : h.clientHeight; + parentLineHeight(e) { + var i, s; + let r = (i = this.mainCodeMirror.dom.querySelector("#" + e)) == null ? void 0 : i.previousSibling; + if (r) + return r.clientHeight; + let n = this.positionManager.get(e); + return (s = [...this.mainCodeMirror.dom.querySelectorAll(".cm-gutterElement")].find((a) => a.textContent == n)) == null ? void 0 : s.clientHeight; } - updateHeight(n, s) { - this.display().setHeight(n, s), this.updateMainCodeMirror(); + updateHeight(e, r) { + this.display().setHeight(e, r), this.updateMainCodeMirror(); } - syncCommentLocations(n) { + syncCommentLocations(e) { this.display().update( - (s) => (n.view.dom.querySelectorAll(".comment-box").forEach((a) => { - var l; - s[l = a.id] || (s[l] = {}), s[a.id].top = a.offsetTop; - }), s) + (r) => (e.view.dom.querySelectorAll(".comment-box").forEach((n) => { + var i; + r[i = n.id] || (r[i] = {}), r[n.id].top = n.offsetTop; + }), r) ); } syncRemoteComments() { - this.display().update((n) => (this.positions().iter().filter((s) => !n[s.commentId] || n[s.commentId].isShown == null).forEach((s) => { - n[s.commentId] = { + this.display().update((e) => (this.positions().iter().filter((r) => !e[r.commentId] || e[r.commentId].isShown == null).forEach((r) => { + e[r.commentId] = { isShown: !0, height: 17 }, this.updateMainCodeMirror(); - }), n)); + }), e)); } removeLocalComments() { - let n = this.positions().iter().map((s) => s.commentId); - this.display().update((s) => { - for (let a in s) - n.includes(a) || (delete s[a], this.suggestions.set(a, [])); - return s; + let e = this.positions().iter().map((r) => r.commentId); + this.display().update((r) => { + for (let n in r) + e.includes(n) || (delete r[n], this.suggestions.set(n, [])); + return r; }); } - syncFoldedComments(n) { - if (!BQe(n)) + syncFoldedComments(e) { + if (!fL(e)) return; - const s = n.transactions[0].effects[0].is(b8), { - from: a, - to: l - } = n.transactions[0].effects[0].value, h = n.state.doc.lineAt(a).number, f = n.state.doc.lineAt(l).number, b = zxn(n.state).iter(0), w = []; - for (let O = b; O.value != null; b.next()) - (O.from != a || O.to != l) && w.push({ - fromLine: n.state.doc.lineAt(O.from).number, - toLine: n.state.doc.lineAt(O.to).number + const r = e.transactions[0].effects[0].is(cf), { + from: n, + to: i + } = e.transactions[0].effects[0].value, s = e.state.doc.lineAt(n).number, a = e.state.doc.lineAt(i).number, o = vOe(e.state).iter(0), l = []; + for (let u = o; u.value != null; o.next()) + (u.from != n || u.to != i) && l.push({ + fromLine: e.state.doc.lineAt(u.from).number, + toLine: e.state.doc.lineAt(u.to).number }); this.positions().iter().filter(({ - lineNumber: O - }) => O >= h && O <= f && !w.some((S) => O >= S.fromLine && O <= S.toLine)).forEach(({ - commentId: O + lineNumber: u + }) => u >= s && u <= a && !l.some((h) => u >= h.fromLine && u <= h.toLine)).forEach(({ + commentId: u }) => { - this.display().setVisibility(O, !s); + this.display().setVisibility(u, !r); }), this.updateMainCodeMirror(); } - syncComments(n) { - n.transactions.some((s) => s.isUserEvent("suggestion")) || (this.syncCommentLocations(n), this.syncFoldedComments(n), this.syncRemoteComments(), this.removeLocalComments(), this.syncResolvedComments(n)); + syncComments(e) { + e.transactions.some((r) => r.isUserEvent("suggestion")) || (this.syncCommentLocations(e), this.syncFoldedComments(e), this.syncRemoteComments(), this.removeLocalComments(), this.syncResolvedComments(e)); } iterComments() { - const n = ({ - lineNumber: s, - commentId: a + const e = ({ + lineNumber: r, + commentId: n }) => ({ - ...this.displayManager.comments[a], - lineNumber: s, - commentId: a + ...this.displayManager.comments[n], + lineNumber: r, + commentId: n }); - return this.positions().iter().map(n); - } - syncSuggestions(...n) { - let s = {}; - for (const a of n) { - const l = this.getTextForComment(a).toString(); - parseInt(this.positions().get(a)); - const h = this.lineAuthors(a), f = l.split(` -`).map((b, w) => { - var O, S; + return this.positions().iter().map(e); + } + syncSuggestions(...e) { + let r = {}; + for (const n of e) { + const i = this.getTextForComment(n).toString(); + parseInt(this.positions().get(n)); + const s = this.lineAuthors(n), a = i.split(` +`).map((o, l) => { + var u, h; return { - text: b, - commentId: a, - color: (S = (O = h.get(w + 1)) == null ? void 0 : O.color) != null ? S : "#111" + text: o, + commentId: n, + color: (h = (u = s.get(l + 1)) == null ? void 0 : u.color) != null ? h : "#111" }; }); - s[a] = f.flatMap(NAn); + r[n] = a.flatMap(h_e); } this.suggestions.doc.transact(() => { - for (const [a, l] of Object.entries(s)) - this.suggestions.set(a, l); + for (const [n, i] of Object.entries(r)) + this.suggestions.set(n, i); }); } updateMainCodeMirror() { this.mainCodeMirror ? this.mainCodeMirror.dispatch({ - effects: zK.of(null) + effects: jy.of(null) }) : console.warn("[YComments] Failed to update the main CodeMirror instance since it doesn't exist."); } - syncResolvedComments(n) { - if (!n.docChanged && !n.transactions.some((a) => a.effects.some((l) => l.is(zK)))) + syncResolvedComments(e) { + if (!e.docChanged && !e.transactions.some((n) => n.effects.some((i) => i.is(jy)))) return; - const s = this.resolver().resolved(); - for (const a of s) { - let l = !0; - if (n.changes.iterChanges((S) => { - n.startState.doc.lineAt(S).number <= a.lineNumber && (l = !1); - }), a.occupied !== this.positions().isOccupied(a.lineNumber) && (l = !1), l) + const r = this.resolver().resolved(); + for (const n of r) { + let i = !0; + if (e.changes.iterChanges((h) => { + e.startState.doc.lineAt(h).number <= n.lineNumber && (i = !1); + }), n.occupied !== this.positions().isOccupied(n.lineNumber) && (i = !1), i) continue; - const h = n.startState.doc.line(a.lineNumber).from, f = n.changes.mapPos(h, 1), b = n.state.doc.lineAt(f).number, w = n.changes.mapPos(h, 1, c0.TrackDel) == null, O = n.changes.mapPos(h, 1, c0.TrackBefore) == null && n.startState.doc.line(a.lineNumber).text == ""; - if (w || O) { - this.resolver().updateComment(a.commentId, { + const s = e.startState.doc.line(n.lineNumber).from, a = e.changes.mapPos(s, 1), o = e.state.doc.lineAt(a).number, l = e.changes.mapPos(s, 1, Si.TrackDel) == null, u = e.changes.mapPos(s, 1, Si.TrackBefore) == null && e.startState.doc.line(n.lineNumber).text == ""; + if (l || u) { + this.resolver().updateComment(n.commentId, { orphaned: !0 }); continue; } - if (this.resolver().updateComment(a.commentId, { - occupied: this.positions().isOccupied(b) - }), !a.orphaned) { - this.resolver().updateComment(a.commentId, { - lineNumber: b + if (this.resolver().updateComment(n.commentId, { + occupied: this.positions().isOccupied(o) + }), !n.orphaned) { + this.resolver().updateComment(n.commentId, { + lineNumber: o }); - const S = n.state.doc.line(b).text; - this.resolver().updateComment(a.commentId, { - resolvedLine: S + const h = e.state.doc.line(o).text; + this.resolver().updateComment(n.commentId, { + resolvedLine: h }); } } } - restoreComment(n) { - const s = this.lineAuthors(n.commentId), a = this.getTextForComment(n.commentId), l = n.orphaned ? this.mainCodeMirror.state.doc.lines : n.lineNumber; - if (this.resolver().delete(n.commentId), this.positions().isOccupied(l)) { - const h = this.findCommentOn(l).commentId; - this.lineAuthors(h).appendFrom(s.lineAuthors); - const f = this.getTextForComment(h); - f.insert(f.length, ` -` + a.toString()), this.display().setVisibility(h, !0); + restoreComment(e) { + const r = this.lineAuthors(e.commentId), n = this.getTextForComment(e.commentId), i = e.orphaned ? this.mainCodeMirror.state.doc.lines : e.lineNumber; + if (this.resolver().delete(e.commentId), this.positions().isOccupied(i)) { + const s = this.findCommentOn(i).commentId; + this.lineAuthors(s).appendFrom(r.lineAuthors); + const a = this.getTextForComment(s); + a.insert(a.length, ` +` + n.toString()), this.display().setVisibility(s, !0); } else { - const h = this.newComment(l); - this.lineAuthors(h).delete(), this.lineAuthors(h).appendFrom(s.lineAuthors), this.getTextForComment(h).insert(0, a.toString()), this.display().setVisibility(h, !0); + const s = this.newComment(i); + this.lineAuthors(s).delete(), this.lineAuthors(s).appendFrom(r.lineAuthors), this.getTextForComment(s).insert(0, n.toString()), this.display().setVisibility(s, !0); } } - moveOrMerge(n, s) { - if (!this.positions().isOccupied(s)) - this.positions().move(n, s); + moveOrMerge(e, r) { + if (!this.positions().isOccupied(r)) + this.positions().move(e, r); else { - const a = this.findCommentOn(s).commentId; - this.lineAuthors(a).appendFrom(this.lineAuthors(n).lineAuthors); - const l = this.getTextForComment(a); - l.insert(l.length, ` -` + this.getTextForComment(n).toString()), this.deleteComment(n), this.display().setVisibility(a, !0); + const n = this.findCommentOn(r).commentId; + this.lineAuthors(n).appendFrom(this.lineAuthors(e).lineAuthors); + const i = this.getTextForComment(n); + i.insert(i.length, ` +` + this.getTextForComment(e).toString()), this.deleteComment(e), this.display().setVisibility(n, !0); } } - registerCommentEditor(n, s) { - this.commentEditors.set(n, s), this.commentEditorsListeners.has(n) && (this.commentEditorsListeners.get(n)(s), this.commentEditorsListeners.delete(n)); + registerCommentEditor(e, r) { + this.commentEditors.set(e, r), this.commentEditorsListeners.has(e) && (this.commentEditorsListeners.get(e)(r), this.commentEditorsListeners.delete(e)); } - getEditorForComment(n) { - return new Promise((s) => { - this.commentEditors.has(n) ? s(this.commentEditors.get(n)) : this.commentEditorsListeners.set(n, s); + getEditorForComment(e) { + return new Promise((r) => { + this.commentEditors.has(e) ? r(this.commentEditors.get(e)) : this.commentEditorsListeners.set(e, r); }); } }; -let YX = yUe; -YZ(YX, "commentsPrefix", "comments/"); -const vwe = us.define({ - combine: (r) => r[r.length - 1], +let Kv = r$; +Or(Kv, "commentsPrefix", "comments/"); +const nT = _t.define({ + combine: (t) => t[t.length - 1], static: !0 -}), zK = $o.define(); -class UAn extends uv { - constructor(n, s, a) { - super(), this.height = n, this.commentId = s, this.isShown = a; +}), jy = Zt.define(); +class w_e extends za { + constructor(e, r, n) { + super(), this.height = e, this.commentId = r, this.isShown = n; } toDOM() { - const n = document.createElement("div"); - return n.id = this.commentId, n.classList = "comment-box", this.isShown || (n.classList += " comment-box-hidden"), n.style.height = this.height + "px", n; + const e = document.createElement("div"); + return e.id = this.commentId, e.classList = "comment-box", this.isShown || (e.classList += " comment-box-hidden"), e.style.height = this.height + "px", e; } } -const WAn = (r, n, s) => as.widget({ - widget: new UAn(r, n, s), +const O_e = (t, e, r) => Et.widget({ + widget: new w_e(t, e, r), side: 1e4, inlineOrder: !1, - block: s -}), YAn = (r, n) => r.lineNumber - n.lineNumber, HAn = (r) => r.docChanged || r.effects.some((n) => n.is(zK)), GAn = (r) => [(n, { - commentId: s, - lineNumber: a, - height: l, - isShown: h + block: r +}), k_e = (t, e) => t.lineNumber - e.lineNumber, S_e = (t) => t.docChanged || t.effects.some((e) => e.is(jy)), T_e = (t) => [(e, { + commentId: r, + lineNumber: n, + height: i, + isShown: s }) => { try { - const f = r.newDoc.line(a).to; - n.add(f, f, WAn(l, s, h)); - } catch (f) { - console.warn(f), console.warn(`An error occured when rendering comment ${s}. Comment will not be shown.`); + const a = t.newDoc.line(n).to; + e.add(a, a, O_e(i, r, s)); + } catch (a) { + console.warn(a), console.warn(`An error occured when rendering comment ${r}. Comment will not be shown.`); } - return n; -}, new G0()], ZAn = (r, n) => { - if (r.isUserEvent("input") || r.isUserEvent("delete")) { - const s = r.state.doc.lines - r.startState.doc.lines; - if (s != 0 && r.selection != null) { - const a = r.state.doc.lines, l = r.state.doc.lineAt(r.selection.main.from).number - s, h = r.selection.main.from === r.state.doc.lineAt(r.selection.main.from).to; - n.positions().shift(l, s, a, h); + return e; +}, new Hi()], C_e = (t, e) => { + if (t.isUserEvent("input") || t.isUserEvent("delete")) { + const r = t.state.doc.lines - t.startState.doc.lines; + if (r != 0 && t.selection != null) { + const n = t.state.doc.lines, i = t.state.doc.lineAt(t.selection.main.from).number - r, s = t.selection.main.from === t.state.doc.lineAt(t.selection.main.from).to; + e.positions().shift(i, r, n, s); } } -}, XAn = Ef.define({ +}, E_e = Pn.define({ create() { - return new G0().finish(); + return new Hi().finish(); }, - update(r, n) { - if (HAn(n)) { - const s = n.state.facet(vwe); - return ZAn(n, s), s.iterComments().sort(YAn).reduce(...GAn(n)).finish(); + update(t, e) { + if (S_e(e)) { + const r = e.state.facet(nT); + return C_e(e, r), r.iterComments().sort(k_e).reduce(...T_e(e)).finish(); } - return r; + return t; }, - provide(r) { - return Ci.decorations.from(r); + provide(t) { + return dt.decorations.from(t); } -}), FM = class extends Xy { - constructor(n, s) { - var a; - super(), this.gutterMarker = null, this.icon = null, s && n && (this.ycomments = s.state.facet(vwe), this.lineNumber = s.state.doc.lineAt(n.to).number, this.commentId = (a = this.ycomments.findCommentOn(this.lineNumber)) == null ? void 0 : a.commentId); +}), Sd = class extends Uo { + constructor(e, r) { + var n; + super(), this.gutterMarker = null, this.icon = null, r && e && (this.ycomments = r.state.facet(nT), this.lineNumber = r.state.doc.lineAt(e.to).number, this.commentId = (n = this.ycomments.findCommentOn(this.lineNumber)) == null ? void 0 : n.commentId); } hasComments() { return Boolean(this.commentId); } createGutterMarker() { - this.gutterMarker = document.createElement("div"), this.gutterMarker.classList.add(FM.MAIN_CLASS), this.lineNumber && (this.gutterMarker.style.width = this.lineNumber.toString().length * 7 + "px", this.gutterMarker.ondrop = () => this.ycomments.moveOrMerge(this.ycomments.draggedComment, this.lineNumber), this.gutterMarker.ondragover = (n) => n.preventDefault()); + this.gutterMarker = document.createElement("div"), this.gutterMarker.classList.add(Sd.MAIN_CLASS), this.lineNumber && (this.gutterMarker.style.width = this.lineNumber.toString().length * 7 + "px", this.gutterMarker.ondrop = () => this.ycomments.moveOrMerge(this.ycomments.draggedComment, this.lineNumber), this.gutterMarker.ondragover = (e) => e.preventDefault()); } createPopupIcon() { - this.icon = document.createElement("section"), this.icon.classList = FM.ICON_CLASS, !this.draggedComment && !this.commentId ? (this.icon.onmouseenter = () => this.icon.classList.add(FM.COMMENT_IMAGE_CLASS), this.icon.onmouseleave = () => this.icon.classList.remove(FM.COMMENT_IMAGE_CLASS)) : (this.icon.onmouseup = () => this.ycomments.display().switchVisibility(this.commentId), this.icon.onmouseenter = () => { + this.icon = document.createElement("section"), this.icon.classList = Sd.ICON_CLASS, !this.draggedComment && !this.commentId ? (this.icon.onmouseenter = () => this.icon.classList.add(Sd.COMMENT_IMAGE_CLASS), this.icon.onmouseleave = () => this.icon.classList.remove(Sd.COMMENT_IMAGE_CLASS)) : (this.icon.onmouseup = () => this.ycomments.display().switchVisibility(this.commentId), this.icon.onmouseenter = () => { this.ycomments.commentWithPopup = this.commentId, this.ycomments.updateMainCodeMirror(); }); } markHasComments() { - this.icon.classList.add(FM.COMMENT_IMAGE_CLASS); + this.icon.classList.add(Sd.COMMENT_IMAGE_CLASS); } toDOM() { return this.createGutterMarker(), this.createPopupIcon(), this.hasComments() && this.markHasComments(), this.gutterMarker.appendChild(this.icon), this.gutterMarker; } }; -let NM = FM; -YZ(NM, "MAIN_CLASS", "comment-gutter"), YZ(NM, "ICON_CLASS", "comment-gutter-icon"), YZ(NM, "COMMENT_IMAGE_CLASS", "comment-image"); -const KAn = (r, n, s) => { - var h; - const a = r.state.doc.lineAt(n.to).number, l = (h = s.findCommentOn(a)) == null ? void 0 : h.commentId; - return l || s.newComment(a); -}, JAn = X2e({ - lineMarker(r, n) { - return new NM(n, r); - }, - lineMarkerChange: (r) => r.transactions.some((n) => n.effects.some((s) => s.is(zK))), - initialSpacer: () => new NM(null, null), +let vd = Sd; +Or(vd, "MAIN_CLASS", "comment-gutter"), Or(vd, "ICON_CLASS", "comment-gutter-icon"), Or(vd, "COMMENT_IMAGE_CLASS", "comment-image"); +const __e = (t, e, r) => { + var s; + const n = t.state.doc.lineAt(e.to).number, i = (s = r.findCommentOn(n)) == null ? void 0 : s.commentId; + return i || r.newComment(n); +}, A_e = PS({ + lineMarker(t, e) { + return new vd(e, t); + }, + lineMarkerChange: (t) => t.transactions.some((e) => e.effects.some((r) => r.is(jy))), + initialSpacer: () => new vd(null, null), domEventHandlers: { - mouseup(r, n) { - let s = r.state.facet(vwe.reader), a = KAn(r, n, s); - s.display().switchVisibility(a), r.dispatch({ - effects: zK.of(null) + mouseup(t, e) { + let r = t.state.facet(nT.reader), n = __e(t, e, r); + r.display().switchVisibility(n), t.dispatch({ + effects: jy.of(null) }); } } -}), eDn = (r) => [vwe.of(r), XAn, JAn, Ci.updateListener.of((n) => r.syncComments(n))]; -class b_ { - constructor(n) { - this.state = n; +}), L_e = (t) => [nT.of(t), E_e, A_e, dt.updateListener.of((e) => t.syncComments(e))]; +class ih { + constructor(e) { + this.state = e; } - run(n) { + run(e) { return []; } } -class tDn extends b_ { - run(n) { - const s = new this.state.Token("code_inline", "code", 0); - return s.content = n.content, [s]; +class R_e extends ih { + run(e) { + const r = new this.state.Token("code_inline", "code", 0); + return r.content = e.content, [r]; } } -const nDn = { - raw: tDn -}, lje = "math_inline"; -class rDn extends b_ { - run(n) { - const s = new this.state.Token(lje, "span", 0); - return s.attrSet("class", "math inline"), s.markup = "$", s.content = n.content, [s]; +const M_e = { + raw: R_e +}, K7 = "math_inline"; +class D_e extends ih { + run(e) { + const r = new this.state.Token(K7, "span", 0); + return r.attrSet("class", "math inline"), r.markup = "$", r.content = e.content, [r]; } } -function iDn(r, n) { - var s; - !(!((s = n == null ? void 0 : n.roles) === null || s === void 0) && s.math) || r.renderer.rules[lje] || (r.renderer.rules[lje] = (a, l) => { - var h, f, b; - const w = (b = (f = (h = n == null ? void 0 : n.opts) === null || h === void 0 ? void 0 : h.math) === null || f === void 0 ? void 0 : f.renderer) !== null && b !== void 0 ? b : (D) => r.utils.escapeHtml(D), O = a[l], S = O.content.trim(), E = w(S, { displayMode: !1 }); - return `${E}`; +function N_e(t, e) { + var r; + !(!((r = e == null ? void 0 : e.roles) === null || r === void 0) && r.math) || t.renderer.rules[K7] || (t.renderer.rules[K7] = (n, i) => { + var s, a, o; + const l = (o = (a = (s = e == null ? void 0 : e.opts) === null || s === void 0 ? void 0 : s.math) === null || a === void 0 ? void 0 : a.renderer) !== null && o !== void 0 ? o : (d) => t.utils.escapeHtml(d), u = n[i], h = u.content.trim(), f = l(h, { displayMode: !1 }); + return `${f}`; }); } -const sDn = { - math: rDn +const I_e = { + math: D_e }; -function sRt(r, n) { - n.parseRoles && r.inline.ruler.before("backticks", "parse_roles", oDn), r.core.ruler.after(n.rolesAfter || "inline", "run_roles", cDn(n.roles || {})), r.renderer.rules.role = (s, a) => { - const l = s[a]; - return `${l.meta.name}${l.content}`; - }, iDn(r, n); -} -function oDn(r, n) { - if (r.src.charCodeAt(r.pos - 1) === 92) +function yre(t, e) { + e.parseRoles && t.inline.ruler.before("backticks", "parse_roles", P_e), t.core.ruler.after(e.rolesAfter || "inline", "run_roles", B_e(e.roles || {})), t.renderer.rules.role = (r, n) => { + const i = r[n]; + return `${i.meta.name}${i.content}`; + }, N_e(t, e); +} +function P_e(t, e) { + if (t.src.charCodeAt(t.pos - 1) === 92) return !1; - const s = aDn.exec(r.src.slice(r.pos)); - if (s == null) + const r = $_e.exec(t.src.slice(t.pos)); + if (r == null) return !1; - const [a, l, , h] = s; - if (r.pos += a.length, !n) { - const f = r.push("role", "", 0); - f.meta = { name: l }, f.content = h; + const [n, i, , s] = r; + if (t.pos += n.length, !e) { + const a = t.push("role", "", 0); + a.meta = { name: i }, a.content = s; } return !0; } -let uje; +let J7; try { - uje = new RegExp("^\\{([a-zA-Z_\\-+:]{1,36})\\}(`+)(?!`)(.+?)(?]+)>$/; -class dDn extends b_ { - run(n) { - const s = new this.state.Token("ref_open", "a", 1), a = new this.state.Token("text", "", 0), l = new this.state.Token("ref_close", "a", -1); - return vqe(this.state, { open: s, content: a, close: l }, { kind: "eq", label: n.content }, { - kind: qK.equation, - contentFromTarget: (h) => `(${h.number})` - }), [s, a, l]; - } -} -class pDn extends b_ { - run(n) { - const s = aRt.exec(n.content), [, a, l] = s != null ? s : [], h = a == null ? void 0 : a.trim(), f = new this.state.Token("ref_open", "a", 1), b = new this.state.Token("text", "", 0), w = new this.state.Token("ref_close", "a", -1); - return vqe(this.state, { open: f, content: b, close: w }, { kind: "numref", label: l || n.content, value: h }, { - contentFromTarget: (O) => s ? h.replace(/%s/g, String(O.number)).replace(/\{number\}/g, String(O.number)) : O.title.trim() - }), [f, b, w]; - } -} -class gDn extends b_ { - run(n) { - const s = aRt.exec(n.content), [, a, l] = s != null ? s : [], h = a == null ? void 0 : a.trim(), f = new this.state.Token("ref_open", "a", 1), b = new this.state.Token("text", "", 0), w = new this.state.Token("ref_close", "a", -1); - return vqe(this.state, { open: f, content: b, close: w }, { kind: "ref", label: l || n.content, value: h }, { - contentFromTarget: (O) => h || O.title - }), [f, b, w]; - } -} -const mDn = { - eq: dDn, - ref: gDn, - numref: pDn -}, bDn = Object.assign(Object.assign(Object.assign(Object.assign({}, nDn), uDn), sDn), mDn); +function QM(t, e, r, n) { + var i; + e.open.meta = (i = e.open.meta) !== null && i !== void 0 ? i : {}, e.open.meta.kind = r.kind, e.open.meta.label = r.label, e.open.meta.value = r.value, iT(t).references.push(Object.assign({ label: r.label, tokens: e }, n)); +} +const xre = /^(.+?)<([^<>]+)>$/; +class q_e extends ih { + run(e) { + const r = new this.state.Token("ref_open", "a", 1), n = new this.state.Token("text", "", 0), i = new this.state.Token("ref_close", "a", -1); + return QM(this.state, { open: r, content: n, close: i }, { kind: "eq", label: e.content }, { + kind: Ky.equation, + contentFromTarget: (s) => `(${s.number})` + }), [r, n, i]; + } +} +class Q_e extends ih { + run(e) { + const r = xre.exec(e.content), [, n, i] = r != null ? r : [], s = n == null ? void 0 : n.trim(), a = new this.state.Token("ref_open", "a", 1), o = new this.state.Token("text", "", 0), l = new this.state.Token("ref_close", "a", -1); + return QM(this.state, { open: a, content: o, close: l }, { kind: "numref", label: i || e.content, value: s }, { + contentFromTarget: (u) => r ? s.replace(/%s/g, String(u.number)).replace(/\{number\}/g, String(u.number)) : u.title.trim() + }), [a, o, l]; + } +} +class Y_e extends ih { + run(e) { + const r = xre.exec(e.content), [, n, i] = r != null ? r : [], s = n == null ? void 0 : n.trim(), a = new this.state.Token("ref_open", "a", 1), o = new this.state.Token("text", "", 0), l = new this.state.Token("ref_close", "a", -1); + return QM(this.state, { open: a, content: o, close: l }, { kind: "ref", label: i || e.content, value: s }, { + contentFromTarget: (u) => s || u.title + }), [a, o, l]; + } +} +const W_e = { + eq: q_e, + ref: Y_e, + numref: Q_e +}, G_e = Object.assign(Object.assign(Object.assign(Object.assign({}, M_e), z_e), I_e), W_e); /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ -function cRt(r) { - return typeof r > "u" || r === null; -} -function vDn(r) { - return typeof r == "object" && r !== null; -} -function wDn(r) { - return Array.isArray(r) ? r : cRt(r) ? [] : [r]; -} -function yDn(r, n) { - var s, a, l, h; - if (n) - for (h = Object.keys(n), s = 0, a = h.length; s < a; s += 1) - l = h[s], r[l] = n[l]; +function wre(t) { + return typeof t > "u" || t === null; +} +function H_e(t) { + return typeof t == "object" && t !== null; +} +function X_e(t) { + return Array.isArray(t) ? t : wre(t) ? [] : [t]; +} +function Z_e(t, e) { + var r, n, i, s; + if (e) + for (s = Object.keys(e), r = 0, n = s.length; r < n; r += 1) + i = s[r], t[i] = e[i]; + return t; +} +function j_e(t, e) { + var r = "", n; + for (n = 0; n < e; n += 1) + r += t; return r; } -function ODn(r, n) { - var s = "", a; - for (a = 0; a < n; a += 1) - s += r; - return s; -} -function kDn(r) { - return r === 0 && Number.NEGATIVE_INFINITY === 1 / r; +function K_e(t) { + return t === 0 && Number.NEGATIVE_INFINITY === 1 / t; } -var xDn = cRt, SDn = vDn, _Dn = wDn, CDn = ODn, EDn = kDn, TDn = yDn, l0 = { - isNothing: xDn, - isObject: SDn, - toArray: _Dn, - repeat: CDn, - isNegativeZero: EDn, - extend: TDn +var J_e = wre, eAe = H_e, tAe = X_e, rAe = j_e, nAe = K_e, iAe = Z_e, Ti = { + isNothing: J_e, + isObject: eAe, + toArray: tAe, + repeat: rAe, + isNegativeZero: nAe, + extend: iAe }; -function lRt(r, n) { - var s = "", a = r.reason || "(unknown reason)"; - return r.mark ? (r.mark.name && (s += 'in "' + r.mark.name + '" '), s += "(" + (r.mark.line + 1) + ":" + (r.mark.column + 1) + ")", !n && r.mark.snippet && (s += ` +function Ore(t, e) { + var r = "", n = t.reason || "(unknown reason)"; + return t.mark ? (t.mark.name && (r += 'in "' + t.mark.name + '" '), r += "(" + (t.mark.line + 1) + ":" + (t.mark.column + 1) + ")", !e && t.mark.snippet && (r += ` -` + r.mark.snippet), a + " " + s) : a; -} -function VK(r, n) { - Error.call(this), this.name = "YAMLException", this.reason = r, this.mark = n, this.message = lRt(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || ""; -} -VK.prototype = Object.create(Error.prototype); -VK.prototype.constructor = VK; -VK.prototype.toString = function(n) { - return this.name + ": " + lRt(this, n); -}; -var Am = VK; -function c$e(r, n, s, a, l) { - var h = "", f = "", b = Math.floor(l / 2) - 1; - return a - n > b && (h = " ... ", n = a - b + h.length), s - a > b && (f = " ...", s = a + b - f.length), { - str: h + r.slice(n, s).replace(/\t/g, "\u2192") + f, - pos: a - n + h.length +` + t.mark.snippet), n + " " + r) : n; +} +function Jy(t, e) { + Error.call(this), this.name = "YAMLException", this.reason = t, this.mark = e, this.message = Ore(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || ""; +} +Jy.prototype = Object.create(Error.prototype); +Jy.prototype.constructor = Jy; +Jy.prototype.toString = function(e) { + return this.name + ": " + Ore(this, e); +}; +var ea = Jy; +function n6(t, e, r, n, i) { + var s = "", a = "", o = Math.floor(i / 2) - 1; + return n - e > o && (s = " ... ", e = n - o + s.length), r - n > o && (a = " ...", r = n + o - a.length), { + str: s + t.slice(e, r).replace(/\t/g, "\u2192") + a, + pos: n - e + s.length }; } -function l$e(r, n) { - return l0.repeat(" ", n - r.length) + r; +function i6(t, e) { + return Ti.repeat(" ", e - t.length) + t; } -function ADn(r, n) { - if (n = Object.create(n || null), !r.buffer) +function sAe(t, e) { + if (e = Object.create(e || null), !t.buffer) return null; - n.maxLength || (n.maxLength = 79), typeof n.indent != "number" && (n.indent = 1), typeof n.linesBefore != "number" && (n.linesBefore = 3), typeof n.linesAfter != "number" && (n.linesAfter = 2); - for (var s = /\r?\n|\r|\0/g, a = [0], l = [], h, f = -1; h = s.exec(r.buffer); ) - l.push(h.index), a.push(h.index + h[0].length), r.position <= h.index && f < 0 && (f = a.length - 2); - f < 0 && (f = a.length - 1); - var b = "", w, O, S = Math.min(r.line + n.linesAfter, l.length).toString().length, E = n.maxLength - (n.indent + S + 3); - for (w = 1; w <= n.linesBefore && !(f - w < 0); w++) - O = c$e( - r.buffer, - a[f - w], - l[f - w], - r.position - (a[f] - a[f - w]), - E - ), b = l0.repeat(" ", n.indent) + l$e((r.line - w + 1).toString(), S) + " | " + O.str + ` -` + b; - for (O = c$e(r.buffer, a[f], l[f], r.position, E), b += l0.repeat(" ", n.indent) + l$e((r.line + 1).toString(), S) + " | " + O.str + ` -`, b += l0.repeat("-", n.indent + S + 3 + O.pos) + `^ -`, w = 1; w <= n.linesAfter && !(f + w >= l.length); w++) - O = c$e( - r.buffer, - a[f + w], - l[f + w], - r.position - (a[f] - a[f + w]), - E - ), b += l0.repeat(" ", n.indent) + l$e((r.line + w + 1).toString(), S) + " | " + O.str + ` + e.maxLength || (e.maxLength = 79), typeof e.indent != "number" && (e.indent = 1), typeof e.linesBefore != "number" && (e.linesBefore = 3), typeof e.linesAfter != "number" && (e.linesAfter = 2); + for (var r = /\r?\n|\r|\0/g, n = [0], i = [], s, a = -1; s = r.exec(t.buffer); ) + i.push(s.index), n.push(s.index + s[0].length), t.position <= s.index && a < 0 && (a = n.length - 2); + a < 0 && (a = n.length - 1); + var o = "", l, u, h = Math.min(t.line + e.linesAfter, i.length).toString().length, f = e.maxLength - (e.indent + h + 3); + for (l = 1; l <= e.linesBefore && !(a - l < 0); l++) + u = n6( + t.buffer, + n[a - l], + i[a - l], + t.position - (n[a] - n[a - l]), + f + ), o = Ti.repeat(" ", e.indent) + i6((t.line - l + 1).toString(), h) + " | " + u.str + ` +` + o; + for (u = n6(t.buffer, n[a], i[a], t.position, f), o += Ti.repeat(" ", e.indent) + i6((t.line + 1).toString(), h) + " | " + u.str + ` +`, o += Ti.repeat("-", e.indent + h + 3 + u.pos) + `^ +`, l = 1; l <= e.linesAfter && !(a + l >= i.length); l++) + u = n6( + t.buffer, + n[a + l], + i[a + l], + t.position - (n[a] - n[a + l]), + f + ), o += Ti.repeat(" ", e.indent) + i6((t.line + l + 1).toString(), h) + " | " + u.str + ` `; - return b.replace(/\n$/, ""); + return o.replace(/\n$/, ""); } -var DDn = ADn, MDn = [ +var aAe = sAe, oAe = [ "kind", "multi", "resolve", @@ -26556,42 +26565,42 @@ var DDn = ADn, MDn = [ "representName", "defaultStyle", "styleAliases" -], PDn = [ +], lAe = [ "scalar", "sequence", "mapping" ]; -function LDn(r) { - var n = {}; - return r !== null && Object.keys(r).forEach(function(s) { - r[s].forEach(function(a) { - n[String(a)] = s; +function cAe(t) { + var e = {}; + return t !== null && Object.keys(t).forEach(function(r) { + t[r].forEach(function(n) { + e[String(n)] = r; }); - }), n; + }), e; } -function IDn(r, n) { - if (n = n || {}, Object.keys(n).forEach(function(s) { - if (MDn.indexOf(s) === -1) - throw new Am('Unknown option "' + s + '" is met in definition of "' + r + '" YAML type.'); - }), this.options = n, this.tag = r, this.kind = n.kind || null, this.resolve = n.resolve || function() { +function uAe(t, e) { + if (e = e || {}, Object.keys(e).forEach(function(r) { + if (oAe.indexOf(r) === -1) + throw new ea('Unknown option "' + r + '" is met in definition of "' + t + '" YAML type.'); + }), this.options = e, this.tag = t, this.kind = e.kind || null, this.resolve = e.resolve || function() { return !0; - }, this.construct = n.construct || function(s) { - return s; - }, this.instanceOf = n.instanceOf || null, this.predicate = n.predicate || null, this.represent = n.represent || null, this.representName = n.representName || null, this.defaultStyle = n.defaultStyle || null, this.multi = n.multi || !1, this.styleAliases = LDn(n.styleAliases || null), PDn.indexOf(this.kind) === -1) - throw new Am('Unknown kind "' + this.kind + '" is specified for "' + r + '" YAML type.'); -} -var $p = IDn; -function OTt(r, n) { - var s = []; - return r[n].forEach(function(a) { - var l = s.length; - s.forEach(function(h, f) { - h.tag === a.tag && h.kind === a.kind && h.multi === a.multi && (l = f); - }), s[l] = a; - }), s; + }, this.construct = e.construct || function(r) { + return r; + }, this.instanceOf = e.instanceOf || null, this.predicate = e.predicate || null, this.represent = e.represent || null, this.representName = e.representName || null, this.defaultStyle = e.defaultStyle || null, this.multi = e.multi || !1, this.styleAliases = cAe(e.styleAliases || null), lAe.indexOf(this.kind) === -1) + throw new ea('Unknown kind "' + this.kind + '" is specified for "' + t + '" YAML type.'); +} +var hs = uAe; +function Zz(t, e) { + var r = []; + return t[e].forEach(function(n) { + var i = r.length; + r.forEach(function(s, a) { + s.tag === n.tag && s.kind === n.kind && s.multi === n.multi && (i = a); + }), r[i] = n; + }), r; } -function NDn() { - var r = { +function hAe() { + var t = { scalar: {}, sequence: {}, mapping: {}, @@ -26602,80 +26611,80 @@ function NDn() { mapping: [], fallback: [] } - }, n, s; - function a(l) { - l.multi ? (r.multi[l.kind].push(l), r.multi.fallback.push(l)) : r[l.kind][l.tag] = r.fallback[l.tag] = l; - } - for (n = 0, s = arguments.length; n < s; n += 1) - arguments[n].forEach(a); - return r; -} -function hje(r) { - return this.extend(r); -} -hje.prototype.extend = function(n) { - var s = [], a = []; - if (n instanceof $p) - a.push(n); - else if (Array.isArray(n)) - a = a.concat(n); - else if (n && (Array.isArray(n.implicit) || Array.isArray(n.explicit))) - n.implicit && (s = s.concat(n.implicit)), n.explicit && (a = a.concat(n.explicit)); + }, e, r; + function n(i) { + i.multi ? (t.multi[i.kind].push(i), t.multi.fallback.push(i)) : t[i.kind][i.tag] = t.fallback[i.tag] = i; + } + for (e = 0, r = arguments.length; e < r; e += 1) + arguments[e].forEach(n); + return t; +} +function e8(t) { + return this.extend(t); +} +e8.prototype.extend = function(e) { + var r = [], n = []; + if (e instanceof hs) + n.push(e); + else if (Array.isArray(e)) + n = n.concat(e); + else if (e && (Array.isArray(e.implicit) || Array.isArray(e.explicit))) + e.implicit && (r = r.concat(e.implicit)), e.explicit && (n = n.concat(e.explicit)); else - throw new Am("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })"); - s.forEach(function(h) { - if (!(h instanceof $p)) - throw new Am("Specified list of YAML types (or a single Type object) contains a non-Type object."); - if (h.loadKind && h.loadKind !== "scalar") - throw new Am("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported."); - if (h.multi) - throw new Am("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit."); - }), a.forEach(function(h) { - if (!(h instanceof $p)) - throw new Am("Specified list of YAML types (or a single Type object) contains a non-Type object."); + throw new ea("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })"); + r.forEach(function(s) { + if (!(s instanceof hs)) + throw new ea("Specified list of YAML types (or a single Type object) contains a non-Type object."); + if (s.loadKind && s.loadKind !== "scalar") + throw new ea("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported."); + if (s.multi) + throw new ea("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit."); + }), n.forEach(function(s) { + if (!(s instanceof hs)) + throw new ea("Specified list of YAML types (or a single Type object) contains a non-Type object."); }); - var l = Object.create(hje.prototype); - return l.implicit = (this.implicit || []).concat(s), l.explicit = (this.explicit || []).concat(a), l.compiledImplicit = OTt(l, "implicit"), l.compiledExplicit = OTt(l, "explicit"), l.compiledTypeMap = NDn(l.compiledImplicit, l.compiledExplicit), l; + var i = Object.create(e8.prototype); + return i.implicit = (this.implicit || []).concat(r), i.explicit = (this.explicit || []).concat(n), i.compiledImplicit = Zz(i, "implicit"), i.compiledExplicit = Zz(i, "explicit"), i.compiledTypeMap = hAe(i.compiledImplicit, i.compiledExplicit), i; }; -var uRt = hje, hRt = new $p("tag:yaml.org,2002:str", { +var kre = e8, Sre = new hs("tag:yaml.org,2002:str", { kind: "scalar", - construct: function(r) { - return r !== null ? r : ""; + construct: function(t) { + return t !== null ? t : ""; } -}), fRt = new $p("tag:yaml.org,2002:seq", { +}), Tre = new hs("tag:yaml.org,2002:seq", { kind: "sequence", - construct: function(r) { - return r !== null ? r : []; + construct: function(t) { + return t !== null ? t : []; } -}), dRt = new $p("tag:yaml.org,2002:map", { +}), Cre = new hs("tag:yaml.org,2002:map", { kind: "mapping", - construct: function(r) { - return r !== null ? r : {}; + construct: function(t) { + return t !== null ? t : {}; } -}), pRt = new uRt({ +}), Ere = new kre({ explicit: [ - hRt, - fRt, - dRt + Sre, + Tre, + Cre ] }); -function RDn(r) { - if (r === null) +function fAe(t) { + if (t === null) return !0; - var n = r.length; - return n === 1 && r === "~" || n === 4 && (r === "null" || r === "Null" || r === "NULL"); + var e = t.length; + return e === 1 && t === "~" || e === 4 && (t === "null" || t === "Null" || t === "NULL"); } -function $Dn() { +function dAe() { return null; } -function BDn(r) { - return r === null; +function pAe(t) { + return t === null; } -var gRt = new $p("tag:yaml.org,2002:null", { +var _re = new hs("tag:yaml.org,2002:null", { kind: "scalar", - resolve: RDn, - construct: $Dn, - predicate: BDn, + resolve: fAe, + construct: dAe, + predicate: pAe, represent: { canonical: function() { return "~"; @@ -26695,126 +26704,126 @@ var gRt = new $p("tag:yaml.org,2002:null", { }, defaultStyle: "lowercase" }); -function FDn(r) { - if (r === null) +function gAe(t) { + if (t === null) return !1; - var n = r.length; - return n === 4 && (r === "true" || r === "True" || r === "TRUE") || n === 5 && (r === "false" || r === "False" || r === "FALSE"); + var e = t.length; + return e === 4 && (t === "true" || t === "True" || t === "TRUE") || e === 5 && (t === "false" || t === "False" || t === "FALSE"); } -function jDn(r) { - return r === "true" || r === "True" || r === "TRUE"; +function mAe(t) { + return t === "true" || t === "True" || t === "TRUE"; } -function QDn(r) { - return Object.prototype.toString.call(r) === "[object Boolean]"; +function vAe(t) { + return Object.prototype.toString.call(t) === "[object Boolean]"; } -var mRt = new $p("tag:yaml.org,2002:bool", { +var Are = new hs("tag:yaml.org,2002:bool", { kind: "scalar", - resolve: FDn, - construct: jDn, - predicate: QDn, + resolve: gAe, + construct: mAe, + predicate: vAe, represent: { - lowercase: function(r) { - return r ? "true" : "false"; + lowercase: function(t) { + return t ? "true" : "false"; }, - uppercase: function(r) { - return r ? "TRUE" : "FALSE"; + uppercase: function(t) { + return t ? "TRUE" : "FALSE"; }, - camelcase: function(r) { - return r ? "True" : "False"; + camelcase: function(t) { + return t ? "True" : "False"; } }, defaultStyle: "lowercase" }); -function zDn(r) { - return 48 <= r && r <= 57 || 65 <= r && r <= 70 || 97 <= r && r <= 102; +function yAe(t) { + return 48 <= t && t <= 57 || 65 <= t && t <= 70 || 97 <= t && t <= 102; } -function qDn(r) { - return 48 <= r && r <= 55; +function bAe(t) { + return 48 <= t && t <= 55; } -function VDn(r) { - return 48 <= r && r <= 57; +function xAe(t) { + return 48 <= t && t <= 57; } -function UDn(r) { - if (r === null) +function wAe(t) { + if (t === null) return !1; - var n = r.length, s = 0, a = !1, l; - if (!n) + var e = t.length, r = 0, n = !1, i; + if (!e) return !1; - if (l = r[s], (l === "-" || l === "+") && (l = r[++s]), l === "0") { - if (s + 1 === n) + if (i = t[r], (i === "-" || i === "+") && (i = t[++r]), i === "0") { + if (r + 1 === e) return !0; - if (l = r[++s], l === "b") { - for (s++; s < n; s++) - if (l = r[s], l !== "_") { - if (l !== "0" && l !== "1") + if (i = t[++r], i === "b") { + for (r++; r < e; r++) + if (i = t[r], i !== "_") { + if (i !== "0" && i !== "1") return !1; - a = !0; + n = !0; } - return a && l !== "_"; + return n && i !== "_"; } - if (l === "x") { - for (s++; s < n; s++) - if (l = r[s], l !== "_") { - if (!zDn(r.charCodeAt(s))) + if (i === "x") { + for (r++; r < e; r++) + if (i = t[r], i !== "_") { + if (!yAe(t.charCodeAt(r))) return !1; - a = !0; + n = !0; } - return a && l !== "_"; + return n && i !== "_"; } - if (l === "o") { - for (s++; s < n; s++) - if (l = r[s], l !== "_") { - if (!qDn(r.charCodeAt(s))) + if (i === "o") { + for (r++; r < e; r++) + if (i = t[r], i !== "_") { + if (!bAe(t.charCodeAt(r))) return !1; - a = !0; + n = !0; } - return a && l !== "_"; + return n && i !== "_"; } } - if (l === "_") + if (i === "_") return !1; - for (; s < n; s++) - if (l = r[s], l !== "_") { - if (!VDn(r.charCodeAt(s))) + for (; r < e; r++) + if (i = t[r], i !== "_") { + if (!xAe(t.charCodeAt(r))) return !1; - a = !0; + n = !0; } - return !(!a || l === "_"); + return !(!n || i === "_"); } -function WDn(r) { - var n = r, s = 1, a; - if (n.indexOf("_") !== -1 && (n = n.replace(/_/g, "")), a = n[0], (a === "-" || a === "+") && (a === "-" && (s = -1), n = n.slice(1), a = n[0]), n === "0") +function OAe(t) { + var e = t, r = 1, n; + if (e.indexOf("_") !== -1 && (e = e.replace(/_/g, "")), n = e[0], (n === "-" || n === "+") && (n === "-" && (r = -1), e = e.slice(1), n = e[0]), e === "0") return 0; - if (a === "0") { - if (n[1] === "b") - return s * parseInt(n.slice(2), 2); - if (n[1] === "x") - return s * parseInt(n.slice(2), 16); - if (n[1] === "o") - return s * parseInt(n.slice(2), 8); + if (n === "0") { + if (e[1] === "b") + return r * parseInt(e.slice(2), 2); + if (e[1] === "x") + return r * parseInt(e.slice(2), 16); + if (e[1] === "o") + return r * parseInt(e.slice(2), 8); } - return s * parseInt(n, 10); + return r * parseInt(e, 10); } -function YDn(r) { - return Object.prototype.toString.call(r) === "[object Number]" && r % 1 === 0 && !l0.isNegativeZero(r); +function kAe(t) { + return Object.prototype.toString.call(t) === "[object Number]" && t % 1 === 0 && !Ti.isNegativeZero(t); } -var bRt = new $p("tag:yaml.org,2002:int", { +var Lre = new hs("tag:yaml.org,2002:int", { kind: "scalar", - resolve: UDn, - construct: WDn, - predicate: YDn, + resolve: wAe, + construct: OAe, + predicate: kAe, represent: { - binary: function(r) { - return r >= 0 ? "0b" + r.toString(2) : "-0b" + r.toString(2).slice(1); + binary: function(t) { + return t >= 0 ? "0b" + t.toString(2) : "-0b" + t.toString(2).slice(1); }, - octal: function(r) { - return r >= 0 ? "0o" + r.toString(8) : "-0o" + r.toString(8).slice(1); + octal: function(t) { + return t >= 0 ? "0o" + t.toString(8) : "-0o" + t.toString(8).slice(1); }, - decimal: function(r) { - return r.toString(10); + decimal: function(t) { + return t.toString(10); }, - hexadecimal: function(r) { - return r >= 0 ? "0x" + r.toString(16).toUpperCase() : "-0x" + r.toString(16).toUpperCase().slice(1); + hexadecimal: function(t) { + return t >= 0 ? "0x" + t.toString(16).toUpperCase() : "-0x" + t.toString(16).toUpperCase().slice(1); } }, defaultStyle: "decimal", @@ -26824,21 +26833,21 @@ var bRt = new $p("tag:yaml.org,2002:int", { decimal: [10, "dec"], hexadecimal: [16, "hex"] } -}), HDn = new RegExp( +}), SAe = new RegExp( "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$" ); -function GDn(r) { - return !(r === null || !HDn.test(r) || r[r.length - 1] === "_"); +function TAe(t) { + return !(t === null || !SAe.test(t) || t[t.length - 1] === "_"); } -function ZDn(r) { - var n, s; - return n = r.replace(/_/g, "").toLowerCase(), s = n[0] === "-" ? -1 : 1, "+-".indexOf(n[0]) >= 0 && (n = n.slice(1)), n === ".inf" ? s === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : n === ".nan" ? NaN : s * parseFloat(n, 10); +function CAe(t) { + var e, r; + return e = t.replace(/_/g, "").toLowerCase(), r = e[0] === "-" ? -1 : 1, "+-".indexOf(e[0]) >= 0 && (e = e.slice(1)), e === ".inf" ? r === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : e === ".nan" ? NaN : r * parseFloat(e, 10); } -var XDn = /^[-+]?[0-9]+e/; -function KDn(r, n) { - var s; - if (isNaN(r)) - switch (n) { +var EAe = /^[-+]?[0-9]+e/; +function _Ae(t, e) { + var r; + if (isNaN(t)) + switch (e) { case "lowercase": return ".nan"; case "uppercase": @@ -26846,8 +26855,8 @@ function KDn(r, n) { case "camelcase": return ".NaN"; } - else if (Number.POSITIVE_INFINITY === r) - switch (n) { + else if (Number.POSITIVE_INFINITY === t) + switch (e) { case "lowercase": return ".inf"; case "uppercase": @@ -26855,8 +26864,8 @@ function KDn(r, n) { case "camelcase": return ".Inf"; } - else if (Number.NEGATIVE_INFINITY === r) - switch (n) { + else if (Number.NEGATIVE_INFINITY === t) + switch (e) { case "lowercase": return "-.inf"; case "uppercase": @@ -26864,634 +26873,634 @@ function KDn(r, n) { case "camelcase": return "-.Inf"; } - else if (l0.isNegativeZero(r)) + else if (Ti.isNegativeZero(t)) return "-0.0"; - return s = r.toString(10), XDn.test(s) ? s.replace("e", ".e") : s; + return r = t.toString(10), EAe.test(r) ? r.replace("e", ".e") : r; } -function JDn(r) { - return Object.prototype.toString.call(r) === "[object Number]" && (r % 1 !== 0 || l0.isNegativeZero(r)); +function AAe(t) { + return Object.prototype.toString.call(t) === "[object Number]" && (t % 1 !== 0 || Ti.isNegativeZero(t)); } -var vRt = new $p("tag:yaml.org,2002:float", { +var Rre = new hs("tag:yaml.org,2002:float", { kind: "scalar", - resolve: GDn, - construct: ZDn, - predicate: JDn, - represent: KDn, + resolve: TAe, + construct: CAe, + predicate: AAe, + represent: _Ae, defaultStyle: "lowercase" -}), wRt = pRt.extend({ +}), Mre = Ere.extend({ implicit: [ - gRt, - mRt, - bRt, - vRt + _re, + Are, + Lre, + Rre ] -}), yRt = wRt, ORt = new RegExp( +}), Dre = Mre, Nre = new RegExp( "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$" -), kRt = new RegExp( +), Ire = new RegExp( "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$" ); -function eMn(r) { - return r === null ? !1 : ORt.exec(r) !== null || kRt.exec(r) !== null; +function LAe(t) { + return t === null ? !1 : Nre.exec(t) !== null || Ire.exec(t) !== null; } -function tMn(r) { - var n, s, a, l, h, f, b, w = 0, O = null, S, E, D; - if (n = ORt.exec(r), n === null && (n = kRt.exec(r)), n === null) +function RAe(t) { + var e, r, n, i, s, a, o, l = 0, u = null, h, f, d; + if (e = Nre.exec(t), e === null && (e = Ire.exec(t)), e === null) throw new Error("Date resolve error"); - if (s = +n[1], a = +n[2] - 1, l = +n[3], !n[4]) - return new Date(Date.UTC(s, a, l)); - if (h = +n[4], f = +n[5], b = +n[6], n[7]) { - for (w = n[7].slice(0, 3); w.length < 3; ) - w += "0"; - w = +w; + if (r = +e[1], n = +e[2] - 1, i = +e[3], !e[4]) + return new Date(Date.UTC(r, n, i)); + if (s = +e[4], a = +e[5], o = +e[6], e[7]) { + for (l = e[7].slice(0, 3); l.length < 3; ) + l += "0"; + l = +l; } - return n[9] && (S = +n[10], E = +(n[11] || 0), O = (S * 60 + E) * 6e4, n[9] === "-" && (O = -O)), D = new Date(Date.UTC(s, a, l, h, f, b, w)), O && D.setTime(D.getTime() - O), D; + return e[9] && (h = +e[10], f = +(e[11] || 0), u = (h * 60 + f) * 6e4, e[9] === "-" && (u = -u)), d = new Date(Date.UTC(r, n, i, s, a, o, l)), u && d.setTime(d.getTime() - u), d; } -function nMn(r) { - return r.toISOString(); +function MAe(t) { + return t.toISOString(); } -var xRt = new $p("tag:yaml.org,2002:timestamp", { +var Pre = new hs("tag:yaml.org,2002:timestamp", { kind: "scalar", - resolve: eMn, - construct: tMn, + resolve: LAe, + construct: RAe, instanceOf: Date, - represent: nMn + represent: MAe }); -function rMn(r) { - return r === "<<" || r === null; +function DAe(t) { + return t === "<<" || t === null; } -var SRt = new $p("tag:yaml.org,2002:merge", { +var $re = new hs("tag:yaml.org,2002:merge", { kind: "scalar", - resolve: rMn -}), wqe = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= + resolve: DAe +}), YM = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= \r`; -function iMn(r) { - if (r === null) +function NAe(t) { + if (t === null) return !1; - var n, s, a = 0, l = r.length, h = wqe; - for (s = 0; s < l; s++) - if (n = h.indexOf(r.charAt(s)), !(n > 64)) { - if (n < 0) + var e, r, n = 0, i = t.length, s = YM; + for (r = 0; r < i; r++) + if (e = s.indexOf(t.charAt(r)), !(e > 64)) { + if (e < 0) return !1; - a += 6; + n += 6; } - return a % 8 === 0; + return n % 8 === 0; } -function sMn(r) { - var n, s, a = r.replace(/[\r\n=]/g, ""), l = a.length, h = wqe, f = 0, b = []; - for (n = 0; n < l; n++) - n % 4 === 0 && n && (b.push(f >> 16 & 255), b.push(f >> 8 & 255), b.push(f & 255)), f = f << 6 | h.indexOf(a.charAt(n)); - return s = l % 4 * 6, s === 0 ? (b.push(f >> 16 & 255), b.push(f >> 8 & 255), b.push(f & 255)) : s === 18 ? (b.push(f >> 10 & 255), b.push(f >> 2 & 255)) : s === 12 && b.push(f >> 4 & 255), new Uint8Array(b); +function IAe(t) { + var e, r, n = t.replace(/[\r\n=]/g, ""), i = n.length, s = YM, a = 0, o = []; + for (e = 0; e < i; e++) + e % 4 === 0 && e && (o.push(a >> 16 & 255), o.push(a >> 8 & 255), o.push(a & 255)), a = a << 6 | s.indexOf(n.charAt(e)); + return r = i % 4 * 6, r === 0 ? (o.push(a >> 16 & 255), o.push(a >> 8 & 255), o.push(a & 255)) : r === 18 ? (o.push(a >> 10 & 255), o.push(a >> 2 & 255)) : r === 12 && o.push(a >> 4 & 255), new Uint8Array(o); } -function oMn(r) { - var n = "", s = 0, a, l, h = r.length, f = wqe; - for (a = 0; a < h; a++) - a % 3 === 0 && a && (n += f[s >> 18 & 63], n += f[s >> 12 & 63], n += f[s >> 6 & 63], n += f[s & 63]), s = (s << 8) + r[a]; - return l = h % 3, l === 0 ? (n += f[s >> 18 & 63], n += f[s >> 12 & 63], n += f[s >> 6 & 63], n += f[s & 63]) : l === 2 ? (n += f[s >> 10 & 63], n += f[s >> 4 & 63], n += f[s << 2 & 63], n += f[64]) : l === 1 && (n += f[s >> 2 & 63], n += f[s << 4 & 63], n += f[64], n += f[64]), n; +function PAe(t) { + var e = "", r = 0, n, i, s = t.length, a = YM; + for (n = 0; n < s; n++) + n % 3 === 0 && n && (e += a[r >> 18 & 63], e += a[r >> 12 & 63], e += a[r >> 6 & 63], e += a[r & 63]), r = (r << 8) + t[n]; + return i = s % 3, i === 0 ? (e += a[r >> 18 & 63], e += a[r >> 12 & 63], e += a[r >> 6 & 63], e += a[r & 63]) : i === 2 ? (e += a[r >> 10 & 63], e += a[r >> 4 & 63], e += a[r << 2 & 63], e += a[64]) : i === 1 && (e += a[r >> 2 & 63], e += a[r << 4 & 63], e += a[64], e += a[64]), e; } -function aMn(r) { - return Object.prototype.toString.call(r) === "[object Uint8Array]"; +function $Ae(t) { + return Object.prototype.toString.call(t) === "[object Uint8Array]"; } -var _Rt = new $p("tag:yaml.org,2002:binary", { +var Bre = new hs("tag:yaml.org,2002:binary", { kind: "scalar", - resolve: iMn, - construct: sMn, - predicate: aMn, - represent: oMn -}), cMn = Object.prototype.hasOwnProperty, lMn = Object.prototype.toString; -function uMn(r) { - if (r === null) + resolve: NAe, + construct: IAe, + predicate: $Ae, + represent: PAe +}), BAe = Object.prototype.hasOwnProperty, FAe = Object.prototype.toString; +function zAe(t) { + if (t === null) return !0; - var n = [], s, a, l, h, f, b = r; - for (s = 0, a = b.length; s < a; s += 1) { - if (l = b[s], f = !1, lMn.call(l) !== "[object Object]") + var e = [], r, n, i, s, a, o = t; + for (r = 0, n = o.length; r < n; r += 1) { + if (i = o[r], a = !1, FAe.call(i) !== "[object Object]") return !1; - for (h in l) - if (cMn.call(l, h)) - if (!f) - f = !0; + for (s in i) + if (BAe.call(i, s)) + if (!a) + a = !0; else return !1; - if (!f) + if (!a) return !1; - if (n.indexOf(h) === -1) - n.push(h); + if (e.indexOf(s) === -1) + e.push(s); else return !1; } return !0; } -function hMn(r) { - return r !== null ? r : []; +function VAe(t) { + return t !== null ? t : []; } -var CRt = new $p("tag:yaml.org,2002:omap", { +var Fre = new hs("tag:yaml.org,2002:omap", { kind: "sequence", - resolve: uMn, - construct: hMn -}), fMn = Object.prototype.toString; -function dMn(r) { - if (r === null) + resolve: zAe, + construct: VAe +}), UAe = Object.prototype.toString; +function qAe(t) { + if (t === null) return !0; - var n, s, a, l, h, f = r; - for (h = new Array(f.length), n = 0, s = f.length; n < s; n += 1) { - if (a = f[n], fMn.call(a) !== "[object Object]" || (l = Object.keys(a), l.length !== 1)) + var e, r, n, i, s, a = t; + for (s = new Array(a.length), e = 0, r = a.length; e < r; e += 1) { + if (n = a[e], UAe.call(n) !== "[object Object]" || (i = Object.keys(n), i.length !== 1)) return !1; - h[n] = [l[0], a[l[0]]]; + s[e] = [i[0], n[i[0]]]; } return !0; } -function pMn(r) { - if (r === null) +function QAe(t) { + if (t === null) return []; - var n, s, a, l, h, f = r; - for (h = new Array(f.length), n = 0, s = f.length; n < s; n += 1) - a = f[n], l = Object.keys(a), h[n] = [l[0], a[l[0]]]; - return h; + var e, r, n, i, s, a = t; + for (s = new Array(a.length), e = 0, r = a.length; e < r; e += 1) + n = a[e], i = Object.keys(n), s[e] = [i[0], n[i[0]]]; + return s; } -var ERt = new $p("tag:yaml.org,2002:pairs", { +var zre = new hs("tag:yaml.org,2002:pairs", { kind: "sequence", - resolve: dMn, - construct: pMn -}), gMn = Object.prototype.hasOwnProperty; -function mMn(r) { - if (r === null) + resolve: qAe, + construct: QAe +}), YAe = Object.prototype.hasOwnProperty; +function WAe(t) { + if (t === null) return !0; - var n, s = r; - for (n in s) - if (gMn.call(s, n) && s[n] !== null) + var e, r = t; + for (e in r) + if (YAe.call(r, e) && r[e] !== null) return !1; return !0; } -function bMn(r) { - return r !== null ? r : {}; +function GAe(t) { + return t !== null ? t : {}; } -var TRt = new $p("tag:yaml.org,2002:set", { +var Vre = new hs("tag:yaml.org,2002:set", { kind: "mapping", - resolve: mMn, - construct: bMn -}), yqe = yRt.extend({ + resolve: WAe, + construct: GAe +}), WM = Dre.extend({ implicit: [ - xRt, - SRt + Pre, + $re ], explicit: [ - _Rt, - CRt, - ERt, - TRt + Bre, + Fre, + zre, + Vre ] -}), k8 = Object.prototype.hasOwnProperty, Cve = 1, ARt = 2, DRt = 3, Eve = 4, u$e = 1, vMn = 2, kTt = 3, wMn = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, yMn = /[\x85\u2028\u2029]/, OMn = /[,\[\]\{\}]/, MRt = /^(?:!|!!|![a-z\-]+!)$/i, PRt = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; -function xTt(r) { - return Object.prototype.toString.call(r); +}), pf = Object.prototype.hasOwnProperty, r3 = 1, Ure = 2, qre = 3, n3 = 4, s6 = 1, HAe = 2, jz = 3, XAe = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, ZAe = /[\x85\u2028\u2029]/, jAe = /[,\[\]\{\}]/, Qre = /^(?:!|!!|![a-z\-]+!)$/i, Yre = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; +function Kz(t) { + return Object.prototype.toString.call(t); } -function ix(r) { - return r === 10 || r === 13; +function Rc(t) { + return t === 10 || t === 13; } -function XM(r) { - return r === 9 || r === 32; +function qd(t) { + return t === 9 || t === 32; } -function ov(r) { - return r === 9 || r === 32 || r === 10 || r === 13; +function Da(t) { + return t === 9 || t === 32 || t === 10 || t === 13; } -function wB(r) { - return r === 44 || r === 91 || r === 93 || r === 123 || r === 125; +function Mp(t) { + return t === 44 || t === 91 || t === 93 || t === 123 || t === 125; } -function kMn(r) { - var n; - return 48 <= r && r <= 57 ? r - 48 : (n = r | 32, 97 <= n && n <= 102 ? n - 97 + 10 : -1); +function KAe(t) { + var e; + return 48 <= t && t <= 57 ? t - 48 : (e = t | 32, 97 <= e && e <= 102 ? e - 97 + 10 : -1); } -function xMn(r) { - return r === 120 ? 2 : r === 117 ? 4 : r === 85 ? 8 : 0; +function JAe(t) { + return t === 120 ? 2 : t === 117 ? 4 : t === 85 ? 8 : 0; } -function SMn(r) { - return 48 <= r && r <= 57 ? r - 48 : -1; +function e7e(t) { + return 48 <= t && t <= 57 ? t - 48 : -1; } -function STt(r) { - return r === 48 ? "\0" : r === 97 ? "\x07" : r === 98 ? "\b" : r === 116 || r === 9 ? " " : r === 110 ? ` -` : r === 118 ? "\v" : r === 102 ? "\f" : r === 114 ? "\r" : r === 101 ? "\x1B" : r === 32 ? " " : r === 34 ? '"' : r === 47 ? "/" : r === 92 ? "\\" : r === 78 ? "\x85" : r === 95 ? "\xA0" : r === 76 ? "\u2028" : r === 80 ? "\u2029" : ""; +function Jz(t) { + return t === 48 ? "\0" : t === 97 ? "\x07" : t === 98 ? "\b" : t === 116 || t === 9 ? " " : t === 110 ? ` +` : t === 118 ? "\v" : t === 102 ? "\f" : t === 114 ? "\r" : t === 101 ? "\x1B" : t === 32 ? " " : t === 34 ? '"' : t === 47 ? "/" : t === 92 ? "\\" : t === 78 ? "\x85" : t === 95 ? "\xA0" : t === 76 ? "\u2028" : t === 80 ? "\u2029" : ""; } -function _Mn(r) { - return r <= 65535 ? String.fromCharCode(r) : String.fromCharCode( - (r - 65536 >> 10) + 55296, - (r - 65536 & 1023) + 56320 +function t7e(t) { + return t <= 65535 ? String.fromCharCode(t) : String.fromCharCode( + (t - 65536 >> 10) + 55296, + (t - 65536 & 1023) + 56320 ); } -var LRt = new Array(256), IRt = new Array(256); -for (var sB = 0; sB < 256; sB++) - LRt[sB] = STt(sB) ? 1 : 0, IRt[sB] = STt(sB); -function CMn(r, n) { - this.input = r, this.filename = n.filename || null, this.schema = n.schema || yqe, this.onWarning = n.onWarning || null, this.legacy = n.legacy || !1, this.json = n.json || !1, this.listener = n.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = r.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = []; +var Wre = new Array(256), Gre = new Array(256); +for (var lp = 0; lp < 256; lp++) + Wre[lp] = Jz(lp) ? 1 : 0, Gre[lp] = Jz(lp); +function r7e(t, e) { + this.input = t, this.filename = e.filename || null, this.schema = e.schema || WM, this.onWarning = e.onWarning || null, this.legacy = e.legacy || !1, this.json = e.json || !1, this.listener = e.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = t.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = []; } -function NRt(r, n) { - var s = { - name: r.filename, - buffer: r.input.slice(0, -1), - position: r.position, - line: r.line, - column: r.position - r.lineStart +function Hre(t, e) { + var r = { + name: t.filename, + buffer: t.input.slice(0, -1), + position: t.position, + line: t.line, + column: t.position - t.lineStart }; - return s.snippet = DDn(s), new Am(n, s); + return r.snippet = aAe(r), new ea(e, r); } -function ho(r, n) { - throw NRt(r, n); +function Ut(t, e) { + throw Hre(t, e); } -function Tve(r, n) { - r.onWarning && r.onWarning.call(null, NRt(r, n)); +function i3(t, e) { + t.onWarning && t.onWarning.call(null, Hre(t, e)); } -var _Tt = { - YAML: function(n, s, a) { - var l, h, f; - n.version !== null && ho(n, "duplication of %YAML directive"), a.length !== 1 && ho(n, "YAML directive accepts exactly one argument"), l = /^([0-9]+)\.([0-9]+)$/.exec(a[0]), l === null && ho(n, "ill-formed argument of the YAML directive"), h = parseInt(l[1], 10), f = parseInt(l[2], 10), h !== 1 && ho(n, "unacceptable YAML version of the document"), n.version = a[0], n.checkLineBreaks = f < 2, f !== 1 && f !== 2 && Tve(n, "unsupported YAML version of the document"); +var eV = { + YAML: function(e, r, n) { + var i, s, a; + e.version !== null && Ut(e, "duplication of %YAML directive"), n.length !== 1 && Ut(e, "YAML directive accepts exactly one argument"), i = /^([0-9]+)\.([0-9]+)$/.exec(n[0]), i === null && Ut(e, "ill-formed argument of the YAML directive"), s = parseInt(i[1], 10), a = parseInt(i[2], 10), s !== 1 && Ut(e, "unacceptable YAML version of the document"), e.version = n[0], e.checkLineBreaks = a < 2, a !== 1 && a !== 2 && i3(e, "unsupported YAML version of the document"); }, - TAG: function(n, s, a) { - var l, h; - a.length !== 2 && ho(n, "TAG directive accepts exactly two arguments"), l = a[0], h = a[1], MRt.test(l) || ho(n, "ill-formed tag handle (first argument) of the TAG directive"), k8.call(n.tagMap, l) && ho(n, 'there is a previously declared suffix for "' + l + '" tag handle'), PRt.test(h) || ho(n, "ill-formed tag prefix (second argument) of the TAG directive"); + TAG: function(e, r, n) { + var i, s; + n.length !== 2 && Ut(e, "TAG directive accepts exactly two arguments"), i = n[0], s = n[1], Qre.test(i) || Ut(e, "ill-formed tag handle (first argument) of the TAG directive"), pf.call(e.tagMap, i) && Ut(e, 'there is a previously declared suffix for "' + i + '" tag handle'), Yre.test(s) || Ut(e, "ill-formed tag prefix (second argument) of the TAG directive"); try { - h = decodeURIComponent(h); + s = decodeURIComponent(s); } catch { - ho(n, "tag prefix is malformed: " + h); + Ut(e, "tag prefix is malformed: " + s); } - n.tagMap[l] = h; + e.tagMap[i] = s; } }; -function s8(r, n, s, a) { - var l, h, f, b; - if (n < s) { - if (b = r.input.slice(n, s), a) - for (l = 0, h = b.length; l < h; l += 1) - f = b.charCodeAt(l), f === 9 || 32 <= f && f <= 1114111 || ho(r, "expected valid JSON character"); +function Xh(t, e, r, n) { + var i, s, a, o; + if (e < r) { + if (o = t.input.slice(e, r), n) + for (i = 0, s = o.length; i < s; i += 1) + a = o.charCodeAt(i), a === 9 || 32 <= a && a <= 1114111 || Ut(t, "expected valid JSON character"); else - wMn.test(b) && ho(r, "the stream contains non-printable characters"); - r.result += b; - } -} -function CTt(r, n, s, a) { - var l, h, f, b; - for (l0.isObject(s) || ho(r, "cannot merge mappings; the provided source object is unacceptable"), l = Object.keys(s), f = 0, b = l.length; f < b; f += 1) - h = l[f], k8.call(n, h) || (n[h] = s[h], a[h] = !0); -} -function yB(r, n, s, a, l, h, f, b, w) { - var O, S; - if (Array.isArray(l)) - for (l = Array.prototype.slice.call(l), O = 0, S = l.length; O < S; O += 1) - Array.isArray(l[O]) && ho(r, "nested arrays are not supported inside keys"), typeof l == "object" && xTt(l[O]) === "[object Object]" && (l[O] = "[object Object]"); - if (typeof l == "object" && xTt(l) === "[object Object]" && (l = "[object Object]"), l = String(l), n === null && (n = {}), a === "tag:yaml.org,2002:merge") - if (Array.isArray(h)) - for (O = 0, S = h.length; O < S; O += 1) - CTt(r, n, h[O], s); + XAe.test(o) && Ut(t, "the stream contains non-printable characters"); + t.result += o; + } +} +function tV(t, e, r, n) { + var i, s, a, o; + for (Ti.isObject(r) || Ut(t, "cannot merge mappings; the provided source object is unacceptable"), i = Object.keys(r), a = 0, o = i.length; a < o; a += 1) + s = i[a], pf.call(e, s) || (e[s] = r[s], n[s] = !0); +} +function Dp(t, e, r, n, i, s, a, o, l) { + var u, h; + if (Array.isArray(i)) + for (i = Array.prototype.slice.call(i), u = 0, h = i.length; u < h; u += 1) + Array.isArray(i[u]) && Ut(t, "nested arrays are not supported inside keys"), typeof i == "object" && Kz(i[u]) === "[object Object]" && (i[u] = "[object Object]"); + if (typeof i == "object" && Kz(i) === "[object Object]" && (i = "[object Object]"), i = String(i), e === null && (e = {}), n === "tag:yaml.org,2002:merge") + if (Array.isArray(s)) + for (u = 0, h = s.length; u < h; u += 1) + tV(t, e, s[u], r); else - CTt(r, n, h, s); + tV(t, e, s, r); else - !r.json && !k8.call(s, l) && k8.call(n, l) && (r.line = f || r.line, r.lineStart = b || r.lineStart, r.position = w || r.position, ho(r, "duplicated mapping key")), l === "__proto__" ? Object.defineProperty(n, l, { + !t.json && !pf.call(r, i) && pf.call(e, i) && (t.line = a || t.line, t.lineStart = o || t.lineStart, t.position = l || t.position, Ut(t, "duplicated mapping key")), i === "__proto__" ? Object.defineProperty(e, i, { configurable: !0, enumerable: !0, writable: !0, - value: h - }) : n[l] = h, delete s[l]; - return n; -} -function Oqe(r) { - var n; - n = r.input.charCodeAt(r.position), n === 10 ? r.position++ : n === 13 ? (r.position++, r.input.charCodeAt(r.position) === 10 && r.position++) : ho(r, "a line break is expected"), r.line += 1, r.lineStart = r.position, r.firstTabInLine = -1; -} -function m1(r, n, s) { - for (var a = 0, l = r.input.charCodeAt(r.position); l !== 0; ) { - for (; XM(l); ) - l === 9 && r.firstTabInLine === -1 && (r.firstTabInLine = r.position), l = r.input.charCodeAt(++r.position); - if (n && l === 35) + value: s + }) : e[i] = s, delete r[i]; + return e; +} +function GM(t) { + var e; + e = t.input.charCodeAt(t.position), e === 10 ? t.position++ : e === 13 ? (t.position++, t.input.charCodeAt(t.position) === 10 && t.position++) : Ut(t, "a line break is expected"), t.line += 1, t.lineStart = t.position, t.firstTabInLine = -1; +} +function hi(t, e, r) { + for (var n = 0, i = t.input.charCodeAt(t.position); i !== 0; ) { + for (; qd(i); ) + i === 9 && t.firstTabInLine === -1 && (t.firstTabInLine = t.position), i = t.input.charCodeAt(++t.position); + if (e && i === 35) do - l = r.input.charCodeAt(++r.position); - while (l !== 10 && l !== 13 && l !== 0); - if (ix(l)) - for (Oqe(r), l = r.input.charCodeAt(r.position), a++, r.lineIndent = 0; l === 32; ) - r.lineIndent++, l = r.input.charCodeAt(++r.position); + i = t.input.charCodeAt(++t.position); + while (i !== 10 && i !== 13 && i !== 0); + if (Rc(i)) + for (GM(t), i = t.input.charCodeAt(t.position), n++, t.lineIndent = 0; i === 32; ) + t.lineIndent++, i = t.input.charCodeAt(++t.position); else break; } - return s !== -1 && a !== 0 && r.lineIndent < s && Tve(r, "deficient indentation"), a; + return r !== -1 && n !== 0 && t.lineIndent < r && i3(t, "deficient indentation"), n; } -function ywe(r) { - var n = r.position, s; - return s = r.input.charCodeAt(n), !!((s === 45 || s === 46) && s === r.input.charCodeAt(n + 1) && s === r.input.charCodeAt(n + 2) && (n += 3, s = r.input.charCodeAt(n), s === 0 || ov(s))); +function sT(t) { + var e = t.position, r; + return r = t.input.charCodeAt(e), !!((r === 45 || r === 46) && r === t.input.charCodeAt(e + 1) && r === t.input.charCodeAt(e + 2) && (e += 3, r = t.input.charCodeAt(e), r === 0 || Da(r))); } -function kqe(r, n) { - n === 1 ? r.result += " " : n > 1 && (r.result += l0.repeat(` -`, n - 1)); +function HM(t, e) { + e === 1 ? t.result += " " : e > 1 && (t.result += Ti.repeat(` +`, e - 1)); } -function EMn(r, n, s) { - var a, l, h, f, b, w, O, S, E = r.kind, D = r.result, M; - if (M = r.input.charCodeAt(r.position), ov(M) || wB(M) || M === 35 || M === 38 || M === 42 || M === 33 || M === 124 || M === 62 || M === 39 || M === 34 || M === 37 || M === 64 || M === 96 || (M === 63 || M === 45) && (l = r.input.charCodeAt(r.position + 1), ov(l) || s && wB(l))) +function n7e(t, e, r) { + var n, i, s, a, o, l, u, h, f = t.kind, d = t.result, p; + if (p = t.input.charCodeAt(t.position), Da(p) || Mp(p) || p === 35 || p === 38 || p === 42 || p === 33 || p === 124 || p === 62 || p === 39 || p === 34 || p === 37 || p === 64 || p === 96 || (p === 63 || p === 45) && (i = t.input.charCodeAt(t.position + 1), Da(i) || r && Mp(i))) return !1; - for (r.kind = "scalar", r.result = "", h = f = r.position, b = !1; M !== 0; ) { - if (M === 58) { - if (l = r.input.charCodeAt(r.position + 1), ov(l) || s && wB(l)) + for (t.kind = "scalar", t.result = "", s = a = t.position, o = !1; p !== 0; ) { + if (p === 58) { + if (i = t.input.charCodeAt(t.position + 1), Da(i) || r && Mp(i)) break; - } else if (M === 35) { - if (a = r.input.charCodeAt(r.position - 1), ov(a)) + } else if (p === 35) { + if (n = t.input.charCodeAt(t.position - 1), Da(n)) break; } else { - if (r.position === r.lineStart && ywe(r) || s && wB(M)) + if (t.position === t.lineStart && sT(t) || r && Mp(p)) break; - if (ix(M)) - if (w = r.line, O = r.lineStart, S = r.lineIndent, m1(r, !1, -1), r.lineIndent >= n) { - b = !0, M = r.input.charCodeAt(r.position); + if (Rc(p)) + if (l = t.line, u = t.lineStart, h = t.lineIndent, hi(t, !1, -1), t.lineIndent >= e) { + o = !0, p = t.input.charCodeAt(t.position); continue; } else { - r.position = f, r.line = w, r.lineStart = O, r.lineIndent = S; + t.position = a, t.line = l, t.lineStart = u, t.lineIndent = h; break; } } - b && (s8(r, h, f, !1), kqe(r, r.line - w), h = f = r.position, b = !1), XM(M) || (f = r.position + 1), M = r.input.charCodeAt(++r.position); + o && (Xh(t, s, a, !1), HM(t, t.line - l), s = a = t.position, o = !1), qd(p) || (a = t.position + 1), p = t.input.charCodeAt(++t.position); } - return s8(r, h, f, !1), r.result ? !0 : (r.kind = E, r.result = D, !1); + return Xh(t, s, a, !1), t.result ? !0 : (t.kind = f, t.result = d, !1); } -function TMn(r, n) { - var s, a, l; - if (s = r.input.charCodeAt(r.position), s !== 39) +function i7e(t, e) { + var r, n, i; + if (r = t.input.charCodeAt(t.position), r !== 39) return !1; - for (r.kind = "scalar", r.result = "", r.position++, a = l = r.position; (s = r.input.charCodeAt(r.position)) !== 0; ) - if (s === 39) - if (s8(r, a, r.position, !0), s = r.input.charCodeAt(++r.position), s === 39) - a = r.position, r.position++, l = r.position; + for (t.kind = "scalar", t.result = "", t.position++, n = i = t.position; (r = t.input.charCodeAt(t.position)) !== 0; ) + if (r === 39) + if (Xh(t, n, t.position, !0), r = t.input.charCodeAt(++t.position), r === 39) + n = t.position, t.position++, i = t.position; else return !0; else - ix(s) ? (s8(r, a, l, !0), kqe(r, m1(r, !1, n)), a = l = r.position) : r.position === r.lineStart && ywe(r) ? ho(r, "unexpected end of the document within a single quoted scalar") : (r.position++, l = r.position); - ho(r, "unexpected end of the stream within a single quoted scalar"); + Rc(r) ? (Xh(t, n, i, !0), HM(t, hi(t, !1, e)), n = i = t.position) : t.position === t.lineStart && sT(t) ? Ut(t, "unexpected end of the document within a single quoted scalar") : (t.position++, i = t.position); + Ut(t, "unexpected end of the stream within a single quoted scalar"); } -function AMn(r, n) { - var s, a, l, h, f, b; - if (b = r.input.charCodeAt(r.position), b !== 34) +function s7e(t, e) { + var r, n, i, s, a, o; + if (o = t.input.charCodeAt(t.position), o !== 34) return !1; - for (r.kind = "scalar", r.result = "", r.position++, s = a = r.position; (b = r.input.charCodeAt(r.position)) !== 0; ) { - if (b === 34) - return s8(r, s, r.position, !0), r.position++, !0; - if (b === 92) { - if (s8(r, s, r.position, !0), b = r.input.charCodeAt(++r.position), ix(b)) - m1(r, !1, n); - else if (b < 256 && LRt[b]) - r.result += IRt[b], r.position++; - else if ((f = xMn(b)) > 0) { - for (l = f, h = 0; l > 0; l--) - b = r.input.charCodeAt(++r.position), (f = kMn(b)) >= 0 ? h = (h << 4) + f : ho(r, "expected hexadecimal character"); - r.result += _Mn(h), r.position++; + for (t.kind = "scalar", t.result = "", t.position++, r = n = t.position; (o = t.input.charCodeAt(t.position)) !== 0; ) { + if (o === 34) + return Xh(t, r, t.position, !0), t.position++, !0; + if (o === 92) { + if (Xh(t, r, t.position, !0), o = t.input.charCodeAt(++t.position), Rc(o)) + hi(t, !1, e); + else if (o < 256 && Wre[o]) + t.result += Gre[o], t.position++; + else if ((a = JAe(o)) > 0) { + for (i = a, s = 0; i > 0; i--) + o = t.input.charCodeAt(++t.position), (a = KAe(o)) >= 0 ? s = (s << 4) + a : Ut(t, "expected hexadecimal character"); + t.result += t7e(s), t.position++; } else - ho(r, "unknown escape sequence"); - s = a = r.position; + Ut(t, "unknown escape sequence"); + r = n = t.position; } else - ix(b) ? (s8(r, s, a, !0), kqe(r, m1(r, !1, n)), s = a = r.position) : r.position === r.lineStart && ywe(r) ? ho(r, "unexpected end of the document within a double quoted scalar") : (r.position++, a = r.position); + Rc(o) ? (Xh(t, r, n, !0), HM(t, hi(t, !1, e)), r = n = t.position) : t.position === t.lineStart && sT(t) ? Ut(t, "unexpected end of the document within a double quoted scalar") : (t.position++, n = t.position); } - ho(r, "unexpected end of the stream within a double quoted scalar"); + Ut(t, "unexpected end of the stream within a double quoted scalar"); } -function DMn(r, n) { - var s = !0, a, l, h, f = r.tag, b, w = r.anchor, O, S, E, D, M, B = /* @__PURE__ */ Object.create(null), z, W, H, G; - if (G = r.input.charCodeAt(r.position), G === 91) - S = 93, M = !1, b = []; - else if (G === 123) - S = 125, M = !0, b = {}; +function a7e(t, e) { + var r = !0, n, i, s, a = t.tag, o, l = t.anchor, u, h, f, d, p, g = /* @__PURE__ */ Object.create(null), m, v, y, b; + if (b = t.input.charCodeAt(t.position), b === 91) + h = 93, p = !1, o = []; + else if (b === 123) + h = 125, p = !0, o = {}; else return !1; - for (r.anchor !== null && (r.anchorMap[r.anchor] = b), G = r.input.charCodeAt(++r.position); G !== 0; ) { - if (m1(r, !0, n), G = r.input.charCodeAt(r.position), G === S) - return r.position++, r.tag = f, r.anchor = w, r.kind = M ? "mapping" : "sequence", r.result = b, !0; - s ? G === 44 && ho(r, "expected the node content, but found ','") : ho(r, "missed comma between flow collection entries"), W = z = H = null, E = D = !1, G === 63 && (O = r.input.charCodeAt(r.position + 1), ov(O) && (E = D = !0, r.position++, m1(r, !0, n))), a = r.line, l = r.lineStart, h = r.position, wF(r, n, Cve, !1, !0), W = r.tag, z = r.result, m1(r, !0, n), G = r.input.charCodeAt(r.position), (D || r.line === a) && G === 58 && (E = !0, G = r.input.charCodeAt(++r.position), m1(r, !0, n), wF(r, n, Cve, !1, !0), H = r.result), M ? yB(r, b, B, W, z, H, a, l, h) : E ? b.push(yB(r, null, B, W, z, H, a, l, h)) : b.push(z), m1(r, !0, n), G = r.input.charCodeAt(r.position), G === 44 ? (s = !0, G = r.input.charCodeAt(++r.position)) : s = !1; - } - ho(r, "unexpected end of the stream within a flow collection"); -} -function MMn(r, n) { - var s, a, l = u$e, h = !1, f = !1, b = n, w = 0, O = !1, S, E; - if (E = r.input.charCodeAt(r.position), E === 124) - a = !1; - else if (E === 62) - a = !0; + for (t.anchor !== null && (t.anchorMap[t.anchor] = o), b = t.input.charCodeAt(++t.position); b !== 0; ) { + if (hi(t, !0, e), b = t.input.charCodeAt(t.position), b === h) + return t.position++, t.tag = a, t.anchor = l, t.kind = p ? "mapping" : "sequence", t.result = o, !0; + r ? b === 44 && Ut(t, "expected the node content, but found ','") : Ut(t, "missed comma between flow collection entries"), v = m = y = null, f = d = !1, b === 63 && (u = t.input.charCodeAt(t.position + 1), Da(u) && (f = d = !0, t.position++, hi(t, !0, e))), n = t.line, i = t.lineStart, s = t.position, Vg(t, e, r3, !1, !0), v = t.tag, m = t.result, hi(t, !0, e), b = t.input.charCodeAt(t.position), (d || t.line === n) && b === 58 && (f = !0, b = t.input.charCodeAt(++t.position), hi(t, !0, e), Vg(t, e, r3, !1, !0), y = t.result), p ? Dp(t, o, g, v, m, y, n, i, s) : f ? o.push(Dp(t, null, g, v, m, y, n, i, s)) : o.push(m), hi(t, !0, e), b = t.input.charCodeAt(t.position), b === 44 ? (r = !0, b = t.input.charCodeAt(++t.position)) : r = !1; + } + Ut(t, "unexpected end of the stream within a flow collection"); +} +function o7e(t, e) { + var r, n, i = s6, s = !1, a = !1, o = e, l = 0, u = !1, h, f; + if (f = t.input.charCodeAt(t.position), f === 124) + n = !1; + else if (f === 62) + n = !0; else return !1; - for (r.kind = "scalar", r.result = ""; E !== 0; ) - if (E = r.input.charCodeAt(++r.position), E === 43 || E === 45) - u$e === l ? l = E === 43 ? kTt : vMn : ho(r, "repeat of a chomping mode identifier"); - else if ((S = SMn(E)) >= 0) - S === 0 ? ho(r, "bad explicit indentation width of a block scalar; it cannot be less than one") : f ? ho(r, "repeat of an indentation width identifier") : (b = n + S - 1, f = !0); + for (t.kind = "scalar", t.result = ""; f !== 0; ) + if (f = t.input.charCodeAt(++t.position), f === 43 || f === 45) + s6 === i ? i = f === 43 ? jz : HAe : Ut(t, "repeat of a chomping mode identifier"); + else if ((h = e7e(f)) >= 0) + h === 0 ? Ut(t, "bad explicit indentation width of a block scalar; it cannot be less than one") : a ? Ut(t, "repeat of an indentation width identifier") : (o = e + h - 1, a = !0); else break; - if (XM(E)) { + if (qd(f)) { do - E = r.input.charCodeAt(++r.position); - while (XM(E)); - if (E === 35) + f = t.input.charCodeAt(++t.position); + while (qd(f)); + if (f === 35) do - E = r.input.charCodeAt(++r.position); - while (!ix(E) && E !== 0); - } - for (; E !== 0; ) { - for (Oqe(r), r.lineIndent = 0, E = r.input.charCodeAt(r.position); (!f || r.lineIndent < b) && E === 32; ) - r.lineIndent++, E = r.input.charCodeAt(++r.position); - if (!f && r.lineIndent > b && (b = r.lineIndent), ix(E)) { - w++; + f = t.input.charCodeAt(++t.position); + while (!Rc(f) && f !== 0); + } + for (; f !== 0; ) { + for (GM(t), t.lineIndent = 0, f = t.input.charCodeAt(t.position); (!a || t.lineIndent < o) && f === 32; ) + t.lineIndent++, f = t.input.charCodeAt(++t.position); + if (!a && t.lineIndent > o && (o = t.lineIndent), Rc(f)) { + l++; continue; } - if (r.lineIndent < b) { - l === kTt ? r.result += l0.repeat(` -`, h ? 1 + w : w) : l === u$e && h && (r.result += ` + if (t.lineIndent < o) { + i === jz ? t.result += Ti.repeat(` +`, s ? 1 + l : l) : i === s6 && s && (t.result += ` `); break; } - for (a ? XM(E) ? (O = !0, r.result += l0.repeat(` -`, h ? 1 + w : w)) : O ? (O = !1, r.result += l0.repeat(` -`, w + 1)) : w === 0 ? h && (r.result += " ") : r.result += l0.repeat(` -`, w) : r.result += l0.repeat(` -`, h ? 1 + w : w), h = !0, f = !0, w = 0, s = r.position; !ix(E) && E !== 0; ) - E = r.input.charCodeAt(++r.position); - s8(r, s, r.position, !1); + for (n ? qd(f) ? (u = !0, t.result += Ti.repeat(` +`, s ? 1 + l : l)) : u ? (u = !1, t.result += Ti.repeat(` +`, l + 1)) : l === 0 ? s && (t.result += " ") : t.result += Ti.repeat(` +`, l) : t.result += Ti.repeat(` +`, s ? 1 + l : l), s = !0, a = !0, l = 0, r = t.position; !Rc(f) && f !== 0; ) + f = t.input.charCodeAt(++t.position); + Xh(t, r, t.position, !1); } return !0; } -function ETt(r, n) { - var s, a = r.tag, l = r.anchor, h = [], f, b = !1, w; - if (r.firstTabInLine !== -1) +function rV(t, e) { + var r, n = t.tag, i = t.anchor, s = [], a, o = !1, l; + if (t.firstTabInLine !== -1) return !1; - for (r.anchor !== null && (r.anchorMap[r.anchor] = h), w = r.input.charCodeAt(r.position); w !== 0 && (r.firstTabInLine !== -1 && (r.position = r.firstTabInLine, ho(r, "tab characters must not be used in indentation")), !(w !== 45 || (f = r.input.charCodeAt(r.position + 1), !ov(f)))); ) { - if (b = !0, r.position++, m1(r, !0, -1) && r.lineIndent <= n) { - h.push(null), w = r.input.charCodeAt(r.position); + for (t.anchor !== null && (t.anchorMap[t.anchor] = s), l = t.input.charCodeAt(t.position); l !== 0 && (t.firstTabInLine !== -1 && (t.position = t.firstTabInLine, Ut(t, "tab characters must not be used in indentation")), !(l !== 45 || (a = t.input.charCodeAt(t.position + 1), !Da(a)))); ) { + if (o = !0, t.position++, hi(t, !0, -1) && t.lineIndent <= e) { + s.push(null), l = t.input.charCodeAt(t.position); continue; } - if (s = r.line, wF(r, n, DRt, !1, !0), h.push(r.result), m1(r, !0, -1), w = r.input.charCodeAt(r.position), (r.line === s || r.lineIndent > n) && w !== 0) - ho(r, "bad indentation of a sequence entry"); - else if (r.lineIndent < n) + if (r = t.line, Vg(t, e, qre, !1, !0), s.push(t.result), hi(t, !0, -1), l = t.input.charCodeAt(t.position), (t.line === r || t.lineIndent > e) && l !== 0) + Ut(t, "bad indentation of a sequence entry"); + else if (t.lineIndent < e) break; } - return b ? (r.tag = a, r.anchor = l, r.kind = "sequence", r.result = h, !0) : !1; + return o ? (t.tag = n, t.anchor = i, t.kind = "sequence", t.result = s, !0) : !1; } -function PMn(r, n, s) { - var a, l, h, f, b, w, O = r.tag, S = r.anchor, E = {}, D = /* @__PURE__ */ Object.create(null), M = null, B = null, z = null, W = !1, H = !1, G; - if (r.firstTabInLine !== -1) +function l7e(t, e, r) { + var n, i, s, a, o, l, u = t.tag, h = t.anchor, f = {}, d = /* @__PURE__ */ Object.create(null), p = null, g = null, m = null, v = !1, y = !1, b; + if (t.firstTabInLine !== -1) return !1; - for (r.anchor !== null && (r.anchorMap[r.anchor] = E), G = r.input.charCodeAt(r.position); G !== 0; ) { - if (!W && r.firstTabInLine !== -1 && (r.position = r.firstTabInLine, ho(r, "tab characters must not be used in indentation")), a = r.input.charCodeAt(r.position + 1), h = r.line, (G === 63 || G === 58) && ov(a)) - G === 63 ? (W && (yB(r, E, D, M, B, null, f, b, w), M = B = z = null), H = !0, W = !0, l = !0) : W ? (W = !1, l = !0) : ho(r, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), r.position += 1, G = a; + for (t.anchor !== null && (t.anchorMap[t.anchor] = f), b = t.input.charCodeAt(t.position); b !== 0; ) { + if (!v && t.firstTabInLine !== -1 && (t.position = t.firstTabInLine, Ut(t, "tab characters must not be used in indentation")), n = t.input.charCodeAt(t.position + 1), s = t.line, (b === 63 || b === 58) && Da(n)) + b === 63 ? (v && (Dp(t, f, d, p, g, null, a, o, l), p = g = m = null), y = !0, v = !0, i = !0) : v ? (v = !1, i = !0) : Ut(t, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), t.position += 1, b = n; else { - if (f = r.line, b = r.lineStart, w = r.position, !wF(r, s, ARt, !1, !0)) + if (a = t.line, o = t.lineStart, l = t.position, !Vg(t, r, Ure, !1, !0)) break; - if (r.line === h) { - for (G = r.input.charCodeAt(r.position); XM(G); ) - G = r.input.charCodeAt(++r.position); - if (G === 58) - G = r.input.charCodeAt(++r.position), ov(G) || ho(r, "a whitespace character is expected after the key-value separator within a block mapping"), W && (yB(r, E, D, M, B, null, f, b, w), M = B = z = null), H = !0, W = !1, l = !1, M = r.tag, B = r.result; - else if (H) - ho(r, "can not read an implicit mapping pair; a colon is missed"); + if (t.line === s) { + for (b = t.input.charCodeAt(t.position); qd(b); ) + b = t.input.charCodeAt(++t.position); + if (b === 58) + b = t.input.charCodeAt(++t.position), Da(b) || Ut(t, "a whitespace character is expected after the key-value separator within a block mapping"), v && (Dp(t, f, d, p, g, null, a, o, l), p = g = m = null), y = !0, v = !1, i = !1, p = t.tag, g = t.result; + else if (y) + Ut(t, "can not read an implicit mapping pair; a colon is missed"); else - return r.tag = O, r.anchor = S, !0; - } else if (H) - ho(r, "can not read a block mapping entry; a multiline key may not be an implicit key"); + return t.tag = u, t.anchor = h, !0; + } else if (y) + Ut(t, "can not read a block mapping entry; a multiline key may not be an implicit key"); else - return r.tag = O, r.anchor = S, !0; + return t.tag = u, t.anchor = h, !0; } - if ((r.line === h || r.lineIndent > n) && (W && (f = r.line, b = r.lineStart, w = r.position), wF(r, n, Eve, !0, l) && (W ? B = r.result : z = r.result), W || (yB(r, E, D, M, B, z, f, b, w), M = B = z = null), m1(r, !0, -1), G = r.input.charCodeAt(r.position)), (r.line === h || r.lineIndent > n) && G !== 0) - ho(r, "bad indentation of a mapping entry"); - else if (r.lineIndent < n) + if ((t.line === s || t.lineIndent > e) && (v && (a = t.line, o = t.lineStart, l = t.position), Vg(t, e, n3, !0, i) && (v ? g = t.result : m = t.result), v || (Dp(t, f, d, p, g, m, a, o, l), p = g = m = null), hi(t, !0, -1), b = t.input.charCodeAt(t.position)), (t.line === s || t.lineIndent > e) && b !== 0) + Ut(t, "bad indentation of a mapping entry"); + else if (t.lineIndent < e) break; } - return W && yB(r, E, D, M, B, null, f, b, w), H && (r.tag = O, r.anchor = S, r.kind = "mapping", r.result = E), H; + return v && Dp(t, f, d, p, g, null, a, o, l), y && (t.tag = u, t.anchor = h, t.kind = "mapping", t.result = f), y; } -function LMn(r) { - var n, s = !1, a = !1, l, h, f; - if (f = r.input.charCodeAt(r.position), f !== 33) +function c7e(t) { + var e, r = !1, n = !1, i, s, a; + if (a = t.input.charCodeAt(t.position), a !== 33) return !1; - if (r.tag !== null && ho(r, "duplication of a tag property"), f = r.input.charCodeAt(++r.position), f === 60 ? (s = !0, f = r.input.charCodeAt(++r.position)) : f === 33 ? (a = !0, l = "!!", f = r.input.charCodeAt(++r.position)) : l = "!", n = r.position, s) { + if (t.tag !== null && Ut(t, "duplication of a tag property"), a = t.input.charCodeAt(++t.position), a === 60 ? (r = !0, a = t.input.charCodeAt(++t.position)) : a === 33 ? (n = !0, i = "!!", a = t.input.charCodeAt(++t.position)) : i = "!", e = t.position, r) { do - f = r.input.charCodeAt(++r.position); - while (f !== 0 && f !== 62); - r.position < r.length ? (h = r.input.slice(n, r.position), f = r.input.charCodeAt(++r.position)) : ho(r, "unexpected end of the stream within a verbatim tag"); + a = t.input.charCodeAt(++t.position); + while (a !== 0 && a !== 62); + t.position < t.length ? (s = t.input.slice(e, t.position), a = t.input.charCodeAt(++t.position)) : Ut(t, "unexpected end of the stream within a verbatim tag"); } else { - for (; f !== 0 && !ov(f); ) - f === 33 && (a ? ho(r, "tag suffix cannot contain exclamation marks") : (l = r.input.slice(n - 1, r.position + 1), MRt.test(l) || ho(r, "named tag handle cannot contain such characters"), a = !0, n = r.position + 1)), f = r.input.charCodeAt(++r.position); - h = r.input.slice(n, r.position), OMn.test(h) && ho(r, "tag suffix cannot contain flow indicator characters"); + for (; a !== 0 && !Da(a); ) + a === 33 && (n ? Ut(t, "tag suffix cannot contain exclamation marks") : (i = t.input.slice(e - 1, t.position + 1), Qre.test(i) || Ut(t, "named tag handle cannot contain such characters"), n = !0, e = t.position + 1)), a = t.input.charCodeAt(++t.position); + s = t.input.slice(e, t.position), jAe.test(s) && Ut(t, "tag suffix cannot contain flow indicator characters"); } - h && !PRt.test(h) && ho(r, "tag name cannot contain such characters: " + h); + s && !Yre.test(s) && Ut(t, "tag name cannot contain such characters: " + s); try { - h = decodeURIComponent(h); + s = decodeURIComponent(s); } catch { - ho(r, "tag name is malformed: " + h); + Ut(t, "tag name is malformed: " + s); } - return s ? r.tag = h : k8.call(r.tagMap, l) ? r.tag = r.tagMap[l] + h : l === "!" ? r.tag = "!" + h : l === "!!" ? r.tag = "tag:yaml.org,2002:" + h : ho(r, 'undeclared tag handle "' + l + '"'), !0; + return r ? t.tag = s : pf.call(t.tagMap, i) ? t.tag = t.tagMap[i] + s : i === "!" ? t.tag = "!" + s : i === "!!" ? t.tag = "tag:yaml.org,2002:" + s : Ut(t, 'undeclared tag handle "' + i + '"'), !0; } -function IMn(r) { - var n, s; - if (s = r.input.charCodeAt(r.position), s !== 38) +function u7e(t) { + var e, r; + if (r = t.input.charCodeAt(t.position), r !== 38) return !1; - for (r.anchor !== null && ho(r, "duplication of an anchor property"), s = r.input.charCodeAt(++r.position), n = r.position; s !== 0 && !ov(s) && !wB(s); ) - s = r.input.charCodeAt(++r.position); - return r.position === n && ho(r, "name of an anchor node must contain at least one character"), r.anchor = r.input.slice(n, r.position), !0; + for (t.anchor !== null && Ut(t, "duplication of an anchor property"), r = t.input.charCodeAt(++t.position), e = t.position; r !== 0 && !Da(r) && !Mp(r); ) + r = t.input.charCodeAt(++t.position); + return t.position === e && Ut(t, "name of an anchor node must contain at least one character"), t.anchor = t.input.slice(e, t.position), !0; } -function NMn(r) { - var n, s, a; - if (a = r.input.charCodeAt(r.position), a !== 42) +function h7e(t) { + var e, r, n; + if (n = t.input.charCodeAt(t.position), n !== 42) return !1; - for (a = r.input.charCodeAt(++r.position), n = r.position; a !== 0 && !ov(a) && !wB(a); ) - a = r.input.charCodeAt(++r.position); - return r.position === n && ho(r, "name of an alias node must contain at least one character"), s = r.input.slice(n, r.position), k8.call(r.anchorMap, s) || ho(r, 'unidentified alias "' + s + '"'), r.result = r.anchorMap[s], m1(r, !0, -1), !0; -} -function wF(r, n, s, a, l) { - var h, f, b, w = 1, O = !1, S = !1, E, D, M, B, z, W; - if (r.listener !== null && r.listener("open", r), r.tag = null, r.anchor = null, r.kind = null, r.result = null, h = f = b = Eve === s || DRt === s, a && m1(r, !0, -1) && (O = !0, r.lineIndent > n ? w = 1 : r.lineIndent === n ? w = 0 : r.lineIndent < n && (w = -1)), w === 1) - for (; LMn(r) || IMn(r); ) - m1(r, !0, -1) ? (O = !0, b = h, r.lineIndent > n ? w = 1 : r.lineIndent === n ? w = 0 : r.lineIndent < n && (w = -1)) : b = !1; - if (b && (b = O || l), (w === 1 || Eve === s) && (Cve === s || ARt === s ? z = n : z = n + 1, W = r.position - r.lineStart, w === 1 ? b && (ETt(r, W) || PMn(r, W, z)) || DMn(r, z) ? S = !0 : (f && MMn(r, z) || TMn(r, z) || AMn(r, z) ? S = !0 : NMn(r) ? (S = !0, (r.tag !== null || r.anchor !== null) && ho(r, "alias node should not have any properties")) : EMn(r, z, Cve === s) && (S = !0, r.tag === null && (r.tag = "?")), r.anchor !== null && (r.anchorMap[r.anchor] = r.result)) : w === 0 && (S = b && ETt(r, W))), r.tag === null) - r.anchor !== null && (r.anchorMap[r.anchor] = r.result); - else if (r.tag === "?") { - for (r.result !== null && r.kind !== "scalar" && ho(r, 'unacceptable node kind for ! tag; it should be "scalar", not "' + r.kind + '"'), E = 0, D = r.implicitTypes.length; E < D; E += 1) - if (B = r.implicitTypes[E], B.resolve(r.result)) { - r.result = B.construct(r.result), r.tag = B.tag, r.anchor !== null && (r.anchorMap[r.anchor] = r.result); + for (n = t.input.charCodeAt(++t.position), e = t.position; n !== 0 && !Da(n) && !Mp(n); ) + n = t.input.charCodeAt(++t.position); + return t.position === e && Ut(t, "name of an alias node must contain at least one character"), r = t.input.slice(e, t.position), pf.call(t.anchorMap, r) || Ut(t, 'unidentified alias "' + r + '"'), t.result = t.anchorMap[r], hi(t, !0, -1), !0; +} +function Vg(t, e, r, n, i) { + var s, a, o, l = 1, u = !1, h = !1, f, d, p, g, m, v; + if (t.listener !== null && t.listener("open", t), t.tag = null, t.anchor = null, t.kind = null, t.result = null, s = a = o = n3 === r || qre === r, n && hi(t, !0, -1) && (u = !0, t.lineIndent > e ? l = 1 : t.lineIndent === e ? l = 0 : t.lineIndent < e && (l = -1)), l === 1) + for (; c7e(t) || u7e(t); ) + hi(t, !0, -1) ? (u = !0, o = s, t.lineIndent > e ? l = 1 : t.lineIndent === e ? l = 0 : t.lineIndent < e && (l = -1)) : o = !1; + if (o && (o = u || i), (l === 1 || n3 === r) && (r3 === r || Ure === r ? m = e : m = e + 1, v = t.position - t.lineStart, l === 1 ? o && (rV(t, v) || l7e(t, v, m)) || a7e(t, m) ? h = !0 : (a && o7e(t, m) || i7e(t, m) || s7e(t, m) ? h = !0 : h7e(t) ? (h = !0, (t.tag !== null || t.anchor !== null) && Ut(t, "alias node should not have any properties")) : n7e(t, m, r3 === r) && (h = !0, t.tag === null && (t.tag = "?")), t.anchor !== null && (t.anchorMap[t.anchor] = t.result)) : l === 0 && (h = o && rV(t, v))), t.tag === null) + t.anchor !== null && (t.anchorMap[t.anchor] = t.result); + else if (t.tag === "?") { + for (t.result !== null && t.kind !== "scalar" && Ut(t, 'unacceptable node kind for ! tag; it should be "scalar", not "' + t.kind + '"'), f = 0, d = t.implicitTypes.length; f < d; f += 1) + if (g = t.implicitTypes[f], g.resolve(t.result)) { + t.result = g.construct(t.result), t.tag = g.tag, t.anchor !== null && (t.anchorMap[t.anchor] = t.result); break; } - } else if (r.tag !== "!") { - if (k8.call(r.typeMap[r.kind || "fallback"], r.tag)) - B = r.typeMap[r.kind || "fallback"][r.tag]; + } else if (t.tag !== "!") { + if (pf.call(t.typeMap[t.kind || "fallback"], t.tag)) + g = t.typeMap[t.kind || "fallback"][t.tag]; else - for (B = null, M = r.typeMap.multi[r.kind || "fallback"], E = 0, D = M.length; E < D; E += 1) - if (r.tag.slice(0, M[E].tag.length) === M[E].tag) { - B = M[E]; + for (g = null, p = t.typeMap.multi[t.kind || "fallback"], f = 0, d = p.length; f < d; f += 1) + if (t.tag.slice(0, p[f].tag.length) === p[f].tag) { + g = p[f]; break; } - B || ho(r, "unknown tag !<" + r.tag + ">"), r.result !== null && B.kind !== r.kind && ho(r, "unacceptable node kind for !<" + r.tag + '> tag; it should be "' + B.kind + '", not "' + r.kind + '"'), B.resolve(r.result, r.tag) ? (r.result = B.construct(r.result, r.tag), r.anchor !== null && (r.anchorMap[r.anchor] = r.result)) : ho(r, "cannot resolve a node with !<" + r.tag + "> explicit tag"); - } - return r.listener !== null && r.listener("close", r), r.tag !== null || r.anchor !== null || S; -} -function RMn(r) { - var n = r.position, s, a, l, h = !1, f; - for (r.version = null, r.checkLineBreaks = r.legacy, r.tagMap = /* @__PURE__ */ Object.create(null), r.anchorMap = /* @__PURE__ */ Object.create(null); (f = r.input.charCodeAt(r.position)) !== 0 && (m1(r, !0, -1), f = r.input.charCodeAt(r.position), !(r.lineIndent > 0 || f !== 37)); ) { - for (h = !0, f = r.input.charCodeAt(++r.position), s = r.position; f !== 0 && !ov(f); ) - f = r.input.charCodeAt(++r.position); - for (a = r.input.slice(s, r.position), l = [], a.length < 1 && ho(r, "directive name must not be less than one character in length"); f !== 0; ) { - for (; XM(f); ) - f = r.input.charCodeAt(++r.position); - if (f === 35) { + g || Ut(t, "unknown tag !<" + t.tag + ">"), t.result !== null && g.kind !== t.kind && Ut(t, "unacceptable node kind for !<" + t.tag + '> tag; it should be "' + g.kind + '", not "' + t.kind + '"'), g.resolve(t.result, t.tag) ? (t.result = g.construct(t.result, t.tag), t.anchor !== null && (t.anchorMap[t.anchor] = t.result)) : Ut(t, "cannot resolve a node with !<" + t.tag + "> explicit tag"); + } + return t.listener !== null && t.listener("close", t), t.tag !== null || t.anchor !== null || h; +} +function f7e(t) { + var e = t.position, r, n, i, s = !1, a; + for (t.version = null, t.checkLineBreaks = t.legacy, t.tagMap = /* @__PURE__ */ Object.create(null), t.anchorMap = /* @__PURE__ */ Object.create(null); (a = t.input.charCodeAt(t.position)) !== 0 && (hi(t, !0, -1), a = t.input.charCodeAt(t.position), !(t.lineIndent > 0 || a !== 37)); ) { + for (s = !0, a = t.input.charCodeAt(++t.position), r = t.position; a !== 0 && !Da(a); ) + a = t.input.charCodeAt(++t.position); + for (n = t.input.slice(r, t.position), i = [], n.length < 1 && Ut(t, "directive name must not be less than one character in length"); a !== 0; ) { + for (; qd(a); ) + a = t.input.charCodeAt(++t.position); + if (a === 35) { do - f = r.input.charCodeAt(++r.position); - while (f !== 0 && !ix(f)); + a = t.input.charCodeAt(++t.position); + while (a !== 0 && !Rc(a)); break; } - if (ix(f)) + if (Rc(a)) break; - for (s = r.position; f !== 0 && !ov(f); ) - f = r.input.charCodeAt(++r.position); - l.push(r.input.slice(s, r.position)); + for (r = t.position; a !== 0 && !Da(a); ) + a = t.input.charCodeAt(++t.position); + i.push(t.input.slice(r, t.position)); } - f !== 0 && Oqe(r), k8.call(_Tt, a) ? _Tt[a](r, a, l) : Tve(r, 'unknown document directive "' + a + '"'); + a !== 0 && GM(t), pf.call(eV, n) ? eV[n](t, n, i) : i3(t, 'unknown document directive "' + n + '"'); } - if (m1(r, !0, -1), r.lineIndent === 0 && r.input.charCodeAt(r.position) === 45 && r.input.charCodeAt(r.position + 1) === 45 && r.input.charCodeAt(r.position + 2) === 45 ? (r.position += 3, m1(r, !0, -1)) : h && ho(r, "directives end mark is expected"), wF(r, r.lineIndent - 1, Eve, !1, !0), m1(r, !0, -1), r.checkLineBreaks && yMn.test(r.input.slice(n, r.position)) && Tve(r, "non-ASCII line breaks are interpreted as content"), r.documents.push(r.result), r.position === r.lineStart && ywe(r)) { - r.input.charCodeAt(r.position) === 46 && (r.position += 3, m1(r, !0, -1)); + if (hi(t, !0, -1), t.lineIndent === 0 && t.input.charCodeAt(t.position) === 45 && t.input.charCodeAt(t.position + 1) === 45 && t.input.charCodeAt(t.position + 2) === 45 ? (t.position += 3, hi(t, !0, -1)) : s && Ut(t, "directives end mark is expected"), Vg(t, t.lineIndent - 1, n3, !1, !0), hi(t, !0, -1), t.checkLineBreaks && ZAe.test(t.input.slice(e, t.position)) && i3(t, "non-ASCII line breaks are interpreted as content"), t.documents.push(t.result), t.position === t.lineStart && sT(t)) { + t.input.charCodeAt(t.position) === 46 && (t.position += 3, hi(t, !0, -1)); return; } - if (r.position < r.length - 1) - ho(r, "end of the stream or a document separator is expected"); + if (t.position < t.length - 1) + Ut(t, "end of the stream or a document separator is expected"); else return; } -function RRt(r, n) { - r = String(r), n = n || {}, r.length !== 0 && (r.charCodeAt(r.length - 1) !== 10 && r.charCodeAt(r.length - 1) !== 13 && (r += ` -`), r.charCodeAt(0) === 65279 && (r = r.slice(1))); - var s = new CMn(r, n), a = r.indexOf("\0"); - for (a !== -1 && (s.position = a, ho(s, "null byte is not allowed in input")), s.input += "\0"; s.input.charCodeAt(s.position) === 32; ) - s.lineIndent += 1, s.position += 1; - for (; s.position < s.length - 1; ) - RMn(s); - return s.documents; -} -function $Mn(r, n, s) { - n !== null && typeof n == "object" && typeof s > "u" && (s = n, n = null); - var a = RRt(r, s); - if (typeof n != "function") - return a; - for (var l = 0, h = a.length; l < h; l += 1) - n(a[l]); -} -function BMn(r, n) { - var s = RRt(r, n); - if (s.length !== 0) { - if (s.length === 1) - return s[0]; - throw new Am("expected a single document in the stream, but found more"); - } -} -var FMn = $Mn, jMn = BMn, $Rt = { - loadAll: FMn, - load: jMn -}, BRt = Object.prototype.toString, FRt = Object.prototype.hasOwnProperty, xqe = 65279, QMn = 9, UK = 10, zMn = 13, qMn = 32, VMn = 33, UMn = 34, fje = 35, WMn = 37, YMn = 38, HMn = 39, GMn = 42, jRt = 44, ZMn = 45, Ave = 58, XMn = 61, KMn = 62, JMn = 63, ePn = 64, QRt = 91, zRt = 93, tPn = 96, qRt = 123, nPn = 124, VRt = 125, Ag = {}; -Ag[0] = "\\0"; -Ag[7] = "\\a"; -Ag[8] = "\\b"; -Ag[9] = "\\t"; -Ag[10] = "\\n"; -Ag[11] = "\\v"; -Ag[12] = "\\f"; -Ag[13] = "\\r"; -Ag[27] = "\\e"; -Ag[34] = '\\"'; -Ag[92] = "\\\\"; -Ag[133] = "\\N"; -Ag[160] = "\\_"; -Ag[8232] = "\\L"; -Ag[8233] = "\\P"; -var rPn = [ +function Xre(t, e) { + t = String(t), e = e || {}, t.length !== 0 && (t.charCodeAt(t.length - 1) !== 10 && t.charCodeAt(t.length - 1) !== 13 && (t += ` +`), t.charCodeAt(0) === 65279 && (t = t.slice(1))); + var r = new r7e(t, e), n = t.indexOf("\0"); + for (n !== -1 && (r.position = n, Ut(r, "null byte is not allowed in input")), r.input += "\0"; r.input.charCodeAt(r.position) === 32; ) + r.lineIndent += 1, r.position += 1; + for (; r.position < r.length - 1; ) + f7e(r); + return r.documents; +} +function d7e(t, e, r) { + e !== null && typeof e == "object" && typeof r > "u" && (r = e, e = null); + var n = Xre(t, r); + if (typeof e != "function") + return n; + for (var i = 0, s = n.length; i < s; i += 1) + e(n[i]); +} +function p7e(t, e) { + var r = Xre(t, e); + if (r.length !== 0) { + if (r.length === 1) + return r[0]; + throw new ea("expected a single document in the stream, but found more"); + } +} +var g7e = d7e, m7e = p7e, Zre = { + loadAll: g7e, + load: m7e +}, jre = Object.prototype.toString, Kre = Object.prototype.hasOwnProperty, XM = 65279, v7e = 9, e2 = 10, y7e = 13, b7e = 32, x7e = 33, w7e = 34, t8 = 35, O7e = 37, k7e = 38, S7e = 39, T7e = 42, Jre = 44, C7e = 45, s3 = 58, E7e = 61, _7e = 62, A7e = 63, L7e = 64, ene = 91, tne = 93, R7e = 96, rne = 123, M7e = 124, nne = 125, qs = {}; +qs[0] = "\\0"; +qs[7] = "\\a"; +qs[8] = "\\b"; +qs[9] = "\\t"; +qs[10] = "\\n"; +qs[11] = "\\v"; +qs[12] = "\\f"; +qs[13] = "\\r"; +qs[27] = "\\e"; +qs[34] = '\\"'; +qs[92] = "\\\\"; +qs[133] = "\\N"; +qs[160] = "\\_"; +qs[8232] = "\\L"; +qs[8233] = "\\P"; +var D7e = [ "y", "Y", "yes", @@ -27508,837 +27517,837 @@ var rPn = [ "off", "Off", "OFF" -], iPn = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; -function sPn(r, n) { - var s, a, l, h, f, b, w; - if (n === null) +], N7e = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; +function I7e(t, e) { + var r, n, i, s, a, o, l; + if (e === null) return {}; - for (s = {}, a = Object.keys(n), l = 0, h = a.length; l < h; l += 1) - f = a[l], b = String(n[f]), f.slice(0, 2) === "!!" && (f = "tag:yaml.org,2002:" + f.slice(2)), w = r.compiledTypeMap.fallback[f], w && FRt.call(w.styleAliases, b) && (b = w.styleAliases[b]), s[f] = b; - return s; + for (r = {}, n = Object.keys(e), i = 0, s = n.length; i < s; i += 1) + a = n[i], o = String(e[a]), a.slice(0, 2) === "!!" && (a = "tag:yaml.org,2002:" + a.slice(2)), l = t.compiledTypeMap.fallback[a], l && Kre.call(l.styleAliases, o) && (o = l.styleAliases[o]), r[a] = o; + return r; } -function oPn(r) { - var n, s, a; - if (n = r.toString(16).toUpperCase(), r <= 255) - s = "x", a = 2; - else if (r <= 65535) - s = "u", a = 4; - else if (r <= 4294967295) - s = "U", a = 8; +function P7e(t) { + var e, r, n; + if (e = t.toString(16).toUpperCase(), t <= 255) + r = "x", n = 2; + else if (t <= 65535) + r = "u", n = 4; + else if (t <= 4294967295) + r = "U", n = 8; else - throw new Am("code point within a string may not be greater than 0xFFFFFFFF"); - return "\\" + s + l0.repeat("0", a - n.length) + n; -} -var aPn = 1, WK = 2; -function cPn(r) { - this.schema = r.schema || yqe, this.indent = Math.max(1, r.indent || 2), this.noArrayIndent = r.noArrayIndent || !1, this.skipInvalid = r.skipInvalid || !1, this.flowLevel = l0.isNothing(r.flowLevel) ? -1 : r.flowLevel, this.styleMap = sPn(this.schema, r.styles || null), this.sortKeys = r.sortKeys || !1, this.lineWidth = r.lineWidth || 80, this.noRefs = r.noRefs || !1, this.noCompatMode = r.noCompatMode || !1, this.condenseFlow = r.condenseFlow || !1, this.quotingType = r.quotingType === '"' ? WK : aPn, this.forceQuotes = r.forceQuotes || !1, this.replacer = typeof r.replacer == "function" ? r.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null; -} -function TTt(r, n) { - for (var s = l0.repeat(" ", n), a = 0, l = -1, h = "", f, b = r.length; a < b; ) - l = r.indexOf(` -`, a), l === -1 ? (f = r.slice(a), a = b) : (f = r.slice(a, l + 1), a = l + 1), f.length && f !== ` -` && (h += s), h += f; - return h; + throw new ea("code point within a string may not be greater than 0xFFFFFFFF"); + return "\\" + r + Ti.repeat("0", n - e.length) + e; +} +var $7e = 1, t2 = 2; +function B7e(t) { + this.schema = t.schema || WM, this.indent = Math.max(1, t.indent || 2), this.noArrayIndent = t.noArrayIndent || !1, this.skipInvalid = t.skipInvalid || !1, this.flowLevel = Ti.isNothing(t.flowLevel) ? -1 : t.flowLevel, this.styleMap = I7e(this.schema, t.styles || null), this.sortKeys = t.sortKeys || !1, this.lineWidth = t.lineWidth || 80, this.noRefs = t.noRefs || !1, this.noCompatMode = t.noCompatMode || !1, this.condenseFlow = t.condenseFlow || !1, this.quotingType = t.quotingType === '"' ? t2 : $7e, this.forceQuotes = t.forceQuotes || !1, this.replacer = typeof t.replacer == "function" ? t.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null; +} +function nV(t, e) { + for (var r = Ti.repeat(" ", e), n = 0, i = -1, s = "", a, o = t.length; n < o; ) + i = t.indexOf(` +`, n), i === -1 ? (a = t.slice(n), n = o) : (a = t.slice(n, i + 1), n = i + 1), a.length && a !== ` +` && (s += r), s += a; + return s; } -function dje(r, n) { +function r8(t, e) { return ` -` + l0.repeat(" ", r.indent * n); +` + Ti.repeat(" ", t.indent * e); } -function lPn(r, n) { - var s, a, l; - for (s = 0, a = r.implicitTypes.length; s < a; s += 1) - if (l = r.implicitTypes[s], l.resolve(n)) +function F7e(t, e) { + var r, n, i; + for (r = 0, n = t.implicitTypes.length; r < n; r += 1) + if (i = t.implicitTypes[r], i.resolve(e)) return !0; return !1; } -function Dve(r) { - return r === qMn || r === QMn; +function a3(t) { + return t === b7e || t === v7e; } -function YK(r) { - return 32 <= r && r <= 126 || 161 <= r && r <= 55295 && r !== 8232 && r !== 8233 || 57344 <= r && r <= 65533 && r !== xqe || 65536 <= r && r <= 1114111; +function r2(t) { + return 32 <= t && t <= 126 || 161 <= t && t <= 55295 && t !== 8232 && t !== 8233 || 57344 <= t && t <= 65533 && t !== XM || 65536 <= t && t <= 1114111; } -function ATt(r) { - return YK(r) && r !== xqe && r !== zMn && r !== UK; +function iV(t) { + return r2(t) && t !== XM && t !== y7e && t !== e2; } -function DTt(r, n, s) { - var a = ATt(r), l = a && !Dve(r); - return (s ? a : a && r !== jRt && r !== QRt && r !== zRt && r !== qRt && r !== VRt) && r !== fje && !(n === Ave && !l) || ATt(n) && !Dve(n) && r === fje || n === Ave && l; +function sV(t, e, r) { + var n = iV(t), i = n && !a3(t); + return (r ? n : n && t !== Jre && t !== ene && t !== tne && t !== rne && t !== nne) && t !== t8 && !(e === s3 && !i) || iV(e) && !a3(e) && t === t8 || e === s3 && i; } -function uPn(r) { - return YK(r) && r !== xqe && !Dve(r) && r !== ZMn && r !== JMn && r !== Ave && r !== jRt && r !== QRt && r !== zRt && r !== qRt && r !== VRt && r !== fje && r !== YMn && r !== GMn && r !== VMn && r !== nPn && r !== XMn && r !== KMn && r !== HMn && r !== UMn && r !== WMn && r !== ePn && r !== tPn; +function z7e(t) { + return r2(t) && t !== XM && !a3(t) && t !== C7e && t !== A7e && t !== s3 && t !== Jre && t !== ene && t !== tne && t !== rne && t !== nne && t !== t8 && t !== k7e && t !== T7e && t !== x7e && t !== M7e && t !== E7e && t !== _7e && t !== S7e && t !== w7e && t !== O7e && t !== L7e && t !== R7e; } -function hPn(r) { - return !Dve(r) && r !== Ave; +function V7e(t) { + return !a3(t) && t !== s3; } -function CX(r, n) { - var s = r.charCodeAt(n), a; - return s >= 55296 && s <= 56319 && n + 1 < r.length && (a = r.charCodeAt(n + 1), a >= 56320 && a <= 57343) ? (s - 55296) * 1024 + a - 56320 + 65536 : s; +function vv(t, e) { + var r = t.charCodeAt(e), n; + return r >= 55296 && r <= 56319 && e + 1 < t.length && (n = t.charCodeAt(e + 1), n >= 56320 && n <= 57343) ? (r - 55296) * 1024 + n - 56320 + 65536 : r; } -function URt(r) { - var n = /^\n* /; - return n.test(r); +function ine(t) { + var e = /^\n* /; + return e.test(t); } -var WRt = 1, pje = 2, YRt = 3, HRt = 4, dB = 5; -function fPn(r, n, s, a, l, h, f, b) { - var w, O = 0, S = null, E = !1, D = !1, M = a !== -1, B = -1, z = uPn(CX(r, 0)) && hPn(CX(r, r.length - 1)); - if (n || f) - for (w = 0; w < r.length; O >= 65536 ? w += 2 : w++) { - if (O = CX(r, w), !YK(O)) - return dB; - z = z && DTt(O, S, b), S = O; +var sne = 1, n8 = 2, ane = 3, one = 4, Tp = 5; +function U7e(t, e, r, n, i, s, a, o) { + var l, u = 0, h = null, f = !1, d = !1, p = n !== -1, g = -1, m = z7e(vv(t, 0)) && V7e(vv(t, t.length - 1)); + if (e || a) + for (l = 0; l < t.length; u >= 65536 ? l += 2 : l++) { + if (u = vv(t, l), !r2(u)) + return Tp; + m = m && sV(u, h, o), h = u; } else { - for (w = 0; w < r.length; O >= 65536 ? w += 2 : w++) { - if (O = CX(r, w), O === UK) - E = !0, M && (D = D || w - B - 1 > a && r[B + 1] !== " ", B = w); - else if (!YK(O)) - return dB; - z = z && DTt(O, S, b), S = O; - } - D = D || M && w - B - 1 > a && r[B + 1] !== " "; - } - return !E && !D ? z && !f && !l(r) ? WRt : h === WK ? dB : pje : s > 9 && URt(r) ? dB : f ? h === WK ? dB : pje : D ? HRt : YRt; -} -function dPn(r, n, s, a, l) { - r.dump = function() { - if (n.length === 0) - return r.quotingType === WK ? '""' : "''"; - if (!r.noCompatMode && (rPn.indexOf(n) !== -1 || iPn.test(n))) - return r.quotingType === WK ? '"' + n + '"' : "'" + n + "'"; - var h = r.indent * Math.max(1, s), f = r.lineWidth === -1 ? -1 : Math.max(Math.min(r.lineWidth, 40), r.lineWidth - h), b = a || r.flowLevel > -1 && s >= r.flowLevel; - function w(O) { - return lPn(r, O); - } - switch (fPn( - n, - b, - r.indent, - f, - w, - r.quotingType, - r.forceQuotes && !a, - l + for (l = 0; l < t.length; u >= 65536 ? l += 2 : l++) { + if (u = vv(t, l), u === e2) + f = !0, p && (d = d || l - g - 1 > n && t[g + 1] !== " ", g = l); + else if (!r2(u)) + return Tp; + m = m && sV(u, h, o), h = u; + } + d = d || p && l - g - 1 > n && t[g + 1] !== " "; + } + return !f && !d ? m && !a && !i(t) ? sne : s === t2 ? Tp : n8 : r > 9 && ine(t) ? Tp : a ? s === t2 ? Tp : n8 : d ? one : ane; +} +function q7e(t, e, r, n, i) { + t.dump = function() { + if (e.length === 0) + return t.quotingType === t2 ? '""' : "''"; + if (!t.noCompatMode && (D7e.indexOf(e) !== -1 || N7e.test(e))) + return t.quotingType === t2 ? '"' + e + '"' : "'" + e + "'"; + var s = t.indent * Math.max(1, r), a = t.lineWidth === -1 ? -1 : Math.max(Math.min(t.lineWidth, 40), t.lineWidth - s), o = n || t.flowLevel > -1 && r >= t.flowLevel; + function l(u) { + return F7e(t, u); + } + switch (U7e( + e, + o, + t.indent, + a, + l, + t.quotingType, + t.forceQuotes && !n, + i )) { - case WRt: - return n; - case pje: - return "'" + n.replace(/'/g, "''") + "'"; - case YRt: - return "|" + MTt(n, r.indent) + PTt(TTt(n, h)); - case HRt: - return ">" + MTt(n, r.indent) + PTt(TTt(pPn(n, f), h)); - case dB: - return '"' + gPn(n) + '"'; + case sne: + return e; + case n8: + return "'" + e.replace(/'/g, "''") + "'"; + case ane: + return "|" + aV(e, t.indent) + oV(nV(e, s)); + case one: + return ">" + aV(e, t.indent) + oV(nV(Q7e(e, a), s)); + case Tp: + return '"' + Y7e(e) + '"'; default: - throw new Am("impossible error: invalid scalar style"); + throw new ea("impossible error: invalid scalar style"); } }(); } -function MTt(r, n) { - var s = URt(r) ? String(n) : "", a = r[r.length - 1] === ` -`, l = a && (r[r.length - 2] === ` -` || r === ` -`), h = l ? "+" : a ? "" : "-"; - return s + h + ` +function aV(t, e) { + var r = ine(t) ? String(e) : "", n = t[t.length - 1] === ` +`, i = n && (t[t.length - 2] === ` +` || t === ` +`), s = i ? "+" : n ? "" : "-"; + return r + s + ` `; } -function PTt(r) { - return r[r.length - 1] === ` -` ? r.slice(0, -1) : r; +function oV(t) { + return t[t.length - 1] === ` +` ? t.slice(0, -1) : t; } -function pPn(r, n) { - for (var s = /(\n+)([^\n]*)/g, a = function() { - var O = r.indexOf(` +function Q7e(t, e) { + for (var r = /(\n+)([^\n]*)/g, n = function() { + var u = t.indexOf(` `); - return O = O !== -1 ? O : r.length, s.lastIndex = O, LTt(r.slice(0, O), n); - }(), l = r[0] === ` -` || r[0] === " ", h, f; f = s.exec(r); ) { - var b = f[1], w = f[2]; - h = w[0] === " ", a += b + (!l && !h && w !== "" ? ` -` : "") + LTt(w, n), l = h; + return u = u !== -1 ? u : t.length, r.lastIndex = u, lV(t.slice(0, u), e); + }(), i = t[0] === ` +` || t[0] === " ", s, a; a = r.exec(t); ) { + var o = a[1], l = a[2]; + s = l[0] === " ", n += o + (!i && !s && l !== "" ? ` +` : "") + lV(l, e), i = s; } - return a; -} -function LTt(r, n) { - if (r === "" || r[0] === " ") - return r; - for (var s = / [^ ]/g, a, l = 0, h, f = 0, b = 0, w = ""; a = s.exec(r); ) - b = a.index, b - l > n && (h = f > l ? f : b, w += ` -` + r.slice(l, h), l = h + 1), f = b; - return w += ` -`, r.length - l > n && f > l ? w += r.slice(l, f) + ` -` + r.slice(f + 1) : w += r.slice(l), w.slice(1); -} -function gPn(r) { - for (var n = "", s = 0, a, l = 0; l < r.length; s >= 65536 ? l += 2 : l++) - s = CX(r, l), a = Ag[s], !a && YK(s) ? (n += r[l], s >= 65536 && (n += r[l + 1])) : n += a || oPn(s); return n; } -function mPn(r, n, s) { - var a = "", l = r.tag, h, f, b; - for (h = 0, f = s.length; h < f; h += 1) - b = s[h], r.replacer && (b = r.replacer.call(s, String(h), b)), (u_(r, n, b, !1, !1) || typeof b > "u" && u_(r, n, null, !1, !1)) && (a !== "" && (a += "," + (r.condenseFlow ? "" : " ")), a += r.dump); - r.tag = l, r.dump = "[" + a + "]"; -} -function ITt(r, n, s, a) { - var l = "", h = r.tag, f, b, w; - for (f = 0, b = s.length; f < b; f += 1) - w = s[f], r.replacer && (w = r.replacer.call(s, String(f), w)), (u_(r, n + 1, w, !0, !0, !1, !0) || typeof w > "u" && u_(r, n + 1, null, !0, !0, !1, !0)) && ((!a || l !== "") && (l += dje(r, n)), r.dump && UK === r.dump.charCodeAt(0) ? l += "-" : l += "- ", l += r.dump); - r.tag = h, r.dump = l || "[]"; -} -function bPn(r, n, s) { - var a = "", l = r.tag, h = Object.keys(s), f, b, w, O, S; - for (f = 0, b = h.length; f < b; f += 1) - S = "", a !== "" && (S += ", "), r.condenseFlow && (S += '"'), w = h[f], O = s[w], r.replacer && (O = r.replacer.call(s, w, O)), u_(r, n, w, !1, !1) && (r.dump.length > 1024 && (S += "? "), S += r.dump + (r.condenseFlow ? '"' : "") + ":" + (r.condenseFlow ? "" : " "), u_(r, n, O, !1, !1) && (S += r.dump, a += S)); - r.tag = l, r.dump = "{" + a + "}"; -} -function vPn(r, n, s, a) { - var l = "", h = r.tag, f = Object.keys(s), b, w, O, S, E, D; - if (r.sortKeys === !0) - f.sort(); - else if (typeof r.sortKeys == "function") - f.sort(r.sortKeys); - else if (r.sortKeys) - throw new Am("sortKeys must be a boolean or a function"); - for (b = 0, w = f.length; b < w; b += 1) - D = "", (!a || l !== "") && (D += dje(r, n)), O = f[b], S = s[O], r.replacer && (S = r.replacer.call(s, O, S)), u_(r, n + 1, O, !0, !0, !0) && (E = r.tag !== null && r.tag !== "?" || r.dump && r.dump.length > 1024, E && (r.dump && UK === r.dump.charCodeAt(0) ? D += "?" : D += "? "), D += r.dump, E && (D += dje(r, n)), u_(r, n + 1, S, !0, E) && (r.dump && UK === r.dump.charCodeAt(0) ? D += ":" : D += ": ", D += r.dump, l += D)); - r.tag = h, r.dump = l || "{}"; -} -function NTt(r, n, s) { - var a, l, h, f, b, w; - for (l = s ? r.explicitTypes : r.implicitTypes, h = 0, f = l.length; h < f; h += 1) - if (b = l[h], (b.instanceOf || b.predicate) && (!b.instanceOf || typeof n == "object" && n instanceof b.instanceOf) && (!b.predicate || b.predicate(n))) { - if (s ? b.multi && b.representName ? r.tag = b.representName(n) : r.tag = b.tag : r.tag = "?", b.represent) { - if (w = r.styleMap[b.tag] || b.defaultStyle, BRt.call(b.represent) === "[object Function]") - a = b.represent(n, w); - else if (FRt.call(b.represent, w)) - a = b.represent[w](n, w); +function lV(t, e) { + if (t === "" || t[0] === " ") + return t; + for (var r = / [^ ]/g, n, i = 0, s, a = 0, o = 0, l = ""; n = r.exec(t); ) + o = n.index, o - i > e && (s = a > i ? a : o, l += ` +` + t.slice(i, s), i = s + 1), a = o; + return l += ` +`, t.length - i > e && a > i ? l += t.slice(i, a) + ` +` + t.slice(a + 1) : l += t.slice(i), l.slice(1); +} +function Y7e(t) { + for (var e = "", r = 0, n, i = 0; i < t.length; r >= 65536 ? i += 2 : i++) + r = vv(t, i), n = qs[r], !n && r2(r) ? (e += t[i], r >= 65536 && (e += t[i + 1])) : e += n || P7e(r); + return e; +} +function W7e(t, e, r) { + var n = "", i = t.tag, s, a, o; + for (s = 0, a = r.length; s < a; s += 1) + o = r[s], t.replacer && (o = t.replacer.call(r, String(s), o)), (zu(t, e, o, !1, !1) || typeof o > "u" && zu(t, e, null, !1, !1)) && (n !== "" && (n += "," + (t.condenseFlow ? "" : " ")), n += t.dump); + t.tag = i, t.dump = "[" + n + "]"; +} +function cV(t, e, r, n) { + var i = "", s = t.tag, a, o, l; + for (a = 0, o = r.length; a < o; a += 1) + l = r[a], t.replacer && (l = t.replacer.call(r, String(a), l)), (zu(t, e + 1, l, !0, !0, !1, !0) || typeof l > "u" && zu(t, e + 1, null, !0, !0, !1, !0)) && ((!n || i !== "") && (i += r8(t, e)), t.dump && e2 === t.dump.charCodeAt(0) ? i += "-" : i += "- ", i += t.dump); + t.tag = s, t.dump = i || "[]"; +} +function G7e(t, e, r) { + var n = "", i = t.tag, s = Object.keys(r), a, o, l, u, h; + for (a = 0, o = s.length; a < o; a += 1) + h = "", n !== "" && (h += ", "), t.condenseFlow && (h += '"'), l = s[a], u = r[l], t.replacer && (u = t.replacer.call(r, l, u)), zu(t, e, l, !1, !1) && (t.dump.length > 1024 && (h += "? "), h += t.dump + (t.condenseFlow ? '"' : "") + ":" + (t.condenseFlow ? "" : " "), zu(t, e, u, !1, !1) && (h += t.dump, n += h)); + t.tag = i, t.dump = "{" + n + "}"; +} +function H7e(t, e, r, n) { + var i = "", s = t.tag, a = Object.keys(r), o, l, u, h, f, d; + if (t.sortKeys === !0) + a.sort(); + else if (typeof t.sortKeys == "function") + a.sort(t.sortKeys); + else if (t.sortKeys) + throw new ea("sortKeys must be a boolean or a function"); + for (o = 0, l = a.length; o < l; o += 1) + d = "", (!n || i !== "") && (d += r8(t, e)), u = a[o], h = r[u], t.replacer && (h = t.replacer.call(r, u, h)), zu(t, e + 1, u, !0, !0, !0) && (f = t.tag !== null && t.tag !== "?" || t.dump && t.dump.length > 1024, f && (t.dump && e2 === t.dump.charCodeAt(0) ? d += "?" : d += "? "), d += t.dump, f && (d += r8(t, e)), zu(t, e + 1, h, !0, f) && (t.dump && e2 === t.dump.charCodeAt(0) ? d += ":" : d += ": ", d += t.dump, i += d)); + t.tag = s, t.dump = i || "{}"; +} +function uV(t, e, r) { + var n, i, s, a, o, l; + for (i = r ? t.explicitTypes : t.implicitTypes, s = 0, a = i.length; s < a; s += 1) + if (o = i[s], (o.instanceOf || o.predicate) && (!o.instanceOf || typeof e == "object" && e instanceof o.instanceOf) && (!o.predicate || o.predicate(e))) { + if (r ? o.multi && o.representName ? t.tag = o.representName(e) : t.tag = o.tag : t.tag = "?", o.represent) { + if (l = t.styleMap[o.tag] || o.defaultStyle, jre.call(o.represent) === "[object Function]") + n = o.represent(e, l); + else if (Kre.call(o.represent, l)) + n = o.represent[l](e, l); else - throw new Am("!<" + b.tag + '> tag resolver accepts not "' + w + '" style'); - r.dump = a; + throw new ea("!<" + o.tag + '> tag resolver accepts not "' + l + '" style'); + t.dump = n; } return !0; } return !1; } -function u_(r, n, s, a, l, h, f) { - r.tag = null, r.dump = s, NTt(r, s, !1) || NTt(r, s, !0); - var b = BRt.call(r.dump), w = a, O; - a && (a = r.flowLevel < 0 || r.flowLevel > n); - var S = b === "[object Object]" || b === "[object Array]", E, D; - if (S && (E = r.duplicates.indexOf(s), D = E !== -1), (r.tag !== null && r.tag !== "?" || D || r.indent !== 2 && n > 0) && (l = !1), D && r.usedDuplicates[E]) - r.dump = "*ref_" + E; +function zu(t, e, r, n, i, s, a) { + t.tag = null, t.dump = r, uV(t, r, !1) || uV(t, r, !0); + var o = jre.call(t.dump), l = n, u; + n && (n = t.flowLevel < 0 || t.flowLevel > e); + var h = o === "[object Object]" || o === "[object Array]", f, d; + if (h && (f = t.duplicates.indexOf(r), d = f !== -1), (t.tag !== null && t.tag !== "?" || d || t.indent !== 2 && e > 0) && (i = !1), d && t.usedDuplicates[f]) + t.dump = "*ref_" + f; else { - if (S && D && !r.usedDuplicates[E] && (r.usedDuplicates[E] = !0), b === "[object Object]") - a && Object.keys(r.dump).length !== 0 ? (vPn(r, n, r.dump, l), D && (r.dump = "&ref_" + E + r.dump)) : (bPn(r, n, r.dump), D && (r.dump = "&ref_" + E + " " + r.dump)); - else if (b === "[object Array]") - a && r.dump.length !== 0 ? (r.noArrayIndent && !f && n > 0 ? ITt(r, n - 1, r.dump, l) : ITt(r, n, r.dump, l), D && (r.dump = "&ref_" + E + r.dump)) : (mPn(r, n, r.dump), D && (r.dump = "&ref_" + E + " " + r.dump)); - else if (b === "[object String]") - r.tag !== "?" && dPn(r, r.dump, n, h, w); + if (h && d && !t.usedDuplicates[f] && (t.usedDuplicates[f] = !0), o === "[object Object]") + n && Object.keys(t.dump).length !== 0 ? (H7e(t, e, t.dump, i), d && (t.dump = "&ref_" + f + t.dump)) : (G7e(t, e, t.dump), d && (t.dump = "&ref_" + f + " " + t.dump)); + else if (o === "[object Array]") + n && t.dump.length !== 0 ? (t.noArrayIndent && !a && e > 0 ? cV(t, e - 1, t.dump, i) : cV(t, e, t.dump, i), d && (t.dump = "&ref_" + f + t.dump)) : (W7e(t, e, t.dump), d && (t.dump = "&ref_" + f + " " + t.dump)); + else if (o === "[object String]") + t.tag !== "?" && q7e(t, t.dump, e, s, l); else { - if (b === "[object Undefined]") + if (o === "[object Undefined]") return !1; - if (r.skipInvalid) + if (t.skipInvalid) return !1; - throw new Am("unacceptable kind of an object to dump " + b); + throw new ea("unacceptable kind of an object to dump " + o); } - r.tag !== null && r.tag !== "?" && (O = encodeURI( - r.tag[0] === "!" ? r.tag.slice(1) : r.tag - ).replace(/!/g, "%21"), r.tag[0] === "!" ? O = "!" + O : O.slice(0, 18) === "tag:yaml.org,2002:" ? O = "!!" + O.slice(18) : O = "!<" + O + ">", r.dump = O + " " + r.dump); + t.tag !== null && t.tag !== "?" && (u = encodeURI( + t.tag[0] === "!" ? t.tag.slice(1) : t.tag + ).replace(/!/g, "%21"), t.tag[0] === "!" ? u = "!" + u : u.slice(0, 18) === "tag:yaml.org,2002:" ? u = "!!" + u.slice(18) : u = "!<" + u + ">", t.dump = u + " " + t.dump); } return !0; } -function wPn(r, n) { - var s = [], a = [], l, h; - for (gje(r, s, a), l = 0, h = a.length; l < h; l += 1) - n.duplicates.push(s[a[l]]); - n.usedDuplicates = new Array(h); -} -function gje(r, n, s) { - var a, l, h; - if (r !== null && typeof r == "object") - if (l = n.indexOf(r), l !== -1) - s.indexOf(l) === -1 && s.push(l); - else if (n.push(r), Array.isArray(r)) - for (l = 0, h = r.length; l < h; l += 1) - gje(r[l], n, s); +function X7e(t, e) { + var r = [], n = [], i, s; + for (i8(t, r, n), i = 0, s = n.length; i < s; i += 1) + e.duplicates.push(r[n[i]]); + e.usedDuplicates = new Array(s); +} +function i8(t, e, r) { + var n, i, s; + if (t !== null && typeof t == "object") + if (i = e.indexOf(t), i !== -1) + r.indexOf(i) === -1 && r.push(i); + else if (e.push(t), Array.isArray(t)) + for (i = 0, s = t.length; i < s; i += 1) + i8(t[i], e, r); else - for (a = Object.keys(r), l = 0, h = a.length; l < h; l += 1) - gje(r[a[l]], n, s); -} -function yPn(r, n) { - n = n || {}; - var s = new cPn(n); - s.noRefs || wPn(r, s); - var a = r; - return s.replacer && (a = s.replacer.call({ "": a }, "", a)), u_(s, 0, a, !0, !0) ? s.dump + ` + for (n = Object.keys(t), i = 0, s = n.length; i < s; i += 1) + i8(t[n[i]], e, r); +} +function Z7e(t, e) { + e = e || {}; + var r = new B7e(e); + r.noRefs || X7e(t, r); + var n = t; + return r.replacer && (n = r.replacer.call({ "": n }, "", n)), zu(r, 0, n, !0, !0) ? r.dump + ` ` : ""; } -var OPn = yPn, kPn = { - dump: OPn +var j7e = Z7e, K7e = { + dump: j7e }; -function Sqe(r, n) { +function ZM(t, e) { return function() { - throw new Error("Function yaml." + r + " is removed in js-yaml 4. Use yaml." + n + " instead, which is now safe by default."); + throw new Error("Function yaml." + t + " is removed in js-yaml 4. Use yaml." + e + " instead, which is now safe by default."); }; } -var xPn = $p, SPn = uRt, _Pn = pRt, CPn = wRt, EPn = yRt, TPn = yqe, APn = $Rt.load, DPn = $Rt.loadAll, MPn = kPn.dump, PPn = Am, LPn = { - binary: _Rt, - float: vRt, - map: dRt, - null: gRt, - pairs: ERt, - set: TRt, - timestamp: xRt, - bool: mRt, - int: bRt, - merge: SRt, - omap: CRt, - seq: fRt, - str: hRt -}, IPn = Sqe("safeLoad", "load"), NPn = Sqe("safeLoadAll", "loadAll"), RPn = Sqe("safeDump", "dump"), $Pn = { - Type: xPn, - Schema: SPn, - FAILSAFE_SCHEMA: _Pn, - JSON_SCHEMA: CPn, - CORE_SCHEMA: EPn, - DEFAULT_SCHEMA: TPn, - load: APn, - loadAll: DPn, - dump: MPn, - YAMLException: PPn, - types: LPn, - safeLoad: IPn, - safeLoadAll: NPn, - safeDump: RPn -}; -function BPn(r, n, s, a, l, h = !0) { - const f = []; - for (const w of [...r.core.ruler.__rules__].reverse()) { - if (w.name === n) { - h || f.push(w.name); +var J7e = hs, e8e = kre, t8e = Ere, r8e = Mre, n8e = Dre, i8e = WM, s8e = Zre.load, a8e = Zre.loadAll, o8e = K7e.dump, l8e = ea, c8e = { + binary: Bre, + float: Rre, + map: Cre, + null: _re, + pairs: zre, + set: Vre, + timestamp: Pre, + bool: Are, + int: Lre, + merge: $re, + omap: Fre, + seq: Tre, + str: Sre +}, u8e = ZM("safeLoad", "load"), h8e = ZM("safeLoadAll", "loadAll"), f8e = ZM("safeDump", "dump"), d8e = { + Type: J7e, + Schema: e8e, + FAILSAFE_SCHEMA: t8e, + JSON_SCHEMA: r8e, + CORE_SCHEMA: n8e, + DEFAULT_SCHEMA: i8e, + load: s8e, + loadAll: a8e, + dump: o8e, + YAMLException: l8e, + types: c8e, + safeLoad: u8e, + safeLoadAll: h8e, + safeDump: f8e +}; +function p8e(t, e, r, n, i, s = !0) { + const a = []; + for (const l of [...t.core.ruler.__rules__].reverse()) { + if (l.name === e) { + s || a.push(l.name); break; } - w.name && f.push(w.name); + l.name && a.push(l.name); } - r.core.ruler.disable(f); - let b = []; + t.core.ruler.disable(a); + let o = []; try { - b = r.parse(s, a); + o = t.parse(r, n); } finally { - r.core.ruler.enable(f); + t.core.ruler.enable(a); } - for (const w of b) - w.map = w.map !== null ? [w.map[0] + l, w.map[1] + l] : w.map; - return b; + for (const l of o) + l.map = l.map !== null ? [l.map[0] + i, l.map[1] + i] : l.map; + return o; } -class DP { - constructor(n) { - this.required_arguments = 0, this.optional_arguments = 0, this.final_argument_whitespace = !1, this.has_content = !1, this.option_spec = {}, this.rawOptions = !1, this.state = n; +class $0 { + constructor(e) { + this.required_arguments = 0, this.optional_arguments = 0, this.final_argument_whitespace = !1, this.has_content = !1, this.option_spec = {}, this.rawOptions = !1, this.state = e; } - run(n) { + run(e) { return []; } - assert(n, s) { - if (!n) - throw new Error(s); + assert(e, r) { + if (!e) + throw new Error(r); } - assert_has_content(n) { - if (!n.body) + assert_has_content(e) { + if (!e.body) throw new Error("Content block expected, but none found."); } - createToken(n, s, a, l) { - const h = new this.state.Token(n, s, a); - return (l == null ? void 0 : l.content) !== void 0 && (h.content = l.content), (l == null ? void 0 : l.level) !== void 0 && (h.level = l.level), (l == null ? void 0 : l.map) !== void 0 && (h.map = l.map), (l == null ? void 0 : l.block) !== void 0 && (h.block = l.block), (l == null ? void 0 : l.info) !== void 0 && (h.info = l.info), (l == null ? void 0 : l.meta) !== void 0 && (h.meta = l.meta), (l == null ? void 0 : l.children) !== void 0 && (h.children = l.children), h; + createToken(e, r, n, i) { + const s = new this.state.Token(e, r, n); + return (i == null ? void 0 : i.content) !== void 0 && (s.content = i.content), (i == null ? void 0 : i.level) !== void 0 && (s.level = i.level), (i == null ? void 0 : i.map) !== void 0 && (s.map = i.map), (i == null ? void 0 : i.block) !== void 0 && (s.block = i.block), (i == null ? void 0 : i.info) !== void 0 && (s.info = i.info), (i == null ? void 0 : i.meta) !== void 0 && (s.meta = i.meta), (i == null ? void 0 : i.children) !== void 0 && (s.children = i.children), s; } - nestedParse(n, s) { - return BPn(this.state.md, "run_directives", n, this.state.env, s, !0); + nestedParse(e, r) { + return p8e(this.state.md, "run_directives", e, this.state.env, r, !0); } } -class JT extends Error { +class $h extends Error { constructor() { super(...arguments), this.name = "DirectiveParsingError"; } } -function FPn(r, n) { - const s = r.meta.arg || "", a = r.content; - let l = a.trim() ? a.split(/\r?\n/) : [], h = 0, f = {}; - (Object.keys(n.option_spec || {}) || n.rawOptions) && ([l, f, h] = GRt(l, n)); - let b = []; - if (!n.required_arguments && !n.optional_arguments ? s && (h = 0, l = [s].concat(l)) : b = jPn(s, n), l.length && !l[0].trim() && (l.shift(), h++), l.length && !n.has_content) - throw new JT("Has content but content not allowed"); +function g8e(t, e) { + const r = t.meta.arg || "", n = t.content; + let i = n.trim() ? n.split(/\r?\n/) : [], s = 0, a = {}; + (Object.keys(e.option_spec || {}) || e.rawOptions) && ([i, a, s] = lne(i, e)); + let o = []; + if (!e.required_arguments && !e.optional_arguments ? r && (s = 0, i = [r].concat(i)) : o = m8e(r, e), i.length && !i[0].trim() && (i.shift(), s++), i.length && !e.has_content) + throw new $h("Has content but content not allowed"); return { - map: r.map ? r.map : [0, 0], - args: b, - options: f, - body: l.join(` + map: t.map ? t.map : [0, 0], + args: o, + options: a, + body: i.join(` `), - bodyMap: r.map ? [ - l.length > 0 ? r.map[0] + h : r.map[1], - l.length > 0 ? r.map[1] - 1 : r.map[1] + bodyMap: t.map ? [ + i.length > 0 ? t.map[0] + s : t.map[1], + i.length > 0 ? t.map[1] - 1 : t.map[1] ] : [0, 0] }; } -function GRt(r, n) { - let s = 1, a = {}, l = null; - if (r.length && r[0].startsWith("---")) { - s++; - const h = []; - l = []; - let f = !1; - for (const b of r.slice(1)) { - if (b.startsWith("---")) { - s++, f = !0; +function lne(t, e) { + let r = 1, n = {}, i = null; + if (t.length && t[0].startsWith("---")) { + r++; + const s = []; + i = []; + let a = !1; + for (const o of t.slice(1)) { + if (o.startsWith("---")) { + r++, a = !0; continue; } - f ? h.push(b) : (s++, l.push(b)); + a ? s.push(o) : (r++, i.push(o)); } - r = h; - } else if (r.length && r[0].startsWith(":")) { - const h = []; - l = []; - let f = !1; - for (const b of r) { - if (!f && !b.startsWith(":")) { - f = !0, h.push(b); + t = s; + } else if (t.length && t[0].startsWith(":")) { + const s = []; + i = []; + let a = !1; + for (const o of t) { + if (!a && !o.startsWith(":")) { + a = !0, s.push(o); continue; } - f ? h.push(b) : (s++, l.push(b.slice(1))); + a ? s.push(o) : (r++, i.push(o.slice(1))); } - r = h; + t = s; } - if (l !== null) + if (i !== null) try { - const h = $Pn.load(l.join(` + const s = d8e.load(i.join(` `)); - if (h !== null && typeof h == "object") - a = h; + if (s !== null && typeof s == "object") + n = s; else - throw new JT(`not dict: ${h}`); - } catch (h) { - throw new JT(`Invalid options YAML: ${h}`); - } - if (n.rawOptions) - return [r, a, s]; - for (const [h, f] of Object.entries(a)) { - const b = n.option_spec ? n.option_spec[h] : null; - if (!b) - throw new JT(`Unknown option: ${h}`); - let w = f; - (f === null || f === !1) && (w = ""); + throw new $h(`not dict: ${s}`); + } catch (s) { + throw new $h(`Invalid options YAML: ${s}`); + } + if (e.rawOptions) + return [t, n, r]; + for (const [s, a] of Object.entries(n)) { + const o = e.option_spec ? e.option_spec[s] : null; + if (!o) + throw new $h(`Unknown option: ${s}`); + let l = a; + (a === null || a === !1) && (l = ""); try { - w = b(`${w || ""}`); - } catch (O) { - throw new JT(`Invalid option value: (option: '${h}'; value: ${f}) -${O}`); + l = o(`${l || ""}`); + } catch (u) { + throw new $h(`Invalid option value: (option: '${s}'; value: ${a}) +${u}`); } - a[h] = w; + n[s] = l; } - return [r, a, s]; + return [t, n, r]; } -function jPn(r, n) { - var s; - let a = r.trim() ? (s = r.trim()) === null || s === void 0 ? void 0 : s.split(/\s+/) : []; - const l = (n.required_arguments || 0) + (n.optional_arguments || 0); - if (a.length < (n.required_arguments || 0)) - throw new JT(`${n.required_arguments} argument(s) required, ${a.length} supplied`); - if (a.length > l) - if (n.final_argument_whitespace) { - const h = r.split(/\s+/); - a = h.splice(0, l - 1), a.push(h.join(" ")); +function m8e(t, e) { + var r; + let n = t.trim() ? (r = t.trim()) === null || r === void 0 ? void 0 : r.split(/\s+/) : []; + const i = (e.required_arguments || 0) + (e.optional_arguments || 0); + if (n.length < (e.required_arguments || 0)) + throw new $h(`${e.required_arguments} argument(s) required, ${n.length} supplied`); + if (n.length > i) + if (e.final_argument_whitespace) { + const s = t.split(/\s+/); + n = s.splice(0, i - 1), n.push(s.join(" ")); } else - throw new JT(`maximum ${l} argument(s) allowed, ${a.length} supplied`); - return a; + throw new $h(`maximum ${i} argument(s) allowed, ${n.length} supplied`); + return n; } -function QPn(r, n) { - var s; - let a = n.directivesAfter || "block"; - (!((s = n.replaceFences) !== null && s !== void 0) || s) && (r.core.ruler.after(a, "fence_to_directive", zPn), a = "fence_to_directive"), r.core.ruler.after(a, "run_directives", qPn(n.directives || {})), r.renderer.rules.directive = (l, h) => { - const f = l[h]; +function v8e(t, e) { + var r; + let n = e.directivesAfter || "block"; + (!((r = e.replaceFences) !== null && r !== void 0) || r) && (t.core.ruler.after(n, "fence_to_directive", y8e), n = "fence_to_directive"), t.core.ruler.after(n, "run_directives", b8e(e.directives || {})), t.renderer.rules.directive = (i, s) => { + const a = i[s]; return ` +
${a.info} ${a.meta.arg}
+
${a.content}
`; - }, r.renderer.rules.directive_error = (l, h) => { - const f = l[h]; - let b = ""; - return f.content && (b = ` + }, t.renderer.rules.directive_error = (i, s) => { + const a = i[s]; + let o = ""; + return a.content && (o = ` --- -${f.content}`), ` +${a.content}`), ` `; }; } -function zPn(r) { - for (const n of r.tokens) - if (n.type === "fence" || n.type === "colon_fence") { - const s = n.info.match(/^\{([^\s}]+)\}\s*(.*)$/); - s && (n.type = "directive", n.info = s[1], n.meta = { arg: s[2] }); +function y8e(t) { + for (const e of t.tokens) + if (e.type === "fence" || e.type === "colon_fence") { + const r = e.info.match(/^\{([^\s}]+)\}\s*(.*)$/); + r && (e.type = "directive", e.info = r[1], e.meta = { arg: r[2] }); } return !0; } -function qPn(r) { - function n(s) { - const a = []; - for (const l of s.tokens) - if (l.type === "directive" && l.info in r) +function b8e(t) { + function e(r) { + const n = []; + for (const i of r.tokens) + if (i.type === "directive" && i.info in t) try { - const h = new r[l.info](s), f = FPn(l, h), [b, w] = GRt(l.content.trim() ? l.content.split(/\r?\n/) : [], h), O = new s.Token("parsed_directive_open", "", 1); - O.info = l.info, O.hidden = !0, O.content = b.join(` -`).trim(), O.meta = { - arg: l.meta.arg, - opts: w + const s = new t[i.info](r), a = g8e(i, s), [o, l] = lne(i.content.trim() ? i.content.split(/\r?\n/) : [], s), u = new r.Token("parsed_directive_open", "", 1); + u.info = i.info, u.hidden = !0, u.content = o.join(` +`).trim(), u.meta = { + arg: i.meta.arg, + opts: l }; - const S = [O]; - S.push(...h.run(f)); - const E = new s.Token("parsed_directive_close", "", -1); - E.hidden = !0, S.push(E), S[1].meta = Object.assign(Object.assign({ directive: !0 }, f.options), S[1].meta), a.push(...S); - } catch (h) { - const f = new s.Token("directive_error", "", 0); - f.content = l.content, f.info = l.info, f.meta = l.meta, f.map = l.map, f.meta.error_message = h.message, f.meta.error_name = h.name, a.push(f); + const h = [u]; + h.push(...s.run(a)); + const f = new r.Token("parsed_directive_close", "", -1); + f.hidden = !0, h.push(f), h[1].meta = Object.assign(Object.assign({ directive: !0 }, a.options), h[1].meta), n.push(...h); + } catch (s) { + const a = new r.Token("directive_error", "", 0); + a.content = i.content, a.info = i.info, a.meta = i.meta, a.map = i.map, a.meta.error_message = s.message, a.meta.error_name = s.name, n.push(a); } else - a.push(l); - return s.tokens = a, !0; + n.push(i); + return r.tokens = n, !0; } - return n; + return e; } -function VPn(r) { - return r.toLowerCase().split(/\s+/).join("-").replace(/[^a-z0-9]+/, "-").replace(/^[-0-9]+|-+$/, ""); +function x8e(t) { + return t.toLowerCase().split(/\s+/).join("-").replace(/[^a-z0-9]+/, "-").replace(/^[-0-9]+|-+$/, ""); } -class uP extends Error { +class t0 extends Error { constructor() { super(...arguments), this.name = "OptionSpecError"; } } -const x8 = (r) => r, mje = (r) => { - if (!r) - throw new uP("Argument required but none supplied"); - return r; -}, bje = (r) => { - if (r.trim()) - throw new uP(`No argument is allowed: "${r}" supplied`); +const gf = (t) => t, s8 = (t) => { + if (!t) + throw new t0("Argument required but none supplied"); + return t; +}, a8 = (t) => { + if (t.trim()) + throw new t0(`No argument is allowed: "${t}" supplied`); return null; -}, ij = (r) => `${r || ""}`.split(/\s+/).map((n) => VPn(n)); -function ZRt(r) { - if (!r) - throw new uP("Value is not set"); - const n = Number.parseFloat(r); - if (Number.isNaN(n) || !Number.isInteger(n)) - throw new uP(`Value "${r}" is not an integer`); - return n; -} -function Mve(r) { - const n = ZRt(r); - if (n < 0) - throw new uP(`Value "${r}" must be positive or zero`); - return n; -} -const XRt = (r) => r ? Mve(r) : null, UPn = (r) => (r = `${r || ""}`.replace(/\s+%$/, ""), Mve(r)); -function KRt(r, n) { - const a = new RegExp(`^(?[0-9.]+)\\s*(?${n.join("|")})$`).exec(r); - if (!a || !a.groups) - throw new uP(`not a positive measure of one of the following units: ${n.join("|")}`); - return a.groups.number + a.groups.units; -} -const JRt = ["em", "ex", "px", "in", "cm", "mm", "pt", "pc"], e$t = (r) => KRt(r, [...JRt, ""]), _qe = (r, n = "") => { +}, q1 = (t) => `${t || ""}`.split(/\s+/).map((e) => x8e(e)); +function cne(t) { + if (!t) + throw new t0("Value is not set"); + const e = Number.parseFloat(t); + if (Number.isNaN(e) || !Number.isInteger(e)) + throw new t0(`Value "${t}" is not an integer`); + return e; +} +function o3(t) { + const e = cne(t); + if (e < 0) + throw new t0(`Value "${t}" must be positive or zero`); + return e; +} +const une = (t) => t ? o3(t) : null, w8e = (t) => (t = `${t || ""}`.replace(/\s+%$/, ""), o3(t)); +function hne(t, e) { + const n = new RegExp(`^(?[0-9.]+)\\s*(?${e.join("|")})$`).exec(t); + if (!n || !n.groups) + throw new t0(`not a positive measure of one of the following units: ${e.join("|")}`); + return n.groups.number + n.groups.units; +} +const fne = ["em", "ex", "px", "in", "cm", "mm", "pt", "pc"], dne = (t) => hne(t, [...fne, ""]), jM = (t, e = "") => { try { - return KRt(r, [...JRt, "%"]); + return hne(t, [...fne, "%"]); } catch { - return e$t(r) + n; - } -}, WPn = (r, n = "") => r.toLowerCase() === "image" ? "image" : _qe(r, n); -function Cqe(r) { - return (n) => { - if (n = n.toLowerCase().trim(), r.includes(n)) - return n; - throw new uP(`must be in: ${r.join("|")}`); + return dne(t) + e; + } +}, O8e = (t, e = "") => t.toLowerCase() === "image" ? "image" : jM(t, e); +function KM(t) { + return (e) => { + if (e = e.toLowerCase().trim(), t.includes(e)) + return e; + throw new t0(`must be in: ${t.join("|")}`); }; } -const YPn = (r) => r; -class Tk extends DP { +const k8e = (t) => t; +class Ql extends $0 { constructor() { super(...arguments), this.final_argument_whitespace = !0, this.has_content = !0, this.option_spec = { - class: ij, - name: x8 + class: q1, + name: gf }, this.title = "", this.kind = ""; } - run(n) { - var s; - const a = [], l = this.createToken("admonition_open", "aside", 1, { - map: n.map, + run(e) { + var r; + const n = [], i = this.createToken("admonition_open", "aside", 1, { + map: e.map, block: !0, meta: { kind: this.kind } }); - ((s = n.options.class) === null || s === void 0 ? void 0 : s.length) >= 1 ? (l.attrSet("class", n.options.class.join(" ")), l.attrJoin("class", "admonition")) : l.attrSet("class", "admonition"), this.kind && l.attrJoin("class", this.kind), a.push(l); - const h = this.createToken("admonition_title_open", "header", 1); - h.attrSet("class", "admonition-title"), a.push(h); - const f = n.args[0] || this.title; - a.push(this.createToken("inline", "", 0, { - map: [n.map[0], n.map[0]], - content: f, + ((r = e.options.class) === null || r === void 0 ? void 0 : r.length) >= 1 ? (i.attrSet("class", e.options.class.join(" ")), i.attrJoin("class", "admonition")) : i.attrSet("class", "admonition"), this.kind && i.attrJoin("class", this.kind), n.push(i); + const s = this.createToken("admonition_title_open", "header", 1); + s.attrSet("class", "admonition-title"), n.push(s); + const a = e.args[0] || this.title; + n.push(this.createToken("inline", "", 0, { + map: [e.map[0], e.map[0]], + content: a, children: [] - })), a.push(this.createToken("admonition_title_close", "header", -1, { block: !0 })); - const b = this.nestedParse(n.body, n.bodyMap[0]); - return a.push(...b), a.push(this.createToken("admonition_close", "aside", -1, { block: !0 })), a; + })), n.push(this.createToken("admonition_title_close", "header", -1, { block: !0 })); + const o = this.nestedParse(e.body, e.bodyMap[0]); + return n.push(...o), n.push(this.createToken("admonition_close", "aside", -1, { block: !0 })), n; } } -class HPn extends Tk { +class S8e extends Ql { constructor() { super(...arguments), this.required_arguments = 1; } } -class GPn extends Tk { +class T8e extends Ql { constructor() { super(...arguments), this.title = "Attention", this.kind = "attention"; } } -class ZPn extends Tk { +class C8e extends Ql { constructor() { super(...arguments), this.title = "Caution", this.kind = "caution"; } } -class XPn extends Tk { +class E8e extends Ql { constructor() { super(...arguments), this.title = "Danger", this.kind = "danger"; } } -class KPn extends Tk { +class _8e extends Ql { constructor() { super(...arguments), this.title = "Error", this.kind = "error"; } } -class JPn extends Tk { +class A8e extends Ql { constructor() { super(...arguments), this.title = "Important", this.kind = "important"; } } -class eLn extends Tk { +class L8e extends Ql { constructor() { super(...arguments), this.title = "Hint", this.kind = "hint"; } } -class tLn extends Tk { +class R8e extends Ql { constructor() { super(...arguments), this.title = "Note", this.kind = "note"; } } -class nLn extends Tk { +class M8e extends Ql { constructor() { super(...arguments), this.title = "See Also", this.kind = "seealso"; } } -class rLn extends Tk { +class D8e extends Ql { constructor() { super(...arguments), this.title = "Tip", this.kind = "tip"; } } -class iLn extends Tk { +class N8e extends Ql { constructor() { super(...arguments), this.title = "Warning", this.kind = "warning"; } } -const sLn = { - admonition: HPn, - attention: GPn, - caution: ZPn, - danger: XPn, - error: KPn, - important: JPn, - hint: eLn, - note: tLn, - seealso: nLn, - tip: rLn, - warning: iLn -}; -class oLn extends DP { +const I8e = { + admonition: S8e, + attention: T8e, + caution: C8e, + danger: E8e, + error: _8e, + important: A8e, + hint: L8e, + note: R8e, + seealso: M8e, + tip: D8e, + warning: N8e +}; +class P8e extends $0 { constructor() { super(...arguments), this.required_arguments = 0, this.optional_arguments = 1, this.final_argument_whitespace = !1, this.has_content = !0, this.option_spec = { - "number-lines": XRt, - force: bje, - name: x8, - class: ij + "number-lines": une, + force: a8, + name: gf, + class: q1 }; } - run(n) { - return this.assert_has_content(n), [this.createToken("fence", "code", 0, { - info: n.args ? n.args[0] : "", - content: n.body, - map: n.bodyMap + run(e) { + return this.assert_has_content(e), [this.createToken("fence", "code", 0, { + info: e.args ? e.args[0] : "", + content: e.body, + map: e.bodyMap })]; } } -class aLn extends DP { +class $8e extends $0 { constructor() { super(...arguments), this.required_arguments = 0, this.optional_arguments = 1, this.final_argument_whitespace = !1, this.has_content = !0, this.option_spec = { - linenos: bje, - "lineno-start": ZRt, - dedent: XRt, - "emphasize-lines": mje, - caption: mje, - force: bje, - name: x8, - class: ij + linenos: a8, + "lineno-start": cne, + dedent: une, + "emphasize-lines": s8, + caption: s8, + force: a8, + name: gf, + class: q1 }; } - run(n) { - return this.assert_has_content(n), [this.createToken("fence", "code", 0, { - info: n.args ? n.args[0] : "", - content: n.body, - map: n.bodyMap + run(e) { + return this.assert_has_content(e), [this.createToken("fence", "code", 0, { + info: e.args ? e.args[0] : "", + content: e.body, + map: e.bodyMap })]; } } -class cLn extends DP { +class B8e extends $0 { constructor() { super(...arguments), this.required_arguments = 0, this.optional_arguments = 1, this.final_argument_whitespace = !1, this.has_content = !0, this.rawOptions = !0; } - run(n) { + run(e) { return [this.createToken("fence", "code", 0, { - info: n.args ? n.args[0] : "", - content: n.body, - map: n.bodyMap + info: e.args ? e.args[0] : "", + content: e.body, + map: e.bodyMap })]; } } -const lLn = { - code: oLn, - "code-block": aLn, - "code-cell": cLn -}, t$t = { - alt: x8, - height: e$t, - width: _qe, - scale: UPn, - target: mje, - class: ij, - name: x8 -}; -class n$t extends DP { +const F8e = { + code: P8e, + "code-block": $8e, + "code-cell": B8e +}, pne = { + alt: gf, + height: dne, + width: jM, + scale: w8e, + target: s8, + class: q1, + name: gf +}; +class gne extends $0 { constructor() { - super(...arguments), this.required_arguments = 1, this.optional_arguments = 0, this.final_argument_whitespace = !0, this.option_spec = Object.assign(Object.assign({}, t$t), { align: Cqe(["left", "center", "right", "top", "middle", "bottom"]) }); + super(...arguments), this.required_arguments = 1, this.optional_arguments = 0, this.final_argument_whitespace = !0, this.option_spec = Object.assign(Object.assign({}, pne), { align: KM(["left", "center", "right", "top", "middle", "bottom"]) }); } - create_image(n) { - const s = YPn(n.args[0] || ""), a = this.createToken("image", "img", 0, { map: n.map, block: !0 }); - a.attrSet("src", s), a.attrSet("alt", n.options.alt || ""); - const l = []; - return n.options.alt && this.state.md.inline.parse(n.options.alt, this.state.md, this.state.env, l), a.children = l, n.options.height && a.attrSet("height", n.options.height), n.options.width && a.attrSet("width", n.options.width), n.options.align && a.attrJoin("class", `align-${n.options.align}`), n.options.class && a.attrJoin("class", n.options.class.join(" ")), a; + create_image(e) { + const r = k8e(e.args[0] || ""), n = this.createToken("image", "img", 0, { map: e.map, block: !0 }); + n.attrSet("src", r), n.attrSet("alt", e.options.alt || ""); + const i = []; + return e.options.alt && this.state.md.inline.parse(e.options.alt, this.state.md, this.state.env, i), n.children = i, e.options.height && n.attrSet("height", e.options.height), e.options.width && n.attrSet("width", e.options.width), e.options.align && n.attrJoin("class", `align-${e.options.align}`), e.options.class && n.attrJoin("class", e.options.class.join(" ")), n; } - run(n) { - return [this.create_image(n)]; + run(e) { + return [this.create_image(e)]; } } -class uLn extends n$t { +class z8e extends gne { constructor() { - super(...arguments), this.option_spec = Object.assign(Object.assign({}, t$t), { align: Cqe(["left", "center", "right"]), figwidth: WPn, figclass: ij }), this.has_content = !0; + super(...arguments), this.option_spec = Object.assign(Object.assign({}, pne), { align: KM(["left", "center", "right"]), figwidth: O8e, figclass: q1 }), this.has_content = !0; } - run(n) { - const s = this.createToken("figure_open", "figure", 1, { - map: n.map, + run(e) { + const r = this.createToken("figure_open", "figure", 1, { + map: e.map, block: !0 }); - n.options.figclass && s.attrJoin("class", n.options.figclass.join(" ")), n.options.align && s.attrJoin("class", `align-${n.options.align}`), n.options.figwidth && n.options.figwidth !== "image" && s.attrSet("width", n.options.figwidth); - let a; - n.options.name && (a = oRt( + e.options.figclass && r.attrJoin("class", e.options.figclass.join(" ")), e.options.align && r.attrJoin("class", `align-${e.options.align}`), e.options.figwidth && e.options.figwidth !== "image" && r.attrSet("width", e.options.figwidth); + let n; + e.options.name && (n = bre( this.state, - s, - qK.figure, - n.options.name, - n.body.trim() - ), s.attrJoin("class", "numbered")); - const l = this.create_image(n); - l.map = [n.map[0], n.map[0]]; - let h = [], f = []; - if (n.body) { - const [w, ...O] = n.body.split(` + r, + Ky.figure, + e.options.name, + e.body.trim() + ), r.attrJoin("class", "numbered")); + const i = this.create_image(e); + i.map = [e.map[0], e.map[0]]; + let s = [], a = []; + if (e.body) { + const [l, ...u] = e.body.split(` -`), S = O.join(` +`), h = u.join(` -`), E = n.bodyMap[0], D = this.createToken("figure_caption_open", "figcaption", 1, { +`), f = e.bodyMap[0], d = this.createToken("figure_caption_open", "figcaption", 1, { block: !0 }); - a && D.attrSet("number", `${a.number}`); - const M = this.nestedParse(w, E), B = this.createToken("figure_caption_close", "figcaption", -1, { + n && d.attrSet("number", `${n.number}`); + const p = this.nestedParse(l, f), g = this.createToken("figure_caption_close", "figcaption", -1, { block: !0 }); - if (h = [D, ...M, B], S) { - const z = E + w.split(` -`).length + 1, W = this.createToken("figure_legend_open", "", 1, { + if (s = [d, ...p, g], h) { + const m = f + l.split(` +`).length + 1, v = this.createToken("figure_legend_open", "", 1, { block: !0 - }), H = this.nestedParse(S, z), G = this.createToken("figure_legend_close", "", -1, { + }), y = this.nestedParse(h, m), b = this.createToken("figure_legend_close", "", -1, { block: !0 }); - f = [W, ...H, G]; + a = [v, ...y, b]; } } - const b = this.createToken("figure_close", "figure", -1, { block: !0 }); - return [s, l, ...h, ...f, b]; + const o = this.createToken("figure_close", "figure", -1, { block: !0 }); + return [r, i, ...s, ...a, o]; } } -const hLn = { - image: n$t, - figure: uLn +const V8e = { + image: gne, + figure: z8e }; -class Eqe { - constructor(n, s = !0) { - if (this.children = [], this.children = [], s) { - this._set_children_from_tokens(n); +class JM { + constructor(e, r = !0) { + if (this.children = [], this.children = [], r) { + this._set_children_from_tokens(e); return; } - if (n.length === 0) + if (e.length === 0) throw new Error("Tree creation: Can only create root from empty token sequence."); - if (n.length === 1) { - const a = n[0]; - if (a.nesting) + if (e.length === 1) { + const n = e[0]; + if (n.nesting) throw new Error("Unequal nesting level at the start and end of token stream."); - this.token = a, a.children !== null && a.children.length > 0 && this._set_children_from_tokens(a.children); + this.token = n, n.children !== null && n.children.length > 0 && this._set_children_from_tokens(n.children); } else - this.nester_tokens = { opening: n[0], closing: n[n.length - 1] }, this._set_children_from_tokens(n.slice(1, -1)); - } - _set_children_from_tokens(n) { - const s = [...n].reverse(); - let a; - for (; s.length > 0 && (a = s.pop(), !!a); ) { - if (!a.nesting) { - this._add_child([a]); + this.nester_tokens = { opening: e[0], closing: e[e.length - 1] }, this._set_children_from_tokens(e.slice(1, -1)); + } + _set_children_from_tokens(e) { + const r = [...e].reverse(); + let n; + for (; r.length > 0 && (n = r.pop(), !!n); ) { + if (!n.nesting) { + this._add_child([n]); continue; } - if (a.nesting !== 1) + if (n.nesting !== 1) throw new Error("Invalid token nesting"); - const l = [a]; - let h = 1; - for (; s.length > 0 && h !== 0; ) - a = s.pop(), a && (l.push(a), h += a.nesting); - if (h) - throw new Error(`unclosed tokens starting: ${l[0]}`); - this._add_child(l); + const i = [n]; + let s = 1; + for (; r.length > 0 && s !== 0; ) + n = r.pop(), n && (i.push(n), s += n.nesting); + if (s) + throw new Error(`unclosed tokens starting: ${i[0]}`); + this._add_child(i); } } - _add_child(n) { - const s = new Eqe(n, !1); - s.parent = this, this.children.push(s); + _add_child(e) { + const r = new JM(e, !1); + r.parent = this, this.children.push(r); } to_tokens() { - function n(a, l) { - if (a.type === "root") - for (const h of a.children) - n(h, l); - else if (a.token) - l.push(a.token); + function e(n, i) { + if (n.type === "root") + for (const s of n.children) + e(s, i); + else if (n.token) + i.push(n.token); else { - if (!a.nester_tokens) + if (!n.nester_tokens) throw new Error("No nested token available"); - l.push(a.nester_tokens.opening); - for (const h of a.children) - n(h, l); - l.push(a.nester_tokens.closing); + i.push(n.nester_tokens.opening); + for (const s of n.children) + e(s, i); + i.push(n.nester_tokens.closing); } } - const s = []; - return n(this, s), s; + const r = []; + return e(this, r), r; } get is_root() { return !(this.token || this.nester_tokens); @@ -28349,21 +28358,21 @@ class Eqe { get siblings() { return this.parent ? this.parent.children : [this]; } - *walk(n = !0) { - n && (yield this); - for (const s of this.children) - yield* s.walk(!0); + *walk(e = !0) { + e && (yield this); + for (const r of this.children) + yield* r.walk(!0); } get type() { - var n, s, a; + var e, r, n; if (this.is_root) return "root"; if (this.token) return this.token.type; - if (!((n = this.nester_tokens) === null || n === void 0) && n.opening.type.endsWith("_open")) - return (s = this.nester_tokens) === null || s === void 0 ? void 0 : s.opening.type.slice(0, -5); + if (!((e = this.nester_tokens) === null || e === void 0) && e.opening.type.endsWith("_open")) + return (r = this.nester_tokens) === null || r === void 0 ? void 0 : r.opening.type.slice(0, -5); if (this.nester_tokens) - return (a = this.nester_tokens) === null || a === void 0 ? void 0 : a.opening.type; + return (n = this.nester_tokens) === null || n === void 0 ? void 0 : n.opening.type; throw new Error("no internal token"); } attribute_token() { @@ -28404,119 +28413,119 @@ class Eqe { return this.attribute_token().attrs; } } -class fLn extends DP { +class U8e extends $0 { constructor() { super(...arguments), this.required_arguments = 0, this.optional_arguments = 1, this.final_argument_whitespace = !0, this.has_content = !0, this.option_spec = { - "header-rows": Mve, - "stub-columns": Mve, - width: _qe, - widths: x8, - class: ij, - name: x8, - align: Cqe(["left", "center", "right"]) + "header-rows": o3, + "stub-columns": o3, + width: jM, + widths: gf, + class: q1, + name: gf, + align: KM(["left", "center", "right"]) }; } - run(n) { - this.assert_has_content(n); - const s = n.options["header-rows"] || 0, a = this.nestedParse(n.body, n.bodyMap[0]); - if (a.length < 2 || a[0].type !== "bullet_list_open" || a[a.length - 1].type !== "bullet_list_close") - throw new JT("Content is not a single bullet list"); - const l = [], h = this.createToken("table_open", "table", 1, { map: n.bodyMap }); - n.options.align && h.attrJoin("class", `align-${n.options.align}`), n.options.class && h.attrJoin("class", n.options.class.join(" ")), l.push(h), n.args.length && n.args[0] && (l.push(this.createToken("table_caption_open", "caption", 1)), l.push(this.createToken("inline", "", 0, { - map: [n.map[0], n.map[0]], - content: n.args[0], + run(e) { + this.assert_has_content(e); + const r = e.options["header-rows"] || 0, n = this.nestedParse(e.body, e.bodyMap[0]); + if (n.length < 2 || n[0].type !== "bullet_list_open" || n[n.length - 1].type !== "bullet_list_close") + throw new $h("Content is not a single bullet list"); + const i = [], s = this.createToken("table_open", "table", 1, { map: e.bodyMap }); + e.options.align && s.attrJoin("class", `align-${e.options.align}`), e.options.class && s.attrJoin("class", e.options.class.join(" ")), i.push(s), e.args.length && e.args[0] && (i.push(this.createToken("table_caption_open", "caption", 1)), i.push(this.createToken("inline", "", 0, { + map: [e.map[0], e.map[0]], + content: e.args[0], children: [] - })), l.push(this.createToken("table_caption_close", "caption", -1))); - let f = "th"; - s ? (l.push(this.createToken("thead_open", "thead", 1, { level: 1 })), f = "th") : (l.push(this.createToken("tbody_open", "tbody", 1, { level: 1 })), f = "td"); - let b, w = 0; - for (const O of new Eqe(a.slice(1, -1)).children) { - w += 1, this.assert(O.type === "list_item", `list item ${w} not of type 'list_item': ${O.type}`), this.assert(O.children.length === 1 && O.children[0].type === "bullet_list", `list item ${w} content not a nested bullet list`); - const S = O.children[0].children; - b === void 0 ? b = S.length : this.assert(S.length === b, `list item ${w} does not contain the same number of columns as previous items`), s && w === s + 1 && (l.push(this.createToken("thead_close", "thead", -1, { level: 1 })), l.push(this.createToken("tbody_open", "tbody", 1, { level: 1 })), f = "td"), l.push(this.createToken("tr_open", "tr", 1, { map: O.map, level: 2 })); - for (const E of S) - l.push(this.createToken(`${f}_open`, f, 1, { map: E.map, level: 3 })), l.push(...E.to_tokens().slice(1, -1)), l.push(this.createToken(`${f}_close`, f, -1, { level: 3 })); - l.push(this.createToken("tr_close", "tr", -1, { level: 2 })); - } - if (s && w < s) - throw new Error(`Insufficient rows (${w}) for required header rows (${s})`); - return f === "td" ? l.push(this.createToken("tbody_close", "tbody", -1, { level: 1 })) : l.push(this.createToken("thead_close", "thead", -1, { level: 1 })), l.push(this.createToken("table_close", "table", -1)), l; - } -} -const dLn = { - "list-table": fLn -}; -class pLn extends DP { + })), i.push(this.createToken("table_caption_close", "caption", -1))); + let a = "th"; + r ? (i.push(this.createToken("thead_open", "thead", 1, { level: 1 })), a = "th") : (i.push(this.createToken("tbody_open", "tbody", 1, { level: 1 })), a = "td"); + let o, l = 0; + for (const u of new JM(n.slice(1, -1)).children) { + l += 1, this.assert(u.type === "list_item", `list item ${l} not of type 'list_item': ${u.type}`), this.assert(u.children.length === 1 && u.children[0].type === "bullet_list", `list item ${l} content not a nested bullet list`); + const h = u.children[0].children; + o === void 0 ? o = h.length : this.assert(h.length === o, `list item ${l} does not contain the same number of columns as previous items`), r && l === r + 1 && (i.push(this.createToken("thead_close", "thead", -1, { level: 1 })), i.push(this.createToken("tbody_open", "tbody", 1, { level: 1 })), a = "td"), i.push(this.createToken("tr_open", "tr", 1, { map: u.map, level: 2 })); + for (const f of h) + i.push(this.createToken(`${a}_open`, a, 1, { map: f.map, level: 3 })), i.push(...f.to_tokens().slice(1, -1)), i.push(this.createToken(`${a}_close`, a, -1, { level: 3 })); + i.push(this.createToken("tr_close", "tr", -1, { level: 2 })); + } + if (r && l < r) + throw new Error(`Insufficient rows (${l}) for required header rows (${r})`); + return a === "td" ? i.push(this.createToken("tbody_close", "tbody", -1, { level: 1 })) : i.push(this.createToken("thead_close", "thead", -1, { level: 1 })), i.push(this.createToken("table_close", "table", -1)), i; + } +} +const q8e = { + "list-table": U8e +}; +class Q8e extends $0 { constructor() { super(...arguments), this.required_arguments = 0, this.optional_arguments = 0, this.final_argument_whitespace = !1, this.has_content = !0, this.option_spec = { - label: x8 + label: gf }; } - run(n) { - this.assert_has_content(n); - const s = this.createToken("math_block", "div", 0, { - content: n.body, - map: n.bodyMap, + run(e) { + this.assert_has_content(e); + const r = this.createToken("math_block", "div", 0, { + content: e.body, + map: e.bodyMap, block: !0 }); - if (s.attrSet("class", "math block"), n.options.label) { - s.attrSet("id", n.options.label); - const a = oRt(this.state, s, qK.equation, n.options.label, ""); - s.attrSet("number", `${a.number}`), s.info = n.options.label, s.meta = { label: n.options.label, numbered: !0, number: a.number }; + if (r.attrSet("class", "math block"), e.options.label) { + r.attrSet("id", e.options.label); + const n = bre(this.state, r, Ky.equation, e.options.label, ""); + r.attrSet("number", `${n.number}`), r.info = e.options.label, r.meta = { label: e.options.label, numbered: !0, number: n.number }; } - return [s]; + return [r]; } } -const gLn = { - math: pLn -}, mLn = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sLn), hLn), lLn), dLn), gLn); -function bLn(r) { - return (n) => { - const s = wwe(n); - return s.references.forEach((a) => { - const { label: l, tokens: h, contentFromTarget: f } = a, b = (O, S) => (h.open.attrJoin("class", "error"), h.open.tag = h.close.tag = "code", f && S ? h.content.content = f(S) : h.content.content = O, !0), w = s.targets[l]; - if (!w) - return b(l, { - kind: a.kind || "", - label: l, - title: l, - number: `"${l}"` +const Y8e = { + math: Q8e +}, W8e = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, I8e), V8e), F8e), q8e), Y8e); +function G8e(t) { + return (e) => { + const r = iT(e); + return r.references.forEach((n) => { + const { label: i, tokens: s, contentFromTarget: a } = n, o = (u, h) => (s.open.attrJoin("class", "error"), s.open.tag = s.close.tag = "code", a && h ? s.content.content = a(h) : s.content.content = u, !0), l = r.targets[i]; + if (!l) + return o(i, { + kind: n.kind || "", + label: i, + title: i, + number: `"${i}"` }); - if (a.kind && w.kind !== a.kind) - return b(`Reference "${l}" does not match kind "${a.kind}"`); - h.open.attrSet("href", `#${w.label}`), w.title && h.open.attrSet("title", w.title), f && (h.content.content = f(w).trim()); + if (n.kind && l.kind !== n.kind) + return o(`Reference "${i}" does not match kind "${n.kind}"`); + s.open.attrSet("href", `#${l.label}`), l.title && s.open.attrSet("title", l.title), a && (s.content.content = a(l).trim()); }), !0; }; } -function vLn(r, n) { - r.core.ruler.push("docutils_number", bLn()); +function H8e(t, e) { + t.core.ruler.push("docutils_number", G8e()); } -const wLn = { +const X8e = { parseRoles: !0, replaceFences: !0, rolesAfter: "inline", directivesAfter: "block", - directives: mLn, - roles: bDn + directives: W8e, + roles: G_e }; -function yLn(r, n) { - const s = Object.assign(Object.assign({}, wLn), n); - r.use(sRt, s), r.use(QPn, s), r.use(vLn, s); +function Z8e(t, e) { + const r = Object.assign(Object.assign({}, X8e), e); + t.use(yre, r), t.use(v8e, r), t.use(H8e, r); } /*! @license DOMPurify 2.4.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.7/LICENSE */ -function WT(r) { - return WT = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) { - return typeof n; - } : function(n) { - return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n; - }, WT(r); -} -function vje(r, n) { - return vje = Object.setPrototypeOf || function(a, l) { - return a.__proto__ = l, a; - }, vje(r, n); -} -function OLn() { +function _h(t) { + return _h = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) { + return typeof e; + } : function(e) { + return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; + }, _h(t); +} +function o8(t, e) { + return o8 = Object.setPrototypeOf || function(n, i) { + return n.__proto__ = i, n; + }, o8(t, e); +} +function j8e() { if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1; if (typeof Proxy == "function") @@ -28528,153 +28537,153 @@ function OLn() { return !1; } } -function cbe(r, n, s) { - return OLn() ? cbe = Reflect.construct : cbe = function(l, h, f) { - var b = [null]; - b.push.apply(b, h); - var w = Function.bind.apply(l, b), O = new w(); - return f && vje(O, f.prototype), O; - }, cbe.apply(null, arguments); -} -function ek(r) { - return kLn(r) || xLn(r) || SLn(r) || _Ln(); -} -function kLn(r) { - if (Array.isArray(r)) - return wje(r); -} -function xLn(r) { - if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) - return Array.from(r); -} -function SLn(r, n) { - if (!!r) { - if (typeof r == "string") - return wje(r, n); - var s = Object.prototype.toString.call(r).slice(8, -1); - if (s === "Object" && r.constructor && (s = r.constructor.name), s === "Map" || s === "Set") - return Array.from(r); - if (s === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)) - return wje(r, n); - } -} -function wje(r, n) { - (n == null || n > r.length) && (n = r.length); - for (var s = 0, a = new Array(n); s < n; s++) - a[s] = r[s]; - return a; +function b4(t, e, r) { + return j8e() ? b4 = Reflect.construct : b4 = function(i, s, a) { + var o = [null]; + o.push.apply(o, s); + var l = Function.bind.apply(i, o), u = new l(); + return a && o8(u, a.prototype), u; + }, b4.apply(null, arguments); +} +function sl(t) { + return K8e(t) || J8e(t) || eLe(t) || tLe(); +} +function K8e(t) { + if (Array.isArray(t)) + return l8(t); +} +function J8e(t) { + if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null) + return Array.from(t); +} +function eLe(t, e) { + if (!!t) { + if (typeof t == "string") + return l8(t, e); + var r = Object.prototype.toString.call(t).slice(8, -1); + if (r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set") + return Array.from(t); + if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) + return l8(t, e); + } +} +function l8(t, e) { + (e == null || e > t.length) && (e = t.length); + for (var r = 0, n = new Array(e); r < e; r++) + n[r] = t[r]; + return n; } -function _Ln() { +function tLe() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } -var CLn = Object.hasOwnProperty, RTt = Object.setPrototypeOf, ELn = Object.isFrozen, TLn = Object.getPrototypeOf, ALn = Object.getOwnPropertyDescriptor, Rm = Object.freeze, wk = Object.seal, DLn = Object.create, r$t = typeof Reflect < "u" && Reflect, Pve = r$t.apply, yje = r$t.construct; -Pve || (Pve = function(n, s, a) { - return n.apply(s, a); +var rLe = Object.hasOwnProperty, hV = Object.setPrototypeOf, nLe = Object.isFrozen, iLe = Object.getPrototypeOf, sLe = Object.getOwnPropertyDescriptor, oa = Object.freeze, Pl = Object.seal, aLe = Object.create, mne = typeof Reflect < "u" && Reflect, l3 = mne.apply, c8 = mne.construct; +l3 || (l3 = function(e, r, n) { + return e.apply(r, n); }); -Rm || (Rm = function(n) { - return n; +oa || (oa = function(e) { + return e; }); -wk || (wk = function(n) { - return n; +Pl || (Pl = function(e) { + return e; }); -yje || (yje = function(n, s) { - return cbe(n, ek(s)); +c8 || (c8 = function(e, r) { + return b4(e, sl(r)); }); -var MLn = Ky(Array.prototype.forEach), $Tt = Ky(Array.prototype.pop), iX = Ky(Array.prototype.push), lbe = Ky(String.prototype.toLowerCase), h$e = Ky(String.prototype.toString), PLn = Ky(String.prototype.match), XO = Ky(String.prototype.replace), LLn = Ky(String.prototype.indexOf), ILn = Ky(String.prototype.trim), Em = Ky(RegExp.prototype.test), f$e = NLn(TypeError); -function Ky(r) { - return function(n) { - for (var s = arguments.length, a = new Array(s > 1 ? s - 1 : 0), l = 1; l < s; l++) - a[l - 1] = arguments[l]; - return Pve(r, n, a); +var oLe = qo(Array.prototype.forEach), fV = qo(Array.prototype.pop), Pm = qo(Array.prototype.push), x4 = qo(String.prototype.toLowerCase), a6 = qo(String.prototype.toString), lLe = qo(String.prototype.match), il = qo(String.prototype.replace), cLe = qo(String.prototype.indexOf), uLe = qo(String.prototype.trim), Xs = qo(RegExp.prototype.test), o6 = hLe(TypeError); +function qo(t) { + return function(e) { + for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++) + n[i - 1] = arguments[i]; + return l3(t, e, n); }; } -function NLn(r) { +function hLe(t) { return function() { - for (var n = arguments.length, s = new Array(n), a = 0; a < n; a++) - s[a] = arguments[a]; - return yje(r, s); + for (var e = arguments.length, r = new Array(e), n = 0; n < e; n++) + r[n] = arguments[n]; + return c8(t, r); }; } -function uc(r, n, s) { - var a; - s = (a = s) !== null && a !== void 0 ? a : lbe, RTt && RTt(r, null); - for (var l = n.length; l--; ) { - var h = n[l]; - if (typeof h == "string") { - var f = s(h); - f !== h && (ELn(n) || (n[l] = f), h = f); +function mr(t, e, r) { + var n; + r = (n = r) !== null && n !== void 0 ? n : x4, hV && hV(t, null); + for (var i = e.length; i--; ) { + var s = e[i]; + if (typeof s == "string") { + var a = r(s); + a !== s && (nLe(e) || (e[i] = a), s = a); } - r[h] = !0; + t[s] = !0; } - return r; + return t; } -function xM(r) { - var n = DLn(null), s; - for (s in r) - Pve(CLn, r, [s]) === !0 && (n[s] = r[s]); - return n; +function jf(t) { + var e = aLe(null), r; + for (r in t) + l3(rLe, t, [r]) === !0 && (e[r] = t[r]); + return e; } -function lme(r, n) { - for (; r !== null; ) { - var s = ALn(r, n); - if (s) { - if (s.get) - return Ky(s.get); - if (typeof s.value == "function") - return Ky(s.value); +function $w(t, e) { + for (; t !== null; ) { + var r = sLe(t, e); + if (r) { + if (r.get) + return qo(r.get); + if (typeof r.value == "function") + return qo(r.value); } - r = TLn(r); + t = iLe(t); } - function a(l) { - return console.warn("fallback value for", l), null; + function n(i) { + return console.warn("fallback value for", i), null; } - return a; + return n; } -var BTt = Rm(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), d$e = Rm(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), p$e = Rm(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), RLn = Rm(["animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), g$e = Rm(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]), $Ln = Rm(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), FTt = Rm(["#text"]), jTt = Rm(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]), m$e = Rm(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), QTt = Rm(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), ume = Rm(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), BLn = wk(/\{\{[\w\W]*|[\w\W]*\}\}/gm), FLn = wk(/<%[\w\W]*|[\w\W]*%>/gm), jLn = wk(/\${[\w\W]*}/gm), QLn = wk(/^data-[\-\w.\u00B7-\uFFFF]/), zLn = wk(/^aria-[\-\w]+$/), qLn = wk( +var dV = oa(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), l6 = oa(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), c6 = oa(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), fLe = oa(["animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), u6 = oa(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]), dLe = oa(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), pV = oa(["#text"]), gV = oa(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]), h6 = oa(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), mV = oa(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Bw = oa(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), pLe = Pl(/\{\{[\w\W]*|[\w\W]*\}\}/gm), gLe = Pl(/<%[\w\W]*|[\w\W]*%>/gm), mLe = Pl(/\${[\w\W]*}/gm), vLe = Pl(/^data-[\-\w.\u00B7-\uFFFF]/), yLe = Pl(/^aria-[\-\w]+$/), bLe = Pl( /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i -), VLn = wk(/^(?:\w+script|data):/i), ULn = wk( +), xLe = Pl(/^(?:\w+script|data):/i), wLe = Pl( /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g -), WLn = wk(/^html$/i), YLn = function() { +), OLe = Pl(/^html$/i), kLe = function() { return typeof window > "u" ? null : window; -}, HLn = function(n, s) { - if (WT(n) !== "object" || typeof n.createPolicy != "function") +}, SLe = function(e, r) { + if (_h(e) !== "object" || typeof e.createPolicy != "function") return null; - var a = null, l = "data-tt-policy-suffix"; - s.currentScript && s.currentScript.hasAttribute(l) && (a = s.currentScript.getAttribute(l)); - var h = "dompurify" + (a ? "#" + a : ""); + var n = null, i = "data-tt-policy-suffix"; + r.currentScript && r.currentScript.hasAttribute(i) && (n = r.currentScript.getAttribute(i)); + var s = "dompurify" + (n ? "#" + n : ""); try { - return n.createPolicy(h, { - createHTML: function(b) { - return b; + return e.createPolicy(s, { + createHTML: function(o) { + return o; }, - createScriptURL: function(b) { - return b; + createScriptURL: function(o) { + return o; } }); } catch { - return console.warn("TrustedTypes policy " + h + " could not be created."), null; + return console.warn("TrustedTypes policy " + s + " could not be created."), null; } }; -function i$t() { - var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : YLn(), n = function(ot) { - return i$t(ot); +function vne() { + var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : kLe(), e = function(te) { + return vne(te); }; - if (n.version = "2.4.7", n.removed = [], !r || !r.document || r.document.nodeType !== 9) - return n.isSupported = !1, n; - var s = r.document, a = r.document, l = r.DocumentFragment, h = r.HTMLTemplateElement, f = r.Node, b = r.Element, w = r.NodeFilter, O = r.NamedNodeMap, S = O === void 0 ? r.NamedNodeMap || r.MozNamedAttrMap : O, E = r.HTMLFormElement, D = r.DOMParser, M = r.trustedTypes, B = b.prototype, z = lme(B, "cloneNode"), W = lme(B, "nextSibling"), H = lme(B, "childNodes"), G = lme(B, "parentNode"); - if (typeof h == "function") { - var ee = a.createElement("template"); - ee.content && ee.content.ownerDocument && (a = ee.content.ownerDocument); - } - var le = HLn(M, s), se = le ? le.createHTML("") : "", he = a, te = he.implementation, be = he.createNodeIterator, fe = he.createDocumentFragment, ae = he.getElementsByTagName, ke = s.importNode, we = {}; + if (e.version = "2.4.7", e.removed = [], !t || !t.document || t.document.nodeType !== 9) + return e.isSupported = !1, e; + var r = t.document, n = t.document, i = t.DocumentFragment, s = t.HTMLTemplateElement, a = t.Node, o = t.Element, l = t.NodeFilter, u = t.NamedNodeMap, h = u === void 0 ? t.NamedNodeMap || t.MozNamedAttrMap : u, f = t.HTMLFormElement, d = t.DOMParser, p = t.trustedTypes, g = o.prototype, m = $w(g, "cloneNode"), v = $w(g, "nextSibling"), y = $w(g, "childNodes"), b = $w(g, "parentNode"); + if (typeof s == "function") { + var w = n.createElement("template"); + w.content && w.content.ownerDocument && (n = w.content.ownerDocument); + } + var O = SLe(p, r), S = O ? O.createHTML("") : "", C = n, T = C.implementation, A = C.createNodeIterator, E = C.createDocumentFragment, L = C.getElementsByTagName, _ = r.importNode, R = {}; try { - we = xM(a).documentMode ? a.documentMode : {}; + R = jf(n).documentMode ? n.documentMode : {}; } catch { } - var Ce = {}; - n.isSupported = typeof G == "function" && te && te.createHTMLDocument !== void 0 && we !== 9; - var X = BLn, Ie = FLn, ge = jLn, Fe = QLn, ve = zLn, Ve = VLn, tt = ULn, wt = qLn, dt = null, Dt = uc({}, [].concat(ek(BTt), ek(d$e), ek(p$e), ek(g$e), ek(FTt))), It = null, cn = uc({}, [].concat(ek(jTt), ek(m$e), ek(QTt), ek(ume))), lt = Object.seal(Object.create(null, { + var $ = {}; + e.isSupported = typeof b == "function" && T && T.createHTMLDocument !== void 0 && R !== 9; + var k = pLe, N = gLe, M = mLe, I = vLe, D = yLe, P = xLe, F = wLe, B = bLe, V = null, Q = mr({}, [].concat(sl(dV), sl(l6), sl(c6), sl(u6), sl(pV))), G = null, ee = mr({}, [].concat(sl(gV), sl(h6), sl(mV), sl(Bw))), Y = Object.seal(Object.create(null, { tagNameCheck: { writable: !0, configurable: !1, @@ -28693,143 +28702,143 @@ function i$t() { enumerable: !0, value: !1 } - })), pr = null, At = null, St = !0, yt = !0, Et = !1, qe = !0, Ze = !1, Mt = !1, Ue = !1, Mn = !1, Be = !1, Kn = !1, Kt = !1, bi = !0, $r = !1, ur = "user-content-", er = !0, or = !1, Ln = {}, rr = null, Jo = uc({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]), ro = null, es = uc({}, ["audio", "video", "img", "source", "image", "track"]), ts = null, xo = uc({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), dc = "http://www.w3.org/1998/Math/MathML", Ks = "http://www.w3.org/2000/svg", Zi = "http://www.w3.org/1999/xhtml", Pi = Zi, Sr = !1, gr = null, ai = uc({}, [dc, Ks, Zi], h$e), Hn, Xi = ["application/xhtml+xml", "text/html"], gn = "text/html", Ki, jn = null, So = a.createElement("form"), io = function(ot) { - return ot instanceof RegExp || ot instanceof Function; - }, Bo = function(ot) { - jn && jn === ot || ((!ot || WT(ot) !== "object") && (ot = {}), ot = xM(ot), Hn = Xi.indexOf(ot.PARSER_MEDIA_TYPE) === -1 ? Hn = gn : Hn = ot.PARSER_MEDIA_TYPE, Ki = Hn === "application/xhtml+xml" ? h$e : lbe, dt = "ALLOWED_TAGS" in ot ? uc({}, ot.ALLOWED_TAGS, Ki) : Dt, It = "ALLOWED_ATTR" in ot ? uc({}, ot.ALLOWED_ATTR, Ki) : cn, gr = "ALLOWED_NAMESPACES" in ot ? uc({}, ot.ALLOWED_NAMESPACES, h$e) : ai, ts = "ADD_URI_SAFE_ATTR" in ot ? uc( - xM(xo), - ot.ADD_URI_SAFE_ATTR, - Ki - ) : xo, ro = "ADD_DATA_URI_TAGS" in ot ? uc( - xM(es), - ot.ADD_DATA_URI_TAGS, - Ki - ) : es, rr = "FORBID_CONTENTS" in ot ? uc({}, ot.FORBID_CONTENTS, Ki) : Jo, pr = "FORBID_TAGS" in ot ? uc({}, ot.FORBID_TAGS, Ki) : {}, At = "FORBID_ATTR" in ot ? uc({}, ot.FORBID_ATTR, Ki) : {}, Ln = "USE_PROFILES" in ot ? ot.USE_PROFILES : !1, St = ot.ALLOW_ARIA_ATTR !== !1, yt = ot.ALLOW_DATA_ATTR !== !1, Et = ot.ALLOW_UNKNOWN_PROTOCOLS || !1, qe = ot.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ze = ot.SAFE_FOR_TEMPLATES || !1, Mt = ot.WHOLE_DOCUMENT || !1, Be = ot.RETURN_DOM || !1, Kn = ot.RETURN_DOM_FRAGMENT || !1, Kt = ot.RETURN_TRUSTED_TYPE || !1, Mn = ot.FORCE_BODY || !1, bi = ot.SANITIZE_DOM !== !1, $r = ot.SANITIZE_NAMED_PROPS || !1, er = ot.KEEP_CONTENT !== !1, or = ot.IN_PLACE || !1, wt = ot.ALLOWED_URI_REGEXP || wt, Pi = ot.NAMESPACE || Zi, lt = ot.CUSTOM_ELEMENT_HANDLING || {}, ot.CUSTOM_ELEMENT_HANDLING && io(ot.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (lt.tagNameCheck = ot.CUSTOM_ELEMENT_HANDLING.tagNameCheck), ot.CUSTOM_ELEMENT_HANDLING && io(ot.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (lt.attributeNameCheck = ot.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), ot.CUSTOM_ELEMENT_HANDLING && typeof ot.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (lt.allowCustomizedBuiltInElements = ot.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Ze && (yt = !1), Kn && (Be = !0), Ln && (dt = uc({}, ek(FTt)), It = [], Ln.html === !0 && (uc(dt, BTt), uc(It, jTt)), Ln.svg === !0 && (uc(dt, d$e), uc(It, m$e), uc(It, ume)), Ln.svgFilters === !0 && (uc(dt, p$e), uc(It, m$e), uc(It, ume)), Ln.mathMl === !0 && (uc(dt, g$e), uc(It, QTt), uc(It, ume))), ot.ADD_TAGS && (dt === Dt && (dt = xM(dt)), uc(dt, ot.ADD_TAGS, Ki)), ot.ADD_ATTR && (It === cn && (It = xM(It)), uc(It, ot.ADD_ATTR, Ki)), ot.ADD_URI_SAFE_ATTR && uc(ts, ot.ADD_URI_SAFE_ATTR, Ki), ot.FORBID_CONTENTS && (rr === Jo && (rr = xM(rr)), uc(rr, ot.FORBID_CONTENTS, Ki)), er && (dt["#text"] = !0), Mt && uc(dt, ["html", "head", "body"]), dt.table && (uc(dt, ["tbody"]), delete pr.tbody), Rm && Rm(ot), jn = ot); - }, Vo = uc({}, ["mi", "mo", "mn", "ms", "mtext"]), ea = uc({}, ["foreignobject", "desc", "title", "annotation-xml"]), ss = uc({}, ["title", "style", "font", "a", "script"]), Us = uc({}, d$e); - uc(Us, p$e), uc(Us, RLn); - var Fo = uc({}, g$e); - uc(Fo, $Ln); - var Js = function(ot) { - var pn = G(ot); - (!pn || !pn.tagName) && (pn = { - namespaceURI: Pi, + })), ne = null, ie = null, U = !0, Z = !0, W = !1, j = !0, ae = !1, se = !1, K = !1, _e = !1, ce = !1, Ee = !1, Ae = !1, Ue = !0, Ge = !1, Ye = "user-content-", De = !0, he = !1, H = {}, oe = null, ve = mr({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]), re = null, ue = mr({}, ["audio", "video", "img", "source", "image", "track"]), fe = null, de = mr({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ge = "http://www.w3.org/1998/Math/MathML", xe = "http://www.w3.org/2000/svg", ke = "http://www.w3.org/1999/xhtml", Ce = ke, Oe = !1, Me = null, Te = mr({}, [ge, xe, ke], a6), Xe, Ne = ["application/xhtml+xml", "text/html"], Ke = "text/html", je, ut = null, ht = n.createElement("form"), ot = function(te) { + return te instanceof RegExp || te instanceof Function; + }, We = function(te) { + ut && ut === te || ((!te || _h(te) !== "object") && (te = {}), te = jf(te), Xe = Ne.indexOf(te.PARSER_MEDIA_TYPE) === -1 ? Xe = Ke : Xe = te.PARSER_MEDIA_TYPE, je = Xe === "application/xhtml+xml" ? a6 : x4, V = "ALLOWED_TAGS" in te ? mr({}, te.ALLOWED_TAGS, je) : Q, G = "ALLOWED_ATTR" in te ? mr({}, te.ALLOWED_ATTR, je) : ee, Me = "ALLOWED_NAMESPACES" in te ? mr({}, te.ALLOWED_NAMESPACES, a6) : Te, fe = "ADD_URI_SAFE_ATTR" in te ? mr( + jf(de), + te.ADD_URI_SAFE_ATTR, + je + ) : de, re = "ADD_DATA_URI_TAGS" in te ? mr( + jf(ue), + te.ADD_DATA_URI_TAGS, + je + ) : ue, oe = "FORBID_CONTENTS" in te ? mr({}, te.FORBID_CONTENTS, je) : ve, ne = "FORBID_TAGS" in te ? mr({}, te.FORBID_TAGS, je) : {}, ie = "FORBID_ATTR" in te ? mr({}, te.FORBID_ATTR, je) : {}, H = "USE_PROFILES" in te ? te.USE_PROFILES : !1, U = te.ALLOW_ARIA_ATTR !== !1, Z = te.ALLOW_DATA_ATTR !== !1, W = te.ALLOW_UNKNOWN_PROTOCOLS || !1, j = te.ALLOW_SELF_CLOSE_IN_ATTR !== !1, ae = te.SAFE_FOR_TEMPLATES || !1, se = te.WHOLE_DOCUMENT || !1, ce = te.RETURN_DOM || !1, Ee = te.RETURN_DOM_FRAGMENT || !1, Ae = te.RETURN_TRUSTED_TYPE || !1, _e = te.FORCE_BODY || !1, Ue = te.SANITIZE_DOM !== !1, Ge = te.SANITIZE_NAMED_PROPS || !1, De = te.KEEP_CONTENT !== !1, he = te.IN_PLACE || !1, B = te.ALLOWED_URI_REGEXP || B, Ce = te.NAMESPACE || ke, Y = te.CUSTOM_ELEMENT_HANDLING || {}, te.CUSTOM_ELEMENT_HANDLING && ot(te.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (Y.tagNameCheck = te.CUSTOM_ELEMENT_HANDLING.tagNameCheck), te.CUSTOM_ELEMENT_HANDLING && ot(te.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (Y.attributeNameCheck = te.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), te.CUSTOM_ELEMENT_HANDLING && typeof te.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (Y.allowCustomizedBuiltInElements = te.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), ae && (Z = !1), Ee && (ce = !0), H && (V = mr({}, sl(pV)), G = [], H.html === !0 && (mr(V, dV), mr(G, gV)), H.svg === !0 && (mr(V, l6), mr(G, h6), mr(G, Bw)), H.svgFilters === !0 && (mr(V, c6), mr(G, h6), mr(G, Bw)), H.mathMl === !0 && (mr(V, u6), mr(G, mV), mr(G, Bw))), te.ADD_TAGS && (V === Q && (V = jf(V)), mr(V, te.ADD_TAGS, je)), te.ADD_ATTR && (G === ee && (G = jf(G)), mr(G, te.ADD_ATTR, je)), te.ADD_URI_SAFE_ATTR && mr(fe, te.ADD_URI_SAFE_ATTR, je), te.FORBID_CONTENTS && (oe === ve && (oe = jf(oe)), mr(oe, te.FORBID_CONTENTS, je)), De && (V["#text"] = !0), se && mr(V, ["html", "head", "body"]), V.table && (mr(V, ["tbody"]), delete ne.tbody), oa && oa(te), ut = te); + }, Qe = mr({}, ["mi", "mo", "mn", "ms", "mtext"]), pt = mr({}, ["foreignobject", "desc", "title", "annotation-xml"]), tt = mr({}, ["title", "style", "font", "a", "script"]), He = mr({}, l6); + mr(He, c6), mr(He, fLe); + var kt = mr({}, u6); + mr(kt, dLe); + var st = function(te) { + var Le = b(te); + (!Le || !Le.tagName) && (Le = { + namespaceURI: Ce, tagName: "template" }); - var vr = lbe(ot.tagName), ws = lbe(pn.tagName); - return gr[ot.namespaceURI] ? ot.namespaceURI === Ks ? pn.namespaceURI === Zi ? vr === "svg" : pn.namespaceURI === dc ? vr === "svg" && (ws === "annotation-xml" || Vo[ws]) : Boolean(Us[vr]) : ot.namespaceURI === dc ? pn.namespaceURI === Zi ? vr === "math" : pn.namespaceURI === Ks ? vr === "math" && ea[ws] : Boolean(Fo[vr]) : ot.namespaceURI === Zi ? pn.namespaceURI === Ks && !ea[ws] || pn.namespaceURI === dc && !Vo[ws] ? !1 : !Fo[vr] && (ss[vr] || !Us[vr]) : !!(Hn === "application/xhtml+xml" && gr[ot.namespaceURI]) : !1; - }, Ph = function(ot) { - iX(n.removed, { - element: ot + var ze = x4(te.tagName), Lt = x4(Le.tagName); + return Me[te.namespaceURI] ? te.namespaceURI === xe ? Le.namespaceURI === ke ? ze === "svg" : Le.namespaceURI === ge ? ze === "svg" && (Lt === "annotation-xml" || Qe[Lt]) : Boolean(He[ze]) : te.namespaceURI === ge ? Le.namespaceURI === ke ? ze === "math" : Le.namespaceURI === xe ? ze === "math" && pt[Lt] : Boolean(kt[ze]) : te.namespaceURI === ke ? Le.namespaceURI === xe && !pt[Lt] || Le.namespaceURI === ge && !Qe[Lt] ? !1 : !kt[ze] && (tt[ze] || !He[ze]) : !!(Xe === "application/xhtml+xml" && Me[te.namespaceURI]) : !1; + }, Ze = function(te) { + Pm(e.removed, { + element: te }); try { - ot.parentNode.removeChild(ot); + te.parentNode.removeChild(te); } catch { try { - ot.outerHTML = se; + te.outerHTML = S; } catch { - ot.remove(); + te.remove(); } } - }, Fp = function(ot, pn) { + }, ft = function(te, Le) { try { - iX(n.removed, { - attribute: pn.getAttributeNode(ot), - from: pn + Pm(e.removed, { + attribute: Le.getAttributeNode(te), + from: Le }); } catch { - iX(n.removed, { + Pm(e.removed, { attribute: null, - from: pn + from: Le }); } - if (pn.removeAttribute(ot), ot === "is" && !It[ot]) - if (Be || Kn) + if (Le.removeAttribute(te), te === "is" && !G[te]) + if (ce || Ee) try { - Ph(pn); + Ze(Le); } catch { } else try { - pn.setAttribute(ot, ""); + Le.setAttribute(te, ""); } catch { } - }, pl = function(ot) { - var pn, vr; - if (Mn) - ot = "" + ot; + }, zt = function(te) { + var Le, ze; + if (_e) + te = "" + te; else { - var ws = PLn(ot, /^[\r\n\t ]+/); - vr = ws && ws[0]; + var Lt = lLe(te, /^[\r\n\t ]+/); + ze = Lt && Lt[0]; } - Hn === "application/xhtml+xml" && Pi === Zi && (ot = '' + ot + ""); - var aa = le ? le.createHTML(ot) : ot; - if (Pi === Zi) + Xe === "application/xhtml+xml" && Ce === ke && (te = '' + te + ""); + var cr = O ? O.createHTML(te) : te; + if (Ce === ke) try { - pn = new D().parseFromString(aa, Hn); + Le = new d().parseFromString(cr, Xe); } catch { } - if (!pn || !pn.documentElement) { - pn = te.createDocument(Pi, "template", null); + if (!Le || !Le.documentElement) { + Le = T.createDocument(Ce, "template", null); try { - pn.documentElement.innerHTML = Sr ? se : aa; + Le.documentElement.innerHTML = Oe ? S : cr; } catch { } } - var wa = pn.body || pn.documentElement; - return ot && vr && wa.insertBefore(a.createTextNode(vr), wa.childNodes[0] || null), Pi === Zi ? ae.call(pn, Mt ? "html" : "body")[0] : Mt ? pn.documentElement : wa; - }, po = function(ot) { - return be.call( - ot.ownerDocument || ot, - ot, - w.SHOW_ELEMENT | w.SHOW_COMMENT | w.SHOW_TEXT, + var Jt = Le.body || Le.documentElement; + return te && ze && Jt.insertBefore(n.createTextNode(ze), Jt.childNodes[0] || null), Ce === ke ? L.call(Le, se ? "html" : "body")[0] : se ? Le.documentElement : Jt; + }, yr = function(te) { + return A.call( + te.ownerDocument || te, + te, + l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT, null, !1 ); - }, yu = function(ot) { - return ot instanceof E && (typeof ot.nodeName != "string" || typeof ot.textContent != "string" || typeof ot.removeChild != "function" || !(ot.attributes instanceof S) || typeof ot.removeAttribute != "function" || typeof ot.setAttribute != "function" || typeof ot.namespaceURI != "string" || typeof ot.insertBefore != "function" || typeof ot.hasChildNodes != "function"); - }, Ou = function(ot) { - return WT(f) === "object" ? ot instanceof f : ot && WT(ot) === "object" && typeof ot.nodeType == "number" && typeof ot.nodeName == "string"; - }, $c = function(ot, pn, vr) { - !Ce[ot] || MLn(Ce[ot], function(ws) { - ws.call(n, pn, vr, jn); + }, Qt = function(te) { + return te instanceof f && (typeof te.nodeName != "string" || typeof te.textContent != "string" || typeof te.removeChild != "function" || !(te.attributes instanceof h) || typeof te.removeAttribute != "function" || typeof te.setAttribute != "function" || typeof te.namespaceURI != "string" || typeof te.insertBefore != "function" || typeof te.hasChildNodes != "function"); + }, wr = function(te) { + return _h(a) === "object" ? te instanceof a : te && _h(te) === "object" && typeof te.nodeType == "number" && typeof te.nodeName == "string"; + }, er = function(te, Le, ze) { + !$[te] || oLe($[te], function(Lt) { + Lt.call(e, Le, ze, ut); }); - }, ku = function(ot) { - var pn; - if ($c("beforeSanitizeElements", ot, null), yu(ot) || Em(/[\u0080-\uFFFF]/, ot.nodeName)) - return Ph(ot), !0; - var vr = Ki(ot.nodeName); - if ($c("uponSanitizeElement", ot, { - tagName: vr, - allowedTags: dt - }), ot.hasChildNodes() && !Ou(ot.firstElementChild) && (!Ou(ot.content) || !Ou(ot.content.firstElementChild)) && Em(/<[/\w]/g, ot.innerHTML) && Em(/<[/\w]/g, ot.textContent) || vr === "select" && Em(/