@ant-design/x-markdown-mini 0.1.0-beta.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.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +216 -0
  3. package/dist/components/Markdown/index.acss +103 -0
  4. package/dist/components/Markdown/index.axml +12 -0
  5. package/dist/components/Markdown/index.js +93 -0
  6. package/dist/components/Markdown/index.json +7 -0
  7. package/dist/components/MiniNodeRenderer/index.acss +11 -0
  8. package/dist/components/MiniNodeRenderer/index.axml +113 -0
  9. package/dist/components/MiniNodeRenderer/index.js +37 -0
  10. package/dist/components/MiniNodeRenderer/index.json +7 -0
  11. package/dist/components/MiniNodeRenderer/index.sjs +63 -0
  12. package/dist/es/Markdown/index.acss +103 -0
  13. package/dist/es/Markdown/index.axml +12 -0
  14. package/dist/es/Markdown/index.js +93 -0
  15. package/dist/es/Markdown/index.json +7 -0
  16. package/dist/es/MiniNodeRenderer/index.acss +11 -0
  17. package/dist/es/MiniNodeRenderer/index.axml +113 -0
  18. package/dist/es/MiniNodeRenderer/index.js +37 -0
  19. package/dist/es/MiniNodeRenderer/index.json +7 -0
  20. package/dist/es/MiniNodeRenderer/index.sjs +63 -0
  21. package/dist/index.d.mts +508 -0
  22. package/dist/index.d.ts +508 -0
  23. package/dist/index.js +3151 -0
  24. package/dist/index.mjs +3111 -0
  25. package/dist/miniprogram_dist/components/Markdown/index.js +85 -0
  26. package/dist/miniprogram_dist/components/Markdown/index.json +10 -0
  27. package/dist/miniprogram_dist/components/Markdown/index.wxml +11 -0
  28. package/dist/miniprogram_dist/components/Markdown/index.wxss +103 -0
  29. package/dist/miniprogram_dist/components/MiniNodeRenderer/index.js +39 -0
  30. package/dist/miniprogram_dist/components/MiniNodeRenderer/index.json +10 -0
  31. package/dist/miniprogram_dist/components/MiniNodeRenderer/index.wxml +112 -0
  32. package/dist/miniprogram_dist/components/MiniNodeRenderer/index.wxs +40 -0
  33. package/dist/miniprogram_dist/components/MiniNodeRenderer/index.wxss +11 -0
  34. package/dist/miniprogram_dist/es/Markdown/index.js +85 -0
  35. package/dist/miniprogram_dist/es/Markdown/index.json +10 -0
  36. package/dist/miniprogram_dist/es/Markdown/index.wxml +11 -0
  37. package/dist/miniprogram_dist/es/Markdown/index.wxss +103 -0
  38. package/dist/miniprogram_dist/es/MiniNodeRenderer/index.js +39 -0
  39. package/dist/miniprogram_dist/es/MiniNodeRenderer/index.json +10 -0
  40. package/dist/miniprogram_dist/es/MiniNodeRenderer/index.wxml +112 -0
  41. package/dist/miniprogram_dist/es/MiniNodeRenderer/index.wxs +40 -0
  42. package/dist/miniprogram_dist/es/MiniNodeRenderer/index.wxss +11 -0
  43. package/dist/miniprogram_dist/index.js +3151 -0
  44. package/dist/miniprogram_dist/plugins/CodeHighlight/index.js +8038 -0
  45. package/dist/miniprogram_dist/plugins/CodeHighlight/style.wxss +105 -0
  46. package/dist/miniprogram_dist/plugins/Latex/index.js +14728 -0
  47. package/dist/miniprogram_dist/plugins/Latex/style.wxss +648 -0
  48. package/dist/miniprogram_dist/shared/flattenInline.js +100 -0
  49. package/dist/plugins/CodeHighlight/index.d.mts +27 -0
  50. package/dist/plugins/CodeHighlight/index.d.ts +27 -0
  51. package/dist/plugins/CodeHighlight/index.js +8038 -0
  52. package/dist/plugins/CodeHighlight/index.mjs +8028 -0
  53. package/dist/plugins/CodeHighlight/style.acss +105 -0
  54. package/dist/plugins/Latex/index.d.mts +12 -0
  55. package/dist/plugins/Latex/index.d.ts +12 -0
  56. package/dist/plugins/Latex/index.js +14728 -0
  57. package/dist/plugins/Latex/index.mjs +14705 -0
  58. package/dist/plugins/Latex/style.acss +648 -0
  59. package/dist/shared/flattenInline.js +100 -0
  60. package/dist/types-CegkonfJ.d.mts +83 -0
  61. package/dist/types-CegkonfJ.d.ts +83 -0
  62. package/package.json +93 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,3111 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ // node_modules/marked/lib/marked.esm.js
