@seed-ship/mcp-ui-solid 1.0.12 → 1.0.15

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 (57) hide show
  1. package/LICENSE +0 -2
  2. package/dist/components/UIResourceRenderer.d.ts.map +1 -1
  3. package/dist/components.cjs +3 -3
  4. package/dist/components.js +3 -3
  5. package/dist/hooks.cjs +1 -1
  6. package/dist/hooks.js +1 -1
  7. package/dist/index.cjs +6 -6
  8. package/dist/index.js +6 -6
  9. package/dist/mcp-ui-solid/src/components/GenerativeUIErrorBoundary.cjs.map +1 -0
  10. package/dist/mcp-ui-solid/src/components/GenerativeUIErrorBoundary.js.map +1 -0
  11. package/dist/mcp-ui-solid/src/components/StreamingUIRenderer.cjs.map +1 -0
  12. package/dist/mcp-ui-solid/src/components/StreamingUIRenderer.js.map +1 -0
  13. package/dist/{components → mcp-ui-solid/src/components}/UIResourceRenderer.cjs +80 -5
  14. package/dist/mcp-ui-solid/src/components/UIResourceRenderer.cjs.map +1 -0
  15. package/dist/{components → mcp-ui-solid/src/components}/UIResourceRenderer.js +82 -7
  16. package/dist/mcp-ui-solid/src/components/UIResourceRenderer.js.map +1 -0
  17. package/dist/mcp-ui-solid/src/hooks/useStreamingUI.cjs.map +1 -0
  18. package/dist/mcp-ui-solid/src/hooks/useStreamingUI.js.map +1 -0
  19. package/dist/mcp-ui-solid/src/services/component-registry.cjs.map +1 -0
  20. package/dist/mcp-ui-solid/src/services/component-registry.js.map +1 -0
  21. package/dist/mcp-ui-solid/src/services/validation.cjs.map +1 -0
  22. package/dist/mcp-ui-solid/src/services/validation.js.map +1 -0
  23. package/dist/mcp-ui-solid/src/utils/logger.cjs.map +1 -0
  24. package/dist/mcp-ui-solid/src/utils/logger.js.map +1 -0
  25. package/dist/node_modules/.pnpm/marked@16.4.2/node_modules/marked/lib/marked.esm.cjs +1118 -0
  26. package/dist/node_modules/.pnpm/marked@16.4.2/node_modules/marked/lib/marked.esm.cjs.map +1 -0
  27. package/dist/node_modules/.pnpm/marked@16.4.2/node_modules/marked/lib/marked.esm.js +1119 -0
  28. package/dist/node_modules/.pnpm/marked@16.4.2/node_modules/marked/lib/marked.esm.js.map +1 -0
  29. package/dist/types/index.d.ts +1 -1
  30. package/dist/types/index.d.ts.map +1 -1
  31. package/package.json +2 -1
  32. package/dist/components/GenerativeUIErrorBoundary.cjs.map +0 -1
  33. package/dist/components/GenerativeUIErrorBoundary.js.map +0 -1
  34. package/dist/components/StreamingUIRenderer.cjs.map +0 -1
  35. package/dist/components/StreamingUIRenderer.js.map +0 -1
  36. package/dist/components/UIResourceRenderer.cjs.map +0 -1
  37. package/dist/components/UIResourceRenderer.js.map +0 -1
  38. package/dist/hooks/useStreamingUI.cjs.map +0 -1
  39. package/dist/hooks/useStreamingUI.js.map +0 -1
  40. package/dist/services/component-registry.cjs.map +0 -1
  41. package/dist/services/component-registry.js.map +0 -1
  42. package/dist/services/validation.cjs.map +0 -1
  43. package/dist/services/validation.js.map +0 -1
  44. package/dist/utils/logger.cjs.map +0 -1
  45. package/dist/utils/logger.js.map +0 -1
  46. /package/dist/{components → mcp-ui-solid/src/components}/GenerativeUIErrorBoundary.cjs +0 -0
  47. /package/dist/{components → mcp-ui-solid/src/components}/GenerativeUIErrorBoundary.js +0 -0
  48. /package/dist/{components → mcp-ui-solid/src/components}/StreamingUIRenderer.cjs +0 -0
  49. /package/dist/{components → mcp-ui-solid/src/components}/StreamingUIRenderer.js +0 -0
  50. /package/dist/{hooks → mcp-ui-solid/src/hooks}/useStreamingUI.cjs +0 -0
  51. /package/dist/{hooks → mcp-ui-solid/src/hooks}/useStreamingUI.js +0 -0
  52. /package/dist/{services → mcp-ui-solid/src/services}/component-registry.cjs +0 -0
  53. /package/dist/{services → mcp-ui-solid/src/services}/component-registry.js +0 -0
  54. /package/dist/{services → mcp-ui-solid/src/services}/validation.cjs +0 -0
  55. /package/dist/{services → mcp-ui-solid/src/services}/validation.js +0 -0
  56. /package/dist/{utils → mcp-ui-solid/src/utils}/logger.cjs +0 -0
  57. /package/dist/{utils → mcp-ui-solid/src/utils}/logger.js +0 -0
