55 lines
119 KiB
JavaScript
55 lines
119 KiB
JavaScript
|
|
import{a as Kt}from"./chunk-LM6QDVU5.mjs";import{a as De,b as gt,d as $,e as M}from"./chunk-5V7UUW6L.mjs";import{c as dt,g as nt}from"./chunk-GOL2OBWC.mjs";import{i as wt,k as $e,o as ht,q}from"./chunk-EFRVIJHI.mjs";import{A as Et,C as we,D as Ne,W as X,Z as jt,i as Se,q as ft,w as kt,y as U,z as Jt}from"./chunk-KXVH62NG.mjs";import{b as z,h as Z}from"./chunk-63GW7ZVL.mjs";import{a as x}from"./chunk-GTKDMUJJ.mjs";var C=x(async(c,t,i)=>{let r,e=t.useHtmlLabels||U(X()?.htmlLabels);i?r=i:r="node default";let a=c.insert("g").attr("class",r).attr("id",t.domId||t.id),h=a.insert("g").attr("class","label").attr("style",q(t.labelStyle)),s;t.label===void 0?s="":s=typeof t.label=="string"?t.label:t.label[0];let l=await nt(h,kt(ht(s),X()),{useHtmlLabels:e,width:t.width||X().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img}),o=l.getBBox(),n=(t?.padding??0)/2;if(e){let p=l.children[0],f=Z(l),m=p.getElementsByTagName("img");if(m){let d=s.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...m].map(g=>new Promise(y=>{function u(){if(g.style.display="flex",g.style.flexDirection="column",d){let b=X().fontSize?X().fontSize:window.getComputedStyle(document.body).fontSize,S=5,[k=Se.fontSize]=$e(b),w=k*S+"px";g.style.minWidth=w,g.style.maxWidth=w}else g.style.width="100%";y(g)}x(u,"setupImage"),setTimeout(()=>{g.complete&&u()}),g.addEventListener("error",u),g.addEventListener("load",u)})))}o=p.getBoundingClientRect(),f.attr("width",o.width),f.attr("height",o.height)}return e?h.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):h.attr("transform","translate(0, "+-o.height/2+")"),t.centerLabel&&h.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),h.insert("rect",":first-child"),{shapeSvg:a,bbox:o,halfPadding:n,label:h}},"labelHelper"),At=x(async(c,t,i)=>{let r=i.useHtmlLabels||U(X()?.flowchart?.htmlLabels),e=c.insert("g").attr("class","label").attr("style",i.labelStyle||""),a=await nt(e,kt(ht(t),X()),{useHtmlLabels:r,width:i.width||X()?.flowchart?.wrappingWidth,style:i.labelStyle,addSvgBackground:!!i.icon||!!i.img}),h=a.getBBox(),s=i.padding/2;if(U(X()?.flowchart?.htmlLabels)){let l=a.children[0],o=Z(a);h=l.getBoundingClientRect(),o.attr("width",h.width),o.attr("height",h.height)}return r?e.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"):e.attr("transform","translate(0, "+-h.height/2+")"),i.centerLabel&&e.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"),e.insert("rect",":first-child"),{shapeSvg:c,bbox:h,halfPadding:s,label:e}},"insertLabel"),D=x((c,t)=>{let i=t.node().getBBox();c.width=i.width,c.height=i.height},"updateNodeBounds");var P=x((c,t)=>(c.look==="handDrawn"?"rough-node":"node")+" "+c.cssClasses+" "+(t||""),"getNodeClasses");function H(c){let t=c.map((i,r)=>`${r===0?"M":"L"}${i.x},${i.y}`);return t.push("Z"),t.join(" ")}x(H,"createPathFromPoints");function lt(c,t,i,r,e,a){let h=[],l=i-c,o=r-t,n=l/a,p=2*Math.PI/n,f=t+o/2;for(let m=0;m<=50;m++){let d=m/50,g=c+d*l,y=f+e*Math.sin(p*(g-c));h.push({x:g,y})}return h}x(lt,"generateFullSineWavePoints");function Nt(c,t,i,r,e,a){let h=[],s=e*Math.PI/180,n=(a*Math.PI/180-s)/(r-1);for(let p=0;p<r;p++){let f=s+p*n,m=c+i*Math.cos(f),d=t+i*Math.sin(f);h.push({x:-m,y:-d})}return h}x(Nt,"generateCirclePoints");function te(c,t,i){if(c&&c.length){let[r,e]=t,a=Math.PI/180*i,h=Math.cos(a),s=Math.sin(a);for(let l of c){let[o,n]=l;l[0]=(o-r)*h-(n-e)*s+r,l[1]=(o-r)*s+(n-e)*h+e}}}x(te,"t");function sr(c,t){return c[0]===t[0]&&c[1]===t[1]}x(sr,"e");function rr(c,t,i,r=1){let e=i,a=Math.max(t,.1),h=c[0]&&c[0][0]&&typeof c[0][0]=="number"?[c]:c,s=[0,0];if(e)for(let o of h)te(o,s,e);let l=(function(o,n,p){let f=[];for(let b of o){let S=[...b];sr(S[0],S[S.length-1])||S.push([S[0][0],S[0][1]]),S.length>2&&f.push(S)}let m=[];n=Math.max(n,.1);let d=[];for(let b of f)for(let S=0;S<b.length-1;S++){let k=b[S],w=b[S+1];if(k[1]!==w[1]){let B=Math.min(k[1],w[1]);d.push({ymin:B,ymax:Math.max(k[1],w[1]),x:B===k[1]?k[0]:w[0],islope:(w[0]-k[0])/(w[1]-k[1])})}}if(d.sort(((b,S)=>b.ymin<S.ymin?-1:b.ymin>S.ymin
|
||
|
|
`),r));let h='<span class="'+(c.isNode?"nodeLabel":"edgeLabel")+'" '+(c.labelStyle?'style="'+c.labelStyle+'"':"")+">"+e+"</span>";return i.html(kt(h,r)),pr(i,c.labelStyle),i.style("display","inline-block"),i.style("padding-right","1px"),i.style("white-space","nowrap"),i.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}x(mr,"addHtmlLabel");var fr=x(async(c,t,i,r)=>{let e=c||"";if(typeof e=="object"&&(e=e[0]),U(X().flowchart.htmlLabels)){e=e.replace(/\\n|\n/g,"<br />"),z.info("vertexText"+e);let a={isNode:r,label:ht(e).replace(/fa[blrs]?:fa-[\w-]+/g,s=>`<i class='${s.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await mr(a)}else{let a=document.createElementNS("http://www.w3.org/2000/svg","text");a.setAttribute("style",t.replace("color:","fill:"));let h=[];typeof e=="string"?h=e.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(e)?h=e:h=[];for(let s of h){let l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),i?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=s.trim(),a.appendChild(l)}return a}},"createLabel"),Rt=fr;var st=x((c,t,i,r,e)=>["M",c+e,t,"H",c+i-e,"A",e,e,0,0,1,c+i,t+e,"V",t+r-e,"A",e,e,0,0,1,c+i-e,t+r,"H",c+e,"A",e,e,0,0,1,c,t+r-e,"V",t+e,"A",e,e,0,0,1,c+e,t,"Z"].join(" "),"createRoundedRectPathD");var He=x(async(c,t)=>{z.info("Creating subgraph rect for ",t.id,t);let i=X(),{themeVariables:r,handDrawnSeed:e}=i,{clusterBkg:a,clusterBorder:h}=r,{labelStyles:s,nodeStyles:l,borderStyles:o,backgroundStyles:n}=$(t),p=c.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=U(i.flowchart.htmlLabels),m=p.insert("g").attr("class","cluster-label "),d=await nt(m,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0}),g=d.getBBox();if(U(i.flowchart.htmlLabels)){let T=d.children[0],R=Z(d);g=T.getBoundingClientRect(),R.attr("width",g.width),R.attr("height",g.height)}let y=t.width<=g.width+t.padding?g.width+t.padding:t.width;t.width<=g.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;let u=t.height,b=t.x-y/2,S=t.y-u/2;z.trace("Data ",t,JSON.stringify(t));let k;if(t.look==="handDrawn"){let T=v.svg(p),R=M(t,{roughness:.7,fill:a,stroke:h,fillWeight:3,seed:e}),E=T.path(st(b,S,y,u,0),R);k=p.insert(()=>(z.debug("Rough node insert CXC",E),E),":first-child"),k.select("path:nth-child(2)").attr("style",o.join(";")),k.select("path").attr("style",n.join(";").replace("fill","stroke"))}else k=p.insert("rect",":first-child"),k.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",S).attr("width",y).attr("height",u);let{subGraphTitleTopMargin:w}=Kt(i);if(m.attr("transform",`translate(${t.x-g.width/2}, ${t.y-t.height/2+w})`),s){let T=m.select("span");T&&T.attr("style",s)}let B=k.node().getBBox();return t.offsetX=0,t.width=B.width,t.height=B.height,t.offsetY=g.height-t.padding/2,t.intersect=function(T){return yt(t,T)},{cluster:p,labelBBox:g}},"rect"),dr=x((c,t)=>{let i=c.insert("g").attr("class","note-cluster").attr("id",t.id),r=i.insert("rect",":first-child"),e=0*t.padding,a=e/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+e).attr("height",t.height+e).attr("fill","none");let h=r.node().getBBox();return t.width=h.width,t.height=h.height,t.intersect=function(s){return yt(t,s)},{cluster:i,labelBBox:{width:0,height:0}}},"noteGroup"),gr=x(async(c,t)=>{let i=X(),{themeVariables:r,handDrawnSeed:e}=i,{altBackground:a,compositeBackground:h,compositeTitleBackground:s,nodeBorder:l}=r,o=c.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),n=o.insert("g",":first-child"),p=o.insert("g").attr("class","cluster-label"),f=o.append("rect"),m=p.node().appendChild(await Rt(t.label,t.labelStyle,void 0,!0)),d=m.getBBox();if(U(i.flowchart.htmlLabels)){let E=m.children[0],L=Z(m);d=E.getBoundingClientRect(),L.attr("width",d.width),L.attr("height",d.height)}let g=0*t.padding,y=g/2,u=(t.widt
|
||
|
|
M ${e.x},${e.y} L ${h.x},${h.y}`}x(vr,"createLine");function Qe(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i,t.label="";let e=c.insert("g").attr("class",P(t)).attr("id",t.domId??t.id),a=Math.max(30,t?.width??0),{cssStyles:h}=t,s=v.svg(e),l=M(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let o=s.circle(0,0,a*2,l),n=vr(a),p=s.path(n,l),f=e.insert(()=>o,":first-child");return f.insert(()=>p),h&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",h),r&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",r),D(t,f),t.intersect=function(m){return z.info("crossedCircle intersect",t,{radius:a,point:m}),N.circle(t,a,m)},e}x(Qe,"crossedCircle");function xt(c,t,i,r=100,e=0,a=180){let h=[],s=e*Math.PI/180,n=(a*Math.PI/180-s)/(r-1);for(let p=0;p<r;p++){let f=s+p*n,m=c+i*Math.cos(f),d=t+i*Math.sin(f);h.push({x:-m,y:-d})}return h}x(xt,"generateCirclePoints");async function Je(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,label:h}=await C(c,t,P(t)),s=a.width+(t.padding??0),l=a.height+(t.padding??0),o=Math.max(5,l*.1),{cssStyles:n}=t,p=[...xt(s/2,-l/2,o,30,-90,0),{x:-s/2-o,y:o},...xt(s/2+o*2,-o,o,20,-180,-270),...xt(s/2+o*2,o,o,20,-90,-180),{x:-s/2-o,y:-l/2},...xt(s/2,l/2,o,20,0,90)],f=[{x:s/2,y:-l/2-o},{x:-s/2,y:-l/2-o},...xt(s/2,-l/2,o,20,-90,0),{x:-s/2-o,y:-o},...xt(s/2+s*.1,-o,o,20,-180,-270),...xt(s/2+s*.1,o,o,20,-90,-180),{x:-s/2-o,y:l/2},...xt(s/2,l/2,o,20,0,90),{x:-s/2,y:l/2+o},{x:s/2,y:l/2+o}],m=v.svg(e),d=M(t,{fill:"none"});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let y=H(p).replace("Z",""),u=m.path(y,d),b=H(f),S=m.path(b,{...d}),k=e.insert("g",":first-child");return k.insert(()=>S,":first-child").attr("stroke-opacity",0),k.insert(()=>u,":first-child"),k.attr("class","text"),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),r&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",r),k.attr("transform",`translate(${o}, 0)`),h.attr("transform",`translate(${-s/2+o-(a.x-(a.left??0))},${-l/2+(t.padding??0)/2-(a.y-(a.top??0))})`),D(t,k),t.intersect=function(w){return N.polygon(t,f,w)},e}x(Je,"curlyBraceLeft");function bt(c,t,i,r=100,e=0,a=180){let h=[],s=e*Math.PI/180,n=(a*Math.PI/180-s)/(r-1);for(let p=0;p<r;p++){let f=s+p*n,m=c+i*Math.cos(f),d=t+i*Math.sin(f);h.push({x:m,y:d})}return h}x(bt,"generateCirclePoints");async function Ke(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,label:h}=await C(c,t,P(t)),s=a.width+(t.padding??0),l=a.height+(t.padding??0),o=Math.max(5,l*.1),{cssStyles:n}=t,p=[...bt(s/2,-l/2,o,20,-90,0),{x:s/2+o,y:-o},...bt(s/2+o*2,-o,o,20,-180,-270),...bt(s/2+o*2,o,o,20,-90,-180),{x:s/2+o,y:l/2},...bt(s/2,l/2,o,20,0,90)],f=[{x:-s/2,y:-l/2-o},{x:s/2,y:-l/2-o},...bt(s/2,-l/2,o,20,-90,0),{x:s/2+o,y:-o},...bt(s/2+o*2,-o,o,20,-180,-270),...bt(s/2+o*2,o,o,20,-90,-180),{x:s/2+o,y:l/2},...bt(s/2,l/2,o,20,0,90),{x:s/2,y:l/2+o},{x:-s/2,y:l/2+o}],m=v.svg(e),d=M(t,{fill:"none"});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let y=H(p).replace("Z",""),u=m.path(y,d),b=H(f),S=m.path(b,{...d}),k=e.insert("g",":first-child");return k.insert(()=>S,":first-child").attr("stroke-opacity",0),k.insert(()=>u,":first-child"),k.attr("class","text"),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),r&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",r),k.attr("transform",`translate(${-o}, 0)`),h.attr("transform",`translate(${-s/2+(t.padding??0)/2-(a.x-(a.left??0))},${-l/2+(t.padding??0)/2-(a.y-(a.top??0))})`),D(t,k),t.intersect=function(w){return N.polygon(t,f,w)},e}x(Ke,"curlyBraceRight");function K(c,t,i,r=100,e=0,a=180){let h=[],s=e*Math.PI/180,n=(a*Math.PI/180-s)/(r-1);for(let p=0;p<r;p++){let f=s+p*n,m=c+i*Math.cos(f),d=t+i*Math.sin(f);h.push({x:-m,y:-d})}return h}x(K,"generateCirclePoints");async function ts(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,label:h}=await C(c,t,P(t)),s=a.width+(t.padding??0),l=a.height+(t.padding??0),o=Math.max(5,l*.1),{cssStyles:n}=t,p=[...K(s/2,-l/2,o,30,-90,0),{x:-s/2-o,y:o},...K(s/2+o*2,-o,o,20,-
|
||
|
|
a${e},${a} 0,0,1 0,${-r}
|
||
|
|
l${i},0
|
||
|
|
a${e},${a} 0,0,1 0,${r}
|
||
|
|
M${i},${-r}
|
||
|
|
a${e},${a} 0,0,0 0,${r}
|
||
|
|
l${-i},0`,"createCylinderPathD"),Er=x((c,t,i,r,e,a)=>[`M${c},${t}`,`M${c+i},${t}`,`a${e},${a} 0,0,0 0,${-r}`,`l${-i},0`,`a${e},${a} 0,0,0 0,${r}`,`l${i},0`].join(" "),"createOuterCylinderPathD"),jr=x((c,t,i,r,e,a)=>[`M${c+i/2},${-r/2}`,`a${e},${a} 0,0,0 0,${r}`].join(" "),"createInnerCylinderPathD");async function Ws(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,label:h,halfPadding:s}=await C(c,t,P(t)),l=t.look==="neo"?s*2:s,o=a.height+l,n=o/2,p=n/(2.5+o/50),f=a.width+p+l,{cssStyles:m}=t,d;if(t.look==="handDrawn"){let g=v.svg(e),y=Er(0,0,f,o,p,n),u=jr(0,0,f,o,p,n),b=g.path(y,M(t,{})),S=g.path(u,M(t,{fill:"none"}));d=e.insert(()=>S,":first-child"),d=e.insert(()=>b,":first-child"),d.attr("class","basic label-container"),m&&d.attr("style",m)}else{let g=Gr(0,0,f,o,p,n);d=e.insert("path",":first-child").attr("d",g).attr("class","basic label-container").attr("style",q(m)).attr("style",r),d.attr("class","basic label-container"),m&&d.selectAll("path").attr("style",m),r&&d.selectAll("path").attr("style",r)}return d.attr("label-offset-x",p),d.attr("transform",`translate(${-f/2}, ${o/2} )`),h.attr("transform",`translate(${-(a.width/2)-p-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),D(t,d),t.intersect=function(g){let y=N.rect(t,g),u=y.y-(t.y??0);if(n!=0&&(Math.abs(u)<(t.height??0)/2||Math.abs(u)==(t.height??0)/2&&Math.abs(y.x-(t.x??0))>(t.width??0)/2-p)){let b=p*p*(1-u*u/(n*n));b!=0&&(b=Math.sqrt(Math.abs(b))),b=p-b,g.x-(t.x??0)>0&&(b=-b),y.x+=b}return y},e}x(Ws,"tiltedCylinder");async function Is(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a}=await C(c,t,P(t)),h=a.width+t.padding,s=a.height+t.padding,l=[{x:-3*s/6,y:0},{x:h+3*s/6,y:0},{x:h,y:-s},{x:0,y:-s}],o,{cssStyles:n}=t;if(t.look==="handDrawn"){let p=v.svg(e),f=M(t,{}),m=H(l),d=p.path(m,f);o=e.insert(()=>d,":first-child").attr("transform",`translate(${-h/2}, ${s/2})`),n&&o.attr("style",n)}else o=rt(e,h,s,l);return r&&o.attr("style",r),t.width=h,t.height=s,D(t,o),t.intersect=function(p){return N.polygon(t,l,p)},e}x(Is,"trapezoid");async function Fs(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a}=await C(c,t,P(t)),h=60,s=20,l=Math.max(h,a.width+(t.padding??0)*2,t?.width??0),o=Math.max(s,a.height+(t.padding??0)*2,t?.height??0),{cssStyles:n}=t,p=v.svg(e),f=M(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");let m=[{x:-l/2*.8,y:-o/2},{x:l/2*.8,y:-o/2},{x:l/2,y:-o/2*.6},{x:l/2,y:o/2},{x:-l/2,y:o/2},{x:-l/2,y:-o/2*.6}],d=H(m),g=p.path(d,f),y=e.insert(()=>g,":first-child");return y.attr("class","basic label-container"),n&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",n),r&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",r),D(t,y),t.intersect=function(u){return N.polygon(t,m,u)},e}x(Fs,"trapezoidalPentagon");async function _s(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,label:h}=await C(c,t,P(t)),s=U(X().flowchart?.htmlLabels),l=a.width+(t.padding??0),o=l+a.height,n=l+a.height,p=[{x:0,y:0},{x:n,y:0},{x:n/2,y:-o}],{cssStyles:f}=t,m=v.svg(e),d=M(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let g=H(p),y=m.path(g,d),u=e.insert(()=>y,":first-child").attr("transform",`translate(${-o/2}, ${o/2})`);return f&&t.look!=="handDrawn"&&u.selectChildren("path").attr("style",f),r&&t.look!=="handDrawn"&&u.selectChildren("path").attr("style",r),t.width=l,t.height=o,D(t,u),h.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${o/2-(a.height+(t.padding??0)/(s?2:1)-(a.y-(a.top??0)))})`),t.intersect=function(b){return z.info("Triangle intersect",t,p,b),N.polygon(t,p,b)},e}x(_s,"triangle");async function zs(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,label:h}=await C(c,t,P(t)),s=Math.max(a.width+(t.padding??0)*2,t?.width??0),l=Math.max(a.height+(t.padding??0)*2,t?.height??0),o=l/8,n=l+o,{cssStyles:p}=t,m=70-s,d=m>0?m/2:0,g=v.svg(e),y=M(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let u=[{x:-s/2-d,y:n/2},...lt(-s/2-d,n/2,s/2+d,n/2,o,.8),{x:s/2+
|
||
|
|
M${n-o},${p} L${n+s},${p}
|
||
|
|
M${n},${p-o} L${n},${p+l}`;t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let u=m.path(y,d),b=e.insert(()=>u,":first-child");return b.attr("transform",`translate(${o/2}, ${o/2})`),b.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",f),r&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",r),h.attr("transform",`translate(${-(a.width/2)+o/2-(a.x-(a.left??0))}, ${-(a.height/2)+o/2-(a.y-(a.top??0))})`),D(t,b),t.intersect=function(S){return N.polygon(t,g,S)},e}x(Xs,"windowPane");async function ye(c,t){let i=t;if(i.alias&&(t.label=i.alias),t.look==="handDrawn"){let{themeVariables:Y}=ft(),{background:J}=Y,tt={...t,id:t.id+"-background",look:"default",cssStyles:["stroke: none",`fill: ${J}`]};await ye(c,tt)}let r=ft();t.useHtmlLabels=r.htmlLabels;let e=r.er?.diagramPadding??10,a=r.er?.entityPadding??6,{cssStyles:h}=t,{labelStyles:s,nodeStyles:l}=$(t);if(i.attributes.length===0&&t.label){let Y={rx:0,ry:0,labelPaddingX:e,labelPaddingY:e*1.5,classes:""};wt(t.label,r)+Y.labelPaddingX*2<r.er.minEntityWidth&&(t.width=r.er.minEntityWidth);let J=await Dt(c,t,Y);if(!U(r.htmlLabels)){let tt=J.select("text"),at=tt.node()?.getBBox();tt.attr("transform",`translate(${-at.width/2}, 0)`)}return J}r.htmlLabels||(e*=1.25,a*=1.25);let o=P(t);o||(o="node default");let n=c.insert("g").attr("class",o).attr("id",t.domId||t.id),p=await Gt(n,t.label??"",r,0,0,["name"],s);p.height+=a;let f=0,m=[],d=[],g=0,y=0,u=0,b=0,S=!0,k=!0;for(let Y of i.attributes){let J=await Gt(n,Y.type,r,0,f,["attribute-type"],s);g=Math.max(g,J.width+e);let tt=await Gt(n,Y.name,r,0,f,["attribute-name"],s);y=Math.max(y,tt.width+e);let at=await Gt(n,Y.keys.join(),r,0,f,["attribute-keys"],s);u=Math.max(u,at.width+e);let St=await Gt(n,Y.comment,r,0,f,["attribute-comment"],s);b=Math.max(b,St.width+e);let mt=Math.max(J.height,tt.height,at.height,St.height)+a;d.push({yOffset:f,rowHeight:mt}),f+=mt}let w=4;u<=e&&(S=!1,u=0,w--),b<=e&&(k=!1,b=0,w--);let B=n.node().getBBox();if(p.width+e*2-(g+y+u+b)>0){let Y=p.width+e*2-(g+y+u+b);g+=Y/w,y+=Y/w,u>0&&(u+=Y/w),b>0&&(b+=Y/w)}let T=g+y+u+b,R=v.svg(n),E=M(t,{});t.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");let L=0;d.length>0&&(L=d.reduce((Y,J)=>Y+(J?.rowHeight??0),0));let O=Math.max(B.width+e*2,t?.width||0,T),V=Math.max((L??0)+p.height,t?.height||0),G=-O/2,j=-V/2;n.selectAll("g:not(:first-child)").each((Y,J,tt)=>{let at=Z(tt[J]),St=at.attr("transform"),mt=0,be=0;if(St){let Qt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(St);Qt&&(mt=parseFloat(Qt[1]),be=parseFloat(Qt[2]),at.attr("class").includes("attribute-name")?mt+=g:at.attr("class").includes("attribute-keys")?mt+=g+y:at.attr("class").includes("attribute-comment")&&(mt+=g+y+u))}at.attr("transform",`translate(${G+e/2+mt}, ${be+j+p.height+a/2})`)}),n.select(".name").attr("transform","translate("+-p.width/2+", "+(j+a/2)+")");let W=R.rectangle(G,j,O,V,E),A=n.insert(()=>W,":first-child").attr("style",h.join("")),{themeVariables:I}=ft(),{rowEven:F,rowOdd:Q,nodeBorder:it}=I;m.push(0);for(let[Y,J]of d.entries()){let at=(Y+1)%2===0&&J.yOffset!==0,St=R.rectangle(G,p.height+j+J?.yOffset,O,J?.rowHeight,{...E,fill:at?F:Q,stroke:it});n.insert(()=>St,"g.label").attr("style",h.join("")).attr("class",`row-rect-${at?"even":"odd"}`)}let ct=R.line(G,p.height+j,O+G,p.height+j,E);n.insert(()=>ct).attr("class","divider"),ct=R.line(g+G,p.height+j,g+G,V+j,E),n.insert(()=>ct).attr("class","divider"),S&&(ct=R.line(g+y+G,p.height+j,g+y+G,V+j,E),n.insert(()=>ct).attr("class","divider")),k&&(ct=R.line(g+y+u+G,p.height+j,g+y+u+G,V+j,E),n.insert(()=>ct).attr("class","divider"));for(let Y of m)ct=R.line(G,p.height+j+Y,O+G,p.height+j+Y,E),n.insert(()=>ct).attr("class","divider");if(D(t,A),l&&t.look!=="handDrawn"){let J=l.split(";")?.filter(tt=>tt.includes("stroke"))?.map(tt=>`${tt}`).join("; ");n.selectAll("path").attr("style",J??""),n.selectAll(".row-rect-even path").attr("style",l)}return t.intersect=function(Y){return N.rect(t,Y)},n}x(ye,"erBox");async function Gt(c,t,i,r=0,e=0,a=[],h=""){let s=c.insert("g").attr("class",`label ${a.join("
|
||
|
|
a${n},${n} 1 0,0 ${d*.25},${-1*g*.1}
|
||
|
|
a${n},${n} 1 0,0 ${d*.25},0
|
||
|
|
a${n},${n} 1 0,0 ${d*.25},0
|
||
|
|
a${n},${n} 1 0,0 ${d*.25},${g*.1}
|
||
|
|
|
||
|
|
a${n},${n} 1 0,0 ${d*.15},${g*.33}
|
||
|
|
a${n*.8},${n*.8} 1 0,0 0,${g*.34}
|
||
|
|
a${n},${n} 1 0,0 ${-1*d*.15},${g*.33}
|
||
|
|
|
||
|
|
a${n},${n} 1 0,0 ${-1*d*.25},${g*.15}
|
||
|
|
a${n},${n} 1 0,0 ${-1*d*.25},0
|
||
|
|
a${n},${n} 1 0,0 ${-1*d*.25},0
|
||
|
|
a${n},${n} 1 0,0 ${-1*d*.25},${-1*g*.15}
|
||
|
|
|
||
|
|
a${n},${n} 1 0,0 ${-1*d*.1},${-1*g*.33}
|
||
|
|
a${n*.8},${n*.8} 1 0,0 0,${-1*g*.34}
|
||
|
|
a${n},${n} 1 0,0 ${d*.1},${-1*g*.33}
|
||
|
|
H0 V0 Z`;if(t.look==="handDrawn"){let b=v.svg(e),S=M(t,{}),k=b.path(u,S);y=e.insert(()=>k,":first-child"),y.attr("class","basic label-container").attr("style",q(p))}else y=e.insert("path",":first-child").attr("class","basic label-container").attr("style",r).attr("d",u);return y.attr("transform",`translate(${-d/2}, ${-g/2})`),D(t,y),t.calcIntersect=function(b,S){return N.rect(b,S)},t.intersect=function(b){return z.info("Bang intersect",t,b),N.rect(t,b)},e}x(Js,"bang");async function Ks(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,halfPadding:h,label:s}=await C(c,t,P(t)),l=a.width+2*h,o=a.height+2*h,n=.15*l,p=.25*l,f=.35*l,m=.2*l,{cssStyles:d}=t,g,y=`M0 0
|
||
|
|
a${n},${n} 0 0,1 ${l*.25},${-1*l*.1}
|
||
|
|
a${f},${f} 1 0,1 ${l*.4},${-1*l*.1}
|
||
|
|
a${p},${p} 1 0,1 ${l*.35},${l*.2}
|
||
|
|
|
||
|
|
a${n},${n} 1 0,1 ${l*.15},${o*.35}
|
||
|
|
a${m},${m} 1 0,1 ${-1*l*.15},${o*.65}
|
||
|
|
|
||
|
|
a${p},${n} 1 0,1 ${-1*l*.25},${l*.15}
|
||
|
|
a${f},${f} 1 0,1 ${-1*l*.5},0
|
||
|
|
a${n},${n} 1 0,1 ${-1*l*.25},${-1*l*.15}
|
||
|
|
|
||
|
|
a${n},${n} 1 0,1 ${-1*l*.1},${-1*o*.35}
|
||
|
|
a${m},${m} 1 0,1 ${l*.1},${-1*o*.65}
|
||
|
|
H0 V0 Z`;if(t.look==="handDrawn"){let u=v.svg(e),b=M(t,{}),S=u.path(y,b);g=e.insert(()=>S,":first-child"),g.attr("class","basic label-container").attr("style",q(d))}else g=e.insert("path",":first-child").attr("class","basic label-container").attr("style",r).attr("d",y);return s.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`),g.attr("transform",`translate(${-l/2}, ${-o/2})`),D(t,g),t.calcIntersect=function(u,b){return N.rect(u,b)},t.intersect=function(u){return z.info("Cloud intersect",t,u),N.rect(t,u)},e}x(Ks,"cloud");async function tr(c,t){let{labelStyles:i,nodeStyles:r}=$(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,halfPadding:h,label:s}=await C(c,t,P(t)),l=a.width+8*h,o=a.height+2*h,n=5,p=`
|
||
|
|
M${-l/2} ${o/2-n}
|
||
|
|
v${-o+2*n}
|
||
|
|
q0,-${n} ${n},-${n}
|
||
|
|
h${l-2*n}
|
||
|
|
q${n},0 ${n},${n}
|
||
|
|
v${o-2*n}
|
||
|
|
q0,${n} -${n},${n}
|
||
|
|
h${-l+2*n}
|
||
|
|
q-${n},0 -${n},-${n}
|
||
|
|
Z
|
||
|
|
`,f=e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("style",r).attr("d",p);return e.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",o/2).attr("x2",l/2).attr("y2",o/2),s.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`),e.append(()=>s.node()),D(t,f),t.calcIntersect=function(m,d){return N.rect(m,d)},t.intersect=function(m){return N.rect(t,m)},e}x(tr,"defaultMindmapNode");async function er(c,t){let i={padding:t.padding??0};return Xt(c,t,i)}x(er,"mindmapCircle");var Or=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Rs},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Bs},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Gs},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Os},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:ss},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:Xt},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:Js},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:Ks},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Ms},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:cs},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:bs},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:xs},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Is},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:us},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:as},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Vs},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Ze},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Cs},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:As},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:js},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:ns},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:hs},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],hand
|