@clevertask/scribe 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/{SlashCommandList-DYKFukY8.js → SlashCommandList-D_Ndw6pj.js} +272 -273
- package/dist/browser-D3_ToIiA.js +2110 -0
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +4 -5
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/index.js +8 -9
- package/dist/main.d.ts +1 -0
- package/dist/turndown.browser.es-CeowJDZ0.js +1168 -0
- package/dist/utils/html-to-markdown.js +4 -5
- package/dist/utils/markdown-to-html.js +3 -4
- package/package.json +2 -2
- package/dist/marked.esm-DIt7dqAB.js +0 -1574
- package/dist/purify.es-Bzg5nW_L.js +0 -524
- package/dist/turndown.browser.es-DwgPoVx0.js +0 -646
|
@@ -0,0 +1,2110 @@
|
|
|
1
|
+
var ii = Object.defineProperty;
|
|
2
|
+
var ri = (h, e, t) => e in h ? ii(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t;
|
|
3
|
+
var S = (h, e, t) => ri(h, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
var Ui = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5
|
+
function si(h) {
|
|
6
|
+
return h && h.__esModule && Object.prototype.hasOwnProperty.call(h, "default") ? h.default : h;
|
|
7
|
+
}
|
|
8
|
+
function ht() {
|
|
9
|
+
return {
|
|
10
|
+
async: !1,
|
|
11
|
+
breaks: !1,
|
|
12
|
+
extensions: null,
|
|
13
|
+
gfm: !0,
|
|
14
|
+
hooks: null,
|
|
15
|
+
pedantic: !1,
|
|
16
|
+
renderer: null,
|
|
17
|
+
silent: !1,
|
|
18
|
+
tokenizer: null,
|
|
19
|
+
walkTokens: null
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
let ie = ht();
|
|
23
|
+
function pn(h) {
|
|
24
|
+
ie = h;
|
|
25
|
+
}
|
|
26
|
+
const Ee = { exec: () => null };
|
|
27
|
+
function y(h, e = "") {
|
|
28
|
+
let t = typeof h == "string" ? h : h.source;
|
|
29
|
+
const n = {
|
|
30
|
+
replace: (o, r) => {
|
|
31
|
+
let s = typeof r == "string" ? r : r.source;
|
|
32
|
+
return s = s.replace(F.caret, "$1"), t = t.replace(o, s), n;
|
|
33
|
+
},
|
|
34
|
+
getRegex: () => new RegExp(t, e)
|
|
35
|
+
};
|
|
36
|
+
return n;
|
|
37
|
+
}
|
|
38
|
+
const F = {
|
|
39
|
+
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
40
|
+
outputLinkReplace: /\\([\[\]])/g,
|
|
41
|
+
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
42
|
+
beginningSpace: /^\s+/,
|
|
43
|
+
endingHash: /#$/,
|
|
44
|
+
startingSpaceChar: /^ /,
|
|
45
|
+
endingSpaceChar: / $/,
|
|
46
|
+
nonSpaceChar: /[^ ]/,
|
|
47
|
+
newLineCharGlobal: /\n/g,
|
|
48
|
+
tabCharGlobal: /\t/g,
|
|
49
|
+
multipleSpaceGlobal: /\s+/g,
|
|
50
|
+
blankLine: /^[ \t]*$/,
|
|
51
|
+
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
52
|
+
blockquoteStart: /^ {0,3}>/,
|
|
53
|
+
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
54
|
+
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
55
|
+
listReplaceTabs: /^\t+/,
|
|
56
|
+
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
57
|
+
listIsTask: /^\[[ xX]\] /,
|
|
58
|
+
listReplaceTask: /^\[[ xX]\] +/,
|
|
59
|
+
anyLine: /\n.*\n/,
|
|
60
|
+
hrefBrackets: /^<(.*)>$/,
|
|
61
|
+
tableDelimiter: /[:|]/,
|
|
62
|
+
tableAlignChars: /^\||\| *$/g,
|
|
63
|
+
tableRowBlankLine: /\n[ \t]*$/,
|
|
64
|
+
tableAlignRight: /^ *-+: *$/,
|
|
65
|
+
tableAlignCenter: /^ *:-+: *$/,
|
|
66
|
+
tableAlignLeft: /^ *:-+ *$/,
|
|
67
|
+
startATag: /^<a /i,
|
|
68
|
+
endATag: /^<\/a>/i,
|
|
69
|
+
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
70
|
+
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
71
|
+
startAngleBracket: /^</,
|
|
72
|
+
endAngleBracket: />$/,
|
|
73
|
+
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
74
|
+
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
75
|
+
escapeTest: /[&<>"']/,
|
|
76
|
+
escapeReplace: /[&<>"']/g,
|
|
77
|
+
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
78
|
+
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
79
|
+
unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
|
|
80
|
+
caret: /(^|[^\[])\^/g,
|
|
81
|
+
percentDecode: /%25/g,
|
|
82
|
+
findPipe: /\|/g,
|
|
83
|
+
splitPipe: / \|/,
|
|
84
|
+
slashPipe: /\\\|/g,
|
|
85
|
+
carriageReturn: /\r\n|\r/g,
|
|
86
|
+
spaceLine: /^ +$/gm,
|
|
87
|
+
notSpaceStart: /^\S*/,
|
|
88
|
+
endingNewline: /\n$/,
|
|
89
|
+
listItemRegex: (h) => new RegExp(`^( {0,3}${h})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
90
|
+
nextBulletRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
91
|
+
hrRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
92
|
+
fencesBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:\`\`\`|~~~)`),
|
|
93
|
+
headingBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}#`),
|
|
94
|
+
htmlBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
95
|
+
}, oi = /^(?:[ \t]*(?:\n|$))+/, li = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ai = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Se = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ci = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, hn = /(?:[*+-]|\d{1,9}[.)])/, fn = y(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, hn).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/).getRegex(), ft = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ui = /^[^\n]+/, gt = /(?!\s*\])(?:\\.|[^\[\]\\])+/, pi = y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", gt).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), hi = y(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, hn).getRegex(), He = "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", dt = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, fi = y("^ {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", dt).replace("tag", He).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), gn = y(ft).replace("hr", Se).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", He).getRegex(), gi = y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", gn).getRegex(), mt = {
|
|
96
|
+
blockquote: gi,
|
|
97
|
+
code: li,
|
|
98
|
+
def: pi,
|
|
99
|
+
fences: ai,
|
|
100
|
+
heading: ci,
|
|
101
|
+
hr: Se,
|
|
102
|
+
html: fi,
|
|
103
|
+
lheading: fn,
|
|
104
|
+
list: hi,
|
|
105
|
+
newline: oi,
|
|
106
|
+
paragraph: gn,
|
|
107
|
+
table: Ee,
|
|
108
|
+
text: ui
|
|
109
|
+
}, nn = y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", Se).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", He).getRegex(), di = {
|
|
110
|
+
...mt,
|
|
111
|
+
table: nn,
|
|
112
|
+
paragraph: y(ft).replace("hr", Se).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", nn).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", He).getRegex()
|
|
113
|
+
}, mi = {
|
|
114
|
+
...mt,
|
|
115
|
+
html: y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", dt).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(),
|
|
116
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
117
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
118
|
+
fences: Ee,
|
|
119
|
+
// fences not supported
|
|
120
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
121
|
+
paragraph: y(ft).replace("hr", Se).replace("heading", ` *#{1,6} *[^
|
|
122
|
+
]`).replace("lheading", fn).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
123
|
+
}, dn = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ki = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, mn = /^( {2,}|\\)\n(?!\s*$)/, bi = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Ge = /[\p{P}\p{S}]/u, kt = /[\s\p{P}\p{S}]/u, kn = /[^\s\p{P}\p{S}]/u, xi = y(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, kt).getRegex(), Ti = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, wi = y(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, "u").replace(/punct/g, Ge).getRegex(), _i = y("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, kn).replace(/punctSpace/g, kt).replace(/punct/g, Ge).getRegex(), Ai = y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, kn).replace(/punctSpace/g, kt).replace(/punct/g, Ge).getRegex(), Ei = y(/\\(punct)/, "gu").replace(/punct/g, Ge).getRegex(), yi = y(/^<(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(), Si = y(dt).replace("(?:-->|$)", "-->").getRegex(), Ri = y("^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", Si).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ue = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Li = y(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", Ue).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), bn = y(/^!?\[(label)\]\[(ref)\]/).replace("label", Ue).replace("ref", gt).getRegex(), xn = y(/^!?\[(ref)\](?:\[\])?/).replace("ref", gt).getRegex(), Ii = y("reflink|nolink(?!\\()", "g").replace("reflink", bn).replace("nolink", xn).getRegex(), bt = {
|
|
124
|
+
_backpedal: Ee,
|
|
125
|
+
// only used for GFM url
|
|
126
|
+
anyPunctuation: Ei,
|
|
127
|
+
autolink: yi,
|
|
128
|
+
blockSkip: Ti,
|
|
129
|
+
br: mn,
|
|
130
|
+
code: ki,
|
|
131
|
+
del: Ee,
|
|
132
|
+
emStrongLDelim: wi,
|
|
133
|
+
emStrongRDelimAst: _i,
|
|
134
|
+
emStrongRDelimUnd: Ai,
|
|
135
|
+
escape: dn,
|
|
136
|
+
link: Li,
|
|
137
|
+
nolink: xn,
|
|
138
|
+
punctuation: xi,
|
|
139
|
+
reflink: bn,
|
|
140
|
+
reflinkSearch: Ii,
|
|
141
|
+
tag: Ri,
|
|
142
|
+
text: bi,
|
|
143
|
+
url: Ee
|
|
144
|
+
}, Ci = {
|
|
145
|
+
...bt,
|
|
146
|
+
link: y(/^!?\[(label)\]\((.*?)\)/).replace("label", Ue).getRegex(),
|
|
147
|
+
reflink: y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ue).getRegex()
|
|
148
|
+
}, pt = {
|
|
149
|
+
...bt,
|
|
150
|
+
escape: y(dn).replace("])", "~|])").getRegex(),
|
|
151
|
+
url: y(/^((?: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(),
|
|
152
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
153
|
+
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
154
|
+
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
155
|
+
}, Oi = {
|
|
156
|
+
...pt,
|
|
157
|
+
br: y(mn).replace("{2,}", "*").getRegex(),
|
|
158
|
+
text: y(pt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
159
|
+
}, $e = {
|
|
160
|
+
normal: mt,
|
|
161
|
+
gfm: di,
|
|
162
|
+
pedantic: mi
|
|
163
|
+
}, _e = {
|
|
164
|
+
normal: bt,
|
|
165
|
+
gfm: pt,
|
|
166
|
+
breaks: Oi,
|
|
167
|
+
pedantic: Ci
|
|
168
|
+
}, Di = {
|
|
169
|
+
"&": "&",
|
|
170
|
+
"<": "<",
|
|
171
|
+
">": ">",
|
|
172
|
+
'"': """,
|
|
173
|
+
"'": "'"
|
|
174
|
+
}, rn = (h) => Di[h];
|
|
175
|
+
function X(h, e) {
|
|
176
|
+
if (e) {
|
|
177
|
+
if (F.escapeTest.test(h))
|
|
178
|
+
return h.replace(F.escapeReplace, rn);
|
|
179
|
+
} else if (F.escapeTestNoEncode.test(h))
|
|
180
|
+
return h.replace(F.escapeReplaceNoEncode, rn);
|
|
181
|
+
return h;
|
|
182
|
+
}
|
|
183
|
+
function sn(h) {
|
|
184
|
+
try {
|
|
185
|
+
h = encodeURI(h).replace(F.percentDecode, "%");
|
|
186
|
+
} catch {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
return h;
|
|
190
|
+
}
|
|
191
|
+
function on(h, e) {
|
|
192
|
+
var r;
|
|
193
|
+
const t = h.replace(F.findPipe, (s, l, u) => {
|
|
194
|
+
let a = !1, c = l;
|
|
195
|
+
for (; --c >= 0 && u[c] === "\\"; )
|
|
196
|
+
a = !a;
|
|
197
|
+
return a ? "|" : " |";
|
|
198
|
+
}), n = t.split(F.splitPipe);
|
|
199
|
+
let o = 0;
|
|
200
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !((r = n.at(-1)) != null && r.trim()) && n.pop(), e)
|
|
201
|
+
if (n.length > e)
|
|
202
|
+
n.splice(e);
|
|
203
|
+
else
|
|
204
|
+
for (; n.length < e; )
|
|
205
|
+
n.push("");
|
|
206
|
+
for (; o < n.length; o++)
|
|
207
|
+
n[o] = n[o].trim().replace(F.slashPipe, "|");
|
|
208
|
+
return n;
|
|
209
|
+
}
|
|
210
|
+
function Ae(h, e, t) {
|
|
211
|
+
const n = h.length;
|
|
212
|
+
if (n === 0)
|
|
213
|
+
return "";
|
|
214
|
+
let o = 0;
|
|
215
|
+
for (; o < n; ) {
|
|
216
|
+
const r = h.charAt(n - o - 1);
|
|
217
|
+
if (r === e && !t)
|
|
218
|
+
o++;
|
|
219
|
+
else if (r !== e && t)
|
|
220
|
+
o++;
|
|
221
|
+
else
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
return h.slice(0, n - o);
|
|
225
|
+
}
|
|
226
|
+
function Ni(h, e) {
|
|
227
|
+
if (h.indexOf(e[1]) === -1)
|
|
228
|
+
return -1;
|
|
229
|
+
let t = 0;
|
|
230
|
+
for (let n = 0; n < h.length; n++)
|
|
231
|
+
if (h[n] === "\\")
|
|
232
|
+
n++;
|
|
233
|
+
else if (h[n] === e[0])
|
|
234
|
+
t++;
|
|
235
|
+
else if (h[n] === e[1] && (t--, t < 0))
|
|
236
|
+
return n;
|
|
237
|
+
return -1;
|
|
238
|
+
}
|
|
239
|
+
function ln(h, e, t, n, o) {
|
|
240
|
+
const r = e.href, s = e.title || null, l = h[1].replace(o.other.outputLinkReplace, "$1");
|
|
241
|
+
if (h[0].charAt(0) !== "!") {
|
|
242
|
+
n.state.inLink = !0;
|
|
243
|
+
const u = {
|
|
244
|
+
type: "link",
|
|
245
|
+
raw: t,
|
|
246
|
+
href: r,
|
|
247
|
+
title: s,
|
|
248
|
+
text: l,
|
|
249
|
+
tokens: n.inlineTokens(l)
|
|
250
|
+
};
|
|
251
|
+
return n.state.inLink = !1, u;
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
type: "image",
|
|
255
|
+
raw: t,
|
|
256
|
+
href: r,
|
|
257
|
+
title: s,
|
|
258
|
+
text: l
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function Mi(h, e, t) {
|
|
262
|
+
const n = h.match(t.other.indentCodeCompensation);
|
|
263
|
+
if (n === null)
|
|
264
|
+
return e;
|
|
265
|
+
const o = n[1];
|
|
266
|
+
return e.split(`
|
|
267
|
+
`).map((r) => {
|
|
268
|
+
const s = r.match(t.other.beginningSpace);
|
|
269
|
+
if (s === null)
|
|
270
|
+
return r;
|
|
271
|
+
const [l] = s;
|
|
272
|
+
return l.length >= o.length ? r.slice(o.length) : r;
|
|
273
|
+
}).join(`
|
|
274
|
+
`);
|
|
275
|
+
}
|
|
276
|
+
class Be {
|
|
277
|
+
// set by the lexer
|
|
278
|
+
constructor(e) {
|
|
279
|
+
S(this, "options");
|
|
280
|
+
S(this, "rules");
|
|
281
|
+
// set by the lexer
|
|
282
|
+
S(this, "lexer");
|
|
283
|
+
this.options = e || ie;
|
|
284
|
+
}
|
|
285
|
+
space(e) {
|
|
286
|
+
const t = this.rules.block.newline.exec(e);
|
|
287
|
+
if (t && t[0].length > 0)
|
|
288
|
+
return {
|
|
289
|
+
type: "space",
|
|
290
|
+
raw: t[0]
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
code(e) {
|
|
294
|
+
const t = this.rules.block.code.exec(e);
|
|
295
|
+
if (t) {
|
|
296
|
+
const n = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
297
|
+
return {
|
|
298
|
+
type: "code",
|
|
299
|
+
raw: t[0],
|
|
300
|
+
codeBlockStyle: "indented",
|
|
301
|
+
text: this.options.pedantic ? n : Ae(n, `
|
|
302
|
+
`)
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
fences(e) {
|
|
307
|
+
const t = this.rules.block.fences.exec(e);
|
|
308
|
+
if (t) {
|
|
309
|
+
const n = t[0], o = Mi(n, t[3] || "", this.rules);
|
|
310
|
+
return {
|
|
311
|
+
type: "code",
|
|
312
|
+
raw: n,
|
|
313
|
+
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
314
|
+
text: o
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
heading(e) {
|
|
319
|
+
const t = this.rules.block.heading.exec(e);
|
|
320
|
+
if (t) {
|
|
321
|
+
let n = t[2].trim();
|
|
322
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
323
|
+
const o = Ae(n, "#");
|
|
324
|
+
(this.options.pedantic || !o || this.rules.other.endingSpaceChar.test(o)) && (n = o.trim());
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
type: "heading",
|
|
328
|
+
raw: t[0],
|
|
329
|
+
depth: t[1].length,
|
|
330
|
+
text: n,
|
|
331
|
+
tokens: this.lexer.inline(n)
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
hr(e) {
|
|
336
|
+
const t = this.rules.block.hr.exec(e);
|
|
337
|
+
if (t)
|
|
338
|
+
return {
|
|
339
|
+
type: "hr",
|
|
340
|
+
raw: Ae(t[0], `
|
|
341
|
+
`)
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
blockquote(e) {
|
|
345
|
+
const t = this.rules.block.blockquote.exec(e);
|
|
346
|
+
if (t) {
|
|
347
|
+
let n = Ae(t[0], `
|
|
348
|
+
`).split(`
|
|
349
|
+
`), o = "", r = "";
|
|
350
|
+
const s = [];
|
|
351
|
+
for (; n.length > 0; ) {
|
|
352
|
+
let l = !1;
|
|
353
|
+
const u = [];
|
|
354
|
+
let a;
|
|
355
|
+
for (a = 0; a < n.length; a++)
|
|
356
|
+
if (this.rules.other.blockquoteStart.test(n[a]))
|
|
357
|
+
u.push(n[a]), l = !0;
|
|
358
|
+
else if (!l)
|
|
359
|
+
u.push(n[a]);
|
|
360
|
+
else
|
|
361
|
+
break;
|
|
362
|
+
n = n.slice(a);
|
|
363
|
+
const c = u.join(`
|
|
364
|
+
`), k = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
365
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
366
|
+
o = o ? `${o}
|
|
367
|
+
${c}` : c, r = r ? `${r}
|
|
368
|
+
${k}` : k;
|
|
369
|
+
const m = this.lexer.state.top;
|
|
370
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(k, s, !0), this.lexer.state.top = m, n.length === 0)
|
|
371
|
+
break;
|
|
372
|
+
const x = s.at(-1);
|
|
373
|
+
if ((x == null ? void 0 : x.type) === "code")
|
|
374
|
+
break;
|
|
375
|
+
if ((x == null ? void 0 : x.type) === "blockquote") {
|
|
376
|
+
const R = x, A = R.raw + `
|
|
377
|
+
` + n.join(`
|
|
378
|
+
`), C = this.blockquote(A);
|
|
379
|
+
s[s.length - 1] = C, o = o.substring(0, o.length - R.raw.length) + C.raw, r = r.substring(0, r.length - R.text.length) + C.text;
|
|
380
|
+
break;
|
|
381
|
+
} else if ((x == null ? void 0 : x.type) === "list") {
|
|
382
|
+
const R = x, A = R.raw + `
|
|
383
|
+
` + n.join(`
|
|
384
|
+
`), C = this.list(A);
|
|
385
|
+
s[s.length - 1] = C, o = o.substring(0, o.length - x.raw.length) + C.raw, r = r.substring(0, r.length - R.raw.length) + C.raw, n = A.substring(s.at(-1).raw.length).split(`
|
|
386
|
+
`);
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return {
|
|
391
|
+
type: "blockquote",
|
|
392
|
+
raw: o,
|
|
393
|
+
tokens: s,
|
|
394
|
+
text: r
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
list(e) {
|
|
399
|
+
let t = this.rules.block.list.exec(e);
|
|
400
|
+
if (t) {
|
|
401
|
+
let n = t[1].trim();
|
|
402
|
+
const o = n.length > 1, r = {
|
|
403
|
+
type: "list",
|
|
404
|
+
raw: "",
|
|
405
|
+
ordered: o,
|
|
406
|
+
start: o ? +n.slice(0, -1) : "",
|
|
407
|
+
loose: !1,
|
|
408
|
+
items: []
|
|
409
|
+
};
|
|
410
|
+
n = o ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = o ? n : "[*+-]");
|
|
411
|
+
const s = this.rules.other.listItemRegex(n);
|
|
412
|
+
let l = !1;
|
|
413
|
+
for (; e; ) {
|
|
414
|
+
let a = !1, c = "", k = "";
|
|
415
|
+
if (!(t = s.exec(e)) || this.rules.block.hr.test(e))
|
|
416
|
+
break;
|
|
417
|
+
c = t[0], e = e.substring(c.length);
|
|
418
|
+
let m = t[2].split(`
|
|
419
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (pe) => " ".repeat(3 * pe.length)), x = e.split(`
|
|
420
|
+
`, 1)[0], R = !m.trim(), A = 0;
|
|
421
|
+
if (this.options.pedantic ? (A = 2, k = m.trimStart()) : R ? A = t[1].length + 1 : (A = t[2].search(this.rules.other.nonSpaceChar), A = A > 4 ? 1 : A, k = m.slice(A), A += t[1].length), R && this.rules.other.blankLine.test(x) && (c += x + `
|
|
422
|
+
`, e = e.substring(x.length + 1), a = !0), !a) {
|
|
423
|
+
const pe = this.rules.other.nextBulletRegex(A), H = this.rules.other.hrRegex(A), O = this.rules.other.fencesBeginRegex(A), J = this.rules.other.headingBeginRegex(A), $ = this.rules.other.htmlBeginRegex(A);
|
|
424
|
+
for (; e; ) {
|
|
425
|
+
const he = e.split(`
|
|
426
|
+
`, 1)[0];
|
|
427
|
+
let b;
|
|
428
|
+
if (x = he, this.options.pedantic ? (x = x.replace(this.rules.other.listReplaceNesting, " "), b = x) : b = x.replace(this.rules.other.tabCharGlobal, " "), O.test(x) || J.test(x) || $.test(x) || pe.test(x) || H.test(x))
|
|
429
|
+
break;
|
|
430
|
+
if (b.search(this.rules.other.nonSpaceChar) >= A || !x.trim())
|
|
431
|
+
k += `
|
|
432
|
+
` + b.slice(A);
|
|
433
|
+
else {
|
|
434
|
+
if (R || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || O.test(m) || J.test(m) || H.test(m))
|
|
435
|
+
break;
|
|
436
|
+
k += `
|
|
437
|
+
` + x;
|
|
438
|
+
}
|
|
439
|
+
!R && !x.trim() && (R = !0), c += he + `
|
|
440
|
+
`, e = e.substring(he.length + 1), m = b.slice(A);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
r.loose || (l ? r.loose = !0 : this.rules.other.doubleBlankLine.test(c) && (l = !0));
|
|
444
|
+
let C = null, Re;
|
|
445
|
+
this.options.gfm && (C = this.rules.other.listIsTask.exec(k), C && (Re = C[0] !== "[ ] ", k = k.replace(this.rules.other.listReplaceTask, ""))), r.items.push({
|
|
446
|
+
type: "list_item",
|
|
447
|
+
raw: c,
|
|
448
|
+
task: !!C,
|
|
449
|
+
checked: Re,
|
|
450
|
+
loose: !1,
|
|
451
|
+
text: k,
|
|
452
|
+
tokens: []
|
|
453
|
+
}), r.raw += c;
|
|
454
|
+
}
|
|
455
|
+
const u = r.items.at(-1);
|
|
456
|
+
u && (u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd()), r.raw = r.raw.trimEnd();
|
|
457
|
+
for (let a = 0; a < r.items.length; a++)
|
|
458
|
+
if (this.lexer.state.top = !1, r.items[a].tokens = this.lexer.blockTokens(r.items[a].text, []), !r.loose) {
|
|
459
|
+
const c = r.items[a].tokens.filter((m) => m.type === "space"), k = c.length > 0 && c.some((m) => this.rules.other.anyLine.test(m.raw));
|
|
460
|
+
r.loose = k;
|
|
461
|
+
}
|
|
462
|
+
if (r.loose)
|
|
463
|
+
for (let a = 0; a < r.items.length; a++)
|
|
464
|
+
r.items[a].loose = !0;
|
|
465
|
+
return r;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
html(e) {
|
|
469
|
+
const t = this.rules.block.html.exec(e);
|
|
470
|
+
if (t)
|
|
471
|
+
return {
|
|
472
|
+
type: "html",
|
|
473
|
+
block: !0,
|
|
474
|
+
raw: t[0],
|
|
475
|
+
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
476
|
+
text: t[0]
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
def(e) {
|
|
480
|
+
const t = this.rules.block.def.exec(e);
|
|
481
|
+
if (t) {
|
|
482
|
+
const n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), o = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
483
|
+
return {
|
|
484
|
+
type: "def",
|
|
485
|
+
tag: n,
|
|
486
|
+
raw: t[0],
|
|
487
|
+
href: o,
|
|
488
|
+
title: r
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
table(e) {
|
|
493
|
+
var l;
|
|
494
|
+
const t = this.rules.block.table.exec(e);
|
|
495
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2]))
|
|
496
|
+
return;
|
|
497
|
+
const n = on(t[1]), o = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = (l = t[3]) != null && l.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
498
|
+
`) : [], s = {
|
|
499
|
+
type: "table",
|
|
500
|
+
raw: t[0],
|
|
501
|
+
header: [],
|
|
502
|
+
align: [],
|
|
503
|
+
rows: []
|
|
504
|
+
};
|
|
505
|
+
if (n.length === o.length) {
|
|
506
|
+
for (const u of o)
|
|
507
|
+
this.rules.other.tableAlignRight.test(u) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(u) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(u) ? s.align.push("left") : s.align.push(null);
|
|
508
|
+
for (let u = 0; u < n.length; u++)
|
|
509
|
+
s.header.push({
|
|
510
|
+
text: n[u],
|
|
511
|
+
tokens: this.lexer.inline(n[u]),
|
|
512
|
+
header: !0,
|
|
513
|
+
align: s.align[u]
|
|
514
|
+
});
|
|
515
|
+
for (const u of r)
|
|
516
|
+
s.rows.push(on(u, s.header.length).map((a, c) => ({
|
|
517
|
+
text: a,
|
|
518
|
+
tokens: this.lexer.inline(a),
|
|
519
|
+
header: !1,
|
|
520
|
+
align: s.align[c]
|
|
521
|
+
})));
|
|
522
|
+
return s;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
lheading(e) {
|
|
526
|
+
const t = this.rules.block.lheading.exec(e);
|
|
527
|
+
if (t)
|
|
528
|
+
return {
|
|
529
|
+
type: "heading",
|
|
530
|
+
raw: t[0],
|
|
531
|
+
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
532
|
+
text: t[1],
|
|
533
|
+
tokens: this.lexer.inline(t[1])
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
paragraph(e) {
|
|
537
|
+
const t = this.rules.block.paragraph.exec(e);
|
|
538
|
+
if (t) {
|
|
539
|
+
const n = t[1].charAt(t[1].length - 1) === `
|
|
540
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
541
|
+
return {
|
|
542
|
+
type: "paragraph",
|
|
543
|
+
raw: t[0],
|
|
544
|
+
text: n,
|
|
545
|
+
tokens: this.lexer.inline(n)
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
text(e) {
|
|
550
|
+
const t = this.rules.block.text.exec(e);
|
|
551
|
+
if (t)
|
|
552
|
+
return {
|
|
553
|
+
type: "text",
|
|
554
|
+
raw: t[0],
|
|
555
|
+
text: t[0],
|
|
556
|
+
tokens: this.lexer.inline(t[0])
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
escape(e) {
|
|
560
|
+
const t = this.rules.inline.escape.exec(e);
|
|
561
|
+
if (t)
|
|
562
|
+
return {
|
|
563
|
+
type: "escape",
|
|
564
|
+
raw: t[0],
|
|
565
|
+
text: t[1]
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
tag(e) {
|
|
569
|
+
const t = this.rules.inline.tag.exec(e);
|
|
570
|
+
if (t)
|
|
571
|
+
return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
572
|
+
type: "html",
|
|
573
|
+
raw: t[0],
|
|
574
|
+
inLink: this.lexer.state.inLink,
|
|
575
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
576
|
+
block: !1,
|
|
577
|
+
text: t[0]
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
link(e) {
|
|
581
|
+
const t = this.rules.inline.link.exec(e);
|
|
582
|
+
if (t) {
|
|
583
|
+
const n = t[2].trim();
|
|
584
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
585
|
+
if (!this.rules.other.endAngleBracket.test(n))
|
|
586
|
+
return;
|
|
587
|
+
const s = Ae(n.slice(0, -1), "\\");
|
|
588
|
+
if ((n.length - s.length) % 2 === 0)
|
|
589
|
+
return;
|
|
590
|
+
} else {
|
|
591
|
+
const s = Ni(t[2], "()");
|
|
592
|
+
if (s > -1) {
|
|
593
|
+
const u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
594
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, u).trim(), t[3] = "";
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
let o = t[2], r = "";
|
|
598
|
+
if (this.options.pedantic) {
|
|
599
|
+
const s = this.rules.other.pedanticHrefTitle.exec(o);
|
|
600
|
+
s && (o = s[1], r = s[3]);
|
|
601
|
+
} else
|
|
602
|
+
r = t[3] ? t[3].slice(1, -1) : "";
|
|
603
|
+
return o = o.trim(), this.rules.other.startAngleBracket.test(o) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? o = o.slice(1) : o = o.slice(1, -1)), ln(t, {
|
|
604
|
+
href: o && o.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
605
|
+
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
606
|
+
}, t[0], this.lexer, this.rules);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
reflink(e, t) {
|
|
610
|
+
let n;
|
|
611
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
612
|
+
const o = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[o.toLowerCase()];
|
|
613
|
+
if (!r) {
|
|
614
|
+
const s = n[0].charAt(0);
|
|
615
|
+
return {
|
|
616
|
+
type: "text",
|
|
617
|
+
raw: s,
|
|
618
|
+
text: s
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
return ln(n, r, n[0], this.lexer, this.rules);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
emStrong(e, t, n = "") {
|
|
625
|
+
let o = this.rules.inline.emStrongLDelim.exec(e);
|
|
626
|
+
if (!o || o[3] && n.match(this.rules.other.unicodeAlphaNumeric))
|
|
627
|
+
return;
|
|
628
|
+
if (!(o[1] || o[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
629
|
+
const s = [...o[0]].length - 1;
|
|
630
|
+
let l, u, a = s, c = 0;
|
|
631
|
+
const k = o[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
632
|
+
for (k.lastIndex = 0, t = t.slice(-1 * e.length + s); (o = k.exec(t)) != null; ) {
|
|
633
|
+
if (l = o[1] || o[2] || o[3] || o[4] || o[5] || o[6], !l)
|
|
634
|
+
continue;
|
|
635
|
+
if (u = [...l].length, o[3] || o[4]) {
|
|
636
|
+
a += u;
|
|
637
|
+
continue;
|
|
638
|
+
} else if ((o[5] || o[6]) && s % 3 && !((s + u) % 3)) {
|
|
639
|
+
c += u;
|
|
640
|
+
continue;
|
|
641
|
+
}
|
|
642
|
+
if (a -= u, a > 0)
|
|
643
|
+
continue;
|
|
644
|
+
u = Math.min(u, u + a + c);
|
|
645
|
+
const m = [...o[0]][0].length, x = e.slice(0, s + o.index + m + u);
|
|
646
|
+
if (Math.min(s, u) % 2) {
|
|
647
|
+
const A = x.slice(1, -1);
|
|
648
|
+
return {
|
|
649
|
+
type: "em",
|
|
650
|
+
raw: x,
|
|
651
|
+
text: A,
|
|
652
|
+
tokens: this.lexer.inlineTokens(A)
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
const R = x.slice(2, -2);
|
|
656
|
+
return {
|
|
657
|
+
type: "strong",
|
|
658
|
+
raw: x,
|
|
659
|
+
text: R,
|
|
660
|
+
tokens: this.lexer.inlineTokens(R)
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
codespan(e) {
|
|
666
|
+
const t = this.rules.inline.code.exec(e);
|
|
667
|
+
if (t) {
|
|
668
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " ");
|
|
669
|
+
const o = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
670
|
+
return o && r && (n = n.substring(1, n.length - 1)), {
|
|
671
|
+
type: "codespan",
|
|
672
|
+
raw: t[0],
|
|
673
|
+
text: n
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
br(e) {
|
|
678
|
+
const t = this.rules.inline.br.exec(e);
|
|
679
|
+
if (t)
|
|
680
|
+
return {
|
|
681
|
+
type: "br",
|
|
682
|
+
raw: t[0]
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
del(e) {
|
|
686
|
+
const t = this.rules.inline.del.exec(e);
|
|
687
|
+
if (t)
|
|
688
|
+
return {
|
|
689
|
+
type: "del",
|
|
690
|
+
raw: t[0],
|
|
691
|
+
text: t[2],
|
|
692
|
+
tokens: this.lexer.inlineTokens(t[2])
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
autolink(e) {
|
|
696
|
+
const t = this.rules.inline.autolink.exec(e);
|
|
697
|
+
if (t) {
|
|
698
|
+
let n, o;
|
|
699
|
+
return t[2] === "@" ? (n = t[1], o = "mailto:" + n) : (n = t[1], o = n), {
|
|
700
|
+
type: "link",
|
|
701
|
+
raw: t[0],
|
|
702
|
+
text: n,
|
|
703
|
+
href: o,
|
|
704
|
+
tokens: [
|
|
705
|
+
{
|
|
706
|
+
type: "text",
|
|
707
|
+
raw: n,
|
|
708
|
+
text: n
|
|
709
|
+
}
|
|
710
|
+
]
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
url(e) {
|
|
715
|
+
var n;
|
|
716
|
+
let t;
|
|
717
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
718
|
+
let o, r;
|
|
719
|
+
if (t[2] === "@")
|
|
720
|
+
o = t[0], r = "mailto:" + o;
|
|
721
|
+
else {
|
|
722
|
+
let s;
|
|
723
|
+
do
|
|
724
|
+
s = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
|
|
725
|
+
while (s !== t[0]);
|
|
726
|
+
o = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
|
|
727
|
+
}
|
|
728
|
+
return {
|
|
729
|
+
type: "link",
|
|
730
|
+
raw: t[0],
|
|
731
|
+
text: o,
|
|
732
|
+
href: r,
|
|
733
|
+
tokens: [
|
|
734
|
+
{
|
|
735
|
+
type: "text",
|
|
736
|
+
raw: o,
|
|
737
|
+
text: o
|
|
738
|
+
}
|
|
739
|
+
]
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
inlineText(e) {
|
|
744
|
+
const t = this.rules.inline.text.exec(e);
|
|
745
|
+
if (t) {
|
|
746
|
+
const n = this.lexer.state.inRawBlock;
|
|
747
|
+
return {
|
|
748
|
+
type: "text",
|
|
749
|
+
raw: t[0],
|
|
750
|
+
text: t[0],
|
|
751
|
+
escaped: n
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
class q {
|
|
757
|
+
constructor(e) {
|
|
758
|
+
S(this, "tokens");
|
|
759
|
+
S(this, "options");
|
|
760
|
+
S(this, "state");
|
|
761
|
+
S(this, "tokenizer");
|
|
762
|
+
S(this, "inlineQueue");
|
|
763
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || ie, this.options.tokenizer = this.options.tokenizer || new Be(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
764
|
+
inLink: !1,
|
|
765
|
+
inRawBlock: !1,
|
|
766
|
+
top: !0
|
|
767
|
+
};
|
|
768
|
+
const t = {
|
|
769
|
+
other: F,
|
|
770
|
+
block: $e.normal,
|
|
771
|
+
inline: _e.normal
|
|
772
|
+
};
|
|
773
|
+
this.options.pedantic ? (t.block = $e.pedantic, t.inline = _e.pedantic) : this.options.gfm && (t.block = $e.gfm, this.options.breaks ? t.inline = _e.breaks : t.inline = _e.gfm), this.tokenizer.rules = t;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Expose Rules
|
|
777
|
+
*/
|
|
778
|
+
static get rules() {
|
|
779
|
+
return {
|
|
780
|
+
block: $e,
|
|
781
|
+
inline: _e
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Static Lex Method
|
|
786
|
+
*/
|
|
787
|
+
static lex(e, t) {
|
|
788
|
+
return new q(t).lex(e);
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Static Lex Inline Method
|
|
792
|
+
*/
|
|
793
|
+
static lexInline(e, t) {
|
|
794
|
+
return new q(t).inlineTokens(e);
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Preprocessing
|
|
798
|
+
*/
|
|
799
|
+
lex(e) {
|
|
800
|
+
e = e.replace(F.carriageReturn, `
|
|
801
|
+
`), this.blockTokens(e, this.tokens);
|
|
802
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
803
|
+
const n = this.inlineQueue[t];
|
|
804
|
+
this.inlineTokens(n.src, n.tokens);
|
|
805
|
+
}
|
|
806
|
+
return this.inlineQueue = [], this.tokens;
|
|
807
|
+
}
|
|
808
|
+
blockTokens(e, t = [], n = !1) {
|
|
809
|
+
var o, r, s;
|
|
810
|
+
for (this.options.pedantic && (e = e.replace(F.tabCharGlobal, " ").replace(F.spaceLine, "")); e; ) {
|
|
811
|
+
let l;
|
|
812
|
+
if ((r = (o = this.options.extensions) == null ? void 0 : o.block) != null && r.some((a) => (l = a.call({ lexer: this }, e, t)) ? (e = e.substring(l.raw.length), t.push(l), !0) : !1))
|
|
813
|
+
continue;
|
|
814
|
+
if (l = this.tokenizer.space(e)) {
|
|
815
|
+
e = e.substring(l.raw.length);
|
|
816
|
+
const a = t.at(-1);
|
|
817
|
+
l.raw.length === 1 && a !== void 0 ? a.raw += `
|
|
818
|
+
` : t.push(l);
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
if (l = this.tokenizer.code(e)) {
|
|
822
|
+
e = e.substring(l.raw.length);
|
|
823
|
+
const a = t.at(-1);
|
|
824
|
+
(a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += `
|
|
825
|
+
` + l.raw, a.text += `
|
|
826
|
+
` + l.text, this.inlineQueue.at(-1).src = a.text) : t.push(l);
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
if (l = this.tokenizer.fences(e)) {
|
|
830
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if (l = this.tokenizer.heading(e)) {
|
|
834
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
if (l = this.tokenizer.hr(e)) {
|
|
838
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
839
|
+
continue;
|
|
840
|
+
}
|
|
841
|
+
if (l = this.tokenizer.blockquote(e)) {
|
|
842
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
843
|
+
continue;
|
|
844
|
+
}
|
|
845
|
+
if (l = this.tokenizer.list(e)) {
|
|
846
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
847
|
+
continue;
|
|
848
|
+
}
|
|
849
|
+
if (l = this.tokenizer.html(e)) {
|
|
850
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
if (l = this.tokenizer.def(e)) {
|
|
854
|
+
e = e.substring(l.raw.length);
|
|
855
|
+
const a = t.at(-1);
|
|
856
|
+
(a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += `
|
|
857
|
+
` + l.raw, a.text += `
|
|
858
|
+
` + l.raw, this.inlineQueue.at(-1).src = a.text) : this.tokens.links[l.tag] || (this.tokens.links[l.tag] = {
|
|
859
|
+
href: l.href,
|
|
860
|
+
title: l.title
|
|
861
|
+
});
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
864
|
+
if (l = this.tokenizer.table(e)) {
|
|
865
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
866
|
+
continue;
|
|
867
|
+
}
|
|
868
|
+
if (l = this.tokenizer.lheading(e)) {
|
|
869
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
870
|
+
continue;
|
|
871
|
+
}
|
|
872
|
+
let u = e;
|
|
873
|
+
if ((s = this.options.extensions) != null && s.startBlock) {
|
|
874
|
+
let a = 1 / 0;
|
|
875
|
+
const c = e.slice(1);
|
|
876
|
+
let k;
|
|
877
|
+
this.options.extensions.startBlock.forEach((m) => {
|
|
878
|
+
k = m.call({ lexer: this }, c), typeof k == "number" && k >= 0 && (a = Math.min(a, k));
|
|
879
|
+
}), a < 1 / 0 && a >= 0 && (u = e.substring(0, a + 1));
|
|
880
|
+
}
|
|
881
|
+
if (this.state.top && (l = this.tokenizer.paragraph(u))) {
|
|
882
|
+
const a = t.at(-1);
|
|
883
|
+
n && (a == null ? void 0 : a.type) === "paragraph" ? (a.raw += `
|
|
884
|
+
` + l.raw, a.text += `
|
|
885
|
+
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(l), n = u.length !== e.length, e = e.substring(l.raw.length);
|
|
886
|
+
continue;
|
|
887
|
+
}
|
|
888
|
+
if (l = this.tokenizer.text(e)) {
|
|
889
|
+
e = e.substring(l.raw.length);
|
|
890
|
+
const a = t.at(-1);
|
|
891
|
+
(a == null ? void 0 : a.type) === "text" ? (a.raw += `
|
|
892
|
+
` + l.raw, a.text += `
|
|
893
|
+
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(l);
|
|
894
|
+
continue;
|
|
895
|
+
}
|
|
896
|
+
if (e) {
|
|
897
|
+
const a = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
898
|
+
if (this.options.silent) {
|
|
899
|
+
console.error(a);
|
|
900
|
+
break;
|
|
901
|
+
} else
|
|
902
|
+
throw new Error(a);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
return this.state.top = !0, t;
|
|
906
|
+
}
|
|
907
|
+
inline(e, t = []) {
|
|
908
|
+
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Lexing/Compiling
|
|
912
|
+
*/
|
|
913
|
+
inlineTokens(e, t = []) {
|
|
914
|
+
var l, u, a;
|
|
915
|
+
let n = e, o = null;
|
|
916
|
+
if (this.tokens.links) {
|
|
917
|
+
const c = Object.keys(this.tokens.links);
|
|
918
|
+
if (c.length > 0)
|
|
919
|
+
for (; (o = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; )
|
|
920
|
+
c.includes(o[0].slice(o[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
921
|
+
}
|
|
922
|
+
for (; (o = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; )
|
|
923
|
+
n = n.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
924
|
+
for (; (o = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; )
|
|
925
|
+
n = n.slice(0, o.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
926
|
+
let r = !1, s = "";
|
|
927
|
+
for (; e; ) {
|
|
928
|
+
r || (s = ""), r = !1;
|
|
929
|
+
let c;
|
|
930
|
+
if ((u = (l = this.options.extensions) == null ? void 0 : l.inline) != null && u.some((m) => (c = m.call({ lexer: this }, e, t)) ? (e = e.substring(c.raw.length), t.push(c), !0) : !1))
|
|
931
|
+
continue;
|
|
932
|
+
if (c = this.tokenizer.escape(e)) {
|
|
933
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
934
|
+
continue;
|
|
935
|
+
}
|
|
936
|
+
if (c = this.tokenizer.tag(e)) {
|
|
937
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
938
|
+
continue;
|
|
939
|
+
}
|
|
940
|
+
if (c = this.tokenizer.link(e)) {
|
|
941
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
942
|
+
continue;
|
|
943
|
+
}
|
|
944
|
+
if (c = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
945
|
+
e = e.substring(c.raw.length);
|
|
946
|
+
const m = t.at(-1);
|
|
947
|
+
c.type === "text" && (m == null ? void 0 : m.type) === "text" ? (m.raw += c.raw, m.text += c.text) : t.push(c);
|
|
948
|
+
continue;
|
|
949
|
+
}
|
|
950
|
+
if (c = this.tokenizer.emStrong(e, n, s)) {
|
|
951
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
if (c = this.tokenizer.codespan(e)) {
|
|
955
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
958
|
+
if (c = this.tokenizer.br(e)) {
|
|
959
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
if (c = this.tokenizer.del(e)) {
|
|
963
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
964
|
+
continue;
|
|
965
|
+
}
|
|
966
|
+
if (c = this.tokenizer.autolink(e)) {
|
|
967
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
970
|
+
if (!this.state.inLink && (c = this.tokenizer.url(e))) {
|
|
971
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
972
|
+
continue;
|
|
973
|
+
}
|
|
974
|
+
let k = e;
|
|
975
|
+
if ((a = this.options.extensions) != null && a.startInline) {
|
|
976
|
+
let m = 1 / 0;
|
|
977
|
+
const x = e.slice(1);
|
|
978
|
+
let R;
|
|
979
|
+
this.options.extensions.startInline.forEach((A) => {
|
|
980
|
+
R = A.call({ lexer: this }, x), typeof R == "number" && R >= 0 && (m = Math.min(m, R));
|
|
981
|
+
}), m < 1 / 0 && m >= 0 && (k = e.substring(0, m + 1));
|
|
982
|
+
}
|
|
983
|
+
if (c = this.tokenizer.inlineText(k)) {
|
|
984
|
+
e = e.substring(c.raw.length), c.raw.slice(-1) !== "_" && (s = c.raw.slice(-1)), r = !0;
|
|
985
|
+
const m = t.at(-1);
|
|
986
|
+
(m == null ? void 0 : m.type) === "text" ? (m.raw += c.raw, m.text += c.text) : t.push(c);
|
|
987
|
+
continue;
|
|
988
|
+
}
|
|
989
|
+
if (e) {
|
|
990
|
+
const m = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
991
|
+
if (this.options.silent) {
|
|
992
|
+
console.error(m);
|
|
993
|
+
break;
|
|
994
|
+
} else
|
|
995
|
+
throw new Error(m);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return t;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
class Fe {
|
|
1002
|
+
// set by the parser
|
|
1003
|
+
constructor(e) {
|
|
1004
|
+
S(this, "options");
|
|
1005
|
+
S(this, "parser");
|
|
1006
|
+
this.options = e || ie;
|
|
1007
|
+
}
|
|
1008
|
+
space(e) {
|
|
1009
|
+
return "";
|
|
1010
|
+
}
|
|
1011
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
1012
|
+
var s;
|
|
1013
|
+
const o = (s = (t || "").match(F.notSpaceStart)) == null ? void 0 : s[0], r = e.replace(F.endingNewline, "") + `
|
|
1014
|
+
`;
|
|
1015
|
+
return o ? '<pre><code class="language-' + X(o) + '">' + (n ? r : X(r, !0)) + `</code></pre>
|
|
1016
|
+
` : "<pre><code>" + (n ? r : X(r, !0)) + `</code></pre>
|
|
1017
|
+
`;
|
|
1018
|
+
}
|
|
1019
|
+
blockquote({ tokens: e }) {
|
|
1020
|
+
return `<blockquote>
|
|
1021
|
+
${this.parser.parse(e)}</blockquote>
|
|
1022
|
+
`;
|
|
1023
|
+
}
|
|
1024
|
+
html({ text: e }) {
|
|
1025
|
+
return e;
|
|
1026
|
+
}
|
|
1027
|
+
heading({ tokens: e, depth: t }) {
|
|
1028
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1029
|
+
`;
|
|
1030
|
+
}
|
|
1031
|
+
hr(e) {
|
|
1032
|
+
return `<hr>
|
|
1033
|
+
`;
|
|
1034
|
+
}
|
|
1035
|
+
list(e) {
|
|
1036
|
+
const t = e.ordered, n = e.start;
|
|
1037
|
+
let o = "";
|
|
1038
|
+
for (let l = 0; l < e.items.length; l++) {
|
|
1039
|
+
const u = e.items[l];
|
|
1040
|
+
o += this.listitem(u);
|
|
1041
|
+
}
|
|
1042
|
+
const r = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
1043
|
+
return "<" + r + s + `>
|
|
1044
|
+
` + o + "</" + r + `>
|
|
1045
|
+
`;
|
|
1046
|
+
}
|
|
1047
|
+
listitem(e) {
|
|
1048
|
+
var n;
|
|
1049
|
+
let t = "";
|
|
1050
|
+
if (e.task) {
|
|
1051
|
+
const o = this.checkbox({ checked: !!e.checked });
|
|
1052
|
+
e.loose ? ((n = e.tokens[0]) == null ? void 0 : n.type) === "paragraph" ? (e.tokens[0].text = o + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = o + " " + X(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = !0)) : e.tokens.unshift({
|
|
1053
|
+
type: "text",
|
|
1054
|
+
raw: o + " ",
|
|
1055
|
+
text: o + " ",
|
|
1056
|
+
escaped: !0
|
|
1057
|
+
}) : t += o + " ";
|
|
1058
|
+
}
|
|
1059
|
+
return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
|
|
1060
|
+
`;
|
|
1061
|
+
}
|
|
1062
|
+
checkbox({ checked: e }) {
|
|
1063
|
+
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
1064
|
+
}
|
|
1065
|
+
paragraph({ tokens: e }) {
|
|
1066
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
1067
|
+
`;
|
|
1068
|
+
}
|
|
1069
|
+
table(e) {
|
|
1070
|
+
let t = "", n = "";
|
|
1071
|
+
for (let r = 0; r < e.header.length; r++)
|
|
1072
|
+
n += this.tablecell(e.header[r]);
|
|
1073
|
+
t += this.tablerow({ text: n });
|
|
1074
|
+
let o = "";
|
|
1075
|
+
for (let r = 0; r < e.rows.length; r++) {
|
|
1076
|
+
const s = e.rows[r];
|
|
1077
|
+
n = "";
|
|
1078
|
+
for (let l = 0; l < s.length; l++)
|
|
1079
|
+
n += this.tablecell(s[l]);
|
|
1080
|
+
o += this.tablerow({ text: n });
|
|
1081
|
+
}
|
|
1082
|
+
return o && (o = `<tbody>${o}</tbody>`), `<table>
|
|
1083
|
+
<thead>
|
|
1084
|
+
` + t + `</thead>
|
|
1085
|
+
` + o + `</table>
|
|
1086
|
+
`;
|
|
1087
|
+
}
|
|
1088
|
+
tablerow({ text: e }) {
|
|
1089
|
+
return `<tr>
|
|
1090
|
+
${e}</tr>
|
|
1091
|
+
`;
|
|
1092
|
+
}
|
|
1093
|
+
tablecell(e) {
|
|
1094
|
+
const t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
1095
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
1096
|
+
`;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* span level renderer
|
|
1100
|
+
*/
|
|
1101
|
+
strong({ tokens: e }) {
|
|
1102
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
1103
|
+
}
|
|
1104
|
+
em({ tokens: e }) {
|
|
1105
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1106
|
+
}
|
|
1107
|
+
codespan({ text: e }) {
|
|
1108
|
+
return `<code>${X(e, !0)}</code>`;
|
|
1109
|
+
}
|
|
1110
|
+
br(e) {
|
|
1111
|
+
return "<br>";
|
|
1112
|
+
}
|
|
1113
|
+
del({ tokens: e }) {
|
|
1114
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1115
|
+
}
|
|
1116
|
+
link({ href: e, title: t, tokens: n }) {
|
|
1117
|
+
const o = this.parser.parseInline(n), r = sn(e);
|
|
1118
|
+
if (r === null)
|
|
1119
|
+
return o;
|
|
1120
|
+
e = r;
|
|
1121
|
+
let s = '<a href="' + e + '"';
|
|
1122
|
+
return t && (s += ' title="' + X(t) + '"'), s += ">" + o + "</a>", s;
|
|
1123
|
+
}
|
|
1124
|
+
image({ href: e, title: t, text: n }) {
|
|
1125
|
+
const o = sn(e);
|
|
1126
|
+
if (o === null)
|
|
1127
|
+
return X(n);
|
|
1128
|
+
e = o;
|
|
1129
|
+
let r = `<img src="${e}" alt="${n}"`;
|
|
1130
|
+
return t && (r += ` title="${X(t)}"`), r += ">", r;
|
|
1131
|
+
}
|
|
1132
|
+
text(e) {
|
|
1133
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : X(e.text);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
class xt {
|
|
1137
|
+
// no need for block level renderers
|
|
1138
|
+
strong({ text: e }) {
|
|
1139
|
+
return e;
|
|
1140
|
+
}
|
|
1141
|
+
em({ text: e }) {
|
|
1142
|
+
return e;
|
|
1143
|
+
}
|
|
1144
|
+
codespan({ text: e }) {
|
|
1145
|
+
return e;
|
|
1146
|
+
}
|
|
1147
|
+
del({ text: e }) {
|
|
1148
|
+
return e;
|
|
1149
|
+
}
|
|
1150
|
+
html({ text: e }) {
|
|
1151
|
+
return e;
|
|
1152
|
+
}
|
|
1153
|
+
text({ text: e }) {
|
|
1154
|
+
return e;
|
|
1155
|
+
}
|
|
1156
|
+
link({ text: e }) {
|
|
1157
|
+
return "" + e;
|
|
1158
|
+
}
|
|
1159
|
+
image({ text: e }) {
|
|
1160
|
+
return "" + e;
|
|
1161
|
+
}
|
|
1162
|
+
br() {
|
|
1163
|
+
return "";
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
class j {
|
|
1167
|
+
constructor(e) {
|
|
1168
|
+
S(this, "options");
|
|
1169
|
+
S(this, "renderer");
|
|
1170
|
+
S(this, "textRenderer");
|
|
1171
|
+
this.options = e || ie, this.options.renderer = this.options.renderer || new Fe(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new xt();
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Static Parse Method
|
|
1175
|
+
*/
|
|
1176
|
+
static parse(e, t) {
|
|
1177
|
+
return new j(t).parse(e);
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Static Parse Inline Method
|
|
1181
|
+
*/
|
|
1182
|
+
static parseInline(e, t) {
|
|
1183
|
+
return new j(t).parseInline(e);
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Parse Loop
|
|
1187
|
+
*/
|
|
1188
|
+
parse(e, t = !0) {
|
|
1189
|
+
var o, r;
|
|
1190
|
+
let n = "";
|
|
1191
|
+
for (let s = 0; s < e.length; s++) {
|
|
1192
|
+
const l = e[s];
|
|
1193
|
+
if ((r = (o = this.options.extensions) == null ? void 0 : o.renderers) != null && r[l.type]) {
|
|
1194
|
+
const a = l, c = this.options.extensions.renderers[a.type].call({ parser: this }, a);
|
|
1195
|
+
if (c !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(a.type)) {
|
|
1196
|
+
n += c || "";
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
const u = l;
|
|
1201
|
+
switch (u.type) {
|
|
1202
|
+
case "space": {
|
|
1203
|
+
n += this.renderer.space(u);
|
|
1204
|
+
continue;
|
|
1205
|
+
}
|
|
1206
|
+
case "hr": {
|
|
1207
|
+
n += this.renderer.hr(u);
|
|
1208
|
+
continue;
|
|
1209
|
+
}
|
|
1210
|
+
case "heading": {
|
|
1211
|
+
n += this.renderer.heading(u);
|
|
1212
|
+
continue;
|
|
1213
|
+
}
|
|
1214
|
+
case "code": {
|
|
1215
|
+
n += this.renderer.code(u);
|
|
1216
|
+
continue;
|
|
1217
|
+
}
|
|
1218
|
+
case "table": {
|
|
1219
|
+
n += this.renderer.table(u);
|
|
1220
|
+
continue;
|
|
1221
|
+
}
|
|
1222
|
+
case "blockquote": {
|
|
1223
|
+
n += this.renderer.blockquote(u);
|
|
1224
|
+
continue;
|
|
1225
|
+
}
|
|
1226
|
+
case "list": {
|
|
1227
|
+
n += this.renderer.list(u);
|
|
1228
|
+
continue;
|
|
1229
|
+
}
|
|
1230
|
+
case "html": {
|
|
1231
|
+
n += this.renderer.html(u);
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
case "paragraph": {
|
|
1235
|
+
n += this.renderer.paragraph(u);
|
|
1236
|
+
continue;
|
|
1237
|
+
}
|
|
1238
|
+
case "text": {
|
|
1239
|
+
let a = u, c = this.renderer.text(a);
|
|
1240
|
+
for (; s + 1 < e.length && e[s + 1].type === "text"; )
|
|
1241
|
+
a = e[++s], c += `
|
|
1242
|
+
` + this.renderer.text(a);
|
|
1243
|
+
t ? n += this.renderer.paragraph({
|
|
1244
|
+
type: "paragraph",
|
|
1245
|
+
raw: c,
|
|
1246
|
+
text: c,
|
|
1247
|
+
tokens: [{ type: "text", raw: c, text: c, escaped: !0 }]
|
|
1248
|
+
}) : n += c;
|
|
1249
|
+
continue;
|
|
1250
|
+
}
|
|
1251
|
+
default: {
|
|
1252
|
+
const a = 'Token with "' + u.type + '" type was not found.';
|
|
1253
|
+
if (this.options.silent)
|
|
1254
|
+
return console.error(a), "";
|
|
1255
|
+
throw new Error(a);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
return n;
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Parse Inline Tokens
|
|
1263
|
+
*/
|
|
1264
|
+
parseInline(e, t = this.renderer) {
|
|
1265
|
+
var o, r;
|
|
1266
|
+
let n = "";
|
|
1267
|
+
for (let s = 0; s < e.length; s++) {
|
|
1268
|
+
const l = e[s];
|
|
1269
|
+
if ((r = (o = this.options.extensions) == null ? void 0 : o.renderers) != null && r[l.type]) {
|
|
1270
|
+
const a = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
1271
|
+
if (a !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
|
|
1272
|
+
n += a || "";
|
|
1273
|
+
continue;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
const u = l;
|
|
1277
|
+
switch (u.type) {
|
|
1278
|
+
case "escape": {
|
|
1279
|
+
n += t.text(u);
|
|
1280
|
+
break;
|
|
1281
|
+
}
|
|
1282
|
+
case "html": {
|
|
1283
|
+
n += t.html(u);
|
|
1284
|
+
break;
|
|
1285
|
+
}
|
|
1286
|
+
case "link": {
|
|
1287
|
+
n += t.link(u);
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1290
|
+
case "image": {
|
|
1291
|
+
n += t.image(u);
|
|
1292
|
+
break;
|
|
1293
|
+
}
|
|
1294
|
+
case "strong": {
|
|
1295
|
+
n += t.strong(u);
|
|
1296
|
+
break;
|
|
1297
|
+
}
|
|
1298
|
+
case "em": {
|
|
1299
|
+
n += t.em(u);
|
|
1300
|
+
break;
|
|
1301
|
+
}
|
|
1302
|
+
case "codespan": {
|
|
1303
|
+
n += t.codespan(u);
|
|
1304
|
+
break;
|
|
1305
|
+
}
|
|
1306
|
+
case "br": {
|
|
1307
|
+
n += t.br(u);
|
|
1308
|
+
break;
|
|
1309
|
+
}
|
|
1310
|
+
case "del": {
|
|
1311
|
+
n += t.del(u);
|
|
1312
|
+
break;
|
|
1313
|
+
}
|
|
1314
|
+
case "text": {
|
|
1315
|
+
n += t.text(u);
|
|
1316
|
+
break;
|
|
1317
|
+
}
|
|
1318
|
+
default: {
|
|
1319
|
+
const a = 'Token with "' + u.type + '" type was not found.';
|
|
1320
|
+
if (this.options.silent)
|
|
1321
|
+
return console.error(a), "";
|
|
1322
|
+
throw new Error(a);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
return n;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
class ye {
|
|
1330
|
+
constructor(e) {
|
|
1331
|
+
S(this, "options");
|
|
1332
|
+
S(this, "block");
|
|
1333
|
+
this.options = e || ie;
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* Process markdown before marked
|
|
1337
|
+
*/
|
|
1338
|
+
preprocess(e) {
|
|
1339
|
+
return e;
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Process HTML after marked is finished
|
|
1343
|
+
*/
|
|
1344
|
+
postprocess(e) {
|
|
1345
|
+
return e;
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Process all tokens before walk tokens
|
|
1349
|
+
*/
|
|
1350
|
+
processAllTokens(e) {
|
|
1351
|
+
return e;
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Provide function to tokenize markdown
|
|
1355
|
+
*/
|
|
1356
|
+
provideLexer() {
|
|
1357
|
+
return this.block ? q.lex : q.lexInline;
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Provide function to parse tokens
|
|
1361
|
+
*/
|
|
1362
|
+
provideParser() {
|
|
1363
|
+
return this.block ? j.parse : j.parseInline;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
S(ye, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
1367
|
+
"preprocess",
|
|
1368
|
+
"postprocess",
|
|
1369
|
+
"processAllTokens"
|
|
1370
|
+
]));
|
|
1371
|
+
class Pi {
|
|
1372
|
+
constructor(...e) {
|
|
1373
|
+
S(this, "defaults", ht());
|
|
1374
|
+
S(this, "options", this.setOptions);
|
|
1375
|
+
S(this, "parse", this.parseMarkdown(!0));
|
|
1376
|
+
S(this, "parseInline", this.parseMarkdown(!1));
|
|
1377
|
+
S(this, "Parser", j);
|
|
1378
|
+
S(this, "Renderer", Fe);
|
|
1379
|
+
S(this, "TextRenderer", xt);
|
|
1380
|
+
S(this, "Lexer", q);
|
|
1381
|
+
S(this, "Tokenizer", Be);
|
|
1382
|
+
S(this, "Hooks", ye);
|
|
1383
|
+
this.use(...e);
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Run callback for every token
|
|
1387
|
+
*/
|
|
1388
|
+
walkTokens(e, t) {
|
|
1389
|
+
var o, r;
|
|
1390
|
+
let n = [];
|
|
1391
|
+
for (const s of e)
|
|
1392
|
+
switch (n = n.concat(t.call(this, s)), s.type) {
|
|
1393
|
+
case "table": {
|
|
1394
|
+
const l = s;
|
|
1395
|
+
for (const u of l.header)
|
|
1396
|
+
n = n.concat(this.walkTokens(u.tokens, t));
|
|
1397
|
+
for (const u of l.rows)
|
|
1398
|
+
for (const a of u)
|
|
1399
|
+
n = n.concat(this.walkTokens(a.tokens, t));
|
|
1400
|
+
break;
|
|
1401
|
+
}
|
|
1402
|
+
case "list": {
|
|
1403
|
+
const l = s;
|
|
1404
|
+
n = n.concat(this.walkTokens(l.items, t));
|
|
1405
|
+
break;
|
|
1406
|
+
}
|
|
1407
|
+
default: {
|
|
1408
|
+
const l = s;
|
|
1409
|
+
(r = (o = this.defaults.extensions) == null ? void 0 : o.childTokens) != null && r[l.type] ? this.defaults.extensions.childTokens[l.type].forEach((u) => {
|
|
1410
|
+
const a = l[u].flat(1 / 0);
|
|
1411
|
+
n = n.concat(this.walkTokens(a, t));
|
|
1412
|
+
}) : l.tokens && (n = n.concat(this.walkTokens(l.tokens, t)));
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
return n;
|
|
1416
|
+
}
|
|
1417
|
+
use(...e) {
|
|
1418
|
+
const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1419
|
+
return e.forEach((n) => {
|
|
1420
|
+
const o = { ...n };
|
|
1421
|
+
if (o.async = this.defaults.async || o.async || !1, n.extensions && (n.extensions.forEach((r) => {
|
|
1422
|
+
if (!r.name)
|
|
1423
|
+
throw new Error("extension name required");
|
|
1424
|
+
if ("renderer" in r) {
|
|
1425
|
+
const s = t.renderers[r.name];
|
|
1426
|
+
s ? t.renderers[r.name] = function(...l) {
|
|
1427
|
+
let u = r.renderer.apply(this, l);
|
|
1428
|
+
return u === !1 && (u = s.apply(this, l)), u;
|
|
1429
|
+
} : t.renderers[r.name] = r.renderer;
|
|
1430
|
+
}
|
|
1431
|
+
if ("tokenizer" in r) {
|
|
1432
|
+
if (!r.level || r.level !== "block" && r.level !== "inline")
|
|
1433
|
+
throw new Error("extension level must be 'block' or 'inline'");
|
|
1434
|
+
const s = t[r.level];
|
|
1435
|
+
s ? s.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
|
|
1436
|
+
}
|
|
1437
|
+
"childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
|
|
1438
|
+
}), o.extensions = t), n.renderer) {
|
|
1439
|
+
const r = this.defaults.renderer || new Fe(this.defaults);
|
|
1440
|
+
for (const s in n.renderer) {
|
|
1441
|
+
if (!(s in r))
|
|
1442
|
+
throw new Error(`renderer '${s}' does not exist`);
|
|
1443
|
+
if (["options", "parser"].includes(s))
|
|
1444
|
+
continue;
|
|
1445
|
+
const l = s, u = n.renderer[l], a = r[l];
|
|
1446
|
+
r[l] = (...c) => {
|
|
1447
|
+
let k = u.apply(r, c);
|
|
1448
|
+
return k === !1 && (k = a.apply(r, c)), k || "";
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
o.renderer = r;
|
|
1452
|
+
}
|
|
1453
|
+
if (n.tokenizer) {
|
|
1454
|
+
const r = this.defaults.tokenizer || new Be(this.defaults);
|
|
1455
|
+
for (const s in n.tokenizer) {
|
|
1456
|
+
if (!(s in r))
|
|
1457
|
+
throw new Error(`tokenizer '${s}' does not exist`);
|
|
1458
|
+
if (["options", "rules", "lexer"].includes(s))
|
|
1459
|
+
continue;
|
|
1460
|
+
const l = s, u = n.tokenizer[l], a = r[l];
|
|
1461
|
+
r[l] = (...c) => {
|
|
1462
|
+
let k = u.apply(r, c);
|
|
1463
|
+
return k === !1 && (k = a.apply(r, c)), k;
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
o.tokenizer = r;
|
|
1467
|
+
}
|
|
1468
|
+
if (n.hooks) {
|
|
1469
|
+
const r = this.defaults.hooks || new ye();
|
|
1470
|
+
for (const s in n.hooks) {
|
|
1471
|
+
if (!(s in r))
|
|
1472
|
+
throw new Error(`hook '${s}' does not exist`);
|
|
1473
|
+
if (["options", "block"].includes(s))
|
|
1474
|
+
continue;
|
|
1475
|
+
const l = s, u = n.hooks[l], a = r[l];
|
|
1476
|
+
ye.passThroughHooks.has(s) ? r[l] = (c) => {
|
|
1477
|
+
if (this.defaults.async)
|
|
1478
|
+
return Promise.resolve(u.call(r, c)).then((m) => a.call(r, m));
|
|
1479
|
+
const k = u.call(r, c);
|
|
1480
|
+
return a.call(r, k);
|
|
1481
|
+
} : r[l] = (...c) => {
|
|
1482
|
+
let k = u.apply(r, c);
|
|
1483
|
+
return k === !1 && (k = a.apply(r, c)), k;
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
o.hooks = r;
|
|
1487
|
+
}
|
|
1488
|
+
if (n.walkTokens) {
|
|
1489
|
+
const r = this.defaults.walkTokens, s = n.walkTokens;
|
|
1490
|
+
o.walkTokens = function(l) {
|
|
1491
|
+
let u = [];
|
|
1492
|
+
return u.push(s.call(this, l)), r && (u = u.concat(r.call(this, l))), u;
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
this.defaults = { ...this.defaults, ...o };
|
|
1496
|
+
}), this;
|
|
1497
|
+
}
|
|
1498
|
+
setOptions(e) {
|
|
1499
|
+
return this.defaults = { ...this.defaults, ...e }, this;
|
|
1500
|
+
}
|
|
1501
|
+
lexer(e, t) {
|
|
1502
|
+
return q.lex(e, t ?? this.defaults);
|
|
1503
|
+
}
|
|
1504
|
+
parser(e, t) {
|
|
1505
|
+
return j.parse(e, t ?? this.defaults);
|
|
1506
|
+
}
|
|
1507
|
+
parseMarkdown(e) {
|
|
1508
|
+
return (n, o) => {
|
|
1509
|
+
const r = { ...o }, s = { ...this.defaults, ...r }, l = this.onError(!!s.silent, !!s.async);
|
|
1510
|
+
if (this.defaults.async === !0 && r.async === !1)
|
|
1511
|
+
return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1512
|
+
if (typeof n > "u" || n === null)
|
|
1513
|
+
return l(new Error("marked(): input parameter is undefined or null"));
|
|
1514
|
+
if (typeof n != "string")
|
|
1515
|
+
return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1516
|
+
s.hooks && (s.hooks.options = s, s.hooks.block = e);
|
|
1517
|
+
const u = s.hooks ? s.hooks.provideLexer() : e ? q.lex : q.lexInline, a = s.hooks ? s.hooks.provideParser() : e ? j.parse : j.parseInline;
|
|
1518
|
+
if (s.async)
|
|
1519
|
+
return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((c) => u(c, s)).then((c) => s.hooks ? s.hooks.processAllTokens(c) : c).then((c) => s.walkTokens ? Promise.all(this.walkTokens(c, s.walkTokens)).then(() => c) : c).then((c) => a(c, s)).then((c) => s.hooks ? s.hooks.postprocess(c) : c).catch(l);
|
|
1520
|
+
try {
|
|
1521
|
+
s.hooks && (n = s.hooks.preprocess(n));
|
|
1522
|
+
let c = u(n, s);
|
|
1523
|
+
s.hooks && (c = s.hooks.processAllTokens(c)), s.walkTokens && this.walkTokens(c, s.walkTokens);
|
|
1524
|
+
let k = a(c, s);
|
|
1525
|
+
return s.hooks && (k = s.hooks.postprocess(k)), k;
|
|
1526
|
+
} catch (c) {
|
|
1527
|
+
return l(c);
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
onError(e, t) {
|
|
1532
|
+
return (n) => {
|
|
1533
|
+
if (n.message += `
|
|
1534
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1535
|
+
const o = "<p>An error occurred:</p><pre>" + X(n.message + "", !0) + "</pre>";
|
|
1536
|
+
return t ? Promise.resolve(o) : o;
|
|
1537
|
+
}
|
|
1538
|
+
if (t)
|
|
1539
|
+
return Promise.reject(n);
|
|
1540
|
+
throw n;
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
const ne = new Pi();
|
|
1545
|
+
function E(h, e) {
|
|
1546
|
+
return ne.parse(h, e);
|
|
1547
|
+
}
|
|
1548
|
+
E.options = E.setOptions = function(h) {
|
|
1549
|
+
return ne.setOptions(h), E.defaults = ne.defaults, pn(E.defaults), E;
|
|
1550
|
+
};
|
|
1551
|
+
E.getDefaults = ht;
|
|
1552
|
+
E.defaults = ie;
|
|
1553
|
+
E.use = function(...h) {
|
|
1554
|
+
return ne.use(...h), E.defaults = ne.defaults, pn(E.defaults), E;
|
|
1555
|
+
};
|
|
1556
|
+
E.walkTokens = function(h, e) {
|
|
1557
|
+
return ne.walkTokens(h, e);
|
|
1558
|
+
};
|
|
1559
|
+
E.parseInline = ne.parseInline;
|
|
1560
|
+
E.Parser = j;
|
|
1561
|
+
E.parser = j.parse;
|
|
1562
|
+
E.Renderer = Fe;
|
|
1563
|
+
E.TextRenderer = xt;
|
|
1564
|
+
E.Lexer = q;
|
|
1565
|
+
E.lexer = q.lex;
|
|
1566
|
+
E.Tokenizer = Be;
|
|
1567
|
+
E.Hooks = ye;
|
|
1568
|
+
E.parse = E;
|
|
1569
|
+
E.options;
|
|
1570
|
+
E.setOptions;
|
|
1571
|
+
E.use;
|
|
1572
|
+
E.walkTokens;
|
|
1573
|
+
E.parseInline;
|
|
1574
|
+
j.parse;
|
|
1575
|
+
q.lex;
|
|
1576
|
+
/*! @license DOMPurify 3.2.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.2/LICENSE */
|
|
1577
|
+
var ct, an;
|
|
1578
|
+
function cn() {
|
|
1579
|
+
if (an) return ct;
|
|
1580
|
+
an = 1;
|
|
1581
|
+
const {
|
|
1582
|
+
entries: h,
|
|
1583
|
+
setPrototypeOf: e,
|
|
1584
|
+
isFrozen: t,
|
|
1585
|
+
getPrototypeOf: n,
|
|
1586
|
+
getOwnPropertyDescriptor: o
|
|
1587
|
+
} = Object;
|
|
1588
|
+
let {
|
|
1589
|
+
freeze: r,
|
|
1590
|
+
seal: s,
|
|
1591
|
+
create: l
|
|
1592
|
+
} = Object, {
|
|
1593
|
+
apply: u,
|
|
1594
|
+
construct: a
|
|
1595
|
+
} = typeof Reflect < "u" && Reflect;
|
|
1596
|
+
r || (r = function(g) {
|
|
1597
|
+
return g;
|
|
1598
|
+
}), s || (s = function(g) {
|
|
1599
|
+
return g;
|
|
1600
|
+
}), u || (u = function(g, _, w) {
|
|
1601
|
+
return g.apply(_, w);
|
|
1602
|
+
}), a || (a = function(g, _) {
|
|
1603
|
+
return new g(..._);
|
|
1604
|
+
});
|
|
1605
|
+
const c = $(Array.prototype.forEach), k = $(Array.prototype.pop), m = $(Array.prototype.push), x = $(String.prototype.toLowerCase), R = $(String.prototype.toString), A = $(String.prototype.match), C = $(String.prototype.replace), Re = $(String.prototype.indexOf), pe = $(String.prototype.trim), H = $(Object.prototype.hasOwnProperty), O = $(RegExp.prototype.test), J = he(TypeError);
|
|
1606
|
+
function $(T) {
|
|
1607
|
+
return function(g) {
|
|
1608
|
+
for (var _ = arguments.length, w = new Array(_ > 1 ? _ - 1 : 0), z = 1; z < _; z++)
|
|
1609
|
+
w[z - 1] = arguments[z];
|
|
1610
|
+
return u(T, g, w);
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
function he(T) {
|
|
1614
|
+
return function() {
|
|
1615
|
+
for (var g = arguments.length, _ = new Array(g), w = 0; w < g; w++)
|
|
1616
|
+
_[w] = arguments[w];
|
|
1617
|
+
return a(T, _);
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
function b(T, g) {
|
|
1621
|
+
let _ = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : x;
|
|
1622
|
+
e && e(T, null);
|
|
1623
|
+
let w = g.length;
|
|
1624
|
+
for (; w--; ) {
|
|
1625
|
+
let z = g[w];
|
|
1626
|
+
if (typeof z == "string") {
|
|
1627
|
+
const Q = _(z);
|
|
1628
|
+
Q !== z && (t(g) || (g[w] = Q), z = Q);
|
|
1629
|
+
}
|
|
1630
|
+
T[z] = !0;
|
|
1631
|
+
}
|
|
1632
|
+
return T;
|
|
1633
|
+
}
|
|
1634
|
+
function Tn(T) {
|
|
1635
|
+
for (let g = 0; g < T.length; g++)
|
|
1636
|
+
H(T, g) || (T[g] = null);
|
|
1637
|
+
return T;
|
|
1638
|
+
}
|
|
1639
|
+
function ee(T) {
|
|
1640
|
+
const g = l(null);
|
|
1641
|
+
for (const [_, w] of h(T))
|
|
1642
|
+
H(T, _) && (Array.isArray(w) ? g[_] = Tn(w) : w && typeof w == "object" && w.constructor === Object ? g[_] = ee(w) : g[_] = w);
|
|
1643
|
+
return g;
|
|
1644
|
+
}
|
|
1645
|
+
function fe(T, g) {
|
|
1646
|
+
for (; T !== null; ) {
|
|
1647
|
+
const w = o(T, g);
|
|
1648
|
+
if (w) {
|
|
1649
|
+
if (w.get)
|
|
1650
|
+
return $(w.get);
|
|
1651
|
+
if (typeof w.value == "function")
|
|
1652
|
+
return $(w.value);
|
|
1653
|
+
}
|
|
1654
|
+
T = n(T);
|
|
1655
|
+
}
|
|
1656
|
+
function _() {
|
|
1657
|
+
return null;
|
|
1658
|
+
}
|
|
1659
|
+
return _;
|
|
1660
|
+
}
|
|
1661
|
+
const Tt = r(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), We = r(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), qe = r(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), wn = r(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), je = r(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), _n = r(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), wt = r(["#text"]), _t = r(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Ze = r(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), At = r(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Le = r(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), An = s(/\{\{[\w\W]*|[\w\W]*\}\}/gm), En = s(/<%[\w\W]*|[\w\W]*%>/gm), yn = s(/\${[\w\W]*}/gm), Sn = s(/^data-[\-\w.\u00B7-\uFFFF]/), Rn = s(/^aria-[\-\w]+$/), Et = s(
|
|
1662
|
+
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
1663
|
+
// eslint-disable-line no-useless-escape
|
|
1664
|
+
), Ln = s(/^(?:\w+script|data):/i), In = s(
|
|
1665
|
+
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
1666
|
+
// eslint-disable-line no-control-regex
|
|
1667
|
+
), yt = s(/^html$/i), Cn = s(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
1668
|
+
var St = /* @__PURE__ */ Object.freeze({
|
|
1669
|
+
__proto__: null,
|
|
1670
|
+
ARIA_ATTR: Rn,
|
|
1671
|
+
ATTR_WHITESPACE: In,
|
|
1672
|
+
CUSTOM_ELEMENT: Cn,
|
|
1673
|
+
DATA_ATTR: Sn,
|
|
1674
|
+
DOCTYPE_NAME: yt,
|
|
1675
|
+
ERB_EXPR: En,
|
|
1676
|
+
IS_ALLOWED_URI: Et,
|
|
1677
|
+
IS_SCRIPT_OR_DATA: Ln,
|
|
1678
|
+
MUSTACHE_EXPR: An,
|
|
1679
|
+
TMPLIT_EXPR: yn
|
|
1680
|
+
});
|
|
1681
|
+
const ge = {
|
|
1682
|
+
element: 1,
|
|
1683
|
+
attribute: 2,
|
|
1684
|
+
text: 3,
|
|
1685
|
+
cdataSection: 4,
|
|
1686
|
+
entityReference: 5,
|
|
1687
|
+
// Deprecated
|
|
1688
|
+
entityNode: 6,
|
|
1689
|
+
// Deprecated
|
|
1690
|
+
progressingInstruction: 7,
|
|
1691
|
+
comment: 8,
|
|
1692
|
+
document: 9,
|
|
1693
|
+
documentType: 10,
|
|
1694
|
+
documentFragment: 11,
|
|
1695
|
+
notation: 12
|
|
1696
|
+
// Deprecated
|
|
1697
|
+
}, On = function() {
|
|
1698
|
+
return typeof window > "u" ? null : window;
|
|
1699
|
+
}, Dn = function(g, _) {
|
|
1700
|
+
if (typeof g != "object" || typeof g.createPolicy != "function")
|
|
1701
|
+
return null;
|
|
1702
|
+
let w = null;
|
|
1703
|
+
const z = "data-tt-policy-suffix";
|
|
1704
|
+
_ && _.hasAttribute(z) && (w = _.getAttribute(z));
|
|
1705
|
+
const Q = "dompurify" + (w ? "#" + w : "");
|
|
1706
|
+
try {
|
|
1707
|
+
return g.createPolicy(Q, {
|
|
1708
|
+
createHTML(re) {
|
|
1709
|
+
return re;
|
|
1710
|
+
},
|
|
1711
|
+
createScriptURL(re) {
|
|
1712
|
+
return re;
|
|
1713
|
+
}
|
|
1714
|
+
});
|
|
1715
|
+
} catch {
|
|
1716
|
+
return console.warn("TrustedTypes policy " + Q + " could not be created."), null;
|
|
1717
|
+
}
|
|
1718
|
+
}, Rt = function() {
|
|
1719
|
+
return {
|
|
1720
|
+
afterSanitizeAttributes: [],
|
|
1721
|
+
afterSanitizeElements: [],
|
|
1722
|
+
afterSanitizeShadowDOM: [],
|
|
1723
|
+
beforeSanitizeAttributes: [],
|
|
1724
|
+
beforeSanitizeElements: [],
|
|
1725
|
+
beforeSanitizeShadowDOM: [],
|
|
1726
|
+
uponSanitizeAttribute: [],
|
|
1727
|
+
uponSanitizeElement: [],
|
|
1728
|
+
uponSanitizeShadowNode: []
|
|
1729
|
+
};
|
|
1730
|
+
};
|
|
1731
|
+
function Lt() {
|
|
1732
|
+
let T = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : On();
|
|
1733
|
+
const g = (d) => Lt(d);
|
|
1734
|
+
if (g.version = "3.2.2", g.removed = [], !T || !T.document || T.document.nodeType !== ge.document)
|
|
1735
|
+
return g.isSupported = !1, g;
|
|
1736
|
+
let {
|
|
1737
|
+
document: _
|
|
1738
|
+
} = T;
|
|
1739
|
+
const w = _, z = w.currentScript, {
|
|
1740
|
+
DocumentFragment: Q,
|
|
1741
|
+
HTMLTemplateElement: re,
|
|
1742
|
+
Node: Ye,
|
|
1743
|
+
Element: It,
|
|
1744
|
+
NodeFilter: de,
|
|
1745
|
+
NamedNodeMap: Mn = T.NamedNodeMap || T.MozNamedAttrMap,
|
|
1746
|
+
HTMLFormElement: Pn,
|
|
1747
|
+
DOMParser: zn,
|
|
1748
|
+
trustedTypes: Ie
|
|
1749
|
+
} = T, me = It.prototype, vn = fe(me, "cloneNode"), $n = fe(me, "remove"), Un = fe(me, "nextSibling"), Bn = fe(me, "childNodes"), Ce = fe(me, "parentNode");
|
|
1750
|
+
if (typeof re == "function") {
|
|
1751
|
+
const d = _.createElement("template");
|
|
1752
|
+
d.content && d.content.ownerDocument && (_ = d.content.ownerDocument);
|
|
1753
|
+
}
|
|
1754
|
+
let U, ke = "";
|
|
1755
|
+
const {
|
|
1756
|
+
implementation: Xe,
|
|
1757
|
+
createNodeIterator: Fn,
|
|
1758
|
+
createDocumentFragment: Hn,
|
|
1759
|
+
getElementsByTagName: Gn
|
|
1760
|
+
} = _, {
|
|
1761
|
+
importNode: Wn
|
|
1762
|
+
} = w;
|
|
1763
|
+
let W = Rt();
|
|
1764
|
+
g.isSupported = typeof h == "function" && typeof Ce == "function" && Xe && Xe.createHTMLDocument !== void 0;
|
|
1765
|
+
const {
|
|
1766
|
+
MUSTACHE_EXPR: Qe,
|
|
1767
|
+
ERB_EXPR: Ve,
|
|
1768
|
+
TMPLIT_EXPR: Ke,
|
|
1769
|
+
DATA_ATTR: qn,
|
|
1770
|
+
ARIA_ATTR: jn,
|
|
1771
|
+
IS_SCRIPT_OR_DATA: Zn,
|
|
1772
|
+
ATTR_WHITESPACE: Ct,
|
|
1773
|
+
CUSTOM_ELEMENT: Yn
|
|
1774
|
+
} = St;
|
|
1775
|
+
let {
|
|
1776
|
+
IS_ALLOWED_URI: Ot
|
|
1777
|
+
} = St, D = null;
|
|
1778
|
+
const Dt = b({}, [...Tt, ...We, ...qe, ...je, ...wt]);
|
|
1779
|
+
let M = null;
|
|
1780
|
+
const Nt = b({}, [..._t, ...Ze, ...At, ...Le]);
|
|
1781
|
+
let I = Object.seal(l(null, {
|
|
1782
|
+
tagNameCheck: {
|
|
1783
|
+
writable: !0,
|
|
1784
|
+
configurable: !1,
|
|
1785
|
+
enumerable: !0,
|
|
1786
|
+
value: null
|
|
1787
|
+
},
|
|
1788
|
+
attributeNameCheck: {
|
|
1789
|
+
writable: !0,
|
|
1790
|
+
configurable: !1,
|
|
1791
|
+
enumerable: !0,
|
|
1792
|
+
value: null
|
|
1793
|
+
},
|
|
1794
|
+
allowCustomizedBuiltInElements: {
|
|
1795
|
+
writable: !0,
|
|
1796
|
+
configurable: !1,
|
|
1797
|
+
enumerable: !0,
|
|
1798
|
+
value: !1
|
|
1799
|
+
}
|
|
1800
|
+
})), be = null, Je = null, Mt = !0, et = !0, Pt = !1, zt = !0, se = !1, tt = !0, te = !1, nt = !1, it = !1, oe = !1, Oe = !1, De = !1, vt = !0, $t = !1;
|
|
1801
|
+
const Xn = "user-content-";
|
|
1802
|
+
let rt = !0, xe = !1, le = {}, ae = null;
|
|
1803
|
+
const Ut = b({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
1804
|
+
let Bt = null;
|
|
1805
|
+
const Ft = b({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
1806
|
+
let st = null;
|
|
1807
|
+
const Ht = b({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Ne = "http://www.w3.org/1998/Math/MathML", Me = "http://www.w3.org/2000/svg", V = "http://www.w3.org/1999/xhtml";
|
|
1808
|
+
let ce = V, ot = !1, lt = null;
|
|
1809
|
+
const Qn = b({}, [Ne, Me, V], R);
|
|
1810
|
+
let Pe = b({}, ["mi", "mo", "mn", "ms", "mtext"]), ze = b({}, ["annotation-xml"]);
|
|
1811
|
+
const Vn = b({}, ["title", "style", "font", "a", "script"]);
|
|
1812
|
+
let Te = null;
|
|
1813
|
+
const Kn = ["application/xhtml+xml", "text/html"], Jn = "text/html";
|
|
1814
|
+
let N = null, ue = null;
|
|
1815
|
+
const ei = _.createElement("form"), Gt = function(i) {
|
|
1816
|
+
return i instanceof RegExp || i instanceof Function;
|
|
1817
|
+
}, at = function() {
|
|
1818
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1819
|
+
if (!(ue && ue === i)) {
|
|
1820
|
+
if ((!i || typeof i != "object") && (i = {}), i = ee(i), Te = // eslint-disable-next-line unicorn/prefer-includes
|
|
1821
|
+
Kn.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? Jn : i.PARSER_MEDIA_TYPE, N = Te === "application/xhtml+xml" ? R : x, D = H(i, "ALLOWED_TAGS") ? b({}, i.ALLOWED_TAGS, N) : Dt, M = H(i, "ALLOWED_ATTR") ? b({}, i.ALLOWED_ATTR, N) : Nt, lt = H(i, "ALLOWED_NAMESPACES") ? b({}, i.ALLOWED_NAMESPACES, R) : Qn, st = H(i, "ADD_URI_SAFE_ATTR") ? b(ee(Ht), i.ADD_URI_SAFE_ATTR, N) : Ht, Bt = H(i, "ADD_DATA_URI_TAGS") ? b(ee(Ft), i.ADD_DATA_URI_TAGS, N) : Ft, ae = H(i, "FORBID_CONTENTS") ? b({}, i.FORBID_CONTENTS, N) : Ut, be = H(i, "FORBID_TAGS") ? b({}, i.FORBID_TAGS, N) : {}, Je = H(i, "FORBID_ATTR") ? b({}, i.FORBID_ATTR, N) : {}, le = H(i, "USE_PROFILES") ? i.USE_PROFILES : !1, Mt = i.ALLOW_ARIA_ATTR !== !1, et = i.ALLOW_DATA_ATTR !== !1, Pt = i.ALLOW_UNKNOWN_PROTOCOLS || !1, zt = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, se = i.SAFE_FOR_TEMPLATES || !1, tt = i.SAFE_FOR_XML !== !1, te = i.WHOLE_DOCUMENT || !1, oe = i.RETURN_DOM || !1, Oe = i.RETURN_DOM_FRAGMENT || !1, De = i.RETURN_TRUSTED_TYPE || !1, it = i.FORCE_BODY || !1, vt = i.SANITIZE_DOM !== !1, $t = i.SANITIZE_NAMED_PROPS || !1, rt = i.KEEP_CONTENT !== !1, xe = i.IN_PLACE || !1, Ot = i.ALLOWED_URI_REGEXP || Et, ce = i.NAMESPACE || V, Pe = i.MATHML_TEXT_INTEGRATION_POINTS || Pe, ze = i.HTML_INTEGRATION_POINTS || ze, I = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && Gt(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (I.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && Gt(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (I.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (I.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), se && (et = !1), Oe && (oe = !0), le && (D = b({}, wt), M = [], le.html === !0 && (b(D, Tt), b(M, _t)), le.svg === !0 && (b(D, We), b(M, Ze), b(M, Le)), le.svgFilters === !0 && (b(D, qe), b(M, Ze), b(M, Le)), le.mathMl === !0 && (b(D, je), b(M, At), b(M, Le))), i.ADD_TAGS && (D === Dt && (D = ee(D)), b(D, i.ADD_TAGS, N)), i.ADD_ATTR && (M === Nt && (M = ee(M)), b(M, i.ADD_ATTR, N)), i.ADD_URI_SAFE_ATTR && b(st, i.ADD_URI_SAFE_ATTR, N), i.FORBID_CONTENTS && (ae === Ut && (ae = ee(ae)), b(ae, i.FORBID_CONTENTS, N)), rt && (D["#text"] = !0), te && b(D, ["html", "head", "body"]), D.table && (b(D, ["tbody"]), delete be.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
1822
|
+
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
1823
|
+
throw J('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
1824
|
+
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
1825
|
+
throw J('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
1826
|
+
U = i.TRUSTED_TYPES_POLICY, ke = U.createHTML("");
|
|
1827
|
+
} else
|
|
1828
|
+
U === void 0 && (U = Dn(Ie, z)), U !== null && typeof ke == "string" && (ke = U.createHTML(""));
|
|
1829
|
+
r && r(i), ue = i;
|
|
1830
|
+
}
|
|
1831
|
+
}, Wt = b({}, [...We, ...qe, ...wn]), qt = b({}, [...je, ..._n]), ti = function(i) {
|
|
1832
|
+
let p = Ce(i);
|
|
1833
|
+
(!p || !p.tagName) && (p = {
|
|
1834
|
+
namespaceURI: ce,
|
|
1835
|
+
tagName: "template"
|
|
1836
|
+
});
|
|
1837
|
+
const f = x(i.tagName), L = x(p.tagName);
|
|
1838
|
+
return lt[i.namespaceURI] ? i.namespaceURI === Me ? p.namespaceURI === V ? f === "svg" : p.namespaceURI === Ne ? f === "svg" && (L === "annotation-xml" || Pe[L]) : !!Wt[f] : i.namespaceURI === Ne ? p.namespaceURI === V ? f === "math" : p.namespaceURI === Me ? f === "math" && ze[L] : !!qt[f] : i.namespaceURI === V ? p.namespaceURI === Me && !ze[L] || p.namespaceURI === Ne && !Pe[L] ? !1 : !qt[f] && (Vn[f] || !Wt[f]) : !!(Te === "application/xhtml+xml" && lt[i.namespaceURI]) : !1;
|
|
1839
|
+
}, Z = function(i) {
|
|
1840
|
+
m(g.removed, {
|
|
1841
|
+
element: i
|
|
1842
|
+
});
|
|
1843
|
+
try {
|
|
1844
|
+
Ce(i).removeChild(i);
|
|
1845
|
+
} catch {
|
|
1846
|
+
$n(i);
|
|
1847
|
+
}
|
|
1848
|
+
}, ve = function(i, p) {
|
|
1849
|
+
try {
|
|
1850
|
+
m(g.removed, {
|
|
1851
|
+
attribute: p.getAttributeNode(i),
|
|
1852
|
+
from: p
|
|
1853
|
+
});
|
|
1854
|
+
} catch {
|
|
1855
|
+
m(g.removed, {
|
|
1856
|
+
attribute: null,
|
|
1857
|
+
from: p
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
if (p.removeAttribute(i), i === "is")
|
|
1861
|
+
if (oe || Oe)
|
|
1862
|
+
try {
|
|
1863
|
+
Z(p);
|
|
1864
|
+
} catch {
|
|
1865
|
+
}
|
|
1866
|
+
else
|
|
1867
|
+
try {
|
|
1868
|
+
p.setAttribute(i, "");
|
|
1869
|
+
} catch {
|
|
1870
|
+
}
|
|
1871
|
+
}, jt = function(i) {
|
|
1872
|
+
let p = null, f = null;
|
|
1873
|
+
if (it)
|
|
1874
|
+
i = "<remove></remove>" + i;
|
|
1875
|
+
else {
|
|
1876
|
+
const P = A(i, /^[\r\n\t ]+/);
|
|
1877
|
+
f = P && P[0];
|
|
1878
|
+
}
|
|
1879
|
+
Te === "application/xhtml+xml" && ce === V && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
1880
|
+
const L = U ? U.createHTML(i) : i;
|
|
1881
|
+
if (ce === V)
|
|
1882
|
+
try {
|
|
1883
|
+
p = new zn().parseFromString(L, Te);
|
|
1884
|
+
} catch {
|
|
1885
|
+
}
|
|
1886
|
+
if (!p || !p.documentElement) {
|
|
1887
|
+
p = Xe.createDocument(ce, "template", null);
|
|
1888
|
+
try {
|
|
1889
|
+
p.documentElement.innerHTML = ot ? ke : L;
|
|
1890
|
+
} catch {
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
const v = p.body || p.documentElement;
|
|
1894
|
+
return i && f && v.insertBefore(_.createTextNode(f), v.childNodes[0] || null), ce === V ? Gn.call(p, te ? "html" : "body")[0] : te ? p.documentElement : v;
|
|
1895
|
+
}, Zt = function(i) {
|
|
1896
|
+
return Fn.call(
|
|
1897
|
+
i.ownerDocument || i,
|
|
1898
|
+
i,
|
|
1899
|
+
// eslint-disable-next-line no-bitwise
|
|
1900
|
+
de.SHOW_ELEMENT | de.SHOW_COMMENT | de.SHOW_TEXT | de.SHOW_PROCESSING_INSTRUCTION | de.SHOW_CDATA_SECTION,
|
|
1901
|
+
null
|
|
1902
|
+
);
|
|
1903
|
+
}, Yt = function(i) {
|
|
1904
|
+
return i instanceof Pn && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof Mn) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
1905
|
+
}, Xt = function(i) {
|
|
1906
|
+
return typeof Ye == "function" && i instanceof Ye;
|
|
1907
|
+
};
|
|
1908
|
+
function K(d, i, p) {
|
|
1909
|
+
c(d, (f) => {
|
|
1910
|
+
f.call(g, i, p, ue);
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
const Qt = function(i) {
|
|
1914
|
+
let p = null;
|
|
1915
|
+
if (K(W.beforeSanitizeElements, i, null), Yt(i))
|
|
1916
|
+
return Z(i), !0;
|
|
1917
|
+
const f = N(i.nodeName);
|
|
1918
|
+
if (K(W.uponSanitizeElement, i, {
|
|
1919
|
+
tagName: f,
|
|
1920
|
+
allowedTags: D
|
|
1921
|
+
}), i.hasChildNodes() && !Xt(i.firstElementChild) && O(/<[/\w]/g, i.innerHTML) && O(/<[/\w]/g, i.textContent) || i.nodeType === ge.progressingInstruction || tt && i.nodeType === ge.comment && O(/<[/\w]/g, i.data))
|
|
1922
|
+
return Z(i), !0;
|
|
1923
|
+
if (!D[f] || be[f]) {
|
|
1924
|
+
if (!be[f] && Kt(f) && (I.tagNameCheck instanceof RegExp && O(I.tagNameCheck, f) || I.tagNameCheck instanceof Function && I.tagNameCheck(f)))
|
|
1925
|
+
return !1;
|
|
1926
|
+
if (rt && !ae[f]) {
|
|
1927
|
+
const L = Ce(i) || i.parentNode, v = Bn(i) || i.childNodes;
|
|
1928
|
+
if (v && L) {
|
|
1929
|
+
const P = v.length;
|
|
1930
|
+
for (let G = P - 1; G >= 0; --G) {
|
|
1931
|
+
const Y = vn(v[G], !0);
|
|
1932
|
+
Y.__removalCount = (i.__removalCount || 0) + 1, L.insertBefore(Y, Un(i));
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
return Z(i), !0;
|
|
1937
|
+
}
|
|
1938
|
+
return i instanceof It && !ti(i) || (f === "noscript" || f === "noembed" || f === "noframes") && O(/<\/no(script|embed|frames)/i, i.innerHTML) ? (Z(i), !0) : (se && i.nodeType === ge.text && (p = i.textContent, c([Qe, Ve, Ke], (L) => {
|
|
1939
|
+
p = C(p, L, " ");
|
|
1940
|
+
}), i.textContent !== p && (m(g.removed, {
|
|
1941
|
+
element: i.cloneNode()
|
|
1942
|
+
}), i.textContent = p)), K(W.afterSanitizeElements, i, null), !1);
|
|
1943
|
+
}, Vt = function(i, p, f) {
|
|
1944
|
+
if (vt && (p === "id" || p === "name") && (f in _ || f in ei))
|
|
1945
|
+
return !1;
|
|
1946
|
+
if (!(et && !Je[p] && O(qn, p))) {
|
|
1947
|
+
if (!(Mt && O(jn, p))) {
|
|
1948
|
+
if (!M[p] || Je[p]) {
|
|
1949
|
+
if (
|
|
1950
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1951
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1952
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
1953
|
+
!(Kt(i) && (I.tagNameCheck instanceof RegExp && O(I.tagNameCheck, i) || I.tagNameCheck instanceof Function && I.tagNameCheck(i)) && (I.attributeNameCheck instanceof RegExp && O(I.attributeNameCheck, p) || I.attributeNameCheck instanceof Function && I.attributeNameCheck(p)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
1954
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1955
|
+
p === "is" && I.allowCustomizedBuiltInElements && (I.tagNameCheck instanceof RegExp && O(I.tagNameCheck, f) || I.tagNameCheck instanceof Function && I.tagNameCheck(f)))
|
|
1956
|
+
) return !1;
|
|
1957
|
+
} else if (!st[p]) {
|
|
1958
|
+
if (!O(Ot, C(f, Ct, ""))) {
|
|
1959
|
+
if (!((p === "src" || p === "xlink:href" || p === "href") && i !== "script" && Re(f, "data:") === 0 && Bt[i])) {
|
|
1960
|
+
if (!(Pt && !O(Zn, C(f, Ct, "")))) {
|
|
1961
|
+
if (f)
|
|
1962
|
+
return !1;
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
return !0;
|
|
1970
|
+
}, Kt = function(i) {
|
|
1971
|
+
return i !== "annotation-xml" && A(i, Yn);
|
|
1972
|
+
}, Jt = function(i) {
|
|
1973
|
+
K(W.beforeSanitizeAttributes, i, null);
|
|
1974
|
+
const {
|
|
1975
|
+
attributes: p
|
|
1976
|
+
} = i;
|
|
1977
|
+
if (!p)
|
|
1978
|
+
return;
|
|
1979
|
+
const f = {
|
|
1980
|
+
attrName: "",
|
|
1981
|
+
attrValue: "",
|
|
1982
|
+
keepAttr: !0,
|
|
1983
|
+
allowedAttributes: M,
|
|
1984
|
+
forceKeepAttr: void 0
|
|
1985
|
+
};
|
|
1986
|
+
let L = p.length;
|
|
1987
|
+
for (; L--; ) {
|
|
1988
|
+
const v = p[L], {
|
|
1989
|
+
name: P,
|
|
1990
|
+
namespaceURI: G,
|
|
1991
|
+
value: Y
|
|
1992
|
+
} = v, we = N(P);
|
|
1993
|
+
let B = P === "value" ? Y : pe(Y);
|
|
1994
|
+
if (f.attrName = we, f.attrValue = B, f.keepAttr = !0, f.forceKeepAttr = void 0, K(W.uponSanitizeAttribute, i, f), B = f.attrValue, $t && (we === "id" || we === "name") && (ve(P, i), B = Xn + B), tt && O(/((--!?|])>)|<\/(style|title)/i, B)) {
|
|
1995
|
+
ve(P, i);
|
|
1996
|
+
continue;
|
|
1997
|
+
}
|
|
1998
|
+
if (f.forceKeepAttr || (ve(P, i), !f.keepAttr))
|
|
1999
|
+
continue;
|
|
2000
|
+
if (!zt && O(/\/>/i, B)) {
|
|
2001
|
+
ve(P, i);
|
|
2002
|
+
continue;
|
|
2003
|
+
}
|
|
2004
|
+
se && c([Qe, Ve, Ke], (tn) => {
|
|
2005
|
+
B = C(B, tn, " ");
|
|
2006
|
+
});
|
|
2007
|
+
const en = N(i.nodeName);
|
|
2008
|
+
if (Vt(en, we, B)) {
|
|
2009
|
+
if (U && typeof Ie == "object" && typeof Ie.getAttributeType == "function" && !G)
|
|
2010
|
+
switch (Ie.getAttributeType(en, we)) {
|
|
2011
|
+
case "TrustedHTML": {
|
|
2012
|
+
B = U.createHTML(B);
|
|
2013
|
+
break;
|
|
2014
|
+
}
|
|
2015
|
+
case "TrustedScriptURL": {
|
|
2016
|
+
B = U.createScriptURL(B);
|
|
2017
|
+
break;
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
try {
|
|
2021
|
+
G ? i.setAttributeNS(G, P, B) : i.setAttribute(P, B), Yt(i) ? Z(i) : k(g.removed);
|
|
2022
|
+
} catch {
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
K(W.afterSanitizeAttributes, i, null);
|
|
2027
|
+
}, ni = function d(i) {
|
|
2028
|
+
let p = null;
|
|
2029
|
+
const f = Zt(i);
|
|
2030
|
+
for (K(W.beforeSanitizeShadowDOM, i, null); p = f.nextNode(); )
|
|
2031
|
+
K(W.uponSanitizeShadowNode, p, null), !Qt(p) && (p.content instanceof Q && d(p.content), Jt(p));
|
|
2032
|
+
K(W.afterSanitizeShadowDOM, i, null);
|
|
2033
|
+
};
|
|
2034
|
+
return g.sanitize = function(d) {
|
|
2035
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = null, f = null, L = null, v = null;
|
|
2036
|
+
if (ot = !d, ot && (d = "<!-->"), typeof d != "string" && !Xt(d))
|
|
2037
|
+
if (typeof d.toString == "function") {
|
|
2038
|
+
if (d = d.toString(), typeof d != "string")
|
|
2039
|
+
throw J("dirty is not a string, aborting");
|
|
2040
|
+
} else
|
|
2041
|
+
throw J("toString is not a function");
|
|
2042
|
+
if (!g.isSupported)
|
|
2043
|
+
return d;
|
|
2044
|
+
if (nt || at(i), g.removed = [], typeof d == "string" && (xe = !1), xe) {
|
|
2045
|
+
if (d.nodeName) {
|
|
2046
|
+
const Y = N(d.nodeName);
|
|
2047
|
+
if (!D[Y] || be[Y])
|
|
2048
|
+
throw J("root node is forbidden and cannot be sanitized in-place");
|
|
2049
|
+
}
|
|
2050
|
+
} else if (d instanceof Ye)
|
|
2051
|
+
p = jt("<!---->"), f = p.ownerDocument.importNode(d, !0), f.nodeType === ge.element && f.nodeName === "BODY" || f.nodeName === "HTML" ? p = f : p.appendChild(f);
|
|
2052
|
+
else {
|
|
2053
|
+
if (!oe && !se && !te && // eslint-disable-next-line unicorn/prefer-includes
|
|
2054
|
+
d.indexOf("<") === -1)
|
|
2055
|
+
return U && De ? U.createHTML(d) : d;
|
|
2056
|
+
if (p = jt(d), !p)
|
|
2057
|
+
return oe ? null : De ? ke : "";
|
|
2058
|
+
}
|
|
2059
|
+
p && it && Z(p.firstChild);
|
|
2060
|
+
const P = Zt(xe ? d : p);
|
|
2061
|
+
for (; L = P.nextNode(); )
|
|
2062
|
+
Qt(L) || (L.content instanceof Q && ni(L.content), Jt(L));
|
|
2063
|
+
if (xe)
|
|
2064
|
+
return d;
|
|
2065
|
+
if (oe) {
|
|
2066
|
+
if (Oe)
|
|
2067
|
+
for (v = Hn.call(p.ownerDocument); p.firstChild; )
|
|
2068
|
+
v.appendChild(p.firstChild);
|
|
2069
|
+
else
|
|
2070
|
+
v = p;
|
|
2071
|
+
return (M.shadowroot || M.shadowrootmode) && (v = Wn.call(w, v, !0)), v;
|
|
2072
|
+
}
|
|
2073
|
+
let G = te ? p.outerHTML : p.innerHTML;
|
|
2074
|
+
return te && D["!doctype"] && p.ownerDocument && p.ownerDocument.doctype && p.ownerDocument.doctype.name && O(yt, p.ownerDocument.doctype.name) && (G = "<!DOCTYPE " + p.ownerDocument.doctype.name + `>
|
|
2075
|
+
` + G), se && c([Qe, Ve, Ke], (Y) => {
|
|
2076
|
+
G = C(G, Y, " ");
|
|
2077
|
+
}), U && De ? U.createHTML(G) : G;
|
|
2078
|
+
}, g.setConfig = function() {
|
|
2079
|
+
let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2080
|
+
at(d), nt = !0;
|
|
2081
|
+
}, g.clearConfig = function() {
|
|
2082
|
+
ue = null, nt = !1;
|
|
2083
|
+
}, g.isValidAttribute = function(d, i, p) {
|
|
2084
|
+
ue || at({});
|
|
2085
|
+
const f = N(d), L = N(i);
|
|
2086
|
+
return Vt(f, L, p);
|
|
2087
|
+
}, g.addHook = function(d, i) {
|
|
2088
|
+
typeof i == "function" && m(W[d], i);
|
|
2089
|
+
}, g.removeHook = function(d) {
|
|
2090
|
+
return k(W[d]);
|
|
2091
|
+
}, g.removeHooks = function(d) {
|
|
2092
|
+
W[d] = [];
|
|
2093
|
+
}, g.removeAllHooks = function() {
|
|
2094
|
+
W = Rt();
|
|
2095
|
+
}, g;
|
|
2096
|
+
}
|
|
2097
|
+
var Nn = Lt();
|
|
2098
|
+
return ct = Nn, ct;
|
|
2099
|
+
}
|
|
2100
|
+
var ut, un;
|
|
2101
|
+
function zi() {
|
|
2102
|
+
return un || (un = 1, ut = window.DOMPurify || (window.DOMPurify = cn().default || cn())), ut;
|
|
2103
|
+
}
|
|
2104
|
+
var vi = zi();
|
|
2105
|
+
const Bi = /* @__PURE__ */ si(vi);
|
|
2106
|
+
export {
|
|
2107
|
+
Bi as D,
|
|
2108
|
+
Ui as c,
|
|
2109
|
+
E as m
|
|
2110
|
+
};
|