diff options
23 files changed, 54869 insertions, 5 deletions
diff --git a/src/external/marked.min.js b/src/external/marked.min.js new file mode 100644 index 0000000..343e921 --- /dev/null +++ b/src/external/marked.min.js @@ -0,0 +1,14 @@ +/** + * marked v8.0.1 - a markdown parser + * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,function(t){"use strict";function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n(e){t.defaults=e}t.defaults=e();const r=/[&<>"']/,s=new RegExp(r.source,"g"),i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,l=new RegExp(i.source,"g"),a={"&":"&","<":"<",">":">",'"':""","'":"'"},o=e=>a[e];function c(e,t){if(t){if(r.test(e))return e.replace(s,o)}else if(i.test(e))return e.replace(l,o);return e}const b=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;const h=/(^|[^\[])\^/g;function p(n,e){n="string"==typeof n?n:n.source,e=e||"";const r={replace:(e,t)=>(t=(t="object"==typeof t&&"source"in t?t.source:t).replace(h,"$1"),n=n.replace(e,t),r),getRegex:()=>new RegExp(n,e)};return r}function u(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}var g={exec:()=>null};function k(e,t){var n=e.replace(/\|/g,(e,t,n)=>{let r=!1,s=t;for(;0<=--s&&"\\"===n[s];)r=!r;return r?"|":" |"}).split(/ \|/);let r=0;if(n[0].trim()||n.shift(),0<n.length&&!n[n.length-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(/\\\|/g,"|");return n}function f(e,t,n){var r=e.length;if(0===r)return"";let s=0;for(;s<r;){var i=e.charAt(r-s-1);if((i!==t||n)&&(i===t||!n))break;s++}return e.slice(0,r-s)}function d(e,t,n,r){var s=t.href,t=t.title?c(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?(r.state.inLink=!0,e={type:"link",raw:n,href:s,title:t,text:i,tokens:r.inlineTokens(i)},r.state.inLink=!1,e):{type:"image",raw:n,href:s,title:t,text:c(i)}}class w{options;rules;lexer;constructor(e){this.options=e||t.defaults}space(e){e=this.rules.block.newline.exec(e);if(e&&0<e[0].length)return{type:"space",raw:e[0]}}code(e){var t,e=this.rules.block.code.exec(e);if(e)return t=e[0].replace(/^ {1,4}/gm,""),{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:f(t,"\n")}}fences(e){var t,n,e=this.rules.block.fences.exec(e);if(e)return n=function(e,t){if(null===(e=e.match(/^(\s+)(?:```)/)))return t;const n=e[1];return t.split("\n").map(e=>{var t=e.match(/^\s+/);return null!==t&&([t]=t,t.length>=n.length)?e.slice(n.length):e}).join("\n")}(t=e[0],e[3]||""),{type:"code",raw:t,lang:e[2]&&e[2].trim().replace(this.rules.inline._escapes,"$1"),text:n}}heading(t){var n,t=this.rules.block.heading.exec(t);if(t){let e=t[2].trim();return/#$/.test(e)&&(n=f(e,"#"),!this.options.pedantic&&n&&!/ $/.test(n)||(e=n.trim())),{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){e=this.rules.block.hr.exec(e);if(e)return{type:"hr",raw:e[0]}}blockquote(e){var t,n,r,e=this.rules.block.blockquote.exec(e);if(e)return t=e[0].replace(/^ *>[ \t]?/gm,""),n=this.lexer.state.top,this.lexer.state.top=!0,r=this.lexer.blockTokens(t),this.lexer.state.top=n,{type:"blockquote",raw:e[0],tokens:r,text:t}}list(h){let p=this.rules.block.list.exec(h);if(p){let e=p[1].trim();var t,n=1<e.length,u={type:"list",raw:"",ordered:n,start:n?+e.slice(0,-1):"",loose:!1,items:[]},g=(e=n?"\\d{1,9}\\"+e.slice(-1):"\\"+e,this.options.pedantic&&(e=n?e:"[*+-]"),new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`));let a="",o="",c=!1;for(;h;){let e=!1;if(!(p=g.exec(h)))break;if(this.rules.block.hr.test(h))break;a=p[0],h=h.substring(a.length);let t=p[2].split("\n",1)[0].replace(/^\t+/,e=>" ".repeat(3*e.length)),n=h.split("\n",1)[0],r=0,s=(this.options.pedantic?(r=2,o=t.trimStart()):(r=4<(r=p[2].search(/[^ ]/))?1:r,o=t.slice(r),r+=p[1].length),!1);if(!t&&/^ *$/.test(n)&&(a+=n+"\n",h=h.substring(n.length+1),e=!0),!e)for(var k=new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),f=new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),d=new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),x=new RegExp(`^ {0,${Math.min(3,r-1)}}#`);h;){var b=h.split("\n",1)[0];if(n=b,this.options.pedantic&&(n=n.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),d.test(n))break;if(x.test(n))break;if(k.test(n))break;if(f.test(h))break;if(n.search(/[^ ]/)>=r||!n.trim())o+="\n"+n.slice(r);else{if(s)break;if(4<=t.search(/[^ ]/))break;if(d.test(t))break;if(x.test(t))break;if(f.test(t))break;o+="\n"+n}s||n.trim()||(s=!0),a+=b+"\n",h=h.substring(b.length+1),t=n.slice(r)}u.loose||(c?u.loose=!0:/\n *\n *$/.test(a)&&(c=!0));let i=null,l;this.options.gfm&&(i=/^\[[ xX]\] /.exec(o))&&(l="[ ] "!==i[0],o=o.replace(/^\[[ xX]\] +/,"")),u.items.push({type:"list_item",raw:a,task:!!i,checked:l,loose:!1,text:o,tokens:[]}),u.raw+=a}u.items[u.items.length-1].raw=a.trimEnd(),u.items[u.items.length-1].text=o.trimEnd(),u.raw=u.raw.trimEnd();for(let e=0;e<u.items.length;e++)this.lexer.state.top=!1,u.items[e].tokens=this.lexer.blockTokens(u.items[e].text,[]),u.loose||(t=0<(t=u.items[e].tokens.filter(e=>"space"===e.type)).length&&t.some(e=>/\n.*\n/.test(e.raw)),u.loose=t);if(u.loose)for(let e=0;e<u.items.length;e++)u.items[e].loose=!0;return u}}html(e){e=this.rules.block.html.exec(e);if(e)return{type:"html",block:!0,raw:e[0],pre:"pre"===e[1]||"script"===e[1]||"style"===e[1],text:e[0]}}def(e){var t,n,r,e=this.rules.block.def.exec(e);if(e)return t=e[1].toLowerCase().replace(/\s+/g," "),n=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",r=e[3]&&e[3].substring(1,e[3].length-1).replace(this.rules.inline._escapes,"$1"),{type:"def",tag:t,raw:e[0],href:n,title:r}}table(e){e=this.rules.block.table.exec(e);if(e){var i={type:"table",raw:e[0],header:k(e[1]).map(e=>({text:e,tokens:[]})),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(i.header.length===i.align.length){let e=i.align.length,t,n,r,s;for(t=0;t<e;t++){var l=i.align[t];l&&(/^ *-+: *$/.test(l)?i.align[t]="right":/^ *:-+: *$/.test(l)?i.align[t]="center":/^ *:-+ *$/.test(l)?i.align[t]="left":i.align[t]=null)}for(e=i.rows.length,t=0;t<e;t++)i.rows[t]=k(i.rows[t],i.header.length).map(e=>({text:e,tokens:[]}));for(e=i.header.length,n=0;n<e;n++)i.header[n].tokens=this.lexer.inline(i.header[n].text);for(e=i.rows.length,n=0;n<e;n++)for(s=i.rows[n],r=0;r<s.length;r++)s[r].tokens=this.lexer.inline(s[r].text);return i}}}lheading(e){e=this.rules.block.lheading.exec(e);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(e){var t,e=this.rules.block.paragraph.exec(e);if(e)return t="\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1],{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}text(e){e=this.rules.block.text.exec(e);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(e){e=this.rules.inline.escape.exec(e);if(e)return{type:"escape",raw:e[0],text:c(e[1])}}tag(e){e=this.rules.inline.tag.exec(e);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){n=this.rules.inline.link.exec(n);if(n){var r=n[2].trim();if(!this.options.pedantic&&/^</.test(r)){if(!/>$/.test(r))return;var s=f(r.slice(0,-1),"\\");if((r.length-s.length)%2==0)return}else{var i,s=function(n,r){if(-1!==n.indexOf(r[1])){let t=0;for(let e=0;e<n.length;e++)if("\\"===n[e])e++;else if(n[e]===r[0])t++;else if(n[e]===r[1]&&--t<0)return e}return-1}(n[2],"()");-1<s&&(i=(0===n[0].indexOf("!")?5:4)+n[1].length+s,n[2]=n[2].substring(0,s),n[0]=n[0].substring(0,i).trim(),n[3]="")}let e=n[2],t="";return this.options.pedantic?(s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(e))&&(e=s[1],t=s[3]):t=n[3]?n[3].slice(1,-1):"",e=e.trim(),d(n,{href:(e=/^</.test(e)?this.options.pedantic&&!/>$/.test(r)?e.slice(1):e.slice(1,-1):e)&&e.replace(this.rules.inline._escapes,"$1"),title:t&&t.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(t,n){let r;if(r=(r=this.rules.inline.reflink.exec(t))||this.rules.inline.nolink.exec(t)){let e=(r[2]||r[1]).replace(/\s+/g," ");return(e=n[e.toLowerCase()])?d(r,e,r[0],this.lexer):{type:"text",raw:t=r[0].charAt(0),text:t}}}emStrong(s,i,e=""){let l=this.rules.inline.emStrong.lDelim.exec(s);if(l&&((!l[3]||!e.match(/[\p{L}\p{N}]/u))&&(!(l[1]||l[2]||"")||!e||this.rules.inline.punctuation.exec(e)))){var a=[...l[0]].length-1;let e,t,n=a,r=0;var o,c,h="*"===l[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(h.lastIndex=0,i=i.slice(-1*s.length+a);null!=(l=h.exec(i));)if(e=l[1]||l[2]||l[3]||l[4]||l[5]||l[6])if(t=[...e].length,l[3]||l[4])n+=t;else if((l[5]||l[6])&&a%3&&!((a+t)%3))r+=t;else if(!(0<(n-=t)))return t=Math.min(t,t+n+r),o=[...s].slice(0,a+l.index+t+1).join(""),Math.min(a,t)%2?(c=o.slice(1,-1),{type:"em",raw:o,text:c,tokens:this.lexer.inlineTokens(c)}):(c=o.slice(2,-2),{type:"strong",raw:o,text:c,tokens:this.lexer.inlineTokens(c)})}}codespan(t){t=this.rules.inline.code.exec(t);if(t){let e=t[2].replace(/\n/g," ");var n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return e=c(e=n&&r?e.substring(1,e.length-1):e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){e=this.rules.inline.br.exec(e);if(e)return{type:"br",raw:e[0]}}del(e){e=this.rules.inline.del.exec(e);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){n=this.rules.inline.autolink.exec(n);if(n){let e,t;return t="@"===n[2]?"mailto:"+(e=c(n[1])):e=c(n[1]),{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}url(e){var n,r;if(n=this.rules.inline.url.exec(e)){let e,t;if("@"===n[2])e=c(n[0]),t="mailto:"+e;else{for(;r=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0],r!==n[0];);e=c(n[0]),t="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(t){t=this.rules.inline.text.exec(t);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:c(t[0]),{type:"text",raw:t[0],text:e}}}}const x={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:g,lheading:/^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/},m=(x.def=p(x.def).replace("label",x._label).replace("title",x._title).getRegex(),x.bullet=/(?:[*+-]|\d{1,9}[.)])/,x.listItemStart=p(/^( *)(bull) */).replace("bull",x.bullet).getRegex(),x.list=p(x.list).replace(/bull/g,x.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+x.def.source+")").getRegex(),x._tag="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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",x._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,x.html=p(x.html,"i").replace("comment",x._comment).replace("tag",x._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x.lheading=p(x.lheading).replace(/bull/g,x.bullet).getRegex(),x.paragraph=p(x._paragraph).replace("hr",x.hr).replace("heading"," {0,3}#{1,6} ").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._tag).getRegex(),x.blockquote=p(x.blockquote).replace("paragraph",x.paragraph).getRegex(),x.normal={...x},x.gfm={...x.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"},x.gfm.table=p(x.gfm.table).replace("hr",x.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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._tag).getRegex(),x.gfm.paragraph=p(x._paragraph).replace("hr",x.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",x.gfm.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._tag).getRegex(),x.pedantic={...x.normal,html:p("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",x._comment).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:g,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:p(x.normal._paragraph).replace("hr",x.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",x.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()},{escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:g,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:g,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^((?![*_])[\spunctuation])/,_punctuation:"\\p{P}$+<=>`^|~"});m.punctuation=p(m.punctuation,"u").replace(/punctuation/g,m._punctuation).getRegex(),m.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,m.anyPunctuation=/\\[punct]/g,m._escapes=/\\([punct])/g,m._comment=p(x._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),m.emStrong.lDelim=p(m.emStrong.lDelim,"u").replace(/punct/g,m._punctuation).getRegex(),m.emStrong.rDelimAst=p(m.emStrong.rDelimAst,"gu").replace(/punct/g,m._punctuation).getRegex(),m.emStrong.rDelimUnd=p(m.emStrong.rDelimUnd,"gu").replace(/punct/g,m._punctuation).getRegex(),m.anyPunctuation=p(m.anyPunctuation,"gu").replace(/punct/g,m._punctuation).getRegex(),m._escapes=p(m._escapes,"gu").replace(/punct/g,m._punctuation).getRegex(),m._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,m._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])?)+(?![-_])/,m.autolink=p(m.autolink).replace("scheme",m._scheme).replace("email",m._email).getRegex(),m._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,m.tag=p(m.tag).replace("comment",m._comment).replace("attribute",m._attribute).getRegex(),m._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,m._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,m._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,m.link=p(m.link).replace("label",m._label).replace("href",m._href).replace("title",m._title).getRegex(),m.reflink=p(m.reflink).replace("label",m._label).replace("ref",x._label).getRegex(),m.nolink=p(m.nolink).replace("ref",x._label).getRegex(),m.reflinkSearch=p(m.reflinkSearch,"g").replace("reflink",m.reflink).replace("nolink",m.nolink).getRegex(),m.normal={...m},m.pedantic={...m.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",m._label).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",m._label).getRegex()},m.gfm={...m.normal,escape:p(m.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\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.!#$%&'*+\/=?_`{\|}~-]+@)))/},m.gfm.url=p(m.gfm.url,"i").replace("email",m.gfm._extended_email).getRegex(),m.breaks={...m.gfm,br:p(m.br).replace("{2,}","*").getRegex(),text:p(m.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};class _{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t.defaults,this.options.tokenizer=this.options.tokenizer||new w,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,(this.tokenizer.lexer=this).inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};e={block:x.normal,inline:m.normal};this.options.pedantic?(e.block=x.pedantic,e.inline=m.pedantic):this.options.gfm&&(e.block=x.gfm,this.options.breaks?e.inline=m.breaks:e.inline=m.gfm),this.tokenizer.rules=e}static get rules(){return{block:x,inline:m}}static lex(e,t){return new _(t).lex(e)}static lexInline(e,t){return new _(t).inlineTokens(e)}lex(e){var t;for(e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(r,t=[]){r=this.options.pedantic?r.replace(/\t/g," ").replace(/^ +$/gm,""):r.replace(/^( *)(\t+)/gm,(e,t,n)=>t+" ".repeat(n.length));let n,e,s,i;for(;r;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(e=>!!(n=e.call({lexer:this},r,t))&&(r=r.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.space(r))r=r.substring(n.raw.length),1===n.raw.length&&0<t.length?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(r))r=r.substring(n.raw.length),!(e=t[t.length-1])||"paragraph"!==e.type&&"text"!==e.type?t.push(n):(e.raw+="\n"+n.raw,e.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=e.text);else if(n=this.tokenizer.fences(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(r))r=r.substring(n.raw.length),!(e=t[t.length-1])||"paragraph"!==e.type&&"text"!==e.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(e.raw+="\n"+n.raw,e.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=e.text);else if(n=this.tokenizer.table(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(r))r=r.substring(n.raw.length),t.push(n);else{if(s=r,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const a=r.slice(1);let n;this.options.extensions.startBlock.forEach(e=>{"number"==typeof(n=e.call({lexer:this},a))&&0<=n&&(t=Math.min(t,n))}),t<1/0&&0<=t&&(s=r.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s)))e=t[t.length-1],i&&"paragraph"===e.type?(e.raw+="\n"+n.raw,e.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=e.text):t.push(n),i=s.length!==r.length,r=r.substring(n.raw.length);else if(n=this.tokenizer.text(r))r=r.substring(n.raw.length),(e=t[t.length-1])&&"text"===e.type?(e.raw+="\n"+n.raw,e.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=e.text):t.push(n);else if(r){var l="Infinite loop on byte: "+r.charCodeAt(0);if(this.options.silent){console.error(l);break}throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(r,t=[]){let n,e,s,i=r,l,a,o;if(this.tokens.links){var c=Object.keys(this.tokens.links);if(0<c.length)for(;null!=(l=this.tokenizer.rules.inline.reflinkSearch.exec(i));)c.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(l=this.tokenizer.rules.inline.blockSkip.exec(i));)i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(l=this.tokenizer.rules.inline.anyPunctuation.exec(i));)i=i.slice(0,l.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;r;)if(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(e=>!!(n=e.call({lexer:this},r,t))&&(r=r.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.escape(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(r))r=r.substring(n.raw.length),(e=t[t.length-1])&&"text"===n.type&&"text"===e.type?(e.raw+=n.raw,e.text+=n.text):t.push(n);else if(n=this.tokenizer.link(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(r,this.tokens.links))r=r.substring(n.raw.length),(e=t[t.length-1])&&"text"===n.type&&"text"===e.type?(e.raw+=n.raw,e.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(r,i,o))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(r))r=r.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(r))r=r.substring(n.raw.length),t.push(n);else if(!this.state.inLink&&(n=this.tokenizer.url(r)))r=r.substring(n.raw.length),t.push(n);else{if(s=r,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const p=r.slice(1);let n;this.options.extensions.startInline.forEach(e=>{"number"==typeof(n=e.call({lexer:this},p))&&0<=n&&(t=Math.min(t,n))}),t<1/0&&0<=t&&(s=r.substring(0,t+1))}if(n=this.tokenizer.inlineText(s))r=r.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),a=!0,(e=t[t.length-1])&&"text"===e.type?(e.raw+=n.raw,e.text+=n.text):t.push(n);else if(r){var h="Infinite loop on byte: "+r.charCodeAt(0);if(this.options.silent){console.error(h);break}throw new Error(h)}}return t}}class y{options;constructor(e){this.options=e||t.defaults}code(e,t,n){t=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",t?'<pre><code class="language-'+c(t)+'">'+(n?e:c(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:c(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote> +${e}</blockquote> +`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}> +`}hr(){return"<hr>\n"}list(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"}listitem(e,t,n){return`<li>${e}</li> +`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p> +`}table(e,t){return"<table>\n<thead>\n"+e+"</thead>\n"+(t=t&&`<tbody>${t}</tbody>`)+"</table>\n"}tablerow(e){return`<tr> +${e}</tr> +`}tablecell(e,t){var n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}> +`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){var r=u(e);if(null===r)return n;let s='<a href="'+(e=r)+'"';return t&&(s+=' title="'+t+'"'),s+=">"+n+"</a>"}image(e,t,n){var r=u(e);if(null===r)return n;let s=`<img src="${e=r}" alt="${n}"`;return t&&(s+=` title="${t}"`),s+=">"}text(e){return e}}class ${strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class z{options;renderer;textRenderer;constructor(e){this.options=e||t.defaults,this.options.renderer=this.options.renderer||new y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new $}static parse(e,t){return new z(t).parse(e)}static parseInline(e,t){return new z(t).parseInline(e)}parse(r,s=!0){let i="";for(let n=0;n<r.length;n++){var l=r[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]){var e=l,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){i+=t||"";continue}}switch(l.type){case"space":continue;case"hr":i+=this.renderer.hr();continue;case"heading":var a=l;i+=this.renderer.heading(this.parseInline(a.tokens),a.depth,this.parseInline(a.tokens,this.textRenderer).replace(b,(e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""));continue;case"code":i+=this.renderer.code(l.text,l.lang,!!l.escaped);continue;case"table":{var o=l,a="";let t="";for(let e=0;e<o.header.length;e++)t+=this.renderer.tablecell(this.parseInline(o.header[e].tokens),{header:!0,align:o.align[e]});a+=this.renderer.tablerow(t);let n="";for(let e=0;e<o.rows.length;e++){var c=o.rows[e];t="";for(let e=0;e<c.length;e++)t+=this.renderer.tablecell(this.parseInline(c[e].tokens),{header:!1,align:o.align[e]});n+=this.renderer.tablerow(t)}i+=this.renderer.table(a,n);continue}case"blockquote":var h=this.parse(l.tokens);i+=this.renderer.blockquote(h);continue;case"list":{var p=l,h=p.ordered,u=p.start,g=p.loose;let n="";for(let t=0;t<p.items.length;t++){var k,f=p.items[t],d=f.checked,x=f.task;let e="";f.task&&(k=this.renderer.checkbox(!!d),g?0<f.tokens.length&&"paragraph"===f.tokens[0].type?(f.tokens[0].text=k+" "+f.tokens[0].text,f.tokens[0].tokens&&0<f.tokens[0].tokens.length&&"text"===f.tokens[0].tokens[0].type&&(f.tokens[0].tokens[0].text=k+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:k+" "}):e+=k+" "),e+=this.parse(f.tokens,g),n+=this.renderer.listitem(e,x,!!d)}i+=this.renderer.list(n,h,u);continue}case"html":i+=this.renderer.html(l.text,l.block);continue;case"paragraph":i+=this.renderer.paragraph(this.parseInline(l.tokens));continue;case"text":{let e=l,t=e.tokens?this.parseInline(e.tokens):e.text;for(;n+1<r.length&&"text"===r[n+1].type;)e=r[++n],t+="\n"+(e.tokens?this.parseInline(e.tokens):e.text);i+=s?this.renderer.paragraph(t):t;continue}default:u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}return i}parseInline(t,n){n=n||this.renderer;let r="";for(let e=0;e<t.length;e++){var s=t[e];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){var i=this.options.extensions.renderers[s.type].call({parser:this},s);if(!1!==i||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=i||"";continue}}switch(s.type){case"escape":r+=n.text(s.text);break;case"html":r+=n.html(s.text);break;case"link":r+=n.link(s.href,s.title,this.parseInline(s.tokens,n));break;case"image":r+=n.image(s.href,s.title,s.text);break;case"strong":r+=n.strong(this.parseInline(s.tokens,n));break;case"em":r+=n.em(this.parseInline(s.tokens,n));break;case"codespan":r+=n.codespan(s.text);break;case"br":r+=n.br();break;case"del":r+=n.del(this.parseInline(s.tokens,n));break;case"text":r+=n.text(s.text);break;default:var l='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}return r}}class v{options;constructor(e){this.options=e||t.defaults}static passThroughHooks=new Set(["preprocess","postprocess"]);preprocess(e){return e}postprocess(e){return e}}class R{defaults=e();options=this.setOptions;parse=this.#parseMarkdown(_.lex,z.parse);parseInline=this.#parseMarkdown(_.lexInline,z.parseInline);Parser=z;parser=z.parse;Renderer=y;TextRenderer=$;Lexer=_;lexer=_.lex;Tokenizer=w;Hooks=v;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":var r=s;for(const i of r.header)n=n.concat(this.walkTokens(i.tokens,t));for(const l of r.rows)for(const a of l)n=n.concat(this.walkTokens(a.tokens,t));break;case"list":r=s;n=n.concat(this.walkTokens(r.items,t));break;default:{const o=s;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(e=>{n=n.concat(this.walkTokens(o[e],t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){const m=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{var t={...e};if(t.async=this.defaults.async||t.async||!1,e.extensions&&(e.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){const r=m.renderers[n.name];r?m.renderers[n.name]=function(...e){let t=n.renderer.apply(this,e);return t=!1===t?r.apply(this,e):t}:m.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||"block"!==n.level&&"inline"!==n.level)throw new Error("extension level must be 'block' or 'inline'");var e=m[n.level];e?e.unshift(n.tokenizer):m[n.level]=[n.tokenizer],n.start&&("block"===n.level?m.startBlock?m.startBlock.push(n.start):m.startBlock=[n.start]:"inline"===n.level&&(m.startInline?m.startInline.push(n.start):m.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(m.childTokens[n.name]=n.childTokens)}),t.extensions=m),e.renderer){const i=this.defaults.renderer||new y(this.defaults);for(const l in e.renderer){const a=e.renderer[l];var n=l;const o=i[n];i[n]=(...e)=>{let t=a.apply(i,e);return(t=!1===t?o.apply(i,e):t)||""}}t.renderer=i}if(e.tokenizer){const c=this.defaults.tokenizer||new w(this.defaults);for(const h in e.tokenizer){const p=e.tokenizer[h];var r=h;const u=c[r];c[r]=(...e)=>{let t=p.apply(c,e);return t=!1===t?u.apply(c,e):t}}t.tokenizer=c}if(e.hooks){const g=this.defaults.hooks||new v;for(const k in e.hooks){const f=e.hooks[k];var s=k;const d=g[s];v.passThroughHooks.has(k)?g[s]=e=>{return this.defaults.async?Promise.resolve(f.call(g,e)).then(e=>d.call(g,e)):(e=f.call(g,e),d.call(g,e))}:g[s]=(...e)=>{let t=f.apply(g,e);return t=!1===t?d.apply(g,e):t}}t.hooks=g}if(e.walkTokens){const x=this.defaults.walkTokens,b=e.walkTokens;t.walkTokens=function(e){let t=[];return t.push(b.call(this,e)),t=x?t.concat(x.call(this,e)):t}}this.defaults={...this.defaults,...t}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}#parseMarkdown(i,l){return(t,n)=>{n={...n};const r={...this.defaults,...n};!0===this.defaults.async&&!1===n.async&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);n=this.#onError(!!r.silent,!!r.async);if(null==t)return n(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then(e=>i(e,r)).then(e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then(()=>e):e).then(e=>l(e,r)).then(e=>r.hooks?r.hooks.postprocess(e):e).catch(n);try{r.hooks&&(t=r.hooks.preprocess(t));var s=i(t,r);r.walkTokens&&this.walkTokens(s,r.walkTokens);let e=l(s,r);return e=r.hooks?r.hooks.postprocess(e):e}catch(e){return n(e)}}}#onError(n,r){return e=>{var t;if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",n)return t="<p>An error occurred:</p><pre>"+c(e.message+"",!0)+"</pre>",r?Promise.resolve(t):t;if(r)return Promise.reject(e);throw e}}}const S=new R;function T(e,t){return S.parse(e,t)}T.options=T.setOptions=function(e){return S.setOptions(e),n(T.defaults=S.defaults),T},T.getDefaults=e,T.defaults=t.defaults,T.use=function(...e){return S.use(...e),n(T.defaults=S.defaults),T},T.walkTokens=function(e,t){return S.walkTokens(e,t)},T.parseInline=S.parseInline,T.Parser=z,T.parser=z.parse,T.Renderer=y,T.TextRenderer=$,T.Lexer=_,T.lexer=_.lex,T.Tokenizer=w,T.Hooks=v;var g=(T.parse=T).options,A=T.setOptions,I=T.use,E=T.walkTokens,Z=T.parseInline,q=T,L=z.parse,D=_.lex;t.Hooks=v,t.Lexer=_,t.Marked=R,t.Parser=z,t.Renderer=y,t.TextRenderer=$,t.Tokenizer=w,t.getDefaults=e,t.lexer=D,t.marked=T,t.options=g,t.parse=q,t.parseInline=Z,t.parser=L,t.setOptions=A,t.use=I,t.walkTokens=E});
\ No newline at end of file diff --git a/src/external/stellar-freighter-api/@shared/api/external.d.ts b/src/external/stellar-freighter-api/@shared/api/external.d.ts new file mode 100644 index 0000000..9755ca4 --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/api/external.d.ts @@ -0,0 +1,24 @@ +import { UserInfo } from "./types"; +export declare const requestPublicKey: () => Promise<string>; +export declare const submitTransaction: (transactionXdr: string, opts?: string | { + network?: string | undefined; + accountToSign?: string | undefined; + networkPassphrase?: string | undefined; +} | undefined, accountToSign?: string | undefined) => Promise<string>; +export declare const submitBlob: (blob: string, opts?: { + accountToSign?: string | undefined; +} | undefined) => Promise<string>; +export declare const submitAuthEntry: (entryXdr: string, opts?: { + accountToSign?: string | undefined; +} | undefined) => Promise<string>; +export declare const requestNetwork: () => Promise<string>; +export declare const requestNetworkDetails: () => Promise<{ + network: string; + networkUrl: string; + networkPassphrase: string; + sorobanRpcUrl?: string | undefined; +}>; +export declare const requestConnectionStatus: () => Promise<boolean>; +export declare const requestAllowedStatus: () => Promise<boolean>; +export declare const setAllowedStatus: () => Promise<boolean>; +export declare const requestUserInfo: () => Promise<UserInfo>; diff --git a/src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts b/src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts new file mode 100644 index 0000000..1aed2d8 --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/api/helpers/extensionMessaging.d.ts @@ -0,0 +1,9 @@ +import { EXTERNAL_SERVICE_TYPES, SERVICE_TYPES } from "../../constants/services"; +import { Response } from "../types"; +interface Msg { + [key: string]: any; + type: EXTERNAL_SERVICE_TYPES | SERVICE_TYPES; +} +export declare const sendMessageToContentScript: (msg: Msg) => Promise<Response>; +export declare const sendMessageToBackground: (msg: Msg) => Promise<Response>; +export {}; diff --git a/src/external/stellar-freighter-api/@shared/api/types.d.ts b/src/external/stellar-freighter-api/@shared/api/types.d.ts new file mode 100644 index 0000000..be44b6a --- /dev/null +++ b/src/external/stellar-freighter-api/@shared/api/types.d.ts @@ -0,0 +1,158 @@ +import BigNumber from "bignumber.js"; +import { Horizon } from "stellar-sdk"; +import { Types } from "@stellar/wallet-sdk"; +import { SERVICE_TYPES, EXTERNAL_SERVICE_TYPES } from "../constants/services"; +import { APPLICATION_STATE } from "../constants/applicationState"; +import { WalletType } from "../constants/hardwareWallet"; +import { NetworkDetails } from "../constants/stellar"; +export declare enum ActionStatus { + IDLE = "IDLE", + PENDING = "PENDING", + SUCCESS = "SUCCESS", + ERROR = "ERROR" +} +export interface UserInfo { + publicKey: string; +} +export interface Response { + error: string; + messagedId: number; + applicationState: APPLICATION_STATE; + publicKey: string; + privateKey: string; + hasPrivateKey: boolean; + mnemonicPhrase: string; + isCorrectPhrase: boolean; + confirmedPassword: boolean; + password: string; + mnemonicPhraseToConfirm: string; + recoverMnemonic: string; + transaction: { + sign: (sourceKeys: {}) => void; + }; + transactionXDR: string; + signedTransaction: string; + signedBlob: string; + signedAuthEntry: string; + source: string; + type: SERVICE_TYPES; + url: string; + isDataSharingAllowed: boolean; + isTestnet: boolean; + isMemoValidationEnabled: boolean; + isSafetyValidationEnabled: boolean; + isValidatingSafeAssetsEnabled: boolean; + isExperimentalModeEnabled: boolean; + networkDetails: NetworkDetails; + sorobanRpcUrl: string; + networksList: NetworkDetails[]; + allAccounts: Array<Account>; + accountName: string; + assetCode: string; + assetCanonical: string; + iconUrl: string; + network: string; + networkIndex: number; + networkName: string; + recentAddresses: Array<string>; + hardwareWalletType: WalletType; + bipPath: string; + blockedDomains: BlockedDomains; + blockedAccounts: BlockedAccount[]; + assetDomain: string; + contractId: string; + tokenId: string; + tokenIdList: string[]; + isConnected: boolean; + isAllowed: boolean; + userInfo: UserInfo; + allowList: string[]; +} +export interface BlockedDomains { + [key: string]: boolean; +} +export interface BlockedAccount { + address: string; + name: string; + domain: string | null; + tags: string[]; +} +export interface ExternalRequestBase { + network: string; + networkPassphrase: string; + accountToSign: string; + type: EXTERNAL_SERVICE_TYPES; +} +export interface ExternalRequestTx extends ExternalRequestBase { + transactionXdr: string; +} +export interface ExternalRequestBlob extends ExternalRequestBase { + blob: string; +} +export interface ExternalRequestAuthEntry extends ExternalRequestBase { + entryXdr: string; +} +export declare type ExternalRequest = ExternalRequestTx | ExternalRequestBlob | ExternalRequestAuthEntry; +export interface Account { + publicKey: string; + name: string; + imported: boolean; + hardwareWalletType?: WalletType; +} +export declare enum AccountType { + HW = "HW", + IMPORTED = "IMPORTED", + FREIGHTER = "FREIGHTER" +} +export interface Preferences { + isDataSharingAllowed: boolean; + isMemoValidationEnabled: boolean; + isSafetyValidationEnabled: boolean; + isValidatingSafeAssetsEnabled: boolean; + networksList: NetworkDetails[]; + error: string; + isExperimentalModeEnabled: boolean; +} +export declare type Settings = { + allowList: string[]; + networkDetails: NetworkDetails; + networksList: NetworkDetails[]; + error: string; +} & Preferences; +export interface AssetIcons { + [code: string]: string; +} +export interface AssetDomains { + [code: string]: string; +} +export declare type Balances = Types.BalanceMap | null; +export interface SorobanBalance { + contractId: string; + total: BigNumber; + name: string; + symbol: string; + decimals: number; +} +export declare type AssetType = Types.AssetBalance | Types.NativeBalance | SorobanBalance; +export declare type TokenBalances = SorobanBalance[]; +export declare type HorizonOperation = any; +export interface AccountBalancesInterface { + balances: Balances; + isFunded: boolean | null; + subentryCount: number; |