@gui-chat-plugin/markdown 0.0.1 → 0.0.2

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