openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
116 lines • 52.8 kB
JavaScript
/*!
# License information
## Contribution License Agreement
If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. `</legalese>`
## Marked
Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## Markdown
Copyright © 2004, John Gruber
http://daringfireball.net/
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
*/
var marked=(()=>{var J=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var je=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var de=r=>{throw TypeError(r)};var Ne=(r,e,t)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Fe=(r,e)=>{for(var t in e)J(r,t,{get:e[t],enumerable:!0})},Ge=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of je(e))!He.call(r,n)&&n!==t&&J(r,n,{get:()=>e[n],enumerable:!(s=Me(e,n))||s.enumerable});return r};var Xe=r=>Ge(J({},"__esModule",{value:!0}),r);var x=(r,e,t)=>Ne(r,typeof e!="symbol"?e+"":e,t),We=(r,e,t)=>e.has(r)||de("Cannot "+t);var fe=(r,e,t)=>e.has(r)?de("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t);var ie=(r,e,t)=>(We(r,e,"access private method"),t);var rr={};Fe(rr,{Hooks:()=>O,Lexer:()=>R,Marked:()=>De,Parser:()=>A,Renderer:()=>N,TextRenderer:()=>ne,Tokenizer:()=>B,defaults:()=>_,getDefaults:()=>re,lexer:()=>tr,marked:()=>b,options:()=>Ut,parse:()=>Yt,parseInline:()=>Vt,parser:()=>er,setOptions:()=>Jt,use:()=>Oe,walkTokens:()=>Kt});function re(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _=re();function ze(r){_=r}var E={exec:()=>null};function C(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),n=e[s];return n||(n=r(s),e[s]=n),n}}function g(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(n,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace($.caret,"$1"),t=t.replace(n,l),s},getRegex:()=>new RegExp(t,e)};return s}var Ue=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch(e){return!1}})(),$={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {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,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,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:C(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:C(r=>new RegExp(`^ {0,${r}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:C(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:C(r=>new RegExp(`^ {0,${r}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:C(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:C(r=>new RegExp(`^ {0,${r}}(?:</?(?:${G})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:C(r=>new RegExp(`^ {0,${r}}>`))},Je=/^(?:[ \t]*(?:\n|$))+/,Ke=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ve=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,F=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ye=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,oe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,_e=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Pe=g(_e).replace(/bull/g,oe).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),et=g(_e).replace(/bull/g,oe).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ce=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,tt=/^[^\n]+/,pe=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,rt=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nt=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,oe).getRegex(),G="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",he=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,st=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",he).replace("tag",G).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ie=r=>g(ce).replace("hr",F).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",r).replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",G).getRegex(),it=Ie(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),lt=Ie(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),at=g(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",lt).getRegex(),ue={blockquote:at,code:Ke,def:rt,fences:Ve,heading:Ye,hr:F,html:st,lheading:Pe,list:nt,newline:Je,paragraph:it,table:E,text:tt},xe=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",F).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",G).getRegex(),ot={...ue,lheading:et,table:xe,paragraph:g(ce).replace("hr",F).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",xe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",G).getRegex()},ct={...ue,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",he).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:E,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(ce).replace("hr",F).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Pe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},pt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ht=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ce=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,ut=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,M=/[\s\p{P}\p{S}]/u,X=/[^\s\p{P}\p{S}]/u,gt=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,M).getRegex(),kt=/[\p{Pi}\p{Ps}"']/u,Le=/(?!~)[\p{P}\p{S}]/u,dt=/(?!~)[\s\p{P}\p{S}]/u,ft=/(?:[^\s\p{P}\p{S}]|~)/u,xt=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ue?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ee=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,bt=g(Ee,"u").replace(/punct/g,T).getRegex(),mt=g(Ee,"u").replace(/punct/g,Le).getRegex(),wt=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,$t=g(wt,"u").replace(/openQuote/g,kt).replace(/punct/g,T).getRegex(),Be="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",St=g(Be,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),yt=g(Be,"gu").replace(/notPunctSpace/g,ft).replace(/punctSpace/g,dt).replace(/punct/g,Le).getRegex(),Rt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",At=g(Rt,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),Tt=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),zt="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",_t=g(zt,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),Pt=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),It="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ct=g(It,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),Lt=g(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),Et=g(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,T).getRegex(),Bt=g(/^<(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(),qt=g(he).replace("(?:-->|$)","-->").getRegex(),vt=g("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",qt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qe=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,ee=g(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",qe).getRegex(),Zt=g(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",ee).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Dt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",ee).replace("ref",pe).getRegex(),Ot=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",pe).getRegex(),be=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Qt=g(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",qe).getRegex(),Mt=g("reflink|nolink(?!\\()","g").replace("reflink",g(/^!?\[(label)\]\[(ref)\]/).replace("label",Qt).replace("ref",be).getRegex()).replace("nolink",g(/^!?\[(ref)\](?:\[\])?/).replace("ref",be).getRegex()).getRegex(),me=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,jt=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Ht=g(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,jt).getRegex(),ge={_backpedal:E,anyPunctuation:Lt,anyPunctuationOutsideCode:Et,autolink:Bt,blockSkip:xt,br:Ce,code:ht,del:E,delLDelim:E,delRDelim:E,emStrongLDelim:bt,emStrongRDelimAst:St,emStrongRDelimUnd:Tt,escape:pt,link:Zt,nolink:Ot,punctuation:gt,reflink:Dt,reflinkSearch:Mt,tag:vt,text:ut,url:E},Nt={...ge,emStrongLDelim:$t,emStrongRDelimAst:At,emStrongRDelimUnd:_t,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",ee).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ee).getRegex()},le={...ge,emStrongRDelimAst:yt,emStrongLDelim:mt,delLDelim:Pt,delRDelim:Ct,url:g(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Ht).replace("protocol",me).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",me).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Ft={...le,br:g(Ce).replace("{2,}","*").getRegex(),text:g(le.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},K={normal:ue,gfm:ot,pedantic:ct},H={normal:ge,gfm:le,breaks:Ft,pedantic:Nt},Gt={"&":"&","<":"<",">":">",'"':""","'":"'"},we=r=>Gt[r];function y(r,e){if(e){if($.escapeTest.test(r))return r.replace($.escapeReplace,we)}else if($.escapeTestNoEncode.test(r))return r.replace($.escapeReplaceNoEncode,we);return r}function Xt(r){return $.numericCharacterReference.test(r)?r.replace($.numericCharacterReferenceOrAmpersand,(e,t,s)=>{if(t===void 0&&s===void 0)return"&";let n=t===void 0?Number.parseInt(s,16):Number.parseInt(t,10);return n===0||n>1114111||n>=55296&&n<=57343?"\uFFFD":n===38?"&":String.fromCodePoint(n)}):r}function $e(r){try{r=encodeURI(r).replace($.percentDecode,"%")}catch(e){return null}return r}function Se(r,e){var i;let t=r.replace($.findPipe,(l,o,a)=>{let h=!1,c=o;for(;--c>=0&&a[c]==="\\";)h=!h;return h?"|":" |"}),s=t.split($.splitPipe),n=0;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);else for(;s.length<e;)s.push("");for(;n<s.length;n++)s[n]=s[n].trim().replace($.slashPipe,"|");return s}function z(r,e,t){let s=r.length;if(s===0)return"";let n=0;for(;n<s;){let i=r.charAt(s-n-1);if(i===e&&!t)n++;else if(i!==e&&t)n++;else break}return r.slice(0,s-n)}function ye(r){let e=r.split(`
`),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
`)}function te(r){return r.trim().toLowerCase().toUpperCase().toLowerCase()}function Re(r,e){if(r.indexOf(e[0])===-1&&r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function V(r,e=0){let t=e,s="";for(let n of r)if(n===" "){let i=4-t%4;s+=" ".repeat(i),t+=i}else s+=n,t++;return s}function Ae(r,e,t,s,n){let i=e.href,l=e.title||null,o=r[1].replace(n.other.outputLinkReplace,"$1"),a=r[0].charAt(0)==="!",h=s.state.inLink,c=s.state.linkEmitted,p=s.state.inRawBlock;s.state.inLink=!0,s.state.linkEmitted=!1;let k=s.inlineTokens(o),u=s.state.linkEmitted;if(s.state.linkEmitted=c,s.state.inLink=h,!a){if(u){s.state.inRawBlock=p;return}s.state.linkEmitted=!0}return{type:a?"image":"link",raw:t,href:i,title:l,text:o,tokens:k}}function Wt(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
`).map(i=>{let l=i.match(t.other.beginningSpace);if(l===null)return i;let[o]=l;return i.slice(Math.min(o.length,n.length))}).join(`
`)}function Te(r,e,t,s){if(!e.includes("<"))return!1;for(let n=0;n<e.length;n++){if(e[n]==="\\"){n++;continue}if(e[n]==="`"){let o=s.inline.code.exec(e.slice(n));if(o){n+=o[0].length-1;continue}}if(e[n]!=="<")continue;let i=r.slice(t+n),l=s.inline.tag.exec(i)||s.inline.autolink.exec(i);if(l){if(l[0].length>e.length-n)return!0;n+=l[0].length-1}}return!1}var B=class{constructor(r){x(this,"options");x(this,"rules");x(this,"lexer");this.options=r||_}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:ye(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=Wt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=z(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceTabChar.test(s))&&(t=s.trim())}return{type:"heading",raw:z(e[0],`
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:z(e[0],`
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=z(e[0],`
`).split(`
`),s="",n="",i=[];for(;t.length>0;){let l=!1,o=[],a;for(a=0;a<t.length;a++)if(this.rules.other.blockquoteStart.test(t[a]))o.push(t[a]),l=!0;else if(!l)o.push(t[a]);else break;t=t.slice(a);let h=o.join(`
`),c=h.replace(this.rules.other.blockquoteMarkerWhitespace,(u,w,d)=>w+V(d,w.length)).replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
${h}`:h,n=n?`${n}
${c}`:c;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=p,t.length===0)break;let k=i.at(-1);if((k==null?void 0:k.type)==="code"||(k==null?void 0:k.type)==="heading"||(k==null?void 0:k.type)==="hr"||(k==null?void 0:k.type)==="html")break;if((k==null?void 0:k.type)==="blockquote"){let u=k,w=t.join(`
`),d=u.raw+`
`+w.replace(this.rules.other.blockquoteSetextReplace2,""),f=this.blockquote(d);i[i.length-1]=f;let S=d.substring(f.raw.length).replace(/^\n/,""),m=S?S.split(`
`).length:0,P=m?t.slice(0,-m):t;P.length>0&&(s=`${s}
${P.join(`
`)}`),n=n.substring(0,n.length-u.text.length)+f.text;break}else if((k==null?void 0:k.type)==="list"){let u=k,w=u.raw+`
`+t.join(`
`),d=this.list(w);i[i.length-1]=d;let f=d.raw.length>u.raw.length?w.slice(u.raw.length+1,d.raw.length).split(`
`).length:0;if(f>0){let S=t.slice(0,f).join(`
`);s=`${s}
${S}`,n=`${n}
${S}`}t=t.slice(f);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=r,s=()=>t.length-r.length,n=e[1].trim(),i=n.length>1,l={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),a=!1;for(;r;){let c=!1,p="";if(!(e=o.exec(r))||this.rules.block.hr.test(r))break;let k=s();r=r.substring(e[0].length);let u=e[2].split(`
`,1)[0],w=e[1].length,d=this.options.pedantic?V(u,w):u.replace(this.rules.other.leadingSpaceTab,Z=>V(Z,w)),f=r.split(`
`,1)[0],S=!d.trim(),m=0;if(this.options.pedantic?(m=2,p=d.trimStart()):S?m=w+1:(m=d.search(this.rules.other.nonSpaceChar),m=m>4?1:m,p=d.slice(m),m+=w),S&&this.rules.other.blankLine.test(f)&&(r=r.substring(f.length+1),c=!0),!c){let Z=this.rules.other.nextBulletRegex(m),W=this.rules.other.hrRegex(m),I=this.rules.other.fencesBeginRegex(m),j=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(m):this.rules.other.headingBeginRegex(m),U=this.rules.other.htmlBeginRegex(m),Qe=this.rules.other.blockquoteBeginRegex(m);for(;r;){let ke=r.split(`
`,1)[0],D;if(f=ke,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),D=f):D=f.replace(this.rules.other.leadingSpaceTab,se=>V(se)),I.test(f)||j.test(f)||U.test(f)||Qe.test(f)||Z.test(f)||W.test(f))break;if(D.search(this.rules.other.nonSpaceChar)>=m||!f.trim())p+=`
`+D.slice(m);else{if(S||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||I.test(d)||j.test(d)||W.test(d))break;let se=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(f)&&this.rules.block.lheading.test(`${d}
${f}`)?` ${D.replace(/^ {0,3}/,"")}`:f;p+=`
`+se}S=!f.trim(),r=r.substring(ke.length+1),d=D.slice(m)}}let P=t.slice(k,s());l.loose||(a?l.loose=!0:this.rules.other.doubleBlankLine.test(P)&&(a=!0)),l.items.push({type:"list_item",raw:P,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]})}let h=l.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;l.raw=t.slice(0,s()).trimEnd();for(let c of l.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!l.loose){let p=c.tokens.filter(u=>u.type==="space"),k=p.length>0&&p.some(u=>this.rules.other.anyLine.test(u.raw));l.loose=k}for(let c of l.items){let p=c.tokens[0];if(c.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let k=this.rules.other.listTaskCheckbox.exec(c.raw);if(k){let u={type:"checkbox",raw:k[0]+" ",checked:k[0]!=="[ ]"};c.checked=u.checked,l.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=u.raw+c.tokens[0].raw,c.tokens[0].text=u.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(u)):c.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):c.tokens.unshift(u)}}else c.task&&(c.task=!1)}if(l.loose)for(let c of l.items){c.loose=!0;for(let p of c.tokens)p.type==="text"&&(p.type="paragraph")}return l}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=ye(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&Re(e[2],"()")!==-1)return;let t=te(e[1]).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];return{type:"def",tag:t,raw:z(e[0],`
`),href:s,title:n}}}table(r){var l;let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Se(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=(l=e[3])!=null&&l.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],i={type:"table",raw:z(e[0],`
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<t.length;o++)i.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:i.align[o]});for(let o of n)i.rows.push(Se(o,i.header.length).map((a,h)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[h]})));return i}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:z(e[0],`
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);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]}}link(r){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(r);if(e){let t=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Te(r,e[1],t,this.rules))return;let s=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let l=z(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=Re(e[2],"()");if(l===-2)return;if(l>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let n=e[2],i="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(n);l&&(n=l[1],i=l[3])}else i=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?n=n.slice(1):n=n.slice(1,-1)),Ae(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=t[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Te(r,t[1],s,this.rules))return;let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[te(n)];if(!i){let l=t[0].charAt(0);return{type:"text",raw:l,text:l}}return Ae(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){var k;let s=this.rules.inline.emStrongLDelim.exec(r);if(!s||!s[1]&&!s[2]&&!s[3]&&!s[4])return;let n=s[0][0],i=t===n,l=e.length-r.length,o=l;for(;!this.options.pedantic&&o>0&&e[o-1]===n;)o--;let a=(k=[...e.slice(Math.max(0,o-2),o)].at(-1))!=null?k:"",h=a==="*"||a==="_"||!!this.rules.inline.punctuation.exec(a);o<l&&(t=a);let c=o<l?h:!!this.rules.inline.punctuation.exec(t);if(s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))return;let p=s[1]||s[3]||"";if(!p||!t||c){let u=[...s[0]].length-1,w,d,f=u,S=0,m=l-o+u,P=!this.options.pedantic&&!!a.trim()&&(!!p||n==="*"&&!h),Z=n==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(Z.lastIndex=0,e=e.slice(-1*r.length+u);(s=Z.exec(e))!==null;){if(w=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!w)continue;if(d=[...w].length,s[3]||s[4]){f+=d;continue}else if(s[5]||s[6]||P){if(i&&(s[5]||s[6]))break;if(m%3&&!((m+d)%3)){S+=d;continue}}if(f-=d,f>0)continue;d=Math.min(d,d+f+S);let W=[...s[0]][0].length,I=r.slice(0,u+s.index+W+d);if(Math.min(u,d)%2){let U=I.slice(1,-1);return{type:"em",raw:I,text:U,tokens:this.lexer.inlineTokens(U)}}let j=I.slice(2,-2);return{type:"strong",raw:I,text:j,tokens:this.lexer.inlineTokens(j)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){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);return s&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,l,o=n,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*r.length+n);(s=a.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==n))continue;if(s[3]||s[4]){o+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o);let h=[...s[0]][0].length,c=r.slice(0,n+s.index+h+l),p=c.slice(n,-n);return{type:"del",raw:c,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,autolink:!0,tokens:[{type:"text",raw:t,text:t}]}}}url(r){var t,s;let e;if(e=this.rules.inline.url.exec(r)){let n,i;if(e[2]==="@")n=e[0],i="mailto:"+n;else{let l;do l=e[0],e[0]=(s=(t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])!=null?s:"";while(l!==e[0]);n=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:n,href:i,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:t?e[0]:Xt(e[0]),escaped:t}}}},Q,ve,Ze,q,R=(q=class{constructor(e){fe(this,Q);x(this,"tokens");x(this,"options");x(this,"state");x(this,"inlineQueue");x(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_,this.options.tokenizer=this.options.tokenizer||new B,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:$,block:K.normal,inline:H.normal};this.options.pedantic?(t.block=K.pedantic,t.inline=H.pedantic):this.options.gfm&&(t.block=K.gfm,this.options.breaks?t.inline=H.breaks:t.inline=H.gfm),this.tokenizer.rules=t}static get rules(){return{block:K,inline:H}}static lex(e,t){return new q(t).lex(e)}static lexInline(e,t){return new q(t).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.state.inRawBlock=!1,this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){var i,l,o;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace($.tabCharGlobal," ").replace($.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let a;if((l=(i=this.options.extensions)==null?void 0:i.block)!=null&&l.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=t.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
`:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=t.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
`)?"":`
`)+a.raw,c.text+=`
`+a.text,this.inlineQueue.at(-1).src=c.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let c=t.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
`)?"":`
`)+a.raw,c.text+=`
`+a.raw,this.inlineQueue.at(-1).src=c.text):(this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title}),t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let h=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,p=e.slice(1),k;this.options.extensions.startBlock.forEach(u=>{k=u.call({lexer:this},p),typeof k=="number"&&k>=0&&(c=Math.min(c,k))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(h))){let c=t.at(-1);s&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
`)?"":`
`)+a.raw,c.text+=`
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(a),s=h.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let c=t.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
`)?"":`
`)+a.raw,c.text+=`
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let n=s[0],i=n.lastIndexOf("[");if(!(n.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,te(n.slice(i+1,-1))))&&!(i>1&&this.linkInText(n.slice(1,i-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=this.state.linkParenPossible;this.state.linkParenPossible=s&&e.includes(")");try{return ie(this,Q,ve).call(this,e,t)}finally{this.state.linkParenPossible=s}}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},Q=new WeakSet,ve=function(e,t){var o,a,h,c;let s=e.includes("*")||e.includes("_")||e.includes("~")||(o=this.options.hooks)!=null&&o.emStrongMask||this.tokenizer.emStrong!==B.prototype.emStrong||this.tokenizer.del!==B.prototype.del?ie(this,Q,Ze).call(this,e):e,n=!1,i="",l=1/0;for(;e;){if(e.length<l)l=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}n||(i=""),n=!1;let p;if((h=(a=this.options.extensions)==null?void 0:a.inline)!=null&&h.some(u=>(p=u.call({lexer:this},e,t))?(e=e.substring(p.raw.length),t.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);let u=t.at(-1);p.type==="text"&&(u==null?void 0:u.type)==="text"?(u.raw+=p.raw,u.text+=p.text):t.push(p);continue}if(p=this.tokenizer.emStrong(e,s,i)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.del(e,s,i)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),t.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),t.push(p);continue}let k=e;if((c=this.options.extensions)!=null&&c.startInline){let u=1/0,w=e.slice(1),d;this.options.extensions.startInline.forEach(f=>{d=f.call({lexer:this},w),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(k=e.substring(0,u+1))}if(p=this.tokenizer.inlineText(k)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(i=p.raw.slice(-1)),n=!0;let u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=p.raw,u.text+=p.text):t.push(p);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t},Ze=function(e){var s,n,i;let t=e;if(this.tokens.links&&e.includes("[")){let l=this.tokenizer.rules.inline.reflinkSearch,o=a=>{let h=a.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,te(a.slice(h+1,-1))))return a;if(h>1&&a.charAt(0)!=="!"){let c=a.slice(1,h-1);if(this.linkInText(c))return"["+c.replace(l,o)+"]["+"a".repeat(a.length-h-2)+"]"}return"["+"a".repeat(a.length-2)+"]"};t=t.replace(l,o)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(l,o,a)=>a?"+".repeat(l.length):o?o+l.slice(o.length,-o.length).replace(/`/g,"+")+o:l),t=t.replace(this.tokenizer.rules.inline.blockSkip,(l,o,a)=>{let h=a?a.length:0;return l.slice(0,h)+"["+"a".repeat(l.length-h-2)+"]"}),t=(i=(n=(s=this.options.hooks)==null?void 0:s.emStrongMask)==null?void 0:n.call({lexer:this},t))!=null?i:t,t},q),N=class{constructor(r){x(this,"options");x(this,"parser");this.options=r||_}space(r){return""}code({text:r,lang:e,escaped:t}){var i;let s=(i=(e||"").match($.notSpaceStart))==null?void 0:i[0],n=r?r.replace($.endingNewline,"")+`
`:"";return s?'<pre><code class="language-'+y(s)+'">'+(t?n:y(n,!0))+`</code></pre>
`:"<pre><code>"+(t?n:y(n,!0))+`</code></pre>
`}blockquote({tokens:r}){return`<blockquote>
${this.parser.parse(r)}</blockquote>
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
`}hr(r){return`<hr>
`}list(r){let e=r.ordered,t=r.start,s="";for(let l=0;l<r.items.length;l++){let o=r.items[l];s+=this.listitem(o)}let n=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+n+i+`>
`+s+"</"+n+`>
`}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
`}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let i=r.rows[n];t="";for(let l=0;l<i.length;l++)t+=this.tablecell(i[l]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+s+`</table>
`}tablerow({text:r}){return`<tr>
${r}</tr>
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${y(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,text:t,tokens:s,autolink:n}){let i=n?y(t,!0):this.parser.parseInline(s),l=$e(r);if(l===null)return i;r=y(l,n);let o='<a href="'+r+'"';return e&&(o+=' title="'+y(e)+'"'),o+=">"+i+"</a>",o}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=$e(r);if(n===null)return y(t);r=n;let i=`<img src="${y(r)}" alt="${y(t)}"`;return e&&(i+=` title="${y(e)}"`),i+=">",i}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:y(r.text)}},ne=class{constructor(){x(this,"parser")}strong({text:r,tokens:e}){return e?this.parser.parseInline(e,this):r}em({text:r,tokens:e}){return e?this.parser.parseInline(e,this):r}codespan({text:r}){return r}del({text:r,tokens:e}){return e?this.parser.parseInline(e,this):r}html({text:r}){return r}text({text:r}){return r}link({text:r,tokens:e}){return e?this.parser.parseInline(e,this):r}image({text:r,tokens:e}){return e?this.parser.parseInline(e,this):r}br(){return""}checkbox({raw:r}){return r}},A=class ae{constructor(e){x(this,"options");x(this,"renderer");x(this,"textRenderer");this.options=e||_,this.options.renderer=this.options.renderer||new N,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ne,this.textRenderer.parser=this}static parse(e,t){return new ae(t).parse(e)}static parseInline(e,t){return new ae(t).parseInline(e)}parse(e){var s,n;this.renderer.parser=this;let t="";for(let i=0;i<e.length;i++){let l=e[i];if((n=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&n[l.type]){let a=l,h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(a.type)){t+=h||"";continue}}let o=l;switch(o.type){case"space":{t+=this.renderer.space(o);break}case"hr":{t+=this.renderer.hr(o);break}case"heading":{t+=this.renderer.heading(o);break}case"code":{t+=this.renderer.code(o);break}case"table":{t+=this.renderer.table(o);break}case"blockquote":{t+=this.renderer.blockquote(o);break}case"list":{t+=this.renderer.list(o);break}case"checkbox":{t+=this.renderer.checkbox(o);break}case"html":{t+=this.renderer.html(o);break}case"def":{t+=this.renderer.def(o);break}case"paragraph":{t+=this.renderer.paragraph(o);break}case"text":{t+=this.renderer.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return t}parseInline(e,t=this.renderer){var n,i;this.renderer.parser=this;let s="";for(let l=0;l<e.length;l++){let o=e[l];if((i=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&i[o.type]){let h=this.options.extensions.renderers[o.type].call({parser:this},o);if(h!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(o.type)){s+=h||"";continue}}let a=o;switch(a.type){case"escape":{s+=t.text(a);break}case"html":{s+=t.html(a);break}case"link":{s+=t.link(a);break}case"image":{s+=t.image(a);break}case"checkbox":{s+=t.checkbox(a);break}case"strong":{s+=t.strong(a);break}case"em":{s+=t.em(a);break}case"codespan":{s+=t.codespan(a);break}case"br":{s+=t.br(a);break}case"del":{s+=t.del(a);break}case"text":{s+=t.text(a);break}default:{let h='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return s}},Y,O=(Y=class{constructor(r){x(this,"options");x(this,"block");this.options=r||_}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?R.lex:R.lexInline}provideParser(r=this.block){return r?A.parse:A.parseInline}},x(Y,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),x(Y,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Y);function L(r,e){if(Array.isArray(e))for(let t=0;t<e.length;t++)r.push(e[t]);else r.push(e)}var De=class{constructor(...r){x(this,"defaults",re());x(this,"options",this.setOptions);x(this,"parse",this.parseMarkdown(!0));x(this,"parseInline",this.parseMarkdown(!1));x(this,"Parser",A);x(this,"Renderer",N);x(this,"TextRenderer",ne);x(this,"Lexer",R);x(this,"Tokenizer",B);x(this,"Hooks",O);this.use(...r)}walkTokens(r,e){var s,n;let t=[];for(let i of r)switch(L(t,e.call(this,i)),i.type){case"table":{let l=i;for(let o of l.header)L(t,this.walkTokens(o.tokens,e));for(let o of l.rows)for(let a of o)L(t,this.walkTokens(a.tokens,e));break}case"list":{let l=i;L(t,this.walkTokens(l.items,e));break}default:{let l=i;(n=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&n[l.type]?this.defaults.extensions.childTokens[l.type].forEach(o=>{let a=l[o].flat(1/0);L(t,this.walkTokens(a,e))}):l.tokens&&L(t,this.walkTokens(l.tokens,e))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let i=e.renderers[n.name];i?e.renderers[n.name]=function(...l){let o=n.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[n.level];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]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),t.renderer){let n=this.defaults.renderer||new N(this.defaults);for(let i in t.renderer){if(!(i in n))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=t.renderer[l],a=n[l];n[l]=(...h)=>{let c=o.apply(n,h);return c===!1&&(c=a.apply(n,h)),c||""}}s.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new B(this.defaults);for(let i in t.tokenizer){if(!(i in n))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=t.tokenizer[l],a=n[l];n[l]=(...h)=>{let c=o.apply(n,h);return c===!1&&(c=a.apply(n,h)),c}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new O;for(let i in t.hooks){if(!(i in n))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,o=t.hooks[l],a=n[l];O.passThroughHooks.has(i)?n[l]=h=>{if(n.options.async&&O.passThroughHooksRespectAsync.has(i))return(async()=>{let p=await o.call(n,h);return a.call(n,p)})();let c=o.call(n,h);return a.call(n,c)}:n[l]=(...h)=>{if(n.options.async)return(async()=>{let p=await o.apply(n,h);return p===!1&&(p=await a.apply(n,h)),p})();let c=o.apply(n,h);return c===!1&&(c=a.apply(n,h)),c}}s.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),n&&L(o,n.call(this,l)),o}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return R.lex(r,e!=null?e:this.defaults)}parser(r,e){return A.parse(r,e!=null?e:this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},n={...this.defaults,...s},i=this.onError(!!n.silent,!!n.async);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."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=r),n.async)return(async()=>{let l=n.hooks?await n.hooks.preprocess(e):e,o=await(n.hooks?await n.hooks.provideLexer(r):r?R.lex:R.lexInline)(l,n),a=n.hooks?await n.hooks.processAllTokens(o):o;n.walkTokens&&await Promise.all(this.walkTokens(a,n.walkTokens));let h=await(n.hooks?await n.hooks.provideParser(r):r?A.parse:A.parseInline)(a,n);return n.hooks?await n.hooks.postprocess(h):h})().catch(i);try{n.hooks&&(e=n.hooks.preprocess(e));let l=(n.hooks?n.hooks.provideLexer(r):r?R.lex:R.lexInline)(e,n);n.hooks&&(l=n.hooks.processAllTokens(l)),n.walkTokens&&this.walkTokens(l,n.walkTokens);let o=(n.hooks?n.hooks.provideParser(r):r?A.parse:A.parseInline)(l,n);return n.hooks&&(o=n.hooks.postprocess(o)),o}catch(l){return i(l)}}}onError(r,e){return t=>{if(t.message+=`
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+y(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},v=new De;function b(r,e){return v.parse(r,e)}b.options=b.setOptions=function(r){return v.setOptions(r),b.defaults=v.defaults,ze(b.defaults),b};b.getDefaults=re;b.defaults=_;function Oe(...r){return v.use(...r),b.defaults=v.defaults,ze(b.defaults),b}b.use=Oe;b.walkTokens=function(r,e){return v.walkTokens(r,e)};b.parseInline=v.parseInline;b.Parser=A;b.parser=A.parse;b.Renderer=N;b.TextRenderer=ne;b.Lexer=R;b.lexer=R.lex;b.Tokenizer=B;b.Hooks=O;b.parse=b;var Ut=b.options,Jt=b.setOptions,Kt=b.walkTokens,Vt=b.parseInline,Yt=b,er=A.parse,tr=R.lex;return Xe(rr);})();