@useinsider/guido 3.2.0-beta.8209d6d → 3.2.0-beta.8220f9d

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