@vizel/core 0.0.1-alpha.1 → 0.0.1-alpha.3

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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +13 -13
  3. package/dist/index.js +141 -141
  4. package/dist/index10.js +70 -110
  5. package/dist/index11.js +135 -168
  6. package/dist/index12.js +83 -74
  7. package/dist/index13.js +13 -134
  8. package/dist/index14.js +13 -146
  9. package/dist/index15.js +303 -15
  10. package/dist/index16.js +69 -14
  11. package/dist/index17.js +26 -295
  12. package/dist/index18.js +2 -2
  13. package/dist/index19.js +355 -24
  14. package/dist/index20.js +25 -264
  15. package/dist/index21.js +85 -68
  16. package/dist/index22.js +97 -353
  17. package/dist/index23.js +66 -84
  18. package/dist/index24.js +12 -36
  19. package/dist/index25.js +53 -92
  20. package/dist/index26.js +132 -96
  21. package/dist/index27.js +59 -126
  22. package/dist/index28.js +37 -53
  23. package/dist/index29.js +19 -62
  24. package/dist/index3.js +165 -60
  25. package/dist/index30.js +9 -37
  26. package/dist/index31.js +143 -19
  27. package/dist/index32.js +264 -11
  28. package/dist/index33.js +92 -9
  29. package/dist/index34.js +63 -16
  30. package/dist/index35.js +4 -58
  31. package/dist/index36.js +123 -15
  32. package/dist/index37.js +305 -42
  33. package/dist/index38.js +487 -4
  34. package/dist/index39.js +37 -112
  35. package/dist/index4.js +10 -86
  36. package/dist/index40.js +653 -301
  37. package/dist/index41.js +4 -487
  38. package/dist/index42.js +4 -48
  39. package/dist/index43.js +206 -642
  40. package/dist/index44.js +82 -4
  41. package/dist/index45.js +17 -4
  42. package/dist/index46.js +57 -237
  43. package/dist/index47.js +15 -82
  44. package/dist/index48.js +190 -274
  45. package/dist/index49.js +281 -1497
  46. package/dist/index5.js +132 -10
  47. package/dist/index50.js +1502 -5
  48. package/dist/index51.js +5 -1561
  49. package/dist/index52.js +1551 -192
  50. package/dist/index53.js +1 -1
  51. package/dist/index54.js +84 -21
  52. package/dist/index55.js +246 -10
  53. package/dist/index56.js +3 -7
  54. package/dist/index57.js +1231 -7
  55. package/dist/index58.js +731 -11
  56. package/dist/index59.js +21 -19
  57. package/dist/index6.js +48 -131
  58. package/dist/index60.js +10 -25
  59. package/dist/index61.js +6 -83
  60. package/dist/index62.js +7 -245
  61. package/dist/index63.js +11 -1229
  62. package/dist/index64.js +17 -732
  63. package/dist/index65.js +25 -3
  64. package/dist/index66.js +53 -1059
  65. package/dist/index67.js +1059 -53
  66. package/dist/index69.js +90 -3
  67. package/dist/index7.js +228 -409
  68. package/dist/index70.js +3 -90
  69. package/dist/index8.js +111 -45
  70. package/dist/index9.js +409 -228
  71. package/package.json +54 -80
