mongodb-chatbot-ui
Version:
UI React components for the MongoDB Chatbot Framework
1,569 lines • 497 kB
JavaScript
import { g as ln, c as gt, j as jn } from "./jsx-runtime.js";
import { P as le, c as cd } from "./Transition.js";
import { J as Yr, $ as ud, j as dd, h as fd, Q as Zr, y as pd, O as gd, P as hd, Y as md, t as tt, l as bd } from "./index4.js";
import { an as js, ao as yd, ap as Gs, aq as Ed, ar as qs, as as _d, at as Ws, au as Vs, av as vd, aw as Ys, r as jt, m as S, Q as ie, F as D, v as pe, d as qe, U as Fn, n as se, ax as xd, z as Xr, a3 as ht, k as Pn, b as Cn, R as Dt, V as wd, a9 as Zs, ay as Nr, az as Xs, aA as Sd, aB as Nd, ag as zn, a0 as Od, a1 as kd, a2 as Xn, K as xt, ac as Fe, T as Ri, j as Li, a4 as Ad, aa as fn, ae as Cd, aC as Td, aD as Id, aE as Di, aF as Qs, $ as Wn, t as Md, Y as Pt, i as lt, aG as Pi, aH as Rd, aI as Js, aJ as Ld, aK as tr, aL as Dd, aM as Pd } from "./index2.js";
import * as Bi from "react";
import O, { useState as Qe, useRef as vn, useEffect as _n, isValidElement as Bd, useCallback as He, useMemo as We, createContext as Qr, useContext as Gt, forwardRef as ec } from "react";
import { u as $d } from "./index5.js";
import { L as Fd } from "./index18.js";
import { r as zd } from "./ChevronDown.js";
import { t as Ud } from "./index16.js";
import { Q as Or } from "./index10.js";
import { g as $i } from "./index9.js";
import { f as Hd, E as nc, y as Fi } from "./index7.js";
import { H as Kd } from "./index8.js";
import { Z as rt, b as tc, H as rc, z as ic, a as Jr, k as Nn } from "./index11.js";
import { flushSync as jd } from "react-dom";
import { o as Gd, B as qd, j as zi } from "./index19.js";
import { e as Wd, K as Vd } from "./index12.js";
import { R as Yd, r as ac } from "./index15.js";
function Zd(e) {
return function(n, t, r) {
for (var i = -1, a = Object(n), o = r(n), l = o.length; l--; ) {
var s = o[e ? l : ++i];
if (t(a[s], s, a) === !1)
break;
}
return n;
};
}
var Xd = Zd, Qd = Xd, Jd = Qd(), ef = Jd, nf = ef, tf = js;
function rf(e, n) {
return e && nf(e, n, tf);
}
var af = rf, of = yd, lf = Gs, sf = 1, cf = 2;
function uf(e, n, t, r) {
var i = t.length, a = i, o = !r;
if (e == null)
return !a;
for (e = Object(e); i--; ) {
var l = t[i];
if (o && l[2] ? l[1] !== e[l[0]] : !(l[0] in e))
return !1;
}
for (; ++i < a; ) {
l = t[i];
var s = l[0], c = e[s], u = l[1];
if (o && l[2]) {
if (c === void 0 && !(s in e))
return !1;
} else {
var d = new of();
if (r)
var h = r(c, u, s, e, n, d);
if (!(h === void 0 ? lf(u, c, sf | cf, r, d) : h))
return !1;
}
}
return !0;
}
var df = uf, ff = Ed;
function pf(e) {
return e === e && !ff(e);
}
var oc = pf, gf = oc, hf = js;
function mf(e) {
for (var n = hf(e), t = n.length; t--; ) {
var r = n[t], i = e[r];
n[t] = [r, i, gf(i)];
}
return n;
}
var bf = mf;
function yf(e, n) {
return function(t) {
return t == null ? !1 : t[e] === n && (n !== void 0 || e in Object(t));
};
}
var lc = yf, Ef = df, _f = bf, vf = lc;
function xf(e) {
var n = _f(e);
return n.length == 1 && n[0][2] ? vf(n[0][0], n[0][1]) : function(t) {
return t === e || Ef(t, e, n);
};
}
var wf = xf, Sf = qs;
function Nf(e, n, t) {
var r = e == null ? void 0 : Sf(e, n);
return r === void 0 ? t : r;
}
var Of = Nf, kf = Gs, Af = Of, Cf = _d, Tf = Ws, If = oc, Mf = lc, Rf = Vs, Lf = 1, Df = 2;
function Pf(e, n) {
return Tf(e) && If(n) ? Mf(Rf(e), n) : function(t) {
var r = Af(t, e);
return r === void 0 && r === n ? Cf(t, e) : kf(n, r, Lf | Df);
};
}
var Bf = Pf;
function $f(e) {
return function(n) {
return n == null ? void 0 : n[e];
};
}
var Ff = $f, zf = qs;
function Uf(e) {
return function(n) {
return zf(n, e);
};
}
var Hf = Uf, Kf = Ff, jf = Hf, Gf = Ws, qf = Vs;
function Wf(e) {
return Gf(e) ? Kf(qf(e)) : jf(e);
}
var Vf = Wf, Yf = wf, Zf = Bf, Xf = vd, Qf = Ys, Jf = Vf;
function ep(e) {
return typeof e == "function" ? e : e == null ? Xf : typeof e == "object" ? Qf(e) ? Zf(e[0], e[1]) : Yf(e) : Jf(e);
}
var np = ep;
const Ui = ["http", "https", "mailto", "tel"];
function tp(e) {
const n = (e || "").trim(), t = n.charAt(0);
if (t === "#" || t === "/")
return n;
const r = n.indexOf(":");
if (r === -1)
return n;
let i = -1;
for (; ++i < Ui.length; ) {
const a = Ui[i];
if (r === a.length && n.slice(0, a.length).toLowerCase() === a)
return n;
}
return i = n.indexOf("?"), i !== -1 && r > i || (i = n.indexOf("#"), i !== -1 && r > i) ? n : "javascript:void(0)";
}
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
var rp = function(n) {
return n != null && n.constructor != null && typeof n.constructor.isBuffer == "function" && n.constructor.isBuffer(n);
};
const sc = /* @__PURE__ */ ln(rp);
function at(e) {
return !e || typeof e != "object" ? "" : "position" in e || "type" in e ? Hi(e.position) : "start" in e || "end" in e ? Hi(e) : "line" in e || "column" in e ? kr(e) : "";
}
function kr(e) {
return Ki(e && e.line) + ":" + Ki(e && e.column);
}
function Hi(e) {
return kr(e && e.start) + "-" + kr(e && e.end);
}
function Ki(e) {
return e && typeof e == "number" ? e : 1;
}
class sn 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, r) {
const i = [null, null];
let a = {
// @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" && (r = t, t = void 0), typeof r == "string") {
const o = r.indexOf(":");
o === -1 ? i[1] = r : (i[0] = r.slice(0, o), i[1] = r.slice(o + 1));
}
t && ("type" in t || "position" in t ? t.position && (a = t.position) : "start" in t || "end" in t ? a = t : ("line" in t || "column" in t) && (a.start = t)), this.name = at(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 = a.start.line, this.column = a.start.column, this.position = a, this.source = i[0], this.ruleId = i[1], this.file, this.actual, this.expected, this.url, this.note;
}
}
sn.prototype.file = "";
sn.prototype.name = "";
sn.prototype.reason = "";
sn.prototype.message = "";
sn.prototype.stack = "";
sn.prototype.fatal = null;
sn.prototype.column = null;
sn.prototype.line = null;
sn.prototype.source = null;
sn.prototype.ruleId = null;
sn.prototype.position = null;
const dn = { basename: ip, dirname: ap, extname: op, join: lp, sep: "/" };
function ip(e, n) {
if (n !== void 0 && typeof n != "string")
throw new TypeError('"ext" argument must be a string');
mt(e);
let t = 0, r = -1, i = e.length, a;
if (n === void 0 || n.length === 0 || n.length > e.length) {
for (; i--; )
if (e.charCodeAt(i) === 47) {
if (a) {
t = i + 1;
break;
}
} else
r < 0 && (a = !0, r = i + 1);
return r < 0 ? "" : e.slice(t, r);
}
if (n === e)
return "";
let o = -1, l = n.length - 1;
for (; i--; )
if (e.charCodeAt(i) === 47) {
if (a) {
t = i + 1;
break;
}
} else
o < 0 && (a = !0, o = i + 1), l > -1 && (e.charCodeAt(i) === n.charCodeAt(l--) ? l < 0 && (r = i) : (l = -1, r = o));
return t === r ? r = o : r < 0 && (r = e.length), e.slice(t, r);
}
function ap(e) {
if (mt(e), e.length === 0)
return ".";
let n = -1, t = e.length, r;
for (; --t; )
if (e.charCodeAt(t) === 47) {
if (r) {
n = t;
break;
}
} else
r || (r = !0);
return n < 0 ? e.charCodeAt(0) === 47 ? "/" : "." : n === 1 && e.charCodeAt(0) === 47 ? "//" : e.slice(0, n);
}
function op(e) {
mt(e);
let n = e.length, t = -1, r = 0, i = -1, a = 0, o;
for (; n--; ) {
const l = e.charCodeAt(n);
if (l === 47) {
if (o) {
r = n + 1;
break;
}
continue;
}
t < 0 && (o = !0, t = n + 1), l === 46 ? i < 0 ? i = n : a !== 1 && (a = 1) : i > -1 && (a = -1);
}
return i < 0 || t < 0 || // We saw a non-dot character immediately before the dot.
a === 0 || // The (right-most) trimmed path component is exactly `..`.
a === 1 && i === t - 1 && i === r + 1 ? "" : e.slice(i, t);
}
function lp(...e) {
let n = -1, t;
for (; ++n < e.length; )
mt(e[n]), e[n] && (t = t === void 0 ? e[n] : t + "/" + e[n]);
return t === void 0 ? "." : sp(t);
}
function sp(e) {
mt(e);
const n = e.charCodeAt(0) === 47;
let t = cp(e, !n);
return t.length === 0 && !n && (t = "."), t.length > 0 && e.charCodeAt(e.length - 1) === 47 && (t += "/"), n ? "/" + t : t;
}
function cp(e, n) {
let t = "", r = 0, i = -1, a = 0, o = -1, l, s;
for (; ++o <= e.length; ) {
if (o < e.length)
l = e.charCodeAt(o);
else {
if (l === 47)
break;
l = 47;
}
if (l === 47) {
if (!(i === o - 1 || a === 1))
if (i !== o - 1 && a === 2) {
if (t.length < 2 || r !== 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 = "", r = 0) : (t = t.slice(0, s), r = t.length - 1 - t.lastIndexOf("/")), i = o, a = 0;
continue;
}
} else if (t.length > 0) {
t = "", r = 0, i = o, a = 0;
continue;
}
}
n && (t = t.length > 0 ? t + "/.." : "..", r = 2);
} else
t.length > 0 ? t += "/" + e.slice(i + 1, o) : t = e.slice(i + 1, o), r = o - i - 1;
i = o, a = 0;
} else
l === 46 && a > -1 ? a++ : a = -1;
}
return t;
}
function mt(e) {
if (typeof e != "string")
throw new TypeError(
"Path must be a string. Received " + JSON.stringify(e)
);
}
const up = { cwd: dp };
function dp() {
return "/";
}
function Ar(e) {
return e !== null && typeof e == "object" && // @ts-expect-error: indexable.
e.href && // @ts-expect-error: indexable.
e.origin;
}
function fp(e) {
if (typeof e == "string")
e = new URL(e);
else if (!Ar(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 pp(e);
}
function pp(e) {
if (e.hostname !== "") {
const r = new TypeError(
'File URL host must be "localhost" or empty on darwin'
);
throw r.code = "ERR_INVALID_FILE_URL_HOST", r;
}
const n = e.pathname;
let t = -1;
for (; ++t < n.length; )
if (n.charCodeAt(t) === 37 && n.charCodeAt(t + 1) === 50) {
const r = n.charCodeAt(t + 2);
if (r === 70 || r === 102) {
const i = new TypeError(
"File URL path must not include encoded / characters"
);
throw i.code = "ERR_INVALID_FILE_URL_PATH", i;
}
}
return decodeURIComponent(n);
}
const rr = ["history", "path", "basename", "stem", "extname", "dirname"];
class cc {
/**
* 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" || gp(n) ? t = { value: n } : Ar(n) ? t = { path: n } : t = n : t = {}, this.data = {}, this.messages = [], this.history = [], this.cwd = up.cwd(), this.value, this.stored, this.result, this.map;
let r = -1;
for (; ++r < rr.length; ) {
const a = rr[r];
a in t && t[a] !== void 0 && t[a] !== null && (this[a] = a === "history" ? [...t[a]] : t[a]);
}
let i;
for (i in t)
rr.includes(i) || (this[i] = t[i]);
}
/**
* 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) {
Ar(n) && (n = fp(n)), ar(n, "path"), this.path !== n && this.history.push(n);
}
/**
* Get the parent path (example: `'~'`).
*/
get dirname() {
return typeof this.path == "string" ? dn.dirname(this.path) : void 0;
}
/**
* Set the parent path (example: `'~'`).
*
* Cannot be set if there’s no `path` yet.
*/
set dirname(n) {
ji(this.basename, "dirname"), this.path = dn.join(n || "", this.basename);
}
/**
* Get the basename (including extname) (example: `'index.min.js'`).
*/
get basename() {
return typeof this.path == "string" ? dn.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) {
ar(n, "basename"), ir(n, "basename"), this.path = dn.join(this.dirname || "", n);
}
/**
* Get the extname (including dot) (example: `'.js'`).
*/
get extname() {
return typeof this.path == "string" ? dn.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 (ir(n, "extname"), ji(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 = dn.join(this.dirname, this.stem + (n || ""));
}
/**
* Get the stem (basename w/o extname) (example: `'index.min'`).
*/
get stem() {
return typeof this.path == "string" ? dn.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) {
ar(n, "stem"), ir(n, "stem"), this.path = dn.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, r) {
const i = new sn(n, t, r);
return this.path && (i.name = this.path + ":" + i.name, i.file = this.path), i.fatal = !1, this.messages.push(i), i;
}
/**
* 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, r) {
const i = this.message(n, t, r);
return i.fatal = null, i;
}
/**
* 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, r) {
const i = this.message(n, t, r);
throw i.fatal = !0, i;
}
}
function ir(e, n) {
if (e && e.includes(dn.sep))
throw new Error(
"`" + n + "` cannot be a path: did not expect `" + dn.sep + "`"
);
}
function ar(e, n) {
if (!e)
throw new Error("`" + n + "` cannot be empty");
}
function ji(e, n) {
if (!e)
throw new Error("Setting `" + n + "` requires `path` to be set too");
}
function gp(e) {
return sc(e);
}
function Gi(e) {
if (e)
throw e;
}
var Mt = Object.prototype.hasOwnProperty, uc = Object.prototype.toString, qi = Object.defineProperty, Wi = Object.getOwnPropertyDescriptor, Vi = function(n) {
return typeof Array.isArray == "function" ? Array.isArray(n) : uc.call(n) === "[object Array]";
}, Yi = function(n) {
if (!n || uc.call(n) !== "[object Object]")
return !1;
var t = Mt.call(n, "constructor"), r = n.constructor && n.constructor.prototype && Mt.call(n.constructor.prototype, "isPrototypeOf");
if (n.constructor && !t && !r)
return !1;
var i;
for (i in n)
;
return typeof i > "u" || Mt.call(n, i);
}, Zi = function(n, t) {
qi && t.name === "__proto__" ? qi(n, t.name, {
enumerable: !0,
configurable: !0,
value: t.newValue,
writable: !0
}) : n[t.name] = t.newValue;
}, Xi = function(n, t) {
if (t === "__proto__")
if (Mt.call(n, t)) {
if (Wi)
return Wi(n, t).value;
} else
return;
return n[t];
}, hp = function e() {
var n, t, r, i, a, o, l = arguments[0], s = 1, c = arguments.length, u = !1;
for (typeof l == "boolean" && (u = l, l = arguments[1] || {}, s = 2), (l == null || typeof l != "object" && typeof l != "function") && (l = {}); s < c; ++s)
if (n = arguments[s], n != null)
for (t in n)
r = Xi(l, t), i = Xi(n, t), l !== i && (u && i && (Yi(i) || (a = Vi(i))) ? (a ? (a = !1, o = r && Vi(r) ? r : []) : o = r && Yi(r) ? r : {}, Zi(l, { name: t, newValue: e(u, o, i) })) : typeof i < "u" && Zi(l, { name: t, newValue: i }));
return l;
};
const Qi = /* @__PURE__ */ ln(hp);
function Cr(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 mp() {
const e = [], n = { run: t, use: r };
return n;
function t(...i) {
let a = -1;
const o = i.pop();
if (typeof o != "function")
throw new TypeError("Expected function as last argument, not " + o);
l(null, ...i);
function l(s, ...c) {
const u = e[++a];
let d = -1;
if (s) {
o(s);
return;
}
for (; ++d < i.length; )
(c[d] === null || c[d] === void 0) && (c[d] = i[d]);
i = c, u ? bp(u, l)(...c) : o(null, ...c);
}
}
function r(i) {
if (typeof i != "function")
throw new TypeError(
"Expected `middelware` to be a function, not " + i
);
return e.push(i), n;
}
}
function bp(e, n) {
let t;
return r;
function r(...o) {
const l = e.length > o.length;
let s;
l && o.push(i);
try {
s = e.apply(this, o);
} catch (c) {
const u = (
/** @type {Error} */
c
);
if (l && t)
throw u;
return i(u);
}
l || (s && s.then && typeof s.then == "function" ? s.then(a, i) : s instanceof Error ? i(s) : a(s));
}
function i(o, ...l) {
t || (t = !0, n(o, ...l));
}
function a(o) {
i(null, o);
}
}
const yp = fc().freeze(), dc = {}.hasOwnProperty;
function fc() {
const e = mp(), n = [];
let t = {}, r, i = -1;
return a.data = o, a.Parser = void 0, a.Compiler = void 0, a.freeze = l, a.attachers = n, a.use = s, a.parse = c, a.stringify = u, a.run = d, a.runSync = h, a.process = f, a.processSync = p, a;
function a() {
const g = fc();
let E = -1;
for (; ++E < n.length; )
g.use(...n[E]);
return g.data(Qi(!0, {}, t)), g;
}
function o(g, E) {
return typeof g == "string" ? arguments.length === 2 ? (sr("data", r), t[g] = E, a) : dc.call(t, g) && t[g] || null : g ? (sr("data", r), t = g, a) : t;
}
function l() {
if (r)
return a;
for (; ++i < n.length; ) {
const [g, ...E] = n[i];
if (E[0] === !1)
continue;
E[0] === !0 && (E[0] = void 0);
const y = g.call(a, ...E);
typeof y == "function" && e.use(y);
}
return r = !0, i = Number.POSITIVE_INFINITY, a;
}
function s(g, ...E) {
let y;
if (sr("use", r), g != null)
if (typeof g == "function")
M(g, ...E);
else if (typeof g == "object")
Array.isArray(g) ? T(g) : x(g);
else
throw new TypeError("Expected usable value, not `" + g + "`");
return y && (t.settings = Object.assign(t.settings || {}, y)), a;
function C(_) {
if (typeof _ == "function")
M(_);
else if (typeof _ == "object")
if (Array.isArray(_)) {
const [k, ...L] = _;
M(k, ...L);
} else
x(_);
else
throw new TypeError("Expected usable value, not `" + _ + "`");
}
function x(_) {
T(_.plugins), _.settings && (y = Object.assign(y || {}, _.settings));
}
function T(_) {
let k = -1;
if (_ != null)
if (Array.isArray(_))
for (; ++k < _.length; ) {
const L = _[k];
C(L);
}
else
throw new TypeError("Expected a list of plugins, not `" + _ + "`");
}
function M(_, k) {
let L = -1, U;
for (; ++L < n.length; )
if (n[L][0] === _) {
U = n[L];
break;
}
U ? (Cr(U[1]) && Cr(k) && (k = Qi(!0, U[1], k)), U[1] = k) : n.push([...arguments]);
}
}
function c(g) {
a.freeze();
const E = et(g), y = a.Parser;
return or("parse", y), Ji(y, "parse") ? new y(String(E), E).parse() : y(String(E), E);
}
function u(g, E) {
a.freeze();
const y = et(E), C = a.Compiler;
return lr("stringify", C), ea(g), Ji(C, "compile") ? new C(g, y).compile() : C(g, y);
}
function d(g, E, y) {
if (ea(g), a.freeze(), !y && typeof E == "function" && (y = E, E = void 0), !y)
return new Promise(C);
C(null, y);
function C(x, T) {
e.run(g, et(E), M);
function M(_, k, L) {
k = k || g, _ ? T(_) : x ? x(k) : y(null, k, L);
}
}
}
function h(g, E) {
let y, C;
return a.run(g, E, x), na("runSync", "run", C), y;
function x(T, M) {
Gi(T), y = M, C = !0;
}
}
function f(g, E) {
if (a.freeze(), or("process", a.Parser), lr("process", a.Compiler), !E)
return new Promise(y);
y(null, E);
function y(C, x) {
const T = et(g);
a.run(a.parse(T), T, (_, k, L) => {
if (_ || !k || !L)
M(_);
else {
const U = a.stringify(k, L);
U == null || (vp(U) ? L.value = U : L.result = U), M(_, L);
}
});
function M(_, k) {
_ || !k ? x(_) : C ? C(k) : E(null, k);
}
}
}
function p(g) {
let E;
a.freeze(), or("processSync", a.Parser), lr("processSync", a.Compiler);
const y = et(g);
return a.process(y, C), na("processSync", "process", E), y;
function C(x) {
E = !0, Gi(x);
}
}
}
function Ji(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
(Ep(e.prototype) || n in e.prototype);
}
function Ep(e) {
let n;
for (n in e)
if (dc.call(e, n))
return !0;
return !1;
}
function or(e, n) {
if (typeof n != "function")
throw new TypeError("Cannot `" + e + "` without `Parser`");
}
function lr(e, n) {
if (typeof n != "function")
throw new TypeError("Cannot `" + e + "` without `Compiler`");
}
function sr(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 ea(e) {
if (!Cr(e) || typeof e.type != "string")
throw new TypeError("Expected node, got `" + e + "`");
}
function na(e, n, t) {
if (!t)
throw new Error(
"`" + e + "` finished async. Use `" + n + "` instead"
);
}
function et(e) {
return _p(e) ? e : new cc(e);
}
function _p(e) {
return !!(e && typeof e == "object" && "message" in e && "messages" in e);
}
function vp(e) {
return typeof e == "string" || sc(e);
}
const xp = {};
function wp(e, n) {
const t = n || xp, r = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
return pc(e, r, i);
}
function pc(e, n, t) {
if (Sp(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 ta(e.children, n, t);
}
return Array.isArray(e) ? ta(e, n, t) : "";
}
function ta(e, n, t) {
const r = [];
let i = -1;
for (; ++i < e.length; )
r[i] = pc(e[i], n, t);
return r.join("");
}
function Sp(e) {
return !!(e && typeof e == "object");
}
function mn(e, n, t, r) {
const i = e.length;
let a = 0, o;
if (n < 0 ? n = -n > i ? 0 : i + n : n = n > i ? i : n, t = t > 0 ? t : 0, r.length < 1e4)
o = Array.from(r), o.unshift(n, t), e.splice(...o);
else
for (t && e.splice(n, t); a < r.length; )
o = r.slice(a, a + 1e4), o.unshift(n, 0), e.splice(...o), a += 1e4, n += 1e4;
}
function an(e, n) {
return e.length > 0 ? (mn(e, e.length, 0, n), e) : n;
}
const ra = {}.hasOwnProperty;
function Np(e) {
const n = {};
let t = -1;
for (; ++t < e.length; )
Op(n, e[t]);
return n;
}
function Op(e, n) {
let t;
for (t in n) {
const i = (ra.call(e, t) ? e[t] : void 0) || (e[t] = {}), a = n[t];
let o;
if (a)
for (o in a) {
ra.call(i, o) || (i[o] = []);
const l = a[o];
kp(
// @ts-expect-error Looks like a list.
i[o],
Array.isArray(l) ? l : l ? [l] : []
);
}
}
}
function kp(e, n) {
let t = -1;
const r = [];
for (; ++t < n.length; )
(n[t].add === "after" ? e : r).push(n[t]);
mn(e, 0, 0, r);
}
const Ap = /[!-\/:-@\[-`\{-~\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]/, pn = Mn(/[A-Za-z]/), tn = Mn(/[\dA-Za-z]/), Cp = Mn(/[#-'*+\--9=?A-Z^-~]/);
function Tr(e) {
return (
// Special whitespace codes (which have negative values), C0 and Control
// character DEL
e !== null && (e < 32 || e === 127)
);
}
const Ir = Mn(/\d/), Tp = Mn(/[\dA-Fa-f]/), Ip = Mn(/[!-/:-@[-`{-~]/);
function re(e) {
return e !== null && e < -2;
}
function Je(e) {
return e !== null && (e < 0 || e === 32);
}
function me(e) {
return e === -2 || e === -1 || e === 32;
}
const Mp = Mn(Ap), Rp = Mn(/\s/);
function Mn(e) {
return n;
function n(t) {
return t !== null && e.test(String.fromCharCode(t));
}
}
function Se(e, n, t, r) {
const i = r ? r - 1 : Number.POSITIVE_INFINITY;
let a = 0;
return o;
function o(s) {
return me(s) ? (e.enter(t), l(s)) : n(s);
}
function l(s) {
return me(s) && a++ < i ? (e.consume(s), l) : (e.exit(t), n(s));
}
}
const Lp = {
tokenize: Dp
};
function Dp(e) {
const n = e.attempt(
this.parser.constructs.contentInitial,
r,
i
);
let t;
return n;
function r(l) {
if (l === null) {
e.consume(l);
return;
}
return e.enter("lineEnding"), e.consume(l), e.exit("lineEnding"), Se(e, n, "linePrefix");
}
function i(l) {
return e.enter("paragraph"), a(l);
}
function a(l) {
const s = e.enter("chunkText", {
contentType: "text",
previous: t
});
return t && (t.next = s), t = s, o(l);
}
function o(l) {
if (l === null) {
e.exit("chunkText"), e.exit("paragraph"), e.consume(l);
return;
}
return re(l) ? (e.consume(l), e.exit("chunkText"), a) : (e.consume(l), o);
}
}
const Pp = {
tokenize: Bp
}, ia = {
tokenize: $p
};
function Bp(e) {
const n = this, t = [];
let r = 0, i, a, o;
return l;
function l(x) {
if (r < t.length) {
const T = t[r];
return n.containerState = T[1], e.attempt(
T[0].continuation,
s,
c
)(x);
}
return c(x);
}
function s(x) {
if (r++, n.containerState._closeFlow) {
n.containerState._closeFlow = void 0, i && C();
const T = n.events.length;
let M = T, _;
for (; M--; )
if (n.events[M][0] === "exit" && n.events[M][1].type === "chunkFlow") {
_ = n.events[M][1].end;
break;
}
y(r);
let k = T;
for (; k < n.events.length; )
n.events[k][1].end = Object.assign({}, _), k++;
return mn(
n.events,
M + 1,
0,
n.events.slice(T)
), n.events.length = k, c(x);
}
return l(x);
}
function c(x) {
if (r === t.length) {
if (!i)
return h(x);
if (i.currentConstruct && i.currentConstruct.concrete)
return p(x);
n.interrupt = !!(i.currentConstruct && !i._gfmTableDynamicInterruptHack);
}
return n.containerState = {}, e.check(
ia,
u,
d
)(x);
}
function u(x) {
return i && C(), y(r), h(x);
}
function d(x) {
return n.parser.lazy[n.now().line] = r !== t.length, o = n.now().offset, p(x);
}
function h(x) {
return n.containerState = {}, e.attempt(
ia,
f,
p
)(x);
}
function f(x) {
return r++, t.push([n.currentConstruct, n.containerState]), h(x);
}
function p(x) {
if (x === null) {
i && C(), y(0), e.consume(x);
return;
}
return i = i || n.parser.flow(n.now()), e.enter("chunkFlow", {
contentType: "flow",
previous: a,
_tokenizer: i
}), g(x);
}
function g(x) {
if (x === null) {
E(e.exit("chunkFlow"), !0), y(0), e.consume(x);
return;
}
return re(x) ? (e.consume(x), E(e.exit("chunkFlow")), r = 0, n.interrupt = void 0, l) : (e.consume(x), g);
}
function E(x, T) {
const M = n.sliceStream(x);
if (T && M.push(null), x.previous = a, a && (a.next = x), a = x, i.defineSkip(x.start), i.write(M), n.parser.lazy[x.start.line]) {
let _ = i.events.length;
for (; _--; )
if (
// The token starts before the line ending…
i.events[_][1].start.offset < o && // …and either is not ended yet…
(!i.events[_][1].end || // …or ends after it.
i.events[_][1].end.offset > o)
)
return;
const k = n.events.length;
let L = k, U, Z;
for (; L--; )
if (n.events[L][0] === "exit" && n.events[L][1].type === "chunkFlow") {
if (U) {
Z = n.events[L][1].end;
break;
}
U = !0;
}
for (y(r), _ = k; _ < n.events.length; )
n.events[_][1].end = Object.assign({}, Z), _++;
mn(
n.events,
L + 1,
0,
n.events.slice(k)
), n.events.length = _;
}
}
function y(x) {
let T = t.length;
for (; T-- > x; ) {
const M = t[T];
n.containerState = M[1], M[0].exit.call(n, e);
}
t.length = x;
}
function C() {
i.write([null]), a = void 0, i = void 0, n.containerState._closeFlow = void 0;
}
}
function $p(e, n, t) {
return Se(
e,
e.attempt(this.parser.constructs.document, n, t),
"linePrefix",
this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
);
}
function aa(e) {
if (e === null || Je(e) || Rp(e))
return 1;
if (Mp(e))
return 2;
}
function ei(e, n, t) {
const r = [];
let i = -1;
for (; ++i < e.length; ) {
const a = e[i].resolveAll;
a && !r.includes(a) && (n = a(n, t), r.push(a));
}
return n;
}
const Mr = {
name: "attention",
tokenize: zp,
resolveAll: Fp
};
function Fp(e, n) {
let t = -1, r, i, a, o, l, s, c, u;
for (; ++t < e.length; )
if (e[t][0] === "enter" && e[t][1].type === "attentionSequence" && e[t][1]._close) {
for (r = t; r--; )
if (e[r][0] === "exit" && e[r][1].type === "attentionSequence" && e[r][1]._open && // If the markers are the same:
n.sliceSerialize(e[r][1]).charCodeAt(0) === n.sliceSerialize(e[t][1]).charCodeAt(0)) {
if ((e[r][1]._close || e[t][1]._open) && (e[t][1].end.offset - e[t][1].start.offset) % 3 && !((e[r][1].end.offset - e[r][1].start.offset + e[t][1].end.offset - e[t][1].start.offset) % 3))
continue;
s = e[r][1].end.offset - e[r][1].start.offset > 1 && e[t][1].end.offset - e[t][1].start.offset > 1 ? 2 : 1;
const d = Object.assign({}, e[r][1].end), h = Object.assign({}, e[t][1].start);
oa(d, -s), oa(h, s), o = {
type: s > 1 ? "strongSequence" : "emphasisSequence",
start: d,
end: Object.assign({}, e[r][1].end)
}, l = {
type: s > 1 ? "strongSequence" : "emphasisSequence",
start: Object.assign({}, e[t][1].start),
end: h
}, a = {
type: s > 1 ? "strongText" : "emphasisText",
start: Object.assign({}, e[r][1].end),
end: Object.assign({}, e[t][1].start)
}, i = {
type: s > 1 ? "strong" : "emphasis",
start: Object.assign({}, o.start),
end: Object.assign({}, l.end)
}, e[r][1].end = Object.assign({}, o.start), e[t][1].start = Object.assign({}, l.end), c = [], e[r][1].end.offset - e[r][1].start.offset && (c = an(c, [
["enter", e[r][1], n],
["exit", e[r][1], n]
])), c = an(c, [
["enter", i, n],
["enter", o, n],
["exit", o, n],
["enter", a, n]
]), c = an(
c,
ei(
n.parser.constructs.insideSpan.null,
e.slice(r + 1, t),
n
)
), c = an(c, [
["exit", a, n],
["enter", l, n],
["exit", l, n],
["exit", i, n]
]), e[t][1].end.offset - e[t][1].start.offset ? (u = 2, c = an(c, [
["enter", e[t][1], n],
["exit", e[t][1], n]
])) : u = 0, mn(e, r - 1, t - r + 3, c), t = r + c.length - u - 2;
break;
}
}
for (t = -1; ++t < e.length; )
e[t][1].type === "attentionSequence" && (e[t][1].type = "data");
return e;
}
function zp(e, n) {
const t = this.parser.constructs.attentionMarkers.null, r = this.previous, i = aa(r);
let a;
return o;
function o(s) {
return a = s, e.enter("attentionSequence"), l(s);
}
function l(s) {
if (s === a)
return e.consume(s), l;
const c = e.exit("attentionSequence"), u = aa(s), d = !u || u === 2 && i || t.includes(s), h = !i || i === 2 && u || t.includes(r);
return c._open = !!(a === 42 ? d : d && (i || !h)), c._close = !!(a === 42 ? h : h && (u || !d)), n(s);
}
}
function oa(e, n) {
e.column += n, e.offset += n, e._bufferIndex += n;
}
const Up = {
name: "autolink",
tokenize: Hp
};
function Hp(e, n, t) {
let r = 0;
return i;
function i(f) {
return e.enter("autolink"), e.enter("autolinkMarker"), e.consume(f), e.exit("autolinkMarker"), e.enter("autolinkProtocol"), a;
}
function a(f) {
return pn(f) ? (e.consume(f), o) : c(f);
}
function o(f) {
return f === 43 || f === 45 || f === 46 || tn(f) ? (r = 1, l(f)) : c(f);
}
function l(f) {
return f === 58 ? (e.consume(f), r = 0, s) : (f === 43 || f === 45 || f === 46 || tn(f)) && r++ < 32 ? (e.consume(f), l) : (r = 0, c(f));
}
function s(f) {
return f === 62 ? (e.exit("autolinkProtocol"), e.enter("autolinkMarker"), e.consume(f), e.exit("autolinkMarker"), e.exit("autolink"), n) : f === null || f === 32 || f === 60 || Tr(f) ? t(f) : (e.consume(f), s);
}
function c(f) {
return f === 64 ? (e.consume(f), u) : Cp(f) ? (e.consume(f), c) : t(f);
}
function u(f) {
return tn(f) ? d(f) : t(f);
}
function d(f) {
return f === 46 ? (e.consume(f), r = 0, u) : f === 62 ? (e.exit("autolinkProtocol").type = "autolinkEmail", e.enter("autolinkMarker"), e.consume(f), e.exit("autolinkMarker"), e.exit("autolink"), n) : h(f);
}
function h(f) {
if ((f === 45 || tn(f)) && r++ < 63) {
const p = f === 45 ? h : d;
return e.consume(f), p;
}
return t(f);
}
}
const qt = {
tokenize: Kp,
partial: !0
};
function Kp(e, n, t) {
return r;
function r(a) {
return me(a) ? Se(e, i, "linePrefix")(a) : i(a);
}
function i(a) {
return a === null || re(a) ? n(a) : t(a);
}
}
const gc = {
name: "blockQuote",
tokenize: jp,
continuation: {
tokenize: Gp
},
exit: qp
};
function jp(e, n, t) {
const r = this;
return i;
function i(o) {
if (o === 62) {
const l = r.containerState;
return l.open || (e.enter("blockQuote", {
_container: !0
}), l.open = !0), e.enter("blockQuotePrefix"), e.enter("blockQuoteMarker"), e.consume(o), e.exit("blockQuoteMarker"), a;
}
return t(o);
}
function a(o) {
return me(o) ? (e.enter("blockQuotePrefixWhitespace"), e.consume(o), e.exit("blockQuotePrefixWhitespace"), e.exit("blockQuotePrefix"), n) : (e.exit("blockQuotePrefix"), n(o));
}
}
function Gp(e, n, t) {
const r = this;
return i;
function i(o) {
return me(o) ? Se(
e,
a,
"linePrefix",
r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
)(o) : a(o);
}
function a(o) {
return e.attempt(gc, n, t)(o);
}
}
function qp(e) {
e.exit("blockQuote");
}
const hc = {
name: "characterEscape",
tokenize: Wp
};
function Wp(e, n, t) {
return r;
function r(a) {
return e.enter("characterEscape"), e.enter("escapeMarker"), e.consume(a), e.exit("escapeMarker"), i;
}
function i(a) {
return Ip(a) ? (e.enter("characterEscapeValue"), e.consume(a), e.exit("characterEscapeValue"), e.exit("characterEscape"), n) : t(a);
}
}
const la = document.createElement("i");
function ni(e) {
const n = "&" + e + ";";
la.innerHTML = n;
const t = la.textContent;
return t.charCodeAt(t.length - 1) === 59 && e !== "semi" || t === n ? !1 : t;
}
const mc = {
name: "characterReference",
tokenize: Vp
};
function Vp(e, n, t) {
const r = this;
let i = 0, a, o;
return l;
function l(d) {
return e.enter("characterReference"), e.enter("characterReferenceMarker"), e.consume(d), e.exit("characterReferenceMarker"), s;
}
function s(d) {
return d === 35 ? (e.enter("characterReferenceMarkerNumeric"), e.consume(d), e.exit("characterReferenceMarkerNumeric"), c) : (e.enter("characterReferenceValue"), a = 31, o = tn, u(d));
}
function c(d) {
return d === 88 || d === 120 ? (e.enter("characterReferenceMarkerHexadecimal"), e.consume(d), e.exit("characterReferenceMarkerHexadecimal"), e.enter("characterReferenceValue"), a = 6, o = Tp, u) : (e.enter("characterReferenceValue"), a = 7, o = Ir, u(d));
}
function u(d) {
if (d === 59 && i) {
const h = e.exit("characterReferenceValue");
return o === tn && !ni(r.sliceSerialize(h)) ? t(d) : (e.enter("characterReferenceMarker"), e.consume(d), e.exit("characterReferenceMarker"), e.exit("characterReference"), n);
}
return o(d) && i++ < a ? (e.consume(d), u) : t(d);
}
}
const sa = {
tokenize: Zp,
partial: !0
}, ca = {
name: "codeFenced",
tokenize: Yp,
concrete: !0
};
function Yp(e, n, t) {
const r = this, i = {
tokenize: M,
partial: !0
};
let a = 0, o = 0, l;
return s;
function s(_) {
return c(_);
}
function c(_) {
const k = r.events[r.events.length - 1];
return a = k && k[1].type === "linePrefix" ? k[2].sliceSerialize(k[1], !0).length : 0, l = _, e.enter("codeFenced"), e.enter("codeFencedFence"), e.enter("codeFencedFenceSequence"), u(_);
}
function u(_) {
return _ === l ? (o++, e.consume(_), u) : o < 3 ? t(_) : (e.exit("codeFencedFenceSequence"), me(_) ? Se(e, d, "whitespace")(_) : d(_));
}
function d(_) {
return _ === null || re(_) ? (e.exit("codeFencedFence"), r.interrupt ? n(_) : e.check(sa, g, T)(_)) : (e.enter("codeFencedFenceInfo"), e.enter("chunkString", {
contentType: "string"
}), h(_));
}
function h(_) {
return _ === null || re(_) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), d(_)) : me(_) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), Se(e, f, "whitespace")(_)) : _ === 96 && _ === l ? t(_) : (e.consume(_), h);
}
function f(_) {
return _ === null || re(_) ? d(_) : (e.enter("codeFencedFenceMeta"), e.enter("chunkString", {
contentType: "string"
}), p(_));
}
function p(_) {
return _ === null || re(_) ? (e.exit("chunkString"), e.exit("codeFencedFenceMeta"), d(_)) : _ === 96 && _ === l ? t(_) : (e.consume(_), p);
}
function g(_) {
return e.attempt(i, T, E)(_);
}
function E(_) {
return e.enter("lineEnding"), e.consume(_), e.exit("lineEnding"), y;
}
function y(_) {
return a > 0 && me(_) ? Se(
e,
C,
"linePrefix",
a + 1
)(_) : C(_);
}
function C(_) {
return _ === null || re(_) ? e.check(sa, g, T)(_) : (e.enter("codeFlowValue"), x(_));
}
function x(_) {
return _ === null || re(_) ? (e.exit("codeFlowValue"), C(_)) : (e.consume(_), x);
}
function T(_) {
return e.exit("codeFenced"), n(_);
}
function M(_, k, L) {
let U = 0;
return Z;
function Z(z) {
return _.enter("lineEnding"), _.consume(z), _.exit("lineEnding"), P;
}
function P(z) {
return _.enter("codeFencedFence"), me(z) ? Se(
_,
R,
"linePrefix",
r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
)(z) : R(z);
}
function R(z) {
return z === l ? (_.enter("codeFencedFenceSequence"), K(z)) : L(z);
}
function K(z) {
return z === l ? (U++, _.consume(z), K) : U >= o ? (_.exit("codeFencedFenceSequence"), me(z) ? Se(_, B, "whitespace")(z) : B(z)) : L(z);
}
function B(z) {
return z === null || re(z) ? (_.exit("codeFencedFence"), k(z)) : L(z);
}
}
}
function Zp(e, n, t) {
const r = this;
return i;
function i(o) {
return o === null ? t(o) : (e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), a);
}
function a(o) {
return r.parser.lazy[r.now().line] ? t(o) : n(o);
}
}
const cr = {
name: "codeIndented",
tokenize: Qp
}, Xp = {
tokenize: Jp,
partial: !0
};
function Qp(e, n, t) {
const r = this;
return i;
function i(c) {
return e.enter("codeIndented"), Se(e, a, "linePrefix", 4 + 1)(c);
}
function a(c) {
const u = r.events[r.events.length - 1];
return u && u[1].type === "linePrefix" && u[2].sliceSerialize(u[1], !0).length >= 4 ? o(c) : t(c);
}
function o(c) {
return c === null ? s(c) : re(c) ? e.attempt(Xp, o, s)(c) : (e.enter("codeFlowValue"), l(c));
}
function l(c) {
return c === null || re(c) ? (e.exit("codeFlowValue"), o(c)) : (e.consume(c), l);
}
function s(c) {
return e.exit("codeIndented"), n(c);
}
}
function Jp(e, n, t) {
const r = this;
return i;
function i(o) {
return r.parser.lazy[r.now().line] ? t(o) : re(o) ? (e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), i) : Se(e, a, "linePrefix", 4 + 1)(o);
}
function a(o) {
const l = r.events[r.events.length - 1];
return l && l[1].type === "linePrefix" && l[2].sliceSerialize(l[1], !0).length >= 4 ? n(o) : re(o) ? i(o) : t(o);
}
}
const eg = {
name: "codeText",
tokenize: rg,
resolve: ng,
previous: tg
};
function ng(e) {
let n = e.length - 4, t = 3, r, i;
if ((e[t][1].type === "lineEnding" || e[t][1].type === "space") && (e[n][1].type === "lineEnding" || e[n][1].type === "space")) {
for (r = t; ++r < n; )
if (e[r][1].type === "codeTextData") {
e[t][1].type = "codeTextPadding", e[n][1].type = "codeTextPadding", t += 2, n -= 2;
break;
}
}
for (r = t - 1, n++; ++r <= n; )
i === void 0 ? r !== n && e[r][1].type !== "lineEnding" && (i = r) : (r === n || e[r][1].type === "lineEnding") && (e[i][1].type = "codeTextData", r !== i + 2 && (e[i][1].end = e[r - 1][1].end, e.splice(i + 2, r - i - 2), n -= r - i - 2, r = i + 2), i = void 0);
return e;
}
function tg(e) {
return e !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
}
function rg(e, n, t) {
let r = 0, i, a;
return o;
function o(d) {
return e.enter("codeText"), e.enter("codeTextSequence"), l(d);
}
function l(d) {
return d === 96 ? (e.consume(d), r++, l) : (e.exit("codeTextSequence"), s(d));
}
function s(d) {
return d === null ? t(d) : d === 32 ? (e.enter("space"), e.consume(d), e.exit("space"), s) : d === 96 ? (a = e.enter("codeTextSequence"), i = 0, u(d)) : re(d) ? (e.enter("lineEnding"), e.consume(d), e.exit("lineEnding"), s) : (e.enter("codeTextData"), c(d));
}
function c(d) {
return d === null || d === 32 || d === 96 || re(d) ? (e.exit("codeTextData"), s(d)) : (e.consume(d), c);
}
function u(d) {
return d === 96 ? (e.consume(d), i++, u) : i === r ? (e.exit("codeTextSequence"), e.exit("codeText"), n(d)) : (a.type = "codeTextData", c(d));
}
}
function bc(e) {
const n = {};
let t = -1, r, i, a, o, l, s, c;
for (; ++t < e.length; ) {
for (; t in n; )
t = n[t];
if (r = e[t], t && r[1].type === "chunkFlow" && e[t - 1][1].type === "listItemPrefix" && (s = r[1]._tokenizer.events, a = 0, a < s.length && s[a][1].type === "lineEndingBlank" && (a += 2), a < s.length && s[a][1].type === "content"))
for (; ++a < s.length && s[a][1].type !== "content"; )
s[a][1].type === "chunkText" && (s[a][1]._isInFirstContentOfListItem = !0, a++);
if (r[0] === "enter")
r[1].contentType && (Object.assign(n, ig(e, t)), t = n[t], c = !0);
else if (r[1]._container) {
for (a = t, i = void 0; a-- && (o = e[a], o[1].type === "lineEnding" || o[1].type === "lineEndingBlank"); )
o[0] === "enter" && (i &