package.dist.chunks.mermaid.esm.min.chunk-EXDBZKZY.mjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mermaid Show documentation
Show all versions of mermaid Show documentation
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
The newest version!
import{o as ie}from"./chunk-2XY5F2HY.mjs";import{I as P,K as ne,L as se,X as re,b as te,ga as v}from"./chunk-ITX3UAHE.mjs";import{a as f}from"./chunk-GTKDMUJJ.mjs";function le(a){for(var e=[],t=1;t"']/,Le=new RegExp(fe.source,"g"),ge=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Me=new RegExp(ge.source,"g"),Ie={"&":"&","<":"<",">":">",'"':""","'":"'"},oe=f(a=>Ie[a],"getEscapeReplacement");function m(a,e){if(e){if(fe.test(a))return a.replace(Le,oe)}else if(ge.test(a))return a.replace(Me,oe);return a}f(m,"escape$1");var _e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Ee(a){return a.replace(_e,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}f(Ee,"unescape");var Ae=/(^|[^\[])\^/g;function x(a,e){let t=typeof a=="string"?a:a.source;e=e||"";let s={replace:f((n,r)=>{let i=typeof r=="string"?r:r.source;return i=i.replace(Ae,"$1"),t=t.replace(n,i),s},"replace"),getRegex:f(()=>new RegExp(t,e),"getRegex")};return s}f(x,"edit");function ae(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}f(ae,"cleanUrl");var _={exec:f(()=>null,"exec")};function ce(a,e){let t=a.replace(/\|/g,(r,i,l)=>{let o=!1,p=i;for(;--p>=0&&l[p]==="\\";)o=!o;return o?"|":" |"}),s=t.split(/ \|/),n=0;if(s[0].trim()||s.shift(),s.length>0&&!s[s.length-1].trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length{let r=n.match(/^\s+/);if(r===null)return n;let[i]=r;return i.length>=s.length?n.slice(s.length):n}).join(`
`)}f(ve,"indentCodeCompensation");var S=class{static{f(this,"_Tokenizer")}options;rules;lexer;constructor(e){this.options=e||R}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 s=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?s:M(s,`
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let s=t[0],n=ve(s,t[3]||"");return{type:"code",raw:s,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 s=t[2].trim();if(/#$/.test(s)){let n=M(s,"#");(this.options.pedantic||!n||/ $/.test(n))&&(s=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:M(t[0],`
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let s=M(t[0],`
`).split(`
`),n="",r="",i=[];for(;s.length>0;){let l=!1,o=[],p;for(p=0;p/.test(s[p]))o.push(s[p]),l=!0;else if(!l)o.push(s[p]);else break;s=s.slice(p);let c=o.join(`
`),h=c.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
$1`).replace(/^ {0,3}>[ \t]?/gm,"");n=n?`${n}
${c}`:c,r=r?`${r}
${h}`:h;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=u,s.length===0)break;let g=i[i.length-1];if(g?.type==="code")break;if(g?.type==="blockquote"){let d=g,b=d.raw+`
`+s.join(`
`),w=this.blockquote(b);i[i.length-1]=w,n=n.substring(0,n.length-d.raw.length)+w.raw,r=r.substring(0,r.length-d.text.length)+w.text;break}else if(g?.type==="list"){let d=g,b=d.raw+`
`+s.join(`
`),w=this.list(b);i[i.length-1]=w,n=n.substring(0,n.length-g.raw.length)+w.raw,r=r.substring(0,r.length-d.raw.length)+w.raw,s=b.substring(i[i.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),n=s.length>1,r={type:"list",raw:"",ordered:n,start:n?+s.slice(0,-1):"",loose:!1,items:[]};s=n?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=n?s:"[*+-]");let i=new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),l=!1;for(;e;){let o=!1,p="",c="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let h=t[2].split(`
`,1)[0].replace(/^\t+/,q=>" ".repeat(3*q.length)),u=e.split(`
`,1)[0],g=!h.trim(),d=0;if(this.options.pedantic?(d=2,c=h.trimStart()):g?d=t[1].length+1:(d=t[2].search(/[^ ]/),d=d>4?1:d,c=h.slice(d),d+=t[1].length),g&&/^ *$/.test(u)&&(p+=u+`
`,e=e.substring(u.length+1),o=!0),!o){let q=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),Y=new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),J=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),ee=new RegExp(`^ {0,${Math.min(3,d-1)}}#`);for(;e;){let Z=e.split(`
`,1)[0];if(u=Z,this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),J.test(u)||ee.test(u)||q.test(u)||Y.test(e))break;if(u.search(/[^ ]/)>=d||!u.trim())c+=`
`+u.slice(d);else{if(g||h.search(/[^ ]/)>=4||J.test(h)||ee.test(h)||Y.test(h))break;c+=`
`+u}!g&&!u.trim()&&(g=!0),p+=Z+`
`,e=e.substring(Z.length+1),h=u.slice(d)}}r.loose||(l?r.loose=!0:/\n *\n *$/.test(p)&&(l=!0));let b=null,w;this.options.gfm&&(b=/^\[[ xX]\] /.exec(c),b&&(w=b[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:p,task:!!b,checked:w,loose:!1,text:c,tokens:[]}),r.raw+=p}r.items[r.items.length-1].raw=r.items[r.items.length-1].raw.trimEnd(),r.items[r.items.length-1].text=r.items[r.items.length-1].text.trimEnd(),r.raw=r.raw.trimEnd();for(let o=0;oh.type==="space"),c=p.length>0&&p.some(h=>/\n.*\n/.test(h.raw));r.loose=c}if(r.loose)for(let o=0;o$/,"$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:s,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;let s=ce(t[1]),n=t[2].replace(/^\||\| *$/g,"").split("|"),r=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
`):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(s.length===n.length){for(let l of n)/^ *-+: *$/.test(l)?i.align.push("right"):/^ *:-+: *$/.test(l)?i.align.push("center"):/^ *:-+ *$/.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l({text:o,tokens:this.lexer.inline(o),header:!1,align:i.align[p]})));return i}}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 s=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:s,tokens:this.lexer.inline(s)}}}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:m(t[1])}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.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 s=t[2].trim();if(!this.options.pedantic&&/^$/.test(s))return;let i=M(s.slice(0,-1),"\\");if((s.length-i.length)%2===0)return}else{let i=Ce(t[2],"()");if(i>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let i=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);i&&(n=i[1],r=i[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^$/.test(s)?n=n.slice(1):n=n.slice(1,-1)),pe(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){let n=(s[2]||s[1]).replace(/\s+/g," "),r=t[n.toLowerCase()];if(!r){let i=s[0].charAt(0);return{type:"text",raw:i,text:i}}return pe(s,r,s[0],this.lexer)}}emStrong(e,t,s=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n||n[3]&&s.match(/[\p{L}\p{N}]/u))return;if(!(n[1]||n[2]||"")||!s||this.rules.inline.punctuation.exec(s)){let i=[...n[0]].length-1,l,o,p=i,c=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,t=t.slice(-1*e.length+i);(n=h.exec(t))!=null;){if(l=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!l)continue;if(o=[...l].length,n[3]||n[4]){p+=o;continue}else if((n[5]||n[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(p-=o,p>0)continue;o=Math.min(o,o+p+c);let u=[...n[0]][0].length,g=e.slice(0,i+n.index+u+o);if(Math.min(i,o)%2){let b=g.slice(1,-1);return{type:"em",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}let d=g.slice(2,-2);return{type:"strong",raw:g,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let s=t[2].replace(/\n/g," "),n=/[^ ]/.test(s),r=/^ /.test(s)&&/ $/.test(s);return n&&r&&(s=s.substring(1,s.length-1)),s=m(s,!0),{type:"codespan",raw:t[0],text:s}}}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 s,n;return t[2]==="@"?(s=m(t[1]),n="mailto:"+s):(s=m(t[1]),n=s),{type:"link",raw:t[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let s,n;if(t[2]==="@")s=m(t[0]),n="mailto:"+s;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);s=m(t[0]),t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let s;return this.lexer.state.inRawBlock?s=t[0]:s=m(t[0]),{type:"text",raw:t[0],text:s}}}},je=/^(?: *(?:\n|$))+/,Be=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,We=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,A=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,qe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,de=/(?:[*+-]|\d{1,9}[.)])/,ke=x(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,de).replace(/blockCode/g,/ {4}/).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/).getRegex(),Q=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ze=/^[^\n]+/,H=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Pe=x(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",H).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),De=x(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,de).getRegex(),W="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",N=/|$))/,Fe=x("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",N).replace("tag",W).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xe=x(Q).replace("hr",A).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",W).getRegex(),Oe=x(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",xe).getRegex(),G={blockquote:Oe,code:Be,def:Pe,fences:We,heading:qe,hr:A,html:Fe,lheading:ke,list:De,newline:je,paragraph:xe,table:_,text:Ze},he=x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",A).replace("heading"," {0,3}#{1,6}(?:\\s|$)").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",W).getRegex(),Qe={...G,table:he,paragraph:x(Q).replace("hr",A).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",he).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",W).getRegex()},He={...G,html:x(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)| \\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",N).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:x(Q).replace("hr",A).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ke).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},me=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ne=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,be=/^( {2,}|\\)\n(?!\s*$)/,Ge=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,Ke=x(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,C).getRegex(),Ve=x("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,C).getRegex(),Ye=x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,C).getRegex(),Je=x(/\\([punct])/,"gu").replace(/punct/g,C).getRegex(),et=x(/^<(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(),tt=x(N).replace("(?:-->|$)","-->").getRegex(),nt=x("^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",tt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),B=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,st=x(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",B).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),we=x(/^!?\[(label)\]\[(ref)\]/).replace("label",B).replace("ref",H).getRegex(),ye=x(/^!?\[(ref)\](?:\[\])?/).replace("ref",H).getRegex(),rt=x("reflink|nolink(?!\\()","g").replace("reflink",we).replace("nolink",ye).getRegex(),U={_backpedal:_,anyPunctuation:Je,autolink:et,blockSkip:Xe,br:be,code:Ne,del:_,emStrongLDelim:Ke,emStrongRDelimAst:Ve,emStrongRDelimUnd:Ye,escape:me,link:st,nolink:ye,punctuation:Ue,reflink:we,reflinkSearch:rt,tag:nt,text:Ge,url:_},it={...U,link:x(/^!?\[(label)\]\((.*?)\)/).replace("label",B).getRegex(),reflink:x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",B).getRegex()},D={...U,escape:x(me).replace("])","~|])").getRegex(),url:x(/^((?: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~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\o+" ".repeat(p.length));let n,r,i;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(n=l.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+n.raw,r.text+=`
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+n.raw,r.text+=`
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startBlock){let l=1/0,o=e.slice(1),p;this.options.extensions.startBlock.forEach(c=>{p=c.call({lexer:this},o),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(i=e.substring(0,l+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i))){r=t[t.length-1],s&&r?.type==="paragraph"?(r.raw+=`
`+n.raw,r.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),s=i.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&r.type==="text"?(r.raw+=`
`+n.raw,r.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let s,n,r,i=e,l,o,p;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)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(;(l=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,l.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(o||(p=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(s=c.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))){if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),n=t[t.length-1],n&&s.type==="text"&&n.type==="text"?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length),n=t[t.length-1],n&&s.type==="text"&&n.type==="text"?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(s=this.tokenizer.emStrong(e,i,p)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.del(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),t.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),t.push(s);continue}if(r=e,this.options.extensions&&this.options.extensions.startInline){let c=1/0,h=e.slice(1),u;this.options.extensions.startInline.forEach(g=>{u=g.call({lexer:this},h),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(r=e.substring(0,c+1))}if(s=this.tokenizer.inlineText(r)){e=e.substring(s.raw.length),s.raw.slice(-1)!=="_"&&(p=s.raw.slice(-1)),o=!0,n=t[t.length-1],n&&n.type==="text"?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}},L=class{static{f(this,"_Renderer")}options;parser;constructor(e){this.options=e||R}space(e){return""}code({text:e,lang:t,escaped:s}){let n=(t||"").match(/^\S*/)?.[0],r=e.replace(/\n$/,"")+`
`;return n?''+(s?r:m(r,!0))+`
`:""+(s?r:m(r,!0))+`
`}blockquote({tokens:e}){return`
${this.parser.parse(e)}
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)}
`}hr(e){return`
`}list(e){let t=e.ordered,s=e.start,n="";for(let l=0;l
`+n+""+r+`>
`}listitem(e){let t="";if(e.task){let s=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=s+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=s+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:s+" ",text:s+" "}):t+=s+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`${t}
`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`${this.parser.parseInline(e)}
`}table(e){let t="",s="";for(let r=0;r${n}`),`
`+t+`
`+n+`
`}tablerow({text:e}){return`
${e}
`}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`${s}>
`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${e}
`}br(e){return"
"}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:s}){let n=this.parser.parseInline(s),r=ae(e);if(r===null)return n;e=r;let i='"+n+"",i}image({href:e,title:t,text:s}){let n=ae(e);if(n===null)return s;e=n;let r=`",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}},E=class{static{f(this,"_TextRenderer")}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""}},T=class a{static{f(this,"_Parser")}options;renderer;textRenderer;constructor(e){this.options=e||R,this.options.renderer=this.options.renderer||new L,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new E}static parse(e,t){return new a(t).parse(e)}static parseInline(e,t){return new a(t).parseInline(e)}parse(e,t=!0){let s="";for(let n=0;n{let l=r[i].flat(1/0);s=s.concat(this.walkTokens(l,t))}):r.tokens&&(s=s.concat(this.walkTokens(r.tokens,t)))}}return s}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{let n={...s};if(n.async=this.defaults.async||n.async||!1,s.extensions&&(s.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=t.renderers[r.name];i?t.renderers[r.name]=function(...l){let o=r.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[r.level];i?i.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),n.extensions=t),s.renderer){let r=this.defaults.renderer||new L(this.defaults);for(let i in s.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=s.renderer[l];s.useNewRenderer||(o=this.#t(o,l,r));let p=r[l];r[l]=(...c)=>{let h=o.apply(r,c);return h===!1&&(h=p.apply(r,c)),h||""}}n.renderer=r}if(s.tokenizer){let r=this.defaults.tokenizer||new S(this.defaults);for(let i in s.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=s.tokenizer[l],p=r[l];r[l]=(...c)=>{let h=o.apply(r,c);return h===!1&&(h=p.apply(r,c)),h}}n.tokenizer=r}if(s.hooks){let r=this.defaults.hooks||new z;for(let i in s.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(i==="options")continue;let l=i,o=s.hooks[l],p=r[l];z.passThroughHooks.has(i)?r[l]=c=>{if(this.defaults.async)return Promise.resolve(o.call(r,c)).then(u=>p.call(r,u));let h=o.call(r,c);return p.call(r,h)}:r[l]=(...c)=>{let h=o.apply(r,c);return h===!1&&(h=p.apply(r,c)),h}}n.hooks=r}if(s.walkTokens){let r=this.defaults.walkTokens,i=s.walkTokens;n.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),r&&(o=o.concat(r.call(this,l))),o}}this.defaults={...this.defaults,...n}}),this}#t(e,t,s){switch(t){case"heading":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,s.parser.parseInline(n.tokens),n.depth,Ee(s.parser.parseInline(n.tokens,s.parser.textRenderer)))};case"code":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text,n.lang,!!n.escaped)};case"table":return function(n){if(!n.type||n.type!==t)return e.apply(this,arguments);let r="",i="";for(let o=0;o0&&c.tokens[0].type==="paragraph"?(c.tokens[0].text=d+" "+c.tokens[0].text,c.tokens[0].tokens&&c.tokens[0].tokens.length>0&&c.tokens[0].tokens[0].type==="text"&&(c.tokens[0].tokens[0].text=d+" "+c.tokens[0].tokens[0].text)):c.tokens.unshift({type:"text",text:d+" "}):g+=d+" "}g+=this.parser.parse(c.tokens,l),o+=this.listitem({type:"list_item",raw:g,text:g,task:u,checked:!!h,loose:l,tokens:c.tokens})}return e.call(this,o,r,i)};case"html":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text,n.block)};case"paragraph":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,this.parser.parseInline(n.tokens))};case"escape":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text)};case"link":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.href,n.title,this.parser.parseInline(n.tokens))};case"image":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.href,n.title,n.text)};case"strong":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,this.parser.parseInline(n.tokens))};case"em":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,this.parser.parseInline(n.tokens))};case"codespan":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text)};case"del":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,this.parser.parseInline(n.tokens))};case"text":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text)}}return e}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return y.lex(e,t??this.defaults)}parser(e,t){return T.parse(e,t??this.defaults)}#e(e,t){return(s,n)=>{let r={...n},i={...this.defaults,...r};this.defaults.async===!0&&r.async===!1&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);let l=this.#n(!!i.silent,!!i.async);if(typeof s>"u"||s===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(s):s).then(o=>e(o,i)).then(o=>i.hooks?i.hooks.processAllTokens(o):o).then(o=>i.walkTokens?Promise.all(this.walkTokens(o,i.walkTokens)).then(()=>o):o).then(o=>t(o,i)).then(o=>i.hooks?i.hooks.postprocess(o):o).catch(l);try{i.hooks&&(s=i.hooks.preprocess(s));let o=e(s,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let p=t(o,i);return i.hooks&&(p=i.hooks.postprocess(p)),p}catch(o){return l(o)}}}#n(e,t){return s=>{if(s.message+=`
Please report this to https://github.com/markedjs/marked.`,e){let n="An error occurred:
"+m(s.message+"",!0)+"
";return t?Promise.resolve(n):n}if(t)return Promise.reject(s);throw s}}},$=new F;function k(a,e){return $.parse(a,e)}f(k,"marked");k.options=k.setOptions=function(a){return $.setOptions(a),k.defaults=$.defaults,ue(k.defaults),k};k.getDefaults=O;k.defaults=R;k.use=function(...a){return $.use(...a),k.defaults=$.defaults,ue(k.defaults),k};k.walkTokens=function(a,e){return $.walkTokens(a,e)};k.parseInline=$.parseInline;k.Parser=T;k.parser=T.parse;k.Renderer=L;k.TextRenderer=E;k.Lexer=y;k.lexer=y.lex;k.Tokenizer=S;k.Hooks=z;k.parse=k;var kt=k.options,xt=k.setOptions,mt=k.use,bt=k.walkTokens,wt=k.parseInline;var yt=T.parse,Tt=y.lex;function ot(a,{markdownAutoWrap:e}){let s=a.replace(/
/g,`
`).replace(/\n{2,}/g,`
`),n=le(s);return e===!1?n.replace(/ /g," "):n}f(ot,"preprocessMarkdown");function Te(a,e={}){let t=ot(a,e),s=k.lexer(t),n=[[]],r=0;function i(l,o="normal"){l.type==="text"?l.text.split(`
`).forEach((c,h)=>{h!==0&&(r++,n.push([])),c.split(" ").forEach(u=>{u=u.replace(/'/g,"'"),u&&n[r].push({content:u,type:o})})}):l.type==="strong"||l.type==="em"?l.tokens.forEach(p=>{i(p,l.type)}):l.type==="html"&&n[r].push({content:l.text,type:"normal"})}return f(i,"processNode"),s.forEach(l=>{l.type==="paragraph"?l.tokens?.forEach(o=>{i(o)}):l.type==="html"&&n[r].push({content:l.text,type:"normal"})}),n}f(Te,"markdownToLines");function $e(a,{markdownAutoWrap:e}={}){let t=k.lexer(a);function s(n){return n.type==="text"?e===!1?n.text.replace(/\n */g,"
").replace(/ /g," "):n.text.replace(/\n */g,"
"):n.type==="strong"?`${n.tokens?.map(s).join("")}`:n.type==="em"?`${n.tokens?.map(s).join("")}`:n.type==="paragraph"?`${n.tokens?.map(s).join("")}
`:n.type==="space"?"":n.type==="html"?`${n.text}`:n.type==="escape"?n.text:`Unsupported markdown: ${n.type}`}return f(s,"output"),t.map(s).join("")}f($e,"markdownToHTML");function at(a){return Intl.Segmenter?[...new Intl.Segmenter().segment(a)].map(e=>e.segment):[...a]}f(at,"splitTextToChars");function ct(a,e){let t=at(e.content);return Re(a,[],t,e.type)}f(ct,"splitWordToFitWidth");function Re(a,e,t,s){if(t.length===0)return[{content:e.join(""),type:s},{content:"",type:s}];let[n,...r]=t,i=[...e,n];return a([{content:i.join(""),type:s}])?Re(a,i,r,s):(e.length===0&&n&&(e.push(n),t.shift()),[{content:e.join(""),type:s},{content:t.join(""),type:s}])}f(Re,"splitWordToFitWidthRecursion");function ze(a,e){if(a.some(({content:t})=>t.includes(`
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return X(a,e)}f(ze,"splitLineToFitWidth");function X(a,e,t=[],s=[]){if(a.length===0)return s.length>0&&t.push(s),t.length>0?t:[];let n="";a[0].content===" "&&(n=" ",a.shift());let r=a.shift()??{content:" ",type:"normal"},i=[...s];if(n!==""&&i.push({content:n,type:"normal"}),i.push(r),e(i))return X(a,e,t,i);if(s.length>0)t.push(s),a.unshift(r);else if(r.content){let[l,o]=ct(e,r);t.push([l]),o.content&&a.unshift(o)}return X(a,e,t)}f(X,"splitLineToFitWidthRecursion");function Se(a,e){e&&a.attr("style",e)}f(Se,"applyStyle");async function pt(a,e,t,s,n=!1){let r=a.append("foreignObject");r.attr("width",`${10*t}px`),r.attr("height",`${10*t}px`);let i=r.append("xhtml:div"),l=e.label;e.label&&P(e.label)&&(l=await ne(e.label.replace(se.lineBreakRegex,`
`),re()));let o=e.isNode?"nodeLabel":"edgeLabel",p=i.append("span");p.html(l),Se(p,e.labelStyle),p.attr("class",`${o} ${s}`),Se(i,e.labelStyle),i.style("display","table-cell"),i.style("white-space","nowrap"),i.style("line-height","1.5"),i.style("max-width",t+"px"),i.style("text-align","center"),i.attr("xmlns","http://www.w3.org/1999/xhtml"),n&&i.attr("class","labelBkg");let c=i.node().getBoundingClientRect();return c.width===t&&(i.style("display","table"),i.style("white-space","break-spaces"),i.style("width",t+"px"),c=i.node().getBoundingClientRect()),r.node()}f(pt,"addHtmlSpan");function K(a,e,t){return a.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",e*t-.1+"em").attr("dy",t+"em")}f(K,"createTspan");function ht(a,e,t){let s=a.append("text"),n=K(s,1,e);V(n,t);let r=n.node().getComputedTextLength();return s.remove(),r}f(ht,"computeWidthOfText");function qt(a,e,t){let s=a.append("text"),n=K(s,1,e);V(n,[{content:t,type:"normal"}]);let r=n.node()?.getBoundingClientRect();return r&&s.remove(),r}f(qt,"computeDimensionOfText");function ut(a,e,t,s=!1){let r=e.append("g"),i=r.insert("rect").attr("class","background").attr("style","stroke: none"),l=r.append("text").attr("y","-10.1"),o=0;for(let p of t){let c=f(u=>ht(r,1.1,u)<=a,"checkWidth"),h=c(p)?[p]:ze(p,c);for(let u of h){let g=K(l,o,1.1);V(g,u),o++}}if(s){let p=l.node().getBBox(),c=2;return i.attr("x",p.x-c).attr("y",p.y-c).attr("width",p.width+2*c).attr("height",p.height+2*c),r.node()}else return l.node()}f(ut,"createFormattedText");function V(a,e){a.text(""),e.forEach((t,s)=>{let n=a.append("tspan").attr("font-style",t.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",t.type==="strong"?"bold":"normal");s===0?n.text(t.content):n.text(" "+t.content)})}f(V,"updateTextContentAndStyles");function ft(a){return a.replace(/fa[bklrs]?:fa-[\w-]+/g,e=>``)}f(ft,"replaceIconSubstring");var Zt=f(async(a,e="",{style:t="",isTitle:s=!1,classes:n="",useHtmlLabels:r=!0,isNode:i=!0,width:l=200,addSvgBackground:o=!1}={},p)=>{if(te.debug("XYZ createText",e,t,s,n,r,i,"addSvgBackground: ",o),r){let c=$e(e,p),h=ft(ie(c)),u=e.replace(/\\\\/g,"\\"),g={isNode:i,label:P(e)?u:h,labelStyle:t.replace("fill:","color:")};return await pt(a,g,l,n,o)}else{let c=e.replace(/
/g,"
"),h=Te(c.replace("
","
"),p),u=ut(l,a,h,e?o:!1);if(i){/stroke:/.exec(t)&&(t=t.replace("stroke:","lineColor:"));let g=t.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");v(u).attr("style",g)}else{let g=t.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");v(u).select("rect").attr("style",g.replace(/background:/g,"fill:"));let d=t.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");v(u).select("text").attr("style",d)}return u}},"createText");export{le as a,qt as b,ft as c,Zt as d};