import{t as R}from"./marked.esm-DCf1d_lA.js";import{u as S}from"./src-D-O4qgKm.js";import{a as nt}from"./chunk-S3R3BYOJ-uZNU-Kd7.js";import{n as f,r as y}from"./src-Ci62OB0C.js";import{I as j,N as rt,O as W,s as it,y as L}from"./chunk-ABZYJK2D-D-T6tPym.js";var lt=Object.freeze({left:0,top:0,width:16,height:16}),x=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),z=Object.freeze({...lt,...x}),ot=Object.freeze({...z,body:"",hidden:!1}),at=Object.freeze({width:null,height:null}),st=Object.freeze({...at,...x}),pt=(t,r,n,i="")=>{let e=t.split(":");if(t.slice(0,1)==="@"){if(e.length<2||e.length>3)return null;i=e.shift().slice(1)}if(e.length>3||!e.length)return null;if(e.length>1){let l=e.pop(),p=e.pop(),s={provider:e.length>0?e[0]:i,prefix:p,name:l};return r&&!$(s)?null:s}let a=e[0],o=a.split("-");if(o.length>1){let l={provider:i,prefix:o.shift(),name:o.join("-")};return r&&!$(l)?null:l}if(n&&i===""){let l={provider:i,prefix:"",name:a};return r&&!$(l,n)?null:l}return null},$=(t,r)=>t?!!((r&&t.prefix===""||t.prefix)&&t.name):!1;function ct(t,r){let n={};!t.hFlip!=!r.hFlip&&(n.hFlip=!0),!t.vFlip!=!r.vFlip&&(n.vFlip=!0);let i=((t.rotate||0)+(r.rotate||0))%4;return i&&(n.rotate=i),n}function A(t,r){let n=ct(t,r);for(let i in ot)i in x?i in t&&!(i in n)&&(n[i]=x[i]):i in r?n[i]=r[i]:i in t&&(n[i]=t[i]);return n}function ft(t,r){let n=t.icons,i=t.aliases||Object.create(null),e=Object.create(null);function a(o){if(n[o])return e[o]=[];if(!(o in e)){e[o]=null;let l=i[o]&&i[o].parent,p=l&&a(l);p&&(e[o]=[l].concat(p))}return e[o]}return(r||Object.keys(n).concat(Object.keys(i))).forEach(a),e}function C(t,r,n){let i=t.icons,e=t.aliases||Object.create(null),a={};function o(l){a=A(i[l]||e[l],a)}return o(r),n.forEach(o),A(t,a)}function ht(t,r){if(t.icons[r])return C(t,r,[]);let n=ft(t,[r])[r];return n?C(t,r,n):null}var ut=/(-?[0-9.]*[0-9]+[0-9.]*)/g,gt=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function N(t,r,n){if(r===1)return t;if(n||(n=100),typeof t=="number")return Math.ceil(t*r*n)/n;if(typeof t!="string")return t;let i=t.split(ut);if(i===null||!i.length)return t;let e=[],a=i.shift(),o=gt.test(a);for(;;){if(o){let l=parseFloat(a);isNaN(l)?e.push(a):e.push(Math.ceil(l*r*n)/n)}else e.push(a);if(a=i.shift(),a===void 0)return e.join("");o=!o}}function dt(t,r="defs"){let n="",i=t.indexOf("<"+r);for(;i>=0;){let e=t.indexOf(">",i),a=t.indexOf("</"+r);if(e===-1||a===-1)break;let o=t.indexOf(">",a);if(o===-1)break;n+=t.slice(e+1,a).trim(),t=t.slice(0,i).trim()+t.slice(o+1)}return{defs:n,content:t}}function mt(t,r){return t?"<defs>"+t+"</defs>"+r:r}function yt(t,r,n){let i=dt(t);return mt(i.defs,r+i.content+n)}var wt=t=>t==="unset"||t==="undefined"||t==="none";function xt(t,r){let n={...z,...t},i={...st,...r},e={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,i].forEach(w=>{let u=[],et=w.hFlip,B=w.vFlip,m=w.rotate;et?B?m+=2:(u.push("translate("+(e.width+e.left).toString()+" "+(0-e.top).toString()+")"),u.push("scale(-1 1)"),e.top=e.left=0):B&&(u.push("translate("+(0-e.left).toString()+" "+(e.height+e.top).toString()+")"),u.push("scale(1 -1)"),e.top=e.left=0);let d;switch(m<0&&(m-=Math.floor(m/4)*4),m%=4,m){case 1:d=e.height/2+e.top,u.unshift("rotate(90 "+d.toString()+" "+d.toString()+")");break;case 2:u.unshift("rotate(180 "+(e.width/2+e.left).toString()+" "+(e.height/2+e.top).toString()+")");break;case 3:d=e.width/2+e.left,u.unshift("rotate(-90 "+d.toString()+" "+d.toString()+")");break}m%2==1&&(e.left!==e.top&&(d=e.left,e.left=e.top,e.top=d),e.width!==e.height&&(d=e.width,e.width=e.height,e.height=d)),u.length&&(a=yt(a,'<g transform="'+u.join(" ")+'">',"</g>"))});let o=i.width,l=i.height,p=e.width,s=e.height,c,h;o===null?(h=l===null?"1em":l==="auto"?s:l,c=N(h,p/s)):(c=o==="auto"?p:o,h=l===null?N(c,s/p):l==="auto"?s:l);let g={},I=(w,u)=>{wt(u)||(g[w]=u.toString())};I("width",c),I("height",h);let M=[e.left,e.top,p,s];return g.viewBox=M.join(" "),{attributes:g,viewBox:M,body:a}}var bt=/\sid="(\S+)"/g,kt="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),vt=0;function St(t,r=kt){let n=[],i;for(;i=bt.exec(t);)n.push(i[1]);if(!n.length)return t;let e="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(a=>{let o=typeof r=="function"?r(a):r+(vt++).toString(),l=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+e+"$3")}),t=t.replace(new RegExp(e,"g"),""),t}function jt(t,r){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(let i in r)n+=" "+i+'="'+r[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}function D(t){var r=[...arguments].slice(1),n=Array.from(typeof t=="string"?[t]:t);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,"");var i=n.reduce(function(o,l){var p=l.match(/\n([\t ]+|(?!\s).)/g);return p?o.concat(p.map(function(s){var c;return((c=s.match(/[\t ]/g))==null?void 0:c.length)??0})):o},[]);if(i.length){var e=RegExp(`
[	 ]{`+Math.min.apply(Math,i)+"}","g");n=n.map(function(o){return o.replace(e,`
`)})}n[0]=n[0].replace(/^\r?\n/,"");var a=n[0];return r.forEach(function(o,l){var p=a.match(/(?:^|\n)( *)$/),s=p?p[1]:"",c=o;typeof o=="string"&&o.includes(`
`)&&(c=String(o).split(`
`).map(function(h,g){return g===0?h:""+s+h}).join(`
`)),a+=c+n[l+1]}),a}var H={body:'<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',height:80,width:80},E=new Map,P=new Map,$t=f(t=>{for(let r of t){if(!r.name)throw Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(y.debug("Registering icon pack:",r.name),"loader"in r)P.set(r.name,r.loader);else if("icons"in r)E.set(r.name,r.icons);else throw y.error("Invalid icon loader:",r),Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),G=f(async(t,r)=>{let n=pt(t,!0,r!==void 0);if(!n)throw Error(`Invalid icon name: ${t}`);let i=n.prefix||r;if(!i)throw Error(`Icon name must contain a prefix: ${t}`);let e=E.get(i);if(!e){let o=P.get(i);if(!o)throw Error(`Icon set not found: ${n.prefix}`);try{e={...await o(),prefix:i},E.set(i,e)}catch(l){throw y.error(l),Error(`Failed to load icon set: ${n.prefix}`)}}let a=ht(e,n.name);if(!a)throw Error(`Icon not found: ${t}`);return a},"getRegisteredIconData"),Et=f(async t=>{try{return await G(t),!0}catch{return!1}},"isIconAvailable"),U=f(async(t,r,n)=>{let i;try{i=await G(t,r==null?void 0:r.fallbackPrefix)}catch(a){y.error(a),i=H}let e=xt(i,r);return j(jt(St(e.body),{...e.attributes,...n}),L())},"getIconSVG");function V(t,{markdownAutoWrap:r}){let n=D(t.replace(/<br\/>/g,`
`).replace(/\n{2,}/g,`
`));return r===!1?n.replace(/ /g,"&nbsp;"):n}f(V,"preprocessMarkdown");function X(t,r={}){let n=V(t,r),i=R.lexer(n),e=[[]],a=0;function o(l,p="normal"){l.type==="text"?l.text.split(`
`).forEach((s,c)=>{c!==0&&(a++,e.push([])),s.split(" ").forEach(h=>{h=h.replace(/&#39;/g,"'"),h&&e[a].push({content:h,type:p})})}):l.type==="strong"||l.type==="em"?l.tokens.forEach(s=>{o(s,l.type)}):l.type==="html"&&e[a].push({content:l.text,type:"normal"})}return f(o,"processNode"),i.forEach(l=>{var p;l.type==="paragraph"?(p=l.tokens)==null||p.forEach(s=>{o(s)}):l.type==="html"?e[a].push({content:l.text,type:"normal"}):e[a].push({content:l.raw,type:"normal"})}),e}f(X,"markdownToLines");function Y(t,{markdownAutoWrap:r}={}){let n=R.lexer(t);function i(e){var a,o,l;return e.type==="text"?r===!1?e.text.replace(/\n */g,"<br/>").replace(/ /g,"&nbsp;"):e.text.replace(/\n */g,"<br/>"):e.type==="strong"?`<strong>${(a=e.tokens)==null?void 0:a.map(i).join("")}</strong>`:e.type==="em"?`<em>${(o=e.tokens)==null?void 0:o.map(i).join("")}</em>`:e.type==="paragraph"?`<p>${(l=e.tokens)==null?void 0:l.map(i).join("")}</p>`:e.type==="space"?"":e.type==="html"?`${e.text}`:e.type==="escape"?e.text:(y.warn(`Unsupported markdown: ${e.type}`),e.raw)}return f(i,"output"),n.map(i).join("")}f(Y,"markdownToHTML");function Z(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(r=>r.segment):[...t]}f(Z,"splitTextToChars");function q(t,r){return O(t,[],Z(r.content),r.type)}f(q,"splitWordToFitWidth");function O(t,r,n,i){if(n.length===0)return[{content:r.join(""),type:i},{content:"",type:i}];let[e,...a]=n,o=[...r,e];return t([{content:o.join(""),type:i}])?O(t,o,a,i):(r.length===0&&e&&(r.push(e),n.shift()),[{content:r.join(""),type:i},{content:n.join(""),type:i}])}f(O,"splitWordToFitWidthRecursion");function J(t,r){if(t.some(({content:n})=>n.includes(`
`)))throw Error("splitLineToFitWidth does not support newlines in the line");return b(t,r)}f(J,"splitLineToFitWidth");function b(t,r,n=[],i=[]){if(t.length===0)return i.length>0&&n.push(i),n.length>0?n:[];let e="";t[0].content===" "&&(e=" ",t.shift());let a=t.shift()??{content:" ",type:"normal"},o=[...i];if(e!==""&&o.push({content:e,type:"normal"}),o.push(a),r(o))return b(t,r,n,o);if(i.length>0)n.push(i),t.unshift(a);else if(a.content){let[l,p]=q(r,a);n.push([l]),p.content&&t.unshift(p)}return b(t,r,n)}f(b,"splitLineToFitWidthRecursion");function T(t,r){r&&t.attr("style",r)}f(T,"applyStyle");async function K(t,r,n,i,e=!1,a=L()){let o=t.append("foreignObject");o.attr("width",`${10*n}px`),o.attr("height",`${10*n}px`);let l=o.append("xhtml:div"),p=W(r.label)?await rt(r.label.replace(it.lineBreakRegex,`
`),a):j(r.label,a),s=r.isNode?"nodeLabel":"edgeLabel",c=l.append("span");c.html(p),T(c,r.labelStyle),c.attr("class",`${s} ${i}`),T(l,r.labelStyle),l.style("display","table-cell"),l.style("white-space","nowrap"),l.style("line-height","1.5"),l.style("max-width",n+"px"),l.style("text-align","center"),l.attr("xmlns","http://www.w3.org/1999/xhtml"),e&&l.attr("class","labelBkg");let h=l.node().getBoundingClientRect();return h.width===n&&(l.style("display","table"),l.style("white-space","break-spaces"),l.style("width",n+"px"),h=l.node().getBoundingClientRect()),o.node()}f(K,"addHtmlSpan");function k(t,r,n){return t.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",r*n-.1+"em").attr("dy",n+"em")}f(k,"createTspan");function Q(t,r,n){let i=t.append("text"),e=k(i,1,r);v(e,n);let a=e.node().getComputedTextLength();return i.remove(),a}f(Q,"computeWidthOfText");function _(t,r,n){var o;let i=t.append("text"),e=k(i,1,r);v(e,[{content:n,type:"normal"}]);let a=(o=e.node())==null?void 0:o.getBoundingClientRect();return a&&i.remove(),a}f(_,"computeDimensionOfText");function tt(t,r,n,i=!1){let e=1.1,a=r.append("g"),o=a.insert("rect").attr("class","background").attr("style","stroke: none"),l=a.append("text").attr("y","-10.1"),p=0;for(let s of n){let c=f(g=>Q(a,e,g)<=t,"checkWidth"),h=c(s)?[s]:J(s,c);for(let g of h)v(k(l,p,e),g),p++}if(i){let s=l.node().getBBox();return o.attr("x",s.x-2).attr("y",s.y-2).attr("width",s.width+4).attr("height",s.height+4),a.node()}else return l.node()}f(tt,"createFormattedText");function v(t,r){t.text(""),r.forEach((n,i)=>{let e=t.append("tspan").attr("font-style",n.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",n.type==="strong"?"bold":"normal");i===0?e.text(n.content):e.text(" "+n.content)})}f(v,"updateTextContentAndStyles");async function F(t,r={}){let n=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(e,a,o)=>(n.push((async()=>{let l=`${a}:${o}`;return await Et(l)?await U(l,void 0,{class:"label-icon"}):`<i class='${j(e,r).replace(":"," ")}'></i>`})()),e));let i=await Promise.all(n);return t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>i.shift()??"")}f(F,"replaceIconSubstring");var Ot=f(async(t,r="",{style:n="",isTitle:i=!1,classes:e="",useHtmlLabels:a=!0,isNode:o=!0,width:l=200,addSvgBackground:p=!1}={},s)=>{if(y.debug("XYZ createText",r,n,i,e,a,o,"addSvgBackground: ",p),a){let c=await F(nt(Y(r,s)),s),h=r.replace(/\\\\/g,"\\");return await K(t,{isNode:o,label:W(r)?h:c,labelStyle:n.replace("fill:","color:")},l,e,p,s)}else{let c=tt(l,t,X(r.replace(/<br\s*\/?>/g,"<br/>").replace("<br>","<br/>"),s),r?p:!1);if(o){/stroke:/.exec(n)&&(n=n.replace("stroke:","lineColor:"));let h=n.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");S(c).attr("style",h)}else{let h=n.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");S(c).select("rect").attr("style",h.replace(/background:/g,"fill:"));let g=n.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");S(c).select("text").attr("style",g)}return c}},"createText");export{F as a,$t as i,Ot as n,H as o,U as r,D as s,_ as t};
