@vizel/core 0.0.1-alpha.2 → 0.0.1-alpha.3

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