@markdown-next/vue 1.0.0 → 1.1.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/index.mjs CHANGED
@@ -1,13 +1,338 @@
1
- import { h, Fragment as O, shallowRef as j, ref as k, watch as C, unref as x, onBeforeUnmount as R, defineComponent as T, useAttrs as E, toRef as L, inject as H, computed as b, onErrorCaptured as J, createVNode as y, mergeProps as G, createTextVNode as S, provide as D } from "vue";
2
- import { createParser as I, createWorkerPool as U } from "@markdown-next/parser";
3
- const M = Symbol("MarkdownWorkerPoll"), V = {
1
+ var dt = Object.defineProperty;
2
+ var pt = (e, t, r) => t in e ? dt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var b = (e, t, r) => pt(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { h as v, Fragment as Ee, shallowRef as ft, ref as te, watch as Oe, unref as me, onBeforeUnmount as U, defineComponent as Le, useAttrs as gt, toRef as kt, inject as mt, computed as I, onErrorCaptured as bt, createVNode as _, mergeProps as xt, createTextVNode as Y, provide as wt, onMounted as yt } from "vue";
5
+ import { createParser as St, createWorkerPool as $t } from "@markdown-next/parser";
6
+ const Be = Symbol("MarkdownWorkerPoll");
7
+ var Rt = Object.defineProperty, Tt = Object.defineProperties, At = Object.getOwnPropertyDescriptors, be = Object.getOwnPropertySymbols, vt = Object.prototype.hasOwnProperty, _t = Object.prototype.propertyIsEnumerable, xe = (e, t, r) => t in e ? Rt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Me = (e, t) => {
8
+ for (var r in t || (t = {})) vt.call(t, r) && xe(e, r, t[r]);
9
+ if (be) for (var r of be(t)) _t.call(t, r) && xe(e, r, t[r]);
10
+ return e;
11
+ }, qe = (e, t) => Tt(e, At(t)), Ct = /(\*\*)([^*]*\*?)$/, It = /(__)([^_]*?)$/, zt = /(\*\*\*)([^*]*?)$/, Pt = /(\*)([^*]*?)$/, Et = /(_)([^_]*?)$/, Ot = /(`)([^`]*?)$/, Lt = /(~~)([^~]*?)$/, O = /^[\s_~*`]*$/, Ne = /^[\s]*[-*+][\s]+$/, Bt = /[\p{L}\p{N}_]/u, Mt = /^```[^`\n]*```?$/, qt = /^\*{4,}$/, Nt = /(__)([^_]+)_$/, Dt = /(~~)([^~]+)~$/, Ht = /__/g, we = /~~/g, C = (e) => {
12
+ if (!e) return !1;
13
+ let t = e.charCodeAt(0);
14
+ return t >= 48 && t <= 57 || t >= 65 && t <= 90 || t >= 97 && t <= 122 || t === 95 ? !0 : Bt.test(e);
15
+ }, P = (e, t) => {
16
+ let r = !1;
17
+ for (let n = 0; n < t; n += 1) e[n] === "`" && e[n + 1] === "`" && e[n + 2] === "`" && (r = !r, n += 2);
18
+ return r;
19
+ }, Wt = (e, t) => {
20
+ let r = 1;
21
+ for (let n = t - 1; n >= 0; n -= 1) if (e[n] === "]") r += 1;
22
+ else if (e[n] === "[" && (r -= 1, r === 0)) return n;
23
+ return -1;
24
+ }, De = (e, t) => {
25
+ let r = 1;
26
+ for (let n = t + 1; n < e.length; n += 1) if (e[n] === "[") r += 1;
27
+ else if (e[n] === "]" && (r -= 1, r === 0)) return n;
28
+ return -1;
29
+ }, Q = (e, t) => {
30
+ let r = !1, n = !1;
31
+ for (let l = 0; l < e.length && l < t; l += 1) {
32
+ if (e[l] === "\\" && e[l + 1] === "$") {
33
+ l += 1;
34
+ continue;
35
+ }
36
+ e[l] === "$" && (e[l + 1] === "$" ? (n = !n, l += 1, r = !1) : n || (r = !r));
37
+ }
38
+ return r || n;
39
+ }, jt = (e, t) => {
40
+ for (let r = t; r < e.length; r += 1) {
41
+ if (e[r] === ")") return !0;
42
+ if (e[r] === `
43
+ `) return !1;
44
+ }
45
+ return !1;
46
+ }, He = (e, t) => {
47
+ for (let r = t - 1; r >= 0; r -= 1) {
48
+ if (e[r] === ")") return !1;
49
+ if (e[r] === "(") return r > 0 && e[r - 1] === "]" ? jt(e, t) : !1;
50
+ if (e[r] === `
51
+ `) return !1;
52
+ }
53
+ return !1;
54
+ }, se = (e, t, r) => {
55
+ let n = 0;
56
+ for (let o = t - 1; o >= 0; o -= 1) if (e[o] === `
57
+ `) {
58
+ n = o + 1;
59
+ break;
60
+ }
61
+ let l = e.length;
62
+ for (let o = t; o < e.length; o += 1) if (e[o] === `
63
+ `) {
64
+ l = o;
65
+ break;
66
+ }
67
+ let i = e.substring(n, l), a = 0, s = !1;
68
+ for (let o of i) if (o === r) a += 1;
69
+ else if (o !== " " && o !== " ") {
70
+ s = !0;
71
+ break;
72
+ }
73
+ return a >= 3 && !s;
74
+ }, Ft = /^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm, Zt = (e) => !e || typeof e != "string" || !e.includes(">") ? e : e.replace(Ft, (t, r, n, l) => P(e, l) ? t : `${r}\\>${n}`), Gt = (e, t, r) => {
75
+ if (r !== " " && r !== " ") return !1;
76
+ let n = 0;
77
+ for (let l = t - 1; l >= 0; l -= 1) if (e[l] === `
78
+ `) {
79
+ n = l + 1;
80
+ break;
81
+ }
82
+ for (let l = n; l < t; l += 1) if (e[l] !== " " && e[l] !== " ") return !1;
83
+ return !0;
84
+ }, Kt = (e, t, r, n) => r === "\\" || e.includes("$") && Q(e, t) ? !0 : r !== "*" && n === "*" ? (t < e.length - 2 ? e[t + 2] : "") !== "*" : !!(r === "*" || r && n && C(r) && C(n) || (!r || r === " " || r === " " || r === `
85
+ `) && (!n || n === " " || n === " " || n === `
86
+ `) || Gt(e, t, n)), We = (e) => {
87
+ let t = 0, r = e.length;
88
+ for (let n = 0; n < r; n += 1) {
89
+ if (e[n] !== "*") continue;
90
+ let l = n > 0 ? e[n - 1] : "", i = n < r - 1 ? e[n + 1] : "";
91
+ Kt(e, n, l, i) || (t += 1);
92
+ }
93
+ return t;
94
+ }, Ut = (e, t, r, n) => !!(r === "\\" || e.includes("$") && Q(e, t) || He(e, t) || r === "_" || n === "_" || r && n && C(r) && C(n)), Qt = (e) => {
95
+ let t = 0, r = e.length;
96
+ for (let n = 0; n < r; n += 1) {
97
+ if (e[n] !== "_") continue;
98
+ let l = n > 0 ? e[n - 1] : "", i = n < r - 1 ? e[n + 1] : "";
99
+ Ut(e, n, l, i) || (t += 1);
100
+ }
101
+ return t;
102
+ }, Xt = (e) => {
103
+ let t = 0, r = 0;
104
+ for (let n = 0; n < e.length; n += 1) e[n] === "*" ? r += 1 : (r >= 3 && (t += Math.floor(r / 3)), r = 0);
105
+ return r >= 3 && (t += Math.floor(r / 3)), t;
106
+ }, Jt = (e, t, r) => {
107
+ if (!t || O.test(t)) return !0;
108
+ let n = e.substring(0, r).lastIndexOf(`
109
+ `), l = n === -1 ? 0 : n + 1, i = e.substring(l, r);
110
+ return Ne.test(i) && t.includes(`
111
+ `) ? !0 : se(e, r, "*");
112
+ }, Vt = (e) => {
113
+ let t = e.match(Ct);
114
+ if (!t) return e;
115
+ let r = t[2], n = e.lastIndexOf(t[1]);
116
+ return P(e, n) || Jt(e, r, n) ? e : (e.match(/\*\*/g) || []).length % 2 === 1 ? r.endsWith("*") ? `${e}*` : `${e}**` : e;
117
+ }, Yt = (e, t, r) => {
118
+ if (!t || O.test(t)) return !0;
119
+ let n = e.substring(0, r).lastIndexOf(`
120
+ `), l = n === -1 ? 0 : n + 1, i = e.substring(l, r);
121
+ return Ne.test(i) && t.includes(`
122
+ `) ? !0 : se(e, r, "_");
123
+ }, er = (e) => {
124
+ let t = e.match(It);
125
+ if (!t) {
126
+ let l = e.match(Nt);
127
+ if (l) {
128
+ let i = e.lastIndexOf(l[1]);
129
+ if (!P(e, i) && (e.match(Ht) || []).length % 2 === 1) return `${e}_`;
130
+ }
131
+ return e;
132
+ }
133
+ let r = t[2], n = e.lastIndexOf(t[1]);
134
+ return P(e, n) || Yt(e, r, n) ? e : (e.match(/__/g) || []).length % 2 === 1 ? `${e}__` : e;
135
+ }, tr = (e) => {
136
+ for (let t = 0; t < e.length; t += 1) if (e[t] === "*" && e[t - 1] !== "*" && e[t + 1] !== "*" && e[t - 1] !== "\\" && !Q(e, t)) {
137
+ let r = t > 0 ? e[t - 1] : "", n = t < e.length - 1 ? e[t + 1] : "";
138
+ if ((!r || r === " " || r === " " || r === `
139
+ `) && (!n || n === " " || n === " " || n === `
140
+ `) || r && n && C(r) && C(n)) continue;
141
+ return t;
142
+ }
143
+ return -1;
144
+ }, rr = (e) => {
145
+ if (!e.match(Pt)) return e;
146
+ let t = tr(e);
147
+ if (t === -1 || P(e, t)) return e;
148
+ let r = e.substring(t + 1);
149
+ return !r || O.test(r) ? e : We(e) % 2 === 1 ? `${e}*` : e;
150
+ }, je = (e) => {
151
+ for (let t = 0; t < e.length; t += 1) if (e[t] === "_" && e[t - 1] !== "_" && e[t + 1] !== "_" && e[t - 1] !== "\\" && !Q(e, t) && !He(e, t)) {
152
+ let r = t > 0 ? e[t - 1] : "", n = t < e.length - 1 ? e[t + 1] : "";
153
+ if (r && n && C(r) && C(n)) continue;
154
+ return t;
155
+ }
156
+ return -1;
157
+ }, nr = (e) => {
158
+ let t = e.length;
159
+ for (; t > 0 && e[t - 1] === `
160
+ `; ) t -= 1;
161
+ if (t < e.length) {
162
+ let r = e.slice(0, t), n = e.slice(t);
163
+ return `${r}_${n}`;
164
+ }
165
+ return `${e}_`;
166
+ }, lr = (e) => {
167
+ if (!e.endsWith("**")) return null;
168
+ let t = e.slice(0, -2);
169
+ if ((t.match(/\*\*/g) || []).length % 2 !== 1) return null;
170
+ let r = t.indexOf("**"), n = je(t);
171
+ return r !== -1 && n !== -1 && r < n ? `${t}_**` : null;
172
+ }, sr = (e) => {
173
+ if (!e.match(Et)) return e;
174
+ let t = je(e);
175
+ if (t === -1 || P(e, t)) return e;
176
+ let r = e.substring(t + 1);
177
+ if (!r || O.test(r)) return e;
178
+ if (Qt(e) % 2 === 1) {
179
+ let n = lr(e);
180
+ return n !== null ? n : nr(e);
181
+ }
182
+ return e;
183
+ }, ir = (e) => {
184
+ let t = (e.match(/\*\*/g) || []).length, r = We(e);
185
+ return t % 2 === 0 && r % 2 === 0;
186
+ }, ar = (e, t, r) => !t || O.test(t) || P(e, r) ? !0 : se(e, r, "*"), or = (e) => {
187
+ if (qt.test(e)) return e;
188
+ let t = e.match(zt);
189
+ if (!t) return e;
190
+ let r = t[2], n = e.lastIndexOf(t[1]);
191
+ return ar(e, r, n) ? e : Xt(e) % 2 === 1 ? ir(e) ? e : `${e}***` : e;
192
+ }, D = (e, t) => {
193
+ let r = !1, n = !1;
194
+ for (let l = 0; l < t; l += 1) {
195
+ if (e.substring(l, l + 3) === "```") {
196
+ n = !n, l += 2;
197
+ continue;
198
+ }
199
+ !n && e[l] === "`" && (r = !r);
200
+ }
201
+ return r || n;
202
+ }, cr = (e, t) => {
203
+ let r = e.substring(t, t + 3) === "```", n = t > 0 && e.substring(t - 1, t + 2) === "```", l = t > 1 && e.substring(t - 2, t + 1) === "```";
204
+ return r || n || l;
205
+ }, ur = (e) => {
206
+ let t = 0;
207
+ for (let r = 0; r < e.length; r += 1) e[r] === "`" && !cr(e, r) && (t += 1);
208
+ return t;
209
+ }, hr = /<[a-zA-Z/][^>]*$/, dr = (e) => {
210
+ let t = e.match(hr);
211
+ return !t || t.index === void 0 || D(e, t.index) ? e : e.substring(0, t.index).trimEnd();
212
+ }, pr = (e) => !e.match(Mt) || e.includes(`
213
+ `) ? null : e.endsWith("``") && !e.endsWith("```") ? `${e}\`` : e, fr = (e) => (e.match(/```/g) || []).length % 2 === 1, gr = (e) => {
214
+ let t = pr(e);
215
+ if (t !== null) return t;
216
+ let r = e.match(Ot);
217
+ if (r && !fr(e)) {
218
+ let n = r[2];
219
+ if (!n || O.test(n)) return e;
220
+ if (ur(e) % 2 === 1) return `${e}\``;
221
+ }
222
+ return e;
223
+ }, kr = (e, t) => t >= 2 && e.substring(t - 2, t + 1) === "```" || t >= 1 && e.substring(t - 1, t + 2) === "```" || t <= e.length - 3 && e.substring(t, t + 3) === "```", mr = (e) => {
224
+ let t = 0, r = !1;
225
+ for (let n = 0; n < e.length - 1; n += 1) e[n] === "`" && !kr(e, n) && (r = !r), !r && e[n] === "$" && e[n + 1] === "$" && (t += 1, n += 1);
226
+ return t;
227
+ }, br = (e) => {
228
+ let t = e.indexOf("$$");
229
+ return t !== -1 && e.indexOf(`
230
+ `, t) !== -1 && !e.endsWith(`
231
+ `) ? `${e}
232
+ $$` : `${e}$$`;
233
+ }, xr = (e) => mr(e) % 2 === 0 ? e : br(e), wr = (e, t, r) => {
234
+ if (e.substring(t + 2).includes(")")) return null;
235
+ let n = Wt(e, t);
236
+ if (n === -1 || D(e, n)) return null;
237
+ let l = n > 0 && e[n - 1] === "!", i = l ? n - 1 : n, a = e.substring(0, i);
238
+ if (l) return a;
239
+ let s = e.substring(n + 1, t);
240
+ return r === "text-only" ? `${a}${s}` : `${a}[${s}](streamdown:incomplete-link)`;
241
+ }, ye = (e, t) => {
242
+ for (let r = 0; r <= t; r++) if (e[r] === "[" && !D(e, r)) {
243
+ if (r > 0 && e[r - 1] === "!") continue;
244
+ let n = De(e, r);
245
+ if (n === -1) return r;
246
+ if (n + 1 < e.length && e[n + 1] === "(") {
247
+ let l = e.indexOf(")", n + 2);
248
+ l !== -1 && (r = l);
249
+ }
250
+ }
251
+ return -1;
252
+ }, yr = (e, t, r) => {
253
+ let n = t > 0 && e[t - 1] === "!", l = n ? t - 1 : t, i = e.substring(t + 1);
254
+ if (!i.includes("]")) {
255
+ let a = e.substring(0, l);
256
+ if (n) return a;
257
+ if (r === "text-only") {
258
+ let s = ye(e, t);
259
+ return s !== -1 ? e.substring(0, s) + e.substring(s + 1) : `${a}${i}`;
260
+ }
261
+ return `${e}](streamdown:incomplete-link)`;
262
+ }
263
+ if (De(e, t) === -1) {
264
+ let a = e.substring(0, l);
265
+ if (n) return a;
266
+ if (r === "text-only") {
267
+ let s = ye(e, t);
268
+ if (s !== -1) return e.substring(0, s) + e.substring(s + 1);
269
+ let o = e.substring(t + 1);
270
+ return `${a}${o}`;
271
+ }
272
+ return `${e}](streamdown:incomplete-link)`;
273
+ }
274
+ return null;
275
+ }, Fe = (e, t = "protocol") => {
276
+ let r = e.lastIndexOf("](");
277
+ if (r !== -1 && !D(e, r)) {
278
+ let n = wr(e, r, t);
279
+ if (n !== null) return n;
280
+ }
281
+ for (let n = e.length - 1; n >= 0; n -= 1) if (e[n] === "[" && !D(e, n)) {
282
+ let l = yr(e, n, t);
283
+ if (l !== null) return l;
284
+ }
285
+ return e;
286
+ }, Sr = /^-{1,2}$/, $r = /^[\s]*-{1,2}[\s]+$/, Rr = /^={1,2}$/, Tr = /^[\s]*={1,2}[\s]+$/, Ar = (e) => {
287
+ if (!e || typeof e != "string") return e;
288
+ let t = e.lastIndexOf(`
289
+ `);
290
+ if (t === -1) return e;
291
+ let r = e.substring(t + 1), n = e.substring(0, t), l = r.trim();
292
+ if (Sr.test(l) && !r.match($r)) {
293
+ let i = n.split(`
294
+ `).at(-1);
295
+ if (i && i.trim().length > 0) return `${e}​`;
296
+ }
297
+ if (Rr.test(l) && !r.match(Tr)) {
298
+ let i = n.split(`
299
+ `).at(-1);
300
+ if (i && i.trim().length > 0) return `${e}​`;
301
+ }
302
+ return e;
303
+ }, vr = (e) => {
304
+ let t = e.match(Lt);
305
+ if (t) {
306
+ let r = t[2];
307
+ if (!r || O.test(r)) return e;
308
+ if ((e.match(we) || []).length % 2 === 1) return `${e}~~`;
309
+ } else if (e.match(Dt) && (e.match(we) || []).length % 2 === 1) return `${e}~`;
310
+ return e;
311
+ }, ee = (e) => e !== !1, S = { COMPARISON_OPERATORS: -10, HTML_TAGS: -5, SETEXT_HEADINGS: 0, LINKS: 10, BOLD_ITALIC: 20, BOLD: 30, ITALIC_DOUBLE_UNDERSCORE: 40, ITALIC_SINGLE_ASTERISK: 41, ITALIC_SINGLE_UNDERSCORE: 42, INLINE_CODE: 50, STRIKETHROUGH: 60, KATEX: 70, DEFAULT: 100 }, _r = [{ handler: { name: "comparisonOperators", handle: Zt, priority: S.COMPARISON_OPERATORS }, optionKey: "comparisonOperators" }, { handler: { name: "htmlTags", handle: dr, priority: S.HTML_TAGS }, optionKey: "htmlTags" }, { handler: { name: "setextHeadings", handle: Ar, priority: S.SETEXT_HEADINGS }, optionKey: "setextHeadings" }, { handler: { name: "links", handle: Fe, priority: S.LINKS }, optionKey: "links", earlyReturn: (e) => e.endsWith("](streamdown:incomplete-link)") }, { handler: { name: "boldItalic", handle: or, priority: S.BOLD_ITALIC }, optionKey: "boldItalic" }, { handler: { name: "bold", handle: Vt, priority: S.BOLD }, optionKey: "bold" }, { handler: { name: "italicDoubleUnderscore", handle: er, priority: S.ITALIC_DOUBLE_UNDERSCORE }, optionKey: "italic" }, { handler: { name: "italicSingleAsterisk", handle: rr, priority: S.ITALIC_SINGLE_ASTERISK }, optionKey: "italic" }, { handler: { name: "italicSingleUnderscore", handle: sr, priority: S.ITALIC_SINGLE_UNDERSCORE }, optionKey: "italic" }, { handler: { name: "inlineCode", handle: gr, priority: S.INLINE_CODE }, optionKey: "inlineCode" }, { handler: { name: "strikethrough", handle: vr, priority: S.STRIKETHROUGH }, optionKey: "strikethrough" }, { handler: { name: "katex", handle: xr, priority: S.KATEX }, optionKey: "katex" }], Cr = (e) => {
312
+ var t;
313
+ let r = (t = e == null ? void 0 : e.linkMode) != null ? t : "protocol";
314
+ return _r.filter(({ handler: n, optionKey: l }) => n.name === "links" ? ee(e == null ? void 0 : e.links) || ee(e == null ? void 0 : e.images) : ee(e == null ? void 0 : e[l])).map(({ handler: n, earlyReturn: l }) => n.name === "links" ? { handler: qe(Me({}, n), { handle: (i) => Fe(i, r) }), earlyReturn: r === "protocol" ? l : void 0 } : { handler: n, earlyReturn: l });
315
+ }, Ir = (e, t) => {
316
+ var r;
317
+ if (!e || typeof e != "string") return e;
318
+ let n = e.endsWith(" ") && !e.endsWith(" ") ? e.slice(0, -1) : e, l = Cr(t), i = ((r = t == null ? void 0 : t.handlers) != null ? r : []).map((s) => {
319
+ var o;
320
+ return { handler: qe(Me({}, s), { priority: (o = s.priority) != null ? o : S.DEFAULT }), earlyReturn: void 0 };
321
+ }), a = [...l, ...i].sort((s, o) => {
322
+ var c, u;
323
+ return ((c = s.handler.priority) != null ? c : S.DEFAULT) - ((u = o.handler.priority) != null ? u : S.DEFAULT);
324
+ });
325
+ for (let { handler: s, earlyReturn: o } of a) if (n = s.handle(n), o != null && o(n)) return n;
326
+ return n;
327
+ }, zr = Ir;
328
+ const Pr = {
4
329
  color: "#1f2328",
5
330
  backgroundColor: "#ffffff",
6
331
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif',
7
332
  fontSize: "16px",
8
333
  lineHeight: "1.5",
9
334
  wordWrap: "break-word"
10
- }, P = {
335
+ }, Ze = {
11
336
  h1: {
12
337
  fontSize: "2em",
13
338
  fontWeight: 600,
@@ -124,117 +449,117 @@ const M = Symbol("MarkdownWorkerPoll"), V = {
124
449
  del: {
125
450
  color: "#656d76"
126
451
  }
127
- }, _ = "mjx-", K = /* @__PURE__ */ new Set(["math"]);
128
- function N(e) {
452
+ }, Er = "mjx-", Or = /* @__PURE__ */ new Set(["math"]);
453
+ function Ge(e) {
129
454
  if (!e) return {};
130
- const n = { ...e };
131
- return "className" in n && (n.class = n.className, delete n.className), "htmlFor" in n && (n.for = n.htmlFor, delete n.htmlFor), n;
455
+ const t = { ...e };
456
+ return "className" in t && (t.class = t.className, delete t.className), "htmlFor" in t && (t.for = t.htmlFor, delete t.htmlFor), t;
132
457
  }
133
- function q(e, n) {
134
- return n ? Array.isArray(n) ? [e ?? {}, ...n] : [e ?? {}, n] : e;
458
+ function Ke(e, t) {
459
+ return t ? Array.isArray(t) ? [e ?? {}, ...t] : [e ?? {}, t] : e;
135
460
  }
136
- function c(e) {
137
- return (n) => {
138
- const { children: t, style: r, ...l } = n, i = { ...l };
461
+ function w(e) {
462
+ return (t) => {
463
+ const { children: r, style: n, ...l } = t, i = { ...l };
139
464
  delete i.node;
140
- const d = t ?? void 0, u = { ...i, style: q(P[e], r) };
141
- return d === void 0 ? h(e, u) : h(e, u, d);
465
+ const a = r ?? void 0, s = { ...i, style: Ke(Ze[e], n) };
466
+ return a === void 0 ? v(e, s) : v(e, s, a);
142
467
  };
143
468
  }
144
- function X() {
469
+ function Lr() {
145
470
  return (e) => {
146
471
  const {
147
- children: n,
148
- style: t,
149
- class: r,
472
+ children: t,
473
+ style: r,
474
+ class: n,
150
475
  className: l,
151
476
  ...i
152
- } = e, d = { ...i };
153
- delete d.node;
154
- const u = r ?? l, m = typeof u == "string" ? u : void 0, p = !!(m && m.includes("language-")), f = P.code ?? {}, s = p ? {
155
- fontFamily: f.fontFamily,
156
- fontSize: f.fontSize,
477
+ } = e, a = { ...i };
478
+ delete a.node;
479
+ const s = n ?? l, o = typeof s == "string" ? s : void 0, c = !!(o && o.includes("language-")), u = Ze.code ?? {}, p = c ? {
480
+ fontFamily: u.fontFamily,
481
+ fontSize: u.fontSize,
157
482
  padding: 0,
158
483
  backgroundColor: "transparent"
159
- } : f, g = n ?? void 0, o = {
160
- ...d,
161
- class: u,
162
- style: q(s, t)
484
+ } : u, f = t ?? void 0, d = {
485
+ ...a,
486
+ class: s,
487
+ style: Ke(p, r)
163
488
  };
164
- return g === void 0 ? h("code", o) : h("code", o, g);
489
+ return f === void 0 ? v("code", d) : v("code", d, f);
165
490
  };
166
491
  }
167
- function Q() {
492
+ function Br() {
168
493
  return {
169
- h1: c("h1"),
170
- h2: c("h2"),
171
- h3: c("h3"),
172
- h4: c("h4"),
173
- h5: c("h5"),
174
- h6: c("h6"),
175
- p: c("p"),
176
- blockquote: c("blockquote"),
177
- ul: c("ul"),
178
- ol: c("ol"),
179
- li: c("li"),
180
- table: c("table"),
181
- th: c("th"),
182
- td: c("td"),
183
- pre: c("pre"),
184
- code: X(),
185
- a: c("a"),
186
- hr: c("hr"),
187
- img: c("img"),
188
- kbd: c("kbd"),
189
- del: c("del")
494
+ h1: w("h1"),
495
+ h2: w("h2"),
496
+ h3: w("h3"),
497
+ h4: w("h4"),
498
+ h5: w("h5"),
499
+ h6: w("h6"),
500
+ p: w("p"),
501
+ blockquote: w("blockquote"),
502
+ ul: w("ul"),
503
+ ol: w("ol"),
504
+ li: w("li"),
505
+ table: w("table"),
506
+ th: w("th"),
507
+ td: w("td"),
508
+ pre: w("pre"),
509
+ code: Lr(),
510
+ a: w("a"),
511
+ hr: w("hr"),
512
+ img: w("img"),
513
+ kbd: w("kbd"),
514
+ del: w("del")
190
515
  };
191
516
  }
192
- const Y = Q();
193
- function Z(e) {
194
- const n = { ...e };
195
- for (const t of Object.keys(n))
196
- (t.startsWith(_) || K.has(t)) && delete n[t];
197
- return n;
517
+ const Mr = Br();
518
+ function qr(e) {
519
+ const t = { ...e };
520
+ for (const r of Object.keys(t))
521
+ (r.startsWith(Er) || Or.has(r)) && delete t[r];
522
+ return t;
198
523
  }
199
- function $(e) {
200
- const n = {
201
- ...Y,
524
+ function Nr(e) {
525
+ const t = {
526
+ ...Mr,
202
527
  ...(e == null ? void 0 : e.components) ?? {}
203
528
  };
204
- return e != null && e.codeRenderer && (n.code = e.codeRenderer), Z(n);
529
+ return e != null && e.codeRenderer && (t.code = e.codeRenderer), qr(t);
205
530
  }
206
- const w = (e, n, t) => {
207
- const r = N(n), { children: l, ...i } = r, d = t == null ? i : { ...i, key: t };
531
+ const Se = (e, t, r) => {
532
+ const n = Ge(t), { children: l, ...i } = n, a = r == null ? i : { ...i, key: r };
208
533
  if (typeof e == "string") {
209
- const m = { ...d };
210
- return delete m.node, l == null ? h(e, m) : h(e, m, l);
534
+ const o = { ...a };
535
+ return delete o.node, l == null ? v(e, o) : v(e, o, l);
211
536
  }
212
537
  if (l == null)
213
- return h(e, d);
214
- const u = { ...d, children: l };
215
- return h(e, u, l);
538
+ return v(e, a);
539
+ const s = { ...a, children: l };
540
+ return v(e, s, l);
216
541
  };
217
- function v(e, n) {
218
- const t = [];
219
- for (let r = 0; r < e.children.length; r += 1) {
220
- const l = z(e.children[r], n, r);
221
- l != null && t.push(l);
542
+ function $e(e, t) {
543
+ const r = [];
544
+ for (let n = 0; n < e.children.length; n += 1) {
545
+ const l = Ue(e.children[n], t, n);
546
+ l != null && r.push(l);
222
547
  }
223
- return t;
548
+ return r;
224
549
  }
225
- function z(e, n, t) {
550
+ function Ue(e, t, r) {
226
551
  switch (e.type) {
227
552
  case "root": {
228
- const r = v(e, n);
229
- return r.length ? w(O, { children: r }, void 0) : null;
553
+ const n = $e(e, t);
554
+ return n.length ? Se(Ee, { children: n }, void 0) : null;
230
555
  }
231
556
  case "element": {
232
- const r = e, l = n[r.tagName] ?? r.tagName, i = N(
233
- r.properties ?? {}
557
+ const n = e, l = t[n.tagName] ?? n.tagName, i = Ge(
558
+ n.properties ?? {}
234
559
  );
235
- i.node = r;
236
- const d = r.tagName === "template" && r.content ? r.content : r, u = v(d, n);
237
- return u.length && (i.children = u), w(l, i, t == null ? void 0 : t.toString());
560
+ i.node = n;
561
+ const a = n.tagName === "template" && n.content ? n.content : n, s = $e(a, t);
562
+ return s.length && (i.children = s), Se(l, i, r == null ? void 0 : r.toString());
238
563
  }
239
564
  case "text":
240
565
  return e.value;
@@ -244,11 +569,1307 @@ function z(e, n, t) {
244
569
  return null;
245
570
  }
246
571
  }
247
- function A(e, n) {
248
- const t = $(n);
249
- return z(e, t);
572
+ function Re(e, t) {
573
+ const r = Nr(t);
574
+ return Ue(e, r);
575
+ }
576
+ function ie() {
577
+ return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
578
+ }
579
+ var L = ie();
580
+ function Qe(e) {
581
+ L = e;
582
+ }
583
+ var z = { exec: () => null };
584
+ function g(e, t = "") {
585
+ let r = typeof e == "string" ? e : e.source, n = { replace: (l, i) => {
586
+ let a = typeof i == "string" ? i : i.source;
587
+ return a = a.replace($.caret, "$1"), r = r.replace(l, a), n;
588
+ }, getRegex: () => new RegExp(r, t) };
589
+ return n;
590
+ }
591
+ var Dr = (() => {
592
+ try {
593
+ return !!new RegExp("(?<=1)(?<!1)");
594
+ } catch {
595
+ return !1;
596
+ }
597
+ })(), $ = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (e) => new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}#`), htmlBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}>`) }, Hr = /^(?:[ \t]*(?:\n|$))+/, Wr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, jr = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, H = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Fr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ae = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Xe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Je = g(Xe).replace(/bull/g, ae).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Zr = g(Xe).replace(/bull/g, ae).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), oe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Gr = /^[^\n]+/, ce = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Kr = g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ce).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ur = g(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, ae).getRegex(), X = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", ue = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Qr = g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ue).replace("tag", X).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Ve = g(oe).replace("hr", H).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", X).getRegex(), Xr = g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ve).getRegex(), he = { blockquote: Xr, code: Wr, def: Kr, fences: jr, heading: Fr, hr: H, html: Qr, lheading: Je, list: Ur, newline: Hr, paragraph: Ve, table: z, text: Gr }, Te = g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", H).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", X).getRegex(), Jr = { ...he, lheading: Zr, table: Te, paragraph: g(oe).replace("hr", H).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Te).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", X).getRegex() }, Vr = { ...he, html: g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ue).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: z, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: g(oe).replace("hr", H).replace("heading", ` *#{1,6} *[^
598
+ ]`).replace("lheading", Je).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Yr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, en = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Ye = /^( {2,}|\\)\n(?!\s*$)/, tn = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, J = /[\p{P}\p{S}]/u, de = /[\s\p{P}\p{S}]/u, et = /[^\s\p{P}\p{S}]/u, rn = g(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, de).getRegex(), tt = /(?!~)[\p{P}\p{S}]/u, nn = /(?!~)[\s\p{P}\p{S}]/u, ln = /(?:[^\s\p{P}\p{S}]|~)/u, rt = /(?![*_])[\p{P}\p{S}]/u, sn = /(?![*_])[\s\p{P}\p{S}]/u, an = /(?:[^\s\p{P}\p{S}]|[*_])/u, on = g(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Dr ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), nt = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, cn = g(nt, "u").replace(/punct/g, J).getRegex(), un = g(nt, "u").replace(/punct/g, tt).getRegex(), lt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", hn = g(lt, "gu").replace(/notPunctSpace/g, et).replace(/punctSpace/g, de).replace(/punct/g, J).getRegex(), dn = g(lt, "gu").replace(/notPunctSpace/g, ln).replace(/punctSpace/g, nn).replace(/punct/g, tt).getRegex(), pn = g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, et).replace(/punctSpace/g, de).replace(/punct/g, J).getRegex(), fn = g(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, rt).getRegex(), gn = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", kn = g(gn, "gu").replace(/notPunctSpace/g, an).replace(/punctSpace/g, sn).replace(/punct/g, rt).getRegex(), mn = g(/\\(punct)/, "gu").replace(/punct/g, J).getRegex(), bn = g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), xn = g(ue).replace("(?:-->|$)", "-->").getRegex(), wn = g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", xn).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Z = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, yn = g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Z).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), st = g(/^!?\[(label)\]\[(ref)\]/).replace("label", Z).replace("ref", ce).getRegex(), it = g(/^!?\[(ref)\](?:\[\])?/).replace("ref", ce).getRegex(), Sn = g("reflink|nolink(?!\\()", "g").replace("reflink", st).replace("nolink", it).getRegex(), Ae = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, pe = { _backpedal: z, anyPunctuation: mn, autolink: bn, blockSkip: on, br: Ye, code: en, del: z, delLDelim: z, delRDelim: z, emStrongLDelim: cn, emStrongRDelimAst: hn, emStrongRDelimUnd: pn, escape: Yr, link: yn, nolink: it, punctuation: rn, reflink: st, reflinkSearch: Sn, tag: wn, text: tn, url: z }, $n = { ...pe, link: g(/^!?\[(label)\]\((.*?)\)/).replace("label", Z).getRegex(), reflink: g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Z).getRegex() }, re = { ...pe, emStrongRDelimAst: dn, emStrongLDelim: un, delLDelim: fn, delRDelim: kn, url: g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Ae).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: g(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Ae).getRegex() }, Rn = { ...re, br: g(Ye).replace("{2,}", "*").getRegex(), text: g(re.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, j = { normal: he, gfm: Jr, pedantic: Vr }, M = { normal: pe, gfm: re, breaks: Rn, pedantic: $n }, Tn = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ve = (e) => Tn[e];
599
+ function A(e, t) {
600
+ if (t) {
601
+ if ($.escapeTest.test(e)) return e.replace($.escapeReplace, ve);
602
+ } else if ($.escapeTestNoEncode.test(e)) return e.replace($.escapeReplaceNoEncode, ve);
603
+ return e;
604
+ }
605
+ function _e(e) {
606
+ try {
607
+ e = encodeURI(e).replace($.percentDecode, "%");
608
+ } catch {
609
+ return null;
610
+ }
611
+ return e;
612
+ }
613
+ function Ce(e, t) {
614
+ var i;
615
+ let r = e.replace($.findPipe, (a, s, o) => {
616
+ let c = !1, u = s;
617
+ for (; --u >= 0 && o[u] === "\\"; ) c = !c;
618
+ return c ? "|" : " |";
619
+ }), n = r.split($.splitPipe), l = 0;
620
+ if (n[0].trim() || n.shift(), n.length > 0 && !((i = n.at(-1)) != null && i.trim()) && n.pop(), t) if (n.length > t) n.splice(t);
621
+ else for (; n.length < t; ) n.push("");
622
+ for (; l < n.length; l++) n[l] = n[l].trim().replace($.slashPipe, "|");
623
+ return n;
624
+ }
625
+ function q(e, t, r) {
626
+ let n = e.length;
627
+ if (n === 0) return "";
628
+ let l = 0;
629
+ for (; l < n && e.charAt(n - l - 1) === t; )
630
+ l++;
631
+ return e.slice(0, n - l);
632
+ }
633
+ function An(e, t) {
634
+ if (e.indexOf(t[1]) === -1) return -1;
635
+ let r = 0;
636
+ for (let n = 0; n < e.length; n++) if (e[n] === "\\") n++;
637
+ else if (e[n] === t[0]) r++;
638
+ else if (e[n] === t[1] && (r--, r < 0)) return n;
639
+ return r > 0 ? -2 : -1;
640
+ }
641
+ function vn(e, t = 0) {
642
+ let r = t, n = "";
643
+ for (let l of e) if (l === " ") {
644
+ let i = 4 - r % 4;
645
+ n += " ".repeat(i), r += i;
646
+ } else n += l, r++;
647
+ return n;
648
+ }
649
+ function Ie(e, t, r, n, l) {
650
+ let i = t.href, a = t.title || null, s = e[1].replace(l.other.outputLinkReplace, "$1");
651
+ n.state.inLink = !0;
652
+ let o = { type: e[0].charAt(0) === "!" ? "image" : "link", raw: r, href: i, title: a, text: s, tokens: n.inlineTokens(s) };
653
+ return n.state.inLink = !1, o;
654
+ }
655
+ function _n(e, t, r) {
656
+ let n = e.match(r.other.indentCodeCompensation);
657
+ if (n === null) return t;
658
+ let l = n[1];
659
+ return t.split(`
660
+ `).map((i) => {
661
+ let a = i.match(r.other.beginningSpace);
662
+ if (a === null) return i;
663
+ let [s] = a;
664
+ return s.length >= l.length ? i.slice(l.length) : i;
665
+ }).join(`
666
+ `);
667
+ }
668
+ var G = class {
669
+ constructor(e) {
670
+ b(this, "options");
671
+ b(this, "rules");
672
+ b(this, "lexer");
673
+ this.options = e || L;
674
+ }
675
+ space(e) {
676
+ let t = this.rules.block.newline.exec(e);
677
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
678
+ }
679
+ code(e) {
680
+ let t = this.rules.block.code.exec(e);
681
+ if (t) {
682
+ let r = t[0].replace(this.rules.other.codeRemoveIndent, "");
683
+ return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? r : q(r, `
684
+ `) };
685
+ }
686
+ }
687
+ fences(e) {
688
+ let t = this.rules.block.fences.exec(e);
689
+ if (t) {
690
+ let r = t[0], n = _n(r, t[3] || "", this.rules);
691
+ return { type: "code", raw: r, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: n };
692
+ }
693
+ }
694
+ heading(e) {
695
+ let t = this.rules.block.heading.exec(e);
696
+ if (t) {
697
+ let r = t[2].trim();
698
+ if (this.rules.other.endingHash.test(r)) {
699
+ let n = q(r, "#");
700
+ (this.options.pedantic || !n || this.rules.other.endingSpaceChar.test(n)) && (r = n.trim());
701
+ }
702
+ return { type: "heading", raw: t[0], depth: t[1].length, text: r, tokens: this.lexer.inline(r) };
703
+ }
704
+ }
705
+ hr(e) {
706
+ let t = this.rules.block.hr.exec(e);
707
+ if (t) return { type: "hr", raw: q(t[0], `
708
+ `) };
709
+ }
710
+ blockquote(e) {
711
+ let t = this.rules.block.blockquote.exec(e);
712
+ if (t) {
713
+ let r = q(t[0], `
714
+ `).split(`
715
+ `), n = "", l = "", i = [];
716
+ for (; r.length > 0; ) {
717
+ let a = !1, s = [], o;
718
+ for (o = 0; o < r.length; o++) if (this.rules.other.blockquoteStart.test(r[o])) s.push(r[o]), a = !0;
719
+ else if (!a) s.push(r[o]);
720
+ else break;
721
+ r = r.slice(o);
722
+ let c = s.join(`
723
+ `), u = c.replace(this.rules.other.blockquoteSetextReplace, `
724
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
725
+ n = n ? `${n}
726
+ ${c}` : c, l = l ? `${l}
727
+ ${u}` : u;
728
+ let p = this.lexer.state.top;
729
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(u, i, !0), this.lexer.state.top = p, r.length === 0) break;
730
+ let f = i.at(-1);
731
+ if ((f == null ? void 0 : f.type) === "code") break;
732
+ if ((f == null ? void 0 : f.type) === "blockquote") {
733
+ let d = f, m = d.raw + `
734
+ ` + r.join(`
735
+ `), h = this.blockquote(m);
736
+ i[i.length - 1] = h, n = n.substring(0, n.length - d.raw.length) + h.raw, l = l.substring(0, l.length - d.text.length) + h.text;
737
+ break;
738
+ } else if ((f == null ? void 0 : f.type) === "list") {
739
+ let d = f, m = d.raw + `
740
+ ` + r.join(`
741
+ `), h = this.list(m);
742
+ i[i.length - 1] = h, n = n.substring(0, n.length - f.raw.length) + h.raw, l = l.substring(0, l.length - d.raw.length) + h.raw, r = m.substring(i.at(-1).raw.length).split(`
743
+ `);
744
+ continue;
745
+ }
746
+ }
747
+ return { type: "blockquote", raw: n, tokens: i, text: l };
748
+ }
749
+ }
750
+ list(e) {
751
+ var r, n;
752
+ let t = this.rules.block.list.exec(e);
753
+ if (t) {
754
+ let l = t[1].trim(), i = l.length > 1, a = { type: "list", raw: "", ordered: i, start: i ? +l.slice(0, -1) : "", loose: !1, items: [] };
755
+ l = i ? `\\d{1,9}\\${l.slice(-1)}` : `\\${l}`, this.options.pedantic && (l = i ? l : "[*+-]");
756
+ let s = this.rules.other.listItemRegex(l), o = !1;
757
+ for (; e; ) {
758
+ let u = !1, p = "", f = "";
759
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
760
+ p = t[0], e = e.substring(p.length);
761
+ let d = vn(t[2].split(`
762
+ `, 1)[0], t[1].length), m = e.split(`
763
+ `, 1)[0], h = !d.trim(), k = 0;
764
+ if (this.options.pedantic ? (k = 2, f = d.trimStart()) : h ? k = t[1].length + 1 : (k = d.search(this.rules.other.nonSpaceChar), k = k > 4 ? 1 : k, f = d.slice(k), k += t[1].length), h && this.rules.other.blankLine.test(m) && (p += m + `
765
+ `, e = e.substring(m.length + 1), u = !0), !u) {
766
+ let y = this.rules.other.nextBulletRegex(k), W = this.rules.other.hrRegex(k), ge = this.rules.other.fencesBeginRegex(k), ke = this.rules.other.headingBeginRegex(k), ut = this.rules.other.htmlBeginRegex(k), ht = this.rules.other.blockquoteBeginRegex(k);
767
+ for (; e; ) {
768
+ let V = e.split(`
769
+ `, 1)[0], B;
770
+ if (m = V, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), B = m) : B = m.replace(this.rules.other.tabCharGlobal, " "), ge.test(m) || ke.test(m) || ut.test(m) || ht.test(m) || y.test(m) || W.test(m)) break;
771
+ if (B.search(this.rules.other.nonSpaceChar) >= k || !m.trim()) f += `
772
+ ` + B.slice(k);
773
+ else {
774
+ if (h || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ge.test(d) || ke.test(d) || W.test(d)) break;
775
+ f += `
776
+ ` + m;
777
+ }
778
+ h = !m.trim(), p += V + `
779
+ `, e = e.substring(V.length + 1), d = B.slice(k);
780
+ }
781
+ }
782
+ a.loose || (o ? a.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (o = !0)), a.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(f), loose: !1, text: f, tokens: [] }), a.raw += p;
783
+ }
784
+ let c = a.items.at(-1);
785
+ if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
786
+ else return;
787
+ a.raw = a.raw.trimEnd();
788
+ for (let u of a.items) {
789
+ if (this.lexer.state.top = !1, u.tokens = this.lexer.blockTokens(u.text, []), u.task) {
790
+ if (u.text = u.text.replace(this.rules.other.listReplaceTask, ""), ((r = u.tokens[0]) == null ? void 0 : r.type) === "text" || ((n = u.tokens[0]) == null ? void 0 : n.type) === "paragraph") {
791
+ u.tokens[0].raw = u.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), u.tokens[0].text = u.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
792
+ for (let f = this.lexer.inlineQueue.length - 1; f >= 0; f--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)) {
793
+ this.lexer.inlineQueue[f].src = this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask, "");
794
+ break;
795
+ }
796
+ }
797
+ let p = this.rules.other.listTaskCheckbox.exec(u.raw);
798
+ if (p) {
799
+ let f = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
800
+ u.checked = f.checked, a.loose ? u.tokens[0] && ["paragraph", "text"].includes(u.tokens[0].type) && "tokens" in u.tokens[0] && u.tokens[0].tokens ? (u.tokens[0].raw = f.raw + u.tokens[0].raw, u.tokens[0].text = f.raw + u.tokens[0].text, u.tokens[0].tokens.unshift(f)) : u.tokens.unshift({ type: "paragraph", raw: f.raw, text: f.raw, tokens: [f] }) : u.tokens.unshift(f);
801
+ }
802
+ }
803
+ if (!a.loose) {
804
+ let p = u.tokens.filter((d) => d.type === "space"), f = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
805
+ a.loose = f;
806
+ }
807
+ }
808
+ if (a.loose) for (let u of a.items) {
809
+ u.loose = !0;
810
+ for (let p of u.tokens) p.type === "text" && (p.type = "paragraph");
811
+ }
812
+ return a;
813
+ }
814
+ }
815
+ html(e) {
816
+ let t = this.rules.block.html.exec(e);
817
+ if (t) return { type: "html", block: !0, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
818
+ }
819
+ def(e) {
820
+ let t = this.rules.block.def.exec(e);
821
+ if (t) {
822
+ let r = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", l = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
823
+ return { type: "def", tag: r, raw: t[0], href: n, title: l };
824
+ }
825
+ }
826
+ table(e) {
827
+ var a;
828
+ let t = this.rules.block.table.exec(e);
829
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
830
+ let r = Ce(t[1]), n = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), l = (a = t[3]) != null && a.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
831
+ `) : [], i = { type: "table", raw: t[0], header: [], align: [], rows: [] };
832
+ if (r.length === n.length) {
833
+ for (let s of n) this.rules.other.tableAlignRight.test(s) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(s) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(s) ? i.align.push("left") : i.align.push(null);
834
+ for (let s = 0; s < r.length; s++) i.header.push({ text: r[s], tokens: this.lexer.inline(r[s]), header: !0, align: i.align[s] });
835
+ for (let s of l) i.rows.push(Ce(s, i.header.length).map((o, c) => ({ text: o, tokens: this.lexer.inline(o), header: !1, align: i.align[c] })));
836
+ return i;
837
+ }
838
+ }
839
+ lheading(e) {
840
+ let t = this.rules.block.lheading.exec(e);
841
+ if (t) return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: t[1], tokens: this.lexer.inline(t[1]) };
842
+ }
843
+ paragraph(e) {
844
+ let t = this.rules.block.paragraph.exec(e);
845
+ if (t) {
846
+ let r = t[1].charAt(t[1].length - 1) === `
847
+ ` ? t[1].slice(0, -1) : t[1];
848
+ return { type: "paragraph", raw: t[0], text: r, tokens: this.lexer.inline(r) };
849
+ }
850
+ }
851
+ text(e) {
852
+ let t = this.rules.block.text.exec(e);
853
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
854
+ }
855
+ escape(e) {
856
+ let t = this.rules.inline.escape.exec(e);
857
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
858
+ }
859
+ tag(e) {
860
+ let t = this.rules.inline.tag.exec(e);
861
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: t[0] };
862
+ }
863
+ link(e) {
864
+ let t = this.rules.inline.link.exec(e);
865
+ if (t) {
866
+ let r = t[2].trim();
867
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
868
+ if (!this.rules.other.endAngleBracket.test(r)) return;
869
+ let i = q(r.slice(0, -1), "\\");
870
+ if ((r.length - i.length) % 2 === 0) return;
871
+ } else {
872
+ let i = An(t[2], "()");
873
+ if (i === -2) return;
874
+ if (i > -1) {
875
+ let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
876
+ t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, a).trim(), t[3] = "";
877
+ }
878
+ }
879
+ let n = t[2], l = "";
880
+ if (this.options.pedantic) {
881
+ let i = this.rules.other.pedanticHrefTitle.exec(n);
882
+ i && (n = i[1], l = i[3]);
883
+ } else l = t[3] ? t[3].slice(1, -1) : "";
884
+ return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? n = n.slice(1) : n = n.slice(1, -1)), Ie(t, { href: n && n.replace(this.rules.inline.anyPunctuation, "$1"), title: l && l.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
885
+ }
886
+ }
887
+ reflink(e, t) {
888
+ let r;
889
+ if ((r = this.rules.inline.reflink.exec(e)) || (r = this.rules.inline.nolink.exec(e))) {
890
+ let n = (r[2] || r[1]).replace(this.rules.other.multipleSpaceGlobal, " "), l = t[n.toLowerCase()];
891
+ if (!l) {
892
+ let i = r[0].charAt(0);
893
+ return { type: "text", raw: i, text: i };
894
+ }
895
+ return Ie(r, l, r[0], this.lexer, this.rules);
896
+ }
897
+ }
898
+ emStrong(e, t, r = "") {
899
+ let n = this.rules.inline.emStrongLDelim.exec(e);
900
+ if (!(!n || n[3] && r.match(this.rules.other.unicodeAlphaNumeric)) && (!(n[1] || n[2]) || !r || this.rules.inline.punctuation.exec(r))) {
901
+ let l = [...n[0]].length - 1, i, a, s = l, o = 0, c = n[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
902
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + l); (n = c.exec(t)) != null; ) {
903
+ if (i = n[1] || n[2] || n[3] || n[4] || n[5] || n[6], !i) continue;
904
+ if (a = [...i].length, n[3] || n[4]) {
905
+ s += a;
906
+ continue;
907
+ } else if ((n[5] || n[6]) && l % 3 && !((l + a) % 3)) {
908
+ o += a;
909
+ continue;
910
+ }
911
+ if (s -= a, s > 0) continue;
912
+ a = Math.min(a, a + s + o);
913
+ let u = [...n[0]][0].length, p = e.slice(0, l + n.index + u + a);
914
+ if (Math.min(l, a) % 2) {
915
+ let d = p.slice(1, -1);
916
+ return { type: "em", raw: p, text: d, tokens: this.lexer.inlineTokens(d) };
917
+ }
918
+ let f = p.slice(2, -2);
919
+ return { type: "strong", raw: p, text: f, tokens: this.lexer.inlineTokens(f) };
920
+ }
921
+ }
922
+ }
923
+ codespan(e) {
924
+ let t = this.rules.inline.code.exec(e);
925
+ if (t) {
926
+ let r = t[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(r), l = this.rules.other.startingSpaceChar.test(r) && this.rules.other.endingSpaceChar.test(r);
927
+ return n && l && (r = r.substring(1, r.length - 1)), { type: "codespan", raw: t[0], text: r };
928
+ }
929
+ }
930
+ br(e) {
931
+ let t = this.rules.inline.br.exec(e);
932
+ if (t) return { type: "br", raw: t[0] };
933
+ }
934
+ del(e, t, r = "") {
935
+ let n = this.rules.inline.delLDelim.exec(e);
936
+ if (n && (!n[1] || !r || this.rules.inline.punctuation.exec(r))) {
937
+ let l = [...n[0]].length - 1, i, a, s = l, o = this.rules.inline.delRDelim;
938
+ for (o.lastIndex = 0, t = t.slice(-1 * e.length + l); (n = o.exec(t)) != null; ) {
939
+ if (i = n[1] || n[2] || n[3] || n[4] || n[5] || n[6], !i || (a = [...i].length, a !== l)) continue;
940
+ if (n[3] || n[4]) {
941
+ s += a;
942
+ continue;
943
+ }
944
+ if (s -= a, s > 0) continue;
945
+ a = Math.min(a, a + s);
946
+ let c = [...n[0]][0].length, u = e.slice(0, l + n.index + c + a), p = u.slice(l, -l);
947
+ return { type: "del", raw: u, text: p, tokens: this.lexer.inlineTokens(p) };
948
+ }
949
+ }
950
+ }
951
+ autolink(e) {
952
+ let t = this.rules.inline.autolink.exec(e);
953
+ if (t) {
954
+ let r, n;
955
+ return t[2] === "@" ? (r = t[1], n = "mailto:" + r) : (r = t[1], n = r), { type: "link", raw: t[0], text: r, href: n, tokens: [{ type: "text", raw: r, text: r }] };
956
+ }
957
+ }
958
+ url(e) {
959
+ var r;
960
+ let t;
961
+ if (t = this.rules.inline.url.exec(e)) {
962
+ let n, l;
963
+ if (t[2] === "@") n = t[0], l = "mailto:" + n;
964
+ else {
965
+ let i;
966
+ do
967
+ i = t[0], t[0] = ((r = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : r[0]) ?? "";
968
+ while (i !== t[0]);
969
+ n = t[0], t[1] === "www." ? l = "http://" + t[0] : l = t[0];
970
+ }
971
+ return { type: "link", raw: t[0], text: n, href: l, tokens: [{ type: "text", raw: n, text: n }] };
972
+ }
973
+ }
974
+ inlineText(e) {
975
+ let t = this.rules.inline.text.exec(e);
976
+ if (t) {
977
+ let r = this.lexer.state.inRawBlock;
978
+ return { type: "text", raw: t[0], text: t[0], escaped: r };
979
+ }
980
+ }
981
+ }, R = class ne {
982
+ constructor(t) {
983
+ b(this, "tokens");
984
+ b(this, "options");
985
+ b(this, "state");
986
+ b(this, "inlineQueue");
987
+ b(this, "tokenizer");
988
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || L, this.options.tokenizer = this.options.tokenizer || new G(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
989
+ let r = { other: $, block: j.normal, inline: M.normal };
990
+ this.options.pedantic ? (r.block = j.pedantic, r.inline = M.pedantic) : this.options.gfm && (r.block = j.gfm, this.options.breaks ? r.inline = M.breaks : r.inline = M.gfm), this.tokenizer.rules = r;
991
+ }
992
+ static get rules() {
993
+ return { block: j, inline: M };
994
+ }
995
+ static lex(t, r) {
996
+ return new ne(r).lex(t);
997
+ }
998
+ static lexInline(t, r) {
999
+ return new ne(r).inlineTokens(t);
1000
+ }
1001
+ lex(t) {
1002
+ t = t.replace($.carriageReturn, `
1003
+ `), this.blockTokens(t, this.tokens);
1004
+ for (let r = 0; r < this.inlineQueue.length; r++) {
1005
+ let n = this.inlineQueue[r];
1006
+ this.inlineTokens(n.src, n.tokens);
1007
+ }
1008
+ return this.inlineQueue = [], this.tokens;
1009
+ }
1010
+ blockTokens(t, r = [], n = !1) {
1011
+ var l, i, a;
1012
+ for (this.options.pedantic && (t = t.replace($.tabCharGlobal, " ").replace($.spaceLine, "")); t; ) {
1013
+ let s;
1014
+ if ((i = (l = this.options.extensions) == null ? void 0 : l.block) != null && i.some((c) => (s = c.call({ lexer: this }, t, r)) ? (t = t.substring(s.raw.length), r.push(s), !0) : !1)) continue;
1015
+ if (s = this.tokenizer.space(t)) {
1016
+ t = t.substring(s.raw.length);
1017
+ let c = r.at(-1);
1018
+ s.raw.length === 1 && c !== void 0 ? c.raw += `
1019
+ ` : r.push(s);
1020
+ continue;
1021
+ }
1022
+ if (s = this.tokenizer.code(t)) {
1023
+ t = t.substring(s.raw.length);
1024
+ let c = r.at(-1);
1025
+ (c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
1026
+ `) ? "" : `
1027
+ `) + s.raw, c.text += `
1028
+ ` + s.text, this.inlineQueue.at(-1).src = c.text) : r.push(s);
1029
+ continue;
1030
+ }
1031
+ if (s = this.tokenizer.fences(t)) {
1032
+ t = t.substring(s.raw.length), r.push(s);
1033
+ continue;
1034
+ }
1035
+ if (s = this.tokenizer.heading(t)) {
1036
+ t = t.substring(s.raw.length), r.push(s);
1037
+ continue;
1038
+ }
1039
+ if (s = this.tokenizer.hr(t)) {
1040
+ t = t.substring(s.raw.length), r.push(s);
1041
+ continue;
1042
+ }
1043
+ if (s = this.tokenizer.blockquote(t)) {
1044
+ t = t.substring(s.raw.length), r.push(s);
1045
+ continue;
1046
+ }
1047
+ if (s = this.tokenizer.list(t)) {
1048
+ t = t.substring(s.raw.length), r.push(s);
1049
+ continue;
1050
+ }
1051
+ if (s = this.tokenizer.html(t)) {
1052
+ t = t.substring(s.raw.length), r.push(s);
1053
+ continue;
1054
+ }
1055
+ if (s = this.tokenizer.def(t)) {
1056
+ t = t.substring(s.raw.length);
1057
+ let c = r.at(-1);
1058
+ (c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
1059
+ `) ? "" : `
1060
+ `) + s.raw, c.text += `
1061
+ ` + s.raw, this.inlineQueue.at(-1).src = c.text) : this.tokens.links[s.tag] || (this.tokens.links[s.tag] = { href: s.href, title: s.title }, r.push(s));
1062
+ continue;
1063
+ }
1064
+ if (s = this.tokenizer.table(t)) {
1065
+ t = t.substring(s.raw.length), r.push(s);
1066
+ continue;
1067
+ }
1068
+ if (s = this.tokenizer.lheading(t)) {
1069
+ t = t.substring(s.raw.length), r.push(s);
1070
+ continue;
1071
+ }
1072
+ let o = t;
1073
+ if ((a = this.options.extensions) != null && a.startBlock) {
1074
+ let c = 1 / 0, u = t.slice(1), p;
1075
+ this.options.extensions.startBlock.forEach((f) => {
1076
+ p = f.call({ lexer: this }, u), typeof p == "number" && p >= 0 && (c = Math.min(c, p));
1077
+ }), c < 1 / 0 && c >= 0 && (o = t.substring(0, c + 1));
1078
+ }
1079
+ if (this.state.top && (s = this.tokenizer.paragraph(o))) {
1080
+ let c = r.at(-1);
1081
+ n && (c == null ? void 0 : c.type) === "paragraph" ? (c.raw += (c.raw.endsWith(`
1082
+ `) ? "" : `
1083
+ `) + s.raw, c.text += `
1084
+ ` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : r.push(s), n = o.length !== t.length, t = t.substring(s.raw.length);
1085
+ continue;
1086
+ }
1087
+ if (s = this.tokenizer.text(t)) {
1088
+ t = t.substring(s.raw.length);
1089
+ let c = r.at(-1);
1090
+ (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
1091
+ `) ? "" : `
1092
+ `) + s.raw, c.text += `
1093
+ ` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : r.push(s);
1094
+ continue;
1095
+ }
1096
+ if (t) {
1097
+ let c = "Infinite loop on byte: " + t.charCodeAt(0);
1098
+ if (this.options.silent) {
1099
+ console.error(c);
1100
+ break;
1101
+ } else throw new Error(c);
1102
+ }
1103
+ }
1104
+ return this.state.top = !0, r;
1105
+ }
1106
+ inline(t, r = []) {
1107
+ return this.inlineQueue.push({ src: t, tokens: r }), r;
1108
+ }
1109
+ inlineTokens(t, r = []) {
1110
+ var o, c, u, p, f;
1111
+ let n = t, l = null;
1112
+ if (this.tokens.links) {
1113
+ let d = Object.keys(this.tokens.links);
1114
+ if (d.length > 0) for (; (l = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) d.includes(l[0].slice(l[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, l.index) + "[" + "a".repeat(l[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1115
+ }
1116
+ for (; (l = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, l.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1117
+ let i;
1118
+ for (; (l = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = l[2] ? l[2].length : 0, n = n.slice(0, l.index + i) + "[" + "a".repeat(l[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1119
+ n = ((c = (o = this.options.hooks) == null ? void 0 : o.emStrongMask) == null ? void 0 : c.call({ lexer: this }, n)) ?? n;
1120
+ let a = !1, s = "";
1121
+ for (; t; ) {
1122
+ a || (s = ""), a = !1;
1123
+ let d;
1124
+ if ((p = (u = this.options.extensions) == null ? void 0 : u.inline) != null && p.some((h) => (d = h.call({ lexer: this }, t, r)) ? (t = t.substring(d.raw.length), r.push(d), !0) : !1)) continue;
1125
+ if (d = this.tokenizer.escape(t)) {
1126
+ t = t.substring(d.raw.length), r.push(d);
1127
+ continue;
1128
+ }
1129
+ if (d = this.tokenizer.tag(t)) {
1130
+ t = t.substring(d.raw.length), r.push(d);
1131
+ continue;
1132
+ }
1133
+ if (d = this.tokenizer.link(t)) {
1134
+ t = t.substring(d.raw.length), r.push(d);
1135
+ continue;
1136
+ }
1137
+ if (d = this.tokenizer.reflink(t, this.tokens.links)) {
1138
+ t = t.substring(d.raw.length);
1139
+ let h = r.at(-1);
1140
+ d.type === "text" && (h == null ? void 0 : h.type) === "text" ? (h.raw += d.raw, h.text += d.text) : r.push(d);
1141
+ continue;
1142
+ }
1143
+ if (d = this.tokenizer.emStrong(t, n, s)) {
1144
+ t = t.substring(d.raw.length), r.push(d);
1145
+ continue;
1146
+ }
1147
+ if (d = this.tokenizer.codespan(t)) {
1148
+ t = t.substring(d.raw.length), r.push(d);
1149
+ continue;
1150
+ }
1151
+ if (d = this.tokenizer.br(t)) {
1152
+ t = t.substring(d.raw.length), r.push(d);
1153
+ continue;
1154
+ }
1155
+ if (d = this.tokenizer.del(t, n, s)) {
1156
+ t = t.substring(d.raw.length), r.push(d);
1157
+ continue;
1158
+ }
1159
+ if (d = this.tokenizer.autolink(t)) {
1160
+ t = t.substring(d.raw.length), r.push(d);
1161
+ continue;
1162
+ }
1163
+ if (!this.state.inLink && (d = this.tokenizer.url(t))) {
1164
+ t = t.substring(d.raw.length), r.push(d);
1165
+ continue;
1166
+ }
1167
+ let m = t;
1168
+ if ((f = this.options.extensions) != null && f.startInline) {
1169
+ let h = 1 / 0, k = t.slice(1), y;
1170
+ this.options.extensions.startInline.forEach((W) => {
1171
+ y = W.call({ lexer: this }, k), typeof y == "number" && y >= 0 && (h = Math.min(h, y));
1172
+ }), h < 1 / 0 && h >= 0 && (m = t.substring(0, h + 1));
1173
+ }
1174
+ if (d = this.tokenizer.inlineText(m)) {
1175
+ t = t.substring(d.raw.length), d.raw.slice(-1) !== "_" && (s = d.raw.slice(-1)), a = !0;
1176
+ let h = r.at(-1);
1177
+ (h == null ? void 0 : h.type) === "text" ? (h.raw += d.raw, h.text += d.text) : r.push(d);
1178
+ continue;
1179
+ }
1180
+ if (t) {
1181
+ let h = "Infinite loop on byte: " + t.charCodeAt(0);
1182
+ if (this.options.silent) {
1183
+ console.error(h);
1184
+ break;
1185
+ } else throw new Error(h);
1186
+ }
1187
+ }
1188
+ return r;
1189
+ }
1190
+ }, K = class {
1191
+ constructor(e) {
1192
+ b(this, "options");
1193
+ b(this, "parser");
1194
+ this.options = e || L;
1195
+ }
1196
+ space(e) {
1197
+ return "";
1198
+ }
1199
+ code({ text: e, lang: t, escaped: r }) {
1200
+ var i;
1201
+ let n = (i = (t || "").match($.notSpaceStart)) == null ? void 0 : i[0], l = e.replace($.endingNewline, "") + `
1202
+ `;
1203
+ return n ? '<pre><code class="language-' + A(n) + '">' + (r ? l : A(l, !0)) + `</code></pre>
1204
+ ` : "<pre><code>" + (r ? l : A(l, !0)) + `</code></pre>
1205
+ `;
1206
+ }
1207
+ blockquote({ tokens: e }) {
1208
+ return `<blockquote>
1209
+ ${this.parser.parse(e)}</blockquote>
1210
+ `;
1211
+ }
1212
+ html({ text: e }) {
1213
+ return e;
1214
+ }
1215
+ def(e) {
1216
+ return "";
1217
+ }
1218
+ heading({ tokens: e, depth: t }) {
1219
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1220
+ `;
1221
+ }
1222
+ hr(e) {
1223
+ return `<hr>
1224
+ `;
1225
+ }
1226
+ list(e) {
1227
+ let t = e.ordered, r = e.start, n = "";
1228
+ for (let a = 0; a < e.items.length; a++) {
1229
+ let s = e.items[a];
1230
+ n += this.listitem(s);
1231
+ }
1232
+ let l = t ? "ol" : "ul", i = t && r !== 1 ? ' start="' + r + '"' : "";
1233
+ return "<" + l + i + `>
1234
+ ` + n + "</" + l + `>
1235
+ `;
1236
+ }
1237
+ listitem(e) {
1238
+ return `<li>${this.parser.parse(e.tokens)}</li>
1239
+ `;
1240
+ }
1241
+ checkbox({ checked: e }) {
1242
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
1243
+ }
1244
+ paragraph({ tokens: e }) {
1245
+ return `<p>${this.parser.parseInline(e)}</p>
1246
+ `;
1247
+ }
1248
+ table(e) {
1249
+ let t = "", r = "";
1250
+ for (let l = 0; l < e.header.length; l++) r += this.tablecell(e.header[l]);
1251
+ t += this.tablerow({ text: r });
1252
+ let n = "";
1253
+ for (let l = 0; l < e.rows.length; l++) {
1254
+ let i = e.rows[l];
1255
+ r = "";
1256
+ for (let a = 0; a < i.length; a++) r += this.tablecell(i[a]);
1257
+ n += this.tablerow({ text: r });
1258
+ }
1259
+ return n && (n = `<tbody>${n}</tbody>`), `<table>
1260
+ <thead>
1261
+ ` + t + `</thead>
1262
+ ` + n + `</table>
1263
+ `;
1264
+ }
1265
+ tablerow({ text: e }) {
1266
+ return `<tr>
1267
+ ${e}</tr>
1268
+ `;
1269
+ }
1270
+ tablecell(e) {
1271
+ let t = this.parser.parseInline(e.tokens), r = e.header ? "th" : "td";
1272
+ return (e.align ? `<${r} align="${e.align}">` : `<${r}>`) + t + `</${r}>
1273
+ `;
1274
+ }
1275
+ strong({ tokens: e }) {
1276
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
1277
+ }
1278
+ em({ tokens: e }) {
1279
+ return `<em>${this.parser.parseInline(e)}</em>`;
1280
+ }
1281
+ codespan({ text: e }) {
1282
+ return `<code>${A(e, !0)}</code>`;
1283
+ }
1284
+ br(e) {
1285
+ return "<br>";
1286
+ }
1287
+ del({ tokens: e }) {
1288
+ return `<del>${this.parser.parseInline(e)}</del>`;
1289
+ }
1290
+ link({ href: e, title: t, tokens: r }) {
1291
+ let n = this.parser.parseInline(r), l = _e(e);
1292
+ if (l === null) return n;
1293
+ e = l;
1294
+ let i = '<a href="' + e + '"';
1295
+ return t && (i += ' title="' + A(t) + '"'), i += ">" + n + "</a>", i;
1296
+ }
1297
+ image({ href: e, title: t, text: r, tokens: n }) {
1298
+ n && (r = this.parser.parseInline(n, this.parser.textRenderer));
1299
+ let l = _e(e);
1300
+ if (l === null) return A(r);
1301
+ e = l;
1302
+ let i = `<img src="${e}" alt="${A(r)}"`;
1303
+ return t && (i += ` title="${A(t)}"`), i += ">", i;
1304
+ }
1305
+ text(e) {
1306
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : A(e.text);
1307
+ }
1308
+ }, fe = class {
1309
+ strong({ text: e }) {
1310
+ return e;
1311
+ }
1312
+ em({ text: e }) {
1313
+ return e;
1314
+ }
1315
+ codespan({ text: e }) {
1316
+ return e;
1317
+ }
1318
+ del({ text: e }) {
1319
+ return e;
1320
+ }
1321
+ html({ text: e }) {
1322
+ return e;
1323
+ }
1324
+ text({ text: e }) {
1325
+ return e;
1326
+ }
1327
+ link({ text: e }) {
1328
+ return "" + e;
1329
+ }
1330
+ image({ text: e }) {
1331
+ return "" + e;
1332
+ }
1333
+ br() {
1334
+ return "";
1335
+ }
1336
+ checkbox({ raw: e }) {
1337
+ return e;
1338
+ }
1339
+ }, T = class le {
1340
+ constructor(t) {
1341
+ b(this, "options");
1342
+ b(this, "renderer");
1343
+ b(this, "textRenderer");
1344
+ this.options = t || L, this.options.renderer = this.options.renderer || new K(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new fe();
1345
+ }
1346
+ static parse(t, r) {
1347
+ return new le(r).parse(t);
1348
+ }
1349
+ static parseInline(t, r) {
1350
+ return new le(r).parseInline(t);
1351
+ }
1352
+ parse(t) {
1353
+ var n, l;
1354
+ let r = "";
1355
+ for (let i = 0; i < t.length; i++) {
1356
+ let a = t[i];
1357
+ if ((l = (n = this.options.extensions) == null ? void 0 : n.renderers) != null && l[a.type]) {
1358
+ let o = a, c = this.options.extensions.renderers[o.type].call({ parser: this }, o);
1359
+ if (c !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(o.type)) {
1360
+ r += c || "";
1361
+ continue;
1362
+ }
1363
+ }
1364
+ let s = a;
1365
+ switch (s.type) {
1366
+ case "space": {
1367
+ r += this.renderer.space(s);
1368
+ break;
1369
+ }
1370
+ case "hr": {
1371
+ r += this.renderer.hr(s);
1372
+ break;
1373
+ }
1374
+ case "heading": {
1375
+ r += this.renderer.heading(s);
1376
+ break;
1377
+ }
1378
+ case "code": {
1379
+ r += this.renderer.code(s);
1380
+ break;
1381
+ }
1382
+ case "table": {
1383
+ r += this.renderer.table(s);
1384
+ break;
1385
+ }
1386
+ case "blockquote": {
1387
+ r += this.renderer.blockquote(s);
1388
+ break;
1389
+ }
1390
+ case "list": {
1391
+ r += this.renderer.list(s);
1392
+ break;
1393
+ }
1394
+ case "checkbox": {
1395
+ r += this.renderer.checkbox(s);
1396
+ break;
1397
+ }
1398
+ case "html": {
1399
+ r += this.renderer.html(s);
1400
+ break;
1401
+ }
1402
+ case "def": {
1403
+ r += this.renderer.def(s);
1404
+ break;
1405
+ }
1406
+ case "paragraph": {
1407
+ r += this.renderer.paragraph(s);
1408
+ break;
1409
+ }
1410
+ case "text": {
1411
+ r += this.renderer.text(s);
1412
+ break;
1413
+ }
1414
+ default: {
1415
+ let o = 'Token with "' + s.type + '" type was not found.';
1416
+ if (this.options.silent) return console.error(o), "";
1417
+ throw new Error(o);
1418
+ }
1419
+ }
1420
+ }
1421
+ return r;
1422
+ }
1423
+ parseInline(t, r = this.renderer) {
1424
+ var l, i;
1425
+ let n = "";
1426
+ for (let a = 0; a < t.length; a++) {
1427
+ let s = t[a];
1428
+ if ((i = (l = this.options.extensions) == null ? void 0 : l.renderers) != null && i[s.type]) {
1429
+ let c = this.options.extensions.renderers[s.type].call({ parser: this }, s);
1430
+ if (c !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(s.type)) {
1431
+ n += c || "";
1432
+ continue;
1433
+ }
1434
+ }
1435
+ let o = s;
1436
+ switch (o.type) {
1437
+ case "escape": {
1438
+ n += r.text(o);
1439
+ break;
1440
+ }
1441
+ case "html": {
1442
+ n += r.html(o);
1443
+ break;
1444
+ }
1445
+ case "link": {
1446
+ n += r.link(o);
1447
+ break;
1448
+ }
1449
+ case "image": {
1450
+ n += r.image(o);
1451
+ break;
1452
+ }
1453
+ case "checkbox": {
1454
+ n += r.checkbox(o);
1455
+ break;
1456
+ }
1457
+ case "strong": {
1458
+ n += r.strong(o);
1459
+ break;
1460
+ }
1461
+ case "em": {
1462
+ n += r.em(o);
1463
+ break;
1464
+ }
1465
+ case "codespan": {
1466
+ n += r.codespan(o);
1467
+ break;
1468
+ }
1469
+ case "br": {
1470
+ n += r.br(o);
1471
+ break;
1472
+ }
1473
+ case "del": {
1474
+ n += r.del(o);
1475
+ break;
1476
+ }
1477
+ case "text": {
1478
+ n += r.text(o);
1479
+ break;
1480
+ }
1481
+ default: {
1482
+ let c = 'Token with "' + o.type + '" type was not found.';
1483
+ if (this.options.silent) return console.error(c), "";
1484
+ throw new Error(c);
1485
+ }
1486
+ }
1487
+ }
1488
+ return n;
1489
+ }
1490
+ }, F, N = (F = class {
1491
+ constructor(e) {
1492
+ b(this, "options");
1493
+ b(this, "block");
1494
+ this.options = e || L;
1495
+ }
1496
+ preprocess(e) {
1497
+ return e;
1498
+ }
1499
+ postprocess(e) {
1500
+ return e;
1501
+ }
1502
+ processAllTokens(e) {
1503
+ return e;
1504
+ }
1505
+ emStrongMask(e) {
1506
+ return e;
1507
+ }
1508
+ provideLexer() {
1509
+ return this.block ? R.lex : R.lexInline;
1510
+ }
1511
+ provideParser() {
1512
+ return this.block ? T.parse : T.parseInline;
1513
+ }
1514
+ }, b(F, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), b(F, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), F), Cn = class {
1515
+ constructor(...e) {
1516
+ b(this, "defaults", ie());
1517
+ b(this, "options", this.setOptions);
1518
+ b(this, "parse", this.parseMarkdown(!0));
1519
+ b(this, "parseInline", this.parseMarkdown(!1));
1520
+ b(this, "Parser", T);
1521
+ b(this, "Renderer", K);
1522
+ b(this, "TextRenderer", fe);
1523
+ b(this, "Lexer", R);
1524
+ b(this, "Tokenizer", G);
1525
+ b(this, "Hooks", N);
1526
+ this.use(...e);
1527
+ }
1528
+ walkTokens(e, t) {
1529
+ var n, l;
1530
+ let r = [];
1531
+ for (let i of e) switch (r = r.concat(t.call(this, i)), i.type) {
1532
+ case "table": {
1533
+ let a = i;
1534
+ for (let s of a.header) r = r.concat(this.walkTokens(s.tokens, t));
1535
+ for (let s of a.rows) for (let o of s) r = r.concat(this.walkTokens(o.tokens, t));
1536
+ break;
1537
+ }
1538
+ case "list": {
1539
+ let a = i;
1540
+ r = r.concat(this.walkTokens(a.items, t));
1541
+ break;
1542
+ }
1543
+ default: {
1544
+ let a = i;
1545
+ (l = (n = this.defaults.extensions) == null ? void 0 : n.childTokens) != null && l[a.type] ? this.defaults.extensions.childTokens[a.type].forEach((s) => {
1546
+ let o = a[s].flat(1 / 0);
1547
+ r = r.concat(this.walkTokens(o, t));
1548
+ }) : a.tokens && (r = r.concat(this.walkTokens(a.tokens, t)));
1549
+ }
1550
+ }
1551
+ return r;
1552
+ }
1553
+ use(...e) {
1554
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1555
+ return e.forEach((r) => {
1556
+ let n = { ...r };
1557
+ if (n.async = this.defaults.async || n.async || !1, r.extensions && (r.extensions.forEach((l) => {
1558
+ if (!l.name) throw new Error("extension name required");
1559
+ if ("renderer" in l) {
1560
+ let i = t.renderers[l.name];
1561
+ i ? t.renderers[l.name] = function(...a) {
1562
+ let s = l.renderer.apply(this, a);
1563
+ return s === !1 && (s = i.apply(this, a)), s;
1564
+ } : t.renderers[l.name] = l.renderer;
1565
+ }
1566
+ if ("tokenizer" in l) {
1567
+ if (!l.level || l.level !== "block" && l.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1568
+ let i = t[l.level];
1569
+ i ? i.unshift(l.tokenizer) : t[l.level] = [l.tokenizer], l.start && (l.level === "block" ? t.startBlock ? t.startBlock.push(l.start) : t.startBlock = [l.start] : l.level === "inline" && (t.startInline ? t.startInline.push(l.start) : t.startInline = [l.start]));
1570
+ }
1571
+ "childTokens" in l && l.childTokens && (t.childTokens[l.name] = l.childTokens);
1572
+ }), n.extensions = t), r.renderer) {
1573
+ let l = this.defaults.renderer || new K(this.defaults);
1574
+ for (let i in r.renderer) {
1575
+ if (!(i in l)) throw new Error(`renderer '${i}' does not exist`);
1576
+ if (["options", "parser"].includes(i)) continue;
1577
+ let a = i, s = r.renderer[a], o = l[a];
1578
+ l[a] = (...c) => {
1579
+ let u = s.apply(l, c);
1580
+ return u === !1 && (u = o.apply(l, c)), u || "";
1581
+ };
1582
+ }
1583
+ n.renderer = l;
1584
+ }
1585
+ if (r.tokenizer) {
1586
+ let l = this.defaults.tokenizer || new G(this.defaults);
1587
+ for (let i in r.tokenizer) {
1588
+ if (!(i in l)) throw new Error(`tokenizer '${i}' does not exist`);
1589
+ if (["options", "rules", "lexer"].includes(i)) continue;
1590
+ let a = i, s = r.tokenizer[a], o = l[a];
1591
+ l[a] = (...c) => {
1592
+ let u = s.apply(l, c);
1593
+ return u === !1 && (u = o.apply(l, c)), u;
1594
+ };
1595
+ }
1596
+ n.tokenizer = l;
1597
+ }
1598
+ if (r.hooks) {
1599
+ let l = this.defaults.hooks || new N();
1600
+ for (let i in r.hooks) {
1601
+ if (!(i in l)) throw new Error(`hook '${i}' does not exist`);
1602
+ if (["options", "block"].includes(i)) continue;
1603
+ let a = i, s = r.hooks[a], o = l[a];
1604
+ N.passThroughHooks.has(i) ? l[a] = (c) => {
1605
+ if (this.defaults.async && N.passThroughHooksRespectAsync.has(i)) return (async () => {
1606
+ let p = await s.call(l, c);
1607
+ return o.call(l, p);
1608
+ })();
1609
+ let u = s.call(l, c);
1610
+ return o.call(l, u);
1611
+ } : l[a] = (...c) => {
1612
+ if (this.defaults.async) return (async () => {
1613
+ let p = await s.apply(l, c);
1614
+ return p === !1 && (p = await o.apply(l, c)), p;
1615
+ })();
1616
+ let u = s.apply(l, c);
1617
+ return u === !1 && (u = o.apply(l, c)), u;
1618
+ };
1619
+ }
1620
+ n.hooks = l;
1621
+ }
1622
+ if (r.walkTokens) {
1623
+ let l = this.defaults.walkTokens, i = r.walkTokens;
1624
+ n.walkTokens = function(a) {
1625
+ let s = [];
1626
+ return s.push(i.call(this, a)), l && (s = s.concat(l.call(this, a))), s;
1627
+ };
1628
+ }
1629
+ this.defaults = { ...this.defaults, ...n };
1630
+ }), this;
1631
+ }
1632
+ setOptions(e) {
1633
+ return this.defaults = { ...this.defaults, ...e }, this;
1634
+ }
1635
+ lexer(e, t) {
1636
+ return R.lex(e, t ?? this.defaults);
1637
+ }
1638
+ parser(e, t) {
1639
+ return T.parse(e, t ?? this.defaults);
1640
+ }
1641
+ parseMarkdown(e) {
1642
+ return (t, r) => {
1643
+ let n = { ...r }, l = { ...this.defaults, ...n }, i = this.onError(!!l.silent, !!l.async);
1644
+ if (this.defaults.async === !0 && n.async === !1) return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1645
+ if (typeof t > "u" || t === null) return i(new Error("marked(): input parameter is undefined or null"));
1646
+ if (typeof t != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
1647
+ if (l.hooks && (l.hooks.options = l, l.hooks.block = e), l.async) return (async () => {
1648
+ let a = l.hooks ? await l.hooks.preprocess(t) : t, s = await (l.hooks ? await l.hooks.provideLexer() : e ? R.lex : R.lexInline)(a, l), o = l.hooks ? await l.hooks.processAllTokens(s) : s;
1649
+ l.walkTokens && await Promise.all(this.walkTokens(o, l.walkTokens));
1650
+ let c = await (l.hooks ? await l.hooks.provideParser() : e ? T.parse : T.parseInline)(o, l);
1651
+ return l.hooks ? await l.hooks.postprocess(c) : c;
1652
+ })().catch(i);
1653
+ try {
1654
+ l.hooks && (t = l.hooks.preprocess(t));
1655
+ let a = (l.hooks ? l.hooks.provideLexer() : e ? R.lex : R.lexInline)(t, l);
1656
+ l.hooks && (a = l.hooks.processAllTokens(a)), l.walkTokens && this.walkTokens(a, l.walkTokens);
1657
+ let s = (l.hooks ? l.hooks.provideParser() : e ? T.parse : T.parseInline)(a, l);
1658
+ return l.hooks && (s = l.hooks.postprocess(s)), s;
1659
+ } catch (a) {
1660
+ return i(a);
1661
+ }
1662
+ };
1663
+ }
1664
+ onError(e, t) {
1665
+ return (r) => {
1666
+ if (r.message += `
1667
+ Please report this to https://github.com/markedjs/marked.`, e) {
1668
+ let n = "<p>An error occurred:</p><pre>" + A(r.message + "", !0) + "</pre>";
1669
+ return t ? Promise.resolve(n) : n;
1670
+ }
1671
+ if (t) return Promise.reject(r);
1672
+ throw r;
1673
+ };
1674
+ }
1675
+ }, E = new Cn();
1676
+ function x(e, t) {
1677
+ return E.parse(e, t);
1678
+ }
1679
+ x.options = x.setOptions = function(e) {
1680
+ return E.setOptions(e), x.defaults = E.defaults, Qe(x.defaults), x;
1681
+ };
1682
+ x.getDefaults = ie;
1683
+ x.defaults = L;
1684
+ x.use = function(...e) {
1685
+ return E.use(...e), x.defaults = E.defaults, Qe(x.defaults), x;
1686
+ };
1687
+ x.walkTokens = function(e, t) {
1688
+ return E.walkTokens(e, t);
1689
+ };
1690
+ x.parseInline = E.parseInline;
1691
+ x.Parser = T;
1692
+ x.parser = T.parse;
1693
+ x.Renderer = K;
1694
+ x.TextRenderer = fe;
1695
+ x.Lexer = R;
1696
+ x.lexer = R.lex;
1697
+ x.Tokenizer = G;
1698
+ x.Hooks = N;
1699
+ x.parse = x;
1700
+ x.options;
1701
+ x.setOptions;
1702
+ x.use;
1703
+ x.walkTokens;
1704
+ x.parseInline;
1705
+ T.parse;
1706
+ R.lex;
1707
+ const In = /\[\^[\w-]{1,200}\](?!:)/, zn = /\[\^[\w-]{1,200}\]:/, Pn = /<(\w+)[\s>]/, En = /* @__PURE__ */ new Set([
1708
+ "area",
1709
+ "base",
1710
+ "br",
1711
+ "col",
1712
+ "embed",
1713
+ "hr",
1714
+ "img",
1715
+ "input",
1716
+ "link",
1717
+ "meta",
1718
+ "param",
1719
+ "source",
1720
+ "track",
1721
+ "wbr"
1722
+ ]), ze = /* @__PURE__ */ new Map(), Pe = /* @__PURE__ */ new Map(), On = (e) => {
1723
+ const t = e.toLowerCase(), r = ze.get(t);
1724
+ if (r) return r;
1725
+ const n = new RegExp(`<${t}(?=[\\s>/])[^>]*>`, "gi");
1726
+ return ze.set(t, n), n;
1727
+ }, Ln = (e) => {
1728
+ const t = e.toLowerCase(), r = Pe.get(t);
1729
+ if (r) return r;
1730
+ const n = new RegExp(`</${t}(?=[\\s>])[^>]*>`, "gi");
1731
+ return Pe.set(t, n), n;
1732
+ }, Bn = (e, t) => {
1733
+ if (En.has(t.toLowerCase())) return 0;
1734
+ const r = e.match(On(t));
1735
+ if (!r) return 0;
1736
+ let n = 0;
1737
+ for (const l of r)
1738
+ l.trimEnd().endsWith("/>") || (n += 1);
1739
+ return n;
1740
+ }, Mn = (e, t) => {
1741
+ const r = e.match(Ln(t));
1742
+ return r ? r.length : 0;
1743
+ }, qn = (e) => {
1744
+ let t = 0;
1745
+ for (let r = 0; r < e.length - 1; r += 1)
1746
+ e[r] === "$" && e[r + 1] === "$" && (t += 1, r += 1);
1747
+ return t;
1748
+ };
1749
+ function Nn(e) {
1750
+ if (e.length === 0) return [];
1751
+ const t = In.test(e), r = zn.test(e);
1752
+ if (t || r)
1753
+ return [e];
1754
+ const n = R.lex(e, { gfm: !0 }), l = [], i = [];
1755
+ let a = !1;
1756
+ for (const s of n) {
1757
+ const o = s.raw, c = l.length;
1758
+ if (i.length > 0) {
1759
+ const u = l[c - 1];
1760
+ if (u == null) {
1761
+ l.push(o);
1762
+ continue;
1763
+ }
1764
+ l[c - 1] = u + o;
1765
+ const p = o.matchAll(/<\/(\w+)>/g);
1766
+ for (const f of p) {
1767
+ const d = f[1];
1768
+ i[i.length - 1] === d && i.pop();
1769
+ }
1770
+ continue;
1771
+ }
1772
+ if (s.type === "space") {
1773
+ if (c > 0) {
1774
+ const u = l[c - 1];
1775
+ u != null && (l[c - 1] = u + o);
1776
+ }
1777
+ continue;
1778
+ }
1779
+ if (s.type === "html" && s.block) {
1780
+ const u = o.match(Pn), p = u == null ? void 0 : u[1];
1781
+ if (p) {
1782
+ const f = Bn(o, p), d = Mn(o, p);
1783
+ f > d && i.push(p);
1784
+ }
1785
+ }
1786
+ if (c > 0 && !a) {
1787
+ const u = l[c - 1];
1788
+ if (u == null) {
1789
+ l.push(o);
1790
+ continue;
1791
+ }
1792
+ if (qn(u) % 2 === 1) {
1793
+ l[c - 1] = u + o;
1794
+ continue;
1795
+ }
1796
+ }
1797
+ l.push(o), s.type !== "space" && (a = s.type === "code");
1798
+ }
1799
+ return l;
1800
+ }
1801
+ function Dn(e) {
1802
+ return (e == null ? void 0 : e.mode) ?? "static";
1803
+ }
1804
+ function Hn(e, t) {
1805
+ return !((t == null ? void 0 : t.parseIncompleteMarkdown) ?? !0) || e.length === 0 ? e : zr(e);
1806
+ }
1807
+ function Wn(e, t) {
1808
+ var a, s;
1809
+ let r = 0;
1810
+ const n = Math.min(e.length, t.length);
1811
+ for (; r < n; ) {
1812
+ const o = (a = e[r]) == null ? void 0 : a.source, c = t[r] ?? "";
1813
+ if (o !== c) break;
1814
+ r += 1;
1815
+ }
1816
+ let l = 0;
1817
+ const i = Math.min(e.length, t.length) - r;
1818
+ for (; l < i; ) {
1819
+ const o = (s = e[e.length - 1 - l]) == null ? void 0 : s.source, c = t[t.length - 1 - l] ?? "";
1820
+ if (o !== c) break;
1821
+ l += 1;
1822
+ }
1823
+ return { prefix: r, suffix: l };
250
1824
  }
251
- function B(e) {
1825
+ async function jn(e, t, r) {
1826
+ if (e.length === 0) return [];
1827
+ const n = new Array(e.length), { prefix: l, suffix: i } = Wn(t, e);
1828
+ for (let s = 0; s < l; s += 1) {
1829
+ const o = t[s];
1830
+ o && (n[s] = o);
1831
+ }
1832
+ for (let s = 0; s < i; s += 1) {
1833
+ const o = t.length - i + s, c = e.length - i + s, u = t[o];
1834
+ u && (n[c] = u);
1835
+ }
1836
+ const a = [];
1837
+ for (let s = l; s < e.length - i; s += 1) {
1838
+ const o = e[s] ?? "";
1839
+ a.push(
1840
+ r.parseToHAST(o).then((c) => {
1841
+ n[s] = { source: o, tree: c };
1842
+ })
1843
+ );
1844
+ }
1845
+ a.length > 0 && await Promise.all(a);
1846
+ for (let s = 0; s < n.length; s += 1) {
1847
+ if (n[s]) continue;
1848
+ const o = e[s] ?? "", c = await r.parseToHAST(o);
1849
+ n[s] = { source: o, tree: c };
1850
+ }
1851
+ return n;
1852
+ }
1853
+ function at(e) {
1854
+ let t = [];
1855
+ return {
1856
+ async render(r, n) {
1857
+ if (Dn(n) !== "streaming") {
1858
+ t = [];
1859
+ const o = await e.parseToHAST(r);
1860
+ return Re(o, n);
1861
+ }
1862
+ const i = Hn(r, n == null ? void 0 : n.streamdown), a = Nn(i);
1863
+ if (t = await jn(a, t, e), t.length === 0) return null;
1864
+ const s = t.map((o) => Re(o.tree, n));
1865
+ return v(Ee, null, s);
1866
+ },
1867
+ reset() {
1868
+ t = [];
1869
+ }
1870
+ };
1871
+ }
1872
+ function ot(e) {
252
1873
  if (e instanceof Error) return e;
253
1874
  if (typeof e == "string") return new Error(e);
254
1875
  try {
@@ -257,79 +1878,82 @@ function B(e) {
257
1878
  return new Error("Unknown error");
258
1879
  }
259
1880
  }
260
- function W(e, n, t) {
261
- const r = j(null), l = k(!1), i = k(null);
262
- let d = null, u = 0;
263
- const m = async (f, s) => {
264
- const g = ++u;
1881
+ function ct(e, t, r) {
1882
+ const n = ft(null), l = te(!1), i = te(null);
1883
+ let a = null, s = 0;
1884
+ const o = async (u, p) => {
1885
+ const f = ++s;
265
1886
  l.value = !0, i.value = null;
266
1887
  try {
267
- const o = await n(f, s);
268
- g === u && (r.value = o);
269
- } catch (o) {
270
- g === u && (i.value = B(o));
1888
+ const d = await t(u, p);
1889
+ f === s && (n.value = d);
1890
+ } catch (d) {
1891
+ f === s && (i.value = ot(d));
271
1892
  } finally {
272
- g === u && (l.value = !1);
273
- }
274
- }, p = (f, s) => {
275
- const g = (s == null ? void 0 : s.dynamic) ?? !1, o = (s == null ? void 0 : s.debounceMs) ?? 250;
276
- if (d != null && (globalThis.clearTimeout(d), d = null), g) {
277
- d = globalThis.setTimeout(() => {
278
- m(f, s);
279
- }, o);
1893
+ f === s && (l.value = !1);
1894
+ }
1895
+ }, c = (u, p) => {
1896
+ const f = (p == null ? void 0 : p.mode) ?? "static", d = (p == null ? void 0 : p.dynamic) ?? f === "streaming", m = (p == null ? void 0 : p.debounceMs) ?? (f === "streaming" ? 80 : 250);
1897
+ if (a != null && (globalThis.clearTimeout(a), a = null), d) {
1898
+ a = globalThis.setTimeout(() => {
1899
+ o(u, p);
1900
+ }, m);
280
1901
  return;
281
1902
  }
282
- m(f, s);
1903
+ o(u, p);
283
1904
  };
284
- return C(
285
- () => [x(e), t ? x(t) : void 0],
286
- ([f, s]) => {
287
- p(f ?? "", s);
1905
+ return Oe(
1906
+ () => [me(e), r ? me(r) : void 0],
1907
+ ([u, p]) => {
1908
+ c(u ?? "", p);
288
1909
  },
289
1910
  { immediate: !0, deep: !0 }
290
- ), R(() => {
291
- d != null && globalThis.clearTimeout(d);
1911
+ ), U(() => {
1912
+ a != null && globalThis.clearTimeout(a);
292
1913
  }), {
293
- content: r,
1914
+ content: n,
294
1915
  loading: l,
295
1916
  error: i
296
1917
  };
297
1918
  }
298
- function ee(e, n, t) {
299
- const r = I(n ?? {});
300
- return W(
1919
+ function Fn(e, t, r) {
1920
+ const n = St(t ?? {}), l = at({
1921
+ parseToHAST: (i) => n.parseToHAST(i)
1922
+ });
1923
+ return U(() => {
1924
+ l.reset();
1925
+ }), ct(
301
1926
  e,
302
- async (l, i) => {
303
- const d = await r.parseToHAST(l);
304
- return A(d, i);
305
- },
306
- t
1927
+ (i, a) => l.render(i, a),
1928
+ r
307
1929
  );
308
1930
  }
309
- function ne(e, n, t) {
310
- return W(
1931
+ function Zn(e, t, r) {
1932
+ const n = at({
1933
+ parseToHAST: (l) => t.parseToHAST(l)
1934
+ });
1935
+ return U(() => {
1936
+ n.reset();
1937
+ }), ct(
311
1938
  e,
312
- async (r, l) => {
313
- const i = await n.parseToHAST(r);
314
- return A(i, l);
315
- },
316
- t
1939
+ (l, i) => n.render(l, i),
1940
+ r
317
1941
  );
318
1942
  }
319
- const re = {
1943
+ const Gn = {
320
1944
  display: "inline-flex",
321
1945
  alignItems: "center",
322
1946
  gap: "8px",
323
1947
  color: "#57606a",
324
1948
  fontSize: "14px"
325
- }, te = {
1949
+ }, Kn = {
326
1950
  padding: "12px 16px",
327
1951
  borderRadius: "8px",
328
1952
  backgroundColor: "#ffebe9",
329
1953
  color: "#cf222e",
330
1954
  border: "1px solid #ff8182",
331
1955
  fontSize: "14px"
332
- }, le = /* @__PURE__ */ T({
1956
+ }, Jn = /* @__PURE__ */ Le({
333
1957
  name: "MarkdownRenderer",
334
1958
  inheritAttrs: !1,
335
1959
  props: {
@@ -352,13 +1976,25 @@ const re = {
352
1976
  required: !1,
353
1977
  default: void 0
354
1978
  },
1979
+ mode: {
1980
+ type: String,
1981
+ required: !1,
1982
+ default: "static"
1983
+ },
1984
+ streamdown: {
1985
+ type: Object,
1986
+ required: !1,
1987
+ default: void 0
1988
+ },
355
1989
  dynamic: {
356
1990
  type: Boolean,
357
- default: !1
1991
+ required: !1,
1992
+ default: void 0
358
1993
  },
359
1994
  debounceMs: {
360
1995
  type: Number,
361
- default: 250
1996
+ required: !1,
1997
+ default: void 0
362
1998
  },
363
1999
  loadingSlot: {
364
2000
  type: [Object, Function],
@@ -367,37 +2003,37 @@ const re = {
367
2003
  }
368
2004
  },
369
2005
  setup(e) {
370
- const n = E(), t = L(e, "markdown"), r = H(M, null), l = k(null), i = b(() => {
371
- const o = {
372
- dynamic: e.dynamic,
373
- debounceMs: e.debounceMs
2006
+ const t = gt(), r = kt(e, "markdown"), n = mt(Be, null), l = te(null), i = (h, k) => {
2007
+ const y = {
2008
+ mode: (h == null ? void 0 : h.mode) ?? k
374
2009
  };
375
- if (r != null && r.forceRenderOptions.value) {
376
- const a = r.renderOptions.value;
377
- return a != null && a.components && (o.components = a.components), a != null && a.codeRenderer && (o.codeRenderer = a.codeRenderer), a != null && a.loadingSlot && (o.loadingSlot = a.loadingSlot), o.dynamic = (a == null ? void 0 : a.dynamic) ?? !1, o.debounceMs = (a == null ? void 0 : a.debounceMs) ?? 250, o;
378
- }
379
- return e.components && (o.components = e.components), e.codeRenderer && (o.codeRenderer = e.codeRenderer), e.loadingSlot && (o.loadingSlot = e.loadingSlot), o;
380
- }), d = r ? ne(t, r.pool, i) : ee(t, e.parserOptions, i);
381
- J((o) => (l.value = B(o), !1)), C(t, () => {
2010
+ return h != null && h.streamdown && (y.streamdown = h.streamdown), h != null && h.components && (y.components = h.components), h != null && h.codeRenderer && (y.codeRenderer = h.codeRenderer), h != null && h.loadingSlot && (y.loadingSlot = h.loadingSlot), (h == null ? void 0 : h.dynamic) != null && (y.dynamic = h.dynamic), (h == null ? void 0 : h.debounceMs) != null && (y.debounceMs = h.debounceMs), y;
2011
+ }, a = I(() => {
2012
+ const h = {
2013
+ mode: e.mode
2014
+ };
2015
+ return e.streamdown && (h.streamdown = e.streamdown), e.components && (h.components = e.components), e.codeRenderer && (h.codeRenderer = e.codeRenderer), e.loadingSlot && (h.loadingSlot = e.loadingSlot), e.dynamic != null && (h.dynamic = e.dynamic), e.debounceMs != null && (h.debounceMs = e.debounceMs), i(h, "static");
2016
+ }), s = I(() => n != null && n.forceRenderOptions.value ? i(n.renderOptions.value, "static") : a.value), o = n ? Zn(r, n.pool, s) : Fn(r, e.parserOptions, s);
2017
+ bt((h) => (l.value = ot(h), !1)), Oe(r, () => {
382
2018
  l.value = null;
383
2019
  });
384
- const u = b(() => [V, n.style]), m = b(() => {
385
- const a = {
386
- ...n
2020
+ const c = I(() => [Pr, t.style]), u = I(() => {
2021
+ const k = {
2022
+ ...t
387
2023
  };
388
- return delete a.style, a;
389
- }), p = b(() => {
390
- var a;
391
- const o = (a = r == null ? void 0 : r.renderOptions.value) == null ? void 0 : a.loadingSlot;
392
- return o || e.loadingSlot;
393
- }), f = () => y("div", {
394
- style: re
395
- }, [y("svg", {
2024
+ return delete k.style, k;
2025
+ }), p = I(() => {
2026
+ var k;
2027
+ const h = (k = n == null ? void 0 : n.renderOptions.value) == null ? void 0 : k.loadingSlot;
2028
+ return h || e.loadingSlot;
2029
+ }), f = () => _("div", {
2030
+ style: Gn
2031
+ }, [_("svg", {
396
2032
  width: "16",
397
2033
  height: "16",
398
2034
  viewBox: "0 0 50 50",
399
2035
  "aria-hidden": "true"
400
- }, [y("circle", {
2036
+ }, [_("circle", {
401
2037
  cx: "25",
402
2038
  cy: "25",
403
2039
  r: "20",
@@ -406,28 +2042,31 @@ const re = {
406
2042
  "stroke-width": "4",
407
2043
  "stroke-linecap": "round",
408
2044
  "stroke-dasharray": "31.4 31.4"
409
- }, [y("animateTransform", {
2045
+ }, [_("animateTransform", {
410
2046
  attributeName: "transform",
411
2047
  type: "rotate",
412
2048
  from: "0 25 25",
413
2049
  to: "360 25 25",
414
2050
  dur: "1s",
415
2051
  repeatCount: "indefinite"
416
- }, null)])]), y("span", null, [S("Rendering markdown...")])]), s = () => {
417
- const o = p.value;
418
- return o ? h(o) : f();
419
- }, g = (o) => y("div", {
420
- style: te
421
- }, [y("strong", null, [S("Markdown render error:")]), S(" "), o.message]);
2052
+ }, null)])]), _("span", null, [Y("Rendering markdown...")])]), d = () => {
2053
+ const h = p.value;
2054
+ return h ? v(h) : f();
2055
+ }, m = (h) => _("div", {
2056
+ style: Kn
2057
+ }, [_("strong", null, [Y("Markdown render error:")]), Y(" "), h.message]);
422
2058
  return () => {
423
- const o = l.value ?? d.error.value, a = d.content.value, F = d.loading.value && !a && !o;
424
- return y("div", G(m.value, {
425
- style: u.value
426
- }), [o ? g(o) : F ? s() : a]);
2059
+ const h = l.value ?? o.error.value, k = o.content.value, y = o.loading.value && !k && !h;
2060
+ return _("div", xt(u.value, {
2061
+ style: c.value
2062
+ }), [h ? m(h) : y ? d() : k]);
427
2063
  };
428
2064
  }
429
- }), ae = /* @__PURE__ */ T({
2065
+ }), Vn = /* @__PURE__ */ Le({
430
2066
  name: "MarkdownWorkerPoll",
2067
+ emits: {
2068
+ ready: (e) => e != null
2069
+ },
431
2070
  props: {
432
2071
  parserOptions: {
433
2072
  type: Object,
@@ -473,6 +2112,16 @@ const re = {
473
2112
  required: !1,
474
2113
  default: void 0
475
2114
  },
2115
+ mode: {
2116
+ type: String,
2117
+ required: !1,
2118
+ default: void 0
2119
+ },
2120
+ streamdown: {
2121
+ type: Object,
2122
+ required: !1,
2123
+ default: void 0
2124
+ },
476
2125
  dynamic: {
477
2126
  type: Boolean,
478
2127
  required: !1,
@@ -490,36 +2139,45 @@ const re = {
490
2139
  }
491
2140
  },
492
2141
  setup(e, {
493
- slots: n
2142
+ slots: t,
2143
+ emit: r,
2144
+ expose: n
494
2145
  }) {
495
- const t = {
2146
+ const l = {
496
2147
  ...e.parserOptions ?? {}
497
2148
  };
498
- e.workerCount != null && (t.workerCount = e.workerCount), e.customTags && (t.customTags = e.customTags), e.extendedGrammar && (t.extendedGrammar = e.extendedGrammar), e.remarkPlugins && (t.remarkPlugins = e.remarkPlugins), e.rehypePlugins && (t.rehypePlugins = e.rehypePlugins), e.mathJaxConfig && (t.mathJaxConfig = e.mathJaxConfig);
499
- const r = U(t), l = b(() => {
500
- if (e.components == null && e.codeRenderer == null && e.dynamic == null && e.debounceMs == null && e.loadingSlot == null)
2149
+ e.workerCount != null && (l.workerCount = e.workerCount), e.customTags && (l.customTags = e.customTags), e.extendedGrammar && (l.extendedGrammar = e.extendedGrammar), e.remarkPlugins && (l.remarkPlugins = e.remarkPlugins), e.rehypePlugins && (l.rehypePlugins = e.rehypePlugins), e.mathJaxConfig && (l.mathJaxConfig = e.mathJaxConfig);
2150
+ const i = $t(l);
2151
+ n({
2152
+ pool: i,
2153
+ getPoolInfo: () => i.getPoolInfo(),
2154
+ getStats: () => i.getStats(),
2155
+ terminate: () => i.terminate(),
2156
+ destroy: () => i.destroy()
2157
+ });
2158
+ const a = I(() => {
2159
+ if (e.components == null && e.codeRenderer == null && e.mode == null && e.streamdown == null && e.dynamic == null && e.debounceMs == null && e.loadingSlot == null)
501
2160
  return;
502
- const d = {
503
- dynamic: e.dynamic ?? !1,
504
- debounceMs: e.debounceMs ?? 250
505
- };
506
- return e.components && (d.components = e.components), e.codeRenderer && (d.codeRenderer = e.codeRenderer), e.loadingSlot && (d.loadingSlot = e.loadingSlot), d;
507
- }), i = b(() => l.value !== void 0);
508
- return D(M, {
509
- pool: r,
510
- renderOptions: l,
511
- forceRenderOptions: i
512
- }), R(() => {
513
- r.destroy();
2161
+ const o = {};
2162
+ return e.components && (o.components = e.components), e.codeRenderer && (o.codeRenderer = e.codeRenderer), e.mode != null && (o.mode = e.mode), e.streamdown && (o.streamdown = e.streamdown), e.dynamic != null && (o.dynamic = e.dynamic), e.debounceMs != null && (o.debounceMs = e.debounceMs), e.loadingSlot && (o.loadingSlot = e.loadingSlot), o;
2163
+ }), s = I(() => a.value !== void 0);
2164
+ return wt(Be, {
2165
+ pool: i,
2166
+ renderOptions: a,
2167
+ forceRenderOptions: s
2168
+ }), yt(() => {
2169
+ r("ready", i);
2170
+ }), U(() => {
2171
+ i.destroy();
514
2172
  }), () => {
515
- var d;
516
- return (d = n.default) == null ? void 0 : d.call(n);
2173
+ var o;
2174
+ return (o = t.default) == null ? void 0 : o.call(t);
517
2175
  };
518
2176
  }
519
2177
  });
520
2178
  export {
521
- le as MarkdownRenderer,
522
- ae as MarkdownWorkerPoll,
523
- ee as useMarkdownParser,
524
- ne as useMarkdownWorkerPool
2179
+ Jn as MarkdownRenderer,
2180
+ Vn as MarkdownWorkerPoll,
2181
+ Fn as useMarkdownParser,
2182
+ Zn as useMarkdownWorkerPool
525
2183
  };