ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
2 lines • 109 kB
JavaScript
const v=require("./chunk-Y2CYZVJY-DPaYLFFP.cjs"),X=require("./src-C9EhKhbk.cjs"),Y=require("./chunk-WYO6CB5R-u4mJNOcO.cjs"),U=require("./chunk-ICXQ74PX-BbT9JaEW.cjs"),kt=require("./chunk-HOUHSVGY-BGB3dOvI.cjs"),ct=require("./chunk-Q4XR5HBZ-aBnPq509.cjs"),At=require("./chunk-OGEWGWER-DX8sW1dT.cjs"),$=require("./chunk-C7G6YPKG-CKEeW9TM.cjs"),H=require("./rough.esm-BfSi6CZE.cjs");var W=v.__name(async(u,t,g)=>{let h;const l=t.useHtmlLabels||Y.evaluate(Y.getConfig2()?.htmlLabels);g?h=g:h="node default";const r=u.insert("g").attr("class",h).attr("id",t.domId||t.id),f=r.insert("g").attr("class","label").attr("style",U.handleUndefinedAttr(t.labelStyle));let i;t.label===void 0?i="":i=typeof t.label=="string"?t.label:t.label[0];const n=!!t.icon||!!t.img,a=t.labelType==="markdown",e=await ct.createText(f,Y.sanitizeText(U.decodeEntities(i),Y.getConfig2()),{useHtmlLabels:l,width:t.width||Y.getConfig2().flowchart?.wrappingWidth,classes:a?"markdown-node-label":"",style:t.labelStyle,addSvgBackground:n,markdown:a},Y.getConfig2());let s=e.getBBox();const o=(t?.padding??0)/2;if(l){const c=e.children[0],y=X.select_default(e);await At.configureLabelImages(c,i),s=c.getBoundingClientRect(),y.attr("width",s.width),y.attr("height",s.height)}return l?f.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"):f.attr("transform","translate(0, "+-s.height/2+")"),t.centerLabel&&f.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),f.insert("rect",":first-child"),{shapeSvg:r,bbox:s,halfPadding:o,label:f}},"labelHelper"),Nt=v.__name(async(u,t,g)=>{const h=g.useHtmlLabels??Y.getEffectiveHtmlLabels(Y.getConfig2()),l=u.insert("g").attr("class","label").attr("style",g.labelStyle||""),r=await ct.createText(l,Y.sanitizeText(U.decodeEntities(t),Y.getConfig2()),{useHtmlLabels:h,width:g.width||Y.getConfig2()?.flowchart?.wrappingWidth,style:g.labelStyle,addSvgBackground:!!g.icon||!!g.img});let f=r.getBBox();const i=g.padding/2;if(Y.getEffectiveHtmlLabels(Y.getConfig2())){const n=r.children[0],a=X.select_default(r);f=n.getBoundingClientRect(),a.attr("width",f.width),a.attr("height",f.height)}return h?l.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):l.attr("transform","translate(0, "+-f.height/2+")"),g.centerLabel&&l.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:u,bbox:f,halfPadding:i,label:l}},"insertLabel"),I=v.__name((u,t)=>{const g=t.node().getBBox();u.width=g.width,u.height=g.height},"updateNodeBounds"),E=v.__name((u,t)=>(u.look==="handDrawn"?"rough-node":"node")+" "+u.cssClasses+" "+(t||""),"getNodeClasses");function q(u){const t=u.map((g,h)=>`${h===0?"M":"L"}${g.x},${g.y}`);return t.push("Z"),t.join(" ")}v.__name(q,"createPathFromPoints");function gt(u,t,g,h,l,r){const f=[],n=g-u,a=h-t,e=n/r,s=2*Math.PI/e,o=t+a/2;for(let c=0;c<=50;c++){const y=u+c/50*n,d=o+l*Math.sin(s*(y-u));f.push({x:y,y:d})}return f}v.__name(gt,"generateFullSineWavePoints");function St(u,t,g,h,l,r){const f=[],i=l*Math.PI/180,n=(r*Math.PI/180-i)/(h-1);for(let a=0;a<h;a++){const e=i+a*n,s=u+g*Math.cos(e),o=t+g*Math.sin(e);f.push({x:-s,y:-o})}return f}v.__name(St,"generateCirclePoints");function Bt(u){const t=Array.from(u.childNodes).filter(n=>n.tagName==="path"),g=document.createElementNS("http://www.w3.org/2000/svg","path"),h=t.map(n=>n.getAttribute("d")).filter(n=>n!==null).join(" ");g.setAttribute("d",h);const l=t.find(n=>n.getAttribute("fill")!=="none"),r=t.find(n=>n.getAttribute("stroke")!=="none"),f=v.__name((n,a)=>n?.getAttribute(a)??void 0,"getAttr");if(l){const n={fill:f(l,"fill"),"fill-opacity":f(l,"fill-opacity")??"1"};Object.entries(n).forEach(([a,e])=>{e&&g.setAttribute(a,e)})}if(r){const n={stroke:f(r,"stroke"),"stroke-width":f(r,"stroke-width")??"1","stroke-opacity":f(r,"stroke-opacity")??"1"};Object.entries(n).forEach(([a,e])=>{e&&g.setAttribute(a,e)})}const i=document.createElementNS("http://www.w3.org/2000/svg","g");return i.appendChild(g),i}v.__name(Bt,"mergePaths");var dt=v.__name((u,t)=>{var g=u.x,h=u.y,l=t.x-g,r=t.y-h,f=u.width/2,i=u.height/2,n,a;return Math.abs(r)*f>Math.abs(l)*i?(r<0&&(i=-i),n=r===0?0:i*l/r,a=i):(l<0&&(f=-f),n=f,a=l===0?0:f*r/l),{x:g+n,y:h+a}},"intersectRect"),$t=v.__name(async(u,t,g,h=!1,l=!1)=>{let r=t||"";typeof r=="object"&&(r=r[0]);const f=Y.getConfig2(),i=Y.getEffectiveHtmlLabels(f);return await ct.createText(u,r,{style:g,isTitle:h,useHtmlLabels:i,markdown:!1,isNode:l,width:Number.POSITIVE_INFINITY},f)},"createLabel"),ft=v.__name((u,t,g,h,l)=>["M",u+l,t,"H",u+g-l,"A",l,l,0,0,1,u+g,t+l,"V",t+h-l,"A",l,l,0,0,1,u+g-l,t+h,"H",u+l,"A",l,l,0,0,1,u,t+h-l,"V",t+l,"A",l,l,0,0,1,u+l,t,"Z"].join(" "),"createRoundedRectPathD"),ps=v.__name(async(u,t)=>{const g=Y.getConfig2(),{themeVariables:h,handDrawnSeed:l}=g,{clusterBkg:r,clusterBorder:f}=h,i=f,{labelStyles:n,nodeStyles:a,borderStyles:e,backgroundStyles:s}=$.styles2String(t),o=u.insert("g").attr("class","cluster swimlane "+(t.cssClasses||"")).attr("id",t.id).attr("data-id",t.id).attr("data-et","cluster").attr("data-look",t.look),c=Y.evaluate(g.flowchart.htmlLabels),y=t.direction==="LR",d=o.insert("g").attr("class","cluster-label swimlane-label"),m=await ct.createText(d,t.label,{style:t.labelStyle,useHtmlLabels:c,isNode:!0,width:t.width});let p=m.getBBox();if(c){const M=m.children[0],B=X.select_default(m);p=M.getBoundingClientRect(),B.attr("width",p.width),B.attr("height",p.height)}const w=t.padding??0,b=t.width<=p.width+w?p.width+w:t.width;t.width<=p.width+w?t.diff=(b-t.width)/2-w:t.diff=-w;const S=t.height,x=t.y-S/2,N=t.y+S/2,k=t.x-b/2,_=t.swimlaneContentTop!==void 0?t.swimlaneContentTop:x+S/3,D=y?4:0,R=p.height+2*D;let L,T;if(y){const M=Math.max(R,p.height+2*D),B=k+M,P=Math.max(0,b-M);if(t.look==="handDrawn"){const G=H.at.svg(o),V=$.userNodeOverrides(t,{roughness:.7,fill:r,stroke:i,fillWeight:3,seed:l}),z=$.userNodeOverrides(t,{roughness:.7,fill:"none",stroke:i,seed:l}),at=G.rectangle(k,x,M,S,V);L=o.insert(()=>at,":first-child");const tt=G.rectangle(B,x,P,S,z);T=o.insert(()=>tt,":first-child"),L.select("path:nth-child(2)").attr("style",e.join(";")),L.select("path").attr("style",s.join(";").replace("fill","stroke"))}else L=o.insert("rect",":first-child"),T=o.insert("rect",":first-child"),L.attr("class","swimlane-title").attr("style",a).attr("x",k).attr("y",x).attr("width",M).attr("height",S).attr("fill",r).attr("stroke",i),T.attr("class","swimlane-body").attr("style",a).attr("x",B).attr("y",x).attr("width",P).attr("height",S).attr("fill","none").attr("stroke",i);const O=k+M/2,C=t.y;d.attr("transform",`translate(${O}, ${C}) rotate(-90) translate(${-p.width/2}, ${-p.height/2})`)}else{const M=Math.max(0,_-x),B=Math.min(R,M),P=x+B,O=Math.max(0,N-P),C=t.x-b/2;if(t.look==="handDrawn"){const z=H.at.svg(o),at=$.userNodeOverrides(t,{roughness:.7,fill:r,stroke:i,fillWeight:3,seed:l}),tt=$.userNodeOverrides(t,{roughness:.7,fill:"none",stroke:i,seed:l}),it=z.rectangle(C,x,b,B,at);L=o.insert(()=>it,":first-child");const K=z.rectangle(C,P,b,O,tt);T=o.insert(()=>K,":first-child"),L.select("path:nth-child(2)").attr("style",e.join(";")),L.select("path").attr("style",s.join(";").replace("fill","stroke"))}else L=o.insert("rect",":first-child"),T=o.insert("rect",":first-child"),L.attr("class","swimlane-title").attr("style",a).attr("x",C).attr("y",x).attr("width",b).attr("height",B).attr("fill",r).attr("stroke",i),T.attr("class","swimlane-body").attr("style",a).attr("x",C).attr("y",P).attr("width",b).attr("height",O).attr("fill","none").attr("stroke",i);const G=t.x-p.width/2,V=x+(B-p.height)/2;d.attr("transform",`translate(${G}, ${V})`)}if(X.log.trace("Swimlane data ",t,JSON.stringify(t)),n){const M=d.select("span");M&&M.attr("style",n)}return t.offsetX=0,t.width=b,t.height=S,t.offsetY=p.height-w/2,t.intersect=function(M){return dt(t,M)},{cluster:o,labelBBox:p}},"swimlane"),Ot=v.__name(async(u,t)=>{X.log.info("Creating subgraph rect for ",t.id,t);const g=Y.getConfig2(),{themeVariables:h,handDrawnSeed:l}=g,{clusterBkg:r,clusterBorder:f}=h,{labelStyles:i,nodeStyles:n,borderStyles:a,backgroundStyles:e}=$.styles2String(t),s=u.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),o=Y.getEffectiveHtmlLabels(g),c=s.insert("g").attr("class","cluster-label ");let y;t.labelType==="markdown"?y=await ct.createText(c,t.label,{style:t.labelStyle,useHtmlLabels:o,isNode:!0,width:t.width}):y=await $t(c,t.label,t.labelStyle||"",!1,!0);let d=y.getBBox();if(Y.getEffectiveHtmlLabels(g)){const k=y.children[0],_=X.select_default(y);d=k.getBoundingClientRect(),_.attr("width",d.width),_.attr("height",d.height)}const m=t.width<=d.width+t.padding?d.width+t.padding:t.width;t.width<=d.width+t.padding?t.diff=(m-t.width)/2-t.padding:t.diff=-t.padding;const p=t.height,w=t.x-m/2,b=t.y-p/2;X.log.trace("Data ",t,JSON.stringify(t));let S;if(t.look==="handDrawn"){const k=H.at.svg(s),_=$.userNodeOverrides(t,{roughness:.7,fill:r,stroke:f,fillWeight:3,seed:l}),D=k.path(ft(w,b,m,p,0),_);S=s.insert(()=>(X.log.debug("Rough node insert CXC",D),D),":first-child"),S.select("path:nth-child(2)").attr("style",a.join(";")),S.select("path").attr("style",e.join(";").replace("fill","stroke"))}else S=s.insert("rect",":first-child"),S.attr("style",n).attr("rx",t.rx).attr("ry",t.ry).attr("x",w).attr("y",b).attr("width",m).attr("height",p);const{subGraphTitleTopMargin:x}=At.getSubGraphTitleMargins(g);if(c.attr("transform",`translate(${t.x-d.width/2}, ${t.y-t.height/2+x})`),i){const k=c.select("span");k&&k.attr("style",i)}const N=S.node().getBBox();return t.offsetX=0,t.width=N.width,t.height=N.height,t.offsetY=d.height-t.padding/2,t.intersect=function(k){return dt(t,k)},{cluster:s,labelBBox:d}},"rect"),ms={rect:Ot,squareRect:Ot,roundedWithTitle:v.__name(async(u,t)=>{const g=Y.getConfig2(),{themeVariables:h,handDrawnSeed:l}=g,{altBackground:r,compositeBackground:f,compositeTitleBackground:i,nodeBorder:n}=h,a=u.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-id",t.id).attr("data-look",t.look),e=a.insert("g",":first-child"),s=a.insert("g").attr("class","cluster-label");let o=a.append("rect");const c=await $t(s,t.label,t.labelStyle,void 0,!0);let y=c.getBBox();if(Y.getEffectiveHtmlLabels(g)){const _=c.children[0],D=X.select_default(c);y=_.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}const d=0*t.padding,m=d/2,p=(t.width<=y.width+t.padding?y.width+t.padding:t.width)+d;t.width<=y.width+t.padding?t.diff=(p-t.width)/2-t.padding:t.diff=-t.padding;const w=t.height+d,b=t.height+d-y.height-6,S=t.x-p/2,x=t.y-w/2;t.width=p;const N=t.y-t.height/2-m+y.height+2;let k;if(t.look==="handDrawn"){const _=t.cssClasses.includes("statediagram-cluster-alt"),D=H.at.svg(a),R=t.rx||t.ry?D.path(ft(S,x,p,w,10),{roughness:.7,fill:i,fillStyle:"solid",stroke:n,seed:l}):D.rectangle(S,x,p,w,{seed:l});k=a.insert(()=>R,":first-child");const L=D.rectangle(S,N,p,b,{fill:_?r:f,fillStyle:_?"hachure":"solid",stroke:n,seed:l});k=a.insert(()=>R,":first-child"),o=a.insert(()=>L)}else k=e.insert("rect",":first-child"),k.attr("class","outer").attr("x",S).attr("y",x).attr("width",p).attr("height",w).attr("data-look",t.look),o.attr("class","inner").attr("x",S).attr("y",N).attr("width",p).attr("height",b);return s.attr("transform",`translate(${t.x-y.width/2}, ${x+1-(Y.getEffectiveHtmlLabels(g)?0:3)})`),t.height=k.node().getBBox().height,t.offsetX=0,t.offsetY=y.height-t.padding/2,t.labelBBox=y,t.intersect=function(_){return dt(t,_)},{cluster:a,labelBBox:y}},"roundedWithTitle"),noteGroup:v.__name((u,t)=>{const g=u.insert("g").attr("class","note-cluster").attr("id",t.domId),h=g.insert("rect",":first-child"),l=0*t.padding,r=l/2;h.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-r).attr("y",t.y-t.height/2-r).attr("width",t.width+l).attr("height",t.height+l).attr("fill","none");const f=h.node().getBBox();return t.width=f.width,t.height=f.height,t.intersect=function(i){return dt(t,i)},{cluster:g,labelBBox:{width:0,height:0}}},"noteGroup"),divider:v.__name((u,t)=>{const{themeVariables:g,handDrawnSeed:h}=Y.getConfig2(),{nodeBorder:l}=g,r=u.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-look",t.look),f=r.insert("g",":first-child"),i=0*t.padding,n=t.width+i;t.diff=-t.padding;const a=t.height+i,e=t.x-n/2,s=t.y-a/2;t.width=n;let o;if(t.look==="handDrawn"){const c=H.at.svg(r).rectangle(e,s,n,a,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:l,seed:h});o=r.insert(()=>c,":first-child")}else{o=f.insert("rect",":first-child");let c="outer";t.look,c="divider",o.attr("class",c).attr("x",e).attr("y",s).attr("width",n).attr("height",a).attr("data-look",t.look)}return t.height=o.node().getBBox().height,t.offsetX=0,t.offsetY=0,t.intersect=function(c){return dt(t,c)},{cluster:r,labelBBox:{}}},"divider"),kanbanSection:v.__name(async(u,t)=>{X.log.info("Creating subgraph rect for ",t.id,t);const g=Y.getConfig2(),{themeVariables:h,handDrawnSeed:l}=g,{clusterBkg:r,clusterBorder:f}=h,{labelStyles:i,nodeStyles:n,borderStyles:a,backgroundStyles:e}=$.styles2String(t),s=u.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),o=Y.getEffectiveHtmlLabels(g),c=s.insert("g").attr("class","cluster-label "),y=await ct.createText(c,t.label,{style:t.labelStyle,useHtmlLabels:o,isNode:!0,width:t.width});let d=y.getBBox();if(Y.getEffectiveHtmlLabels(g)){const k=y.children[0],_=X.select_default(y);d=k.getBoundingClientRect(),_.attr("width",d.width),_.attr("height",d.height)}const m=t.width<=d.width+t.padding?d.width+t.padding:t.width;t.width<=d.width+t.padding?t.diff=(m-t.width)/2-t.padding:t.diff=-t.padding;const p=t.height,w=t.x-m/2,b=t.y-p/2;X.log.trace("Data ",t,JSON.stringify(t));let S;if(t.look==="handDrawn"){const k=H.at.svg(s),_=$.userNodeOverrides(t,{roughness:.7,fill:r,stroke:f,fillWeight:4,seed:l}),D=k.path(ft(w,b,m,p,t.rx),_);S=s.insert(()=>(X.log.debug("Rough node insert CXC",D),D),":first-child"),S.select("path:nth-child(2)").attr("style",a.join(";")),S.select("path").attr("style",e.join(";").replace("fill","stroke"))}else S=s.insert("rect",":first-child"),S.attr("style",n).attr("rx",t.rx).attr("ry",t.ry).attr("x",w).attr("y",b).attr("width",m).attr("height",p);const{subGraphTitleTopMargin:x}=At.getSubGraphTitleMargins(g);if(c.attr("transform",`translate(${t.x-d.width/2}, ${t.y-t.height/2+x})`),i){const k=c.select("span");k&&k.attr("style",i)}const N=S.node().getBBox();return t.offsetX=0,t.width=N.width,t.height=N.height,t.offsetY=d.height-t.padding/2,t.intersect=function(k){return dt(t,k)},{cluster:s,labelBBox:d}},"kanbanSection"),swimlane:ps},zt=new Map,ws=v.__name(async(u,t)=>{const g=await ms[t.shape||"rect"](u,t);return zt.set(t.id,g),g},"insertCluster"),bs=v.__name(()=>{zt=new Map},"clear");function Ut(u,t){return u.intersect(t)}v.__name(Ut,"intersectNode");var xs=Ut;function Zt(u,t,g,h){var l=u.x,r=u.y,f=l-h.x,i=r-h.y,n=Math.sqrt(t*t*i*i+g*g*f*f),a=Math.abs(t*g*f/n);h.x<l&&(a=-a);var e=Math.abs(t*g*i/n);return h.y<r&&(e=-e),{x:l+a,y:r+e}}v.__name(Zt,"intersectEllipse");var Jt=Zt;function Qt(u,t,g){return Jt(u,t,t,g)}v.__name(Qt,"intersectCircle");var Ss=Qt;function Kt(u,t,g,h){{const l=t.y-u.y,r=u.x-t.x,f=t.x*u.y-u.x*t.y,i=l*g.x+r*g.y+f,n=l*h.x+r*h.y+f,a=1e-6;if(i!==0&&n!==0&&Mt(i,n))return;const e=h.y-g.y,s=g.x-h.x,o=h.x*g.y-g.x*h.y,c=e*u.x+s*u.y+o,y=e*t.x+s*t.y+o;if(Math.abs(c)<a&&Math.abs(y)<a&&Mt(c,y))return;const d=l*s-e*r;if(d===0)return;const m=Math.abs(d/2);let p=r*o-s*f;const w=p<0?(p-m)/d:(p+m)/d;return p=e*f-l*o,{x:w,y:p<0?(p-m)/d:(p+m)/d}}}v.__name(Kt,"intersectLine");function Mt(u,t){return u*t>0}v.__name(Mt,"sameSign");var $s=Kt;function te(u,t,g){let h=u.x,l=u.y,r=[],f=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(e){f=Math.min(f,e.x),i=Math.min(i,e.y)}):(f=Math.min(f,t.x),i=Math.min(i,t.y));let n=h-u.width/2-f,a=l-u.height/2-i;for(let e=0;e<t.length;e++){let s=t[e],o=t[e<t.length-1?e+1:0],c=$s(u,g,{x:n+s.x,y:a+s.y},{x:n+o.x,y:a+o.y});c&&r.push(c)}return r.length?(r.length>1&&r.sort(function(e,s){let o=e.x-g.x,c=e.y-g.y,y=Math.sqrt(o*o+c*c),d=s.x-g.x,m=s.y-g.y,p=Math.sqrt(d*d+m*m);return y<p?-1:y===p?0:1}),r[0]):u}v.__name(te,"intersectPolygon");var A={node:xs,circle:Ss,ellipse:Jt,polygon:te,rect:dt};function ee(u,t){const{labelStyles:g}=$.styles2String(t);t.labelStyle=g;const h=E(t);let l=h;h||(l="anchor");const r=u.insert("g").attr("class",l).attr("id",t.domId||t.id),f=1,{cssStyles:i}=t,n=H.at.svg(r),a=$.userNodeOverrides(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(a.roughness=0);const e=n.circle(0,0,f*2,a),s=r.insert(()=>e,":first-child");return s.attr("class","anchor").attr("style",U.handleUndefinedAttr(i)),I(t,s),t.intersect=function(o){return X.log.info("Circle intersect",t,f,o),A.circle(t,f,o)},r}v.__name(ee,"anchor");function Ct(u,t,g,h,l,r,f){const n=(u+g)/2,a=(t+h)/2,e=Math.atan2(h-t,g-u),s=(g-u)/2,o=(h-t)/2,c=s/l,y=o/r,d=Math.sqrt(c**2+y**2);if(d>1)throw new Error("The given radii are too small to create an arc between the points.");const m=Math.sqrt(1-d**2),p=n+m*r*Math.sin(e)*(f?-1:1),w=a-m*l*Math.cos(e)*(f?-1:1),b=Math.atan2((t-w)/r,(u-p)/l);let S=Math.atan2((h-w)/r,(g-p)/l)-b;f&&S<0&&(S+=2*Math.PI),!f&&S>0&&(S-=2*Math.PI);const x=[];for(let N=0;N<20;N++){const k=b+N/19*S,_=p+l*Math.cos(k),D=w+r*Math.sin(k);x.push({x:_,y:D})}return x}v.__name(Ct,"generateArcPoints");function se(u,t,g){const[h,l]=[t,g].sort((r,f)=>f-r);return l*(1-Math.sqrt(1-(u/h/2)**2))}v.__name(se,"calculateArcSagitta");async function ae(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=t.padding??0,r=t.look==="neo"?16:l,f=t.look==="neo"?12:l,i=v.__name(_=>_+f,"calcTotalHeight"),n=v.__name(_=>{const D=_/2;return[D/(2.5+_/50),D]},"calcEllipseRadius"),{shapeSvg:a,bbox:e}=await W(u,t,E(t)),s=i(t?.height?t?.height:e.height),[o,c]=n(s),y=se(s,o,c),d=(t?.width?t?.width:e.width)+r*2+y-y,m=s,{cssStyles:p}=t,w=[{x:d/2,y:-m/2},{x:-d/2,y:-m/2},...Ct(-d/2,-m/2,-d/2,m/2,o,c,!1),{x:d/2,y:m/2},...Ct(d/2,m/2,d/2,-m/2,o,c,!0)],b=H.at.svg(a),S=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const x=q(w),N=b.path(x,S),k=a.insert(()=>N,":first-child");return k.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",p),h&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",h),k.attr("transform",`translate(${o/2}, 0)`),I(t,k),t.intersect=function(_){return A.polygon(t,w,_)},a}v.__name(ae,"bowTieRect");function ot(u,t,g,h){return u.insert("polygon",":first-child").attr("points",h.map(function(l){return l.x+","+l.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+g/2+")")}v.__name(ot,"insertPolygonShape");var vt=12;async function ie(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=t.padding??0,r=t.look==="neo"?28:l,f=t.look==="neo"?24:l,{shapeSvg:i,bbox:n}=await W(u,t,E(t)),a=(t?.width??n.width)+(t.look==="neo"?r*2:r+vt),e=(t?.height??n.height)+(t.look==="neo"?f*2:f),s=0,o=a,c=-e,y=0,d=[{x:s+vt,y:c},{x:o,y:c},{x:o,y},{x:s,y},{x:s,y:c+vt},{x:s+vt,y:c}];let m;const{cssStyles:p}=t;if(t.look==="handDrawn"){const w=H.at.svg(i),b=$.userNodeOverrides(t,{}),S=q(d),x=w.path(S,b);m=i.insert(()=>x,":first-child").attr("transform",`translate(${-a/2}, ${e/2})`),p&&m.attr("style",p)}else m=ot(i,a,e,d);return h&&m.attr("style",h),I(t,m),t.intersect=function(w){return A.polygon(t,d,w)},i}v.__name(ie,"card");function re(u,t){const{nodeStyles:g}=$.styles2String(t);t.label="";const h=u.insert("g").attr("class",E(t)).attr("id",t.domId??t.id),{cssStyles:l}=t,r=Math.max(28,t.width??0),f=[{x:0,y:r/2},{x:r/2,y:0},{x:0,y:-r/2},{x:-r/2,y:0}],i=H.at.svg(h),n=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(n.roughness=0,n.fillStyle="solid");const a=q(f),e=i.path(a,n),s=h.insert(()=>e,":first-child");return l&&t.look!=="handDrawn"&&s.selectAll("path").attr("style",l),g&&t.look!=="handDrawn"&&s.selectAll("path").attr("style",g),t.width=28,t.height=28,t.intersect=function(o){return A.polygon(t,f,o)},h}v.__name(re,"choice");async function Rt(u,t,g){const{labelStyles:h,nodeStyles:l}=$.styles2String(t);t.labelStyle=h;const{shapeSvg:r,bbox:f,halfPadding:i}=await W(u,t,E(t)),n=16,a=g?.padding??i,e=t.look==="neo"?f.width/2+n*2:f.width/2+a;let s;const{cssStyles:o}=t;if(t.look==="handDrawn"){const c=H.at.svg(r),y=$.userNodeOverrides(t,{}),d=c.circle(0,0,e*2,y);s=r.insert(()=>d,":first-child"),s.attr("class","basic label-container").attr("style",U.handleUndefinedAttr(o))}else s=r.insert("circle",":first-child").attr("class","basic label-container").attr("style",l).attr("r",e).attr("cx",0).attr("cy",0);return I(t,s),t.calcIntersect=function(c,y){const d=c.width/2;return A.circle(c,d,y)},t.intersect=function(c){return X.log.info("Circle intersect",t,e,c),A.circle(t,e,c)},r}v.__name(Rt,"circle");function le(u){const t=Math.cos(Math.PI/4),g=Math.sin(Math.PI/4),h=u*2,l={x:h/2*t,y:h/2*g},r={x:-(h/2)*t,y:h/2*g},f={x:-(h/2)*t,y:-(h/2)*g},i={x:h/2*t,y:-(h/2)*g};return`M ${r.x},${r.y} L ${i.x},${i.y}
M ${l.x},${l.y} L ${f.x},${f.y}`}v.__name(le,"createLine");function ne(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g,t.label="";const l=u.insert("g").attr("class",E(t)).attr("id",t.domId??t.id),r=Math.max(30,t?.width??0),{cssStyles:f}=t,i=H.at.svg(l),n=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(n.roughness=0,n.fillStyle="solid");const a=i.circle(0,0,r*2,n),e=le(r),s=i.path(e,n),o=l.insert(()=>a,":first-child");return o.insert(()=>s),o.attr("class","outer-path"),f&&t.look!=="handDrawn"&&o.selectAll("path").attr("style",f),h&&t.look!=="handDrawn"&&o.selectAll("path").attr("style",h),I(t,o),t.intersect=function(c){return X.log.info("crossedCircle intersect",t,{radius:r,point:c}),A.circle(t,r,c)},l}v.__name(ne,"crossedCircle");function lt(u,t,g,h=100,l=0,r=180){const f=[],i=l*Math.PI/180,n=(r*Math.PI/180-i)/(h-1);for(let a=0;a<h;a++){const e=i+a*n,s=u+g*Math.cos(e),o=t+g*Math.sin(e);f.push({x:-s,y:-o})}return f}v.__name(lt,"generateCirclePoints");async function ce(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const{shapeSvg:l,bbox:r,label:f}=await W(u,t,E(t)),i=t.look==="neo"?18:t.padding??0,n=t.look==="neo"?12:t.padding??0,a=r.width+i,e=r.height+n,s=Math.max(5,e*.1),{cssStyles:o}=t,c=[...lt(a/2,-e/2,s,30,-90,0),{x:-a/2-s,y:s},...lt(a/2+s*2,-s,s,20,-180,-270),...lt(a/2+s*2,s,s,20,-90,-180),{x:-a/2-s,y:-e/2},...lt(a/2,e/2,s,20,0,90)],y=[{x:a/2,y:-e/2-s},{x:-a/2,y:-e/2-s},...lt(a/2,-e/2,s,20,-90,0),{x:-a/2-s,y:-s},...lt(a/2+a*.1,-s,s,20,-180,-270),...lt(a/2+a*.1,s,s,20,-90,-180),{x:-a/2-s,y:e/2},...lt(a/2,e/2,s,20,0,90),{x:-a/2,y:e/2+s},{x:a/2,y:e/2+s}],d=H.at.svg(l),m=$.userNodeOverrides(t,{fill:"none"});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=q(c).replace("Z",""),w=d.path(p,m),b=q(y),S=d.path(b,{...m}),x=l.insert("g",":first-child");return x.insert(()=>S,":first-child").attr("stroke-opacity",0),x.insert(()=>w,":first-child"),x.attr("class","text"),o&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",o),h&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",h),x.attr("transform",`translate(${s}, 0)`),f.attr("transform",`translate(${-a/2+s-(r.x-(r.left??0))},${-e/2+(t.padding??0)/2-(r.y-(r.top??0))})`),I(t,x),t.intersect=function(N){return A.polygon(t,y,N)},l}v.__name(ce,"curlyBraceLeft");function nt(u,t,g,h=100,l=0,r=180){const f=[],i=l*Math.PI/180,n=(r*Math.PI/180-i)/(h-1);for(let a=0;a<h;a++){const e=i+a*n,s=u+g*Math.cos(e),o=t+g*Math.sin(e);f.push({x:s,y:o})}return f}v.__name(nt,"generateCirclePoints");async function oe(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const{shapeSvg:l,bbox:r,label:f}=await W(u,t,E(t)),i=t.look==="neo"?18:t.padding??0,n=t.look==="neo"?12:t.padding??0,a=r.width+(t.look==="neo"?i*2:i),e=r.height+(t.look==="neo"?n*2:n),s=Math.max(5,e*.1),{cssStyles:o}=t,c=[...nt(a/2,-e/2,s,20,-90,0),{x:a/2+s,y:-s},...nt(a/2+s*2,-s,s,20,-180,-270),...nt(a/2+s*2,s,s,20,-90,-180),{x:a/2+s,y:e/2},...nt(a/2,e/2,s,20,0,90)],y=[{x:-a/2,y:-e/2-s},{x:a/2,y:-e/2-s},...nt(a/2,-e/2,s,20,-90,0),{x:a/2+s,y:-s},...nt(a/2+s*2,-s,s,20,-180,-270),...nt(a/2+s*2,s,s,20,-90,-180),{x:a/2+s,y:e/2},...nt(a/2,e/2,s,20,0,90),{x:a/2,y:e/2+s},{x:-a/2,y:e/2+s}],d=H.at.svg(l),m=$.userNodeOverrides(t,{fill:"none"});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=q(c).replace("Z",""),w=d.path(p,m),b=q(y),S=d.path(b,{...m}),x=l.insert("g",":first-child");return x.insert(()=>S,":first-child").attr("stroke-opacity",0),x.insert(()=>w,":first-child"),x.attr("class","text"),o&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",o),h&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",h),x.attr("transform",`translate(${-s}, 0)`),f.attr("transform",`translate(${-a/2+(t.padding??0)/2-(r.x-(r.left??0))},${-e/2+(t.padding??0)/2-(r.y-(r.top??0))})`),I(t,x),t.intersect=function(N){return A.polygon(t,y,N)},l}v.__name(oe,"curlyBraceRight");function J(u,t,g,h=100,l=0,r=180){const f=[],i=l*Math.PI/180,n=(r*Math.PI/180-i)/(h-1);for(let a=0;a<h;a++){const e=i+a*n,s=u+g*Math.cos(e),o=t+g*Math.sin(e);f.push({x:-s,y:-o})}return f}v.__name(J,"generateCirclePoints");async function he(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const{shapeSvg:l,bbox:r,label:f}=await W(u,t,E(t)),i=t.look==="neo"?18:t.padding??0,n=t.look==="neo"?12:t.padding??0,a=r.width+(t.look==="neo"?i*2:i),e=r.height+(t.look==="neo"?n*2:n),s=Math.max(5,e*.1),{cssStyles:o}=t,c=[...J(a/2,-e/2,s,30,-90,0),{x:-a/2-s,y:s},...J(a/2+s*2,-s,s,20,-180,-270),...J(a/2+s*2,s,s,20,-90,-180),{x:-a/2-s,y:-e/2},...J(a/2,e/2,s,20,0,90)],y=[...J(-a/2+s+s/2,-e/2,s,20,-90,-180),{x:a/2-s/2,y:s},...J(-a/2-s/2,-s,s,20,0,90),...J(-a/2-s/2,s,s,20,-90,0),{x:a/2-s/2,y:-s},...J(-a/2+s+s/2,e/2,s,30,-180,-270)],d=[{x:a/2,y:-e/2-s},{x:-a/2,y:-e/2-s},...J(a/2,-e/2,s,20,-90,0),{x:-a/2-s,y:-s},...J(a/2+s*2,-s,s,20,-180,-270),...J(a/2+s*2,s,s,20,-90,-180),{x:-a/2-s,y:e/2},...J(a/2,e/2,s,20,0,90),{x:-a/2,y:e/2+s},{x:a/2-s-s/2,y:e/2+s},...J(-a/2+s+s/2,-e/2,s,20,-90,-180),{x:a/2-s/2,y:s},...J(-a/2-s/2,-s,s,20,0,90),...J(-a/2-s/2,s,s,20,-90,0),{x:a/2-s/2,y:-s},...J(-a/2+s+s/2,e/2,s,30,-180,-270)],m=H.at.svg(l),p=$.userNodeOverrides(t,{fill:"none"});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const w=q(c).replace("Z",""),b=m.path(w,p),S=q(y).replace("Z",""),x=m.path(S,p),N=q(d),k=m.path(N,{...p}),_=l.insert("g",":first-child");return _.insert(()=>k,":first-child").attr("stroke-opacity",0),_.insert(()=>b,":first-child"),_.insert(()=>x,":first-child"),_.attr("class","text"),o&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",o),h&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",h),_.attr("transform",`translate(${s-s/4}, 0)`),f.attr("transform",`translate(${-a/2+(t.padding??0)/2-(r.x-(r.left??0))},${-e/2+(t.padding??0)/2-(r.y-(r.top??0))})`),I(t,_),t.intersect=function(D){return A.polygon(t,d,D)},l}v.__name(he,"curlyBraces");async function ge(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=t.padding??0,r=t.look==="neo"?16:l,f=t.look==="neo"?12:l,i=20,n=5,{shapeSvg:a,bbox:e}=await W(u,t,E(t)),s=Math.max(i,(e.width+r*2)*1.25,t?.width??0),o=Math.max(n,e.height+f*2,t?.height??0),c=o/2,{cssStyles:y}=t,d=H.at.svg(a),m=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=s,w=o,b=p-c,S=w/4,x=[{x:b,y:0},{x:S,y:0},{x:0,y:w/2},{x:S,y:w},{x:b,y:w},...St(-b,-w/2,c,50,270,90)],N=q(x),k=d.path(N,m),_=a.insert(()=>k,":first-child");return _.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&_.selectChildren("path").attr("style",y),h&&t.look!=="handDrawn"&&_.selectChildren("path").attr("style",h),_.attr("transform",`translate(${-s/2}, ${-o/2})`),I(t,_),t.intersect=function(D){return A.polygon(t,x,D)},a}v.__name(ge,"curvedTrapezoid");var vs=v.__name((u,t,g,h,l,r)=>[`M${u},${t+r}`,`a${l},${r} 0,0,0 ${g},0`,`a${l},${r} 0,0,0 ${-g},0`,`l0,${h}`,`a${l},${r} 0,0,0 ${g},0`,`l0,${-h}`].join(" "),"createCylinderPathD"),ks=v.__name((u,t,g,h,l,r)=>[`M${u},${t+r}`,`M${u+g},${t+r}`,`a${l},${r} 0,0,0 ${-g},0`,`l0,${h}`,`a${l},${r} 0,0,0 ${g},0`,`l0,${-h}`].join(" "),"createOuterCylinderPathD"),_s=v.__name((u,t,g,h,l,r)=>[`M${u-g/2},${-h/2}`,`a${l},${r} 0,0,0 ${g},0`].join(" "),"createInnerCylinderPathD"),It=8,Tt=8;async function fe(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=t.padding??0,r=t.look==="neo"?24:l,f=t.look==="neo"?24:l;if(t.width||t.height){const m=t.width??0;t.width=(t.width??0)-f,t.width<Tt&&(t.width=Tt);const p=m/2/(2.5+m/50);t.height=(t.height??0)-r-p*3,t.height<It&&(t.height=It)}const{shapeSvg:i,bbox:n,label:a}=await W(u,t,E(t)),e=(t.width?t.width:n.width)+f,s=e/2,o=s/(2.5+e/50),c=(t.height?t.height:n.height)+r+o;let y;const{cssStyles:d}=t;if(t.look==="handDrawn"){const m=H.at.svg(i),p=ks(0,0,e,c,s,o),w=_s(0,o,e,c,s,o),b=$.userNodeOverrides(t,{}),S=m.path(p,b),x=m.path(w,$.userNodeOverrides(t,{fill:"none"}));y=i.insert(()=>x,":first-child"),y=i.insert(()=>S,":first-child"),y.attr("class","basic label-container"),d&&y.attr("style",d)}else{const m=vs(0,0,e,c,s,o);y=i.insert("path",":first-child").attr("d",m).attr("class","basic label-container outer-path").attr("style",U.handleUndefinedAttr(d)).attr("style",h)}return y.attr("label-offset-y",o),y.attr("transform",`translate(${-e/2}, ${-(c/2+o)})`),I(t,y),a.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)+(t.padding??0)/1.5-(n.y-(n.top??0))})`),t.intersect=function(m){const p=A.rect(t,m),w=p.x-(t.x??0);if(s!=0&&(Math.abs(w)<(t.width??0)/2||Math.abs(w)==(t.width??0)/2&&Math.abs(p.y-(t.y??0))>(t.height??0)/2-o)){let b=o*o*(1-w*w/(s*s));b>0&&(b=Math.sqrt(b)),b=o-b,m.y-(t.y??0)>0&&(b=-b),p.y+=b}return p},i}v.__name(fe,"cylinder");async function wt(u,t,g){const{labelStyles:h,nodeStyles:l}=$.styles2String(t);t.labelStyle=h;const{shapeSvg:r,bbox:f}=await W(u,t,E(t)),i=Math.max(f.width+g.labelPaddingX*2,t?.width||0),n=Math.max(f.height+g.labelPaddingY*2,t?.height||0),a=-i/2,e=-n/2;let s,{rx:o,ry:c}=t;const{cssStyles:y}=t;if(g?.rx&&g.ry&&(o=g.rx,c=g.ry),t.look==="handDrawn"){const d=H.at.svg(r),m=$.userNodeOverrides(t,{}),p=o||c?d.path(ft(a,e,i,n,o||0),m):d.rectangle(a,e,i,n,m);s=r.insert(()=>p,":first-child"),s.attr("class","basic label-container").attr("style",U.handleUndefinedAttr(y))}else s=r.insert("rect",":first-child"),s.attr("class","basic label-container").attr("style",l).attr("rx",U.handleUndefinedAttr(o)).attr("ry",U.handleUndefinedAttr(c)).attr("x",a).attr("y",e).attr("width",i).attr("height",n);return I(t,s),t.calcIntersect=function(d,m){return A.rect(d,m)},t.intersect=function(d){return A.rect(t,d)},r}v.__name(wt,"drawRect");async function ye(u,t){const{cssClasses:g,labelPaddingX:h,labelPaddingY:l,padding:r,width:f,height:i}=t,n=await wt(u,t,{rx:0,ry:0,classes:g??"",labelPaddingX:h??(r??0)*2,labelPaddingY:l??r??0});if(t.look==="handDrawn"){const o=H.at.svg(n),c=$.userNodeOverrides(t,{}),y=n.select(".basic.label-container > path:nth-child(2)"),d=y.node();if(!d)return n;let m=null;if(d instanceof SVGGraphicsElement)m=d.getBBox();else return n;return n.insert(()=>o.line(m.x,m.y,m.x+m.width,m.y,c),".basic.label-container g.label"),n.insert(()=>o.line(m.x,m.y+m.height,m.x+m.width,m.y+m.height,c),".basic.label-container g.label"),y.remove(),n}const a=n.select(".basic.label-container"),e=(Number(a.attr("width"))||f)??0,s=(Number(a.attr("height"))||i)??0;return e>0&&s>0&&a.attr("stroke-dasharray",`${e} ${s}`),n}v.__name(ye,"datastore");async function de(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=t.look==="neo"?16:t.padding??0,r=t.look==="neo"?16:t.padding??0,{shapeSvg:f,bbox:i,label:n}=await W(u,t,E(t)),a=i.width+l,e=i.height+r,s=e*.2,o=-a/2,c=-e/2-s/2,{cssStyles:y}=t,d=H.at.svg(f),m=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=[{x:o,y:c+s},{x:-o,y:c+s},{x:-o,y:-c},{x:o,y:-c},{x:o,y:c},{x:-o,y:c},{x:-o,y:c+s}],w=d.polygon(p.map(S=>[S.x,S.y]),m),b=f.insert(()=>w,":first-child");return b.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",y),h&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",h),n.attr("transform",`translate(${o+(t.padding??0)/2-(i.x-(i.left??0))}, ${c+s+(t.padding??0)/2-(i.y-(i.top??0))})`),I(t,b),t.intersect=function(S){return A.rect(t,S)},f}v.__name(de,"dividedRectangle");async function ue(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t),l=t.look==="neo"?12:5;t.labelStyle=g;const r=t.padding??0,f=t.look==="neo"?16:r,{shapeSvg:i,bbox:n}=await W(u,t,E(t)),a=(t?.width?t?.width/2:n.width/2)+(f??0),e=a-l;let s;const{cssStyles:o}=t;if(t.look==="handDrawn"){const c=H.at.svg(i),y=$.userNodeOverrides(t,{roughness:.2,strokeWidth:2.5}),d=$.userNodeOverrides(t,{roughness:.2,strokeWidth:1.5}),m=c.circle(0,0,a*2,y),p=c.circle(0,0,e*2,d);s=i.insert("g",":first-child"),s.attr("class",U.handleUndefinedAttr(t.cssClasses)).attr("style",U.handleUndefinedAttr(o)),s.node()?.appendChild(m),s.node()?.appendChild(p)}else{s=i.insert("g",":first-child");const c=s.insert("circle",":first-child"),y=s.insert("circle");s.attr("class","basic label-container").attr("style",h),c.attr("class","outer-circle").attr("style",h).attr("r",a).attr("cx",0).attr("cy",0),y.attr("class","inner-circle").attr("style",h).attr("r",e).attr("cx",0).attr("cy",0)}return I(t,s),t.intersect=function(c){return X.log.info("DoubleCircle intersect",t,a,c),A.circle(t,a,c)},i}v.__name(ue,"doublecircle");function pe(u,t,{config:{themeVariables:g}}){const{labelStyles:h,nodeStyles:l}=$.styles2String(t);t.label="",t.labelStyle=h;const r=u.insert("g").attr("class",E(t)).attr("id",t.domId??t.id),f=7,{cssStyles:i}=t,n=H.at.svg(r),{nodeBorder:a}=g,e=$.userNodeOverrides(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(e.roughness=0);const s=n.circle(0,0,f*2,e),o=r.insert(()=>s,":first-child");return o.selectAll("path").attr("style",`fill: ${a} !important;`),i&&i.length>0&&t.look!=="handDrawn"&&o.selectAll("path").attr("style",i),l&&t.look!=="handDrawn"&&o.selectAll("path").attr("style",l),I(t,o),t.intersect=function(c){return X.log.info("filledCircle intersect",t,{radius:f,point:c}),A.circle(t,f,c)},r}v.__name(pe,"filledCircle");var Et=10,Wt=10;async function me(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=t.padding??0,r=t.look==="neo"?l*2:l;(t.width||t.height)&&(t.height=t?.height??0,t.height<Et&&(t.height=Et),t.width=(t?.width??0)-r-r/2,t.width<Wt&&(t.width=Wt));const{shapeSvg:f,bbox:i,label:n}=await W(u,t,E(t)),a=(t?.width?t?.width:i.width)+(r??0),e=t?.height?t?.height:a+i.height,s=e,o=[{x:0,y:-e},{x:s,y:-e},{x:s/2,y:0}],{cssStyles:c}=t,y=H.at.svg(f),d=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const m=q(o),p=y.path(m,d),w=f.insert(()=>p,":first-child").attr("transform",`translate(${-e/2}, ${e/2})`).attr("class","outer-path");return c&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",c),h&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",h),t.width=a,t.height=e,I(t,w),n.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${-e/2+(t.padding??0)/2+(i.y-(i.top??0))})`),t.intersect=function(b){return X.log.info("Triangle intersect",t,o,b),A.polygon(t,o,b)},f}v.__name(me,"flippedTriangle");function we(u,t,{dir:g,config:{state:h,themeVariables:l}}){const{nodeStyles:r}=$.styles2String(t);t.label="";const f=u.insert("g").attr("class",E(t)).attr("id",t.domId??t.id),{cssStyles:i}=t;let n=Math.max(70,t?.width??0),a=Math.max(10,t?.height??0);g==="LR"&&(n=Math.max(10,t?.width??0),a=Math.max(70,t?.height??0));const e=-1*n/2,s=-1*a/2,o=H.at.svg(f),c=$.userNodeOverrides(t,{stroke:l.lineColor,fill:l.lineColor});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const y=o.rectangle(e,s,n,a,c),d=f.insert(()=>y,":first-child");i&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",i),r&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",r),I(t,d);const m=h?.padding??0;return t.width&&t.height&&(t.width+=m/2||0,t.height+=m/2||0),t.intersect=function(p){return A.rect(t,p)},f}v.__name(we,"forkJoin");async function be(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=15,r=10,f=t.look==="neo"?16:t.padding??0,i=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.height=(t?.height??0)-i*2,t.height<r&&(t.height=r),t.width=(t?.width??0)-f*2,t.width<l&&(t.width=l));const{shapeSvg:n,bbox:a}=await W(u,t,E(t)),e=(t?.width?t?.width:Math.max(l,a.width))+f*2,s=(t?.height?t?.height:Math.max(r,a.height))+i*2,o=s/2,{cssStyles:c}=t,y=H.at.svg(n),d=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const m=[{x:-e/2,y:-s/2},{x:e/2-o,y:-s/2},...St(-e/2+o,0,o,50,90,270),{x:e/2-o,y:s/2},{x:-e/2,y:s/2}],p=q(m),w=y.path(p,d),b=n.insert(()=>w,":first-child");return b.attr("class","basic label-container outer-path"),c&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",c),h&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",h),I(t,b),t.intersect=function(S){return X.log.info("Pill intersect",t,{radius:o,point:S}),A.polygon(t,m,S)},n}v.__name(be,"halfRoundedRectangle");var Ps=v.__name((u,t,g,h,l)=>[`M${u+l},${t}`,`L${u+g-l},${t}`,`L${u+g},${t-h/2}`,`L${u+g-l},${t-h}`,`L${u+l},${t-h}`,`L${u},${t-h/2}`,"Z"].join(" "),"createHexagonPathD");async function xe(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t),l=t.look==="neo"?3.5:4;t.labelStyle=g;const r=t.padding??0,f=70,i=32,n=t.look==="neo"?f:r,a=t.look==="neo"?i:r;if(t.width||t.height){const w=(t.height??0)/l;t.width=(t?.width??0)-2*w-a,t.height=(t.height??0)-n}const{shapeSvg:e,bbox:s}=await W(u,t,E(t)),o=(t?.height?t?.height:s.height)+n,c=o/l,y=(t?.width?t?.width:s.width)+2*c+a,d=[{x:c,y:0},{x:y-c,y:0},{x:y,y:-o/2},{x:y-c,y:-o},{x:c,y:-o},{x:0,y:-o/2}];let m;const{cssStyles:p}=t;if(t.look==="handDrawn"){const w=H.at.svg(e),b=$.userNodeOverrides(t,{}),S=Ps(0,0,y,o,c),x=w.path(S,b);m=e.insert(()=>x,":first-child").attr("transform",`translate(${-y/2}, ${o/2})`),p&&m.attr("style",p)}else m=ot(e,y,o,d);return h&&m.attr("style",h),t.width=y,t.height=o,I(t,m),t.intersect=function(w){return A.polygon(t,d,w)},e}v.__name(xe,"hexagon");async function Se(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.label="",t.labelStyle=g;const{shapeSvg:l}=await W(u,t,E(t)),r=Math.max(30,t?.width??0),f=Math.max(30,t?.height??0),{cssStyles:i}=t,n=H.at.svg(l),a=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(a.roughness=0,a.fillStyle="solid");const e=[{x:0,y:0},{x:r,y:0},{x:0,y:f},{x:r,y:f}],s=q(e),o=n.path(s,a),c=l.insert(()=>o,":first-child");return c.attr("class","basic label-container outer-path"),i&&t.look!=="handDrawn"&&c.selectChildren("path").attr("style",i),h&&t.look!=="handDrawn"&&c.selectChildren("path").attr("style",h),c.attr("transform",`translate(${-r/2}, ${-f/2})`),I(t,c),t.intersect=function(y){return X.log.info("Pill intersect",t,{points:e}),A.polygon(t,e,y)},l}v.__name(Se,"hourglass");async function $e(u,t,{config:{themeVariables:g,flowchart:h}}){const{labelStyles:l}=$.styles2String(t);t.labelStyle=l;const r=t.assetHeight??48,f=t.assetWidth??48,i=Math.max(r,f),n=h?.wrappingWidth;t.width=Math.max(i,n??0);const{shapeSvg:a,bbox:e,label:s}=await W(u,t,"icon-shape default"),o=t.pos==="t",c=i,y=i,{nodeBorder:d}=g,{stylesMap:m}=$.compileStyles(t),p=-y/2,w=-c/2,b=t.label?8:0,S=H.at.svg(a),x=$.userNodeOverrides(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const N=S.rectangle(p,w,y,c,x),k=Math.max(y,e.width),_=c+e.height+b,D=S.rectangle(-k/2,-_/2,k,_,{...x,fill:"transparent",stroke:"none"}),R=a.insert(()=>N,":first-child"),L=a.insert(()=>D);if(t.icon){const T=a.append("g");T.html(`<g>${await kt.getIconSVG(t.icon,{height:i,width:i,fallbackPrefix:""})}</g>`);const M=T.node().getBBox(),B=M.width,P=M.height,O=M.x,C=M.y;T.attr("transform",`translate(${-B/2-O},${o?e.height/2+b/2-P/2-C:-e.height/2-b/2-P/2-C})`),T.attr("style",`color: ${m.get("stroke")??d};`)}return s.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${o?-_/2:_/2-e.height})`),R.attr("transform",`translate(0,${o?e.height/2+b/2:-e.height/2-b/2})`),I(t,L),t.intersect=function(T){if(X.log.info("iconSquare intersect",t,T),!t.label)return A.rect(t,T);const M=t.x??0,B=t.y??0,P=t.height??0;let O=[];return o?O=[{x:M-e.width/2,y:B-P/2},{x:M+e.width/2,y:B-P/2},{x:M+e.width/2,y:B-P/2+e.height+b},{x:M+y/2,y:B-P/2+e.height+b},{x:M+y/2,y:B+P/2},{x:M-y/2,y:B+P/2},{x:M-y/2,y:B-P/2+e.height+b},{x:M-e.width/2,y:B-P/2+e.height+b}]:O=[{x:M-y/2,y:B-P/2},{x:M+y/2,y:B-P/2},{x:M+y/2,y:B-P/2+c},{x:M+e.width/2,y:B-P/2+c},{x:M+e.width/2/2,y:B+P/2},{x:M-e.width/2,y:B+P/2},{x:M-e.width/2,y:B-P/2+c},{x:M-y/2,y:B-P/2+c}],A.polygon(t,O,T)},a}v.__name($e,"icon");async function ve(u,t,{config:{themeVariables:g,flowchart:h}}){const{labelStyles:l}=$.styles2String(t);t.labelStyle=l;const r=t.assetHeight??48,f=t.assetWidth??48,i=Math.max(r,f),n=h?.wrappingWidth;t.width=Math.max(i,n??0);const{shapeSvg:a,bbox:e,label:s}=await W(u,t,"icon-shape default"),o=20,c=t.label?8:0,y=t.pos==="t",{nodeBorder:d,mainBkg:m}=g,{stylesMap:p}=$.compileStyles(t),w=H.at.svg(a),b=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid"),b.stroke=p.get("fill")??m;const S=a.append("g");t.icon&&S.html(`<g>${await kt.getIconSVG(t.icon,{height:i,width:i,fallbackPrefix:""})}</g>`);const x=S.node().getBBox(),N=x.width,k=x.height,_=x.x,D=x.y,R=Math.max(N,k)*Math.SQRT2+o*2,L=w.circle(0,0,R,b),T=Math.max(R,e.width),M=R+e.height+c,B=w.rectangle(-T/2,-M/2,T,M,{...b,fill:"transparent",stroke:"none"}),P=a.insert(()=>L,":first-child"),O=a.insert(()=>B);return S.attr("transform",`translate(${-N/2-_},${y?e.height/2+c/2-k/2-D:-e.height/2-c/2-k/2-D})`),S.attr("style",`color: ${p.get("stroke")??d};`),s.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${y?-M/2:M/2-e.height})`),P.attr("transform",`translate(0,${y?e.height/2+c/2:-e.height/2-c/2})`),I(t,O),t.intersect=function(C){return X.log.info("iconSquare intersect",t,C),A.rect(t,C)},a}v.__name(ve,"iconCircle");async function ke(u,t,{config:{themeVariables:g,flowchart:h}}){const{labelStyles:l}=$.styles2String(t);t.labelStyle=l;const r=t.assetHeight??48,f=t.assetWidth??48,i=Math.max(r,f),n=h?.wrappingWidth;t.width=Math.max(i,n??0);const{shapeSvg:a,bbox:e,halfPadding:s,label:o}=await W(u,t,"icon-shape default"),c=t.pos==="t",y=i+s*2,d=i+s*2,{nodeBorder:m,mainBkg:p}=g,{stylesMap:w}=$.compileStyles(t),b=-d/2,S=-y/2,x=t.label?8:0,N=H.at.svg(a),k=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid"),k.stroke=w.get("fill")??p;const _=N.path(ft(b,S,d,y,5),k),D=Math.max(d,e.width),R=y+e.height+x,L=N.rectangle(-D/2,-R/2,D,R,{...k,fill:"transparent",stroke:"none"}),T=a.insert(()=>_,":first-child").attr("class","icon-shape2"),M=a.insert(()=>L);if(t.icon){const B=a.append("g");B.html(`<g>${await kt.getIconSVG(t.icon,{height:i,width:i,fallbackPrefix:""})}</g>`);const P=B.node().getBBox(),O=P.width,C=P.height,G=P.x,V=P.y;B.attr("transform",`translate(${-O/2-G},${c?e.height/2+x/2-C/2-V:-e.height/2-x/2-C/2-V})`),B.attr("style",`color: ${w.get("stroke")??m};`)}return o.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${c?-R/2:R/2-e.height})`),T.attr("transform",`translate(0,${c?e.height/2+x/2:-e.height/2-x/2})`),I(t,M),t.intersect=function(B){if(X.log.info("iconSquare intersect",t,B),!t.label)return A.rect(t,B);const P=t.x??0,O=t.y??0,C=t.height??0;let G=[];return c?G=[{x:P-e.width/2,y:O-C/2},{x:P+e.width/2,y:O-C/2},{x:P+e.width/2,y:O-C/2+e.height+x},{x:P+d/2,y:O-C/2+e.height+x},{x:P+d/2,y:O+C/2},{x:P-d/2,y:O+C/2},{x:P-d/2,y:O-C/2+e.height+x},{x:P-e.width/2,y:O-C/2+e.height+x}]:G=[{x:P-d/2,y:O-C/2},{x:P+d/2,y:O-C/2},{x:P+d/2,y:O-C/2+y},{x:P+e.width/2,y:O-C/2+y},{x:P+e.width/2/2,y:O+C/2},{x:P-e.width/2,y:O+C/2},{x:P-e.width/2,y:O-C/2+y},{x:P-d/2,y:O-C/2+y}],A.polygon(t,G,B)},a}v.__name(ke,"iconRounded");async function _e(u,t,{config:{themeVariables:g,flowchart:h}}){const{labelStyles:l}=$.styles2String(t);t.labelStyle=l;const r=t.assetHeight??48,f=t.assetWidth??48,i=Math.max(r,f),n=h?.wrappingWidth;t.width=Math.max(i,n??0);const{shapeSvg:a,bbox:e,halfPadding:s,label:o}=await W(u,t,"icon-shape default"),c=t.pos==="t",y=i+s*2,d=i+s*2,{nodeBorder:m,mainBkg:p}=g,{stylesMap:w}=$.compileStyles(t),b=-d/2,S=-y/2,x=t.label?8:0,N=H.at.svg(a),k=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid"),k.stroke=w.get("fill")??p;const _=N.path(ft(b,S,d,y,.1),k),D=Math.max(d,e.width),R=y+e.height+x,L=N.rectangle(-D/2,-R/2,D,R,{...k,fill:"transparent",stroke:"none"}),T=a.insert(()=>_,":first-child"),M=a.insert(()=>L);if(t.icon){const B=a.append("g");B.html(`<g>${await kt.getIconSVG(t.icon,{height:i,width:i,fallbackPrefix:""})}</g>`);const P=B.node().getBBox(),O=P.width,C=P.height,G=P.x,V=P.y;B.attr("transform",`translate(${-O/2-G},${c?e.height/2+x/2-C/2-V:-e.height/2-x/2-C/2-V})`),B.attr("style",`color: ${w.get("stroke")??m};`)}return o.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${c?-R/2:R/2-e.height})`),T.attr("transform",`translate(0,${c?e.height/2+x/2:-e.height/2-x/2})`),I(t,M),t.intersect=function(B){if(X.log.info("iconSquare intersect",t,B),!t.label)return A.rect(t,B);const P=t.x??0,O=t.y??0,C=t.height??0;let G=[];return c?G=[{x:P-e.width/2,y:O-C/2},{x:P+e.width/2,y:O-C/2},{x:P+e.width/2,y:O-C/2+e.height+x},{x:P+d/2,y:O-C/2+e.height+x},{x:P+d/2,y:O+C/2},{x:P-d/2,y:O+C/2},{x:P-d/2,y:O-C/2+e.height+x},{x:P-e.width/2,y:O-C/2+e.height+x}]:G=[{x:P-d/2,y:O-C/2},{x:P+d/2,y:O-C/2},{x:P+d/2,y:O-C/2+y},{x:P+e.width/2,y:O-C/2+y},{x:P+e.width/2/2,y:O+C/2},{x:P-e.width/2,y:O+C/2},{x:P-e.width/2,y:O-C/2+y},{x:P-d/2,y:O-C/2+y}],A.polygon(t,G,B)},a}v.__name(_e,"iconSquare");async function Pe(u,t,{config:{flowchart:g}}){const h=new Image;h.src=t?.img??"",await h.decode();const l=Number(h.naturalWidth.toString().replace("px","")),r=Number(h.naturalHeight.toString().replace("px",""));t.imageAspectRatio=l/r;const{labelStyles:f}=$.styles2String(t);t.labelStyle=f;const i=g?.wrappingWidth;t.defaultWidth=g?.wrappingWidth;const n=Math.max(t.label?i??0:0,t?.assetWidth??l),a=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:n,e=t.constraint==="on"?a/t.imageAspectRatio:t?.assetHeight??r;t.width=Math.max(a,i??0);const{shapeSvg:s,bbox:o,label:c}=await W(u,t,"image-shape default"),y=t.pos==="t",d=-a/2,m=-e/2,p=t.label?8:0,w=H.at.svg(s),b=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const S=w.rectangle(d,m,a,e,b),x=Math.max(a,o.width),N=e+o.height+p,k=w.rectangle(-x/2,-N/2,x,N,{...b,fill:"none",stroke:"none"}),_=s.insert(()=>S,":first-child"),D=s.insert(()=>k);if(t.img){const R=s.append("image");R.attr("href",t.img),R.attr("width",a),R.attr("height",e),R.attr("preserveAspectRatio","none"),R.attr("transform",`translate(${-a/2},${y?N/2-e:-N/2})`)}return c.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))},${y?-e/2-o.height/2-p/2:e/2-o.height/2+p/2})`),_.attr("transform",`translate(0,${y?o.height/2+p/2:-o.height/2-p/2})`),I(t,D),t.intersect=function(R){if(X.log.info("iconSquare intersect",t,R),!t.label)return A.rect(t,R);const L=t.x??0,T=t.y??0,M=t.height??0;let B=[];return y?B=[{x:L-o.width/2,y:T-M/2},{x:L+o.width/2,y:T-M/2},{x:L+o.width/2,y:T-M/2+o.height+p},{x:L+a/2,y:T-M/2+o.height+p},{x:L+a/2,y:T+M/2},{x:L-a/2,y:T+M/2},{x:L-a/2,y:T-M/2+o.height+p},{x:L-o.width/2,y:T-M/2+o.height+p}]:B=[{x:L-a/2,y:T-M/2},{x:L+a/2,y:T-M/2},{x:L+a/2,y:T-M/2+e},{x:L+o.width/2,y:T-M/2+e},{x:L+o.width/2/2,y:T+M/2},{x:L-o.width/2,y:T+M/2},{x:L-o.width/2,y:T-M/2+e},{x:L-a/2,y:T-M/2+e}],A.polygon(t,B,R)},s}v.__name(Pe,"imageSquare");async function Ne(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=t.padding??0,r=l,f=t.look==="neo"?l*2:l,{shapeSvg:i,bbox:n}=await W(u,t,E(t)),a=Math.max(n.width+(f??0)*2,t?.width??0),e=Math.max(n.height+(r??0)*2,t?.height??0),s=[{x:0,y:0},{x:a,y:0},{x:a+3*e/6,y:-e},{x:-3*e/6,y:-e}];let o;const{cssStyles:c}=t;if(t.look==="handDrawn"){const y=H.at.svg(i),d=$.userNodeOverrides(t,{}),m=q(s),p=y.path(m,d);o=i.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${e/2})`),c&&o.attr("style",c)}else o=ot(i,a,e,s);return h&&o.attr("style",h),t.width=a,t.height=e,I(t,o),t.intersect=function(y){return A.polygon(t,s,y)},i}v.__name(Ne,"inv_trapezoid");async function De(u,t){const{shapeSvg:g,bbox:h,label:l}=await W(u,t,"label"),r=g.insert("rect",":first-child");return r.attr("width",.1).attr("height",.1),g.attr("class","label edgeLabel"),l.attr("transform",`translate(${-(h.width/2)-(h.x-(h.left??0))}, ${-(h.height/2)-(h.y-(h.top??0))})`),I(t,r),t.intersect=function(f){return A.rect(t,f)},g}v.__name(De,"labelRect");async function Be(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=t.padding??0,r=l,f=t.look==="neo"?l*2:l,{shapeSvg:i,bbox:n}=await W(u,t,E(t)),a=(t?.height??n.height)+r,e=(t?.width??n.width)+f,s=[{x:0,y:0},{x:e+3*a/6,y:0},{x:e,y:-a},{x:-(3*a)/6,y:-a}];let o;const{cssStyles:c}=t;if(t.look==="handDrawn"){const y=H.at.svg(i),d=$.userNodeOverrides(t,{}),m=q(s),p=y.path(m,d);o=i.insert(()=>p,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),c&&o.attr("style",c)}else o=ot(i,e,a,s);return h&&o.attr("style",h),t.width=e,t.height=a,I(t,o),t.intersect=function(y){return A.polygon(t,s,y)},i}v.__name(Be,"lean_left");async function Me(u,t){const{labelStyles:g,nodeStyles:h}=$.styles2String(t);t.labelStyle=g;const l=t.padding??0,r=l,f=t.look==="neo"?l*2:l,{shapeSvg:i,bbox:n}=await W(u,t,E(t)),a=(t?.height??n.height)+r,e=(t?.width??n.width)+f,s=[{x:-3*a/6,y:0},{x:e,y:0},{x:e+3*a/6,y:-a},{x:0,y:-a}];let o;const{cssStyles:c}=t;if(t.look==="handDrawn"){const y=H.at.svg(i),d=$.userNodeOverrides(t,{}),m=q(s),p=y.path(m,d);o=i.insert(()=>p,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),c&&o.attr("style",c)}else o=ot(i,e,a,s);return h&&o.a