@cremini/skillpack 1.0.2

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