import{h as e,defineComponent as r,ref as o,onMounted as t,onBeforeUnmount as a,nextTick as l}from"vue";import{IconBase as i}from"@mr-hope/vuepress-shared/lib/client";import"../styles/mermaid.scss";const d=()=>e(i,{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 n=r({name:"MermaidChart",props:{id:{type:String,required:!0}},setup(r){const i=o(""),n=o();let s;return t((()=>{var e;const o=decodeURIComponent((null===(e=n.value)||void 0===e?void 0:e.dataset.code)||"");Promise.all([import("mermaid"),new Promise((e=>setTimeout(e,MARKDOWN_ENHANCE_DELAY)))]).then((([e])=>{const{initialize:t,render:a}=e.default,d=e=>{const d=document.createElement("div");d.style.position="relative",d.style.top="-9999px";const n=e=>{i.value=e,document.body.removeChild(d)};t({theme:"base",themeVariables:{dark:e,background:e?"#1e1e1e":"#fff",primaryColor:e?"#389d70":"#4abf8a",primaryBorderColor:e?"#389d70":"#4abf8a",primaryTextColor:"#fff",secondaryColor:"#f39c12",secondaryBorderColor:e?"#fff":"#000",secondaryTextColor:e?"#ddd":"#333",tertiaryColor:e?"#22182d":"#eeeaf3",tertiaryBorderColor:e?"#fff":"#000",tertiaryTextColor:e?"#ddd":"#333",noteBkgColor:e?"#f6d365":"#fff5ad",noteTextColor:"#242424",noteBorderColor:e?"#f6d365":"#333",lineColor:e?"#d3d3d3":"#333",textColor:e?"#fff":"#242424",mainBkg:e?"#389d70":"#4abf8a",errorBkgColor:"#eb4d5d",errorTextColor:"#fff",nodeBorder:e?"#389d70":"#4abf8a",nodeTextColor:e?"#fff":"#242424",signalTextColor:e?"#9e9e9e":"#242424",classText:"#fff",labelColor:"#fff",fillType0:e?"#cf1322":"#f1636e",fillType1:"#f39c12",fillType2:"#2ecc71",fillType3:"#fa541c",fillType4:"#25a55b",fillType5:"#13c2c2",fillType6:"#096dd9",fillType7:"#aa6fe9"},...MERMAID_OPTIONS,startOnLoad:!1}),i.value="",document.body.appendChild(d),l((()=>{a(r.id,o,n,d)}))},n=document.querySelector("body");d(n.classList.contains("theme-dark")),s=new MutationObserver((()=>{d(n.classList.contains("theme-dark"))})),s.observe(n,{attributeFilter:["class"],attributes:!0})}))})),a((()=>{s.disconnect()})),()=>e("div",{ref:n,class:{"md-enhance-mermaid":!0,loading:!i.value}},i.value?e("div",{class:"content",innerHTML:i.value}):e(d))}});export{n as default};
//# sourceMappingURL=Mermaid.js.map
