import{f as o}from"./chunk-S3KIL6JF.js";import{t as f}from"./chunk-3FYGGAQT.js";import{b as h}from"./chunk-BG5BKATX.js";import{a as s}from"./chunk-YUSHYV7C.js";var T=s(({flowchart:a})=>{let t=a?.subGraphTitleMargin?.top??0,i=a?.subGraphTitleMargin?.bottom??0,r=t+i;return{subGraphTitleTopMargin:t,subGraphTitleBottomMargin:i,subGraphTitleTotalMargin:r}},"getSubGraphTitleMargins"),l=new Map;async function g(a,t,i){let r,e;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");let p=t.shape?o[t.shape]:void 0;if(!p)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let c;i.config.securityLevel==="sandbox"?c="_top":t.linkTarget&&(c=t.linkTarget||"_blank"),r=a.insert("svg:a").attr("xlink:href",t.link).attr("target",c??null),e=await p(r,t,i)}else e=await p(a,t,i),r=e;return r.attr("data-look",f(t.look)),t.tooltip&&e.attr("title",t.tooltip),l.set(t.id,r),t.haveCallback&&r.attr("class",r.attr("class")+" clickable"),r}s(g,"insertNode");var k=s((a,t)=>{l.set(t.id,a)},"setNodeElem"),v=s(()=>{l.clear()},"clear"),w=s(a=>{let t=l.get(a.id);h.trace("Transforming node",a.diff,a,"translate("+(a.x-a.width/2-5)+", "+a.width/2+")");let i=8,r=a.diff||0;return a.clusterNode?t.attr("transform","translate("+(a.x+r-a.width/2)+", "+(a.y-a.height/2-i)+")"):t.attr("transform","translate("+a.x+", "+a.y+")"),r},"positionNode");export{T as a,g as b,k as c,v as d,w as e};
