@clevertask/scribe 0.0.15 → 0.1.0

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