markdown-text-editor 1.7.0 → 1.8.0
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/LICENSE +1 -1
- package/README.md +17 -10
- package/dist/markdown-text-editor.es.js +829 -646
- package/dist/markdown-text-editor.es.js.map +1 -1
- package/dist/markdown-text-editor.min.js +73 -71
- package/dist/markdown-text-editor.min.js.map +1 -1
- package/dist/markdown-text-editor.umd.js +73 -71
- package/dist/markdown-text-editor.umd.js.map +1 -1
- package/package.json +13 -8
- package/types/index.d.ts +9 -0
|
@@ -43,7 +43,7 @@ var o = ((e = "") => {
|
|
|
43
43
|
return !1;
|
|
44
44
|
}
|
|
45
45
|
})(), s = {
|
|
46
|
-
codeRemoveIndent: /^(?: {
|
|
46
|
+
codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm,
|
|
47
47
|
outputLinkReplace: /\\([\[\]])/g,
|
|
48
48
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
49
49
|
beginningSpace: /^\s+/,
|
|
@@ -54,6 +54,7 @@ var o = ((e = "") => {
|
|
|
54
54
|
nonSpaceChar: /[^ ]/,
|
|
55
55
|
newLineCharGlobal: /\n/g,
|
|
56
56
|
tabCharGlobal: /\t/g,
|
|
57
|
+
leadingSpaceTab: /^[ \t]+/,
|
|
57
58
|
multipleSpaceGlobal: /\s+/g,
|
|
58
59
|
blankLine: /^[ \t]*$/,
|
|
59
60
|
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
@@ -80,6 +81,7 @@ var o = ((e = "") => {
|
|
|
80
81
|
endAngleBracket: />$/,
|
|
81
82
|
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
82
83
|
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
84
|
+
numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,
|
|
83
85
|
escapeTest: /[&<>"']/,
|
|
84
86
|
escapeReplace: /[&<>"']/g,
|
|
85
87
|
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
@@ -95,104 +97,110 @@ var o = ((e = "") => {
|
|
|
95
97
|
endingNewline: /\n$/,
|
|
96
98
|
listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
97
99
|
nextBulletRegex: i((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
|
|
98
|
-
hrRegex: i((e) => RegExp(`^ {0,${e}}((?:-
|
|
100
|
+
hrRegex: i((e) => RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),
|
|
99
101
|
fencesBeginRegex: i((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
|
|
100
102
|
headingBeginRegex: i((e) => RegExp(`^ {0,${e}}#`)),
|
|
101
|
-
htmlBeginRegex: i((e) => RegExp(`^ {0,${e}}
|
|
103
|
+
htmlBeginRegex: i((e) => RegExp(`^ {0,${e}}(?:</?(?:${y})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")),
|
|
102
104
|
blockquoteBeginRegex: i((e) => RegExp(`^ {0,${e}}>`))
|
|
103
|
-
}, 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 |
|
|
104
|
-
blockquote: a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",
|
|
105
|
+
}, 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 |fences|blockquote|heading|hr|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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), g = 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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), _ = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, v = /^[^\n]+/, ee = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, te = a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ee).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ne = 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", b = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, re = 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][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", b).replace("tag", y).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), x = (e) => a(_).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|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", y).getRegex(), ie = x(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), ae = x(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), oe = {
|
|
106
|
+
blockquote: a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex(),
|
|
105
107
|
code: l,
|
|
106
|
-
def:
|
|
108
|
+
def: te,
|
|
107
109
|
fences: u,
|
|
108
110
|
heading: f,
|
|
109
111
|
hr: d,
|
|
110
|
-
html:
|
|
111
|
-
lheading:
|
|
112
|
+
html: re,
|
|
113
|
+
lheading: h,
|
|
112
114
|
list: ne,
|
|
113
115
|
newline: c,
|
|
114
|
-
paragraph:
|
|
116
|
+
paragraph: ie,
|
|
115
117
|
table: r,
|
|
116
|
-
text:
|
|
117
|
-
},
|
|
118
|
-
...
|
|
119
|
-
lheading:
|
|
120
|
-
table:
|
|
121
|
-
paragraph: a(
|
|
122
|
-
},
|
|
123
|
-
...
|
|
124
|
-
html: a("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",
|
|
118
|
+
text: v
|
|
119
|
+
}, se = 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|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", y).getRegex(), ce = {
|
|
120
|
+
...oe,
|
|
121
|
+
lheading: g,
|
|
122
|
+
table: se,
|
|
123
|
+
paragraph: a(_).replace("hr", d).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", y).getRegex()
|
|
124
|
+
}, le = {
|
|
125
|
+
...oe,
|
|
126
|
+
html: a("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", b).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(),
|
|
125
127
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
126
128
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
127
129
|
fences: r,
|
|
128
130
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
129
|
-
paragraph: a(
|
|
130
|
-
},
|
|
131
|
+
paragraph: a(_).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()
|
|
132
|
+
}, ue = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, de = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, fe = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, pe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, S = /[\p{P}\p{S}]/u, me = /[\s\p{P}\p{S}]/u, he = /[^\s\p{P}\p{S}]/u, ge = a(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, me).getRegex(), C = /[\p{Pi}\p{Ps}"']/u, _e = /(?!~)[\p{P}\p{S}]/u, ve = /(?!~)[\s\p{P}\p{S}]/u, ye = /(?:[^\s\p{P}\p{S}]|~)/u, be = 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(), xe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Se = a(xe, "u").replace(/punct/g, S).getRegex(), Ce = a(xe, "u").replace(/punct/g, _e).getRegex(), we = a(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, C).replace(/punct/g, S).getRegex(), Te = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", w = a(Te, "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), Ee = a(Te, "gu").replace(/notPunctSpace/g, ye).replace(/punctSpace/g, ve).replace(/punct/g, _e).getRegex(), T = a("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), De = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), E = a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), Oe = a(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, S).getRegex(), ke = a("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, S).getRegex(), D = a(/\\(punct)/, "gu").replace(/punct/g, S).getRegex(), Ae = 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(), je = a(b).replace("(?:-->|$)", "-->").getRegex(), Me = a("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ne = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, O = a(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Ne).getRegex(), Pe = a(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", O).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Fe = a(/^!?\[(label)\]\[(ref)\]/).replace("label", O).replace("ref", ee).getRegex(), Ie = a(/^!?\[(ref)\](?:\[\])?/).replace("ref", ee).getRegex(), Le = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, Re = a(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Ne).getRegex(), ze = a("reflink|nolink(?!\\()", "g").replace("reflink", a(/^!?\[(label)\]\[(ref)\]/).replace("label", Re).replace("ref", Le).getRegex()).replace("nolink", a(/^!?\[(ref)\](?:\[\])?/).replace("ref", Le).getRegex()).getRegex(), Be = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Ve = a(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), He = {
|
|
131
133
|
_backpedal: r,
|
|
132
|
-
anyPunctuation:
|
|
133
|
-
autolink:
|
|
134
|
-
blockSkip:
|
|
135
|
-
br:
|
|
136
|
-
code:
|
|
134
|
+
anyPunctuation: D,
|
|
135
|
+
autolink: Ae,
|
|
136
|
+
blockSkip: be,
|
|
137
|
+
br: fe,
|
|
138
|
+
code: de,
|
|
137
139
|
del: r,
|
|
138
140
|
delLDelim: r,
|
|
139
141
|
delRDelim: r,
|
|
140
|
-
emStrongLDelim:
|
|
141
|
-
emStrongRDelimAst: C,
|
|
142
|
-
emStrongRDelimUnd: Oe,
|
|
143
|
-
escape: de,
|
|
144
|
-
link: D,
|
|
145
|
-
nolink: k,
|
|
146
|
-
punctuation: _e,
|
|
147
|
-
reflink: O,
|
|
148
|
-
reflinkSearch: Fe,
|
|
149
|
-
tag: Ne,
|
|
150
|
-
text: me,
|
|
151
|
-
url: r
|
|
152
|
-
}, Re = {
|
|
153
|
-
...Le,
|
|
154
|
-
emStrongLDelim: Te,
|
|
142
|
+
emStrongLDelim: Se,
|
|
155
143
|
emStrongRDelimAst: w,
|
|
156
|
-
emStrongRDelimUnd:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
144
|
+
emStrongRDelimUnd: De,
|
|
145
|
+
escape: ue,
|
|
146
|
+
link: Pe,
|
|
147
|
+
nolink: Ie,
|
|
148
|
+
punctuation: ge,
|
|
149
|
+
reflink: Fe,
|
|
150
|
+
reflinkSearch: ze,
|
|
151
|
+
tag: Me,
|
|
152
|
+
text: pe,
|
|
153
|
+
url: r
|
|
154
|
+
}, Ue = {
|
|
155
|
+
...He,
|
|
162
156
|
emStrongLDelim: we,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
emStrongRDelimAst: T,
|
|
158
|
+
emStrongRDelimUnd: E,
|
|
159
|
+
link: a(/^!?\[(label)\]\((.*?)\)/).replace("label", O).getRegex(),
|
|
160
|
+
reflink: a(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", O).getRegex()
|
|
161
|
+
}, We = {
|
|
162
|
+
...He,
|
|
163
|
+
emStrongRDelimAst: Ee,
|
|
164
|
+
emStrongLDelim: Ce,
|
|
165
|
+
delLDelim: Oe,
|
|
166
|
+
delRDelim: ke,
|
|
167
|
+
url: a(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Ve).replace("protocol", Be).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),
|
|
166
168
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
167
169
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
168
|
-
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",
|
|
169
|
-
},
|
|
170
|
-
...
|
|
171
|
-
br: a(
|
|
172
|
-
text: a(
|
|
173
|
-
},
|
|
174
|
-
normal:
|
|
175
|
-
gfm:
|
|
176
|
-
pedantic:
|
|
177
|
-
},
|
|
178
|
-
normal:
|
|
179
|
-
gfm:
|
|
180
|
-
breaks:
|
|
181
|
-
pedantic:
|
|
182
|
-
},
|
|
170
|
+
text: a(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", Be).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex()
|
|
171
|
+
}, Ge = {
|
|
172
|
+
...We,
|
|
173
|
+
br: a(fe).replace("{2,}", "*").getRegex(),
|
|
174
|
+
text: a(We.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
175
|
+
}, Ke = {
|
|
176
|
+
normal: oe,
|
|
177
|
+
gfm: ce,
|
|
178
|
+
pedantic: le
|
|
179
|
+
}, qe = {
|
|
180
|
+
normal: He,
|
|
181
|
+
gfm: We,
|
|
182
|
+
breaks: Ge,
|
|
183
|
+
pedantic: Ue
|
|
184
|
+
}, Je = {
|
|
183
185
|
"&": "&",
|
|
184
186
|
"<": "<",
|
|
185
187
|
">": ">",
|
|
186
188
|
"\"": """,
|
|
187
189
|
"'": "'"
|
|
188
|
-
},
|
|
189
|
-
function
|
|
190
|
+
}, Ye = (e) => Je[e];
|
|
191
|
+
function k(e, t) {
|
|
190
192
|
if (t) {
|
|
191
|
-
if (s.escapeTest.test(e)) return e.replace(s.escapeReplace,
|
|
192
|
-
} else if (s.escapeTestNoEncode.test(e)) return e.replace(s.escapeReplaceNoEncode,
|
|
193
|
+
if (s.escapeTest.test(e)) return e.replace(s.escapeReplace, Ye);
|
|
194
|
+
} else if (s.escapeTestNoEncode.test(e)) return e.replace(s.escapeReplaceNoEncode, Ye);
|
|
193
195
|
return e;
|
|
194
196
|
}
|
|
195
|
-
function
|
|
197
|
+
function Xe(e) {
|
|
198
|
+
return e.replace(s.numericCharacterReference, (e, t, n) => {
|
|
199
|
+
let r = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
|
|
200
|
+
return r === 0 || r > 1114111 || r >= 55296 && r <= 57343 ? "�" : String.fromCodePoint(r);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function Ze(e) {
|
|
196
204
|
try {
|
|
197
205
|
e = encodeURI(e).replace(s.percentDecode, "%");
|
|
198
206
|
} catch {
|
|
@@ -200,7 +208,7 @@ function We(e) {
|
|
|
200
208
|
}
|
|
201
209
|
return e;
|
|
202
210
|
}
|
|
203
|
-
function
|
|
211
|
+
function Qe(e, t) {
|
|
204
212
|
let n = e.replace(s.findPipe, (e, t, n) => {
|
|
205
213
|
let r = !1, i = t;
|
|
206
214
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
@@ -213,7 +221,7 @@ function Ge(e, t) {
|
|
|
213
221
|
for (; r < n.length; r++) n[r] = n[r].trim().replace(s.slashPipe, "|");
|
|
214
222
|
return n;
|
|
215
223
|
}
|
|
216
|
-
function
|
|
224
|
+
function A(e, t, n) {
|
|
217
225
|
let r = e.length;
|
|
218
226
|
if (r === 0) return "";
|
|
219
227
|
let i = 0;
|
|
@@ -225,12 +233,15 @@ function M(e, t, n) {
|
|
|
225
233
|
}
|
|
226
234
|
return e.slice(0, r - i);
|
|
227
235
|
}
|
|
228
|
-
function
|
|
236
|
+
function $e(e) {
|
|
229
237
|
let t = e.split("\n"), n = t.length - 1;
|
|
230
238
|
for (; n >= 0 && s.blankLine.test(t[n]);) n--;
|
|
231
239
|
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
232
240
|
}
|
|
233
|
-
function
|
|
241
|
+
function j(e) {
|
|
242
|
+
return e.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
243
|
+
}
|
|
244
|
+
function M(e, t) {
|
|
234
245
|
if (e.indexOf(t[1]) === -1) return -1;
|
|
235
246
|
let n = 0;
|
|
236
247
|
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
@@ -238,7 +249,7 @@ function qe(e, t) {
|
|
|
238
249
|
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
239
250
|
return n > 0 ? -2 : -1;
|
|
240
251
|
}
|
|
241
|
-
function
|
|
252
|
+
function N(e, t = 0) {
|
|
242
253
|
let n = t, r = "";
|
|
243
254
|
for (let t of e) if (t === " ") {
|
|
244
255
|
let e = 4 - n % 4;
|
|
@@ -246,7 +257,7 @@ function Je(e, t = 0) {
|
|
|
246
257
|
} else r += t, n++;
|
|
247
258
|
return r;
|
|
248
259
|
}
|
|
249
|
-
function
|
|
260
|
+
function et(e, t, n, r, i) {
|
|
250
261
|
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1"), c = e[0].charAt(0) === "!";
|
|
251
262
|
r.state.inLink = !0;
|
|
252
263
|
let l = r.state.linkEmitted, u = r.state.inRawBlock;
|
|
@@ -268,7 +279,7 @@ function Ye(e, t, n, r, i) {
|
|
|
268
279
|
tokens: d
|
|
269
280
|
};
|
|
270
281
|
}
|
|
271
|
-
function
|
|
282
|
+
function tt(e, t, n) {
|
|
272
283
|
let r = e.match(n.other.indentCodeCompensation);
|
|
273
284
|
if (r === null) return t;
|
|
274
285
|
let i = r[1];
|
|
@@ -279,7 +290,30 @@ function Xe(e, t, n) {
|
|
|
279
290
|
return e.slice(Math.min(r.length, i.length));
|
|
280
291
|
}).join("\n");
|
|
281
292
|
}
|
|
282
|
-
|
|
293
|
+
function nt(e, t, n, r) {
|
|
294
|
+
if (!t.includes("<")) return !1;
|
|
295
|
+
for (let i = 0; i < t.length; i++) {
|
|
296
|
+
if (t[i] === "\\") {
|
|
297
|
+
i++;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (t[i] === "`") {
|
|
301
|
+
let e = r.inline.code.exec(t.slice(i));
|
|
302
|
+
if (e) {
|
|
303
|
+
i += e[0].length - 1;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (t[i] !== "<") continue;
|
|
308
|
+
let a = e.slice(n + i), o = r.inline.tag.exec(a) || r.inline.autolink.exec(a);
|
|
309
|
+
if (o) {
|
|
310
|
+
if (o[0].length > t.length - i) return !0;
|
|
311
|
+
i += o[0].length - 1;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return !1;
|
|
315
|
+
}
|
|
316
|
+
var rt = class {
|
|
283
317
|
options;
|
|
284
318
|
rules;
|
|
285
319
|
lexer;
|
|
@@ -296,7 +330,7 @@ var Ze = class {
|
|
|
296
330
|
code(e) {
|
|
297
331
|
let t = this.rules.block.code.exec(e);
|
|
298
332
|
if (t) {
|
|
299
|
-
let e = this.options.pedantic ? t[0] :
|
|
333
|
+
let e = this.options.pedantic ? t[0] : $e(t[0]);
|
|
300
334
|
return {
|
|
301
335
|
type: "code",
|
|
302
336
|
raw: e,
|
|
@@ -308,7 +342,7 @@ var Ze = class {
|
|
|
308
342
|
fences(e) {
|
|
309
343
|
let t = this.rules.block.fences.exec(e);
|
|
310
344
|
if (t) {
|
|
311
|
-
let e = t[0], n =
|
|
345
|
+
let e = t[0], n = tt(e, t[3] || "", this.rules);
|
|
312
346
|
return {
|
|
313
347
|
type: "code",
|
|
314
348
|
raw: e,
|
|
@@ -322,12 +356,12 @@ var Ze = class {
|
|
|
322
356
|
if (t) {
|
|
323
357
|
let e = t[2].trim();
|
|
324
358
|
if (this.rules.other.endingHash.test(e)) {
|
|
325
|
-
let t =
|
|
359
|
+
let t = A(e, "#");
|
|
326
360
|
(this.options.pedantic || !t || this.rules.other.endingSpaceTabChar.test(t)) && (e = t.trim());
|
|
327
361
|
}
|
|
328
362
|
return {
|
|
329
363
|
type: "heading",
|
|
330
|
-
raw:
|
|
364
|
+
raw: A(t[0], "\n"),
|
|
331
365
|
depth: t[1].length,
|
|
332
366
|
text: e,
|
|
333
367
|
tokens: this.lexer.inline(e)
|
|
@@ -338,16 +372,16 @@ var Ze = class {
|
|
|
338
372
|
let t = this.rules.block.hr.exec(e);
|
|
339
373
|
if (t) return {
|
|
340
374
|
type: "hr",
|
|
341
|
-
raw:
|
|
375
|
+
raw: A(t[0], "\n")
|
|
342
376
|
};
|
|
343
377
|
}
|
|
344
378
|
blockquote(e) {
|
|
345
379
|
let t = this.rules.block.blockquote.exec(e);
|
|
346
380
|
if (t) {
|
|
347
|
-
let e =
|
|
381
|
+
let e = A(t[0], "\n").split("\n"), n = "", r = "", i = [];
|
|
348
382
|
for (; e.length > 0;) {
|
|
349
|
-
let t = !1, a = [], o;
|
|
350
|
-
for (
|
|
383
|
+
let t = !1, a = [], o = 0;
|
|
384
|
+
for (; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
|
|
351
385
|
else if (!t) a.push(e[o]);
|
|
352
386
|
else break;
|
|
353
387
|
e = e.slice(o);
|
|
@@ -361,8 +395,10 @@ ${c}` : c;
|
|
|
361
395
|
if (u?.type === "code") break;
|
|
362
396
|
if (u?.type === "blockquote") {
|
|
363
397
|
let t = u, a = e.join("\n"), o = t.raw + "\n" + a.replace(this.rules.other.blockquoteSetextReplace2, ""), s = this.blockquote(o);
|
|
364
|
-
i[i.length - 1] = s
|
|
365
|
-
|
|
398
|
+
i[i.length - 1] = s;
|
|
399
|
+
let c = o.substring(s.raw.length).replace(/^\n/, ""), l = c ? c.split("\n").length : 0, d = l ? e.slice(0, -l) : e;
|
|
400
|
+
d.length > 0 && (n = `${n}
|
|
401
|
+
${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
366
402
|
break;
|
|
367
403
|
}
|
|
368
404
|
if (u?.type === "list") {
|
|
@@ -396,18 +432,18 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
396
432
|
let n = !1, r = "", s = "";
|
|
397
433
|
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
398
434
|
r = t[0], e = e.substring(r.length);
|
|
399
|
-
let c =
|
|
400
|
-
if (this.options.pedantic ? (
|
|
401
|
-
let t = this.rules.other.nextBulletRegex(
|
|
435
|
+
let c = t[2].split("\n", 1)[0], l = t[1].length, u = this.options.pedantic ? N(c, l) : c.replace(this.rules.other.leadingSpaceTab, (e) => N(e, l)), d = e.split("\n", 1)[0], f = !u.trim(), p = 0;
|
|
436
|
+
if (this.options.pedantic ? (p = 2, s = u.trimStart()) : f ? p = l + 1 : (p = u.search(this.rules.other.nonSpaceChar), p = p > 4 ? 1 : p, s = u.slice(p), p += l), f && this.rules.other.blankLine.test(d) && (r += d + "\n", e = e.substring(d.length + 1), n = !0), !n) {
|
|
437
|
+
let t = this.rules.other.nextBulletRegex(p), n = this.rules.other.hrRegex(p), i = this.rules.other.fencesBeginRegex(p), a = this.rules.other.headingBeginRegex(p), o = this.rules.other.htmlBeginRegex(p), c = this.rules.other.blockquoteBeginRegex(p);
|
|
402
438
|
for (; e;) {
|
|
403
|
-
let
|
|
404
|
-
if (
|
|
405
|
-
if (m.search(this.rules.other.nonSpaceChar) >=
|
|
439
|
+
let l = e.split("\n", 1)[0], m;
|
|
440
|
+
if (d = l, this.options.pedantic ? (d = d.replace(this.rules.other.listReplaceNesting, " "), m = d) : m = d.replace(this.rules.other.leadingSpaceTab, (e) => e.replace(this.rules.other.tabCharGlobal, " ")), i.test(d) || a.test(d) || o.test(d) || c.test(d) || t.test(d) || n.test(d)) break;
|
|
441
|
+
if (m.search(this.rules.other.nonSpaceChar) >= p || !d.trim()) s += "\n" + m.slice(p);
|
|
406
442
|
else {
|
|
407
|
-
if (
|
|
408
|
-
s += "\n" +
|
|
443
|
+
if (f || u.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(u) || a.test(u) || n.test(u)) break;
|
|
444
|
+
s += "\n" + d;
|
|
409
445
|
}
|
|
410
|
-
|
|
446
|
+
f = !d.trim(), r += l + "\n", e = e.substring(l.length + 1), u = m.slice(p);
|
|
411
447
|
}
|
|
412
448
|
}
|
|
413
449
|
i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
|
|
@@ -461,7 +497,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
461
497
|
html(e) {
|
|
462
498
|
let t = this.rules.block.html.exec(e);
|
|
463
499
|
if (t) {
|
|
464
|
-
let e =
|
|
500
|
+
let e = $e(t[0]);
|
|
465
501
|
return {
|
|
466
502
|
type: "html",
|
|
467
503
|
block: !0,
|
|
@@ -474,11 +510,11 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
474
510
|
def(e) {
|
|
475
511
|
let t = this.rules.block.def.exec(e);
|
|
476
512
|
if (t) {
|
|
477
|
-
let e = t[1]
|
|
513
|
+
let e = j(t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
478
514
|
return {
|
|
479
515
|
type: "def",
|
|
480
516
|
tag: e,
|
|
481
|
-
raw:
|
|
517
|
+
raw: A(t[0], "\n"),
|
|
482
518
|
href: n,
|
|
483
519
|
title: r
|
|
484
520
|
};
|
|
@@ -487,9 +523,9 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
487
523
|
table(e) {
|
|
488
524
|
let t = this.rules.block.table.exec(e);
|
|
489
525
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
490
|
-
let n =
|
|
526
|
+
let n = Qe(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 = {
|
|
491
527
|
type: "table",
|
|
492
|
-
raw:
|
|
528
|
+
raw: A(t[0], "\n"),
|
|
493
529
|
header: [],
|
|
494
530
|
align: [],
|
|
495
531
|
rows: []
|
|
@@ -502,7 +538,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
502
538
|
header: !0,
|
|
503
539
|
align: a.align[e]
|
|
504
540
|
});
|
|
505
|
-
for (let e of i) a.rows.push(
|
|
541
|
+
for (let e of i) a.rows.push(Qe(e, a.header.length).map((e, t) => ({
|
|
506
542
|
text: e,
|
|
507
543
|
tokens: this.lexer.inline(e),
|
|
508
544
|
header: !1,
|
|
@@ -517,7 +553,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
517
553
|
let e = t[1].trim();
|
|
518
554
|
return {
|
|
519
555
|
type: "heading",
|
|
520
|
-
raw:
|
|
556
|
+
raw: A(t[0], "\n"),
|
|
521
557
|
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
522
558
|
text: e,
|
|
523
559
|
tokens: this.lexer.inline(e)
|
|
@@ -567,35 +603,39 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
567
603
|
link(e) {
|
|
568
604
|
let t = this.rules.inline.link.exec(e);
|
|
569
605
|
if (t) {
|
|
570
|
-
let
|
|
571
|
-
if (!this.options.pedantic && this.rules
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
if (
|
|
606
|
+
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
607
|
+
if (!this.options.pedantic && nt(e, t[1], n, this.rules)) return;
|
|
608
|
+
let r = t[2].trim();
|
|
609
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
|
|
610
|
+
if (!this.rules.other.endAngleBracket.test(r)) return;
|
|
611
|
+
let e = A(r.slice(0, -1), "\\");
|
|
612
|
+
if ((r.length - e.length) % 2 == 0) return;
|
|
575
613
|
} else {
|
|
576
|
-
let e =
|
|
614
|
+
let e = M(t[2], "()");
|
|
577
615
|
if (e === -2) return;
|
|
578
616
|
if (e > -1) {
|
|
579
617
|
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
580
618
|
t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
|
|
581
619
|
}
|
|
582
620
|
}
|
|
583
|
-
let
|
|
621
|
+
let i = t[2], a = "";
|
|
584
622
|
if (this.options.pedantic) {
|
|
585
|
-
let e = this.rules.other.pedanticHrefTitle.exec(
|
|
586
|
-
e && (
|
|
587
|
-
} else
|
|
588
|
-
return
|
|
589
|
-
href:
|
|
590
|
-
title:
|
|
623
|
+
let e = this.rules.other.pedanticHrefTitle.exec(i);
|
|
624
|
+
e && (i = e[1], a = e[3]);
|
|
625
|
+
} else a = t[3] ? t[3].slice(1, -1) : "";
|
|
626
|
+
return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (i = this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? i.slice(1) : i.slice(1, -1)), et(t, {
|
|
627
|
+
href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
628
|
+
title: a && a.replace(this.rules.inline.anyPunctuation, "$1")
|
|
591
629
|
}, t[0], this.lexer, this.rules);
|
|
592
630
|
}
|
|
593
631
|
}
|
|
594
632
|
reflink(e, t) {
|
|
595
633
|
let n;
|
|
596
634
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
597
|
-
let
|
|
598
|
-
if (!e)
|
|
635
|
+
let r = n[0].charAt(0) === "!" ? 2 : 1;
|
|
636
|
+
if (!this.options.pedantic && nt(e, n[1], r, this.rules)) return;
|
|
637
|
+
let i = t[j((n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "))];
|
|
638
|
+
if (!i) {
|
|
599
639
|
let e = n[0].charAt(0);
|
|
600
640
|
return {
|
|
601
641
|
type: "text",
|
|
@@ -603,7 +643,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
603
643
|
text: e
|
|
604
644
|
};
|
|
605
645
|
}
|
|
606
|
-
return
|
|
646
|
+
return et(n, i, n[0], this.lexer, this.rules);
|
|
607
647
|
}
|
|
608
648
|
}
|
|
609
649
|
emStrong(e, t, n = "") {
|
|
@@ -736,19 +776,19 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
736
776
|
return {
|
|
737
777
|
type: "text",
|
|
738
778
|
raw: t[0],
|
|
739
|
-
text: t[0],
|
|
779
|
+
text: e ? t[0] : Xe(t[0]),
|
|
740
780
|
escaped: e
|
|
741
781
|
};
|
|
742
782
|
}
|
|
743
783
|
}
|
|
744
|
-
},
|
|
784
|
+
}, P = class e {
|
|
745
785
|
tokens;
|
|
746
786
|
options;
|
|
747
787
|
state;
|
|
748
788
|
inlineQueue;
|
|
749
789
|
tokenizer;
|
|
750
790
|
constructor(e) {
|
|
751
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || t, this.options.tokenizer = this.options.tokenizer || new
|
|
791
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || t, this.options.tokenizer = this.options.tokenizer || new rt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
752
792
|
inLink: !1,
|
|
753
793
|
inRawBlock: !1,
|
|
754
794
|
linkEmitted: !1,
|
|
@@ -756,15 +796,15 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
756
796
|
};
|
|
757
797
|
let n = {
|
|
758
798
|
other: s,
|
|
759
|
-
block:
|
|
760
|
-
inline:
|
|
799
|
+
block: Ke.normal,
|
|
800
|
+
inline: qe.normal
|
|
761
801
|
};
|
|
762
|
-
this.options.pedantic ? (n.block =
|
|
802
|
+
this.options.pedantic ? (n.block = Ke.pedantic, n.inline = qe.pedantic) : this.options.gfm && (n.block = Ke.gfm, n.inline = this.options.breaks ? qe.breaks : qe.gfm), this.tokenizer.rules = n;
|
|
763
803
|
}
|
|
764
804
|
static get rules() {
|
|
765
805
|
return {
|
|
766
|
-
block:
|
|
767
|
-
inline:
|
|
806
|
+
block: Ke,
|
|
807
|
+
inline: qe
|
|
768
808
|
};
|
|
769
809
|
}
|
|
770
810
|
static lex(t, n) {
|
|
@@ -882,7 +922,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
882
922
|
for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return !0;
|
|
883
923
|
for (let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
884
924
|
let e = t[0], n = e.lastIndexOf("[");
|
|
885
|
-
if (
|
|
925
|
+
if (e.charAt(0) !== "!" && Object.hasOwn(this.tokens.links, j(e.slice(n + 1, -1))) && !(n > 1 && this.linkInText(e.slice(1, n - 1)))) return !0;
|
|
886
926
|
}
|
|
887
927
|
return !1;
|
|
888
928
|
}
|
|
@@ -892,7 +932,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
892
932
|
if (this.tokens.links && e.includes("[")) {
|
|
893
933
|
let e = this.tokenizer.rules.inline.reflinkSearch, t = (n) => {
|
|
894
934
|
let r = n.lastIndexOf("[");
|
|
895
|
-
if (!Object.hasOwn(this.tokens.links, n.slice(r + 1, -1))) return n;
|
|
935
|
+
if (!Object.hasOwn(this.tokens.links, j(n.slice(r + 1, -1)))) return n;
|
|
896
936
|
if (r > 1 && n.charAt(0) !== "!") {
|
|
897
937
|
let i = n.slice(1, r - 1);
|
|
898
938
|
if (this.linkInText(i)) return "[" + i.replace(e, t) + "][" + "a".repeat(n.length - r - 2) + "]";
|
|
@@ -982,7 +1022,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
982
1022
|
if (this.options.silent) console.error(t);
|
|
983
1023
|
else throw Error(t);
|
|
984
1024
|
}
|
|
985
|
-
},
|
|
1025
|
+
}, it = class {
|
|
986
1026
|
options;
|
|
987
1027
|
parser;
|
|
988
1028
|
constructor(e) {
|
|
@@ -993,7 +1033,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
993
1033
|
}
|
|
994
1034
|
code({ text: e, lang: t, escaped: n }) {
|
|
995
1035
|
let r = (t || "").match(s.notSpaceStart)?.[0], i = e ? e.replace(s.endingNewline, "") + "\n" : "";
|
|
996
|
-
return r ? "<pre><code class=\"language-" +
|
|
1036
|
+
return r ? "<pre><code class=\"language-" + k(r) + "\">" + (n ? i : k(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : k(i, !0)) + "</code></pre>\n";
|
|
997
1037
|
}
|
|
998
1038
|
blockquote({ tokens: e }) {
|
|
999
1039
|
return `<blockquote>
|
|
@@ -1063,7 +1103,7 @@ ${e}</tr>
|
|
|
1063
1103
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1064
1104
|
}
|
|
1065
1105
|
codespan({ text: e }) {
|
|
1066
|
-
return `<code>${
|
|
1106
|
+
return `<code>${k(e, !0)}</code>`;
|
|
1067
1107
|
}
|
|
1068
1108
|
br(e) {
|
|
1069
1109
|
return "<br>";
|
|
@@ -1072,24 +1112,24 @@ ${e}</tr>
|
|
|
1072
1112
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1073
1113
|
}
|
|
1074
1114
|
link({ href: e, title: t, text: n, tokens: r, autolink: i }) {
|
|
1075
|
-
let a = i ?
|
|
1115
|
+
let a = i ? k(n, !0) : this.parser.parseInline(r), o = Ze(e);
|
|
1076
1116
|
if (o === null) return a;
|
|
1077
|
-
e =
|
|
1117
|
+
e = k(o, i);
|
|
1078
1118
|
let s = "<a href=\"" + e + "\"";
|
|
1079
|
-
return t && (s += " title=\"" +
|
|
1119
|
+
return t && (s += " title=\"" + k(t) + "\""), s += ">" + a + "</a>", s;
|
|
1080
1120
|
}
|
|
1081
1121
|
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1082
1122
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1083
|
-
let i =
|
|
1084
|
-
if (i === null) return
|
|
1123
|
+
let i = Ze(e);
|
|
1124
|
+
if (i === null) return k(n);
|
|
1085
1125
|
e = i;
|
|
1086
|
-
let a = `<img src="${
|
|
1087
|
-
return t && (a += ` title="${
|
|
1126
|
+
let a = `<img src="${k(e)}" alt="${k(n)}"`;
|
|
1127
|
+
return t && (a += ` title="${k(t)}"`), a += ">", a;
|
|
1088
1128
|
}
|
|
1089
1129
|
text(e) {
|
|
1090
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text :
|
|
1130
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : k(e.text);
|
|
1091
1131
|
}
|
|
1092
|
-
},
|
|
1132
|
+
}, at = class {
|
|
1093
1133
|
strong({ text: e }) {
|
|
1094
1134
|
return e;
|
|
1095
1135
|
}
|
|
@@ -1120,12 +1160,12 @@ ${e}</tr>
|
|
|
1120
1160
|
checkbox({ raw: e }) {
|
|
1121
1161
|
return e;
|
|
1122
1162
|
}
|
|
1123
|
-
},
|
|
1163
|
+
}, F = class e {
|
|
1124
1164
|
options;
|
|
1125
1165
|
renderer;
|
|
1126
1166
|
textRenderer;
|
|
1127
1167
|
constructor(e) {
|
|
1128
|
-
this.options = e || t, this.options.renderer = this.options.renderer || new
|
|
1168
|
+
this.options = e || t, this.options.renderer = this.options.renderer || new it(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new at();
|
|
1129
1169
|
}
|
|
1130
1170
|
static parse(t, n) {
|
|
1131
1171
|
return new e(n).parse(t);
|
|
@@ -1273,7 +1313,7 @@ ${e}</tr>
|
|
|
1273
1313
|
}
|
|
1274
1314
|
return n;
|
|
1275
1315
|
}
|
|
1276
|
-
},
|
|
1316
|
+
}, I = class {
|
|
1277
1317
|
options;
|
|
1278
1318
|
block;
|
|
1279
1319
|
constructor(e) {
|
|
@@ -1303,22 +1343,22 @@ ${e}</tr>
|
|
|
1303
1343
|
return e;
|
|
1304
1344
|
}
|
|
1305
1345
|
provideLexer(e = this.block) {
|
|
1306
|
-
return e ?
|
|
1346
|
+
return e ? P.lex : P.lexInline;
|
|
1307
1347
|
}
|
|
1308
1348
|
provideParser(e = this.block) {
|
|
1309
|
-
return e ?
|
|
1349
|
+
return e ? F.parse : F.parseInline;
|
|
1310
1350
|
}
|
|
1311
|
-
},
|
|
1351
|
+
}, ot = class {
|
|
1312
1352
|
defaults = e();
|
|
1313
1353
|
options = this.setOptions;
|
|
1314
1354
|
parse = this.parseMarkdown(!0);
|
|
1315
1355
|
parseInline = this.parseMarkdown(!1);
|
|
1316
|
-
Parser =
|
|
1317
|
-
Renderer =
|
|
1318
|
-
TextRenderer =
|
|
1319
|
-
Lexer =
|
|
1320
|
-
Tokenizer =
|
|
1321
|
-
Hooks =
|
|
1356
|
+
Parser = F;
|
|
1357
|
+
Renderer = it;
|
|
1358
|
+
TextRenderer = at;
|
|
1359
|
+
Lexer = P;
|
|
1360
|
+
Tokenizer = rt;
|
|
1361
|
+
Hooks = I;
|
|
1322
1362
|
constructor(...e) {
|
|
1323
1363
|
this.use(...e);
|
|
1324
1364
|
}
|
|
@@ -1369,7 +1409,7 @@ ${e}</tr>
|
|
|
1369
1409
|
}
|
|
1370
1410
|
"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
|
|
1371
1411
|
}), n.extensions = t), e.renderer) {
|
|
1372
|
-
let t = this.defaults.renderer || new
|
|
1412
|
+
let t = this.defaults.renderer || new it(this.defaults);
|
|
1373
1413
|
for (let n in e.renderer) {
|
|
1374
1414
|
if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
|
|
1375
1415
|
if (["options", "parser"].includes(n)) continue;
|
|
@@ -1382,7 +1422,7 @@ ${e}</tr>
|
|
|
1382
1422
|
n.renderer = t;
|
|
1383
1423
|
}
|
|
1384
1424
|
if (e.tokenizer) {
|
|
1385
|
-
let t = this.defaults.tokenizer || new
|
|
1425
|
+
let t = this.defaults.tokenizer || new rt(this.defaults);
|
|
1386
1426
|
for (let n in e.tokenizer) {
|
|
1387
1427
|
if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
|
|
1388
1428
|
if ([
|
|
@@ -1399,13 +1439,13 @@ ${e}</tr>
|
|
|
1399
1439
|
n.tokenizer = t;
|
|
1400
1440
|
}
|
|
1401
1441
|
if (e.hooks) {
|
|
1402
|
-
let t = this.defaults.hooks || new
|
|
1442
|
+
let t = this.defaults.hooks || new I();
|
|
1403
1443
|
for (let n in e.hooks) {
|
|
1404
1444
|
if (!(n in t)) throw Error(`hook '${n}' does not exist`);
|
|
1405
1445
|
if (["options", "block"].includes(n)) continue;
|
|
1406
1446
|
let r = n, i = e.hooks[r], a = t[r];
|
|
1407
|
-
t[r] =
|
|
1408
|
-
if (this.defaults.async &&
|
|
1447
|
+
t[r] = I.passThroughHooks.has(n) ? (e) => {
|
|
1448
|
+
if (this.defaults.async && I.passThroughHooksRespectAsync.has(n)) return (async () => {
|
|
1409
1449
|
let n = await i.call(t, e);
|
|
1410
1450
|
return a.call(t, n);
|
|
1411
1451
|
})();
|
|
@@ -1442,10 +1482,10 @@ ${e}</tr>
|
|
|
1442
1482
|
}, this;
|
|
1443
1483
|
}
|
|
1444
1484
|
lexer(e, t) {
|
|
1445
|
-
return
|
|
1485
|
+
return P.lex(e, t ?? this.defaults);
|
|
1446
1486
|
}
|
|
1447
1487
|
parser(e, t) {
|
|
1448
|
-
return
|
|
1488
|
+
return F.parse(e, t ?? this.defaults);
|
|
1449
1489
|
}
|
|
1450
1490
|
parseMarkdown(e) {
|
|
1451
1491
|
return (t, n) => {
|
|
@@ -1457,16 +1497,16 @@ ${e}</tr>
|
|
|
1457
1497
|
if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
1458
1498
|
if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
1459
1499
|
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
1460
|
-
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ?
|
|
1500
|
+
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? P.lex : P.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
|
|
1461
1501
|
i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
|
|
1462
|
-
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ?
|
|
1502
|
+
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? F.parse : F.parseInline)(a, i);
|
|
1463
1503
|
return i.hooks ? await i.hooks.postprocess(o) : o;
|
|
1464
1504
|
})().catch(a);
|
|
1465
1505
|
try {
|
|
1466
1506
|
i.hooks && (t = i.hooks.preprocess(t));
|
|
1467
|
-
let n = (i.hooks ? i.hooks.provideLexer(e) : e ?
|
|
1507
|
+
let n = (i.hooks ? i.hooks.provideLexer(e) : e ? P.lex : P.lexInline)(t, i);
|
|
1468
1508
|
i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
|
|
1469
|
-
let r = (i.hooks ? i.hooks.provideParser(e) : e ?
|
|
1509
|
+
let r = (i.hooks ? i.hooks.provideParser(e) : e ? F.parse : F.parseInline)(n, i);
|
|
1470
1510
|
return i.hooks && (r = i.hooks.postprocess(r)), r;
|
|
1471
1511
|
} catch (e) {
|
|
1472
1512
|
return a(e);
|
|
@@ -1476,42 +1516,48 @@ ${e}</tr>
|
|
|
1476
1516
|
onError(e, t) {
|
|
1477
1517
|
return (n) => {
|
|
1478
1518
|
if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
|
|
1479
|
-
let e = "<p>An error occurred:</p><pre>" +
|
|
1519
|
+
let e = "<p>An error occurred:</p><pre>" + k(n.message + "", !0) + "</pre>";
|
|
1480
1520
|
return t ? Promise.resolve(e) : e;
|
|
1481
1521
|
}
|
|
1482
1522
|
if (t) return Promise.reject(n);
|
|
1483
1523
|
throw n;
|
|
1484
1524
|
};
|
|
1485
1525
|
}
|
|
1486
|
-
}, L = new
|
|
1526
|
+
}, L = new ot();
|
|
1487
1527
|
function R(e, t) {
|
|
1488
1528
|
return L.parse(e, t);
|
|
1489
1529
|
}
|
|
1490
1530
|
R.options = R.setOptions = function(e) {
|
|
1491
1531
|
return L.setOptions(e), R.defaults = L.defaults, n(R.defaults), R;
|
|
1492
1532
|
}, R.getDefaults = e, R.defaults = t;
|
|
1493
|
-
function
|
|
1533
|
+
function st(...e) {
|
|
1494
1534
|
return L.use(...e), R.defaults = L.defaults, n(R.defaults), R;
|
|
1495
1535
|
}
|
|
1496
|
-
R.use =
|
|
1536
|
+
R.use = st, R.walkTokens = function(e, t) {
|
|
1497
1537
|
return L.walkTokens(e, t);
|
|
1498
|
-
}, R.parseInline = L.parseInline, R.Parser =
|
|
1538
|
+
}, R.parseInline = L.parseInline, R.Parser = F, R.parser = F.parse, R.Renderer = it, R.TextRenderer = at, R.Lexer = P, R.lexer = P.lex, R.Tokenizer = rt, R.Hooks = I, R.parse = R, R.options, R.setOptions, R.walkTokens, R.parseInline, F.parse, P.lex;
|
|
1499
1539
|
//#endregion
|
|
1500
1540
|
//#region node_modules/dompurify/dist/purify.es.mjs
|
|
1501
|
-
function
|
|
1541
|
+
function ct(e, t) {
|
|
1542
|
+
this.v = e, this.k = t;
|
|
1543
|
+
}
|
|
1544
|
+
function lt(e, t) {
|
|
1502
1545
|
(t == null || t > e.length) && (t = e.length);
|
|
1503
1546
|
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
1504
1547
|
return r;
|
|
1505
1548
|
}
|
|
1506
|
-
function
|
|
1549
|
+
function ut(e) {
|
|
1507
1550
|
if (Array.isArray(e)) return e;
|
|
1508
1551
|
}
|
|
1509
|
-
function
|
|
1552
|
+
function dt(e, t) {
|
|
1510
1553
|
var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
1511
1554
|
if (n != null) {
|
|
1512
1555
|
var r, i, a, o, s = [], c = !0, l = !1;
|
|
1513
1556
|
try {
|
|
1514
|
-
if (a = (n = n.call(e)).next, t
|
|
1557
|
+
if (a = (n = n.call(e)).next, t === 0) {
|
|
1558
|
+
if (Object(n) !== n) return;
|
|
1559
|
+
c = !1;
|
|
1560
|
+
} else for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
|
|
1515
1561
|
} catch (e) {
|
|
1516
1562
|
l = !0, i = e;
|
|
1517
1563
|
} finally {
|
|
@@ -1524,113 +1570,164 @@ function rt(e, t) {
|
|
|
1524
1570
|
return s;
|
|
1525
1571
|
}
|
|
1526
1572
|
}
|
|
1527
|
-
function
|
|
1573
|
+
function ft() {
|
|
1528
1574
|
throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1529
1575
|
}
|
|
1530
|
-
function
|
|
1531
|
-
return
|
|
1576
|
+
function pt(e, t) {
|
|
1577
|
+
return ut(e) || dt(e, t) || mt(e, t) || ft();
|
|
1532
1578
|
}
|
|
1533
|
-
function
|
|
1579
|
+
function mt(e, t) {
|
|
1534
1580
|
if (e) {
|
|
1535
|
-
if (typeof e == "string") return
|
|
1581
|
+
if (typeof e == "string") return lt(e, t);
|
|
1536
1582
|
var n = {}.toString.call(e).slice(8, -1);
|
|
1537
|
-
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) ?
|
|
1583
|
+
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) ? lt(e, t) : void 0;
|
|
1538
1584
|
}
|
|
1539
1585
|
}
|
|
1540
|
-
|
|
1586
|
+
function ht(e) {
|
|
1587
|
+
var t, n;
|
|
1588
|
+
function r(t, n) {
|
|
1589
|
+
try {
|
|
1590
|
+
var a = e[t](n), o = a.value, s = o instanceof ct;
|
|
1591
|
+
Promise.resolve(s ? o.v : o).then(function(n) {
|
|
1592
|
+
if (s) {
|
|
1593
|
+
var c = t === "return" && o.k ? t : "next";
|
|
1594
|
+
if (!o.k || n.done) return r(c, n);
|
|
1595
|
+
n = e[c](n).value;
|
|
1596
|
+
}
|
|
1597
|
+
i(!!a.done, n);
|
|
1598
|
+
}, function(e) {
|
|
1599
|
+
r("throw", e);
|
|
1600
|
+
});
|
|
1601
|
+
} catch (e) {
|
|
1602
|
+
i(2, e);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
function i(e, i) {
|
|
1606
|
+
e === 2 ? t.reject(i) : t.resolve({
|
|
1607
|
+
value: i,
|
|
1608
|
+
done: e
|
|
1609
|
+
}), (t = t.next) ? r(t.key, t.arg) : n = null;
|
|
1610
|
+
}
|
|
1611
|
+
this._invoke = function(e, i) {
|
|
1612
|
+
return new Promise(function(a, o) {
|
|
1613
|
+
var s = {
|
|
1614
|
+
key: e,
|
|
1615
|
+
arg: i,
|
|
1616
|
+
resolve: a,
|
|
1617
|
+
reject: o,
|
|
1618
|
+
next: null
|
|
1619
|
+
};
|
|
1620
|
+
n ? n = n.next = s : (t = n = s, r(e, i));
|
|
1621
|
+
});
|
|
1622
|
+
}, typeof e.return != "function" && (this.return = void 0);
|
|
1623
|
+
}
|
|
1624
|
+
ht.prototype[typeof Symbol == "function" && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
1625
|
+
return this;
|
|
1626
|
+
}, ht.prototype.next = function(e) {
|
|
1627
|
+
return this._invoke("next", e);
|
|
1628
|
+
}, ht.prototype.throw = function(e) {
|
|
1629
|
+
return this._invoke("throw", e);
|
|
1630
|
+
}, ht.prototype.return = function(e) {
|
|
1631
|
+
return this._invoke("return", e);
|
|
1632
|
+
};
|
|
1633
|
+
var gt = Object.entries, z = Object.setPrototypeOf, _t = Object.isFrozen, vt = Object.getPrototypeOf, yt = Object.getOwnPropertyDescriptor, B = Object.freeze, V = Object.seal, bt = Object.create, xt = typeof Reflect < "u" && Reflect, St = xt.apply, Ct = xt.construct;
|
|
1541
1634
|
B ||= function(e) {
|
|
1542
1635
|
return e;
|
|
1543
1636
|
}, V ||= function(e) {
|
|
1544
1637
|
return e;
|
|
1545
|
-
},
|
|
1638
|
+
}, St ||= function(e, t) {
|
|
1546
1639
|
var n = [...arguments].slice(2);
|
|
1547
1640
|
return e.apply(t, n);
|
|
1548
|
-
},
|
|
1641
|
+
}, Ct ||= function(e) {
|
|
1549
1642
|
return new e(...[...arguments].slice(1));
|
|
1550
1643
|
};
|
|
1551
|
-
var
|
|
1644
|
+
var wt = K(Array.prototype.forEach);
|
|
1645
|
+
Array.prototype.indexOf;
|
|
1646
|
+
var Tt = K(Array.prototype.lastIndexOf), Et = K(Array.prototype.pop), Dt = K(Array.prototype.push);
|
|
1647
|
+
Array.prototype.slice;
|
|
1648
|
+
var Ot = K(Array.prototype.splice), kt = Array.isArray, At = K(String.prototype.toLowerCase), jt = K(String.prototype.toString), Mt = K(String.prototype.match), Nt = K(String.prototype.replace), Pt = K(String.prototype.indexOf), Ft = K(String.prototype.trim), It = K(Number.prototype.toString), Lt = K(Boolean.prototype.toString), Rt = typeof BigInt > "u" ? null : K(BigInt.prototype.toString), zt = typeof Symbol > "u" ? null : K(Symbol.prototype.toString), H = K(Object.prototype.hasOwnProperty), U = K(Object.prototype.toString), W = K(RegExp.prototype.test), G = Bt(TypeError);
|
|
1552
1649
|
function K(e) {
|
|
1553
1650
|
return function(t) {
|
|
1554
1651
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
1555
1652
|
var n = [...arguments].slice(1);
|
|
1556
|
-
return
|
|
1653
|
+
return St(e, t, n);
|
|
1557
1654
|
};
|
|
1558
1655
|
}
|
|
1559
|
-
function
|
|
1656
|
+
function Bt(e) {
|
|
1560
1657
|
return function() {
|
|
1561
|
-
return
|
|
1658
|
+
return Ct(e, [...arguments]);
|
|
1562
1659
|
};
|
|
1563
1660
|
}
|
|
1564
1661
|
function q(e, t) {
|
|
1565
|
-
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
1566
|
-
if (
|
|
1662
|
+
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : At;
|
|
1663
|
+
if (z && z(e, null), !kt(t)) return e;
|
|
1567
1664
|
let r = t.length;
|
|
1568
1665
|
for (; r--;) {
|
|
1569
1666
|
let i = t[r];
|
|
1570
1667
|
if (typeof i == "string") {
|
|
1571
1668
|
let e = n(i);
|
|
1572
|
-
e !== i && (
|
|
1669
|
+
e !== i && (_t(t) || (t[r] = e), i = e);
|
|
1573
1670
|
}
|
|
1574
1671
|
e[i] = !0;
|
|
1575
1672
|
}
|
|
1576
1673
|
return e;
|
|
1577
1674
|
}
|
|
1578
|
-
function
|
|
1579
|
-
for (let t = 0; t < e.length; t++)
|
|
1675
|
+
function Vt(e) {
|
|
1676
|
+
for (let t = 0; t < e.length; t++) H(e, t) || (e[t] = null);
|
|
1580
1677
|
return e;
|
|
1581
1678
|
}
|
|
1582
1679
|
function J(e) {
|
|
1583
|
-
let t =
|
|
1584
|
-
for (let r of
|
|
1585
|
-
var n =
|
|
1680
|
+
let t = bt(null);
|
|
1681
|
+
for (let r of gt(e)) {
|
|
1682
|
+
var n = pt(r, 2);
|
|
1586
1683
|
let i = n[0], a = n[1];
|
|
1587
|
-
|
|
1684
|
+
H(e, i) && (t[i] = kt(a) ? Vt(a) : a && typeof a == "object" && a.constructor === Object ? J(a) : a);
|
|
1588
1685
|
}
|
|
1589
1686
|
return t;
|
|
1590
1687
|
}
|
|
1591
|
-
function
|
|
1688
|
+
function Ht(e) {
|
|
1592
1689
|
switch (typeof e) {
|
|
1593
1690
|
case "string": return e;
|
|
1594
|
-
case "number": return
|
|
1595
|
-
case "boolean": return
|
|
1596
|
-
case "bigint": return
|
|
1597
|
-
case "symbol": return
|
|
1598
|
-
case "undefined": return
|
|
1691
|
+
case "number": return It(e);
|
|
1692
|
+
case "boolean": return Lt(e);
|
|
1693
|
+
case "bigint": return Rt ? Rt(e) : "0";
|
|
1694
|
+
case "symbol": return zt ? zt(e) : "Symbol()";
|
|
1695
|
+
case "undefined": return U(e);
|
|
1599
1696
|
case "function":
|
|
1600
1697
|
case "object": {
|
|
1601
|
-
if (e === null) return
|
|
1698
|
+
if (e === null) return U(e);
|
|
1602
1699
|
let t = e, n = Y(t, "toString");
|
|
1603
1700
|
if (typeof n == "function") {
|
|
1604
1701
|
let e = n(t);
|
|
1605
|
-
return typeof e == "string" ? e :
|
|
1702
|
+
return typeof e == "string" ? e : U(e);
|
|
1606
1703
|
}
|
|
1607
|
-
return
|
|
1704
|
+
return U(e);
|
|
1608
1705
|
}
|
|
1609
|
-
default: return
|
|
1706
|
+
default: return U(e);
|
|
1610
1707
|
}
|
|
1611
1708
|
}
|
|
1612
1709
|
function Y(e, t) {
|
|
1613
1710
|
for (; e !== null;) {
|
|
1614
|
-
let n =
|
|
1711
|
+
let n = yt(e, t);
|
|
1615
1712
|
if (n) {
|
|
1616
1713
|
if (n.get) return K(n.get);
|
|
1617
1714
|
if (typeof n.value == "function") return K(n.value);
|
|
1618
1715
|
}
|
|
1619
|
-
e =
|
|
1716
|
+
e = vt(e);
|
|
1620
1717
|
}
|
|
1621
1718
|
function n() {
|
|
1622
1719
|
return null;
|
|
1623
1720
|
}
|
|
1624
1721
|
return n;
|
|
1625
1722
|
}
|
|
1626
|
-
function
|
|
1723
|
+
function Ut(e) {
|
|
1627
1724
|
try {
|
|
1628
|
-
return
|
|
1725
|
+
return W(e, ""), !0;
|
|
1629
1726
|
} catch {
|
|
1630
1727
|
return !1;
|
|
1631
1728
|
}
|
|
1632
1729
|
}
|
|
1633
|
-
var
|
|
1730
|
+
var Wt = B(/* @__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(".")), Gt = B(/* @__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(".")), Kt = B([
|
|
1634
1731
|
"feBlend",
|
|
1635
1732
|
"feColorMatrix",
|
|
1636
1733
|
"feComponentTransfer",
|
|
@@ -1656,7 +1753,7 @@ var Ft = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1656
1753
|
"feSpotLight",
|
|
1657
1754
|
"feTile",
|
|
1658
1755
|
"feTurbulence"
|
|
1659
|
-
]),
|
|
1756
|
+
]), qt = B([
|
|
1660
1757
|
"animate",
|
|
1661
1758
|
"color-profile",
|
|
1662
1759
|
"cursor",
|
|
@@ -1679,7 +1776,7 @@ var Ft = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1679
1776
|
"solidcolor",
|
|
1680
1777
|
"unknown",
|
|
1681
1778
|
"use"
|
|
1682
|
-
]),
|
|
1779
|
+
]), Jt = B(/* @__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(".")), Yt = B([
|
|
1683
1780
|
"maction",
|
|
1684
1781
|
"maligngroup",
|
|
1685
1782
|
"malignmark",
|
|
@@ -1695,13 +1792,13 @@ var Ft = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1695
1792
|
"annotation-xml",
|
|
1696
1793
|
"mprescripts",
|
|
1697
1794
|
"none"
|
|
1698
|
-
]),
|
|
1795
|
+
]), Xt = B(["#text"]), Zt = B(/* @__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(".")), Qt = B(/* @__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.pointer-events.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.vector-effect.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(".")), $t = B(/* @__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(".")), en = B([
|
|
1699
1796
|
"xlink:href",
|
|
1700
1797
|
"xml:id",
|
|
1701
1798
|
"xlink:title",
|
|
1702
1799
|
"xml:space",
|
|
1703
1800
|
"xmlns:xlink"
|
|
1704
|
-
]),
|
|
1801
|
+
]), tn = V(/{{[\w\W]*|^[\w\W]*}}/g), nn = V(/<%[\w\W]*|^[\w\W]*%>/g), rn = V(/\${[\w\W]*/g), an = V(/^data-[\-\w.\u00B7-\uFFFF]+$/), on = V(/^aria-[\-\w]+$/), sn = V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), cn = V(/^(?:\w+script|data):/i), ln = V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), un = V(/^html$/i), dn = V(/^[a-z][.\w]*(-[.\w]+)+$/i), fn = V(/<[/\w!]/g), pn = V(/<[/\w]/g), mn = V(/<\/no(script|embed|frames)/i), hn = V(/\/>/i), X = {
|
|
1705
1802
|
element: 1,
|
|
1706
1803
|
attribute: 2,
|
|
1707
1804
|
text: 3,
|
|
@@ -1714,7 +1811,7 @@ var Ft = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1714
1811
|
documentType: 10,
|
|
1715
1812
|
documentFragment: 11,
|
|
1716
1813
|
notation: 12
|
|
1717
|
-
},
|
|
1814
|
+
}, Z = [
|
|
1718
1815
|
"style",
|
|
1719
1816
|
"script",
|
|
1720
1817
|
"xmp",
|
|
@@ -1723,14 +1820,14 @@ var Ft = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1723
1820
|
"noframes",
|
|
1724
1821
|
"plaintext",
|
|
1725
1822
|
"noscript"
|
|
1726
|
-
],
|
|
1823
|
+
], gn = B(q({}, Z)), _n = function() {
|
|
1727
1824
|
let e = {};
|
|
1728
|
-
return
|
|
1825
|
+
return wt(Z, (t) => {
|
|
1729
1826
|
e[t] = V(RegExp("</" + t + "(?=[\\t\\n\\f\\r />])", "i"));
|
|
1730
1827
|
}), B(e);
|
|
1731
|
-
}(),
|
|
1828
|
+
}(), vn = function() {
|
|
1732
1829
|
return typeof window > "u" ? null : window;
|
|
1733
|
-
},
|
|
1830
|
+
}, yn = function(e, t) {
|
|
1734
1831
|
if (typeof e != "object" || typeof e.createPolicy != "function") return null;
|
|
1735
1832
|
let n = null, r = "data-tt-policy-suffix";
|
|
1736
1833
|
t && t.hasAttribute(r) && (n = t.getAttribute(r));
|
|
@@ -1747,7 +1844,7 @@ var Ft = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1747
1844
|
} catch {
|
|
1748
1845
|
return console.warn("TrustedTypes policy " + i + " could not be created."), null;
|
|
1749
1846
|
}
|
|
1750
|
-
},
|
|
1847
|
+
}, bn = function() {
|
|
1751
1848
|
return {
|
|
1752
1849
|
afterSanitizeAttributes: [],
|
|
1753
1850
|
afterSanitizeElements: [],
|
|
@@ -1759,60 +1856,60 @@ var Ft = B(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1759
1856
|
uponSanitizeElement: [],
|
|
1760
1857
|
uponSanitizeShadowNode: []
|
|
1761
1858
|
};
|
|
1762
|
-
},
|
|
1763
|
-
return
|
|
1764
|
-
},
|
|
1765
|
-
let r =
|
|
1859
|
+
}, xn = function(e, t, n, r) {
|
|
1860
|
+
return H(e, t) && kt(e[t]) ? q(r.base ? J(r.base) : {}, e[t], r.transform) : n;
|
|
1861
|
+
}, Sn = function(e, t, n) {
|
|
1862
|
+
let r = H(e, t) ? e[t] : void 0;
|
|
1766
1863
|
return r && typeof r == "object" ? J(r) : n();
|
|
1767
1864
|
};
|
|
1768
|
-
function
|
|
1769
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
1770
|
-
if (t.version = "3.4.
|
|
1865
|
+
function Cn() {
|
|
1866
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : vn(), t = (e) => Cn(e);
|
|
1867
|
+
if (t.version = "3.4.16", t.removed = [], !e || !e.document || e.document.nodeType !== X.document || !e.Element) return t.isSupported = !1, t;
|
|
1771
1868
|
let n = e.document, r = n, i = r.currentScript;
|
|
1772
1869
|
e.DocumentFragment;
|
|
1773
1870
|
let a = e.HTMLTemplateElement, o = e.Node, s = e.Element, c = e.NodeFilter;
|
|
1774
1871
|
e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
|
|
1775
|
-
let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = Y(d, "cloneNode"), p = Y(d, "remove"), m = Y(d, "removeAttributeNode"),
|
|
1776
|
-
return
|
|
1777
|
-
},
|
|
1872
|
+
let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = Y(d, "cloneNode"), p = Y(d, "remove"), m = Y(d, "removeAttributeNode"), h = Y(d, "nextSibling"), g = Y(d, "childNodes"), _ = Y(d, "parentNode"), v = Y(d, "shadowRoot"), ee = Y(d, "attributes"), te = o && o.prototype ? Y(o.prototype, "nodeType") : null, ne = o && o.prototype ? Y(o.prototype, "nodeName") : null, y = o && o.prototype ? Y(o.prototype, "ownerDocument") : null, b = function(e) {
|
|
1873
|
+
return te ? te(e) : e.nodeType;
|
|
1874
|
+
}, re = function(e) {
|
|
1778
1875
|
return ne ? ne(e) : e.nodeName;
|
|
1779
1876
|
};
|
|
1780
1877
|
if (typeof a == "function") {
|
|
1781
1878
|
let e = n.createElement("template");
|
|
1782
1879
|
e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
|
|
1783
1880
|
}
|
|
1784
|
-
let
|
|
1785
|
-
if (
|
|
1786
|
-
},
|
|
1787
|
-
|
|
1881
|
+
let x, ie = "", ae, oe = !1, se = 0, ce = function() {
|
|
1882
|
+
if (se > 0) throw G("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.");
|
|
1883
|
+
}, le = function(e) {
|
|
1884
|
+
ce(), se++;
|
|
1788
1885
|
try {
|
|
1789
|
-
return
|
|
1886
|
+
return x.createHTML(e);
|
|
1790
1887
|
} finally {
|
|
1791
|
-
|
|
1888
|
+
se--;
|
|
1792
1889
|
}
|
|
1793
|
-
},
|
|
1794
|
-
|
|
1890
|
+
}, ue = function(e) {
|
|
1891
|
+
ce(), se++;
|
|
1795
1892
|
try {
|
|
1796
|
-
return
|
|
1893
|
+
return x.createScriptURL(e);
|
|
1797
1894
|
} finally {
|
|
1798
|
-
|
|
1799
|
-
}
|
|
1800
|
-
},
|
|
1801
|
-
return
|
|
1802
|
-
},
|
|
1803
|
-
t.isSupported = typeof
|
|
1804
|
-
let ve =
|
|
1805
|
-
...Ft,
|
|
1806
|
-
...It,
|
|
1807
|
-
...Lt,
|
|
1808
|
-
...zt,
|
|
1809
|
-
...Vt
|
|
1810
|
-
]), w = null, Oe = q({}, [
|
|
1811
|
-
...Ht,
|
|
1812
|
-
...Ut,
|
|
1895
|
+
se--;
|
|
1896
|
+
}
|
|
1897
|
+
}, de = function() {
|
|
1898
|
+
return oe ||= (ae = yn(u, i), !0), ae;
|
|
1899
|
+
}, fe = n, pe = fe.implementation, S = fe.createNodeIterator, me = fe.createDocumentFragment, he = fe.getElementsByTagName, ge = r.importNode, C = bn();
|
|
1900
|
+
t.isSupported = typeof gt == "function" && typeof _ == "function" && pe && pe.createHTMLDocument !== void 0;
|
|
1901
|
+
let _e = tn, ve = nn, ye = rn, be = an, xe = on, Se = cn, Ce = ln, we = dn, Te = sn, w = null, Ee = q({}, [
|
|
1813
1902
|
...Wt,
|
|
1814
|
-
...Gt
|
|
1815
|
-
|
|
1903
|
+
...Gt,
|
|
1904
|
+
...Kt,
|
|
1905
|
+
...Jt,
|
|
1906
|
+
...Xt
|
|
1907
|
+
]), T = null, De = q({}, [
|
|
1908
|
+
...Zt,
|
|
1909
|
+
...Qt,
|
|
1910
|
+
...$t,
|
|
1911
|
+
...en
|
|
1912
|
+
]), E = Object.seal(bt(null, {
|
|
1816
1913
|
tagNameCheck: {
|
|
1817
1914
|
writable: !0,
|
|
1818
1915
|
configurable: !1,
|
|
@@ -1831,7 +1928,7 @@ function hn() {
|
|
|
1831
1928
|
enumerable: !0,
|
|
1832
1929
|
value: !1
|
|
1833
1930
|
}
|
|
1834
|
-
})),
|
|
1931
|
+
})), Oe = null, ke = null, D = Object.seal(bt(null, {
|
|
1835
1932
|
tagCheck: {
|
|
1836
1933
|
writable: !0,
|
|
1837
1934
|
configurable: !1,
|
|
@@ -1844,14 +1941,14 @@ function hn() {
|
|
|
1844
1941
|
enumerable: !0,
|
|
1845
1942
|
value: null
|
|
1846
1943
|
}
|
|
1847
|
-
})),
|
|
1944
|
+
})), Ae = !0, je = !0, Me = !1, Ne = !0, O = !1, Pe = !0, Fe = !1, Ie = !1, Le = null, Re = null, ze = !1, Be = !1, Ve = !1, He = !1, Ue = !0, We = !1, Ge = "user-content-", Ke = !0, qe = !1, Je = {}, Ye = null, k = q({}, /* @__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(".")), Xe = null, Ze = q({}, [
|
|
1848
1945
|
"audio",
|
|
1849
1946
|
"video",
|
|
1850
1947
|
"img",
|
|
1851
1948
|
"source",
|
|
1852
1949
|
"image",
|
|
1853
1950
|
"track"
|
|
1854
|
-
]),
|
|
1951
|
+
]), Qe = null, A = q({}, [
|
|
1855
1952
|
"alt",
|
|
1856
1953
|
"class",
|
|
1857
1954
|
"for",
|
|
@@ -1866,77 +1963,77 @@ function hn() {
|
|
|
1866
1963
|
"value",
|
|
1867
1964
|
"style",
|
|
1868
1965
|
"xmlns"
|
|
1869
|
-
]),
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
],
|
|
1966
|
+
]), $e = "http://www.w3.org/1998/Math/MathML", j = "http://www.w3.org/2000/svg", M = "http://www.w3.org/1999/xhtml", N = M, et = !1, tt = null, nt = q({}, [
|
|
1967
|
+
$e,
|
|
1968
|
+
j,
|
|
1969
|
+
M
|
|
1970
|
+
], jt), rt = B([
|
|
1874
1971
|
"mi",
|
|
1875
1972
|
"mo",
|
|
1876
1973
|
"mn",
|
|
1877
1974
|
"ms",
|
|
1878
1975
|
"mtext"
|
|
1879
|
-
]),
|
|
1976
|
+
]), P = q({}, rt), it = B(["annotation-xml"]), at = q({}, it), F = q({}, [
|
|
1880
1977
|
"title",
|
|
1881
1978
|
"style",
|
|
1882
1979
|
"font",
|
|
1883
1980
|
"a",
|
|
1884
1981
|
"script"
|
|
1885
|
-
]),
|
|
1982
|
+
]), I = null, ot = ["application/xhtml+xml", "text/html"], L = null, R = null, st = n.createElement("form"), ct = function(e) {
|
|
1886
1983
|
return e instanceof RegExp || e instanceof Function;
|
|
1887
1984
|
}, lt = function() {
|
|
1888
1985
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1889
|
-
if (
|
|
1890
|
-
(!e || typeof e != "object") && (e = {}), e = J(e),
|
|
1891
|
-
transform:
|
|
1892
|
-
base:
|
|
1893
|
-
}),
|
|
1894
|
-
transform:
|
|
1895
|
-
base:
|
|
1896
|
-
}),
|
|
1897
|
-
let t =
|
|
1898
|
-
if (
|
|
1986
|
+
if (R && R === e) return;
|
|
1987
|
+
(!e || typeof e != "object") && (e = {}), e = J(e), I = ot.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, L = I === "application/xhtml+xml" ? jt : At, w = xn(e, "ALLOWED_TAGS", Ee, { transform: L }), T = xn(e, "ALLOWED_ATTR", De, { transform: L }), tt = xn(e, "ALLOWED_NAMESPACES", nt, { transform: jt }), Qe = xn(e, "ADD_URI_SAFE_ATTR", A, {
|
|
1988
|
+
transform: L,
|
|
1989
|
+
base: A
|
|
1990
|
+
}), Xe = xn(e, "ADD_DATA_URI_TAGS", Ze, {
|
|
1991
|
+
transform: L,
|
|
1992
|
+
base: Ze
|
|
1993
|
+
}), Ye = xn(e, "FORBID_CONTENTS", k, { transform: L }), Oe = xn(e, "FORBID_TAGS", J({}), { transform: L }), ke = xn(e, "FORBID_ATTR", J({}), { transform: L }), Je = H(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? J(e.USE_PROFILES) : e.USE_PROFILES : !1, Ae = e.ALLOW_ARIA_ATTR !== !1, je = e.ALLOW_DATA_ATTR !== !1, Me = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Ne = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, O = e.SAFE_FOR_TEMPLATES || !1, Pe = e.SAFE_FOR_XML !== !1, Fe = e.WHOLE_DOCUMENT || !1, Be = e.RETURN_DOM || !1, Ve = e.RETURN_DOM_FRAGMENT || !1, He = e.RETURN_TRUSTED_TYPE || !1, ze = e.FORCE_BODY || !1, Ue = e.SANITIZE_DOM !== !1, We = e.SANITIZE_NAMED_PROPS || !1, Ke = e.KEEP_CONTENT !== !1, qe = e.IN_PLACE || !1, Te = Ut(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : sn, N = typeof e.NAMESPACE == "string" ? e.NAMESPACE : M, P = Sn(e, "MATHML_TEXT_INTEGRATION_POINTS", () => q({}, rt)), at = Sn(e, "HTML_INTEGRATION_POINTS", () => q({}, it));
|
|
1994
|
+
let t = Sn(e, "CUSTOM_ELEMENT_HANDLING", () => bt(null));
|
|
1995
|
+
if (E = bt(null), H(t, "tagNameCheck") && ct(t.tagNameCheck) && (E.tagNameCheck = t.tagNameCheck), H(t, "attributeNameCheck") && ct(t.attributeNameCheck) && (E.attributeNameCheck = t.attributeNameCheck), H(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (E.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), V(E), O && (je = !1), Ve && (Be = !0), Je && (w = q({}, Xt), T = bt(null), Je.html === !0 && (q(w, Wt), q(T, Zt)), Je.svg === !0 && (q(w, Gt), q(T, Qt), q(T, en)), Je.svgFilters === !0 && (q(w, Kt), q(T, Qt), q(T, en)), Je.mathMl === !0 && (q(w, Jt), q(T, $t), q(T, en))), D.tagCheck = null, D.attributeCheck = null, H(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? D.tagCheck = e.ADD_TAGS : kt(e.ADD_TAGS) && (w === Ee && (w = J(w)), q(w, e.ADD_TAGS, L))), H(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? D.attributeCheck = e.ADD_ATTR : kt(e.ADD_ATTR) && (T === De && (T = J(T)), q(T, e.ADD_ATTR, L))), H(e, "ADD_FORBID_CONTENTS") && kt(e.ADD_FORBID_CONTENTS) && (Ye === k && (Ye = J(Ye)), q(Ye, e.ADD_FORBID_CONTENTS, L)), Ke && (w["#text"] = !0), Fe && q(w, [
|
|
1899
1996
|
"html",
|
|
1900
1997
|
"head",
|
|
1901
1998
|
"body"
|
|
1902
|
-
]),
|
|
1903
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw
|
|
1904
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw
|
|
1905
|
-
let t =
|
|
1906
|
-
|
|
1999
|
+
]), w.table && (q(w, ["tbody"]), delete Oe.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
2000
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw G("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
2001
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw G("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
2002
|
+
let t = x;
|
|
2003
|
+
x = e.TRUSTED_TYPES_POLICY;
|
|
1907
2004
|
try {
|
|
1908
|
-
|
|
2005
|
+
ie = le("");
|
|
1909
2006
|
} catch (e) {
|
|
1910
|
-
throw
|
|
2007
|
+
throw x = t, e;
|
|
1911
2008
|
}
|
|
1912
|
-
} else e.TRUSTED_TYPES_POLICY === null ? (
|
|
1913
|
-
B && B(e),
|
|
2009
|
+
} else e.TRUSTED_TYPES_POLICY === null ? (x = void 0, ie = "") : (x === void 0 && (x = de()), x && typeof ie == "string" && (ie = le("")));
|
|
2010
|
+
B && B(e), R = e;
|
|
1914
2011
|
}, ut = q({}, [
|
|
1915
|
-
...
|
|
1916
|
-
...
|
|
1917
|
-
...
|
|
1918
|
-
]),
|
|
1919
|
-
return t.namespaceURI ===
|
|
2012
|
+
...Gt,
|
|
2013
|
+
...Kt,
|
|
2014
|
+
...qt
|
|
2015
|
+
]), dt = q({}, [...Jt, ...Yt]), ft = function(e, t, n) {
|
|
2016
|
+
return t.namespaceURI === M ? e === "svg" : t.namespaceURI === $e ? e === "svg" && (n === "annotation-xml" || P[n]) : !!ut[e];
|
|
2017
|
+
}, pt = function(e, t, n) {
|
|
2018
|
+
return t.namespaceURI === M ? e === "math" : t.namespaceURI === j ? e === "math" && at[n] : !!dt[e];
|
|
1920
2019
|
}, mt = function(e, t, n) {
|
|
1921
|
-
return t.namespaceURI ===
|
|
1922
|
-
},
|
|
1923
|
-
|
|
1924
|
-
}, Ot = function(e) {
|
|
1925
|
-
let t = g(e);
|
|
2020
|
+
return t.namespaceURI === j && !at[n] || t.namespaceURI === $e && !P[n] ? !1 : !dt[e] && (F[e] || !ut[e]);
|
|
2021
|
+
}, ht = function(e) {
|
|
2022
|
+
let t = _(e);
|
|
1926
2023
|
(!t || !t.tagName) && (t = {
|
|
1927
|
-
namespaceURI:
|
|
2024
|
+
namespaceURI: N,
|
|
1928
2025
|
tagName: "template"
|
|
1929
2026
|
});
|
|
1930
|
-
let n =
|
|
1931
|
-
return
|
|
1932
|
-
},
|
|
1933
|
-
|
|
2027
|
+
let n = At(e.tagName), r = At(t.tagName);
|
|
2028
|
+
return tt[e.namespaceURI] ? e.namespaceURI === j ? ft(n, t, r) : e.namespaceURI === $e ? pt(n, t, r) : e.namespaceURI === M ? mt(n, t, r) : !!(I === "application/xhtml+xml" && tt[e.namespaceURI]) : !1;
|
|
2029
|
+
}, z = function(e) {
|
|
2030
|
+
Dt(t.removed, { element: e });
|
|
1934
2031
|
try {
|
|
1935
|
-
|
|
2032
|
+
_(e).removeChild(e);
|
|
1936
2033
|
} catch {
|
|
1937
|
-
if (p(e), !
|
|
2034
|
+
if (p(e), !_(e)) throw G("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
1938
2035
|
}
|
|
1939
|
-
},
|
|
2036
|
+
}, _t = function(e, t, n) {
|
|
1940
2037
|
try {
|
|
1941
2038
|
m(e, t);
|
|
1942
2039
|
} catch {
|
|
@@ -1944,31 +2041,31 @@ function hn() {
|
|
|
1944
2041
|
e.removeAttribute(n);
|
|
1945
2042
|
} catch {}
|
|
1946
2043
|
}
|
|
1947
|
-
},
|
|
1948
|
-
|
|
1949
|
-
let t =
|
|
2044
|
+
}, vt = function(e) {
|
|
2045
|
+
St(e);
|
|
2046
|
+
let t = g(e);
|
|
1950
2047
|
if (t) {
|
|
1951
2048
|
let e = [];
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
}),
|
|
2049
|
+
wt(t, (t) => {
|
|
2050
|
+
Dt(e, t);
|
|
2051
|
+
}), wt(e, (e) => {
|
|
1955
2052
|
try {
|
|
1956
2053
|
p(e);
|
|
1957
2054
|
} catch {}
|
|
1958
2055
|
});
|
|
1959
2056
|
}
|
|
1960
|
-
let n =
|
|
2057
|
+
let n = ee(e);
|
|
1961
2058
|
if (n) for (let t = n.length - 1; t >= 0; --t) {
|
|
1962
2059
|
let r = n[t], i = r && r.name;
|
|
1963
|
-
typeof i == "string" &&
|
|
2060
|
+
typeof i == "string" && _t(e, r, i);
|
|
1964
2061
|
}
|
|
1965
|
-
},
|
|
2062
|
+
}, yt = function(e, n, r) {
|
|
1966
2063
|
if (!r) try {
|
|
1967
2064
|
r = n.getAttributeNode(e);
|
|
1968
2065
|
} catch {
|
|
1969
2066
|
r = null;
|
|
1970
2067
|
}
|
|
1971
|
-
|
|
2068
|
+
Dt(t.removed, {
|
|
1972
2069
|
attribute: r || null,
|
|
1973
2070
|
from: n
|
|
1974
2071
|
});
|
|
@@ -1980,149 +2077,149 @@ function hn() {
|
|
|
1980
2077
|
} catch {}
|
|
1981
2078
|
}
|
|
1982
2079
|
if (e === "is") {
|
|
1983
|
-
if (
|
|
1984
|
-
|
|
2080
|
+
if (Be || Ve) try {
|
|
2081
|
+
z(n);
|
|
1985
2082
|
} catch {}
|
|
1986
2083
|
else try {
|
|
1987
2084
|
n.setAttribute(e, "");
|
|
1988
2085
|
} catch {}
|
|
1989
2086
|
}
|
|
1990
|
-
},
|
|
1991
|
-
let t =
|
|
2087
|
+
}, xt = function(e) {
|
|
2088
|
+
let t = ee(e);
|
|
1992
2089
|
if (t) for (let n = t.length - 1; n >= 0; --n) {
|
|
1993
2090
|
let r = t[n], i = r && r.name;
|
|
1994
|
-
typeof i != "string" ||
|
|
2091
|
+
typeof i != "string" || T[L(i)] || _t(e, r, i);
|
|
1995
2092
|
}
|
|
1996
|
-
},
|
|
2093
|
+
}, St = function(e) {
|
|
1997
2094
|
let t = [e];
|
|
1998
2095
|
for (; t.length > 0;) {
|
|
1999
2096
|
let e = t.pop();
|
|
2000
|
-
|
|
2001
|
-
let n =
|
|
2097
|
+
b(e) === X.element && xt(e);
|
|
2098
|
+
let n = g(e);
|
|
2002
2099
|
if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
|
|
2003
2100
|
}
|
|
2004
|
-
},
|
|
2005
|
-
return
|
|
2006
|
-
},
|
|
2007
|
-
if (!
|
|
2101
|
+
}, Ct = function(e, t) {
|
|
2102
|
+
return Pe ? e === "patchsrc" || e === "for" && t !== "label" && t !== "output" : !1;
|
|
2103
|
+
}, It = function(e) {
|
|
2104
|
+
if (!Pe) return;
|
|
2008
2105
|
let t = [e];
|
|
2009
2106
|
for (; t.length > 0;) {
|
|
2010
|
-
let e = t.pop(), n =
|
|
2011
|
-
if (n === X.processingInstruction || n === X.comment &&
|
|
2107
|
+
let e = t.pop(), n = b(e);
|
|
2108
|
+
if (n === X.processingInstruction || n === X.comment && W(pn, e.data)) {
|
|
2012
2109
|
try {
|
|
2013
2110
|
p(e);
|
|
2014
2111
|
} catch {}
|
|
2015
2112
|
continue;
|
|
2016
2113
|
}
|
|
2017
2114
|
if (n === X.element) {
|
|
2018
|
-
let t = e, n =
|
|
2115
|
+
let t = e, n = L(re(e));
|
|
2019
2116
|
try {
|
|
2020
|
-
t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") &&
|
|
2117
|
+
t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && Ct("for", n) && t.removeAttribute("for");
|
|
2021
2118
|
} catch {}
|
|
2022
2119
|
}
|
|
2023
|
-
let r =
|
|
2120
|
+
let r = g(e);
|
|
2024
2121
|
if (r) for (let e = r.length - 1; e >= 0; --e) t.push(r[e]);
|
|
2025
2122
|
}
|
|
2026
|
-
},
|
|
2123
|
+
}, Lt = function(e) {
|
|
2027
2124
|
let t = null, r = null;
|
|
2028
|
-
if (
|
|
2125
|
+
if (ze) e = "<remove></remove>" + e;
|
|
2029
2126
|
else {
|
|
2030
|
-
let t =
|
|
2127
|
+
let t = Mt(e, /^[\r\n\t ]+/);
|
|
2031
2128
|
r = t && t[0];
|
|
2032
2129
|
}
|
|
2033
|
-
|
|
2034
|
-
let i =
|
|
2035
|
-
if (
|
|
2036
|
-
t = new l().parseFromString(i,
|
|
2130
|
+
I === "application/xhtml+xml" && N === M && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
|
|
2131
|
+
let i = x ? le(e) : e;
|
|
2132
|
+
if (N === M) try {
|
|
2133
|
+
t = new l().parseFromString(i, I);
|
|
2037
2134
|
} catch {}
|
|
2038
2135
|
if (!t || !t.documentElement) {
|
|
2039
|
-
t =
|
|
2136
|
+
t = pe.createDocument(N, "template", null);
|
|
2040
2137
|
try {
|
|
2041
|
-
t.documentElement.innerHTML =
|
|
2138
|
+
t.documentElement.innerHTML = et ? ie : i;
|
|
2042
2139
|
} catch {}
|
|
2043
2140
|
}
|
|
2044
2141
|
let a = t.body || t.documentElement;
|
|
2045
|
-
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null),
|
|
2046
|
-
},
|
|
2142
|
+
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), N === M ? he.call(t, Fe ? "html" : "body")[0] : Fe ? t.documentElement : a;
|
|
2143
|
+
}, Rt = function(e) {
|
|
2047
2144
|
let t = y ? y(e) : e.ownerDocument;
|
|
2048
|
-
return
|
|
2049
|
-
},
|
|
2050
|
-
return e =
|
|
2051
|
-
},
|
|
2145
|
+
return S.call(t || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
|
|
2146
|
+
}, zt = function(e) {
|
|
2147
|
+
return e = Nt(e, _e, " "), e = Nt(e, ve, " "), e = Nt(e, ye, " "), e;
|
|
2148
|
+
}, U = function(e) {
|
|
2052
2149
|
e.normalize();
|
|
2053
|
-
let t = y ? y(e) : e.ownerDocument, n =
|
|
2054
|
-
for (; r;) r.data =
|
|
2150
|
+
let t = y ? y(e) : e.ownerDocument, n = S.call(t || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), r = n.nextNode();
|
|
2151
|
+
for (; r;) r.data = zt(r.data), r = n.nextNode();
|
|
2055
2152
|
let i = e.querySelectorAll?.call(e, "template");
|
|
2056
|
-
i &&
|
|
2057
|
-
|
|
2153
|
+
i && wt(i, (e) => {
|
|
2154
|
+
Bt(e.content) && U(e.content);
|
|
2058
2155
|
});
|
|
2059
|
-
},
|
|
2156
|
+
}, K = function(e) {
|
|
2060
2157
|
let t = ne ? ne(e) : null;
|
|
2061
|
-
return typeof t != "string" ||
|
|
2062
|
-
},
|
|
2063
|
-
if (!
|
|
2158
|
+
return typeof t != "string" || L(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== ee(e) || typeof e.removeAttribute != "function" || typeof e.removeAttributeNode != "function" || typeof e.getAttributeNode != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== te(e) || e.childNodes !== g(e);
|
|
2159
|
+
}, Bt = function(e) {
|
|
2160
|
+
if (!te || typeof e != "object" || !e) return !1;
|
|
2064
2161
|
try {
|
|
2065
|
-
return
|
|
2162
|
+
return te(e) === X.documentFragment;
|
|
2066
2163
|
} catch {
|
|
2067
2164
|
return !1;
|
|
2068
2165
|
}
|
|
2069
|
-
},
|
|
2070
|
-
if (!
|
|
2166
|
+
}, Vt = function(e) {
|
|
2167
|
+
if (!te || typeof e != "object" || !e) return !1;
|
|
2071
2168
|
try {
|
|
2072
|
-
return typeof
|
|
2169
|
+
return typeof te(e) == "number";
|
|
2073
2170
|
} catch {
|
|
2074
2171
|
return !1;
|
|
2075
2172
|
}
|
|
2076
2173
|
};
|
|
2077
|
-
function
|
|
2078
|
-
e.length !== 0 &&
|
|
2079
|
-
e.call(t, n, r,
|
|
2174
|
+
function Z(e, n, r) {
|
|
2175
|
+
e.length !== 0 && wt(e, (e) => {
|
|
2176
|
+
e.call(t, n, r, R);
|
|
2080
2177
|
});
|
|
2081
2178
|
}
|
|
2082
|
-
let
|
|
2083
|
-
return !!(
|
|
2084
|
-
},
|
|
2085
|
-
return e instanceof RegExp ?
|
|
2179
|
+
let wn = function(e, t) {
|
|
2180
|
+
return !!(Pe && e.hasChildNodes() && !Vt(e.firstElementChild) && W(fn, e.textContent) && W(fn, e.innerHTML) || Pe && e.namespaceURI === M && gn[t] && (Vt(e.firstElementChild) || typeof e.textContent == "string" && W(_n[t], e.textContent)) || e.nodeType === X.processingInstruction || Pe && e.nodeType === X.comment && W(pn, e.data));
|
|
2181
|
+
}, Q = function(e, t) {
|
|
2182
|
+
return e instanceof RegExp ? W(e, t) : e instanceof Function && !!e(t, ...[...arguments].slice(2));
|
|
2086
2183
|
}, Tn = function(e, t, n) {
|
|
2087
|
-
if (!
|
|
2088
|
-
if (
|
|
2089
|
-
let t =
|
|
2184
|
+
if (!Oe[t] && jn(t) && Q(E.tagNameCheck, t)) return !1;
|
|
2185
|
+
if (Ke && !Ye[t]) {
|
|
2186
|
+
let t = _(e), r = g(e);
|
|
2090
2187
|
if (r && t) {
|
|
2091
2188
|
let i = r.length;
|
|
2092
2189
|
for (let a = i - 1; a >= 0; --a) {
|
|
2093
2190
|
let i = e === n ? f(r[a], !0) : r[a];
|
|
2094
|
-
t.insertBefore(i,
|
|
2191
|
+
t.insertBefore(i, h(e));
|
|
2095
2192
|
}
|
|
2096
2193
|
}
|
|
2097
2194
|
}
|
|
2098
|
-
return
|
|
2195
|
+
return z(e), !0;
|
|
2099
2196
|
}, En = function(e, t, n, r) {
|
|
2100
2197
|
return e.length === 0 ? t : t === n || t === r ? J(t) : t;
|
|
2101
2198
|
}, Dn = function(e, t) {
|
|
2102
|
-
return e === t ||
|
|
2199
|
+
return e === t || _(e) !== null ? !1 : (qe && St(e), !0);
|
|
2103
2200
|
}, On = function(e, n) {
|
|
2104
|
-
if (
|
|
2105
|
-
if (
|
|
2106
|
-
let r =
|
|
2107
|
-
if (
|
|
2201
|
+
if (Z(C.beforeSanitizeElements, e, null), Dn(e, n)) return !0;
|
|
2202
|
+
if (K(e)) return z(e), !0;
|
|
2203
|
+
let r = L(re(e));
|
|
2204
|
+
if (w = En(C.uponSanitizeElement, w, Ee, Le), Z(C.uponSanitizeElement, e, {
|
|
2108
2205
|
tagName: r,
|
|
2109
|
-
allowedTags:
|
|
2206
|
+
allowedTags: w
|
|
2110
2207
|
}), Dn(e, n)) return !0;
|
|
2111
|
-
if (
|
|
2112
|
-
if (
|
|
2208
|
+
if (wn(e, r)) return z(e), !0;
|
|
2209
|
+
if (Oe[r] || !(D.tagCheck instanceof Function && D.tagCheck(r)) && !w[r]) {
|
|
2113
2210
|
let t = Tn(e, r, n);
|
|
2114
|
-
return t === !1 &&
|
|
2211
|
+
return t === !1 && (Z(C.afterSanitizeElements, e, null), Dn(e, n)) ? !0 : t;
|
|
2115
2212
|
}
|
|
2116
|
-
if (
|
|
2117
|
-
if (
|
|
2118
|
-
let n =
|
|
2119
|
-
e.textContent !== n && (
|
|
2213
|
+
if (b(e) === X.element && !ht(e) || (r === "noscript" || r === "noembed" || r === "noframes") && W(mn, e.innerHTML)) return z(e), !0;
|
|
2214
|
+
if (O && e.nodeType === X.text) {
|
|
2215
|
+
let n = zt(e.textContent);
|
|
2216
|
+
e.textContent !== n && (Dt(t.removed, { element: e.cloneNode() }), e.textContent = n);
|
|
2120
2217
|
}
|
|
2121
|
-
return
|
|
2218
|
+
return Z(C.afterSanitizeElements, e, null), Dn(e, n);
|
|
2122
2219
|
}, kn = function(e, t, r) {
|
|
2123
|
-
if (
|
|
2124
|
-
let i =
|
|
2125
|
-
return
|
|
2220
|
+
if (ke[t] || Ct(t, e) || Ue && (t === "id" || t === "name") && (r in n || r in st)) return !1;
|
|
2221
|
+
let i = T[t] || D.attributeCheck instanceof Function && D.attributeCheck(t, e);
|
|
2222
|
+
return je && W(be, t) || Ae && W(xe, t) ? !0 : i ? Qe[t] || W(Te, Nt(r, Ce, "")) || (t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Pt(r, "data:") === 0 && Xe[e] || Me && !W(Se, Nt(r, Ce, "")) ? !0 : !r : jn(e) && Q(E.tagNameCheck, e) && Q(E.attributeNameCheck, t, e) || t === "is" && E.allowCustomizedBuiltInElements && Q(E.tagNameCheck, r);
|
|
2126
2223
|
}, An = q({}, [
|
|
2127
2224
|
"annotation-xml",
|
|
2128
2225
|
"color-profile",
|
|
@@ -2133,65 +2230,65 @@ function hn() {
|
|
|
2133
2230
|
"font-face-uri",
|
|
2134
2231
|
"missing-glyph"
|
|
2135
2232
|
]), jn = function(e) {
|
|
2136
|
-
return !An[
|
|
2233
|
+
return !An[At(e)] && W(we, e);
|
|
2137
2234
|
}, Mn = function(e, t, n, r) {
|
|
2138
|
-
if (
|
|
2139
|
-
case "TrustedHTML": return
|
|
2140
|
-
case "TrustedScriptURL": return
|
|
2235
|
+
if (x && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
|
|
2236
|
+
case "TrustedHTML": return le(r);
|
|
2237
|
+
case "TrustedScriptURL": return ue(r);
|
|
2141
2238
|
}
|
|
2142
2239
|
return r;
|
|
2143
2240
|
}, Nn = function(e, t, n, r) {
|
|
2144
2241
|
try {
|
|
2145
|
-
return n ? e.setAttributeNS(n, t, r) : e.setAttribute(t, r), !
|
|
2242
|
+
return n ? e.setAttributeNS(n, t, r) : e.setAttribute(t, r), !K(e) || (z(e), !1);
|
|
2146
2243
|
} catch {
|
|
2147
|
-
return
|
|
2148
|
-
}
|
|
2149
|
-
}, Pn = function(e) {
|
|
2150
|
-
|
|
2151
|
-
let
|
|
2152
|
-
if (!
|
|
2153
|
-
|
|
2154
|
-
let
|
|
2244
|
+
return yt(t, e), !1;
|
|
2245
|
+
}
|
|
2246
|
+
}, Pn = function(e, n) {
|
|
2247
|
+
if (Z(C.beforeSanitizeAttributes, e, null), Dn(e, n)) return;
|
|
2248
|
+
let r = e.attributes;
|
|
2249
|
+
if (!r || K(e)) return;
|
|
2250
|
+
T = En(C.uponSanitizeAttribute, T, De, Re);
|
|
2251
|
+
let i = {
|
|
2155
2252
|
attrName: "",
|
|
2156
2253
|
attrValue: "",
|
|
2157
2254
|
keepAttr: !0,
|
|
2158
|
-
allowedAttributes:
|
|
2255
|
+
allowedAttributes: T,
|
|
2159
2256
|
forceKeepAttr: void 0
|
|
2160
|
-
},
|
|
2161
|
-
for (;
|
|
2162
|
-
let
|
|
2163
|
-
if (
|
|
2164
|
-
|
|
2257
|
+
}, a = r.length, o = L(e.nodeName);
|
|
2258
|
+
for (; a--;) {
|
|
2259
|
+
let n = r[a], s = n.name, c = n.namespaceURI, l = n.value, u = L(s), d = l, f = s === "value" ? d : Ft(d), p = !1;
|
|
2260
|
+
if (i.attrName = u, i.attrValue = f, i.keepAttr = !0, i.forceKeepAttr = void 0, Z(C.uponSanitizeAttribute, e, i), f = i.attrValue, We && (u === "id" || u === "name") && Pt(f, Ge) !== 0 && (yt(s, e, n), f = Ge + f, p = !0), Pe && W(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, f)) {
|
|
2261
|
+
yt(s, e, n);
|
|
2165
2262
|
continue;
|
|
2166
2263
|
}
|
|
2167
|
-
if (u === "attributename" &&
|
|
2168
|
-
|
|
2264
|
+
if (u === "attributename" && Mt(f, "href")) {
|
|
2265
|
+
yt(s, e, n);
|
|
2169
2266
|
continue;
|
|
2170
2267
|
}
|
|
2171
|
-
if (!
|
|
2172
|
-
if (!
|
|
2173
|
-
|
|
2268
|
+
if (!i.forceKeepAttr) {
|
|
2269
|
+
if (!i.keepAttr) {
|
|
2270
|
+
yt(s, e, n);
|
|
2174
2271
|
continue;
|
|
2175
2272
|
}
|
|
2176
|
-
if (!
|
|
2177
|
-
|
|
2273
|
+
if (!Ne && W(hn, f)) {
|
|
2274
|
+
yt(s, e, n);
|
|
2178
2275
|
continue;
|
|
2179
2276
|
}
|
|
2180
|
-
if (
|
|
2181
|
-
|
|
2277
|
+
if (O && (f = zt(f)), !kn(o, u, f)) {
|
|
2278
|
+
yt(s, e, n);
|
|
2182
2279
|
continue;
|
|
2183
2280
|
}
|
|
2184
|
-
f = Mn(
|
|
2281
|
+
f = Mn(o, u, c, f), f !== d && Nn(e, s, c, f) && p && Et(t.removed);
|
|
2185
2282
|
}
|
|
2186
2283
|
}
|
|
2187
|
-
|
|
2284
|
+
Z(C.afterSanitizeAttributes, e, null), Dn(e, n);
|
|
2188
2285
|
}, Fn = function(e) {
|
|
2189
|
-
let t = null, n =
|
|
2190
|
-
for (
|
|
2191
|
-
let e =
|
|
2192
|
-
|
|
2286
|
+
let t = null, n = Rt(e);
|
|
2287
|
+
for (Z(C.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if (Z(C.uponSanitizeShadowNode, t, null), On(t, e), Pn(t, e), Bt(t.content) && Fn(t.content), b(t) === X.element) {
|
|
2288
|
+
let e = v(t);
|
|
2289
|
+
Bt(e) && (In(e), Fn(e));
|
|
2193
2290
|
}
|
|
2194
|
-
|
|
2291
|
+
Z(C.afterSanitizeShadowDOM, e, null);
|
|
2195
2292
|
}, In = function(e) {
|
|
2196
2293
|
let t = [{
|
|
2197
2294
|
node: e,
|
|
@@ -2203,24 +2300,24 @@ function hn() {
|
|
|
2203
2300
|
Fn(e.shadow);
|
|
2204
2301
|
continue;
|
|
2205
2302
|
}
|
|
2206
|
-
let n = e.node, r =
|
|
2303
|
+
let n = e.node, r = b(n) === X.element, i = g(n);
|
|
2207
2304
|
if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
|
|
2208
2305
|
node: i[e],
|
|
2209
2306
|
shadow: null
|
|
2210
2307
|
});
|
|
2211
2308
|
if (r) {
|
|
2212
2309
|
let e = ne ? ne(n) : null;
|
|
2213
|
-
if (typeof e == "string" &&
|
|
2310
|
+
if (typeof e == "string" && L(e) === "template") {
|
|
2214
2311
|
let e = n.content;
|
|
2215
|
-
|
|
2312
|
+
Bt(e) && t.push({
|
|
2216
2313
|
node: e,
|
|
2217
2314
|
shadow: null
|
|
2218
2315
|
});
|
|
2219
2316
|
}
|
|
2220
2317
|
}
|
|
2221
2318
|
if (r) {
|
|
2222
|
-
let e =
|
|
2223
|
-
|
|
2319
|
+
let e = v(n);
|
|
2320
|
+
Bt(e) && t.push({
|
|
2224
2321
|
node: null,
|
|
2225
2322
|
shadow: e
|
|
2226
2323
|
}, {
|
|
@@ -2232,74 +2329,78 @@ function hn() {
|
|
|
2232
2329
|
};
|
|
2233
2330
|
return t.sanitize = function(e) {
|
|
2234
2331
|
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
|
|
2235
|
-
if (
|
|
2332
|
+
if (et = !e, et && (e = "<!-->"), typeof e != "string" && !Vt(e) && (e = Ht(e), typeof e != "string")) throw G("dirty is not a string, aborting");
|
|
2236
2333
|
if (!t.isSupported) return e;
|
|
2237
|
-
|
|
2238
|
-
let c =
|
|
2334
|
+
Ie ? (w = Le, T = Re) : lt(n), (C.uponSanitizeElement.length > 0 || C.uponSanitizeAttribute.length > 0) && (w = J(w)), C.uponSanitizeAttribute.length > 0 && (T = J(T)), t.removed = [];
|
|
2335
|
+
let c = qe && typeof e != "string" && Vt(e);
|
|
2239
2336
|
if (c) {
|
|
2240
|
-
|
|
2241
|
-
let t =
|
|
2337
|
+
It(e);
|
|
2338
|
+
let t = re(e);
|
|
2242
2339
|
if (typeof t == "string") {
|
|
2243
|
-
let n =
|
|
2244
|
-
if (!
|
|
2340
|
+
let n = L(t);
|
|
2341
|
+
if (!w[n] || Oe[n]) throw vt(e), G("root node is forbidden and cannot be sanitized in-place");
|
|
2245
2342
|
}
|
|
2246
|
-
if (
|
|
2343
|
+
if (K(e)) throw vt(e), G("root node is clobbered and cannot be sanitized in-place");
|
|
2247
2344
|
try {
|
|
2248
2345
|
In(e);
|
|
2249
2346
|
} catch (t) {
|
|
2250
|
-
throw
|
|
2347
|
+
throw vt(e), t;
|
|
2251
2348
|
}
|
|
2252
|
-
} else if (
|
|
2349
|
+
} else if (Vt(e)) i = Lt("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === X.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), In(i);
|
|
2253
2350
|
else {
|
|
2254
|
-
if (!
|
|
2255
|
-
if (i =
|
|
2351
|
+
if (!Be && !O && !Fe && e.indexOf("<") === -1) return x && He ? le(e) : e;
|
|
2352
|
+
if (i = Lt(e), !i) return Be ? null : He ? ie : "";
|
|
2256
2353
|
}
|
|
2257
|
-
i &&
|
|
2354
|
+
i && ze && z(i.firstChild);
|
|
2258
2355
|
let l = c ? e : i;
|
|
2259
2356
|
try {
|
|
2260
|
-
let e =
|
|
2261
|
-
for (; o = e.nextNode();) On(o, l), Pn(o),
|
|
2357
|
+
let e = Rt(l);
|
|
2358
|
+
for (; o = e.nextNode();) On(o, l), Pn(o, l), Bt(o.content) && Fn(o.content);
|
|
2262
2359
|
} catch (n) {
|
|
2263
|
-
throw c && (
|
|
2264
|
-
e.element &&
|
|
2360
|
+
throw c && (vt(e), wt(t.removed, (e) => {
|
|
2361
|
+
e.element && St(e.element);
|
|
2265
2362
|
})), n;
|
|
2266
2363
|
}
|
|
2267
|
-
if (c)
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2364
|
+
if (c) {
|
|
2365
|
+
let n = !1;
|
|
2366
|
+
if (wt(t.removed, (t) => {
|
|
2367
|
+
t.element && (t.element === e && (n = !0), St(t.element));
|
|
2368
|
+
}), n) throw G("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
2369
|
+
return O && U(e), e;
|
|
2370
|
+
}
|
|
2371
|
+
if (Be) {
|
|
2372
|
+
if (O && U(i), Ve) for (s = me.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
|
|
2272
2373
|
else s = i;
|
|
2273
|
-
return (
|
|
2374
|
+
return (T.shadowroot || T.shadowrootmode) && (s = ge.call(r, s, !0)), s;
|
|
2274
2375
|
}
|
|
2275
|
-
let u =
|
|
2276
|
-
return
|
|
2376
|
+
let u = Fe ? i.outerHTML : i.innerHTML;
|
|
2377
|
+
return Fe && w["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && W(un, i.ownerDocument.doctype.name) && (u = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + u), O && (u = zt(u)), x && He ? le(u) : u;
|
|
2277
2378
|
}, t.setConfig = function() {
|
|
2278
2379
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2279
|
-
lt(e),
|
|
2380
|
+
lt(e), Ie = !0, Le = w, Re = T;
|
|
2280
2381
|
}, t.clearConfig = function() {
|
|
2281
|
-
|
|
2382
|
+
R = null, Ie = !1, Le = null, Re = null, x = ae, ie = "";
|
|
2282
2383
|
}, t.isValidAttribute = function(e, t, n) {
|
|
2283
|
-
|
|
2284
|
-
let r =
|
|
2384
|
+
R || lt({});
|
|
2385
|
+
let r = L(e), i = L(t);
|
|
2285
2386
|
return kn(r, i, n);
|
|
2286
2387
|
}, t.addHook = function(e, t) {
|
|
2287
|
-
typeof t == "function" &&
|
|
2388
|
+
typeof t == "function" && H(C, e) && Dt(C[e], t);
|
|
2288
2389
|
}, t.removeHook = function(e, t) {
|
|
2289
|
-
if (
|
|
2390
|
+
if (H(C, e)) {
|
|
2290
2391
|
if (t !== void 0) {
|
|
2291
|
-
let n =
|
|
2292
|
-
return n === -1 ? void 0 :
|
|
2392
|
+
let n = Tt(C[e], t);
|
|
2393
|
+
return n === -1 ? void 0 : Ot(C[e], n, 1)[0];
|
|
2293
2394
|
}
|
|
2294
|
-
return
|
|
2395
|
+
return Et(C[e]);
|
|
2295
2396
|
}
|
|
2296
2397
|
}, t.removeHooks = function(e) {
|
|
2297
|
-
|
|
2398
|
+
H(C, e) && (C[e] = []);
|
|
2298
2399
|
}, t.removeAllHooks = function() {
|
|
2299
|
-
|
|
2400
|
+
C = bn();
|
|
2300
2401
|
}, t;
|
|
2301
2402
|
}
|
|
2302
|
-
var
|
|
2403
|
+
var wn = Cn(), Q = class {
|
|
2303
2404
|
constructor(e, t) {
|
|
2304
2405
|
this.editor = e, this.defaultText = `${t} text`, this.button = this.createButton(), this.title = t;
|
|
2305
2406
|
}
|
|
@@ -2307,13 +2408,13 @@ var gn = hn(), Z = class {
|
|
|
2307
2408
|
let t = document.createElement("button"), n = this.title ? `${this.title.replace(/ /g, "-")}-btn`.toLowerCase() : "";
|
|
2308
2409
|
t.innerHTML = e;
|
|
2309
2410
|
let r = t.querySelector("svg");
|
|
2310
|
-
if (r && r.setAttribute("aria-hidden", "true"), t.type = "button", t.title = this.title, t.className = `markdown-btn ${n} fj:me-btn fj:me-btn-xs fj:me-btn-square fj:me-btn-ghost`, t.addEventListener("click", (e) => this.applySyntax(e)), n == "preview-btn") {
|
|
2411
|
+
if (r && r.setAttribute("aria-hidden", "true"), t.type = "button", t.title = this.title ? this.editor.label(this.title) : this.title, t.className = `markdown-btn ${n} fj:me-btn fj:me-btn-xs fj:me-btn-square fj:me-btn-ghost`, t.addEventListener("click", (e) => this.applySyntax(e)), n == "preview-btn") {
|
|
2311
2412
|
let e = document.createElement("div");
|
|
2312
2413
|
return e.className = "fj:me-surface fj:me-surface-outline fj:border-base-soft fj:border-0 fj:border-l fj:sticky fj:-right-2 fj:px-1.5", e.appendChild(t), e;
|
|
2313
2414
|
}
|
|
2314
2415
|
return t;
|
|
2315
2416
|
}
|
|
2316
|
-
},
|
|
2417
|
+
}, Tn = class extends Q {
|
|
2317
2418
|
constructor(e) {
|
|
2318
2419
|
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 ");
|
|
2319
2420
|
}
|
|
@@ -2330,7 +2431,7 @@ var gn = hn(), Z = class {
|
|
|
2330
2431
|
} else a = `**${i || "Bold text"}**`, i || (o = 2);
|
|
2331
2432
|
this.editor.insertText(a, o, o);
|
|
2332
2433
|
}
|
|
2333
|
-
},
|
|
2434
|
+
}, En = class extends Q {
|
|
2334
2435
|
constructor(e) {
|
|
2335
2436
|
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 ");
|
|
2336
2437
|
}
|
|
@@ -2347,7 +2448,7 @@ var gn = hn(), Z = class {
|
|
|
2347
2448
|
} else a = `*${i || "Italic text"}*`, i || (o = 1);
|
|
2348
2449
|
this.editor.insertText(a, o, o);
|
|
2349
2450
|
}
|
|
2350
|
-
},
|
|
2451
|
+
}, Dn = class extends Q {
|
|
2351
2452
|
constructor(e) {
|
|
2352
2453
|
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 ");
|
|
2353
2454
|
}
|
|
@@ -2360,7 +2461,7 @@ var gn = hn(), Z = class {
|
|
|
2360
2461
|
} else a = `~~${i || "Strikethrough text"}~~`, o = 2;
|
|
2361
2462
|
this.editor.insertText(a, o, o);
|
|
2362
2463
|
}
|
|
2363
|
-
},
|
|
2464
|
+
}, On = class extends Q {
|
|
2364
2465
|
constructor(e) {
|
|
2365
2466
|
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 ");
|
|
2366
2467
|
}
|
|
@@ -2373,7 +2474,7 @@ var gn = hn(), Z = class {
|
|
|
2373
2474
|
} else a = `- ${i || "Unordered list"}`, o = 2;
|
|
2374
2475
|
this.editor.insertText(a, o);
|
|
2375
2476
|
}
|
|
2376
|
-
},
|
|
2477
|
+
}, kn = class extends Q {
|
|
2377
2478
|
constructor(e) {
|
|
2378
2479
|
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 ");
|
|
2379
2480
|
}
|
|
@@ -2386,7 +2487,7 @@ var gn = hn(), Z = class {
|
|
|
2386
2487
|
} else a = `1. ${i || "Ordered list"}`, o = 3;
|
|
2387
2488
|
this.editor.insertText(a, o);
|
|
2388
2489
|
}
|
|
2389
|
-
},
|
|
2490
|
+
}, An = class extends Q {
|
|
2390
2491
|
constructor(e) {
|
|
2391
2492
|
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 ");
|
|
2392
2493
|
let t = this.button.querySelector("button");
|
|
@@ -2394,7 +2495,7 @@ var gn = hn(), Z = class {
|
|
|
2394
2495
|
}
|
|
2395
2496
|
applySyntax() {
|
|
2396
2497
|
let e = this.editor.previewContent?.parentNode, t = this.editor.markdownEditorDiv;
|
|
2397
|
-
|
|
2498
|
+
e && t && (this.editor.preview && this.preview ? this.enablePreview(e, t) : this.disablePreview(e, t));
|
|
2398
2499
|
}
|
|
2399
2500
|
disablePreview(e, t) {
|
|
2400
2501
|
this.preview = !0;
|
|
@@ -2417,7 +2518,7 @@ var gn = hn(), Z = class {
|
|
|
2417
2518
|
destroy() {
|
|
2418
2519
|
this.preview || (document.removeEventListener("keydown", this._escHandler), document.querySelector("body")?.classList.remove("fj:overflow-hidden"));
|
|
2419
2520
|
}
|
|
2420
|
-
},
|
|
2521
|
+
}, jn = class extends Q {
|
|
2421
2522
|
constructor(e) {
|
|
2422
2523
|
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 ");
|
|
2423
2524
|
}
|
|
@@ -2434,7 +2535,7 @@ var gn = hn(), Z = class {
|
|
|
2434
2535
|
}
|
|
2435
2536
|
this.editor.insertText(s, c);
|
|
2436
2537
|
}
|
|
2437
|
-
},
|
|
2538
|
+
}, Mn = class extends Q {
|
|
2438
2539
|
constructor(e) {
|
|
2439
2540
|
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 ");
|
|
2440
2541
|
}
|
|
@@ -2450,7 +2551,7 @@ var gn = hn(), Z = class {
|
|
|
2450
2551
|
};
|
|
2451
2552
|
//#endregion
|
|
2452
2553
|
//#region src/components/modal.js
|
|
2453
|
-
function
|
|
2554
|
+
function Nn(e, t, n, r = "") {
|
|
2454
2555
|
let i = e.target.closest(".markdown-editor-wrapper");
|
|
2455
2556
|
i.querySelector(".markdown-modal") && i.querySelector(".markdown-modal").remove();
|
|
2456
2557
|
let a = `
|
|
@@ -2466,7 +2567,7 @@ function wn(e, t, n, r = "") {
|
|
|
2466
2567
|
}
|
|
2467
2568
|
//#endregion
|
|
2468
2569
|
//#region src/components/toolbar/tools/LinkTool.js
|
|
2469
|
-
var
|
|
2570
|
+
var Pn = class extends Q {
|
|
2470
2571
|
constructor(e) {
|
|
2471
2572
|
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 ");
|
|
2472
2573
|
}
|
|
@@ -2476,32 +2577,32 @@ var Tn = class extends Z {
|
|
|
2476
2577
|
let e = s.match(/^\]\(([^)]+)\)/);
|
|
2477
2578
|
e && (r = o.length - 1, i += e[0].length, n.setSelectionRange(r, i));
|
|
2478
2579
|
}
|
|
2479
|
-
let c = a.substring(r, i), l = c && c.match(/^\[([^\]]+)\]\(([^)]+)\)$/), u = l ? l[1] : c, d =
|
|
2580
|
+
let c = a.substring(r, i), l = c && c.match(/^\[([^\]]+)\]\(([^)]+)\)$/), u = l ? l[1] : c, d = l ? l[2] : "", f = Nn(e, "fj:max-w-sm", `
|
|
2480
2581
|
<div class="fj:flex fj:justify-between fj:items-center fj:gap-3">
|
|
2481
|
-
<div class="fj:font-medium"
|
|
2482
|
-
<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">
|
|
2582
|
+
<div class="fj:font-medium">${this.editor.label("Link")}</div>
|
|
2583
|
+
<button type="button" class="modal-close-btn fj:me-btn fj:me-btn-ghost fj:me-btn-xs fj:me-btn-circle" aria-label="${this.editor.label("Close")}">
|
|
2483
2584
|
<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 d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
2484
2585
|
</button>
|
|
2485
2586
|
</div>
|
|
2486
2587
|
<form method="post">
|
|
2487
2588
|
<div class="fj:flex fj:flex-col fj:justify-center fj:gap-y-4.5 fj:mt-4">
|
|
2488
|
-
<input type="url" placeholder="URL" class="link-input fj:me-input fj:w-full" value="${
|
|
2489
|
-
<input type="text" placeholder="Link text" class="link-text-input fj:me-input fj:w-full" value="${u}" required>
|
|
2490
|
-
<button type="submit" class="submit-link fj:me-btn fj:me-btn-sm fj:self-end"
|
|
2589
|
+
<input type="url" placeholder="${this.editor.label("URL")}" class="link-input fj:me-input fj:w-full" value="${d}" required>
|
|
2590
|
+
<input type="text" placeholder="${this.editor.label("Link text")}" class="link-text-input fj:me-input fj:w-full" value="${u}" required>
|
|
2591
|
+
<button type="submit" class="submit-link fj:me-btn fj:me-btn-sm fj:self-end">${this.editor.label("Apply")}</button>
|
|
2491
2592
|
</div>
|
|
2492
2593
|
</form>`, "Link");
|
|
2493
|
-
|
|
2594
|
+
f.querySelector(".modal-close-btn").addEventListener("click", () => f.close()), f.querySelector(".submit-link").addEventListener("click", function(e) {
|
|
2494
2595
|
e.preventDefault();
|
|
2495
|
-
let n =
|
|
2596
|
+
let n = f.querySelector(".link-input"), r = f.querySelector(".link-text-input");
|
|
2496
2597
|
if (!n.validity.valid) n.reportValidity();
|
|
2497
2598
|
else if (!r.validity.valid) r.reportValidity();
|
|
2498
2599
|
else {
|
|
2499
2600
|
let e = n.value, i = r.value || "Link Text";
|
|
2500
|
-
t.insertText(`[${i}](${e})`),
|
|
2601
|
+
t.insertText(`[${i}](${e})`), f.close();
|
|
2501
2602
|
}
|
|
2502
2603
|
});
|
|
2503
2604
|
}
|
|
2504
|
-
},
|
|
2605
|
+
}, Fn = class extends Q {
|
|
2505
2606
|
constructor(e) {
|
|
2506
2607
|
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 ");
|
|
2507
2608
|
}
|
|
@@ -2509,9 +2610,9 @@ var Tn = class extends Z {
|
|
|
2509
2610
|
let t = `heading-popover-${Math.random().toString(36).slice(2, 7)}`, n = document.createElement("button");
|
|
2510
2611
|
n.innerHTML = e;
|
|
2511
2612
|
let r = n.querySelector("svg");
|
|
2512
|
-
r && r.setAttribute("aria-hidden", "true"), n.type = "button", n.title = "Heading", n.setAttribute("aria-label", "Heading"), n.setAttribute("aria-haspopup", "menu"), n.className = "markdown-btn heading-btn fj:me-btn fj:me-btn-xs fj:me-btn-square fj:me-btn-ghost fj:me-popover-toggle", n.setAttribute("popovertarget", t);
|
|
2613
|
+
r && r.setAttribute("aria-hidden", "true"), n.type = "button", n.title = this.editor.label("Heading"), n.setAttribute("aria-label", this.editor.label("Heading")), n.setAttribute("aria-haspopup", "menu"), n.className = "markdown-btn heading-btn fj:me-btn fj:me-btn-xs fj:me-btn-square fj:me-btn-ghost fj:me-popover-toggle", n.setAttribute("popovertarget", t);
|
|
2513
2614
|
let i = document.createElement("div");
|
|
2514
|
-
i.id = t, i.setAttribute("role", "menu"), i.setAttribute("aria-label", "Heading level"), i.className = "fj:me-popover-content", i.setAttribute("popover", "");
|
|
2615
|
+
i.id = t, i.setAttribute("role", "menu"), i.setAttribute("aria-label", this.editor.label("Heading level")), i.className = "fj:me-popover-content", i.setAttribute("popover", "");
|
|
2515
2616
|
let a = document.createElement("ul");
|
|
2516
2617
|
a.className = "fj:me-menu", a.setAttribute("role", "presentation");
|
|
2517
2618
|
let o = [
|
|
@@ -2526,7 +2627,7 @@ var Tn = class extends Z {
|
|
|
2526
2627
|
let t = document.createElement("li");
|
|
2527
2628
|
t.setAttribute("role", "none");
|
|
2528
2629
|
let n = document.createElement("button");
|
|
2529
|
-
n.type = "button", n.setAttribute("role", "menuitem"), n.className = `fj:me-menu-item ${o[e - 1]}`, n.textContent =
|
|
2630
|
+
n.type = "button", n.setAttribute("role", "menuitem"), n.className = `fj:me-menu-item ${o[e - 1]}`, n.textContent = `${this.editor.label("Heading")} ${e}`, n.addEventListener("click", () => {
|
|
2530
2631
|
this.applyHeading(e), i.hidePopover();
|
|
2531
2632
|
}), t.appendChild(n), a.appendChild(t);
|
|
2532
2633
|
}
|
|
@@ -2541,7 +2642,28 @@ var Tn = class extends Z {
|
|
|
2541
2642
|
t.setSelectionRange(p, m), this.editor.scrollToView(), this.editor.render(), this.editor.notifyChange();
|
|
2542
2643
|
}
|
|
2543
2644
|
applySyntax() {}
|
|
2544
|
-
}
|
|
2645
|
+
};
|
|
2646
|
+
//#endregion
|
|
2647
|
+
//#region src/utils/imageUpload.js
|
|
2648
|
+
async function In(e, { uploadUrl: t, params: n = {}, alt: r = "" } = {}) {
|
|
2649
|
+
let i = new FormData();
|
|
2650
|
+
i.append("image_file", e), i.append("image_alt", r);
|
|
2651
|
+
for (let [e, t] of Object.entries(n)) i.append(e, t);
|
|
2652
|
+
let a = await fetch(t, {
|
|
2653
|
+
method: "POST",
|
|
2654
|
+
body: i
|
|
2655
|
+
});
|
|
2656
|
+
if (!a.ok) throw Error(`Upload failed: ${a.status}`);
|
|
2657
|
+
let o = await a.json();
|
|
2658
|
+
if (!o.success || !o.image_path) throw Error(o.error || o.message || "Image upload failed.");
|
|
2659
|
+
return {
|
|
2660
|
+
path: o.image_path,
|
|
2661
|
+
alt: o.image_alt || ""
|
|
2662
|
+
};
|
|
2663
|
+
}
|
|
2664
|
+
//#endregion
|
|
2665
|
+
//#region src/components/toolbar/tools/ImageTool.js
|
|
2666
|
+
var Ln = class extends Q {
|
|
2545
2667
|
constructor(e, t = {}) {
|
|
2546
2668
|
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 ");
|
|
2547
2669
|
}
|
|
@@ -2551,29 +2673,29 @@ var Tn = class extends Z {
|
|
|
2551
2673
|
let e = s.match(/^\]\(([^)]+)\)/);
|
|
2552
2674
|
e && (r = o.length - 2, i += e[0].length, n.setSelectionRange(r, i));
|
|
2553
2675
|
}
|
|
2554
|
-
let c = a.substring(r, i), l = this.fileInputConfig.accept ? this.fileInputConfig.accept.map((e) => `image/${e}`).join(",") : "image/*", u = typeof this.altInputConfig == "boolean" ? this.altInputConfig : this.altInputConfig.required !== !1, d = this.fileInputConfig.uploadUrl || null, f = this.fileInputConfig.params || {}, p = c && c.match(/^!\[([^\]]*)\]\(([^)]+)\)$/), m = p ? p[1] : c,
|
|
2555
|
-
this.fileInputConfig && (
|
|
2676
|
+
let c = a.substring(r, i), l = this.fileInputConfig.accept ? this.fileInputConfig.accept.map((e) => `image/${e}`).join(",") : "image/*", u = typeof this.altInputConfig == "boolean" ? this.altInputConfig : this.altInputConfig.required !== !1, d = this.fileInputConfig.uploadUrl || null, f = this.fileInputConfig.params || {}, p = c && c.match(/^!\[([^\]]*)\]\(([^)]+)\)$/), m = p ? p[1] : c, h = p ? p[2] : "", g = "";
|
|
2677
|
+
this.fileInputConfig && (g = `
|
|
2556
2678
|
<input type="file" accept="${l}" class="img-file-input fj:me-input fj:w-full">
|
|
2557
2679
|
<div class="fj:me-divider fj:my-1">OR</div>
|
|
2558
2680
|
`);
|
|
2559
|
-
let
|
|
2681
|
+
let _ = Nn(e, "fj:max-w-sm", `
|
|
2560
2682
|
<div class="fj:flex fj:justify-between fj:items-center fj:gap-3">
|
|
2561
|
-
<div class="fj:font-medium"
|
|
2562
|
-
<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">
|
|
2683
|
+
<div class="fj:font-medium">${t.label("Image")}</div>
|
|
2684
|
+
<button type="button" class="modal-close-btn fj:me-btn fj:me-btn-ghost fj:me-btn-xs fj:me-btn-circle" aria-label="${t.label("Close")}">
|
|
2563
2685
|
<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 d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
2564
2686
|
</button>
|
|
2565
2687
|
</div>
|
|
2566
2688
|
<div class="fj:mt-4 fj:flex fj:flex-col fj:gap-y-4">
|
|
2567
|
-
${
|
|
2568
|
-
<input type="url" placeholder="URL" class="img-link-input fj:me-input fj:w-full" value="${
|
|
2569
|
-
<input type="text" placeholder="Alt text" class="img-link-alt-input fj:me-input fj:w-full" value="${m}" ${u ? "required" : ""}>
|
|
2570
|
-
<button type="button" class="submit-img-link fj:me-btn fj:me-btn-sm fj:self-end"
|
|
2689
|
+
${g}
|
|
2690
|
+
<input type="url" placeholder="${t.label("URL")}" class="img-link-input fj:me-input fj:w-full" value="${h}" required>
|
|
2691
|
+
<input type="text" placeholder="${t.label("Alt text")}" class="img-link-alt-input fj:me-input fj:w-full" value="${m}" ${u ? "required" : ""}>
|
|
2692
|
+
<button type="button" class="submit-img-link fj:me-btn fj:me-btn-sm fj:self-end">${t.label("Apply")}</button>
|
|
2571
2693
|
</div>`, "Image");
|
|
2572
|
-
|
|
2573
|
-
let
|
|
2574
|
-
|
|
2694
|
+
_.querySelector(".modal-close-btn").addEventListener("click", () => _.close());
|
|
2695
|
+
let v = _.querySelector(".submit-img-link");
|
|
2696
|
+
v.addEventListener("click", async (e) => {
|
|
2575
2697
|
e.preventDefault();
|
|
2576
|
-
let n =
|
|
2698
|
+
let n = _.querySelector(".img-file-input"), r = _.querySelector(".img-link-input"), i = _.querySelector(".img-link-alt-input"), a = n?.files[0];
|
|
2577
2699
|
if (a && (r.required = !1), u && !i.validity.valid) {
|
|
2578
2700
|
i.reportValidity(), a && (r.required = !0);
|
|
2579
2701
|
return;
|
|
@@ -2584,34 +2706,25 @@ var Tn = class extends Z {
|
|
|
2584
2706
|
}
|
|
2585
2707
|
if (a && d) {
|
|
2586
2708
|
let e = n.files[0];
|
|
2587
|
-
|
|
2588
|
-
let t = new FormData();
|
|
2589
|
-
t.append("image_file", e), t.append("image_alt", i.value), Object.keys(f).forEach((e) => {
|
|
2590
|
-
t.append(e, f[e]);
|
|
2591
|
-
});
|
|
2709
|
+
v.disabled = !0, v.textContent = t.label("Uploading...");
|
|
2592
2710
|
try {
|
|
2593
|
-
let
|
|
2594
|
-
|
|
2595
|
-
|
|
2711
|
+
let { path: t, alt: n } = await In(e, {
|
|
2712
|
+
uploadUrl: d,
|
|
2713
|
+
params: f,
|
|
2714
|
+
alt: i.value
|
|
2596
2715
|
});
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
else {
|
|
2601
|
-
alert(n.error || n.message || "Image upload failed."), _.disabled = !1, _.textContent = "Apply", r.required = !0;
|
|
2602
|
-
return;
|
|
2603
|
-
}
|
|
2604
|
-
} catch {
|
|
2605
|
-
alert("Upload failed."), _.disabled = !1, _.textContent = "Apply", r.required = !0;
|
|
2716
|
+
r.value = t, n && !i.value.trim() && (i.value = n);
|
|
2717
|
+
} catch (e) {
|
|
2718
|
+
alert(e.message || "Upload failed."), v.disabled = !1, v.textContent = t.label("Apply"), r.required = !0;
|
|
2606
2719
|
return;
|
|
2607
2720
|
}
|
|
2608
|
-
|
|
2721
|
+
v.disabled = !1, v.textContent = t.label("Apply");
|
|
2609
2722
|
}
|
|
2610
2723
|
let o = r.value, s = ``;
|
|
2611
|
-
t.insertText(s),
|
|
2724
|
+
t.insertText(s), _.close();
|
|
2612
2725
|
});
|
|
2613
2726
|
}
|
|
2614
|
-
},
|
|
2727
|
+
}, Rn = class extends Q {
|
|
2615
2728
|
constructor(e) {
|
|
2616
2729
|
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 ");
|
|
2617
2730
|
}
|
|
@@ -2619,7 +2732,7 @@ var Tn = class extends Z {
|
|
|
2619
2732
|
let e = this.editor.undoRedoManager;
|
|
2620
2733
|
e && e.undo();
|
|
2621
2734
|
}
|
|
2622
|
-
},
|
|
2735
|
+
}, zn = class extends Q {
|
|
2623
2736
|
constructor(e) {
|
|
2624
2737
|
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 ");
|
|
2625
2738
|
}
|
|
@@ -2627,7 +2740,7 @@ var Tn = class extends Z {
|
|
|
2627
2740
|
let e = this.editor.undoRedoManager;
|
|
2628
2741
|
e && e.redo();
|
|
2629
2742
|
}
|
|
2630
|
-
},
|
|
2743
|
+
}, Bn = class extends Q {
|
|
2631
2744
|
constructor(e) {
|
|
2632
2745
|
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 ");
|
|
2633
2746
|
}
|
|
@@ -2635,7 +2748,7 @@ var Tn = class extends Z {
|
|
|
2635
2748
|
let e = this.editor.indentManager;
|
|
2636
2749
|
e && (e.indent(), this.editor.render());
|
|
2637
2750
|
}
|
|
2638
|
-
},
|
|
2751
|
+
}, Vn = class extends Q {
|
|
2639
2752
|
constructor(e) {
|
|
2640
2753
|
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 ");
|
|
2641
2754
|
}
|
|
@@ -2643,7 +2756,7 @@ var Tn = class extends Z {
|
|
|
2643
2756
|
let t = this.editor.indentManager;
|
|
2644
2757
|
t && (t.outdent(), this.editor.render());
|
|
2645
2758
|
}
|
|
2646
|
-
},
|
|
2759
|
+
}, Hn = class extends Q {
|
|
2647
2760
|
constructor(e) {
|
|
2648
2761
|
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 ");
|
|
2649
2762
|
}
|
|
@@ -2660,7 +2773,7 @@ var Tn = class extends Z {
|
|
|
2660
2773
|
let a = `\`${i || "code"}\``;
|
|
2661
2774
|
this.editor.insertText(a, 1, 1);
|
|
2662
2775
|
}
|
|
2663
|
-
},
|
|
2776
|
+
}, Un = class extends Q {
|
|
2664
2777
|
constructor(e) {
|
|
2665
2778
|
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 ");
|
|
2666
2779
|
}
|
|
@@ -2674,7 +2787,7 @@ var Tn = class extends Z {
|
|
|
2674
2787
|
let i = `\`\`\`\n${r || "code"}\n\`\`\``;
|
|
2675
2788
|
this.editor.insertText(i, 4, 4);
|
|
2676
2789
|
}
|
|
2677
|
-
},
|
|
2790
|
+
}, Wn = class extends Q {
|
|
2678
2791
|
constructor(e) {
|
|
2679
2792
|
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 ");
|
|
2680
2793
|
}
|
|
@@ -2682,7 +2795,7 @@ var Tn = class extends Z {
|
|
|
2682
2795
|
let e = this.editor.usertextarea, { selectionStart: t } = e, n = e.value, r = t === 0 || n[t - 1] === "\n" ? "---\n" : "\n\n---\n";
|
|
2683
2796
|
this.editor.insertText(r, r.length, 0);
|
|
2684
2797
|
}
|
|
2685
|
-
},
|
|
2798
|
+
}, Gn = class extends Q {
|
|
2686
2799
|
constructor(e) {
|
|
2687
2800
|
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 ");
|
|
2688
2801
|
}
|
|
@@ -2693,28 +2806,28 @@ var Tn = class extends Z {
|
|
|
2693
2806
|
};
|
|
2694
2807
|
//#endregion
|
|
2695
2808
|
//#region src/utils/variables.js
|
|
2696
|
-
function
|
|
2809
|
+
function Kn(e) {
|
|
2697
2810
|
let t = (e) => e && e.label && typeof e.value == "string", n = [];
|
|
2698
2811
|
for (let r of Array.isArray(e) ? e : []) r && (Array.isArray(r.items) ? n.push(...r.items.filter(t)) : t(r) && n.push(r));
|
|
2699
2812
|
return n;
|
|
2700
2813
|
}
|
|
2701
|
-
function
|
|
2702
|
-
let n =
|
|
2814
|
+
function qn(e, t) {
|
|
2815
|
+
let n = Kn(t).filter((e) => typeof e.sample == "string");
|
|
2703
2816
|
return n.length ? n.slice().sort((e, t) => t.value.length - e.value.length).reduce((e, t) => e.split(t.value).join(t.sample), e) : e;
|
|
2704
2817
|
}
|
|
2705
2818
|
//#endregion
|
|
2706
2819
|
//#region src/components/toolbar/tools/VariableTool.js
|
|
2707
|
-
var
|
|
2820
|
+
var Jn = "\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 4a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2\" /><path d=\"M17 4a2 2 0 0 1 2 2v3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2v3a2 2 0 0 1 -2 2\" /></svg>\n", Yn = class extends Q {
|
|
2708
2821
|
constructor(e) {
|
|
2709
2822
|
super(e, "Variables");
|
|
2710
2823
|
}
|
|
2711
2824
|
createButton() {
|
|
2712
2825
|
let e = this.editor.variables ?? [];
|
|
2713
|
-
if (!
|
|
2826
|
+
if (!Kn(e).length) return null;
|
|
2714
2827
|
let t = `variable-popover-${Math.random().toString(36).slice(2, 7)}`, n = document.createElement("button");
|
|
2715
|
-
n.innerHTML =
|
|
2828
|
+
n.innerHTML = Jn, n.querySelector("svg")?.setAttribute("aria-hidden", "true"), n.type = "button", n.title = this.editor.label("Insert variable"), n.setAttribute("aria-label", this.editor.label("Insert variable")), n.setAttribute("aria-haspopup", "menu"), n.className = "markdown-btn variable-btn fj:me-btn fj:me-btn-xs fj:me-btn-square fj:me-btn-ghost fj:me-popover-toggle", n.setAttribute("popovertarget", t);
|
|
2716
2829
|
let r = document.createElement("div");
|
|
2717
|
-
r.id = t, r.setAttribute("role", "menu"), r.setAttribute("aria-label", "Variables"), r.className = "fj:me-popover-content", r.setAttribute("popover", "");
|
|
2830
|
+
r.id = t, r.setAttribute("role", "menu"), r.setAttribute("aria-label", this.editor.label("Variables")), r.className = "fj:me-popover-content", r.setAttribute("popover", "");
|
|
2718
2831
|
let i = document.createElement("ul");
|
|
2719
2832
|
i.className = "fj:me-menu", i.setAttribute("role", "presentation");
|
|
2720
2833
|
let a = (e) => e && e.label && typeof e.value == "string";
|
|
@@ -2743,31 +2856,31 @@ var Rn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
|
|
|
2743
2856
|
}), n.appendChild(r), n;
|
|
2744
2857
|
}
|
|
2745
2858
|
applySyntax() {}
|
|
2746
|
-
},
|
|
2859
|
+
}, Xn = class {
|
|
2747
2860
|
constructor(e, t) {
|
|
2748
2861
|
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();
|
|
2749
2862
|
}
|
|
2750
2863
|
init() {
|
|
2751
2864
|
let e = {
|
|
2752
|
-
heading:
|
|
2753
|
-
ul:
|
|
2754
|
-
ol:
|
|
2755
|
-
checklist:
|
|
2756
|
-
bold:
|
|
2757
|
-
italic:
|
|
2758
|
-
strikethrough:
|
|
2759
|
-
blockquote:
|
|
2760
|
-
code:
|
|
2761
|
-
codeblock:
|
|
2762
|
-
hr:
|
|
2763
|
-
table:
|
|
2764
|
-
link:
|
|
2765
|
-
image:
|
|
2766
|
-
undo:
|
|
2767
|
-
redo:
|
|
2768
|
-
indent:
|
|
2769
|
-
outdent:
|
|
2770
|
-
variables:
|
|
2865
|
+
heading: Fn,
|
|
2866
|
+
ul: On,
|
|
2867
|
+
ol: kn,
|
|
2868
|
+
checklist: jn,
|
|
2869
|
+
bold: Tn,
|
|
2870
|
+
italic: En,
|
|
2871
|
+
strikethrough: Dn,
|
|
2872
|
+
blockquote: Mn,
|
|
2873
|
+
code: Hn,
|
|
2874
|
+
codeblock: Un,
|
|
2875
|
+
hr: Wn,
|
|
2876
|
+
table: Gn,
|
|
2877
|
+
link: Pn,
|
|
2878
|
+
image: Ln,
|
|
2879
|
+
undo: Rn,
|
|
2880
|
+
redo: zn,
|
|
2881
|
+
indent: Bn,
|
|
2882
|
+
outdent: Vn,
|
|
2883
|
+
variables: Yn
|
|
2771
2884
|
};
|
|
2772
2885
|
if (this.options.forEach((t) => {
|
|
2773
2886
|
let n, r;
|
|
@@ -2781,19 +2894,19 @@ var Rn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
|
|
|
2781
2894
|
e.button && this.toolbar.appendChild(e.button);
|
|
2782
2895
|
}
|
|
2783
2896
|
}), this.options.includes("preview")) {
|
|
2784
|
-
let e = new
|
|
2897
|
+
let e = new An(this.editor);
|
|
2785
2898
|
this.editor.previewTool = e, this.toolbar.appendChild(e.button);
|
|
2786
2899
|
}
|
|
2787
2900
|
this.editor.editorContainer.insertBefore(this.toolbar, this.editor.markdownEditorDiv);
|
|
2788
2901
|
}
|
|
2789
|
-
},
|
|
2902
|
+
}, Zn = class {
|
|
2790
2903
|
constructor(e) {
|
|
2791
2904
|
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:mte-prose fj:mte-prose-sm fj:md:mte-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);
|
|
2792
2905
|
}
|
|
2793
2906
|
getPreviewContent() {
|
|
2794
2907
|
return this.previewContent;
|
|
2795
2908
|
}
|
|
2796
|
-
},
|
|
2909
|
+
}, Qn = class {
|
|
2797
2910
|
constructor(e, t = {}) {
|
|
2798
2911
|
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);
|
|
2799
2912
|
}
|
|
@@ -2831,7 +2944,7 @@ var Rn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
|
|
|
2831
2944
|
lastComponent: void 0
|
|
2832
2945
|
}], f = this.extractCommon(d[0], t, e, 0, n);
|
|
2833
2946
|
if (d[0].oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(d[0].lastComponent, t, e));
|
|
2834
|
-
let p = -Infinity, m = Infinity,
|
|
2947
|
+
let p = -Infinity, m = Infinity, h = () => {
|
|
2835
2948
|
for (let r = Math.max(p, -s); r <= Math.min(m, s); r += 2) {
|
|
2836
2949
|
let s, c = d[r - 1], l = d[r + 1];
|
|
2837
2950
|
c && (d[r - 1] = void 0);
|
|
@@ -2840,12 +2953,12 @@ var Rn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
|
|
|
2840
2953
|
let e = l.oldPos - r;
|
|
2841
2954
|
u = l && 0 <= e && e < a;
|
|
2842
2955
|
}
|
|
2843
|
-
let
|
|
2844
|
-
if (!u && !
|
|
2956
|
+
let h = c && c.oldPos + 1 < o;
|
|
2957
|
+
if (!u && !h) {
|
|
2845
2958
|
d[r] = void 0;
|
|
2846
2959
|
continue;
|
|
2847
2960
|
}
|
|
2848
|
-
if (s = !
|
|
2961
|
+
if (s = !h || u && c.oldPos < l.oldPos ? this.addToPath(l, !0, !1, 0, n) : this.addToPath(c, !1, !0, 1, n), f = this.extractCommon(s, t, e, r, n), s.oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(s.lastComponent, t, e)) || !0;
|
|
2849
2962
|
d[r] = s, s.oldPos + 1 >= o && (m = Math.min(m, r - 1)), f + 1 >= a && (p = Math.max(p, r + 1));
|
|
2850
2963
|
}
|
|
2851
2964
|
s++;
|
|
@@ -2853,11 +2966,11 @@ var Rn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
|
|
|
2853
2966
|
if (r) (function e() {
|
|
2854
2967
|
setTimeout(function() {
|
|
2855
2968
|
if (s > c || Date.now() > u) return r(void 0);
|
|
2856
|
-
|
|
2969
|
+
h() || e();
|
|
2857
2970
|
}, 0);
|
|
2858
2971
|
})();
|
|
2859
2972
|
else for (; s <= c && Date.now() <= u;) {
|
|
2860
|
-
let e =
|
|
2973
|
+
let e = h();
|
|
2861
2974
|
if (e) return e;
|
|
2862
2975
|
}
|
|
2863
2976
|
}
|
|
@@ -2940,42 +3053,42 @@ var Rn = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"
|
|
|
2940
3053
|
}
|
|
2941
3054
|
return r;
|
|
2942
3055
|
}
|
|
2943
|
-
},
|
|
2944
|
-
function
|
|
2945
|
-
return
|
|
3056
|
+
}, $n = new class extends $ {}();
|
|
3057
|
+
function er(e, t, n) {
|
|
3058
|
+
return $n.diff(e, t, n);
|
|
2946
3059
|
}
|
|
2947
3060
|
//#endregion
|
|
2948
3061
|
//#region node_modules/diff/libesm/util/string.js
|
|
2949
|
-
function
|
|
2950
|
-
let n;
|
|
2951
|
-
for (
|
|
3062
|
+
function tr(e, t) {
|
|
3063
|
+
let n = 0;
|
|
3064
|
+
for (; n < e.length && n < t.length; n++) if (e[n] != t[n]) return e.slice(0, n);
|
|
2952
3065
|
return e.slice(0, n);
|
|
2953
3066
|
}
|
|
2954
|
-
function
|
|
3067
|
+
function nr(e, t) {
|
|
2955
3068
|
let n;
|
|
2956
3069
|
if (!e || !t || e[e.length - 1] != t[t.length - 1]) return "";
|
|
2957
3070
|
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);
|
|
2958
3071
|
return e.slice(-n);
|
|
2959
3072
|
}
|
|
2960
|
-
function
|
|
3073
|
+
function rr(e, t, n) {
|
|
2961
3074
|
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`);
|
|
2962
3075
|
return n + e.slice(t.length);
|
|
2963
3076
|
}
|
|
2964
|
-
function
|
|
3077
|
+
function ir(e, t, n) {
|
|
2965
3078
|
if (!t) return e + n;
|
|
2966
3079
|
if (e.slice(-t.length) != t) throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);
|
|
2967
3080
|
return e.slice(0, -t.length) + n;
|
|
2968
3081
|
}
|
|
2969
|
-
function
|
|
2970
|
-
return
|
|
3082
|
+
function ar(e, t) {
|
|
3083
|
+
return rr(e, t, "");
|
|
2971
3084
|
}
|
|
2972
|
-
function
|
|
2973
|
-
return
|
|
3085
|
+
function or(e, t) {
|
|
3086
|
+
return ir(e, t, "");
|
|
2974
3087
|
}
|
|
2975
|
-
function
|
|
2976
|
-
return t.slice(0,
|
|
3088
|
+
function sr(e, t) {
|
|
3089
|
+
return t.slice(0, cr(e, t));
|
|
2977
3090
|
}
|
|
2978
|
-
function
|
|
3091
|
+
function cr(e, t) {
|
|
2979
3092
|
let n = 0;
|
|
2980
3093
|
e.length > t.length && (n = e.length - t.length);
|
|
2981
3094
|
let r = t.length;
|
|
@@ -2993,7 +3106,7 @@ function Qn(e, t) {
|
|
|
2993
3106
|
}
|
|
2994
3107
|
return a;
|
|
2995
3108
|
}
|
|
2996
|
-
function
|
|
3109
|
+
function lr(e, t) {
|
|
2997
3110
|
let n = [];
|
|
2998
3111
|
for (let r of Array.from(t.segment(e))) {
|
|
2999
3112
|
let e = r.segment;
|
|
@@ -3001,26 +3114,26 @@ function $n(e, t) {
|
|
|
3001
3114
|
}
|
|
3002
3115
|
return n;
|
|
3003
3116
|
}
|
|
3004
|
-
function
|
|
3005
|
-
if (t) return
|
|
3117
|
+
function ur(e, t) {
|
|
3118
|
+
if (t) return fr(e, t)[1];
|
|
3006
3119
|
let n;
|
|
3007
3120
|
for (n = e.length - 1; n >= 0 && e[n].match(/\s/); n--);
|
|
3008
3121
|
return e.substring(n + 1);
|
|
3009
3122
|
}
|
|
3010
|
-
function
|
|
3011
|
-
if (t) return
|
|
3123
|
+
function dr(e, t) {
|
|
3124
|
+
if (t) return fr(e, t)[0];
|
|
3012
3125
|
let n = e.match(/^\s*/);
|
|
3013
3126
|
return n ? n[0] : "";
|
|
3014
3127
|
}
|
|
3015
|
-
function
|
|
3016
|
-
if (!t) return [
|
|
3128
|
+
function fr(e, t) {
|
|
3129
|
+
if (!t) return [dr(e), ur(e)];
|
|
3017
3130
|
if (t.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
|
|
3018
|
-
let n =
|
|
3131
|
+
let n = lr(e, t), r = n[0], i = n[n.length - 1];
|
|
3019
3132
|
return [/\s/.test(r) ? r : "", /\s/.test(i) ? i : ""];
|
|
3020
3133
|
}
|
|
3021
3134
|
//#endregion
|
|
3022
3135
|
//#region node_modules/diff/libesm/diff/word.js
|
|
3023
|
-
var
|
|
3136
|
+
var pr = "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}", mr = RegExp(`[${pr}]+|\\s+|[^${pr}]`, "ug");
|
|
3024
3137
|
new class extends $ {
|
|
3025
3138
|
equals(e, t, n) {
|
|
3026
3139
|
return n.ignoreCase && (e = e.toLowerCase(), t = t.toLowerCase()), e.trim() === t.trim();
|
|
@@ -3030,8 +3143,8 @@ new class extends $ {
|
|
|
3030
3143
|
if (t.intlSegmenter) {
|
|
3031
3144
|
let r = t.intlSegmenter;
|
|
3032
3145
|
if (r.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
|
|
3033
|
-
n =
|
|
3034
|
-
} else n = e.match(
|
|
3146
|
+
n = lr(e, r);
|
|
3147
|
+
} else n = e.match(mr) || [];
|
|
3035
3148
|
let r = [], i = null;
|
|
3036
3149
|
return n.forEach((e) => {
|
|
3037
3150
|
/\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;
|
|
@@ -3044,57 +3157,57 @@ new class extends $ {
|
|
|
3044
3157
|
if (!e || t.oneChangePerToken) return e;
|
|
3045
3158
|
let n = null, r = null, i = null;
|
|
3046
3159
|
return e.forEach((e) => {
|
|
3047
|
-
e.added ? r = e : e.removed ? i = e : ((r || i) &&
|
|
3048
|
-
}), (r || i) &&
|
|
3160
|
+
e.added ? r = e : e.removed ? i = e : ((r || i) && hr(n, i, r, e, t.intlSegmenter), n = e, r = null, i = null);
|
|
3161
|
+
}), (r || i) && hr(n, i, r, null, t.intlSegmenter), e;
|
|
3049
3162
|
}
|
|
3050
3163
|
}();
|
|
3051
|
-
function
|
|
3164
|
+
function hr(e, t, n, r, i) {
|
|
3052
3165
|
if (t && n) {
|
|
3053
|
-
let [a, o] =
|
|
3166
|
+
let [a, o] = fr(t.value, i), [s, c] = fr(n.value, i);
|
|
3054
3167
|
if (e) {
|
|
3055
|
-
let r =
|
|
3056
|
-
e.value =
|
|
3168
|
+
let r = tr(a, s);
|
|
3169
|
+
e.value = ir(e.value, s, r), t.value = ar(t.value, r), n.value = ar(n.value, r);
|
|
3057
3170
|
}
|
|
3058
3171
|
if (r) {
|
|
3059
|
-
let e =
|
|
3060
|
-
r.value =
|
|
3172
|
+
let e = nr(o, c);
|
|
3173
|
+
r.value = rr(r.value, c, e), t.value = or(t.value, e), n.value = or(n.value, e);
|
|
3061
3174
|
}
|
|
3062
3175
|
} else if (n) {
|
|
3063
3176
|
if (e) {
|
|
3064
|
-
let e =
|
|
3177
|
+
let e = dr(n.value, i);
|
|
3065
3178
|
n.value = n.value.substring(e.length);
|
|
3066
3179
|
}
|
|
3067
3180
|
if (r) {
|
|
3068
|
-
let e =
|
|
3181
|
+
let e = dr(r.value, i);
|
|
3069
3182
|
r.value = r.value.substring(e.length);
|
|
3070
3183
|
}
|
|
3071
3184
|
} else if (e && r) {
|
|
3072
|
-
let n =
|
|
3073
|
-
t.value =
|
|
3074
|
-
let c =
|
|
3075
|
-
t.value =
|
|
3185
|
+
let n = dr(r.value, i), [a, o] = fr(t.value, i), s = tr(n, a);
|
|
3186
|
+
t.value = ar(t.value, s);
|
|
3187
|
+
let c = nr(ar(n, s), o);
|
|
3188
|
+
t.value = or(t.value, c), r.value = rr(r.value, n, c), e.value = ir(e.value, n, n.slice(0, n.length - c.length));
|
|
3076
3189
|
} else if (r) {
|
|
3077
|
-
let e =
|
|
3078
|
-
t.value =
|
|
3190
|
+
let e = dr(r.value, i), n = sr(ur(t.value, i), e);
|
|
3191
|
+
t.value = or(t.value, n);
|
|
3079
3192
|
} else if (e) {
|
|
3080
|
-
let n =
|
|
3081
|
-
t.value =
|
|
3193
|
+
let n = sr(ur(e.value, i), dr(t.value, i));
|
|
3194
|
+
t.value = ar(t.value, n);
|
|
3082
3195
|
}
|
|
3083
3196
|
}
|
|
3084
3197
|
new class extends $ {
|
|
3085
3198
|
tokenize(e) {
|
|
3086
|
-
let t = RegExp(`(\\r?\\n)|[${
|
|
3199
|
+
let t = RegExp(`(\\r?\\n)|[${pr}]+|[^\\S\\n\\r]+|[^${pr}]`, "ug");
|
|
3087
3200
|
return e.match(t) || [];
|
|
3088
3201
|
}
|
|
3089
3202
|
}(), new class extends $ {
|
|
3090
3203
|
constructor() {
|
|
3091
|
-
super(...arguments), this.tokenize =
|
|
3204
|
+
super(...arguments), this.tokenize = gr;
|
|
3092
3205
|
}
|
|
3093
3206
|
equals(e, t, n) {
|
|
3094
3207
|
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);
|
|
3095
3208
|
}
|
|
3096
3209
|
}();
|
|
3097
|
-
function
|
|
3210
|
+
function gr(e, t) {
|
|
3098
3211
|
t.stripTrailingCr && (e = e.replace(/\r\n/g, "\n"));
|
|
3099
3212
|
let n = [], r = e.split(/(\n|\r\n)/);
|
|
3100
3213
|
r[r.length - 1] || r.pop();
|
|
@@ -3106,7 +3219,7 @@ function or(e, t) {
|
|
|
3106
3219
|
}
|
|
3107
3220
|
//#endregion
|
|
3108
3221
|
//#region node_modules/diff/libesm/diff/sentence.js
|
|
3109
|
-
function
|
|
3222
|
+
function _r(e) {
|
|
3110
3223
|
return e == "." || e == "!" || e == "?";
|
|
3111
3224
|
}
|
|
3112
3225
|
new class extends $ {
|
|
@@ -3117,7 +3230,7 @@ new class extends $ {
|
|
|
3117
3230
|
t.push(e.slice(n));
|
|
3118
3231
|
break;
|
|
3119
3232
|
}
|
|
3120
|
-
if (
|
|
3233
|
+
if (_r(e[r]) && e[r + 1].match(/\s/)) {
|
|
3121
3234
|
for (t.push(e.slice(n, r + 1)), r = n = r + 1; e[r + 1]?.match(/\s/);) r++;
|
|
3122
3235
|
t.push(e.slice(n, r + 1)), n = r + 1;
|
|
3123
3236
|
}
|
|
@@ -3130,26 +3243,26 @@ new class extends $ {
|
|
|
3130
3243
|
}
|
|
3131
3244
|
}(), new class extends $ {
|
|
3132
3245
|
constructor() {
|
|
3133
|
-
super(...arguments), this.tokenize =
|
|
3246
|
+
super(...arguments), this.tokenize = gr;
|
|
3134
3247
|
}
|
|
3135
3248
|
get useLongestToken() {
|
|
3136
3249
|
return !0;
|
|
3137
3250
|
}
|
|
3138
3251
|
castInput(e, t) {
|
|
3139
3252
|
let { undefinedReplacement: n, stringifyReplacer: r = (e, t) => t === void 0 ? n : t } = t;
|
|
3140
|
-
return typeof e == "string" ? e : JSON.stringify(
|
|
3253
|
+
return typeof e == "string" ? e : JSON.stringify(vr(e, null, null, r), null, " ");
|
|
3141
3254
|
}
|
|
3142
3255
|
equals(e, t, n) {
|
|
3143
3256
|
return super.equals(e.replace(/,([\r\n])/g, "$1"), t.replace(/,([\r\n])/g, "$1"), n);
|
|
3144
3257
|
}
|
|
3145
3258
|
}();
|
|
3146
|
-
function
|
|
3259
|
+
function vr(e, t, n, r, i) {
|
|
3147
3260
|
t ||= [], n ||= [], r && (e = r(i === void 0 ? "" : i, e));
|
|
3148
|
-
let a;
|
|
3149
|
-
for (
|
|
3261
|
+
let a = 0;
|
|
3262
|
+
for (; a < t.length; a += 1) if (t[a] === e) return n[a];
|
|
3150
3263
|
let o;
|
|
3151
3264
|
if (Object.prototype.toString.call(e) === "[object Array]") {
|
|
3152
|
-
for (t.push(e), o = Array(e.length), n.push(o), a = 0; a < e.length; a += 1) o[a] =
|
|
3265
|
+
for (t.push(e), o = Array(e.length), n.push(o), a = 0; a < e.length; a += 1) o[a] = vr(e[a], t, n, r, String(a));
|
|
3153
3266
|
return t.pop(), n.pop(), o;
|
|
3154
3267
|
}
|
|
3155
3268
|
if (e && e.toJSON && (e = e.toJSON()), typeof e == "object" && e) {
|
|
@@ -3158,7 +3271,7 @@ function cr(e, t, n, r, i) {
|
|
|
3158
3271
|
for (s in e)
|
|
3159
3272
|
/* istanbul ignore else */
|
|
3160
3273
|
Object.prototype.hasOwnProperty.call(e, s) && i.push(s);
|
|
3161
|
-
for (i.sort(), a = 0; a < i.length; a += 1) s = i[a], o[s] =
|
|
3274
|
+
for (i.sort(), a = 0; a < i.length; a += 1) s = i[a], o[s] = vr(e[s], t, n, r, s);
|
|
3162
3275
|
t.pop(), n.pop();
|
|
3163
3276
|
} else o = e;
|
|
3164
3277
|
return o;
|
|
@@ -3176,7 +3289,7 @@ new class extends $ {
|
|
|
3176
3289
|
}();
|
|
3177
3290
|
//#endregion
|
|
3178
3291
|
//#region src/utils/UndoRedoManager.js
|
|
3179
|
-
var
|
|
3292
|
+
var yr = class {
|
|
3180
3293
|
constructor(e) {
|
|
3181
3294
|
this.editor = e, this.textarea = e.usertextarea, this.undoStack = [], this.redoStack = [], this.lastValue = this.textarea.value, this.lastSelection = {
|
|
3182
3295
|
selectionStart: this.textarea.selectionStart,
|
|
@@ -3210,7 +3323,7 @@ var lr = class {
|
|
|
3210
3323
|
let e = this.textarea.value || "";
|
|
3211
3324
|
if (e === this.lastValue) return;
|
|
3212
3325
|
clearTimeout(this._debounceTimer);
|
|
3213
|
-
let t =
|
|
3326
|
+
let t = er(this.lastValue, e);
|
|
3214
3327
|
this.undoStack.push({
|
|
3215
3328
|
diff: t,
|
|
3216
3329
|
selection: { ...this.lastSelection }
|
|
@@ -3250,7 +3363,7 @@ var lr = class {
|
|
|
3250
3363
|
_restoreState(e, t) {
|
|
3251
3364
|
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();
|
|
3252
3365
|
}
|
|
3253
|
-
},
|
|
3366
|
+
}, br = class {
|
|
3254
3367
|
constructor(e, t) {
|
|
3255
3368
|
this.editor = e, this.textarea = e.usertextarea, this.renderCallback = t, this.pairs = {
|
|
3256
3369
|
"{": "}",
|
|
@@ -3343,7 +3456,7 @@ var lr = class {
|
|
|
3343
3456
|
_applyChange(e, t, n) {
|
|
3344
3457
|
this.textarea.value = e, this.textarea.setSelectionRange(t, n);
|
|
3345
3458
|
}
|
|
3346
|
-
},
|
|
3459
|
+
}, xr = class {
|
|
3347
3460
|
constructor(e) {
|
|
3348
3461
|
this.editor = e, this.textarea = e.usertextarea, this._keydownHandler = (e) => {
|
|
3349
3462
|
e.key === "Enter" && this.handleEnter(e);
|
|
@@ -3369,12 +3482,12 @@ var lr = class {
|
|
|
3369
3482
|
this.textarea.setSelectionRange(o, o), this.editor.render(), this.editor.notifyChange();
|
|
3370
3483
|
}
|
|
3371
3484
|
}
|
|
3372
|
-
},
|
|
3485
|
+
}, Sr = [
|
|
3373
3486
|
{
|
|
3374
3487
|
key: "b",
|
|
3375
3488
|
ctrl: !0,
|
|
3376
3489
|
shift: !1,
|
|
3377
|
-
ToolClass:
|
|
3490
|
+
ToolClass: Tn,
|
|
3378
3491
|
label: "Ctrl+B",
|
|
3379
3492
|
btnClass: "bold-btn"
|
|
3380
3493
|
},
|
|
@@ -3382,7 +3495,7 @@ var lr = class {
|
|
|
3382
3495
|
key: "i",
|
|
3383
3496
|
ctrl: !0,
|
|
3384
3497
|
shift: !1,
|
|
3385
|
-
ToolClass:
|
|
3498
|
+
ToolClass: En,
|
|
3386
3499
|
label: "Ctrl+I",
|
|
3387
3500
|
btnClass: "italic-btn"
|
|
3388
3501
|
},
|
|
@@ -3390,7 +3503,7 @@ var lr = class {
|
|
|
3390
3503
|
key: "k",
|
|
3391
3504
|
ctrl: !0,
|
|
3392
3505
|
shift: !1,
|
|
3393
|
-
ToolClass:
|
|
3506
|
+
ToolClass: Pn,
|
|
3394
3507
|
label: "Ctrl+K",
|
|
3395
3508
|
btnClass: "link-btn"
|
|
3396
3509
|
},
|
|
@@ -3398,7 +3511,7 @@ var lr = class {
|
|
|
3398
3511
|
key: "`",
|
|
3399
3512
|
ctrl: !0,
|
|
3400
3513
|
shift: !1,
|
|
3401
|
-
ToolClass:
|
|
3514
|
+
ToolClass: Hn,
|
|
3402
3515
|
label: "Ctrl+`",
|
|
3403
3516
|
btnClass: "code-btn"
|
|
3404
3517
|
},
|
|
@@ -3406,7 +3519,7 @@ var lr = class {
|
|
|
3406
3519
|
key: "s",
|
|
3407
3520
|
ctrl: !0,
|
|
3408
3521
|
shift: !0,
|
|
3409
|
-
ToolClass:
|
|
3522
|
+
ToolClass: Dn,
|
|
3410
3523
|
label: "Ctrl+Shift+S",
|
|
3411
3524
|
btnClass: "strikethrough-btn"
|
|
3412
3525
|
},
|
|
@@ -3414,11 +3527,11 @@ var lr = class {
|
|
|
3414
3527
|
key: "l",
|
|
3415
3528
|
ctrl: !0,
|
|
3416
3529
|
shift: !1,
|
|
3417
|
-
ToolClass:
|
|
3530
|
+
ToolClass: On,
|
|
3418
3531
|
label: "Ctrl+L",
|
|
3419
3532
|
btnClass: "ul-btn"
|
|
3420
3533
|
}
|
|
3421
|
-
],
|
|
3534
|
+
], Cr = class {
|
|
3422
3535
|
constructor(e) {
|
|
3423
3536
|
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();
|
|
3424
3537
|
}
|
|
@@ -3433,10 +3546,10 @@ var lr = class {
|
|
|
3433
3546
|
"2",
|
|
3434
3547
|
"3"
|
|
3435
3548
|
].includes(e.key)) {
|
|
3436
|
-
e.preventDefault(), new
|
|
3549
|
+
e.preventDefault(), new Fn(this.editor).applyHeading(parseInt(e.key));
|
|
3437
3550
|
return;
|
|
3438
3551
|
}
|
|
3439
|
-
for (let i of
|
|
3552
|
+
for (let i of Sr) if (r === i.key && t === i.ctrl && n === i.shift) {
|
|
3440
3553
|
e.preventDefault(), new i.ToolClass(this.editor).applySyntax(e);
|
|
3441
3554
|
return;
|
|
3442
3555
|
}
|
|
@@ -3448,7 +3561,7 @@ var lr = class {
|
|
|
3448
3561
|
}
|
|
3449
3562
|
}
|
|
3450
3563
|
_updateTooltips() {
|
|
3451
|
-
for (let { btnClass: e, label: t } of
|
|
3564
|
+
for (let { btnClass: e, label: t } of Sr) {
|
|
3452
3565
|
let n = this.editor.editorContainer.querySelector(`.${e}`);
|
|
3453
3566
|
n && (n.title += ` (${t})`);
|
|
3454
3567
|
}
|
|
@@ -3460,7 +3573,7 @@ var lr = class {
|
|
|
3460
3573
|
destroy() {
|
|
3461
3574
|
this.editor.usertextarea.removeEventListener("keydown", this._handler), document.removeEventListener("keydown", this._docHandler);
|
|
3462
3575
|
}
|
|
3463
|
-
},
|
|
3576
|
+
}, wr = class {
|
|
3464
3577
|
constructor(e) {
|
|
3465
3578
|
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);
|
|
3466
3579
|
}
|
|
@@ -3612,9 +3725,79 @@ var lr = class {
|
|
|
3612
3725
|
destroy() {
|
|
3613
3726
|
this.editor.usertextarea.removeEventListener("keydown", this._taHandler), this._scrollHandler && this.editor.usertextarea.removeEventListener("scroll", this._scrollHandler), this._clearMatchHighlight(), this._panel?.remove();
|
|
3614
3727
|
}
|
|
3615
|
-
},
|
|
3728
|
+
}, Tr = /^https?:\/\/\S+$/i, Er = class {
|
|
3729
|
+
constructor(e) {
|
|
3730
|
+
this.editor = e, this.textarea = e.usertextarea, this._pasteHandler = (e) => this._onPaste(e), this._dropHandler = (e) => this._onDrop(e), this._dragOverHandler = (e) => {
|
|
3731
|
+
this._carriesFiles(e.dataTransfer) && e.preventDefault();
|
|
3732
|
+
}, this.textarea.addEventListener("paste", this._pasteHandler), this.textarea.addEventListener("drop", this._dropHandler), this.textarea.addEventListener("dragover", this._dragOverHandler);
|
|
3733
|
+
}
|
|
3734
|
+
destroy() {
|
|
3735
|
+
this.textarea.removeEventListener("paste", this._pasteHandler), this.textarea.removeEventListener("drop", this._dropHandler), this.textarea.removeEventListener("dragover", this._dragOverHandler);
|
|
3736
|
+
}
|
|
3737
|
+
_carriesFiles(e) {
|
|
3738
|
+
return Array.from(e?.types ?? []).includes("Files");
|
|
3739
|
+
}
|
|
3740
|
+
_imageFiles(e) {
|
|
3741
|
+
return Array.from(e?.files ?? []).filter((e) => e.type?.startsWith("image/"));
|
|
3742
|
+
}
|
|
3743
|
+
_onPaste(e) {
|
|
3744
|
+
let t = this._imageFiles(e.clipboardData);
|
|
3745
|
+
if (t.length) {
|
|
3746
|
+
if (!this.editor.imageUpload) {
|
|
3747
|
+
console.warn("[MarkdownEditor] An image was pasted but no upload endpoint is configured. Add { image: { fileInput: { uploadUrl: \"...\" } } } to the toolbar to enable it.");
|
|
3748
|
+
return;
|
|
3749
|
+
}
|
|
3750
|
+
e.preventDefault(), this._uploadAll(t);
|
|
3751
|
+
return;
|
|
3752
|
+
}
|
|
3753
|
+
let n = e.clipboardData?.getData("text/plain")?.trim(), { selectionStart: r, selectionEnd: i } = this.textarea;
|
|
3754
|
+
if (n && i > r && Tr.test(n)) {
|
|
3755
|
+
e.preventDefault();
|
|
3756
|
+
let t = `[${this.textarea.value.slice(r, i)}](${n})`;
|
|
3757
|
+
this.editor.insertText(t, t.length, 0);
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
_onDrop(e) {
|
|
3761
|
+
if (!this._carriesFiles(e.dataTransfer)) return;
|
|
3762
|
+
e.preventDefault();
|
|
3763
|
+
let t = this._imageFiles(e.dataTransfer);
|
|
3764
|
+
if (t.length) {
|
|
3765
|
+
if (!this.editor.imageUpload) {
|
|
3766
|
+
console.warn("[MarkdownEditor] An image was dropped but no upload endpoint is configured. Add { image: { fileInput: { uploadUrl: \"...\" } } } to the toolbar to enable it.");
|
|
3767
|
+
return;
|
|
3768
|
+
}
|
|
3769
|
+
this._uploadAll(t);
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
async _uploadAll(e) {
|
|
3773
|
+
for (let t of e) {
|
|
3774
|
+
let e = `![${this.editor.label("Uploading...")}]()`;
|
|
3775
|
+
this.editor.insertText(e, e.length, 0);
|
|
3776
|
+
try {
|
|
3777
|
+
let { path: n, alt: r } = await In(t, this.editor.imageUpload);
|
|
3778
|
+
this._replace(e, ``);
|
|
3779
|
+
} catch (t) {
|
|
3780
|
+
this._replace(e, `![${this.editor.label("Upload failed")}]()`), console.error("[MarkdownEditor] Image upload failed.", t);
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
_replace(e, t) {
|
|
3785
|
+
let n = this.textarea, r = n.value.indexOf(e);
|
|
3786
|
+
if (r === -1) return;
|
|
3787
|
+
n.value = n.value.slice(0, r) + t + n.value.slice(r + e.length);
|
|
3788
|
+
let i = r + t.length;
|
|
3789
|
+
n.setSelectionRange(i, i), this.editor.render(), this.editor.notifyChange();
|
|
3790
|
+
}
|
|
3791
|
+
}, Dr = new ot({ breaks: !0 }), Or = class {
|
|
3616
3792
|
constructor(e, t = {}) {
|
|
3617
|
-
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.variables = this._parseVariables(t.toolbar), this.previewTimer = null, this.init(), this.undoRedoManager = new
|
|
3793
|
+
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.variables = this._parseVariables(t.toolbar), this.imageUpload = this._parseImageUpload(t.toolbar), this.previewTimer = null, this.init(), this.undoRedoManager = new yr(this), this.listManager = new xr(this), this.indentManager = new br(this), this.shortcutManager = new Cr(this), this.findReplace = new wr(this), this.pasteManager = new Er(this);
|
|
3794
|
+
}
|
|
3795
|
+
label(e) {
|
|
3796
|
+
return this.options.labels?.[e] ?? e;
|
|
3797
|
+
}
|
|
3798
|
+
_parseImageUpload(e) {
|
|
3799
|
+
let t = (Array.isArray(e) ? e : []).find((e) => e && typeof e == "object" && e.image)?.image?.fileInput;
|
|
3800
|
+
return t?.uploadUrl ? t : null;
|
|
3618
3801
|
}
|
|
3619
3802
|
_parseVariables(e) {
|
|
3620
3803
|
let t = (Array.isArray(e) ? e : []).find((e) => e && typeof e == "object" && Array.isArray(e.variables));
|
|
@@ -3652,7 +3835,7 @@ var lr = class {
|
|
|
3652
3835
|
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);
|
|
3653
3836
|
}
|
|
3654
3837
|
addPreviewWrapper() {
|
|
3655
|
-
let e = new
|
|
3838
|
+
let e = new Zn(this.markdownEditorDiv);
|
|
3656
3839
|
this.previewContent = e.getPreviewContent();
|
|
3657
3840
|
}
|
|
3658
3841
|
addInputListener() {
|
|
@@ -3675,7 +3858,7 @@ var lr = class {
|
|
|
3675
3858
|
}, 150));
|
|
3676
3859
|
}
|
|
3677
3860
|
_renderMarkdown(e) {
|
|
3678
|
-
let t = this.options.renderer ?? ((e) =>
|
|
3861
|
+
let t = this.options.renderer ?? ((e) => Dr.parse(e)), n = this.options.sanitizer ?? ((e) => wn.sanitize(e)), r = qn(e, this.variables), i = t(r);
|
|
3679
3862
|
return this.options.renderer && !this._taskListWarned && /^\s*[-*] \[[ xX]\] /m.test(r) && !/type=["']?checkbox/.test(i) && (this._taskListWarned = !0, console.warn("[MarkdownEditor] Task list syntax found, but the custom renderer emitted no checkboxes. Clickable checkboxes in the preview need a task-list plugin, e.g. markdown-it-task-lists.")), n(i);
|
|
3680
3863
|
}
|
|
3681
3864
|
wirePreviewCheckboxes() {
|
|
@@ -3697,10 +3880,10 @@ var lr = class {
|
|
|
3697
3880
|
addFooter() {
|
|
3698
3881
|
if (!this.footerOptions) return;
|
|
3699
3882
|
let { line: e, col: t, chars: n, words: r } = this.footerOptions;
|
|
3700
|
-
|
|
3883
|
+
(e || t || n || r) && (this.footer = new Qn(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));
|
|
3701
3884
|
}
|
|
3702
3885
|
addToolbar() {
|
|
3703
|
-
new
|
|
3886
|
+
new Xn(this, this.options.toolbar || [
|
|
3704
3887
|
"undo",
|
|
3705
3888
|
"redo",
|
|
3706
3889
|
"heading",
|
|
@@ -3765,7 +3948,7 @@ var lr = class {
|
|
|
3765
3948
|
this._autoGrow(), this.renderHybrid(), this.preview && (this.previewContent.innerHTML = this._renderMarkdown(this.usertextarea.value), this.wirePreviewCheckboxes());
|
|
3766
3949
|
}
|
|
3767
3950
|
destroy() {
|
|
3768
|
-
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);
|
|
3951
|
+
this.shortcutManager?.destroy(), this.findReplace?.destroy(), this.previewTool?.destroy(), this.undoRedoManager?.destroy(), this.listManager?.destroy(), this.pasteManager?.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);
|
|
3769
3952
|
let e = this.editorContainer.parentNode;
|
|
3770
3953
|
e && ([
|
|
3771
3954
|
"editor-textarea",
|
|
@@ -3794,6 +3977,6 @@ var lr = class {
|
|
|
3794
3977
|
}
|
|
3795
3978
|
};
|
|
3796
3979
|
//#endregion
|
|
3797
|
-
export {
|
|
3980
|
+
export { Or as default };
|
|
3798
3981
|
|
|
3799
3982
|
//# sourceMappingURL=markdown-text-editor.es.js.map
|