6
+ function z() {
7
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
8
+ }
9
+ var T = z();
10
+ function G(l3) {
11
+ T = l3;
12
+ }
13
+ var _ = { exec: () => null };
14
+ function d(l3, e = "") {
15
+ let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (s, r) => {
16
+ let i = typeof r == "string" ? r : r.source;
17
+ return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n;
18
+ }, getRegex: () => new RegExp(t, e) };
19
+ return n;
20
+ }
21
+ var Re = ((l3 = "") => {
22
+ try {
23
+ return !!new RegExp("(?<=1)(?<!1)" + l3);
24
+ } catch (e) {
25
+ return false;
26
+ }
27
+ })();
28
+ var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}#`), htmlBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}>`) };
29
+ var Te = /^(?:[ \t]*(?:\n|$))+/;
30
+ var Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
31
+ var we = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
32
+ var I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
33
+ var ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
34
+ var Q = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
35
+ var ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
36
+ var oe = d(ie).replace(/bull/g, Q).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();
37
+ var Pe = d(ie).replace(/bull/g, Q).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();
38
+ var j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
39
+ var Se = /^[^\n]+/;
40
+ var F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
41
+ var $e = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
42
+ var Le = d(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex();
43
+ var v = "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";
44
+ var U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
45
+ var _e = d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
46
+ var ae = d(j).replace("hr", I).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[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex();
47
+ var Me = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex();
48
+ var K = { blockquote: Me, code: Oe, def: $e, fences: we, heading: ye, hr: I, html: _e, lheading: oe, list: Le, newline: Te, paragraph: ae, table: _, text: Se };
49
+ var re = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex();
50
+ var ze = { ...K, lheading: Pe, table: re, paragraph: d(j).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() };
51
+ var Ee = { ...K, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(j).replace("hr", I).replace("heading", ` *#{1,6} *[^
52
+ ]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
53
+ var Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
54
+ var Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
55
+ var le = /^( {2,}|\\)\n(?!\s*$)/;
56
+ var Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
57
+ var E = /[\p{P}\p{S}]/u;
58
+ var H = /[\s\p{P}\p{S}]/u;
59
+ var W = /[^\s\p{P}\p{S}]/u;
60
+ var Be = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, H).getRegex();
61
+ var ue = /(?!~)[\p{P}\p{S}]/u;
62
+ var De = /(?!~)[\s\p{P}\p{S}]/u;
63
+ var qe = /(?:[^\s\p{P}\p{S}]|~)/u;
64
+ var ve = d(/link|precode-code|html/, "g").replace("link", new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-", Re ? "(?<!`)()" : "(^^|[^`])").replace("code", new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html", /<(?! )[^<>]*?>/).getRegex();
65
+ var pe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
66
+ var He = d(pe, "u").replace(/punct/g, E).getRegex();
67
+ var Ze = d(pe, "u").replace(/punct/g, ue).getRegex();
68
+ var ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
69
+ var Ge = d(ce, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, E).getRegex();
70
+ var Ne = d(ce, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, De).replace(/punct/g, ue).getRegex();
71
+ var Qe = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, E).getRegex();
72
+ var je = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, E).getRegex();
73
+ var Fe = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
74
+ var Ue = d(Fe, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, E).getRegex();
75
+ var Ke = d(/\\(punct)/, "gu").replace(/punct/g, E).getRegex();
76
+ var We = d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
77
+ var Xe = d(U).replace("(?:-->|$)", "-->").getRegex();
78
+ var Je = d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Xe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
79
+ var q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/;
80
+ var Ve = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
81
+ var he = d(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex();
82
+ var ke = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex();
83
+ var Ye = d("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex();
84
+ var se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
85
+ var X = { _backpedal: _, anyPunctuation: Ke, autolink: We, blockSkip: ve, br: le, code: Ce, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: He, emStrongRDelimAst: Ge, emStrongRDelimUnd: Qe, escape: Ae, link: Ve, nolink: ke, punctuation: Be, reflink: he, reflinkSearch: Ye, tag: Je, text: Ie, url: _ };
86
+ var et = { ...X, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() };
87
+ var N = { ...X, emStrongRDelimAst: Ne, emStrongLDelim: Ze, delLDelim: je, delRDelim: Ue, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", se).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", se).getRegex() };
88
+ var tt = { ...N, br: d(le).replace("{2,}", "*").getRegex(), text: d(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
89
+ var B = { normal: K, gfm: ze, pedantic: Ee };
90
+ var A = { normal: X, gfm: N, breaks: tt, pedantic: et };
91
+ var nt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
92
+ var de = (l3) => nt[l3];
93
+ function O(l3, e) {
94
+ if (e) {
95
+ if (m.escapeTest.test(l3)) return l3.replace(m.escapeReplace, de);
96
+ } else if (m.escapeTestNoEncode.test(l3)) return l3.replace(m.escapeReplaceNoEncode, de);
97
+ return l3;
98
+ }
99
+ function J(l3) {
100
+ try {
101
+ l3 = encodeURI(l3).replace(m.percentDecode, "%");
102
+ } catch (e) {
103
+ return null;
104
+ }
105
+ return l3;
106
+ }
107
+ function V(l3, e) {
108
+ var _a2;
109
+ let t = l3.replace(m.findPipe, (r, i, o) => {
110
+ let u2 = false, a = i;
111
+ for (; --a >= 0 && o[a] === "\\"; ) u2 = !u2;
112
+ return u2 ? "|" : " |";
113
+ }), n = t.split(m.splitPipe), s = 0;
114
+ if (n[0].trim() || n.shift(), n.length > 0 && !((_a2 = n.at(-1)) == null ? void 0 : _a2.trim()) && n.pop(), e) if (n.length > e) n.splice(e);
115
+ else for (; n.length < e; ) n.push("");
116
+ for (; s < n.length; s++) n[s] = n[s].trim().replace(m.slashPipe, "|");
117
+ return n;
118
+ }
119
+ function $(l3, e, t) {
120
+ let n = l3.length;
121
+ if (n === 0) return "";
122
+ let s = 0;
123
+ for (; s < n; ) {
124
+ let r = l3.charAt(n - s - 1);
125
+ if (r === e && !t) s++;
126
+ else if (r !== e && t) s++;
127
+ else break;
128
+ }
129
+ return l3.slice(0, n - s);
130
+ }
131
+ function Y(l3) {
132
+ let e = l3.split(`
133
+ `), t = e.length - 1;
134
+ for (; t >= 0 && m.blankLine.test(e[t]); ) t--;
135
+ return e.length - t <= 2 ? l3 : e.slice(0, t + 1).join(`
136
+ `);
137
+ }
138
+ function ge(l3, e) {
139
+ if (l3.indexOf(e[1]) === -1) return -1;
140
+ let t = 0;
141
+ for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
142
+ else if (l3[n] === e[0]) t++;
143
+ else if (l3[n] === e[1] && (t--, t < 0)) return n;
144
+ return t > 0 ? -2 : -1;
145
+ }
146
+ function fe(l3, e = 0) {
147
+ let t = e, n = "";
148
+ for (let s of l3) if (s === " ") {
149
+ let r = 4 - t % 4;
150
+ n += " ".repeat(r), t += r;
151
+ } else n += s, t++;
152
+ return n;
153
+ }
154
+ function me(l3, e, t, n, s) {
155
+ let r = e.href, i = e.title || null, o = l3[1].replace(s.other.outputLinkReplace, "$1");
156
+ n.state.inLink = true;
157
+ let u2 = { type: l3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: r, title: i, text: o, tokens: n.inlineTokens(o) };
158
+ return n.state.inLink = false, u2;
159
+ }
160
+ function rt(l3, e, t) {
161
+ let n = l3.match(t.other.indentCodeCompensation);
162
+ if (n === null) return e;
163
+ let s = n[1];
164
+ return e.split(`
165
+ `).map((r) => {
166
+ let i = r.match(t.other.beginningSpace);
167
+ if (i === null) return r;
168
+ let [o] = i;
169
+ return o.length >= s.length ? r.slice(s.length) : r;
170
+ }).join(`
171
+ `);
172
+ }
173
+ var w = class {
174
+ constructor(e) {
175
+ __publicField(this, "options");
176
+ __publicField(this, "rules");
177
+ __publicField(this, "lexer");
178
+ this.options = e || T;
179
+ }
180
+ space(e) {
181
+ let t = this.rules.block.newline.exec(e);
182
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
183
+ }
184
+ code(e) {
185
+ let t = this.rules.block.code.exec(e);
186
+ if (t) {
187
+ let n = this.options.pedantic ? t[0] : Y(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
188
+ return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
189
+ }
190
+ }
191
+ fences(e) {
192
+ let t = this.rules.block.fences.exec(e);
193
+ if (t) {
194
+ let n = t[0], s = rt(n, t[3] || "", this.rules);
195
+ return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
196
+ }
197
+ }
198
+ heading(e) {
199
+ let t = this.rules.block.heading.exec(e);
200
+ if (t) {
201
+ let n = t[2].trim();
202
+ if (this.rules.other.endingHash.test(n)) {
203
+ let s = $(n, "#");
204
+ (this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
205
+ }
206
+ return { type: "heading", raw: $(t[0], `
207
+ `), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
208
+ }
209
+ }
210
+ hr(e) {
211
+ let t = this.rules.block.hr.exec(e);
212
+ if (t) return { type: "hr", raw: $(t[0], `
213
+ `) };
214
+ }
215
+ blockquote(e) {
216
+ let t = this.rules.block.blockquote.exec(e);
217
+ if (t) {
218
+ let n = $(t[0], `
219
+ `).split(`
220
+ `), s = "", r = "", i = [];
221
+ for (; n.length > 0; ) {
222
+ let o = false, u2 = [], a;
223
+ for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) u2.push(n[a]), o = true;
224
+ else if (!o) u2.push(n[a]);
225
+ else break;
226
+ n = n.slice(a);
227
+ let c2 = u2.join(`
228
+ `), p2 = c2.replace(this.rules.other.blockquoteSetextReplace, `
229
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
230
+ s = s ? `${s}
231
+ ${c2}` : c2, r = r ? `${r}
232
+ ${p2}` : p2;
233
+ let k2 = this.lexer.state.top;
234
+ if (this.lexer.state.top = true, this.lexer.blockTokens(p2, i, true), this.lexer.state.top = k2, n.length === 0) break;
235
+ let h2 = i.at(-1);
236
+ if ((h2 == null ? void 0 : h2.type) === "code") break;
237
+ if ((h2 == null ? void 0 : h2.type) === "blockquote") {
238
+ let R2 = h2, f2 = R2.raw + `
239
+ ` + n.join(`
240
+ `), S2 = this.blockquote(f2);
241
+ i[i.length - 1] = S2, s = s.substring(0, s.length - R2.raw.length) + S2.raw, r = r.substring(0, r.length - R2.text.length) + S2.text;
242
+ break;
243
+ } else if ((h2 == null ? void 0 : h2.type) === "list") {
244
+ let R2 = h2, f2 = R2.raw + `
245
+ ` + n.join(`
246
+ `), S2 = this.list(f2);
247
+ i[i.length - 1] = S2, s = s.substring(0, s.length - h2.raw.length) + S2.raw, r = r.substring(0, r.length - R2.raw.length) + S2.raw, n = f2.substring(i.at(-1).raw.length).split(`
248
+ `);
249
+ continue;
250
+ }
251
+ }
252
+ return { type: "blockquote", raw: s, tokens: i, text: r };
253
+ }
254
+ }
255
+ list(e) {
256
+ let t = this.rules.block.list.exec(e);
257
+ if (t) {
258
+ let n = t[1].trim(), s = n.length > 1, r = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: false, items: [] };
259
+ n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
260
+ let i = this.rules.other.listItemRegex(n), o = false;
261
+ for (; e; ) {
262
+ let a = false, c2 = "", p2 = "";
263
+ if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
264
+ c2 = t[0], e = e.substring(c2.length);
265
+ let k2 = fe(t[2].split(`
266
+ `, 1)[0], t[1].length), h2 = e.split(`
267
+ `, 1)[0], R2 = !k2.trim(), f2 = 0;
268
+ if (this.options.pedantic ? (f2 = 2, p2 = k2.trimStart()) : R2 ? f2 = t[1].length + 1 : (f2 = k2.search(this.rules.other.nonSpaceChar), f2 = f2 > 4 ? 1 : f2, p2 = k2.slice(f2), f2 += t[1].length), R2 && this.rules.other.blankLine.test(h2) && (c2 += h2 + `
269
+ `, e = e.substring(h2.length + 1), a = true), !a) {
270
+ let S2 = this.rules.other.nextBulletRegex(f2), ee = this.rules.other.hrRegex(f2), te = this.rules.other.fencesBeginRegex(f2), ne = this.rules.other.headingBeginRegex(f2), xe = this.rules.other.htmlBeginRegex(f2), be = this.rules.other.blockquoteBeginRegex(f2);
271
+ for (; e; ) {
272
+ let Z2 = e.split(`
273
+ `, 1)[0], C2;
274
+ if (h2 = Z2, this.options.pedantic ? (h2 = h2.replace(this.rules.other.listReplaceNesting, " "), C2 = h2) : C2 = h2.replace(this.rules.other.tabCharGlobal, " "), te.test(h2) || ne.test(h2) || xe.test(h2) || be.test(h2) || S2.test(h2) || ee.test(h2)) break;
275
+ if (C2.search(this.rules.other.nonSpaceChar) >= f2 || !h2.trim()) p2 += `
276
+ ` + C2.slice(f2);
277
+ else {
278
+ if (R2 || k2.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(k2) || ne.test(k2) || ee.test(k2)) break;
279
+ p2 += `
280
+ ` + h2;
281
+ }
282
+ R2 = !h2.trim(), c2 += Z2 + `
283
+ `, e = e.substring(Z2.length + 1), k2 = C2.slice(f2);
284
+ }
285
+ }
286
+ r.loose || (o ? r.loose = true : this.rules.other.doubleBlankLine.test(c2) && (o = true)), r.items.push({ type: "list_item", raw: c2, task: !!this.options.gfm && this.rules.other.listIsTask.test(p2), loose: false, text: p2, tokens: [] }), r.raw += c2;
287
+ }
288
+ let u2 = r.items.at(-1);
289
+ if (u2) u2.raw = u2.raw.trimEnd(), u2.text = u2.text.trimEnd();
290
+ else return;
291
+ r.raw = r.raw.trimEnd();
292
+ for (let a of r.items) {
293
+ this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []);
294
+ let c2 = a.tokens[0];
295
+ if (a.task && ((c2 == null ? void 0 : c2.type) === "text" || (c2 == null ? void 0 : c2.type) === "paragraph")) {
296
+ a.text = a.text.replace(this.rules.other.listReplaceTask, ""), c2.raw = c2.raw.replace(this.rules.other.listReplaceTask, ""), c2.text = c2.text.replace(this.rules.other.listReplaceTask, "");
297
+ for (let k2 = this.lexer.inlineQueue.length - 1; k2 >= 0; k2--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k2].src)) {
298
+ this.lexer.inlineQueue[k2].src = this.lexer.inlineQueue[k2].src.replace(this.rules.other.listReplaceTask, "");
299
+ break;
300
+ }
301
+ let p2 = this.rules.other.listTaskCheckbox.exec(a.raw);
302
+ if (p2) {
303
+ let k2 = { type: "checkbox", raw: p2[0] + " ", checked: p2[0] !== "[ ]" };
304
+ a.checked = k2.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = k2.raw + a.tokens[0].raw, a.tokens[0].text = k2.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(k2)) : a.tokens.unshift({ type: "paragraph", raw: k2.raw, text: k2.raw, tokens: [k2] }) : a.tokens.unshift(k2);
305
+ }
306
+ } else a.task && (a.task = false);
307
+ if (!r.loose) {
308
+ let p2 = a.tokens.filter((h2) => h2.type === "space"), k2 = p2.length > 0 && p2.some((h2) => this.rules.other.anyLine.test(h2.raw));
309
+ r.loose = k2;
310
+ }
311
+ }
312
+ if (r.loose) for (let a of r.items) {
313
+ a.loose = true;
314
+ for (let c2 of a.tokens) c2.type === "text" && (c2.type = "paragraph");
315
+ }
316
+ return r;
317
+ }
318
+ }
319
+ html(e) {
320
+ let t = this.rules.block.html.exec(e);
321
+ if (t) {
322
+ let n = Y(t[0]);
323
+ return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
324
+ }
325
+ }
326
+ def(e) {
327
+ let t = this.rules.block.def.exec(e);
328
+ if (t) {
329
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = 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];
330
+ return { type: "def", tag: n, raw: $(t[0], `
331
+ `), href: s, title: r };
332
+ }
333
+ }
334
+ table(e) {
335
+ var _a2;
336
+ let t = this.rules.block.table.exec(e);
337
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
338
+ let n = V(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = ((_a2 = t[3]) == null ? void 0 : _a2.trim()) ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
339
+ `) : [], i = { type: "table", raw: $(t[0], `
340
+ `), header: [], align: [], rows: [] };
341
+ if (n.length === s.length) {
342
+ for (let o of s) this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
343
+ for (let o = 0; o < n.length; o++) i.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: true, align: i.align[o] });
344
+ for (let o of r) i.rows.push(V(o, i.header.length).map((u2, a) => ({ text: u2, tokens: this.lexer.inline(u2), header: false, align: i.align[a] })));
345
+ return i;
346
+ }
347
+ }
348
+ lheading(e) {
349
+ let t = this.rules.block.lheading.exec(e);
350
+ if (t) {
351
+ let n = t[1].trim();
352
+ return { type: "heading", raw: $(t[0], `
353
+ `), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
354
+ }
355
+ }
356
+ paragraph(e) {
357
+ let t = this.rules.block.paragraph.exec(e);
358
+ if (t) {
359
+ let n = t[1].charAt(t[1].length - 1) === `
360
+ ` ? t[1].slice(0, -1) : t[1];
361
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
362
+ }
363
+ }
364
+ text(e) {
365
+ let t = this.rules.block.text.exec(e);
366
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
367
+ }
368
+ escape(e) {
369
+ let t = this.rules.inline.escape.exec(e);
370
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
371
+ }
372
+ tag(e) {
373
+ let t = this.rules.inline.tag.exec(e);
374
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
375
+ }
376
+ link(e) {
377
+ let t = this.rules.inline.link.exec(e);
378
+ if (t) {
379
+ let n = t[2].trim();
380
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
381
+ if (!this.rules.other.endAngleBracket.test(n)) return;
382
+ let i = $(n.slice(0, -1), "\\");
383
+ if ((n.length - i.length) % 2 === 0) return;
384
+ } else {
385
+ let i = ge(t[2], "()");
386
+ if (i === -2) return;
387
+ if (i > -1) {
388
+ let u2 = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
389
+ t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u2).trim(), t[3] = "";
390
+ }
391
+ }
392
+ let s = t[2], r = "";
393
+ if (this.options.pedantic) {
394
+ let i = this.rules.other.pedanticHrefTitle.exec(s);
395
+ i && (s = i[1], r = i[3]);
396
+ } else r = t[3] ? t[3].slice(1, -1) : "";
397
+ return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), me(t, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
398
+ }
399
+ }
400
+ reflink(e, t) {
401
+ let n;
402
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
403
+ let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[s.toLowerCase()];
404
+ if (!r) {
405
+ let i = n[0].charAt(0);
406
+ return { type: "text", raw: i, text: i };
407
+ }
408
+ return me(n, r, n[0], this.lexer, this.rules);
409
+ }
410
+ }
411
+ emStrong(e, t, n = "") {
412
+ let s = this.rules.inline.emStrongLDelim.exec(e);
413
+ if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
414
+ if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
415
+ let i = [...s[0]].length - 1, o, u2, a = i, c2 = 0, p2 = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
416
+ for (p2.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = p2.exec(t)) !== null; ) {
417
+ if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o) continue;
418
+ if (u2 = [...o].length, s[3] || s[4]) {
419
+ a += u2;
420
+ continue;
421
+ } else if ((s[5] || s[6]) && i % 3 && !((i + u2) % 3)) {
422
+ c2 += u2;
423
+ continue;
424
+ }
425
+ if (a -= u2, a > 0) continue;
426
+ u2 = Math.min(u2, u2 + a + c2);
427
+ let k2 = [...s[0]][0].length, h2 = e.slice(0, i + s.index + k2 + u2);
428
+ if (Math.min(i, u2) % 2) {
429
+ let f2 = h2.slice(1, -1);
430
+ return { type: "em", raw: h2, text: f2, tokens: this.lexer.inlineTokens(f2) };
431
+ }
432
+ let R2 = h2.slice(2, -2);
433
+ return { type: "strong", raw: h2, text: R2, tokens: this.lexer.inlineTokens(R2) };
434
+ }
435
+ }
436
+ }
437
+ codespan(e) {
438
+ let t = this.rules.inline.code.exec(e);
439
+ if (t) {
440
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
441
+ return s && r && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
442
+ }
443
+ }
444
+ br(e) {
445
+ let t = this.rules.inline.br.exec(e);
446
+ if (t) return { type: "br", raw: t[0] };
447
+ }
448
+ del(e, t, n = "") {
449
+ let s = this.rules.inline.delLDelim.exec(e);
450
+ if (!s) return;
451
+ if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
452
+ let i = [...s[0]].length - 1, o, u2, a = i, c2 = this.rules.inline.delRDelim;
453
+ for (c2.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = c2.exec(t)) !== null; ) {
454
+ if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (u2 = [...o].length, u2 !== i)) continue;
455
+ if (s[3] || s[4]) {
456
+ a += u2;
457
+ continue;
458
+ }
459
+ if (a -= u2, a > 0) continue;
460
+ u2 = Math.min(u2, u2 + a);
461
+ let p2 = [...s[0]][0].length, k2 = e.slice(0, i + s.index + p2 + u2), h2 = k2.slice(i, -i);
462
+ return { type: "del", raw: k2, text: h2, tokens: this.lexer.inlineTokens(h2) };
463
+ }
464
+ }
465
+ }
466
+ autolink(e) {
467
+ let t = this.rules.inline.autolink.exec(e);
468
+ if (t) {
469
+ let n, s;
470
+ return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
471
+ }
472
+ }
473
+ url(e) {
474
+ var _a2, _b;
475
+ let t;
476
+ if (t = this.rules.inline.url.exec(e)) {
477
+ let n, s;
478
+ if (t[2] === "@") n = t[0], s = "mailto:" + n;
479
+ else {
480
+ let r;
481
+ do
482
+ r = t[0], t[0] = (_b = (_a2 = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : _a2[0]) != null ? _b : "";
483
+ while (r !== t[0]);
484
+ n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
485
+ }
486
+ return { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
487
+ }
488
+ }
489
+ inlineText(e) {
490
+ let t = this.rules.inline.text.exec(e);
491
+ if (t) {
492
+ let n = this.lexer.state.inRawBlock;
493
+ return { type: "text", raw: t[0], text: t[0], escaped: n };
494
+ }
495
+ }
496
+ };
497
+ var x = class l {
498
+ constructor(e) {
499
+ __publicField(this, "tokens");
500
+ __publicField(this, "options");
501
+ __publicField(this, "state");
502
+ __publicField(this, "inlineQueue");
503
+ __publicField(this, "tokenizer");
504
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
505
+ let t = { other: m, block: B.normal, inline: A.normal };
506
+ this.options.pedantic ? (t.block = B.pedantic, t.inline = A.pedantic) : this.options.gfm && (t.block = B.gfm, this.options.breaks ? t.inline = A.breaks : t.inline = A.gfm), this.tokenizer.rules = t;
507
+ }
508
+ static get rules() {
509
+ return { block: B, inline: A };
510
+ }
511
+ static lex(e, t) {
512
+ return new l(t).lex(e);
513
+ }
514
+ static lexInline(e, t) {
515
+ return new l(t).inlineTokens(e);
516
+ }
517
+ lex(e) {
518
+ e = e.replace(m.carriageReturn, `
519
+ `), this.blockTokens(e, this.tokens);
520
+ for (let t = 0; t < this.inlineQueue.length; t++) {
521
+ let n = this.inlineQueue[t];
522
+ this.inlineTokens(n.src, n.tokens);
523
+ }
524
+ return this.inlineQueue = [], this.tokens;
525
+ }
526
+ blockTokens(e, t = [], n = false) {
527
+ var _a2, _b, _c;
528
+ this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, ""));
529
+ let s = 1 / 0;
530
+ for (; e; ) {
531
+ if (e.length < s) s = e.length;
532
+ else {
533
+ this.infiniteLoopError(e.charCodeAt(0));
534
+ break;
535
+ }
536
+ let r;
537
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some((o) => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
538
+ if (r = this.tokenizer.space(e)) {
539
+ e = e.substring(r.raw.length);
540
+ let o = t.at(-1);
541
+ r.raw.length === 1 && o !== void 0 ? o.raw += `
542
+ ` : t.push(r);
543
+ continue;
544
+ }
545
+ if (r = this.tokenizer.code(e)) {
546
+ e = e.substring(r.raw.length);
547
+ let o = t.at(-1);
548
+ (o == null ? void 0 : o.type) === "paragraph" || (o == null ? void 0 : o.type) === "text" ? (o.raw += (o.raw.endsWith(`
549
+ `) ? "" : `
550
+ `) + r.raw, o.text += `
551
+ ` + r.text, this.inlineQueue.at(-1).src = o.text) : t.push(r);
552
+ continue;
553
+ }
554
+ if (r = this.tokenizer.fences(e)) {
555
+ e = e.substring(r.raw.length), t.push(r);
556
+ continue;
557
+ }
558
+ if (r = this.tokenizer.heading(e)) {
559
+ e = e.substring(r.raw.length), t.push(r);
560
+ continue;
561
+ }
562
+ if (r = this.tokenizer.hr(e)) {
563
+ e = e.substring(r.raw.length), t.push(r);
564
+ continue;
565
+ }
566
+ if (r = this.tokenizer.blockquote(e)) {
567
+ e = e.substring(r.raw.length), t.push(r);
568
+ continue;
569
+ }
570
+ if (r = this.tokenizer.list(e)) {
571
+ e = e.substring(r.raw.length), t.push(r);
572
+ continue;
573
+ }
574
+ if (r = this.tokenizer.html(e)) {
575
+ e = e.substring(r.raw.length), t.push(r);
576
+ continue;
577
+ }
578
+ if (r = this.tokenizer.def(e)) {
579
+ e = e.substring(r.raw.length);
580
+ let o = t.at(-1);
581
+ (o == null ? void 0 : o.type) === "paragraph" || (o == null ? void 0 : o.type) === "text" ? (o.raw += (o.raw.endsWith(`
582
+ `) ? "" : `
583
+ `) + r.raw, o.text += `
584
+ ` + r.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
585
+ continue;
586
+ }
587
+ if (r = this.tokenizer.table(e)) {
588
+ e = e.substring(r.raw.length), t.push(r);
589
+ continue;
590
+ }
591
+ if (r = this.tokenizer.lheading(e)) {
592
+ e = e.substring(r.raw.length), t.push(r);
593
+ continue;
594
+ }
595
+ let i = e;
596
+ if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
597
+ let o = 1 / 0, u2 = e.slice(1), a;
598
+ this.options.extensions.startBlock.forEach((c2) => {
599
+ a = c2.call({ lexer: this }, u2), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
600
+ }), o < 1 / 0 && o >= 0 && (i = e.substring(0, o + 1));
601
+ }
602
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
603
+ let o = t.at(-1);
604
+ n && (o == null ? void 0 : o.type) === "paragraph" ? (o.raw += (o.raw.endsWith(`
605
+ `) ? "" : `
606
+ `) + r.raw, o.text += `
607
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
608
+ continue;
609
+ }
610
+ if (r = this.tokenizer.text(e)) {
611
+ e = e.substring(r.raw.length);
612
+ let o = t.at(-1);
613
+ (o == null ? void 0 : o.type) === "text" ? (o.raw += (o.raw.endsWith(`
614
+ `) ? "" : `
615
+ `) + r.raw, o.text += `
616
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r);
617
+ continue;
618
+ }
619
+ if (e) {
620
+ this.infiniteLoopError(e.charCodeAt(0));
621
+ break;
622
+ }
623
+ }
624
+ return this.state.top = true, t;
625
+ }
626
+ inline(e, t = []) {
627
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
628
+ }
629
+ inlineTokens(e, t = []) {
630
+ var _a2, _b, _c, _d, _e2, _f;
631
+ this.tokenizer.lexer = this;
632
+ let n = e, s = null;
633
+ if (this.tokens.links) {
634
+ let a = Object.keys(this.tokens.links);
635
+ if (a.length > 0) for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null; ) a.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
636
+ }
637
+ for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null; ) n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
638
+ let r;
639
+ for (; (s = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; ) r = s[2] ? s[2].length : 0, n = n.slice(0, s.index + r) + "[" + "a".repeat(s[0].length - r - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
640
+ n = (_c = (_b = (_a2 = this.options.hooks) == null ? void 0 : _a2.emStrongMask) == null ? void 0 : _b.call({ lexer: this }, n)) != null ? _c : n;
641
+ let i = false, o = "", u2 = 1 / 0;
642
+ for (; e; ) {
643
+ if (e.length < u2) u2 = e.length;
644
+ else {
645
+ this.infiniteLoopError(e.charCodeAt(0));
646
+ break;
647
+ }
648
+ i || (o = ""), i = false;
649
+ let a;
650
+ if ((_e2 = (_d = this.options.extensions) == null ? void 0 : _d.inline) == null ? void 0 : _e2.some((p2) => (a = p2.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), true) : false)) continue;
651
+ if (a = this.tokenizer.escape(e)) {
652
+ e = e.substring(a.raw.length), t.push(a);
653
+ continue;
654
+ }
655
+ if (a = this.tokenizer.tag(e)) {
656
+ e = e.substring(a.raw.length), t.push(a);
657
+ continue;
658
+ }
659
+ if (a = this.tokenizer.link(e)) {
660
+ e = e.substring(a.raw.length), t.push(a);
661
+ continue;
662
+ }
663
+ if (a = this.tokenizer.reflink(e, this.tokens.links)) {
664
+ e = e.substring(a.raw.length);
665
+ let p2 = t.at(-1);
666
+ a.type === "text" && (p2 == null ? void 0 : p2.type) === "text" ? (p2.raw += a.raw, p2.text += a.text) : t.push(a);
667
+ continue;
668
+ }
669
+ if (a = this.tokenizer.emStrong(e, n, o)) {
670
+ e = e.substring(a.raw.length), t.push(a);
671
+ continue;
672
+ }
673
+ if (a = this.tokenizer.codespan(e)) {
674
+ e = e.substring(a.raw.length), t.push(a);
675
+ continue;
676
+ }
677
+ if (a = this.tokenizer.br(e)) {
678
+ e = e.substring(a.raw.length), t.push(a);
679
+ continue;
680
+ }
681
+ if (a = this.tokenizer.del(e, n, o)) {
682
+ e = e.substring(a.raw.length), t.push(a);
683
+ continue;
684
+ }
685
+ if (a = this.tokenizer.autolink(e)) {
686
+ e = e.substring(a.raw.length), t.push(a);
687
+ continue;
688
+ }
689
+ if (!this.state.inLink && (a = this.tokenizer.url(e))) {
690
+ e = e.substring(a.raw.length), t.push(a);
691
+ continue;
692
+ }
693
+ let c2 = e;
694
+ if ((_f = this.options.extensions) == null ? void 0 : _f.startInline) {
695
+ let p2 = 1 / 0, k2 = e.slice(1), h2;
696
+ this.options.extensions.startInline.forEach((R2) => {
697
+ h2 = R2.call({ lexer: this }, k2), typeof h2 == "number" && h2 >= 0 && (p2 = Math.min(p2, h2));
698
+ }), p2 < 1 / 0 && p2 >= 0 && (c2 = e.substring(0, p2 + 1));
699
+ }
700
+ if (a = this.tokenizer.inlineText(c2)) {
701
+ e = e.substring(a.raw.length), a.raw.slice(-1) !== "_" && (o = a.raw.slice(-1)), i = true;
702
+ let p2 = t.at(-1);
703
+ (p2 == null ? void 0 : p2.type) === "text" ? (p2.raw += a.raw, p2.text += a.text) : t.push(a);
704
+ continue;
705
+ }
706
+ if (e) {
707
+ this.infiniteLoopError(e.charCodeAt(0));
708
+ break;
709
+ }
710
+ }
711
+ return t;
712
+ }
713
+ infiniteLoopError(e) {
714
+ let t = "Infinite loop on byte: " + e;
715
+ if (this.options.silent) console.error(t);
716
+ else throw new Error(t);
717
+ }
718
+ };
719
+ var y = class {
720
+ constructor(e) {
721
+ __publicField(this, "options");
722
+ __publicField(this, "parser");
723
+ this.options = e || T;
724
+ }
725
+ space(e) {
726
+ return "";
727
+ }
728
+ code({ text: e, lang: t, escaped: n }) {
729
+ var _a2;
730
+ let s = (_a2 = (t || "").match(m.notSpaceStart)) == null ? void 0 : _a2[0], r = e.replace(m.endingNewline, "") + `
731
+ `;
732
+ return s ? '<pre><code class="language-' + O(s) + '">' + (n ? r : O(r, true)) + `</code></pre>
733
+ ` : "<pre><code>" + (n ? r : O(r, true)) + `</code></pre>
734
+ `;
735
+ }
736
+ blockquote({ tokens: e }) {
737
+ return `<blockquote>
738
+ ${this.parser.parse(e)}</blockquote>
739
+ `;
740
+ }
741
+ html({ text: e }) {
742
+ return e;
743
+ }
744
+ def(e) {
745
+ return "";
746
+ }
747
+ heading({ tokens: e, depth: t }) {
748
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
749
+ `;
750
+ }
751
+ hr(e) {
752
+ return `<hr>
753
+ `;
754
+ }
755
+ list(e) {
756
+ let t = e.ordered, n = e.start, s = "";
757
+ for (let o = 0; o < e.items.length; o++) {
758
+ let u2 = e.items[o];
759
+ s += this.listitem(u2);
760
+ }
761
+ let r = t ? "ol" : "ul", i = t && n !== 1 ? ' start="' + n + '"' : "";
762
+ return "<" + r + i + `>
763
+ ` + s + "</" + r + `>
764
+ `;
765
+ }
766
+ listitem(e) {
767
+ return `<li>${this.parser.parse(e.tokens)}</li>
768
+ `;
769
+ }
770
+ checkbox({ checked: e }) {
771
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
772
+ }
773
+ paragraph({ tokens: e }) {
774
+ return `<p>${this.parser.parseInline(e)}</p>
775
+ `;
776
+ }
777
+ table(e) {
778
+ let t = "", n = "";
779
+ for (let r = 0; r < e.header.length; r++) n += this.tablecell(e.header[r]);
780
+ t += this.tablerow({ text: n });
781
+ let s = "";
782
+ for (let r = 0; r < e.rows.length; r++) {
783
+ let i = e.rows[r];
784
+ n = "";
785
+ for (let o = 0; o < i.length; o++) n += this.tablecell(i[o]);
786
+ s += this.tablerow({ text: n });
787
+ }
788
+ return s && (s = `<tbody>${s}</tbody>`), `<table>
789
+ <thead>
790
+ ` + t + `</thead>
791
+ ` + s + `</table>
792
+ `;
793
+ }
794
+ tablerow({ text: e }) {
795
+ return `<tr>
796
+ ${e}</tr>
797
+ `;
798
+ }
799
+ tablecell(e) {
800
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
801
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
802
+ `;
803
+ }
804
+ strong({ tokens: e }) {
805
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
806
+ }
807
+ em({ tokens: e }) {
808
+ return `<em>${this.parser.parseInline(e)}</em>`;
809
+ }
810
+ codespan({ text: e }) {
811
+ return `<code>${O(e, true)}</code>`;
812
+ }
813
+ br(e) {
814
+ return "<br>";
815
+ }
816
+ del({ tokens: e }) {
817
+ return `<del>${this.parser.parseInline(e)}</del>`;
818
+ }
819
+ link({ href: e, title: t, tokens: n }) {
820
+ let s = this.parser.parseInline(n), r = J(e);
821
+ if (r === null) return s;
822
+ e = r;
823
+ let i = '<a href="' + e + '"';
824
+ return t && (i += ' title="' + O(t) + '"'), i += ">" + s + "</a>", i;
825
+ }
826
+ image({ href: e, title: t, text: n, tokens: s }) {
827
+ s && (n = this.parser.parseInline(s, this.parser.textRenderer));
828
+ let r = J(e);
829
+ if (r === null) return O(n);
830
+ e = r;
831
+ let i = `<img src="${e}" alt="${O(n)}"`;
832
+ return t && (i += ` title="${O(t)}"`), i += ">", i;
833
+ }
834
+ text(e) {
835
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
836
+ }
837
+ };
838
+ var L = class {
839
+ strong({ text: e }) {
840
+ return e;
841
+ }
842
+ em({ text: e }) {
843
+ return e;
844
+ }
845
+ codespan({ text: e }) {
846
+ return e;
847
+ }
848
+ del({ text: e }) {
849
+ return e;
850
+ }
851
+ html({ text: e }) {
852
+ return e;
853
+ }
854
+ text({ text: e }) {
855
+ return e;
856
+ }
857
+ link({ text: e }) {
858
+ return "" + e;
859
+ }
860
+ image({ text: e }) {
861
+ return "" + e;
862
+ }
863
+ br() {
864
+ return "";
865
+ }
866
+ checkbox({ raw: e }) {
867
+ return e;
868
+ }
869
+ };
870
+ var b = class l2 {
871
+ constructor(e) {
872
+ __publicField(this, "options");
873
+ __publicField(this, "renderer");
874
+ __publicField(this, "textRenderer");
875
+ this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L();
876
+ }
877
+ static parse(e, t) {
878
+ return new l2(t).parse(e);
879
+ }
880
+ static parseInline(e, t) {
881
+ return new l2(t).parseInline(e);
882
+ }
883
+ parse(e) {
884
+ var _a2, _b;
885
+ this.renderer.parser = this;
886
+ let t = "";
887
+ for (let n = 0; n < e.length; n++) {
888
+ let s = e[n];
889
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[s.type]) {
890
+ let i = s, o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
891
+ if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(i.type)) {
892
+ t += o || "";
893
+ continue;
894
+ }
895
+ }
896
+ let r = s;
897
+ switch (r.type) {
898
+ case "space": {
899
+ t += this.renderer.space(r);
900
+ break;
901
+ }
902
+ case "hr": {
903
+ t += this.renderer.hr(r);
904
+ break;
905
+ }
906
+ case "heading": {
907
+ t += this.renderer.heading(r);
908
+ break;
909
+ }
910
+ case "code": {
911
+ t += this.renderer.code(r);
912
+ break;
913
+ }
914
+ case "table": {
915
+ t += this.renderer.table(r);
916
+ break;
917
+ }
918
+ case "blockquote": {
919
+ t += this.renderer.blockquote(r);
920
+ break;
921
+ }
922
+ case "list": {
923
+ t += this.renderer.list(r);
924
+ break;
925
+ }
926
+ case "checkbox": {
927
+ t += this.renderer.checkbox(r);
928
+ break;
929
+ }
930
+ case "html": {
931
+ t += this.renderer.html(r);
932
+ break;
933
+ }
934
+ case "def": {
935
+ t += this.renderer.def(r);
936
+ break;
937
+ }
938
+ case "paragraph": {
939
+ t += this.renderer.paragraph(r);
940
+ break;
941
+ }
942
+ case "text": {
943
+ t += this.renderer.text(r);
944
+ break;
945
+ }
946
+ default: {
947
+ let i = 'Token with "' + r.type + '" type was not found.';
948
+ if (this.options.silent) return console.error(i), "";
949
+ throw new Error(i);
950
+ }
951
+ }
952
+ }
953
+ return t;
954
+ }
955
+ parseInline(e, t = this.renderer) {
956
+ var _a2, _b;
957
+ this.renderer.parser = this;
958
+ let n = "";
959
+ for (let s = 0; s < e.length; s++) {
960
+ let r = e[s];
961
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[r.type]) {
962
+ let o = this.options.extensions.renderers[r.type].call({ parser: this }, r);
963
+ if (o !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
964
+ n += o || "";
965
+ continue;
966
+ }
967
+ }
968
+ let i = r;
969
+ switch (i.type) {
970
+ case "escape": {
971
+ n += t.text(i);
972
+ break;
973
+ }
974
+ case "html": {
975
+ n += t.html(i);
976
+ break;
977
+ }
978
+ case "link": {
979
+ n += t.link(i);
980
+ break;
981
+ }
982
+ case "image": {
983
+ n += t.image(i);
984
+ break;
985
+ }
986
+ case "checkbox": {
987
+ n += t.checkbox(i);
988
+ break;
989
+ }
990
+ case "strong": {
991
+ n += t.strong(i);
992
+ break;
993
+ }
994
+ case "em": {
995
+ n += t.em(i);
996
+ break;
997
+ }
998
+ case "codespan": {
999
+ n += t.codespan(i);
1000
+ break;
1001
+ }
1002
+ case "br": {
1003
+ n += t.br(i);
1004
+ break;
1005
+ }
1006
+ case "del": {
1007
+ n += t.del(i);
1008
+ break;
1009
+ }
1010
+ case "text": {
1011
+ n += t.text(i);
1012
+ break;
1013
+ }
1014
+ default: {
1015
+ let o = 'Token with "' + i.type + '" type was not found.';
1016
+ if (this.options.silent) return console.error(o), "";
1017
+ throw new Error(o);
1018
+ }
1019
+ }
1020
+ }
1021
+ return n;
1022
+ }
1023
+ };
1024
+ var _a;
1025
+ var P = (_a = class {
1026
+ constructor(e) {
1027
+ __publicField(this, "options");
1028
+ __publicField(this, "block");
1029
+ this.options = e || T;
1030
+ }
1031
+ preprocess(e) {
1032
+ return e;
1033
+ }
1034
+ postprocess(e) {
1035
+ return e;
1036
+ }
1037
+ processAllTokens(e) {
1038
+ return e;
1039
+ }
1040
+ emStrongMask(e) {
1041
+ return e;
1042
+ }
1043
+ provideLexer(e = this.block) {
1044
+ return e ? x.lex : x.lexInline;
1045
+ }
1046
+ provideParser(e = this.block) {
1047
+ return e ? b.parse : b.parseInline;
1048
+ }
1049
+ }, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
1050
+ var D = class {
1051
+ constructor(...e) {
1052
+ __publicField(this, "defaults", z());
1053
+ __publicField(this, "options", this.setOptions);
1054
+ __publicField(this, "parse", this.parseMarkdown(true));
1055
+ __publicField(this, "parseInline", this.parseMarkdown(false));
1056
+ __publicField(this, "Parser", b);
1057
+ __publicField(this, "Renderer", y);
1058
+ __publicField(this, "TextRenderer", L);
1059
+ __publicField(this, "Lexer", x);
1060
+ __publicField(this, "Tokenizer", w);
1061
+ __publicField(this, "Hooks", P);
1062
+ this.use(...e);
1063
+ }
1064
+ walkTokens(e, t) {
1065
+ var _a2, _b;
1066
+ let n = [];
1067
+ for (let s of e) switch (n = n.concat(t.call(this, s)), s.type) {
1068
+ case "table": {
1069
+ let r = s;
1070
+ for (let i of r.header) n = n.concat(this.walkTokens(i.tokens, t));
1071
+ for (let i of r.rows) for (let o of i) n = n.concat(this.walkTokens(o.tokens, t));
1072
+ break;
1073
+ }
1074
+ case "list": {
1075
+ let r = s;
1076
+ n = n.concat(this.walkTokens(r.items, t));
1077
+ break;
1078
+ }
1079
+ default: {
1080
+ let r = s;
1081
+ ((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[r.type]) ? this.defaults.extensions.childTokens[r.type].forEach((i) => {
1082
+ let o = r[i].flat(1 / 0);
1083
+ n = n.concat(this.walkTokens(o, t));
1084
+ }) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
1085
+ }
1086
+ }
1087
+ return n;
1088
+ }
1089
+ use(...e) {
1090
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1091
+ return e.forEach((n) => {
1092
+ let s = { ...n };
1093
+ if (s.async = this.defaults.async || s.async || false, n.extensions && (n.extensions.forEach((r) => {
1094
+ if (!r.name) throw new Error("extension name required");
1095
+ if ("renderer" in r) {
1096
+ let i = t.renderers[r.name];
1097
+ i ? t.renderers[r.name] = function(...o) {
1098
+ let u2 = r.renderer.apply(this, o);
1099
+ return u2 === false && (u2 = i.apply(this, o)), u2;
1100
+ } : t.renderers[r.name] = r.renderer;
1101
+ }
1102
+ if ("tokenizer" in r) {
1103
+ if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1104
+ let i = t[r.level];
1105
+ i ? i.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
1106
+ }
1107
+ "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
1108
+ }), s.extensions = t), n.renderer) {
1109
+ let r = this.defaults.renderer || new y(this.defaults);
1110
+ for (let i in n.renderer) {
1111
+ if (!(i in r)) throw new Error(`renderer '${i}' does not exist`);
1112
+ if (["options", "parser"].includes(i)) continue;
1113
+ let o = i, u2 = n.renderer[o], a = r[o];
1114
+ r[o] = (...c2) => {
1115
+ let p2 = u2.apply(r, c2);
1116
+ return p2 === false && (p2 = a.apply(r, c2)), p2 || "";
1117
+ };
1118
+ }
1119
+ s.renderer = r;
1120
+ }
1121
+ if (n.tokenizer) {
1122
+ let r = this.defaults.tokenizer || new w(this.defaults);
1123
+ for (let i in n.tokenizer) {
1124
+ if (!(i in r)) throw new Error(`tokenizer '${i}' does not exist`);
1125
+ if (["options", "rules", "lexer"].includes(i)) continue;
1126
+ let o = i, u2 = n.tokenizer[o], a = r[o];
1127
+ r[o] = (...c2) => {
1128
+ let p2 = u2.apply(r, c2);
1129
+ return p2 === false && (p2 = a.apply(r, c2)), p2;
1130
+ };
1131
+ }
1132
+ s.tokenizer = r;
1133
+ }
1134
+ if (n.hooks) {
1135
+ let r = this.defaults.hooks || new P();
1136
+ for (let i in n.hooks) {
1137
+ if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
1138
+ if (["options", "block"].includes(i)) continue;
1139
+ let o = i, u2 = n.hooks[o], a = r[o];
1140
+ P.passThroughHooks.has(i) ? r[o] = (c2) => {
1141
+ if (this.defaults.async && P.passThroughHooksRespectAsync.has(i)) return (async () => {
1142
+ let k2 = await u2.call(r, c2);
1143
+ return a.call(r, k2);
1144
+ })();
1145
+ let p2 = u2.call(r, c2);
1146
+ return a.call(r, p2);
1147
+ } : r[o] = (...c2) => {
1148
+ if (this.defaults.async) return (async () => {
1149
+ let k2 = await u2.apply(r, c2);
1150
+ return k2 === false && (k2 = await a.apply(r, c2)), k2;
1151
+ })();
1152
+ let p2 = u2.apply(r, c2);
1153
+ return p2 === false && (p2 = a.apply(r, c2)), p2;
1154
+ };
1155
+ }
1156
+ s.hooks = r;
1157
+ }
1158
+ if (n.walkTokens) {
1159
+ let r = this.defaults.walkTokens, i = n.walkTokens;
1160
+ s.walkTokens = function(o) {
1161
+ let u2 = [];
1162
+ return u2.push(i.call(this, o)), r && (u2 = u2.concat(r.call(this, o))), u2;
1163
+ };
1164
+ }
1165
+ this.defaults = { ...this.defaults, ...s };
1166
+ }), this;
1167
+ }
1168
+ setOptions(e) {
1169
+ return this.defaults = { ...this.defaults, ...e }, this;
1170
+ }
1171
+ lexer(e, t) {
1172
+ return x.lex(e, t != null ? t : this.defaults);
1173
+ }
1174
+ parser(e, t) {
1175
+ return b.parse(e, t != null ? t : this.defaults);
1176
+ }
1177
+ parseMarkdown(e) {
1178
+ return (n, s) => {
1179
+ let r = { ...s }, i = { ...this.defaults, ...r }, o = this.onError(!!i.silent, !!i.async);
1180
+ if (this.defaults.async === true && r.async === false) return o(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."));
1181
+ if (typeof n > "u" || n === null) return o(new Error("marked(): input parameter is undefined or null"));
1182
+ if (typeof n != "string") return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1183
+ if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
1184
+ let u2 = i.hooks ? await i.hooks.preprocess(n) : n, c2 = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(u2, i), p2 = i.hooks ? await i.hooks.processAllTokens(c2) : c2;
1185
+ i.walkTokens && await Promise.all(this.walkTokens(p2, i.walkTokens));
1186
+ let h2 = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(p2, i);
1187
+ return i.hooks ? await i.hooks.postprocess(h2) : h2;
1188
+ })().catch(o);
1189
+ try {
1190
+ i.hooks && (n = i.hooks.preprocess(n));
1191
+ let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
1192
+ i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
1193
+ let p2 = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
1194
+ return i.hooks && (p2 = i.hooks.postprocess(p2)), p2;
1195
+ } catch (u2) {
1196
+ return o(u2);
1197
+ }
1198
+ };
1199
+ }
1200
+ onError(e, t) {
1201
+ return (n) => {
1202
+ if (n.message += `
1203
+ Please report this to https://github.com/markedjs/marked.`, e) {
1204
+ let s = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
1205
+ return t ? Promise.resolve(s) : s;
1206
+ }
1207
+ if (t) return Promise.reject(n);
1208
+ throw n;
1209
+ };
1210
+ }
1211
+ };
1212
+ var M = new D();
1213
+ function g(l3, e) {
1214
+ return M.parse(l3, e);
1215
+ }
1216
+ g.options = g.setOptions = function(l3) {
1217
+ return M.setOptions(l3), g.defaults = M.defaults, G(g.defaults), g;
1218
+ };
1219
+ g.getDefaults = z;
1220
+ g.defaults = T;
1221
+ g.use = function(...l3) {
1222
+ return M.use(...l3), g.defaults = M.defaults, G(g.defaults), g;
1223
+ };
1224
+ g.walkTokens = function(l3, e) {
1225
+ return M.walkTokens(l3, e);
1226
+ };
1227
+ g.parseInline = M.parseInline;
1228
+ g.Parser = b;
1229
+ g.parser = b.parse;
1230
+ g.Renderer = y;
1231
+ g.TextRenderer = L;
1232
+ g.Lexer = x;
1233
+ g.lexer = x.lex;
1234
+ g.Tokenizer = w;
1235
+ g.Hooks = P;
1236
+ g.parse = g;
1237
+ var jt = g.options;
1238
+ var Ft = g.setOptions;
1239
+ var Ut = g.use;
1240
+ var Kt = g.walkTokens;
1241
+ var Wt = g.parseInline;
1242
+ var Jt = b.parse;
1243
+ var Vt = x.lex;
1244
+
1245
+ // src/plugins/shared/htmlToMiniNodes.ts
1246
+ function htmlToMiniNodes(html, escapeText) {
1247
+ var _a2;
1248
+ const root = { name: "root", children: [] };
1249
+ const stack = [root];
1250
+ let i = 0;
1251
+ function decode(s) {
1252
+ if (!escapeText) return s;
1253
+ return s.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
1254
+ }
1255
+ function mapTag(tag) {
1256
+ switch (tag) {
1257
+ case "div":
1258
+ case "p":
1259
+ return "div";
1260
+ case "span":
1261
+ case "code":
1262
+ return "span";
1263
+ case "br":
1264
+ return "br";
1265
+ case "img":
1266
+ return "img";
1267
+ case "em":
1268
+ case "i":
1269
+ return "em";
1270
+ case "strong":
1271
+ case "b":
1272
+ return "strong";
1273
+ case "sup":
1274
+ return "sup";
1275
+ case "sub":
1276
+ return "sub";
1277
+ default:
1278
+ return "span";
1279
+ }
1280
+ }
1281
+ while (i < html.length) {
1282
+ if (html[i] === "<") {
1283
+ const closeMatch = /^<\/(\w+)\s*>/.exec(html.slice(i));
1284
+ if (closeMatch) {
1285
+ const closeTag = closeMatch[1].toLowerCase();
1286
+ for (let j3 = stack.length - 1; j3 > 0; j3--) {
1287
+ if (stack[j3].name === mapTag(closeTag)) {
1288
+ stack.length = j3;
1289
+ break;
1290
+ }
1291
+ }
1292
+ i += closeMatch[0].length;
1293
+ continue;
1294
+ }
1295
+ const tagMatch = /^<(\w+)((?:\s+[^>]*?)?)(\/?)>/.exec(html.slice(i));
1296
+ if (tagMatch) {
1297
+ const rawTag = tagMatch[1].toLowerCase();
1298
+ const attrStr = tagMatch[2];
1299
+ const selfClose = tagMatch[3] === "/";
1300
+ if (rawTag === "span" && /\bkatex-mathml\b/.test(attrStr)) {
1301
+ let depth = 1;
1302
+ let si = i + tagMatch[0].length;
1303
+ while (si < html.length && depth > 0) {
1304
+ const next = html.indexOf("<", si);
1305
+ if (next === -1) break;
1306
+ const csm = /^<\/span\s*>/i.exec(html.slice(next));
1307
+ const osm = /^<span[\s>]/i.exec(html.slice(next));
1308
+ if (csm) {
1309
+ depth--;
1310
+ si = next + csm[0].length;
1311
+ } else if (osm) {
1312
+ depth++;
1313
+ si = next + osm[0].length;
1314
+ } else {
1315
+ si = next + 1;
1316
+ }
1317
+ }
1318
+ i = si;
1319
+ continue;
1320
+ }
1321
+ const name = mapTag(rawTag);
1322
+ const attrs = {};
1323
+ const classMatch = /\bclass\s*=\s*"([^"]*)"/.exec(attrStr);
1324
+ if (classMatch) attrs.class = classMatch[1];
1325
+ const styleMatch = /\bstyle\s*=\s*"([^"]*)"/.exec(attrStr);
1326
+ if (styleMatch) attrs.style = styleMatch[1];
1327
+ const srcMatch = /\bsrc\s*=\s*"([^"]*)"/.exec(attrStr);
1328
+ if (srcMatch) attrs.src = srcMatch[1];
1329
+ const altMatch = /\balt\s*=\s*"([^"]*)"/.exec(attrStr);
1330
+ if (altMatch) attrs.alt = altMatch[1];
1331
+ const node = { name, attrs: Object.keys(attrs).length ? attrs : void 0, children: [] };
1332
+ if (selfClose || rawTag === "br") {
1333
+ if (rawTag === "br") {
1334
+ const parent = stack[stack.length - 1];
1335
+ parent.children.push({ name: "text", attrs: { value: "\n" } });
1336
+ } else {
1337
+ stack[stack.length - 1].children.push(node);
1338
+ }
1339
+ } else {
1340
+ stack[stack.length - 1].children.push(node);
1341
+ stack.push(node);
1342
+ }
1343
+ i += tagMatch[0].length;
1344
+ continue;
1345
+ }
1346
+ i++;
1347
+ } else {
1348
+ const nextLt = html.indexOf("<", i);
1349
+ const text = nextLt === -1 ? html.slice(i) : html.slice(i, nextLt);
1350
+ if (text) {
1351
+ const parent = stack[stack.length - 1];
1352
+ const last = parent.children[parent.children.length - 1];
1353
+ if (last && last.name === "text") {
1354
+ last.attrs.value += decode(text);
1355
+ } else {
1356
+ parent.children.push({ name: "text", attrs: { value: decode(text) } });
1357
+ }
1358
+ }
1359
+ i = nextLt === -1 ? html.length : nextLt;
1360
+ }
1361
+ }
1362
+ return (_a2 = root.children) != null ? _a2 : [];
1363
+ }
1364
+
1365
+ // src/platforms/shared/customTokenRenderer.ts
1366
+ function makeRendererThis(_ctx) {
1367
+ return { parser: { parseInline: () => "" } };
1368
+ }
1369
+ function renderCustomToken(token, ctx) {
1370
+ var _a2;
1371
+ const exts = ctx.extensions;
1372
+ if (exts && exts.length > 0) {
1373
+ for (let i = 0; i < exts.length; i++) {
1374
+ const inner = (_a2 = exts[i]) == null ? void 0 : _a2.extensions;
1375
+ if (!inner || inner.length === 0) continue;
1376
+ for (let j3 = 0; j3 < inner.length; j3++) {
1377
+ const tok = inner[j3];
1378
+ if (!tok || tok.name !== token.type) continue;
1379
+ if (typeof tok.miniRenderer === "function") {
1380
+ const rendered = tok.miniRenderer(token, ctx);
1381
+ if (!rendered) return [];
1382
+ return Array.isArray(rendered) ? rendered : [rendered];
1383
+ }
1384
+ if (typeof tok.renderer === "function") {
1385
+ const html = tok.renderer.call(makeRendererThis(ctx), token);
1386
+ if (typeof html !== "string" || html.length === 0) return [];
1387
+ return htmlToMiniNodes(html, ctx.escapeText !== false);
1388
+ }
1389
+ break;
1390
+ }
1391
+ }
1392
+ }
1393
+ return [];
1394
+ }
1395
+
1396
+ // src/platforms/shared/miniNodeRenderer.ts
1397
+ function escapeHtml(text) {
1398
+ let out = "";
1399
+ for (let i = 0; i < text.length; i++) {
1400
+ const ch = text.charCodeAt(i);
1401
+ if (ch === 38) out += "&amp;";
1402
+ else if (ch === 60) out += "&lt;";
1403
+ else if (ch === 62) out += "&gt;";
1404
+ else if (ch === 34) out += "&quot;";
1405
+ else out += text[i];
1406
+ }
1407
+ return out;
1408
+ }
1409
+ function block(name, children, animate, adapter, token, extra) {
1410
+ var _a2;
1411
+ const node = { name };
1412
+ if (extra && Object.keys(extra).length > 0) node.attrs = extra;
1413
+ if (children.length) node.children = children;
1414
+ if (animate) node.animate = true;
1415
+ return (_a2 = adaptNode(adapter, node, { role: "block", token })) != null ? _a2 : node;
1416
+ }
1417
+ function inlineNode(adapter, node, token) {
1418
+ return adaptNode(adapter, compactNode(node), { role: "inline", token });
1419
+ }
1420
+ function compactNode(node) {
1421
+ if (node.attrs && Object.keys(node.attrs).length === 0) {
1422
+ const { attrs: _attrs, ...rest } = node;
1423
+ return rest;
1424
+ }
1425
+ return node;
1426
+ }
1427
+ function adaptNode(adapter, node, meta) {
1428
+ var _a2;
1429
+ const adapted = (_a2 = adapter.node) == null ? void 0 : _a2.call(adapter, node, meta);
1430
+ if (adapted === null) return null;
1431
+ return compactNode(adapted != null ? adapted : node);
1432
+ }
1433
+ function supports(adapter, capability) {
1434
+ var _a2;
1435
+ return ((_a2 = adapter.capabilities) == null ? void 0 : _a2[capability]) !== false;
1436
+ }
1437
+ function textBlock(value, animate, adapter, token) {
1438
+ return block("p", value ? [{ name: "text", attrs: { value } }] : [], animate, adapter, token);
1439
+ }
1440
+ function collectText(nodes) {
1441
+ var _a2, _b;
1442
+ let out = "";
1443
+ for (const node of nodes) {
1444
+ if (node.name === "text") out += String((_b = (_a2 = node.attrs) == null ? void 0 : _a2.value) != null ? _b : "");
1445
+ if (node.children) out += collectText(node.children);
1446
+ }
1447
+ return out;
1448
+ }
1449
+ function renderTokensToMiniNodes(tokens, adapter, ctx = {}) {
1450
+ const animate = ctx.animation === true;
1451
+ const enc = ctx.escapeText === false ? (s) => s : escapeHtml;
1452
+ const localCtx = { ...ctx };
1453
+ localCtx.renderInlineTokens = (inner) => inlineTokens(inner, adapter, enc, localCtx);
1454
+ return blockTokens(tokens, adapter, animate, enc, localCtx);
1455
+ }
1456
+ function blockTokens(tokens, adapter, animate, enc, ctx) {
1457
+ const out = [];
1458
+ for (const tok of tokens) {
1459
+ const node = blockTok(tok, adapter, animate, enc, ctx);
1460
+ if (node) out.push(node);
1461
+ }
1462
+ return out;
1463
+ }
1464
+ function blockTok(tok, adapter, animate, enc, ctx) {
1465
+ var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m;
1466
+ switch (tok.type) {
1467
+ case "space":
1468
+ return null;
1469
+ case "heading": {
1470
+ const t = tok;
1471
+ const depth = Math.min(6, Math.max(1, (_a2 = t.depth) != null ? _a2 : 1));
1472
+ return block(`h${depth}`, inlineTokens((_b = t.tokens) != null ? _b : [], adapter, enc, ctx), animate, adapter, tok);
1473
+ }
1474
+ case "paragraph": {
1475
+ const t = tok;
1476
+ return block("p", inlineTokens((_c = t.tokens) != null ? _c : [], adapter, enc, ctx), animate, adapter, tok);
1477
+ }
1478
+ case "code": {
1479
+ const custom = renderCustomToken(tok, ctx);
1480
+ if (custom.length) return block("pre", custom, animate, adapter, tok);
1481
+ const t = tok;
1482
+ if (!supports(adapter, "supportsPre")) {
1483
+ return textBlock(enc((_d = t.text) != null ? _d : ""), animate, adapter, tok);
1484
+ }
1485
+ const codeChild = {
1486
+ name: "code",
1487
+ children: [{ name: "text", attrs: { value: enc((_e2 = t.text) != null ? _e2 : "") } }]
1488
+ };
1489
+ return block("pre", [codeChild], animate, adapter, tok);
1490
+ }
1491
+ case "hr":
1492
+ return block("hr", [], animate, adapter, tok);
1493
+ case "blockquote": {
1494
+ const t = tok;
1495
+ const children = blockTokens((_f = t.tokens) != null ? _f : [], adapter, animate, enc, ctx);
1496
+ if (!supports(adapter, "supportsBlockquote")) {
1497
+ return textBlock(collectText(children), animate, adapter, tok);
1498
+ }
1499
+ return block("blockquote", children, animate, adapter, tok);
1500
+ }
1501
+ case "list": {
1502
+ const t = tok;
1503
+ const ordered = !!t.ordered;
1504
+ const start = typeof t.start === "number" ? t.start : 1;
1505
+ const tag = ordered ? "ol" : "ul";
1506
+ const children = t.items.map((item) => listItemTok(item, adapter, animate, enc, ctx));
1507
+ return block(tag, children, animate, adapter, tok, ordered ? adapter.olAttrs(start, t) : void 0);
1508
+ }
1509
+ case "html": {
1510
+ const t = tok;
1511
+ const raw = ((_h = (_g = t.text) != null ? _g : t.raw) != null ? _h : "").replace(/\s+$/, "");
1512
+ return block("div", raw ? [{ name: "text", attrs: { value: raw } }] : [], animate, adapter, tok);
1513
+ }
1514
+ case "table": {
1515
+ const t = tok;
1516
+ if (!supports(adapter, "supportsTable")) {
1517
+ const rows = [
1518
+ (_i = t.header) != null ? _i : [],
1519
+ ...(_j = t.rows) != null ? _j : []
1520
+ ];
1521
+ const value = rows.map((row) => row.map((cell) => {
1522
+ var _a3;
1523
+ return collectText(inlineTokens((_a3 = cell.tokens) != null ? _a3 : [], adapter, enc, ctx));
1524
+ }).join(" ")).join("\n");
1525
+ return textBlock(value, animate, adapter, tok);
1526
+ }
1527
+ const headCells = ((_k = t.header) != null ? _k : []).map((cell) => {
1528
+ var _a3;
1529
+ return {
1530
+ name: "th",
1531
+ children: inlineTokens((_a3 = cell.tokens) != null ? _a3 : [], adapter, enc, ctx)
1532
+ };
1533
+ });
1534
+ const rowNodes = ((_l = t.rows) != null ? _l : []).map((row) => ({
1535
+ name: "tr",
1536
+ children: row.map((cell) => {
1537
+ var _a3;
1538
+ return {
1539
+ name: "td",
1540
+ children: inlineTokens((_a3 = cell.tokens) != null ? _a3 : [], adapter, enc, ctx)
1541
+ };
1542
+ })
1543
+ }));
1544
+ const thead = {
1545
+ name: "thead",
1546
+ children: [{ name: "tr", attrs: {}, children: headCells }]
1547
+ };
1548
+ const tbody = { name: "tbody", attrs: {}, children: rowNodes };
1549
+ return block("table", [compactNode(thead), compactNode(tbody)], animate, adapter, tok);
1550
+ }
1551
+ case "text": {
1552
+ const t = tok;
1553
+ const inline = t.tokens ? inlineTokens(t.tokens, adapter, enc, ctx) : [{ name: "text", attrs: { value: enc((_m = t.text) != null ? _m : "") } }];
1554
+ return block("p", inline, animate, adapter, tok);
1555
+ }
1556
+ case "def":
1557
+ return null;
1558
+ default: {
1559
+ const custom = renderCustomToken(tok, ctx);
1560
+ return custom.length ? block("div", custom, animate, adapter, tok) : null;
1561
+ }
1562
+ }
1563
+ }
1564
+ function listItemTok(item, adapter, animate, enc, ctx) {
1565
+ var _a2, _b, _c, _d;
1566
+ const blocks = (_a2 = item.tokens) != null ? _a2 : [];
1567
+ const children = [];
1568
+ if (blocks.length === 1 && blocks[0].type === "paragraph") {
1569
+ const p2 = blocks[0];
1570
+ children.push(...inlineTokens((_b = p2.tokens) != null ? _b : [], adapter, enc, ctx));
1571
+ } else {
1572
+ for (const b3 of blocks) {
1573
+ if (b3.type === "paragraph") {
1574
+ const p2 = b3;
1575
+ children.push(...inlineTokens((_c = p2.tokens) != null ? _c : [], adapter, enc, ctx));
1576
+ } else if (b3.type === "text") {
1577
+ const t = b3;
1578
+ const inline = t.tokens ? inlineTokens(t.tokens, adapter, enc, ctx) : [{ name: "text", attrs: { value: enc((_d = t.text) != null ? _d : "") } }];
1579
+ children.push(...inline);
1580
+ } else {
1581
+ const node = blockTok(b3, adapter, animate, enc, ctx);
1582
+ if (node) children.push(node);
1583
+ }
1584
+ }
1585
+ }
1586
+ return block("li", children, false, adapter, item);
1587
+ }
1588
+ function inlineTokens(tokens, adapter, enc, ctx) {
1589
+ const out = [];
1590
+ for (const tok of tokens) inlineTok(tok, adapter, enc, out, ctx);
1591
+ return out;
1592
+ }
1593
+ function inlineTok(tok, adapter, enc, out, ctx) {
1594
+ var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k;
1595
+ switch (tok.type) {
1596
+ case "text": {
1597
+ const t = tok;
1598
+ if (t.tokens && t.tokens.length) {
1599
+ for (const inner of t.tokens) inlineTok(inner, adapter, enc, out, ctx);
1600
+ } else {
1601
+ const value = enc((_a2 = t.text) != null ? _a2 : "");
1602
+ const node = inlineNode(adapter, { name: "text", attrs: { value } }, tok);
1603
+ if (value && node) out.push(node);
1604
+ }
1605
+ return;
1606
+ }
1607
+ case "escape": {
1608
+ const t = tok;
1609
+ const value = enc((_b = t.text) != null ? _b : "");
1610
+ const node = inlineNode(adapter, { name: "text", attrs: { value } }, tok);
1611
+ if (value && node) out.push(node);
1612
+ return;
1613
+ }
1614
+ case "strong": {
1615
+ const t = tok;
1616
+ const inner = [];
1617
+ for (const c2 of (_c = t.tokens) != null ? _c : []) inlineTok(c2, adapter, enc, inner, ctx);
1618
+ const node = inlineNode(adapter, { name: "strong", children: inner }, tok);
1619
+ if (node) out.push(node);
1620
+ return;
1621
+ }
1622
+ case "em": {
1623
+ const t = tok;
1624
+ const inner = [];
1625
+ for (const c2 of (_d = t.tokens) != null ? _d : []) inlineTok(c2, adapter, enc, inner, ctx);
1626
+ const node = inlineNode(adapter, { name: "em", children: inner }, tok);
1627
+ if (node) out.push(node);
1628
+ return;
1629
+ }
1630
+ case "del": {
1631
+ const t = tok;
1632
+ const inner = [];
1633
+ for (const c2 of (_e2 = t.tokens) != null ? _e2 : []) inlineTok(c2, adapter, enc, inner, ctx);
1634
+ const node = inlineNode(adapter, { name: "del", children: inner }, tok);
1635
+ if (node) out.push(node);
1636
+ return;
1637
+ }
1638
+ case "codespan": {
1639
+ const t = tok;
1640
+ const node = inlineNode(adapter, {
1641
+ name: "code",
1642
+ children: [{ name: "text", attrs: { value: enc((_f = t.text) != null ? _f : "") } }]
1643
+ }, tok);
1644
+ if (node) out.push(node);
1645
+ return;
1646
+ }
1647
+ case "br":
1648
+ {
1649
+ const node = inlineNode(adapter, { name: "br" }, tok);
1650
+ if (node) out.push(node);
1651
+ }
1652
+ return;
1653
+ case "link": {
1654
+ const t = tok;
1655
+ const inner = [];
1656
+ for (const c2 of (_g = t.tokens) != null ? _g : []) inlineTok(c2, adapter, enc, inner, ctx);
1657
+ const node = inlineNode(adapter, {
1658
+ name: "a",
1659
+ attrs: adapter.linkAttrs((_h = t.href) != null ? _h : "", t),
1660
+ children: inner.length ? inner : [{ name: "text", attrs: { value: "" } }]
1661
+ }, tok);
1662
+ if (node) out.push(node);
1663
+ return;
1664
+ }
1665
+ case "image": {
1666
+ const t = tok;
1667
+ const node = inlineNode(
1668
+ adapter,
1669
+ { name: "img", attrs: { src: adapter.imageSrc((_i = t.href) != null ? _i : "", t), alt: (_j = t.text) != null ? _j : "" } },
1670
+ tok
1671
+ );
1672
+ if (node) out.push(node);
1673
+ return;
1674
+ }
1675
+ case "html": {
1676
+ const t = tok;
1677
+ const node = inlineNode(adapter, { name: "text", attrs: { value: enc((_k = t.text) != null ? _k : "") } }, tok);
1678
+ if (node) out.push(node);
1679
+ return;
1680
+ }
1681
+ default: {
1682
+ const custom = renderCustomToken(tok, ctx);
1683
+ if (custom.length) out.push(...custom);
1684
+ return;
1685
+ }
1686
+ }
1687
+ }
1688
+
1689
+ // src/platforms/alipay/tokensToAlipay.ts
1690
+ function buildMarkedOptions(opts) {
1691
+ return { gfm: opts.gfm !== false, breaks: !!opts.breaks };
1692
+ }
1693
+ var alipayCapabilities = {
1694
+ supportsOlStart: false,
1695
+ requiresHttpsImage: true,
1696
+ anchorHrefMode: "href",
1697
+ supportsTable: true,
1698
+ supportsPre: true,
1699
+ supportsBlockquote: true
1700
+ };
1701
+ var alipayAdapter = {
1702
+ capabilities: alipayCapabilities,
1703
+ linkAttrs: (href) => ({ href }),
1704
+ imageSrc: (src) => src.replace(/^http:\/\//, "https://"),
1705
+ olAttrs: () => ({})
1706
+ };
1707
+ function tokensToAlipay(content, opts = {}) {
1708
+ const { options, ...ctx } = opts;
1709
+ const tokens = x.lex(content, buildMarkedOptions(options != null ? options : {}));
1710
+ return tokensToAlipayNodes(tokens, ctx);
1711
+ }
1712
+ function tokensToAlipayNodes(tokens, ctx = {}) {
1713
+ return renderTokensToMiniNodes(tokens, alipayAdapter, ctx);
1714
+ }
1715
+
1716
+ // src/platforms/alipay/index.ts
1717
+ var alipayRenderer = {
1718
+ name: "alipay",
1719
+ capabilities: alipayCapabilities,
1720
+ renderTokens: tokensToAlipayNodes
1721
+ };
1722
+
1723
+ // src/platforms/wechat/tokensToWechat.ts
1724
+ function buildMarkedOptions2(opts) {
1725
+ return { gfm: opts.gfm !== false, breaks: !!opts.breaks };
1726
+ }
1727
+ var wechatCapabilities = {
1728
+ supportsOlStart: true,
1729
+ requiresHttpsImage: false,
1730
+ anchorHrefMode: "data-href",
1731
+ supportsTable: true,
1732
+ supportsPre: true,
1733
+ supportsBlockquote: true
1734
+ };
1735
+ var wechatAdapter = {
1736
+ capabilities: wechatCapabilities,
1737
+ linkAttrs: (href) => ({ "data-href": href, class: "md-link" }),
1738
+ imageSrc: (src) => src,
1739
+ olAttrs: (start) => {
1740
+ const attrs = {};
1741
+ if (start !== 1) attrs.start = start;
1742
+ return attrs;
1743
+ }
1744
+ };
1745
+ function tokensToWechat(content, opts = {}) {
1746
+ const { options, ...ctx } = opts;
1747
+ const tokens = x.lex(content, buildMarkedOptions2(options != null ? options : {}));
1748
+ return tokensToWechatNodes(tokens, ctx);
1749
+ }
1750
+ function tokensToWechatNodes(tokens, ctx = {}) {
1751
+ return renderTokensToMiniNodes(tokens, wechatAdapter, ctx);
1752
+ }
1753
+
1754
+ // src/platforms/wechat/index.ts
1755
+ var wechatRenderer = {
1756
+ name: "wechat",
1757
+ capabilities: wechatCapabilities,
1758
+ renderTokens: tokensToWechatNodes
1759
+ };
1760
+
1761
+ // src/platforms/index.ts
1762
+ var DETECTORS = [
1763
+ {
1764
+ name: "my",
1765
+ read: () => typeof my !== "undefined" ? my : void 0,
1766
+ platform: "alipay"
1767
+ },
1768
+ {
1769
+ name: "wx",
1770
+ read: () => typeof wx !== "undefined" ? wx : void 0,
1771
+ platform: "wechat"
1772
+ }
1773
+ ];
1774
+ var DEFAULT_PLATFORM = "alipay";
1775
+ var RENDERERS = {
1776
+ alipay: alipayRenderer,
1777
+ wechat: wechatRenderer
1778
+ };
1779
+ function isRuntimeObject(obj) {
1780
+ if (!obj || typeof obj !== "object") return false;
1781
+ const target = obj;
1782
+ return typeof target.getSystemInfo === "function" || typeof target.getSystemInfoSync === "function";
1783
+ }
1784
+ function detectPlatformRuntime() {
1785
+ for (const { read, platform } of DETECTORS) {
1786
+ let obj;
1787
+ try {
1788
+ obj = read();
1789
+ } catch (e) {
1790
+ continue;
1791
+ }
1792
+ if (isRuntimeObject(obj)) {
1793
+ return platform;
1794
+ }
1795
+ }
1796
+ return DEFAULT_PLATFORM;
1797
+ }
1798
+ function resolvePlatform(platform) {
1799
+ if (!platform || platform === "auto") return detectPlatformRuntime();
1800
+ return platform;
1801
+ }
1802
+ function getPlatformRenderer(platform) {
1803
+ const renderer = RENDERERS[platform];
1804
+ if (!renderer) {
1805
+ throw new Error(`Unknown platform renderer: ${platform}`);
1806
+ }
1807
+ return renderer;
1808
+ }
1809
+ function registerPlatformRenderer(renderer) {
1810
+ RENDERERS[renderer.name] = renderer;
1811
+ }
1812
+
1813
+ // src/streaming/StreamingProcessor.ts
1814
+ var DEFAULT_DELIMITERS = /[。?!……;:——,、\n]/;
1815
+ var DEFAULT_MAX_CHUNK_SIZE = 80;
1816
+ function isZeroDelay(spec) {
1817
+ if (Array.isArray(spec)) return spec.length === 0 || spec.every((d3) => d3 === 0);
1818
+ return spec === 0;
1819
+ }
1820
+ function resolveDelay(spec, index) {
1821
+ if (Array.isArray(spec)) {
1822
+ if (spec.length === 0) return 0;
1823
+ return spec[Math.min(index, spec.length - 1)];
1824
+ }
1825
+ return spec;
1826
+ }
1827
+ var cachedSegmenter = null;
1828
+ var segmenterResolved = false;
1829
+ function splitGraphemes(text) {
1830
+ if (!segmenterResolved) {
1831
+ segmenterResolved = true;
1832
+ try {
1833
+ const Seg = Intl.Segmenter;
1834
+ if (Seg) cachedSegmenter = new Seg();
1835
+ } catch (e) {
1836
+ cachedSegmenter = null;
1837
+ }
1838
+ }
1839
+ if (cachedSegmenter) {
1840
+ const out = [];
1841
+ for (const s of cachedSegmenter.segment(text)) out.push(s.segment);
1842
+ return out;
1843
+ }
1844
+ return Array.from(text);
1845
+ }
1846
+ var StreamingProcessor = class {
1847
+ constructor(cfg) {
1848
+ this.buffer = "";
1849
+ this.renderedText = "";
1850
+ this.previousMarkdown = "";
1851
+ this.stableNodes = [];
1852
+ this.committedLen = 0;
1853
+ /** Whether the character at committedLen is inside a fenced code block (used for incremental scanning). */
1854
+ this.committedInFence = false;
1855
+ this.committedFenceChar = "";
1856
+ this.pendingChunks = [];
1857
+ this.chunkIndex = 0;
1858
+ /** 已渲染块的累计序号,用于数组变速延迟(charDelay/chunkDelay 为数组时按此取值)。 */
1859
+ this.chunkRenderIndex = 0;
1860
+ this.activeChunk = "";
1861
+ this.activeChunkOffset = 0;
1862
+ this.timer = null;
1863
+ this.currentHasNextChunk = false;
1864
+ var _a2, _b, _c, _d, _e2;
1865
+ this.config = {
1866
+ transform: cfg.transform,
1867
+ fixup: cfg.fixup,
1868
+ onUpdate: cfg.onUpdate,
1869
+ onPatch: cfg.onPatch,
1870
+ onComplete: cfg.onComplete,
1871
+ semanticEnabled: (_a2 = cfg.semanticEnabled) != null ? _a2 : true,
1872
+ delimiters: (_b = cfg.delimiters) != null ? _b : DEFAULT_DELIMITERS,
1873
+ maxChunkSize: (_c = cfg.maxChunkSize) != null ? _c : DEFAULT_MAX_CHUNK_SIZE,
1874
+ chunkDelay: (_d = cfg.chunkDelay) != null ? _d : 0,
1875
+ charDelay: (_e2 = cfg.charDelay) != null ? _e2 : 0
1876
+ };
1877
+ }
1878
+ /** 内容更新:增量则追加到 buffer,否则 reset 后整段替换。 */
1879
+ handleContentUpdate(content) {
1880
+ if (content.startsWith(this.previousMarkdown)) {
1881
+ this.buffer += content.slice(this.previousMarkdown.length);
1882
+ } else {
1883
+ this.reset();
1884
+ this.buffer = content;
1885
+ }
1886
+ this.previousMarkdown = content;
1887
+ }
1888
+ reset() {
1889
+ this.buffer = "";
1890
+ this.renderedText = "";
1891
+ this.previousMarkdown = "";
1892
+ this.pendingChunks = [];
1893
+ this.chunkIndex = 0;
1894
+ this.chunkRenderIndex = 0;
1895
+ this.activeChunk = "";
1896
+ this.activeChunkOffset = 0;
1897
+ this.stableNodes = [];
1898
+ this.committedLen = 0;
1899
+ this.committedInFence = false;
1900
+ this.committedFenceChar = "";
1901
+ this.cancelScheduledRender();
1902
+ }
1903
+ /**
1904
+ * 推进渲染。若 chunk/charDelay 都为 0,立即一次性 flush;否则进入打字机循环。
1905
+ */
1906
+ runRenderLoop(hasNextChunk) {
1907
+ this.currentHasNextChunk = hasNextChunk;
1908
+ const { chunkDelay, charDelay } = this.config;
1909
+ this.cancelScheduledRender();
1910
+ if (isZeroDelay(chunkDelay) && isZeroDelay(charDelay)) {
1911
+ if (this.buffer.length > 0) {
1912
+ this.renderedText += this.buffer;
1913
+ this.buffer = "";
1914
+ }
1915
+ this.flushNodes();
1916
+ if (!hasNextChunk) {
1917
+ this.config.onComplete();
1918
+ }
1919
+ return;
1920
+ }
1921
+ this.splitIntoChunks(hasNextChunk);
1922
+ this.chunkIndex = 0;
1923
+ this.scheduleNext();
1924
+ }
1925
+ /** 当前已输出给 UI 的完整 markdown 字符串 */
1926
+ getRenderedText() {
1927
+ return this.renderedText;
1928
+ }
1929
+ /** 是否还有待处理 chunks(外部可据此判断是否完成) */
1930
+ hasPendingChunks() {
1931
+ return this.chunkIndex < this.pendingChunks.length || this.buffer.length > 0;
1932
+ }
1933
+ // --- 内部 ---
1934
+ /** 按 delimiters + maxChunkSize 把 buffer 切成 chunk 序列;hasNext=false 时 flush 末尾。 */
1935
+ splitIntoChunks(hasNextChunk) {
1936
+ const { semanticEnabled, delimiters = DEFAULT_DELIMITERS, maxChunkSize = DEFAULT_MAX_CHUNK_SIZE } = this.config;
1937
+ const pending = [];
1938
+ let remaining = this.buffer;
1939
+ while (remaining.length > 0) {
1940
+ let chunk = "";
1941
+ if (semanticEnabled) {
1942
+ const m3 = remaining.match(delimiters);
1943
+ const cut = m3 ? remaining.indexOf(m3[0]) + 1 : -1;
1944
+ if (cut > 0) {
1945
+ chunk = remaining.slice(0, cut);
1946
+ remaining = remaining.slice(cut);
1947
+ } else if (remaining.length > maxChunkSize && hasNextChunk) {
1948
+ chunk = remaining.slice(0, maxChunkSize);
1949
+ remaining = remaining.slice(maxChunkSize);
1950
+ } else if (!hasNextChunk) {
1951
+ chunk = remaining;
1952
+ remaining = "";
1953
+ } else {
1954
+ break;
1955
+ }
1956
+ } else if (remaining.length > maxChunkSize) {
1957
+ chunk = remaining.slice(0, maxChunkSize);
1958
+ remaining = remaining.slice(maxChunkSize);
1959
+ } else if (!hasNextChunk) {
1960
+ chunk = remaining;
1961
+ remaining = "";
1962
+ } else {
1963
+ break;
1964
+ }
1965
+ if (chunk.length > 0) pending.push(chunk);
1966
+ }
1967
+ this.pendingChunks = pending;
1968
+ this.buffer = remaining;
1969
+ }
1970
+ scheduleNext() {
1971
+ const { chunkDelay, charDelay, onComplete } = this.config;
1972
+ const interChunkDelay = this.chunkIndex === 0 ? 0 : resolveDelay(chunkDelay, this.chunkRenderIndex);
1973
+ this.timer = setTimeout(() => {
1974
+ if (this.chunkIndex >= this.pendingChunks.length) {
1975
+ if (this.buffer.length > 0) {
1976
+ this.splitIntoChunks(this.currentHasNextChunk);
1977
+ this.scheduleNext();
1978
+ return;
1979
+ }
1980
+ this.timer = null;
1981
+ this.activeChunk = "";
1982
+ this.activeChunkOffset = 0;
1983
+ if (!this.currentHasNextChunk) onComplete();
1984
+ return;
1985
+ }
1986
+ const chunk = this.pendingChunks[this.chunkIndex];
1987
+ this.activeChunk = chunk;
1988
+ this.activeChunkOffset = 0;
1989
+ const cd = resolveDelay(charDelay, this.chunkRenderIndex);
1990
+ const graphemes = cd > 0 ? splitGraphemes(chunk) : null;
1991
+ if (cd > 0 && graphemes && graphemes.length > 1) {
1992
+ let gi = 0;
1993
+ let offset = 0;
1994
+ const step = () => {
1995
+ if (gi < graphemes.length) {
1996
+ const g3 = graphemes[gi++];
1997
+ this.renderedText += g3;
1998
+ offset += g3.length;
1999
+ this.activeChunkOffset = offset;
2000
+ this.flushNodes();
2001
+ this.timer = setTimeout(step, cd);
2002
+ } else {
2003
+ this.activeChunk = "";
2004
+ this.activeChunkOffset = 0;
2005
+ this.chunkIndex += 1;
2006
+ this.chunkRenderIndex += 1;
2007
+ this.scheduleNext();
2008
+ }
2009
+ };
2010
+ step();
2011
+ } else {
2012
+ this.renderedText += chunk;
2013
+ this.activeChunk = "";
2014
+ this.activeChunkOffset = 0;
2015
+ this.chunkIndex += 1;
2016
+ this.chunkRenderIndex += 1;
2017
+ this.flushNodes();
2018
+ this.scheduleNext();
2019
+ }
2020
+ }, interChunkDelay);
2021
+ }
2022
+ cancelScheduledRender() {
2023
+ if (this.timer) {
2024
+ clearTimeout(this.timer);
2025
+ this.timer = null;
2026
+ }
2027
+ let remaining = "";
2028
+ let startIndex = this.chunkIndex;
2029
+ if (this.activeChunk) {
2030
+ remaining += this.activeChunk.slice(this.activeChunkOffset);
2031
+ startIndex = this.chunkIndex + 1;
2032
+ }
2033
+ if (startIndex < this.pendingChunks.length) {
2034
+ remaining += this.pendingChunks.slice(startIndex).join("");
2035
+ }
2036
+ if (remaining) this.buffer = remaining + this.buffer;
2037
+ this.pendingChunks = [];
2038
+ this.chunkIndex = 0;
2039
+ this.activeChunk = "";
2040
+ this.activeChunkOffset = 0;
2041
+ }
2042
+ /** 推进 commit 点:从上次 committedLen 开始增量扫描,找 fenced code 之外的最后一段「双换行」位置。 */
2043
+ advanceCommit() {
2044
+ const text = this.renderedText;
2045
+ if (this.committedLen >= text.length) return;
2046
+ let inFence = this.committedInFence;
2047
+ let fenceChar = this.committedFenceChar;
2048
+ let lineStart = this.committedLen;
2049
+ if (this.committedLen > 0) {
2050
+ let ls = this.committedLen;
2051
+ while (ls > 0 && text[ls - 1] !== "\n") ls--;
2052
+ lineStart = ls;
2053
+ }
2054
+ let lastSafe = -1;
2055
+ let lastSafeInFence = false;
2056
+ let lastSafeFenceChar = "";
2057
+ let prevBlank = false;
2058
+ for (let i = lineStart; i <= text.length; i++) {
2059
+ if (i === text.length || text[i] === "\n") {
2060
+ const line = text.slice(lineStart, i);
2061
+ const fence = /^ {0,3}(`{3,}|~{3,})/.exec(line);
2062
+ if (fence) {
2063
+ if (!inFence) {
2064
+ inFence = true;
2065
+ fenceChar = fence[1][0];
2066
+ } else if (fence[1][0] === fenceChar) {
2067
+ inFence = false;
2068
+ fenceChar = "";
2069
+ }
2070
+ }
2071
+ const isBlank = line.trim() === "";
2072
+ if (!inFence && isBlank && prevBlank) {
2073
+ lastSafe = i === text.length ? i : i + 1;
2074
+ lastSafeInFence = inFence;
2075
+ lastSafeFenceChar = fenceChar;
2076
+ }
2077
+ prevBlank = isBlank && !inFence;
2078
+ lineStart = i + 1;
2079
+ }
2080
+ }
2081
+ if (lastSafe > this.committedLen) {
2082
+ const segment = text.slice(this.committedLen, lastSafe);
2083
+ const nodes = this.config.transform(segment);
2084
+ this.stableNodes.push(...nodes);
2085
+ this.committedLen = lastSafe;
2086
+ this.committedInFence = lastSafeInFence;
2087
+ this.committedFenceChar = lastSafeFenceChar;
2088
+ }
2089
+ }
2090
+ /** 重新解析 tail 部分,与 stableNodes 合并后 emit。 */
2091
+ flushNodes() {
2092
+ const { onUpdate, onPatch, transform, fixup } = this.config;
2093
+ onUpdate(this.renderedText);
2094
+ this.advanceCommit();
2095
+ const tail = this.renderedText.slice(this.committedLen);
2096
+ const fixedTail = tail && fixup ? fixup(tail) : tail;
2097
+ const tailNodes = fixedTail ? transform(fixedTail) : [];
2098
+ onPatch(this.stableNodes.concat(tailNodes));
2099
+ }
2100
+ };
2101
+
2102
+ // node_modules/remend/dist/index.js
2103
+ var cn = Object.defineProperty;
2104
+ var un = Object.defineProperties;
2105
+ var fn = Object.getOwnPropertyDescriptors;
2106
+ var $2 = Object.getOwnPropertySymbols;
2107
+ var dn = Object.prototype.hasOwnProperty;
2108
+ var gn = Object.prototype.propertyIsEnumerable;
2109
+ var O2 = (n, r, e) => r in n ? cn(n, r, { enumerable: true, configurable: true, writable: true, value: e }) : n[r] = e;
2110
+ var I2 = (n, r) => {
2111
+ for (var e in r || (r = {})) dn.call(r, e) && O2(n, e, r[e]);
2112
+ if ($2) for (var e of $2(r)) gn.call(r, e) && O2(n, e, r[e]);
2113
+ return n;
2114
+ };
2115
+ var k = (n, r) => un(n, fn(r));
2116
+ var c = (n, r) => {
2117
+ let e = false, i = false;
2118
+ for (let s = 0; s < r; s += 1) {
2119
+ if (n[s] === "\\" && s + 1 < n.length && n[s + 1] === "`") {
2120
+ s += 1;
2121
+ continue;
2122
+ }
2123
+ if (n.substring(s, s + 3) === "```") {
2124
+ i = !i, s += 2;
2125
+ continue;
2126
+ }
2127
+ !i && n[s] === "`" && (e = !e);
2128
+ }
2129
+ return e || i;
2130
+ };
2131
+ var hn = (n, r) => {
2132
+ let e = n.substring(r, r + 3) === "```", i = r > 0 && n.substring(r - 1, r + 2) === "```", s = r > 1 && n.substring(r - 2, r + 1) === "```";
2133
+ return e || i || s;
2134
+ };
2135
+ var L2 = (n) => {
2136
+ let r = 0;
2137
+ for (let e = 0; e < n.length; e += 1) {
2138
+ if (n[e] === "\\" && e + 1 < n.length && n[e + 1] === "`") {
2139
+ e += 1;
2140
+ continue;
2141
+ }
2142
+ n[e] === "`" && !hn(n, e) && (r += 1);
2143
+ }
2144
+ return r;
2145
+ };
2146
+ var f = (n, r) => {
2147
+ let e = false, i = false, s = -1;
2148
+ for (let o = 0; o < n.length; o += 1) {
2149
+ if (n[o] === "\\" && o + 1 < n.length && n[o + 1] === "`") {
2150
+ o += 1;
2151
+ continue;
2152
+ }
2153
+ if (n.substring(o, o + 3) === "```") {
2154
+ i = !i, o += 2;
2155
+ continue;
2156
+ }
2157
+ if (!i && n[o] === "`") if (e) {
2158
+ if (s < r && r < o) return true;
2159
+ e = false, s = -1;
2160
+ } else e = true, s = o;
2161
+ }
2162
+ return false;
2163
+ };
2164
+ var mn = /^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm;
2165
+ var E2 = (n) => !n || typeof n != "string" || !n.includes(">") ? n : n.replace(mn, (r, e, i, s) => c(n, s) ? r : `${e}\\>${i}`);
2166
+ var M2 = /(\*\*)([^*]*\*?)$/;
2167
+ var N2 = /(__)([^_]*?)$/;
2168
+ var y2 = /(\*\*\*)([^*]*?)$/;
2169
+ var R = /(\*)([^*]*?)$/;
2170
+ var U2 = /(_)([^_]*?)$/;
2171
+ var W2 = /(`)([^`]*?)$/;
2172
+ var K2 = /(~~)([^~]*?)$/;
2173
+ var d2 = /^[\s_~*`]*$/;
2174
+ var b2 = /^[\s]*[-*+][\s]+$/;
2175
+ var H2 = /[\p{L}\p{N}_]/u;
2176
+ var D2 = /^```[^`\n]*```?$/;
2177
+ var w2 = /^\*{4,}$/;
2178
+ var G2 = /(__)([^_]+)_$/;
2179
+ var F2 = /(~~)([^~]+)~$/;
2180
+ var T2 = /~~/g;
2181
+ var g2 = (n) => {
2182
+ if (!n) return false;
2183
+ let r = n.charCodeAt(0);
2184
+ return r >= 48 && r <= 57 || r >= 65 && r <= 90 || r >= 97 && r <= 122 || r === 95 ? true : H2.test(n);
2185
+ };
2186
+ var X2 = (n, r) => {
2187
+ let e = 1;
2188
+ for (let i = r - 1; i >= 0; i -= 1) if (n[i] === "]") e += 1;
2189
+ else if (n[i] === "[" && (e -= 1, e === 0)) return i;
2190
+ return -1;
2191
+ };
2192
+ var C = (n, r) => {
2193
+ let e = 1;
2194
+ for (let i = r + 1; i < n.length; i += 1) if (n[i] === "[") e += 1;
2195
+ else if (n[i] === "]" && (e -= 1, e === 0)) return i;
2196
+ return -1;
2197
+ };
2198
+ var h = (n, r) => {
2199
+ let e = false, i = false;
2200
+ for (let s = 0; s < n.length && s < r; s += 1) {
2201
+ if (n[s] === "\\" && n[s + 1] === "$") {
2202
+ s += 1;
2203
+ continue;
2204
+ }
2205
+ n[s] === "$" && (n[s + 1] === "$" ? (i = !i, s += 1, e = false) : i || (e = !e));
2206
+ }
2207
+ return e || i;
2208
+ };
2209
+ var In = (n, r) => {
2210
+ for (let e = r; e < n.length; e += 1) {
2211
+ if (n[e] === ")") return true;
2212
+ if (n[e] === `
2213
+ `) return false;
2214
+ }
2215
+ return false;
2216
+ };
2217
+ var m2 = (n, r) => {
2218
+ for (let e = r - 1; e >= 0; e -= 1) {
2219
+ if (n[e] === ")") return false;
2220
+ if (n[e] === "(") return e > 0 && n[e - 1] === "]" ? In(n, r) : false;
2221
+ if (n[e] === `
2222
+ `) return false;
2223
+ }
2224
+ return false;
2225
+ };
2226
+ var z2 = (n, r) => {
2227
+ for (let e = r - 1; e >= 0; e -= 1) {
2228
+ if (n[e] === ">") return false;
2229
+ if (n[e] === "<") {
2230
+ let i = e + 1 < n.length ? n[e + 1] : "";
2231
+ return i >= "a" && i <= "z" || i >= "A" && i <= "Z" || i === "/";
2232
+ }
2233
+ if (n[e] === `
2234
+ `) return false;
2235
+ }
2236
+ return false;
2237
+ };
2238
+ var p = (n, r, e) => {
2239
+ let i = 0;
2240
+ for (let l3 = r - 1; l3 >= 0; l3 -= 1) if (n[l3] === `
2241
+ `) {
2242
+ i = l3 + 1;
2243
+ break;
2244
+ }
2245
+ let s = n.length;
2246
+ for (let l3 = r; l3 < n.length; l3 += 1) if (n[l3] === `
2247
+ `) {
2248
+ s = l3;
2249
+ break;
2250
+ }
2251
+ let o = n.substring(i, s), t = 0, a = false;
2252
+ for (let l3 of o) if (l3 === e) t += 1;
2253
+ else if (l3 !== " " && l3 !== " ") {
2254
+ a = true;
2255
+ break;
2256
+ }
2257
+ return t >= 3 && !a;
2258
+ };
2259
+ var kn = (n, r, e, i) => e === "\\" || n.includes("$") && h(n, r) ? true : e !== "*" && i === "*" ? (r < n.length - 2 ? n[r + 2] : "") !== "*" : !!(e === "*" || e && i && g2(e) && g2(i) || (!e || e === " " || e === " " || e === `
2260
+ `) && (!i || i === " " || i === " " || i === `
2261
+ `));
2262
+ var Y2 = (n) => {
2263
+ let r = 0, e = false, i = n.length;
2264
+ for (let s = 0; s < i; s += 1) {
2265
+ if (n[s] === "`" && s + 2 < i && n[s + 1] === "`" && n[s + 2] === "`") {
2266
+ e = !e, s += 2;
2267
+ continue;
2268
+ }
2269
+ if (e || n[s] !== "*") continue;
2270
+ let o = s > 0 ? n[s - 1] : "", t = s < i - 1 ? n[s + 1] : "";
2271
+ kn(n, s, o, t) || (r += 1);
2272
+ }
2273
+ return r;
2274
+ };
2275
+ var bn = (n, r, e, i) => !!(e === "\\" || n.includes("$") && h(n, r) || m2(n, r) || z2(n, r) || e === "_" || i === "_" || e && i && g2(e) && g2(i));
2276
+ var Tn = (n) => {
2277
+ let r = 0, e = false, i = n.length;
2278
+ for (let s = 0; s < i; s += 1) {
2279
+ if (n[s] === "`" && s + 2 < i && n[s + 1] === "`" && n[s + 2] === "`") {
2280
+ e = !e, s += 2;
2281
+ continue;
2282
+ }
2283
+ if (e || n[s] !== "_") continue;
2284
+ let o = s > 0 ? n[s - 1] : "", t = s < i - 1 ? n[s + 1] : "";
2285
+ bn(n, s, o, t) || (r += 1);
2286
+ }
2287
+ return r;
2288
+ };
2289
+ var Cn = (n) => {
2290
+ let r = 0, e = 0, i = false;
2291
+ for (let s = 0; s < n.length; s += 1) {
2292
+ if (n[s] === "`" && s + 2 < n.length && n[s + 1] === "`" && n[s + 2] === "`") {
2293
+ e >= 3 && (r += Math.floor(e / 3)), e = 0, i = !i, s += 2;
2294
+ continue;
2295
+ }
2296
+ i || (n[s] === "*" ? e += 1 : (e >= 3 && (r += Math.floor(e / 3)), e = 0));
2297
+ }
2298
+ return e >= 3 && (r += Math.floor(e / 3)), r;
2299
+ };
2300
+ var A2 = (n) => {
2301
+ let r = 0, e = false;
2302
+ for (let i = 0; i < n.length; i += 1) {
2303
+ if (n[i] === "`" && i + 2 < n.length && n[i + 1] === "`" && n[i + 2] === "`") {
2304
+ e = !e, i += 2;
2305
+ continue;
2306
+ }
2307
+ e || n[i] === "*" && i + 1 < n.length && n[i + 1] === "*" && (r += 1, i += 1);
2308
+ }
2309
+ return r;
2310
+ };
2311
+ var v2 = (n) => {
2312
+ let r = 0, e = false;
2313
+ for (let i = 0; i < n.length; i += 1) {
2314
+ if (n[i] === "`" && i + 2 < n.length && n[i + 1] === "`" && n[i + 2] === "`") {
2315
+ e = !e, i += 2;
2316
+ continue;
2317
+ }
2318
+ e || n[i] === "_" && i + 1 < n.length && n[i + 1] === "_" && (r += 1, i += 1);
2319
+ }
2320
+ return r;
2321
+ };
2322
+ var An = (n, r, e) => {
2323
+ if (!r || d2.test(r)) return true;
2324
+ let s = n.substring(0, e).lastIndexOf(`
2325
+ `), o = s === -1 ? 0 : s + 1, t = n.substring(o, e);
2326
+ return b2.test(t) && r.includes(`
2327
+ `) ? true : p(n, e, "*");
2328
+ };
2329
+ var j2 = (n) => {
2330
+ let r = n.match(M2);
2331
+ if (!r) return n;
2332
+ let e = r[2], i = n.lastIndexOf(r[1]);
2333
+ return c(n, i) || f(n, i) || An(n, e, i) ? n : A2(n) % 2 === 1 ? e.endsWith("*") ? `${n}*` : `${n}**` : n;
2334
+ };
2335
+ var Bn = (n, r, e) => {
2336
+ if (!r || d2.test(r)) return true;
2337
+ let s = n.substring(0, e).lastIndexOf(`
2338
+ `), o = s === -1 ? 0 : s + 1, t = n.substring(o, e);
2339
+ return b2.test(t) && r.includes(`
2340
+ `) ? true : p(n, e, "_");
2341
+ };
2342
+ var Q2 = (n) => {
2343
+ let r = n.match(N2);
2344
+ if (!r) {
2345
+ let o = n.match(G2);
2346
+ if (o) {
2347
+ let t = n.lastIndexOf(o[1]);
2348
+ if (!(c(n, t) || f(n, t)) && v2(n) % 2 === 1) return `${n}_`;
2349
+ }
2350
+ return n;
2351
+ }
2352
+ let e = r[2], i = n.lastIndexOf(r[1]);
2353
+ return c(n, i) || f(n, i) || Bn(n, e, i) ? n : v2(n) % 2 === 1 ? `${n}__` : n;
2354
+ };
2355
+ var Sn = (n) => {
2356
+ let r = false;
2357
+ for (let e = 0; e < n.length; e += 1) {
2358
+ if (n[e] === "`" && e + 2 < n.length && n[e + 1] === "`" && n[e + 2] === "`") {
2359
+ r = !r, e += 2;
2360
+ continue;
2361
+ }
2362
+ if (!r && n[e] === "*" && n[e - 1] !== "*" && n[e + 1] !== "*" && n[e - 1] !== "\\" && !h(n, e)) {
2363
+ let i = e > 0 ? n[e - 1] : "", s = e < n.length - 1 ? n[e + 1] : "";
2364
+ if ((!i || i === " " || i === " " || i === `
2365
+ `) && (!s || s === " " || s === " " || s === `
2366
+ `) || i && s && g2(i) && g2(s)) continue;
2367
+ return e;
2368
+ }
2369
+ }
2370
+ return -1;
2371
+ };
2372
+ var Z = (n) => {
2373
+ if (!n.match(R)) return n;
2374
+ let e = Sn(n);
2375
+ if (e === -1 || c(n, e) || f(n, e)) return n;
2376
+ let i = n.substring(e + 1);
2377
+ return !i || d2.test(i) ? n : Y2(n) % 2 === 1 ? `${n}*` : n;
2378
+ };
2379
+ var q2 = (n) => {
2380
+ let r = false;
2381
+ for (let e = 0; e < n.length; e += 1) {
2382
+ if (n[e] === "`" && e + 2 < n.length && n[e + 1] === "`" && n[e + 2] === "`") {
2383
+ r = !r, e += 2;
2384
+ continue;
2385
+ }
2386
+ if (!r && n[e] === "_" && n[e - 1] !== "_" && n[e + 1] !== "_" && n[e - 1] !== "\\" && !h(n, e) && !m2(n, e)) {
2387
+ let i = e > 0 ? n[e - 1] : "", s = e < n.length - 1 ? n[e + 1] : "";
2388
+ if (i && s && g2(i) && g2(s)) continue;
2389
+ return e;
2390
+ }
2391
+ }
2392
+ return -1;
2393
+ };
2394
+ var _n = (n) => {
2395
+ let r = n.length;
2396
+ for (; r > 0 && n[r - 1] === `
2397
+ `; ) r -= 1;
2398
+ if (r < n.length) {
2399
+ let e = n.slice(0, r), i = n.slice(r);
2400
+ return `${e}_${i}`;
2401
+ }
2402
+ return `${n}_`;
2403
+ };
2404
+ var Pn = (n) => {
2405
+ if (!n.endsWith("**")) return null;
2406
+ let r = n.slice(0, -2);
2407
+ if (A2(r) % 2 !== 1) return null;
2408
+ let i = r.indexOf("**"), s = q2(r);
2409
+ return i !== -1 && s !== -1 && i < s ? `${r}_**` : null;
2410
+ };
2411
+ var J2 = (n) => {
2412
+ if (!n.match(U2)) return n;
2413
+ let e = q2(n);
2414
+ if (e === -1) return n;
2415
+ let i = n.substring(e + 1);
2416
+ if (!i || d2.test(i) || c(n, e) || f(n, e)) return n;
2417
+ if (Tn(n) % 2 === 1) {
2418
+ let o = Pn(n);
2419
+ return o !== null ? o : _n(n);
2420
+ }
2421
+ return n;
2422
+ };
2423
+ var $n = (n) => {
2424
+ let r = A2(n), e = Y2(n);
2425
+ return r % 2 === 0 && e % 2 === 0;
2426
+ };
2427
+ var On = (n, r, e) => !r || d2.test(r) || c(n, e) || f(n, e) ? true : p(n, e, "*");
2428
+ var V2 = (n) => {
2429
+ if (w2.test(n)) return n;
2430
+ let r = n.match(y2);
2431
+ if (!r) return n;
2432
+ let e = r[2], i = n.lastIndexOf(r[1]);
2433
+ return On(n, e, i) ? n : Cn(n) % 2 === 1 ? $n(n) ? n : `${n}***` : n;
2434
+ };
2435
+ var Ln = /<[a-zA-Z/][^>]*$/;
2436
+ var x2 = (n) => {
2437
+ let r = n.match(Ln);
2438
+ return !r || r.index === void 0 || c(n, r.index) ? n : n.substring(0, r.index).trimEnd();
2439
+ };
2440
+ var En = (n) => !n.match(D2) || n.includes(`
2441
+ `) ? null : n.endsWith("``") && !n.endsWith("```") ? `${n}\`` : n;
2442
+ var Mn = (n) => (n.match(/```/g) || []).length % 2 === 1;
2443
+ var nn = (n) => {
2444
+ let r = En(n);
2445
+ if (r !== null) return r;
2446
+ let e = n.match(W2);
2447
+ if (e && !Mn(n)) {
2448
+ let i = e[2];
2449
+ if (!i || d2.test(i)) return n;
2450
+ if (L2(n) % 2 === 1) return `${n}\``;
2451
+ }
2452
+ return n;
2453
+ };
2454
+ var en = (n, r) => r >= 2 && n.substring(r - 2, r + 1) === "```" || r >= 1 && n.substring(r - 1, r + 2) === "```" || r <= n.length - 3 && n.substring(r, r + 3) === "```";
2455
+ var Nn = (n) => {
2456
+ let r = 0, e = false;
2457
+ for (let i = 0; i < n.length - 1; i += 1) n[i] === "`" && !en(n, i) && (e = !e), !e && n[i] === "$" && n[i + 1] === "$" && (r += 1, i += 1);
2458
+ return r;
2459
+ };
2460
+ var yn = (n) => {
2461
+ let r = 0, e = false;
2462
+ for (let i = 0; i < n.length; i += 1) {
2463
+ if (n[i] === "\\") {
2464
+ i += 1;
2465
+ continue;
2466
+ }
2467
+ if (n[i] === "`" && !en(n, i)) {
2468
+ e = !e;
2469
+ continue;
2470
+ }
2471
+ !e && n[i] === "$" && (i + 1 < n.length && n[i + 1] === "$" ? i += 1 : r += 1);
2472
+ }
2473
+ return r;
2474
+ };
2475
+ var Rn = (n) => {
2476
+ if (n.endsWith("$") && !n.endsWith("$$")) return `${n}$`;
2477
+ let r = n.indexOf("$$");
2478
+ return r !== -1 && n.indexOf(`
2479
+ `, r) !== -1 && !n.endsWith(`
2480
+ `) ? `${n}
2481
+ $$` : `${n}$$`;
2482
+ };
2483
+ var rn = (n) => Nn(n) % 2 === 0 ? n : Rn(n);
2484
+ var sn = (n) => yn(n) % 2 === 1 ? `${n}$` : n;
2485
+ var Un = (n, r, e) => {
2486
+ if (n.substring(r + 2).includes(")")) return null;
2487
+ let s = X2(n, r);
2488
+ if (s === -1 || c(n, s)) return null;
2489
+ let o = s > 0 && n[s - 1] === "!", t = o ? s - 1 : s, a = n.substring(0, t);
2490
+ if (o) return a;
2491
+ let l3 = n.substring(s + 1, r);
2492
+ return e === "text-only" ? `${a}${l3}` : `${a}[${l3}](streamdown:incomplete-link)`;
2493
+ };
2494
+ var on = (n, r) => {
2495
+ for (let e = 0; e < r; e++) if (n[e] === "[" && !c(n, e)) {
2496
+ if (e > 0 && n[e - 1] === "!") continue;
2497
+ let i = C(n, e);
2498
+ if (i === -1) return e;
2499
+ if (i + 1 < n.length && n[i + 1] === "(") {
2500
+ let s = n.indexOf(")", i + 2);
2501
+ s !== -1 && (e = s);
2502
+ }
2503
+ }
2504
+ return r;
2505
+ };
2506
+ var Wn = (n, r, e) => {
2507
+ let i = r > 0 && n[r - 1] === "!", s = i ? r - 1 : r;
2508
+ if (!n.substring(r + 1).includes("]")) {
2509
+ let a = n.substring(0, s);
2510
+ if (i) return a;
2511
+ if (e === "text-only") {
2512
+ let l3 = on(n, r);
2513
+ return n.substring(0, l3) + n.substring(l3 + 1);
2514
+ }
2515
+ return `${n}](streamdown:incomplete-link)`;
2516
+ }
2517
+ if (C(n, r) === -1) {
2518
+ let a = n.substring(0, s);
2519
+ if (i) return a;
2520
+ if (e === "text-only") {
2521
+ let l3 = on(n, r);
2522
+ return n.substring(0, l3) + n.substring(l3 + 1);
2523
+ }
2524
+ return `${n}](streamdown:incomplete-link)`;
2525
+ }
2526
+ return null;
2527
+ };
2528
+ var B2 = (n, r = "protocol") => {
2529
+ let e = n.lastIndexOf("](");
2530
+ if (e !== -1 && !c(n, e)) {
2531
+ let i = Un(n, e, r);
2532
+ if (i !== null) return i;
2533
+ }
2534
+ for (let i = n.length - 1; i >= 0; i -= 1) if (n[i] === "[" && !c(n, i)) {
2535
+ let s = Wn(n, i, r);
2536
+ if (s !== null) return s;
2537
+ }
2538
+ return n;
2539
+ };
2540
+ var Kn = /^-{1,2}$/;
2541
+ var Hn = /^[\s]*-{1,2}[\s]+$/;
2542
+ var Dn = /^={1,2}$/;
2543
+ var wn = /^[\s]*={1,2}[\s]+$/;
2544
+ var ln = (n) => {
2545
+ if (!n || typeof n != "string") return n;
2546
+ let r = n.lastIndexOf(`
2547
+ `);
2548
+ if (r === -1) return n;
2549
+ let e = n.substring(r + 1), i = n.substring(0, r), s = e.trim();
2550
+ if (Kn.test(s) && !e.match(Hn)) {
2551
+ let t = i.split(`
2552
+ `).at(-1);
2553
+ if (t && t.trim().length > 0) return `${n}\u200B`;
2554
+ }
2555
+ if (Dn.test(s) && !e.match(wn)) {
2556
+ let t = i.split(`
2557
+ `).at(-1);
2558
+ if (t && t.trim().length > 0) return `${n}\u200B`;
2559
+ }
2560
+ return n;
2561
+ };
2562
+ var Gn = new RegExp("(?<=[\\p{L}\\p{N}_])~(?!~)(?=[\\p{L}\\p{N}_])", "gu");
2563
+ var tn = (n) => !n || typeof n != "string" || !n.includes("~") ? n : n.replace(Gn, (r, e) => c(n, e) ? r : "\\~");
2564
+ var an = (n) => {
2565
+ var e, i;
2566
+ let r = n.match(K2);
2567
+ if (r) {
2568
+ let s = r[2];
2569
+ if (!s || d2.test(s)) return n;
2570
+ let o = n.lastIndexOf(r[1]);
2571
+ if (c(n, o) || f(n, o)) return n;
2572
+ if (((e = n.match(T2)) == null ? void 0 : e.length) % 2 === 1) return `${n}~~`;
2573
+ } else {
2574
+ let s = n.match(F2);
2575
+ if (s) {
2576
+ let o = n.lastIndexOf(s[0].slice(0, 2));
2577
+ if (c(n, o) || f(n, o)) return n;
2578
+ if (((i = n.match(T2)) == null ? void 0 : i.length) % 2 === 1) return `${n}~`;
2579
+ }
2580
+ }
2581
+ return n;
2582
+ };
2583
+ var S = (n) => n !== false;
2584
+ var Fn = (n) => n === true;
2585
+ var u = { SINGLE_TILDE: 0, COMPARISON_OPERATORS: 5, HTML_TAGS: 10, SETEXT_HEADINGS: 15, LINKS: 20, BOLD_ITALIC: 30, BOLD: 35, ITALIC_DOUBLE_UNDERSCORE: 40, ITALIC_SINGLE_ASTERISK: 41, ITALIC_SINGLE_UNDERSCORE: 42, INLINE_CODE: 50, STRIKETHROUGH: 60, KATEX: 70, INLINE_KATEX: 75, DEFAULT: 100 };
2586
+ var Xn = [{ handler: { name: "singleTilde", handle: tn, priority: u.SINGLE_TILDE }, optionKey: "singleTilde" }, { handler: { name: "comparisonOperators", handle: E2, priority: u.COMPARISON_OPERATORS }, optionKey: "comparisonOperators" }, { handler: { name: "htmlTags", handle: x2, priority: u.HTML_TAGS }, optionKey: "htmlTags" }, { handler: { name: "setextHeadings", handle: ln, priority: u.SETEXT_HEADINGS }, optionKey: "setextHeadings" }, { handler: { name: "links", handle: B2, priority: u.LINKS }, optionKey: "links", earlyReturn: (n) => n.endsWith("](streamdown:incomplete-link)") }, { handler: { name: "boldItalic", handle: V2, priority: u.BOLD_ITALIC }, optionKey: "boldItalic" }, { handler: { name: "bold", handle: j2, priority: u.BOLD }, optionKey: "bold" }, { handler: { name: "italicDoubleUnderscore", handle: Q2, priority: u.ITALIC_DOUBLE_UNDERSCORE }, optionKey: "italic" }, { handler: { name: "italicSingleAsterisk", handle: Z, priority: u.ITALIC_SINGLE_ASTERISK }, optionKey: "italic" }, { handler: { name: "italicSingleUnderscore", handle: J2, priority: u.ITALIC_SINGLE_UNDERSCORE }, optionKey: "italic" }, { handler: { name: "inlineCode", handle: nn, priority: u.INLINE_CODE }, optionKey: "inlineCode" }, { handler: { name: "strikethrough", handle: an, priority: u.STRIKETHROUGH }, optionKey: "strikethrough" }, { handler: { name: "katex", handle: rn, priority: u.KATEX }, optionKey: "katex" }, { handler: { name: "inlineKatex", handle: sn, priority: u.INLINE_KATEX }, optionKey: "inlineKatex" }];
2587
+ var zn = (n) => {
2588
+ var e;
2589
+ let r = (e = n == null ? void 0 : n.linkMode) != null ? e : "protocol";
2590
+ return Xn.filter(({ handler: i, optionKey: s }) => i.name === "links" ? S(n == null ? void 0 : n.links) || S(n == null ? void 0 : n.images) : i.name === "inlineKatex" ? Fn(n == null ? void 0 : n.inlineKatex) : S(n == null ? void 0 : n[s])).map(({ handler: i, earlyReturn: s }) => i.name === "links" ? { handler: k(I2({}, i), { handle: (o) => B2(o, r) }), earlyReturn: r === "protocol" ? s : void 0 } : { handler: i, earlyReturn: s });
2591
+ };
2592
+ var vn = (n, r) => {
2593
+ var t;
2594
+ if (!n || typeof n != "string") return n;
2595
+ let e = n.endsWith(" ") && !n.endsWith(" ") ? n.slice(0, -1) : n, i = zn(r), s = ((t = r == null ? void 0 : r.handlers) != null ? t : []).map((a) => {
2596
+ var l3;
2597
+ return { handler: k(I2({}, a), { priority: (l3 = a.priority) != null ? l3 : u.DEFAULT }), earlyReturn: void 0 };
2598
+ }), o = [...i, ...s].sort((a, l3) => {
2599
+ var _2, P2;
2600
+ return ((_2 = a.handler.priority) != null ? _2 : 0) - ((P2 = l3.handler.priority) != null ? P2 : 0);
2601
+ });
2602
+ for (let { handler: a, earlyReturn: l3 } of o) if (e = a.handle(e), l3 != null && l3(e)) return e;
2603
+ return e;
2604
+ };
2605
+ var $e2 = vn;
2606
+
2607
+ // src/streaming/config.ts
2608
+ function resolveStreamingFixup(fixup) {
2609
+ if (fixup === false) return void 0;
2610
+ if (fixup === "remend") return (s) => $e2(s);
2611
+ return fixup;
2612
+ }
2613
+ function normalizeStreamingConfig(streaming) {
2614
+ var _a2, _b;
2615
+ if (!streaming) return null;
2616
+ if (streaming === true) {
2617
+ return {
2618
+ hasNextChunk: true,
2619
+ semanticEnabled: true,
2620
+ semanticConfig: {},
2621
+ enableAnimation: true
2622
+ };
2623
+ }
2624
+ const semantic = (_a2 = streaming.semantic) != null ? _a2 : true;
2625
+ return {
2626
+ hasNextChunk: streaming.hasNextChunk,
2627
+ semanticEnabled: semantic !== false,
2628
+ semanticConfig: typeof semantic === "object" ? semantic : {},
2629
+ enableAnimation: (_b = streaming.enableAnimation) != null ? _b : true
2630
+ };
2631
+ }
2632
+
2633
+ // src/XMarkdownMini.ts
2634
+ var ATTR_RE = /([a-zA-Z_][a-zA-Z0-9_:-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;
2635
+ function parseAttrs(src) {
2636
+ var _a2, _b;
2637
+ const out = {};
2638
+ if (!src) return out;
2639
+ ATTR_RE.lastIndex = 0;
2640
+ let m3;
2641
+ while ((m3 = ATTR_RE.exec(src)) !== null) {
2642
+ const name = m3[1];
2643
+ const value = (_b = (_a2 = m3[2]) != null ? _a2 : m3[3]) != null ? _b : m3[4];
2644
+ out[name] = value === void 0 ? true : value;
2645
+ }
2646
+ return out;
2647
+ }
2648
+ function synthesizeComponentsExtension(tags) {
2649
+ const entries = tags.map((tag) => {
2650
+ const safeTag = tag.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2651
+ const tagRe = new RegExp(
2652
+ `^<${safeTag}(?:\\s+([^>]*?))?\\s*(\\/)?>(?:([\\s\\S]*?)<\\/${safeTag}>)?`
2653
+ );
2654
+ return {
2655
+ name: `customTag:${tag}`,
2656
+ level: "inline",
2657
+ start(src) {
2658
+ const i = src.indexOf(`<${tag}`);
2659
+ return i < 0 ? void 0 : i;
2660
+ },
2661
+ tokenizer(src) {
2662
+ var _a2, _b, _c;
2663
+ const m3 = tagRe.exec(src);
2664
+ if (!m3) return void 0;
2665
+ const attrsStr = (_a2 = m3[1]) != null ? _a2 : "";
2666
+ const selfClosing = m3[2] === "/";
2667
+ const inner = selfClosing ? "" : (_b = m3[3]) != null ? _b : "";
2668
+ if (!selfClosing && m3[3] === void 0) return void 0;
2669
+ const attrs = parseAttrs(attrsStr);
2670
+ const innerTokens = [];
2671
+ if (inner.length > 0 && typeof ((_c = this == null ? void 0 : this.lexer) == null ? void 0 : _c.inlineTokens) === "function") {
2672
+ this.lexer.inlineTokens(inner, innerTokens);
2673
+ }
2674
+ return {
2675
+ type: `customTag:${tag}`,
2676
+ raw: m3[0],
2677
+ tag,
2678
+ attrs,
2679
+ tokens: innerTokens
2680
+ };
2681
+ },
2682
+ miniRenderer(token, ctx) {
2683
+ var _a2, _b;
2684
+ const t = token;
2685
+ const node = { name: t.tag, tag: t.tag };
2686
+ if (t.attrs && Object.keys(t.attrs).length > 0) {
2687
+ node.attrs = t.attrs;
2688
+ }
2689
+ const inner = t.tokens && t.tokens.length > 0 ? (_b = (_a2 = ctx.renderInlineTokens) == null ? void 0 : _a2.call(ctx, t.tokens)) != null ? _b : [] : [];
2690
+ if (inner.length > 0) node.children = inner;
2691
+ return node;
2692
+ }
2693
+ };
2694
+ });
2695
+ return { extensions: entries };
2696
+ }
2697
+ var XMarkdownMini = class {
2698
+ constructor(opts = {}) {
2699
+ this.tokenStreamProcessor = null;
2700
+ this.nodeStreamProcessor = null;
2701
+ this.activeTokenStreamDefaults = null;
2702
+ this.activeNodeStreamDefaults = null;
2703
+ var _a2, _b, _c;
2704
+ this.escapeText = (_a2 = opts.escapeText) != null ? _a2 : true;
2705
+ this.fixup = resolveStreamingFixup((_b = opts.streamingFixup) != null ? _b : "remend");
2706
+ this.gfm = opts.gfm;
2707
+ this.breaks = opts.breaks;
2708
+ const directExtensions = (_c = opts.extensions) != null ? _c : [];
2709
+ this.componentsExtension = opts.components && opts.components.length > 0 ? synthesizeComponentsExtension(opts.components) : void 0;
2710
+ const allMarkedExtensions = [
2711
+ ...directExtensions,
2712
+ ...this.componentsExtension ? [this.componentsExtension] : []
2713
+ ];
2714
+ this.extensions = directExtensions;
2715
+ this.marked = new D(...allMarkedExtensions);
2716
+ }
2717
+ /**
2718
+ * Build the full RenderContext.extensions list for a render call.
2719
+ * Per-call extensions replace instance-level user extensions; the
2720
+ * components extension is always appended so that `<custom-tag>` sugar
2721
+ * continues to work regardless of per-call overrides.
2722
+ */
2723
+ resolveExtensions(perCall) {
2724
+ if (!perCall || perCall.length === 0) {
2725
+ return [
2726
+ ...this.extensions,
2727
+ ...this.componentsExtension ? [this.componentsExtension] : []
2728
+ ];
2729
+ }
2730
+ return [
2731
+ ...perCall,
2732
+ ...this.componentsExtension ? [this.componentsExtension] : []
2733
+ ];
2734
+ }
2735
+ /**
2736
+ * Register per-call extensions with the Marked instance and return a
2737
+ * snapshot of the previous defaults so they can be restored after the call.
2738
+ * Returns `null` if nothing to apply (no per-call extensions).
2739
+ */
2740
+ applyPerCallExtensions(perCall) {
2741
+ if (!perCall || perCall.length === 0) return null;
2742
+ const saved = { ...this.marked.defaults };
2743
+ this.marked.use(...perCall);
2744
+ return saved;
2745
+ }
2746
+ restoreDefaults(saved) {
2747
+ if (saved) this.marked.defaults = saved;
2748
+ }
2749
+ buildMarkedOptions(perCall) {
2750
+ var _a2, _b;
2751
+ const gfm = (_a2 = perCall == null ? void 0 : perCall.gfm) != null ? _a2 : this.gfm;
2752
+ const breaks = (_b = perCall == null ? void 0 : perCall.breaks) != null ? _b : this.breaks;
2753
+ return {
2754
+ ...this.marked.defaults,
2755
+ ...gfm !== void 0 ? { gfm: gfm !== false } : {},
2756
+ ...breaks !== void 0 ? { breaks: !!breaks } : {}
2757
+ };
2758
+ }
2759
+ lex(content, opts) {
2760
+ const tokens = this.marked.lexer(content, opts != null ? opts : this.buildMarkedOptions());
2761
+ const walkFn = this.marked.defaults.walkTokens;
2762
+ if (typeof walkFn === "function") {
2763
+ this.marked.walkTokens(tokens, walkFn);
2764
+ }
2765
+ return tokens;
2766
+ }
2767
+ /**
2768
+ * Parses markdown into marked's native Token[] without platform rendering.
2769
+ */
2770
+ parse(content) {
2771
+ return this.lex(content, this.buildMarkedOptions());
2772
+ }
2773
+ render(input) {
2774
+ if (typeof input === "string") return this.parse(input);
2775
+ return this.renderTokens(input);
2776
+ }
2777
+ /**
2778
+ * Token streaming entry. AI streaming fixup runs on markdown text before lex.
2779
+ */
2780
+ renderTokens(props) {
2781
+ var _a2, _b, _c, _d;
2782
+ const { content, gfm, breaks, extensions: perCallExts } = props;
2783
+ const stream = normalizeStreamingConfig(props.streaming);
2784
+ if (!stream) {
2785
+ this.tokenStreamProcessor = null;
2786
+ this.restoreDefaults(this.activeTokenStreamDefaults);
2787
+ this.activeTokenStreamDefaults = null;
2788
+ const saved = this.applyPerCallExtensions(perCallExts);
2789
+ try {
2790
+ const markedOpts = this.buildMarkedOptions({ gfm, breaks });
2791
+ (_a2 = props.onRenderStart) == null ? void 0 : _a2.call(props);
2792
+ const tokens = this.lex(content, markedOpts);
2793
+ (_b = props.onPatch) == null ? void 0 : _b.call(props, tokens);
2794
+ (_c = props.onRenderComplete) == null ? void 0 : _c.call(props);
2795
+ return tokens;
2796
+ } finally {
2797
+ this.restoreDefaults(saved);
2798
+ }
2799
+ }
2800
+ if (!this.tokenStreamProcessor) {
2801
+ this.activeTokenStreamDefaults = this.applyPerCallExtensions(perCallExts);
2802
+ const markedOpts = this.buildMarkedOptions({ gfm, breaks });
2803
+ const transform = (md) => this.lex(md, markedOpts);
2804
+ this.tokenStreamProcessor = new StreamingProcessor({
2805
+ transform,
2806
+ fixup: this.fixup,
2807
+ semanticEnabled: stream.semanticEnabled,
2808
+ ...stream.semanticConfig,
2809
+ onUpdate: (markdown) => {
2810
+ var _a3;
2811
+ return (_a3 = props.onRenderProgress) == null ? void 0 : _a3.call(props, { markdown });
2812
+ },
2813
+ onPatch: (tokens) => {
2814
+ var _a3;
2815
+ return (_a3 = props.onPatch) == null ? void 0 : _a3.call(props, tokens);
2816
+ },
2817
+ onComplete: () => {
2818
+ var _a3;
2819
+ (_a3 = props.onRenderComplete) == null ? void 0 : _a3.call(props);
2820
+ this.tokenStreamProcessor = null;
2821
+ this.restoreDefaults(this.activeTokenStreamDefaults);
2822
+ this.activeTokenStreamDefaults = null;
2823
+ }
2824
+ });
2825
+ (_d = props.onRenderStart) == null ? void 0 : _d.call(props);
2826
+ }
2827
+ this.tokenStreamProcessor.handleContentUpdate(content);
2828
+ this.tokenStreamProcessor.runRenderLoop(stream.hasNextChunk);
2829
+ return [];
2830
+ }
2831
+ /**
2832
+ * Component/node entry. Tokens are rendered by the selected platform renderer.
2833
+ */
2834
+ renderNodes(props) {
2835
+ var _a2, _b, _c, _d;
2836
+ const { content, platform = "auto", selectable = true, gfm, breaks, extensions: perCallExts } = props;
2837
+ const target = resolvePlatform(platform);
2838
+ const renderer = getPlatformRenderer(target);
2839
+ const stream = normalizeStreamingConfig(props.streaming);
2840
+ const ctxExtensions = this.resolveExtensions(perCallExts);
2841
+ if (!stream) {
2842
+ this.nodeStreamProcessor = null;
2843
+ this.restoreDefaults(this.activeNodeStreamDefaults);
2844
+ this.activeNodeStreamDefaults = null;
2845
+ const saved = this.applyPerCallExtensions(perCallExts);
2846
+ try {
2847
+ const markedOpts = this.buildMarkedOptions({ gfm, breaks });
2848
+ (_a2 = props.onRenderStart) == null ? void 0 : _a2.call(props);
2849
+ const ctx = {
2850
+ animation: false,
2851
+ selectable,
2852
+ escapeText: this.escapeText,
2853
+ extensions: ctxExtensions
2854
+ };
2855
+ const tokens = this.lex(content, markedOpts);
2856
+ const nodes = renderer.renderTokens(tokens, ctx);
2857
+ (_b = props.onPatch) == null ? void 0 : _b.call(props, nodes);
2858
+ (_c = props.onRenderComplete) == null ? void 0 : _c.call(props);
2859
+ return nodes;
2860
+ } finally {
2861
+ this.restoreDefaults(saved);
2862
+ }
2863
+ }
2864
+ if (!this.nodeStreamProcessor) {
2865
+ this.activeNodeStreamDefaults = this.applyPerCallExtensions(perCallExts);
2866
+ const markedOpts = this.buildMarkedOptions({ gfm, breaks });
2867
+ const ctx = {
2868
+ animation: stream.enableAnimation,
2869
+ selectable,
2870
+ escapeText: this.escapeText,
2871
+ extensions: ctxExtensions
2872
+ };
2873
+ const transform = (md) => renderer.renderTokens(this.lex(md, markedOpts), ctx);
2874
+ this.nodeStreamProcessor = new StreamingProcessor({
2875
+ transform,
2876
+ fixup: this.fixup,
2877
+ semanticEnabled: stream.semanticEnabled,
2878
+ ...stream.semanticConfig,
2879
+ onUpdate: (markdown) => {
2880
+ var _a3;
2881
+ return (_a3 = props.onRenderProgress) == null ? void 0 : _a3.call(props, { markdown });
2882
+ },
2883
+ onPatch: (nodes) => {
2884
+ var _a3;
2885
+ return (_a3 = props.onPatch) == null ? void 0 : _a3.call(props, nodes);
2886
+ },
2887
+ onComplete: () => {
2888
+ var _a3;
2889
+ (_a3 = props.onRenderComplete) == null ? void 0 : _a3.call(props);
2890
+ this.nodeStreamProcessor = null;
2891
+ this.restoreDefaults(this.activeNodeStreamDefaults);
2892
+ this.activeNodeStreamDefaults = null;
2893
+ }
2894
+ });
2895
+ (_d = props.onRenderStart) == null ? void 0 : _d.call(props);
2896
+ }
2897
+ this.nodeStreamProcessor.handleContentUpdate(content);
2898
+ this.nodeStreamProcessor.runRenderLoop(stream.hasNextChunk);
2899
+ return [];
2900
+ }
2901
+ /** Resets streaming state, usually during component detach/unmount. */
2902
+ reset() {
2903
+ var _a2, _b;
2904
+ (_a2 = this.tokenStreamProcessor) == null ? void 0 : _a2.reset();
2905
+ (_b = this.nodeStreamProcessor) == null ? void 0 : _b.reset();
2906
+ this.tokenStreamProcessor = null;
2907
+ this.nodeStreamProcessor = null;
2908
+ this.restoreDefaults(this.activeTokenStreamDefaults);
2909
+ this.restoreDefaults(this.activeNodeStreamDefaults);
2910
+ this.activeTokenStreamDefaults = null;
2911
+ this.activeNodeStreamDefaults = null;
2912
+ }
2913
+ };
2914
+
2915
+ // src/plugins/Footnote/index.ts
2916
+ var RULE = /^\[\^(?:([^\]:]+):)?([\s\S]+?)\]/;
2917
+ function Footnote(options = {}) {
2918
+ var _a2;
2919
+ const defaultLabel = (_a2 = options.defaultLabel) != null ? _a2 : "\u6CE8";
2920
+ return {
2921
+ extensions: [
2922
+ {
2923
+ name: "footnote",
2924
+ level: "inline",
2925
+ start(src) {
2926
+ const i = src.indexOf("[^");
2927
+ return i < 0 ? void 0 : i;
2928
+ },
2929
+ tokenizer(src) {
2930
+ var _a3;
2931
+ const m3 = RULE.exec(src);
2932
+ if (!m3) return void 0;
2933
+ return {
2934
+ type: "footnote",
2935
+ raw: m3[0],
2936
+ label: ((_a3 = m3[1]) != null ? _a3 : defaultLabel).trim(),
2937
+ content: m3[2].trim()
2938
+ };
2939
+ },
2940
+ miniRenderer(token, _ctx) {
2941
+ const t = token;
2942
+ return {
2943
+ name: "footnote",
2944
+ tag: "footnote",
2945
+ attrs: { label: t.label, content: t.content, class: "md-footnote" }
2946
+ };
2947
+ }
2948
+ }
2949
+ ]
2950
+ };
2951
+ }
2952
+
2953
+ // src/components/shared/flattenInlineTokens.ts
2954
+ var TAG_CLASS = {
2955
+ strong: "md-strong",
2956
+ em: "md-em",
2957
+ del: "md-del",
2958
+ codespan: "md-inline-code"
2959
+ };
2960
+ function escapeHtml2(text) {
2961
+ let out = "";
2962
+ for (let i = 0; i < text.length; i++) {
2963
+ const ch = text.charCodeAt(i);
2964
+ if (ch === 38) out += "&amp;";
2965
+ else if (ch === 60) out += "&lt;";
2966
+ else if (ch === 62) out += "&gt;";
2967
+ else if (ch === 34) out += "&quot;";
2968
+ else out += text[i];
2969
+ }
2970
+ return out;
2971
+ }
2972
+ function mergeClass(...parts) {
2973
+ const seen = /* @__PURE__ */ new Set();
2974
+ for (const p2 of parts) {
2975
+ if (!p2) continue;
2976
+ for (const tok of p2.split(/\s+/)) if (tok) seen.add(tok);
2977
+ }
2978
+ return Array.from(seen).join(" ");
2979
+ }
2980
+ function tokensToText(tokens) {
2981
+ var _a2;
2982
+ if (!tokens) return "";
2983
+ let out = "";
2984
+ for (const t of tokens) {
2985
+ const u2 = t;
2986
+ if (u2.type === "text" || u2.type === "escape") {
2987
+ out += (_a2 = u2.text) != null ? _a2 : "";
2988
+ } else if (u2.tokens) {
2989
+ out += tokensToText(u2.tokens);
2990
+ } else if (typeof u2.text === "string") {
2991
+ out += u2.text;
2992
+ }
2993
+ }
2994
+ return out;
2995
+ }
2996
+ function flattenInlineTokens(tokens, opts) {
2997
+ const out = [];
2998
+ const enc = opts.escapeText ? escapeHtml2 : (s) => s;
2999
+ walk(tokens, "", out, enc);
3000
+ return out;
3001
+ }
3002
+ function walk(tokens, classChain, out, enc) {
3003
+ var _a2, _b, _c, _d, _e2, _f, _g, _h;
3004
+ for (const tok of tokens) {
3005
+ const t = tok;
3006
+ switch (t.type) {
3007
+ case "text":
3008
+ case "escape": {
3009
+ const node = t;
3010
+ if (node.tokens && node.tokens.length) {
3011
+ walk(node.tokens, classChain, out, enc);
3012
+ } else {
3013
+ const v3 = enc((_a2 = node.text) != null ? _a2 : "");
3014
+ if (v3) out.push({ kind: "text", value: v3, classes: classChain });
3015
+ }
3016
+ break;
3017
+ }
3018
+ case "strong":
3019
+ case "em":
3020
+ case "del":
3021
+ walk(
3022
+ (_b = t.tokens) != null ? _b : [],
3023
+ mergeClass(classChain, TAG_CLASS[t.type]),
3024
+ out,
3025
+ enc
3026
+ );
3027
+ break;
3028
+ case "codespan": {
3029
+ const node = t;
3030
+ const v3 = enc((_c = node.text) != null ? _c : "");
3031
+ if (v3)
3032
+ out.push({
3033
+ kind: "text",
3034
+ value: v3,
3035
+ classes: mergeClass(classChain, TAG_CLASS.codespan)
3036
+ });
3037
+ break;
3038
+ }
3039
+ case "br":
3040
+ out.push({ kind: "br", value: "", classes: classChain });
3041
+ break;
3042
+ case "link": {
3043
+ const node = t;
3044
+ const label = tokensToText(node.tokens) || node.text || "";
3045
+ const run = {
3046
+ kind: "link",
3047
+ value: enc(label),
3048
+ classes: classChain,
3049
+ attrs: { href: (_d = node.href) != null ? _d : "" }
3050
+ };
3051
+ if (node.title) run.attrs.title = node.title;
3052
+ out.push(run);
3053
+ break;
3054
+ }
3055
+ case "image": {
3056
+ const node = t;
3057
+ const run = {
3058
+ kind: "image",
3059
+ value: enc((_e2 = node.text) != null ? _e2 : ""),
3060
+ classes: classChain,
3061
+ attrs: { src: (_f = node.href) != null ? _f : "", alt: (_g = node.text) != null ? _g : "" }
3062
+ };
3063
+ if (node.title) run.attrs.title = node.title;
3064
+ out.push(run);
3065
+ break;
3066
+ }
3067
+ case "html": {
3068
+ const node = t;
3069
+ const v3 = enc((_h = node.text) != null ? _h : "");
3070
+ if (v3) out.push({ kind: "text", value: v3, classes: classChain });
3071
+ break;
3072
+ }
3073
+ default: {
3074
+ if (typeof t.text === "string") {
3075
+ const v3 = enc(t.text);
3076
+ if (v3) out.push({ kind: "text", value: v3, classes: classChain });
3077
+ }
3078
+ }
3079
+ }
3080
+ }
3081
+ }
3082
+
3083
+ // src/index.ts
3084
+ var defaultInstance = new XMarkdownMini();
3085
+ function parse(content) {
3086
+ return defaultInstance.parse(content);
3087
+ }
3088
+ function render(input) {
3089
+ return typeof input === "string" ? defaultInstance.render(input) : defaultInstance.render(input);
3090
+ }
3091
+ function renderNodes(props) {
3092
+ return defaultInstance.renderNodes(props);
3093
+ }
3094
+ export {
3095
+ Footnote,
3096
+ StreamingProcessor,
3097
+ XMarkdownMini,
3098
+ alipayRenderer,
3099
+ flattenInlineTokens,
3100
+ getPlatformRenderer,
3101
+ parse,
3102
+ registerPlatformRenderer,
3103
+ render,
3104
+ renderNodes,
3105
+ resolvePlatform,
3106
+ tokensToAlipay,
3107
+ tokensToAlipayNodes,
3108
+ tokensToWechat,
3109
+ tokensToWechatNodes,
3110
+ wechatRenderer
3111
+ };