@work-zhanguo/light-file-preview 0.0.1

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