UNPKG

@vrcd-community/zhlint

Version:

A linting tool for Chinese language.

1,579 lines 247 kB
const Il = /^(?:(?<prefix>.+?)-,)?(?<textStart>.+?)(?:,(?<textEnd>.+?))?(?:,-(?<suffix>.+?))?$/, si = (e) => { const n = e.match(Il); if (n) { const { prefix: t, textStart: i, textEnd: r, suffix: l } = n.groups; return { prefix: t, textStart: i, textEnd: r, suffix: l }; } }, Pl = (e) => { const { ignoredByRules: n, value: t } = e, i = /<!--\s*zhlint\s*ignore:\s*(.+?)\s*-->/g; let r; for (; (r = i.exec(t)) !== null; ) { const l = si(r[1]); l && n.push(l); } return e; }, _l = /\{% ([^ ]+?) [^%]*?%\}(?:\n|\{(?!%)|[^{])*?\{% end(?:\1) %\}/g, Rl = (e) => (e.modifiedValue = e.modifiedValue.replace( _l, (n, t, i) => { const { length: r } = n; return e.ignoredByParsers.push({ name: t, meta: `hexo-${t}`, index: i, length: r, originValue: n }), "@".repeat(r); } ), e); let mn; try { mn = new RegExp("(?<=^|\\n)(:::.*)\\n([\\s\\S]+?)\\n(:::)(?=\\n|$)", "g"); } catch { mn = /(:::.*)\n([\s\S]+?)\n(:::)/g; } const Bl = (e) => (e.modifiedValue = e.modifiedValue.replace( mn, (n, t, i, r, l) => { const { length: u } = n, a = t.substring(3).trim().split(" ")[0] || "default"; return e.ignoredByParsers.push({ name: a, index: l, length: t.length, originValue: t, meta: `vuepress-${a}-start` }), e.ignoredByParsers.push({ name: a, index: l + u - 3, length: 3, originValue: r, meta: `vuepress-${a}-end` }), "@".repeat(t.length) + ` ` + i + ` ` + "@".repeat(3); } ), e); function tr(e) { if (e) throw e; } function _t(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ var Ll = function(n) { return n != null && n.constructor != null && typeof n.constructor.isBuffer == "function" && n.constructor.isBuffer(n); }; const oi = /* @__PURE__ */ _t(Ll); var St = Object.prototype.hasOwnProperty, ci = Object.prototype.toString, nr = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, ir = function(n) { return typeof Array.isArray == "function" ? Array.isArray(n) : ci.call(n) === "[object Array]"; }, lr = function(n) { if (!n || ci.call(n) !== "[object Object]") return !1; var t = St.call(n, "constructor"), i = n.constructor && n.constructor.prototype && St.call(n.constructor.prototype, "isPrototypeOf"); if (n.constructor && !t && !i) return !1; var r; for (r in n) ; return typeof r > "u" || St.call(n, r); }, ur = function(n, t) { nr && t.name === "__proto__" ? nr(n, t.name, { enumerable: !0, configurable: !0, value: t.newValue, writable: !0 }) : n[t.name] = t.newValue; }, ar = function(n, t) { if (t === "__proto__") if (St.call(n, t)) { if (rr) return rr(n, t).value; } else return; return n[t]; }, vl = function e() { var n, t, i, r, l, u, a = arguments[0], s = 1, c = arguments.length, f = !1; for (typeof a == "boolean" && (f = a, a = arguments[1] || {}, s = 2), (a == null || typeof a != "object" && typeof a != "function") && (a = {}); s < c; ++s) if (n = arguments[s], n != null) for (t in n) i = ar(a, t), r = ar(n, t), a !== r && (f && r && (lr(r) || (l = ir(r))) ? (l ? (l = !1, u = i && ir(i) ? i : []) : u = i && lr(i) ? i : {}, ur(a, { name: t, newValue: e(f, u, r) })) : typeof r < "u" && ur(a, { name: t, newValue: r })); return a; }; const sr = /* @__PURE__ */ _t(vl); function yn(e) { if (typeof e != "object" || e === null) return !1; const n = Object.getPrototypeOf(e); return (n === null || n === Object.prototype || Object.getPrototypeOf(n) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e); } function Dl() { const e = [], n = { run: t, use: i }; return n; function t(...r) { let l = -1; const u = r.pop(); if (typeof u != "function") throw new TypeError("Expected function as last argument, not " + u); a(null, ...r); function a(s, ...c) { const f = e[++l]; let o = -1; if (s) { u(s); return; } for (; ++o < r.length; ) (c[o] === null || c[o] === void 0) && (c[o] = r[o]); r = c, f ? Ml(f, a)(...c) : u(null, ...c); } } function i(r) { if (typeof r != "function") throw new TypeError( "Expected `middelware` to be a function, not " + r ); return e.push(r), n; } } function Ml(e, n) { let t; return i; function i(...u) { const a = e.length > u.length; let s; a && u.push(r); try { s = e.apply(this, u); } catch (c) { const f = ( /** @type {Error} */ c ); if (a && t) throw f; return r(f); } a || (s && s.then && typeof s.then == "function" ? s.then(l, r) : s instanceof Error ? r(s) : l(s)); } function r(u, ...a) { t || (t = !0, n(u, ...a)); } function l(u) { r(null, u); } } function lt(e) { return !e || typeof e != "object" ? "" : "position" in e || "type" in e ? or(e.position) : "start" in e || "end" in e ? or(e) : "line" in e || "column" in e ? bn(e) : ""; } function bn(e) { return cr(e && e.line) + ":" + cr(e && e.column); } function or(e) { return bn(e && e.start) + "-" + bn(e && e.end); } function cr(e) { return e && typeof e == "number" ? e : 1; } class oe extends Error { /** * Create a message for `reason` at `place` from `origin`. * * When an error is passed in as `reason`, the `stack` is copied. * * @param {string | Error | VFileMessage} reason * Reason for message, uses the stack and message of the error if given. * * > 👉 **Note**: you should use markdown. * @param {Node | NodeLike | Position | Point | null | undefined} [place] * Place in file where the message occurred. * @param {string | null | undefined} [origin] * Place in code where the message originates (example: * `'my-package:my-rule'` or `'my-rule'`). * @returns * Instance of `VFileMessage`. */ // To do: next major: expose `undefined` everywhere instead of `null`. constructor(n, t, i) { const r = [null, null]; let l = { // @ts-expect-error: we always follows the structure of `position`. start: { line: null, column: null }, // @ts-expect-error: " end: { line: null, column: null } }; if (super(), typeof t == "string" && (i = t, t = void 0), typeof i == "string") { const u = i.indexOf(":"); u === -1 ? r[1] = i : (r[0] = i.slice(0, u), r[1] = i.slice(u + 1)); } t && ("type" in t || "position" in t ? t.position && (l = t.position) : "start" in t || "end" in t ? l = t : ("line" in t || "column" in t) && (l.start = t)), this.name = lt(t) || "1:1", this.message = typeof n == "object" ? n.message : n, this.stack = "", typeof n == "object" && n.stack && (this.stack = n.stack), this.reason = this.message, this.fatal, this.line = l.start.line, this.column = l.start.column, this.position = l, this.source = r[0], this.ruleId = r[1], this.file, this.actual, this.expected, this.url, this.note; } } oe.prototype.file = ""; oe.prototype.name = ""; oe.prototype.reason = ""; oe.prototype.message = ""; oe.prototype.stack = ""; oe.prototype.fatal = null; oe.prototype.column = null; oe.prototype.line = null; oe.prototype.source = null; oe.prototype.ruleId = null; oe.prototype.position = null; const ye = { basename: zl, dirname: Nl, extname: Hl, join: Vl, sep: "/" }; function zl(e, n) { if (n !== void 0 && typeof n != "string") throw new TypeError('"ext" argument must be a string'); ft(e); let t = 0, i = -1, r = e.length, l; if (n === void 0 || n.length === 0 || n.length > e.length) { for (; r--; ) if (e.charCodeAt(r) === 47) { if (l) { t = r + 1; break; } } else i < 0 && (l = !0, i = r + 1); return i < 0 ? "" : e.slice(t, i); } if (n === e) return ""; let u = -1, a = n.length - 1; for (; r--; ) if (e.charCodeAt(r) === 47) { if (l) { t = r + 1; break; } } else u < 0 && (l = !0, u = r + 1), a > -1 && (e.charCodeAt(r) === n.charCodeAt(a--) ? a < 0 && (i = r) : (a = -1, i = u)); return t === i ? i = u : i < 0 && (i = e.length), e.slice(t, i); } function Nl(e) { if (ft(e), e.length === 0) return "."; let n = -1, t = e.length, i; for (; --t; ) if (e.charCodeAt(t) === 47) { if (i) { n = t; break; } } else i || (i = !0); return n < 0 ? e.charCodeAt(0) === 47 ? "/" : "." : n === 1 && e.charCodeAt(0) === 47 ? "//" : e.slice(0, n); } function Hl(e) { ft(e); let n = e.length, t = -1, i = 0, r = -1, l = 0, u; for (; n--; ) { const a = e.charCodeAt(n); if (a === 47) { if (u) { i = n + 1; break; } continue; } t < 0 && (u = !0, t = n + 1), a === 46 ? r < 0 ? r = n : l !== 1 && (l = 1) : r > -1 && (l = -1); } return r < 0 || t < 0 || // We saw a non-dot character immediately before the dot. l === 0 || // The (right-most) trimmed path component is exactly `..`. l === 1 && r === t - 1 && r === i + 1 ? "" : e.slice(r, t); } function Vl(...e) { let n = -1, t; for (; ++n < e.length; ) ft(e[n]), e[n] && (t = t === void 0 ? e[n] : t + "/" + e[n]); return t === void 0 ? "." : jl(t); } function jl(e) { ft(e); const n = e.charCodeAt(0) === 47; let t = Ul(e, !n); return t.length === 0 && !n && (t = "."), t.length > 0 && e.charCodeAt(e.length - 1) === 47 && (t += "/"), n ? "/" + t : t; } function Ul(e, n) { let t = "", i = 0, r = -1, l = 0, u = -1, a, s; for (; ++u <= e.length; ) { if (u < e.length) a = e.charCodeAt(u); else { if (a === 47) break; a = 47; } if (a === 47) { if (!(r === u - 1 || l === 1)) if (r !== u - 1 && l === 2) { if (t.length < 2 || i !== 2 || t.charCodeAt(t.length - 1) !== 46 || t.charCodeAt(t.length - 2) !== 46) { if (t.length > 2) { if (s = t.lastIndexOf("/"), s !== t.length - 1) { s < 0 ? (t = "", i = 0) : (t = t.slice(0, s), i = t.length - 1 - t.lastIndexOf("/")), r = u, l = 0; continue; } } else if (t.length > 0) { t = "", i = 0, r = u, l = 0; continue; } } n && (t = t.length > 0 ? t + "/.." : "..", i = 2); } else t.length > 0 ? t += "/" + e.slice(r + 1, u) : t = e.slice(r + 1, u), i = u - r - 1; r = u, l = 0; } else a === 46 && l > -1 ? l++ : l = -1; } return t; } function ft(e) { if (typeof e != "string") throw new TypeError( "Path must be a string. Received " + JSON.stringify(e) ); } const Wl = { cwd: $l }; function $l() { return "/"; } function xn(e) { return e !== null && typeof e == "object" && // @ts-expect-error: indexable. e.href && // @ts-expect-error: indexable. e.origin; } function ql(e) { if (typeof e == "string") e = new URL(e); else if (!xn(e)) { const n = new TypeError( 'The "path" argument must be of type string or an instance of URL. Received `' + e + "`" ); throw n.code = "ERR_INVALID_ARG_TYPE", n; } if (e.protocol !== "file:") { const n = new TypeError("The URL must be of scheme file"); throw n.code = "ERR_INVALID_URL_SCHEME", n; } return Gl(e); } function Gl(e) { if (e.hostname !== "") { const i = new TypeError( 'File URL host must be "localhost" or empty on darwin' ); throw i.code = "ERR_INVALID_FILE_URL_HOST", i; } const n = e.pathname; let t = -1; for (; ++t < n.length; ) if (n.charCodeAt(t) === 37 && n.charCodeAt(t + 1) === 50) { const i = n.charCodeAt(t + 2); if (i === 70 || i === 102) { const r = new TypeError( "File URL path must not include encoded / characters" ); throw r.code = "ERR_INVALID_FILE_URL_PATH", r; } } return decodeURIComponent(n); } const Ut = ["history", "path", "basename", "stem", "extname", "dirname"]; class Kl { /** * Create a new virtual file. * * `options` is treated as: * * * `string` or `Buffer` — `{value: options}` * * `URL` — `{path: options}` * * `VFile` — shallow copies its data over to the new file * * `object` — all fields are shallow copied over to the new file * * Path related fields are set in the following order (least specific to * most specific): `history`, `path`, `basename`, `stem`, `extname`, * `dirname`. * * You cannot set `dirname` or `extname` without setting either `history`, * `path`, `basename`, or `stem` too. * * @param {Compatible | null | undefined} [value] * File value. * @returns * New instance. */ constructor(n) { let t; n ? typeof n == "string" || Ql(n) ? t = { value: n } : xn(n) ? t = { path: n } : t = n : t = {}, this.data = {}, this.messages = [], this.history = [], this.cwd = Wl.cwd(), this.value, this.stored, this.result, this.map; let i = -1; for (; ++i < Ut.length; ) { const l = Ut[i]; l in t && t[l] !== void 0 && t[l] !== null && (this[l] = l === "history" ? [...t[l]] : t[l]); } let r; for (r in t) Ut.includes(r) || (this[r] = t[r]); } /** * Get the full path (example: `'~/index.min.js'`). * * @returns {string} */ get path() { return this.history[this.history.length - 1]; } /** * Set the full path (example: `'~/index.min.js'`). * * Cannot be nullified. * You can set a file URL (a `URL` object with a `file:` protocol) which will * be turned into a path with `url.fileURLToPath`. * * @param {string | URL} path */ set path(n) { xn(n) && (n = ql(n)), $t(n, "path"), this.path !== n && this.history.push(n); } /** * Get the parent path (example: `'~'`). */ get dirname() { return typeof this.path == "string" ? ye.dirname(this.path) : void 0; } /** * Set the parent path (example: `'~'`). * * Cannot be set if there’s no `path` yet. */ set dirname(n) { fr(this.basename, "dirname"), this.path = ye.join(n || "", this.basename); } /** * Get the basename (including extname) (example: `'index.min.js'`). */ get basename() { return typeof this.path == "string" ? ye.basename(this.path) : void 0; } /** * Set basename (including extname) (`'index.min.js'`). * * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` * on windows). * Cannot be nullified (use `file.path = file.dirname` instead). */ set basename(n) { $t(n, "basename"), Wt(n, "basename"), this.path = ye.join(this.dirname || "", n); } /** * Get the extname (including dot) (example: `'.js'`). */ get extname() { return typeof this.path == "string" ? ye.extname(this.path) : void 0; } /** * Set the extname (including dot) (example: `'.js'`). * * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` * on windows). * Cannot be set if there’s no `path` yet. */ set extname(n) { if (Wt(n, "extname"), fr(this.dirname, "extname"), n) { if (n.charCodeAt(0) !== 46) throw new Error("`extname` must start with `.`"); if (n.includes(".", 1)) throw new Error("`extname` cannot contain multiple dots"); } this.path = ye.join(this.dirname, this.stem + (n || "")); } /** * Get the stem (basename w/o extname) (example: `'index.min'`). */ get stem() { return typeof this.path == "string" ? ye.basename(this.path, this.extname) : void 0; } /** * Set the stem (basename w/o extname) (example: `'index.min'`). * * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` * on windows). * Cannot be nullified (use `file.path = file.dirname` instead). */ set stem(n) { $t(n, "stem"), Wt(n, "stem"), this.path = ye.join(this.dirname || "", n + (this.extname || "")); } /** * Serialize the file. * * @param {BufferEncoding | null | undefined} [encoding='utf8'] * Character encoding to understand `value` as when it’s a `Buffer` * (default: `'utf8'`). * @returns {string} * Serialized file. */ toString(n) { return (this.value || "").toString(n || void 0); } /** * Create a warning message associated with the file. * * Its `fatal` is set to `false` and `file` is set to the current file path. * Its added to `file.messages`. * * @param {string | Error | VFileMessage} reason * Reason for message, uses the stack and message of the error if given. * @param {Node | NodeLike | Position | Point | null | undefined} [place] * Place in file where the message occurred. * @param {string | null | undefined} [origin] * Place in code where the message originates (example: * `'my-package:my-rule'` or `'my-rule'`). * @returns {VFileMessage} * Message. */ message(n, t, i) { const r = new oe(n, t, i); return this.path && (r.name = this.path + ":" + r.name, r.file = this.path), r.fatal = !1, this.messages.push(r), r; } /** * Create an info message associated with the file. * * Its `fatal` is set to `null` and `file` is set to the current file path. * Its added to `file.messages`. * * @param {string | Error | VFileMessage} reason * Reason for message, uses the stack and message of the error if given. * @param {Node | NodeLike | Position | Point | null | undefined} [place] * Place in file where the message occurred. * @param {string | null | undefined} [origin] * Place in code where the message originates (example: * `'my-package:my-rule'` or `'my-rule'`). * @returns {VFileMessage} * Message. */ info(n, t, i) { const r = this.message(n, t, i); return r.fatal = null, r; } /** * Create a fatal error associated with the file. * * Its `fatal` is set to `true` and `file` is set to the current file path. * Its added to `file.messages`. * * > 👉 **Note**: a fatal error means that a file is no longer processable. * * @param {string | Error | VFileMessage} reason * Reason for message, uses the stack and message of the error if given. * @param {Node | NodeLike | Position | Point | null | undefined} [place] * Place in file where the message occurred. * @param {string | null | undefined} [origin] * Place in code where the message originates (example: * `'my-package:my-rule'` or `'my-rule'`). * @returns {never} * Message. * @throws {VFileMessage} * Message. */ fail(n, t, i) { const r = this.message(n, t, i); throw r.fatal = !0, r; } } function Wt(e, n) { if (e && e.includes(ye.sep)) throw new Error( "`" + n + "` cannot be a path: did not expect `" + ye.sep + "`" ); } function $t(e, n) { if (!e) throw new Error("`" + n + "` cannot be empty"); } function fr(e, n) { if (!e) throw new Error("Setting `" + n + "` requires `path` to be set too"); } function Ql(e) { return oi(e); } const Yl = hi().freeze(), fi = {}.hasOwnProperty; function hi() { const e = Dl(), n = []; let t = {}, i, r = -1; return l.data = u, l.Parser = void 0, l.Compiler = void 0, l.freeze = a, l.attachers = n, l.use = s, l.parse = c, l.stringify = f, l.run = o, l.runSync = p, l.process = h, l.processSync = d, l; function l() { const y = hi(); let x = -1; for (; ++x < n.length; ) y.use(...n[x]); return y.data(sr(!0, {}, t)), y; } function u(y, x) { return typeof y == "string" ? arguments.length === 2 ? (Kt("data", i), t[y] = x, l) : fi.call(t, y) && t[y] || null : y ? (Kt("data", i), t = y, l) : t; } function a() { if (i) return l; for (; ++r < n.length; ) { const [y, ...x] = n[r]; if (x[0] === !1) continue; x[0] === !0 && (x[0] = void 0); const b = y.call(l, ...x); typeof b == "function" && e.use(b); } return i = !0, r = Number.POSITIVE_INFINITY, l; } function s(y, ...x) { let b; if (Kt("use", i), y != null) if (typeof y == "function") _(y, ...x); else if (typeof y == "object") Array.isArray(y) ? O(y) : w(y); else throw new TypeError("Expected usable value, not `" + y + "`"); return b && (t.settings = Object.assign(t.settings || {}, b)), l; function C(k) { if (typeof k == "function") _(k); else if (typeof k == "object") if (Array.isArray(k)) { const [S, ...L] = k; _(S, ...L); } else w(k); else throw new TypeError("Expected usable value, not `" + k + "`"); } function w(k) { O(k.plugins), k.settings && (b = Object.assign(b || {}, k.settings)); } function O(k) { let S = -1; if (k != null) if (Array.isArray(k)) for (; ++S < k.length; ) { const L = k[S]; C(L); } else throw new TypeError("Expected a list of plugins, not `" + k + "`"); } function _(k, S) { let L = -1, N; for (; ++L < n.length; ) if (n[L][0] === k) { N = n[L]; break; } N ? (yn(N[1]) && yn(S) && (S = sr(!0, N[1], S)), N[1] = S) : n.push([...arguments]); } } function c(y) { l.freeze(); const x = nt(y), b = l.Parser; return qt("parse", b), hr(b, "parse") ? new b(String(x), x).parse() : b(String(x), x); } function f(y, x) { l.freeze(); const b = nt(x), C = l.Compiler; return Gt("stringify", C), pr(y), hr(C, "compile") ? new C(y, b).compile() : C(y, b); } function o(y, x, b) { if (pr(y), l.freeze(), !b && typeof x == "function" && (b = x, x = void 0), !b) return new Promise(C); C(null, b); function C(w, O) { e.run(y, nt(x), _); function _(k, S, L) { S = S || y, k ? O(k) : w ? w(S) : b(null, S, L); } } } function p(y, x) { let b, C; return l.run(y, x, w), dr("runSync", "run", C), b; function w(O, _) { tr(O), b = _, C = !0; } } function h(y, x) { if (l.freeze(), qt("process", l.Parser), Gt("process", l.Compiler), !x) return new Promise(b); b(null, x); function b(C, w) { const O = nt(y); l.run(l.parse(O), O, (k, S, L) => { if (k || !S || !L) _(k); else { const N = l.stringify(S, L); N == null || (Xl(N) ? L.value = N : L.result = N), _(k, L); } }); function _(k, S) { k || !S ? w(k) : C ? C(S) : x(null, S); } } } function d(y) { let x; l.freeze(), qt("processSync", l.Parser), Gt("processSync", l.Compiler); const b = nt(y); return l.process(b, C), dr("processSync", "process", x), b; function C(w) { x = !0, tr(w); } } } function hr(e, n) { return typeof e == "function" && // Prototypes do exist. // type-coverage:ignore-next-line e.prototype && // A function with keys in its prototype is probably a constructor. // Classes’ prototype methods are not enumerable, so we check if some value // exists in the prototype. // type-coverage:ignore-next-line (Jl(e.prototype) || n in e.prototype); } function Jl(e) { let n; for (n in e) if (fi.call(e, n)) return !0; return !1; } function qt(e, n) { if (typeof n != "function") throw new TypeError("Cannot `" + e + "` without `Parser`"); } function Gt(e, n) { if (typeof n != "function") throw new TypeError("Cannot `" + e + "` without `Compiler`"); } function Kt(e, n) { if (n) throw new Error( "Cannot call `" + e + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`." ); } function pr(e) { if (!yn(e) || typeof e.type != "string") throw new TypeError("Expected node, got `" + e + "`"); } function dr(e, n, t) { if (!t) throw new Error( "`" + e + "` finished async. Use `" + n + "` instead" ); } function nt(e) { return Zl(e) ? e : new Kl(e); } function Zl(e) { return !!(e && typeof e == "object" && "message" in e && "messages" in e); } function Xl(e) { return typeof e == "string" || oi(e); } const eu = {}; function tu(e, n) { const t = n || eu, i = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, r = typeof t.includeHtml == "boolean" ? t.includeHtml : !0; return pi(e, i, r); } function pi(e, n, t) { if (nu(e)) { if ("value" in e) return e.type === "html" && !t ? "" : e.value; if (n && "alt" in e && e.alt) return e.alt; if ("children" in e) return gr(e.children, n, t); } return Array.isArray(e) ? gr(e, n, t) : ""; } function gr(e, n, t) { const i = []; let r = -1; for (; ++r < e.length; ) i[r] = pi(e[r], n, t); return i.join(""); } function nu(e) { return !!(e && typeof e == "object"); } function re(e, n, t, i) { const r = e.length; let l = 0, u; if (n < 0 ? n = -n > r ? 0 : r + n : n = n > r ? r : n, t = t > 0 ? t : 0, i.length < 1e4) u = Array.from(i), u.unshift(n, t), e.splice(...u); else for (t && e.splice(n, t); l < i.length; ) u = i.slice(l, l + 1e4), u.unshift(n, 0), e.splice(...u), l += 1e4, n += 1e4; } function ue(e, n) { return e.length > 0 ? (re(e, e.length, 0, n), e) : n; } const mr = {}.hasOwnProperty; function di(e) { const n = {}; let t = -1; for (; ++t < e.length; ) ru(n, e[t]); return n; } function ru(e, n) { let t; for (t in n) { const r = (mr.call(e, t) ? e[t] : void 0) || (e[t] = {}), l = n[t]; let u; if (l) for (u in l) { mr.call(r, u) || (r[u] = []); const a = l[u]; iu( // @ts-expect-error Looks like a list. r[u], Array.isArray(a) ? a : a ? [a] : [] ); } } } function iu(e, n) { let t = -1; const i = []; for (; ++t < n.length; ) (n[t].add === "after" ? e : i).push(n[t]); re(e, 0, 0, i); } const lu = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/, X = Le(/[A-Za-z]/), ne = Le(/[\dA-Za-z]/), uu = Le(/[#-'*+\--9=?A-Z^-~]/); function Ft(e) { return ( // Special whitespace codes (which have negative values), C0 and Control // character DEL e !== null && (e < 32 || e === 127) ); } const kn = Le(/\d/), au = Le(/[\dA-Fa-f]/), su = Le(/[!-/:-@[-`{-~]/); function P(e) { return e !== null && e < -2; } function W(e) { return e !== null && (e < 0 || e === 32); } function v(e) { return e === -2 || e === -1 || e === 32; } const Rt = Le(lu), Ne = Le(/\s/); function Le(e) { return n; function n(t) { return t !== null && e.test(String.fromCharCode(t)); } } function M(e, n, t, i) { const r = i ? i - 1 : Number.POSITIVE_INFINITY; let l = 0; return u; function u(s) { return v(s) ? (e.enter(t), a(s)) : n(s); } function a(s) { return v(s) && l++ < r ? (e.consume(s), a) : (e.exit(t), n(s)); } } const ou = { tokenize: cu }; function cu(e) { const n = e.attempt( this.parser.constructs.contentInitial, i, r ); let t; return n; function i(a) { if (a === null) { e.consume(a); return; } return e.enter("lineEnding"), e.consume(a), e.exit("lineEnding"), M(e, n, "linePrefix"); } function r(a) { return e.enter("paragraph"), l(a); } function l(a) { const s = e.enter("chunkText", { contentType: "text", previous: t }); return t && (t.next = s), t = s, u(a); } function u(a) { if (a === null) { e.exit("chunkText"), e.exit("paragraph"), e.consume(a); return; } return P(a) ? (e.consume(a), e.exit("chunkText"), l) : (e.consume(a), u); } } const fu = { tokenize: hu }, yr = { tokenize: pu }; function hu(e) { const n = this, t = []; let i = 0, r, l, u; return a; function a(w) { if (i < t.length) { const O = t[i]; return n.containerState = O[1], e.attempt( O[0].continuation, s, c )(w); } return c(w); } function s(w) { if (i++, n.containerState._closeFlow) { n.containerState._closeFlow = void 0, r && C(); const O = n.events.length; let _ = O, k; for (; _--; ) if (n.events[_][0] === "exit" && n.events[_][1].type === "chunkFlow") { k = n.events[_][1].end; break; } b(i); let S = O; for (; S < n.events.length; ) n.events[S][1].end = Object.assign({}, k), S++; return re( n.events, _ + 1, 0, n.events.slice(O) ), n.events.length = S, c(w); } return a(w); } function c(w) { if (i === t.length) { if (!r) return p(w); if (r.currentConstruct && r.currentConstruct.concrete) return d(w); n.interrupt = !!(r.currentConstruct && !r._gfmTableDynamicInterruptHack); } return n.containerState = {}, e.check( yr, f, o )(w); } function f(w) { return r && C(), b(i), p(w); } function o(w) { return n.parser.lazy[n.now().line] = i !== t.length, u = n.now().offset, d(w); } function p(w) { return n.containerState = {}, e.attempt( yr, h, d )(w); } function h(w) { return i++, t.push([n.currentConstruct, n.containerState]), p(w); } function d(w) { if (w === null) { r && C(), b(0), e.consume(w); return; } return r = r || n.parser.flow(n.now()), e.enter("chunkFlow", { contentType: "flow", previous: l, _tokenizer: r }), y(w); } function y(w) { if (w === null) { x(e.exit("chunkFlow"), !0), b(0), e.consume(w); return; } return P(w) ? (e.consume(w), x(e.exit("chunkFlow")), i = 0, n.interrupt = void 0, a) : (e.consume(w), y); } function x(w, O) { const _ = n.sliceStream(w); if (O && _.push(null), w.previous = l, l && (l.next = w), l = w, r.defineSkip(w.start), r.write(_), n.parser.lazy[w.start.line]) { let k = r.events.length; for (; k--; ) if ( // The token starts before the line ending… r.events[k][1].start.offset < u && // …and either is not ended yet… (!r.events[k][1].end || // …or ends after it. r.events[k][1].end.offset > u) ) return; const S = n.events.length; let L = S, N, E; for (; L--; ) if (n.events[L][0] === "exit" && n.events[L][1].type === "chunkFlow") { if (N) { E = n.events[L][1].end; break; } N = !0; } for (b(i), k = S; k < n.events.length; ) n.events[k][1].end = Object.assign({}, E), k++; re( n.events, L + 1, 0, n.events.slice(S) ), n.events.length = k; } } function b(w) { let O = t.length; for (; O-- > w; ) { const _ = t[O]; n.containerState = _[1], _[0].exit.call(n, e); } t.length = w; } function C() { r.write([null]), l = void 0, r = void 0, n.containerState._closeFlow = void 0; } } function pu(e, n, t) { return M( e, e.attempt(this.parser.constructs.document, n, t), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 ); } function Ot(e) { if (e === null || W(e) || Ne(e)) return 1; if (Rt(e)) return 2; } function Bt(e, n, t) { const i = []; let r = -1; for (; ++r < e.length; ) { const l = e[r].resolveAll; l && !i.includes(l) && (n = l(n, t), i.push(l)); } return n; } const wn = { name: "attention", tokenize: gu, resolveAll: du }; function du(e, n) { let t = -1, i, r, l, u, a, s, c, f; for (; ++t < e.length; ) if (e[t][0] === "enter" && e[t][1].type === "attentionSequence" && e[t][1]._close) { for (i = t; i--; ) if (e[i][0] === "exit" && e[i][1].type === "attentionSequence" && e[i][1]._open && // If the markers are the same: n.sliceSerialize(e[i][1]).charCodeAt(0) === n.sliceSerialize(e[t][1]).charCodeAt(0)) { if ((e[i][1]._close || e[t][1]._open) && (e[t][1].end.offset - e[t][1].start.offset) % 3 && !((e[i][1].end.offset - e[i][1].start.offset + e[t][1].end.offset - e[t][1].start.offset) % 3)) continue; s = e[i][1].end.offset - e[i][1].start.offset > 1 && e[t][1].end.offset - e[t][1].start.offset > 1 ? 2 : 1; const o = Object.assign({}, e[i][1].end), p = Object.assign({}, e[t][1].start); br(o, -s), br(p, s), u = { type: s > 1 ? "strongSequence" : "emphasisSequence", start: o, end: Object.assign({}, e[i][1].end) }, a = { type: s > 1 ? "strongSequence" : "emphasisSequence", start: Object.assign({}, e[t][1].start), end: p }, l = { type: s > 1 ? "strongText" : "emphasisText", start: Object.assign({}, e[i][1].end), end: Object.assign({}, e[t][1].start) }, r = { type: s > 1 ? "strong" : "emphasis", start: Object.assign({}, u.start), end: Object.assign({}, a.end) }, e[i][1].end = Object.assign({}, u.start), e[t][1].start = Object.assign({}, a.end), c = [], e[i][1].end.offset - e[i][1].start.offset && (c = ue(c, [ ["enter", e[i][1], n], ["exit", e[i][1], n] ])), c = ue(c, [ ["enter", r, n], ["enter", u, n], ["exit", u, n], ["enter", l, n] ]), c = ue( c, Bt( n.parser.constructs.insideSpan.null, e.slice(i + 1, t), n ) ), c = ue(c, [ ["exit", l, n], ["enter", a, n], ["exit", a, n], ["exit", r, n] ]), e[t][1].end.offset - e[t][1].start.offset ? (f = 2, c = ue(c, [ ["enter", e[t][1], n], ["exit", e[t][1], n] ])) : f = 0, re(e, i - 1, t - i + 3, c), t = i + c.length - f - 2; break; } } for (t = -1; ++t < e.length; ) e[t][1].type === "attentionSequence" && (e[t][1].type = "data"); return e; } function gu(e, n) { const t = this.parser.constructs.attentionMarkers.null, i = this.previous, r = Ot(i); let l; return u; function u(s) { return l = s, e.enter("attentionSequence"), a(s); } function a(s) { if (s === l) return e.consume(s), a; const c = e.exit("attentionSequence"), f = Ot(s), o = !f || f === 2 && r || t.includes(s), p = !r || r === 2 && f || t.includes(i); return c._open = !!(l === 42 ? o : o && (r || !p)), c._close = !!(l === 42 ? p : p && (f || !o)), n(s); } } function br(e, n) { e.column += n, e.offset += n, e._bufferIndex += n; } const mu = { name: "autolink", tokenize: yu }; function yu(e, n, t) { let i = 0; return r; function r(h) { return e.enter("autolink"), e.enter("autolinkMarker"), e.consume(h), e.exit("autolinkMarker"), e.enter("autolinkProtocol"), l; } function l(h) { return X(h) ? (e.consume(h), u) : c(h); } function u(h) { return h === 43 || h === 45 || h === 46 || ne(h) ? (i = 1, a(h)) : c(h); } function a(h) { return h === 58 ? (e.consume(h), i = 0, s) : (h === 43 || h === 45 || h === 46 || ne(h)) && i++ < 32 ? (e.consume(h), a) : (i = 0, c(h)); } function s(h) { return h === 62 ? (e.exit("autolinkProtocol"), e.enter("autolinkMarker"), e.consume(h), e.exit("autolinkMarker"), e.exit("autolink"), n) : h === null || h === 32 || h === 60 || Ft(h) ? t(h) : (e.consume(h), s); } function c(h) { return h === 64 ? (e.consume(h), f) : uu(h) ? (e.consume(h), c) : t(h); } function f(h) { return ne(h) ? o(h) : t(h); } function o(h) { return h === 46 ? (e.consume(h), i = 0, f) : h === 62 ? (e.exit("autolinkProtocol").type = "autolinkEmail", e.enter("autolinkMarker"), e.consume(h), e.exit("autolinkMarker"), e.exit("autolink"), n) : p(h); } function p(h) { if ((h === 45 || ne(h)) && i++ < 63) { const d = h === 45 ? p : o; return e.consume(h), d; } return t(h); } } const ht = { tokenize: bu, partial: !0 }; function bu(e, n, t) { return i; function i(l) { return v(l) ? M(e, r, "linePrefix")(l) : r(l); } function r(l) { return l === null || P(l) ? n(l) : t(l); } } const gi = { name: "blockQuote", tokenize: xu, continuation: { tokenize: ku }, exit: wu }; function xu(e, n, t) { const i = this; return r; function r(u) { if (u === 62) { const a = i.containerState; return a.open || (e.enter("blockQuote", { _container: !0 }), a.open = !0), e.enter("blockQuotePrefix"), e.enter("blockQuoteMarker"), e.consume(u), e.exit("blockQuoteMarker"), l; } return t(u); } function l(u) { return v(u) ? (e.enter("blockQuotePrefixWhitespace"), e.consume(u), e.exit("blockQuotePrefixWhitespace"), e.exit("blockQuotePrefix"), n) : (e.exit("blockQuotePrefix"), n(u)); } } function ku(e, n, t) { const i = this; return r; function r(u) { return v(u) ? M( e, l, "linePrefix", i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 )(u) : l(u); } function l(u) { return e.attempt(gi, n, t)(u); } } function wu(e) { e.exit("blockQuote"); } const mi = { name: "characterEscape", tokenize: Eu }; function Eu(e, n, t) { return i; function i(l) { return e.enter("characterEscape"), e.enter("escapeMarker"), e.consume(l), e.exit("escapeMarker"), r; } function r(l) { return su(l) ? (e.enter("characterEscapeValue"), e.consume(l), e.exit("characterEscapeValue"), e.exit("characterEscape"), n) : t(l); } } const xr = document.createElement("i"); function Mn(e) { const n = "&" + e + ";"; xr.innerHTML = n; const t = xr.textContent; return t.charCodeAt(t.length - 1) === 59 && e !== "semi" || t === n ? !1 : t; } const yi = { name: "characterReference", tokenize: Au }; function Au(e, n, t) { const i = this; let r = 0, l, u; return a; function a(o) { return e.enter("characterReference"), e.enter("characterReferenceMarker"), e.consume(o), e.exit("characterReferenceMarker"), s; } function s(o) { return o === 35 ? (e.enter("characterReferenceMarkerNumeric"), e.consume(o), e.exit("characterReferenceMarkerNumeric"), c) : (e.enter("characterReferenceValue"), l = 31, u = ne, f(o)); } function c(o) { return o === 88 || o === 120 ? (e.enter("characterReferenceMarkerHexadecimal"), e.consume(o), e.exit("characterReferenceMarkerHexadecimal"), e.enter("characterReferenceValue"), l = 6, u = au, f) : (e.enter("characterReferenceValue"), l = 7, u = kn, f(o)); } function f(o) { if (o === 59 && r) { const p = e.exit("characterReferenceValue"); return u === ne && !Mn(i.sliceSerialize(p)) ? t(o) : (e.enter("characterReferenceMarker"), e.consume(o), e.exit("characterReferenceMarker"), e.exit("characterReference"), n); } return u(o) && r++ < l ? (e.consume(o), f) : t(o); } } const kr = { tokenize: Cu, partial: !0 }, wr = { name: "codeFenced", tokenize: Su, concrete: !0 }; function Su(e, n, t) { const i = this, r = { tokenize: _, partial: !0 }; let l = 0, u = 0, a; return s; function s(k) { return c(k); } function c(k) { const S = i.events[i.events.length - 1]; return l = S && S[1].type === "linePrefix" ? S[2].sliceSerialize(S[1], !0).length : 0, a = k, e.enter("codeFenced"), e.enter("codeFencedFence"), e.enter("codeFencedFenceSequence"), f(k); } function f(k) { return k === a ? (u++, e.consume(k), f) : u < 3 ? t(k) : (e.exit("codeFencedFenceSequence"), v(k) ? M(e, o, "whitespace")(k) : o(k)); } function o(k) { return k === null || P(k) ? (e.exit("codeFencedFence"), i.interrupt ? n(k) : e.check(kr, y, O)(k)) : (e.enter("codeFencedFenceInfo"), e.enter("chunkString", { contentType: "string" }), p(k)); } function p(k) { return k === null || P(k) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), o(k)) : v(k) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), M(e, h, "whitespace")(k)) : k === 96 && k === a ? t(k) : (e.consume(k), p); } function h(k) { return k === null || P(k) ? o(k) : (e.enter("codeFencedFenceMeta"), e.enter("chunkString", { contentType: "string" }), d(k)); } function d(k) { return k === null || P(k) ? (e.exit("chunkString"), e.exit("codeFencedFenceMeta"), o(k)) : k === 96 && k === a ? t(k) : (e.consume(k), d); } function y(k) { return e.attempt(r, O, x)(k); } function x(k) { return e.enter("lineEnding"), e.consume(k), e.exit("lineEnding"), b; } function b(k) { return l > 0 && v(k) ? M( e, C, "linePrefix", l + 1 )(k) : C(k); } function C(k) { return k === null || P(k) ? e.check(kr, y, O)(k) : (e.enter("codeFlowValue"), w(k)); } function w(k) { return k === null || P(k) ? (e.exit("codeFlowValue"), C(k)) : (e.consume(k), w); } function O(k) { return e.exit("codeFenced"), n(k); } function _(k, S, L) { let N = 0; return E; function E(z) { return k.enter("lineEnding"), k.consume(z), k.exit("lineEnding"), F; } function F(z) { return k.enter("codeFencedFence"), v(z) ? M( k, I, "linePrefix", i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 )(z) : I(z); } function I(z) { return z === a ? (k.enter("codeFencedFenceSequence"), j(z)) : L(z); } function j(z) { return z === a ? (N++, k.consume(z), j) : N >= u ? (k.exit("codeFencedFenceSequence"), v(z) ? M(k, G, "whitespace")(z) : G(z)) : L(z); } function G(z) { return z === null || P(z) ? (k.exit("codeFencedFence"), S(z)) : L(z); } } } function Cu(e, n, t) { const i = this; return r; function r(u) { return u === null ? t(u) : (e.enter("lineEnding"), e.consume(u), e.exit("lineEnding"), l); } function l(u) { return i.parser.lazy[i.now().line] ? t(u) : n(u); } } const Qt = { name: "codeIndented", tokenize: Fu }, Tu = { tokenize: Ou, partial: !0 }; function Fu(e, n, t) { const i = this; return r; function r(c) { return e.enter("codeIndented"), M(e, l, "linePrefix", 5)(c); } function l(c) { const f = i.events[i.events.length - 1]; return f && f[1].type === "linePrefix" && f[2].sliceSerialize(f[1], !0).length >= 4 ? u(c) : t(c); } function u(c) { return c === null ? s(c) : P(c) ? e.attempt(Tu, u, s)(c) : (e.enter("codeFlowValue"), a(c)); } function a(c) { return c === null || P(c) ? (e.exit("codeFlowValue"), u(c)) : (e.consume(c), a); } function s(c) { return e.exit("codeIndented"), n(c); } } function Ou(e, n, t) { const i = this; return r; function r(u) { return i.parser.lazy[i.now().line] ? t(u) : P(u) ? (e.enter("lineEnding"), e.consume(u), e.exit("lineEnding"), r) : M(e, l, "linePrefix", 5)(u); } function l(u) { const a = i.events[i.events.length - 1]; return a && a[1].type === "linePrefix" && a[2].sliceSerialize(a[1], !0).length >= 4 ? n(u) : P(u) ? r(u) : t(u); } } const Iu = { name: "codeText", tokenize: Ru, resolve: Pu, previous: _u }; function Pu(e) { let n = e.length - 4, t = 3, i, r; if ((e[t][1].type === "lineEnding" || e[t][1].type === "space") && (e[n][1].type === "lineEnding" || e[n][1].type === "space")) { for (i = t; ++i < n; ) if (e[i][1].type === "codeTextData") { e[t][1].type = "codeTextPadding", e[n][1].type = "codeTextPadding", t += 2, n -= 2; break; } } for (i = t - 1, n++; ++i <= n; ) r === void 0 ? i !== n && e[i][1].type !== "lineEnding" && (r = i) : (i === n || e[i][1].type === "lineEnding") && (e[r][1].type = "codeTextData", i !== r + 2 && (e[r][1].end = e[i - 1][1].end, e.splice(r + 2, i - r - 2), n -= i - r - 2, i = r + 2), r = void 0); return e; } function _u(e) { return e !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; } function Ru(e, n, t) { let i = 0, r, l; return u; function u(o) { return e.enter("codeText"), e.enter("codeTextSequence"), a(o); } function a(o) { return o === 96 ? (e.consume(o), i++, a) : (e.exit("codeTextSequence"), s(o)); } function s(o) { return o === null ? t(o) : o === 32 ? (e.enter("space"), e.consume(o), e.exit("space"), s) : o === 96 ? (l = e.enter("codeTextSequence"), r = 0, f(o)) : P(o) ? (e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), s) : (e.enter("codeTextData"), c(o)); } function c(o) { return o === null || o === 32 || o === 96 || P(o) ? (e.exit("codeTextData"), s(o)) : (e.consume(o), c); } function f(o) { return o === 96 ? (e.consume(o), r++, f) : r === i ? (e.exit("codeTextSequence"), e.exit("codeText"), n(o)) : (l.type = "codeTextData", c(o)); } } function bi(e) { const n = {}; let t = -1, i, r, l, u, a, s, c; for (; ++t < e.length; ) { for (; t in n; ) t = n[t]; if (i = e[t], t && i[1].type === "chunkFlow" && e[t - 1][1].type === "listItemPrefix" && (s = i[1]._tokenizer.events, l = 0, l < s.length && s[l][1].type === "lineEndingBlank" && (l += 2), l < s.length && s[l][1].type === "content")) for (; ++l < s.length && s[l][1].type !== "content"; ) s[l][1].type === "chunkText" && (s[l][1]._isInFirstContentOfListItem = !0, l++); if (i[0] === "enter") i[1].contentType && (Object.assign(n, Bu(e, t)), t = n[t], c = !0); else if (i[1]._container) { for (l = t, r = void 0; l-- && (u = e[l], u[1].type === "lineEnding" || u[1].type === "lineEndingBlank"); ) u[0] === "enter" && (r && (e[r][1].type = "lineEndingBlank"), u[1].type = "lineEnding", r = l); r && (i[1].end = Object.assign({}, e[r][1].start), a = e.slice(r, t), a.unshift(i), re(e, r, t - r + 1, a)); } } return !c; } function Bu(e, n) { const t = e[n][1], i = e[n][2]; let r = n - 1; const l = [], u = t._tokenizer || i.parser[t.contentType](t.start), a = u.events, s = [], c = {}; let f, o, p = -1, h = t, d = 0, y = 0; const x = [y]; for (; h; ) { for (; e[++r][1] !== h; ) ; l.push(r), h._tokenizer || (f = i.sliceStream(h), h.next || f.push(null), o && u.defineSkip(h.start), h._isInFirstContentOfListItem && (u._gfmTasklistFirstContentOfListItem = !0), u.write(f), h._isInFirstContentOfListItem && (u._gfmTasklistFirstContentOfListItem = void 0)), o = h, h = h.next; } for (h = t; ++p < a.length; ) // Find a void token that includes a break. a[p][0] === "exit" && a[p - 1][0] === "enter" && a[p][1].type === a[p - 1][1].type && a[p][1].start.line !== a[p][1].end.line && (y = p + 1, x.push(y), h._tokenizer = void 0, h.previous = void 0, h = h.next); for (u.events = [], h ? (h._tokenizer = void 0, h.previous = void 0) : x.pop(), p = x.length; p--; ) { const b = a.slice(x[p], x[p + 1]), C = l.pop(); s.unshift([C, C + b.length - 1]), re(e, C, 2, b); } for (p = -1; ++p < s.length; ) c[d + s[p][0]] = d + s[p][1], d += s[p][1] - s[p][0] - 1; return c; } const Lu = { tokenize: Mu, resolve: Du }, vu = { tokenize: zu, partial: !0 }; function Du(e) { return bi(e), e; } function Mu(e, n) { let t; return i; function i(a) { return e.enter("content"), t = e.enter("chunkContent", { contentType: "content" }), r(a); } function r(a) { return a === null ? l(a) : P(a) ? e.check( vu, u, l )(a) : (e.consume(a), r); } function l(a) { return e.exit("chunkContent"), e.exit("content"), n(a); } function u(a) { return e.consume(a), e.exit("chunkContent"), t.next = e.enter("chunkContent", { contentType: "content", previous: t }), t = t.next, r; } } function zu(e, n, t) { const i = this; return r; function r(u) { return e.exit("chunkContent"), e.enter("lineEnding"), e.consume(u), e.exit("lineEnding"), M(e, l, "linePrefix"); } function l(u) { if (u === null || P(u)) return t(u); const a = i.events[i.events.length - 1]; return !i.parser.constructs.disable.null.includes("codeIndented") && a && a[1].type === "linePrefix" && a[2].sliceSerialize(a[1], !0).length >= 4 ? n(u) : e.interrupt(i.parser.constructs.flow, t, n)(u); } } function xi(e, n, t, i, r, l, u, a, s) { const c = s || Number.POSITIVE_INFINITY; let f = 0; return o; function o(b) { return b === 60 ? (e.enter(i), e.enter(r), e.enter(l), e.consume(b), e.exit(l), p) : b === null || b === 32 || b === 41 || Ft(b) ? t(b) : (e.enter(i), e