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