markdown-text-editor 1.5.1 → 1.5.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/README.md +89 -74
- package/dist/markdown-text-editor.es.js +459 -427
- package/dist/markdown-text-editor.es.js.map +1 -1
- package/dist/markdown-text-editor.min.js +50 -50
- package/dist/markdown-text-editor.min.js.map +1 -1
- package/dist/markdown-text-editor.umd.js +50 -50
- package/dist/markdown-text-editor.umd.js.map +1 -1
- package/package.json +21 -26
|
@@ -99,8 +99,8 @@ var o = ((e = "") => {
|
|
|
99
99
|
headingBeginRegex: i((e) => RegExp(`^ {0,${e}}#`)),
|
|
100
100
|
htmlBeginRegex: i((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
|
|
101
101
|
blockquoteBeginRegex: i((e) => RegExp(`^ {0,${e}}>`))
|
|
102
|
-
}, c = /^(?:[ \t]*(?:\n|$))+/, l = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, u = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, d = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, f = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, p = / {0,3}(?:[*+-]|\d{1,9}[.)])/, m = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, h = a(m).replace(/bull/g, p).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ee = a(m).replace(/bull/g, p).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), te = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ne = /^[^\n]+/, g = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, _ = a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", g).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), v = a(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, p).getRegex(), y = "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", re = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ie = a("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(
|
|
103
|
-
blockquote: a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",
|
|
102
|
+
}, c = /^(?:[ \t]*(?:\n|$))+/, l = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, u = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, d = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, f = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, p = / {0,3}(?:[*+-]|\d{1,9}[.)])/, m = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, h = a(m).replace(/bull/g, p).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ee = a(m).replace(/bull/g, p).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), te = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ne = /^[^\n]+/, g = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, _ = a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", g).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), v = a(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, p).getRegex(), y = "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", re = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ie = a("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n+|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n+|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\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", re).replace("tag", y).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ae = (e) => a(te).replace("hr", d).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", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", y).getRegex(), oe = ae(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), se = ae(/ {0,3}(?:[*+-]|\d{1,9}[.)])[ \t]+[^ \t\n]/), ce = {
|
|
103
|
+
blockquote: a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", se).getRegex(),
|
|
104
104
|
code: l,
|
|
105
105
|
def: _,
|
|
106
106
|
fences: u,
|
|
@@ -110,85 +110,85 @@ var o = ((e = "") => {
|
|
|
110
110
|
lheading: h,
|
|
111
111
|
list: v,
|
|
112
112
|
newline: c,
|
|
113
|
-
paragraph:
|
|
113
|
+
paragraph: oe,
|
|
114
114
|
table: r,
|
|
115
115
|
text: ne
|
|
116
|
-
},
|
|
117
|
-
...
|
|
116
|
+
}, le = a("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", d).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[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", y).getRegex(), ue = {
|
|
117
|
+
...ce,
|
|
118
118
|
lheading: ee,
|
|
119
|
-
table:
|
|
120
|
-
paragraph: a(te).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table",
|
|
121
|
-
},
|
|
122
|
-
...
|
|
119
|
+
table: le,
|
|
120
|
+
paragraph: a(te).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", le).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", y).getRegex()
|
|
121
|
+
}, de = {
|
|
122
|
+
...ce,
|
|
123
123
|
html: a("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", re).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(),
|
|
124
124
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
125
125
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
126
126
|
fences: r,
|
|
127
127
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
128
128
|
paragraph: a(te).replace("hr", d).replace("heading", " *#{1,6} *[^\n]").replace("lheading", h).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
129
|
-
},
|
|
129
|
+
}, fe = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, pe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, me = /^( {2,}|\\)\n(?!\s*$)/, he = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, b = /[\p{P}\p{S}]/u, ge = /[\s\p{P}\p{S}]/u, _e = /[^\s\p{P}\p{S}]/u, ve = a(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, ge).getRegex(), ye = /(?!~)[\p{P}\p{S}]/u, be = /(?!~)[\s\p{P}\p{S}]/u, xe = /(?:[^\s\p{P}\p{S}]|~)/u, Se = a(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", o ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, we = a(Ce, "u").replace(/punct/g, b).getRegex(), x = a(Ce, "u").replace(/punct/g, ye).getRegex(), Te = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", S = a(Te, "gu").replace(/notPunctSpace/g, _e).replace(/punctSpace/g, ge).replace(/punct/g, b).getRegex(), Ee = a(Te, "gu").replace(/notPunctSpace/g, xe).replace(/punctSpace/g, be).replace(/punct/g, ye).getRegex(), C = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, _e).replace(/punctSpace/g, ge).replace(/punct/g, b).getRegex(), De = a(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, b).getRegex(), Oe = a("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, _e).replace(/punctSpace/g, ge).replace(/punct/g, b).getRegex(), w = a(/\\(punct)/, "gu").replace(/punct/g, b).getRegex(), ke = a(/^<(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(), Ae = a(re).replace("(?:-->|$)", "-->").getRegex(), je = a("^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", Ae).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Me = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, T = a(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Me).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), E = a(/^!?\[(label)\]\[(ref)\]/).replace("label", Me).replace("ref", g).getRegex(), D = a(/^!?\[(ref)\](?:\[\])?/).replace("ref", g).getRegex(), Ne = a("reflink|nolink(?!\\()", "g").replace("reflink", E).replace("nolink", D).getRegex(), Pe = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Fe = {
|
|
130
130
|
_backpedal: r,
|
|
131
|
-
anyPunctuation:
|
|
132
|
-
autolink:
|
|
133
|
-
blockSkip:
|
|
134
|
-
br:
|
|
135
|
-
code:
|
|
131
|
+
anyPunctuation: w,
|
|
132
|
+
autolink: ke,
|
|
133
|
+
blockSkip: Se,
|
|
134
|
+
br: me,
|
|
135
|
+
code: pe,
|
|
136
136
|
del: r,
|
|
137
137
|
delLDelim: r,
|
|
138
138
|
delRDelim: r,
|
|
139
|
-
emStrongLDelim:
|
|
140
|
-
emStrongRDelimAst:
|
|
141
|
-
emStrongRDelimUnd:
|
|
142
|
-
escape:
|
|
143
|
-
link:
|
|
144
|
-
nolink:
|
|
145
|
-
punctuation:
|
|
146
|
-
reflink:
|
|
139
|
+
emStrongLDelim: we,
|
|
140
|
+
emStrongRDelimAst: S,
|
|
141
|
+
emStrongRDelimUnd: C,
|
|
142
|
+
escape: fe,
|
|
143
|
+
link: T,
|
|
144
|
+
nolink: D,
|
|
145
|
+
punctuation: ve,
|
|
146
|
+
reflink: E,
|
|
147
147
|
reflinkSearch: Ne,
|
|
148
|
-
tag:
|
|
149
|
-
text:
|
|
148
|
+
tag: je,
|
|
149
|
+
text: he,
|
|
150
150
|
url: r
|
|
151
|
-
}, Fe = {
|
|
152
|
-
...Pe,
|
|
153
|
-
link: a(/^!?\[(label)\]\((.*?)\)/).replace("label", Ae).getRegex(),
|
|
154
|
-
reflink: a(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ae).getRegex()
|
|
155
151
|
}, Ie = {
|
|
156
|
-
...
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
152
|
+
...Fe,
|
|
153
|
+
link: a(/^!?\[(label)\]\((.*?)\)/).replace("label", Me).getRegex(),
|
|
154
|
+
reflink: a(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Me).getRegex()
|
|
155
|
+
}, O = {
|
|
156
|
+
...Fe,
|
|
157
|
+
emStrongRDelimAst: Ee,
|
|
158
|
+
emStrongLDelim: x,
|
|
159
|
+
delLDelim: De,
|
|
160
|
+
delRDelim: Oe,
|
|
161
|
+
url: a(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Pe).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
162
162
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
163
163
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
164
|
-
text: a(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",
|
|
164
|
+
text: a(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Pe).getRegex()
|
|
165
165
|
}, Le = {
|
|
166
|
-
...
|
|
167
|
-
br: a(
|
|
168
|
-
text: a(
|
|
169
|
-
},
|
|
170
|
-
normal:
|
|
171
|
-
gfm:
|
|
172
|
-
pedantic:
|
|
173
|
-
}, O = {
|
|
174
|
-
normal: Pe,
|
|
175
|
-
gfm: Ie,
|
|
176
|
-
breaks: Le,
|
|
177
|
-
pedantic: Fe
|
|
166
|
+
...O,
|
|
167
|
+
br: a(me).replace("{2,}", "*").getRegex(),
|
|
168
|
+
text: a(O.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
169
|
+
}, k = {
|
|
170
|
+
normal: ce,
|
|
171
|
+
gfm: ue,
|
|
172
|
+
pedantic: de
|
|
178
173
|
}, Re = {
|
|
174
|
+
normal: Fe,
|
|
175
|
+
gfm: O,
|
|
176
|
+
breaks: Le,
|
|
177
|
+
pedantic: Ie
|
|
178
|
+
}, ze = {
|
|
179
179
|
"&": "&",
|
|
180
180
|
"<": "<",
|
|
181
181
|
">": ">",
|
|
182
182
|
"\"": """,
|
|
183
183
|
"'": "'"
|
|
184
|
-
},
|
|
185
|
-
function
|
|
184
|
+
}, Be = (e) => ze[e];
|
|
185
|
+
function A(e, t) {
|
|
186
186
|
if (t) {
|
|
187
|
-
if (s.escapeTest.test(e)) return e.replace(s.escapeReplace,
|
|
188
|
-
} else if (s.escapeTestNoEncode.test(e)) return e.replace(s.escapeReplaceNoEncode,
|
|
187
|
+
if (s.escapeTest.test(e)) return e.replace(s.escapeReplace, Be);
|
|
188
|
+
} else if (s.escapeTestNoEncode.test(e)) return e.replace(s.escapeReplaceNoEncode, Be);
|
|
189
189
|
return e;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function Ve(e) {
|
|
192
192
|
try {
|
|
193
193
|
e = encodeURI(e).replace(s.percentDecode, "%");
|
|
194
194
|
} catch {
|
|
@@ -196,7 +196,7 @@ function Be(e) {
|
|
|
196
196
|
}
|
|
197
197
|
return e;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function j(e, t) {
|
|
200
200
|
let n = e.replace(s.findPipe, (e, t, n) => {
|
|
201
201
|
let r = !1, i = t;
|
|
202
202
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
@@ -207,7 +207,7 @@ function Ve(e, t) {
|
|
|
207
207
|
for (; r < n.length; r++) n[r] = n[r].trim().replace(s.slashPipe, "|");
|
|
208
208
|
return n;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function M(e, t, n) {
|
|
211
211
|
let r = e.length;
|
|
212
212
|
if (r === 0) return "";
|
|
213
213
|
let i = 0;
|
|
@@ -224,7 +224,7 @@ function He(e) {
|
|
|
224
224
|
for (; n >= 0 && s.blankLine.test(t[n]);) n--;
|
|
225
225
|
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function Ue(e, t) {
|
|
228
228
|
if (e.indexOf(t[1]) === -1) return -1;
|
|
229
229
|
let n = 0;
|
|
230
230
|
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
@@ -232,7 +232,7 @@ function j(e, t) {
|
|
|
232
232
|
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
233
233
|
return n > 0 ? -2 : -1;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function We(e, t = 0) {
|
|
236
236
|
let n = t, r = "";
|
|
237
237
|
for (let t of e) if (t === " ") {
|
|
238
238
|
let e = 4 - n % 4;
|
|
@@ -240,7 +240,7 @@ function Ue(e, t = 0) {
|
|
|
240
240
|
} else r += t, n++;
|
|
241
241
|
return r;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function Ge(e, t, n, r, i) {
|
|
244
244
|
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
|
|
245
245
|
r.state.inLink = !0;
|
|
246
246
|
let c = {
|
|
@@ -253,7 +253,7 @@ function We(e, t, n, r, i) {
|
|
|
253
253
|
};
|
|
254
254
|
return r.state.inLink = !1, c;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function Ke(e, t, n) {
|
|
257
257
|
let r = e.match(n.other.indentCodeCompensation);
|
|
258
258
|
if (r === null) return t;
|
|
259
259
|
let i = r[1];
|
|
@@ -264,7 +264,7 @@ function Ge(e, t, n) {
|
|
|
264
264
|
return r.length >= i.length ? e.slice(i.length) : e;
|
|
265
265
|
}).join("\n");
|
|
266
266
|
}
|
|
267
|
-
var
|
|
267
|
+
var qe = class {
|
|
268
268
|
options;
|
|
269
269
|
rules;
|
|
270
270
|
lexer;
|
|
@@ -293,7 +293,7 @@ var Ke = class {
|
|
|
293
293
|
fences(e) {
|
|
294
294
|
let t = this.rules.block.fences.exec(e);
|
|
295
295
|
if (t) {
|
|
296
|
-
let e = t[0], n =
|
|
296
|
+
let e = t[0], n = Ke(e, t[3] || "", this.rules);
|
|
297
297
|
return {
|
|
298
298
|
type: "code",
|
|
299
299
|
raw: e,
|
|
@@ -307,12 +307,12 @@ var Ke = class {
|
|
|
307
307
|
if (t) {
|
|
308
308
|
let e = t[2].trim();
|
|
309
309
|
if (this.rules.other.endingHash.test(e)) {
|
|
310
|
-
let t =
|
|
310
|
+
let t = M(e, "#");
|
|
311
311
|
(this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
|
|
312
312
|
}
|
|
313
313
|
return {
|
|
314
314
|
type: "heading",
|
|
315
|
-
raw:
|
|
315
|
+
raw: M(t[0], "\n"),
|
|
316
316
|
depth: t[1].length,
|
|
317
317
|
text: e,
|
|
318
318
|
tokens: this.lexer.inline(e)
|
|
@@ -323,13 +323,13 @@ var Ke = class {
|
|
|
323
323
|
let t = this.rules.block.hr.exec(e);
|
|
324
324
|
if (t) return {
|
|
325
325
|
type: "hr",
|
|
326
|
-
raw:
|
|
326
|
+
raw: M(t[0], "\n")
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
329
|
blockquote(e) {
|
|
330
330
|
let t = this.rules.block.blockquote.exec(e);
|
|
331
331
|
if (t) {
|
|
332
|
-
let e =
|
|
332
|
+
let e = M(t[0], "\n").split("\n"), n = "", r = "", i = [];
|
|
333
333
|
for (; e.length > 0;) {
|
|
334
334
|
let t = !1, a = [], o;
|
|
335
335
|
for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
|
|
@@ -379,7 +379,7 @@ ${c}` : c;
|
|
|
379
379
|
let n = !1, r = "", s = "";
|
|
380
380
|
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
381
381
|
r = t[0], e = e.substring(r.length);
|
|
382
|
-
let c =
|
|
382
|
+
let c = We(t[2].split("\n", 1)[0], t[1].length), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
|
|
383
383
|
if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = c.search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
|
|
384
384
|
let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d), f = this.rules.other.blockquoteBeginRegex(d);
|
|
385
385
|
for (; e;) {
|
|
@@ -462,7 +462,7 @@ ${c}` : c;
|
|
|
462
462
|
return {
|
|
463
463
|
type: "def",
|
|
464
464
|
tag: e,
|
|
465
|
-
raw:
|
|
465
|
+
raw: M(t[0], "\n"),
|
|
466
466
|
href: n,
|
|
467
467
|
title: r
|
|
468
468
|
};
|
|
@@ -471,9 +471,9 @@ ${c}` : c;
|
|
|
471
471
|
table(e) {
|
|
472
472
|
let t = this.rules.block.table.exec(e);
|
|
473
473
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
474
|
-
let n =
|
|
474
|
+
let n = j(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
|
|
475
475
|
type: "table",
|
|
476
|
-
raw:
|
|
476
|
+
raw: M(t[0], "\n"),
|
|
477
477
|
header: [],
|
|
478
478
|
align: [],
|
|
479
479
|
rows: []
|
|
@@ -486,7 +486,7 @@ ${c}` : c;
|
|
|
486
486
|
header: !0,
|
|
487
487
|
align: a.align[e]
|
|
488
488
|
});
|
|
489
|
-
for (let e of i) a.rows.push(
|
|
489
|
+
for (let e of i) a.rows.push(j(e, a.header.length).map((e, t) => ({
|
|
490
490
|
text: e,
|
|
491
491
|
tokens: this.lexer.inline(e),
|
|
492
492
|
header: !1,
|
|
@@ -501,7 +501,7 @@ ${c}` : c;
|
|
|
501
501
|
let e = t[1].trim();
|
|
502
502
|
return {
|
|
503
503
|
type: "heading",
|
|
504
|
-
raw:
|
|
504
|
+
raw: M(t[0], "\n"),
|
|
505
505
|
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
506
506
|
text: e,
|
|
507
507
|
tokens: this.lexer.inline(e)
|
|
@@ -554,10 +554,10 @@ ${c}` : c;
|
|
|
554
554
|
let e = t[2].trim();
|
|
555
555
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
|
|
556
556
|
if (!this.rules.other.endAngleBracket.test(e)) return;
|
|
557
|
-
let t =
|
|
557
|
+
let t = M(e.slice(0, -1), "\\");
|
|
558
558
|
if ((e.length - t.length) % 2 == 0) return;
|
|
559
559
|
} else {
|
|
560
|
-
let e =
|
|
560
|
+
let e = Ue(t[2], "()");
|
|
561
561
|
if (e === -2) return;
|
|
562
562
|
if (e > -1) {
|
|
563
563
|
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
@@ -569,7 +569,7 @@ ${c}` : c;
|
|
|
569
569
|
let e = this.rules.other.pedanticHrefTitle.exec(n);
|
|
570
570
|
e && (n = e[1], r = e[3]);
|
|
571
571
|
} else r = t[3] ? t[3].slice(1, -1) : "";
|
|
572
|
-
return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)),
|
|
572
|
+
return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), Ge(t, {
|
|
573
573
|
href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
574
574
|
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
575
575
|
}, t[0], this.lexer, this.rules);
|
|
@@ -587,7 +587,7 @@ ${c}` : c;
|
|
|
587
587
|
text: e
|
|
588
588
|
};
|
|
589
589
|
}
|
|
590
|
-
return
|
|
590
|
+
return Ge(n, e, n[0], this.lexer, this.rules);
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
593
|
emStrong(e, t, n = "") {
|
|
@@ -719,29 +719,29 @@ ${c}` : c;
|
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
},
|
|
722
|
+
}, N = class e {
|
|
723
723
|
tokens;
|
|
724
724
|
options;
|
|
725
725
|
state;
|
|
726
726
|
inlineQueue;
|
|
727
727
|
tokenizer;
|
|
728
728
|
constructor(e) {
|
|
729
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || t, this.options.tokenizer = this.options.tokenizer || new
|
|
729
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || t, this.options.tokenizer = this.options.tokenizer || new qe(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
730
730
|
inLink: !1,
|
|
731
731
|
inRawBlock: !1,
|
|
732
732
|
top: !0
|
|
733
733
|
};
|
|
734
734
|
let n = {
|
|
735
735
|
other: s,
|
|
736
|
-
block:
|
|
737
|
-
inline:
|
|
736
|
+
block: k.normal,
|
|
737
|
+
inline: Re.normal
|
|
738
738
|
};
|
|
739
|
-
this.options.pedantic ? (n.block =
|
|
739
|
+
this.options.pedantic ? (n.block = k.pedantic, n.inline = Re.pedantic) : this.options.gfm && (n.block = k.gfm, this.options.breaks ? n.inline = Re.breaks : n.inline = Re.gfm), this.tokenizer.rules = n;
|
|
740
740
|
}
|
|
741
741
|
static get rules() {
|
|
742
742
|
return {
|
|
743
|
-
block:
|
|
744
|
-
inline:
|
|
743
|
+
block: k,
|
|
744
|
+
inline: Re
|
|
745
745
|
};
|
|
746
746
|
}
|
|
747
747
|
static lex(t, n) {
|
|
@@ -941,7 +941,7 @@ ${c}` : c;
|
|
|
941
941
|
if (this.options.silent) console.error(t);
|
|
942
942
|
else throw Error(t);
|
|
943
943
|
}
|
|
944
|
-
},
|
|
944
|
+
}, P = class {
|
|
945
945
|
options;
|
|
946
946
|
parser;
|
|
947
947
|
constructor(e) {
|
|
@@ -952,7 +952,7 @@ ${c}` : c;
|
|
|
952
952
|
}
|
|
953
953
|
code({ text: e, lang: t, escaped: n }) {
|
|
954
954
|
let r = (t || "").match(s.notSpaceStart)?.[0], i = e.replace(s.endingNewline, "") + "\n";
|
|
955
|
-
return r ? "<pre><code class=\"language-" +
|
|
955
|
+
return r ? "<pre><code class=\"language-" + A(r) + "\">" + (n ? i : A(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : A(i, !0)) + "</code></pre>\n";
|
|
956
956
|
}
|
|
957
957
|
blockquote({ tokens: e }) {
|
|
958
958
|
return `<blockquote>
|
|
@@ -1022,7 +1022,7 @@ ${e}</tr>
|
|
|
1022
1022
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1023
1023
|
}
|
|
1024
1024
|
codespan({ text: e }) {
|
|
1025
|
-
return `<code>${
|
|
1025
|
+
return `<code>${A(e, !0)}</code>`;
|
|
1026
1026
|
}
|
|
1027
1027
|
br(e) {
|
|
1028
1028
|
return "<br>";
|
|
@@ -1031,24 +1031,24 @@ ${e}</tr>
|
|
|
1031
1031
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1032
1032
|
}
|
|
1033
1033
|
link({ href: e, title: t, tokens: n }) {
|
|
1034
|
-
let r = this.parser.parseInline(n), i =
|
|
1034
|
+
let r = this.parser.parseInline(n), i = Ve(e);
|
|
1035
1035
|
if (i === null) return r;
|
|
1036
1036
|
e = i;
|
|
1037
1037
|
let a = "<a href=\"" + e + "\"";
|
|
1038
|
-
return t && (a += " title=\"" +
|
|
1038
|
+
return t && (a += " title=\"" + A(t) + "\""), a += ">" + r + "</a>", a;
|
|
1039
1039
|
}
|
|
1040
1040
|
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1041
1041
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1042
|
-
let i =
|
|
1043
|
-
if (i === null) return
|
|
1042
|
+
let i = Ve(e);
|
|
1043
|
+
if (i === null) return A(n);
|
|
1044
1044
|
e = i;
|
|
1045
|
-
let a = `<img src="${e}" alt="${
|
|
1046
|
-
return t && (a += ` title="${
|
|
1045
|
+
let a = `<img src="${e}" alt="${A(n)}"`;
|
|
1046
|
+
return t && (a += ` title="${A(t)}"`), a += ">", a;
|
|
1047
1047
|
}
|
|
1048
1048
|
text(e) {
|
|
1049
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text :
|
|
1049
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : A(e.text);
|
|
1050
1050
|
}
|
|
1051
|
-
},
|
|
1051
|
+
}, F = class {
|
|
1052
1052
|
strong({ text: e }) {
|
|
1053
1053
|
return e;
|
|
1054
1054
|
}
|
|
@@ -1079,12 +1079,12 @@ ${e}</tr>
|
|
|
1079
1079
|
checkbox({ raw: e }) {
|
|
1080
1080
|
return e;
|
|
1081
1081
|
}
|
|
1082
|
-
},
|
|
1082
|
+
}, I = class e {
|
|
1083
1083
|
options;
|
|
1084
1084
|
renderer;
|
|
1085
1085
|
textRenderer;
|
|
1086
1086
|
constructor(e) {
|
|
1087
|
-
this.options = e || t, this.options.renderer = this.options.renderer || new
|
|
1087
|
+
this.options = e || t, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new F();
|
|
1088
1088
|
}
|
|
1089
1089
|
static parse(t, n) {
|
|
1090
1090
|
return new e(n).parse(t);
|
|
@@ -1230,7 +1230,7 @@ ${e}</tr>
|
|
|
1230
1230
|
}
|
|
1231
1231
|
return n;
|
|
1232
1232
|
}
|
|
1233
|
-
},
|
|
1233
|
+
}, L = class {
|
|
1234
1234
|
options;
|
|
1235
1235
|
block;
|
|
1236
1236
|
constructor(e) {
|
|
@@ -1260,22 +1260,22 @@ ${e}</tr>
|
|
|
1260
1260
|
return e;
|
|
1261
1261
|
}
|
|
1262
1262
|
provideLexer(e = this.block) {
|
|
1263
|
-
return e ?
|
|
1263
|
+
return e ? N.lex : N.lexInline;
|
|
1264
1264
|
}
|
|
1265
1265
|
provideParser(e = this.block) {
|
|
1266
|
-
return e ?
|
|
1266
|
+
return e ? I.parse : I.parseInline;
|
|
1267
1267
|
}
|
|
1268
|
-
},
|
|
1268
|
+
}, R = new class {
|
|
1269
1269
|
defaults = e();
|
|
1270
1270
|
options = this.setOptions;
|
|
1271
1271
|
parse = this.parseMarkdown(!0);
|
|
1272
1272
|
parseInline = this.parseMarkdown(!1);
|
|
1273
|
-
Parser =
|
|
1274
|
-
Renderer =
|
|
1275
|
-
TextRenderer =
|
|
1276
|
-
Lexer =
|
|
1277
|
-
Tokenizer =
|
|
1278
|
-
Hooks =
|
|
1273
|
+
Parser = I;
|
|
1274
|
+
Renderer = P;
|
|
1275
|
+
TextRenderer = F;
|
|
1276
|
+
Lexer = N;
|
|
1277
|
+
Tokenizer = qe;
|
|
1278
|
+
Hooks = L;
|
|
1279
1279
|
constructor(...e) {
|
|
1280
1280
|
this.use(...e);
|
|
1281
1281
|
}
|
|
@@ -1326,7 +1326,7 @@ ${e}</tr>
|
|
|
1326
1326
|
}
|
|
1327
1327
|
"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
|
|
1328
1328
|
}), n.extensions = t), e.renderer) {
|
|
1329
|
-
let t = this.defaults.renderer || new
|
|
1329
|
+
let t = this.defaults.renderer || new P(this.defaults);
|
|
1330
1330
|
for (let n in e.renderer) {
|
|
1331
1331
|
if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
|
|
1332
1332
|
if (["options", "parser"].includes(n)) continue;
|
|
@@ -1339,7 +1339,7 @@ ${e}</tr>
|
|
|
1339
1339
|
n.renderer = t;
|
|
1340
1340
|
}
|
|
1341
1341
|
if (e.tokenizer) {
|
|
1342
|
-
let t = this.defaults.tokenizer || new
|
|
1342
|
+
let t = this.defaults.tokenizer || new qe(this.defaults);
|
|
1343
1343
|
for (let n in e.tokenizer) {
|
|
1344
1344
|
if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
|
|
1345
1345
|
if ([
|
|
@@ -1356,13 +1356,13 @@ ${e}</tr>
|
|
|
1356
1356
|
n.tokenizer = t;
|
|
1357
1357
|
}
|
|
1358
1358
|
if (e.hooks) {
|
|
1359
|
-
let t = this.defaults.hooks || new
|
|
1359
|
+
let t = this.defaults.hooks || new L();
|
|
1360
1360
|
for (let n in e.hooks) {
|
|
1361
1361
|
if (!(n in t)) throw Error(`hook '${n}' does not exist`);
|
|
1362
1362
|
if (["options", "block"].includes(n)) continue;
|
|
1363
1363
|
let r = n, i = e.hooks[r], a = t[r];
|
|
1364
|
-
|
|
1365
|
-
if (this.defaults.async &&
|
|
1364
|
+
L.passThroughHooks.has(n) ? t[r] = (e) => {
|
|
1365
|
+
if (this.defaults.async && L.passThroughHooksRespectAsync.has(n)) return (async () => {
|
|
1366
1366
|
let n = await i.call(t, e);
|
|
1367
1367
|
return a.call(t, n);
|
|
1368
1368
|
})();
|
|
@@ -1399,10 +1399,10 @@ ${e}</tr>
|
|
|
1399
1399
|
}, this;
|
|
1400
1400
|
}
|
|
1401
1401
|
lexer(e, t) {
|
|
1402
|
-
return
|
|
1402
|
+
return N.lex(e, t ?? this.defaults);
|
|
1403
1403
|
}
|
|
1404
1404
|
parser(e, t) {
|
|
1405
|
-
return
|
|
1405
|
+
return I.parse(e, t ?? this.defaults);
|
|
1406
1406
|
}
|
|
1407
1407
|
parseMarkdown(e) {
|
|
1408
1408
|
return (t, n) => {
|
|
@@ -1414,16 +1414,16 @@ ${e}</tr>
|
|
|
1414
1414
|
if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
1415
1415
|
if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
1416
1416
|
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
1417
|
-
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ?
|
|
1417
|
+
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? N.lex : N.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
|
|
1418
1418
|
i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
|
|
1419
|
-
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ?
|
|
1419
|
+
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? I.parse : I.parseInline)(a, i);
|
|
1420
1420
|
return i.hooks ? await i.hooks.postprocess(o) : o;
|
|
1421
1421
|
})().catch(a);
|
|
1422
1422
|
try {
|
|
1423
1423
|
i.hooks && (t = i.hooks.preprocess(t));
|
|
1424
|
-
let n = (i.hooks ? i.hooks.provideLexer(e) : e ?
|
|
1424
|
+
let n = (i.hooks ? i.hooks.provideLexer(e) : e ? N.lex : N.lexInline)(t, i);
|
|
1425
1425
|
i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
|
|
1426
|
-
let r = (i.hooks ? i.hooks.provideParser(e) : e ?
|
|
1426
|
+
let r = (i.hooks ? i.hooks.provideParser(e) : e ? I.parse : I.parseInline)(n, i);
|
|
1427
1427
|
return i.hooks && (r = i.hooks.postprocess(r)), r;
|
|
1428
1428
|
} catch (e) {
|
|
1429
1429
|
return a(e);
|
|
@@ -1433,7 +1433,7 @@ ${e}</tr>
|
|
|
1433
1433
|
onError(e, t) {
|
|
1434
1434
|
return (n) => {
|
|
1435
1435
|
if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
|
|
1436
|
-
let e = "<p>An error occurred:</p><pre>" +
|
|
1436
|
+
let e = "<p>An error occurred:</p><pre>" + A(n.message + "", !0) + "</pre>";
|
|
1437
1437
|
return t ? Promise.resolve(e) : e;
|
|
1438
1438
|
}
|
|
1439
1439
|
if (t) return Promise.reject(n);
|
|
@@ -1441,16 +1441,16 @@ ${e}</tr>
|
|
|
1441
1441
|
};
|
|
1442
1442
|
}
|
|
1443
1443
|
}();
|
|
1444
|
-
function
|
|
1445
|
-
return
|
|
1444
|
+
function z(e, t) {
|
|
1445
|
+
return R.parse(e, t);
|
|
1446
1446
|
}
|
|
1447
|
-
|
|
1448
|
-
return
|
|
1449
|
-
},
|
|
1450
|
-
return
|
|
1451
|
-
},
|
|
1452
|
-
return
|
|
1453
|
-
},
|
|
1447
|
+
z.options = z.setOptions = function(e) {
|
|
1448
|
+
return R.setOptions(e), z.defaults = R.defaults, n(z.defaults), z;
|
|
1449
|
+
}, z.getDefaults = e, z.defaults = t, z.use = function(...e) {
|
|
1450
|
+
return R.use(...e), z.defaults = R.defaults, n(z.defaults), z;
|
|
1451
|
+
}, z.walkTokens = function(e, t) {
|
|
1452
|
+
return R.walkTokens(e, t);
|
|
1453
|
+
}, z.parseInline = R.parseInline, z.Parser = I, z.parser = I.parse, z.Renderer = P, z.TextRenderer = F, z.Lexer = N, z.lexer = N.lex, z.Tokenizer = qe, z.Hooks = L, z.parse = z, z.options, z.setOptions, z.use, z.walkTokens, z.parseInline, I.parse, N.lex;
|
|
1454
1454
|
//#endregion
|
|
1455
1455
|
//#region node_modules/dompurify/dist/purify.es.mjs
|
|
1456
1456
|
function Je(e, t) {
|
|
@@ -1492,10 +1492,10 @@ function $e(e, t) {
|
|
|
1492
1492
|
return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Je(e, t) : void 0;
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
|
-
var et = Object.entries,
|
|
1496
|
-
|
|
1495
|
+
var et = Object.entries, B = Object.setPrototypeOf, tt = Object.isFrozen, nt = Object.getPrototypeOf, rt = Object.getOwnPropertyDescriptor, V = Object.freeze, H = Object.seal, it = Object.create, at = typeof Reflect < "u" && Reflect, ot = at.apply, st = at.construct;
|
|
1496
|
+
V ||= function(e) {
|
|
1497
1497
|
return e;
|
|
1498
|
-
},
|
|
1498
|
+
}, H ||= function(e) {
|
|
1499
1499
|
return e;
|
|
1500
1500
|
}, ot ||= function(e, t) {
|
|
1501
1501
|
var n = [...arguments].slice(2);
|
|
@@ -1503,43 +1503,43 @@ z ||= function(e) {
|
|
|
1503
1503
|
}, st ||= function(e) {
|
|
1504
1504
|
return new e(...[...arguments].slice(1));
|
|
1505
1505
|
};
|
|
1506
|
-
var ct =
|
|
1507
|
-
function
|
|
1506
|
+
var ct = q(Array.prototype.forEach), lt = q(Array.prototype.lastIndexOf), ut = q(Array.prototype.pop), dt = q(Array.prototype.push), ft = q(Array.prototype.splice), U = Array.isArray, pt = q(String.prototype.toLowerCase), mt = q(String.prototype.toString), ht = q(String.prototype.match), gt = q(String.prototype.replace), _t = q(String.prototype.indexOf), vt = q(String.prototype.trim), yt = q(Number.prototype.toString), bt = q(Boolean.prototype.toString), xt = typeof BigInt > "u" ? null : q(BigInt.prototype.toString), St = typeof Symbol > "u" ? null : q(Symbol.prototype.toString), W = q(Object.prototype.hasOwnProperty), G = q(Object.prototype.toString), K = q(RegExp.prototype.test), Ct = wt(TypeError);
|
|
1507
|
+
function q(e) {
|
|
1508
1508
|
return function(t) {
|
|
1509
1509
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
1510
1510
|
var n = [...arguments].slice(1);
|
|
1511
1511
|
return ot(e, t, n);
|
|
1512
1512
|
};
|
|
1513
1513
|
}
|
|
1514
|
-
function
|
|
1514
|
+
function wt(e) {
|
|
1515
1515
|
return function() {
|
|
1516
1516
|
return st(e, [...arguments]);
|
|
1517
1517
|
};
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1519
|
+
function J(e, t) {
|
|
1520
1520
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : pt;
|
|
1521
|
-
if (
|
|
1521
|
+
if (B && B(e, null), !U(t)) return e;
|
|
1522
1522
|
let r = t.length;
|
|
1523
1523
|
for (; r--;) {
|
|
1524
1524
|
let i = t[r];
|
|
1525
1525
|
if (typeof i == "string") {
|
|
1526
1526
|
let e = n(i);
|
|
1527
|
-
e !== i && (
|
|
1527
|
+
e !== i && (tt(t) || (t[r] = e), i = e);
|
|
1528
1528
|
}
|
|
1529
1529
|
e[i] = !0;
|
|
1530
1530
|
}
|
|
1531
1531
|
return e;
|
|
1532
1532
|
}
|
|
1533
1533
|
function Tt(e) {
|
|
1534
|
-
for (let t = 0; t < e.length; t++)
|
|
1534
|
+
for (let t = 0; t < e.length; t++) W(e, t) || (e[t] = null);
|
|
1535
1535
|
return e;
|
|
1536
1536
|
}
|
|
1537
|
-
function
|
|
1537
|
+
function Y(e) {
|
|
1538
1538
|
let t = it(null);
|
|
1539
1539
|
for (let r of et(e)) {
|
|
1540
1540
|
var n = Qe(r, 2);
|
|
1541
1541
|
let i = n[0], a = n[1];
|
|
1542
|
-
|
|
1542
|
+
W(e, i) && (U(a) ? t[i] = Tt(a) : a && typeof a == "object" && a.constructor === Object ? t[i] = Y(a) : t[i] = a);
|
|
1543
1543
|
}
|
|
1544
1544
|
return t;
|
|
1545
1545
|
}
|
|
@@ -1550,28 +1550,28 @@ function Et(e) {
|
|
|
1550
1550
|
case "boolean": return bt(e);
|
|
1551
1551
|
case "bigint": return xt ? xt(e) : "0";
|
|
1552
1552
|
case "symbol": return St ? St(e) : "Symbol()";
|
|
1553
|
-
case "undefined": return
|
|
1553
|
+
case "undefined": return G(e);
|
|
1554
1554
|
case "function":
|
|
1555
1555
|
case "object": {
|
|
1556
|
-
if (e === null) return
|
|
1557
|
-
let t = e, n =
|
|
1556
|
+
if (e === null) return G(e);
|
|
1557
|
+
let t = e, n = X(t, "toString");
|
|
1558
1558
|
if (typeof n == "function") {
|
|
1559
1559
|
let e = n(t);
|
|
1560
|
-
return typeof e == "string" ? e :
|
|
1560
|
+
return typeof e == "string" ? e : G(e);
|
|
1561
1561
|
}
|
|
1562
|
-
return
|
|
1562
|
+
return G(e);
|
|
1563
1563
|
}
|
|
1564
|
-
default: return
|
|
1564
|
+
default: return G(e);
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
|
-
function
|
|
1567
|
+
function X(e, t) {
|
|
1568
1568
|
for (; e !== null;) {
|
|
1569
1569
|
let n = rt(e, t);
|
|
1570
1570
|
if (n) {
|
|
1571
|
-
if (n.get) return
|
|
1572
|
-
if (typeof n.value == "function") return
|
|
1571
|
+
if (n.get) return q(n.get);
|
|
1572
|
+
if (typeof n.value == "function") return q(n.value);
|
|
1573
1573
|
}
|
|
1574
|
-
e =
|
|
1574
|
+
e = nt(e);
|
|
1575
1575
|
}
|
|
1576
1576
|
function n() {
|
|
1577
1577
|
return null;
|
|
@@ -1580,12 +1580,12 @@ function J(e, t) {
|
|
|
1580
1580
|
}
|
|
1581
1581
|
function Dt(e) {
|
|
1582
1582
|
try {
|
|
1583
|
-
return
|
|
1583
|
+
return K(e, ""), !0;
|
|
1584
1584
|
} catch {
|
|
1585
1585
|
return !1;
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
1588
|
-
var Ot =
|
|
1588
|
+
var Ot = V(/* @__PURE__ */ "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.search.section.select.shadow.slot.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".split(".")), kt = V(/* @__PURE__ */ "svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")), At = V([
|
|
1589
1589
|
"feBlend",
|
|
1590
1590
|
"feColorMatrix",
|
|
1591
1591
|
"feComponentTransfer",
|
|
@@ -1611,7 +1611,7 @@ var Ot = z(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1611
1611
|
"feSpotLight",
|
|
1612
1612
|
"feTile",
|
|
1613
1613
|
"feTurbulence"
|
|
1614
|
-
]), jt =
|
|
1614
|
+
]), jt = V([
|
|
1615
1615
|
"animate",
|
|
1616
1616
|
"color-profile",
|
|
1617
1617
|
"cursor",
|
|
@@ -1634,7 +1634,7 @@ var Ot = z(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1634
1634
|
"solidcolor",
|
|
1635
1635
|
"unknown",
|
|
1636
1636
|
"use"
|
|
1637
|
-
]), Mt =
|
|
1637
|
+
]), Mt = V(/* @__PURE__ */ "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".split(".")), Nt = V([
|
|
1638
1638
|
"maction",
|
|
1639
1639
|
"maligngroup",
|
|
1640
1640
|
"malignmark",
|
|
@@ -1650,13 +1650,13 @@ var Ot = z(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1650
1650
|
"annotation-xml",
|
|
1651
1651
|
"mprescripts",
|
|
1652
1652
|
"none"
|
|
1653
|
-
]), Pt =
|
|
1653
|
+
]), Pt = V(["#text"]), Ft = V(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.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.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns".split(".")), It = V(/* @__PURE__ */ "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.dominant-baseline.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.mask-type.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-orientation.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".split(".")), Lt = V(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.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".split(".")), Rt = V([
|
|
1654
1654
|
"xlink:href",
|
|
1655
1655
|
"xml:id",
|
|
1656
1656
|
"xlink:title",
|
|
1657
1657
|
"xml:space",
|
|
1658
1658
|
"xmlns:xlink"
|
|
1659
|
-
]), zt =
|
|
1659
|
+
]), zt = H(/{{[\w\W]*|^[\w\W]*}}/g), Bt = H(/<%[\w\W]*|^[\w\W]*%>/g), Vt = H(/\${[\w\W]*/g), Ht = H(/^data-[\-\w.\u00B7-\uFFFF]+$/), Ut = H(/^aria-[\-\w]+$/), Wt = H(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Gt = H(/^(?:\w+script|data):/i), Kt = H(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), qt = H(/^html$/i), Jt = H(/^[a-z][.\w]*(-[.\w]+)+$/i), Yt = H(/<[/\w!]/g), Xt = H(/<[/\w]/g), Zt = H(/<\/no(script|embed|frames)/i), Qt = H(/\/>/i), Z = {
|
|
1660
1660
|
element: 1,
|
|
1661
1661
|
attribute: 2,
|
|
1662
1662
|
text: 3,
|
|
@@ -1700,23 +1700,23 @@ var Ot = z(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1700
1700
|
uponSanitizeElement: [],
|
|
1701
1701
|
uponSanitizeShadowNode: []
|
|
1702
1702
|
};
|
|
1703
|
-
},
|
|
1704
|
-
return
|
|
1703
|
+
}, nn = function(e, t, n, r) {
|
|
1704
|
+
return W(e, t) && U(e[t]) ? J(r.base ? Y(r.base) : {}, e[t], r.transform) : n;
|
|
1705
1705
|
};
|
|
1706
|
-
function
|
|
1707
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : $t(), t = (e) =>
|
|
1708
|
-
if (t.version = "3.4.
|
|
1706
|
+
function rn() {
|
|
1707
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : $t(), t = (e) => rn(e);
|
|
1708
|
+
if (t.version = "3.4.12", t.removed = [], !e || !e.document || e.document.nodeType !== Z.document || !e.Element) return t.isSupported = !1, t;
|
|
1709
1709
|
let n = e.document, r = n, i = r.currentScript;
|
|
1710
1710
|
e.DocumentFragment;
|
|
1711
1711
|
let a = e.HTMLTemplateElement, o = e.Node, s = e.Element, c = e.NodeFilter;
|
|
1712
1712
|
e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
|
|
1713
|
-
let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f =
|
|
1713
|
+
let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = X(d, "cloneNode"), p = X(d, "remove"), m = X(d, "nextSibling"), h = X(d, "childNodes"), ee = X(d, "parentNode"), te = X(d, "shadowRoot"), ne = X(d, "attributes"), g = o && o.prototype ? X(o.prototype, "nodeType") : null, _ = o && o.prototype ? X(o.prototype, "nodeName") : null;
|
|
1714
1714
|
if (typeof a == "function") {
|
|
1715
1715
|
let e = n.createElement("template");
|
|
1716
1716
|
e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
|
|
1717
1717
|
}
|
|
1718
1718
|
let v, y = "", re, ie = !1, ae = 0, oe = function() {
|
|
1719
|
-
if (ae > 0) throw
|
|
1719
|
+
if (ae > 0) throw Ct("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
|
|
1720
1720
|
}, se = function(e) {
|
|
1721
1721
|
oe(), ae++;
|
|
1722
1722
|
try {
|
|
@@ -1735,13 +1735,13 @@ function nn() {
|
|
|
1735
1735
|
return ie ||= (re = en(u, i), !0), re;
|
|
1736
1736
|
}, ue = n, de = ue.implementation, fe = ue.createNodeIterator, pe = ue.createDocumentFragment, me = ue.getElementsByTagName, he = r.importNode, b = tn();
|
|
1737
1737
|
t.isSupported = typeof et == "function" && typeof ee == "function" && de && de.createHTMLDocument !== void 0;
|
|
1738
|
-
let ge = zt, _e = Bt, ve = Vt, ye = Ht, be = Ut, xe = Gt, Se = Kt, Ce = Jt, we = Wt, x = null, Te =
|
|
1738
|
+
let ge = zt, _e = Bt, ve = Vt, ye = Ht, be = Ut, xe = Gt, Se = Kt, Ce = Jt, we = Wt, x = null, Te = J({}, [
|
|
1739
1739
|
...Ot,
|
|
1740
1740
|
...kt,
|
|
1741
1741
|
...At,
|
|
1742
1742
|
...Mt,
|
|
1743
1743
|
...Pt
|
|
1744
|
-
]), S = null, Ee =
|
|
1744
|
+
]), S = null, Ee = J({}, [
|
|
1745
1745
|
...Ft,
|
|
1746
1746
|
...It,
|
|
1747
1747
|
...Lt,
|
|
@@ -1778,14 +1778,14 @@ function nn() {
|
|
|
1778
1778
|
enumerable: !0,
|
|
1779
1779
|
value: null
|
|
1780
1780
|
}
|
|
1781
|
-
})), ke = !0, Ae = !0, je = !1, Me = !0, T = !1,
|
|
1781
|
+
})), ke = !0, Ae = !0, je = !1, Me = !0, T = !1, E = !0, D = !1, Ne = !1, Pe = null, Fe = null, Ie = !1, O = !1, Le = !1, k = !1, Re = !0, ze = !1, Be = "user-content-", A = !0, Ve = !1, j = {}, M = null, He = J({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), Ue = null, We = J({}, [
|
|
1782
1782
|
"audio",
|
|
1783
1783
|
"video",
|
|
1784
1784
|
"img",
|
|
1785
1785
|
"source",
|
|
1786
1786
|
"image",
|
|
1787
1787
|
"track"
|
|
1788
|
-
]),
|
|
1788
|
+
]), Ge = null, Ke = J({}, [
|
|
1789
1789
|
"alt",
|
|
1790
1790
|
"class",
|
|
1791
1791
|
"for",
|
|
@@ -1800,42 +1800,42 @@ function nn() {
|
|
|
1800
1800
|
"value",
|
|
1801
1801
|
"style",
|
|
1802
1802
|
"xmlns"
|
|
1803
|
-
]),
|
|
1804
|
-
N,
|
|
1803
|
+
]), qe = "http://www.w3.org/1998/Math/MathML", N = "http://www.w3.org/2000/svg", P = "http://www.w3.org/1999/xhtml", F = P, I = !1, L = null, R = J({}, [
|
|
1805
1804
|
qe,
|
|
1805
|
+
N,
|
|
1806
1806
|
P
|
|
1807
|
-
], mt),
|
|
1807
|
+
], mt), z = V([
|
|
1808
1808
|
"mi",
|
|
1809
1809
|
"mo",
|
|
1810
1810
|
"mn",
|
|
1811
1811
|
"ms",
|
|
1812
1812
|
"mtext"
|
|
1813
|
-
]),
|
|
1813
|
+
]), Je = J({}, z), Ye = V(["annotation-xml"]), Xe = J({}, Ye), Ze = J({}, [
|
|
1814
1814
|
"title",
|
|
1815
1815
|
"style",
|
|
1816
1816
|
"font",
|
|
1817
1817
|
"a",
|
|
1818
1818
|
"script"
|
|
1819
|
-
]),
|
|
1819
|
+
]), Qe = null, $e = ["application/xhtml+xml", "text/html"], B = null, tt = null, nt = n.createElement("form"), rt = function(e) {
|
|
1820
1820
|
return e instanceof RegExp || e instanceof Function;
|
|
1821
|
-
},
|
|
1821
|
+
}, at = function() {
|
|
1822
1822
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1823
|
-
if (
|
|
1824
|
-
(!e || typeof e != "object") && (e = {}), e =
|
|
1825
|
-
transform:
|
|
1826
|
-
base:
|
|
1827
|
-
}),
|
|
1828
|
-
transform:
|
|
1829
|
-
base:
|
|
1830
|
-
}),
|
|
1831
|
-
let t =
|
|
1832
|
-
if (C = it(null),
|
|
1823
|
+
if (tt && tt === e) return;
|
|
1824
|
+
(!e || typeof e != "object") && (e = {}), e = Y(e), Qe = $e.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, B = Qe === "application/xhtml+xml" ? mt : pt, x = nn(e, "ALLOWED_TAGS", Te, { transform: B }), S = nn(e, "ALLOWED_ATTR", Ee, { transform: B }), L = nn(e, "ALLOWED_NAMESPACES", R, { transform: mt }), Ge = nn(e, "ADD_URI_SAFE_ATTR", Ke, {
|
|
1825
|
+
transform: B,
|
|
1826
|
+
base: Ke
|
|
1827
|
+
}), Ue = nn(e, "ADD_DATA_URI_TAGS", We, {
|
|
1828
|
+
transform: B,
|
|
1829
|
+
base: We
|
|
1830
|
+
}), M = nn(e, "FORBID_CONTENTS", He, { transform: B }), De = nn(e, "FORBID_TAGS", Y({}), { transform: B }), Oe = nn(e, "FORBID_ATTR", Y({}), { transform: B }), j = W(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? Y(e.USE_PROFILES) : e.USE_PROFILES : !1, ke = e.ALLOW_ARIA_ATTR !== !1, Ae = e.ALLOW_DATA_ATTR !== !1, je = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Me = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, T = e.SAFE_FOR_TEMPLATES || !1, E = e.SAFE_FOR_XML !== !1, D = e.WHOLE_DOCUMENT || !1, O = e.RETURN_DOM || !1, Le = e.RETURN_DOM_FRAGMENT || !1, k = e.RETURN_TRUSTED_TYPE || !1, Ie = e.FORCE_BODY || !1, Re = e.SANITIZE_DOM !== !1, ze = e.SANITIZE_NAMED_PROPS || !1, A = e.KEEP_CONTENT !== !1, Ve = e.IN_PLACE || !1, we = Dt(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : Wt, F = typeof e.NAMESPACE == "string" ? e.NAMESPACE : P, Je = W(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? Y(e.MATHML_TEXT_INTEGRATION_POINTS) : J({}, z), Xe = W(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? Y(e.HTML_INTEGRATION_POINTS) : J({}, Ye);
|
|
1831
|
+
let t = W(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? Y(e.CUSTOM_ELEMENT_HANDLING) : it(null);
|
|
1832
|
+
if (C = it(null), W(t, "tagNameCheck") && rt(t.tagNameCheck) && (C.tagNameCheck = t.tagNameCheck), W(t, "attributeNameCheck") && rt(t.attributeNameCheck) && (C.attributeNameCheck = t.attributeNameCheck), W(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (C.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), H(C), T && (Ae = !1), Le && (O = !0), j && (x = J({}, Pt), S = it(null), j.html === !0 && (J(x, Ot), J(S, Ft)), j.svg === !0 && (J(x, kt), J(S, It), J(S, Rt)), j.svgFilters === !0 && (J(x, At), J(S, It), J(S, Rt)), j.mathMl === !0 && (J(x, Mt), J(S, Lt), J(S, Rt))), w.tagCheck = null, w.attributeCheck = null, W(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? w.tagCheck = e.ADD_TAGS : U(e.ADD_TAGS) && (x === Te && (x = Y(x)), J(x, e.ADD_TAGS, B))), W(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? w.attributeCheck = e.ADD_ATTR : U(e.ADD_ATTR) && (S === Ee && (S = Y(S)), J(S, e.ADD_ATTR, B))), W(e, "ADD_URI_SAFE_ATTR") && U(e.ADD_URI_SAFE_ATTR) && J(Ge, e.ADD_URI_SAFE_ATTR, B), W(e, "FORBID_CONTENTS") && U(e.FORBID_CONTENTS) && (M === He && (M = Y(M)), J(M, e.FORBID_CONTENTS, B)), W(e, "ADD_FORBID_CONTENTS") && U(e.ADD_FORBID_CONTENTS) && (M === He && (M = Y(M)), J(M, e.ADD_FORBID_CONTENTS, B)), A && (x["#text"] = !0), D && J(x, [
|
|
1833
1833
|
"html",
|
|
1834
1834
|
"head",
|
|
1835
1835
|
"body"
|
|
1836
|
-
]), x.table && (
|
|
1837
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw
|
|
1838
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw
|
|
1836
|
+
]), x.table && (J(x, ["tbody"]), delete De.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
1837
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw Ct("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
1838
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw Ct("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
1839
1839
|
let t = v;
|
|
1840
1840
|
v = e.TRUSTED_TYPES_POLICY;
|
|
1841
1841
|
try {
|
|
@@ -1844,33 +1844,34 @@ function nn() {
|
|
|
1844
1844
|
throw v = t, e;
|
|
1845
1845
|
}
|
|
1846
1846
|
} else e.TRUSTED_TYPES_POLICY === null ? (v = void 0, y = "") : (v === void 0 && (v = le()), v && typeof y == "string" && (y = se("")));
|
|
1847
|
-
|
|
1848
|
-
},
|
|
1847
|
+
V && V(e), tt = e;
|
|
1848
|
+
}, ot = J({}, [
|
|
1849
1849
|
...kt,
|
|
1850
1850
|
...At,
|
|
1851
1851
|
...jt
|
|
1852
|
-
]),
|
|
1853
|
-
return t.namespaceURI === P ? e === "svg" : t.namespaceURI ===
|
|
1854
|
-
},
|
|
1855
|
-
return t.namespaceURI === P ? e === "math" : t.namespaceURI ===
|
|
1856
|
-
},
|
|
1857
|
-
return t.namespaceURI ===
|
|
1858
|
-
},
|
|
1852
|
+
]), st = J({}, [...Mt, ...Nt]), yt = function(e, t, n) {
|
|
1853
|
+
return t.namespaceURI === P ? e === "svg" : t.namespaceURI === qe ? e === "svg" && (n === "annotation-xml" || Je[n]) : !!ot[e];
|
|
1854
|
+
}, bt = function(e, t, n) {
|
|
1855
|
+
return t.namespaceURI === P ? e === "math" : t.namespaceURI === N ? e === "math" && Xe[n] : !!st[e];
|
|
1856
|
+
}, xt = function(e, t, n) {
|
|
1857
|
+
return t.namespaceURI === N && !Xe[n] || t.namespaceURI === qe && !Je[n] ? !1 : !st[e] && (Ze[e] || !ot[e]);
|
|
1858
|
+
}, St = function(e) {
|
|
1859
1859
|
let t = ee(e);
|
|
1860
1860
|
(!t || !t.tagName) && (t = {
|
|
1861
1861
|
namespaceURI: F,
|
|
1862
1862
|
tagName: "template"
|
|
1863
1863
|
});
|
|
1864
1864
|
let n = pt(e.tagName), r = pt(t.tagName);
|
|
1865
|
-
return L[e.namespaceURI] ? e.namespaceURI ===
|
|
1865
|
+
return L[e.namespaceURI] ? e.namespaceURI === N ? yt(n, t, r) : e.namespaceURI === qe ? bt(n, t, r) : e.namespaceURI === P ? xt(n, t, r) : !!(Qe === "application/xhtml+xml" && L[e.namespaceURI]) : !1;
|
|
1866
1866
|
}, G = function(e) {
|
|
1867
1867
|
dt(t.removed, { element: e });
|
|
1868
1868
|
try {
|
|
1869
1869
|
ee(e).removeChild(e);
|
|
1870
1870
|
} catch {
|
|
1871
|
-
if (p(e), !ee(e)) throw
|
|
1871
|
+
if (p(e), !ee(e)) throw Ct("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
1872
1872
|
}
|
|
1873
|
-
},
|
|
1873
|
+
}, q = function(e) {
|
|
1874
|
+
an(e);
|
|
1874
1875
|
let t = h(e);
|
|
1875
1876
|
if (t) {
|
|
1876
1877
|
let e = [];
|
|
@@ -1889,7 +1890,7 @@ function nn() {
|
|
|
1889
1890
|
e.removeAttribute(i);
|
|
1890
1891
|
} catch {}
|
|
1891
1892
|
}
|
|
1892
|
-
},
|
|
1893
|
+
}, wt = function(e, n) {
|
|
1893
1894
|
try {
|
|
1894
1895
|
dt(t.removed, {
|
|
1895
1896
|
attribute: n.getAttributeNode(e),
|
|
@@ -1901,39 +1902,59 @@ function nn() {
|
|
|
1901
1902
|
from: n
|
|
1902
1903
|
});
|
|
1903
1904
|
}
|
|
1904
|
-
if (n.removeAttribute(e), e === "is") if (
|
|
1905
|
+
if (n.removeAttribute(e), e === "is") if (O || Le) try {
|
|
1905
1906
|
G(n);
|
|
1906
1907
|
} catch {}
|
|
1907
1908
|
else try {
|
|
1908
1909
|
n.setAttribute(e, "");
|
|
1909
1910
|
} catch {}
|
|
1910
|
-
},
|
|
1911
|
+
}, Tt = function(e) {
|
|
1911
1912
|
let t = ne(e);
|
|
1912
1913
|
if (t) for (let n = t.length - 1; n >= 0; --n) {
|
|
1913
1914
|
let r = t[n], i = r && r.name;
|
|
1914
|
-
if (!(typeof i != "string" || S[
|
|
1915
|
+
if (!(typeof i != "string" || S[B(i)])) try {
|
|
1915
1916
|
e.removeAttribute(i);
|
|
1916
1917
|
} catch {}
|
|
1917
1918
|
}
|
|
1918
|
-
},
|
|
1919
|
+
}, an = function(e) {
|
|
1919
1920
|
let t = [e];
|
|
1920
1921
|
for (; t.length > 0;) {
|
|
1921
1922
|
let e = t.pop();
|
|
1922
|
-
(g ? g(e) : e.nodeType) ===
|
|
1923
|
+
(g ? g(e) : e.nodeType) === Z.element && Tt(e);
|
|
1923
1924
|
let n = h(e);
|
|
1924
1925
|
if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
|
|
1925
1926
|
}
|
|
1926
|
-
},
|
|
1927
|
+
}, Q = function(e) {
|
|
1928
|
+
if (!E) return;
|
|
1929
|
+
let t = [e];
|
|
1930
|
+
for (; t.length > 0;) {
|
|
1931
|
+
let e = t.pop(), n = g ? g(e) : e.nodeType;
|
|
1932
|
+
if (n === Z.processingInstruction || n === Z.comment && K(Xt, e.data)) {
|
|
1933
|
+
try {
|
|
1934
|
+
p(e);
|
|
1935
|
+
} catch {}
|
|
1936
|
+
continue;
|
|
1937
|
+
}
|
|
1938
|
+
if (n === Z.element) {
|
|
1939
|
+
let t = e, n = B(_ ? _(e) : e.nodeName);
|
|
1940
|
+
try {
|
|
1941
|
+
t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && n !== "label" && n !== "output" && t.removeAttribute("for");
|
|
1942
|
+
} catch {}
|
|
1943
|
+
}
|
|
1944
|
+
let r = h(e);
|
|
1945
|
+
if (r) for (let e = r.length - 1; e >= 0; --e) t.push(r[e]);
|
|
1946
|
+
}
|
|
1947
|
+
}, on = function(e) {
|
|
1927
1948
|
let t = null, r = null;
|
|
1928
|
-
if (
|
|
1949
|
+
if (Ie) e = "<remove></remove>" + e;
|
|
1929
1950
|
else {
|
|
1930
1951
|
let t = ht(e, /^[\r\n\t ]+/);
|
|
1931
1952
|
r = t && t[0];
|
|
1932
1953
|
}
|
|
1933
|
-
|
|
1954
|
+
Qe === "application/xhtml+xml" && F === P && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
|
|
1934
1955
|
let i = v ? se(e) : e;
|
|
1935
1956
|
if (F === P) try {
|
|
1936
|
-
t = new l().parseFromString(i,
|
|
1957
|
+
t = new l().parseFromString(i, Qe);
|
|
1937
1958
|
} catch {}
|
|
1938
1959
|
if (!t || !t.documentElement) {
|
|
1939
1960
|
t = de.createDocument(F, "template", null);
|
|
@@ -1942,30 +1963,30 @@ function nn() {
|
|
|
1942
1963
|
} catch {}
|
|
1943
1964
|
}
|
|
1944
1965
|
let a = t.body || t.documentElement;
|
|
1945
|
-
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), F === P ? me.call(t,
|
|
1946
|
-
}, on = function(e) {
|
|
1947
|
-
return fe.call(e.ownerDocument || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
|
|
1966
|
+
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), F === P ? me.call(t, D ? "html" : "body")[0] : D ? t.documentElement : a;
|
|
1948
1967
|
}, sn = function(e) {
|
|
1949
|
-
return e
|
|
1968
|
+
return fe.call(e.ownerDocument || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
|
|
1950
1969
|
}, cn = function(e) {
|
|
1970
|
+
return e = gt(e, ge, " "), e = gt(e, _e, " "), e = gt(e, ve, " "), e;
|
|
1971
|
+
}, ln = function(e) {
|
|
1951
1972
|
e.normalize();
|
|
1952
1973
|
let t = fe.call(e.ownerDocument || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), n = t.nextNode();
|
|
1953
|
-
for (; n;) n.data =
|
|
1974
|
+
for (; n;) n.data = cn(n.data), n = t.nextNode();
|
|
1954
1975
|
let r = e.querySelectorAll?.call(e, "template");
|
|
1955
1976
|
r && ct(r, (e) => {
|
|
1956
|
-
|
|
1977
|
+
dn(e.content) && ln(e.content);
|
|
1957
1978
|
});
|
|
1958
|
-
}, ln = function(e) {
|
|
1959
|
-
let t = _ ? _(e) : null;
|
|
1960
|
-
return typeof t != "string" || R(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== ne(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== g(e) || e.childNodes !== h(e);
|
|
1961
1979
|
}, un = function(e) {
|
|
1980
|
+
let t = _ ? _(e) : null;
|
|
1981
|
+
return typeof t != "string" || B(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== ne(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== g(e) || e.childNodes !== h(e);
|
|
1982
|
+
}, dn = function(e) {
|
|
1962
1983
|
if (!g || typeof e != "object" || !e) return !1;
|
|
1963
1984
|
try {
|
|
1964
|
-
return g(e) ===
|
|
1985
|
+
return g(e) === Z.documentFragment;
|
|
1965
1986
|
} catch {
|
|
1966
1987
|
return !1;
|
|
1967
1988
|
}
|
|
1968
|
-
},
|
|
1989
|
+
}, fn = function(e) {
|
|
1969
1990
|
if (!g || typeof e != "object" || !e) return !1;
|
|
1970
1991
|
try {
|
|
1971
1992
|
return typeof g(e) == "number";
|
|
@@ -1975,48 +1996,53 @@ function nn() {
|
|
|
1975
1996
|
};
|
|
1976
1997
|
function $(e, n, r) {
|
|
1977
1998
|
e.length !== 0 && ct(e, (e) => {
|
|
1978
|
-
e.call(t, n, r,
|
|
1999
|
+
e.call(t, n, r, tt);
|
|
1979
2000
|
});
|
|
1980
2001
|
}
|
|
1981
|
-
let
|
|
1982
|
-
return !!(
|
|
1983
|
-
},
|
|
1984
|
-
if (!De[t] &&
|
|
1985
|
-
if (
|
|
2002
|
+
let pn = function(e, t) {
|
|
2003
|
+
return !!(E && e.hasChildNodes() && !fn(e.firstElementChild) && K(Yt, e.textContent) && K(Yt, e.innerHTML) || E && e.namespaceURI === P && t === "style" && fn(e.firstElementChild) || e.nodeType === Z.processingInstruction || E && e.nodeType === Z.comment && K(Xt, e.data));
|
|
2004
|
+
}, mn = function(e, t) {
|
|
2005
|
+
if (!De[t] && vn(t) && (C.tagNameCheck instanceof RegExp && K(C.tagNameCheck, t) || C.tagNameCheck instanceof Function && C.tagNameCheck(t))) return !1;
|
|
2006
|
+
if (A && !M[t]) {
|
|
1986
2007
|
let t = ee(e), n = h(e);
|
|
1987
2008
|
if (n && t) {
|
|
1988
2009
|
let r = n.length;
|
|
1989
2010
|
for (let i = r - 1; i >= 0; --i) {
|
|
1990
|
-
let r =
|
|
2011
|
+
let r = Ve ? n[i] : f(n[i], !0);
|
|
1991
2012
|
t.insertBefore(r, m(e));
|
|
1992
2013
|
}
|
|
1993
2014
|
}
|
|
1994
2015
|
}
|
|
1995
2016
|
return G(e), !0;
|
|
1996
|
-
},
|
|
1997
|
-
if ($(b.beforeSanitizeElements, e, null),
|
|
1998
|
-
|
|
2017
|
+
}, hn = function(e, n) {
|
|
2018
|
+
if ($(b.beforeSanitizeElements, e, null), e !== n && ee(e) === null) return !0;
|
|
2019
|
+
if (un(e)) return G(e), !0;
|
|
2020
|
+
let r = B(_ ? _(e) : e.nodeName);
|
|
1999
2021
|
if ($(b.uponSanitizeElement, e, {
|
|
2000
|
-
tagName:
|
|
2022
|
+
tagName: r,
|
|
2001
2023
|
allowedTags: x
|
|
2002
|
-
}),
|
|
2003
|
-
if (
|
|
2004
|
-
if (
|
|
2005
|
-
|
|
2006
|
-
|
|
2024
|
+
}), e !== n && ee(e) === null) return !0;
|
|
2025
|
+
if (pn(e, r)) return G(e), !0;
|
|
2026
|
+
if (De[r] || !(w.tagCheck instanceof Function && w.tagCheck(r)) && !x[r]) {
|
|
2027
|
+
let t = mn(e, r);
|
|
2028
|
+
return t === !1 && $(b.afterSanitizeElements, e, null), t;
|
|
2029
|
+
}
|
|
2030
|
+
if ((g ? g(e) : e.nodeType) === Z.element && !St(e) || (r === "noscript" || r === "noembed" || r === "noframes") && K(Zt, e.innerHTML)) return G(e), !0;
|
|
2031
|
+
if (T && e.nodeType === Z.text) {
|
|
2032
|
+
let n = cn(e.textContent);
|
|
2007
2033
|
e.textContent !== n && (dt(t.removed, { element: e.cloneNode() }), e.textContent = n);
|
|
2008
2034
|
}
|
|
2009
2035
|
return $(b.afterSanitizeElements, e, null), !1;
|
|
2010
|
-
},
|
|
2011
|
-
if (Oe[t] ||
|
|
2036
|
+
}, gn = function(e, t, r) {
|
|
2037
|
+
if (Oe[t] || E && t === "patchsrc" || E && t === "for" && e !== "label" && e !== "output" || Re && (t === "id" || t === "name") && (r in n || r in nt)) return !1;
|
|
2012
2038
|
let i = S[t] || w.attributeCheck instanceof Function && w.attributeCheck(t, e);
|
|
2013
|
-
if (!(Ae &&
|
|
2039
|
+
if (!(Ae && K(ye, t)) && !(ke && K(be, t))) {
|
|
2014
2040
|
if (!i) {
|
|
2015
|
-
if (!(
|
|
2016
|
-
} else if (!
|
|
2041
|
+
if (!(vn(e) && (C.tagNameCheck instanceof RegExp && K(C.tagNameCheck, e) || C.tagNameCheck instanceof Function && C.tagNameCheck(e)) && (C.attributeNameCheck instanceof RegExp && K(C.attributeNameCheck, t) || C.attributeNameCheck instanceof Function && C.attributeNameCheck(t, e)) || t === "is" && C.allowCustomizedBuiltInElements && (C.tagNameCheck instanceof RegExp && K(C.tagNameCheck, r) || C.tagNameCheck instanceof Function && C.tagNameCheck(r)))) return !1;
|
|
2042
|
+
} else if (!Ge[t] && !K(we, gt(r, Se, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && _t(r, "data:") === 0 && Ue[e]) && !(je && !K(xe, gt(r, Se, ""))) && r) return !1;
|
|
2017
2043
|
}
|
|
2018
2044
|
return !0;
|
|
2019
|
-
},
|
|
2045
|
+
}, _n = J({}, [
|
|
2020
2046
|
"annotation-xml",
|
|
2021
2047
|
"color-profile",
|
|
2022
2048
|
"font-face",
|
|
@@ -2025,66 +2051,66 @@ function nn() {
|
|
|
2025
2051
|
"font-face-src",
|
|
2026
2052
|
"font-face-uri",
|
|
2027
2053
|
"missing-glyph"
|
|
2028
|
-
]),
|
|
2029
|
-
return !
|
|
2030
|
-
},
|
|
2054
|
+
]), vn = function(e) {
|
|
2055
|
+
return !_n[pt(e)] && K(Ce, e);
|
|
2056
|
+
}, yn = function(e, t, n, r) {
|
|
2031
2057
|
if (v && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
|
|
2032
2058
|
case "TrustedHTML": return se(r);
|
|
2033
2059
|
case "TrustedScriptURL": return ce(r);
|
|
2034
2060
|
}
|
|
2035
2061
|
return r;
|
|
2036
|
-
},
|
|
2062
|
+
}, bn = function(e, n, r, i) {
|
|
2037
2063
|
try {
|
|
2038
|
-
r ? e.setAttributeNS(r, n, i) : e.setAttribute(n, i),
|
|
2064
|
+
r ? e.setAttributeNS(r, n, i) : e.setAttribute(n, i), un(e) ? G(e) : ut(t.removed);
|
|
2039
2065
|
} catch {
|
|
2040
|
-
|
|
2066
|
+
wt(n, e);
|
|
2041
2067
|
}
|
|
2042
|
-
},
|
|
2068
|
+
}, xn = function(e) {
|
|
2043
2069
|
$(b.beforeSanitizeAttributes, e, null);
|
|
2044
2070
|
let t = e.attributes;
|
|
2045
|
-
if (!t ||
|
|
2071
|
+
if (!t || un(e)) return;
|
|
2046
2072
|
let n = {
|
|
2047
2073
|
attrName: "",
|
|
2048
2074
|
attrValue: "",
|
|
2049
2075
|
keepAttr: !0,
|
|
2050
2076
|
allowedAttributes: S,
|
|
2051
2077
|
forceKeepAttr: void 0
|
|
2052
|
-
}, r = t.length, i =
|
|
2078
|
+
}, r = t.length, i = B(e.nodeName);
|
|
2053
2079
|
for (; r--;) {
|
|
2054
|
-
let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, l =
|
|
2055
|
-
if (n.attrName = l, n.attrValue = d, n.keepAttr = !0, n.forceKeepAttr = void 0, $(b.uponSanitizeAttribute, e, n), d = n.attrValue,
|
|
2056
|
-
|
|
2080
|
+
let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, l = B(o), u = c, d = o === "value" ? u : vt(u);
|
|
2081
|
+
if (n.attrName = l, n.attrValue = d, n.keepAttr = !0, n.forceKeepAttr = void 0, $(b.uponSanitizeAttribute, e, n), d = n.attrValue, ze && (l === "id" || l === "name") && _t(d, Be) !== 0 && (wt(o, e), d = Be + d), E && K(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, d)) {
|
|
2082
|
+
wt(o, e);
|
|
2057
2083
|
continue;
|
|
2058
2084
|
}
|
|
2059
2085
|
if (l === "attributename" && ht(d, "href")) {
|
|
2060
|
-
|
|
2086
|
+
wt(o, e);
|
|
2061
2087
|
continue;
|
|
2062
2088
|
}
|
|
2063
2089
|
if (!n.forceKeepAttr) {
|
|
2064
2090
|
if (!n.keepAttr) {
|
|
2065
|
-
|
|
2091
|
+
wt(o, e);
|
|
2066
2092
|
continue;
|
|
2067
2093
|
}
|
|
2068
|
-
if (!Me &&
|
|
2069
|
-
|
|
2094
|
+
if (!Me && K(Qt, d)) {
|
|
2095
|
+
wt(o, e);
|
|
2070
2096
|
continue;
|
|
2071
2097
|
}
|
|
2072
|
-
if (T && (d =
|
|
2073
|
-
|
|
2098
|
+
if (T && (d = cn(d)), !gn(i, l, d)) {
|
|
2099
|
+
wt(o, e);
|
|
2074
2100
|
continue;
|
|
2075
2101
|
}
|
|
2076
|
-
d =
|
|
2102
|
+
d = yn(i, l, s, d), d !== u && bn(e, o, s, d);
|
|
2077
2103
|
}
|
|
2078
2104
|
}
|
|
2079
2105
|
$(b.afterSanitizeAttributes, e, null);
|
|
2080
|
-
},
|
|
2081
|
-
let t = null, n =
|
|
2082
|
-
for ($(b.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if ($(b.uponSanitizeShadowNode, t, null),
|
|
2106
|
+
}, Sn = function(e) {
|
|
2107
|
+
let t = null, n = sn(e);
|
|
2108
|
+
for ($(b.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if ($(b.uponSanitizeShadowNode, t, null), hn(t, e), xn(t), dn(t.content) && Sn(t.content), (g ? g(t) : t.nodeType) === Z.element) {
|
|
2083
2109
|
let e = te(t);
|
|
2084
|
-
|
|
2110
|
+
dn(e) && (Cn(e), Sn(e));
|
|
2085
2111
|
}
|
|
2086
2112
|
$(b.afterSanitizeShadowDOM, e, null);
|
|
2087
|
-
},
|
|
2113
|
+
}, Cn = function(e) {
|
|
2088
2114
|
let t = [{
|
|
2089
2115
|
node: e,
|
|
2090
2116
|
shadow: null
|
|
@@ -2092,19 +2118,19 @@ function nn() {
|
|
|
2092
2118
|
for (; t.length > 0;) {
|
|
2093
2119
|
let e = t.pop();
|
|
2094
2120
|
if (e.shadow) {
|
|
2095
|
-
|
|
2121
|
+
Sn(e.shadow);
|
|
2096
2122
|
continue;
|
|
2097
2123
|
}
|
|
2098
|
-
let n = e.node, r = (g ? g(n) : n.nodeType) ===
|
|
2124
|
+
let n = e.node, r = (g ? g(n) : n.nodeType) === Z.element, i = h(n);
|
|
2099
2125
|
if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
|
|
2100
2126
|
node: i[e],
|
|
2101
2127
|
shadow: null
|
|
2102
2128
|
});
|
|
2103
2129
|
if (r) {
|
|
2104
2130
|
let e = _ ? _(n) : null;
|
|
2105
|
-
if (typeof e == "string" &&
|
|
2131
|
+
if (typeof e == "string" && B(e) === "template") {
|
|
2106
2132
|
let e = n.content;
|
|
2107
|
-
|
|
2133
|
+
dn(e) && t.push({
|
|
2108
2134
|
node: e,
|
|
2109
2135
|
shadow: null
|
|
2110
2136
|
});
|
|
@@ -2112,7 +2138,7 @@ function nn() {
|
|
|
2112
2138
|
}
|
|
2113
2139
|
if (r) {
|
|
2114
2140
|
let e = te(n);
|
|
2115
|
-
|
|
2141
|
+
dn(e) && t.push({
|
|
2116
2142
|
node: null,
|
|
2117
2143
|
shadow: e
|
|
2118
2144
|
}, {
|
|
@@ -2124,54 +2150,60 @@ function nn() {
|
|
|
2124
2150
|
};
|
|
2125
2151
|
return t.sanitize = function(e) {
|
|
2126
2152
|
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
|
|
2127
|
-
if (I = !e, I && (e = "<!-->"), typeof e != "string" && !
|
|
2153
|
+
if (I = !e, I && (e = "<!-->"), typeof e != "string" && !fn(e) && (e = Et(e), typeof e != "string")) throw Ct("dirty is not a string, aborting");
|
|
2128
2154
|
if (!t.isSupported) return e;
|
|
2129
|
-
|
|
2130
|
-
let c =
|
|
2155
|
+
Ne ? (x = Pe, S = Fe) : at(n), (b.uponSanitizeElement.length > 0 || b.uponSanitizeAttribute.length > 0) && (x = Y(x)), b.uponSanitizeAttribute.length > 0 && (S = Y(S)), t.removed = [];
|
|
2156
|
+
let c = Ve && typeof e != "string" && fn(e);
|
|
2131
2157
|
if (c) {
|
|
2158
|
+
Q(e);
|
|
2132
2159
|
let t = _ ? _(e) : e.nodeName;
|
|
2133
2160
|
if (typeof t == "string") {
|
|
2134
|
-
let
|
|
2135
|
-
if (!x[
|
|
2161
|
+
let n = B(t);
|
|
2162
|
+
if (!x[n] || De[n]) throw q(e), Ct("root node is forbidden and cannot be sanitized in-place");
|
|
2136
2163
|
}
|
|
2137
|
-
if (
|
|
2164
|
+
if (un(e)) throw q(e), Ct("root node is clobbered and cannot be sanitized in-place");
|
|
2138
2165
|
try {
|
|
2139
|
-
|
|
2166
|
+
Cn(e);
|
|
2140
2167
|
} catch (t) {
|
|
2141
|
-
throw
|
|
2168
|
+
throw q(e), t;
|
|
2142
2169
|
}
|
|
2143
|
-
} else if (
|
|
2170
|
+
} else if (fn(e)) i = on("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === Z.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Cn(a);
|
|
2144
2171
|
else {
|
|
2145
|
-
if (!
|
|
2146
|
-
if (i =
|
|
2172
|
+
if (!O && !T && !D && e.indexOf("<") === -1) return v && k ? se(e) : e;
|
|
2173
|
+
if (i = on(e), !i) return O ? null : k ? y : "";
|
|
2147
2174
|
}
|
|
2148
|
-
i &&
|
|
2149
|
-
let l =
|
|
2175
|
+
i && Ie && G(i.firstChild);
|
|
2176
|
+
let l = c ? e : i, u = sn(l);
|
|
2150
2177
|
try {
|
|
2151
|
-
for (; o =
|
|
2152
|
-
} catch (
|
|
2153
|
-
throw c &&
|
|
2178
|
+
for (; o = u.nextNode();) hn(o, l), xn(o), dn(o.content) && Sn(o.content);
|
|
2179
|
+
} catch (n) {
|
|
2180
|
+
throw c && (q(e), ct(t.removed, (e) => {
|
|
2181
|
+
e.element && an(e.element);
|
|
2182
|
+
})), n;
|
|
2154
2183
|
}
|
|
2155
2184
|
if (c) return ct(t.removed, (e) => {
|
|
2156
|
-
e.element &&
|
|
2157
|
-
}), T &&
|
|
2158
|
-
if (
|
|
2159
|
-
if (T &&
|
|
2185
|
+
e.element && an(e.element);
|
|
2186
|
+
}), T && ln(e), e;
|
|
2187
|
+
if (O) {
|
|
2188
|
+
if (T && ln(i), Le) for (s = pe.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
|
|
2160
2189
|
else s = i;
|
|
2161
2190
|
return (S.shadowroot || S.shadowrootmode) && (s = he.call(r, s, !0)), s;
|
|
2162
2191
|
}
|
|
2163
|
-
let
|
|
2164
|
-
return
|
|
2192
|
+
let d = D ? i.outerHTML : i.innerHTML;
|
|
2193
|
+
return D && x["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && K(qt, i.ownerDocument.doctype.name) && (d = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + d), T && (d = cn(d)), v && k ? se(d) : d;
|
|
2165
2194
|
}, t.setConfig = function() {
|
|
2166
|
-
|
|
2195
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2196
|
+
at(e), Ne = !0, Pe = x, Fe = S;
|
|
2167
2197
|
}, t.clearConfig = function() {
|
|
2168
|
-
|
|
2198
|
+
tt = null, Ne = !1, Pe = null, Fe = null, v = re, y = "";
|
|
2169
2199
|
}, t.isValidAttribute = function(e, t, n) {
|
|
2170
|
-
|
|
2200
|
+
tt || at({});
|
|
2201
|
+
let r = B(e), i = B(t);
|
|
2202
|
+
return gn(r, i, n);
|
|
2171
2203
|
}, t.addHook = function(e, t) {
|
|
2172
|
-
typeof t == "function" &&
|
|
2204
|
+
typeof t == "function" && W(b, e) && dt(b[e], t);
|
|
2173
2205
|
}, t.removeHook = function(e, t) {
|
|
2174
|
-
if (
|
|
2206
|
+
if (W(b, e)) {
|
|
2175
2207
|
if (t !== void 0) {
|
|
2176
2208
|
let n = lt(b[e], t);
|
|
2177
2209
|
return n === -1 ? void 0 : ft(b[e], n, 1)[0];
|
|
@@ -2179,12 +2211,12 @@ function nn() {
|
|
|
2179
2211
|
return ut(b[e]);
|
|
2180
2212
|
}
|
|
2181
2213
|
}, t.removeHooks = function(e) {
|
|
2182
|
-
|
|
2214
|
+
W(b, e) && (b[e] = []);
|
|
2183
2215
|
}, t.removeAllHooks = function() {
|
|
2184
2216
|
b = tn();
|
|
2185
2217
|
}, t;
|
|
2186
2218
|
}
|
|
2187
|
-
var
|
|
2219
|
+
var an = rn(), Q = class {
|
|
2188
2220
|
constructor(e, t) {
|
|
2189
2221
|
this.editor = e, this.defaultText = `${t} text`, this.button = this.createButton(), this.title = t;
|
|
2190
2222
|
}
|
|
@@ -2198,7 +2230,7 @@ var Z = nn(), Q = class {
|
|
|
2198
2230
|
}
|
|
2199
2231
|
return t;
|
|
2200
2232
|
}
|
|
2201
|
-
},
|
|
2233
|
+
}, on = class extends Q {
|
|
2202
2234
|
constructor(e) {
|
|
2203
2235
|
super(e, "Bold"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 5h6a3.5 3.5 0 0 1 0 7h-6l0 -7\" /><path d=\"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7\" /></svg>\n ");
|
|
2204
2236
|
}
|
|
@@ -2215,7 +2247,7 @@ var Z = nn(), Q = class {
|
|
|
2215
2247
|
} else a = `**${i || "Bold text"}**`, i || (o = 2);
|
|
2216
2248
|
this.editor.insertText(a, o, o);
|
|
2217
2249
|
}
|
|
2218
|
-
},
|
|
2250
|
+
}, sn = class extends Q {
|
|
2219
2251
|
constructor(e) {
|
|
2220
2252
|
super(e, "Italic"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M11 5l6 0\" /><path d=\"M7 19l6 0\" /><path d=\"M14 5l-4 14\" /></svg>\n ");
|
|
2221
2253
|
}
|
|
@@ -2232,7 +2264,7 @@ var Z = nn(), Q = class {
|
|
|
2232
2264
|
} else a = `*${i || "Italic text"}*`, i || (o = 1);
|
|
2233
2265
|
this.editor.insertText(a, o, o);
|
|
2234
2266
|
}
|
|
2235
|
-
},
|
|
2267
|
+
}, cn = class extends Q {
|
|
2236
2268
|
constructor(e) {
|
|
2237
2269
|
super(e, "Strikethrough"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M5 12l14 0\" /><path d=\"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5\" /></svg>\n ");
|
|
2238
2270
|
}
|
|
@@ -2245,7 +2277,7 @@ var Z = nn(), Q = class {
|
|
|
2245
2277
|
} else a = `~~${i || "Strikethrough text"}~~`, o = 2;
|
|
2246
2278
|
this.editor.insertText(a, o, o);
|
|
2247
2279
|
}
|
|
2248
|
-
},
|
|
2280
|
+
}, ln = class extends Q {
|
|
2249
2281
|
constructor(e) {
|
|
2250
2282
|
super(e, "Unordered list"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 6l11 0\" /><path d=\"M9 12l11 0\" /><path d=\"M9 18l11 0\" /><path d=\"M5 6l0 .01\" /><path d=\"M5 12l0 .01\" /><path d=\"M5 18l0 .01\" /></svg>\n ");
|
|
2251
2283
|
}
|
|
@@ -2258,7 +2290,7 @@ var Z = nn(), Q = class {
|
|
|
2258
2290
|
} else a = `- ${i || "Unordered list"}`, o = 2;
|
|
2259
2291
|
this.editor.insertText(a, o);
|
|
2260
2292
|
}
|
|
2261
|
-
},
|
|
2293
|
+
}, un = class extends Q {
|
|
2262
2294
|
constructor(e) {
|
|
2263
2295
|
super(e, "Ordered list"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M11 6h9\" /><path d=\"M11 12h9\" /><path d=\"M12 18h8\" /><path d=\"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4\" /><path d=\"M6 10v-6l-2 2\" /></svg>\n ");
|
|
2264
2296
|
}
|
|
@@ -2271,7 +2303,7 @@ var Z = nn(), Q = class {
|
|
|
2271
2303
|
} else a = `1. ${i || "Ordered list"}`, o = 3;
|
|
2272
2304
|
this.editor.insertText(a, o);
|
|
2273
2305
|
}
|
|
2274
|
-
},
|
|
2306
|
+
}, dn = class extends Q {
|
|
2275
2307
|
constructor(e) {
|
|
2276
2308
|
super(e, "Preview"), this.preview = !0, this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M12 4v16\" /><path d=\"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14\" /><path d=\"M12 13l7.5 -7.5\" /><path d=\"M12 18l8 -8\" /><path d=\"M15 20l5 -5\" /><path d=\"M12 8l4 -4\" /></svg>\n ");
|
|
2277
2309
|
let t = this.button.querySelector("button");
|
|
@@ -2300,7 +2332,7 @@ var Z = nn(), Q = class {
|
|
|
2300
2332
|
destroy() {
|
|
2301
2333
|
this.preview || (document.removeEventListener("keydown", this._escHandler), document.querySelector("body")?.classList.remove("fj:overflow-hidden"));
|
|
2302
2334
|
}
|
|
2303
|
-
},
|
|
2335
|
+
}, fn = class extends Q {
|
|
2304
2336
|
constructor(e) {
|
|
2305
2337
|
super(e, "Check list"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M3.5 5.5l1.5 1.5l2.5 -2.5\" /><path d=\"M3.5 11.5l1.5 1.5l2.5 -2.5\" /><path d=\"M3.5 17.5l1.5 1.5l2.5 -2.5\" /><path d=\"M11 6l9 0\" /><path d=\"M11 12l9 0\" /><path d=\"M11 18l9 0\" /></svg>\n ");
|
|
2306
2338
|
}
|
|
@@ -2317,7 +2349,7 @@ var Z = nn(), Q = class {
|
|
|
2317
2349
|
}
|
|
2318
2350
|
this.editor.insertText(s, c);
|
|
2319
2351
|
}
|
|
2320
|
-
},
|
|
2352
|
+
}, $ = class extends Q {
|
|
2321
2353
|
constructor(e) {
|
|
2322
2354
|
super(e, "Blockquote"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5\" /><path d=\"M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5\" /></svg>\n ");
|
|
2323
2355
|
}
|
|
@@ -2333,7 +2365,7 @@ var Z = nn(), Q = class {
|
|
|
2333
2365
|
};
|
|
2334
2366
|
//#endregion
|
|
2335
2367
|
//#region src/components/modal.js
|
|
2336
|
-
function
|
|
2368
|
+
function pn(e, t, n, r = "") {
|
|
2337
2369
|
let i = e.target.closest(".markdown-editor-wrapper");
|
|
2338
2370
|
i.querySelector(".markdown-modal") && i.querySelector(".markdown-modal").remove();
|
|
2339
2371
|
let a = `
|
|
@@ -2349,7 +2381,7 @@ function $(e, t, n, r = "") {
|
|
|
2349
2381
|
}
|
|
2350
2382
|
//#endregion
|
|
2351
2383
|
//#region src/components/toolbar/tools/LinkTool.js
|
|
2352
|
-
var
|
|
2384
|
+
var mn = class extends Q {
|
|
2353
2385
|
constructor(e) {
|
|
2354
2386
|
super(e, "Link"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 15l6 -6\" /><path d=\"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464\" /><path d=\"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463\" /></svg>\n ");
|
|
2355
2387
|
}
|
|
@@ -2359,7 +2391,7 @@ var fn = class extends Q {
|
|
|
2359
2391
|
let e = a.match(o)[1];
|
|
2360
2392
|
n.setRangeText(e, r, i, "select");
|
|
2361
2393
|
} else {
|
|
2362
|
-
let n =
|
|
2394
|
+
let n = pn(e, "fj:max-w-sm", `
|
|
2363
2395
|
<div class="fj:flex fj:justify-between fj:items-center fj:gap-3">
|
|
2364
2396
|
<div class="fj:font-medium">Link</div>
|
|
2365
2397
|
<button type="button" class="modal-close-btn fj:me-btn fj:me-btn-ghost fj:me-btn-xs fj:me-btn-circle" aria-label="Close">
|
|
@@ -2387,7 +2419,7 @@ var fn = class extends Q {
|
|
|
2387
2419
|
});
|
|
2388
2420
|
}
|
|
2389
2421
|
}
|
|
2390
|
-
},
|
|
2422
|
+
}, hn = class extends Q {
|
|
2391
2423
|
constructor(e) {
|
|
2392
2424
|
super(e, "Heading"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 12h10\" /><path d=\"M7 5v14\" /><path d=\"M17 5v14\" /><path d=\"M15 19h4\" /><path d=\"M15 5h4\" /><path d=\"M5 19h4\" /><path d=\"M5 5h4\" /></svg>\n ");
|
|
2393
2425
|
}
|
|
@@ -2427,7 +2459,7 @@ var fn = class extends Q {
|
|
|
2427
2459
|
t.setSelectionRange(p, m), this.editor.scrollToView(), this.editor.render(), this.editor.notifyChange();
|
|
2428
2460
|
}
|
|
2429
2461
|
applySyntax() {}
|
|
2430
|
-
},
|
|
2462
|
+
}, gn = class extends Q {
|
|
2431
2463
|
constructor(e, t = {}) {
|
|
2432
2464
|
super(e, "Image link"), this.config = t, this.fileInputConfig = t.fileInput || !1, this.altInputConfig = t.altInput === void 0 ? { required: !0 } : t.altInput, this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M15 8h.01\" /><path d=\"M12.5 21h-6.5a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6.5\" /><path d=\"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l4 4\" /><path d=\"M14 14l1 -1c.67 -.644 1.45 -.824 2.182 -.54\" /><path d=\"M16 19h6\" /><path d=\"M19 16v6\" /></svg>\n ");
|
|
2433
2465
|
}
|
|
@@ -2443,7 +2475,7 @@ var fn = class extends Q {
|
|
|
2443
2475
|
<input type="file" accept="${o}" class="img-file-input fj:me-input fj:w-full">
|
|
2444
2476
|
<div class="fj:me-divider fj:my-1">OR</div>
|
|
2445
2477
|
`);
|
|
2446
|
-
let f =
|
|
2478
|
+
let f = pn(e, "fj:max-w-sm", `
|
|
2447
2479
|
<div class="fj:flex fj:justify-between fj:items-center fj:gap-3">
|
|
2448
2480
|
<div class="fj:font-medium">Image</div>
|
|
2449
2481
|
<button type="button" class="modal-close-btn fj:me-btn fj:me-btn-ghost fj:me-btn-xs fj:me-btn-circle" aria-label="Close">
|
|
@@ -2498,7 +2530,7 @@ var fn = class extends Q {
|
|
|
2498
2530
|
t.insertText(m), f.close();
|
|
2499
2531
|
});
|
|
2500
2532
|
}
|
|
2501
|
-
},
|
|
2533
|
+
}, _n = class extends Q {
|
|
2502
2534
|
constructor(e) {
|
|
2503
2535
|
super(e, "Undo"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 14l-4 -4l4 -4\" /><path d=\"M5 10h11a4 4 0 1 1 0 8h-1\" /></svg>\n ");
|
|
2504
2536
|
}
|
|
@@ -2506,7 +2538,7 @@ var fn = class extends Q {
|
|
|
2506
2538
|
let e = this.editor.undoRedoManager;
|
|
2507
2539
|
e && e.undo();
|
|
2508
2540
|
}
|
|
2509
|
-
},
|
|
2541
|
+
}, vn = class extends Q {
|
|
2510
2542
|
constructor(e) {
|
|
2511
2543
|
super(e, "Redo"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M15 14l4 -4l-4 -4\" /><path d=\"M19 10h-11a4 4 0 1 0 0 8h1\" /></svg>\n ");
|
|
2512
2544
|
}
|
|
@@ -2514,7 +2546,7 @@ var fn = class extends Q {
|
|
|
2514
2546
|
let e = this.editor.undoRedoManager;
|
|
2515
2547
|
e && e.redo();
|
|
2516
2548
|
}
|
|
2517
|
-
},
|
|
2549
|
+
}, yn = class extends Q {
|
|
2518
2550
|
constructor(e) {
|
|
2519
2551
|
super(e, "Indent"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M20 6l-11 0\" /><path d=\"M20 12l-7 0\" /><path d=\"M20 18l-11 0\" /><path d=\"M4 8l4 4l-4 4\" /></svg>\n ");
|
|
2520
2552
|
}
|
|
@@ -2522,7 +2554,7 @@ var fn = class extends Q {
|
|
|
2522
2554
|
let e = this.editor.indentManager;
|
|
2523
2555
|
e && (e.indent(), this.editor.render());
|
|
2524
2556
|
}
|
|
2525
|
-
},
|
|
2557
|
+
}, bn = class extends Q {
|
|
2526
2558
|
constructor(e) {
|
|
2527
2559
|
super(e, "Outdent"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M20 6l-7 0\" /><path d=\"M20 12l-9 0\" /><path d=\"M20 18l-7 0\" /><path d=\"M8 8l-4 4l4 4\" /></svg>\n ");
|
|
2528
2560
|
}
|
|
@@ -2530,7 +2562,7 @@ var fn = class extends Q {
|
|
|
2530
2562
|
let t = this.editor.indentManager;
|
|
2531
2563
|
t && (t.outdent(), this.editor.render());
|
|
2532
2564
|
}
|
|
2533
|
-
},
|
|
2565
|
+
}, xn = class extends Q {
|
|
2534
2566
|
constructor(e) {
|
|
2535
2567
|
super(e, "Code"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 8l-4 4l4 4\" /><path d=\"M17 8l4 4l-4 4\" /><path d=\"M14 4l-4 16\" /></svg>\n ");
|
|
2536
2568
|
}
|
|
@@ -2547,7 +2579,7 @@ var fn = class extends Q {
|
|
|
2547
2579
|
let a = `\`${i || "code"}\``;
|
|
2548
2580
|
this.editor.insertText(a, 1, 1);
|
|
2549
2581
|
}
|
|
2550
|
-
},
|
|
2582
|
+
}, Sn = class extends Q {
|
|
2551
2583
|
constructor(e) {
|
|
2552
2584
|
super(e, "Code Block"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M8 9l3 3l-3 3\" /><path d=\"M13 15l3 0\" /><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" /></svg>\n ");
|
|
2553
2585
|
}
|
|
@@ -2561,7 +2593,7 @@ var fn = class extends Q {
|
|
|
2561
2593
|
let i = `\`\`\`\n${r || "code"}\n\`\`\``;
|
|
2562
2594
|
this.editor.insertText(i, 4, 4);
|
|
2563
2595
|
}
|
|
2564
|
-
},
|
|
2596
|
+
}, Cn = class extends Q {
|
|
2565
2597
|
constructor(e) {
|
|
2566
2598
|
super(e, "Horizontal Rule"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M4 12l16 0\" stroke-width=\"3\"/><path d=\"M4 7l6 0\" /><path d=\"M4 17l6 0\" /><path d=\"M14 7l6 0\" /><path d=\"M14 17l6 0\" /></svg>\n ");
|
|
2567
2599
|
}
|
|
@@ -2569,7 +2601,7 @@ var fn = class extends Q {
|
|
|
2569
2601
|
let e = this.editor.usertextarea, { selectionStart: t } = e, n = e.value, r = t === 0 || n[t - 1] === "\n" ? "---\n" : "\n\n---\n";
|
|
2570
2602
|
this.editor.insertText(r, r.length, 0);
|
|
2571
2603
|
}
|
|
2572
|
-
},
|
|
2604
|
+
}, wn = class extends Q {
|
|
2573
2605
|
constructor(e) {
|
|
2574
2606
|
super(e, "Table"), this.button = this.createButton("\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z\" /><path d=\"M3 10h18\" /><path d=\"M10 3v18\" /></svg>\n ");
|
|
2575
2607
|
}
|
|
@@ -2577,30 +2609,30 @@ var fn = class extends Q {
|
|
|
2577
2609
|
let e = this.editor.usertextarea, { selectionStart: t } = e, n = e.value, r = "| Column 1 | Column 2 | Column 3 |\n| --- | --- | --- |\n| Cell | Cell | Cell |\n| Cell | Cell | Cell |", i = t === 0 || n[t - 1] === "\n" ? r : `\n${r}`;
|
|
2578
2610
|
this.editor.insertText(i, i.length, 0);
|
|
2579
2611
|
}
|
|
2580
|
-
},
|
|
2612
|
+
}, Tn = class {
|
|
2581
2613
|
constructor(e, t) {
|
|
2582
2614
|
this.editor = e, this.options = t, this.toolbar = document.createElement("div"), this.toolbar.className = "toolbar not-prose fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-b fj:flex fj:items-center fj:gap-x-1 fj:p-1.5 fj:overflow-x-auto", this.toolbar.setAttribute("role", "toolbar"), this.toolbar.setAttribute("aria-label", "Editor toolbar"), this.init();
|
|
2583
2615
|
}
|
|
2584
2616
|
init() {
|
|
2585
2617
|
let e = {
|
|
2586
|
-
heading:
|
|
2587
|
-
ul:
|
|
2588
|
-
ol:
|
|
2589
|
-
checklist:
|
|
2590
|
-
bold:
|
|
2591
|
-
italic:
|
|
2592
|
-
strikethrough:
|
|
2593
|
-
blockquote:
|
|
2594
|
-
code:
|
|
2595
|
-
codeblock:
|
|
2596
|
-
hr:
|
|
2597
|
-
table:
|
|
2598
|
-
link:
|
|
2599
|
-
image:
|
|
2600
|
-
undo:
|
|
2601
|
-
redo:
|
|
2602
|
-
indent:
|
|
2603
|
-
outdent:
|
|
2618
|
+
heading: hn,
|
|
2619
|
+
ul: ln,
|
|
2620
|
+
ol: un,
|
|
2621
|
+
checklist: fn,
|
|
2622
|
+
bold: on,
|
|
2623
|
+
italic: sn,
|
|
2624
|
+
strikethrough: cn,
|
|
2625
|
+
blockquote: $,
|
|
2626
|
+
code: xn,
|
|
2627
|
+
codeblock: Sn,
|
|
2628
|
+
hr: Cn,
|
|
2629
|
+
table: wn,
|
|
2630
|
+
link: mn,
|
|
2631
|
+
image: gn,
|
|
2632
|
+
undo: _n,
|
|
2633
|
+
redo: vn,
|
|
2634
|
+
indent: yn,
|
|
2635
|
+
outdent: bn
|
|
2604
2636
|
};
|
|
2605
2637
|
if (this.options.forEach((t) => {
|
|
2606
2638
|
let n, r;
|
|
@@ -2614,19 +2646,19 @@ var fn = class extends Q {
|
|
|
2614
2646
|
this.toolbar.appendChild(e.button);
|
|
2615
2647
|
}
|
|
2616
2648
|
}), this.options.includes("preview")) {
|
|
2617
|
-
let e = new
|
|
2649
|
+
let e = new dn(this.editor);
|
|
2618
2650
|
this.editor.previewTool = e, this.toolbar.appendChild(e.button);
|
|
2619
2651
|
}
|
|
2620
2652
|
this.editor.editorContainer.insertBefore(this.toolbar, this.editor.markdownEditorDiv);
|
|
2621
2653
|
}
|
|
2622
|
-
},
|
|
2654
|
+
}, En = class {
|
|
2623
2655
|
constructor(e) {
|
|
2624
2656
|
this.previewContainer = document.createElement("div"), this.previewContainer.className = "preview-wrapper fj:p-2 fj:hidden fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-l", this.previewContainer.setAttribute("role", "region"), this.previewContainer.setAttribute("aria-label", "Preview"), this.previewContent = document.createElement("div"), this.previewContent.className = "preview-content fj:prose fj:prose-sm fj:md:prose-base fj:me-prose-frutjam fj:p-1.5 fj:overflow-y-auto fj:h-full fj:max-w-full", this.previewContainer.appendChild(this.previewContent), e.appendChild(this.previewContainer);
|
|
2625
2657
|
}
|
|
2626
2658
|
getPreviewContent() {
|
|
2627
2659
|
return this.previewContent;
|
|
2628
2660
|
}
|
|
2629
|
-
},
|
|
2661
|
+
}, Dn = class {
|
|
2630
2662
|
constructor(e, t = {}) {
|
|
2631
2663
|
this.options = t, this.footer = document.createElement("div"), this.footer.className = "editor-footer not-prose fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-t fj:flex fj:justify-between fj:items-center fj:px-3 fj:py-1 fj:text-xs fj:opacity-60 fj:select-none", this.footer.setAttribute("aria-hidden", "true"), this.positionEl = document.createElement("span"), this.charsEl = document.createElement("span"), this.wordsEl = document.createElement("span"), (this.options.line || this.options.col) && this.footer.appendChild(this.positionEl), this.options.chars && this.footer.appendChild(this.charsEl), this.options.words && this.footer.appendChild(this.wordsEl), e.appendChild(this.footer);
|
|
2632
2664
|
}
|
|
@@ -2641,7 +2673,7 @@ var fn = class extends Q {
|
|
|
2641
2673
|
this.wordsEl.textContent = `${e.toLocaleString()} words`;
|
|
2642
2674
|
}
|
|
2643
2675
|
}
|
|
2644
|
-
},
|
|
2676
|
+
}, On = class {
|
|
2645
2677
|
diff(e, t, n = {}) {
|
|
2646
2678
|
let r;
|
|
2647
2679
|
typeof n == "function" ? (r = n, n = {}) : "callback" in n && (r = n.callback);
|
|
@@ -2772,42 +2804,42 @@ var fn = class extends Q {
|
|
|
2772
2804
|
}
|
|
2773
2805
|
return r;
|
|
2774
2806
|
}
|
|
2775
|
-
},
|
|
2776
|
-
function
|
|
2777
|
-
return
|
|
2807
|
+
}, kn = new class extends On {}();
|
|
2808
|
+
function An(e, t, n) {
|
|
2809
|
+
return kn.diff(e, t, n);
|
|
2778
2810
|
}
|
|
2779
2811
|
//#endregion
|
|
2780
2812
|
//#region node_modules/diff/libesm/util/string.js
|
|
2781
|
-
function
|
|
2813
|
+
function jn(e, t) {
|
|
2782
2814
|
let n;
|
|
2783
2815
|
for (n = 0; n < e.length && n < t.length; n++) if (e[n] != t[n]) return e.slice(0, n);
|
|
2784
2816
|
return e.slice(0, n);
|
|
2785
2817
|
}
|
|
2786
|
-
function
|
|
2818
|
+
function Mn(e, t) {
|
|
2787
2819
|
let n;
|
|
2788
2820
|
if (!e || !t || e[e.length - 1] != t[t.length - 1]) return "";
|
|
2789
2821
|
for (n = 0; n < e.length && n < t.length; n++) if (e[e.length - (n + 1)] != t[t.length - (n + 1)]) return e.slice(-n);
|
|
2790
2822
|
return e.slice(-n);
|
|
2791
2823
|
}
|
|
2792
|
-
function
|
|
2824
|
+
function Nn(e, t, n) {
|
|
2793
2825
|
if (e.slice(0, t.length) != t) throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);
|
|
2794
2826
|
return n + e.slice(t.length);
|
|
2795
2827
|
}
|
|
2796
|
-
function
|
|
2828
|
+
function Pn(e, t, n) {
|
|
2797
2829
|
if (!t) return e + n;
|
|
2798
2830
|
if (e.slice(-t.length) != t) throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);
|
|
2799
2831
|
return e.slice(0, -t.length) + n;
|
|
2800
2832
|
}
|
|
2801
|
-
function Nn(e, t) {
|
|
2802
|
-
return jn(e, t, "");
|
|
2803
|
-
}
|
|
2804
|
-
function Pn(e, t) {
|
|
2805
|
-
return Mn(e, t, "");
|
|
2806
|
-
}
|
|
2807
2833
|
function Fn(e, t) {
|
|
2808
|
-
return
|
|
2834
|
+
return Nn(e, t, "");
|
|
2809
2835
|
}
|
|
2810
2836
|
function In(e, t) {
|
|
2837
|
+
return Pn(e, t, "");
|
|
2838
|
+
}
|
|
2839
|
+
function Ln(e, t) {
|
|
2840
|
+
return t.slice(0, Rn(e, t));
|
|
2841
|
+
}
|
|
2842
|
+
function Rn(e, t) {
|
|
2811
2843
|
let n = 0;
|
|
2812
2844
|
e.length > t.length && (n = e.length - t.length);
|
|
2813
2845
|
let r = t.length;
|
|
@@ -2825,7 +2857,7 @@ function In(e, t) {
|
|
|
2825
2857
|
}
|
|
2826
2858
|
return a;
|
|
2827
2859
|
}
|
|
2828
|
-
function
|
|
2860
|
+
function zn(e, t) {
|
|
2829
2861
|
let n = [];
|
|
2830
2862
|
for (let r of Array.from(t.segment(e))) {
|
|
2831
2863
|
let e = r.segment;
|
|
@@ -2833,27 +2865,27 @@ function Ln(e, t) {
|
|
|
2833
2865
|
}
|
|
2834
2866
|
return n;
|
|
2835
2867
|
}
|
|
2836
|
-
function
|
|
2837
|
-
if (t) return
|
|
2868
|
+
function Bn(e, t) {
|
|
2869
|
+
if (t) return Hn(e, t)[1];
|
|
2838
2870
|
let n;
|
|
2839
2871
|
for (n = e.length - 1; n >= 0 && e[n].match(/\s/); n--);
|
|
2840
2872
|
return e.substring(n + 1);
|
|
2841
2873
|
}
|
|
2842
|
-
function
|
|
2843
|
-
if (t) return
|
|
2874
|
+
function Vn(e, t) {
|
|
2875
|
+
if (t) return Hn(e, t)[0];
|
|
2844
2876
|
let n = e.match(/^\s*/);
|
|
2845
2877
|
return n ? n[0] : "";
|
|
2846
2878
|
}
|
|
2847
|
-
function
|
|
2848
|
-
if (!t) return [
|
|
2879
|
+
function Hn(e, t) {
|
|
2880
|
+
if (!t) return [Vn(e), Bn(e)];
|
|
2849
2881
|
if (t.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
|
|
2850
|
-
let n =
|
|
2882
|
+
let n = zn(e, t), r = n[0], i = n[n.length - 1];
|
|
2851
2883
|
return [/\s/.test(r) ? r : "", /\s/.test(i) ? i : ""];
|
|
2852
2884
|
}
|
|
2853
2885
|
//#endregion
|
|
2854
2886
|
//#region node_modules/diff/libesm/diff/word.js
|
|
2855
|
-
var
|
|
2856
|
-
new class extends
|
|
2887
|
+
var Un = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}", Wn = RegExp(`[${Un}]+|\\s+|[^${Un}]`, "ug");
|
|
2888
|
+
new class extends On {
|
|
2857
2889
|
equals(e, t, n) {
|
|
2858
2890
|
return n.ignoreCase && (e = e.toLowerCase(), t = t.toLowerCase()), e.trim() === t.trim();
|
|
2859
2891
|
}
|
|
@@ -2862,8 +2894,8 @@ new class extends En {
|
|
|
2862
2894
|
if (t.intlSegmenter) {
|
|
2863
2895
|
let r = t.intlSegmenter;
|
|
2864
2896
|
if (r.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
|
|
2865
|
-
n =
|
|
2866
|
-
} else n = e.match(
|
|
2897
|
+
n = zn(e, r);
|
|
2898
|
+
} else n = e.match(Wn) || [];
|
|
2867
2899
|
let r = [], i = null;
|
|
2868
2900
|
return n.forEach((e) => {
|
|
2869
2901
|
/\s/.test(e) ? i == null ? r.push(e) : r.push(r.pop() + e) : i != null && /\s/.test(i) ? r[r.length - 1] == i ? r.push(r.pop() + e) : r.push(i + e) : r.push(e), i = e;
|
|
@@ -2876,57 +2908,57 @@ new class extends En {
|
|
|
2876
2908
|
if (!e || t.oneChangePerToken) return e;
|
|
2877
2909
|
let n = null, r = null, i = null;
|
|
2878
2910
|
return e.forEach((e) => {
|
|
2879
|
-
e.added ? r = e : e.removed ? i = e : ((r || i) &&
|
|
2880
|
-
}), (r || i) &&
|
|
2911
|
+
e.added ? r = e : e.removed ? i = e : ((r || i) && Gn(n, i, r, e, t.intlSegmenter), n = e, r = null, i = null);
|
|
2912
|
+
}), (r || i) && Gn(n, i, r, null, t.intlSegmenter), e;
|
|
2881
2913
|
}
|
|
2882
2914
|
}();
|
|
2883
|
-
function
|
|
2915
|
+
function Gn(e, t, n, r, i) {
|
|
2884
2916
|
if (t && n) {
|
|
2885
|
-
let [a, o] =
|
|
2917
|
+
let [a, o] = Hn(t.value, i), [s, c] = Hn(n.value, i);
|
|
2886
2918
|
if (e) {
|
|
2887
|
-
let r =
|
|
2888
|
-
e.value =
|
|
2919
|
+
let r = jn(a, s);
|
|
2920
|
+
e.value = Pn(e.value, s, r), t.value = Fn(t.value, r), n.value = Fn(n.value, r);
|
|
2889
2921
|
}
|
|
2890
2922
|
if (r) {
|
|
2891
|
-
let e =
|
|
2892
|
-
r.value =
|
|
2923
|
+
let e = Mn(o, c);
|
|
2924
|
+
r.value = Nn(r.value, c, e), t.value = In(t.value, e), n.value = In(n.value, e);
|
|
2893
2925
|
}
|
|
2894
2926
|
} else if (n) {
|
|
2895
2927
|
if (e) {
|
|
2896
|
-
let e =
|
|
2928
|
+
let e = Vn(n.value, i);
|
|
2897
2929
|
n.value = n.value.substring(e.length);
|
|
2898
2930
|
}
|
|
2899
2931
|
if (r) {
|
|
2900
|
-
let e =
|
|
2932
|
+
let e = Vn(r.value, i);
|
|
2901
2933
|
r.value = r.value.substring(e.length);
|
|
2902
2934
|
}
|
|
2903
2935
|
} else if (e && r) {
|
|
2904
|
-
let n =
|
|
2905
|
-
t.value =
|
|
2906
|
-
let c =
|
|
2907
|
-
t.value =
|
|
2936
|
+
let n = Vn(r.value, i), [a, o] = Hn(t.value, i), s = jn(n, a);
|
|
2937
|
+
t.value = Fn(t.value, s);
|
|
2938
|
+
let c = Mn(Fn(n, s), o);
|
|
2939
|
+
t.value = In(t.value, c), r.value = Nn(r.value, n, c), e.value = Pn(e.value, n, n.slice(0, n.length - c.length));
|
|
2908
2940
|
} else if (r) {
|
|
2909
|
-
let e =
|
|
2910
|
-
t.value =
|
|
2941
|
+
let e = Vn(r.value, i), n = Ln(Bn(t.value, i), e);
|
|
2942
|
+
t.value = In(t.value, n);
|
|
2911
2943
|
} else if (e) {
|
|
2912
|
-
let n =
|
|
2913
|
-
t.value =
|
|
2944
|
+
let n = Ln(Bn(e.value, i), Vn(t.value, i));
|
|
2945
|
+
t.value = Fn(t.value, n);
|
|
2914
2946
|
}
|
|
2915
2947
|
}
|
|
2916
|
-
new class extends
|
|
2948
|
+
new class extends On {
|
|
2917
2949
|
tokenize(e) {
|
|
2918
|
-
let t = RegExp(`(\\r?\\n)|[${
|
|
2950
|
+
let t = RegExp(`(\\r?\\n)|[${Un}]+|[^\\S\\n\\r]+|[^${Un}]`, "ug");
|
|
2919
2951
|
return e.match(t) || [];
|
|
2920
2952
|
}
|
|
2921
|
-
}(), new class extends
|
|
2953
|
+
}(), new class extends On {
|
|
2922
2954
|
constructor() {
|
|
2923
|
-
super(...arguments), this.tokenize =
|
|
2955
|
+
super(...arguments), this.tokenize = Kn;
|
|
2924
2956
|
}
|
|
2925
2957
|
equals(e, t, n) {
|
|
2926
2958
|
return n.ignoreWhitespace ? ((!n.newlineIsToken || !e.includes("\n")) && (e = e.trim()), (!n.newlineIsToken || !t.includes("\n")) && (t = t.trim())) : n.ignoreNewlineAtEof && !n.newlineIsToken && (e.endsWith("\n") && (e = e.slice(0, -1)), t.endsWith("\n") && (t = t.slice(0, -1))), super.equals(e, t, n);
|
|
2927
2959
|
}
|
|
2928
2960
|
}();
|
|
2929
|
-
function
|
|
2961
|
+
function Kn(e, t) {
|
|
2930
2962
|
t.stripTrailingCr && (e = e.replace(/\r\n/g, "\n"));
|
|
2931
2963
|
let n = [], r = e.split(/(\n|\r\n)/);
|
|
2932
2964
|
r[r.length - 1] || r.pop();
|
|
@@ -2938,10 +2970,10 @@ function Wn(e, t) {
|
|
|
2938
2970
|
}
|
|
2939
2971
|
//#endregion
|
|
2940
2972
|
//#region node_modules/diff/libesm/diff/sentence.js
|
|
2941
|
-
function
|
|
2973
|
+
function qn(e) {
|
|
2942
2974
|
return e == "." || e == "!" || e == "?";
|
|
2943
2975
|
}
|
|
2944
|
-
new class extends
|
|
2976
|
+
new class extends On {
|
|
2945
2977
|
tokenize(e) {
|
|
2946
2978
|
let t = [], n = 0;
|
|
2947
2979
|
for (let r = 0; r < e.length; r++) {
|
|
@@ -2949,39 +2981,39 @@ new class extends En {
|
|
|
2949
2981
|
t.push(e.slice(n));
|
|
2950
2982
|
break;
|
|
2951
2983
|
}
|
|
2952
|
-
if (
|
|
2984
|
+
if (qn(e[r]) && e[r + 1].match(/\s/)) {
|
|
2953
2985
|
for (t.push(e.slice(n, r + 1)), r = n = r + 1; e[r + 1]?.match(/\s/);) r++;
|
|
2954
2986
|
t.push(e.slice(n, r + 1)), n = r + 1;
|
|
2955
2987
|
}
|
|
2956
2988
|
}
|
|
2957
2989
|
return t;
|
|
2958
2990
|
}
|
|
2959
|
-
}(), new class extends
|
|
2991
|
+
}(), new class extends On {
|
|
2960
2992
|
tokenize(e) {
|
|
2961
2993
|
return e.split(/([{}:;,]|\s+)/);
|
|
2962
2994
|
}
|
|
2963
|
-
}(), new class extends
|
|
2995
|
+
}(), new class extends On {
|
|
2964
2996
|
constructor() {
|
|
2965
|
-
super(...arguments), this.tokenize =
|
|
2997
|
+
super(...arguments), this.tokenize = Kn;
|
|
2966
2998
|
}
|
|
2967
2999
|
get useLongestToken() {
|
|
2968
3000
|
return !0;
|
|
2969
3001
|
}
|
|
2970
3002
|
castInput(e, t) {
|
|
2971
3003
|
let { undefinedReplacement: n, stringifyReplacer: r = (e, t) => t === void 0 ? n : t } = t;
|
|
2972
|
-
return typeof e == "string" ? e : JSON.stringify(
|
|
3004
|
+
return typeof e == "string" ? e : JSON.stringify(Jn(e, null, null, r), null, " ");
|
|
2973
3005
|
}
|
|
2974
3006
|
equals(e, t, n) {
|
|
2975
3007
|
return super.equals(e.replace(/,([\r\n])/g, "$1"), t.replace(/,([\r\n])/g, "$1"), n);
|
|
2976
3008
|
}
|
|
2977
3009
|
}();
|
|
2978
|
-
function
|
|
3010
|
+
function Jn(e, t, n, r, i) {
|
|
2979
3011
|
t ||= [], n ||= [], r && (e = r(i === void 0 ? "" : i, e));
|
|
2980
3012
|
let a;
|
|
2981
3013
|
for (a = 0; a < t.length; a += 1) if (t[a] === e) return n[a];
|
|
2982
3014
|
let o;
|
|
2983
3015
|
if (Object.prototype.toString.call(e) === "[object Array]") {
|
|
2984
|
-
for (t.push(e), o = Array(e.length), n.push(o), a = 0; a < e.length; a += 1) o[a] =
|
|
3016
|
+
for (t.push(e), o = Array(e.length), n.push(o), a = 0; a < e.length; a += 1) o[a] = Jn(e[a], t, n, r, String(a));
|
|
2985
3017
|
return t.pop(), n.pop(), o;
|
|
2986
3018
|
}
|
|
2987
3019
|
if (e && e.toJSON && (e = e.toJSON()), typeof e == "object" && e) {
|
|
@@ -2990,12 +3022,12 @@ function Kn(e, t, n, r, i) {
|
|
|
2990
3022
|
for (s in e)
|
|
2991
3023
|
/* istanbul ignore else */
|
|
2992
3024
|
Object.prototype.hasOwnProperty.call(e, s) && i.push(s);
|
|
2993
|
-
for (i.sort(), a = 0; a < i.length; a += 1) s = i[a], o[s] =
|
|
3025
|
+
for (i.sort(), a = 0; a < i.length; a += 1) s = i[a], o[s] = Jn(e[s], t, n, r, s);
|
|
2994
3026
|
t.pop(), n.pop();
|
|
2995
3027
|
} else o = e;
|
|
2996
3028
|
return o;
|
|
2997
3029
|
}
|
|
2998
|
-
new class extends
|
|
3030
|
+
new class extends On {
|
|
2999
3031
|
tokenize(e) {
|
|
3000
3032
|
return e.slice();
|
|
3001
3033
|
}
|
|
@@ -3008,7 +3040,7 @@ new class extends En {
|
|
|
3008
3040
|
}();
|
|
3009
3041
|
//#endregion
|
|
3010
3042
|
//#region src/utils/UndoRedoManager.js
|
|
3011
|
-
var
|
|
3043
|
+
var Yn = class {
|
|
3012
3044
|
constructor(e) {
|
|
3013
3045
|
this.editor = e, this.textarea = e.usertextarea, this.undoStack = [], this.redoStack = [], this.lastValue = this.textarea.value, this.lastSelection = {
|
|
3014
3046
|
selectionStart: this.textarea.selectionStart,
|
|
@@ -3042,7 +3074,7 @@ var qn = class {
|
|
|
3042
3074
|
let e = this.textarea.value || "";
|
|
3043
3075
|
if (e === this.lastValue) return;
|
|
3044
3076
|
clearTimeout(this._debounceTimer);
|
|
3045
|
-
let t =
|
|
3077
|
+
let t = An(this.lastValue, e);
|
|
3046
3078
|
this.undoStack.push({
|
|
3047
3079
|
diff: t,
|
|
3048
3080
|
selection: { ...this.lastSelection }
|
|
@@ -3082,7 +3114,7 @@ var qn = class {
|
|
|
3082
3114
|
_restoreState(e, t) {
|
|
3083
3115
|
this.textarea.value = e, this.textarea.setSelectionRange(t.selectionStart, t.selectionEnd), this.lastValue = e, this.lastSelection = { ...t }, this.editor.render && this.editor.render(), this.editor.notifyChange(), this.textarea.focus();
|
|
3084
3116
|
}
|
|
3085
|
-
},
|
|
3117
|
+
}, Xn = class {
|
|
3086
3118
|
constructor(e, t) {
|
|
3087
3119
|
this.editor = e, this.textarea = e.usertextarea, this.renderCallback = t, this.pairs = {
|
|
3088
3120
|
"{": "}",
|
|
@@ -3173,7 +3205,7 @@ var qn = class {
|
|
|
3173
3205
|
_applyChange(e, t, n) {
|
|
3174
3206
|
this.textarea.value = e, this.textarea.setSelectionRange(t, n);
|
|
3175
3207
|
}
|
|
3176
|
-
},
|
|
3208
|
+
}, Zn = class {
|
|
3177
3209
|
constructor(e) {
|
|
3178
3210
|
this.editor = e, this.textarea = e.usertextarea, this._keydownHandler = (e) => {
|
|
3179
3211
|
e.key === "Enter" && this.handleEnter(e);
|
|
@@ -3199,12 +3231,12 @@ var qn = class {
|
|
|
3199
3231
|
this.textarea.setSelectionRange(o, o), this.editor.render(), this.editor.notifyChange();
|
|
3200
3232
|
}
|
|
3201
3233
|
}
|
|
3202
|
-
},
|
|
3234
|
+
}, Qn = [
|
|
3203
3235
|
{
|
|
3204
3236
|
key: "b",
|
|
3205
3237
|
ctrl: !0,
|
|
3206
3238
|
shift: !1,
|
|
3207
|
-
ToolClass:
|
|
3239
|
+
ToolClass: on,
|
|
3208
3240
|
label: "Ctrl+B",
|
|
3209
3241
|
btnClass: "bold-btn"
|
|
3210
3242
|
},
|
|
@@ -3212,7 +3244,7 @@ var qn = class {
|
|
|
3212
3244
|
key: "i",
|
|
3213
3245
|
ctrl: !0,
|
|
3214
3246
|
shift: !1,
|
|
3215
|
-
ToolClass:
|
|
3247
|
+
ToolClass: sn,
|
|
3216
3248
|
label: "Ctrl+I",
|
|
3217
3249
|
btnClass: "italic-btn"
|
|
3218
3250
|
},
|
|
@@ -3220,7 +3252,7 @@ var qn = class {
|
|
|
3220
3252
|
key: "k",
|
|
3221
3253
|
ctrl: !0,
|
|
3222
3254
|
shift: !1,
|
|
3223
|
-
ToolClass:
|
|
3255
|
+
ToolClass: mn,
|
|
3224
3256
|
label: "Ctrl+K",
|
|
3225
3257
|
btnClass: "link-btn"
|
|
3226
3258
|
},
|
|
@@ -3228,7 +3260,7 @@ var qn = class {
|
|
|
3228
3260
|
key: "`",
|
|
3229
3261
|
ctrl: !0,
|
|
3230
3262
|
shift: !1,
|
|
3231
|
-
ToolClass:
|
|
3263
|
+
ToolClass: xn,
|
|
3232
3264
|
label: "Ctrl+`",
|
|
3233
3265
|
btnClass: "code-btn"
|
|
3234
3266
|
},
|
|
@@ -3236,7 +3268,7 @@ var qn = class {
|
|
|
3236
3268
|
key: "s",
|
|
3237
3269
|
ctrl: !0,
|
|
3238
3270
|
shift: !0,
|
|
3239
|
-
ToolClass:
|
|
3271
|
+
ToolClass: cn,
|
|
3240
3272
|
label: "Ctrl+Shift+S",
|
|
3241
3273
|
btnClass: "strikethrough-btn"
|
|
3242
3274
|
},
|
|
@@ -3244,11 +3276,11 @@ var qn = class {
|
|
|
3244
3276
|
key: "l",
|
|
3245
3277
|
ctrl: !0,
|
|
3246
3278
|
shift: !1,
|
|
3247
|
-
ToolClass:
|
|
3279
|
+
ToolClass: ln,
|
|
3248
3280
|
label: "Ctrl+L",
|
|
3249
3281
|
btnClass: "ul-btn"
|
|
3250
3282
|
}
|
|
3251
|
-
],
|
|
3283
|
+
], $n = class {
|
|
3252
3284
|
constructor(e) {
|
|
3253
3285
|
this.editor = e, this._handler = this._onKeyDown.bind(this), this._docHandler = this._onDocKeyDown.bind(this), e.usertextarea.addEventListener("keydown", this._handler), document.addEventListener("keydown", this._docHandler), this._updateTooltips();
|
|
3254
3286
|
}
|
|
@@ -3263,10 +3295,10 @@ var qn = class {
|
|
|
3263
3295
|
"2",
|
|
3264
3296
|
"3"
|
|
3265
3297
|
].includes(e.key)) {
|
|
3266
|
-
e.preventDefault(), new
|
|
3298
|
+
e.preventDefault(), new hn(this.editor).applyHeading(parseInt(e.key));
|
|
3267
3299
|
return;
|
|
3268
3300
|
}
|
|
3269
|
-
for (let i of
|
|
3301
|
+
for (let i of Qn) if (r === i.key && t === i.ctrl && n === i.shift) {
|
|
3270
3302
|
e.preventDefault(), new i.ToolClass(this.editor).applySyntax(e);
|
|
3271
3303
|
return;
|
|
3272
3304
|
}
|
|
@@ -3278,7 +3310,7 @@ var qn = class {
|
|
|
3278
3310
|
}
|
|
3279
3311
|
}
|
|
3280
3312
|
_updateTooltips() {
|
|
3281
|
-
for (let { btnClass: e, label: t } of
|
|
3313
|
+
for (let { btnClass: e, label: t } of Qn) {
|
|
3282
3314
|
let n = this.editor.editorContainer.querySelector(`.${e}`);
|
|
3283
3315
|
n && (n.title += ` (${t})`);
|
|
3284
3316
|
}
|
|
@@ -3290,7 +3322,7 @@ var qn = class {
|
|
|
3290
3322
|
destroy() {
|
|
3291
3323
|
this.editor.usertextarea.removeEventListener("keydown", this._handler), document.removeEventListener("keydown", this._docHandler);
|
|
3292
3324
|
}
|
|
3293
|
-
},
|
|
3325
|
+
}, er = class {
|
|
3294
3326
|
constructor(e) {
|
|
3295
3327
|
this.editor = e, this._matches = [], this._currentIndex = -1, this._caseSensitive = !1, this._panel = null, this._findInput = null, this._replaceInput = null, this._countEl = null, this._replaceRow = null, this._caseSensitiveBtn = null, this._highlightEl = null, this._scrollHandler = null, this._taHandler = this._onTextareaKeyDown.bind(this), e.usertextarea.addEventListener("keydown", this._taHandler);
|
|
3296
3328
|
}
|
|
@@ -3445,10 +3477,10 @@ var qn = class {
|
|
|
3445
3477
|
};
|
|
3446
3478
|
//#endregion
|
|
3447
3479
|
//#region src/components/Editor.js
|
|
3448
|
-
|
|
3449
|
-
var
|
|
3480
|
+
z.setOptions({ breaks: !0 });
|
|
3481
|
+
var tr = class {
|
|
3450
3482
|
constructor(e, t = {}) {
|
|
3451
|
-
this.usertextarea = typeof e == "string" ? document.querySelector(e) : e, this.options = t, this.mode = t.mode || "plain", this.preview = this.options.toolbar
|
|
3483
|
+
this.usertextarea = typeof e == "string" ? document.querySelector(e) : e, this.options = t, this.mode = t.mode || "plain", this.preview = !this.options.toolbar || this.options.toolbar.includes("preview"), this.footerOptions = this._parseFooterOptions(t.footer), this.previewTimer = null, this.init(), this.undoRedoManager = new Yn(this), this.listManager = new Zn(this), this.indentManager = new Xn(this), this.shortcutManager = new $n(this), this.findReplace = new er(this);
|
|
3452
3484
|
}
|
|
3453
3485
|
_parseFooterOptions(e) {
|
|
3454
3486
|
if (e === !1) return null;
|
|
@@ -3482,7 +3514,7 @@ var $n = class {
|
|
|
3482
3514
|
e.className = "\n textarea-wrapper\n not-prose\n fj:me-surface\n fj:h-full\n fj:min-h-0\n fj:relative\n fj:grid\n ", this.mode == "hybrid" && (this.displayLayer = document.createElement("div"), this.displayLayer.setAttribute("data-placeholder", this.usertextarea.placeholder), this.displayLayer.setAttribute("aria-hidden", !0), this.displayLayer.className = "\n display-layer\n fj:px-4\n fj:py-2\n fj:whitespace-pre-wrap fj:wrap-break-word\n fj:pointer-events-none\n fj:absolute\n fj:inset-0\n fj:m-0\n fj:box-border\n fj:z-0\n fj:overflow-y-auto\n fj:empty:after:content-[attr(data-placeholder)]\n fj:empty:after:absolute\n fj:empty:after:inset-0\n fj:empty:after:px-4\n fj:empty:after:py-2\n fj:empty:after:text-[CanvasText]\n fj:empty:after:opacity-50\n ", this.usertextarea.className += "\n fj:text-transparent\n fj:caret-primary\n fj:resize-none\n fj:outline-none\n fj:m-0\n fj:box-border\n fj:relative\n fj:z-10\n ", e.appendChild(this.displayLayer)), e.appendChild(this.usertextarea), this.markdownEditorDiv.appendChild(e);
|
|
3483
3515
|
}
|
|
3484
3516
|
addPreviewWrapper() {
|
|
3485
|
-
let e = new
|
|
3517
|
+
let e = new En(this.markdownEditorDiv);
|
|
3486
3518
|
this.previewContent = e.getPreviewContent();
|
|
3487
3519
|
}
|
|
3488
3520
|
addInputListener() {
|
|
@@ -3499,7 +3531,7 @@ var $n = class {
|
|
|
3499
3531
|
}
|
|
3500
3532
|
debouncedPreview() {
|
|
3501
3533
|
this.preview && (clearTimeout(this.previewTimer), this.previewTimer = setTimeout(() => {
|
|
3502
|
-
this.previewContent.innerHTML =
|
|
3534
|
+
this.previewContent.innerHTML = an.sanitize(z(this.usertextarea.value)), this.wirePreviewCheckboxes();
|
|
3503
3535
|
let e = this.usertextarea, t = e.scrollTop / (e.scrollHeight - e.clientHeight);
|
|
3504
3536
|
this.previewContent.scrollTop = t * (this.previewContent.scrollHeight - this.previewContent.clientHeight);
|
|
3505
3537
|
}, 150));
|
|
@@ -3523,10 +3555,10 @@ var $n = class {
|
|
|
3523
3555
|
addFooter() {
|
|
3524
3556
|
if (!this.footerOptions) return;
|
|
3525
3557
|
let { line: e, col: t, chars: n } = this.footerOptions;
|
|
3526
|
-
!e && !t && !n || (this.footer = new
|
|
3558
|
+
!e && !t && !n || (this.footer = new Dn(this.editorContainer, this.footerOptions), this.footer.update(this.usertextarea), this._footerUpdate = () => this.footer.update(this.usertextarea), this.usertextarea.addEventListener("input", this._footerUpdate), this.usertextarea.addEventListener("click", this._footerUpdate), this.usertextarea.addEventListener("keyup", this._footerUpdate), this.usertextarea.addEventListener("focus", this._footerUpdate));
|
|
3527
3559
|
}
|
|
3528
3560
|
addToolbar() {
|
|
3529
|
-
new
|
|
3561
|
+
new Tn(this, this.options.toolbar || [
|
|
3530
3562
|
"undo",
|
|
3531
3563
|
"redo",
|
|
3532
3564
|
"heading",
|
|
@@ -3590,7 +3622,7 @@ var $n = class {
|
|
|
3590
3622
|
this.options.onChange && this.options.onChange(this.usertextarea.value);
|
|
3591
3623
|
}
|
|
3592
3624
|
render() {
|
|
3593
|
-
this._autoGrow(), this.renderHybrid(), this.preview && (this.previewContent.innerHTML =
|
|
3625
|
+
this._autoGrow(), this.renderHybrid(), this.preview && (this.previewContent.innerHTML = an.sanitize(z(this.usertextarea.value)), this.wirePreviewCheckboxes());
|
|
3594
3626
|
}
|
|
3595
3627
|
destroy() {
|
|
3596
3628
|
this.shortcutManager?.destroy(), this.findReplace?.destroy(), this.previewTool?.destroy(), this.undoRedoManager?.destroy(), this.listManager?.destroy(), this._footerUpdate && (this.usertextarea.removeEventListener("input", this._footerUpdate), this.usertextarea.removeEventListener("click", this._footerUpdate), this.usertextarea.removeEventListener("keyup", this._footerUpdate), this.usertextarea.removeEventListener("focus", this._footerUpdate)), this.usertextarea.removeEventListener("input", this._inputHandler), this.usertextarea.removeEventListener("scroll", this._scrollHandler);
|
|
@@ -3622,6 +3654,6 @@ var $n = class {
|
|
|
3622
3654
|
}
|
|
3623
3655
|
};
|
|
3624
3656
|
//#endregion
|
|
3625
|
-
export {
|
|
3657
|
+
export { tr as default };
|
|
3626
3658
|
|
|
3627
3659
|
//# sourceMappingURL=markdown-text-editor.es.js.map
|