import{h as e,defineComponent as r,ref as t,onMounted as o,watch as a,onBeforeUnmount as i,nextTick as l}from"vue";import{IconBase as d}from"@mr-hope/vuepress-shared/lib/client";import"../styles/mermaid.scss";const n=()=>e(d,{name:"loading"},(()=>["0s","-0.333s","-0.667s"].map((r=>e("circle",{cx:50,cy:50,r:0,fill:"none",stroke:"currentColor",strokeWidth:"2"},[e("animate",{attributeName:"r",repeatCount:"indefinite",dur:"1s",values:"0;40",keyTimes:"0;1",keySplines:"0 0.2 0.8 1",calcMode:"spline",begin:r}),e("animate",{attributeName:"opacity",repeatCount:"indefinite",dur:"1s",values:"1;0",keyTimes:"0;1",keySplines:"0.2 0 0.8 1",calcMode:"spline",begin:r})])))));var s=r({name:"MermaidChart",props:{id:{type:String,required:!0}},setup(r){const d=t(""),s=t(),f=t(!1);let c;return o((()=>{var e;const t=document.querySelector("html"),o=decodeURIComponent((null===(e=s.value)||void 0===e?void 0:e.dataset.code)||""),i=()=>t.classList.contains("dark")||"dark"===t.getAttribute("data-theme");f.value=i(),Promise.all([import("mermaid"),new Promise((e=>setTimeout(e,MARKDOWN_ENHANCE_DELAY)))]).then((([e])=>{const{initialize:n,render:s}=e.default,u=()=>{const e=document.createElement("div");e.style.position="relative",e.style.top="-9999px";const t=r=>{d.value=r,document.body.removeChild(e)};var a;n({theme:"base",themeVariables:(a=f.value,{dark:a,background:a?"#1e1e1e":"#fff",primaryColor:a?"#389d70":"#4abf8a",primaryBorderColor:a?"#389d70":"#4abf8a",primaryTextColor:"#fff",secondaryColor:"#f39c12",secondaryBorderColor:a?"#fff":"#000",secondaryTextColor:a?"#ddd":"#333",tertiaryColor:a?"#22182d":"#eeeaf3",tertiaryBorderColor:a?"#fff":"#000",tertiaryTextColor:a?"#ddd":"#333",noteBkgColor:a?"#f6d365":"#fff5ad",noteTextColor:"#242424",noteBorderColor:a?"#f6d365":"#333",lineColor:a?"#d3d3d3":"#333",textColor:a?"#fff":"#242424",mainBkg:a?"#389d70":"#4abf8a",errorBkgColor:"#eb4d5d",errorTextColor:"#fff",nodeBorder:a?"#389d70":"#4abf8a",nodeTextColor:a?"#fff":"#242424",signalTextColor:a?"#9e9e9e":"#242424",classText:"#fff",labelColor:"#fff",fillType0:a?"#cf1322":"#f1636e",fillType1:"#f39c12",fillType2:"#2ecc71",fillType3:"#fa541c",fillType4:"#25a55b",fillType5:"#13c2c2",fillType6:"#096dd9",fillType7:"#aa6fe9"}),flowchart:{useMaxWidth:!1},sequence:{useMaxWidth:!1},journey:{useMaxWidth:!1},gantt:{useMaxWidth:!1},er:{useMaxWidth:!1},pie:{useMaxWidth:!1},...MERMAID_OPTIONS,startOnLoad:!1}),d.value="",document.body.appendChild(e),l((()=>{s(r.id,o,t,e)}))};u(),c=new MutationObserver((()=>{f.value=i()})),c.observe(t,{attributeFilter:["class","data-theme"],attributes:!0}),a(f,u)}))})),i((()=>{c.disconnect()})),()=>e("div",{ref:s,class:["md-enhance-mermaid",{loading:!d.value}]},d.value?e("div",{class:"content",innerHTML:d.value}):e(n))}});export{s as default};
//# sourceMappingURL=Mermaid.js.map
