From eb40bd3022ac4968e0065b956c6fefe294e1d673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Wed, 16 Oct 2024 01:54:41 +0800 Subject: [PATCH] Fix mermaid diagram width shrinking --- assets/packs/mermaid/main.css | 43 +++++++++++++++++-------------- assets/packs/mermaid/main.js | 6 ++++- lib/assets/mermaid/build/main.css | 2 +- lib/assets/mermaid/build/main.js | 14 +++++----- 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/assets/packs/mermaid/main.css b/assets/packs/mermaid/main.css index e5716737..18a36200 100644 --- a/assets/packs/mermaid/main.css +++ b/assets/packs/mermaid/main.css @@ -1,36 +1,39 @@ .container { display: flex; + flex-direction: column; align-items: flex-start; - gap: 8px; - width: max-content; -} - -.container .download-btn { - cursor: pointer; - padding: 0.25rem; - color: #61758A; - background: none; - border: none; -} - -.container .download-btn:hover { - color: #0D1829; -} - -.container:not(:hover) .download-btn { - opacity: 0; } .figure { + position: relative; margin: 0; + flex-grow: 1; display: flex; flex-direction: column; align-items: center; - width: max-content; } -.caption { +.figure .caption { margin-top: 8px; font-size: 0.875rem; color: #61758a; } + +.figure .download-btn { + position: absolute; + top: 0; + right: 0; + cursor: pointer; + padding: 0.25rem; + color: #61758a; + background: none; + border: none; +} + +.figure .download-btn:hover { + color: #0d1829; +} + +.figure:not(:hover) .download-btn { + display: none; +} diff --git a/assets/packs/mermaid/main.js b/assets/packs/mermaid/main.js index 8b1e62b5..9f5198d4 100644 --- a/assets/packs/mermaid/main.js +++ b/assets/packs/mermaid/main.js @@ -18,6 +18,10 @@ export function init(ctx, { diagram, caption, download }) { const figure = document.createElement("figure"); figure.classList.add("figure"); figure.innerHTML = svg; + // The diagram intrinsic width is actually in max-width, so we adjust it + figure.firstElementChild.style.width = + figure.firstElementChild.style.maxWidth; + figure.firstElementChild.style.maxWidth = "100%"; container.appendChild(figure); if (caption) { @@ -32,7 +36,7 @@ export function init(ctx, { diagram, caption, download }) { downloadBtn.classList.add("download-btn"); downloadBtn.title = "Download"; downloadBtn.innerHTML = ``; - container.appendChild(downloadBtn); + figure.appendChild(downloadBtn); downloadBtn.addEventListener("click", (event) => { const blobURL = URL.createObjectURL( diff --git a/lib/assets/mermaid/build/main.css b/lib/assets/mermaid/build/main.css index fd9f7b79..13e74b37 100644 --- a/lib/assets/mermaid/build/main.css +++ b/lib/assets/mermaid/build/main.css @@ -1 +1 @@ -.container{display:flex;align-items:flex-start;gap:8px;width:-moz-max-content;width:max-content}.container .download-btn{cursor:pointer;padding:.25rem;color:#61758a;background:none;border:none}.container .download-btn:hover{color:#0d1829}.container:not(:hover) .download-btn{opacity:0}.figure{margin:0;display:flex;flex-direction:column;align-items:center;width:-moz-max-content;width:max-content}.caption{margin-top:8px;font-size:.875rem;color:#61758a} +.container{display:flex;flex-direction:column;align-items:flex-start}.figure{position:relative;margin:0;flex-grow:1;display:flex;flex-direction:column;align-items:center}.figure .caption{margin-top:8px;font-size:.875rem;color:#61758a}.figure .download-btn{position:absolute;top:0;right:0;cursor:pointer;padding:.25rem;color:#61758a;background:none;border:none}.figure .download-btn:hover{color:#0d1829}.figure:not(:hover) .download-btn{display:none} diff --git a/lib/assets/mermaid/build/main.js b/lib/assets/mermaid/build/main.js index b24ac636..910eb710 100644 --- a/lib/assets/mermaid/build/main.js +++ b/lib/assets/mermaid/build/main.js @@ -1,13 +1,13 @@ -import{a as ye}from"./chunk-LZX4GX75.js";import{a as ir}from"./chunk-HPDSMQTX.js";import{a as We,b as Ke}from"./chunk-XNPPQCMN.js";import{a as ar}from"./chunk-EXJ52NKL.js";import"./chunk-5CG6MCMB.js";import{b as Qe}from"./chunk-GDYVCCNI.js";import"./chunk-IEVFQHBT.js";import{a as tr}from"./chunk-DQY2Y6DO.js";import{b as Ze,j as he,l as Je,m as H,n as er,o as rr}from"./chunk-WSSX4ADQ.js";import"./chunk-ZTFC2RI5.js";import{A as Ge,B as ge,C as Be,D as V,E as qe,F as q,I as Ye,O as je,Q as Xe,ba as Y,ca as Q,g as gt,h as i,ha as k,j as v,k as me,l as $e,n as Ve,o as ue,p as pe,q as fe,r as He,s as Pe,u as K,x as ve,y as Ue,z as Ne}from"./chunk-SOPNMMPO.js";import{d as we}from"./chunk-B7P5FXKN.js";import"./chunk-OIZLKBMD.js";import{a as Oe,b as ze,f as vt}from"./chunk-FC2K5MUR.js";var Z="comm",J="rule",ee="decl";var or="@import";var nr="@keyframes";var sr="@layer";var xe=Math.abs,j=String.fromCharCode;function re(e){return e.trim()}function X(e,r,t){return e.replace(r,t)}function dr(e,r,t){return e.indexOf(r,t)}function z(e,r){return e.charCodeAt(r)|0}function F(e,r,t){return e.slice(r,t)}function b(e){return e.length}function cr(e){return e.length}function P(e,r){return r.push(e),e}var te=1,U=1,lr=0,D=0,w=0,G="";function ae(e,r,t,a,o,n,d,c){return{value:e,root:r,parent:t,type:a,props:o,children:n,line:te,column:U,length:d,return:"",siblings:c}}function mr(){return w}function ur(){return w=D>0?z(G,--D):0,U--,w===10&&(U=1,te--),w}function T(){return w=D2||N(w)>3?"":" "}function gr(e,r){for(;--r&&T()&&!(w<48||w>102||w>57&&w<65||w>70&&w<97););return ie(e,W()+(r<6&&I()==32&&T()==32))}function be(e){for(;T();)switch(w){case e:return D;case 34:case 39:e!==34&&e!==39&&be(w);break;case 40:e===41&&be(e);break;case 92:T();break}return D}function hr(e,r){for(;T()&&e+w!==57;)if(e+w===84&&I()===47)break;return"/*"+ie(r,D-1)+"*"+j(e===47?e:T())}function wr(e){for(;!N(I());)T();return ie(e,D)}function br(e){return fr(ne("",null,null,null,[""],e=pr(e),0,[0],e))}function ne(e,r,t,a,o,n,d,c,s){for(var l=0,u=0,m=d,g=0,y=0,x=0,f=1,C=1,L=1,h=0,_="",R=o,M=n,S=a,p=_;C;)switch(x=h,h=T()){case 40:if(x!=108&&z(p,m-1)==58){dr(p+=X(oe(h),"&","&\f"),"&\f",xe(l?c[l-1]:0))!=-1&&(L=-1);break}case 34:case 39:case 91:p+=oe(h);break;case 9:case 10:case 13:case 32:p+=vr(x);break;case 92:p+=gr(W()-1,7);continue;case 47:switch(I()){case 42:case 47:P(ht(hr(T(),W()),r,t,s),s),(N(x||1)==5||N(I()||1)==5)&&b(p)&&F(p,-1,void 0)!==" "&&(p+=" ");break;default:p+="/"}break;case 123*f:c[l++]=b(p)*L;case 125*f:case 59:case 0:switch(h){case 0:case 125:C=0;case 59+u:L==-1&&(p=X(p,/\f/g,"")),y>0&&(b(p)-m||f===0&&x===47)&&P(y>32?xr(p+";",a,t,m-1,s):xr(X(p," ","")+";",a,t,m-2,s),s);break;case 59:p+=";";default:if(P(S=yr(p,r,t,l,u,o,c,_,R=[],M=[],m,n),n),h===123)if(u===0)ne(p,r,S,S,R,n,m,c,M);else switch(g===99&&z(p,3)===110?100:g){case 100:case 108:case 109:case 115:ne(e,S,S,a&&P(yr(e,S,S,0,0,o,c,_,o,R=[],m,M),M),o,M,m,c,a?R:M);break;default:ne(p,S,S,S,[""],M,0,c,M)}}l=u=y=0,f=L=1,_=p="",m=d;break;case 58:m=1+b(p),y=x;default:if(f<1){if(h==123)--f;else if(h==125&&f++==0&&ur()==125)continue}switch(p+=j(h),h*f){case 38:L=u>0?1:(p+="\f",-1);break;case 44:c[l++]=(b(p)-1)*L,L=1;break;case 64:I()===45&&(p+=oe(T())),g=I(),u=m=b(_=p+=wr(W())),h++;break;case 45:x===45&&b(p)==2&&(f=0)}}return n}function yr(e,r,t,a,o,n,d,c,s,l,u,m){for(var g=o-1,y=o===0?n:[""],x=cr(y),f=0,C=0,L=0;f0?y[h]+" "+_:X(_,/&\f/g,y[h])))&&(s[L++]=R);return ae(e,r,t,o===0?J:c,s,l,u,m)}function ht(e,r,t,a){return ae(e,r,t,Z,j(mr()),F(e,2,-2),0,a)}function xr(e,r,t,a,o){return ae(e,r,t,ee,F(e,0,a),F(e,a+1,-1),a,o)}function se(e,r){for(var t="",a=0;a/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),yt=i(async()=>{let{diagram:e}=await import("./c4Diagram-ZCSEYPFN-LHU7TFVG.js");return{id:_r,diagram:e}},"loader"),xt={id:_r,detector:wt,loader:yt},bt=xt,Ar="flowchart",Et=i((e,r)=>{var t,a;return((t=r==null?void 0:r.flowchart)==null?void 0:t.defaultRenderer)==="dagre-wrapper"||((a=r==null?void 0:r.flowchart)==null?void 0:a.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),St=i(async()=>{let{diagram:e}=await import("./flowDiagram-NWEUNK3L-AVS4VA5D.js");return{id:Ar,diagram:e}},"loader"),Dt={id:Ar,detector:Et,loader:St},Tt=Dt,Mr="flowchart-v2",Lt=i((e,r)=>{var t,a,o;return((t=r==null?void 0:r.flowchart)==null?void 0:t.defaultRenderer)==="dagre-d3"?!1:(((a=r==null?void 0:r.flowchart)==null?void 0:a.defaultRenderer)==="elk"&&(r.layout="elk"),/^\s*graph/.test(e)&&((o=r==null?void 0:r.flowchart)==null?void 0:o.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),_t=i(async()=>{let{diagram:e}=await import("./flowDiagram-NWEUNK3L-AVS4VA5D.js");return{id:Mr,diagram:e}},"loader"),At={id:Mr,detector:Lt,loader:_t},Mt=At,Cr="er",Ct=i(e=>/^\s*erDiagram/.test(e),"detector"),Rt=i(async()=>{let{diagram:e}=await import("./erDiagram-DKC2X5TE-7IMDOGPV.js");return{id:Cr,diagram:e}},"loader"),kt={id:Cr,detector:Ct,loader:Rt},It=kt,Rr="gitGraph",Ft=i(e=>/^\s*gitGraph/.test(e),"detector"),Ot=i(async()=>{let{diagram:e}=await import("./gitGraphDiagram-JPZ3KUXI-P4CDCJ5R.js");return{id:Rr,diagram:e}},"loader"),zt={id:Rr,detector:Ft,loader:Ot},$t=zt,kr="gantt",Vt=i(e=>/^\s*gantt/.test(e),"detector"),Ht=i(async()=>{let{diagram:e}=await import("./ganttDiagram-HLVPPPRE-HJEASYBQ.js");return{id:kr,diagram:e}},"loader"),Pt={id:kr,detector:Vt,loader:Ht},Ut=Pt,Ir="info",Nt=i(e=>/^\s*info/.test(e),"detector"),Gt=i(async()=>{let{diagram:e}=await import("./infoDiagram-RZZSJVI2-POSSOW46.js");return{id:Ir,diagram:e}},"loader"),Bt={id:Ir,detector:Nt,loader:Gt},Fr="pie",qt=i(e=>/^\s*pie/.test(e),"detector"),Yt=i(async()=>{let{diagram:e}=await import("./pieDiagram-X7YZ5ZEZ-3SQQQNGA.js");return{id:Fr,diagram:e}},"loader"),jt={id:Fr,detector:qt,loader:Yt},Or="quadrantChart",Xt=i(e=>/^\s*quadrantChart/.test(e),"detector"),Wt=i(async()=>{let{diagram:e}=await import("./quadrantDiagram-F36EZAVT-NQBHRIYW.js");return{id:Or,diagram:e}},"loader"),Kt={id:Or,detector:Xt,loader:Wt},Qt=Kt,zr="xychart",Zt=i(e=>/^\s*xychart-beta/.test(e),"detector"),Jt=i(async()=>{let{diagram:e}=await import("./xychartDiagram-KECQ2H5Q-JZOSWF5P.js");return{id:zr,diagram:e}},"loader"),ea={id:zr,detector:Zt,loader:Jt},ra=ea,$r="requirement",ta=i(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),aa=i(async()=>{let{diagram:e}=await import("./requirementDiagram-JG2LMPGF-H3PVKFMC.js");return{id:$r,diagram:e}},"loader"),ia={id:$r,detector:ta,loader:aa},oa=ia,Vr="sequence",na=i(e=>/^\s*sequenceDiagram/.test(e),"detector"),sa=i(async()=>{let{diagram:e}=await import("./sequenceDiagram-WK7YDQ3N-YACFAK5N.js");return{id:Vr,diagram:e}},"loader"),da={id:Vr,detector:na,loader:sa},ca=da,Hr="class",la=i((e,r)=>{var t;return((t=r==null?void 0:r.class)==null?void 0:t.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),ma=i(async()=>{let{diagram:e}=await import("./classDiagram-Q73GJZWF-2IBCPTCF.js");return{id:Hr,diagram:e}},"loader"),ua={id:Hr,detector:la,loader:ma},pa=ua,Pr="classDiagram",fa=i((e,r)=>{var t;return/^\s*classDiagram/.test(e)&&((t=r==null?void 0:r.class)==null?void 0:t.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),va=i(async()=>{let{diagram:e}=await import("./classDiagram-v2-C6QPLPW4-YZ7DAWLS.js");return{id:Pr,diagram:e}},"loader"),ga={id:Pr,detector:fa,loader:va},ha=ga,Ur="state",wa=i((e,r)=>{var t;return((t=r==null?void 0:r.state)==null?void 0:t.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),ya=i(async()=>{let{diagram:e}=await import("./stateDiagram-4JV6CC6H-Y5EABW5W.js");return{id:Ur,diagram:e}},"loader"),xa={id:Ur,detector:wa,loader:ya},ba=xa,Nr="stateDiagram",Ea=i((e,r)=>{var t;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((t=r==null?void 0:r.state)==null?void 0:t.defaultRenderer)==="dagre-wrapper")},"detector"),Sa=i(async()=>{let{diagram:e}=await import("./stateDiagram-v2-7KT6RKTD-G32MXPIO.js");return{id:Nr,diagram:e}},"loader"),Da={id:Nr,detector:Ea,loader:Sa},Ta=Da,Gr="journey",La=i(e=>/^\s*journey/.test(e),"detector"),_a=i(async()=>{let{diagram:e}=await import("./journeyDiagram-BLD6N6MZ-R5TUEUIF.js");return{id:Gr,diagram:e}},"loader"),Aa={id:Gr,detector:La,loader:_a},Ma=Aa,Ca=i((e,r,t)=>{v.debug(`rendering svg for syntax error -`);let a=ir(r),o=a.append("g");a.attr("viewBox","0 0 2412 512"),je(a,100,512,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${t}`)},"draw"),Br={draw:Ca},Ra=Br,ka={db:{},renderer:Br,parser:{parse:i(()=>{},"parse")}},Ia=ka,qr="flowchart-elk",Fa=i((e,r={})=>{var t;return/^\s*flowchart-elk/.test(e)||/^\s*flowchart|graph/.test(e)&&((t=r==null?void 0:r.flowchart)==null?void 0:t.defaultRenderer)==="elk"?(r.layout="elk",!0):!1},"detector"),Oa=i(async()=>{let{diagram:e}=await import("./flowDiagram-NWEUNK3L-AVS4VA5D.js");return{id:qr,diagram:e}},"loader"),za={id:qr,detector:Fa,loader:Oa},$a=za,Yr="timeline",Va=i(e=>/^\s*timeline/.test(e),"detector"),Ha=i(async()=>{let{diagram:e}=await import("./timeline-definition-3ZMEY6HS-L3XOSZAD.js");return{id:Yr,diagram:e}},"loader"),Pa={id:Yr,detector:Va,loader:Ha},Ua=Pa,jr="mindmap",Na=i(e=>/^\s*mindmap/.test(e),"detector"),Ga=i(async()=>{let{diagram:e}=await import("./mindmap-definition-OEB2RXX2-GLBBLRPD.js");return{id:jr,diagram:e}},"loader"),Ba={id:jr,detector:Na,loader:Ga},qa=Ba,Xr="sankey",Ya=i(e=>/^\s*sankey-beta/.test(e),"detector"),ja=i(async()=>{let{diagram:e}=await import("./sankeyDiagram-ATFNWWW6-NJIAQZLJ.js");return{id:Xr,diagram:e}},"loader"),Xa={id:Xr,detector:Ya,loader:ja},Wa=Xa,Wr="packet",Ka=i(e=>/^\s*packet-beta/.test(e),"detector"),Qa=i(async()=>{let{diagram:e}=await import("./diagram-AVGMFHF7-MASML6G7.js");return{id:Wr,diagram:e}},"loader"),Za={id:Wr,detector:Ka,loader:Qa},Kr="block",Ja=i(e=>/^\s*block-beta/.test(e),"detector"),ei=i(async()=>{let{diagram:e}=await import("./blockDiagram-TCMKQVZ6-N32CL4AM.js");return{id:Kr,diagram:e}},"loader"),ri={id:Kr,detector:Ja,loader:ei},ti=ri,Qr="architecture",ai=i(e=>/^\s*architecture/.test(e),"detector"),ii=i(async()=>{let{diagram:e}=await import("./architectureDiagram-IFBEXTG3-JASG623T.js");return{id:Qr,diagram:e}},"loader"),oi={id:Qr,detector:ai,loader:ii},ni=oi,Sr=!1,ce=i(()=>{Sr||(Sr=!0,Y("error",Ia,e=>e.toLowerCase().trim()==="error"),Y("---",{db:{clear:i(()=>{},"clear")},styles:{},renderer:{draw:i(()=>{},"draw")},parser:{parse:i(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:i(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),fe(bt,ha,pa,It,Ut,Bt,jt,oa,ca,$a,Mt,Tt,qa,Ua,$t,Ta,ba,Ma,Qt,Wa,Za,ra,ti,ni))},"addDiagrams"),si=i(async()=>{v.debug("Loading registered diagrams");let r=(await Promise.allSettled(Object.entries(ue).map(async([t,{detector:a,loader:o}])=>{if(o)try{Q(t)}catch(n){try{let{diagram:d,id:c}=await o();Y(c,d,a)}catch(d){throw v.error(`Failed to load external diagram with key ${t}. Removing from detectors.`),delete ue[t],d}}}))).filter(t=>t.status==="rejected");if(r.length>0){v.error(`Failed to load ${r.length} external diagrams`);for(let t of r)v.error(t);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),di="graphics-document document";function Jr(e,r){e.attr("role",di),r!==""&&e.attr("aria-roledescription",r)}i(Jr,"setA11yDiagramInfo");function et(e,r,t,a){if(e.insert!==void 0){if(t){let o=`chart-desc-${a}`;e.attr("aria-describedby",o),e.insert("desc",":first-child").attr("id",o).text(t)}if(r){let o=`chart-title-${a}`;e.attr("aria-labelledby",o),e.insert("title",":first-child").attr("id",o).text(r)}}}i(et,"addSVGa11yTitleDescription");var B,Se=(B=class{constructor(r,t,a,o,n){this.type=r,this.text=t,this.db=a,this.parser=o,this.renderer=n}static async fromText(r,t={}){var l,u;let a=V(),o=pe(r,a);r=er(r)+` -`;try{Q(o)}catch(m){let g=He(o);if(!g)throw new Ve(`Diagram ${o} not found.`);let{id:y,diagram:x}=await g();Y(y,x)}let{db:n,parser:d,renderer:c,init:s}=Q(o);return d.parser&&(d.parser.yy=n),(l=n.clear)==null||l.call(n),s==null||s(a),t.title&&((u=n.setDiagramTitle)==null||u.call(n,t.title)),await d.parse(r),new B(o,r,n,d,c)}async render(r,t){await this.renderer.draw(this.text,r,t,this)}getParser(){return this.parser}getType(){return this.type}},i(B,"Diagram"),B),Dr=[],ci=i(()=>{Dr.forEach(e=>{e()}),Dr=[]},"attachFunctions"),li=i(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function rt(e){var o;let r=e.match($e);if(!r)return{text:e,metadata:{}};let t=(o=Ke(r[1],{schema:We}))!=null?o:{};t=typeof t=="object"&&!Array.isArray(t)?t:{};let a={};return t.displayMode&&(a.displayMode=t.displayMode.toString()),t.title&&(a.title=t.title.toString()),t.config&&(a.config=t.config),{text:e.slice(r[0].length),metadata:a}}i(rt,"extractFrontMatter");var mi=i(e=>e.replace(/\r\n?/g,` -`).replace(/<(\w+)([^>]*)>/g,(r,t,a)=>"<"+t+a.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),ui=i(e=>{let{text:r,metadata:t}=rt(e),{displayMode:a,title:o,config:n={}}=t;return a&&(n.gantt||(n.gantt={}),n.gantt.displayMode=a),{title:o,config:n,text:r}},"processFrontmatter"),pi=i(e=>{var a;let r=(a=H.detectInit(e))!=null?a:{},t=H.detectDirective(e,"wrap");return Array.isArray(t)?r.wrap=t.some(({type:o})=>o==="wrap"):(t==null?void 0:t.type)==="wrap"&&(r.wrap=!0),{text:Ze(e),directive:r}},"processDirectives");function Te(e){let r=mi(e),t=ui(r),a=pi(t.text),o=Je(t.config,a.directive);return e=li(a.text),{code:e,title:t.title,config:o}}i(Te,"preprocessDiagram");function tt(e){let r=new TextEncoder().encode(e),t=Array.from(r,a=>String.fromCodePoint(a)).join("");return btoa(t)}i(tt,"toBase64");var fi=5e4,vi="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",gi="sandbox",hi="loose",wi="http://www.w3.org/2000/svg",yi="http://www.w3.org/1999/xlink",xi="http://www.w3.org/1999/xhtml",bi="100%",Ei="100%",Si="border:0;margin:0;",Di="margin:0",Ti="allow-top-navigation-by-user-activation allow-popups",Li='The "iframe" tag is not supported by your browser.',_i=["foreignobject"],Ai=["dominant-baseline"];function Le(e){var t;let r=Te(e);return q(),qe((t=r.config)!=null?t:{}),r}i(Le,"processAndSetConfigs");async function at(e,r){ce();try{let{code:t,config:a}=Le(e);return{diagramType:(await ot(t)).type,config:a}}catch(t){if(r!=null&&r.suppressErrors)return!1;throw t}}i(at,"parse");var Tr=i((e,r,t=[])=>` -.${e} ${r} { ${t.join(" !important; ")} !important; }`,"cssImportantStyles"),Mi=i((e,r=new Map)=>{var a,o;let t="";if(e.themeCSS!==void 0&&(t+=` +import{a as ye}from"./chunk-LZX4GX75.js";import{a as ir}from"./chunk-HPDSMQTX.js";import{a as We,b as Ke}from"./chunk-XNPPQCMN.js";import{a as ar}from"./chunk-EXJ52NKL.js";import"./chunk-5CG6MCMB.js";import{b as Qe}from"./chunk-GDYVCCNI.js";import"./chunk-IEVFQHBT.js";import{a as tr}from"./chunk-DQY2Y6DO.js";import{b as Ze,j as he,l as Je,m as H,n as er,o as rr}from"./chunk-WSSX4ADQ.js";import"./chunk-ZTFC2RI5.js";import{A as Ge,B as ge,C as Be,D as V,E as qe,F as q,I as Ye,O as je,Q as Xe,ba as Y,ca as Q,g as gt,h as i,ha as k,j as v,k as ue,l as $e,n as Ve,o as me,p as pe,q as fe,r as He,s as Pe,u as K,x as ve,y as Ue,z as Ne}from"./chunk-SOPNMMPO.js";import{d as we}from"./chunk-B7P5FXKN.js";import"./chunk-OIZLKBMD.js";import{a as Oe,b as ze,f as vt}from"./chunk-FC2K5MUR.js";var Z="comm",J="rule",ee="decl";var or="@import";var nr="@keyframes";var sr="@layer";var xe=Math.abs,j=String.fromCharCode;function re(e){return e.trim()}function X(e,r,t){return e.replace(r,t)}function dr(e,r,t){return e.indexOf(r,t)}function z(e,r){return e.charCodeAt(r)|0}function F(e,r,t){return e.slice(r,t)}function b(e){return e.length}function cr(e){return e.length}function P(e,r){return r.push(e),e}var te=1,U=1,lr=0,D=0,w=0,G="";function ae(e,r,t,a,o,n,d,c){return{value:e,root:r,parent:t,type:a,props:o,children:n,line:te,column:U,length:d,return:"",siblings:c}}function ur(){return w}function mr(){return w=D>0?z(G,--D):0,U--,w===10&&(U=1,te--),w}function T(){return w=D2||N(w)>3?"":" "}function gr(e,r){for(;--r&&T()&&!(w<48||w>102||w>57&&w<65||w>70&&w<97););return ie(e,W()+(r<6&&I()==32&&T()==32))}function be(e){for(;T();)switch(w){case e:return D;case 34:case 39:e!==34&&e!==39&&be(w);break;case 40:e===41&&be(e);break;case 92:T();break}return D}function hr(e,r){for(;T()&&e+w!==57;)if(e+w===84&&I()===47)break;return"/*"+ie(r,D-1)+"*"+j(e===47?e:T())}function wr(e){for(;!N(I());)T();return ie(e,D)}function br(e){return fr(ne("",null,null,null,[""],e=pr(e),0,[0],e))}function ne(e,r,t,a,o,n,d,c,s){for(var l=0,m=0,u=d,g=0,y=0,x=0,f=1,M=1,L=1,h=0,_="",R=o,A=n,S=a,p=_;M;)switch(x=h,h=T()){case 40:if(x!=108&&z(p,u-1)==58){dr(p+=X(oe(h),"&","&\f"),"&\f",xe(l?c[l-1]:0))!=-1&&(L=-1);break}case 34:case 39:case 91:p+=oe(h);break;case 9:case 10:case 13:case 32:p+=vr(x);break;case 92:p+=gr(W()-1,7);continue;case 47:switch(I()){case 42:case 47:P(ht(hr(T(),W()),r,t,s),s),(N(x||1)==5||N(I()||1)==5)&&b(p)&&F(p,-1,void 0)!==" "&&(p+=" ");break;default:p+="/"}break;case 123*f:c[l++]=b(p)*L;case 125*f:case 59:case 0:switch(h){case 0:case 125:M=0;case 59+m:L==-1&&(p=X(p,/\f/g,"")),y>0&&(b(p)-u||f===0&&x===47)&&P(y>32?xr(p+";",a,t,u-1,s):xr(X(p," ","")+";",a,t,u-2,s),s);break;case 59:p+=";";default:if(P(S=yr(p,r,t,l,m,o,c,_,R=[],A=[],u,n),n),h===123)if(m===0)ne(p,r,S,S,R,n,u,c,A);else switch(g===99&&z(p,3)===110?100:g){case 100:case 108:case 109:case 115:ne(e,S,S,a&&P(yr(e,S,S,0,0,o,c,_,o,R=[],u,A),A),o,A,u,c,a?R:A);break;default:ne(p,S,S,S,[""],A,0,c,A)}}l=m=y=0,f=L=1,_=p="",u=d;break;case 58:u=1+b(p),y=x;default:if(f<1){if(h==123)--f;else if(h==125&&f++==0&&mr()==125)continue}switch(p+=j(h),h*f){case 38:L=m>0?1:(p+="\f",-1);break;case 44:c[l++]=(b(p)-1)*L,L=1;break;case 64:I()===45&&(p+=oe(T())),g=I(),m=u=b(_=p+=wr(W())),h++;break;case 45:x===45&&b(p)==2&&(f=0)}}return n}function yr(e,r,t,a,o,n,d,c,s,l,m,u){for(var g=o-1,y=o===0?n:[""],x=cr(y),f=0,M=0,L=0;f0?y[h]+" "+_:X(_,/&\f/g,y[h])))&&(s[L++]=R);return ae(e,r,t,o===0?J:c,s,l,m,u)}function ht(e,r,t,a){return ae(e,r,t,Z,j(ur()),F(e,2,-2),0,a)}function xr(e,r,t,a,o){return ae(e,r,t,ee,F(e,0,a),F(e,a+1,-1),a,o)}function se(e,r){for(var t="",a=0;a/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),yt=i(async()=>{let{diagram:e}=await import("./c4Diagram-ZCSEYPFN-LHU7TFVG.js");return{id:_r,diagram:e}},"loader"),xt={id:_r,detector:wt,loader:yt},bt=xt,Cr="flowchart",Et=i((e,r)=>{var t,a;return((t=r==null?void 0:r.flowchart)==null?void 0:t.defaultRenderer)==="dagre-wrapper"||((a=r==null?void 0:r.flowchart)==null?void 0:a.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),St=i(async()=>{let{diagram:e}=await import("./flowDiagram-NWEUNK3L-AVS4VA5D.js");return{id:Cr,diagram:e}},"loader"),Dt={id:Cr,detector:Et,loader:St},Tt=Dt,Ar="flowchart-v2",Lt=i((e,r)=>{var t,a,o;return((t=r==null?void 0:r.flowchart)==null?void 0:t.defaultRenderer)==="dagre-d3"?!1:(((a=r==null?void 0:r.flowchart)==null?void 0:a.defaultRenderer)==="elk"&&(r.layout="elk"),/^\s*graph/.test(e)&&((o=r==null?void 0:r.flowchart)==null?void 0:o.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),_t=i(async()=>{let{diagram:e}=await import("./flowDiagram-NWEUNK3L-AVS4VA5D.js");return{id:Ar,diagram:e}},"loader"),Ct={id:Ar,detector:Lt,loader:_t},At=Ct,Mr="er",Mt=i(e=>/^\s*erDiagram/.test(e),"detector"),Rt=i(async()=>{let{diagram:e}=await import("./erDiagram-DKC2X5TE-7IMDOGPV.js");return{id:Mr,diagram:e}},"loader"),kt={id:Mr,detector:Mt,loader:Rt},It=kt,Rr="gitGraph",Ft=i(e=>/^\s*gitGraph/.test(e),"detector"),Ot=i(async()=>{let{diagram:e}=await import("./gitGraphDiagram-JPZ3KUXI-P4CDCJ5R.js");return{id:Rr,diagram:e}},"loader"),zt={id:Rr,detector:Ft,loader:Ot},$t=zt,kr="gantt",Vt=i(e=>/^\s*gantt/.test(e),"detector"),Ht=i(async()=>{let{diagram:e}=await import("./ganttDiagram-HLVPPPRE-HJEASYBQ.js");return{id:kr,diagram:e}},"loader"),Pt={id:kr,detector:Vt,loader:Ht},Ut=Pt,Ir="info",Nt=i(e=>/^\s*info/.test(e),"detector"),Gt=i(async()=>{let{diagram:e}=await import("./infoDiagram-RZZSJVI2-POSSOW46.js");return{id:Ir,diagram:e}},"loader"),Bt={id:Ir,detector:Nt,loader:Gt},Fr="pie",qt=i(e=>/^\s*pie/.test(e),"detector"),Yt=i(async()=>{let{diagram:e}=await import("./pieDiagram-X7YZ5ZEZ-3SQQQNGA.js");return{id:Fr,diagram:e}},"loader"),jt={id:Fr,detector:qt,loader:Yt},Or="quadrantChart",Xt=i(e=>/^\s*quadrantChart/.test(e),"detector"),Wt=i(async()=>{let{diagram:e}=await import("./quadrantDiagram-F36EZAVT-NQBHRIYW.js");return{id:Or,diagram:e}},"loader"),Kt={id:Or,detector:Xt,loader:Wt},Qt=Kt,zr="xychart",Zt=i(e=>/^\s*xychart-beta/.test(e),"detector"),Jt=i(async()=>{let{diagram:e}=await import("./xychartDiagram-KECQ2H5Q-JZOSWF5P.js");return{id:zr,diagram:e}},"loader"),ea={id:zr,detector:Zt,loader:Jt},ra=ea,$r="requirement",ta=i(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),aa=i(async()=>{let{diagram:e}=await import("./requirementDiagram-JG2LMPGF-H3PVKFMC.js");return{id:$r,diagram:e}},"loader"),ia={id:$r,detector:ta,loader:aa},oa=ia,Vr="sequence",na=i(e=>/^\s*sequenceDiagram/.test(e),"detector"),sa=i(async()=>{let{diagram:e}=await import("./sequenceDiagram-WK7YDQ3N-YACFAK5N.js");return{id:Vr,diagram:e}},"loader"),da={id:Vr,detector:na,loader:sa},ca=da,Hr="class",la=i((e,r)=>{var t;return((t=r==null?void 0:r.class)==null?void 0:t.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),ua=i(async()=>{let{diagram:e}=await import("./classDiagram-Q73GJZWF-2IBCPTCF.js");return{id:Hr,diagram:e}},"loader"),ma={id:Hr,detector:la,loader:ua},pa=ma,Pr="classDiagram",fa=i((e,r)=>{var t;return/^\s*classDiagram/.test(e)&&((t=r==null?void 0:r.class)==null?void 0:t.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),va=i(async()=>{let{diagram:e}=await import("./classDiagram-v2-C6QPLPW4-YZ7DAWLS.js");return{id:Pr,diagram:e}},"loader"),ga={id:Pr,detector:fa,loader:va},ha=ga,Ur="state",wa=i((e,r)=>{var t;return((t=r==null?void 0:r.state)==null?void 0:t.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),ya=i(async()=>{let{diagram:e}=await import("./stateDiagram-4JV6CC6H-Y5EABW5W.js");return{id:Ur,diagram:e}},"loader"),xa={id:Ur,detector:wa,loader:ya},ba=xa,Nr="stateDiagram",Ea=i((e,r)=>{var t;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((t=r==null?void 0:r.state)==null?void 0:t.defaultRenderer)==="dagre-wrapper")},"detector"),Sa=i(async()=>{let{diagram:e}=await import("./stateDiagram-v2-7KT6RKTD-G32MXPIO.js");return{id:Nr,diagram:e}},"loader"),Da={id:Nr,detector:Ea,loader:Sa},Ta=Da,Gr="journey",La=i(e=>/^\s*journey/.test(e),"detector"),_a=i(async()=>{let{diagram:e}=await import("./journeyDiagram-BLD6N6MZ-R5TUEUIF.js");return{id:Gr,diagram:e}},"loader"),Ca={id:Gr,detector:La,loader:_a},Aa=Ca,Ma=i((e,r,t)=>{v.debug(`rendering svg for syntax error +`);let a=ir(r),o=a.append("g");a.attr("viewBox","0 0 2412 512"),je(a,100,512,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${t}`)},"draw"),Br={draw:Ma},Ra=Br,ka={db:{},renderer:Br,parser:{parse:i(()=>{},"parse")}},Ia=ka,qr="flowchart-elk",Fa=i((e,r={})=>{var t;return/^\s*flowchart-elk/.test(e)||/^\s*flowchart|graph/.test(e)&&((t=r==null?void 0:r.flowchart)==null?void 0:t.defaultRenderer)==="elk"?(r.layout="elk",!0):!1},"detector"),Oa=i(async()=>{let{diagram:e}=await import("./flowDiagram-NWEUNK3L-AVS4VA5D.js");return{id:qr,diagram:e}},"loader"),za={id:qr,detector:Fa,loader:Oa},$a=za,Yr="timeline",Va=i(e=>/^\s*timeline/.test(e),"detector"),Ha=i(async()=>{let{diagram:e}=await import("./timeline-definition-3ZMEY6HS-L3XOSZAD.js");return{id:Yr,diagram:e}},"loader"),Pa={id:Yr,detector:Va,loader:Ha},Ua=Pa,jr="mindmap",Na=i(e=>/^\s*mindmap/.test(e),"detector"),Ga=i(async()=>{let{diagram:e}=await import("./mindmap-definition-OEB2RXX2-GLBBLRPD.js");return{id:jr,diagram:e}},"loader"),Ba={id:jr,detector:Na,loader:Ga},qa=Ba,Xr="sankey",Ya=i(e=>/^\s*sankey-beta/.test(e),"detector"),ja=i(async()=>{let{diagram:e}=await import("./sankeyDiagram-ATFNWWW6-NJIAQZLJ.js");return{id:Xr,diagram:e}},"loader"),Xa={id:Xr,detector:Ya,loader:ja},Wa=Xa,Wr="packet",Ka=i(e=>/^\s*packet-beta/.test(e),"detector"),Qa=i(async()=>{let{diagram:e}=await import("./diagram-AVGMFHF7-MASML6G7.js");return{id:Wr,diagram:e}},"loader"),Za={id:Wr,detector:Ka,loader:Qa},Kr="block",Ja=i(e=>/^\s*block-beta/.test(e),"detector"),ei=i(async()=>{let{diagram:e}=await import("./blockDiagram-TCMKQVZ6-N32CL4AM.js");return{id:Kr,diagram:e}},"loader"),ri={id:Kr,detector:Ja,loader:ei},ti=ri,Qr="architecture",ai=i(e=>/^\s*architecture/.test(e),"detector"),ii=i(async()=>{let{diagram:e}=await import("./architectureDiagram-IFBEXTG3-JASG623T.js");return{id:Qr,diagram:e}},"loader"),oi={id:Qr,detector:ai,loader:ii},ni=oi,Sr=!1,ce=i(()=>{Sr||(Sr=!0,Y("error",Ia,e=>e.toLowerCase().trim()==="error"),Y("---",{db:{clear:i(()=>{},"clear")},styles:{},renderer:{draw:i(()=>{},"draw")},parser:{parse:i(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:i(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),fe(bt,ha,pa,It,Ut,Bt,jt,oa,ca,$a,At,Tt,qa,Ua,$t,Ta,ba,Aa,Qt,Wa,Za,ra,ti,ni))},"addDiagrams"),si=i(async()=>{v.debug("Loading registered diagrams");let r=(await Promise.allSettled(Object.entries(me).map(async([t,{detector:a,loader:o}])=>{if(o)try{Q(t)}catch(n){try{let{diagram:d,id:c}=await o();Y(c,d,a)}catch(d){throw v.error(`Failed to load external diagram with key ${t}. Removing from detectors.`),delete me[t],d}}}))).filter(t=>t.status==="rejected");if(r.length>0){v.error(`Failed to load ${r.length} external diagrams`);for(let t of r)v.error(t);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),di="graphics-document document";function Jr(e,r){e.attr("role",di),r!==""&&e.attr("aria-roledescription",r)}i(Jr,"setA11yDiagramInfo");function et(e,r,t,a){if(e.insert!==void 0){if(t){let o=`chart-desc-${a}`;e.attr("aria-describedby",o),e.insert("desc",":first-child").attr("id",o).text(t)}if(r){let o=`chart-title-${a}`;e.attr("aria-labelledby",o),e.insert("title",":first-child").attr("id",o).text(r)}}}i(et,"addSVGa11yTitleDescription");var B,Se=(B=class{constructor(r,t,a,o,n){this.type=r,this.text=t,this.db=a,this.parser=o,this.renderer=n}static async fromText(r,t={}){var l,m;let a=V(),o=pe(r,a);r=er(r)+` +`;try{Q(o)}catch(u){let g=He(o);if(!g)throw new Ve(`Diagram ${o} not found.`);let{id:y,diagram:x}=await g();Y(y,x)}let{db:n,parser:d,renderer:c,init:s}=Q(o);return d.parser&&(d.parser.yy=n),(l=n.clear)==null||l.call(n),s==null||s(a),t.title&&((m=n.setDiagramTitle)==null||m.call(n,t.title)),await d.parse(r),new B(o,r,n,d,c)}async render(r,t){await this.renderer.draw(this.text,r,t,this)}getParser(){return this.parser}getType(){return this.type}},i(B,"Diagram"),B),Dr=[],ci=i(()=>{Dr.forEach(e=>{e()}),Dr=[]},"attachFunctions"),li=i(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function rt(e){var o;let r=e.match($e);if(!r)return{text:e,metadata:{}};let t=(o=Ke(r[1],{schema:We}))!=null?o:{};t=typeof t=="object"&&!Array.isArray(t)?t:{};let a={};return t.displayMode&&(a.displayMode=t.displayMode.toString()),t.title&&(a.title=t.title.toString()),t.config&&(a.config=t.config),{text:e.slice(r[0].length),metadata:a}}i(rt,"extractFrontMatter");var ui=i(e=>e.replace(/\r\n?/g,` +`).replace(/<(\w+)([^>]*)>/g,(r,t,a)=>"<"+t+a.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),mi=i(e=>{let{text:r,metadata:t}=rt(e),{displayMode:a,title:o,config:n={}}=t;return a&&(n.gantt||(n.gantt={}),n.gantt.displayMode=a),{title:o,config:n,text:r}},"processFrontmatter"),pi=i(e=>{var a;let r=(a=H.detectInit(e))!=null?a:{},t=H.detectDirective(e,"wrap");return Array.isArray(t)?r.wrap=t.some(({type:o})=>o==="wrap"):(t==null?void 0:t.type)==="wrap"&&(r.wrap=!0),{text:Ze(e),directive:r}},"processDirectives");function Te(e){let r=ui(e),t=mi(r),a=pi(t.text),o=Je(t.config,a.directive);return e=li(a.text),{code:e,title:t.title,config:o}}i(Te,"preprocessDiagram");function tt(e){let r=new TextEncoder().encode(e),t=Array.from(r,a=>String.fromCodePoint(a)).join("");return btoa(t)}i(tt,"toBase64");var fi=5e4,vi="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",gi="sandbox",hi="loose",wi="http://www.w3.org/2000/svg",yi="http://www.w3.org/1999/xlink",xi="http://www.w3.org/1999/xhtml",bi="100%",Ei="100%",Si="border:0;margin:0;",Di="margin:0",Ti="allow-top-navigation-by-user-activation allow-popups",Li='The "iframe" tag is not supported by your browser.',_i=["foreignobject"],Ci=["dominant-baseline"];function Le(e){var t;let r=Te(e);return q(),qe((t=r.config)!=null?t:{}),r}i(Le,"processAndSetConfigs");async function at(e,r){ce();try{let{code:t,config:a}=Le(e);return{diagramType:(await ot(t)).type,config:a}}catch(t){if(r!=null&&r.suppressErrors)return!1;throw t}}i(at,"parse");var Tr=i((e,r,t=[])=>` +.${e} ${r} { ${t.join(" !important; ")} !important; }`,"cssImportantStyles"),Ai=i((e,r=new Map)=>{var a,o;let t="";if(e.themeCSS!==void 0&&(t+=` ${e.themeCSS}`),e.fontFamily!==void 0&&(t+=` :root { --mermaid-font-family: ${e.fontFamily}}`),e.altFontFamily!==void 0&&(t+=` -:root { --mermaid-alt-font-family: ${e.altFontFamily}}`),r instanceof Map){let s=((o=e.htmlLabels)!=null?o:(a=e.flowchart)==null?void 0:a.htmlLabels)?["> *","span"]:["rect","polygon","ellipse","circle","path"];r.forEach(l=>{we(l.styles)||s.forEach(u=>{t+=Tr(l.id,u,l.styles)}),we(l.textStyles)||(t+=Tr(l.id,"tspan",((l==null?void 0:l.textStyles)||[]).map(u=>u.replace("color","fill"))))})}return t},"createCssStyles"),Ci=i((e,r,t,a)=>{let o=Mi(e,t),n=Xe(r,o,e.themeVariables);return se(br(`${a}{${n}}`),Er)},"createUserStyles"),Ri=i((e="",r,t)=>{let a=e;return!t&&!r&&(a=a.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),a=rr(a),a=a.replace(/
/g,"
"),a},"cleanUpSvgCode"),ki=i((e="",r)=>{var o,n;let t=(n=(o=r==null?void 0:r.viewBox)==null?void 0:o.baseVal)!=null&&n.height?r.viewBox.baseVal.height+"px":Ei,a=tt(`${e}`);return``},"putIntoIFrame"),Lr=i((e,r,t,a,o)=>{let n=e.append("div");n.attr("id",t),a&&n.attr("style",a);let d=n.append("svg").attr("id",r).attr("width","100%").attr("xmlns",wi);return o&&d.attr("xmlns:xlink",o),d.append("g"),e},"appendDivSvgG");function De(e,r){return e.append("iframe").attr("id",r).attr("style","width: 100%; height: 100%;").attr("sandbox","")}i(De,"sandboxedIframe");var Ii=i((e,r,t,a)=>{var o,n,d;(o=e.getElementById(r))==null||o.remove(),(n=e.getElementById(t))==null||n.remove(),(d=e.getElementById(a))==null||d.remove()},"removeExistingElements"),Fi=i(async function(e,r,t){var Ae,Me,Ce,Re,ke,Ie,Fe;ce();let a=Le(r);r=a.code;let o=V();v.debug(o),r.length>((Ae=o==null?void 0:o.maxTextSize)!=null?Ae:fi)&&(r=vi);let n="#"+e,d="i"+e,c="#"+d,s="d"+e,l="#"+s,u=i(()=>{let le=k(g?c:l).node();le&&"remove"in le&&le.remove()},"removeTempElements"),m=k("body"),g=o.securityLevel===gi,y=o.securityLevel===hi,x=o.fontFamily;if(t!==void 0){if(t&&(t.innerHTML=""),g){let A=De(k(t),d);m=k(A.nodes()[0].contentDocument.body),m.node().style.margin=0}else m=k(t);Lr(m,e,s,`font-family: ${x}`,yi)}else{if(Ii(document,e,s,d),g){let A=De(k("body"),d);m=k(A.nodes()[0].contentDocument.body),m.node().style.margin=0}else m=k("body");Lr(m,e,s)}let f,C;try{f=await Se.fromText(r,{title:a.title})}catch(A){if(o.suppressErrorRendering)throw u(),A;f=await Se.fromText("error"),C=A}let L=m.select(l).node(),h=f.type,_=L.firstChild,R=_.firstChild,M=(Ce=(Me=f.renderer).getClasses)==null?void 0:Ce.call(Me,r,f),S=Ci(o,h,M,n),p=document.createElement("style");p.innerHTML=S,_.insertBefore(p,R);try{await f.renderer.draw(r,e,ye,f)}catch(A){throw o.suppressErrorRendering?u():Ra.draw(r,e,ye),A}let ut=m.select(`${l} svg`),pt=(ke=(Re=f.db).getAccTitle)==null?void 0:ke.call(Re),ft=(Fe=(Ie=f.db).getAccDescription)==null?void 0:Fe.call(Ie);nt(h,ut,pt,ft),m.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",xi);let O=m.select(l).node().innerHTML;if(v.debug("config.arrowMarkerAbsolute",o.arrowMarkerAbsolute),O=Ri(O,g,Ye(o.arrowMarkerAbsolute)),g){let A=m.select(l+" svg").node();O=ki(O,A)}else y||(O=Zr.default.sanitize(O,{ADD_TAGS:_i,ADD_ATTR:Ai}));if(ci(),C)throw C;return u(),{diagramType:h,svg:O,bindFunctions:f.db.bindFunctions}},"render");function it(e={}){var a;let r=Pe({},e);r!=null&&r.fontFamily&&!((a=r.themeVariables)!=null&&a.fontFamily)&&(r.themeVariables||(r.themeVariables={}),r.themeVariables.fontFamily=r.fontFamily),Ne(r),r!=null&&r.theme&&r.theme in K?r.themeVariables=K[r.theme].getThemeVariables(r.themeVariables):r&&(r.themeVariables=K.default.getThemeVariables(r.themeVariables));let t=typeof r=="object"?Ue(r):ge();me(t.logLevel),ce()}i(it,"initialize");var ot=i((e,r={})=>{let{code:t}=Te(e);return Se.fromText(t,r)},"getDiagramFromText");function nt(e,r,t,a){Jr(r,e),et(r,t,a,r.attr("id"))}i(nt,"addA11yInfo");var $=Object.freeze({render:Fi,parse:at,getDiagramFromText:ot,initialize:it,getConfig:V,setConfig:Be,getSiteConfig:ge,updateSiteConfig:Ge,reset:i(()=>{q()},"reset"),globalReset:i(()=>{q(ve)},"globalReset"),defaultConfig:ve});me(V().logLevel);q(V());var Oi=i((e,r,t)=>{v.warn(e),he(e)?(t&&t(e.str,e.hash),r.push(ze(Oe({},e),{message:e.str,error:e}))):(t&&t(e),e instanceof Error&&r.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),st=i(async function(e={querySelector:".mermaid"}){try{await zi(e)}catch(r){if(he(r)&&v.error(r.str),E.parseError&&E.parseError(r),!e.suppressErrors)throw v.error("Use the suppressErrors option to suppress these errors"),r}},"run"),zi=i(async function({postRenderCallback:e,querySelector:r,nodes:t}={querySelector:".mermaid"}){let a=$.getConfig();v.debug(`${e?"":"No "}Callback function found`);let o;if(t)o=t;else if(r)o=document.querySelectorAll(r);else throw new Error("Nodes and querySelector are both undefined");v.debug(`Found ${o.length} diagrams`),(a==null?void 0:a.startOnLoad)!==void 0&&(v.debug("Start On Load: "+(a==null?void 0:a.startOnLoad)),$.updateSiteConfig({startOnLoad:a==null?void 0:a.startOnLoad}));let n=new H.InitIDGenerator(a.deterministicIds,a.deterministicIDSeed),d,c=[];for(let s of Array.from(o)){if(v.info("Rendering diagram: "+s.id),s.getAttribute("data-processed"))continue;s.setAttribute("data-processed","true");let l=`mermaid-${n.next()}`;d=s.innerHTML,d=tr(H.entityDecode(d)).trim().replace(//gi,"
");let u=H.detectInit(d);u&&v.debug("Detected early reinit: ",u);try{let{svg:m,bindFunctions:g}=await mt(l,d,s);s.innerHTML=m,e&&await e(l),g&&g(s)}catch(m){Oi(m,c,E.parseError)}}if(c.length>0)throw c[0]},"runThrowsErrors"),dt=i(function(e){$.initialize(e)},"initialize"),$i=i(async function(e,r,t){v.warn("mermaid.init is deprecated. Please use run instead."),e&&dt(e);let a={postRenderCallback:t,querySelector:".mermaid"};typeof r=="string"?a.querySelector=r:r&&(r instanceof HTMLElement?a.nodes=[r]:a.nodes=r),await st(a)},"init"),Vi=i(async(e,{lazyLoad:r=!0}={})=>{ce(),fe(...e),r===!1&&await si()},"registerExternalDiagrams"),ct=i(function(){if(E.startOnLoad){let{startOnLoad:e}=$.getConfig();e&&E.run().catch(r=>v.error("Mermaid failed to initialize",r))}},"contentLoaded");typeof document!="undefined"&&window.addEventListener("load",ct,!1);var Hi=i(function(e){E.parseError=e},"setParseErrorHandler"),de=[],Ee=!1,lt=i(async()=>{if(!Ee){for(Ee=!0;de.length>0;){let e=de.shift();if(e)try{await e()}catch(r){v.error("Error executing queue",r)}}Ee=!1}},"executeQueue"),Pi=i(async(e,r)=>new Promise((t,a)=>{let o=i(()=>new Promise((n,d)=>{$.parse(e,r).then(c=>{n(c),t(c)},c=>{var s;v.error("Error parsing",c),(s=E.parseError)==null||s.call(E,c),d(c),a(c)})}),"performCall");de.push(o),lt().catch(a)}),"parse"),mt=i((e,r,t)=>new Promise((a,o)=>{let n=i(()=>new Promise((d,c)=>{$.render(e,r,t).then(s=>{d(s),a(s)},s=>{var l;v.error("Error parsing",s),(l=E.parseError)==null||l.call(E,s),c(s),o(s)})}),"performCall");de.push(n),lt().catch(o)}),"render"),E={startOnLoad:!0,mermaidAPI:$,parse:Pi,render:mt,init:$i,run:st,registerExternalDiagrams:Vi,registerLayoutLoaders:ar,initialize:dt,parseError:void 0,contentLoaded:ct,setParseErrorHandler:Hi,detectType:pe,registerIconPacks:Qe},_e=E;_e.initialize({startOnLoad:!1});function bo(e,{diagram:r,caption:t,download:a}){e.importCSS("main.css");function o(){_e.render("diagram",r).then(({svg:n,bindFunctions:d})=>{n=n.replace(/
/gi,"
");let c=document.createElement("div");c.classList.add("container"),e.root.appendChild(c);let s=document.createElement("figure");if(s.classList.add("figure"),s.innerHTML=n,c.appendChild(s),t){let u=document.createElement("figcaption");u.classList.add("caption"),u.textContent=t,s.appendChild(u)}if(a){let u=document.createElement("button");u.classList.add("download-btn"),u.title="Download",u.innerHTML='',c.appendChild(u),u.addEventListener("click",m=>{let g=URL.createObjectURL(new Blob([n],{type:"image/svg+xml"})),y=document.createElement("a");y.style.display="none",y.href=g,y.download="diagram.svg",c.appendChild(y),y.click(),c.removeChild(y)})}d&&d(e.root),s.querySelector("svg").removeAttribute("height")})}window.innerWidth===0?window.addEventListener("resize",()=>o(),{once:!0}):o()}export{bo as init}; +`},"putIntoIFrame"),Lr=i((e,r,t,a,o)=>{let n=e.append("div");n.attr("id",t),a&&n.attr("style",a);let d=n.append("svg").attr("id",r).attr("width","100%").attr("xmlns",wi);return o&&d.attr("xmlns:xlink",o),d.append("g"),e},"appendDivSvgG");function De(e,r){return e.append("iframe").attr("id",r).attr("style","width: 100%; height: 100%;").attr("sandbox","")}i(De,"sandboxedIframe");var Ii=i((e,r,t,a)=>{var o,n,d;(o=e.getElementById(r))==null||o.remove(),(n=e.getElementById(t))==null||n.remove(),(d=e.getElementById(a))==null||d.remove()},"removeExistingElements"),Fi=i(async function(e,r,t){var Ce,Ae,Me,Re,ke,Ie,Fe;ce();let a=Le(r);r=a.code;let o=V();v.debug(o),r.length>((Ce=o==null?void 0:o.maxTextSize)!=null?Ce:fi)&&(r=vi);let n="#"+e,d="i"+e,c="#"+d,s="d"+e,l="#"+s,m=i(()=>{let le=k(g?c:l).node();le&&"remove"in le&&le.remove()},"removeTempElements"),u=k("body"),g=o.securityLevel===gi,y=o.securityLevel===hi,x=o.fontFamily;if(t!==void 0){if(t&&(t.innerHTML=""),g){let C=De(k(t),d);u=k(C.nodes()[0].contentDocument.body),u.node().style.margin=0}else u=k(t);Lr(u,e,s,`font-family: ${x}`,yi)}else{if(Ii(document,e,s,d),g){let C=De(k("body"),d);u=k(C.nodes()[0].contentDocument.body),u.node().style.margin=0}else u=k("body");Lr(u,e,s)}let f,M;try{f=await Se.fromText(r,{title:a.title})}catch(C){if(o.suppressErrorRendering)throw m(),C;f=await Se.fromText("error"),M=C}let L=u.select(l).node(),h=f.type,_=L.firstChild,R=_.firstChild,A=(Me=(Ae=f.renderer).getClasses)==null?void 0:Me.call(Ae,r,f),S=Mi(o,h,A,n),p=document.createElement("style");p.innerHTML=S,_.insertBefore(p,R);try{await f.renderer.draw(r,e,ye,f)}catch(C){throw o.suppressErrorRendering?m():Ra.draw(r,e,ye),C}let mt=u.select(`${l} svg`),pt=(ke=(Re=f.db).getAccTitle)==null?void 0:ke.call(Re),ft=(Fe=(Ie=f.db).getAccDescription)==null?void 0:Fe.call(Ie);nt(h,mt,pt,ft),u.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",xi);let O=u.select(l).node().innerHTML;if(v.debug("config.arrowMarkerAbsolute",o.arrowMarkerAbsolute),O=Ri(O,g,Ye(o.arrowMarkerAbsolute)),g){let C=u.select(l+" svg").node();O=ki(O,C)}else y||(O=Zr.default.sanitize(O,{ADD_TAGS:_i,ADD_ATTR:Ci}));if(ci(),M)throw M;return m(),{diagramType:h,svg:O,bindFunctions:f.db.bindFunctions}},"render");function it(e={}){var a;let r=Pe({},e);r!=null&&r.fontFamily&&!((a=r.themeVariables)!=null&&a.fontFamily)&&(r.themeVariables||(r.themeVariables={}),r.themeVariables.fontFamily=r.fontFamily),Ne(r),r!=null&&r.theme&&r.theme in K?r.themeVariables=K[r.theme].getThemeVariables(r.themeVariables):r&&(r.themeVariables=K.default.getThemeVariables(r.themeVariables));let t=typeof r=="object"?Ue(r):ge();ue(t.logLevel),ce()}i(it,"initialize");var ot=i((e,r={})=>{let{code:t}=Te(e);return Se.fromText(t,r)},"getDiagramFromText");function nt(e,r,t,a){Jr(r,e),et(r,t,a,r.attr("id"))}i(nt,"addA11yInfo");var $=Object.freeze({render:Fi,parse:at,getDiagramFromText:ot,initialize:it,getConfig:V,setConfig:Be,getSiteConfig:ge,updateSiteConfig:Ge,reset:i(()=>{q()},"reset"),globalReset:i(()=>{q(ve)},"globalReset"),defaultConfig:ve});ue(V().logLevel);q(V());var Oi=i((e,r,t)=>{v.warn(e),he(e)?(t&&t(e.str,e.hash),r.push(ze(Oe({},e),{message:e.str,error:e}))):(t&&t(e),e instanceof Error&&r.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),st=i(async function(e={querySelector:".mermaid"}){try{await zi(e)}catch(r){if(he(r)&&v.error(r.str),E.parseError&&E.parseError(r),!e.suppressErrors)throw v.error("Use the suppressErrors option to suppress these errors"),r}},"run"),zi=i(async function({postRenderCallback:e,querySelector:r,nodes:t}={querySelector:".mermaid"}){let a=$.getConfig();v.debug(`${e?"":"No "}Callback function found`);let o;if(t)o=t;else if(r)o=document.querySelectorAll(r);else throw new Error("Nodes and querySelector are both undefined");v.debug(`Found ${o.length} diagrams`),(a==null?void 0:a.startOnLoad)!==void 0&&(v.debug("Start On Load: "+(a==null?void 0:a.startOnLoad)),$.updateSiteConfig({startOnLoad:a==null?void 0:a.startOnLoad}));let n=new H.InitIDGenerator(a.deterministicIds,a.deterministicIDSeed),d,c=[];for(let s of Array.from(o)){if(v.info("Rendering diagram: "+s.id),s.getAttribute("data-processed"))continue;s.setAttribute("data-processed","true");let l=`mermaid-${n.next()}`;d=s.innerHTML,d=tr(H.entityDecode(d)).trim().replace(//gi,"
");let m=H.detectInit(d);m&&v.debug("Detected early reinit: ",m);try{let{svg:u,bindFunctions:g}=await ut(l,d,s);s.innerHTML=u,e&&await e(l),g&&g(s)}catch(u){Oi(u,c,E.parseError)}}if(c.length>0)throw c[0]},"runThrowsErrors"),dt=i(function(e){$.initialize(e)},"initialize"),$i=i(async function(e,r,t){v.warn("mermaid.init is deprecated. Please use run instead."),e&&dt(e);let a={postRenderCallback:t,querySelector:".mermaid"};typeof r=="string"?a.querySelector=r:r&&(r instanceof HTMLElement?a.nodes=[r]:a.nodes=r),await st(a)},"init"),Vi=i(async(e,{lazyLoad:r=!0}={})=>{ce(),fe(...e),r===!1&&await si()},"registerExternalDiagrams"),ct=i(function(){if(E.startOnLoad){let{startOnLoad:e}=$.getConfig();e&&E.run().catch(r=>v.error("Mermaid failed to initialize",r))}},"contentLoaded");typeof document!="undefined"&&window.addEventListener("load",ct,!1);var Hi=i(function(e){E.parseError=e},"setParseErrorHandler"),de=[],Ee=!1,lt=i(async()=>{if(!Ee){for(Ee=!0;de.length>0;){let e=de.shift();if(e)try{await e()}catch(r){v.error("Error executing queue",r)}}Ee=!1}},"executeQueue"),Pi=i(async(e,r)=>new Promise((t,a)=>{let o=i(()=>new Promise((n,d)=>{$.parse(e,r).then(c=>{n(c),t(c)},c=>{var s;v.error("Error parsing",c),(s=E.parseError)==null||s.call(E,c),d(c),a(c)})}),"performCall");de.push(o),lt().catch(a)}),"parse"),ut=i((e,r,t)=>new Promise((a,o)=>{let n=i(()=>new Promise((d,c)=>{$.render(e,r,t).then(s=>{d(s),a(s)},s=>{var l;v.error("Error parsing",s),(l=E.parseError)==null||l.call(E,s),c(s),o(s)})}),"performCall");de.push(n),lt().catch(o)}),"render"),E={startOnLoad:!0,mermaidAPI:$,parse:Pi,render:ut,init:$i,run:st,registerExternalDiagrams:Vi,registerLayoutLoaders:ar,initialize:dt,parseError:void 0,contentLoaded:ct,setParseErrorHandler:Hi,detectType:pe,registerIconPacks:Qe},_e=E;_e.initialize({startOnLoad:!1});function bo(e,{diagram:r,caption:t,download:a}){e.importCSS("main.css");function o(){_e.render("diagram",r).then(({svg:n,bindFunctions:d})=>{n=n.replace(/
/gi,"
");let c=document.createElement("div");c.classList.add("container"),e.root.appendChild(c);let s=document.createElement("figure");if(s.classList.add("figure"),s.innerHTML=n,s.firstElementChild.style.width=s.firstElementChild.style.maxWidth,s.firstElementChild.style.maxWidth="100%",c.appendChild(s),t){let m=document.createElement("figcaption");m.classList.add("caption"),m.textContent=t,s.appendChild(m)}if(a){let m=document.createElement("button");m.classList.add("download-btn"),m.title="Download",m.innerHTML='',s.appendChild(m),m.addEventListener("click",u=>{let g=URL.createObjectURL(new Blob([n],{type:"image/svg+xml"})),y=document.createElement("a");y.style.display="none",y.href=g,y.download="diagram.svg",c.appendChild(y),y.click(),c.removeChild(y)})}d&&d(e.root),s.querySelector("svg").removeAttribute("height")})}window.innerWidth===0?window.addEventListener("resize",()=>o(),{once:!0}):o()}export{bo as init}; /*! Bundled license information: mermaid/dist/mermaid.core.mjs: