@devalok/shilp-sutra-karm 0.20.2 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/chat-panel.js +51 -51
- package/dist/_chunks/kanban-board.js +40 -39
- package/dist/_chunks/markdown-components.js +15 -15
- package/dist/_chunks/project-card.js +25 -25
- package/dist/_chunks/render-adjustment-type.js +190 -190
- package/dist/_chunks/sidebar-scratchpad.js +225 -224
- package/dist/_chunks/task-detail-panel.js +362 -350
- package/dist/_chunks/vendor-dnd.js +3353 -0
- package/dist/_chunks/vendor-markdown.js +4939 -0
- package/dist/_chunks/vendor-utils.js +3264 -0
- package/dist/dashboard/index.js +80 -80
- package/dist/index.js +8 -8
- package/dist/tasks/index.js +205 -205
- package/dist/tasks/task-detail-panel.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/vendor.js +0 -11522
|
@@ -0,0 +1,4939 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { s as Ie, a as Je, h as sn, o as Se, n as st, f as on, b as cn, c as hn, d as pn, e as fn, p as Nt, g as mn, t as dn, i as Pe, v as Pt, j as gn, k as xn, l as _e, m as ot, q as ve, u as yn, r as Be } from "./vendor-utils.js";
|
|
3
|
+
import { jsxs as kn, jsx as bn, Fragment as wn } from "react/jsx-runtime";
|
|
4
|
+
import "react";
|
|
5
|
+
const Sn = /[ \t\n\f\r]/g;
|
|
6
|
+
function In(e) {
|
|
7
|
+
return typeof e == "object" ? e.type === "text" ? ct(e.value) : !1 : ct(e);
|
|
8
|
+
}
|
|
9
|
+
function ct(e) {
|
|
10
|
+
return e.replace(Sn, "") === "";
|
|
11
|
+
}
|
|
12
|
+
class Q extends Error {
|
|
13
|
+
/**
|
|
14
|
+
* Create a message for `reason`.
|
|
15
|
+
*
|
|
16
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
17
|
+
*
|
|
18
|
+
* @overload
|
|
19
|
+
* @param {string} reason
|
|
20
|
+
* @param {Options | null | undefined} [options]
|
|
21
|
+
* @returns
|
|
22
|
+
*
|
|
23
|
+
* @overload
|
|
24
|
+
* @param {string} reason
|
|
25
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
26
|
+
* @param {string | null | undefined} [origin]
|
|
27
|
+
* @returns
|
|
28
|
+
*
|
|
29
|
+
* @overload
|
|
30
|
+
* @param {string} reason
|
|
31
|
+
* @param {Point | Position | null | undefined} place
|
|
32
|
+
* @param {string | null | undefined} [origin]
|
|
33
|
+
* @returns
|
|
34
|
+
*
|
|
35
|
+
* @overload
|
|
36
|
+
* @param {string} reason
|
|
37
|
+
* @param {string | null | undefined} [origin]
|
|
38
|
+
* @returns
|
|
39
|
+
*
|
|
40
|
+
* @overload
|
|
41
|
+
* @param {Error | VFileMessage} cause
|
|
42
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
43
|
+
* @param {string | null | undefined} [origin]
|
|
44
|
+
* @returns
|
|
45
|
+
*
|
|
46
|
+
* @overload
|
|
47
|
+
* @param {Error | VFileMessage} cause
|
|
48
|
+
* @param {Point | Position | null | undefined} place
|
|
49
|
+
* @param {string | null | undefined} [origin]
|
|
50
|
+
* @returns
|
|
51
|
+
*
|
|
52
|
+
* @overload
|
|
53
|
+
* @param {Error | VFileMessage} cause
|
|
54
|
+
* @param {string | null | undefined} [origin]
|
|
55
|
+
* @returns
|
|
56
|
+
*
|
|
57
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
58
|
+
* Reason for message, should use markdown.
|
|
59
|
+
* @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
60
|
+
* Configuration (optional).
|
|
61
|
+
* @param {string | null | undefined} [origin]
|
|
62
|
+
* Place in code where the message originates (example:
|
|
63
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
64
|
+
* @returns
|
|
65
|
+
* Instance of `VFileMessage`.
|
|
66
|
+
*/
|
|
67
|
+
// eslint-disable-next-line complexity
|
|
68
|
+
constructor(t, n, r) {
|
|
69
|
+
super(), typeof n == "string" && (r = n, n = void 0);
|
|
70
|
+
let l = "", i = {}, u = !1;
|
|
71
|
+
if (n && ("line" in n && "column" in n ? i = { place: n } : "start" in n && "end" in n ? i = { place: n } : "type" in n ? i = {
|
|
72
|
+
ancestors: [n],
|
|
73
|
+
place: n.position
|
|
74
|
+
} : i = { ...n }), typeof t == "string" ? l = t : !i.cause && t && (u = !0, l = t.message, i.cause = t), !i.ruleId && !i.source && typeof r == "string") {
|
|
75
|
+
const f = r.indexOf(":");
|
|
76
|
+
f === -1 ? i.ruleId = r : (i.source = r.slice(0, f), i.ruleId = r.slice(f + 1));
|
|
77
|
+
}
|
|
78
|
+
if (!i.place && i.ancestors && i.ancestors) {
|
|
79
|
+
const f = i.ancestors[i.ancestors.length - 1];
|
|
80
|
+
f && (i.place = f.position);
|
|
81
|
+
}
|
|
82
|
+
const a = i.place && "start" in i.place ? i.place.start : i.place;
|
|
83
|
+
this.ancestors = i.ancestors || void 0, this.cause = i.cause || void 0, this.column = a ? a.column : void 0, this.fatal = void 0, this.file = "", this.message = l, this.line = a ? a.line : void 0, this.name = Ie(i.place) || "1:1", this.place = i.place || void 0, this.reason = this.message, this.ruleId = i.ruleId || void 0, this.source = i.source || void 0, this.stack = u && i.cause && typeof i.cause.stack == "string" ? i.cause.stack : "", this.actual = void 0, this.expected = void 0, this.note = void 0, this.url = void 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
Q.prototype.file = "";
|
|
87
|
+
Q.prototype.name = "";
|
|
88
|
+
Q.prototype.reason = "";
|
|
89
|
+
Q.prototype.message = "";
|
|
90
|
+
Q.prototype.stack = "";
|
|
91
|
+
Q.prototype.column = void 0;
|
|
92
|
+
Q.prototype.line = void 0;
|
|
93
|
+
Q.prototype.ancestors = void 0;
|
|
94
|
+
Q.prototype.cause = void 0;
|
|
95
|
+
Q.prototype.fatal = void 0;
|
|
96
|
+
Q.prototype.place = void 0;
|
|
97
|
+
Q.prototype.ruleId = void 0;
|
|
98
|
+
Q.prototype.source = void 0;
|
|
99
|
+
const Ke = {}.hasOwnProperty, En = /* @__PURE__ */ new Map(), Cn = /[A-Z]/g, Tn = /* @__PURE__ */ new Set(["table", "tbody", "thead", "tfoot", "tr"]), zn = /* @__PURE__ */ new Set(["td", "th"]), Lt = "https://github.com/syntax-tree/hast-util-to-jsx-runtime";
|
|
100
|
+
function An(e, t) {
|
|
101
|
+
if (!t || t.Fragment === void 0)
|
|
102
|
+
throw new TypeError("Expected `Fragment` in options");
|
|
103
|
+
const n = t.filePath || void 0;
|
|
104
|
+
let r;
|
|
105
|
+
if (t.development) {
|
|
106
|
+
if (typeof t.jsxDEV != "function")
|
|
107
|
+
throw new TypeError(
|
|
108
|
+
"Expected `jsxDEV` in options when `development: true`"
|
|
109
|
+
);
|
|
110
|
+
r = Rn(n, t.jsxDEV);
|
|
111
|
+
} else {
|
|
112
|
+
if (typeof t.jsx != "function")
|
|
113
|
+
throw new TypeError("Expected `jsx` in production options");
|
|
114
|
+
if (typeof t.jsxs != "function")
|
|
115
|
+
throw new TypeError("Expected `jsxs` in production options");
|
|
116
|
+
r = Dn(n, t.jsx, t.jsxs);
|
|
117
|
+
}
|
|
118
|
+
const l = {
|
|
119
|
+
Fragment: t.Fragment,
|
|
120
|
+
ancestors: [],
|
|
121
|
+
components: t.components || {},
|
|
122
|
+
create: r,
|
|
123
|
+
elementAttributeNameCase: t.elementAttributeNameCase || "react",
|
|
124
|
+
evaluater: t.createEvaluater ? t.createEvaluater() : void 0,
|
|
125
|
+
filePath: n,
|
|
126
|
+
ignoreInvalidStyle: t.ignoreInvalidStyle || !1,
|
|
127
|
+
passKeys: t.passKeys !== !1,
|
|
128
|
+
passNode: t.passNode || !1,
|
|
129
|
+
schema: t.space === "svg" ? Je : sn,
|
|
130
|
+
stylePropertyNameCase: t.stylePropertyNameCase || "dom",
|
|
131
|
+
tableCellAlignToStyle: t.tableCellAlignToStyle !== !1
|
|
132
|
+
}, i = _t(l, e, void 0);
|
|
133
|
+
return i && typeof i != "string" ? i : l.create(
|
|
134
|
+
e,
|
|
135
|
+
l.Fragment,
|
|
136
|
+
{ children: i || void 0 },
|
|
137
|
+
void 0
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function _t(e, t, n) {
|
|
141
|
+
if (t.type === "element")
|
|
142
|
+
return Fn(e, t, n);
|
|
143
|
+
if (t.type === "mdxFlowExpression" || t.type === "mdxTextExpression")
|
|
144
|
+
return Nn(e, t);
|
|
145
|
+
if (t.type === "mdxJsxFlowElement" || t.type === "mdxJsxTextElement")
|
|
146
|
+
return Ln(e, t, n);
|
|
147
|
+
if (t.type === "mdxjsEsm")
|
|
148
|
+
return Pn(e, t);
|
|
149
|
+
if (t.type === "root")
|
|
150
|
+
return _n(e, t, n);
|
|
151
|
+
if (t.type === "text")
|
|
152
|
+
return Bn(e, t);
|
|
153
|
+
}
|
|
154
|
+
function Fn(e, t, n) {
|
|
155
|
+
const r = e.schema;
|
|
156
|
+
let l = r;
|
|
157
|
+
t.tagName.toLowerCase() === "svg" && r.space === "html" && (l = Je, e.schema = l), e.ancestors.push(t);
|
|
158
|
+
const i = Dt(e, t.tagName, !1), u = Mn(e, t);
|
|
159
|
+
let a = Ge(e, t);
|
|
160
|
+
return Tn.has(t.tagName) && (a = a.filter(function(f) {
|
|
161
|
+
return typeof f == "string" ? !In(f) : !0;
|
|
162
|
+
})), Bt(e, u, i, t), Ze(u, a), e.ancestors.pop(), e.schema = r, e.create(t, i, u, n);
|
|
163
|
+
}
|
|
164
|
+
function Nn(e, t) {
|
|
165
|
+
if (t.data && t.data.estree && e.evaluater) {
|
|
166
|
+
const r = t.data.estree.body[0];
|
|
167
|
+
return Se(r.type === "ExpressionStatement"), /** @type {Child | undefined} */
|
|
168
|
+
e.evaluater.evaluateExpression(r.expression);
|
|
169
|
+
}
|
|
170
|
+
Ce(e, t.position);
|
|
171
|
+
}
|
|
172
|
+
function Pn(e, t) {
|
|
173
|
+
if (t.data && t.data.estree && e.evaluater)
|
|
174
|
+
return (
|
|
175
|
+
/** @type {Child | undefined} */
|
|
176
|
+
e.evaluater.evaluateProgram(t.data.estree)
|
|
177
|
+
);
|
|
178
|
+
Ce(e, t.position);
|
|
179
|
+
}
|
|
180
|
+
function Ln(e, t, n) {
|
|
181
|
+
const r = e.schema;
|
|
182
|
+
let l = r;
|
|
183
|
+
t.name === "svg" && r.space === "html" && (l = Je, e.schema = l), e.ancestors.push(t);
|
|
184
|
+
const i = t.name === null ? e.Fragment : Dt(e, t.name, !0), u = On(e, t), a = Ge(e, t);
|
|
185
|
+
return Bt(e, u, i, t), Ze(u, a), e.ancestors.pop(), e.schema = r, e.create(t, i, u, n);
|
|
186
|
+
}
|
|
187
|
+
function _n(e, t, n) {
|
|
188
|
+
const r = {};
|
|
189
|
+
return Ze(r, Ge(e, t)), e.create(t, e.Fragment, r, n);
|
|
190
|
+
}
|
|
191
|
+
function Bn(e, t) {
|
|
192
|
+
return t.value;
|
|
193
|
+
}
|
|
194
|
+
function Bt(e, t, n, r) {
|
|
195
|
+
typeof n != "string" && n !== e.Fragment && e.passNode && (t.node = r);
|
|
196
|
+
}
|
|
197
|
+
function Ze(e, t) {
|
|
198
|
+
if (t.length > 0) {
|
|
199
|
+
const n = t.length > 1 ? t : t[0];
|
|
200
|
+
n && (e.children = n);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function Dn(e, t, n) {
|
|
204
|
+
return r;
|
|
205
|
+
function r(l, i, u, a) {
|
|
206
|
+
const s = Array.isArray(u.children) ? n : t;
|
|
207
|
+
return a ? s(i, u, a) : s(i, u);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function Rn(e, t) {
|
|
211
|
+
return n;
|
|
212
|
+
function n(r, l, i, u) {
|
|
213
|
+
const a = Array.isArray(i.children), f = Nt(r);
|
|
214
|
+
return t(
|
|
215
|
+
l,
|
|
216
|
+
i,
|
|
217
|
+
u,
|
|
218
|
+
a,
|
|
219
|
+
{
|
|
220
|
+
columnNumber: f ? f.column - 1 : void 0,
|
|
221
|
+
fileName: e,
|
|
222
|
+
lineNumber: f ? f.line : void 0
|
|
223
|
+
},
|
|
224
|
+
void 0
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function Mn(e, t) {
|
|
229
|
+
const n = {};
|
|
230
|
+
let r, l;
|
|
231
|
+
for (l in t.properties)
|
|
232
|
+
if (l !== "children" && Ke.call(t.properties, l)) {
|
|
233
|
+
const i = jn(e, l, t.properties[l]);
|
|
234
|
+
if (i) {
|
|
235
|
+
const [u, a] = i;
|
|
236
|
+
e.tableCellAlignToStyle && u === "align" && typeof a == "string" && zn.has(t.tagName) ? r = a : n[u] = a;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (r) {
|
|
240
|
+
const i = (
|
|
241
|
+
/** @type {Style} */
|
|
242
|
+
n.style || (n.style = {})
|
|
243
|
+
);
|
|
244
|
+
i[e.stylePropertyNameCase === "css" ? "text-align" : "textAlign"] = r;
|
|
245
|
+
}
|
|
246
|
+
return n;
|
|
247
|
+
}
|
|
248
|
+
function On(e, t) {
|
|
249
|
+
const n = {};
|
|
250
|
+
for (const r of t.attributes)
|
|
251
|
+
if (r.type === "mdxJsxExpressionAttribute")
|
|
252
|
+
if (r.data && r.data.estree && e.evaluater) {
|
|
253
|
+
const i = r.data.estree.body[0];
|
|
254
|
+
Se(i.type === "ExpressionStatement");
|
|
255
|
+
const u = i.expression;
|
|
256
|
+
Se(u.type === "ObjectExpression");
|
|
257
|
+
const a = u.properties[0];
|
|
258
|
+
Se(a.type === "SpreadElement"), Object.assign(
|
|
259
|
+
n,
|
|
260
|
+
e.evaluater.evaluateExpression(a.argument)
|
|
261
|
+
);
|
|
262
|
+
} else
|
|
263
|
+
Ce(e, t.position);
|
|
264
|
+
else {
|
|
265
|
+
const l = r.name;
|
|
266
|
+
let i;
|
|
267
|
+
if (r.value && typeof r.value == "object")
|
|
268
|
+
if (r.value.data && r.value.data.estree && e.evaluater) {
|
|
269
|
+
const a = r.value.data.estree.body[0];
|
|
270
|
+
Se(a.type === "ExpressionStatement"), i = e.evaluater.evaluateExpression(a.expression);
|
|
271
|
+
} else
|
|
272
|
+
Ce(e, t.position);
|
|
273
|
+
else
|
|
274
|
+
i = r.value === null ? !0 : r.value;
|
|
275
|
+
n[l] = /** @type {Props[keyof Props]} */
|
|
276
|
+
i;
|
|
277
|
+
}
|
|
278
|
+
return n;
|
|
279
|
+
}
|
|
280
|
+
function Ge(e, t) {
|
|
281
|
+
const n = [];
|
|
282
|
+
let r = -1;
|
|
283
|
+
const l = e.passKeys ? /* @__PURE__ */ new Map() : En;
|
|
284
|
+
for (; ++r < t.children.length; ) {
|
|
285
|
+
const i = t.children[r];
|
|
286
|
+
let u;
|
|
287
|
+
if (e.passKeys) {
|
|
288
|
+
const f = i.type === "element" ? i.tagName : i.type === "mdxJsxFlowElement" || i.type === "mdxJsxTextElement" ? i.name : void 0;
|
|
289
|
+
if (f) {
|
|
290
|
+
const s = l.get(f) || 0;
|
|
291
|
+
u = f + "-" + s, l.set(f, s + 1);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const a = _t(e, i, u);
|
|
295
|
+
a !== void 0 && n.push(a);
|
|
296
|
+
}
|
|
297
|
+
return n;
|
|
298
|
+
}
|
|
299
|
+
function jn(e, t, n) {
|
|
300
|
+
const r = on(e.schema, t);
|
|
301
|
+
if (!(n == null || typeof n == "number" && Number.isNaN(n))) {
|
|
302
|
+
if (Array.isArray(n) && (n = r.commaSeparated ? cn(n) : hn(n)), r.property === "style") {
|
|
303
|
+
let l = typeof n == "object" ? n : Hn(e, String(n));
|
|
304
|
+
return e.stylePropertyNameCase === "css" && (l = Vn(l)), ["style", l];
|
|
305
|
+
}
|
|
306
|
+
return [
|
|
307
|
+
e.elementAttributeNameCase === "react" && r.space ? pn[r.property] || r.property : r.attribute,
|
|
308
|
+
n
|
|
309
|
+
];
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function Hn(e, t) {
|
|
313
|
+
try {
|
|
314
|
+
return fn(t, { reactCompat: !0 });
|
|
315
|
+
} catch (n) {
|
|
316
|
+
if (e.ignoreInvalidStyle)
|
|
317
|
+
return {};
|
|
318
|
+
const r = (
|
|
319
|
+
/** @type {Error} */
|
|
320
|
+
n
|
|
321
|
+
), l = new Q("Cannot parse `style` attribute", {
|
|
322
|
+
ancestors: e.ancestors,
|
|
323
|
+
cause: r,
|
|
324
|
+
ruleId: "style",
|
|
325
|
+
source: "hast-util-to-jsx-runtime"
|
|
326
|
+
});
|
|
327
|
+
throw l.file = e.filePath || void 0, l.url = Lt + "#cannot-parse-style-attribute", l;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function Dt(e, t, n) {
|
|
331
|
+
let r;
|
|
332
|
+
if (!n)
|
|
333
|
+
r = { type: "Literal", value: t };
|
|
334
|
+
else if (t.includes(".")) {
|
|
335
|
+
const l = t.split(".");
|
|
336
|
+
let i = -1, u;
|
|
337
|
+
for (; ++i < l.length; ) {
|
|
338
|
+
const a = st(l[i]) ? { type: "Identifier", name: l[i] } : { type: "Literal", value: l[i] };
|
|
339
|
+
u = u ? {
|
|
340
|
+
type: "MemberExpression",
|
|
341
|
+
object: u,
|
|
342
|
+
property: a,
|
|
343
|
+
computed: !!(i && a.type === "Literal"),
|
|
344
|
+
optional: !1
|
|
345
|
+
} : a;
|
|
346
|
+
}
|
|
347
|
+
r = u;
|
|
348
|
+
} else
|
|
349
|
+
r = st(t) && !/^[a-z]/.test(t) ? { type: "Identifier", name: t } : { type: "Literal", value: t };
|
|
350
|
+
if (r.type === "Literal") {
|
|
351
|
+
const l = (
|
|
352
|
+
/** @type {string | number} */
|
|
353
|
+
r.value
|
|
354
|
+
);
|
|
355
|
+
return Ke.call(e.components, l) ? e.components[l] : l;
|
|
356
|
+
}
|
|
357
|
+
if (e.evaluater)
|
|
358
|
+
return e.evaluater.evaluateExpression(r);
|
|
359
|
+
Ce(e);
|
|
360
|
+
}
|
|
361
|
+
function Ce(e, t) {
|
|
362
|
+
const n = new Q(
|
|
363
|
+
"Cannot handle MDX estrees without `createEvaluater`",
|
|
364
|
+
{
|
|
365
|
+
ancestors: e.ancestors,
|
|
366
|
+
place: t,
|
|
367
|
+
ruleId: "mdx-estree",
|
|
368
|
+
source: "hast-util-to-jsx-runtime"
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
throw n.file = e.filePath || void 0, n.url = Lt + "#cannot-handle-mdx-estrees-without-createevaluater", n;
|
|
372
|
+
}
|
|
373
|
+
function Vn(e) {
|
|
374
|
+
const t = {};
|
|
375
|
+
let n;
|
|
376
|
+
for (n in e)
|
|
377
|
+
Ke.call(e, n) && (t[qn(n)] = e[n]);
|
|
378
|
+
return t;
|
|
379
|
+
}
|
|
380
|
+
function qn(e) {
|
|
381
|
+
let t = e.replace(Cn, vn);
|
|
382
|
+
return t.slice(0, 3) === "ms-" && (t = "-" + t), t;
|
|
383
|
+
}
|
|
384
|
+
function vn(e) {
|
|
385
|
+
return "-" + e.toLowerCase();
|
|
386
|
+
}
|
|
387
|
+
const Un = {};
|
|
388
|
+
function Qn(e, t) {
|
|
389
|
+
const n = Un, r = typeof n.includeImageAlt == "boolean" ? n.includeImageAlt : !0, l = typeof n.includeHtml == "boolean" ? n.includeHtml : !0;
|
|
390
|
+
return Rt(e, r, l);
|
|
391
|
+
}
|
|
392
|
+
function Rt(e, t, n) {
|
|
393
|
+
if ($n(e)) {
|
|
394
|
+
if ("value" in e)
|
|
395
|
+
return e.type === "html" && !n ? "" : e.value;
|
|
396
|
+
if (t && "alt" in e && e.alt)
|
|
397
|
+
return e.alt;
|
|
398
|
+
if ("children" in e)
|
|
399
|
+
return ht(e.children, t, n);
|
|
400
|
+
}
|
|
401
|
+
return Array.isArray(e) ? ht(e, t, n) : "";
|
|
402
|
+
}
|
|
403
|
+
function ht(e, t, n) {
|
|
404
|
+
const r = [];
|
|
405
|
+
let l = -1;
|
|
406
|
+
for (; ++l < e.length; )
|
|
407
|
+
r[l] = Rt(e[l], t, n);
|
|
408
|
+
return r.join("");
|
|
409
|
+
}
|
|
410
|
+
function $n(e) {
|
|
411
|
+
return !!(e && typeof e == "object");
|
|
412
|
+
}
|
|
413
|
+
const pt = document.createElement("i");
|
|
414
|
+
function Xe(e) {
|
|
415
|
+
const t = "&" + e + ";";
|
|
416
|
+
pt.innerHTML = t;
|
|
417
|
+
const n = pt.textContent;
|
|
418
|
+
return n.charCodeAt(n.length - 1) === 59 && e !== "semi" || n === t ? !1 : n;
|
|
419
|
+
}
|
|
420
|
+
function re(e, t, n, r) {
|
|
421
|
+
const l = e.length;
|
|
422
|
+
let i = 0, u;
|
|
423
|
+
if (t < 0 ? t = -t > l ? 0 : l + t : t = t > l ? l : t, n = n > 0 ? n : 0, r.length < 1e4)
|
|
424
|
+
u = Array.from(r), u.unshift(t, n), e.splice(...u);
|
|
425
|
+
else
|
|
426
|
+
for (n && e.splice(t, n); i < r.length; )
|
|
427
|
+
u = r.slice(i, i + 1e4), u.unshift(t, 0), e.splice(...u), i += 1e4, t += 1e4;
|
|
428
|
+
}
|
|
429
|
+
function K(e, t) {
|
|
430
|
+
return e.length > 0 ? (re(e, e.length, 0, t), e) : t;
|
|
431
|
+
}
|
|
432
|
+
const ft = {}.hasOwnProperty;
|
|
433
|
+
function Wn(e) {
|
|
434
|
+
const t = {};
|
|
435
|
+
let n = -1;
|
|
436
|
+
for (; ++n < e.length; )
|
|
437
|
+
Yn(t, e[n]);
|
|
438
|
+
return t;
|
|
439
|
+
}
|
|
440
|
+
function Yn(e, t) {
|
|
441
|
+
let n;
|
|
442
|
+
for (n in t) {
|
|
443
|
+
const l = (ft.call(e, n) ? e[n] : void 0) || (e[n] = {}), i = t[n];
|
|
444
|
+
let u;
|
|
445
|
+
if (i)
|
|
446
|
+
for (u in i) {
|
|
447
|
+
ft.call(l, u) || (l[u] = []);
|
|
448
|
+
const a = i[u];
|
|
449
|
+
Jn(
|
|
450
|
+
// @ts-expect-error Looks like a list.
|
|
451
|
+
l[u],
|
|
452
|
+
Array.isArray(a) ? a : a ? [a] : []
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
function Jn(e, t) {
|
|
458
|
+
let n = -1;
|
|
459
|
+
const r = [];
|
|
460
|
+
for (; ++n < t.length; )
|
|
461
|
+
(t[n].add === "after" ? e : r).push(t[n]);
|
|
462
|
+
re(e, 0, 0, r);
|
|
463
|
+
}
|
|
464
|
+
function Mt(e, t) {
|
|
465
|
+
const n = Number.parseInt(e, t);
|
|
466
|
+
return (
|
|
467
|
+
// C0 except for HT, LF, FF, CR, space.
|
|
468
|
+
n < 9 || n === 11 || n > 13 && n < 32 || // Control character (DEL) of C0, and C1 controls.
|
|
469
|
+
n > 126 && n < 160 || // Lone high surrogates and low surrogates.
|
|
470
|
+
n > 55295 && n < 57344 || // Noncharacters.
|
|
471
|
+
n > 64975 && n < 65008 || /* eslint-disable no-bitwise */
|
|
472
|
+
(n & 65535) === 65535 || (n & 65535) === 65534 || /* eslint-enable no-bitwise */
|
|
473
|
+
// Out of range
|
|
474
|
+
n > 1114111 ? "�" : String.fromCodePoint(n)
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
function ge(e) {
|
|
478
|
+
return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
|
|
479
|
+
}
|
|
480
|
+
const ne = ce(/[A-Za-z]/), J = ce(/[\dA-Za-z]/), Kn = ce(/[#-'*+\--9=?A-Z^-~]/);
|
|
481
|
+
function Ue(e) {
|
|
482
|
+
return (
|
|
483
|
+
// Special whitespace codes (which have negative values), C0 and Control
|
|
484
|
+
// character DEL
|
|
485
|
+
e !== null && (e < 32 || e === 127)
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
const Qe = ce(/\d/), Zn = ce(/[\dA-Fa-f]/), Gn = ce(/[!-/:-@[-`{-~]/);
|
|
489
|
+
function E(e) {
|
|
490
|
+
return e !== null && e < -2;
|
|
491
|
+
}
|
|
492
|
+
function W(e) {
|
|
493
|
+
return e !== null && (e < 0 || e === 32);
|
|
494
|
+
}
|
|
495
|
+
function P(e) {
|
|
496
|
+
return e === -2 || e === -1 || e === 32;
|
|
497
|
+
}
|
|
498
|
+
const Xn = ce(new RegExp("\\p{P}|\\p{S}", "u")), er = ce(/\s/);
|
|
499
|
+
function ce(e) {
|
|
500
|
+
return t;
|
|
501
|
+
function t(n) {
|
|
502
|
+
return n !== null && n > -1 && e.test(String.fromCharCode(n));
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
function xe(e) {
|
|
506
|
+
const t = [];
|
|
507
|
+
let n = -1, r = 0, l = 0;
|
|
508
|
+
for (; ++n < e.length; ) {
|
|
509
|
+
const i = e.charCodeAt(n);
|
|
510
|
+
let u = "";
|
|
511
|
+
if (i === 37 && J(e.charCodeAt(n + 1)) && J(e.charCodeAt(n + 2)))
|
|
512
|
+
l = 2;
|
|
513
|
+
else if (i < 128)
|
|
514
|
+
/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i)) || (u = String.fromCharCode(i));
|
|
515
|
+
else if (i > 55295 && i < 57344) {
|
|
516
|
+
const a = e.charCodeAt(n + 1);
|
|
517
|
+
i < 56320 && a > 56319 && a < 57344 ? (u = String.fromCharCode(i, a), l = 1) : u = "�";
|
|
518
|
+
} else
|
|
519
|
+
u = String.fromCharCode(i);
|
|
520
|
+
u && (t.push(e.slice(r, n), encodeURIComponent(u)), r = n + l + 1, u = ""), l && (n += l, l = 0);
|
|
521
|
+
}
|
|
522
|
+
return t.join("") + e.slice(r);
|
|
523
|
+
}
|
|
524
|
+
function D(e, t, n, r) {
|
|
525
|
+
const l = r ? r - 1 : Number.POSITIVE_INFINITY;
|
|
526
|
+
let i = 0;
|
|
527
|
+
return u;
|
|
528
|
+
function u(f) {
|
|
529
|
+
return P(f) ? (e.enter(n), a(f)) : t(f);
|
|
530
|
+
}
|
|
531
|
+
function a(f) {
|
|
532
|
+
return P(f) && i++ < l ? (e.consume(f), a) : (e.exit(n), t(f));
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
const tr = {
|
|
536
|
+
tokenize: nr
|
|
537
|
+
};
|
|
538
|
+
function nr(e) {
|
|
539
|
+
const t = e.attempt(this.parser.constructs.contentInitial, r, l);
|
|
540
|
+
let n;
|
|
541
|
+
return t;
|
|
542
|
+
function r(a) {
|
|
543
|
+
if (a === null) {
|
|
544
|
+
e.consume(a);
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
return e.enter("lineEnding"), e.consume(a), e.exit("lineEnding"), D(e, t, "linePrefix");
|
|
548
|
+
}
|
|
549
|
+
function l(a) {
|
|
550
|
+
return e.enter("paragraph"), i(a);
|
|
551
|
+
}
|
|
552
|
+
function i(a) {
|
|
553
|
+
const f = e.enter("chunkText", {
|
|
554
|
+
contentType: "text",
|
|
555
|
+
previous: n
|
|
556
|
+
});
|
|
557
|
+
return n && (n.next = f), n = f, u(a);
|
|
558
|
+
}
|
|
559
|
+
function u(a) {
|
|
560
|
+
if (a === null) {
|
|
561
|
+
e.exit("chunkText"), e.exit("paragraph"), e.consume(a);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
return E(a) ? (e.consume(a), e.exit("chunkText"), i) : (e.consume(a), u);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
const rr = {
|
|
568
|
+
tokenize: ir
|
|
569
|
+
}, mt = {
|
|
570
|
+
tokenize: lr
|
|
571
|
+
};
|
|
572
|
+
function ir(e) {
|
|
573
|
+
const t = this, n = [];
|
|
574
|
+
let r = 0, l, i, u;
|
|
575
|
+
return a;
|
|
576
|
+
function a(w) {
|
|
577
|
+
if (r < n.length) {
|
|
578
|
+
const M = n[r];
|
|
579
|
+
return t.containerState = M[1], e.attempt(M[0].continuation, f, s)(w);
|
|
580
|
+
}
|
|
581
|
+
return s(w);
|
|
582
|
+
}
|
|
583
|
+
function f(w) {
|
|
584
|
+
if (r++, t.containerState._closeFlow) {
|
|
585
|
+
t.containerState._closeFlow = void 0, l && A();
|
|
586
|
+
const M = t.events.length;
|
|
587
|
+
let j = M, x;
|
|
588
|
+
for (; j--; )
|
|
589
|
+
if (t.events[j][0] === "exit" && t.events[j][1].type === "chunkFlow") {
|
|
590
|
+
x = t.events[j][1].end;
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
k(r);
|
|
594
|
+
let L = M;
|
|
595
|
+
for (; L < t.events.length; )
|
|
596
|
+
t.events[L][1].end = {
|
|
597
|
+
...x
|
|
598
|
+
}, L++;
|
|
599
|
+
return re(t.events, j + 1, 0, t.events.slice(M)), t.events.length = L, s(w);
|
|
600
|
+
}
|
|
601
|
+
return a(w);
|
|
602
|
+
}
|
|
603
|
+
function s(w) {
|
|
604
|
+
if (r === n.length) {
|
|
605
|
+
if (!l)
|
|
606
|
+
return d(w);
|
|
607
|
+
if (l.currentConstruct && l.currentConstruct.concrete)
|
|
608
|
+
return b(w);
|
|
609
|
+
t.interrupt = !!(l.currentConstruct && !l._gfmTableDynamicInterruptHack);
|
|
610
|
+
}
|
|
611
|
+
return t.containerState = {}, e.check(mt, c, m)(w);
|
|
612
|
+
}
|
|
613
|
+
function c(w) {
|
|
614
|
+
return l && A(), k(r), d(w);
|
|
615
|
+
}
|
|
616
|
+
function m(w) {
|
|
617
|
+
return t.parser.lazy[t.now().line] = r !== n.length, u = t.now().offset, b(w);
|
|
618
|
+
}
|
|
619
|
+
function d(w) {
|
|
620
|
+
return t.containerState = {}, e.attempt(mt, o, b)(w);
|
|
621
|
+
}
|
|
622
|
+
function o(w) {
|
|
623
|
+
return r++, n.push([t.currentConstruct, t.containerState]), d(w);
|
|
624
|
+
}
|
|
625
|
+
function b(w) {
|
|
626
|
+
if (w === null) {
|
|
627
|
+
l && A(), k(0), e.consume(w);
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
return l = l || t.parser.flow(t.now()), e.enter("chunkFlow", {
|
|
631
|
+
_tokenizer: l,
|
|
632
|
+
contentType: "flow",
|
|
633
|
+
previous: i
|
|
634
|
+
}), C(w);
|
|
635
|
+
}
|
|
636
|
+
function C(w) {
|
|
637
|
+
if (w === null) {
|
|
638
|
+
N(e.exit("chunkFlow"), !0), k(0), e.consume(w);
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
return E(w) ? (e.consume(w), N(e.exit("chunkFlow")), r = 0, t.interrupt = void 0, a) : (e.consume(w), C);
|
|
642
|
+
}
|
|
643
|
+
function N(w, M) {
|
|
644
|
+
const j = t.sliceStream(w);
|
|
645
|
+
if (M && j.push(null), w.previous = i, i && (i.next = w), i = w, l.defineSkip(w.start), l.write(j), t.parser.lazy[w.start.line]) {
|
|
646
|
+
let x = l.events.length;
|
|
647
|
+
for (; x--; )
|
|
648
|
+
if (
|
|
649
|
+
// The token starts before the line ending…
|
|
650
|
+
l.events[x][1].start.offset < u && // …and either is not ended yet…
|
|
651
|
+
(!l.events[x][1].end || // …or ends after it.
|
|
652
|
+
l.events[x][1].end.offset > u)
|
|
653
|
+
)
|
|
654
|
+
return;
|
|
655
|
+
const L = t.events.length;
|
|
656
|
+
let H = L, _, R;
|
|
657
|
+
for (; H--; )
|
|
658
|
+
if (t.events[H][0] === "exit" && t.events[H][1].type === "chunkFlow") {
|
|
659
|
+
if (_) {
|
|
660
|
+
R = t.events[H][1].end;
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
_ = !0;
|
|
664
|
+
}
|
|
665
|
+
for (k(r), x = L; x < t.events.length; )
|
|
666
|
+
t.events[x][1].end = {
|
|
667
|
+
...R
|
|
668
|
+
}, x++;
|
|
669
|
+
re(t.events, H + 1, 0, t.events.slice(L)), t.events.length = x;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
function k(w) {
|
|
673
|
+
let M = n.length;
|
|
674
|
+
for (; M-- > w; ) {
|
|
675
|
+
const j = n[M];
|
|
676
|
+
t.containerState = j[1], j[0].exit.call(t, e);
|
|
677
|
+
}
|
|
678
|
+
n.length = w;
|
|
679
|
+
}
|
|
680
|
+
function A() {
|
|
681
|
+
l.write([null]), i = void 0, l = void 0, t.containerState._closeFlow = void 0;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
function lr(e, t, n) {
|
|
685
|
+
return D(e, e.attempt(this.parser.constructs.document, t, n), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
|
|
686
|
+
}
|
|
687
|
+
function dt(e) {
|
|
688
|
+
if (e === null || W(e) || er(e))
|
|
689
|
+
return 1;
|
|
690
|
+
if (Xn(e))
|
|
691
|
+
return 2;
|
|
692
|
+
}
|
|
693
|
+
function et(e, t, n) {
|
|
694
|
+
const r = [];
|
|
695
|
+
let l = -1;
|
|
696
|
+
for (; ++l < e.length; ) {
|
|
697
|
+
const i = e[l].resolveAll;
|
|
698
|
+
i && !r.includes(i) && (t = i(t, n), r.push(i));
|
|
699
|
+
}
|
|
700
|
+
return t;
|
|
701
|
+
}
|
|
702
|
+
const $e = {
|
|
703
|
+
name: "attention",
|
|
704
|
+
resolveAll: ur,
|
|
705
|
+
tokenize: ar
|
|
706
|
+
};
|
|
707
|
+
function ur(e, t) {
|
|
708
|
+
let n = -1, r, l, i, u, a, f, s, c;
|
|
709
|
+
for (; ++n < e.length; )
|
|
710
|
+
if (e[n][0] === "enter" && e[n][1].type === "attentionSequence" && e[n][1]._close) {
|
|
711
|
+
for (r = n; r--; )
|
|
712
|
+
if (e[r][0] === "exit" && e[r][1].type === "attentionSequence" && e[r][1]._open && // If the markers are the same:
|
|
713
|
+
t.sliceSerialize(e[r][1]).charCodeAt(0) === t.sliceSerialize(e[n][1]).charCodeAt(0)) {
|
|
714
|
+
if ((e[r][1]._close || e[n][1]._open) && (e[n][1].end.offset - e[n][1].start.offset) % 3 && !((e[r][1].end.offset - e[r][1].start.offset + e[n][1].end.offset - e[n][1].start.offset) % 3))
|
|
715
|
+
continue;
|
|
716
|
+
f = e[r][1].end.offset - e[r][1].start.offset > 1 && e[n][1].end.offset - e[n][1].start.offset > 1 ? 2 : 1;
|
|
717
|
+
const m = {
|
|
718
|
+
...e[r][1].end
|
|
719
|
+
}, d = {
|
|
720
|
+
...e[n][1].start
|
|
721
|
+
};
|
|
722
|
+
gt(m, -f), gt(d, f), u = {
|
|
723
|
+
type: f > 1 ? "strongSequence" : "emphasisSequence",
|
|
724
|
+
start: m,
|
|
725
|
+
end: {
|
|
726
|
+
...e[r][1].end
|
|
727
|
+
}
|
|
728
|
+
}, a = {
|
|
729
|
+
type: f > 1 ? "strongSequence" : "emphasisSequence",
|
|
730
|
+
start: {
|
|
731
|
+
...e[n][1].start
|
|
732
|
+
},
|
|
733
|
+
end: d
|
|
734
|
+
}, i = {
|
|
735
|
+
type: f > 1 ? "strongText" : "emphasisText",
|
|
736
|
+
start: {
|
|
737
|
+
...e[r][1].end
|
|
738
|
+
},
|
|
739
|
+
end: {
|
|
740
|
+
...e[n][1].start
|
|
741
|
+
}
|
|
742
|
+
}, l = {
|
|
743
|
+
type: f > 1 ? "strong" : "emphasis",
|
|
744
|
+
start: {
|
|
745
|
+
...u.start
|
|
746
|
+
},
|
|
747
|
+
end: {
|
|
748
|
+
...a.end
|
|
749
|
+
}
|
|
750
|
+
}, e[r][1].end = {
|
|
751
|
+
...u.start
|
|
752
|
+
}, e[n][1].start = {
|
|
753
|
+
...a.end
|
|
754
|
+
}, s = [], e[r][1].end.offset - e[r][1].start.offset && (s = K(s, [["enter", e[r][1], t], ["exit", e[r][1], t]])), s = K(s, [["enter", l, t], ["enter", u, t], ["exit", u, t], ["enter", i, t]]), s = K(s, et(t.parser.constructs.insideSpan.null, e.slice(r + 1, n), t)), s = K(s, [["exit", i, t], ["enter", a, t], ["exit", a, t], ["exit", l, t]]), e[n][1].end.offset - e[n][1].start.offset ? (c = 2, s = K(s, [["enter", e[n][1], t], ["exit", e[n][1], t]])) : c = 0, re(e, r - 1, n - r + 3, s), n = r + s.length - c - 2;
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
for (n = -1; ++n < e.length; )
|
|
759
|
+
e[n][1].type === "attentionSequence" && (e[n][1].type = "data");
|
|
760
|
+
return e;
|
|
761
|
+
}
|
|
762
|
+
function ar(e, t) {
|
|
763
|
+
const n = this.parser.constructs.attentionMarkers.null, r = this.previous, l = dt(r);
|
|
764
|
+
let i;
|
|
765
|
+
return u;
|
|
766
|
+
function u(f) {
|
|
767
|
+
return i = f, e.enter("attentionSequence"), a(f);
|
|
768
|
+
}
|
|
769
|
+
function a(f) {
|
|
770
|
+
if (f === i)
|
|
771
|
+
return e.consume(f), a;
|
|
772
|
+
const s = e.exit("attentionSequence"), c = dt(f), m = !c || c === 2 && l || n.includes(f), d = !l || l === 2 && c || n.includes(r);
|
|
773
|
+
return s._open = !!(i === 42 ? m : m && (l || !d)), s._close = !!(i === 42 ? d : d && (c || !m)), t(f);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
function gt(e, t) {
|
|
777
|
+
e.column += t, e.offset += t, e._bufferIndex += t;
|
|
778
|
+
}
|
|
779
|
+
const sr = {
|
|
780
|
+
name: "autolink",
|
|
781
|
+
tokenize: or
|
|
782
|
+
};
|
|
783
|
+
function or(e, t, n) {
|
|
784
|
+
let r = 0;
|
|
785
|
+
return l;
|
|
786
|
+
function l(o) {
|
|
787
|
+
return e.enter("autolink"), e.enter("autolinkMarker"), e.consume(o), e.exit("autolinkMarker"), e.enter("autolinkProtocol"), i;
|
|
788
|
+
}
|
|
789
|
+
function i(o) {
|
|
790
|
+
return ne(o) ? (e.consume(o), u) : o === 64 ? n(o) : s(o);
|
|
791
|
+
}
|
|
792
|
+
function u(o) {
|
|
793
|
+
return o === 43 || o === 45 || o === 46 || J(o) ? (r = 1, a(o)) : s(o);
|
|
794
|
+
}
|
|
795
|
+
function a(o) {
|
|
796
|
+
return o === 58 ? (e.consume(o), r = 0, f) : (o === 43 || o === 45 || o === 46 || J(o)) && r++ < 32 ? (e.consume(o), a) : (r = 0, s(o));
|
|
797
|
+
}
|
|
798
|
+
function f(o) {
|
|
799
|
+
return o === 62 ? (e.exit("autolinkProtocol"), e.enter("autolinkMarker"), e.consume(o), e.exit("autolinkMarker"), e.exit("autolink"), t) : o === null || o === 32 || o === 60 || Ue(o) ? n(o) : (e.consume(o), f);
|
|
800
|
+
}
|
|
801
|
+
function s(o) {
|
|
802
|
+
return o === 64 ? (e.consume(o), c) : Kn(o) ? (e.consume(o), s) : n(o);
|
|
803
|
+
}
|
|
804
|
+
function c(o) {
|
|
805
|
+
return J(o) ? m(o) : n(o);
|
|
806
|
+
}
|
|
807
|
+
function m(o) {
|
|
808
|
+
return o === 46 ? (e.consume(o), r = 0, c) : o === 62 ? (e.exit("autolinkProtocol").type = "autolinkEmail", e.enter("autolinkMarker"), e.consume(o), e.exit("autolinkMarker"), e.exit("autolink"), t) : d(o);
|
|
809
|
+
}
|
|
810
|
+
function d(o) {
|
|
811
|
+
if ((o === 45 || J(o)) && r++ < 63) {
|
|
812
|
+
const b = o === 45 ? d : m;
|
|
813
|
+
return e.consume(o), b;
|
|
814
|
+
}
|
|
815
|
+
return n(o);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
const Le = {
|
|
819
|
+
partial: !0,
|
|
820
|
+
tokenize: cr
|
|
821
|
+
};
|
|
822
|
+
function cr(e, t, n) {
|
|
823
|
+
return r;
|
|
824
|
+
function r(i) {
|
|
825
|
+
return P(i) ? D(e, l, "linePrefix")(i) : l(i);
|
|
826
|
+
}
|
|
827
|
+
function l(i) {
|
|
828
|
+
return i === null || E(i) ? t(i) : n(i);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
const Ot = {
|
|
832
|
+
continuation: {
|
|
833
|
+
tokenize: pr
|
|
834
|
+
},
|
|
835
|
+
exit: fr,
|
|
836
|
+
name: "blockQuote",
|
|
837
|
+
tokenize: hr
|
|
838
|
+
};
|
|
839
|
+
function hr(e, t, n) {
|
|
840
|
+
const r = this;
|
|
841
|
+
return l;
|
|
842
|
+
function l(u) {
|
|
843
|
+
if (u === 62) {
|
|
844
|
+
const a = r.containerState;
|
|
845
|
+
return a.open || (e.enter("blockQuote", {
|
|
846
|
+
_container: !0
|
|
847
|
+
}), a.open = !0), e.enter("blockQuotePrefix"), e.enter("blockQuoteMarker"), e.consume(u), e.exit("blockQuoteMarker"), i;
|
|
848
|
+
}
|
|
849
|
+
return n(u);
|
|
850
|
+
}
|
|
851
|
+
function i(u) {
|
|
852
|
+
return P(u) ? (e.enter("blockQuotePrefixWhitespace"), e.consume(u), e.exit("blockQuotePrefixWhitespace"), e.exit("blockQuotePrefix"), t) : (e.exit("blockQuotePrefix"), t(u));
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
function pr(e, t, n) {
|
|
856
|
+
const r = this;
|
|
857
|
+
return l;
|
|
858
|
+
function l(u) {
|
|
859
|
+
return P(u) ? D(e, i, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(u) : i(u);
|
|
860
|
+
}
|
|
861
|
+
function i(u) {
|
|
862
|
+
return e.attempt(Ot, t, n)(u);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
function fr(e) {
|
|
866
|
+
e.exit("blockQuote");
|
|
867
|
+
}
|
|
868
|
+
const jt = {
|
|
869
|
+
name: "characterEscape",
|
|
870
|
+
tokenize: mr
|
|
871
|
+
};
|
|
872
|
+
function mr(e, t, n) {
|
|
873
|
+
return r;
|
|
874
|
+
function r(i) {
|
|
875
|
+
return e.enter("characterEscape"), e.enter("escapeMarker"), e.consume(i), e.exit("escapeMarker"), l;
|
|
876
|
+
}
|
|
877
|
+
function l(i) {
|
|
878
|
+
return Gn(i) ? (e.enter("characterEscapeValue"), e.consume(i), e.exit("characterEscapeValue"), e.exit("characterEscape"), t) : n(i);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
const Ht = {
|
|
882
|
+
name: "characterReference",
|
|
883
|
+
tokenize: dr
|
|
884
|
+
};
|
|
885
|
+
function dr(e, t, n) {
|
|
886
|
+
const r = this;
|
|
887
|
+
let l = 0, i, u;
|
|
888
|
+
return a;
|
|
889
|
+
function a(m) {
|
|
890
|
+
return e.enter("characterReference"), e.enter("characterReferenceMarker"), e.consume(m), e.exit("characterReferenceMarker"), f;
|
|
891
|
+
}
|
|
892
|
+
function f(m) {
|
|
893
|
+
return m === 35 ? (e.enter("characterReferenceMarkerNumeric"), e.consume(m), e.exit("characterReferenceMarkerNumeric"), s) : (e.enter("characterReferenceValue"), i = 31, u = J, c(m));
|
|
894
|
+
}
|
|
895
|
+
function s(m) {
|
|
896
|
+
return m === 88 || m === 120 ? (e.enter("characterReferenceMarkerHexadecimal"), e.consume(m), e.exit("characterReferenceMarkerHexadecimal"), e.enter("characterReferenceValue"), i = 6, u = Zn, c) : (e.enter("characterReferenceValue"), i = 7, u = Qe, c(m));
|
|
897
|
+
}
|
|
898
|
+
function c(m) {
|
|
899
|
+
if (m === 59 && l) {
|
|
900
|
+
const d = e.exit("characterReferenceValue");
|
|
901
|
+
return u === J && !Xe(r.sliceSerialize(d)) ? n(m) : (e.enter("characterReferenceMarker"), e.consume(m), e.exit("characterReferenceMarker"), e.exit("characterReference"), t);
|
|
902
|
+
}
|
|
903
|
+
return u(m) && l++ < i ? (e.consume(m), c) : n(m);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
const xt = {
|
|
907
|
+
partial: !0,
|
|
908
|
+
tokenize: xr
|
|
909
|
+
}, yt = {
|
|
910
|
+
concrete: !0,
|
|
911
|
+
name: "codeFenced",
|
|
912
|
+
tokenize: gr
|
|
913
|
+
};
|
|
914
|
+
function gr(e, t, n) {
|
|
915
|
+
const r = this, l = {
|
|
916
|
+
partial: !0,
|
|
917
|
+
tokenize: j
|
|
918
|
+
};
|
|
919
|
+
let i = 0, u = 0, a;
|
|
920
|
+
return f;
|
|
921
|
+
function f(x) {
|
|
922
|
+
return s(x);
|
|
923
|
+
}
|
|
924
|
+
function s(x) {
|
|
925
|
+
const L = r.events[r.events.length - 1];
|
|
926
|
+
return i = L && L[1].type === "linePrefix" ? L[2].sliceSerialize(L[1], !0).length : 0, a = x, e.enter("codeFenced"), e.enter("codeFencedFence"), e.enter("codeFencedFenceSequence"), c(x);
|
|
927
|
+
}
|
|
928
|
+
function c(x) {
|
|
929
|
+
return x === a ? (u++, e.consume(x), c) : u < 3 ? n(x) : (e.exit("codeFencedFenceSequence"), P(x) ? D(e, m, "whitespace")(x) : m(x));
|
|
930
|
+
}
|
|
931
|
+
function m(x) {
|
|
932
|
+
return x === null || E(x) ? (e.exit("codeFencedFence"), r.interrupt ? t(x) : e.check(xt, C, M)(x)) : (e.enter("codeFencedFenceInfo"), e.enter("chunkString", {
|
|
933
|
+
contentType: "string"
|
|
934
|
+
}), d(x));
|
|
935
|
+
}
|
|
936
|
+
function d(x) {
|
|
937
|
+
return x === null || E(x) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), m(x)) : P(x) ? (e.exit("chunkString"), e.exit("codeFencedFenceInfo"), D(e, o, "whitespace")(x)) : x === 96 && x === a ? n(x) : (e.consume(x), d);
|
|
938
|
+
}
|
|
939
|
+
function o(x) {
|
|
940
|
+
return x === null || E(x) ? m(x) : (e.enter("codeFencedFenceMeta"), e.enter("chunkString", {
|
|
941
|
+
contentType: "string"
|
|
942
|
+
}), b(x));
|
|
943
|
+
}
|
|
944
|
+
function b(x) {
|
|
945
|
+
return x === null || E(x) ? (e.exit("chunkString"), e.exit("codeFencedFenceMeta"), m(x)) : x === 96 && x === a ? n(x) : (e.consume(x), b);
|
|
946
|
+
}
|
|
947
|
+
function C(x) {
|
|
948
|
+
return e.attempt(l, M, N)(x);
|
|
949
|
+
}
|
|
950
|
+
function N(x) {
|
|
951
|
+
return e.enter("lineEnding"), e.consume(x), e.exit("lineEnding"), k;
|
|
952
|
+
}
|
|
953
|
+
function k(x) {
|
|
954
|
+
return i > 0 && P(x) ? D(e, A, "linePrefix", i + 1)(x) : A(x);
|
|
955
|
+
}
|
|
956
|
+
function A(x) {
|
|
957
|
+
return x === null || E(x) ? e.check(xt, C, M)(x) : (e.enter("codeFlowValue"), w(x));
|
|
958
|
+
}
|
|
959
|
+
function w(x) {
|
|
960
|
+
return x === null || E(x) ? (e.exit("codeFlowValue"), A(x)) : (e.consume(x), w);
|
|
961
|
+
}
|
|
962
|
+
function M(x) {
|
|
963
|
+
return e.exit("codeFenced"), t(x);
|
|
964
|
+
}
|
|
965
|
+
function j(x, L, H) {
|
|
966
|
+
let _ = 0;
|
|
967
|
+
return R;
|
|
968
|
+
function R(F) {
|
|
969
|
+
return x.enter("lineEnding"), x.consume(F), x.exit("lineEnding"), I;
|
|
970
|
+
}
|
|
971
|
+
function I(F) {
|
|
972
|
+
return x.enter("codeFencedFence"), P(F) ? D(x, S, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(F) : S(F);
|
|
973
|
+
}
|
|
974
|
+
function S(F) {
|
|
975
|
+
return F === a ? (x.enter("codeFencedFenceSequence"), O(F)) : H(F);
|
|
976
|
+
}
|
|
977
|
+
function O(F) {
|
|
978
|
+
return F === a ? (_++, x.consume(F), O) : _ >= u ? (x.exit("codeFencedFenceSequence"), P(F) ? D(x, V, "whitespace")(F) : V(F)) : H(F);
|
|
979
|
+
}
|
|
980
|
+
function V(F) {
|
|
981
|
+
return F === null || E(F) ? (x.exit("codeFencedFence"), L(F)) : H(F);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
function xr(e, t, n) {
|
|
986
|
+
const r = this;
|
|
987
|
+
return l;
|
|
988
|
+
function l(u) {
|
|
989
|
+
return u === null ? n(u) : (e.enter("lineEnding"), e.consume(u), e.exit("lineEnding"), i);
|
|
990
|
+
}
|
|
991
|
+
function i(u) {
|
|
992
|
+
return r.parser.lazy[r.now().line] ? n(u) : t(u);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
const De = {
|
|
996
|
+
name: "codeIndented",
|
|
997
|
+
tokenize: kr
|
|
998
|
+
}, yr = {
|
|
999
|
+
partial: !0,
|
|
1000
|
+
tokenize: br
|
|
1001
|
+
};
|
|
1002
|
+
function kr(e, t, n) {
|
|
1003
|
+
const r = this;
|
|
1004
|
+
return l;
|
|
1005
|
+
function l(s) {
|
|
1006
|
+
return e.enter("codeIndented"), D(e, i, "linePrefix", 5)(s);
|
|
1007
|
+
}
|
|
1008
|
+
function i(s) {
|
|
1009
|
+
const c = r.events[r.events.length - 1];
|
|
1010
|
+
return c && c[1].type === "linePrefix" && c[2].sliceSerialize(c[1], !0).length >= 4 ? u(s) : n(s);
|
|
1011
|
+
}
|
|
1012
|
+
function u(s) {
|
|
1013
|
+
return s === null ? f(s) : E(s) ? e.attempt(yr, u, f)(s) : (e.enter("codeFlowValue"), a(s));
|
|
1014
|
+
}
|
|
1015
|
+
function a(s) {
|
|
1016
|
+
return s === null || E(s) ? (e.exit("codeFlowValue"), u(s)) : (e.consume(s), a);
|
|
1017
|
+
}
|
|
1018
|
+
function f(s) {
|
|
1019
|
+
return e.exit("codeIndented"), t(s);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
function br(e, t, n) {
|
|
1023
|
+
const r = this;
|
|
1024
|
+
return l;
|
|
1025
|
+
function l(u) {
|
|
1026
|
+
return r.parser.lazy[r.now().line] ? n(u) : E(u) ? (e.enter("lineEnding"), e.consume(u), e.exit("lineEnding"), l) : D(e, i, "linePrefix", 5)(u);
|
|
1027
|
+
}
|
|
1028
|
+
function i(u) {
|
|
1029
|
+
const a = r.events[r.events.length - 1];
|
|
1030
|
+
return a && a[1].type === "linePrefix" && a[2].sliceSerialize(a[1], !0).length >= 4 ? t(u) : E(u) ? l(u) : n(u);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
const wr = {
|
|
1034
|
+
name: "codeText",
|
|
1035
|
+
previous: Ir,
|
|
1036
|
+
resolve: Sr,
|
|
1037
|
+
tokenize: Er
|
|
1038
|
+
};
|
|
1039
|
+
function Sr(e) {
|
|
1040
|
+
let t = e.length - 4, n = 3, r, l;
|
|
1041
|
+
if ((e[n][1].type === "lineEnding" || e[n][1].type === "space") && (e[t][1].type === "lineEnding" || e[t][1].type === "space")) {
|
|
1042
|
+
for (r = n; ++r < t; )
|
|
1043
|
+
if (e[r][1].type === "codeTextData") {
|
|
1044
|
+
e[n][1].type = "codeTextPadding", e[t][1].type = "codeTextPadding", n += 2, t -= 2;
|
|
1045
|
+
break;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
for (r = n - 1, t++; ++r <= t; )
|
|
1049
|
+
l === void 0 ? r !== t && e[r][1].type !== "lineEnding" && (l = r) : (r === t || e[r][1].type === "lineEnding") && (e[l][1].type = "codeTextData", r !== l + 2 && (e[l][1].end = e[r - 1][1].end, e.splice(l + 2, r - l - 2), t -= r - l - 2, r = l + 2), l = void 0);
|
|
1050
|
+
return e;
|
|
1051
|
+
}
|
|
1052
|
+
function Ir(e) {
|
|
1053
|
+
return e !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
|
|
1054
|
+
}
|
|
1055
|
+
function Er(e, t, n) {
|
|
1056
|
+
let r = 0, l, i;
|
|
1057
|
+
return u;
|
|
1058
|
+
function u(m) {
|
|
1059
|
+
return e.enter("codeText"), e.enter("codeTextSequence"), a(m);
|
|
1060
|
+
}
|
|
1061
|
+
function a(m) {
|
|
1062
|
+
return m === 96 ? (e.consume(m), r++, a) : (e.exit("codeTextSequence"), f(m));
|
|
1063
|
+
}
|
|
1064
|
+
function f(m) {
|
|
1065
|
+
return m === null ? n(m) : m === 32 ? (e.enter("space"), e.consume(m), e.exit("space"), f) : m === 96 ? (i = e.enter("codeTextSequence"), l = 0, c(m)) : E(m) ? (e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"), f) : (e.enter("codeTextData"), s(m));
|
|
1066
|
+
}
|
|
1067
|
+
function s(m) {
|
|
1068
|
+
return m === null || m === 32 || m === 96 || E(m) ? (e.exit("codeTextData"), f(m)) : (e.consume(m), s);
|
|
1069
|
+
}
|
|
1070
|
+
function c(m) {
|
|
1071
|
+
return m === 96 ? (e.consume(m), l++, c) : l === r ? (e.exit("codeTextSequence"), e.exit("codeText"), t(m)) : (i.type = "codeTextData", s(m));
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
class Cr {
|
|
1075
|
+
/**
|
|
1076
|
+
* @param {ReadonlyArray<T> | null | undefined} [initial]
|
|
1077
|
+
* Initial items (optional).
|
|
1078
|
+
* @returns
|
|
1079
|
+
* Splice buffer.
|
|
1080
|
+
*/
|
|
1081
|
+
constructor(t) {
|
|
1082
|
+
this.left = t ? [...t] : [], this.right = [];
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Array access;
|
|
1086
|
+
* does not move the cursor.
|
|
1087
|
+
*
|
|
1088
|
+
* @param {number} index
|
|
1089
|
+
* Index.
|
|
1090
|
+
* @return {T}
|
|
1091
|
+
* Item.
|
|
1092
|
+
*/
|
|
1093
|
+
get(t) {
|
|
1094
|
+
if (t < 0 || t >= this.left.length + this.right.length)
|
|
1095
|
+
throw new RangeError("Cannot access index `" + t + "` in a splice buffer of size `" + (this.left.length + this.right.length) + "`");
|
|
1096
|
+
return t < this.left.length ? this.left[t] : this.right[this.right.length - t + this.left.length - 1];
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* The length of the splice buffer, one greater than the largest index in the
|
|
1100
|
+
* array.
|
|
1101
|
+
*/
|
|
1102
|
+
get length() {
|
|
1103
|
+
return this.left.length + this.right.length;
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Remove and return `list[0]`;
|
|
1107
|
+
* moves the cursor to `0`.
|
|
1108
|
+
*
|
|
1109
|
+
* @returns {T | undefined}
|
|
1110
|
+
* Item, optional.
|
|
1111
|
+
*/
|
|
1112
|
+
shift() {
|
|
1113
|
+
return this.setCursor(0), this.right.pop();
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Slice the buffer to get an array;
|
|
1117
|
+
* does not move the cursor.
|
|
1118
|
+
*
|
|
1119
|
+
* @param {number} start
|
|
1120
|
+
* Start.
|
|
1121
|
+
* @param {number | null | undefined} [end]
|
|
1122
|
+
* End (optional).
|
|
1123
|
+
* @returns {Array<T>}
|
|
1124
|
+
* Array of items.
|
|
1125
|
+
*/
|
|
1126
|
+
slice(t, n) {
|
|
1127
|
+
const r = n ?? Number.POSITIVE_INFINITY;
|
|
1128
|
+
return r < this.left.length ? this.left.slice(t, r) : t > this.left.length ? this.right.slice(this.right.length - r + this.left.length, this.right.length - t + this.left.length).reverse() : this.left.slice(t).concat(this.right.slice(this.right.length - r + this.left.length).reverse());
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Mimics the behavior of Array.prototype.splice() except for the change of
|
|
1132
|
+
* interface necessary to avoid segfaults when patching in very large arrays.
|
|
1133
|
+
*
|
|
1134
|
+
* This operation moves cursor is moved to `start` and results in the cursor
|
|
1135
|
+
* placed after any inserted items.
|
|
1136
|
+
*
|
|
1137
|
+
* @param {number} start
|
|
1138
|
+
* Start;
|
|
1139
|
+
* zero-based index at which to start changing the array;
|
|
1140
|
+
* negative numbers count backwards from the end of the array and values
|
|
1141
|
+
* that are out-of bounds are clamped to the appropriate end of the array.
|
|
1142
|
+
* @param {number | null | undefined} [deleteCount=0]
|
|
1143
|
+
* Delete count (default: `0`);
|
|
1144
|
+
* maximum number of elements to delete, starting from start.
|
|
1145
|
+
* @param {Array<T> | null | undefined} [items=[]]
|
|
1146
|
+
* Items to include in place of the deleted items (default: `[]`).
|
|
1147
|
+
* @return {Array<T>}
|
|
1148
|
+
* Any removed items.
|
|
1149
|
+
*/
|
|
1150
|
+
splice(t, n, r) {
|
|
1151
|
+
const l = n || 0;
|
|
1152
|
+
this.setCursor(Math.trunc(t));
|
|
1153
|
+
const i = this.right.splice(this.right.length - l, Number.POSITIVE_INFINITY);
|
|
1154
|
+
return r && we(this.left, r), i.reverse();
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Remove and return the highest-numbered item in the array, so
|
|
1158
|
+
* `list[list.length - 1]`;
|
|
1159
|
+
* Moves the cursor to `length`.
|
|
1160
|
+
*
|
|
1161
|
+
* @returns {T | undefined}
|
|
1162
|
+
* Item, optional.
|
|
1163
|
+
*/
|
|
1164
|
+
pop() {
|
|
1165
|
+
return this.setCursor(Number.POSITIVE_INFINITY), this.left.pop();
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Inserts a single item to the high-numbered side of the array;
|
|
1169
|
+
* moves the cursor to `length`.
|
|
1170
|
+
*
|
|
1171
|
+
* @param {T} item
|
|
1172
|
+
* Item.
|
|
1173
|
+
* @returns {undefined}
|
|
1174
|
+
* Nothing.
|
|
1175
|
+
*/
|
|
1176
|
+
push(t) {
|
|
1177
|
+
this.setCursor(Number.POSITIVE_INFINITY), this.left.push(t);
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Inserts many items to the high-numbered side of the array.
|
|
1181
|
+
* Moves the cursor to `length`.
|
|
1182
|
+
*
|
|
1183
|
+
* @param {Array<T>} items
|
|
1184
|
+
* Items.
|
|
1185
|
+
* @returns {undefined}
|
|
1186
|
+
* Nothing.
|
|
1187
|
+
*/
|
|
1188
|
+
pushMany(t) {
|
|
1189
|
+
this.setCursor(Number.POSITIVE_INFINITY), we(this.left, t);
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Inserts a single item to the low-numbered side of the array;
|
|
1193
|
+
* Moves the cursor to `0`.
|
|
1194
|
+
*
|
|
1195
|
+
* @param {T} item
|
|
1196
|
+
* Item.
|
|
1197
|
+
* @returns {undefined}
|
|
1198
|
+
* Nothing.
|
|
1199
|
+
*/
|
|
1200
|
+
unshift(t) {
|
|
1201
|
+
this.setCursor(0), this.right.push(t);
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Inserts many items to the low-numbered side of the array;
|
|
1205
|
+
* moves the cursor to `0`.
|
|
1206
|
+
*
|
|
1207
|
+
* @param {Array<T>} items
|
|
1208
|
+
* Items.
|
|
1209
|
+
* @returns {undefined}
|
|
1210
|
+
* Nothing.
|
|
1211
|
+
*/
|
|
1212
|
+
unshiftMany(t) {
|
|
1213
|
+
this.setCursor(0), we(this.right, t.reverse());
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Move the cursor to a specific position in the array. Requires
|
|
1217
|
+
* time proportional to the distance moved.
|
|
1218
|
+
*
|
|
1219
|
+
* If `n < 0`, the cursor will end up at the beginning.
|
|
1220
|
+
* If `n > length`, the cursor will end up at the end.
|
|
1221
|
+
*
|
|
1222
|
+
* @param {number} n
|
|
1223
|
+
* Position.
|
|
1224
|
+
* @return {undefined}
|
|
1225
|
+
* Nothing.
|
|
1226
|
+
*/
|
|
1227
|
+
setCursor(t) {
|
|
1228
|
+
if (!(t === this.left.length || t > this.left.length && this.right.length === 0 || t < 0 && this.left.length === 0))
|
|
1229
|
+
if (t < this.left.length) {
|
|
1230
|
+
const n = this.left.splice(t, Number.POSITIVE_INFINITY);
|
|
1231
|
+
we(this.right, n.reverse());
|
|
1232
|
+
} else {
|
|
1233
|
+
const n = this.right.splice(this.left.length + this.right.length - t, Number.POSITIVE_INFINITY);
|
|
1234
|
+
we(this.left, n.reverse());
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
function we(e, t) {
|
|
1239
|
+
let n = 0;
|
|
1240
|
+
if (t.length < 1e4)
|
|
1241
|
+
e.push(...t);
|
|
1242
|
+
else
|
|
1243
|
+
for (; n < t.length; )
|
|
1244
|
+
e.push(...t.slice(n, n + 1e4)), n += 1e4;
|
|
1245
|
+
}
|
|
1246
|
+
function Vt(e) {
|
|
1247
|
+
const t = {};
|
|
1248
|
+
let n = -1, r, l, i, u, a, f, s;
|
|
1249
|
+
const c = new Cr(e);
|
|
1250
|
+
for (; ++n < c.length; ) {
|
|
1251
|
+
for (; n in t; )
|
|
1252
|
+
n = t[n];
|
|
1253
|
+
if (r = c.get(n), n && r[1].type === "chunkFlow" && c.get(n - 1)[1].type === "listItemPrefix" && (f = r[1]._tokenizer.events, i = 0, i < f.length && f[i][1].type === "lineEndingBlank" && (i += 2), i < f.length && f[i][1].type === "content"))
|
|
1254
|
+
for (; ++i < f.length && f[i][1].type !== "content"; )
|
|
1255
|
+
f[i][1].type === "chunkText" && (f[i][1]._isInFirstContentOfListItem = !0, i++);
|
|
1256
|
+
if (r[0] === "enter")
|
|
1257
|
+
r[1].contentType && (Object.assign(t, Tr(c, n)), n = t[n], s = !0);
|
|
1258
|
+
else if (r[1]._container) {
|
|
1259
|
+
for (i = n, l = void 0; i--; )
|
|
1260
|
+
if (u = c.get(i), u[1].type === "lineEnding" || u[1].type === "lineEndingBlank")
|
|
1261
|
+
u[0] === "enter" && (l && (c.get(l)[1].type = "lineEndingBlank"), u[1].type = "lineEnding", l = i);
|
|
1262
|
+
else if (!(u[1].type === "linePrefix" || u[1].type === "listItemIndent")) break;
|
|
1263
|
+
l && (r[1].end = {
|
|
1264
|
+
...c.get(l)[1].start
|
|
1265
|
+
}, a = c.slice(l, n), a.unshift(r), c.splice(l, n - l + 1, a));
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
return re(e, 0, Number.POSITIVE_INFINITY, c.slice(0)), !s;
|
|
1269
|
+
}
|
|
1270
|
+
function Tr(e, t) {
|
|
1271
|
+
const n = e.get(t)[1], r = e.get(t)[2];
|
|
1272
|
+
let l = t - 1;
|
|
1273
|
+
const i = [];
|
|
1274
|
+
let u = n._tokenizer;
|
|
1275
|
+
u || (u = r.parser[n.contentType](n.start), n._contentTypeTextTrailing && (u._contentTypeTextTrailing = !0));
|
|
1276
|
+
const a = u.events, f = [], s = {};
|
|
1277
|
+
let c, m, d = -1, o = n, b = 0, C = 0;
|
|
1278
|
+
const N = [C];
|
|
1279
|
+
for (; o; ) {
|
|
1280
|
+
for (; e.get(++l)[1] !== o; )
|
|
1281
|
+
;
|
|
1282
|
+
i.push(l), o._tokenizer || (c = r.sliceStream(o), o.next || c.push(null), m && u.defineSkip(o.start), o._isInFirstContentOfListItem && (u._gfmTasklistFirstContentOfListItem = !0), u.write(c), o._isInFirstContentOfListItem && (u._gfmTasklistFirstContentOfListItem = void 0)), m = o, o = o.next;
|
|
1283
|
+
}
|
|
1284
|
+
for (o = n; ++d < a.length; )
|
|
1285
|
+
// Find a void token that includes a break.
|
|
1286
|
+
a[d][0] === "exit" && a[d - 1][0] === "enter" && a[d][1].type === a[d - 1][1].type && a[d][1].start.line !== a[d][1].end.line && (C = d + 1, N.push(C), o._tokenizer = void 0, o.previous = void 0, o = o.next);
|
|
1287
|
+
for (u.events = [], o ? (o._tokenizer = void 0, o.previous = void 0) : N.pop(), d = N.length; d--; ) {
|
|
1288
|
+
const k = a.slice(N[d], N[d + 1]), A = i.pop();
|
|
1289
|
+
f.push([A, A + k.length - 1]), e.splice(A, 2, k);
|
|
1290
|
+
}
|
|
1291
|
+
for (f.reverse(), d = -1; ++d < f.length; )
|
|
1292
|
+
s[b + f[d][0]] = b + f[d][1], b += f[d][1] - f[d][0] - 1;
|
|
1293
|
+
return s;
|
|
1294
|
+
}
|
|
1295
|
+
const zr = {
|
|
1296
|
+
resolve: Fr,
|
|
1297
|
+
tokenize: Nr
|
|
1298
|
+
}, Ar = {
|
|
1299
|
+
partial: !0,
|
|
1300
|
+
tokenize: Pr
|
|
1301
|
+
};
|
|
1302
|
+
function Fr(e) {
|
|
1303
|
+
return Vt(e), e;
|
|
1304
|
+
}
|
|
1305
|
+
function Nr(e, t) {
|
|
1306
|
+
let n;
|
|
1307
|
+
return r;
|
|
1308
|
+
function r(a) {
|
|
1309
|
+
return e.enter("content"), n = e.enter("chunkContent", {
|
|
1310
|
+
contentType: "content"
|
|
1311
|
+
}), l(a);
|
|
1312
|
+
}
|
|
1313
|
+
function l(a) {
|
|
1314
|
+
return a === null ? i(a) : E(a) ? e.check(Ar, u, i)(a) : (e.consume(a), l);
|
|
1315
|
+
}
|
|
1316
|
+
function i(a) {
|
|
1317
|
+
return e.exit("chunkContent"), e.exit("content"), t(a);
|
|
1318
|
+
}
|
|
1319
|
+
function u(a) {
|
|
1320
|
+
return e.consume(a), e.exit("chunkContent"), n.next = e.enter("chunkContent", {
|
|
1321
|
+
contentType: "content",
|
|
1322
|
+
previous: n
|
|
1323
|
+
}), n = n.next, l;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
function Pr(e, t, n) {
|
|
1327
|
+
const r = this;
|
|
1328
|
+
return l;
|
|
1329
|
+
function l(u) {
|
|
1330
|
+
return e.exit("chunkContent"), e.enter("lineEnding"), e.consume(u), e.exit("lineEnding"), D(e, i, "linePrefix");
|
|
1331
|
+
}
|
|
1332
|
+
function i(u) {
|
|
1333
|
+
if (u === null || E(u))
|
|
1334
|
+
return n(u);
|
|
1335
|
+
const a = r.events[r.events.length - 1];
|
|
1336
|
+
return !r.parser.constructs.disable.null.includes("codeIndented") && a && a[1].type === "linePrefix" && a[2].sliceSerialize(a[1], !0).length >= 4 ? t(u) : e.interrupt(r.parser.constructs.flow, n, t)(u);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
function qt(e, t, n, r, l, i, u, a, f) {
|
|
1340
|
+
const s = f || Number.POSITIVE_INFINITY;
|
|
1341
|
+
let c = 0;
|
|
1342
|
+
return m;
|
|
1343
|
+
function m(k) {
|
|
1344
|
+
return k === 60 ? (e.enter(r), e.enter(l), e.enter(i), e.consume(k), e.exit(i), d) : k === null || k === 32 || k === 41 || Ue(k) ? n(k) : (e.enter(r), e.enter(u), e.enter(a), e.enter("chunkString", {
|
|
1345
|
+
contentType: "string"
|
|
1346
|
+
}), C(k));
|
|
1347
|
+
}
|
|
1348
|
+
function d(k) {
|
|
1349
|
+
return k === 62 ? (e.enter(i), e.consume(k), e.exit(i), e.exit(l), e.exit(r), t) : (e.enter(a), e.enter("chunkString", {
|
|
1350
|
+
contentType: "string"
|
|
1351
|
+
}), o(k));
|
|
1352
|
+
}
|
|
1353
|
+
function o(k) {
|
|
1354
|
+
return k === 62 ? (e.exit("chunkString"), e.exit(a), d(k)) : k === null || k === 60 || E(k) ? n(k) : (e.consume(k), k === 92 ? b : o);
|
|
1355
|
+
}
|
|
1356
|
+
function b(k) {
|
|
1357
|
+
return k === 60 || k === 62 || k === 92 ? (e.consume(k), o) : o(k);
|
|
1358
|
+
}
|
|
1359
|
+
function C(k) {
|
|
1360
|
+
return !c && (k === null || k === 41 || W(k)) ? (e.exit("chunkString"), e.exit(a), e.exit(u), e.exit(r), t(k)) : c < s && k === 40 ? (e.consume(k), c++, C) : k === 41 ? (e.consume(k), c--, C) : k === null || k === 32 || k === 40 || Ue(k) ? n(k) : (e.consume(k), k === 92 ? N : C);
|
|
1361
|
+
}
|
|
1362
|
+
function N(k) {
|
|
1363
|
+
return k === 40 || k === 41 || k === 92 ? (e.consume(k), C) : C(k);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
function vt(e, t, n, r, l, i) {
|
|
1367
|
+
const u = this;
|
|
1368
|
+
let a = 0, f;
|
|
1369
|
+
return s;
|
|
1370
|
+
function s(o) {
|
|
1371
|
+
return e.enter(r), e.enter(l), e.consume(o), e.exit(l), e.enter(i), c;
|
|
1372
|
+
}
|
|
1373
|
+
function c(o) {
|
|
1374
|
+
return a > 999 || o === null || o === 91 || o === 93 && !f || // To do: remove in the future once we’ve switched from
|
|
1375
|
+
// `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
|
|
1376
|
+
// which doesn’t need this.
|
|
1377
|
+
// Hidden footnotes hook.
|
|
1378
|
+
/* c8 ignore next 3 */
|
|
1379
|
+
o === 94 && !a && "_hiddenFootnoteSupport" in u.parser.constructs ? n(o) : o === 93 ? (e.exit(i), e.enter(l), e.consume(o), e.exit(l), e.exit(r), t) : E(o) ? (e.enter("lineEnding"), e.consume(o), e.exit("lineEnding"), c) : (e.enter("chunkString", {
|
|
1380
|
+
contentType: "string"
|
|
1381
|
+
}), m(o));
|
|
1382
|
+
}
|
|
1383
|
+
function m(o) {
|
|
1384
|
+
return o === null || o === 91 || o === 93 || E(o) || a++ > 999 ? (e.exit("chunkString"), c(o)) : (e.consume(o), f || (f = !P(o)), o === 92 ? d : m);
|
|
1385
|
+
}
|
|
1386
|
+
function d(o) {
|
|
1387
|
+
return o === 91 || o === 92 || o === 93 ? (e.consume(o), a++, m) : m(o);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
function Ut(e, t, n, r, l, i) {
|
|
1391
|
+
let u;
|
|
1392
|
+
return a;
|
|
1393
|
+
function a(d) {
|
|
1394
|
+
return d === 34 || d === 39 || d === 40 ? (e.enter(r), e.enter(l), e.consume(d), e.exit(l), u = d === 40 ? 41 : d, f) : n(d);
|
|
1395
|
+
}
|
|
1396
|
+
function f(d) {
|
|
1397
|
+
return d === u ? (e.enter(l), e.consume(d), e.exit(l), e.exit(r), t) : (e.enter(i), s(d));
|
|
1398
|
+
}
|
|
1399
|
+
function s(d) {
|
|
1400
|
+
return d === u ? (e.exit(i), f(u)) : d === null ? n(d) : E(d) ? (e.enter("lineEnding"), e.consume(d), e.exit("lineEnding"), D(e, s, "linePrefix")) : (e.enter("chunkString", {
|
|
1401
|
+
contentType: "string"
|
|
1402
|
+
}), c(d));
|
|
1403
|
+
}
|
|
1404
|
+
function c(d) {
|
|
1405
|
+
return d === u || d === null || E(d) ? (e.exit("chunkString"), s(d)) : (e.consume(d), d === 92 ? m : c);
|
|
1406
|
+
}
|
|
1407
|
+
function m(d) {
|
|
1408
|
+
return d === u || d === 92 ? (e.consume(d), c) : c(d);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
function Ee(e, t) {
|
|
1412
|
+
let n;
|
|
1413
|
+
return r;
|
|
1414
|
+
function r(l) {
|
|
1415
|
+
return E(l) ? (e.enter("lineEnding"), e.consume(l), e.exit("lineEnding"), n = !0, r) : P(l) ? D(e, r, n ? "linePrefix" : "lineSuffix")(l) : t(l);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
const Lr = {
|
|
1419
|
+
name: "definition",
|
|
1420
|
+
tokenize: Br
|
|
1421
|
+
}, _r = {
|
|
1422
|
+
partial: !0,
|
|
1423
|
+
tokenize: Dr
|
|
1424
|
+
};
|
|
1425
|
+
function Br(e, t, n) {
|
|
1426
|
+
const r = this;
|
|
1427
|
+
let l;
|
|
1428
|
+
return i;
|
|
1429
|
+
function i(o) {
|
|
1430
|
+
return e.enter("definition"), u(o);
|
|
1431
|
+
}
|
|
1432
|
+
function u(o) {
|
|
1433
|
+
return vt.call(
|
|
1434
|
+
r,
|
|
1435
|
+
e,
|
|
1436
|
+
a,
|
|
1437
|
+
// Note: we don’t need to reset the way `markdown-rs` does.
|
|
1438
|
+
n,
|
|
1439
|
+
"definitionLabel",
|
|
1440
|
+
"definitionLabelMarker",
|
|
1441
|
+
"definitionLabelString"
|
|
1442
|
+
)(o);
|
|
1443
|
+
}
|
|
1444
|
+
function a(o) {
|
|
1445
|
+
return l = ge(r.sliceSerialize(r.events[r.events.length - 1][1]).slice(1, -1)), o === 58 ? (e.enter("definitionMarker"), e.consume(o), e.exit("definitionMarker"), f) : n(o);
|
|
1446
|
+
}
|
|
1447
|
+
function f(o) {
|
|
1448
|
+
return W(o) ? Ee(e, s)(o) : s(o);
|
|
1449
|
+
}
|
|
1450
|
+
function s(o) {
|
|
1451
|
+
return qt(
|
|
1452
|
+
e,
|
|
1453
|
+
c,
|
|
1454
|
+
// Note: we don’t need to reset the way `markdown-rs` does.
|
|
1455
|
+
n,
|
|
1456
|
+
"definitionDestination",
|
|
1457
|
+
"definitionDestinationLiteral",
|
|
1458
|
+
"definitionDestinationLiteralMarker",
|
|
1459
|
+
"definitionDestinationRaw",
|
|
1460
|
+
"definitionDestinationString"
|
|
1461
|
+
)(o);
|
|
1462
|
+
}
|
|
1463
|
+
function c(o) {
|
|
1464
|
+
return e.attempt(_r, m, m)(o);
|
|
1465
|
+
}
|
|
1466
|
+
function m(o) {
|
|
1467
|
+
return P(o) ? D(e, d, "whitespace")(o) : d(o);
|
|
1468
|
+
}
|
|
1469
|
+
function d(o) {
|
|
1470
|
+
return o === null || E(o) ? (e.exit("definition"), r.parser.defined.push(l), t(o)) : n(o);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
function Dr(e, t, n) {
|
|
1474
|
+
return r;
|
|
1475
|
+
function r(a) {
|
|
1476
|
+
return W(a) ? Ee(e, l)(a) : n(a);
|
|
1477
|
+
}
|
|
1478
|
+
function l(a) {
|
|
1479
|
+
return Ut(e, i, n, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(a);
|
|
1480
|
+
}
|
|
1481
|
+
function i(a) {
|
|
1482
|
+
return P(a) ? D(e, u, "whitespace")(a) : u(a);
|
|
1483
|
+
}
|
|
1484
|
+
function u(a) {
|
|
1485
|
+
return a === null || E(a) ? t(a) : n(a);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
const Rr = {
|
|
1489
|
+
name: "hardBreakEscape",
|
|
1490
|
+
tokenize: Mr
|
|
1491
|
+
};
|
|
1492
|
+
function Mr(e, t, n) {
|
|
1493
|
+
return r;
|
|
1494
|
+
function r(i) {
|
|
1495
|
+
return e.enter("hardBreakEscape"), e.consume(i), l;
|
|
1496
|
+
}
|
|
1497
|
+
function l(i) {
|
|
1498
|
+
return E(i) ? (e.exit("hardBreakEscape"), t(i)) : n(i);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
const Or = {
|
|
1502
|
+
name: "headingAtx",
|
|
1503
|
+
resolve: jr,
|
|
1504
|
+
tokenize: Hr
|
|
1505
|
+
};
|
|
1506
|
+
function jr(e, t) {
|
|
1507
|
+
let n = e.length - 2, r = 3, l, i;
|
|
1508
|
+
return e[r][1].type === "whitespace" && (r += 2), n - 2 > r && e[n][1].type === "whitespace" && (n -= 2), e[n][1].type === "atxHeadingSequence" && (r === n - 1 || n - 4 > r && e[n - 2][1].type === "whitespace") && (n -= r + 1 === n ? 2 : 4), n > r && (l = {
|
|
1509
|
+
type: "atxHeadingText",
|
|
1510
|
+
start: e[r][1].start,
|
|
1511
|
+
end: e[n][1].end
|
|
1512
|
+
}, i = {
|
|
1513
|
+
type: "chunkText",
|
|
1514
|
+
start: e[r][1].start,
|
|
1515
|
+
end: e[n][1].end,
|
|
1516
|
+
contentType: "text"
|
|
1517
|
+
}, re(e, r, n - r + 1, [["enter", l, t], ["enter", i, t], ["exit", i, t], ["exit", l, t]])), e;
|
|
1518
|
+
}
|
|
1519
|
+
function Hr(e, t, n) {
|
|
1520
|
+
let r = 0;
|
|
1521
|
+
return l;
|
|
1522
|
+
function l(c) {
|
|
1523
|
+
return e.enter("atxHeading"), i(c);
|
|
1524
|
+
}
|
|
1525
|
+
function i(c) {
|
|
1526
|
+
return e.enter("atxHeadingSequence"), u(c);
|
|
1527
|
+
}
|
|
1528
|
+
function u(c) {
|
|
1529
|
+
return c === 35 && r++ < 6 ? (e.consume(c), u) : c === null || W(c) ? (e.exit("atxHeadingSequence"), a(c)) : n(c);
|
|
1530
|
+
}
|
|
1531
|
+
function a(c) {
|
|
1532
|
+
return c === 35 ? (e.enter("atxHeadingSequence"), f(c)) : c === null || E(c) ? (e.exit("atxHeading"), t(c)) : P(c) ? D(e, a, "whitespace")(c) : (e.enter("atxHeadingText"), s(c));
|
|
1533
|
+
}
|
|
1534
|
+
function f(c) {
|
|
1535
|
+
return c === 35 ? (e.consume(c), f) : (e.exit("atxHeadingSequence"), a(c));
|
|
1536
|
+
}
|
|
1537
|
+
function s(c) {
|
|
1538
|
+
return c === null || c === 35 || W(c) ? (e.exit("atxHeadingText"), a(c)) : (e.consume(c), s);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
const Vr = [
|
|
1542
|
+
"address",
|
|
1543
|
+
"article",
|
|
1544
|
+
"aside",
|
|
1545
|
+
"base",
|
|
1546
|
+
"basefont",
|
|
1547
|
+
"blockquote",
|
|
1548
|
+
"body",
|
|
1549
|
+
"caption",
|
|
1550
|
+
"center",
|
|
1551
|
+
"col",
|
|
1552
|
+
"colgroup",
|
|
1553
|
+
"dd",
|
|
1554
|
+
"details",
|
|
1555
|
+
"dialog",
|
|
1556
|
+
"dir",
|
|
1557
|
+
"div",
|
|
1558
|
+
"dl",
|
|
1559
|
+
"dt",
|
|
1560
|
+
"fieldset",
|
|
1561
|
+
"figcaption",
|
|
1562
|
+
"figure",
|
|
1563
|
+
"footer",
|
|
1564
|
+
"form",
|
|
1565
|
+
"frame",
|
|
1566
|
+
"frameset",
|
|
1567
|
+
"h1",
|
|
1568
|
+
"h2",
|
|
1569
|
+
"h3",
|
|
1570
|
+
"h4",
|
|
1571
|
+
"h5",
|
|
1572
|
+
"h6",
|
|
1573
|
+
"head",
|
|
1574
|
+
"header",
|
|
1575
|
+
"hr",
|
|
1576
|
+
"html",
|
|
1577
|
+
"iframe",
|
|
1578
|
+
"legend",
|
|
1579
|
+
"li",
|
|
1580
|
+
"link",
|
|
1581
|
+
"main",
|
|
1582
|
+
"menu",
|
|
1583
|
+
"menuitem",
|
|
1584
|
+
"nav",
|
|
1585
|
+
"noframes",
|
|
1586
|
+
"ol",
|
|
1587
|
+
"optgroup",
|
|
1588
|
+
"option",
|
|
1589
|
+
"p",
|
|
1590
|
+
"param",
|
|
1591
|
+
"search",
|
|
1592
|
+
"section",
|
|
1593
|
+
"summary",
|
|
1594
|
+
"table",
|
|
1595
|
+
"tbody",
|
|
1596
|
+
"td",
|
|
1597
|
+
"tfoot",
|
|
1598
|
+
"th",
|
|
1599
|
+
"thead",
|
|
1600
|
+
"title",
|
|
1601
|
+
"tr",
|
|
1602
|
+
"track",
|
|
1603
|
+
"ul"
|
|
1604
|
+
], kt = ["pre", "script", "style", "textarea"], qr = {
|
|
1605
|
+
concrete: !0,
|
|
1606
|
+
name: "htmlFlow",
|
|
1607
|
+
resolveTo: Qr,
|
|
1608
|
+
tokenize: $r
|
|
1609
|
+
}, vr = {
|
|
1610
|
+
partial: !0,
|
|
1611
|
+
tokenize: Yr
|
|
1612
|
+
}, Ur = {
|
|
1613
|
+
partial: !0,
|
|
1614
|
+
tokenize: Wr
|
|
1615
|
+
};
|
|
1616
|
+
function Qr(e) {
|
|
1617
|
+
let t = e.length;
|
|
1618
|
+
for (; t-- && !(e[t][0] === "enter" && e[t][1].type === "htmlFlow"); )
|
|
1619
|
+
;
|
|
1620
|
+
return t > 1 && e[t - 2][1].type === "linePrefix" && (e[t][1].start = e[t - 2][1].start, e[t + 1][1].start = e[t - 2][1].start, e.splice(t - 2, 2)), e;
|
|
1621
|
+
}
|
|
1622
|
+
function $r(e, t, n) {
|
|
1623
|
+
const r = this;
|
|
1624
|
+
let l, i, u, a, f;
|
|
1625
|
+
return s;
|
|
1626
|
+
function s(p) {
|
|
1627
|
+
return c(p);
|
|
1628
|
+
}
|
|
1629
|
+
function c(p) {
|
|
1630
|
+
return e.enter("htmlFlow"), e.enter("htmlFlowData"), e.consume(p), m;
|
|
1631
|
+
}
|
|
1632
|
+
function m(p) {
|
|
1633
|
+
return p === 33 ? (e.consume(p), d) : p === 47 ? (e.consume(p), i = !0, C) : p === 63 ? (e.consume(p), l = 3, r.interrupt ? t : h) : ne(p) ? (e.consume(p), u = String.fromCharCode(p), N) : n(p);
|
|
1634
|
+
}
|
|
1635
|
+
function d(p) {
|
|
1636
|
+
return p === 45 ? (e.consume(p), l = 2, o) : p === 91 ? (e.consume(p), l = 5, a = 0, b) : ne(p) ? (e.consume(p), l = 4, r.interrupt ? t : h) : n(p);
|
|
1637
|
+
}
|
|
1638
|
+
function o(p) {
|
|
1639
|
+
return p === 45 ? (e.consume(p), r.interrupt ? t : h) : n(p);
|
|
1640
|
+
}
|
|
1641
|
+
function b(p) {
|
|
1642
|
+
const X = "CDATA[";
|
|
1643
|
+
return p === X.charCodeAt(a++) ? (e.consume(p), a === X.length ? r.interrupt ? t : S : b) : n(p);
|
|
1644
|
+
}
|
|
1645
|
+
function C(p) {
|
|
1646
|
+
return ne(p) ? (e.consume(p), u = String.fromCharCode(p), N) : n(p);
|
|
1647
|
+
}
|
|
1648
|
+
function N(p) {
|
|
1649
|
+
if (p === null || p === 47 || p === 62 || W(p)) {
|
|
1650
|
+
const X = p === 47, he = u.toLowerCase();
|
|
1651
|
+
return !X && !i && kt.includes(he) ? (l = 1, r.interrupt ? t(p) : S(p)) : Vr.includes(u.toLowerCase()) ? (l = 6, X ? (e.consume(p), k) : r.interrupt ? t(p) : S(p)) : (l = 7, r.interrupt && !r.parser.lazy[r.now().line] ? n(p) : i ? A(p) : w(p));
|
|
1652
|
+
}
|
|
1653
|
+
return p === 45 || J(p) ? (e.consume(p), u += String.fromCharCode(p), N) : n(p);
|
|
1654
|
+
}
|
|
1655
|
+
function k(p) {
|
|
1656
|
+
return p === 62 ? (e.consume(p), r.interrupt ? t : S) : n(p);
|
|
1657
|
+
}
|
|
1658
|
+
function A(p) {
|
|
1659
|
+
return P(p) ? (e.consume(p), A) : R(p);
|
|
1660
|
+
}
|
|
1661
|
+
function w(p) {
|
|
1662
|
+
return p === 47 ? (e.consume(p), R) : p === 58 || p === 95 || ne(p) ? (e.consume(p), M) : P(p) ? (e.consume(p), w) : R(p);
|
|
1663
|
+
}
|
|
1664
|
+
function M(p) {
|
|
1665
|
+
return p === 45 || p === 46 || p === 58 || p === 95 || J(p) ? (e.consume(p), M) : j(p);
|
|
1666
|
+
}
|
|
1667
|
+
function j(p) {
|
|
1668
|
+
return p === 61 ? (e.consume(p), x) : P(p) ? (e.consume(p), j) : w(p);
|
|
1669
|
+
}
|
|
1670
|
+
function x(p) {
|
|
1671
|
+
return p === null || p === 60 || p === 61 || p === 62 || p === 96 ? n(p) : p === 34 || p === 39 ? (e.consume(p), f = p, L) : P(p) ? (e.consume(p), x) : H(p);
|
|
1672
|
+
}
|
|
1673
|
+
function L(p) {
|
|
1674
|
+
return p === f ? (e.consume(p), f = null, _) : p === null || E(p) ? n(p) : (e.consume(p), L);
|
|
1675
|
+
}
|
|
1676
|
+
function H(p) {
|
|
1677
|
+
return p === null || p === 34 || p === 39 || p === 47 || p === 60 || p === 61 || p === 62 || p === 96 || W(p) ? j(p) : (e.consume(p), H);
|
|
1678
|
+
}
|
|
1679
|
+
function _(p) {
|
|
1680
|
+
return p === 47 || p === 62 || P(p) ? w(p) : n(p);
|
|
1681
|
+
}
|
|
1682
|
+
function R(p) {
|
|
1683
|
+
return p === 62 ? (e.consume(p), I) : n(p);
|
|
1684
|
+
}
|
|
1685
|
+
function I(p) {
|
|
1686
|
+
return p === null || E(p) ? S(p) : P(p) ? (e.consume(p), I) : n(p);
|
|
1687
|
+
}
|
|
1688
|
+
function S(p) {
|
|
1689
|
+
return p === 45 && l === 2 ? (e.consume(p), U) : p === 60 && l === 1 ? (e.consume(p), q) : p === 62 && l === 4 ? (e.consume(p), G) : p === 63 && l === 3 ? (e.consume(p), h) : p === 93 && l === 5 ? (e.consume(p), ie) : E(p) && (l === 6 || l === 7) ? (e.exit("htmlFlowData"), e.check(vr, le, O)(p)) : p === null || E(p) ? (e.exit("htmlFlowData"), O(p)) : (e.consume(p), S);
|
|
1690
|
+
}
|
|
1691
|
+
function O(p) {
|
|
1692
|
+
return e.check(Ur, V, le)(p);
|
|
1693
|
+
}
|
|
1694
|
+
function V(p) {
|
|
1695
|
+
return e.enter("lineEnding"), e.consume(p), e.exit("lineEnding"), F;
|
|
1696
|
+
}
|
|
1697
|
+
function F(p) {
|
|
1698
|
+
return p === null || E(p) ? O(p) : (e.enter("htmlFlowData"), S(p));
|
|
1699
|
+
}
|
|
1700
|
+
function U(p) {
|
|
1701
|
+
return p === 45 ? (e.consume(p), h) : S(p);
|
|
1702
|
+
}
|
|
1703
|
+
function q(p) {
|
|
1704
|
+
return p === 47 ? (e.consume(p), u = "", Z) : S(p);
|
|
1705
|
+
}
|
|
1706
|
+
function Z(p) {
|
|
1707
|
+
if (p === 62) {
|
|
1708
|
+
const X = u.toLowerCase();
|
|
1709
|
+
return kt.includes(X) ? (e.consume(p), G) : S(p);
|
|
1710
|
+
}
|
|
1711
|
+
return ne(p) && u.length < 8 ? (e.consume(p), u += String.fromCharCode(p), Z) : S(p);
|
|
1712
|
+
}
|
|
1713
|
+
function ie(p) {
|
|
1714
|
+
return p === 93 ? (e.consume(p), h) : S(p);
|
|
1715
|
+
}
|
|
1716
|
+
function h(p) {
|
|
1717
|
+
return p === 62 ? (e.consume(p), G) : p === 45 && l === 2 ? (e.consume(p), h) : S(p);
|
|
1718
|
+
}
|
|
1719
|
+
function G(p) {
|
|
1720
|
+
return p === null || E(p) ? (e.exit("htmlFlowData"), le(p)) : (e.consume(p), G);
|
|
1721
|
+
}
|
|
1722
|
+
function le(p) {
|
|
1723
|
+
return e.exit("htmlFlow"), t(p);
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
function Wr(e, t, n) {
|
|
1727
|
+
const r = this;
|
|
1728
|
+
return l;
|
|
1729
|
+
function l(u) {
|
|
1730
|
+
return E(u) ? (e.enter("lineEnding"), e.consume(u), e.exit("lineEnding"), i) : n(u);
|
|
1731
|
+
}
|
|
1732
|
+
function i(u) {
|
|
1733
|
+
return r.parser.lazy[r.now().line] ? n(u) : t(u);
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
function Yr(e, t, n) {
|
|
1737
|
+
return r;
|
|
1738
|
+
function r(l) {
|
|
1739
|
+
return e.enter("lineEnding"), e.consume(l), e.exit("lineEnding"), e.attempt(Le, t, n);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
const Jr = {
|
|
1743
|
+
name: "htmlText",
|
|
1744
|
+
tokenize: Kr
|
|
1745
|
+
};
|
|
1746
|
+
function Kr(e, t, n) {
|
|
1747
|
+
const r = this;
|
|
1748
|
+
let l, i, u;
|
|
1749
|
+
return a;
|
|
1750
|
+
function a(h) {
|
|
1751
|
+
return e.enter("htmlText"), e.enter("htmlTextData"), e.consume(h), f;
|
|
1752
|
+
}
|
|
1753
|
+
function f(h) {
|
|
1754
|
+
return h === 33 ? (e.consume(h), s) : h === 47 ? (e.consume(h), j) : h === 63 ? (e.consume(h), w) : ne(h) ? (e.consume(h), H) : n(h);
|
|
1755
|
+
}
|
|
1756
|
+
function s(h) {
|
|
1757
|
+
return h === 45 ? (e.consume(h), c) : h === 91 ? (e.consume(h), i = 0, b) : ne(h) ? (e.consume(h), A) : n(h);
|
|
1758
|
+
}
|
|
1759
|
+
function c(h) {
|
|
1760
|
+
return h === 45 ? (e.consume(h), o) : n(h);
|
|
1761
|
+
}
|
|
1762
|
+
function m(h) {
|
|
1763
|
+
return h === null ? n(h) : h === 45 ? (e.consume(h), d) : E(h) ? (u = m, q(h)) : (e.consume(h), m);
|
|
1764
|
+
}
|
|
1765
|
+
function d(h) {
|
|
1766
|
+
return h === 45 ? (e.consume(h), o) : m(h);
|
|
1767
|
+
}
|
|
1768
|
+
function o(h) {
|
|
1769
|
+
return h === 62 ? U(h) : h === 45 ? d(h) : m(h);
|
|
1770
|
+
}
|
|
1771
|
+
function b(h) {
|
|
1772
|
+
const G = "CDATA[";
|
|
1773
|
+
return h === G.charCodeAt(i++) ? (e.consume(h), i === G.length ? C : b) : n(h);
|
|
1774
|
+
}
|
|
1775
|
+
function C(h) {
|
|
1776
|
+
return h === null ? n(h) : h === 93 ? (e.consume(h), N) : E(h) ? (u = C, q(h)) : (e.consume(h), C);
|
|
1777
|
+
}
|
|
1778
|
+
function N(h) {
|
|
1779
|
+
return h === 93 ? (e.consume(h), k) : C(h);
|
|
1780
|
+
}
|
|
1781
|
+
function k(h) {
|
|
1782
|
+
return h === 62 ? U(h) : h === 93 ? (e.consume(h), k) : C(h);
|
|
1783
|
+
}
|
|
1784
|
+
function A(h) {
|
|
1785
|
+
return h === null || h === 62 ? U(h) : E(h) ? (u = A, q(h)) : (e.consume(h), A);
|
|
1786
|
+
}
|
|
1787
|
+
function w(h) {
|
|
1788
|
+
return h === null ? n(h) : h === 63 ? (e.consume(h), M) : E(h) ? (u = w, q(h)) : (e.consume(h), w);
|
|
1789
|
+
}
|
|
1790
|
+
function M(h) {
|
|
1791
|
+
return h === 62 ? U(h) : w(h);
|
|
1792
|
+
}
|
|
1793
|
+
function j(h) {
|
|
1794
|
+
return ne(h) ? (e.consume(h), x) : n(h);
|
|
1795
|
+
}
|
|
1796
|
+
function x(h) {
|
|
1797
|
+
return h === 45 || J(h) ? (e.consume(h), x) : L(h);
|
|
1798
|
+
}
|
|
1799
|
+
function L(h) {
|
|
1800
|
+
return E(h) ? (u = L, q(h)) : P(h) ? (e.consume(h), L) : U(h);
|
|
1801
|
+
}
|
|
1802
|
+
function H(h) {
|
|
1803
|
+
return h === 45 || J(h) ? (e.consume(h), H) : h === 47 || h === 62 || W(h) ? _(h) : n(h);
|
|
1804
|
+
}
|
|
1805
|
+
function _(h) {
|
|
1806
|
+
return h === 47 ? (e.consume(h), U) : h === 58 || h === 95 || ne(h) ? (e.consume(h), R) : E(h) ? (u = _, q(h)) : P(h) ? (e.consume(h), _) : U(h);
|
|
1807
|
+
}
|
|
1808
|
+
function R(h) {
|
|
1809
|
+
return h === 45 || h === 46 || h === 58 || h === 95 || J(h) ? (e.consume(h), R) : I(h);
|
|
1810
|
+
}
|
|
1811
|
+
function I(h) {
|
|
1812
|
+
return h === 61 ? (e.consume(h), S) : E(h) ? (u = I, q(h)) : P(h) ? (e.consume(h), I) : _(h);
|
|
1813
|
+
}
|
|
1814
|
+
function S(h) {
|
|
1815
|
+
return h === null || h === 60 || h === 61 || h === 62 || h === 96 ? n(h) : h === 34 || h === 39 ? (e.consume(h), l = h, O) : E(h) ? (u = S, q(h)) : P(h) ? (e.consume(h), S) : (e.consume(h), V);
|
|
1816
|
+
}
|
|
1817
|
+
function O(h) {
|
|
1818
|
+
return h === l ? (e.consume(h), l = void 0, F) : h === null ? n(h) : E(h) ? (u = O, q(h)) : (e.consume(h), O);
|
|
1819
|
+
}
|
|
1820
|
+
function V(h) {
|
|
1821
|
+
return h === null || h === 34 || h === 39 || h === 60 || h === 61 || h === 96 ? n(h) : h === 47 || h === 62 || W(h) ? _(h) : (e.consume(h), V);
|
|
1822
|
+
}
|
|
1823
|
+
function F(h) {
|
|
1824
|
+
return h === 47 || h === 62 || W(h) ? _(h) : n(h);
|
|
1825
|
+
}
|
|
1826
|
+
function U(h) {
|
|
1827
|
+
return h === 62 ? (e.consume(h), e.exit("htmlTextData"), e.exit("htmlText"), t) : n(h);
|
|
1828
|
+
}
|
|
1829
|
+
function q(h) {
|
|
1830
|
+
return e.exit("htmlTextData"), e.enter("lineEnding"), e.consume(h), e.exit("lineEnding"), Z;
|
|
1831
|
+
}
|
|
1832
|
+
function Z(h) {
|
|
1833
|
+
return P(h) ? D(e, ie, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(h) : ie(h);
|
|
1834
|
+
}
|
|
1835
|
+
function ie(h) {
|
|
1836
|
+
return e.enter("htmlTextData"), u(h);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
const tt = {
|
|
1840
|
+
name: "labelEnd",
|
|
1841
|
+
resolveAll: ei,
|
|
1842
|
+
resolveTo: ti,
|
|
1843
|
+
tokenize: ni
|
|
1844
|
+
}, Zr = {
|
|
1845
|
+
tokenize: ri
|
|
1846
|
+
}, Gr = {
|
|
1847
|
+
tokenize: ii
|
|
1848
|
+
}, Xr = {
|
|
1849
|
+
tokenize: li
|
|
1850
|
+
};
|
|
1851
|
+
function ei(e) {
|
|
1852
|
+
let t = -1;
|
|
1853
|
+
const n = [];
|
|
1854
|
+
for (; ++t < e.length; ) {
|
|
1855
|
+
const r = e[t][1];
|
|
1856
|
+
if (n.push(e[t]), r.type === "labelImage" || r.type === "labelLink" || r.type === "labelEnd") {
|
|
1857
|
+
const l = r.type === "labelImage" ? 4 : 2;
|
|
1858
|
+
r.type = "data", t += l;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
return e.length !== n.length && re(e, 0, e.length, n), e;
|
|
1862
|
+
}
|
|
1863
|
+
function ti(e, t) {
|
|
1864
|
+
let n = e.length, r = 0, l, i, u, a;
|
|
1865
|
+
for (; n--; )
|
|
1866
|
+
if (l = e[n][1], i) {
|
|
1867
|
+
if (l.type === "link" || l.type === "labelLink" && l._inactive)
|
|
1868
|
+
break;
|
|
1869
|
+
e[n][0] === "enter" && l.type === "labelLink" && (l._inactive = !0);
|
|
1870
|
+
} else if (u) {
|
|
1871
|
+
if (e[n][0] === "enter" && (l.type === "labelImage" || l.type === "labelLink") && !l._balanced && (i = n, l.type !== "labelLink")) {
|
|
1872
|
+
r = 2;
|
|
1873
|
+
break;
|
|
1874
|
+
}
|
|
1875
|
+
} else l.type === "labelEnd" && (u = n);
|
|
1876
|
+
const f = {
|
|
1877
|
+
type: e[i][1].type === "labelLink" ? "link" : "image",
|
|
1878
|
+
start: {
|
|
1879
|
+
...e[i][1].start
|
|
1880
|
+
},
|
|
1881
|
+
end: {
|
|
1882
|
+
...e[e.length - 1][1].end
|
|
1883
|
+
}
|
|
1884
|
+
}, s = {
|
|
1885
|
+
type: "label",
|
|
1886
|
+
start: {
|
|
1887
|
+
...e[i][1].start
|
|
1888
|
+
},
|
|
1889
|
+
end: {
|
|
1890
|
+
...e[u][1].end
|
|
1891
|
+
}
|
|
1892
|
+
}, c = {
|
|
1893
|
+
type: "labelText",
|
|
1894
|
+
start: {
|
|
1895
|
+
...e[i + r + 2][1].end
|
|
1896
|
+
},
|
|
1897
|
+
end: {
|
|
1898
|
+
...e[u - 2][1].start
|
|
1899
|
+
}
|
|
1900
|
+
};
|
|
1901
|
+
return a = [["enter", f, t], ["enter", s, t]], a = K(a, e.slice(i + 1, i + r + 3)), a = K(a, [["enter", c, t]]), a = K(a, et(t.parser.constructs.insideSpan.null, e.slice(i + r + 4, u - 3), t)), a = K(a, [["exit", c, t], e[u - 2], e[u - 1], ["exit", s, t]]), a = K(a, e.slice(u + 1)), a = K(a, [["exit", f, t]]), re(e, i, e.length, a), e;
|
|
1902
|
+
}
|
|
1903
|
+
function ni(e, t, n) {
|
|
1904
|
+
const r = this;
|
|
1905
|
+
let l = r.events.length, i, u;
|
|
1906
|
+
for (; l--; )
|
|
1907
|
+
if ((r.events[l][1].type === "labelImage" || r.events[l][1].type === "labelLink") && !r.events[l][1]._balanced) {
|
|
1908
|
+
i = r.events[l][1];
|
|
1909
|
+
break;
|
|
1910
|
+
}
|
|
1911
|
+
return a;
|
|
1912
|
+
function a(d) {
|
|
1913
|
+
return i ? i._inactive ? m(d) : (u = r.parser.defined.includes(ge(r.sliceSerialize({
|
|
1914
|
+
start: i.end,
|
|
1915
|
+
end: r.now()
|
|
1916
|
+
}))), e.enter("labelEnd"), e.enter("labelMarker"), e.consume(d), e.exit("labelMarker"), e.exit("labelEnd"), f) : n(d);
|
|
1917
|
+
}
|
|
1918
|
+
function f(d) {
|
|
1919
|
+
return d === 40 ? e.attempt(Zr, c, u ? c : m)(d) : d === 91 ? e.attempt(Gr, c, u ? s : m)(d) : u ? c(d) : m(d);
|
|
1920
|
+
}
|
|
1921
|
+
function s(d) {
|
|
1922
|
+
return e.attempt(Xr, c, m)(d);
|
|
1923
|
+
}
|
|
1924
|
+
function c(d) {
|
|
1925
|
+
return t(d);
|
|
1926
|
+
}
|
|
1927
|
+
function m(d) {
|
|
1928
|
+
return i._balanced = !0, n(d);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
function ri(e, t, n) {
|
|
1932
|
+
return r;
|
|
1933
|
+
function r(m) {
|
|
1934
|
+
return e.enter("resource"), e.enter("resourceMarker"), e.consume(m), e.exit("resourceMarker"), l;
|
|
1935
|
+
}
|
|
1936
|
+
function l(m) {
|
|
1937
|
+
return W(m) ? Ee(e, i)(m) : i(m);
|
|
1938
|
+
}
|
|
1939
|
+
function i(m) {
|
|
1940
|
+
return m === 41 ? c(m) : qt(e, u, a, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(m);
|
|
1941
|
+
}
|
|
1942
|
+
function u(m) {
|
|
1943
|
+
return W(m) ? Ee(e, f)(m) : c(m);
|
|
1944
|
+
}
|
|
1945
|
+
function a(m) {
|
|
1946
|
+
return n(m);
|
|
1947
|
+
}
|
|
1948
|
+
function f(m) {
|
|
1949
|
+
return m === 34 || m === 39 || m === 40 ? Ut(e, s, n, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(m) : c(m);
|
|
1950
|
+
}
|
|
1951
|
+
function s(m) {
|
|
1952
|
+
return W(m) ? Ee(e, c)(m) : c(m);
|
|
1953
|
+
}
|
|
1954
|
+
function c(m) {
|
|
1955
|
+
return m === 41 ? (e.enter("resourceMarker"), e.consume(m), e.exit("resourceMarker"), e.exit("resource"), t) : n(m);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
function ii(e, t, n) {
|
|
1959
|
+
const r = this;
|
|
1960
|
+
return l;
|
|
1961
|
+
function l(a) {
|
|
1962
|
+
return vt.call(r, e, i, u, "reference", "referenceMarker", "referenceString")(a);
|
|
1963
|
+
}
|
|
1964
|
+
function i(a) {
|
|
1965
|
+
return r.parser.defined.includes(ge(r.sliceSerialize(r.events[r.events.length - 1][1]).slice(1, -1))) ? t(a) : n(a);
|
|
1966
|
+
}
|
|
1967
|
+
function u(a) {
|
|
1968
|
+
return n(a);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
function li(e, t, n) {
|
|
1972
|
+
return r;
|
|
1973
|
+
function r(i) {
|
|
1974
|
+
return e.enter("reference"), e.enter("referenceMarker"), e.consume(i), e.exit("referenceMarker"), l;
|
|
1975
|
+
}
|
|
1976
|
+
function l(i) {
|
|
1977
|
+
return i === 93 ? (e.enter("referenceMarker"), e.consume(i), e.exit("referenceMarker"), e.exit("reference"), t) : n(i);
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
const ui = {
|
|
1981
|
+
name: "labelStartImage",
|
|
1982
|
+
resolveAll: tt.resolveAll,
|
|
1983
|
+
tokenize: ai
|
|
1984
|
+
};
|
|
1985
|
+
function ai(e, t, n) {
|
|
1986
|
+
const r = this;
|
|
1987
|
+
return l;
|
|
1988
|
+
function l(a) {
|
|
1989
|
+
return e.enter("labelImage"), e.enter("labelImageMarker"), e.consume(a), e.exit("labelImageMarker"), i;
|
|
1990
|
+
}
|
|
1991
|
+
function i(a) {
|
|
1992
|
+
return a === 91 ? (e.enter("labelMarker"), e.consume(a), e.exit("labelMarker"), e.exit("labelImage"), u) : n(a);
|
|
1993
|
+
}
|
|
1994
|
+
function u(a) {
|
|
1995
|
+
return a === 94 && "_hiddenFootnoteSupport" in r.parser.constructs ? n(a) : t(a);
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
const si = {
|
|
1999
|
+
name: "labelStartLink",
|
|
2000
|
+
resolveAll: tt.resolveAll,
|
|
2001
|
+
tokenize: oi
|
|
2002
|
+
};
|
|
2003
|
+
function oi(e, t, n) {
|
|
2004
|
+
const r = this;
|
|
2005
|
+
return l;
|
|
2006
|
+
function l(u) {
|
|
2007
|
+
return e.enter("labelLink"), e.enter("labelMarker"), e.consume(u), e.exit("labelMarker"), e.exit("labelLink"), i;
|
|
2008
|
+
}
|
|
2009
|
+
function i(u) {
|
|
2010
|
+
return u === 94 && "_hiddenFootnoteSupport" in r.parser.constructs ? n(u) : t(u);
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
const Re = {
|
|
2014
|
+
name: "lineEnding",
|
|
2015
|
+
tokenize: ci
|
|
2016
|
+
};
|
|
2017
|
+
function ci(e, t) {
|
|
2018
|
+
return n;
|
|
2019
|
+
function n(r) {
|
|
2020
|
+
return e.enter("lineEnding"), e.consume(r), e.exit("lineEnding"), D(e, t, "linePrefix");
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
const Ne = {
|
|
2024
|
+
name: "thematicBreak",
|
|
2025
|
+
tokenize: hi
|
|
2026
|
+
};
|
|
2027
|
+
function hi(e, t, n) {
|
|
2028
|
+
let r = 0, l;
|
|
2029
|
+
return i;
|
|
2030
|
+
function i(s) {
|
|
2031
|
+
return e.enter("thematicBreak"), u(s);
|
|
2032
|
+
}
|
|
2033
|
+
function u(s) {
|
|
2034
|
+
return l = s, a(s);
|
|
2035
|
+
}
|
|
2036
|
+
function a(s) {
|
|
2037
|
+
return s === l ? (e.enter("thematicBreakSequence"), f(s)) : r >= 3 && (s === null || E(s)) ? (e.exit("thematicBreak"), t(s)) : n(s);
|
|
2038
|
+
}
|
|
2039
|
+
function f(s) {
|
|
2040
|
+
return s === l ? (e.consume(s), r++, f) : (e.exit("thematicBreakSequence"), P(s) ? D(e, a, "whitespace")(s) : a(s));
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
const $ = {
|
|
2044
|
+
continuation: {
|
|
2045
|
+
tokenize: di
|
|
2046
|
+
},
|
|
2047
|
+
exit: xi,
|
|
2048
|
+
name: "list",
|
|
2049
|
+
tokenize: mi
|
|
2050
|
+
}, pi = {
|
|
2051
|
+
partial: !0,
|
|
2052
|
+
tokenize: yi
|
|
2053
|
+
}, fi = {
|
|
2054
|
+
partial: !0,
|
|
2055
|
+
tokenize: gi
|
|
2056
|
+
};
|
|
2057
|
+
function mi(e, t, n) {
|
|
2058
|
+
const r = this, l = r.events[r.events.length - 1];
|
|
2059
|
+
let i = l && l[1].type === "linePrefix" ? l[2].sliceSerialize(l[1], !0).length : 0, u = 0;
|
|
2060
|
+
return a;
|
|
2061
|
+
function a(o) {
|
|
2062
|
+
const b = r.containerState.type || (o === 42 || o === 43 || o === 45 ? "listUnordered" : "listOrdered");
|
|
2063
|
+
if (b === "listUnordered" ? !r.containerState.marker || o === r.containerState.marker : Qe(o)) {
|
|
2064
|
+
if (r.containerState.type || (r.containerState.type = b, e.enter(b, {
|
|
2065
|
+
_container: !0
|
|
2066
|
+
})), b === "listUnordered")
|
|
2067
|
+
return e.enter("listItemPrefix"), o === 42 || o === 45 ? e.check(Ne, n, s)(o) : s(o);
|
|
2068
|
+
if (!r.interrupt || o === 49)
|
|
2069
|
+
return e.enter("listItemPrefix"), e.enter("listItemValue"), f(o);
|
|
2070
|
+
}
|
|
2071
|
+
return n(o);
|
|
2072
|
+
}
|
|
2073
|
+
function f(o) {
|
|
2074
|
+
return Qe(o) && ++u < 10 ? (e.consume(o), f) : (!r.interrupt || u < 2) && (r.containerState.marker ? o === r.containerState.marker : o === 41 || o === 46) ? (e.exit("listItemValue"), s(o)) : n(o);
|
|
2075
|
+
}
|
|
2076
|
+
function s(o) {
|
|
2077
|
+
return e.enter("listItemMarker"), e.consume(o), e.exit("listItemMarker"), r.containerState.marker = r.containerState.marker || o, e.check(
|
|
2078
|
+
Le,
|
|
2079
|
+
// Can’t be empty when interrupting.
|
|
2080
|
+
r.interrupt ? n : c,
|
|
2081
|
+
e.attempt(pi, d, m)
|
|
2082
|
+
);
|
|
2083
|
+
}
|
|
2084
|
+
function c(o) {
|
|
2085
|
+
return r.containerState.initialBlankLine = !0, i++, d(o);
|
|
2086
|
+
}
|
|
2087
|
+
function m(o) {
|
|
2088
|
+
return P(o) ? (e.enter("listItemPrefixWhitespace"), e.consume(o), e.exit("listItemPrefixWhitespace"), d) : n(o);
|
|
2089
|
+
}
|
|
2090
|
+
function d(o) {
|
|
2091
|
+
return r.containerState.size = i + r.sliceSerialize(e.exit("listItemPrefix"), !0).length, t(o);
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
function di(e, t, n) {
|
|
2095
|
+
const r = this;
|
|
2096
|
+
return r.containerState._closeFlow = void 0, e.check(Le, l, i);
|
|
2097
|
+
function l(a) {
|
|
2098
|
+
return r.containerState.furtherBlankLines = r.containerState.furtherBlankLines || r.containerState.initialBlankLine, D(e, t, "listItemIndent", r.containerState.size + 1)(a);
|
|
2099
|
+
}
|
|
2100
|
+
function i(a) {
|
|
2101
|
+
return r.containerState.furtherBlankLines || !P(a) ? (r.containerState.furtherBlankLines = void 0, r.containerState.initialBlankLine = void 0, u(a)) : (r.containerState.furtherBlankLines = void 0, r.containerState.initialBlankLine = void 0, e.attempt(fi, t, u)(a));
|
|
2102
|
+
}
|
|
2103
|
+
function u(a) {
|
|
2104
|
+
return r.containerState._closeFlow = !0, r.interrupt = void 0, D(e, e.attempt($, t, n), "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(a);
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
function gi(e, t, n) {
|
|
2108
|
+
const r = this;
|
|
2109
|
+
return D(e, l, "listItemIndent", r.containerState.size + 1);
|
|
2110
|
+
function l(i) {
|
|
2111
|
+
const u = r.events[r.events.length - 1];
|
|
2112
|
+
return u && u[1].type === "listItemIndent" && u[2].sliceSerialize(u[1], !0).length === r.containerState.size ? t(i) : n(i);
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
function xi(e) {
|
|
2116
|
+
e.exit(this.containerState.type);
|
|
2117
|
+
}
|
|
2118
|
+
function yi(e, t, n) {
|
|
2119
|
+
const r = this;
|
|
2120
|
+
return D(e, l, "listItemPrefixWhitespace", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 5);
|
|
2121
|
+
function l(i) {
|
|
2122
|
+
const u = r.events[r.events.length - 1];
|
|
2123
|
+
return !P(i) && u && u[1].type === "listItemPrefixWhitespace" ? t(i) : n(i);
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
const bt = {
|
|
2127
|
+
name: "setextUnderline",
|
|
2128
|
+
resolveTo: ki,
|
|
2129
|
+
tokenize: bi
|
|
2130
|
+
};
|
|
2131
|
+
function ki(e, t) {
|
|
2132
|
+
let n = e.length, r, l, i;
|
|
2133
|
+
for (; n--; )
|
|
2134
|
+
if (e[n][0] === "enter") {
|
|
2135
|
+
if (e[n][1].type === "content") {
|
|
2136
|
+
r = n;
|
|
2137
|
+
break;
|
|
2138
|
+
}
|
|
2139
|
+
e[n][1].type === "paragraph" && (l = n);
|
|
2140
|
+
} else
|
|
2141
|
+
e[n][1].type === "content" && e.splice(n, 1), !i && e[n][1].type === "definition" && (i = n);
|
|
2142
|
+
const u = {
|
|
2143
|
+
type: "setextHeading",
|
|
2144
|
+
start: {
|
|
2145
|
+
...e[r][1].start
|
|
2146
|
+
},
|
|
2147
|
+
end: {
|
|
2148
|
+
...e[e.length - 1][1].end
|
|
2149
|
+
}
|
|
2150
|
+
};
|
|
2151
|
+
return e[l][1].type = "setextHeadingText", i ? (e.splice(l, 0, ["enter", u, t]), e.splice(i + 1, 0, ["exit", e[r][1], t]), e[r][1].end = {
|
|
2152
|
+
...e[i][1].end
|
|
2153
|
+
}) : e[r][1] = u, e.push(["exit", u, t]), e;
|
|
2154
|
+
}
|
|
2155
|
+
function bi(e, t, n) {
|
|
2156
|
+
const r = this;
|
|
2157
|
+
let l;
|
|
2158
|
+
return i;
|
|
2159
|
+
function i(s) {
|
|
2160
|
+
let c = r.events.length, m;
|
|
2161
|
+
for (; c--; )
|
|
2162
|
+
if (r.events[c][1].type !== "lineEnding" && r.events[c][1].type !== "linePrefix" && r.events[c][1].type !== "content") {
|
|
2163
|
+
m = r.events[c][1].type === "paragraph";
|
|
2164
|
+
break;
|
|
2165
|
+
}
|
|
2166
|
+
return !r.parser.lazy[r.now().line] && (r.interrupt || m) ? (e.enter("setextHeadingLine"), l = s, u(s)) : n(s);
|
|
2167
|
+
}
|
|
2168
|
+
function u(s) {
|
|
2169
|
+
return e.enter("setextHeadingLineSequence"), a(s);
|
|
2170
|
+
}
|
|
2171
|
+
function a(s) {
|
|
2172
|
+
return s === l ? (e.consume(s), a) : (e.exit("setextHeadingLineSequence"), P(s) ? D(e, f, "lineSuffix")(s) : f(s));
|
|
2173
|
+
}
|
|
2174
|
+
function f(s) {
|
|
2175
|
+
return s === null || E(s) ? (e.exit("setextHeadingLine"), t(s)) : n(s);
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
const wi = {
|
|
2179
|
+
tokenize: Si
|
|
2180
|
+
};
|
|
2181
|
+
function Si(e) {
|
|
2182
|
+
const t = this, n = e.attempt(
|
|
2183
|
+
// Try to parse a blank line.
|
|
2184
|
+
Le,
|
|
2185
|
+
r,
|
|
2186
|
+
// Try to parse initial flow (essentially, only code).
|
|
2187
|
+
e.attempt(this.parser.constructs.flowInitial, l, D(e, e.attempt(this.parser.constructs.flow, l, e.attempt(zr, l)), "linePrefix"))
|
|
2188
|
+
);
|
|
2189
|
+
return n;
|
|
2190
|
+
function r(i) {
|
|
2191
|
+
if (i === null) {
|
|
2192
|
+
e.consume(i);
|
|
2193
|
+
return;
|
|
2194
|
+
}
|
|
2195
|
+
return e.enter("lineEndingBlank"), e.consume(i), e.exit("lineEndingBlank"), t.currentConstruct = void 0, n;
|
|
2196
|
+
}
|
|
2197
|
+
function l(i) {
|
|
2198
|
+
if (i === null) {
|
|
2199
|
+
e.consume(i);
|
|
2200
|
+
return;
|
|
2201
|
+
}
|
|
2202
|
+
return e.enter("lineEnding"), e.consume(i), e.exit("lineEnding"), t.currentConstruct = void 0, n;
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
const Ii = {
|
|
2206
|
+
resolveAll: $t()
|
|
2207
|
+
}, Ei = Qt("string"), Ci = Qt("text");
|
|
2208
|
+
function Qt(e) {
|
|
2209
|
+
return {
|
|
2210
|
+
resolveAll: $t(e === "text" ? Ti : void 0),
|
|
2211
|
+
tokenize: t
|
|
2212
|
+
};
|
|
2213
|
+
function t(n) {
|
|
2214
|
+
const r = this, l = this.parser.constructs[e], i = n.attempt(l, u, a);
|
|
2215
|
+
return u;
|
|
2216
|
+
function u(c) {
|
|
2217
|
+
return s(c) ? i(c) : a(c);
|
|
2218
|
+
}
|
|
2219
|
+
function a(c) {
|
|
2220
|
+
if (c === null) {
|
|
2221
|
+
n.consume(c);
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
return n.enter("data"), n.consume(c), f;
|
|
2225
|
+
}
|
|
2226
|
+
function f(c) {
|
|
2227
|
+
return s(c) ? (n.exit("data"), i(c)) : (n.consume(c), f);
|
|
2228
|
+
}
|
|
2229
|
+
function s(c) {
|
|
2230
|
+
if (c === null)
|
|
2231
|
+
return !0;
|
|
2232
|
+
const m = l[c];
|
|
2233
|
+
let d = -1;
|
|
2234
|
+
if (m)
|
|
2235
|
+
for (; ++d < m.length; ) {
|
|
2236
|
+
const o = m[d];
|
|
2237
|
+
if (!o.previous || o.previous.call(r, r.previous))
|
|
2238
|
+
return !0;
|
|
2239
|
+
}
|
|
2240
|
+
return !1;
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
function $t(e) {
|
|
2245
|
+
return t;
|
|
2246
|
+
function t(n, r) {
|
|
2247
|
+
let l = -1, i;
|
|
2248
|
+
for (; ++l <= n.length; )
|
|
2249
|
+
i === void 0 ? n[l] && n[l][1].type === "data" && (i = l, l++) : (!n[l] || n[l][1].type !== "data") && (l !== i + 2 && (n[i][1].end = n[l - 1][1].end, n.splice(i + 2, l - i - 2), l = i + 2), i = void 0);
|
|
2250
|
+
return e ? e(n, r) : n;
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
function Ti(e, t) {
|
|
2254
|
+
let n = 0;
|
|
2255
|
+
for (; ++n <= e.length; )
|
|
2256
|
+
if ((n === e.length || e[n][1].type === "lineEnding") && e[n - 1][1].type === "data") {
|
|
2257
|
+
const r = e[n - 1][1], l = t.sliceStream(r);
|
|
2258
|
+
let i = l.length, u = -1, a = 0, f;
|
|
2259
|
+
for (; i--; ) {
|
|
2260
|
+
const s = l[i];
|
|
2261
|
+
if (typeof s == "string") {
|
|
2262
|
+
for (u = s.length; s.charCodeAt(u - 1) === 32; )
|
|
2263
|
+
a++, u--;
|
|
2264
|
+
if (u) break;
|
|
2265
|
+
u = -1;
|
|
2266
|
+
} else if (s === -2)
|
|
2267
|
+
f = !0, a++;
|
|
2268
|
+
else if (s !== -1) {
|
|
2269
|
+
i++;
|
|
2270
|
+
break;
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
if (t._contentTypeTextTrailing && n === e.length && (a = 0), a) {
|
|
2274
|
+
const s = {
|
|
2275
|
+
type: n === e.length || f || a < 2 ? "lineSuffix" : "hardBreakTrailing",
|
|
2276
|
+
start: {
|
|
2277
|
+
_bufferIndex: i ? u : r.start._bufferIndex + u,
|
|
2278
|
+
_index: r.start._index + i,
|
|
2279
|
+
line: r.end.line,
|
|
2280
|
+
column: r.end.column - a,
|
|
2281
|
+
offset: r.end.offset - a
|
|
2282
|
+
},
|
|
2283
|
+
end: {
|
|
2284
|
+
...r.end
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
2287
|
+
r.end = {
|
|
2288
|
+
...s.start
|
|
2289
|
+
}, r.start.offset === r.end.offset ? Object.assign(r, s) : (e.splice(n, 0, ["enter", s, t], ["exit", s, t]), n += 2);
|
|
2290
|
+
}
|
|
2291
|
+
n++;
|
|
2292
|
+
}
|
|
2293
|
+
return e;
|
|
2294
|
+
}
|
|
2295
|
+
const zi = {
|
|
2296
|
+
42: $,
|
|
2297
|
+
43: $,
|
|
2298
|
+
45: $,
|
|
2299
|
+
48: $,
|
|
2300
|
+
49: $,
|
|
2301
|
+
50: $,
|
|
2302
|
+
51: $,
|
|
2303
|
+
52: $,
|
|
2304
|
+
53: $,
|
|
2305
|
+
54: $,
|
|
2306
|
+
55: $,
|
|
2307
|
+
56: $,
|
|
2308
|
+
57: $,
|
|
2309
|
+
62: Ot
|
|
2310
|
+
}, Ai = {
|
|
2311
|
+
91: Lr
|
|
2312
|
+
}, Fi = {
|
|
2313
|
+
[-2]: De,
|
|
2314
|
+
[-1]: De,
|
|
2315
|
+
32: De
|
|
2316
|
+
}, Ni = {
|
|
2317
|
+
35: Or,
|
|
2318
|
+
42: Ne,
|
|
2319
|
+
45: [bt, Ne],
|
|
2320
|
+
60: qr,
|
|
2321
|
+
61: bt,
|
|
2322
|
+
95: Ne,
|
|
2323
|
+
96: yt,
|
|
2324
|
+
126: yt
|
|
2325
|
+
}, Pi = {
|
|
2326
|
+
38: Ht,
|
|
2327
|
+
92: jt
|
|
2328
|
+
}, Li = {
|
|
2329
|
+
[-5]: Re,
|
|
2330
|
+
[-4]: Re,
|
|
2331
|
+
[-3]: Re,
|
|
2332
|
+
33: ui,
|
|
2333
|
+
38: Ht,
|
|
2334
|
+
42: $e,
|
|
2335
|
+
60: [sr, Jr],
|
|
2336
|
+
91: si,
|
|
2337
|
+
92: [Rr, jt],
|
|
2338
|
+
93: tt,
|
|
2339
|
+
95: $e,
|
|
2340
|
+
96: wr
|
|
2341
|
+
}, _i = {
|
|
2342
|
+
null: [$e, Ii]
|
|
2343
|
+
}, Bi = {
|
|
2344
|
+
null: [42, 95]
|
|
2345
|
+
}, Di = {
|
|
2346
|
+
null: []
|
|
2347
|
+
}, Ri = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2348
|
+
__proto__: null,
|
|
2349
|
+
attentionMarkers: Bi,
|
|
2350
|
+
contentInitial: Ai,
|
|
2351
|
+
disable: Di,
|
|
2352
|
+
document: zi,
|
|
2353
|
+
flow: Ni,
|
|
2354
|
+
flowInitial: Fi,
|
|
2355
|
+
insideSpan: _i,
|
|
2356
|
+
string: Pi,
|
|
2357
|
+
text: Li
|
|
2358
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2359
|
+
function Mi(e, t, n) {
|
|
2360
|
+
let r = {
|
|
2361
|
+
_bufferIndex: -1,
|
|
2362
|
+
_index: 0,
|
|
2363
|
+
line: n && n.line || 1,
|
|
2364
|
+
column: n && n.column || 1,
|
|
2365
|
+
offset: n && n.offset || 0
|
|
2366
|
+
};
|
|
2367
|
+
const l = {}, i = [];
|
|
2368
|
+
let u = [], a = [];
|
|
2369
|
+
const f = {
|
|
2370
|
+
attempt: L(j),
|
|
2371
|
+
check: L(x),
|
|
2372
|
+
consume: A,
|
|
2373
|
+
enter: w,
|
|
2374
|
+
exit: M,
|
|
2375
|
+
interrupt: L(x, {
|
|
2376
|
+
interrupt: !0
|
|
2377
|
+
})
|
|
2378
|
+
}, s = {
|
|
2379
|
+
code: null,
|
|
2380
|
+
containerState: {},
|
|
2381
|
+
defineSkip: C,
|
|
2382
|
+
events: [],
|
|
2383
|
+
now: b,
|
|
2384
|
+
parser: e,
|
|
2385
|
+
previous: null,
|
|
2386
|
+
sliceSerialize: d,
|
|
2387
|
+
sliceStream: o,
|
|
2388
|
+
write: m
|
|
2389
|
+
};
|
|
2390
|
+
let c = t.tokenize.call(s, f);
|
|
2391
|
+
return t.resolveAll && i.push(t), s;
|
|
2392
|
+
function m(I) {
|
|
2393
|
+
return u = K(u, I), N(), u[u.length - 1] !== null ? [] : (H(t, 0), s.events = et(i, s.events, s), s.events);
|
|
2394
|
+
}
|
|
2395
|
+
function d(I, S) {
|
|
2396
|
+
return ji(o(I), S);
|
|
2397
|
+
}
|
|
2398
|
+
function o(I) {
|
|
2399
|
+
return Oi(u, I);
|
|
2400
|
+
}
|
|
2401
|
+
function b() {
|
|
2402
|
+
const {
|
|
2403
|
+
_bufferIndex: I,
|
|
2404
|
+
_index: S,
|
|
2405
|
+
line: O,
|
|
2406
|
+
column: V,
|
|
2407
|
+
offset: F
|
|
2408
|
+
} = r;
|
|
2409
|
+
return {
|
|
2410
|
+
_bufferIndex: I,
|
|
2411
|
+
_index: S,
|
|
2412
|
+
line: O,
|
|
2413
|
+
column: V,
|
|
2414
|
+
offset: F
|
|
2415
|
+
};
|
|
2416
|
+
}
|
|
2417
|
+
function C(I) {
|
|
2418
|
+
l[I.line] = I.column, R();
|
|
2419
|
+
}
|
|
2420
|
+
function N() {
|
|
2421
|
+
let I;
|
|
2422
|
+
for (; r._index < u.length; ) {
|
|
2423
|
+
const S = u[r._index];
|
|
2424
|
+
if (typeof S == "string")
|
|
2425
|
+
for (I = r._index, r._bufferIndex < 0 && (r._bufferIndex = 0); r._index === I && r._bufferIndex < S.length; )
|
|
2426
|
+
k(S.charCodeAt(r._bufferIndex));
|
|
2427
|
+
else
|
|
2428
|
+
k(S);
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
function k(I) {
|
|
2432
|
+
c = c(I);
|
|
2433
|
+
}
|
|
2434
|
+
function A(I) {
|
|
2435
|
+
E(I) ? (r.line++, r.column = 1, r.offset += I === -3 ? 2 : 1, R()) : I !== -1 && (r.column++, r.offset++), r._bufferIndex < 0 ? r._index++ : (r._bufferIndex++, r._bufferIndex === // Points w/ non-negative `_bufferIndex` reference
|
|
2436
|
+
// strings.
|
|
2437
|
+
/** @type {string} */
|
|
2438
|
+
u[r._index].length && (r._bufferIndex = -1, r._index++)), s.previous = I;
|
|
2439
|
+
}
|
|
2440
|
+
function w(I, S) {
|
|
2441
|
+
const O = S || {};
|
|
2442
|
+
return O.type = I, O.start = b(), s.events.push(["enter", O, s]), a.push(O), O;
|
|
2443
|
+
}
|
|
2444
|
+
function M(I) {
|
|
2445
|
+
const S = a.pop();
|
|
2446
|
+
return S.end = b(), s.events.push(["exit", S, s]), S;
|
|
2447
|
+
}
|
|
2448
|
+
function j(I, S) {
|
|
2449
|
+
H(I, S.from);
|
|
2450
|
+
}
|
|
2451
|
+
function x(I, S) {
|
|
2452
|
+
S.restore();
|
|
2453
|
+
}
|
|
2454
|
+
function L(I, S) {
|
|
2455
|
+
return O;
|
|
2456
|
+
function O(V, F, U) {
|
|
2457
|
+
let q, Z, ie, h;
|
|
2458
|
+
return Array.isArray(V) ? (
|
|
2459
|
+
/* c8 ignore next 1 */
|
|
2460
|
+
le(V)
|
|
2461
|
+
) : "tokenize" in V ? (
|
|
2462
|
+
// Looks like a construct.
|
|
2463
|
+
le([
|
|
2464
|
+
/** @type {Construct} */
|
|
2465
|
+
V
|
|
2466
|
+
])
|
|
2467
|
+
) : G(V);
|
|
2468
|
+
function G(v) {
|
|
2469
|
+
return ye;
|
|
2470
|
+
function ye(se) {
|
|
2471
|
+
const fe = se !== null && v[se], me = se !== null && v.null, ze = [
|
|
2472
|
+
// To do: add more extension tests.
|
|
2473
|
+
/* c8 ignore next 2 */
|
|
2474
|
+
...Array.isArray(fe) ? fe : fe ? [fe] : [],
|
|
2475
|
+
...Array.isArray(me) ? me : me ? [me] : []
|
|
2476
|
+
];
|
|
2477
|
+
return le(ze)(se);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
function le(v) {
|
|
2481
|
+
return q = v, Z = 0, v.length === 0 ? U : p(v[Z]);
|
|
2482
|
+
}
|
|
2483
|
+
function p(v) {
|
|
2484
|
+
return ye;
|
|
2485
|
+
function ye(se) {
|
|
2486
|
+
return h = _(), ie = v, v.partial || (s.currentConstruct = v), v.name && s.parser.constructs.disable.null.includes(v.name) ? he() : v.tokenize.call(
|
|
2487
|
+
// If we do have fields, create an object w/ `context` as its
|
|
2488
|
+
// prototype.
|
|
2489
|
+
// This allows a “live binding”, which is needed for `interrupt`.
|
|
2490
|
+
S ? Object.assign(Object.create(s), S) : s,
|
|
2491
|
+
f,
|
|
2492
|
+
X,
|
|
2493
|
+
he
|
|
2494
|
+
)(se);
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
function X(v) {
|
|
2498
|
+
return I(ie, h), F;
|
|
2499
|
+
}
|
|
2500
|
+
function he(v) {
|
|
2501
|
+
return h.restore(), ++Z < q.length ? p(q[Z]) : U;
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
function H(I, S) {
|
|
2506
|
+
I.resolveAll && !i.includes(I) && i.push(I), I.resolve && re(s.events, S, s.events.length - S, I.resolve(s.events.slice(S), s)), I.resolveTo && (s.events = I.resolveTo(s.events, s));
|
|
2507
|
+
}
|
|
2508
|
+
function _() {
|
|
2509
|
+
const I = b(), S = s.previous, O = s.currentConstruct, V = s.events.length, F = Array.from(a);
|
|
2510
|
+
return {
|
|
2511
|
+
from: V,
|
|
2512
|
+
restore: U
|
|
2513
|
+
};
|
|
2514
|
+
function U() {
|
|
2515
|
+
r = I, s.previous = S, s.currentConstruct = O, s.events.length = V, a = F, R();
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
function R() {
|
|
2519
|
+
r.line in l && r.column < 2 && (r.column = l[r.line], r.offset += l[r.line] - 1);
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
function Oi(e, t) {
|
|
2523
|
+
const n = t.start._index, r = t.start._bufferIndex, l = t.end._index, i = t.end._bufferIndex;
|
|
2524
|
+
let u;
|
|
2525
|
+
if (n === l)
|
|
2526
|
+
u = [e[n].slice(r, i)];
|
|
2527
|
+
else {
|
|
2528
|
+
if (u = e.slice(n, l), r > -1) {
|
|
2529
|
+
const a = u[0];
|
|
2530
|
+
typeof a == "string" ? u[0] = a.slice(r) : u.shift();
|
|
2531
|
+
}
|
|
2532
|
+
i > 0 && u.push(e[l].slice(0, i));
|
|
2533
|
+
}
|
|
2534
|
+
return u;
|
|
2535
|
+
}
|
|
2536
|
+
function ji(e, t) {
|
|
2537
|
+
let n = -1;
|
|
2538
|
+
const r = [];
|
|
2539
|
+
let l;
|
|
2540
|
+
for (; ++n < e.length; ) {
|
|
2541
|
+
const i = e[n];
|
|
2542
|
+
let u;
|
|
2543
|
+
if (typeof i == "string")
|
|
2544
|
+
u = i;
|
|
2545
|
+
else switch (i) {
|
|
2546
|
+
case -5: {
|
|
2547
|
+
u = "\r";
|
|
2548
|
+
break;
|
|
2549
|
+
}
|
|
2550
|
+
case -4: {
|
|
2551
|
+
u = `
|
|
2552
|
+
`;
|
|
2553
|
+
break;
|
|
2554
|
+
}
|
|
2555
|
+
case -3: {
|
|
2556
|
+
u = `\r
|
|
2557
|
+
`;
|
|
2558
|
+
break;
|
|
2559
|
+
}
|
|
2560
|
+
case -2: {
|
|
2561
|
+
u = t ? " " : " ";
|
|
2562
|
+
break;
|
|
2563
|
+
}
|
|
2564
|
+
case -1: {
|
|
2565
|
+
if (!t && l) continue;
|
|
2566
|
+
u = " ";
|
|
2567
|
+
break;
|
|
2568
|
+
}
|
|
2569
|
+
default:
|
|
2570
|
+
u = String.fromCharCode(i);
|
|
2571
|
+
}
|
|
2572
|
+
l = i === -2, r.push(u);
|
|
2573
|
+
}
|
|
2574
|
+
return r.join("");
|
|
2575
|
+
}
|
|
2576
|
+
function Hi(e) {
|
|
2577
|
+
const r = {
|
|
2578
|
+
constructs: (
|
|
2579
|
+
/** @type {FullNormalizedExtension} */
|
|
2580
|
+
Wn([Ri, ...(e || {}).extensions || []])
|
|
2581
|
+
),
|
|
2582
|
+
content: l(tr),
|
|
2583
|
+
defined: [],
|
|
2584
|
+
document: l(rr),
|
|
2585
|
+
flow: l(wi),
|
|
2586
|
+
lazy: {},
|
|
2587
|
+
string: l(Ei),
|
|
2588
|
+
text: l(Ci)
|
|
2589
|
+
};
|
|
2590
|
+
return r;
|
|
2591
|
+
function l(i) {
|
|
2592
|
+
return u;
|
|
2593
|
+
function u(a) {
|
|
2594
|
+
return Mi(r, i, a);
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
function Vi(e) {
|
|
2599
|
+
for (; !Vt(e); )
|
|
2600
|
+
;
|
|
2601
|
+
return e;
|
|
2602
|
+
}
|
|
2603
|
+
const wt = /[\0\t\n\r]/g;
|
|
2604
|
+
function qi() {
|
|
2605
|
+
let e = 1, t = "", n = !0, r;
|
|
2606
|
+
return l;
|
|
2607
|
+
function l(i, u, a) {
|
|
2608
|
+
const f = [];
|
|
2609
|
+
let s, c, m, d, o;
|
|
2610
|
+
for (i = t + (typeof i == "string" ? i.toString() : new TextDecoder(u || void 0).decode(i)), m = 0, t = "", n && (i.charCodeAt(0) === 65279 && m++, n = void 0); m < i.length; ) {
|
|
2611
|
+
if (wt.lastIndex = m, s = wt.exec(i), d = s && s.index !== void 0 ? s.index : i.length, o = i.charCodeAt(d), !s) {
|
|
2612
|
+
t = i.slice(m);
|
|
2613
|
+
break;
|
|
2614
|
+
}
|
|
2615
|
+
if (o === 10 && m === d && r)
|
|
2616
|
+
f.push(-3), r = void 0;
|
|
2617
|
+
else
|
|
2618
|
+
switch (r && (f.push(-5), r = void 0), m < d && (f.push(i.slice(m, d)), e += d - m), o) {
|
|
2619
|
+
case 0: {
|
|
2620
|
+
f.push(65533), e++;
|
|
2621
|
+
break;
|
|
2622
|
+
}
|
|
2623
|
+
case 9: {
|
|
2624
|
+
for (c = Math.ceil(e / 4) * 4, f.push(-2); e++ < c; ) f.push(-1);
|
|
2625
|
+
break;
|
|
2626
|
+
}
|
|
2627
|
+
case 10: {
|
|
2628
|
+
f.push(-4), e = 1;
|
|
2629
|
+
break;
|
|
2630
|
+
}
|
|
2631
|
+
default:
|
|
2632
|
+
r = !0, e = 1;
|
|
2633
|
+
}
|
|
2634
|
+
m = d + 1;
|
|
2635
|
+
}
|
|
2636
|
+
return a && (r && f.push(-5), t && f.push(t), f.push(null)), f;
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
const vi = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
|
|
2640
|
+
function Ui(e) {
|
|
2641
|
+
return e.replace(vi, Qi);
|
|
2642
|
+
}
|
|
2643
|
+
function Qi(e, t, n) {
|
|
2644
|
+
if (t)
|
|
2645
|
+
return t;
|
|
2646
|
+
if (n.charCodeAt(0) === 35) {
|
|
2647
|
+
const l = n.charCodeAt(1), i = l === 120 || l === 88;
|
|
2648
|
+
return Mt(n.slice(i ? 2 : 1), i ? 16 : 10);
|
|
2649
|
+
}
|
|
2650
|
+
return Xe(n) || e;
|
|
2651
|
+
}
|
|
2652
|
+
const Wt = {}.hasOwnProperty;
|
|
2653
|
+
function $i(e, t, n) {
|
|
2654
|
+
return t && typeof t == "object" && (n = t, t = void 0), Wi(n)(Vi(Hi(n).document().write(qi()(e, t, !0))));
|
|
2655
|
+
}
|
|
2656
|
+
function Wi(e) {
|
|
2657
|
+
const t = {
|
|
2658
|
+
transforms: [],
|
|
2659
|
+
canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
|
|
2660
|
+
enter: {
|
|
2661
|
+
autolink: i(ut),
|
|
2662
|
+
autolinkProtocol: _,
|
|
2663
|
+
autolinkEmail: _,
|
|
2664
|
+
atxHeading: i(rt),
|
|
2665
|
+
blockQuote: i(me),
|
|
2666
|
+
characterEscape: _,
|
|
2667
|
+
characterReference: _,
|
|
2668
|
+
codeFenced: i(ze),
|
|
2669
|
+
codeFencedFenceInfo: u,
|
|
2670
|
+
codeFencedFenceMeta: u,
|
|
2671
|
+
codeIndented: i(ze, u),
|
|
2672
|
+
codeText: i(Gt, u),
|
|
2673
|
+
codeTextData: _,
|
|
2674
|
+
data: _,
|
|
2675
|
+
codeFlowValue: _,
|
|
2676
|
+
definition: i(Xt),
|
|
2677
|
+
definitionDestinationString: u,
|
|
2678
|
+
definitionLabelString: u,
|
|
2679
|
+
definitionTitleString: u,
|
|
2680
|
+
emphasis: i(en),
|
|
2681
|
+
hardBreakEscape: i(it),
|
|
2682
|
+
hardBreakTrailing: i(it),
|
|
2683
|
+
htmlFlow: i(lt, u),
|
|
2684
|
+
htmlFlowData: _,
|
|
2685
|
+
htmlText: i(lt, u),
|
|
2686
|
+
htmlTextData: _,
|
|
2687
|
+
image: i(tn),
|
|
2688
|
+
label: u,
|
|
2689
|
+
link: i(ut),
|
|
2690
|
+
listItem: i(nn),
|
|
2691
|
+
listItemValue: d,
|
|
2692
|
+
listOrdered: i(at, m),
|
|
2693
|
+
listUnordered: i(at),
|
|
2694
|
+
paragraph: i(rn),
|
|
2695
|
+
reference: p,
|
|
2696
|
+
referenceString: u,
|
|
2697
|
+
resourceDestinationString: u,
|
|
2698
|
+
resourceTitleString: u,
|
|
2699
|
+
setextHeading: i(rt),
|
|
2700
|
+
strong: i(ln),
|
|
2701
|
+
thematicBreak: i(an)
|
|
2702
|
+
},
|
|
2703
|
+
exit: {
|
|
2704
|
+
atxHeading: f(),
|
|
2705
|
+
atxHeadingSequence: j,
|
|
2706
|
+
autolink: f(),
|
|
2707
|
+
autolinkEmail: fe,
|
|
2708
|
+
autolinkProtocol: se,
|
|
2709
|
+
blockQuote: f(),
|
|
2710
|
+
characterEscapeValue: R,
|
|
2711
|
+
characterReferenceMarkerHexadecimal: he,
|
|
2712
|
+
characterReferenceMarkerNumeric: he,
|
|
2713
|
+
characterReferenceValue: v,
|
|
2714
|
+
characterReference: ye,
|
|
2715
|
+
codeFenced: f(N),
|
|
2716
|
+
codeFencedFence: C,
|
|
2717
|
+
codeFencedFenceInfo: o,
|
|
2718
|
+
codeFencedFenceMeta: b,
|
|
2719
|
+
codeFlowValue: R,
|
|
2720
|
+
codeIndented: f(k),
|
|
2721
|
+
codeText: f(F),
|
|
2722
|
+
codeTextData: R,
|
|
2723
|
+
data: R,
|
|
2724
|
+
definition: f(),
|
|
2725
|
+
definitionDestinationString: M,
|
|
2726
|
+
definitionLabelString: A,
|
|
2727
|
+
definitionTitleString: w,
|
|
2728
|
+
emphasis: f(),
|
|
2729
|
+
hardBreakEscape: f(S),
|
|
2730
|
+
hardBreakTrailing: f(S),
|
|
2731
|
+
htmlFlow: f(O),
|
|
2732
|
+
htmlFlowData: R,
|
|
2733
|
+
htmlText: f(V),
|
|
2734
|
+
htmlTextData: R,
|
|
2735
|
+
image: f(q),
|
|
2736
|
+
label: ie,
|
|
2737
|
+
labelText: Z,
|
|
2738
|
+
lineEnding: I,
|
|
2739
|
+
link: f(U),
|
|
2740
|
+
listItem: f(),
|
|
2741
|
+
listOrdered: f(),
|
|
2742
|
+
listUnordered: f(),
|
|
2743
|
+
paragraph: f(),
|
|
2744
|
+
referenceString: X,
|
|
2745
|
+
resourceDestinationString: h,
|
|
2746
|
+
resourceTitleString: G,
|
|
2747
|
+
resource: le,
|
|
2748
|
+
setextHeading: f(H),
|
|
2749
|
+
setextHeadingLineSequence: L,
|
|
2750
|
+
setextHeadingText: x,
|
|
2751
|
+
strong: f(),
|
|
2752
|
+
thematicBreak: f()
|
|
2753
|
+
}
|
|
2754
|
+
};
|
|
2755
|
+
Yt(t, (e || {}).mdastExtensions || []);
|
|
2756
|
+
const n = {};
|
|
2757
|
+
return r;
|
|
2758
|
+
function r(g) {
|
|
2759
|
+
let y = {
|
|
2760
|
+
type: "root",
|
|
2761
|
+
children: []
|
|
2762
|
+
};
|
|
2763
|
+
const T = {
|
|
2764
|
+
stack: [y],
|
|
2765
|
+
tokenStack: [],
|
|
2766
|
+
config: t,
|
|
2767
|
+
enter: a,
|
|
2768
|
+
exit: s,
|
|
2769
|
+
buffer: u,
|
|
2770
|
+
resume: c,
|
|
2771
|
+
data: n
|
|
2772
|
+
}, z = [];
|
|
2773
|
+
let B = -1;
|
|
2774
|
+
for (; ++B < g.length; )
|
|
2775
|
+
if (g[B][1].type === "listOrdered" || g[B][1].type === "listUnordered")
|
|
2776
|
+
if (g[B][0] === "enter")
|
|
2777
|
+
z.push(B);
|
|
2778
|
+
else {
|
|
2779
|
+
const ee = z.pop();
|
|
2780
|
+
B = l(g, ee, B);
|
|
2781
|
+
}
|
|
2782
|
+
for (B = -1; ++B < g.length; ) {
|
|
2783
|
+
const ee = t[g[B][0]];
|
|
2784
|
+
Wt.call(ee, g[B][1].type) && ee[g[B][1].type].call(Object.assign({
|
|
2785
|
+
sliceSerialize: g[B][2].sliceSerialize
|
|
2786
|
+
}, T), g[B][1]);
|
|
2787
|
+
}
|
|
2788
|
+
if (T.tokenStack.length > 0) {
|
|
2789
|
+
const ee = T.tokenStack[T.tokenStack.length - 1];
|
|
2790
|
+
(ee[1] || St).call(T, void 0, ee[0]);
|
|
2791
|
+
}
|
|
2792
|
+
for (y.position = {
|
|
2793
|
+
start: oe(g.length > 0 ? g[0][1].start : {
|
|
2794
|
+
line: 1,
|
|
2795
|
+
column: 1,
|
|
2796
|
+
offset: 0
|
|
2797
|
+
}),
|
|
2798
|
+
end: oe(g.length > 0 ? g[g.length - 2][1].end : {
|
|
2799
|
+
line: 1,
|
|
2800
|
+
column: 1,
|
|
2801
|
+
offset: 0
|
|
2802
|
+
})
|
|
2803
|
+
}, B = -1; ++B < t.transforms.length; )
|
|
2804
|
+
y = t.transforms[B](y) || y;
|
|
2805
|
+
return y;
|
|
2806
|
+
}
|
|
2807
|
+
function l(g, y, T) {
|
|
2808
|
+
let z = y - 1, B = -1, ee = !1, pe, ue, ke, be;
|
|
2809
|
+
for (; ++z <= T; ) {
|
|
2810
|
+
const Y = g[z];
|
|
2811
|
+
switch (Y[1].type) {
|
|
2812
|
+
case "listUnordered":
|
|
2813
|
+
case "listOrdered":
|
|
2814
|
+
case "blockQuote": {
|
|
2815
|
+
Y[0] === "enter" ? B++ : B--, be = void 0;
|
|
2816
|
+
break;
|
|
2817
|
+
}
|
|
2818
|
+
case "lineEndingBlank": {
|
|
2819
|
+
Y[0] === "enter" && (pe && !be && !B && !ke && (ke = z), be = void 0);
|
|
2820
|
+
break;
|
|
2821
|
+
}
|
|
2822
|
+
case "linePrefix":
|
|
2823
|
+
case "listItemValue":
|
|
2824
|
+
case "listItemMarker":
|
|
2825
|
+
case "listItemPrefix":
|
|
2826
|
+
case "listItemPrefixWhitespace":
|
|
2827
|
+
break;
|
|
2828
|
+
default:
|
|
2829
|
+
be = void 0;
|
|
2830
|
+
}
|
|
2831
|
+
if (!B && Y[0] === "enter" && Y[1].type === "listItemPrefix" || B === -1 && Y[0] === "exit" && (Y[1].type === "listUnordered" || Y[1].type === "listOrdered")) {
|
|
2832
|
+
if (pe) {
|
|
2833
|
+
let de = z;
|
|
2834
|
+
for (ue = void 0; de--; ) {
|
|
2835
|
+
const ae = g[de];
|
|
2836
|
+
if (ae[1].type === "lineEnding" || ae[1].type === "lineEndingBlank") {
|
|
2837
|
+
if (ae[0] === "exit") continue;
|
|
2838
|
+
ue && (g[ue][1].type = "lineEndingBlank", ee = !0), ae[1].type = "lineEnding", ue = de;
|
|
2839
|
+
} else if (!(ae[1].type === "linePrefix" || ae[1].type === "blockQuotePrefix" || ae[1].type === "blockQuotePrefixWhitespace" || ae[1].type === "blockQuoteMarker" || ae[1].type === "listItemIndent")) break;
|
|
2840
|
+
}
|
|
2841
|
+
ke && (!ue || ke < ue) && (pe._spread = !0), pe.end = Object.assign({}, ue ? g[ue][1].start : Y[1].end), g.splice(ue || z, 0, ["exit", pe, Y[2]]), z++, T++;
|
|
2842
|
+
}
|
|
2843
|
+
if (Y[1].type === "listItemPrefix") {
|
|
2844
|
+
const de = {
|
|
2845
|
+
type: "listItem",
|
|
2846
|
+
_spread: !1,
|
|
2847
|
+
start: Object.assign({}, Y[1].start),
|
|
2848
|
+
// @ts-expect-error: we’ll add `end` in a second.
|
|
2849
|
+
end: void 0
|
|
2850
|
+
};
|
|
2851
|
+
pe = de, g.splice(z, 0, ["enter", de, Y[2]]), z++, T++, ke = void 0, be = !0;
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
return g[y][1]._spread = ee, T;
|
|
2856
|
+
}
|
|
2857
|
+
function i(g, y) {
|
|
2858
|
+
return T;
|
|
2859
|
+
function T(z) {
|
|
2860
|
+
a.call(this, g(z), z), y && y.call(this, z);
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
function u() {
|
|
2864
|
+
this.stack.push({
|
|
2865
|
+
type: "fragment",
|
|
2866
|
+
children: []
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
function a(g, y, T) {
|
|
2870
|
+
this.stack[this.stack.length - 1].children.push(g), this.stack.push(g), this.tokenStack.push([y, T || void 0]), g.position = {
|
|
2871
|
+
start: oe(y.start),
|
|
2872
|
+
// @ts-expect-error: `end` will be patched later.
|
|
2873
|
+
end: void 0
|
|
2874
|
+
};
|
|
2875
|
+
}
|
|
2876
|
+
function f(g) {
|
|
2877
|
+
return y;
|
|
2878
|
+
function y(T) {
|
|
2879
|
+
g && g.call(this, T), s.call(this, T);
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
function s(g, y) {
|
|
2883
|
+
const T = this.stack.pop(), z = this.tokenStack.pop();
|
|
2884
|
+
if (z)
|
|
2885
|
+
z[0].type !== g.type && (y ? y.call(this, g, z[0]) : (z[1] || St).call(this, g, z[0]));
|
|
2886
|
+
else throw new Error("Cannot close `" + g.type + "` (" + Ie({
|
|
2887
|
+
start: g.start,
|
|
2888
|
+
end: g.end
|
|
2889
|
+
}) + "): it’s not open");
|
|
2890
|
+
T.position.end = oe(g.end);
|
|
2891
|
+
}
|
|
2892
|
+
function c() {
|
|
2893
|
+
return Qn(this.stack.pop());
|
|
2894
|
+
}
|
|
2895
|
+
function m() {
|
|
2896
|
+
this.data.expectingFirstListItemValue = !0;
|
|
2897
|
+
}
|
|
2898
|
+
function d(g) {
|
|
2899
|
+
if (this.data.expectingFirstListItemValue) {
|
|
2900
|
+
const y = this.stack[this.stack.length - 2];
|
|
2901
|
+
y.start = Number.parseInt(this.sliceSerialize(g), 10), this.data.expectingFirstListItemValue = void 0;
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
function o() {
|
|
2905
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
2906
|
+
y.lang = g;
|
|
2907
|
+
}
|
|
2908
|
+
function b() {
|
|
2909
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
2910
|
+
y.meta = g;
|
|
2911
|
+
}
|
|
2912
|
+
function C() {
|
|
2913
|
+
this.data.flowCodeInside || (this.buffer(), this.data.flowCodeInside = !0);
|
|
2914
|
+
}
|
|
2915
|
+
function N() {
|
|
2916
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
2917
|
+
y.value = g.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""), this.data.flowCodeInside = void 0;
|
|
2918
|
+
}
|
|
2919
|
+
function k() {
|
|
2920
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
2921
|
+
y.value = g.replace(/(\r?\n|\r)$/g, "");
|
|
2922
|
+
}
|
|
2923
|
+
function A(g) {
|
|
2924
|
+
const y = this.resume(), T = this.stack[this.stack.length - 1];
|
|
2925
|
+
T.label = y, T.identifier = ge(this.sliceSerialize(g)).toLowerCase();
|
|
2926
|
+
}
|
|
2927
|
+
function w() {
|
|
2928
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
2929
|
+
y.title = g;
|
|
2930
|
+
}
|
|
2931
|
+
function M() {
|
|
2932
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
2933
|
+
y.url = g;
|
|
2934
|
+
}
|
|
2935
|
+
function j(g) {
|
|
2936
|
+
const y = this.stack[this.stack.length - 1];
|
|
2937
|
+
if (!y.depth) {
|
|
2938
|
+
const T = this.sliceSerialize(g).length;
|
|
2939
|
+
y.depth = T;
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
function x() {
|
|
2943
|
+
this.data.setextHeadingSlurpLineEnding = !0;
|
|
2944
|
+
}
|
|
2945
|
+
function L(g) {
|
|
2946
|
+
const y = this.stack[this.stack.length - 1];
|
|
2947
|
+
y.depth = this.sliceSerialize(g).codePointAt(0) === 61 ? 1 : 2;
|
|
2948
|
+
}
|
|
2949
|
+
function H() {
|
|
2950
|
+
this.data.setextHeadingSlurpLineEnding = void 0;
|
|
2951
|
+
}
|
|
2952
|
+
function _(g) {
|
|
2953
|
+
const T = this.stack[this.stack.length - 1].children;
|
|
2954
|
+
let z = T[T.length - 1];
|
|
2955
|
+
(!z || z.type !== "text") && (z = un(), z.position = {
|
|
2956
|
+
start: oe(g.start),
|
|
2957
|
+
// @ts-expect-error: we’ll add `end` later.
|
|
2958
|
+
end: void 0
|
|
2959
|
+
}, T.push(z)), this.stack.push(z);
|
|
2960
|
+
}
|
|
2961
|
+
function R(g) {
|
|
2962
|
+
const y = this.stack.pop();
|
|
2963
|
+
y.value += this.sliceSerialize(g), y.position.end = oe(g.end);
|
|
2964
|
+
}
|
|
2965
|
+
function I(g) {
|
|
2966
|
+
const y = this.stack[this.stack.length - 1];
|
|
2967
|
+
if (this.data.atHardBreak) {
|
|
2968
|
+
const T = y.children[y.children.length - 1];
|
|
2969
|
+
T.position.end = oe(g.end), this.data.atHardBreak = void 0;
|
|
2970
|
+
return;
|
|
2971
|
+
}
|
|
2972
|
+
!this.data.setextHeadingSlurpLineEnding && t.canContainEols.includes(y.type) && (_.call(this, g), R.call(this, g));
|
|
2973
|
+
}
|
|
2974
|
+
function S() {
|
|
2975
|
+
this.data.atHardBreak = !0;
|
|
2976
|
+
}
|
|
2977
|
+
function O() {
|
|
2978
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
2979
|
+
y.value = g;
|
|
2980
|
+
}
|
|
2981
|
+
function V() {
|
|
2982
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
2983
|
+
y.value = g;
|
|
2984
|
+
}
|
|
2985
|
+
function F() {
|
|
2986
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
2987
|
+
y.value = g;
|
|
2988
|
+
}
|
|
2989
|
+
function U() {
|
|
2990
|
+
const g = this.stack[this.stack.length - 1];
|
|
2991
|
+
if (this.data.inReference) {
|
|
2992
|
+
const y = this.data.referenceType || "shortcut";
|
|
2993
|
+
g.type += "Reference", g.referenceType = y, delete g.url, delete g.title;
|
|
2994
|
+
} else
|
|
2995
|
+
delete g.identifier, delete g.label;
|
|
2996
|
+
this.data.referenceType = void 0;
|
|
2997
|
+
}
|
|
2998
|
+
function q() {
|
|
2999
|
+
const g = this.stack[this.stack.length - 1];
|
|
3000
|
+
if (this.data.inReference) {
|
|
3001
|
+
const y = this.data.referenceType || "shortcut";
|
|
3002
|
+
g.type += "Reference", g.referenceType = y, delete g.url, delete g.title;
|
|
3003
|
+
} else
|
|
3004
|
+
delete g.identifier, delete g.label;
|
|
3005
|
+
this.data.referenceType = void 0;
|
|
3006
|
+
}
|
|
3007
|
+
function Z(g) {
|
|
3008
|
+
const y = this.sliceSerialize(g), T = this.stack[this.stack.length - 2];
|
|
3009
|
+
T.label = Ui(y), T.identifier = ge(y).toLowerCase();
|
|
3010
|
+
}
|
|
3011
|
+
function ie() {
|
|
3012
|
+
const g = this.stack[this.stack.length - 1], y = this.resume(), T = this.stack[this.stack.length - 1];
|
|
3013
|
+
if (this.data.inReference = !0, T.type === "link") {
|
|
3014
|
+
const z = g.children;
|
|
3015
|
+
T.children = z;
|
|
3016
|
+
} else
|
|
3017
|
+
T.alt = y;
|
|
3018
|
+
}
|
|
3019
|
+
function h() {
|
|
3020
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
3021
|
+
y.url = g;
|
|
3022
|
+
}
|
|
3023
|
+
function G() {
|
|
3024
|
+
const g = this.resume(), y = this.stack[this.stack.length - 1];
|
|
3025
|
+
y.title = g;
|
|
3026
|
+
}
|
|
3027
|
+
function le() {
|
|
3028
|
+
this.data.inReference = void 0;
|
|
3029
|
+
}
|
|
3030
|
+
function p() {
|
|
3031
|
+
this.data.referenceType = "collapsed";
|
|
3032
|
+
}
|
|
3033
|
+
function X(g) {
|
|
3034
|
+
const y = this.resume(), T = this.stack[this.stack.length - 1];
|
|
3035
|
+
T.label = y, T.identifier = ge(this.sliceSerialize(g)).toLowerCase(), this.data.referenceType = "full";
|
|
3036
|
+
}
|
|
3037
|
+
function he(g) {
|
|
3038
|
+
this.data.characterReferenceType = g.type;
|
|
3039
|
+
}
|
|
3040
|
+
function v(g) {
|
|
3041
|
+
const y = this.sliceSerialize(g), T = this.data.characterReferenceType;
|
|
3042
|
+
let z;
|
|
3043
|
+
T ? (z = Mt(y, T === "characterReferenceMarkerNumeric" ? 10 : 16), this.data.characterReferenceType = void 0) : z = Xe(y);
|
|
3044
|
+
const B = this.stack[this.stack.length - 1];
|
|
3045
|
+
B.value += z;
|
|
3046
|
+
}
|
|
3047
|
+
function ye(g) {
|
|
3048
|
+
const y = this.stack.pop();
|
|
3049
|
+
y.position.end = oe(g.end);
|
|
3050
|
+
}
|
|
3051
|
+
function se(g) {
|
|
3052
|
+
R.call(this, g);
|
|
3053
|
+
const y = this.stack[this.stack.length - 1];
|
|
3054
|
+
y.url = this.sliceSerialize(g);
|
|
3055
|
+
}
|
|
3056
|
+
function fe(g) {
|
|
3057
|
+
R.call(this, g);
|
|
3058
|
+
const y = this.stack[this.stack.length - 1];
|
|
3059
|
+
y.url = "mailto:" + this.sliceSerialize(g);
|
|
3060
|
+
}
|
|
3061
|
+
function me() {
|
|
3062
|
+
return {
|
|
3063
|
+
type: "blockquote",
|
|
3064
|
+
children: []
|
|
3065
|
+
};
|
|
3066
|
+
}
|
|
3067
|
+
function ze() {
|
|
3068
|
+
return {
|
|
3069
|
+
type: "code",
|
|
3070
|
+
lang: null,
|
|
3071
|
+
meta: null,
|
|
3072
|
+
value: ""
|
|
3073
|
+
};
|
|
3074
|
+
}
|
|
3075
|
+
function Gt() {
|
|
3076
|
+
return {
|
|
3077
|
+
type: "inlineCode",
|
|
3078
|
+
value: ""
|
|
3079
|
+
};
|
|
3080
|
+
}
|
|
3081
|
+
function Xt() {
|
|
3082
|
+
return {
|
|
3083
|
+
type: "definition",
|
|
3084
|
+
identifier: "",
|
|
3085
|
+
label: null,
|
|
3086
|
+
title: null,
|
|
3087
|
+
url: ""
|
|
3088
|
+
};
|
|
3089
|
+
}
|
|
3090
|
+
function en() {
|
|
3091
|
+
return {
|
|
3092
|
+
type: "emphasis",
|
|
3093
|
+
children: []
|
|
3094
|
+
};
|
|
3095
|
+
}
|
|
3096
|
+
function rt() {
|
|
3097
|
+
return {
|
|
3098
|
+
type: "heading",
|
|
3099
|
+
// @ts-expect-error `depth` will be set later.
|
|
3100
|
+
depth: 0,
|
|
3101
|
+
children: []
|
|
3102
|
+
};
|
|
3103
|
+
}
|
|
3104
|
+
function it() {
|
|
3105
|
+
return {
|
|
3106
|
+
type: "break"
|
|
3107
|
+
};
|
|
3108
|
+
}
|
|
3109
|
+
function lt() {
|
|
3110
|
+
return {
|
|
3111
|
+
type: "html",
|
|
3112
|
+
value: ""
|
|
3113
|
+
};
|
|
3114
|
+
}
|
|
3115
|
+
function tn() {
|
|
3116
|
+
return {
|
|
3117
|
+
type: "image",
|
|
3118
|
+
title: null,
|
|
3119
|
+
url: "",
|
|
3120
|
+
alt: null
|
|
3121
|
+
};
|
|
3122
|
+
}
|
|
3123
|
+
function ut() {
|
|
3124
|
+
return {
|
|
3125
|
+
type: "link",
|
|
3126
|
+
title: null,
|
|
3127
|
+
url: "",
|
|
3128
|
+
children: []
|
|
3129
|
+
};
|
|
3130
|
+
}
|
|
3131
|
+
function at(g) {
|
|
3132
|
+
return {
|
|
3133
|
+
type: "list",
|
|
3134
|
+
ordered: g.type === "listOrdered",
|
|
3135
|
+
start: null,
|
|
3136
|
+
spread: g._spread,
|
|
3137
|
+
children: []
|
|
3138
|
+
};
|
|
3139
|
+
}
|
|
3140
|
+
function nn(g) {
|
|
3141
|
+
return {
|
|
3142
|
+
type: "listItem",
|
|
3143
|
+
spread: g._spread,
|
|
3144
|
+
checked: null,
|
|
3145
|
+
children: []
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
function rn() {
|
|
3149
|
+
return {
|
|
3150
|
+
type: "paragraph",
|
|
3151
|
+
children: []
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
function ln() {
|
|
3155
|
+
return {
|
|
3156
|
+
type: "strong",
|
|
3157
|
+
children: []
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
3160
|
+
function un() {
|
|
3161
|
+
return {
|
|
3162
|
+
type: "text",
|
|
3163
|
+
value: ""
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
function an() {
|
|
3167
|
+
return {
|
|
3168
|
+
type: "thematicBreak"
|
|
3169
|
+
};
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
function oe(e) {
|
|
3173
|
+
return {
|
|
3174
|
+
line: e.line,
|
|
3175
|
+
column: e.column,
|
|
3176
|
+
offset: e.offset
|
|
3177
|
+
};
|
|
3178
|
+
}
|
|
3179
|
+
function Yt(e, t) {
|
|
3180
|
+
let n = -1;
|
|
3181
|
+
for (; ++n < t.length; ) {
|
|
3182
|
+
const r = t[n];
|
|
3183
|
+
Array.isArray(r) ? Yt(e, r) : Yi(e, r);
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
function Yi(e, t) {
|
|
3187
|
+
let n;
|
|
3188
|
+
for (n in t)
|
|
3189
|
+
if (Wt.call(t, n))
|
|
3190
|
+
switch (n) {
|
|
3191
|
+
case "canContainEols": {
|
|
3192
|
+
const r = t[n];
|
|
3193
|
+
r && e[n].push(...r);
|
|
3194
|
+
break;
|
|
3195
|
+
}
|
|
3196
|
+
case "transforms": {
|
|
3197
|
+
const r = t[n];
|
|
3198
|
+
r && e[n].push(...r);
|
|
3199
|
+
break;
|
|
3200
|
+
}
|
|
3201
|
+
case "enter":
|
|
3202
|
+
case "exit": {
|
|
3203
|
+
const r = t[n];
|
|
3204
|
+
r && Object.assign(e[n], r);
|
|
3205
|
+
break;
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
function St(e, t) {
|
|
3210
|
+
throw e ? new Error("Cannot close `" + e.type + "` (" + Ie({
|
|
3211
|
+
start: e.start,
|
|
3212
|
+
end: e.end
|
|
3213
|
+
}) + "): a different token (`" + t.type + "`, " + Ie({
|
|
3214
|
+
start: t.start,
|
|
3215
|
+
end: t.end
|
|
3216
|
+
}) + ") is open") : new Error("Cannot close document, a token (`" + t.type + "`, " + Ie({
|
|
3217
|
+
start: t.start,
|
|
3218
|
+
end: t.end
|
|
3219
|
+
}) + ") is still open");
|
|
3220
|
+
}
|
|
3221
|
+
function Ji(e) {
|
|
3222
|
+
const t = this;
|
|
3223
|
+
t.parser = n;
|
|
3224
|
+
function n(r) {
|
|
3225
|
+
return $i(r, {
|
|
3226
|
+
...t.data("settings"),
|
|
3227
|
+
...e,
|
|
3228
|
+
// Note: these options are not in the readme.
|
|
3229
|
+
// The goal is for them to be set by plugins on `data` instead of being
|
|
3230
|
+
// passed by users.
|
|
3231
|
+
extensions: t.data("micromarkExtensions") || [],
|
|
3232
|
+
mdastExtensions: t.data("fromMarkdownExtensions") || []
|
|
3233
|
+
});
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
function Ki(e, t) {
|
|
3237
|
+
const n = {
|
|
3238
|
+
type: "element",
|
|
3239
|
+
tagName: "blockquote",
|
|
3240
|
+
properties: {},
|
|
3241
|
+
children: e.wrap(e.all(t), !0)
|
|
3242
|
+
};
|
|
3243
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3244
|
+
}
|
|
3245
|
+
function Zi(e, t) {
|
|
3246
|
+
const n = { type: "element", tagName: "br", properties: {}, children: [] };
|
|
3247
|
+
return e.patch(t, n), [e.applyData(t, n), { type: "text", value: `
|
|
3248
|
+
` }];
|
|
3249
|
+
}
|
|
3250
|
+
function Gi(e, t) {
|
|
3251
|
+
const n = t.value ? t.value + `
|
|
3252
|
+
` : "", r = {}, l = t.lang ? t.lang.split(/\s+/) : [];
|
|
3253
|
+
l.length > 0 && (r.className = ["language-" + l[0]]);
|
|
3254
|
+
let i = {
|
|
3255
|
+
type: "element",
|
|
3256
|
+
tagName: "code",
|
|
3257
|
+
properties: r,
|
|
3258
|
+
children: [{ type: "text", value: n }]
|
|
3259
|
+
};
|
|
3260
|
+
return t.meta && (i.data = { meta: t.meta }), e.patch(t, i), i = e.applyData(t, i), i = { type: "element", tagName: "pre", properties: {}, children: [i] }, e.patch(t, i), i;
|
|
3261
|
+
}
|
|
3262
|
+
function Xi(e, t) {
|
|
3263
|
+
const n = {
|
|
3264
|
+
type: "element",
|
|
3265
|
+
tagName: "del",
|
|
3266
|
+
properties: {},
|
|
3267
|
+
children: e.all(t)
|
|
3268
|
+
};
|
|
3269
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3270
|
+
}
|
|
3271
|
+
function el(e, t) {
|
|
3272
|
+
const n = {
|
|
3273
|
+
type: "element",
|
|
3274
|
+
tagName: "em",
|
|
3275
|
+
properties: {},
|
|
3276
|
+
children: e.all(t)
|
|
3277
|
+
};
|
|
3278
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3279
|
+
}
|
|
3280
|
+
function tl(e, t) {
|
|
3281
|
+
const n = typeof e.options.clobberPrefix == "string" ? e.options.clobberPrefix : "user-content-", r = String(t.identifier).toUpperCase(), l = xe(r.toLowerCase()), i = e.footnoteOrder.indexOf(r);
|
|
3282
|
+
let u, a = e.footnoteCounts.get(r);
|
|
3283
|
+
a === void 0 ? (a = 0, e.footnoteOrder.push(r), u = e.footnoteOrder.length) : u = i + 1, a += 1, e.footnoteCounts.set(r, a);
|
|
3284
|
+
const f = {
|
|
3285
|
+
type: "element",
|
|
3286
|
+
tagName: "a",
|
|
3287
|
+
properties: {
|
|
3288
|
+
href: "#" + n + "fn-" + l,
|
|
3289
|
+
id: n + "fnref-" + l + (a > 1 ? "-" + a : ""),
|
|
3290
|
+
dataFootnoteRef: !0,
|
|
3291
|
+
ariaDescribedBy: ["footnote-label"]
|
|
3292
|
+
},
|
|
3293
|
+
children: [{ type: "text", value: String(u) }]
|
|
3294
|
+
};
|
|
3295
|
+
e.patch(t, f);
|
|
3296
|
+
const s = {
|
|
3297
|
+
type: "element",
|
|
3298
|
+
tagName: "sup",
|
|
3299
|
+
properties: {},
|
|
3300
|
+
children: [f]
|
|
3301
|
+
};
|
|
3302
|
+
return e.patch(t, s), e.applyData(t, s);
|
|
3303
|
+
}
|
|
3304
|
+
function nl(e, t) {
|
|
3305
|
+
const n = {
|
|
3306
|
+
type: "element",
|
|
3307
|
+
tagName: "h" + t.depth,
|
|
3308
|
+
properties: {},
|
|
3309
|
+
children: e.all(t)
|
|
3310
|
+
};
|
|
3311
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3312
|
+
}
|
|
3313
|
+
function rl(e, t) {
|
|
3314
|
+
if (e.options.allowDangerousHtml) {
|
|
3315
|
+
const n = { type: "raw", value: t.value };
|
|
3316
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
function Jt(e, t) {
|
|
3320
|
+
const n = t.referenceType;
|
|
3321
|
+
let r = "]";
|
|
3322
|
+
if (n === "collapsed" ? r += "[]" : n === "full" && (r += "[" + (t.label || t.identifier) + "]"), t.type === "imageReference")
|
|
3323
|
+
return [{ type: "text", value: "![" + t.alt + r }];
|
|
3324
|
+
const l = e.all(t), i = l[0];
|
|
3325
|
+
i && i.type === "text" ? i.value = "[" + i.value : l.unshift({ type: "text", value: "[" });
|
|
3326
|
+
const u = l[l.length - 1];
|
|
3327
|
+
return u && u.type === "text" ? u.value += r : l.push({ type: "text", value: r }), l;
|
|
3328
|
+
}
|
|
3329
|
+
function il(e, t) {
|
|
3330
|
+
const n = String(t.identifier).toUpperCase(), r = e.definitionById.get(n);
|
|
3331
|
+
if (!r)
|
|
3332
|
+
return Jt(e, t);
|
|
3333
|
+
const l = { src: xe(r.url || ""), alt: t.alt };
|
|
3334
|
+
r.title !== null && r.title !== void 0 && (l.title = r.title);
|
|
3335
|
+
const i = { type: "element", tagName: "img", properties: l, children: [] };
|
|
3336
|
+
return e.patch(t, i), e.applyData(t, i);
|
|
3337
|
+
}
|
|
3338
|
+
function ll(e, t) {
|
|
3339
|
+
const n = { src: xe(t.url) };
|
|
3340
|
+
t.alt !== null && t.alt !== void 0 && (n.alt = t.alt), t.title !== null && t.title !== void 0 && (n.title = t.title);
|
|
3341
|
+
const r = { type: "element", tagName: "img", properties: n, children: [] };
|
|
3342
|
+
return e.patch(t, r), e.applyData(t, r);
|
|
3343
|
+
}
|
|
3344
|
+
function ul(e, t) {
|
|
3345
|
+
const n = { type: "text", value: t.value.replace(/\r?\n|\r/g, " ") };
|
|
3346
|
+
e.patch(t, n);
|
|
3347
|
+
const r = {
|
|
3348
|
+
type: "element",
|
|
3349
|
+
tagName: "code",
|
|
3350
|
+
properties: {},
|
|
3351
|
+
children: [n]
|
|
3352
|
+
};
|
|
3353
|
+
return e.patch(t, r), e.applyData(t, r);
|
|
3354
|
+
}
|
|
3355
|
+
function al(e, t) {
|
|
3356
|
+
const n = String(t.identifier).toUpperCase(), r = e.definitionById.get(n);
|
|
3357
|
+
if (!r)
|
|
3358
|
+
return Jt(e, t);
|
|
3359
|
+
const l = { href: xe(r.url || "") };
|
|
3360
|
+
r.title !== null && r.title !== void 0 && (l.title = r.title);
|
|
3361
|
+
const i = {
|
|
3362
|
+
type: "element",
|
|
3363
|
+
tagName: "a",
|
|
3364
|
+
properties: l,
|
|
3365
|
+
children: e.all(t)
|
|
3366
|
+
};
|
|
3367
|
+
return e.patch(t, i), e.applyData(t, i);
|
|
3368
|
+
}
|
|
3369
|
+
function sl(e, t) {
|
|
3370
|
+
const n = { href: xe(t.url) };
|
|
3371
|
+
t.title !== null && t.title !== void 0 && (n.title = t.title);
|
|
3372
|
+
const r = {
|
|
3373
|
+
type: "element",
|
|
3374
|
+
tagName: "a",
|
|
3375
|
+
properties: n,
|
|
3376
|
+
children: e.all(t)
|
|
3377
|
+
};
|
|
3378
|
+
return e.patch(t, r), e.applyData(t, r);
|
|
3379
|
+
}
|
|
3380
|
+
function ol(e, t, n) {
|
|
3381
|
+
const r = e.all(t), l = n ? cl(n) : Kt(t), i = {}, u = [];
|
|
3382
|
+
if (typeof t.checked == "boolean") {
|
|
3383
|
+
const c = r[0];
|
|
3384
|
+
let m;
|
|
3385
|
+
c && c.type === "element" && c.tagName === "p" ? m = c : (m = { type: "element", tagName: "p", properties: {}, children: [] }, r.unshift(m)), m.children.length > 0 && m.children.unshift({ type: "text", value: " " }), m.children.unshift({
|
|
3386
|
+
type: "element",
|
|
3387
|
+
tagName: "input",
|
|
3388
|
+
properties: { type: "checkbox", checked: t.checked, disabled: !0 },
|
|
3389
|
+
children: []
|
|
3390
|
+
}), i.className = ["task-list-item"];
|
|
3391
|
+
}
|
|
3392
|
+
let a = -1;
|
|
3393
|
+
for (; ++a < r.length; ) {
|
|
3394
|
+
const c = r[a];
|
|
3395
|
+
(l || a !== 0 || c.type !== "element" || c.tagName !== "p") && u.push({ type: "text", value: `
|
|
3396
|
+
` }), c.type === "element" && c.tagName === "p" && !l ? u.push(...c.children) : u.push(c);
|
|
3397
|
+
}
|
|
3398
|
+
const f = r[r.length - 1];
|
|
3399
|
+
f && (l || f.type !== "element" || f.tagName !== "p") && u.push({ type: "text", value: `
|
|
3400
|
+
` });
|
|
3401
|
+
const s = { type: "element", tagName: "li", properties: i, children: u };
|
|
3402
|
+
return e.patch(t, s), e.applyData(t, s);
|
|
3403
|
+
}
|
|
3404
|
+
function cl(e) {
|
|
3405
|
+
let t = !1;
|
|
3406
|
+
if (e.type === "list") {
|
|
3407
|
+
t = e.spread || !1;
|
|
3408
|
+
const n = e.children;
|
|
3409
|
+
let r = -1;
|
|
3410
|
+
for (; !t && ++r < n.length; )
|
|
3411
|
+
t = Kt(n[r]);
|
|
3412
|
+
}
|
|
3413
|
+
return t;
|
|
3414
|
+
}
|
|
3415
|
+
function Kt(e) {
|
|
3416
|
+
const t = e.spread;
|
|
3417
|
+
return t ?? e.children.length > 1;
|
|
3418
|
+
}
|
|
3419
|
+
function hl(e, t) {
|
|
3420
|
+
const n = {}, r = e.all(t);
|
|
3421
|
+
let l = -1;
|
|
3422
|
+
for (typeof t.start == "number" && t.start !== 1 && (n.start = t.start); ++l < r.length; ) {
|
|
3423
|
+
const u = r[l];
|
|
3424
|
+
if (u.type === "element" && u.tagName === "li" && u.properties && Array.isArray(u.properties.className) && u.properties.className.includes("task-list-item")) {
|
|
3425
|
+
n.className = ["contains-task-list"];
|
|
3426
|
+
break;
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
const i = {
|
|
3430
|
+
type: "element",
|
|
3431
|
+
tagName: t.ordered ? "ol" : "ul",
|
|
3432
|
+
properties: n,
|
|
3433
|
+
children: e.wrap(r, !0)
|
|
3434
|
+
};
|
|
3435
|
+
return e.patch(t, i), e.applyData(t, i);
|
|
3436
|
+
}
|
|
3437
|
+
function pl(e, t) {
|
|
3438
|
+
const n = {
|
|
3439
|
+
type: "element",
|
|
3440
|
+
tagName: "p",
|
|
3441
|
+
properties: {},
|
|
3442
|
+
children: e.all(t)
|
|
3443
|
+
};
|
|
3444
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3445
|
+
}
|
|
3446
|
+
function fl(e, t) {
|
|
3447
|
+
const n = { type: "root", children: e.wrap(e.all(t)) };
|
|
3448
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3449
|
+
}
|
|
3450
|
+
function ml(e, t) {
|
|
3451
|
+
const n = {
|
|
3452
|
+
type: "element",
|
|
3453
|
+
tagName: "strong",
|
|
3454
|
+
properties: {},
|
|
3455
|
+
children: e.all(t)
|
|
3456
|
+
};
|
|
3457
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3458
|
+
}
|
|
3459
|
+
function dl(e, t) {
|
|
3460
|
+
const n = e.all(t), r = n.shift(), l = [];
|
|
3461
|
+
if (r) {
|
|
3462
|
+
const u = {
|
|
3463
|
+
type: "element",
|
|
3464
|
+
tagName: "thead",
|
|
3465
|
+
properties: {},
|
|
3466
|
+
children: e.wrap([r], !0)
|
|
3467
|
+
};
|
|
3468
|
+
e.patch(t.children[0], u), l.push(u);
|
|
3469
|
+
}
|
|
3470
|
+
if (n.length > 0) {
|
|
3471
|
+
const u = {
|
|
3472
|
+
type: "element",
|
|
3473
|
+
tagName: "tbody",
|
|
3474
|
+
properties: {},
|
|
3475
|
+
children: e.wrap(n, !0)
|
|
3476
|
+
}, a = Nt(t.children[1]), f = mn(t.children[t.children.length - 1]);
|
|
3477
|
+
a && f && (u.position = { start: a, end: f }), l.push(u);
|
|
3478
|
+
}
|
|
3479
|
+
const i = {
|
|
3480
|
+
type: "element",
|
|
3481
|
+
tagName: "table",
|
|
3482
|
+
properties: {},
|
|
3483
|
+
children: e.wrap(l, !0)
|
|
3484
|
+
};
|
|
3485
|
+
return e.patch(t, i), e.applyData(t, i);
|
|
3486
|
+
}
|
|
3487
|
+
function gl(e, t, n) {
|
|
3488
|
+
const r = n ? n.children : void 0, i = (r ? r.indexOf(t) : 1) === 0 ? "th" : "td", u = n && n.type === "table" ? n.align : void 0, a = u ? u.length : t.children.length;
|
|
3489
|
+
let f = -1;
|
|
3490
|
+
const s = [];
|
|
3491
|
+
for (; ++f < a; ) {
|
|
3492
|
+
const m = t.children[f], d = {}, o = u ? u[f] : void 0;
|
|
3493
|
+
o && (d.align = o);
|
|
3494
|
+
let b = { type: "element", tagName: i, properties: d, children: [] };
|
|
3495
|
+
m && (b.children = e.all(m), e.patch(m, b), b = e.applyData(m, b)), s.push(b);
|
|
3496
|
+
}
|
|
3497
|
+
const c = {
|
|
3498
|
+
type: "element",
|
|
3499
|
+
tagName: "tr",
|
|
3500
|
+
properties: {},
|
|
3501
|
+
children: e.wrap(s, !0)
|
|
3502
|
+
};
|
|
3503
|
+
return e.patch(t, c), e.applyData(t, c);
|
|
3504
|
+
}
|
|
3505
|
+
function xl(e, t) {
|
|
3506
|
+
const n = {
|
|
3507
|
+
type: "element",
|
|
3508
|
+
tagName: "td",
|
|
3509
|
+
// Assume body cell.
|
|
3510
|
+
properties: {},
|
|
3511
|
+
children: e.all(t)
|
|
3512
|
+
};
|
|
3513
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3514
|
+
}
|
|
3515
|
+
function yl(e, t) {
|
|
3516
|
+
const n = { type: "text", value: dn(String(t.value)) };
|
|
3517
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3518
|
+
}
|
|
3519
|
+
function kl(e, t) {
|
|
3520
|
+
const n = {
|
|
3521
|
+
type: "element",
|
|
3522
|
+
tagName: "hr",
|
|
3523
|
+
properties: {},
|
|
3524
|
+
children: []
|
|
3525
|
+
};
|
|
3526
|
+
return e.patch(t, n), e.applyData(t, n);
|
|
3527
|
+
}
|
|
3528
|
+
const bl = {
|
|
3529
|
+
blockquote: Ki,
|
|
3530
|
+
break: Zi,
|
|
3531
|
+
code: Gi,
|
|
3532
|
+
delete: Xi,
|
|
3533
|
+
emphasis: el,
|
|
3534
|
+
footnoteReference: tl,
|
|
3535
|
+
heading: nl,
|
|
3536
|
+
html: rl,
|
|
3537
|
+
imageReference: il,
|
|
3538
|
+
image: ll,
|
|
3539
|
+
inlineCode: ul,
|
|
3540
|
+
linkReference: al,
|
|
3541
|
+
link: sl,
|
|
3542
|
+
listItem: ol,
|
|
3543
|
+
list: hl,
|
|
3544
|
+
paragraph: pl,
|
|
3545
|
+
// @ts-expect-error: root is different, but hard to type.
|
|
3546
|
+
root: fl,
|
|
3547
|
+
strong: ml,
|
|
3548
|
+
table: dl,
|
|
3549
|
+
tableCell: xl,
|
|
3550
|
+
tableRow: gl,
|
|
3551
|
+
text: yl,
|
|
3552
|
+
thematicBreak: kl,
|
|
3553
|
+
toml: Ae,
|
|
3554
|
+
yaml: Ae,
|
|
3555
|
+
definition: Ae,
|
|
3556
|
+
footnoteDefinition: Ae
|
|
3557
|
+
};
|
|
3558
|
+
function Ae() {
|
|
3559
|
+
}
|
|
3560
|
+
function wl(e, t) {
|
|
3561
|
+
const n = [{ type: "text", value: "↩" }];
|
|
3562
|
+
return t > 1 && n.push({
|
|
3563
|
+
type: "element",
|
|
3564
|
+
tagName: "sup",
|
|
3565
|
+
properties: {},
|
|
3566
|
+
children: [{ type: "text", value: String(t) }]
|
|
3567
|
+
}), n;
|
|
3568
|
+
}
|
|
3569
|
+
function Sl(e, t) {
|
|
3570
|
+
return "Back to reference " + (e + 1) + (t > 1 ? "-" + t : "");
|
|
3571
|
+
}
|
|
3572
|
+
function Il(e) {
|
|
3573
|
+
const t = typeof e.options.clobberPrefix == "string" ? e.options.clobberPrefix : "user-content-", n = e.options.footnoteBackContent || wl, r = e.options.footnoteBackLabel || Sl, l = e.options.footnoteLabel || "Footnotes", i = e.options.footnoteLabelTagName || "h2", u = e.options.footnoteLabelProperties || {
|
|
3574
|
+
className: ["sr-only"]
|
|
3575
|
+
}, a = [];
|
|
3576
|
+
let f = -1;
|
|
3577
|
+
for (; ++f < e.footnoteOrder.length; ) {
|
|
3578
|
+
const s = e.footnoteById.get(
|
|
3579
|
+
e.footnoteOrder[f]
|
|
3580
|
+
);
|
|
3581
|
+
if (!s)
|
|
3582
|
+
continue;
|
|
3583
|
+
const c = e.all(s), m = String(s.identifier).toUpperCase(), d = xe(m.toLowerCase());
|
|
3584
|
+
let o = 0;
|
|
3585
|
+
const b = [], C = e.footnoteCounts.get(m);
|
|
3586
|
+
for (; C !== void 0 && ++o <= C; ) {
|
|
3587
|
+
b.length > 0 && b.push({ type: "text", value: " " });
|
|
3588
|
+
let A = typeof n == "string" ? n : n(f, o);
|
|
3589
|
+
typeof A == "string" && (A = { type: "text", value: A }), b.push({
|
|
3590
|
+
type: "element",
|
|
3591
|
+
tagName: "a",
|
|
3592
|
+
properties: {
|
|
3593
|
+
href: "#" + t + "fnref-" + d + (o > 1 ? "-" + o : ""),
|
|
3594
|
+
dataFootnoteBackref: "",
|
|
3595
|
+
ariaLabel: typeof r == "string" ? r : r(f, o),
|
|
3596
|
+
className: ["data-footnote-backref"]
|
|
3597
|
+
},
|
|
3598
|
+
children: Array.isArray(A) ? A : [A]
|
|
3599
|
+
});
|
|
3600
|
+
}
|
|
3601
|
+
const N = c[c.length - 1];
|
|
3602
|
+
if (N && N.type === "element" && N.tagName === "p") {
|
|
3603
|
+
const A = N.children[N.children.length - 1];
|
|
3604
|
+
A && A.type === "text" ? A.value += " " : N.children.push({ type: "text", value: " " }), N.children.push(...b);
|
|
3605
|
+
} else
|
|
3606
|
+
c.push(...b);
|
|
3607
|
+
const k = {
|
|
3608
|
+
type: "element",
|
|
3609
|
+
tagName: "li",
|
|
3610
|
+
properties: { id: t + "fn-" + d },
|
|
3611
|
+
children: e.wrap(c, !0)
|
|
3612
|
+
};
|
|
3613
|
+
e.patch(s, k), a.push(k);
|
|
3614
|
+
}
|
|
3615
|
+
if (a.length !== 0)
|
|
3616
|
+
return {
|
|
3617
|
+
type: "element",
|
|
3618
|
+
tagName: "section",
|
|
3619
|
+
properties: { dataFootnotes: !0, className: ["footnotes"] },
|
|
3620
|
+
children: [
|
|
3621
|
+
{
|
|
3622
|
+
type: "element",
|
|
3623
|
+
tagName: i,
|
|
3624
|
+
properties: {
|
|
3625
|
+
...Pe(u),
|
|
3626
|
+
id: "footnote-label"
|
|
3627
|
+
},
|
|
3628
|
+
children: [{ type: "text", value: l }]
|
|
3629
|
+
},
|
|
3630
|
+
{ type: "text", value: `
|
|
3631
|
+
` },
|
|
3632
|
+
{
|
|
3633
|
+
type: "element",
|
|
3634
|
+
tagName: "ol",
|
|
3635
|
+
properties: {},
|
|
3636
|
+
children: e.wrap(a, !0)
|
|
3637
|
+
},
|
|
3638
|
+
{ type: "text", value: `
|
|
3639
|
+
` }
|
|
3640
|
+
]
|
|
3641
|
+
};
|
|
3642
|
+
}
|
|
3643
|
+
const We = {}.hasOwnProperty, El = {};
|
|
3644
|
+
function Cl(e, t) {
|
|
3645
|
+
const n = t || El, r = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), u = { ...bl, ...n.handlers }, a = {
|
|
3646
|
+
all: s,
|
|
3647
|
+
applyData: zl,
|
|
3648
|
+
definitionById: r,
|
|
3649
|
+
footnoteById: l,
|
|
3650
|
+
footnoteCounts: i,
|
|
3651
|
+
footnoteOrder: [],
|
|
3652
|
+
handlers: u,
|
|
3653
|
+
one: f,
|
|
3654
|
+
options: n,
|
|
3655
|
+
patch: Tl,
|
|
3656
|
+
wrap: Fl
|
|
3657
|
+
};
|
|
3658
|
+
return Pt(e, function(c) {
|
|
3659
|
+
if (c.type === "definition" || c.type === "footnoteDefinition") {
|
|
3660
|
+
const m = c.type === "definition" ? r : l, d = String(c.identifier).toUpperCase();
|
|
3661
|
+
m.has(d) || m.set(d, c);
|
|
3662
|
+
}
|
|
3663
|
+
}), a;
|
|
3664
|
+
function f(c, m) {
|
|
3665
|
+
const d = c.type, o = a.handlers[d];
|
|
3666
|
+
if (We.call(a.handlers, d) && o)
|
|
3667
|
+
return o(a, c, m);
|
|
3668
|
+
if (a.options.passThrough && a.options.passThrough.includes(d)) {
|
|
3669
|
+
if ("children" in c) {
|
|
3670
|
+
const { children: C, ...N } = c, k = Pe(N);
|
|
3671
|
+
return k.children = a.all(c), k;
|
|
3672
|
+
}
|
|
3673
|
+
return Pe(c);
|
|
3674
|
+
}
|
|
3675
|
+
return (a.options.unknownHandler || Al)(a, c, m);
|
|
3676
|
+
}
|
|
3677
|
+
function s(c) {
|
|
3678
|
+
const m = [];
|
|
3679
|
+
if ("children" in c) {
|
|
3680
|
+
const d = c.children;
|
|
3681
|
+
let o = -1;
|
|
3682
|
+
for (; ++o < d.length; ) {
|
|
3683
|
+
const b = a.one(d[o], c);
|
|
3684
|
+
if (b) {
|
|
3685
|
+
if (o && d[o - 1].type === "break" && (!Array.isArray(b) && b.type === "text" && (b.value = It(b.value)), !Array.isArray(b) && b.type === "element")) {
|
|
3686
|
+
const C = b.children[0];
|
|
3687
|
+
C && C.type === "text" && (C.value = It(C.value));
|
|
3688
|
+
}
|
|
3689
|
+
Array.isArray(b) ? m.push(...b) : m.push(b);
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
return m;
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
function Tl(e, t) {
|
|
3697
|
+
e.position && (t.position = gn(e));
|
|
3698
|
+
}
|
|
3699
|
+
function zl(e, t) {
|
|
3700
|
+
let n = t;
|
|
3701
|
+
if (e && e.data) {
|
|
3702
|
+
const r = e.data.hName, l = e.data.hChildren, i = e.data.hProperties;
|
|
3703
|
+
if (typeof r == "string")
|
|
3704
|
+
if (n.type === "element")
|
|
3705
|
+
n.tagName = r;
|
|
3706
|
+
else {
|
|
3707
|
+
const u = "children" in n ? n.children : [n];
|
|
3708
|
+
n = { type: "element", tagName: r, properties: {}, children: u };
|
|
3709
|
+
}
|
|
3710
|
+
n.type === "element" && i && Object.assign(n.properties, Pe(i)), "children" in n && n.children && l !== null && l !== void 0 && (n.children = l);
|
|
3711
|
+
}
|
|
3712
|
+
return n;
|
|
3713
|
+
}
|
|
3714
|
+
function Al(e, t) {
|
|
3715
|
+
const n = t.data || {}, r = "value" in t && !(We.call(n, "hProperties") || We.call(n, "hChildren")) ? { type: "text", value: t.value } : {
|
|
3716
|
+
type: "element",
|
|
3717
|
+
tagName: "div",
|
|
3718
|
+
properties: {},
|
|
3719
|
+
children: e.all(t)
|
|
3720
|
+
};
|
|
3721
|
+
return e.patch(t, r), e.applyData(t, r);
|
|
3722
|
+
}
|
|
3723
|
+
function Fl(e, t) {
|
|
3724
|
+
const n = [];
|
|
3725
|
+
let r = -1;
|
|
3726
|
+
for (t && n.push({ type: "text", value: `
|
|
3727
|
+
` }); ++r < e.length; )
|
|
3728
|
+
r && n.push({ type: "text", value: `
|
|
3729
|
+
` }), n.push(e[r]);
|
|
3730
|
+
return t && e.length > 0 && n.push({ type: "text", value: `
|
|
3731
|
+
` }), n;
|
|
3732
|
+
}
|
|
3733
|
+
function It(e) {
|
|
3734
|
+
let t = 0, n = e.charCodeAt(t);
|
|
3735
|
+
for (; n === 9 || n === 32; )
|
|
3736
|
+
t++, n = e.charCodeAt(t);
|
|
3737
|
+
return e.slice(t);
|
|
3738
|
+
}
|
|
3739
|
+
function Et(e, t) {
|
|
3740
|
+
const n = Cl(e, t), r = n.one(e, void 0), l = Il(n), i = Array.isArray(r) ? { type: "root", children: r } : r || { type: "root", children: [] };
|
|
3741
|
+
return l && i.children.push({ type: "text", value: `
|
|
3742
|
+
` }, l), i;
|
|
3743
|
+
}
|
|
3744
|
+
function Nl(e, t) {
|
|
3745
|
+
return e && "run" in e ? async function(n, r) {
|
|
3746
|
+
const l = (
|
|
3747
|
+
/** @type {HastRoot} */
|
|
3748
|
+
Et(n, { file: r, ...t })
|
|
3749
|
+
);
|
|
3750
|
+
await e.run(l, r);
|
|
3751
|
+
} : function(n, r) {
|
|
3752
|
+
return (
|
|
3753
|
+
/** @type {HastRoot} */
|
|
3754
|
+
Et(n, { file: r, ...e || t })
|
|
3755
|
+
);
|
|
3756
|
+
};
|
|
3757
|
+
}
|
|
3758
|
+
const te = { basename: Pl, dirname: Ll, extname: _l, join: Bl, sep: "/" };
|
|
3759
|
+
function Pl(e, t) {
|
|
3760
|
+
if (t !== void 0 && typeof t != "string")
|
|
3761
|
+
throw new TypeError('"ext" argument must be a string');
|
|
3762
|
+
Te(e);
|
|
3763
|
+
let n = 0, r = -1, l = e.length, i;
|
|
3764
|
+
if (t === void 0 || t.length === 0 || t.length > e.length) {
|
|
3765
|
+
for (; l--; )
|
|
3766
|
+
if (e.codePointAt(l) === 47) {
|
|
3767
|
+
if (i) {
|
|
3768
|
+
n = l + 1;
|
|
3769
|
+
break;
|
|
3770
|
+
}
|
|
3771
|
+
} else r < 0 && (i = !0, r = l + 1);
|
|
3772
|
+
return r < 0 ? "" : e.slice(n, r);
|
|
3773
|
+
}
|
|
3774
|
+
if (t === e)
|
|
3775
|
+
return "";
|
|
3776
|
+
let u = -1, a = t.length - 1;
|
|
3777
|
+
for (; l--; )
|
|
3778
|
+
if (e.codePointAt(l) === 47) {
|
|
3779
|
+
if (i) {
|
|
3780
|
+
n = l + 1;
|
|
3781
|
+
break;
|
|
3782
|
+
}
|
|
3783
|
+
} else
|
|
3784
|
+
u < 0 && (i = !0, u = l + 1), a > -1 && (e.codePointAt(l) === t.codePointAt(a--) ? a < 0 && (r = l) : (a = -1, r = u));
|
|
3785
|
+
return n === r ? r = u : r < 0 && (r = e.length), e.slice(n, r);
|
|
3786
|
+
}
|
|
3787
|
+
function Ll(e) {
|
|
3788
|
+
if (Te(e), e.length === 0)
|
|
3789
|
+
return ".";
|
|
3790
|
+
let t = -1, n = e.length, r;
|
|
3791
|
+
for (; --n; )
|
|
3792
|
+
if (e.codePointAt(n) === 47) {
|
|
3793
|
+
if (r) {
|
|
3794
|
+
t = n;
|
|
3795
|
+
break;
|
|
3796
|
+
}
|
|
3797
|
+
} else r || (r = !0);
|
|
3798
|
+
return t < 0 ? e.codePointAt(0) === 47 ? "/" : "." : t === 1 && e.codePointAt(0) === 47 ? "//" : e.slice(0, t);
|
|
3799
|
+
}
|
|
3800
|
+
function _l(e) {
|
|
3801
|
+
Te(e);
|
|
3802
|
+
let t = e.length, n = -1, r = 0, l = -1, i = 0, u;
|
|
3803
|
+
for (; t--; ) {
|
|
3804
|
+
const a = e.codePointAt(t);
|
|
3805
|
+
if (a === 47) {
|
|
3806
|
+
if (u) {
|
|
3807
|
+
r = t + 1;
|
|
3808
|
+
break;
|
|
3809
|
+
}
|
|
3810
|
+
continue;
|
|
3811
|
+
}
|
|
3812
|
+
n < 0 && (u = !0, n = t + 1), a === 46 ? l < 0 ? l = t : i !== 1 && (i = 1) : l > -1 && (i = -1);
|
|
3813
|
+
}
|
|
3814
|
+
return l < 0 || n < 0 || // We saw a non-dot character immediately before the dot.
|
|
3815
|
+
i === 0 || // The (right-most) trimmed path component is exactly `..`.
|
|
3816
|
+
i === 1 && l === n - 1 && l === r + 1 ? "" : e.slice(l, n);
|
|
3817
|
+
}
|
|
3818
|
+
function Bl(...e) {
|
|
3819
|
+
let t = -1, n;
|
|
3820
|
+
for (; ++t < e.length; )
|
|
3821
|
+
Te(e[t]), e[t] && (n = n === void 0 ? e[t] : n + "/" + e[t]);
|
|
3822
|
+
return n === void 0 ? "." : Dl(n);
|
|
3823
|
+
}
|
|
3824
|
+
function Dl(e) {
|
|
3825
|
+
Te(e);
|
|
3826
|
+
const t = e.codePointAt(0) === 47;
|
|
3827
|
+
let n = Rl(e, !t);
|
|
3828
|
+
return n.length === 0 && !t && (n = "."), n.length > 0 && e.codePointAt(e.length - 1) === 47 && (n += "/"), t ? "/" + n : n;
|
|
3829
|
+
}
|
|
3830
|
+
function Rl(e, t) {
|
|
3831
|
+
let n = "", r = 0, l = -1, i = 0, u = -1, a, f;
|
|
3832
|
+
for (; ++u <= e.length; ) {
|
|
3833
|
+
if (u < e.length)
|
|
3834
|
+
a = e.codePointAt(u);
|
|
3835
|
+
else {
|
|
3836
|
+
if (a === 47)
|
|
3837
|
+
break;
|
|
3838
|
+
a = 47;
|
|
3839
|
+
}
|
|
3840
|
+
if (a === 47) {
|
|
3841
|
+
if (!(l === u - 1 || i === 1)) if (l !== u - 1 && i === 2) {
|
|
3842
|
+
if (n.length < 2 || r !== 2 || n.codePointAt(n.length - 1) !== 46 || n.codePointAt(n.length - 2) !== 46) {
|
|
3843
|
+
if (n.length > 2) {
|
|
3844
|
+
if (f = n.lastIndexOf("/"), f !== n.length - 1) {
|
|
3845
|
+
f < 0 ? (n = "", r = 0) : (n = n.slice(0, f), r = n.length - 1 - n.lastIndexOf("/")), l = u, i = 0;
|
|
3846
|
+
continue;
|
|
3847
|
+
}
|
|
3848
|
+
} else if (n.length > 0) {
|
|
3849
|
+
n = "", r = 0, l = u, i = 0;
|
|
3850
|
+
continue;
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
t && (n = n.length > 0 ? n + "/.." : "..", r = 2);
|
|
3854
|
+
} else
|
|
3855
|
+
n.length > 0 ? n += "/" + e.slice(l + 1, u) : n = e.slice(l + 1, u), r = u - l - 1;
|
|
3856
|
+
l = u, i = 0;
|
|
3857
|
+
} else a === 46 && i > -1 ? i++ : i = -1;
|
|
3858
|
+
}
|
|
3859
|
+
return n;
|
|
3860
|
+
}
|
|
3861
|
+
function Te(e) {
|
|
3862
|
+
if (typeof e != "string")
|
|
3863
|
+
throw new TypeError(
|
|
3864
|
+
"Path must be a string. Received " + JSON.stringify(e)
|
|
3865
|
+
);
|
|
3866
|
+
}
|
|
3867
|
+
const Ml = { cwd: Ol };
|
|
3868
|
+
function Ol() {
|
|
3869
|
+
return "/";
|
|
3870
|
+
}
|
|
3871
|
+
function Ye(e) {
|
|
3872
|
+
return !!(e !== null && typeof e == "object" && "href" in e && e.href && "protocol" in e && e.protocol && // @ts-expect-error: indexing is fine.
|
|
3873
|
+
e.auth === void 0);
|
|
3874
|
+
}
|
|
3875
|
+
function jl(e) {
|
|
3876
|
+
if (typeof e == "string")
|
|
3877
|
+
e = new URL(e);
|
|
3878
|
+
else if (!Ye(e)) {
|
|
3879
|
+
const t = new TypeError(
|
|
3880
|
+
'The "path" argument must be of type string or an instance of URL. Received `' + e + "`"
|
|
3881
|
+
);
|
|
3882
|
+
throw t.code = "ERR_INVALID_ARG_TYPE", t;
|
|
3883
|
+
}
|
|
3884
|
+
if (e.protocol !== "file:") {
|
|
3885
|
+
const t = new TypeError("The URL must be of scheme file");
|
|
3886
|
+
throw t.code = "ERR_INVALID_URL_SCHEME", t;
|
|
3887
|
+
}
|
|
3888
|
+
return Hl(e);
|
|
3889
|
+
}
|
|
3890
|
+
function Hl(e) {
|
|
3891
|
+
if (e.hostname !== "") {
|
|
3892
|
+
const r = new TypeError(
|
|
3893
|
+
'File URL host must be "localhost" or empty on darwin'
|
|
3894
|
+
);
|
|
3895
|
+
throw r.code = "ERR_INVALID_FILE_URL_HOST", r;
|
|
3896
|
+
}
|
|
3897
|
+
const t = e.pathname;
|
|
3898
|
+
let n = -1;
|
|
3899
|
+
for (; ++n < t.length; )
|
|
3900
|
+
if (t.codePointAt(n) === 37 && t.codePointAt(n + 1) === 50) {
|
|
3901
|
+
const r = t.codePointAt(n + 2);
|
|
3902
|
+
if (r === 70 || r === 102) {
|
|
3903
|
+
const l = new TypeError(
|
|
3904
|
+
"File URL path must not include encoded / characters"
|
|
3905
|
+
);
|
|
3906
|
+
throw l.code = "ERR_INVALID_FILE_URL_PATH", l;
|
|
3907
|
+
}
|
|
3908
|
+
}
|
|
3909
|
+
return decodeURIComponent(t);
|
|
3910
|
+
}
|
|
3911
|
+
const Me = (
|
|
3912
|
+
/** @type {const} */
|
|
3913
|
+
[
|
|
3914
|
+
"history",
|
|
3915
|
+
"path",
|
|
3916
|
+
"basename",
|
|
3917
|
+
"stem",
|
|
3918
|
+
"extname",
|
|
3919
|
+
"dirname"
|
|
3920
|
+
]
|
|
3921
|
+
);
|
|
3922
|
+
class Zt {
|
|
3923
|
+
/**
|
|
3924
|
+
* Create a new virtual file.
|
|
3925
|
+
*
|
|
3926
|
+
* `options` is treated as:
|
|
3927
|
+
*
|
|
3928
|
+
* * `string` or `Uint8Array` — `{value: options}`
|
|
3929
|
+
* * `URL` — `{path: options}`
|
|
3930
|
+
* * `VFile` — shallow copies its data over to the new file
|
|
3931
|
+
* * `object` — all fields are shallow copied over to the new file
|
|
3932
|
+
*
|
|
3933
|
+
* Path related fields are set in the following order (least specific to
|
|
3934
|
+
* most specific): `history`, `path`, `basename`, `stem`, `extname`,
|
|
3935
|
+
* `dirname`.
|
|
3936
|
+
*
|
|
3937
|
+
* You cannot set `dirname` or `extname` without setting either `history`,
|
|
3938
|
+
* `path`, `basename`, or `stem` too.
|
|
3939
|
+
*
|
|
3940
|
+
* @param {Compatible | null | undefined} [value]
|
|
3941
|
+
* File value.
|
|
3942
|
+
* @returns
|
|
3943
|
+
* New instance.
|
|
3944
|
+
*/
|
|
3945
|
+
constructor(t) {
|
|
3946
|
+
let n;
|
|
3947
|
+
t ? Ye(t) ? n = { path: t } : typeof t == "string" || Vl(t) ? n = { value: t } : n = t : n = {}, this.cwd = "cwd" in n ? "" : Ml.cwd(), this.data = {}, this.history = [], this.messages = [], this.value, this.map, this.result, this.stored;
|
|
3948
|
+
let r = -1;
|
|
3949
|
+
for (; ++r < Me.length; ) {
|
|
3950
|
+
const i = Me[r];
|
|
3951
|
+
i in n && n[i] !== void 0 && n[i] !== null && (this[i] = i === "history" ? [...n[i]] : n[i]);
|
|
3952
|
+
}
|
|
3953
|
+
let l;
|
|
3954
|
+
for (l in n)
|
|
3955
|
+
Me.includes(l) || (this[l] = n[l]);
|
|
3956
|
+
}
|
|
3957
|
+
/**
|
|
3958
|
+
* Get the basename (including extname) (example: `'index.min.js'`).
|
|
3959
|
+
*
|
|
3960
|
+
* @returns {string | undefined}
|
|
3961
|
+
* Basename.
|
|
3962
|
+
*/
|
|
3963
|
+
get basename() {
|
|
3964
|
+
return typeof this.path == "string" ? te.basename(this.path) : void 0;
|
|
3965
|
+
}
|
|
3966
|
+
/**
|
|
3967
|
+
* Set basename (including extname) (`'index.min.js'`).
|
|
3968
|
+
*
|
|
3969
|
+
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
|
3970
|
+
* on windows).
|
|
3971
|
+
* Cannot be nullified (use `file.path = file.dirname` instead).
|
|
3972
|
+
*
|
|
3973
|
+
* @param {string} basename
|
|
3974
|
+
* Basename.
|
|
3975
|
+
* @returns {undefined}
|
|
3976
|
+
* Nothing.
|
|
3977
|
+
*/
|
|
3978
|
+
set basename(t) {
|
|
3979
|
+
je(t, "basename"), Oe(t, "basename"), this.path = te.join(this.dirname || "", t);
|
|
3980
|
+
}
|
|
3981
|
+
/**
|
|
3982
|
+
* Get the parent path (example: `'~'`).
|
|
3983
|
+
*
|
|
3984
|
+
* @returns {string | undefined}
|
|
3985
|
+
* Dirname.
|
|
3986
|
+
*/
|
|
3987
|
+
get dirname() {
|
|
3988
|
+
return typeof this.path == "string" ? te.dirname(this.path) : void 0;
|
|
3989
|
+
}
|
|
3990
|
+
/**
|
|
3991
|
+
* Set the parent path (example: `'~'`).
|
|
3992
|
+
*
|
|
3993
|
+
* Cannot be set if there’s no `path` yet.
|
|
3994
|
+
*
|
|
3995
|
+
* @param {string | undefined} dirname
|
|
3996
|
+
* Dirname.
|
|
3997
|
+
* @returns {undefined}
|
|
3998
|
+
* Nothing.
|
|
3999
|
+
*/
|
|
4000
|
+
set dirname(t) {
|
|
4001
|
+
Ct(this.basename, "dirname"), this.path = te.join(t || "", this.basename);
|
|
4002
|
+
}
|
|
4003
|
+
/**
|
|
4004
|
+
* Get the extname (including dot) (example: `'.js'`).
|
|
4005
|
+
*
|
|
4006
|
+
* @returns {string | undefined}
|
|
4007
|
+
* Extname.
|
|
4008
|
+
*/
|
|
4009
|
+
get extname() {
|
|
4010
|
+
return typeof this.path == "string" ? te.extname(this.path) : void 0;
|
|
4011
|
+
}
|
|
4012
|
+
/**
|
|
4013
|
+
* Set the extname (including dot) (example: `'.js'`).
|
|
4014
|
+
*
|
|
4015
|
+
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
|
4016
|
+
* on windows).
|
|
4017
|
+
* Cannot be set if there’s no `path` yet.
|
|
4018
|
+
*
|
|
4019
|
+
* @param {string | undefined} extname
|
|
4020
|
+
* Extname.
|
|
4021
|
+
* @returns {undefined}
|
|
4022
|
+
* Nothing.
|
|
4023
|
+
*/
|
|
4024
|
+
set extname(t) {
|
|
4025
|
+
if (Oe(t, "extname"), Ct(this.dirname, "extname"), t) {
|
|
4026
|
+
if (t.codePointAt(0) !== 46)
|
|
4027
|
+
throw new Error("`extname` must start with `.`");
|
|
4028
|
+
if (t.includes(".", 1))
|
|
4029
|
+
throw new Error("`extname` cannot contain multiple dots");
|
|
4030
|
+
}
|
|
4031
|
+
this.path = te.join(this.dirname, this.stem + (t || ""));
|
|
4032
|
+
}
|
|
4033
|
+
/**
|
|
4034
|
+
* Get the full path (example: `'~/index.min.js'`).
|
|
4035
|
+
*
|
|
4036
|
+
* @returns {string}
|
|
4037
|
+
* Path.
|
|
4038
|
+
*/
|
|
4039
|
+
get path() {
|
|
4040
|
+
return this.history[this.history.length - 1];
|
|
4041
|
+
}
|
|
4042
|
+
/**
|
|
4043
|
+
* Set the full path (example: `'~/index.min.js'`).
|
|
4044
|
+
*
|
|
4045
|
+
* Cannot be nullified.
|
|
4046
|
+
* You can set a file URL (a `URL` object with a `file:` protocol) which will
|
|
4047
|
+
* be turned into a path with `url.fileURLToPath`.
|
|
4048
|
+
*
|
|
4049
|
+
* @param {URL | string} path
|
|
4050
|
+
* Path.
|
|
4051
|
+
* @returns {undefined}
|
|
4052
|
+
* Nothing.
|
|
4053
|
+
*/
|
|
4054
|
+
set path(t) {
|
|
4055
|
+
Ye(t) && (t = jl(t)), je(t, "path"), this.path !== t && this.history.push(t);
|
|
4056
|
+
}
|
|
4057
|
+
/**
|
|
4058
|
+
* Get the stem (basename w/o extname) (example: `'index.min'`).
|
|
4059
|
+
*
|
|
4060
|
+
* @returns {string | undefined}
|
|
4061
|
+
* Stem.
|
|
4062
|
+
*/
|
|
4063
|
+
get stem() {
|
|
4064
|
+
return typeof this.path == "string" ? te.basename(this.path, this.extname) : void 0;
|
|
4065
|
+
}
|
|
4066
|
+
/**
|
|
4067
|
+
* Set the stem (basename w/o extname) (example: `'index.min'`).
|
|
4068
|
+
*
|
|
4069
|
+
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
|
4070
|
+
* on windows).
|
|
4071
|
+
* Cannot be nullified (use `file.path = file.dirname` instead).
|
|
4072
|
+
*
|
|
4073
|
+
* @param {string} stem
|
|
4074
|
+
* Stem.
|
|
4075
|
+
* @returns {undefined}
|
|
4076
|
+
* Nothing.
|
|
4077
|
+
*/
|
|
4078
|
+
set stem(t) {
|
|
4079
|
+
je(t, "stem"), Oe(t, "stem"), this.path = te.join(this.dirname || "", t + (this.extname || ""));
|
|
4080
|
+
}
|
|
4081
|
+
// Normal prototypal methods.
|
|
4082
|
+
/**
|
|
4083
|
+
* Create a fatal message for `reason` associated with the file.
|
|
4084
|
+
*
|
|
4085
|
+
* The `fatal` field of the message is set to `true` (error; file not usable)
|
|
4086
|
+
* and the `file` field is set to the current file path.
|
|
4087
|
+
* The message is added to the `messages` field on `file`.
|
|
4088
|
+
*
|
|
4089
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
4090
|
+
*
|
|
4091
|
+
* @overload
|
|
4092
|
+
* @param {string} reason
|
|
4093
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
4094
|
+
* @returns {never}
|
|
4095
|
+
*
|
|
4096
|
+
* @overload
|
|
4097
|
+
* @param {string} reason
|
|
4098
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
4099
|
+
* @param {string | null | undefined} [origin]
|
|
4100
|
+
* @returns {never}
|
|
4101
|
+
*
|
|
4102
|
+
* @overload
|
|
4103
|
+
* @param {string} reason
|
|
4104
|
+
* @param {Point | Position | null | undefined} place
|
|
4105
|
+
* @param {string | null | undefined} [origin]
|
|
4106
|
+
* @returns {never}
|
|
4107
|
+
*
|
|
4108
|
+
* @overload
|
|
4109
|
+
* @param {string} reason
|
|
4110
|
+
* @param {string | null | undefined} [origin]
|
|
4111
|
+
* @returns {never}
|
|
4112
|
+
*
|
|
4113
|
+
* @overload
|
|
4114
|
+
* @param {Error | VFileMessage} cause
|
|
4115
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
4116
|
+
* @param {string | null | undefined} [origin]
|
|
4117
|
+
* @returns {never}
|
|
4118
|
+
*
|
|
4119
|
+
* @overload
|
|
4120
|
+
* @param {Error | VFileMessage} cause
|
|
4121
|
+
* @param {Point | Position | null | undefined} place
|
|
4122
|
+
* @param {string | null | undefined} [origin]
|
|
4123
|
+
* @returns {never}
|
|
4124
|
+
*
|
|
4125
|
+
* @overload
|
|
4126
|
+
* @param {Error | VFileMessage} cause
|
|
4127
|
+
* @param {string | null | undefined} [origin]
|
|
4128
|
+
* @returns {never}
|
|
4129
|
+
*
|
|
4130
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
4131
|
+
* Reason for message, should use markdown.
|
|
4132
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
4133
|
+
* Configuration (optional).
|
|
4134
|
+
* @param {string | null | undefined} [origin]
|
|
4135
|
+
* Place in code where the message originates (example:
|
|
4136
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
4137
|
+
* @returns {never}
|
|
4138
|
+
* Never.
|
|
4139
|
+
* @throws {VFileMessage}
|
|
4140
|
+
* Message.
|
|
4141
|
+
*/
|
|
4142
|
+
fail(t, n, r) {
|
|
4143
|
+
const l = this.message(t, n, r);
|
|
4144
|
+
throw l.fatal = !0, l;
|
|
4145
|
+
}
|
|
4146
|
+
/**
|
|
4147
|
+
* Create an info message for `reason` associated with the file.
|
|
4148
|
+
*
|
|
4149
|
+
* The `fatal` field of the message is set to `undefined` (info; change
|
|
4150
|
+
* likely not needed) and the `file` field is set to the current file path.
|
|
4151
|
+
* The message is added to the `messages` field on `file`.
|
|
4152
|
+
*
|
|
4153
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
4154
|
+
*
|
|
4155
|
+
* @overload
|
|
4156
|
+
* @param {string} reason
|
|
4157
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
4158
|
+
* @returns {VFileMessage}
|
|
4159
|
+
*
|
|
4160
|
+
* @overload
|
|
4161
|
+
* @param {string} reason
|
|
4162
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
4163
|
+
* @param {string | null | undefined} [origin]
|
|
4164
|
+
* @returns {VFileMessage}
|
|
4165
|
+
*
|
|
4166
|
+
* @overload
|
|
4167
|
+
* @param {string} reason
|
|
4168
|
+
* @param {Point | Position | null | undefined} place
|
|
4169
|
+
* @param {string | null | undefined} [origin]
|
|
4170
|
+
* @returns {VFileMessage}
|
|
4171
|
+
*
|
|
4172
|
+
* @overload
|
|
4173
|
+
* @param {string} reason
|
|
4174
|
+
* @param {string | null | undefined} [origin]
|
|
4175
|
+
* @returns {VFileMessage}
|
|
4176
|
+
*
|
|
4177
|
+
* @overload
|
|
4178
|
+
* @param {Error | VFileMessage} cause
|
|
4179
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
4180
|
+
* @param {string | null | undefined} [origin]
|
|
4181
|
+
* @returns {VFileMessage}
|
|
4182
|
+
*
|
|
4183
|
+
* @overload
|
|
4184
|
+
* @param {Error | VFileMessage} cause
|
|
4185
|
+
* @param {Point | Position | null | undefined} place
|
|
4186
|
+
* @param {string | null | undefined} [origin]
|
|
4187
|
+
* @returns {VFileMessage}
|
|
4188
|
+
*
|
|
4189
|
+
* @overload
|
|
4190
|
+
* @param {Error | VFileMessage} cause
|
|
4191
|
+
* @param {string | null | undefined} [origin]
|
|
4192
|
+
* @returns {VFileMessage}
|
|
4193
|
+
*
|
|
4194
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
4195
|
+
* Reason for message, should use markdown.
|
|
4196
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
4197
|
+
* Configuration (optional).
|
|
4198
|
+
* @param {string | null | undefined} [origin]
|
|
4199
|
+
* Place in code where the message originates (example:
|
|
4200
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
4201
|
+
* @returns {VFileMessage}
|
|
4202
|
+
* Message.
|
|
4203
|
+
*/
|
|
4204
|
+
info(t, n, r) {
|
|
4205
|
+
const l = this.message(t, n, r);
|
|
4206
|
+
return l.fatal = void 0, l;
|
|
4207
|
+
}
|
|
4208
|
+
/**
|
|
4209
|
+
* Create a message for `reason` associated with the file.
|
|
4210
|
+
*
|
|
4211
|
+
* The `fatal` field of the message is set to `false` (warning; change may be
|
|
4212
|
+
* needed) and the `file` field is set to the current file path.
|
|
4213
|
+
* The message is added to the `messages` field on `file`.
|
|
4214
|
+
*
|
|
4215
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
4216
|
+
*
|
|
4217
|
+
* @overload
|
|
4218
|
+
* @param {string} reason
|
|
4219
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
4220
|
+
* @returns {VFileMessage}
|
|
4221
|
+
*
|
|
4222
|
+
* @overload
|
|
4223
|
+
* @param {string} reason
|
|
4224
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
4225
|
+
* @param {string | null | undefined} [origin]
|
|
4226
|
+
* @returns {VFileMessage}
|
|
4227
|
+
*
|
|
4228
|
+
* @overload
|
|
4229
|
+
* @param {string} reason
|
|
4230
|
+
* @param {Point | Position | null | undefined} place
|
|
4231
|
+
* @param {string | null | undefined} [origin]
|
|
4232
|
+
* @returns {VFileMessage}
|
|
4233
|
+
*
|
|
4234
|
+
* @overload
|
|
4235
|
+
* @param {string} reason
|
|
4236
|
+
* @param {string | null | undefined} [origin]
|
|
4237
|
+
* @returns {VFileMessage}
|
|
4238
|
+
*
|
|
4239
|
+
* @overload
|
|
4240
|
+
* @param {Error | VFileMessage} cause
|
|
4241
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
4242
|
+
* @param {string | null | undefined} [origin]
|
|
4243
|
+
* @returns {VFileMessage}
|
|
4244
|
+
*
|
|
4245
|
+
* @overload
|
|
4246
|
+
* @param {Error | VFileMessage} cause
|
|
4247
|
+
* @param {Point | Position | null | undefined} place
|
|
4248
|
+
* @param {string | null | undefined} [origin]
|
|
4249
|
+
* @returns {VFileMessage}
|
|
4250
|
+
*
|
|
4251
|
+
* @overload
|
|
4252
|
+
* @param {Error | VFileMessage} cause
|
|
4253
|
+
* @param {string | null | undefined} [origin]
|
|
4254
|
+
* @returns {VFileMessage}
|
|
4255
|
+
*
|
|
4256
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
4257
|
+
* Reason for message, should use markdown.
|
|
4258
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
4259
|
+
* Configuration (optional).
|
|
4260
|
+
* @param {string | null | undefined} [origin]
|
|
4261
|
+
* Place in code where the message originates (example:
|
|
4262
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
4263
|
+
* @returns {VFileMessage}
|
|
4264
|
+
* Message.
|
|
4265
|
+
*/
|
|
4266
|
+
message(t, n, r) {
|
|
4267
|
+
const l = new Q(
|
|
4268
|
+
// @ts-expect-error: the overloads are fine.
|
|
4269
|
+
t,
|
|
4270
|
+
n,
|
|
4271
|
+
r
|
|
4272
|
+
);
|
|
4273
|
+
return this.path && (l.name = this.path + ":" + l.name, l.file = this.path), l.fatal = !1, this.messages.push(l), l;
|
|
4274
|
+
}
|
|
4275
|
+
/**
|
|
4276
|
+
* Serialize the file.
|
|
4277
|
+
*
|
|
4278
|
+
* > **Note**: which encodings are supported depends on the engine.
|
|
4279
|
+
* > For info on Node.js, see:
|
|
4280
|
+
* > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.
|
|
4281
|
+
*
|
|
4282
|
+
* @param {string | null | undefined} [encoding='utf8']
|
|
4283
|
+
* Character encoding to understand `value` as when it’s a `Uint8Array`
|
|
4284
|
+
* (default: `'utf-8'`).
|
|
4285
|
+
* @returns {string}
|
|
4286
|
+
* Serialized file.
|
|
4287
|
+
*/
|
|
4288
|
+
toString(t) {
|
|
4289
|
+
return this.value === void 0 ? "" : typeof this.value == "string" ? this.value : new TextDecoder(t || void 0).decode(this.value);
|
|
4290
|
+
}
|
|
4291
|
+
}
|
|
4292
|
+
function Oe(e, t) {
|
|
4293
|
+
if (e && e.includes(te.sep))
|
|
4294
|
+
throw new Error(
|
|
4295
|
+
"`" + t + "` cannot be a path: did not expect `" + te.sep + "`"
|
|
4296
|
+
);
|
|
4297
|
+
}
|
|
4298
|
+
function je(e, t) {
|
|
4299
|
+
if (!e)
|
|
4300
|
+
throw new Error("`" + t + "` cannot be empty");
|
|
4301
|
+
}
|
|
4302
|
+
function Ct(e, t) {
|
|
4303
|
+
if (!e)
|
|
4304
|
+
throw new Error("Setting `" + t + "` requires `path` to be set too");
|
|
4305
|
+
}
|
|
4306
|
+
function Vl(e) {
|
|
4307
|
+
return !!(e && typeof e == "object" && "byteLength" in e && "byteOffset" in e);
|
|
4308
|
+
}
|
|
4309
|
+
const ql = (
|
|
4310
|
+
/**
|
|
4311
|
+
* @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}
|
|
4312
|
+
*/
|
|
4313
|
+
/** @type {unknown} */
|
|
4314
|
+
/**
|
|
4315
|
+
* @this {Function}
|
|
4316
|
+
* @param {string | symbol} property
|
|
4317
|
+
* @returns {(...parameters: Array<unknown>) => unknown}
|
|
4318
|
+
*/
|
|
4319
|
+
function(e) {
|
|
4320
|
+
const r = (
|
|
4321
|
+
/** @type {Record<string | symbol, Function>} */
|
|
4322
|
+
// Prototypes do exist.
|
|
4323
|
+
// type-coverage:ignore-next-line
|
|
4324
|
+
this.constructor.prototype
|
|
4325
|
+
), l = r[e], i = function() {
|
|
4326
|
+
return l.apply(i, arguments);
|
|
4327
|
+
};
|
|
4328
|
+
return Object.setPrototypeOf(i, r), i;
|
|
4329
|
+
}
|
|
4330
|
+
), vl = {}.hasOwnProperty;
|
|
4331
|
+
class nt extends ql {
|
|
4332
|
+
/**
|
|
4333
|
+
* Create a processor.
|
|
4334
|
+
*/
|
|
4335
|
+
constructor() {
|
|
4336
|
+
super("copy"), this.Compiler = void 0, this.Parser = void 0, this.attachers = [], this.compiler = void 0, this.freezeIndex = -1, this.frozen = void 0, this.namespace = {}, this.parser = void 0, this.transformers = xn();
|
|
4337
|
+
}
|
|
4338
|
+
/**
|
|
4339
|
+
* Copy a processor.
|
|
4340
|
+
*
|
|
4341
|
+
* @deprecated
|
|
4342
|
+
* This is a private internal method and should not be used.
|
|
4343
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
4344
|
+
* New *unfrozen* processor ({@linkcode Processor}) that is
|
|
4345
|
+
* configured to work the same as its ancestor.
|
|
4346
|
+
* When the descendant processor is configured in the future it does not
|
|
4347
|
+
* affect the ancestral processor.
|
|
4348
|
+
*/
|
|
4349
|
+
copy() {
|
|
4350
|
+
const t = (
|
|
4351
|
+
/** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */
|
|
4352
|
+
new nt()
|
|
4353
|
+
);
|
|
4354
|
+
let n = -1;
|
|
4355
|
+
for (; ++n < this.attachers.length; ) {
|
|
4356
|
+
const r = this.attachers[n];
|
|
4357
|
+
t.use(...r);
|
|
4358
|
+
}
|
|
4359
|
+
return t.data(_e(!0, {}, this.namespace)), t;
|
|
4360
|
+
}
|
|
4361
|
+
/**
|
|
4362
|
+
* Configure the processor with info available to all plugins.
|
|
4363
|
+
* Information is stored in an object.
|
|
4364
|
+
*
|
|
4365
|
+
* Typically, options can be given to a specific plugin, but sometimes it
|
|
4366
|
+
* makes sense to have information shared with several plugins.
|
|
4367
|
+
* For example, a list of HTML elements that are self-closing, which is
|
|
4368
|
+
* needed during all phases.
|
|
4369
|
+
*
|
|
4370
|
+
* > **Note**: setting information cannot occur on *frozen* processors.
|
|
4371
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
4372
|
+
*
|
|
4373
|
+
* > **Note**: to register custom data in TypeScript, augment the
|
|
4374
|
+
* > {@linkcode Data} interface.
|
|
4375
|
+
*
|
|
4376
|
+
* @example
|
|
4377
|
+
* This example show how to get and set info:
|
|
4378
|
+
*
|
|
4379
|
+
* ```js
|
|
4380
|
+
* import {unified} from 'unified'
|
|
4381
|
+
*
|
|
4382
|
+
* const processor = unified().data('alpha', 'bravo')
|
|
4383
|
+
*
|
|
4384
|
+
* processor.data('alpha') // => 'bravo'
|
|
4385
|
+
*
|
|
4386
|
+
* processor.data() // => {alpha: 'bravo'}
|
|
4387
|
+
*
|
|
4388
|
+
* processor.data({charlie: 'delta'})
|
|
4389
|
+
*
|
|
4390
|
+
* processor.data() // => {charlie: 'delta'}
|
|
4391
|
+
* ```
|
|
4392
|
+
*
|
|
4393
|
+
* @template {keyof Data} Key
|
|
4394
|
+
*
|
|
4395
|
+
* @overload
|
|
4396
|
+
* @returns {Data}
|
|
4397
|
+
*
|
|
4398
|
+
* @overload
|
|
4399
|
+
* @param {Data} dataset
|
|
4400
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
4401
|
+
*
|
|
4402
|
+
* @overload
|
|
4403
|
+
* @param {Key} key
|
|
4404
|
+
* @returns {Data[Key]}
|
|
4405
|
+
*
|
|
4406
|
+
* @overload
|
|
4407
|
+
* @param {Key} key
|
|
4408
|
+
* @param {Data[Key]} value
|
|
4409
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
4410
|
+
*
|
|
4411
|
+
* @param {Data | Key} [key]
|
|
4412
|
+
* Key to get or set, or entire dataset to set, or nothing to get the
|
|
4413
|
+
* entire dataset (optional).
|
|
4414
|
+
* @param {Data[Key]} [value]
|
|
4415
|
+
* Value to set (optional).
|
|
4416
|
+
* @returns {unknown}
|
|
4417
|
+
* The current processor when setting, the value at `key` when getting, or
|
|
4418
|
+
* the entire dataset when getting without key.
|
|
4419
|
+
*/
|
|
4420
|
+
data(t, n) {
|
|
4421
|
+
return typeof t == "string" ? arguments.length === 2 ? (qe("data", this.frozen), this.namespace[t] = n, this) : vl.call(this.namespace, t) && this.namespace[t] || void 0 : t ? (qe("data", this.frozen), this.namespace = t, this) : this.namespace;
|
|
4422
|
+
}
|
|
4423
|
+
/**
|
|
4424
|
+
* Freeze a processor.
|
|
4425
|
+
*
|
|
4426
|
+
* Frozen processors are meant to be extended and not to be configured
|
|
4427
|
+
* directly.
|
|
4428
|
+
*
|
|
4429
|
+
* When a processor is frozen it cannot be unfrozen.
|
|
4430
|
+
* New processors working the same way can be created by calling the
|
|
4431
|
+
* processor.
|
|
4432
|
+
*
|
|
4433
|
+
* It’s possible to freeze processors explicitly by calling `.freeze()`.
|
|
4434
|
+
* Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,
|
|
4435
|
+
* `.stringify()`, `.process()`, or `.processSync()` are called.
|
|
4436
|
+
*
|
|
4437
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
4438
|
+
* The current processor.
|
|
4439
|
+
*/
|
|
4440
|
+
freeze() {
|
|
4441
|
+
if (this.frozen)
|
|
4442
|
+
return this;
|
|
4443
|
+
const t = (
|
|
4444
|
+
/** @type {Processor} */
|
|
4445
|
+
/** @type {unknown} */
|
|
4446
|
+
this
|
|
4447
|
+
);
|
|
4448
|
+
for (; ++this.freezeIndex < this.attachers.length; ) {
|
|
4449
|
+
const [n, ...r] = this.attachers[this.freezeIndex];
|
|
4450
|
+
if (r[0] === !1)
|
|
4451
|
+
continue;
|
|
4452
|
+
r[0] === !0 && (r[0] = void 0);
|
|
4453
|
+
const l = n.call(t, ...r);
|
|
4454
|
+
typeof l == "function" && this.transformers.use(l);
|
|
4455
|
+
}
|
|
4456
|
+
return this.frozen = !0, this.freezeIndex = Number.POSITIVE_INFINITY, this;
|
|
4457
|
+
}
|
|
4458
|
+
/**
|
|
4459
|
+
* Parse text to a syntax tree.
|
|
4460
|
+
*
|
|
4461
|
+
* > **Note**: `parse` freezes the processor if not already *frozen*.
|
|
4462
|
+
*
|
|
4463
|
+
* > **Note**: `parse` performs the parse phase, not the run phase or other
|
|
4464
|
+
* > phases.
|
|
4465
|
+
*
|
|
4466
|
+
* @param {Compatible | undefined} [file]
|
|
4467
|
+
* file to parse (optional); typically `string` or `VFile`; any value
|
|
4468
|
+
* accepted as `x` in `new VFile(x)`.
|
|
4469
|
+
* @returns {ParseTree extends undefined ? Node : ParseTree}
|
|
4470
|
+
* Syntax tree representing `file`.
|
|
4471
|
+
*/
|
|
4472
|
+
parse(t) {
|
|
4473
|
+
this.freeze();
|
|
4474
|
+
const n = Fe(t), r = this.parser || this.Parser;
|
|
4475
|
+
return He("parse", r), r(String(n), n);
|
|
4476
|
+
}
|
|
4477
|
+
/**
|
|
4478
|
+
* Process the given file as configured on the processor.
|
|
4479
|
+
*
|
|
4480
|
+
* > **Note**: `process` freezes the processor if not already *frozen*.
|
|
4481
|
+
*
|
|
4482
|
+
* > **Note**: `process` performs the parse, run, and stringify phases.
|
|
4483
|
+
*
|
|
4484
|
+
* @overload
|
|
4485
|
+
* @param {Compatible | undefined} file
|
|
4486
|
+
* @param {ProcessCallback<VFileWithOutput<CompileResult>>} done
|
|
4487
|
+
* @returns {undefined}
|
|
4488
|
+
*
|
|
4489
|
+
* @overload
|
|
4490
|
+
* @param {Compatible | undefined} [file]
|
|
4491
|
+
* @returns {Promise<VFileWithOutput<CompileResult>>}
|
|
4492
|
+
*
|
|
4493
|
+
* @param {Compatible | undefined} [file]
|
|
4494
|
+
* File (optional); typically `string` or `VFile`]; any value accepted as
|
|
4495
|
+
* `x` in `new VFile(x)`.
|
|
4496
|
+
* @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]
|
|
4497
|
+
* Callback (optional).
|
|
4498
|
+
* @returns {Promise<VFile> | undefined}
|
|
4499
|
+
* Nothing if `done` is given.
|
|
4500
|
+
* Otherwise a promise, rejected with a fatal error or resolved with the
|
|
4501
|
+
* processed file.
|
|
4502
|
+
*
|
|
4503
|
+
* The parsed, transformed, and compiled value is available at
|
|
4504
|
+
* `file.value` (see note).
|
|
4505
|
+
*
|
|
4506
|
+
* > **Note**: unified typically compiles by serializing: most
|
|
4507
|
+
* > compilers return `string` (or `Uint8Array`).
|
|
4508
|
+
* > Some compilers, such as the one configured with
|
|
4509
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
4510
|
+
* > React tree).
|
|
4511
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
4512
|
+
* > result values.
|
|
4513
|
+
* >
|
|
4514
|
+
* > To register custom results in TypeScript, add them to
|
|
4515
|
+
* > {@linkcode CompileResultMap}.
|
|
4516
|
+
*
|
|
4517
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
4518
|
+
*/
|
|
4519
|
+
process(t, n) {
|
|
4520
|
+
const r = this;
|
|
4521
|
+
return this.freeze(), He("process", this.parser || this.Parser), Ve("process", this.compiler || this.Compiler), n ? l(void 0, n) : new Promise(l);
|
|
4522
|
+
function l(i, u) {
|
|
4523
|
+
const a = Fe(t), f = (
|
|
4524
|
+
/** @type {HeadTree extends undefined ? Node : HeadTree} */
|
|
4525
|
+
/** @type {unknown} */
|
|
4526
|
+
r.parse(a)
|
|
4527
|
+
);
|
|
4528
|
+
r.run(f, a, function(c, m, d) {
|
|
4529
|
+
if (c || !m || !d)
|
|
4530
|
+
return s(c);
|
|
4531
|
+
const o = (
|
|
4532
|
+
/** @type {CompileTree extends undefined ? Node : CompileTree} */
|
|
4533
|
+
/** @type {unknown} */
|
|
4534
|
+
m
|
|
4535
|
+
), b = r.stringify(o, d);
|
|
4536
|
+
$l(b) ? d.value = b : d.result = b, s(
|
|
4537
|
+
c,
|
|
4538
|
+
/** @type {VFileWithOutput<CompileResult>} */
|
|
4539
|
+
d
|
|
4540
|
+
);
|
|
4541
|
+
});
|
|
4542
|
+
function s(c, m) {
|
|
4543
|
+
c || !m ? u(c) : i ? i(m) : n(void 0, m);
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
/**
|
|
4548
|
+
* Process the given file as configured on the processor.
|
|
4549
|
+
*
|
|
4550
|
+
* An error is thrown if asynchronous transforms are configured.
|
|
4551
|
+
*
|
|
4552
|
+
* > **Note**: `processSync` freezes the processor if not already *frozen*.
|
|
4553
|
+
*
|
|
4554
|
+
* > **Note**: `processSync` performs the parse, run, and stringify phases.
|
|
4555
|
+
*
|
|
4556
|
+
* @param {Compatible | undefined} [file]
|
|
4557
|
+
* File (optional); typically `string` or `VFile`; any value accepted as
|
|
4558
|
+
* `x` in `new VFile(x)`.
|
|
4559
|
+
* @returns {VFileWithOutput<CompileResult>}
|
|
4560
|
+
* The processed file.
|
|
4561
|
+
*
|
|
4562
|
+
* The parsed, transformed, and compiled value is available at
|
|
4563
|
+
* `file.value` (see note).
|
|
4564
|
+
*
|
|
4565
|
+
* > **Note**: unified typically compiles by serializing: most
|
|
4566
|
+
* > compilers return `string` (or `Uint8Array`).
|
|
4567
|
+
* > Some compilers, such as the one configured with
|
|
4568
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
4569
|
+
* > React tree).
|
|
4570
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
4571
|
+
* > result values.
|
|
4572
|
+
* >
|
|
4573
|
+
* > To register custom results in TypeScript, add them to
|
|
4574
|
+
* > {@linkcode CompileResultMap}.
|
|
4575
|
+
*
|
|
4576
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
4577
|
+
*/
|
|
4578
|
+
processSync(t) {
|
|
4579
|
+
let n = !1, r;
|
|
4580
|
+
return this.freeze(), He("processSync", this.parser || this.Parser), Ve("processSync", this.compiler || this.Compiler), this.process(t, l), zt("processSync", "process", n), r;
|
|
4581
|
+
function l(i, u) {
|
|
4582
|
+
n = !0, ot(i), r = u;
|
|
4583
|
+
}
|
|
4584
|
+
}
|
|
4585
|
+
/**
|
|
4586
|
+
* Run *transformers* on a syntax tree.
|
|
4587
|
+
*
|
|
4588
|
+
* > **Note**: `run` freezes the processor if not already *frozen*.
|
|
4589
|
+
*
|
|
4590
|
+
* > **Note**: `run` performs the run phase, not other phases.
|
|
4591
|
+
*
|
|
4592
|
+
* @overload
|
|
4593
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
4594
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
|
4595
|
+
* @returns {undefined}
|
|
4596
|
+
*
|
|
4597
|
+
* @overload
|
|
4598
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
4599
|
+
* @param {Compatible | undefined} file
|
|
4600
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
|
4601
|
+
* @returns {undefined}
|
|
4602
|
+
*
|
|
4603
|
+
* @overload
|
|
4604
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
4605
|
+
* @param {Compatible | undefined} [file]
|
|
4606
|
+
* @returns {Promise<TailTree extends undefined ? Node : TailTree>}
|
|
4607
|
+
*
|
|
4608
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
4609
|
+
* Tree to transform and inspect.
|
|
4610
|
+
* @param {(
|
|
4611
|
+
* RunCallback<TailTree extends undefined ? Node : TailTree> |
|
|
4612
|
+
* Compatible
|
|
4613
|
+
* )} [file]
|
|
4614
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
4615
|
+
* `new VFile(x)`.
|
|
4616
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
|
|
4617
|
+
* Callback (optional).
|
|
4618
|
+
* @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
|
|
4619
|
+
* Nothing if `done` is given.
|
|
4620
|
+
* Otherwise, a promise rejected with a fatal error or resolved with the
|
|
4621
|
+
* transformed tree.
|
|
4622
|
+
*/
|
|
4623
|
+
run(t, n, r) {
|
|
4624
|
+
Tt(t), this.freeze();
|
|
4625
|
+
const l = this.transformers;
|
|
4626
|
+
return !r && typeof n == "function" && (r = n, n = void 0), r ? i(void 0, r) : new Promise(i);
|
|
4627
|
+
function i(u, a) {
|
|
4628
|
+
const f = Fe(n);
|
|
4629
|
+
l.run(t, f, s);
|
|
4630
|
+
function s(c, m, d) {
|
|
4631
|
+
const o = (
|
|
4632
|
+
/** @type {TailTree extends undefined ? Node : TailTree} */
|
|
4633
|
+
m || t
|
|
4634
|
+
);
|
|
4635
|
+
c ? a(c) : u ? u(o) : r(void 0, o, d);
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
}
|
|
4639
|
+
/**
|
|
4640
|
+
* Run *transformers* on a syntax tree.
|
|
4641
|
+
*
|
|
4642
|
+
* An error is thrown if asynchronous transforms are configured.
|
|
4643
|
+
*
|
|
4644
|
+
* > **Note**: `runSync` freezes the processor if not already *frozen*.
|
|
4645
|
+
*
|
|
4646
|
+
* > **Note**: `runSync` performs the run phase, not other phases.
|
|
4647
|
+
*
|
|
4648
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
4649
|
+
* Tree to transform and inspect.
|
|
4650
|
+
* @param {Compatible | undefined} [file]
|
|
4651
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
4652
|
+
* `new VFile(x)`.
|
|
4653
|
+
* @returns {TailTree extends undefined ? Node : TailTree}
|
|
4654
|
+
* Transformed tree.
|
|
4655
|
+
*/
|
|
4656
|
+
runSync(t, n) {
|
|
4657
|
+
let r = !1, l;
|
|
4658
|
+
return this.run(t, n, i), zt("runSync", "run", r), l;
|
|
4659
|
+
function i(u, a) {
|
|
4660
|
+
ot(u), l = a, r = !0;
|
|
4661
|
+
}
|
|
4662
|
+
}
|
|
4663
|
+
/**
|
|
4664
|
+
* Compile a syntax tree.
|
|
4665
|
+
*
|
|
4666
|
+
* > **Note**: `stringify` freezes the processor if not already *frozen*.
|
|
4667
|
+
*
|
|
4668
|
+
* > **Note**: `stringify` performs the stringify phase, not the run phase
|
|
4669
|
+
* > or other phases.
|
|
4670
|
+
*
|
|
4671
|
+
* @param {CompileTree extends undefined ? Node : CompileTree} tree
|
|
4672
|
+
* Tree to compile.
|
|
4673
|
+
* @param {Compatible | undefined} [file]
|
|
4674
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
4675
|
+
* `new VFile(x)`.
|
|
4676
|
+
* @returns {CompileResult extends undefined ? Value : CompileResult}
|
|
4677
|
+
* Textual representation of the tree (see note).
|
|
4678
|
+
*
|
|
4679
|
+
* > **Note**: unified typically compiles by serializing: most compilers
|
|
4680
|
+
* > return `string` (or `Uint8Array`).
|
|
4681
|
+
* > Some compilers, such as the one configured with
|
|
4682
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
4683
|
+
* > React tree).
|
|
4684
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
4685
|
+
* > result values.
|
|
4686
|
+
* >
|
|
4687
|
+
* > To register custom results in TypeScript, add them to
|
|
4688
|
+
* > {@linkcode CompileResultMap}.
|
|
4689
|
+
*
|
|
4690
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
4691
|
+
*/
|
|
4692
|
+
stringify(t, n) {
|
|
4693
|
+
this.freeze();
|
|
4694
|
+
const r = Fe(n), l = this.compiler || this.Compiler;
|
|
4695
|
+
return Ve("stringify", l), Tt(t), l(t, r);
|
|
4696
|
+
}
|
|
4697
|
+
/**
|
|
4698
|
+
* Configure the processor to use a plugin, a list of usable values, or a
|
|
4699
|
+
* preset.
|
|
4700
|
+
*
|
|
4701
|
+
* If the processor is already using a plugin, the previous plugin
|
|
4702
|
+
* configuration is changed based on the options that are passed in.
|
|
4703
|
+
* In other words, the plugin is not added a second time.
|
|
4704
|
+
*
|
|
4705
|
+
* > **Note**: `use` cannot be called on *frozen* processors.
|
|
4706
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
4707
|
+
*
|
|
4708
|
+
* @example
|
|
4709
|
+
* There are many ways to pass plugins to `.use()`.
|
|
4710
|
+
* This example gives an overview:
|
|
4711
|
+
*
|
|
4712
|
+
* ```js
|
|
4713
|
+
* import {unified} from 'unified'
|
|
4714
|
+
*
|
|
4715
|
+
* unified()
|
|
4716
|
+
* // Plugin with options:
|
|
4717
|
+
* .use(pluginA, {x: true, y: true})
|
|
4718
|
+
* // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
|
|
4719
|
+
* .use(pluginA, {y: false, z: true})
|
|
4720
|
+
* // Plugins:
|
|
4721
|
+
* .use([pluginB, pluginC])
|
|
4722
|
+
* // Two plugins, the second with options:
|
|
4723
|
+
* .use([pluginD, [pluginE, {}]])
|
|
4724
|
+
* // Preset with plugins and settings:
|
|
4725
|
+
* .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
|
|
4726
|
+
* // Settings only:
|
|
4727
|
+
* .use({settings: {position: false}})
|
|
4728
|
+
* ```
|
|
4729
|
+
*
|
|
4730
|
+
* @template {Array<unknown>} [Parameters=[]]
|
|
4731
|
+
* @template {Node | string | undefined} [Input=undefined]
|
|
4732
|
+
* @template [Output=Input]
|
|
4733
|
+
*
|
|
4734
|
+
* @overload
|
|
4735
|
+
* @param {Preset | null | undefined} [preset]
|
|
4736
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
4737
|
+
*
|
|
4738
|
+
* @overload
|
|
4739
|
+
* @param {PluggableList} list
|
|
4740
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
4741
|
+
*
|
|
4742
|
+
* @overload
|
|
4743
|
+
* @param {Plugin<Parameters, Input, Output>} plugin
|
|
4744
|
+
* @param {...(Parameters | [boolean])} parameters
|
|
4745
|
+
* @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
|
|
4746
|
+
*
|
|
4747
|
+
* @param {PluggableList | Plugin | Preset | null | undefined} value
|
|
4748
|
+
* Usable value.
|
|
4749
|
+
* @param {...unknown} parameters
|
|
4750
|
+
* Parameters, when a plugin is given as a usable value.
|
|
4751
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
4752
|
+
* Current processor.
|
|
4753
|
+
*/
|
|
4754
|
+
use(t, ...n) {
|
|
4755
|
+
const r = this.attachers, l = this.namespace;
|
|
4756
|
+
if (qe("use", this.frozen), t != null) if (typeof t == "function")
|
|
4757
|
+
f(t, n);
|
|
4758
|
+
else if (typeof t == "object")
|
|
4759
|
+
Array.isArray(t) ? a(t) : u(t);
|
|
4760
|
+
else
|
|
4761
|
+
throw new TypeError("Expected usable value, not `" + t + "`");
|
|
4762
|
+
return this;
|
|
4763
|
+
function i(s) {
|
|
4764
|
+
if (typeof s == "function")
|
|
4765
|
+
f(s, []);
|
|
4766
|
+
else if (typeof s == "object")
|
|
4767
|
+
if (Array.isArray(s)) {
|
|
4768
|
+
const [c, ...m] = (
|
|
4769
|
+
/** @type {PluginTuple<Array<unknown>>} */
|
|
4770
|
+
s
|
|
4771
|
+
);
|
|
4772
|
+
f(c, m);
|
|
4773
|
+
} else
|
|
4774
|
+
u(s);
|
|
4775
|
+
else
|
|
4776
|
+
throw new TypeError("Expected usable value, not `" + s + "`");
|
|
4777
|
+
}
|
|
4778
|
+
function u(s) {
|
|
4779
|
+
if (!("plugins" in s) && !("settings" in s))
|
|
4780
|
+
throw new Error(
|
|
4781
|
+
"Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither"
|
|
4782
|
+
);
|
|
4783
|
+
a(s.plugins), s.settings && (l.settings = _e(!0, l.settings, s.settings));
|
|
4784
|
+
}
|
|
4785
|
+
function a(s) {
|
|
4786
|
+
let c = -1;
|
|
4787
|
+
if (s != null) if (Array.isArray(s))
|
|
4788
|
+
for (; ++c < s.length; ) {
|
|
4789
|
+
const m = s[c];
|
|
4790
|
+
i(m);
|
|
4791
|
+
}
|
|
4792
|
+
else
|
|
4793
|
+
throw new TypeError("Expected a list of plugins, not `" + s + "`");
|
|
4794
|
+
}
|
|
4795
|
+
function f(s, c) {
|
|
4796
|
+
let m = -1, d = -1;
|
|
4797
|
+
for (; ++m < r.length; )
|
|
4798
|
+
if (r[m][0] === s) {
|
|
4799
|
+
d = m;
|
|
4800
|
+
break;
|
|
4801
|
+
}
|
|
4802
|
+
if (d === -1)
|
|
4803
|
+
r.push([s, ...c]);
|
|
4804
|
+
else if (c.length > 0) {
|
|
4805
|
+
let [o, ...b] = c;
|
|
4806
|
+
const C = r[d][1];
|
|
4807
|
+
ve(C) && ve(o) && (o = _e(!0, C, o)), r[d] = [s, o, ...b];
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4811
|
+
}
|
|
4812
|
+
const Ul = new nt().freeze();
|
|
4813
|
+
function He(e, t) {
|
|
4814
|
+
if (typeof t != "function")
|
|
4815
|
+
throw new TypeError("Cannot `" + e + "` without `parser`");
|
|
4816
|
+
}
|
|
4817
|
+
function Ve(e, t) {
|
|
4818
|
+
if (typeof t != "function")
|
|
4819
|
+
throw new TypeError("Cannot `" + e + "` without `compiler`");
|
|
4820
|
+
}
|
|
4821
|
+
function qe(e, t) {
|
|
4822
|
+
if (t)
|
|
4823
|
+
throw new Error(
|
|
4824
|
+
"Cannot call `" + e + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`."
|
|
4825
|
+
);
|
|
4826
|
+
}
|
|
4827
|
+
function Tt(e) {
|
|
4828
|
+
if (!ve(e) || typeof e.type != "string")
|
|
4829
|
+
throw new TypeError("Expected node, got `" + e + "`");
|
|
4830
|
+
}
|
|
4831
|
+
function zt(e, t, n) {
|
|
4832
|
+
if (!n)
|
|
4833
|
+
throw new Error(
|
|
4834
|
+
"`" + e + "` finished async. Use `" + t + "` instead"
|
|
4835
|
+
);
|
|
4836
|
+
}
|
|
4837
|
+
function Fe(e) {
|
|
4838
|
+
return Ql(e) ? e : new Zt(e);
|
|
4839
|
+
}
|
|
4840
|
+
function Ql(e) {
|
|
4841
|
+
return !!(e && typeof e == "object" && "message" in e && "messages" in e);
|
|
4842
|
+
}
|
|
4843
|
+
function $l(e) {
|
|
4844
|
+
return typeof e == "string" || Wl(e);
|
|
4845
|
+
}
|
|
4846
|
+
function Wl(e) {
|
|
4847
|
+
return !!(e && typeof e == "object" && "byteLength" in e && "byteOffset" in e);
|
|
4848
|
+
}
|
|
4849
|
+
const Yl = "https://github.com/remarkjs/react-markdown/blob/main/changelog.md", At = [], Ft = { allowDangerousHtml: !0 }, Jl = /^(https?|ircs?|mailto|xmpp)$/i, Kl = [
|
|
4850
|
+
{ from: "astPlugins", id: "remove-buggy-html-in-markdown-parser" },
|
|
4851
|
+
{ from: "allowDangerousHtml", id: "remove-buggy-html-in-markdown-parser" },
|
|
4852
|
+
{
|
|
4853
|
+
from: "allowNode",
|
|
4854
|
+
id: "replace-allownode-allowedtypes-and-disallowedtypes",
|
|
4855
|
+
to: "allowElement"
|
|
4856
|
+
},
|
|
4857
|
+
{
|
|
4858
|
+
from: "allowedTypes",
|
|
4859
|
+
id: "replace-allownode-allowedtypes-and-disallowedtypes",
|
|
4860
|
+
to: "allowedElements"
|
|
4861
|
+
},
|
|
4862
|
+
{ from: "className", id: "remove-classname" },
|
|
4863
|
+
{
|
|
4864
|
+
from: "disallowedTypes",
|
|
4865
|
+
id: "replace-allownode-allowedtypes-and-disallowedtypes",
|
|
4866
|
+
to: "disallowedElements"
|
|
4867
|
+
},
|
|
4868
|
+
{ from: "escapeHtml", id: "remove-buggy-html-in-markdown-parser" },
|
|
4869
|
+
{ from: "includeElementIndex", id: "#remove-includeelementindex" },
|
|
4870
|
+
{
|
|
4871
|
+
from: "includeNodeIndex",
|
|
4872
|
+
id: "change-includenodeindex-to-includeelementindex"
|
|
4873
|
+
},
|
|
4874
|
+
{ from: "linkTarget", id: "remove-linktarget" },
|
|
4875
|
+
{ from: "plugins", id: "change-plugins-to-remarkplugins", to: "remarkPlugins" },
|
|
4876
|
+
{ from: "rawSourcePos", id: "#remove-rawsourcepos" },
|
|
4877
|
+
{ from: "renderers", id: "change-renderers-to-components", to: "components" },
|
|
4878
|
+
{ from: "source", id: "change-source-to-children", to: "children" },
|
|
4879
|
+
{ from: "sourcePos", id: "#remove-sourcepos" },
|
|
4880
|
+
{ from: "transformImageUri", id: "#add-urltransform", to: "urlTransform" },
|
|
4881
|
+
{ from: "transformLinkUri", id: "#add-urltransform", to: "urlTransform" }
|
|
4882
|
+
];
|
|
4883
|
+
function iu(e) {
|
|
4884
|
+
const t = Zl(e), n = Gl(e);
|
|
4885
|
+
return Xl(t.runSync(t.parse(n), n), e);
|
|
4886
|
+
}
|
|
4887
|
+
function Zl(e) {
|
|
4888
|
+
const t = e.rehypePlugins || At, n = e.remarkPlugins || At, r = e.remarkRehypeOptions ? { ...e.remarkRehypeOptions, ...Ft } : Ft;
|
|
4889
|
+
return Ul().use(Ji).use(n).use(Nl, r).use(t);
|
|
4890
|
+
}
|
|
4891
|
+
function Gl(e) {
|
|
4892
|
+
const t = e.children || "", n = new Zt();
|
|
4893
|
+
return typeof t == "string" && (n.value = t), n;
|
|
4894
|
+
}
|
|
4895
|
+
function Xl(e, t) {
|
|
4896
|
+
const n = t.allowedElements, r = t.allowElement, l = t.components, i = t.disallowedElements, u = t.skipHtml, a = t.unwrapDisallowed, f = t.urlTransform || eu;
|
|
4897
|
+
for (const c of Kl)
|
|
4898
|
+
Object.hasOwn(t, c.from) && yn(
|
|
4899
|
+
"Unexpected `" + c.from + "` prop, " + (c.to ? "use `" + c.to + "` instead" : "remove it") + " (see <" + Yl + "#" + c.id + "> for more info)"
|
|
4900
|
+
);
|
|
4901
|
+
return Pt(e, s), An(e, {
|
|
4902
|
+
Fragment: wn,
|
|
4903
|
+
components: l,
|
|
4904
|
+
ignoreInvalidStyle: !0,
|
|
4905
|
+
jsx: bn,
|
|
4906
|
+
jsxs: kn,
|
|
4907
|
+
passKeys: !0,
|
|
4908
|
+
passNode: !0
|
|
4909
|
+
});
|
|
4910
|
+
function s(c, m, d) {
|
|
4911
|
+
if (c.type === "raw" && d && typeof m == "number")
|
|
4912
|
+
return u ? d.children.splice(m, 1) : d.children[m] = { type: "text", value: c.value }, m;
|
|
4913
|
+
if (c.type === "element") {
|
|
4914
|
+
let o;
|
|
4915
|
+
for (o in Be)
|
|
4916
|
+
if (Object.hasOwn(Be, o) && Object.hasOwn(c.properties, o)) {
|
|
4917
|
+
const b = c.properties[o], C = Be[o];
|
|
4918
|
+
(C === null || C.includes(c.tagName)) && (c.properties[o] = f(String(b || ""), o, c));
|
|
4919
|
+
}
|
|
4920
|
+
}
|
|
4921
|
+
if (c.type === "element") {
|
|
4922
|
+
let o = n ? !n.includes(c.tagName) : i ? i.includes(c.tagName) : !1;
|
|
4923
|
+
if (!o && r && typeof m == "number" && (o = !r(c, m, d)), o && d && typeof m == "number")
|
|
4924
|
+
return a && c.children ? d.children.splice(m, 1, ...c.children) : d.children.splice(m, 1), m;
|
|
4925
|
+
}
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
function eu(e) {
|
|
4929
|
+
const t = e.indexOf(":"), n = e.indexOf("?"), r = e.indexOf("#"), l = e.indexOf("/");
|
|
4930
|
+
return (
|
|
4931
|
+
// If there is no protocol, it’s relative.
|
|
4932
|
+
t === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
|
|
4933
|
+
l !== -1 && t > l || n !== -1 && t > n || r !== -1 && t > r || // It is a protocol, it should be allowed.
|
|
4934
|
+
Jl.test(e.slice(0, t)) ? e : ""
|
|
4935
|
+
);
|
|
4936
|
+
}
|
|
4937
|
+
export {
|
|
4938
|
+
iu as M
|
|
4939
|
+
};
|