aptolix_chatbot 1.0.5 → 1.0.7
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.
- package/.gitattributes +63 -0
- package/.vs/Aptolix_Chatbot/CopilotIndices/17.14.1368.60722/CodeChunks.db +0 -0
- package/.vs/Aptolix_Chatbot/CopilotIndices/{17.14.995.13737 → 17.14.1368.60722}/SemanticSymbols.db +0 -0
- package/.vs/Aptolix_Chatbot/FileContentIndex/6af43a12-1809-4220-acbe-157eada43878.vsidx +0 -0
- package/.vs/Aptolix_Chatbot/FileContentIndex/cb041aa7-a0e1-4bca-8679-9fa832fdb7f8.vsidx +0 -0
- package/.vs/Aptolix_Chatbot/FileContentIndex/e6968f22-96d6-4c7a-82cb-14a6ddf57328.vsidx +0 -0
- package/.vs/Aptolix_Chatbot/copilot-chat/c320fb0f/sessions/59f54b6a-d7a7-4560-8de1-6ab7fc64e20d +0 -0
- package/.vs/Aptolix_Chatbot/v17/.wsuo +0 -0
- package/.vs/Aptolix_Chatbot/v17/DocumentLayout.backup.json +28 -24
- package/.vs/Aptolix_Chatbot/v17/DocumentLayout.json +28 -24
- package/.vs/VSWorkspaceState.json +0 -1
- package/.vs/slnx.sqlite +0 -0
- package/dist/web.mjs +1 -1
- package/dist/web.mjs.map +1 -1
- package/package.json +1 -1
- package/src/chatbotstyle.css +37 -0
- package/src/index.js +106 -6
- package/.vs/Aptolix_Chatbot/CopilotIndices/17.14.995.13737/CodeChunks.db +0 -0
- package/.vs/Aptolix_Chatbot/FileContentIndex/0945bb3e-9a20-4e06-945a-0aa0d0ec1cfb.vsidx +0 -0
- package/.vs/Aptolix_Chatbot/copilot-chat/c320fb0f/sessions/2a930e1c-ad70-4a85-a204-4f771e8a9966 +0 -0
package/dist/web.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var t={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function n(e){t=e}var r={exec:()=>null};function i(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(s.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var s={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},l=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,a=/(?:[*+-]|\d{1,9}[.)])/,o=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,c=i(o).replace(/bull/g,a).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(),p=i(o).replace(/bull/g,a).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(),h=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,u=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,d=i(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",u).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),g=i(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,a).getRegex(),x="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",b=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,f=i("^ {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[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",b).replace("tag",x).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k=i(h).replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",x).getRegex(),m={blockquote:i(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",k).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:d,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:l,html:f,lheading:c,list:g,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:k,table:r,text:/^[^\n]+/},w=i("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",x).getRegex(),y={...m,lheading:p,table:w,paragraph:i(h).replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",w).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",x).getRegex()},$={...m,html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",b).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:r,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:i(h).replace("hr",l).replace("heading"," *#{1,6} *[^\n]").replace("lheading",c).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},S=/^( {2,}|\\)\n(?!\s*$)/,z=/[\p{P}\p{S}]/u,T=/[\s\p{P}\p{S}]/u,v=/[^\s\p{P}\p{S}]/u,R=i(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,T).getRegex(),A=/(?!~)[\p{P}\p{S}]/u,C=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,_=i(C,"u").replace(/punct/g,z).getRegex(),E=i(C,"u").replace(/punct/g,A).getRegex(),L="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",q=i(L,"gu").replace(/notPunctSpace/g,v).replace(/punctSpace/g,T).replace(/punct/g,z).getRegex(),P=i(L,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,A).getRegex(),I=i("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,v).replace(/punctSpace/g,T).replace(/punct/g,z).getRegex(),B=i(/\\(punct)/,"gu").replace(/punct/g,z).getRegex(),H=i(/^<(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(),M=i(b).replace("(?:--\x3e|$)","--\x3e").getRegex(),Z=i("^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",M).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),N=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,j=i(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",N).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),D=i(/^!?\[(label)\]\[(ref)\]/).replace("label",N).replace("ref",u).getRegex(),O=i(/^!?\[(ref)\](?:\[\])?/).replace("ref",u).getRegex(),Q={_backpedal:r,anyPunctuation:B,autolink:H,blockSkip:/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,br:S,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:r,emStrongLDelim:_,emStrongRDelimAst:q,emStrongRDelimUnd:I,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:j,nolink:O,punctuation:R,reflink:D,reflinkSearch:i("reflink|nolink(?!\\()","g").replace("reflink",D).replace("nolink",O).getRegex(),tag:Z,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:r},G={...Q,link:i(/^!?\[(label)\]\((.*?)\)/).replace("label",N).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",N).getRegex()},F={...Q,emStrongRDelimAst:P,emStrongLDelim:E,url:i(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},U={...F,br:i(S).replace("{2,}","*").getRegex(),text:i(F.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},W={normal:m,gfm:y,pedantic:$},X={normal:Q,gfm:F,breaks:U,pedantic:G},Y={"&":"&","<":"<",">":">",'"':""","'":"'"},J=e=>Y[e];function K(e,t){if(t){if(s.escapeTest.test(e))return e.replace(s.escapeReplace,J)}else if(s.escapeTestNoEncode.test(e))return e.replace(s.escapeReplaceNoEncode,J);return e}function V(e){try{e=encodeURI(e).replace(s.percentDecode,"%")}catch{return null}return e}function ee(e,t){let n=e.replace(s.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(s.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(s.slashPipe,"|");return n}function te(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){let s=e.charAt(r-i-1);if(s!==t||n){if(s===t||!n)break;i++}else i++}return e.slice(0,r-i)}function ne(e,t,n,r,i){let s=t.href,l=t.title||null,a=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let o={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:s,title:l,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,o}var re=class{options;rules;lexer;constructor(e){this.options=e||t}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:te(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split("\n").map(e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=te(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:te(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=te(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,s=!1,l=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))l.push(e[t]),s=!0;else{if(s)break;l.push(e[t])}e=e.slice(t);let a=l.join("\n"),o=a.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${a}`:a,r=r?`${r}\n${o}`:o;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(o,i,!0),this.lexer.state.top=c,0===e.length)break;let p=i.at(-1);if("code"===p?.type)break;if("blockquote"===p?.type){let t=p,s=t.raw+"\n"+e.join("\n"),l=this.blockquote(s);i[i.length-1]=l,n=n.substring(0,n.length-t.raw.length)+l.raw,r=r.substring(0,r.length-t.text.length)+l.text;break}if("list"===p?.type){let t=p,s=t.raw+"\n"+e.join("\n"),l=this.list(s);i[i.length-1]=l,n=n.substring(0,n.length-p.raw.length)+l.raw,r=r.substring(0,r.length-t.raw.length)+l.raw,e=s.substring(i.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),l=!1;for(;e;){let n=!1,r="",a="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let o=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),c=e.split("\n",1)[0],p=!o.trim(),h=0;if(this.options.pedantic?(h=2,a=o.trimStart()):p?h=t[1].length+1:(h=t[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=o.slice(h),h+=t[1].length),p&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),i=this.rules.other.fencesBeginRegex(h),s=this.rules.other.headingBeginRegex(h),l=this.rules.other.htmlBeginRegex(h);for(;e;){let u,d=e.split("\n",1)[0];if(c=d,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),u=c):u=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||s.test(c)||l.test(c)||t.test(c)||n.test(c))break;if(u.search(this.rules.other.nonSpaceChar)>=h||!c.trim())a+="\n"+u.slice(h);else{if(p||o.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(o)||s.test(o)||n.test(o))break;a+="\n"+c}!p&&!c.trim()&&(p=!0),r+=d+"\n",e=e.substring(d.length+1),o=u.slice(h)}}i.loose||(l?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(l=!0));let u,d=null;this.options.gfm&&(d=this.rules.other.listIsTask.exec(a),d&&(u="[ ] "!==d[0],a=a.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!d,checked:u,loose:!1,text:a,tokens:[]}),i.raw+=r}let a=i.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>"space"===e.type),n=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));i.loose=n}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ee(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?s.align.push("right"):this.rules.other.tableAlignCenter.test(e)?s.align.push("center"):this.rules.other.tableAlignLeft.test(e)?s.align.push("left"):s.align.push(null);for(let e=0;e<n.length;e++)s.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:s.align[e]});for(let e of i)s.rows.push(ee(e,s.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:s.align[t]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=te(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),ne(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return ne(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!n||this.rules.inline.punctuation.exec(n))){let n,i,s=[...r[0]].length-1,l=s,a=0,o="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(o.lastIndex=0,t=t.slice(-1*e.length+s);null!=(r=o.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(i=[...n].length,r[3]||r[4]){l+=i;continue}if((r[5]||r[6])&&s%3&&!((s+i)%3)){a+=i;continue}if(l-=i,l>0)continue;i=Math.min(i,i+l+a);let t=[...r[0]][0].length,o=e.slice(0,s+r.index+t+i);if(Math.min(s,i)%2){let e=o.slice(1,-1);return{type:"em",raw:o,text:e,tokens:this.lexer.inlineTokens(e)}}let c=o.slice(2,-2);return{type:"strong",raw:o,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},ie=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t,this.options.tokenizer=this.options.tokenizer||new re,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:s,block:W.normal,inline:X.normal};this.options.pedantic?(n.block=W.pedantic,n.inline=X.pedantic):this.options.gfm&&(n.block=W.gfm,this.options.breaks?n.inline=X.breaks:n.inline=X.gfm),this.tokenizer.rules=n}static get rules(){return{block:W,inline:X}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(s.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(s.tabCharGlobal," ").replace(s.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach(e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&"paragraph"===s?.type?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,s="";for(;e;){let r;if(i||(s=""),i=!1,this.options.extensions?.inline?.some(n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===r.type&&"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,s)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let l=e;if(this.options.extensions?.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach(e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(l=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(l)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(s=r.raw.slice(-1)),i=!0;let n=t.at(-1);"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},se=class{options;parser;constructor(e){this.options=e||t}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(s.notSpaceStart)?.[0],i=e.replace(s.endingNewline,"")+"\n";return r?'<pre><code class="language-'+K(r)+'">'+(n?i:K(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:K(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+K(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n="";for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${K(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=V(e);if(null===i)return r;let s='<a href="'+(e=i)+'"';return t&&(s+=' title="'+K(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=V(e);if(null===i)return K(n);let s=`<img src="${e=i}" alt="${n}"`;return t&&(s+=` title="${K(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:K(e.text)}},le=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},ae=class e{options;renderer;textRenderer;constructor(e){this.options=e||t,this.options.renderer=this.options.renderer||new se,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new le}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){n+=t||"";continue}}let s=i;switch(s.type){case"space":n+=this.renderer.space(s);continue;case"hr":n+=this.renderer.hr(s);continue;case"heading":n+=this.renderer.heading(s);continue;case"code":n+=this.renderer.code(s);continue;case"table":n+=this.renderer.table(s);continue;case"blockquote":n+=this.renderer.blockquote(s);continue;case"list":n+=this.renderer.list(s);continue;case"html":n+=this.renderer.html(s);continue;case"def":n+=this.renderer.def(s);continue;case"paragraph":n+=this.renderer.paragraph(s);continue;case"text":{let i=s,l=this.renderer.text(i);for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],l+="\n"+this.renderer.text(i);n+=t?this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):l;continue}default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=e||"";continue}}let s=i;switch(s.type){case"escape":case"text":n+=t.text(s);break;case"html":n+=t.html(s);break;case"link":n+=t.link(s);break;case"image":n+=t.image(s);break;case"strong":n+=t.strong(s);break;case"em":n+=t.em(s);break;case"codespan":n+=t.codespan(s);break;case"br":n+=t.br(s);break;case"del":n+=t.del(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},oe=class{options;block;constructor(e){this.options=e||t}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ie.lex:ie.lexInline}provideParser(){return this.block?ae.parse:ae.parseInline}},ce=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ae;Renderer=se;TextRenderer=le;Lexer=ie;Tokenizer=re;Hooks=oe;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new se(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,i=e.renderer[r],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new re(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,i=e.tokenizer[r],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new oe;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,i=e.hooks[r],s=t[r];oe.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>s.call(t,e));let n=i.call(t,e);return s.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ie.lex(e,t??this.defaults)}parser(e,t){return ae.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return s(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 t>"u"||null===t)return s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let l=i.hooks?i.hooks.provideLexer():e?ie.lex:ie.lexInline,a=i.hooks?i.hooks.provideParser():e?ae.parse:ae.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>l(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>a(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let e=l(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=a(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return s(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+K(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function pe(e,t){return ce.parse(e,t)}pe.options=pe.setOptions=function(e){return ce.setOptions(e),pe.defaults=ce.defaults,n(pe.defaults),pe},pe.getDefaults=e,pe.defaults=t,pe.use=function(...e){return ce.use(...e),pe.defaults=ce.defaults,n(pe.defaults),pe},pe.walkTokens=function(e,t){return ce.walkTokens(e,t)},pe.parseInline=ce.parseInline,pe.Parser=ae,pe.parser=ae.parse,pe.Renderer=se,pe.TextRenderer=le,pe.Lexer=ie,pe.lexer=ie.lex,pe.Tokenizer=re,pe.Hooks=oe,pe.parse=pe,pe.options,pe.setOptions,pe.use,pe.walkTokens,pe.parseInline,ae.parse,ie.lex;!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}('#aptolix-chat-window{background:#f6f3ff;border:2.5px solid #9333ea;border-radius:16px;box-shadow:0 12px 40px rgba(167,139,250,.12);box-sizing:border-box;display:flex;flex-direction:column;font-family:Inter,sans-serif;height:100%;margin:0;max-height:100%;max-width:100%;min-height:0;min-width:0;overflow:hidden;width:100%}#aptolix-chat-header{align-items:center;background:#9333ea;border-bottom:2px solid #ede9fe;color:#fff;display:flex;font-size:1.15rem;font-weight:600;justify-content:space-between;padding:18px 16px 16px}.aptolix-header-title{display:flex;flex-direction:column;gap:2px;justify-content:center}.aptolix-header-subtitle{color:#ede9fe;font-size:.95rem;font-weight:400;margin-top:2px}.aptolix-header-actions{align-items:center;display:flex;gap:12px;margin-top:0}.aptolix-header-flex{align-items:center;display:flex;justify-content:space-between;width:100%}#aptolix-chat-messages{background:#f6f3ff;display:flex;flex:1 1 auto;flex-direction:column;gap:6px;min-height:120px;overflow-y:auto;padding:18px 16px 16px}.aptolix-powered-by{background:transparent;color:#a78bfa;font-size:.95rem;font-weight:500;letter-spacing:.02em;padding:10px 0 8px;text-align:center}.aptolix-powered-by .aptolix-link{color:#9333ea;font-weight:600;text-decoration:underline}#aptolix-chat-input{align-items:center;background:#fff;border-top:2px solid #ede9fe;display:flex;gap:8px;min-height:56px;padding:14px 12px}#aptolix-chat-input input{background:#f6f3ff;border:1.5px solid #d1d5db;border-radius:10px;color:#7c3aed;flex:1 1 auto;font-size:1rem;min-width:0;padding:10px 14px;transition:border .2s}#aptolix-chat-input input:focus{border-color:#a78bfa;outline:none}#aptolix-chat-input button{background:#a78bfa;border:none;border-radius:10px;box-shadow:0 2px 8px rgba(167,139,250,.1);color:#fff;cursor:pointer;flex-shrink:0;font-size:1rem;font-weight:600;padding:8px 18px;transition:background .2s,box-shadow .2s}#aptolix-chat-input button:hover{background:#7c3aed;box-shadow:0 4px 16px rgba(124,62,237,.18)}#aptolix-chat-input button:not(:first-child){background:rgba(167,139,250,.12);border-radius:8px;box-shadow:none;color:#9333ea;font-size:1.1rem;font-weight:500;padding:8px 12px}#aptolix-chat-input button:not(:first-child):hover{background:rgba(167,139,250,.22);color:#4b5563}#aptolix-chat-inputbox{background:#fff;border:1px solid #ccc;border-radius:4px;box-sizing:border-box;font-family:inherit;font-size:1rem;max-height:130px;min-height:42px;outline:none;overflow-y:auto;padding:6px 12px;resize:none;transition:border-color .2s;width:100%}.message.bot,.message.user{display:block;font-family:Inter,sans-serif;margin-bottom:0;max-width:90%;word-break:break-word}.message.user{align-self:flex-end;background:#a78bfa;border-radius:14px 14px 4px 14px;box-shadow:0 2px 8px rgba(167,139,250,.1);color:#fff;text-align:right}.message.bot,.message.user{font-weight:500;padding:8px 14px}.message.bot{align-self:flex-start;background:#ede9fe;border-radius:14px 14px 14px 4px;box-shadow:0 2px 8px rgba(167,139,250,.08);color:#4b5563;text-align:left}.message.bot a{color:#7c3aed;text-decoration:underline;word-break:break-all}.message.bot b,.message.bot strong{color:#312e81;font-weight:700}.message.bot h1,.message.bot h2,.message.bot h3{font-size:1.3rem;line-height:1.2;margin:10px 0 6px}.message.bot h2{font-size:1.15rem}.message.bot h3{font-size:1.05rem}.message.bot p{margin:10px 0}.message.bot ol,.message.bot ul{margin:8px 0 8px 18px;padding-left:18px}.message.bot ul{list-style:none;padding-left:0}.message.bot ul li{margin-bottom:4px;padding-left:1.3em;position:relative}.message.bot ul li:before{background:#9333ea;border-radius:50%;content:"";display:inline-block;height:.5em;left:.3em;position:absolute;top:.7em;width:.5em}.message.bot li{margin-bottom:4px}.message.bot code,.message.bot pre{background:#f3f4f6;border-radius:6px;color:#7c3aed;font-family:Fira Mono,Consolas,Monaco,monospace;font-size:1em;margin:8px 0;padding:4px 10px}.message.bot pre{overflow-x:auto;padding:12px 16px}.typing-dots span{animation:blink 1.2s infinite;font-size:1.5em;margin-right:2px;opacity:.5}.typing-dots span:nth-child(2){animation-delay:.2s}.typing-dots span:nth-child(3){animation-delay:.4s}@keyframes blink{0%,to{opacity:.2}50%{opacity:1}}#aptolix-chat-bubble{align-items:center;background:#9333ea;border-radius:50%;bottom:32px;box-shadow:0 6px 24px rgba(167,139,250,.18);color:#fff;cursor:pointer;display:flex;font-size:2rem;height:56px;justify-content:center;position:fixed;right:32px;transition:background .2s,box-shadow .2s;width:56px;z-index:9999}#aptolix-chat-bubble:hover{background:#7c3aed;box-shadow:0 8px 32px rgba(124,62,237,.28)}#aptolix-chat-window.bubble-mode{border-radius:16px;bottom:100px;height:595px;max-height:80vh;min-height:595px;position:fixed;right:32px;width:400px;z-index:9999}#aptolix-chat-window.section-mode{border:2px solid #a78bfa;border-radius:18px;box-shadow:0 4px 24px rgba(167,139,250,.1);height:100%;max-height:100%;max-width:100%;position:static!important;width:100%}#aptolix-chat-window.section-mode #aptolix-chat-header{background:#9333ea;color:#fff}#aptolix-chat-window.section-mode #aptolix-chat-close,#aptolix-chat-window.section-mode #aptolix-chat-expand,#aptolix-chat-window.section-mode~#aptolix-chat-bubble{display:none!important}#aptolix-chat-window.section-mode .message.user{background:#a78bfa;color:#fff}#aptolix-chat-window.section-mode .message.bot{background:#ede9fe;color:#4b5563}#aptolix-chat-window.section-mode #aptolix-chat-messages{background:#f6f3ff;padding:20px 18px 18px}@media (max-width:600px){#aptolix-chat-window,#aptolix-chat-window.bubble-mode,#aptolix-chat-window.section-mode{border-radius:12px;max-width:100vw;min-height:180px;padding:0;width:100vw}#aptolix-chat-header{font-size:1rem;padding:10px 6px 8px}#aptolix-chat-messages{padding:8px 4px 6px}#aptolix-chat-input{padding:6px 2px}}.aptolix-retry-btn{background:#ede9fe;border:none;border-radius:6px;color:#7c3aed;cursor:pointer;font-weight:600;margin-top:8px;padding:4px 12px}.aptolix-retry-btn:hover{background:#d8b4fe}');const he={init:({apiHost:e,chatflowid:t,title:n,subtitle:r,greeting:i,mode:s="bubble",target:l})=>{const a="section"===s?"section-mode":"bubble-mode";let o;"bubble"===s&&(o=document.createElement("div"),o.id="aptolix-chat-bubble",o.innerText="💬",document.body.appendChild(o));const c=document.createElement("div");if(c.id="aptolix-chat-window",c.classList.add(a),c.style.display="section"===s?"flex":"none","section"===s&&l){const e="string"==typeof l?document.querySelector(l):l;e?e.appendChild(c):document.body.appendChild(c)}else document.body.appendChild(c);c.innerHTML=`\n <div id="aptolix-chat-header">\n <div class="aptolix-header-flex">\n <div class="aptolix-header-title">\n <strong>${n||"Assistant"}</strong>\n ${r?`<div class="aptolix-header-subtitle">${r}</div>`:""}\n </div>\n <div class="aptolix-header-actions">\n <button id="aptolix-chat-reset" title="Clear chat" aria-label="Clear chat">⟲</button>\n <button id="aptolix-chat-expand" title="Expand/Collapse" aria-label="Expand/Collapse">\n <span id="aptolix-chat-expand-icon">⤢</span>\n </button>\n <button id="aptolix-chat-close" title="Close chat" aria-label="Close chat">×</button>\n </div>\n </div>\n </div>\n <div id="aptolix-chat-messages"></div>\n <div id="aptolix-chat-input">\n <textarea id="aptolix-chat-inputbox" rows="1" placeholder="Type your message..." style="resize:none"></textarea>\n <button>Send</button>\n </div>\n <div class="aptolix-powered-by">\n Powered by <a href="https://aptolix.com" target="_blank" rel="noopener" class="aptolix-link">Aptolix</a>\n </div>\n`;const p=c.querySelector("#aptolix-chat-close"),h=c.querySelector("#aptolix-chat-reset"),u=c.querySelector("#aptolix-chat-expand"),d=c.querySelector("#aptolix-chat-expand-icon"),g=c.querySelector("#aptolix-chat-inputbox"),x=c.querySelector("button"),b=c.querySelector("#aptolix-chat-messages");async function f(n=!1,r=null){const i=r||g.value.trim();if(!i)return;if(n||(g.value="",g.rows=1,g.style.height="32px",g.style.overflowY="hidden"),!n){const e=document.createElement("div");e.className="message user",e.innerText=i,b.appendChild(e),b.scrollTop=b.scrollHeight}const l=document.createElement("div");l.className="message bot typing",l.innerHTML='<span class="typing-dots"><span>.</span><span>.</span><span>.</span></span>',b.appendChild(l),b.scrollTop=b.scrollHeight;try{const n=await fetch(`${e}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:i})}),r=await n.json();l.remove();const a=document.createElement("div");a.className="message bot",a.innerHTML=pe.parse(r.text||"[No response]"),b.appendChild(a),b.scrollTop=b.scrollHeight,"bubble"===s&&"none"===c.style.display&&o.setAttribute("data-unread","true")}catch(e){!function(){l.remove();const e=document.createElement("div");e.className="message bot error",e.innerHTML='\n <div>\n <strong>⚠️ Unable to connect to the assistant.</strong><br>\n Please check your internet connection or try again later.\n </div>\n <button class="aptolix-retry-btn">Retry</button>\n ',b.appendChild(e),b.scrollTop=b.scrollHeight;const t=e.querySelector(".aptolix-retry-btn");t&&t.addEventListener("click",()=>{e.remove(),f(!0,i)})}(),"bubble"===s&&"none"===c.style.display&&o.setAttribute("data-unread","true")}}"bubble"===s&&p.addEventListener("click",()=>{c.style.display="none"}),h.addEventListener("click",()=>{b.innerHTML="",g.value="",m()}),"bubble"===s&&o&&o.addEventListener("click",()=>{const e="none"===c.style.display;c.style.display=e?"flex":"none",o.removeAttribute("data-unread"),e&&m()}),"bubble"===s&&document.addEventListener("mousedown",function(e){"none"!==c.style.display&&(c.contains(e.target)||o.contains(e.target)||(c.style.display="none"))}),x.addEventListener("click",()=>f()),g.addEventListener("keydown",e=>{"Enter"===e.key&&(e.preventDefault(),f())});let k=!1;function m(){b.querySelectorAll(".message.greeting").forEach(e=>e.remove());const e=i||"<strong>👋 Howdy, </strong>How can I help you today?",t=document.createElement("div");t.className="message bot greeting",t.innerHTML=e,b.appendChild(t),b.scrollTop=b.scrollHeight}"bubble"===s&&u.addEventListener("click",()=>{k=!k,k?(c.style.width="600px",c.style.height="80vh",d.textContent="⤡"):(c.style.width="400px",c.style.height="595px",d.textContent="⤢")}),setTimeout(m,100),g.addEventListener("input",function(){if(this.value.length>350)return void(this.value=this.value.slice(0,350));if(""===this.value)return this.rows=1,this.style.height="32px",void(this.style.overflowY="hidden");const e=this.value.split("\n");this.rows=Math.min(e.length,4);this.style.height="auto",this.style.height=Math.min(this.scrollHeight,108)+"px",this.scrollHeight>108?this.style.overflowY="auto":this.style.overflowY="hidden"})},initFull:function(e){let t=document.querySelector("aptolix-chatbot");t?Object.entries(e).forEach(([e,n])=>{t.setAttribute(e,n)}):console.warn("No <aptolix-chatbot> element found in the DOM.")}};class ue extends HTMLElement{static get observedAttributes(){return["apiHost","chatflowid","title","greeting","subtitle","target"]}connectedCallback(){this.tryInit()}attributeChangedCallback(){const e=this.querySelector("#aptolix-chat-window");e&&e.remove(),this._initialized=!1,this.tryInit()}tryInit(){const e=this.getAttribute("apiHost"),t=this.getAttribute("chatflowid");if(!e||!t)return;const n=this.getAttribute("title")||"Aptolix Assistant",r=this.getAttribute("greeting"),i=this.getAttribute("subtitle"),s=this.getAttribute("target");let l=this;if(s){const e=document.querySelector(s);e&&(l=e)}this._initialized||(this._initialized=!0,he.init({apiHost:e,chatflowid:t,title:n,subtitle:i,greeting:r,mode:"section",target:l}))}}customElements.define("aptolix-chatbot",ue);export{he as default};
|
|
1
|
+
function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var t={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function n(e){t=e}var i={exec:()=>null};function r(e,t=""){let n="string"==typeof e?e:e.source,i={replace:(e,t)=>{let r="string"==typeof t?t:t.source;return r=r.replace(s.caret,"$1"),n=n.replace(e,r),i},getRegex:()=>new RegExp(n,t)};return i}var s={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},l=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,a=/(?:[*+-]|\d{1,9}[.)])/,o=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,c=r(o).replace(/bull/g,a).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(),p=r(o).replace(/bull/g,a).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(),h=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,u=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,d=r(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",u).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),g=r(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,a).getRegex(),x="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",b=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,f=r("^ {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[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",b).replace("tag",x).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k=r(h).replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",x).getRegex(),m={blockquote:r(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",k).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:d,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:l,html:f,lheading:c,list:g,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:k,table:i,text:/^[^\n]+/},w=r("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",x).getRegex(),y={...m,lheading:p,table:w,paragraph:r(h).replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",w).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",x).getRegex()},S={...m,html:r("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",b).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:i,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:r(h).replace("hr",l).replace("heading"," *#{1,6} *[^\n]").replace("lheading",c).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},$=/^( {2,}|\\)\n(?!\s*$)/,v=/[\p{P}\p{S}]/u,T=/[\s\p{P}\p{S}]/u,z=/[^\s\p{P}\p{S}]/u,R=r(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,T).getRegex(),A=/(?!~)[\p{P}\p{S}]/u,C=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,E=r(C,"u").replace(/punct/g,v).getRegex(),L=r(C,"u").replace(/punct/g,A).getRegex(),_="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",I=r(_,"gu").replace(/notPunctSpace/g,z).replace(/punctSpace/g,T).replace(/punct/g,v).getRegex(),q=r(_,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,A).getRegex(),P=r("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,z).replace(/punctSpace/g,T).replace(/punct/g,v).getRegex(),B=r(/\\(punct)/,"gu").replace(/punct/g,v).getRegex(),H=r(/^<(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(),M=r(b).replace("(?:--\x3e|$)","--\x3e").getRegex(),Z=r("^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",M).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),N=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,j=r(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",N).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),D=r(/^!?\[(label)\]\[(ref)\]/).replace("label",N).replace("ref",u).getRegex(),O=r(/^!?\[(ref)\](?:\[\])?/).replace("ref",u).getRegex(),Q={_backpedal:i,anyPunctuation:B,autolink:H,blockSkip:/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,br:$,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:i,emStrongLDelim:E,emStrongRDelimAst:I,emStrongRDelimUnd:P,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:j,nolink:O,punctuation:R,reflink:D,reflinkSearch:r("reflink|nolink(?!\\()","g").replace("reflink",D).replace("nolink",O).getRegex(),tag:Z,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:i},G={...Q,link:r(/^!?\[(label)\]\((.*?)\)/).replace("label",N).getRegex(),reflink:r(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",N).getRegex()},U={...Q,emStrongRDelimAst:q,emStrongLDelim:L,url:r(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},F={...U,br:r($).replace("{2,}","*").getRegex(),text:r(U.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Y={normal:m,gfm:y,pedantic:S},W={normal:Q,gfm:U,breaks:F,pedantic:G},X={"&":"&","<":"<",">":">",'"':""","'":"'"},J=e=>X[e];function K(e,t){if(t){if(s.escapeTest.test(e))return e.replace(s.escapeReplace,J)}else if(s.escapeTestNoEncode.test(e))return e.replace(s.escapeReplaceNoEncode,J);return e}function V(e){try{e=encodeURI(e).replace(s.percentDecode,"%")}catch{return null}return e}function ee(e,t){let n=e.replace(s.findPipe,(e,t,n)=>{let i=!1,r=t;for(;--r>=0&&"\\"===n[r];)i=!i;return i?"|":" |"}).split(s.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(s.slashPipe,"|");return n}function te(e,t,n){let i=e.length;if(0===i)return"";let r=0;for(;r<i;){let s=e.charAt(i-r-1);if(s!==t||n){if(s===t||!n)break;r++}else r++}return e.slice(0,i-r)}function ne(e,t,n,i,r){let s=t.href,l=t.title||null,a=e[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let o={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:s,title:l,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,o}var ie=class{options;rules;lexer;constructor(e){this.options=e||t}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:te(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(null===i)return t;let r=i[1];return t.split("\n").map(e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[i]=t;return i.length>=r.length?e.slice(r.length):e}).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=te(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:te(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=te(t[0],"\n").split("\n"),n="",i="",r=[];for(;e.length>0;){let t,s=!1,l=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))l.push(e[t]),s=!0;else{if(s)break;l.push(e[t])}e=e.slice(t);let a=l.join("\n"),o=a.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${a}`:a,i=i?`${i}\n${o}`:o;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(o,r,!0),this.lexer.state.top=c,0===e.length)break;let p=r.at(-1);if("code"===p?.type)break;if("blockquote"===p?.type){let t=p,s=t.raw+"\n"+e.join("\n"),l=this.blockquote(s);r[r.length-1]=l,n=n.substring(0,n.length-t.raw.length)+l.raw,i=i.substring(0,i.length-t.text.length)+l.text;break}if("list"===p?.type){let t=p,s=t.raw+"\n"+e.join("\n"),l=this.list(s);r[r.length-1]=l,n=n.substring(0,n.length-p.raw.length)+l.raw,i=i.substring(0,i.length-t.raw.length)+l.raw,e=s.substring(r.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:n,tokens:r,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),i=n.length>1,r={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 s=this.rules.other.listItemRegex(n),l=!1;for(;e;){let n=!1,i="",a="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;i=t[0],e=e.substring(i.length);let o=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),c=e.split("\n",1)[0],p=!o.trim(),h=0;if(this.options.pedantic?(h=2,a=o.trimStart()):p?h=t[1].length+1:(h=t[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=o.slice(h),h+=t[1].length),p&&this.rules.other.blankLine.test(c)&&(i+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),s=this.rules.other.headingBeginRegex(h),l=this.rules.other.htmlBeginRegex(h);for(;e;){let u,d=e.split("\n",1)[0];if(c=d,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),u=c):u=c.replace(this.rules.other.tabCharGlobal," "),r.test(c)||s.test(c)||l.test(c)||t.test(c)||n.test(c))break;if(u.search(this.rules.other.nonSpaceChar)>=h||!c.trim())a+="\n"+u.slice(h);else{if(p||o.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||r.test(o)||s.test(o)||n.test(o))break;a+="\n"+c}!p&&!c.trim()&&(p=!0),i+=d+"\n",e=e.substring(d.length+1),o=u.slice(h)}}r.loose||(l?r.loose=!0:this.rules.other.doubleBlankLine.test(i)&&(l=!0));let u,d=null;this.options.gfm&&(d=this.rules.other.listIsTask.exec(a),d&&(u="[ ] "!==d[0],a=a.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:i,task:!!d,checked:u,loose:!1,text:a,tokens:[]}),r.raw+=i}let a=r.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++)if(this.lexer.state.top=!1,r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]),!r.loose){let t=r.items[e].tokens.filter(e=>"space"===e.type),n=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));r.loose=n}if(r.loose)for(let e=0;e<r.items.length;e++)r.items[e].loose=!0;return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ee(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let e of i)this.rules.other.tableAlignRight.test(e)?s.align.push("right"):this.rules.other.tableAlignCenter.test(e)?s.align.push("center"):this.rules.other.tableAlignLeft.test(e)?s.align.push("left"):s.align.push(null);for(let e=0;e<n.length;e++)s.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:s.align[e]});for(let e of r)s.rows.push(ee(e,s.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:s.align[t]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=te(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let i=0;i<e.length;i++)if("\\"===e[i])i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),ne(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return ne(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!i[1]&&!i[2]||!n||this.rules.inline.punctuation.exec(n))){let n,r,s=[...i[0]].length-1,l=s,a=0,o="*"===i[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(o.lastIndex=0,t=t.slice(-1*e.length+s);null!=(i=o.exec(t));){if(n=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!n)continue;if(r=[...n].length,i[3]||i[4]){l+=r;continue}if((i[5]||i[6])&&s%3&&!((s+r)%3)){a+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l+a);let t=[...i[0]][0].length,o=e.slice(0,s+i.index+t+r);if(Math.min(s,r)%2){let e=o.slice(1,-1);return{type:"em",raw:o,text:e,tokens:this.lexer.inlineTokens(e)}}let c=o.slice(2,-2);return{type:"strong",raw:o,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),i=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&i&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let i;do{i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(i!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},re=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t,this.options.tokenizer=this.options.tokenizer||new ie,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:s,block:Y.normal,inline:W.normal};this.options.pedantic?(n.block=Y.pedantic,n.inline=W.pedantic):this.options.gfm&&(n.block=Y.gfm,this.options.breaks?n.inline=W.breaks:n.inline=W.gfm),this.tokenizer.rules=n}static get rules(){return{block:Y,inline:W}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(s.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(s.tabCharGlobal," ").replace(s.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(n=>!!(i=n.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);1===i.raw.length&&void 0!==n?n.raw+="\n":t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+i.raw,n.text+="\n"+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+i.raw,n.text+="\n"+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let r=e;if(this.options.extensions?.startBlock){let t,n=1/0,i=e.slice(1);this.options.extensions.startBlock.forEach(e=>{t=e.call({lexer:this},i),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(r=e.substring(0,n+1))}if(this.state.top&&(i=this.tokenizer.paragraph(r))){let s=t.at(-1);n&&"paragraph"===s?.type?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+i.raw,s.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(i),n=r.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+i.raw,n.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,i=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let r=!1,s="";for(;e;){let i;if(r||(s=""),r=!1,this.options.extensions?.inline?.some(n=>!!(i=n.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))continue;if(i=this.tokenizer.escape(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.tag(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.link(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(i.raw.length);let n=t.at(-1);"text"===i.type&&"text"===n?.type?(n.raw+=i.raw,n.text+=i.text):t.push(i);continue}if(i=this.tokenizer.emStrong(e,n,s)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.codespan(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.br(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.del(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.autolink(e)){e=e.substring(i.raw.length),t.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(e))){e=e.substring(i.raw.length),t.push(i);continue}let l=e;if(this.options.extensions?.startInline){let t,n=1/0,i=e.slice(1);this.options.extensions.startInline.forEach(e=>{t=e.call({lexer:this},i),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(l=e.substring(0,n+1))}if(i=this.tokenizer.inlineText(l)){e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(s=i.raw.slice(-1)),r=!0;let n=t.at(-1);"text"===n?.type?(n.raw+=i.raw,n.text+=i.text):t.push(i);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},se=class{options;parser;constructor(e){this.options=e||t}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(s.notSpaceStart)?.[0],r=e.replace(s.endingNewline,"")+"\n";return i?'<pre><code class="language-'+K(i)+'">'+(n?r:K(r,!0))+"</code></pre>\n":"<pre><code>"+(n?r:K(r,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,i="";for(let t=0;t<e.items.length;t++){let n=e.items[t];i+=this.listitem(n)}let r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+i+"</"+r+">\n"}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+K(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let i="";for(let t=0;t<e.rows.length;t++){let r=e.rows[t];n="";for(let e=0;e<r.length;e++)n+=this.tablecell(r[e]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+i+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${K(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let i=this.parser.parseInline(n),r=V(e);if(null===r)return i;let s='<a href="'+(e=r)+'"';return t&&(s+=' title="'+K(t)+'"'),s+=">"+i+"</a>",s}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let r=V(e);if(null===r)return K(n);let s=`<img src="${e=r}" alt="${n}"`;return t&&(s+=` title="${K(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:K(e.text)}},le=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},ae=class e{options;renderer;textRenderer;constructor(e){this.options=e||t,this.options.renderer=this.options.renderer||new se,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new le}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){let r=e[i];if(this.options.extensions?.renderers?.[r.type]){let e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){n+=t||"";continue}}let s=r;switch(s.type){case"space":n+=this.renderer.space(s);continue;case"hr":n+=this.renderer.hr(s);continue;case"heading":n+=this.renderer.heading(s);continue;case"code":n+=this.renderer.code(s);continue;case"table":n+=this.renderer.table(s);continue;case"blockquote":n+=this.renderer.blockquote(s);continue;case"list":n+=this.renderer.list(s);continue;case"html":n+=this.renderer.html(s);continue;case"def":n+=this.renderer.def(s);continue;case"paragraph":n+=this.renderer.paragraph(s);continue;case"text":{let r=s,l=this.renderer.text(r);for(;i+1<e.length&&"text"===e[i+1].type;)r=e[++i],l+="\n"+this.renderer.text(r);n+=t?this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):l;continue}default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let i=0;i<e.length;i++){let r=e[i];if(this.options.extensions?.renderers?.[r.type]){let e=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}let s=r;switch(s.type){case"escape":case"text":n+=t.text(s);break;case"html":n+=t.html(s);break;case"link":n+=t.link(s);break;case"image":n+=t.image(s);break;case"strong":n+=t.strong(s);break;case"em":n+=t.em(s);break;case"codespan":n+=t.codespan(s);break;case"br":n+=t.br(s);break;case"del":n+=t.del(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},oe=class{options;block;constructor(e){this.options=e||t}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?re.lex:re.lexInline}provideParser(){return this.block?ae.parse:ae.parseInline}},ce=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ae;Renderer=se;TextRenderer=le;Lexer=re;Tokenizer=ie;Hooks=oe;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let e=i;for(let i of e.header)n=n.concat(this.walkTokens(i.tokens,t));for(let i of e.rows)for(let e of i)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=i;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=i;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(i=>{let r=e[i].flat(1/0);n=n.concat(this.walkTokens(r,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=n.apply(this,t)),i}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new se(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let i=n,r=e.renderer[i],s=t[i];t[i]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=s.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ie(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let i=n,r=e.tokenizer[i],s=t[i];t[i]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new oe;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let i=n,r=e.hooks[i],s=t[i];oe.passThroughHooks.has(n)?t[i]=e=>{if(this.defaults.async)return Promise.resolve(r.call(t,e)).then(e=>s.call(t,e));let n=r.call(t,e);return s.call(t,n)}:t[i]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,i=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(i.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return re.lex(e,t??this.defaults)}parser(e,t){return ae.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},r={...this.defaults,...i},s=this.onError(!!r.silent,!!r.async);if(!0===this.defaults.async&&!1===i.async)return s(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 t>"u"||null===t)return s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);let l=r.hooks?r.hooks.provideLexer():e?re.lex:re.lexInline,a=r.hooks?r.hooks.provideParser():e?ae.parse:ae.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then(e=>l(e,r)).then(e=>r.hooks?r.hooks.processAllTokens(e):e).then(e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then(()=>e):e).then(e=>a(e,r)).then(e=>r.hooks?r.hooks.postprocess(e):e).catch(s);try{r.hooks&&(t=r.hooks.preprocess(t));let e=l(t,r);r.hooks&&(e=r.hooks.processAllTokens(e)),r.walkTokens&&this.walkTokens(e,r.walkTokens);let n=a(e,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(e){return s(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+K(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function pe(e,t){return ce.parse(e,t)}pe.options=pe.setOptions=function(e){return ce.setOptions(e),pe.defaults=ce.defaults,n(pe.defaults),pe},pe.getDefaults=e,pe.defaults=t,pe.use=function(...e){return ce.use(...e),pe.defaults=ce.defaults,n(pe.defaults),pe},pe.walkTokens=function(e,t){return ce.walkTokens(e,t)},pe.parseInline=ce.parseInline,pe.Parser=ae,pe.parser=ae.parse,pe.Renderer=se,pe.TextRenderer=le,pe.Lexer=re,pe.lexer=re.lex,pe.Tokenizer=ie,pe.Hooks=oe,pe.parse=pe,pe.options,pe.setOptions,pe.use,pe.walkTokens,pe.parseInline,ae.parse,re.lex;!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}('#aptolix-chat-window{background:#f6f3ff;border:2.5px solid #9333ea;border-radius:16px;box-shadow:0 12px 40px rgba(167,139,250,.12);box-sizing:border-box;display:flex;flex-direction:column;font-family:Inter,sans-serif;height:100%;margin:0;max-height:100%;max-width:100%;min-height:0;min-width:0;overflow:hidden;width:100%}#aptolix-chat-header{align-items:center;background:#9333ea;border-bottom:2px solid #ede9fe;color:#fff;display:flex;font-size:1.15rem;font-weight:600;justify-content:space-between;padding:18px 16px 16px}.aptolix-header-title{display:flex;flex-direction:column;gap:2px;justify-content:center}.aptolix-header-subtitle{color:#ede9fe;font-size:.95rem;font-weight:400;margin-top:2px}.aptolix-header-actions{align-items:center;display:flex;gap:12px;margin-top:0}.aptolix-header-flex{align-items:center;display:flex;justify-content:space-between;width:100%}#aptolix-chat-messages{background:#f6f3ff;display:flex;flex:1 1 auto;flex-direction:column;gap:6px;min-height:120px;overflow-y:auto;padding:18px 16px 16px}.aptolix-powered-by{background:transparent;color:#a78bfa;font-size:.95rem;font-weight:500;letter-spacing:.02em;padding:10px 0 8px;text-align:center}.aptolix-powered-by .aptolix-link{color:#9333ea;font-weight:600;text-decoration:underline}#aptolix-chat-input{align-items:center;background:#fff;border-top:2px solid #ede9fe;display:flex;gap:8px;min-height:56px;padding:14px 12px}#aptolix-chat-input input{background:#f6f3ff;border:1.5px solid #d1d5db;border-radius:10px;color:#7c3aed;flex:1 1 auto;font-size:1rem;min-width:0;padding:10px 14px;transition:border .2s}#aptolix-chat-input input:focus{border-color:#a78bfa;outline:none}#aptolix-chat-input button{background:#a78bfa;border:none;border-radius:10px;box-shadow:0 2px 8px rgba(167,139,250,.1);color:#fff;cursor:pointer;flex-shrink:0;font-size:1rem;font-weight:600;padding:8px 18px;transition:background .2s,box-shadow .2s}#aptolix-chat-input button:hover{background:#7c3aed;box-shadow:0 4px 16px rgba(124,62,237,.18)}#aptolix-chat-input button:not(:first-child){background:rgba(167,139,250,.12);border-radius:8px;box-shadow:none;color:#9333ea;font-size:1.1rem;font-weight:500;padding:8px 12px}#aptolix-chat-input button:not(:first-child):hover{background:rgba(167,139,250,.22);color:#4b5563}#aptolix-chat-inputbox{background:#fff;border:1px solid #ccc;border-radius:4px;box-sizing:border-box;font-family:inherit;font-size:1rem;max-height:130px;min-height:42px;outline:none;overflow-y:auto;padding:6px 12px;resize:none;transition:border-color .2s;width:100%}.message.bot,.message.user{display:block;font-family:Inter,sans-serif;margin-bottom:0;max-width:90%;word-break:break-word}.message.user{align-self:flex-end;background:#a78bfa;border-radius:14px 14px 4px 14px;box-shadow:0 2px 8px rgba(167,139,250,.1);color:#fff;text-align:right}.message.bot,.message.user{font-weight:500;padding:8px 14px}.message.bot{align-self:flex-start;background:#ede9fe;border-radius:14px 14px 14px 4px;box-shadow:0 2px 8px rgba(167,139,250,.08);color:#4b5563;text-align:left}.message.bot a{color:#7c3aed;text-decoration:underline;word-break:break-all}.message.bot b,.message.bot strong{color:#312e81;font-weight:700}.message.bot h1,.message.bot h2,.message.bot h3{font-size:1.3rem;line-height:1.2;margin:10px 0 6px}.message.bot h2{font-size:1.15rem}.message.bot h3{font-size:1.05rem}.message.bot p{margin:10px 0}.message.bot ol,.message.bot ul{margin:8px 0 8px 18px;padding-left:18px}.message.bot ul{list-style:none;padding-left:0}.message.bot ul li{margin-bottom:4px;padding-left:1.3em;position:relative}.message.bot ul li:before{background:#9333ea;border-radius:50%;content:"";display:inline-block;height:.5em;left:.3em;position:absolute;top:.7em;width:.5em}.message.bot li{margin-bottom:4px}.message.bot code,.message.bot pre{background:#f3f4f6;border-radius:6px;color:#7c3aed;font-family:Fira Mono,Consolas,Monaco,monospace;font-size:1em;margin:8px 0;padding:4px 10px}.message.bot pre{overflow-x:auto;padding:12px 16px}.typing-dots span{animation:blink 1.2s infinite;font-size:1.5em;margin-right:2px;opacity:.5}.typing-dots span:nth-child(2){animation-delay:.2s}.typing-dots span:nth-child(3){animation-delay:.4s}@keyframes blink{0%,to{opacity:.2}50%{opacity:1}}#aptolix-chat-bubble{align-items:center;background:#9333ea;border-radius:50%;bottom:32px;box-shadow:0 6px 24px rgba(167,139,250,.18);color:#fff;cursor:pointer;display:flex;font-size:2rem;height:56px;justify-content:center;position:fixed;right:32px;transition:background .2s,box-shadow .2s;width:56px;z-index:9999}#aptolix-chat-bubble:hover{background:#7c3aed;box-shadow:0 8px 32px rgba(124,62,237,.28)}#aptolix-chat-window.bubble-mode{border-radius:16px;bottom:100px;height:595px;max-height:80vh;min-height:595px;position:fixed;right:32px;width:400px;z-index:9999}#aptolix-chat-window.section-mode{border:2px solid #a78bfa;border-radius:18px;box-shadow:0 4px 24px rgba(167,139,250,.1);height:100%;max-height:100%;max-width:100%;position:static!important;width:100%}#aptolix-chat-window.section-mode #aptolix-chat-header{background:#9333ea;color:#fff}#aptolix-chat-window.section-mode #aptolix-chat-close,#aptolix-chat-window.section-mode #aptolix-chat-expand,#aptolix-chat-window.section-mode~#aptolix-chat-bubble{display:none!important}#aptolix-chat-window.section-mode .message.user{background:#a78bfa;color:#fff}#aptolix-chat-window.section-mode .message.bot{background:#ede9fe;color:#4b5563}#aptolix-chat-window.section-mode #aptolix-chat-messages{background:#f6f3ff;padding:20px 18px 18px}@media (max-width:600px){#aptolix-chat-window,#aptolix-chat-window.bubble-mode,#aptolix-chat-window.section-mode{border-radius:12px;left:0;margin:0;max-width:100vw;min-height:180px;padding:0;right:0;width:100vw}#aptolix-chat-header{font-size:1rem;padding:10px 6px 8px}#aptolix-chat-messages{padding:8px 4px 6px}#aptolix-chat-input{padding:6px 2px}#aptolix-chat-expand,#aptolix-chat-window.section-mode #aptolix-chat-close{display:none!important}}.aptolix-retry-btn{background:#ede9fe;border:none;border-radius:6px;color:#7c3aed;cursor:pointer;font-weight:600;margin-top:8px;padding:4px 12px}.aptolix-retry-btn:hover{background:#d8b4fe}.aptolix-hint-bubble{background:#fff;border-radius:8px;bottom:110px;box-shadow:0 2px 8px rgba(0,0,0,.15);color:#333;font-size:1em;max-width:320px;min-width:180px;padding:16px 40px 16px 16px;pointer-events:auto;position:fixed;right:40px;z-index:9999}.aptolix-hint-bubble:after{border-left:10px solid transparent;border-right:10px solid transparent;border-top:12px solid #fff;bottom:-12px;content:"";height:0;position:absolute;right:28px;width:0}');const he={init:({apiHost:e,chatflowid:t,title:n,subtitle:i,greeting:r,mode:s="bubble",target:l,hintText:a="I am here to help",hintDelay:o=5e3})=>{const c="section"===s?"section-mode":"bubble-mode",p=document.createElement("div");let h,u,d;if("bubble"===s){h=document.createElement("div"),h.id="aptolix-chat-bubble",h.innerText="💬",document.body.appendChild(h);const e=document.getElementById("aptolix-chat-hint-bubble");e&&e.remove(),d=document.createElement("div"),d.id="aptolix-chat-hint-bubble",d.className="aptolix-hint-bubble",d.style.display="none",d.style.position="fixed",d.style.right="40px",d.style.bottom="110px",d.style.zIndex="9999";const t=document.createElement("span");t.textContent=a;const n=document.createElement("button");n.id="aptolix-hint-close",n.title="Close",n.setAttribute("aria-label","Close"),n.innerHTML="✕",n.style.background="none",n.style.border="none",n.style.color="#9333ea",n.style.fontSize="1.3em",n.style.position="absolute",n.style.top="8px",n.style.right="12px",n.style.cursor="pointer",n.style.padding="0",n.addEventListener("click",()=>{d.style.display="none",sessionStorage.setItem("aptolixHintClosed","true"),clearTimeout(u)}),d.appendChild(t),d.appendChild(n),document.body.appendChild(d),u=setTimeout(()=>{"none"!==p.style.display||sessionStorage.getItem("aptolixHintClosed")||(d.style.display="block")},o),h.addEventListener("click",()=>{d.style.display="none",clearTimeout(u)}),p.addEventListener("transitionstart",()=>{d.style.display="none",clearTimeout(u)})}if(p.id="aptolix-chat-window",p.classList.add(c),p.style.display="section"===s?"flex":"none","section"===s&&l){const e="string"==typeof l?document.querySelector(l):l;e?e.appendChild(p):document.body.appendChild(p)}else document.body.appendChild(p);p.innerHTML=`\n <div id="aptolix-chat-header">\n <div class="aptolix-header-flex">\n <div class="aptolix-header-title">\n <strong>${n||"AI Chatbot"}</strong>\n ${i?`<div class="aptolix-header-subtitle">${i}</div>`:""}\n </div>\n <div class="aptolix-header-actions">\n <button id="aptolix-chat-reset" title="Clear chat" aria-label="Clear chat">⟲</button>\n <button id="aptolix-chat-expand" title="Expand/Collapse" aria-label="Expand/Collapse">\n <span id="aptolix-chat-expand-icon">⤢</span>\n </button>\n <button id="aptolix-chat-download" title="Download chat" aria-label="Download chat">⤓</button>\n <button id="aptolix-chat-close" title="Close chat" aria-label="Close chat">×</button>\n </div>\n </div>\n </div>\n <div id="aptolix-chat-messages"></div>\n <div id="aptolix-chat-input">\n <textarea id="aptolix-chat-inputbox" rows="1" placeholder="Type your message..." style="resize:none"></textarea>\n <button>Send</button>\n </div>\n <div class="aptolix-powered-by">\n Powered by <a href="https://aptolix.com" target="_blank" rel="noopener" class="aptolix-link">Aptolix</a>\n </div>\n`;const g=p.querySelector("#aptolix-chat-close"),x=p.querySelector("#aptolix-chat-reset"),b=p.querySelector("#aptolix-chat-expand"),f=p.querySelector("#aptolix-chat-expand-icon"),k=p.querySelector("#aptolix-chat-inputbox"),m=p.querySelector("button"),w=p.querySelector("#aptolix-chat-messages"),y=p.querySelector("#aptolix-chat-download");async function S(n=!1,i=null){const r=i||k.value.trim();if(!r)return;if(n||(k.value="",k.rows=1,k.style.height="32px",k.style.overflowY="hidden"),!n){const e=document.createElement("div");e.className="message user",e.innerText=r,w.appendChild(e),w.scrollTop=w.scrollHeight}const l=document.createElement("div");l.className="message bot typing",l.innerHTML='<span class="typing-dots"><span>.</span><span>.</span><span>.</span></span>',w.appendChild(l),w.scrollTop=w.scrollHeight;try{const n=await fetch(`${e}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:r})}),i=await n.json();l.remove();const a=document.createElement("div");a.className="message bot",a.innerHTML=pe.parse(i.text||"[No response]"),w.appendChild(a),w.scrollTop=w.scrollHeight,"bubble"===s&&"none"===p.style.display&&h.setAttribute("data-unread","true")}catch(e){!function(){l.remove();const e=document.createElement("div");e.className="message bot error",e.innerHTML='\n <div>\n <strong>⚠️ Unable to connect to the assistant.</strong><br>\n Please check your internet connection or try again later.\n </div>\n <button class="aptolix-retry-btn">Retry</button>\n ',w.appendChild(e),w.scrollTop=w.scrollHeight;const t=e.querySelector(".aptolix-retry-btn");t&&t.addEventListener("click",()=>{e.remove(),S(!0,r)})}(),"bubble"===s&&"none"===p.style.display&&h.setAttribute("data-unread","true")}}"bubble"===s&&g.addEventListener("click",()=>{p.style.display="none"}),x.addEventListener("click",()=>{w.innerHTML="",k.value="",v()}),"bubble"===s&&h&&h.addEventListener("click",()=>{const e="none"===p.style.display;p.style.display=e?"flex":"none",h.removeAttribute("data-unread"),e&&v()}),"bubble"===s&&document.addEventListener("mousedown",function(e){"none"!==p.style.display&&(p.contains(e.target)||h.contains(e.target)||(p.style.display="none"))}),m.addEventListener("click",()=>S()),k.addEventListener("keydown",e=>{"Enter"===e.key&&(e.preventDefault(),S())});let $=!1;function v(){w.querySelectorAll(".message.greeting").forEach(e=>e.remove());const e=r||"<strong>👋 Howdy, </strong>How can I help you today?",t=document.createElement("div");t.className="message bot greeting",t.innerHTML=e,w.appendChild(t),w.scrollTop=w.scrollHeight}"bubble"===s&&b.addEventListener("click",()=>{$=!$,$?(p.style.width="600px",p.style.height="80vh",f.textContent="⤡"):(p.style.width="400px",p.style.height="595px",f.textContent="⤢")}),setTimeout(v,100),k.addEventListener("input",function(){if(this.value.length>350)return void(this.value=this.value.slice(0,350));if(""===this.value)return this.rows=1,this.style.height="32px",void(this.style.overflowY="hidden");const e=this.value.split("\n");this.rows=Math.min(e.length,4);this.style.height="auto",this.style.height=Math.min(this.scrollHeight,108)+"px",this.scrollHeight>108?this.style.overflowY="auto":this.style.overflowY="hidden"}),y.addEventListener("click",()=>{const e=Array.from(w.querySelectorAll(".message")).map(e=>`${e.classList.contains("user")?"You":"Bot"}: ${e.innerText||e.textContent}`).join("\n\n"),t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download="chat_history.txt",document.body.appendChild(i),i.click(),setTimeout(()=>{document.body.removeChild(i),URL.revokeObjectURL(n)},100)})},initFull:function(e){let t=document.querySelector("aptolix-chatbot");t?Object.entries(e).forEach(([e,n])=>{t.setAttribute(e,n)}):console.warn("No <aptolix-chatbot> element found in the DOM.")}};class ue extends HTMLElement{static get observedAttributes(){return["apiHost","chatflowid","title","greeting","subtitle","target"]}connectedCallback(){this.tryInit()}attributeChangedCallback(){const e=this.querySelector("#aptolix-chat-window");e&&e.remove(),this._initialized=!1,this.tryInit()}tryInit(){const e=this.getAttribute("apiHost"),t=this.getAttribute("chatflowid");if(!e||!t)return;const n=this.getAttribute("title")||"Aptolix AI Chatbot",i=this.getAttribute("greeting"),r=this.getAttribute("subtitle"),s=this.getAttribute("target");let l=this;if(s){const e=document.querySelector(s);e&&(l=e)}this._initialized||(this._initialized=!0,he.init({apiHost:e,chatflowid:t,title:n,subtitle:r,greeting:i,mode:"section",target:l}))}}customElements.define("aptolix-chatbot",ue);export{he as default};
|
|
2
2
|
//# sourceMappingURL=web.mjs.map
|