package/dist/index51.js CHANGED
@@ -1,1563 +1,7 @@
1
- function O() {
2
- return {
3
- async: !1,
4
- breaks: !1,
5
- extensions: null,
6
- gfm: !0,
7
- hooks: null,
8
- pedantic: !1,
9
- renderer: null,
10
- silent: !1,
11
- tokenizer: null,
12
- walkTokens: null
13
- };
14
- }
15
- var S = O();
16
- function ie(n) {
17
- S = n;
18
- }
19
- var z = { exec: () => null };
20
- function u(n, e = "") {
21
- let t = typeof n == "string" ? n : n.source;
22
- const s = {
23
- replace: (r, i) => {
24
- let l = typeof i == "string" ? i : i.source;
25
- return l = l.replace(x.caret, "$1"), t = t.replace(r, l), s;
26
- },
27
- getRegex: () => new RegExp(t, e)
28
- };
29
- return s;
30
- }
31
- var x = {
32
- codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
33
- outputLinkReplace: /\\([\[\]])/g,
34
- indentCodeCompensation: /^(\s+)(?:```)/,
35
- beginningSpace: /^\s+/,
36
- endingHash: /#$/,
37
- startingSpaceChar: /^ /,
38
- endingSpaceChar: / $/,
39
- nonSpaceChar: /[^ ]/,
40
- newLineCharGlobal: /\n/g,
41
- tabCharGlobal: /\t/g,
42
- multipleSpaceGlobal: /\s+/g,
43
- blankLine: /^[ \t]*$/,
44
- doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
45
- blockquoteStart: /^ {0,3}>/,
46
- blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
47
- blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
48
- listReplaceTabs: /^\t+/,
49
- listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
50
- listIsTask: /^\[[ xX]\] /,
51
- listReplaceTask: /^\[[ xX]\] +/,
52
- anyLine: /\n.*\n/,
53
- hrefBrackets: /^<(.*)>$/,
54
- tableDelimiter: /[:|]/,
55
- tableAlignChars: /^\||\| *$/g,
56
- tableRowBlankLine: /\n[ \t]*$/,
57
- tableAlignRight: /^ *-+: *$/,
58
- tableAlignCenter: /^ *:-+: *$/,
59
- tableAlignLeft: /^ *:-+ *$/,
60
- startATag: /^<a /i,
61
- endATag: /^<\/a>/i,
62
- startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
63
- endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
64
- startAngleBracket: /^</,
65
- endAngleBracket: />$/,
66
- pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
67
- unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
68
- escapeTest: /[&<>"']/,
69
- escapeReplace: /[&<>"']/g,
70
- escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
71
- escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
72
- unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
73
- caret: /(^|[^\[])\^/g,
74
- percentDecode: /%25/g,
75
- findPipe: /\|/g,
76
- splitPipe: / \|/,
77
- slashPipe: /\\\|/g,
78
- carriageReturn: /\r\n|\r/g,
79
- spaceLine: /^ +$/gm,
80
- notSpaceStart: /^\S*/,
81
- endingNewline: /\n$/,
82
- listItemRegex: (n) => new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),
83
- nextBulletRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
84
- hrRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
85
- fencesBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:\`\`\`|~~~)`),
86
- headingBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}#`),
87
- htmlBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}<(?:[a-z].*>|!--)`, "i")
88
- }, xe = /^(?:[ \t]*(?:\n|$))+/, be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, me = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, _ = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, N = /(?:[*+-]|\d{1,9}[.)])/, le = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ae = u(le).replace(/bull/g, N).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(), ye = u(le).replace(/bull/g, N).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(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Re = /^[^\n]+/, H = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Se = u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", H).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), $e = u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex(), B = "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", Q = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Te = u(
89
- "^ {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|$))",
90
- "i"
91
- ).replace("comment", Q).replace("tag", B).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oe = u(j).replace("hr", _).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", B).getRegex(), ve = u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(), F = {
92
- blockquote: ve,
93
- code: be,
94
- def: Se,
95
- fences: me,
96
- heading: we,
97
- hr: _,
98
- html: Te,
99
- lheading: ae,
100
- list: $e,
101
- newline: xe,
102
- paragraph: oe,
103
- table: z,
104
- text: Re
105
- }, ee = u(
106
- "^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
107
- ).replace("hr", _).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", B).getRegex(), ze = {
108
- ...F,
109
- lheading: ye,
110
- table: ee,
111
- paragraph: u(j).replace("hr", _).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ee).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", B).getRegex()
112
- }, _e = {
113
- ...F,
114
- html: u(
115
- `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
116
- ).replace("comment", Q).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(),
117
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
118
- heading: /^(#{1,6})(.*)(?:\n+|$)/,
119
- fences: z,
120
- // fences not supported
121
- lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
122
- paragraph: u(j).replace("hr", _).replace("heading", ` *#{1,6} *[^
123
- ]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
124
- }, Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Le = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ce = /^( {2,}|\\)\n(?!\s*$)/, Pe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, E = /[\p{P}\p{S}]/u, U = /[\s\p{P}\p{S}]/u, he = /[^\s\p{P}\p{S}]/u, Ce = u(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, U).getRegex(), pe = /(?!~)[\p{P}\p{S}]/u, Ie = /(?!~)[\s\p{P}\p{S}]/u, Be = /(?:[^\s\p{P}\p{S}]|~)/u, Ee = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, ue = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qe = u(ue, "u").replace(/punct/g, E).getRegex(), Ze = u(ue, "u").replace(/punct/g, pe).getRegex(), ge = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De = u(ge, "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, U).replace(/punct/g, E).getRegex(), Me = u(ge, "gu").replace(/notPunctSpace/g, Be).replace(/punctSpace/g, Ie).replace(/punct/g, pe).getRegex(), Ge = u(
125
- "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
126
- "gu"
127
- ).replace(/notPunctSpace/g, he).replace(/punctSpace/g, U).replace(/punct/g, E).getRegex(), Oe = u(/\\(punct)/, "gu").replace(/punct/g, E).getRegex(), Ne = u(/^<(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(), je = u(Q).replace("(?:-->|$)", "-->").getRegex(), He = u(
128
- "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
129
- ).replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), P = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Qe = u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", P).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), fe = u(/^!?\[(label)\]\[(ref)\]/).replace("label", P).replace("ref", H).getRegex(), ke = u(/^!?\[(ref)\](?:\[\])?/).replace("ref", H).getRegex(), Fe = u("reflink|nolink(?!\\()", "g").replace("reflink", fe).replace("nolink", ke).getRegex(), X = {
130
- _backpedal: z,
131
- // only used for GFM url
132
- anyPunctuation: Oe,
133
- autolink: Ne,
134
- blockSkip: Ee,
135
- br: ce,
136
- code: Le,
137
- del: z,
138
- emStrongLDelim: qe,
139
- emStrongRDelimAst: De,
140
- emStrongRDelimUnd: Ge,
141
- escape: Ae,
142
- link: Qe,
143
- nolink: ke,
144
- punctuation: Ce,
145
- reflink: fe,
146
- reflinkSearch: Fe,
147
- tag: He,
148
- text: Pe,
149
- url: z
150
- }, Ue = {
151
- ...X,
152
- link: u(/^!?\[(label)\]\((.*?)\)/).replace("label", P).getRegex(),
153
- reflink: u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", P).getRegex()
154
- }, D = {
155
- ...X,
156
- emStrongRDelimAst: Me,
157
- emStrongLDelim: Ze,
158
- url: u(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
159
- _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
160
- del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
161
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
162
- }, Xe = {
163
- ...D,
164
- br: u(ce).replace("{2,}", "*").getRegex(),
165
- text: u(D.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
166
- }, A = {
167
- normal: F,
168
- gfm: ze,
169
- pedantic: _e
170
- }, T = {
171
- normal: X,
172
- gfm: D,
173
- breaks: Xe,
174
- pedantic: Ue
175
- }, We = {
176
- "&": "&amp;",
177
- "<": "&lt;",
178
- ">": "&gt;",
179
- '"': "&quot;",
180
- "'": "&#39;"
181
- }, te = (n) => We[n];
182
- function m(n, e) {
183
- if (e) {
184
- if (x.escapeTest.test(n))
185
- return n.replace(x.escapeReplace, te);
186
- } else if (x.escapeTestNoEncode.test(n))
187
- return n.replace(x.escapeReplaceNoEncode, te);
188
- return n;
189
- }
190
- function ne(n) {
191
- try {
192
- n = encodeURI(n).replace(x.percentDecode, "%");
193
- } catch {
194
- return null;
195
- }
196
- return n;
197
- }
198
- function re(n, e) {
199
- const t = n.replace(x.findPipe, (i, l, a) => {
200
- let c = !1, o = l;
201
- for (; --o >= 0 && a[o] === "\\"; ) c = !c;
202
- return c ? "|" : " |";
203
- }), s = t.split(x.splitPipe);
204
- let r = 0;
205
- if (s[0].trim() || s.shift(), s.length > 0 && !s.at(-1)?.trim() && s.pop(), e)
206
- if (s.length > e)
207
- s.splice(e);
208
- else
209
- for (; s.length < e; ) s.push("");
210
- for (; r < s.length; r++)
211
- s[r] = s[r].trim().replace(x.slashPipe, "|");
212
- return s;
213
- }
214
- function v(n, e, t) {
215
- const s = n.length;
216
- if (s === 0)
217
- return "";
218
- let r = 0;
219
- for (; r < s && n.charAt(s - r - 1) === e; )
220
- r++;
221
- return n.slice(0, s - r);
222
- }
223
- function Je(n, e) {
224
- if (n.indexOf(e[1]) === -1)
225
- return -1;
226
- let t = 0;
227
- for (let s = 0; s < n.length; s++)
228
- if (n[s] === "\\")
229
- s++;
230
- else if (n[s] === e[0])
231
- t++;
232
- else if (n[s] === e[1] && (t--, t < 0))
233
- return s;
234
- return t > 0 ? -2 : -1;
235
- }
236
- function se(n, e, t, s, r) {
237
- const i = e.href, l = e.title || null, a = n[1].replace(r.other.outputLinkReplace, "$1");
238
- s.state.inLink = !0;
239
- const c = {
240
- type: n[0].charAt(0) === "!" ? "image" : "link",
241
- raw: t,
242
- href: i,
243
- title: l,
244
- text: a,
245
- tokens: s.inlineTokens(a)
246
- };
247
- return s.state.inLink = !1, c;
248
- }
249
- function Ke(n, e, t) {
250
- const s = n.match(t.other.indentCodeCompensation);
251
- if (s === null)
252
- return e;
253
- const r = s[1];
254
- return e.split(`
255
- `).map((i) => {
256
- const l = i.match(t.other.beginningSpace);
257
- if (l === null)
258
- return i;
259
- const [a] = l;
260
- return a.length >= r.length ? i.slice(r.length) : i;
261
- }).join(`
262
- `);
263
- }
264
- var C = class {
265
- options;
266
- rules;
267
- // set by the lexer
268
- lexer;
269
- // set by the lexer
270
- constructor(n) {
271
- this.options = n || S;
272
- }
273
- space(n) {
274
- const e = this.rules.block.newline.exec(n);
275
- if (e && e[0].length > 0)
276
- return {
277
- type: "space",
278
- raw: e[0]
279
- };
280
- }
281
- code(n) {
282
- const e = this.rules.block.code.exec(n);
283
- if (e) {
284
- const t = e[0].replace(this.rules.other.codeRemoveIndent, "");
285
- return {
286
- type: "code",
287
- raw: e[0],
288
- codeBlockStyle: "indented",
289
- text: this.options.pedantic ? t : v(t, `
290
- `)
291
- };
292
- }
293
- }
294
- fences(n) {
295
- const e = this.rules.block.fences.exec(n);
296
- if (e) {
297
- const t = e[0], s = Ke(t, e[3] || "", this.rules);
298
- return {
299
- type: "code",
300
- raw: t,
301
- lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2],
302
- text: s
303
- };
304
- }
305
- }
306
- heading(n) {
307
- const e = this.rules.block.heading.exec(n);
308
- if (e) {
309
- let t = e[2].trim();
310
- if (this.rules.other.endingHash.test(t)) {
311
- const s = v(t, "#");
312
- (this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (t = s.trim());
313
- }
314
- return {
315
- type: "heading",
316
- raw: e[0],
317
- depth: e[1].length,
318
- text: t,
319
- tokens: this.lexer.inline(t)
320
- };
321
- }
322
- }
323
- hr(n) {
324
- const e = this.rules.block.hr.exec(n);
325
- if (e)
326
- return {
327
- type: "hr",
328
- raw: v(e[0], `
329
- `)
330
- };
331
- }
332
- blockquote(n) {
333
- const e = this.rules.block.blockquote.exec(n);
334
- if (e) {
335
- let t = v(e[0], `
336
- `).split(`
337
- `), s = "", r = "";
338
- const i = [];
339
- for (; t.length > 0; ) {
340
- let l = !1;
341
- const a = [];
342
- let c;
343
- for (c = 0; c < t.length; c++)
344
- if (this.rules.other.blockquoteStart.test(t[c]))
345
- a.push(t[c]), l = !0;
346
- else if (!l)
347
- a.push(t[c]);
348
- else
349
- break;
350
- t = t.slice(c);
351
- const o = a.join(`
352
- `), h = o.replace(this.rules.other.blockquoteSetextReplace, `
353
- $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
354
- s = s ? `${s}
355
- ${o}` : o, r = r ? `${r}
356
- ${h}` : h;
357
- const k = this.lexer.state.top;
358
- if (this.lexer.state.top = !0, this.lexer.blockTokens(h, i, !0), this.lexer.state.top = k, t.length === 0)
359
- break;
360
- const p = i.at(-1);
361
- if (p?.type === "code")
362
- break;
363
- if (p?.type === "blockquote") {
364
- const d = p, f = d.raw + `
365
- ` + t.join(`
366
- `), b = this.blockquote(f);
367
- i[i.length - 1] = b, s = s.substring(0, s.length - d.raw.length) + b.raw, r = r.substring(0, r.length - d.text.length) + b.text;
368
- break;
369
- } else if (p?.type === "list") {
370
- const d = p, f = d.raw + `
371
- ` + t.join(`
372
- `), b = this.list(f);
373
- i[i.length - 1] = b, s = s.substring(0, s.length - p.raw.length) + b.raw, r = r.substring(0, r.length - d.raw.length) + b.raw, t = f.substring(i.at(-1).raw.length).split(`
374
- `);
375
- continue;
376
- }
377
- }
378
- return {
379
- type: "blockquote",
380
- raw: s,
381
- tokens: i,
382
- text: r
383
- };
384
- }
385
- }
386
- list(n) {
387
- let e = this.rules.block.list.exec(n);
388
- if (e) {
389
- let t = e[1].trim();
390
- const s = t.length > 1, r = {
391
- type: "list",
392
- raw: "",
393
- ordered: s,
394
- start: s ? +t.slice(0, -1) : "",
395
- loose: !1,
396
- items: []
397
- };
398
- t = s ? `\\d{1,9}\\${t.slice(-1)}` : `\\${t}`, this.options.pedantic && (t = s ? t : "[*+-]");
399
- const i = this.rules.other.listItemRegex(t);
400
- let l = !1;
401
- for (; n; ) {
402
- let c = !1, o = "", h = "";
403
- if (!(e = i.exec(n)) || this.rules.block.hr.test(n))
404
- break;
405
- o = e[0], n = n.substring(o.length);
406
- let k = e[2].split(`
407
- `, 1)[0].replace(this.rules.other.listReplaceTabs, (q) => " ".repeat(3 * q.length)), p = n.split(`
408
- `, 1)[0], d = !k.trim(), f = 0;
409
- if (this.options.pedantic ? (f = 2, h = k.trimStart()) : d ? f = e[1].length + 1 : (f = e[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, h = k.slice(f), f += e[1].length), d && this.rules.other.blankLine.test(p) && (o += p + `
410
- `, n = n.substring(p.length + 1), c = !0), !c) {
411
- const q = this.rules.other.nextBulletRegex(f), K = this.rules.other.hrRegex(f), V = this.rules.other.fencesBeginRegex(f), Y = this.rules.other.headingBeginRegex(f), de = this.rules.other.htmlBeginRegex(f);
412
- for (; n; ) {
413
- const Z = n.split(`
414
- `, 1)[0];
415
- let $;
416
- if (p = Z, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), $ = p) : $ = p.replace(this.rules.other.tabCharGlobal, " "), V.test(p) || Y.test(p) || de.test(p) || q.test(p) || K.test(p))
417
- break;
418
- if ($.search(this.rules.other.nonSpaceChar) >= f || !p.trim())
419
- h += `
420
- ` + $.slice(f);
421
- else {
422
- if (d || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || V.test(k) || Y.test(k) || K.test(k))
423
- break;
424
- h += `
425
- ` + p;
426
- }
427
- !d && !p.trim() && (d = !0), o += Z + `
428
- `, n = n.substring(Z.length + 1), k = $.slice(f);
429
- }
430
- }
431
- r.loose || (l ? r.loose = !0 : this.rules.other.doubleBlankLine.test(o) && (l = !0));
432
- let b = null, J;
433
- this.options.gfm && (b = this.rules.other.listIsTask.exec(h), b && (J = b[0] !== "[ ] ", h = h.replace(this.rules.other.listReplaceTask, ""))), r.items.push({
434
- type: "list_item",
435
- raw: o,
436
- task: !!b,
437
- checked: J,
438
- loose: !1,
439
- text: h,
440
- tokens: []
441
- }), r.raw += o;
442
- }
443
- const a = r.items.at(-1);
444
- if (a)
445
- a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd();
446
- else
447
- return;
448
- r.raw = r.raw.trimEnd();
449
- for (let c = 0; c < r.items.length; c++)
450
- if (this.lexer.state.top = !1, r.items[c].tokens = this.lexer.blockTokens(r.items[c].text, []), !r.loose) {
451
- const o = r.items[c].tokens.filter((k) => k.type === "space"), h = o.length > 0 && o.some((k) => this.rules.other.anyLine.test(k.raw));
452
- r.loose = h;
453
- }
454
- if (r.loose)
455
- for (let c = 0; c < r.items.length; c++)
456
- r.items[c].loose = !0;
457
- return r;
458
- }
459
- }
460
- html(n) {
461
- const e = this.rules.block.html.exec(n);
462
- if (e)
463
- return {
464
- type: "html",
465
- block: !0,
466
- raw: e[0],
467
- pre: e[1] === "pre" || e[1] === "script" || e[1] === "style",
468
- text: e[0]
469
- };
470
- }
471
- def(n) {
472
- const e = this.rules.block.def.exec(n);
473
- if (e) {
474
- const t = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
475
- return {
476
- type: "def",
477
- tag: t,
478
- raw: e[0],
479
- href: s,
480
- title: r
481
- };
482
- }
483
- }
484
- table(n) {
485
- const e = this.rules.block.table.exec(n);
486
- if (!e || !this.rules.other.tableDelimiter.test(e[2]))
487
- return;
488
- const t = re(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
489
- `) : [], i = {
490
- type: "table",
491
- raw: e[0],
492
- header: [],
493
- align: [],
494
- rows: []
495
- };
496
- if (t.length === s.length) {
497
- for (const l of s)
498
- this.rules.other.tableAlignRight.test(l) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? i.align.push("left") : i.align.push(null);
499
- for (let l = 0; l < t.length; l++)
500
- i.header.push({
501
- text: t[l],
502
- tokens: this.lexer.inline(t[l]),
503
- header: !0,
504
- align: i.align[l]
505
- });
506
- for (const l of r)
507
- i.rows.push(re(l, i.header.length).map((a, c) => ({
508
- text: a,
509
- tokens: this.lexer.inline(a),
510
- header: !1,
511
- align: i.align[c]
512
- })));
513
- return i;
514
- }
515
- }
516
- lheading(n) {
517
- const e = this.rules.block.lheading.exec(n);
518
- if (e)
519
- return {
520
- type: "heading",
521
- raw: e[0],
522
- depth: e[2].charAt(0) === "=" ? 1 : 2,
523
- text: e[1],
524
- tokens: this.lexer.inline(e[1])
525
- };
526
- }
527
- paragraph(n) {
528
- const e = this.rules.block.paragraph.exec(n);
529
- if (e) {
530
- const t = e[1].charAt(e[1].length - 1) === `
531
- ` ? e[1].slice(0, -1) : e[1];
532
- return {
533
- type: "paragraph",
534
- raw: e[0],
535
- text: t,
536
- tokens: this.lexer.inline(t)
537
- };
538
- }
539
- }
540
- text(n) {
541
- const e = this.rules.block.text.exec(n);
542
- if (e)
543
- return {
544
- type: "text",
545
- raw: e[0],
546
- text: e[0],
547
- tokens: this.lexer.inline(e[0])
548
- };
549
- }
550
- escape(n) {
551
- const e = this.rules.inline.escape.exec(n);
552
- if (e)
553
- return {
554
- type: "escape",
555
- raw: e[0],
556
- text: e[1]
557
- };
558
- }
559
- tag(n) {
560
- const e = this.rules.inline.tag.exec(n);
561
- if (e)
562
- return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), {
563
- type: "html",
564
- raw: e[0],
565
- inLink: this.lexer.state.inLink,
566
- inRawBlock: this.lexer.state.inRawBlock,
567
- block: !1,
568
- text: e[0]
569
- };
570
- }
571
- link(n) {
572
- const e = this.rules.inline.link.exec(n);
573
- if (e) {
574
- const t = e[2].trim();
575
- if (!this.options.pedantic && this.rules.other.startAngleBracket.test(t)) {
576
- if (!this.rules.other.endAngleBracket.test(t))
577
- return;
578
- const i = v(t.slice(0, -1), "\\");
579
- if ((t.length - i.length) % 2 === 0)
580
- return;
581
- } else {
582
- const i = Je(e[2], "()");
583
- if (i === -2)
584
- return;
585
- if (i > -1) {
586
- const a = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
587
- e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, a).trim(), e[3] = "";
588
- }
589
- }
590
- let s = e[2], r = "";
591
- if (this.options.pedantic) {
592
- const i = this.rules.other.pedanticHrefTitle.exec(s);
593
- i && (s = i[1], r = i[3]);
594
- } else
595
- r = e[3] ? e[3].slice(1, -1) : "";
596
- return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(t) ? s = s.slice(1) : s = s.slice(1, -1)), se(e, {
597
- href: s && s.replace(this.rules.inline.anyPunctuation, "$1"),
598
- title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
599
- }, e[0], this.lexer, this.rules);
600
- }
601
- }
602
- reflink(n, e) {
603
- let t;
604
- if ((t = this.rules.inline.reflink.exec(n)) || (t = this.rules.inline.nolink.exec(n))) {
605
- const s = (t[2] || t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = e[s.toLowerCase()];
606
- if (!r) {
607
- const i = t[0].charAt(0);
608
- return {
609
- type: "text",
610
- raw: i,
611
- text: i
612
- };
613
- }
614
- return se(t, r, t[0], this.lexer, this.rules);
615
- }
616
- }
617
- emStrong(n, e, t = "") {
618
- let s = this.rules.inline.emStrongLDelim.exec(n);
619
- if (!s || s[3] && t.match(this.rules.other.unicodeAlphaNumeric)) return;
620
- if (!(s[1] || s[2] || "") || !t || this.rules.inline.punctuation.exec(t)) {
621
- const i = [...s[0]].length - 1;
622
- let l, a, c = i, o = 0;
623
- const h = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
624
- for (h.lastIndex = 0, e = e.slice(-1 * n.length + i); (s = h.exec(e)) != null; ) {
625
- if (l = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !l) continue;
626
- if (a = [...l].length, s[3] || s[4]) {
627
- c += a;
628
- continue;
629
- } else if ((s[5] || s[6]) && i % 3 && !((i + a) % 3)) {
630
- o += a;
631
- continue;
632
- }
633
- if (c -= a, c > 0) continue;
634
- a = Math.min(a, a + c + o);
635
- const k = [...s[0]][0].length, p = n.slice(0, i + s.index + k + a);
636
- if (Math.min(i, a) % 2) {
637
- const f = p.slice(1, -1);
638
- return {
639
- type: "em",
640
- raw: p,
641
- text: f,
642
- tokens: this.lexer.inlineTokens(f)
643
- };
644
- }
645
- const d = p.slice(2, -2);
646
- return {
647
- type: "strong",
648
- raw: p,
649
- text: d,
650
- tokens: this.lexer.inlineTokens(d)
651
- };
652
- }
653
- }
654
- }
655
- codespan(n) {
656
- const e = this.rules.inline.code.exec(n);
657
- if (e) {
658
- let t = e[2].replace(this.rules.other.newLineCharGlobal, " ");
659
- const s = this.rules.other.nonSpaceChar.test(t), r = this.rules.other.startingSpaceChar.test(t) && this.rules.other.endingSpaceChar.test(t);
660
- return s && r && (t = t.substring(1, t.length - 1)), {
661
- type: "codespan",
662
- raw: e[0],
663
- text: t
664
- };
665
- }
666
- }
667
- br(n) {
668
- const e = this.rules.inline.br.exec(n);
669
- if (e)
670
- return {
671
- type: "br",
672
- raw: e[0]
673
- };
674
- }
675
- del(n) {
676
- const e = this.rules.inline.del.exec(n);
677
- if (e)
678
- return {
679
- type: "del",
680
- raw: e[0],
681
- text: e[2],
682
- tokens: this.lexer.inlineTokens(e[2])
683
- };
684
- }
685
- autolink(n) {
686
- const e = this.rules.inline.autolink.exec(n);
687
- if (e) {
688
- let t, s;
689
- return e[2] === "@" ? (t = e[1], s = "mailto:" + t) : (t = e[1], s = t), {
690
- type: "link",
691
- raw: e[0],
692
- text: t,
693
- href: s,
694
- tokens: [
695
- {
696
- type: "text",
697
- raw: t,
698
- text: t
699
- }
700
- ]
701
- };
702
- }
703
- }
704
- url(n) {
705
- let e;
706
- if (e = this.rules.inline.url.exec(n)) {
707
- let t, s;
708
- if (e[2] === "@")
709
- t = e[0], s = "mailto:" + t;
710
- else {
711
- let r;
712
- do
713
- r = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
714
- while (r !== e[0]);
715
- t = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
716
- }
717
- return {
718
- type: "link",
719
- raw: e[0],
720
- text: t,
721
- href: s,
722
- tokens: [
723
- {
724
- type: "text",
725
- raw: t,
726
- text: t
727
- }
728
- ]
729
- };
730
- }
731
- }
732
- inlineText(n) {
733
- const e = this.rules.inline.text.exec(n);
734
- if (e) {
735
- const t = this.lexer.state.inRawBlock;
736
- return {
737
- type: "text",
738
- raw: e[0],
739
- text: e[0],
740
- escaped: t
741
- };
742
- }
743
- }
744
- }, w = class M {
745
- tokens;
746
- options;
747
- state;
748
- tokenizer;
749
- inlineQueue;
750
- constructor(e) {
751
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || S, this.options.tokenizer = this.options.tokenizer || new C(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
752
- inLink: !1,
753
- inRawBlock: !1,
754
- top: !0
755
- };
756
- const t = {
757
- other: x,
758
- block: A.normal,
759
- inline: T.normal
760
- };
761
- this.options.pedantic ? (t.block = A.pedantic, t.inline = T.pedantic) : this.options.gfm && (t.block = A.gfm, this.options.breaks ? t.inline = T.breaks : t.inline = T.gfm), this.tokenizer.rules = t;
762
- }
763
- /**
764
- * Expose Rules
765
- */
766
- static get rules() {
767
- return {
768
- block: A,
769
- inline: T
770
- };
771
- }
772
- /**
773
- * Static Lex Method
774
- */
775
- static lex(e, t) {
776
- return new M(t).lex(e);
777
- }
778
- /**
779
- * Static Lex Inline Method
780
- */
781
- static lexInline(e, t) {
782
- return new M(t).inlineTokens(e);
783
- }
784
- /**
785
- * Preprocessing
786
- */
787
- lex(e) {
788
- e = e.replace(x.carriageReturn, `
789
- `), this.blockTokens(e, this.tokens);
790
- for (let t = 0; t < this.inlineQueue.length; t++) {
791
- const s = this.inlineQueue[t];
792
- this.inlineTokens(s.src, s.tokens);
793
- }
794
- return this.inlineQueue = [], this.tokens;
795
- }
796
- blockTokens(e, t = [], s = !1) {
797
- for (this.options.pedantic && (e = e.replace(x.tabCharGlobal, " ").replace(x.spaceLine, "")); e; ) {
798
- let r;
799
- if (this.options.extensions?.block?.some((l) => (r = l.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1))
800
- continue;
801
- if (r = this.tokenizer.space(e)) {
802
- e = e.substring(r.raw.length);
803
- const l = t.at(-1);
804
- r.raw.length === 1 && l !== void 0 ? l.raw += `
805
- ` : t.push(r);
806
- continue;
807
- }
808
- if (r = this.tokenizer.code(e)) {
809
- e = e.substring(r.raw.length);
810
- const l = t.at(-1);
811
- l?.type === "paragraph" || l?.type === "text" ? (l.raw += `
812
- ` + r.raw, l.text += `
813
- ` + r.text, this.inlineQueue.at(-1).src = l.text) : t.push(r);
814
- continue;
815
- }
816
- if (r = this.tokenizer.fences(e)) {
817
- e = e.substring(r.raw.length), t.push(r);
818
- continue;
819
- }
820
- if (r = this.tokenizer.heading(e)) {
821
- e = e.substring(r.raw.length), t.push(r);
822
- continue;
823
- }
824
- if (r = this.tokenizer.hr(e)) {
825
- e = e.substring(r.raw.length), t.push(r);
826
- continue;
827
- }
828
- if (r = this.tokenizer.blockquote(e)) {
829
- e = e.substring(r.raw.length), t.push(r);
830
- continue;
831
- }
832
- if (r = this.tokenizer.list(e)) {
833
- e = e.substring(r.raw.length), t.push(r);
834
- continue;
835
- }
836
- if (r = this.tokenizer.html(e)) {
837
- e = e.substring(r.raw.length), t.push(r);
838
- continue;
839
- }
840
- if (r = this.tokenizer.def(e)) {
841
- e = e.substring(r.raw.length);
842
- const l = t.at(-1);
843
- l?.type === "paragraph" || l?.type === "text" ? (l.raw += `
844
- ` + r.raw, l.text += `
845
- ` + r.raw, this.inlineQueue.at(-1).src = l.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
846
- href: r.href,
847
- title: r.title
848
- });
849
- continue;
850
- }
851
- if (r = this.tokenizer.table(e)) {
852
- e = e.substring(r.raw.length), t.push(r);
853
- continue;
854
- }
855
- if (r = this.tokenizer.lheading(e)) {
856
- e = e.substring(r.raw.length), t.push(r);
857
- continue;
858
- }
859
- let i = e;
860
- if (this.options.extensions?.startBlock) {
861
- let l = 1 / 0;
862
- const a = e.slice(1);
863
- let c;
864
- this.options.extensions.startBlock.forEach((o) => {
865
- c = o.call({ lexer: this }, a), typeof c == "number" && c >= 0 && (l = Math.min(l, c));
866
- }), l < 1 / 0 && l >= 0 && (i = e.substring(0, l + 1));
867
- }
868
- if (this.state.top && (r = this.tokenizer.paragraph(i))) {
869
- const l = t.at(-1);
870
- s && l?.type === "paragraph" ? (l.raw += `
871
- ` + r.raw, l.text += `
872
- ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : t.push(r), s = i.length !== e.length, e = e.substring(r.raw.length);
873
- continue;
874
- }
875
- if (r = this.tokenizer.text(e)) {
876
- e = e.substring(r.raw.length);
877
- const l = t.at(-1);
878
- l?.type === "text" ? (l.raw += `
879
- ` + r.raw, l.text += `
880
- ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : t.push(r);
881
- continue;
882
- }
883
- if (e) {
884
- const l = "Infinite loop on byte: " + e.charCodeAt(0);
885
- if (this.options.silent) {
886
- console.error(l);
887
- break;
888
- } else
889
- throw new Error(l);
890
- }
891
- }
892
- return this.state.top = !0, t;
893
- }
894
- inline(e, t = []) {
895
- return this.inlineQueue.push({ src: e, tokens: t }), t;
896
- }
897
- /**
898
- * Lexing/Compiling
899
- */
900
- inlineTokens(e, t = []) {
901
- let s = e, r = null;
902
- if (this.tokens.links) {
903
- const a = Object.keys(this.tokens.links);
904
- if (a.length > 0)
905
- for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; )
906
- a.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
907
- }
908
- for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; )
909
- s = s.slice(0, r.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
910
- for (; (r = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; )
911
- s = s.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
912
- let i = !1, l = "";
913
- for (; e; ) {
914
- i || (l = ""), i = !1;
915
- let a;
916
- if (this.options.extensions?.inline?.some((o) => (a = o.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), !0) : !1))
917
- continue;
918
- if (a = this.tokenizer.escape(e)) {
919
- e = e.substring(a.raw.length), t.push(a);
920
- continue;
921
- }
922
- if (a = this.tokenizer.tag(e)) {
923
- e = e.substring(a.raw.length), t.push(a);
924
- continue;
925
- }
926
- if (a = this.tokenizer.link(e)) {
927
- e = e.substring(a.raw.length), t.push(a);
928
- continue;
929
- }
930
- if (a = this.tokenizer.reflink(e, this.tokens.links)) {
931
- e = e.substring(a.raw.length);
932
- const o = t.at(-1);
933
- a.type === "text" && o?.type === "text" ? (o.raw += a.raw, o.text += a.text) : t.push(a);
934
- continue;
935
- }
936
- if (a = this.tokenizer.emStrong(e, s, l)) {
937
- e = e.substring(a.raw.length), t.push(a);
938
- continue;
939
- }
940
- if (a = this.tokenizer.codespan(e)) {
941
- e = e.substring(a.raw.length), t.push(a);
942
- continue;
943
- }
944
- if (a = this.tokenizer.br(e)) {
945
- e = e.substring(a.raw.length), t.push(a);
946
- continue;
947
- }
948
- if (a = this.tokenizer.del(e)) {
949
- e = e.substring(a.raw.length), t.push(a);
950
- continue;
951
- }
952
- if (a = this.tokenizer.autolink(e)) {
953
- e = e.substring(a.raw.length), t.push(a);
954
- continue;
955
- }
956
- if (!this.state.inLink && (a = this.tokenizer.url(e))) {
957
- e = e.substring(a.raw.length), t.push(a);
958
- continue;
959
- }
960
- let c = e;
961
- if (this.options.extensions?.startInline) {
962
- let o = 1 / 0;
963
- const h = e.slice(1);
964
- let k;
965
- this.options.extensions.startInline.forEach((p) => {
966
- k = p.call({ lexer: this }, h), typeof k == "number" && k >= 0 && (o = Math.min(o, k));
967
- }), o < 1 / 0 && o >= 0 && (c = e.substring(0, o + 1));
968
- }
969
- if (a = this.tokenizer.inlineText(c)) {
970
- e = e.substring(a.raw.length), a.raw.slice(-1) !== "_" && (l = a.raw.slice(-1)), i = !0;
971
- const o = t.at(-1);
972
- o?.type === "text" ? (o.raw += a.raw, o.text += a.text) : t.push(a);
973
- continue;
974
- }
975
- if (e) {
976
- const o = "Infinite loop on byte: " + e.charCodeAt(0);
977
- if (this.options.silent) {
978
- console.error(o);
979
- break;
980
- } else
981
- throw new Error(o);
982
- }
983
- }
984
- return t;
985
- }
986
- }, I = class {
987
- options;
988
- parser;
989
- // set by the parser
990
- constructor(n) {
991
- this.options = n || S;
992
- }
993
- space(n) {
994
- return "";
995
- }
996
- code({ text: n, lang: e, escaped: t }) {
997
- const s = (e || "").match(x.notSpaceStart)?.[0], r = n.replace(x.endingNewline, "") + `
998
- `;
999
- return s ? '<pre><code class="language-' + m(s) + '">' + (t ? r : m(r, !0)) + `</code></pre>
1000
- ` : "<pre><code>" + (t ? r : m(r, !0)) + `</code></pre>
1001
- `;
1002
- }
1003
- blockquote({ tokens: n }) {
1004
- return `<blockquote>
1005
- ${this.parser.parse(n)}</blockquote>
1006
- `;
1007
- }
1008
- html({ text: n }) {
1009
- return n;
1010
- }
1011
- heading({ tokens: n, depth: e }) {
1012
- return `<h${e}>${this.parser.parseInline(n)}</h${e}>
1013
- `;
1014
- }
1015
- hr(n) {
1016
- return `<hr>
1017
- `;
1018
- }
1019
- list(n) {
1020
- const e = n.ordered, t = n.start;
1021
- let s = "";
1022
- for (let l = 0; l < n.items.length; l++) {
1023
- const a = n.items[l];
1024
- s += this.listitem(a);
1025
- }
1026
- const r = e ? "ol" : "ul", i = e && t !== 1 ? ' start="' + t + '"' : "";
1027
- return "<" + r + i + `>
1028
- ` + s + "</" + r + `>
1029
- `;
1030
- }
1031
- listitem(n) {
1032
- let e = "";
1033
- if (n.task) {
1034
- const t = this.checkbox({ checked: !!n.checked });
1035
- n.loose ? n.tokens[0]?.type === "paragraph" ? (n.tokens[0].text = t + " " + n.tokens[0].text, n.tokens[0].tokens && n.tokens[0].tokens.length > 0 && n.tokens[0].tokens[0].type === "text" && (n.tokens[0].tokens[0].text = t + " " + m(n.tokens[0].tokens[0].text), n.tokens[0].tokens[0].escaped = !0)) : n.tokens.unshift({
1036
- type: "text",
1037
- raw: t + " ",
1038
- text: t + " ",
1039
- escaped: !0
1040
- }) : e += t + " ";
1041
- }
1042
- return e += this.parser.parse(n.tokens, !!n.loose), `<li>${e}</li>
1043
- `;
1044
- }
1045
- checkbox({ checked: n }) {
1046
- return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
1047
- }
1048
- paragraph({ tokens: n }) {
1049
- return `<p>${this.parser.parseInline(n)}</p>
1050
- `;
1051
- }
1052
- table(n) {
1053
- let e = "", t = "";
1054
- for (let r = 0; r < n.header.length; r++)
1055
- t += this.tablecell(n.header[r]);
1056
- e += this.tablerow({ text: t });
1057
- let s = "";
1058
- for (let r = 0; r < n.rows.length; r++) {
1059
- const i = n.rows[r];
1060
- t = "";
1061
- for (let l = 0; l < i.length; l++)
1062
- t += this.tablecell(i[l]);
1063
- s += this.tablerow({ text: t });
1064
- }
1065
- return s && (s = `<tbody>${s}</tbody>`), `<table>
1066
- <thead>
1067
- ` + e + `</thead>
1068
- ` + s + `</table>
1069
- `;
1070
- }
1071
- tablerow({ text: n }) {
1072
- return `<tr>
1073
- ${n}</tr>
1074
- `;
1075
- }
1076
- tablecell(n) {
1077
- const e = this.parser.parseInline(n.tokens), t = n.header ? "th" : "td";
1078
- return (n.align ? `<${t} align="${n.align}">` : `<${t}>`) + e + `</${t}>
1079
- `;
1080
- }
1081
- /**
1082
- * span level renderer
1083
- */
1084
- strong({ tokens: n }) {
1085
- return `<strong>${this.parser.parseInline(n)}</strong>`;
1086
- }
1087
- em({ tokens: n }) {
1088
- return `<em>${this.parser.parseInline(n)}</em>`;
1089
- }
1090
- codespan({ text: n }) {
1091
- return `<code>${m(n, !0)}</code>`;
1092
- }
1093
- br(n) {
1094
- return "<br>";
1095
- }
1096
- del({ tokens: n }) {
1097
- return `<del>${this.parser.parseInline(n)}</del>`;
1098
- }
1099
- link({ href: n, title: e, tokens: t }) {
1100
- const s = this.parser.parseInline(t), r = ne(n);
1101
- if (r === null)
1102
- return s;
1103
- n = r;
1104
- let i = '<a href="' + n + '"';
1105
- return e && (i += ' title="' + m(e) + '"'), i += ">" + s + "</a>", i;
1106
- }
1107
- image({ href: n, title: e, text: t, tokens: s }) {
1108
- s && (t = this.parser.parseInline(s, this.parser.textRenderer));
1109
- const r = ne(n);
1110
- if (r === null)
1111
- return m(t);
1112
- n = r;
1113
- let i = `<img src="${n}" alt="${t}"`;
1114
- return e && (i += ` title="${m(e)}"`), i += ">", i;
1115
- }
1116
- text(n) {
1117
- return "tokens" in n && n.tokens ? this.parser.parseInline(n.tokens) : "escaped" in n && n.escaped ? n.text : m(n.text);
1118
- }
1119
- }, W = class {
1120
- // no need for block level renderers
1121
- strong({ text: n }) {
1122
- return n;
1123
- }
1124
- em({ text: n }) {
1125
- return n;
1126
- }
1127
- codespan({ text: n }) {
1128
- return n;
1129
- }
1130
- del({ text: n }) {
1131
- return n;
1132
- }
1133
- html({ text: n }) {
1134
- return n;
1135
- }
1136
- text({ text: n }) {
1137
- return n;
1138
- }
1139
- link({ text: n }) {
1140
- return "" + n;
1141
- }
1142
- image({ text: n }) {
1143
- return "" + n;
1144
- }
1145
- br() {
1146
- return "";
1147
- }
1148
- }, y = class G {
1149
- options;
1150
- renderer;
1151
- textRenderer;
1152
- constructor(e) {
1153
- this.options = e || S, this.options.renderer = this.options.renderer || new I(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new W();
1154
- }
1155
- /**
1156
- * Static Parse Method
1157
- */
1158
- static parse(e, t) {
1159
- return new G(t).parse(e);
1160
- }
1161
- /**
1162
- * Static Parse Inline Method
1163
- */
1164
- static parseInline(e, t) {
1165
- return new G(t).parseInline(e);
1166
- }
1167
- /**
1168
- * Parse Loop
1169
- */
1170
- parse(e, t = !0) {
1171
- let s = "";
1172
- for (let r = 0; r < e.length; r++) {
1173
- const i = e[r];
1174
- if (this.options.extensions?.renderers?.[i.type]) {
1175
- const a = i, c = this.options.extensions.renderers[a.type].call({ parser: this }, a);
1176
- if (c !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(a.type)) {
1177
- s += c || "";
1178
- continue;
1179
- }
1180
- }
1181
- const l = i;
1182
- switch (l.type) {
1183
- case "space": {
1184
- s += this.renderer.space(l);
1185
- continue;
1186
- }
1187
- case "hr": {
1188
- s += this.renderer.hr(l);
1189
- continue;
1190
- }
1191
- case "heading": {
1192
- s += this.renderer.heading(l);
1193
- continue;
1194
- }
1195
- case "code": {
1196
- s += this.renderer.code(l);
1197
- continue;
1198
- }
1199
- case "table": {
1200
- s += this.renderer.table(l);
1201
- continue;
1202
- }
1203
- case "blockquote": {
1204
- s += this.renderer.blockquote(l);
1205
- continue;
1206
- }
1207
- case "list": {
1208
- s += this.renderer.list(l);
1209
- continue;
1210
- }
1211
- case "html": {
1212
- s += this.renderer.html(l);
1213
- continue;
1214
- }
1215
- case "paragraph": {
1216
- s += this.renderer.paragraph(l);
1217
- continue;
1218
- }
1219
- case "text": {
1220
- let a = l, c = this.renderer.text(a);
1221
- for (; r + 1 < e.length && e[r + 1].type === "text"; )
1222
- a = e[++r], c += `
1223
- ` + this.renderer.text(a);
1224
- t ? s += this.renderer.paragraph({
1225
- type: "paragraph",
1226
- raw: c,
1227
- text: c,
1228
- tokens: [{ type: "text", raw: c, text: c, escaped: !0 }]
1229
- }) : s += c;
1230
- continue;
1231
- }
1232
- default: {
1233
- const a = 'Token with "' + l.type + '" type was not found.';
1234
- if (this.options.silent)
1235
- return console.error(a), "";
1236
- throw new Error(a);
1237
- }
1238
- }
1239
- }
1240
- return s;
1241
- }
1242
- /**
1243
- * Parse Inline Tokens
1244
- */
1245
- parseInline(e, t = this.renderer) {
1246
- let s = "";
1247
- for (let r = 0; r < e.length; r++) {
1248
- const i = e[r];
1249
- if (this.options.extensions?.renderers?.[i.type]) {
1250
- const a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1251
- if (a !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
1252
- s += a || "";
1253
- continue;
1254
- }
1255
- }
1256
- const l = i;
1257
- switch (l.type) {
1258
- case "escape": {
1259
- s += t.text(l);
1260
- break;
1261
- }
1262
- case "html": {
1263
- s += t.html(l);
1264
- break;
1265
- }
1266
- case "link": {
1267
- s += t.link(l);
1268
- break;
1269
- }
1270
- case "image": {
1271
- s += t.image(l);
1272
- break;
1273
- }
1274
- case "strong": {
1275
- s += t.strong(l);
1276
- break;
1277
- }
1278
- case "em": {
1279
- s += t.em(l);
1280
- break;
1281
- }
1282
- case "codespan": {
1283
- s += t.codespan(l);
1284
- break;
1285
- }
1286
- case "br": {
1287
- s += t.br(l);
1288
- break;
1289
- }
1290
- case "del": {
1291
- s += t.del(l);
1292
- break;
1293
- }
1294
- case "text": {
1295
- s += t.text(l);
1296
- break;
1297
- }
1298
- default: {
1299
- const a = 'Token with "' + l.type + '" type was not found.';
1300
- if (this.options.silent)
1301
- return console.error(a), "";
1302
- throw new Error(a);
1303
- }
1304
- }
1305
- }
1306
- return s;
1307
- }
1308
- }, L = class {
1309
- options;
1310
- block;
1311
- constructor(n) {
1312
- this.options = n || S;
1313
- }
1314
- static passThroughHooks = /* @__PURE__ */ new Set([
1315
- "preprocess",
1316
- "postprocess",
1317
- "processAllTokens"
1318
- ]);
1319
- /**
1320
- * Process markdown before marked
1321
- */
1322
- preprocess(n) {
1323
- return n;
1324
- }
1325
- /**
1326
- * Process HTML after marked is finished
1327
- */
1328
- postprocess(n) {
1329
- return n;
1330
- }
1331
- /**
1332
- * Process all tokens before walk tokens
1333
- */
1334
- processAllTokens(n) {
1335
- return n;
1336
- }
1337
- /**
1338
- * Provide function to tokenize markdown
1339
- */
1340
- provideLexer() {
1341
- return this.block ? w.lex : w.lexInline;
1342
- }
1343
- /**
1344
- * Provide function to parse tokens
1345
- */
1346
- provideParser() {
1347
- return this.block ? y.parse : y.parseInline;
1348
- }
1349
- }, Ve = class {
1350
- defaults = O();
1351
- options = this.setOptions;
1352
- parse = this.parseMarkdown(!0);
1353
- parseInline = this.parseMarkdown(!1);
1354
- Parser = y;
1355
- Renderer = I;
1356
- TextRenderer = W;
1357
- Lexer = w;
1358
- Tokenizer = C;
1359
- Hooks = L;
1360
- constructor(...n) {
1361
- this.use(...n);
1362
- }
1363
- /**
1364
- * Run callback for every token
1365
- */
1366
- walkTokens(n, e) {
1367
- let t = [];
1368
- for (const s of n)
1369
- switch (t = t.concat(e.call(this, s)), s.type) {
1370
- case "table": {
1371
- const r = s;
1372
- for (const i of r.header)
1373
- t = t.concat(this.walkTokens(i.tokens, e));
1374
- for (const i of r.rows)
1375
- for (const l of i)
1376
- t = t.concat(this.walkTokens(l.tokens, e));
1377
- break;
1378
- }
1379
- case "list": {
1380
- const r = s;
1381
- t = t.concat(this.walkTokens(r.items, e));
1382
- break;
1383
- }
1384
- default: {
1385
- const r = s;
1386
- this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((i) => {
1387
- const l = r[i].flat(1 / 0);
1388
- t = t.concat(this.walkTokens(l, e));
1389
- }) : r.tokens && (t = t.concat(this.walkTokens(r.tokens, e)));
1390
- }
1391
- }
1392
- return t;
1393
- }
1394
- use(...n) {
1395
- const e = this.defaults.extensions || { renderers: {}, childTokens: {} };
1396
- return n.forEach((t) => {
1397
- const s = { ...t };
1398
- if (s.async = this.defaults.async || s.async || !1, t.extensions && (t.extensions.forEach((r) => {
1399
- if (!r.name)
1400
- throw new Error("extension name required");
1401
- if ("renderer" in r) {
1402
- const i = e.renderers[r.name];
1403
- i ? e.renderers[r.name] = function(...l) {
1404
- let a = r.renderer.apply(this, l);
1405
- return a === !1 && (a = i.apply(this, l)), a;
1406
- } : e.renderers[r.name] = r.renderer;
1407
- }
1408
- if ("tokenizer" in r) {
1409
- if (!r.level || r.level !== "block" && r.level !== "inline")
1410
- throw new Error("extension level must be 'block' or 'inline'");
1411
- const i = e[r.level];
1412
- i ? i.unshift(r.tokenizer) : e[r.level] = [r.tokenizer], r.start && (r.level === "block" ? e.startBlock ? e.startBlock.push(r.start) : e.startBlock = [r.start] : r.level === "inline" && (e.startInline ? e.startInline.push(r.start) : e.startInline = [r.start]));
1413
- }
1414
- "childTokens" in r && r.childTokens && (e.childTokens[r.name] = r.childTokens);
1415
- }), s.extensions = e), t.renderer) {
1416
- const r = this.defaults.renderer || new I(this.defaults);
1417
- for (const i in t.renderer) {
1418
- if (!(i in r))
1419
- throw new Error(`renderer '${i}' does not exist`);
1420
- if (["options", "parser"].includes(i))
1421
- continue;
1422
- const l = i, a = t.renderer[l], c = r[l];
1423
- r[l] = (...o) => {
1424
- let h = a.apply(r, o);
1425
- return h === !1 && (h = c.apply(r, o)), h || "";
1426
- };
1427
- }
1428
- s.renderer = r;
1429
- }
1430
- if (t.tokenizer) {
1431
- const r = this.defaults.tokenizer || new C(this.defaults);
1432
- for (const i in t.tokenizer) {
1433
- if (!(i in r))
1434
- throw new Error(`tokenizer '${i}' does not exist`);
1435
- if (["options", "rules", "lexer"].includes(i))
1436
- continue;
1437
- const l = i, a = t.tokenizer[l], c = r[l];
1438
- r[l] = (...o) => {
1439
- let h = a.apply(r, o);
1440
- return h === !1 && (h = c.apply(r, o)), h;
1441
- };
1442
- }
1443
- s.tokenizer = r;
1444
- }
1445
- if (t.hooks) {
1446
- const r = this.defaults.hooks || new L();
1447
- for (const i in t.hooks) {
1448
- if (!(i in r))
1449
- throw new Error(`hook '${i}' does not exist`);
1450
- if (["options", "block"].includes(i))
1451
- continue;
1452
- const l = i, a = t.hooks[l], c = r[l];
1453
- L.passThroughHooks.has(i) ? r[l] = (o) => {
1454
- if (this.defaults.async)
1455
- return Promise.resolve(a.call(r, o)).then((k) => c.call(r, k));
1456
- const h = a.call(r, o);
1457
- return c.call(r, h);
1458
- } : r[l] = (...o) => {
1459
- let h = a.apply(r, o);
1460
- return h === !1 && (h = c.apply(r, o)), h;
1461
- };
1462
- }
1463
- s.hooks = r;
1464
- }
1465
- if (t.walkTokens) {
1466
- const r = this.defaults.walkTokens, i = t.walkTokens;
1467
- s.walkTokens = function(l) {
1468
- let a = [];
1469
- return a.push(i.call(this, l)), r && (a = a.concat(r.call(this, l))), a;
1470
- };
1471
- }
1472
- this.defaults = { ...this.defaults, ...s };
1473
- }), this;
1474
- }
1475
- setOptions(n) {
1476
- return this.defaults = { ...this.defaults, ...n }, this;
1477
- }
1478
- lexer(n, e) {
1479
- return w.lex(n, e ?? this.defaults);
1480
- }
1481
- parser(n, e) {
1482
- return y.parse(n, e ?? this.defaults);
1483
- }
1484
- parseMarkdown(n) {
1485
- return (t, s) => {
1486
- const r = { ...s }, i = { ...this.defaults, ...r }, l = this.onError(!!i.silent, !!i.async);
1487
- if (this.defaults.async === !0 && r.async === !1)
1488
- return l(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."));
1489
- if (typeof t > "u" || t === null)
1490
- return l(new Error("marked(): input parameter is undefined or null"));
1491
- if (typeof t != "string")
1492
- return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
1493
- i.hooks && (i.hooks.options = i, i.hooks.block = n);
1494
- const a = i.hooks ? i.hooks.provideLexer() : n ? w.lex : w.lexInline, c = i.hooks ? i.hooks.provideParser() : n ? y.parse : y.parseInline;
1495
- if (i.async)
1496
- return Promise.resolve(i.hooks ? i.hooks.preprocess(t) : t).then((o) => a(o, i)).then((o) => i.hooks ? i.hooks.processAllTokens(o) : o).then((o) => i.walkTokens ? Promise.all(this.walkTokens(o, i.walkTokens)).then(() => o) : o).then((o) => c(o, i)).then((o) => i.hooks ? i.hooks.postprocess(o) : o).catch(l);
1497
- try {
1498
- i.hooks && (t = i.hooks.preprocess(t));
1499
- let o = a(t, i);
1500
- i.hooks && (o = i.hooks.processAllTokens(o)), i.walkTokens && this.walkTokens(o, i.walkTokens);
1501
- let h = c(o, i);
1502
- return i.hooks && (h = i.hooks.postprocess(h)), h;
1503
- } catch (o) {
1504
- return l(o);
1505
- }
1506
- };
1507
- }
1508
- onError(n, e) {
1509
- return (t) => {
1510
- if (t.message += `
1511
- Please report this to https://github.com/markedjs/marked.`, n) {
1512
- const s = "<p>An error occurred:</p><pre>" + m(t.message + "", !0) + "</pre>";
1513
- return e ? Promise.resolve(s) : s;
1514
- }
1515
- if (e)
1516
- return Promise.reject(t);
1517
- throw t;
1518
- };
1519
- }
1520
- }, R = new Ve();
1521
- function g(n, e) {
1522
- return R.parse(n, e);
1523
- }
1524
- g.options = g.setOptions = function(n) {
1525
- return R.setOptions(n), g.defaults = R.defaults, ie(g.defaults), g;
1526
- };
1527
- g.getDefaults = O;
1528
- g.defaults = S;
1529
- g.use = function(...n) {
1530
- return R.use(...n), g.defaults = R.defaults, ie(g.defaults), g;
1531
- };
1532
- g.walkTokens = function(n, e) {
1533
- return R.walkTokens(n, e);
1534
- };
1535
- g.parseInline = R.parseInline;
1536
- g.Parser = y;
1537
- g.parser = y.parse;
1538
- g.Renderer = I;
1539
- g.TextRenderer = W;
1540
- g.Lexer = w;
1541
- g.lexer = w.lex;
1542
- g.Tokenizer = C;
1543
- g.Hooks = L;
1544
- g.parse = g;
1545
- g.options;
1546
- g.setOptions;
1547
- g.use;
1548
- g.walkTokens;
1549
- g.parseInline;
1550
- y.parse;
1551
- w.lex;
1
+ import { getDefaultExportFromCjs as r } from "./index70.js";
2
+ import { __require as o } from "./index67.js";
3
+ var e = /* @__PURE__ */ o();
4
+ const a = /* @__PURE__ */ r(e);
1552
5
  export {
1553
- L as Hooks,
1554
- w as Lexer,
1555
- Ve as Marked,
1556
- y as Parser,
1557
- I as Renderer,
1558
- W as TextRenderer,
1559
- C as Tokenizer,
1560
- S as defaults,
1561
- O as getDefaults,
1562
- g as marked
6
+ a as default
1563
7
  };