@@ -0,0 +1,1119 @@
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
+ var _a;
5
+ function L() {
6
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
7
+ }
8
+ var T = L();
9
+ function G(l3) {
10
+ T = l3;
11
+ }
12
+ var E = { exec: () => null };
13
+ function d(l3, e = "") {
14
+ let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (r, i) => {
15
+ let s = typeof i == "string" ? i : i.source;
16
+ return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
17
+ }, getRegex: () => new RegExp(t, e) };
18
+ return n;
19
+ }
20
+ var be = (() => {
21
+ try {
22
+ return !!new RegExp("(?<=1)(?<!1)");
23
+ } catch {
24
+ return false;
25
+ }
26
+ })(), 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, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ 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, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, 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") }, Re = /^(?:[ \t]*(?:\n|$))+/, Te = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Oe = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, F = /(?:[*+-]|\d{1,9}[.)])/, ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, oe = d(ie).replace(/bull/g, F).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ye = d(ie).replace(/bull/g, F).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Pe = /^[^\n]+/, Q = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Se = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), $e = d(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, F).getRegex(), 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", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _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(), 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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Le = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex(), K = { blockquote: Le, code: Te, def: Se, fences: Oe, heading: we, hr: I, html: _e, lheading: oe, list: $e, newline: Re, paragraph: ae, table: E, text: Pe }, 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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Me = { ...K, lheading: ye, 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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() }, ze = { ...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: E, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(j).replace("hr", I).replace("heading", ` *#{1,6} *[^
27
+ ]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ee = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, le = /^( {2,}|\\)\n(?!\s*$)/, Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, W = /[\s\p{P}\p{S}]/u, ue = /[^\s\p{P}\p{S}]/u, Ce = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex(), pe = /(?!~)[\p{P}\p{S}]/u, Be = /(?!~)[\s\p{P}\p{S}]/u, qe = /(?:[^\s\p{P}\p{S}]|~)/u, ve = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", be ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ce = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, De = d(ce, "u").replace(/punct/g, D).getRegex(), He = d(ce, "u").replace(/punct/g, pe).getRegex(), he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ze = d(he, "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), Ge = d(he, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, Be).replace(/punct/g, pe).getRegex(), Ne = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), Fe = d(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), je = 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(), Qe = d(U).replace("(?:-->|$)", "-->").getRegex(), Ue = 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", Qe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Ke = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), de = d(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex(), ke = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex(), We = d("reflink|nolink(?!\\()", "g").replace("reflink", de).replace("nolink", ke).getRegex(), se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, X = { _backpedal: E, anyPunctuation: Fe, autolink: je, blockSkip: ve, br: le, code: Ee, del: E, emStrongLDelim: De, emStrongRDelimAst: Ze, emStrongRDelimUnd: Ne, escape: Ae, link: Ke, nolink: ke, punctuation: Ce, reflink: de, reflinkSearch: We, tag: Ue, text: Ie, url: E }, Xe = { ...X, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, N = { ...X, emStrongRDelimAst: Ge, emStrongLDelim: He, 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() }, Je = { ...N, br: d(le).replace("{2,}", "*").getRegex(), text: d(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, C = { normal: K, gfm: Me, pedantic: ze }, M = { normal: X, gfm: N, breaks: Je, pedantic: Xe };
28
+ var Ve = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ge = (l3) => Ve[l3];
29
+ function w(l3, e) {
30
+ if (e) {
31
+ if (m.escapeTest.test(l3)) return l3.replace(m.escapeReplace, ge);
32
+ } else if (m.escapeTestNoEncode.test(l3)) return l3.replace(m.escapeReplaceNoEncode, ge);
33
+ return l3;
34
+ }
35
+ function J(l3) {
36
+ try {
37
+ l3 = encodeURI(l3).replace(m.percentDecode, "%");
38
+ } catch {
39
+ return null;
40
+ }
41
+ return l3;
42
+ }
43
+ function V(l3, e) {
44
+ var _a2;
45
+ let t = l3.replace(m.findPipe, (i, s, a) => {
46
+ let o = false, p = s;
47
+ for (; --p >= 0 && a[p] === "\\"; ) o = !o;
48
+ return o ? "|" : " |";
49
+ }), n = t.split(m.splitPipe), r = 0;
50
+ 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);
51
+ else for (; n.length < e; ) n.push("");
52
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
53
+ return n;
54
+ }
55
+ function z(l3, e, t) {
56
+ let n = l3.length;
57
+ if (n === 0) return "";
58
+ let r = 0;
59
+ for (; r < n; ) {
60
+ let i = l3.charAt(n - r - 1);
61
+ if (i === e && true) r++;
62
+ else break;
63
+ }
64
+ return l3.slice(0, n - r);
65
+ }
66
+ function fe(l3, e) {
67
+ if (l3.indexOf(e[1]) === -1) return -1;
68
+ let t = 0;
69
+ for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
70
+ else if (l3[n] === e[0]) t++;
71
+ else if (l3[n] === e[1] && (t--, t < 0)) return n;
72
+ return t > 0 ? -2 : -1;
73
+ }
74
+ function me(l3, e, t, n, r) {
75
+ let i = e.href, s = e.title || null, a = l3[1].replace(r.other.outputLinkReplace, "$1");
76
+ n.state.inLink = true;
77
+ let o = { type: l3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
78
+ return n.state.inLink = false, o;
79
+ }
80
+ function Ye(l3, e, t) {
81
+ let n = l3.match(t.other.indentCodeCompensation);
82
+ if (n === null) return e;
83
+ let r = n[1];
84
+ return e.split(`
85
+ `).map((i) => {
86
+ let s = i.match(t.other.beginningSpace);
87
+ if (s === null) return i;
88
+ let [a] = s;
89
+ return a.length >= r.length ? i.slice(r.length) : i;
90
+ }).join(`
91
+ `);
92
+ }
93
+ var y = class {
94
+ constructor(e) {
95
+ __publicField(this, "options");
96
+ __publicField(this, "rules");
97
+ __publicField(this, "lexer");
98
+ this.options = e || T;
99
+ }
100
+ space(e) {
101
+ let t = this.rules.block.newline.exec(e);
102
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
103
+ }
104
+ code(e) {
105
+ let t = this.rules.block.code.exec(e);
106
+ if (t) {
107
+ let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
108
+ return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : z(n, `
109
+ `) };
110
+ }
111
+ }
112
+ fences(e) {
113
+ let t = this.rules.block.fences.exec(e);
114
+ if (t) {
115
+ let n = t[0], r = Ye(n, t[3] || "", this.rules);
116
+ return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
117
+ }
118
+ }
119
+ heading(e) {
120
+ let t = this.rules.block.heading.exec(e);
121
+ if (t) {
122
+ let n = t[2].trim();
123
+ if (this.rules.other.endingHash.test(n)) {
124
+ let r = z(n, "#");
125
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
126
+ }
127
+ return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
128
+ }
129
+ }
130
+ hr(e) {
131
+ let t = this.rules.block.hr.exec(e);
132
+ if (t) return { type: "hr", raw: z(t[0], `
133
+ `) };
134
+ }
135
+ blockquote(e) {
136
+ let t = this.rules.block.blockquote.exec(e);
137
+ if (t) {
138
+ let n = z(t[0], `
139
+ `).split(`
140
+ `), r = "", i = "", s = [];
141
+ for (; n.length > 0; ) {
142
+ let a = false, o = [], p;
143
+ for (p = 0; p < n.length; p++) if (this.rules.other.blockquoteStart.test(n[p])) o.push(n[p]), a = true;
144
+ else if (!a) o.push(n[p]);
145
+ else break;
146
+ n = n.slice(p);
147
+ let u = o.join(`
148
+ `), c = u.replace(this.rules.other.blockquoteSetextReplace, `
149
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
150
+ r = r ? `${r}
151
+ ${u}` : u, i = i ? `${i}
152
+ ${c}` : c;
153
+ let g = this.lexer.state.top;
154
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = g, n.length === 0) break;
155
+ let h = s.at(-1);
156
+ if ((h == null ? void 0 : h.type) === "code") break;
157
+ if ((h == null ? void 0 : h.type) === "blockquote") {
158
+ let R = h, f = R.raw + `
159
+ ` + n.join(`
160
+ `), O = this.blockquote(f);
161
+ s[s.length - 1] = O, r = r.substring(0, r.length - R.raw.length) + O.raw, i = i.substring(0, i.length - R.text.length) + O.text;
162
+ break;
163
+ } else if ((h == null ? void 0 : h.type) === "list") {
164
+ let R = h, f = R.raw + `
165
+ ` + n.join(`
166
+ `), O = this.list(f);
167
+ s[s.length - 1] = O, r = r.substring(0, r.length - h.raw.length) + O.raw, i = i.substring(0, i.length - R.raw.length) + O.raw, n = f.substring(s.at(-1).raw.length).split(`
168
+ `);
169
+ continue;
170
+ }
171
+ }
172
+ return { type: "blockquote", raw: r, tokens: s, text: i };
173
+ }
174
+ }
175
+ list(e) {
176
+ let t = this.rules.block.list.exec(e);
177
+ if (t) {
178
+ let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
179
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
180
+ let s = this.rules.other.listItemRegex(n), a = false;
181
+ for (; e; ) {
182
+ let p = false, u = "", c = "";
183
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
184
+ u = t[0], e = e.substring(u.length);
185
+ let g = t[2].split(`
186
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (H) => " ".repeat(3 * H.length)), h = e.split(`
187
+ `, 1)[0], R = !g.trim(), f = 0;
188
+ if (this.options.pedantic ? (f = 2, c = g.trimStart()) : R ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = g.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (u += h + `
189
+ `, e = e.substring(h.length + 1), p = true), !p) {
190
+ let H = this.rules.other.nextBulletRegex(f), ee = this.rules.other.hrRegex(f), te = this.rules.other.fencesBeginRegex(f), ne = this.rules.other.headingBeginRegex(f), xe = this.rules.other.htmlBeginRegex(f);
191
+ for (; e; ) {
192
+ let Z = e.split(`
193
+ `, 1)[0], A;
194
+ if (h = Z, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), te.test(h) || ne.test(h) || xe.test(h) || H.test(h) || ee.test(h)) break;
195
+ if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
196
+ ` + A.slice(f);
197
+ else {
198
+ if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(g) || ne.test(g) || ee.test(g)) break;
199
+ c += `
200
+ ` + h;
201
+ }
202
+ !R && !h.trim() && (R = true), u += Z + `
203
+ `, e = e.substring(Z.length + 1), g = A.slice(f);
204
+ }
205
+ }
206
+ i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(u) && (a = true));
207
+ let O = null, Y;
208
+ this.options.gfm && (O = this.rules.other.listIsTask.exec(c), O && (Y = O[0] !== "[ ] ", c = c.replace(this.rules.other.listReplaceTask, ""))), i.items.push({ type: "list_item", raw: u, task: !!O, checked: Y, loose: false, text: c, tokens: [] }), i.raw += u;
209
+ }
210
+ let o = i.items.at(-1);
211
+ if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
212
+ else return;
213
+ i.raw = i.raw.trimEnd();
214
+ for (let p = 0; p < i.items.length; p++) if (this.lexer.state.top = false, i.items[p].tokens = this.lexer.blockTokens(i.items[p].text, []), !i.loose) {
215
+ let u = i.items[p].tokens.filter((g) => g.type === "space"), c = u.length > 0 && u.some((g) => this.rules.other.anyLine.test(g.raw));
216
+ i.loose = c;
217
+ }
218
+ if (i.loose) for (let p = 0; p < i.items.length; p++) i.items[p].loose = true;
219
+ return i;
220
+ }
221
+ }
222
+ html(e) {
223
+ let t = this.rules.block.html.exec(e);
224
+ if (t) return { type: "html", block: true, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
225
+ }
226
+ def(e) {
227
+ let t = this.rules.block.def.exec(e);
228
+ if (t) {
229
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
230
+ return { type: "def", tag: n, raw: t[0], href: r, title: i };
231
+ }
232
+ }
233
+ table(e) {
234
+ var _a2;
235
+ let t = this.rules.block.table.exec(e);
236
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
237
+ let n = V(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = ((_a2 = t[3]) == null ? void 0 : _a2.trim()) ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
238
+ `) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
239
+ if (n.length === r.length) {
240
+ for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
241
+ for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
242
+ for (let a of i) s.rows.push(V(a, s.header.length).map((o, p) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[p] })));
243
+ return s;
244
+ }
245
+ }
246
+ lheading(e) {
247
+ let t = this.rules.block.lheading.exec(e);
248
+ if (t) return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: t[1], tokens: this.lexer.inline(t[1]) };
249
+ }
250
+ paragraph(e) {
251
+ let t = this.rules.block.paragraph.exec(e);
252
+ if (t) {
253
+ let n = t[1].charAt(t[1].length - 1) === `
254
+ ` ? t[1].slice(0, -1) : t[1];
255
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
256
+ }
257
+ }
258
+ text(e) {
259
+ let t = this.rules.block.text.exec(e);
260
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
261
+ }
262
+ escape(e) {
263
+ let t = this.rules.inline.escape.exec(e);
264
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
265
+ }
266
+ tag(e) {
267
+ let t = this.rules.inline.tag.exec(e);
268
+ 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] };
269
+ }
270
+ link(e) {
271
+ let t = this.rules.inline.link.exec(e);
272
+ if (t) {
273
+ let n = t[2].trim();
274
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
275
+ if (!this.rules.other.endAngleBracket.test(n)) return;
276
+ let s = z(n.slice(0, -1), "\\");
277
+ if ((n.length - s.length) % 2 === 0) return;
278
+ } else {
279
+ let s = fe(t[2], "()");
280
+ if (s === -2) return;
281
+ if (s > -1) {
282
+ let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
283
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
284
+ }
285
+ }
286
+ let r = t[2], i = "";
287
+ if (this.options.pedantic) {
288
+ let s = this.rules.other.pedanticHrefTitle.exec(r);
289
+ s && (r = s[1], i = s[3]);
290
+ } else i = t[3] ? t[3].slice(1, -1) : "";
291
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), me(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
292
+ }
293
+ }
294
+ reflink(e, t) {
295
+ let n;
296
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
297
+ let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
298
+ if (!i) {
299
+ let s = n[0].charAt(0);
300
+ return { type: "text", raw: s, text: s };
301
+ }
302
+ return me(n, i, n[0], this.lexer, this.rules);
303
+ }
304
+ }
305
+ emStrong(e, t, n = "") {
306
+ let r = this.rules.inline.emStrongLDelim.exec(e);
307
+ if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
308
+ if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
309
+ let s = [...r[0]].length - 1, a, o, p = s, u = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
310
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
311
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
312
+ if (o = [...a].length, r[3] || r[4]) {
313
+ p += o;
314
+ continue;
315
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
316
+ u += o;
317
+ continue;
318
+ }
319
+ if (p -= o, p > 0) continue;
320
+ o = Math.min(o, o + p + u);
321
+ let g = [...r[0]][0].length, h = e.slice(0, s + r.index + g + o);
322
+ if (Math.min(s, o) % 2) {
323
+ let f = h.slice(1, -1);
324
+ return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
325
+ }
326
+ let R = h.slice(2, -2);
327
+ return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
328
+ }
329
+ }
330
+ }
331
+ codespan(e) {
332
+ let t = this.rules.inline.code.exec(e);
333
+ if (t) {
334
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
335
+ return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
336
+ }
337
+ }
338
+ br(e) {
339
+ let t = this.rules.inline.br.exec(e);
340
+ if (t) return { type: "br", raw: t[0] };
341
+ }
342
+ del(e) {
343
+ let t = this.rules.inline.del.exec(e);
344
+ if (t) return { type: "del", raw: t[0], text: t[2], tokens: this.lexer.inlineTokens(t[2]) };
345
+ }
346
+ autolink(e) {
347
+ let t = this.rules.inline.autolink.exec(e);
348
+ if (t) {
349
+ let n, r;
350
+ return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
351
+ }
352
+ }
353
+ url(e) {
354
+ var _a2;
355
+ let t;
356
+ if (t = this.rules.inline.url.exec(e)) {
357
+ let n, r;
358
+ if (t[2] === "@") n = t[0], r = "mailto:" + n;
359
+ else {
360
+ let i;
361
+ do
362
+ i = t[0], t[0] = ((_a2 = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : _a2[0]) ?? "";
363
+ while (i !== t[0]);
364
+ n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
365
+ }
366
+ return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
367
+ }
368
+ }
369
+ inlineText(e) {
370
+ let t = this.rules.inline.text.exec(e);
371
+ if (t) {
372
+ let n = this.lexer.state.inRawBlock;
373
+ return { type: "text", raw: t[0], text: t[0], escaped: n };
374
+ }
375
+ }
376
+ };
377
+ var x = class l {
378
+ constructor(e) {
379
+ __publicField(this, "tokens");
380
+ __publicField(this, "options");
381
+ __publicField(this, "state");
382
+ __publicField(this, "tokenizer");
383
+ __publicField(this, "inlineQueue");
384
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
385
+ let t = { other: m, block: C.normal, inline: M.normal };
386
+ this.options.pedantic ? (t.block = C.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = C.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
387
+ }
388
+ static get rules() {
389
+ return { block: C, inline: M };
390
+ }
391
+ static lex(e, t) {
392
+ return new l(t).lex(e);
393
+ }
394
+ static lexInline(e, t) {
395
+ return new l(t).inlineTokens(e);
396
+ }
397
+ lex(e) {
398
+ e = e.replace(m.carriageReturn, `
399
+ `), this.blockTokens(e, this.tokens);
400
+ for (let t = 0; t < this.inlineQueue.length; t++) {
401
+ let n = this.inlineQueue[t];
402
+ this.inlineTokens(n.src, n.tokens);
403
+ }
404
+ return this.inlineQueue = [], this.tokens;
405
+ }
406
+ blockTokens(e, t = [], n = false) {
407
+ var _a2, _b, _c;
408
+ for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
409
+ let r;
410
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
411
+ if (r = this.tokenizer.space(e)) {
412
+ e = e.substring(r.raw.length);
413
+ let s = t.at(-1);
414
+ r.raw.length === 1 && s !== void 0 ? s.raw += `
415
+ ` : t.push(r);
416
+ continue;
417
+ }
418
+ if (r = this.tokenizer.code(e)) {
419
+ e = e.substring(r.raw.length);
420
+ let s = t.at(-1);
421
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
422
+ `) ? "" : `
423
+ `) + r.raw, s.text += `
424
+ ` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
425
+ continue;
426
+ }
427
+ if (r = this.tokenizer.fences(e)) {
428
+ e = e.substring(r.raw.length), t.push(r);
429
+ continue;
430
+ }
431
+ if (r = this.tokenizer.heading(e)) {
432
+ e = e.substring(r.raw.length), t.push(r);
433
+ continue;
434
+ }
435
+ if (r = this.tokenizer.hr(e)) {
436
+ e = e.substring(r.raw.length), t.push(r);
437
+ continue;
438
+ }
439
+ if (r = this.tokenizer.blockquote(e)) {
440
+ e = e.substring(r.raw.length), t.push(r);
441
+ continue;
442
+ }
443
+ if (r = this.tokenizer.list(e)) {
444
+ e = e.substring(r.raw.length), t.push(r);
445
+ continue;
446
+ }
447
+ if (r = this.tokenizer.html(e)) {
448
+ e = e.substring(r.raw.length), t.push(r);
449
+ continue;
450
+ }
451
+ if (r = this.tokenizer.def(e)) {
452
+ e = e.substring(r.raw.length);
453
+ let s = t.at(-1);
454
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
455
+ `) ? "" : `
456
+ `) + r.raw, s.text += `
457
+ ` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
458
+ continue;
459
+ }
460
+ if (r = this.tokenizer.table(e)) {
461
+ e = e.substring(r.raw.length), t.push(r);
462
+ continue;
463
+ }
464
+ if (r = this.tokenizer.lheading(e)) {
465
+ e = e.substring(r.raw.length), t.push(r);
466
+ continue;
467
+ }
468
+ let i = e;
469
+ if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
470
+ let s = 1 / 0, a = e.slice(1), o;
471
+ this.options.extensions.startBlock.forEach((p) => {
472
+ o = p.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
473
+ }), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
474
+ }
475
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
476
+ let s = t.at(-1);
477
+ n && (s == null ? void 0 : s.type) === "paragraph" ? (s.raw += (s.raw.endsWith(`
478
+ `) ? "" : `
479
+ `) + r.raw, s.text += `
480
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
481
+ continue;
482
+ }
483
+ if (r = this.tokenizer.text(e)) {
484
+ e = e.substring(r.raw.length);
485
+ let s = t.at(-1);
486
+ (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
487
+ `) ? "" : `
488
+ `) + r.raw, s.text += `
489
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
490
+ continue;
491
+ }
492
+ if (e) {
493
+ let s = "Infinite loop on byte: " + e.charCodeAt(0);
494
+ if (this.options.silent) {
495
+ console.error(s);
496
+ break;
497
+ } else throw new Error(s);
498
+ }
499
+ }
500
+ return this.state.top = true, t;
501
+ }
502
+ inline(e, t = []) {
503
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
504
+ }
505
+ inlineTokens(e, t = []) {
506
+ var _a2, _b, _c, _d, _e2;
507
+ let n = e, r = null;
508
+ if (this.tokens.links) {
509
+ let o = Object.keys(this.tokens.links);
510
+ if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
511
+ }
512
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
513
+ let i;
514
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
515
+ n = ((_b = (_a2 = this.options.hooks) == null ? void 0 : _a2.emStrongMask) == null ? void 0 : _b.call({ lexer: this }, n)) ?? n;
516
+ let s = false, a = "";
517
+ for (; e; ) {
518
+ s || (a = ""), s = false;
519
+ let o;
520
+ if ((_d = (_c = this.options.extensions) == null ? void 0 : _c.inline) == null ? void 0 : _d.some((u) => (o = u.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
521
+ if (o = this.tokenizer.escape(e)) {
522
+ e = e.substring(o.raw.length), t.push(o);
523
+ continue;
524
+ }
525
+ if (o = this.tokenizer.tag(e)) {
526
+ e = e.substring(o.raw.length), t.push(o);
527
+ continue;
528
+ }
529
+ if (o = this.tokenizer.link(e)) {
530
+ e = e.substring(o.raw.length), t.push(o);
531
+ continue;
532
+ }
533
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
534
+ e = e.substring(o.raw.length);
535
+ let u = t.at(-1);
536
+ o.type === "text" && (u == null ? void 0 : u.type) === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
537
+ continue;
538
+ }
539
+ if (o = this.tokenizer.emStrong(e, n, a)) {
540
+ e = e.substring(o.raw.length), t.push(o);
541
+ continue;
542
+ }
543
+ if (o = this.tokenizer.codespan(e)) {
544
+ e = e.substring(o.raw.length), t.push(o);
545
+ continue;
546
+ }
547
+ if (o = this.tokenizer.br(e)) {
548
+ e = e.substring(o.raw.length), t.push(o);
549
+ continue;
550
+ }
551
+ if (o = this.tokenizer.del(e)) {
552
+ e = e.substring(o.raw.length), t.push(o);
553
+ continue;
554
+ }
555
+ if (o = this.tokenizer.autolink(e)) {
556
+ e = e.substring(o.raw.length), t.push(o);
557
+ continue;
558
+ }
559
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
560
+ e = e.substring(o.raw.length), t.push(o);
561
+ continue;
562
+ }
563
+ let p = e;
564
+ if ((_e2 = this.options.extensions) == null ? void 0 : _e2.startInline) {
565
+ let u = 1 / 0, c = e.slice(1), g;
566
+ this.options.extensions.startInline.forEach((h) => {
567
+ g = h.call({ lexer: this }, c), typeof g == "number" && g >= 0 && (u = Math.min(u, g));
568
+ }), u < 1 / 0 && u >= 0 && (p = e.substring(0, u + 1));
569
+ }
570
+ if (o = this.tokenizer.inlineText(p)) {
571
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
572
+ let u = t.at(-1);
573
+ (u == null ? void 0 : u.type) === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
574
+ continue;
575
+ }
576
+ if (e) {
577
+ let u = "Infinite loop on byte: " + e.charCodeAt(0);
578
+ if (this.options.silent) {
579
+ console.error(u);
580
+ break;
581
+ } else throw new Error(u);
582
+ }
583
+ }
584
+ return t;
585
+ }
586
+ };
587
+ var P = class {
588
+ constructor(e) {
589
+ __publicField(this, "options");
590
+ __publicField(this, "parser");
591
+ this.options = e || T;
592
+ }
593
+ space(e) {
594
+ return "";
595
+ }
596
+ code({ text: e, lang: t, escaped: n }) {
597
+ var _a2;
598
+ let r = (_a2 = (t || "").match(m.notSpaceStart)) == null ? void 0 : _a2[0], i = e.replace(m.endingNewline, "") + `
599
+ `;
600
+ return r ? '<pre><code class="language-' + w(r) + '">' + (n ? i : w(i, true)) + `</code></pre>
601
+ ` : "<pre><code>" + (n ? i : w(i, true)) + `</code></pre>
602
+ `;
603
+ }
604
+ blockquote({ tokens: e }) {
605
+ return `<blockquote>
606
+ ${this.parser.parse(e)}</blockquote>
607
+ `;
608
+ }
609
+ html({ text: e }) {
610
+ return e;
611
+ }
612
+ def(e) {
613
+ return "";
614
+ }
615
+ heading({ tokens: e, depth: t }) {
616
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
617
+ `;
618
+ }
619
+ hr(e) {
620
+ return `<hr>
621
+ `;
622
+ }
623
+ list(e) {
624
+ let t = e.ordered, n = e.start, r = "";
625
+ for (let a = 0; a < e.items.length; a++) {
626
+ let o = e.items[a];
627
+ r += this.listitem(o);
628
+ }
629
+ let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
630
+ return "<" + i + s + `>
631
+ ` + r + "</" + i + `>
632
+ `;
633
+ }
634
+ listitem(e) {
635
+ var _a2;
636
+ let t = "";
637
+ if (e.task) {
638
+ let n = this.checkbox({ checked: !!e.checked });
639
+ e.loose ? ((_a2 = e.tokens[0]) == null ? void 0 : _a2.type) === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " + w(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = true)) : e.tokens.unshift({ type: "text", raw: n + " ", text: n + " ", escaped: true }) : t += n + " ";
640
+ }
641
+ return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
642
+ `;
643
+ }
644
+ checkbox({ checked: e }) {
645
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
646
+ }
647
+ paragraph({ tokens: e }) {
648
+ return `<p>${this.parser.parseInline(e)}</p>
649
+ `;
650
+ }
651
+ table(e) {
652
+ let t = "", n = "";
653
+ for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
654
+ t += this.tablerow({ text: n });
655
+ let r = "";
656
+ for (let i = 0; i < e.rows.length; i++) {
657
+ let s = e.rows[i];
658
+ n = "";
659
+ for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
660
+ r += this.tablerow({ text: n });
661
+ }
662
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
663
+ <thead>
664
+ ` + t + `</thead>
665
+ ` + r + `</table>
666
+ `;
667
+ }
668
+ tablerow({ text: e }) {
669
+ return `<tr>
670
+ ${e}</tr>
671
+ `;
672
+ }
673
+ tablecell(e) {
674
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
675
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
676
+ `;
677
+ }
678
+ strong({ tokens: e }) {
679
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
680
+ }
681
+ em({ tokens: e }) {
682
+ return `<em>${this.parser.parseInline(e)}</em>`;
683
+ }
684
+ codespan({ text: e }) {
685
+ return `<code>${w(e, true)}</code>`;
686
+ }
687
+ br(e) {
688
+ return "<br>";
689
+ }
690
+ del({ tokens: e }) {
691
+ return `<del>${this.parser.parseInline(e)}</del>`;
692
+ }
693
+ link({ href: e, title: t, tokens: n }) {
694
+ let r = this.parser.parseInline(n), i = J(e);
695
+ if (i === null) return r;
696
+ e = i;
697
+ let s = '<a href="' + e + '"';
698
+ return t && (s += ' title="' + w(t) + '"'), s += ">" + r + "</a>", s;
699
+ }
700
+ image({ href: e, title: t, text: n, tokens: r }) {
701
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
702
+ let i = J(e);
703
+ if (i === null) return w(n);
704
+ e = i;
705
+ let s = `<img src="${e}" alt="${n}"`;
706
+ return t && (s += ` title="${w(t)}"`), s += ">", s;
707
+ }
708
+ text(e) {
709
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
710
+ }
711
+ };
712
+ var $ = class {
713
+ strong({ text: e }) {
714
+ return e;
715
+ }
716
+ em({ text: e }) {
717
+ return e;
718
+ }
719
+ codespan({ text: e }) {
720
+ return e;
721
+ }
722
+ del({ text: e }) {
723
+ return e;
724
+ }
725
+ html({ text: e }) {
726
+ return e;
727
+ }
728
+ text({ text: e }) {
729
+ return e;
730
+ }
731
+ link({ text: e }) {
732
+ return "" + e;
733
+ }
734
+ image({ text: e }) {
735
+ return "" + e;
736
+ }
737
+ br() {
738
+ return "";
739
+ }
740
+ };
741
+ var b = class l2 {
742
+ constructor(e) {
743
+ __publicField(this, "options");
744
+ __publicField(this, "renderer");
745
+ __publicField(this, "textRenderer");
746
+ this.options = e || T, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
747
+ }
748
+ static parse(e, t) {
749
+ return new l2(t).parse(e);
750
+ }
751
+ static parseInline(e, t) {
752
+ return new l2(t).parseInline(e);
753
+ }
754
+ parse(e, t = true) {
755
+ var _a2, _b;
756
+ let n = "";
757
+ for (let r = 0; r < e.length; r++) {
758
+ let i = e[r];
759
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[i.type]) {
760
+ let a = i, o = this.options.extensions.renderers[a.type].call({ parser: this }, a);
761
+ if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(a.type)) {
762
+ n += o || "";
763
+ continue;
764
+ }
765
+ }
766
+ let s = i;
767
+ switch (s.type) {
768
+ case "space": {
769
+ n += this.renderer.space(s);
770
+ continue;
771
+ }
772
+ case "hr": {
773
+ n += this.renderer.hr(s);
774
+ continue;
775
+ }
776
+ case "heading": {
777
+ n += this.renderer.heading(s);
778
+ continue;
779
+ }
780
+ case "code": {
781
+ n += this.renderer.code(s);
782
+ continue;
783
+ }
784
+ case "table": {
785
+ n += this.renderer.table(s);
786
+ continue;
787
+ }
788
+ case "blockquote": {
789
+ n += this.renderer.blockquote(s);
790
+ continue;
791
+ }
792
+ case "list": {
793
+ n += this.renderer.list(s);
794
+ continue;
795
+ }
796
+ case "html": {
797
+ n += this.renderer.html(s);
798
+ continue;
799
+ }
800
+ case "def": {
801
+ n += this.renderer.def(s);
802
+ continue;
803
+ }
804
+ case "paragraph": {
805
+ n += this.renderer.paragraph(s);
806
+ continue;
807
+ }
808
+ case "text": {
809
+ let a = s, o = this.renderer.text(a);
810
+ for (; r + 1 < e.length && e[r + 1].type === "text"; ) a = e[++r], o += `
811
+ ` + this.renderer.text(a);
812
+ t ? n += this.renderer.paragraph({ type: "paragraph", raw: o, text: o, tokens: [{ type: "text", raw: o, text: o, escaped: true }] }) : n += o;
813
+ continue;
814
+ }
815
+ default: {
816
+ let a = 'Token with "' + s.type + '" type was not found.';
817
+ if (this.options.silent) return console.error(a), "";
818
+ throw new Error(a);
819
+ }
820
+ }
821
+ }
822
+ return n;
823
+ }
824
+ parseInline(e, t = this.renderer) {
825
+ var _a2, _b;
826
+ let n = "";
827
+ for (let r = 0; r < e.length; r++) {
828
+ let i = e[r];
829
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[i.type]) {
830
+ let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
831
+ if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
832
+ n += a || "";
833
+ continue;
834
+ }
835
+ }
836
+ let s = i;
837
+ switch (s.type) {
838
+ case "escape": {
839
+ n += t.text(s);
840
+ break;
841
+ }
842
+ case "html": {
843
+ n += t.html(s);
844
+ break;
845
+ }
846
+ case "link": {
847
+ n += t.link(s);
848
+ break;
849
+ }
850
+ case "image": {
851
+ n += t.image(s);
852
+ break;
853
+ }
854
+ case "strong": {
855
+ n += t.strong(s);
856
+ break;
857
+ }
858
+ case "em": {
859
+ n += t.em(s);
860
+ break;
861
+ }
862
+ case "codespan": {
863
+ n += t.codespan(s);
864
+ break;
865
+ }
866
+ case "br": {
867
+ n += t.br(s);
868
+ break;
869
+ }
870
+ case "del": {
871
+ n += t.del(s);
872
+ break;
873
+ }
874
+ case "text": {
875
+ n += t.text(s);
876
+ break;
877
+ }
878
+ default: {
879
+ let a = 'Token with "' + s.type + '" type was not found.';
880
+ if (this.options.silent) return console.error(a), "";
881
+ throw new Error(a);
882
+ }
883
+ }
884
+ }
885
+ return n;
886
+ }
887
+ };
888
+ var S = (_a = class {
889
+ constructor(e) {
890
+ __publicField(this, "options");
891
+ __publicField(this, "block");
892
+ this.options = e || T;
893
+ }
894
+ preprocess(e) {
895
+ return e;
896
+ }
897
+ postprocess(e) {
898
+ return e;
899
+ }
900
+ processAllTokens(e) {
901
+ return e;
902
+ }
903
+ emStrongMask(e) {
904
+ return e;
905
+ }
906
+ provideLexer() {
907
+ return this.block ? x.lex : x.lexInline;
908
+ }
909
+ provideParser() {
910
+ return this.block ? b.parse : b.parseInline;
911
+ }
912
+ }, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
913
+ var B = class {
914
+ constructor(...e) {
915
+ __publicField(this, "defaults", L());
916
+ __publicField(this, "options", this.setOptions);
917
+ __publicField(this, "parse", this.parseMarkdown(true));
918
+ __publicField(this, "parseInline", this.parseMarkdown(false));
919
+ __publicField(this, "Parser", b);
920
+ __publicField(this, "Renderer", P);
921
+ __publicField(this, "TextRenderer", $);
922
+ __publicField(this, "Lexer", x);
923
+ __publicField(this, "Tokenizer", y);
924
+ __publicField(this, "Hooks", S);
925
+ this.use(...e);
926
+ }
927
+ walkTokens(e, t) {
928
+ var _a2, _b;
929
+ let n = [];
930
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
931
+ case "table": {
932
+ let i = r;
933
+ for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
934
+ for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
935
+ break;
936
+ }
937
+ case "list": {
938
+ let i = r;
939
+ n = n.concat(this.walkTokens(i.items, t));
940
+ break;
941
+ }
942
+ default: {
943
+ let i = r;
944
+ ((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[i.type]) ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
945
+ let a = i[s].flat(1 / 0);
946
+ n = n.concat(this.walkTokens(a, t));
947
+ }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
948
+ }
949
+ }
950
+ return n;
951
+ }
952
+ use(...e) {
953
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
954
+ return e.forEach((n) => {
955
+ let r = { ...n };
956
+ if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
957
+ if (!i.name) throw new Error("extension name required");
958
+ if ("renderer" in i) {
959
+ let s = t.renderers[i.name];
960
+ s ? t.renderers[i.name] = function(...a) {
961
+ let o = i.renderer.apply(this, a);
962
+ return o === false && (o = s.apply(this, a)), o;
963
+ } : t.renderers[i.name] = i.renderer;
964
+ }
965
+ if ("tokenizer" in i) {
966
+ if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
967
+ let s = t[i.level];
968
+ s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
969
+ }
970
+ "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
971
+ }), r.extensions = t), n.renderer) {
972
+ let i = this.defaults.renderer || new P(this.defaults);
973
+ for (let s in n.renderer) {
974
+ if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
975
+ if (["options", "parser"].includes(s)) continue;
976
+ let a = s, o = n.renderer[a], p = i[a];
977
+ i[a] = (...u) => {
978
+ let c = o.apply(i, u);
979
+ return c === false && (c = p.apply(i, u)), c || "";
980
+ };
981
+ }
982
+ r.renderer = i;
983
+ }
984
+ if (n.tokenizer) {
985
+ let i = this.defaults.tokenizer || new y(this.defaults);
986
+ for (let s in n.tokenizer) {
987
+ if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
988
+ if (["options", "rules", "lexer"].includes(s)) continue;
989
+ let a = s, o = n.tokenizer[a], p = i[a];
990
+ i[a] = (...u) => {
991
+ let c = o.apply(i, u);
992
+ return c === false && (c = p.apply(i, u)), c;
993
+ };
994
+ }
995
+ r.tokenizer = i;
996
+ }
997
+ if (n.hooks) {
998
+ let i = this.defaults.hooks || new S();
999
+ for (let s in n.hooks) {
1000
+ if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
1001
+ if (["options", "block"].includes(s)) continue;
1002
+ let a = s, o = n.hooks[a], p = i[a];
1003
+ S.passThroughHooks.has(s) ? i[a] = (u) => {
1004
+ if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
1005
+ let g = await o.call(i, u);
1006
+ return p.call(i, g);
1007
+ })();
1008
+ let c = o.call(i, u);
1009
+ return p.call(i, c);
1010
+ } : i[a] = (...u) => {
1011
+ if (this.defaults.async) return (async () => {
1012
+ let g = await o.apply(i, u);
1013
+ return g === false && (g = await p.apply(i, u)), g;
1014
+ })();
1015
+ let c = o.apply(i, u);
1016
+ return c === false && (c = p.apply(i, u)), c;
1017
+ };
1018
+ }
1019
+ r.hooks = i;
1020
+ }
1021
+ if (n.walkTokens) {
1022
+ let i = this.defaults.walkTokens, s = n.walkTokens;
1023
+ r.walkTokens = function(a) {
1024
+ let o = [];
1025
+ return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
1026
+ };
1027
+ }
1028
+ this.defaults = { ...this.defaults, ...r };
1029
+ }), this;
1030
+ }
1031
+ setOptions(e) {
1032
+ return this.defaults = { ...this.defaults, ...e }, this;
1033
+ }
1034
+ lexer(e, t) {
1035
+ return x.lex(e, t ?? this.defaults);
1036
+ }
1037
+ parser(e, t) {
1038
+ return b.parse(e, t ?? this.defaults);
1039
+ }
1040
+ parseMarkdown(e) {
1041
+ return (n, r) => {
1042
+ let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
1043
+ if (this.defaults.async === true && i.async === false) return a(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."));
1044
+ if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
1045
+ if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1046
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
1047
+ let o = s.hooks ? await s.hooks.preprocess(n) : n, u = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(u) : u;
1048
+ s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
1049
+ let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
1050
+ return s.hooks ? await s.hooks.postprocess(h) : h;
1051
+ })().catch(a);
1052
+ try {
1053
+ s.hooks && (n = s.hooks.preprocess(n));
1054
+ let p = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
1055
+ s.hooks && (p = s.hooks.processAllTokens(p)), s.walkTokens && this.walkTokens(p, s.walkTokens);
1056
+ let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(p, s);
1057
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
1058
+ } catch (o) {
1059
+ return a(o);
1060
+ }
1061
+ };
1062
+ }
1063
+ onError(e, t) {
1064
+ return (n) => {
1065
+ if (n.message += `
1066
+ Please report this to https://github.com/markedjs/marked.`, e) {
1067
+ let r = "<p>An error occurred:</p><pre>" + w(n.message + "", true) + "</pre>";
1068
+ return t ? Promise.resolve(r) : r;
1069
+ }
1070
+ if (t) return Promise.reject(n);
1071
+ throw n;
1072
+ };
1073
+ }
1074
+ };
1075
+ var _ = new B();
1076
+ function k(l3, e) {
1077
+ return _.parse(l3, e);
1078
+ }
1079
+ k.options = k.setOptions = function(l3) {
1080
+ return _.setOptions(l3), k.defaults = _.defaults, G(k.defaults), k;
1081
+ };
1082
+ k.getDefaults = L;
1083
+ k.defaults = T;
1084
+ k.use = function(...l3) {
1085
+ return _.use(...l3), k.defaults = _.defaults, G(k.defaults), k;
1086
+ };
1087
+ k.walkTokens = function(l3, e) {
1088
+ return _.walkTokens(l3, e);
1089
+ };
1090
+ k.parseInline = _.parseInline;
1091
+ k.Parser = b;
1092
+ k.parser = b.parse;
1093
+ k.Renderer = P;
1094
+ k.TextRenderer = $;
1095
+ k.Lexer = x;
1096
+ k.lexer = x.lex;
1097
+ k.Tokenizer = y;
1098
+ k.Hooks = S;
1099
+ k.parse = k;
1100
+ k.options;
1101
+ k.setOptions;
1102
+ k.use;
1103
+ k.walkTokens;
1104
+ k.parseInline;
1105
+ b.parse;
1106
+ x.lex;
1107
+ export {
1108
+ S as Hooks,
1109
+ x as Lexer,
1110
+ B as Marked,
1111
+ b as Parser,
1112
+ P as Renderer,
1113
+ $ as TextRenderer,
1114
+ y as Tokenizer,
1115
+ T as defaults,
1116
+ L as getDefaults,
1117
+ k as marked
1118
+ };
1119
+ //# sourceMappingURL=marked.esm.js.map