b&&(b=h),k=v*v*w,T=Math.max(b/k,k/x),T>E){v-=h;break}E=T}s.push(u={value:v,dice:m ma))l.moveTo(0,0);else if(v>zg-ma)l.moveTo(m*Pf(g),m*cc(g)),l.arc(0,0,m,g,y,!x),p>ma&&(l.moveTo(p*Pf(y),p*cc(y)),l.arc(0,0,p,y,g,x));else{var b=g,T=y,E=g,w=y,k=v,S=v,A=s.apply(this,arguments)/2,L=A>ma&&(n?+n.apply(this,arguments):n0(p*p+m*m)),I=G5(F9(m-p)/2,+r.apply(this,arguments)),N=I,C=I,_,D;if(L>ma){var M=$9(L/p*cc(A)),R=$9(L/m*cc(A));(k-=M*2)>ma?(M*=x?1:-1,E+=M,w-=M):(k=0,E=w=(g+y)/2),(S-=R*2)>ma?(R*=x?1:-1,b+=R,T-=R):(S=0,b=T=(g+y)/2)}var P=m*Pf(b),B=m*cc(b),F=p*Pf(w),G=p*cc(w);if(I>ma){var $=m*Pf(T),V=m*cc(T),X=p*Pf(E),Q=p*cc(E),H;if(v<$g)if(H=INe(P,B,X,Q,$,V,F,G)){var ie=P-H[0],Y=B-H[1],le=$-H[0],ee=V-H[1],J=1/cc(JJ((ie*le+Y*ee)/(n0(ie*ie+Y*Y)*n0(le*le+ee*ee)))/2),te=n0(H[0]*H[0]+H[1]*H[1]);N=G5(I,(p-te)/(J-1)),C=G5(I,(m-te)/(J+1))}else N=C=0}S>ma?C>ma?(_=U5(X,Q,P,B,m,C,x),D=U5($,V,F,G,m,C,x),l.moveTo(_.cx+_.x01,_.cy+_.y01),Cma)||!(k>ma)?l.lineTo(F,G):N>ma?(_=U5(F,G,$,V,p,-N,x),D=U5(P,B,X,Q,p,-N,x),l.lineTo(_.cx+_.x01,_.cy+_.y01),N{"use strict";z5();V5();z9();o(DNe,"arcInnerRadius");o(RNe,"arcOuterRadius");o(LNe,"arcStartAngle");o(NNe,"arcEndAngle");o(MNe,"arcPadAngle");o(INe,"intersect");o(U5,"cornerTangents");o(uc,"default")});function Ex(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}var j6t,G9=O(()=>{"use strict";j6t=Array.prototype.slice;o(Ex,"default")});function tee(t){this._context=t}function au(t){return new tee(t)}var V9=O(()=>{"use strict";o(tee,"Linear");tee.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._point=0},"lineStart"),lineEnd:o(function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}},"point")};o(au,"default")});function ree(t){return t[0]}function nee(t){return t[1]}var iee=O(()=>{"use strict";o(ree,"x");o(nee,"y")});function hc(t,e){var r=ei(!0),n=null,i=au,a=null,s=q5(l);t=typeof t=="function"?t:t===void 0?ree:ei(t),e=typeof e=="function"?e:e===void 0?nee:ei(e);function l(u){var h,f=(u=Ex(u)).length,d,p=!1,m;for(n==null&&(a=i(m=s())),h=0;h<=f;++h)!(h0;){if(h=W2(s,l,r),h===u)return n[i]=s,n[a]=l,e(n);if(h>0)s=Math.floor(s/h)*h,l=Math.ceil(l/h)*h;else if(h<0)s=Math.ceil(s*h)/h,l=Math.floor(l*h)/h;else break;u=h}return t},t}function sc(){var t=yx();return t.copy=function(){return D5(t,sc())},Mf.apply(t,arguments),t9e(t)}var dJ=O(()=>{"use strict";Cf();g9();gx();fJ();o(t9e,"linearish");o(sc,"linear")});function v9(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],a=t[n],s;return a{"use strict";o(v9,"nice")});function In(t,e,r,n){function i(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return o(i,"interval"),i.floor=a=>(t(a=new Date(+a)),a),i.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),i.round=a=>{let s=i(a),l=i.ceil(a);return a-s0))return u;let h;do u.push(h=new Date(+a)),e(a,l),t(a);while(hIn(s=>{if(s>=s)for(;t(s),!a(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;e(s,-1),!a(s););else for(;--l>=0;)for(;e(s,1),!a(s););}),r&&(i.count=(a,s)=>(x9.setTime(+a),b9.setTime(+s),t(x9),t(b9),Math.floor(r(x9,b9))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?s=>n(s)%a===0:s=>i.count(0,s)%a===0):i)),i}var x9,b9,gh=O(()=>{"use strict";x9=new Date,b9=new Date;o(In,"timeInterval")});var ru,mJ,T9=O(()=>{"use strict";gh();ru=In(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);ru.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?In(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):ru);mJ=ru.range});var $o,gJ,w9=O(()=>{"use strict";gh();$o=In(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),gJ=$o.range});var yh,r9e,R5,n9e,k9=O(()=>{"use strict";gh();yh=In(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),r9e=yh.range,R5=In(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),n9e=R5.range});var vh,i9e,L5,a9e,E9=O(()=>{"use strict";gh();vh=In(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3-t.getMinutes()*6e4)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getHours()),i9e=vh.range,L5=In(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),a9e=L5.range});var gl,s9e,xx,o9e,N5,l9e,S9=O(()=>{"use strict";gh();gl=In(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1),s9e=gl.range,xx=In(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),o9e=xx.range,N5=In(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),l9e=N5.range});function Jp(t){return In(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}function e0(t){return In(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/6048e5)}var oc,If,M5,I5,iu,O5,P5,vJ,c9e,u9e,h9e,f9e,d9e,p9e,t0,Bg,xJ,bJ,Of,TJ,wJ,kJ,m9e,g9e,y9e,v9e,x9e,b9e,C9=O(()=>{"use strict";gh();o(Jp,"timeWeekday");oc=Jp(0),If=Jp(1),M5=Jp(2),I5=Jp(3),iu=Jp(4),O5=Jp(5),P5=Jp(6),vJ=oc.range,c9e=If.range,u9e=M5.range,h9e=I5.range,f9e=iu.range,d9e=O5.range,p9e=P5.range;o(e0,"utcWeekday");t0=e0(0),Bg=e0(1),xJ=e0(2),bJ=e0(3),Of=e0(4),TJ=e0(5),wJ=e0(6),kJ=t0.range,m9e=Bg.range,g9e=xJ.range,y9e=bJ.range,v9e=Of.range,x9e=TJ.range,b9e=wJ.range});var xh,T9e,B5,w9e,A9=O(()=>{"use strict";gh();xh=In(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth()),T9e=xh.range,B5=In(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth()),w9e=B5.range});var zo,k9e,lc,E9e,_9=O(()=>{"use strict";gh();zo=In(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());zo.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:In(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});k9e=zo.range,lc=In(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());lc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:In(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});E9e=lc.range});function SJ(t,e,r,n,i,a){let s=[[$o,1,1e3],[$o,5,5*1e3],[$o,15,15*1e3],[$o,30,30*1e3],[a,1,6e4],[a,5,5*6e4],[a,15,15*6e4],[a,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[e,1,2592e6],[e,3,3*2592e6],[t,1,31536e6]];function l(h,f,d){let p=f{"use strict";Cf();T9();w9();k9();E9();S9();C9();A9();_9();o(SJ,"ticker");[C9e,A9e]=SJ(lc,B5,t0,N5,L5,R5),[D9,R9]=SJ(zo,xh,oc,gl,vh,yh)});var F5=O(()=>{"use strict";T9();w9();k9();E9();S9();C9();A9();_9();CJ()});function L9(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function N9(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function bx(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function M9(t){var e=t.dateTime,r=t.date,n=t.time,i=t.periods,a=t.days,s=t.shortDays,l=t.months,u=t.shortMonths,h=Tx(i),f=wx(i),d=Tx(a),p=wx(a),m=Tx(s),g=wx(s),y=Tx(l),v=wx(l),x=Tx(u),b=wx(u),T={a:P,A:B,b:F,B:G,c:null,d:NJ,e:NJ,f:K9e,g:sNe,G:lNe,H:Y9e,I:j9e,j:X9e,L:BJ,m:Q9e,M:Z9e,p:$,q:V,Q:OJ,s:PJ,S:J9e,u:eNe,U:tNe,V:rNe,w:nNe,W:iNe,x:null,X:null,y:aNe,Y:oNe,Z:cNe,"%":IJ},E={a:X,A:Q,b:H,B:ie,c:null,d:MJ,e:MJ,f:dNe,g:kNe,G:SNe,H:uNe,I:hNe,j:fNe,L:$J,m:pNe,M:mNe,p:Y,q:le,Q:OJ,s:PJ,S:gNe,u:yNe,U:vNe,V:xNe,w:bNe,W:TNe,x:null,X:null,y:wNe,Y:ENe,Z:CNe,"%":IJ},w={a:I,A:N,b:C,B:_,c:D,d:RJ,e:RJ,f:q9e,g:DJ,G:_J,H:LJ,I:LJ,j:$9e,L:V9e,m:F9e,M:z9e,p:L,q:B9e,Q:W9e,s:H9e,S:G9e,u:N9e,U:M9e,V:I9e,w:L9e,W:O9e,x:M,X:R,y:DJ,Y:_J,Z:P9e,"%":U9e};T.x=k(r,T),T.X=k(n,T),T.c=k(e,T),E.x=k(r,E),E.X=k(n,E),E.c=k(e,E);function k(ee,J){return function(te){var Z=[],xe=-1,de=0,Se=ee.length,Me,ke,we;for(te instanceof Date||(te=new Date(+te));++xe{"use strict";o1();Zg();o(ROe,"copyObject");kl=ROe});function LOe(t,e){for(var r=-1,n=Array(t);++r
"},r),st.lineBreakRegex.test(t)))return t;let n=t.split(" ").filter(Boolean),i=[],a="";return n.forEach((s,l)=>{let u=xa(`${s} `,r),h=xa(a,r);if(u>e){let{hyphenatedStrings:p,remainingWord:m}=vPe(s,e,"-",r);i.push(a,...p),a=m}else h+u>=e?(i.push(a),a=s):a=[a,s].filter(Boolean).join(" ");l+1===n.length&&i.push(a)}),i.filter(s=>s!=="").join(r.joinWith)},(t,e,r)=>`${t}${e}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),vPe=Xg((t,e,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);let i=[...t],a=[],s="";return i.forEach((l,u)=>{let h=`${s}${l}`;if(xa(h,n)>=e){let d=u+1,p=i.length===d,m=`${h}${r}`;a.push(p?h:m),s=""}else s=h}),{hyphenatedStrings:a,remainingWord:s}},(t,e,r="-",n)=>`${t}${e}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);o(Ak,"calculateTextHeight");o(xa,"calculateTextWidth");IN=Xg((t,e)=>{let{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};let[,a]=Uo(r),s=["sans-serif",n],l=t.split(st.lineBreakRegex),u=[],h=je("body");if(!h.remove)return{width:0,height:0,lineHeight:0};let f=h.append("svg");for(let p of s){let m=0,g={width:0,height:0,lineHeight:0};for(let y of l){let v=gPe();v.text=y||AN;let x=yPe(f,v).style("font-size",a).style("font-weight",i).style("font-family",p),b=(x._groups||x)[0][0].getBBox();if(b.width===0&&b.height===0)throw new Error("svg element not in render tree");g.width=Math.round(Math.max(g.width,b.width)),m=Math.round(b.height),g.height+=m,g.lineHeight=Math.round(Math.max(g.lineHeight,m))}u.push(g)}f.remove();let d=isNaN(u[1].height)||isNaN(u[1].width)||isNaN(u[1].lineHeight)||u[0].height>u[1].height&&u[0].width>u[1].width&&u[0].lineHeight>u[1].lineHeight?0:1;return u[d]},(t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`),CN=class{constructor(e=!1,r){this.count=0;this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}static{o(this,"InitIDGenerator")}},xPe=o(function(t){return Ck=Ck||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Ck.innerHTML=t,unescape(Ck.textContent)},"entityDecode");o(ON,"isDetailedError");bPe=o((t,e,r,n)=>{if(!n)return;let i=t.node()?.getBBox();i&&t.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",e)},"insertTitle"),Uo=o(t=>{if(typeof t=="number")return[t,t+"px"];let e=parseInt(t??"",10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},"parseFontSize");o(Pn,"cleanAndMerge");Xt={assignWithDepth:Vn,wrapLabel:MN,calculateTextHeight:Ak,calculateTextWidth:xa,calculateTextDimensions:IN,cleanAndMerge:Pn,detectInit:oPe,detectDirective:zre,isSubstringInArray:lPe,interpolateToCurve:_N,calcLabelPosition:fPe,calcCardinalityPosition:dPe,calcTerminalLabelPosition:pPe,formatUrl:cPe,getStylesFromArray:RN,generateId:LN,random:NN,runFunc:uPe,entityDecode:xPe,insertTitle:bPe,isLabelCoordinateInPath:TPe,parseFontSize:Uo,InitIDGenerator:CN},qre=o(function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){let n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"\uFB02\xB0\xB0"+n+"\xB6\xDF":"\uFB02\xB0"+n+"\xB6\xDF"}),e},"encodeEntities"),ao=o(function(t){return t.replace(/fl°°/g,"").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),hu=o((t,e,{counter:r=0,prefix:n,suffix:i},a)=>a||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");o(Bn,"handleUndefinedAttr");o(TPe,"isLabelCoordinateInPath")});function gc(t,e,r,n,i){if(!e[t].width)if(r)e[t].text=MN(e[t].text,i,n),e[t].textLines=e[t].text.split(st.lineBreakRegex).length,e[t].width=i,e[t].height=Ak(e[t].text,n);else{let a=e[t].text.split(st.lineBreakRegex);e[t].textLines=a.length;let s=0;e[t].height=0,e[t].width=0;for(let l of a)e[t].width=Math.max(xa(l,n),e[t].width),s=Ak(l,n),e[t].height=e[t].height+s}}function jre(t,e,r,n,i){let a=new Lk(i);a.data.widthLimit=r.data.widthLimit/Math.min(PN,n.length);for(let[s,l]of n.entries()){let u=0;l.image={width:0,height:0,Y:0},l.sprite&&(l.image.width=48,l.image.height=48,l.image.Y=u,u=l.image.Y+l.image.height);let h=l.wrap&&Jt.wrap,f=_k(Jt);if(f.fontSize=f.fontSize+2,f.fontWeight="bold",gc("label",l,h,f,a.data.widthLimit),l.label.Y=u+8,u=l.label.Y+l.label.height,l.type&&l.type.text!==""){l.type.text="["+l.type.text+"]";let g=_k(Jt);gc("type",l,h,g,a.data.widthLimit),l.type.Y=u+5,u=l.type.Y+l.type.height}if(l.descr&&l.descr.text!==""){let g=_k(Jt);g.fontSize=g.fontSize-2,gc("descr",l,h,g,a.data.widthLimit),l.descr.Y=u+20,u=l.descr.Y+l.descr.height}if(s==0||s%PN===0){let g=r.data.startx+Jt.diagramMarginX,y=r.data.stopy+Jt.diagramMarginY+u;a.setData(g,g,y,y)}else{let g=a.data.stopx!==a.data.startx?a.data.stopx+Jt.diagramMarginX:a.data.startx,y=a.data.starty;a.setData(g,g,y,y)}a.name=l.alias;let d=i.db.getC4ShapeArray(l.alias),p=i.db.getC4ShapeKeys(l.alias);p.length>0&&Yre(a,t,d,p),e=l.alias;let m=i.db.getBoundaries(e);m.length>0&&jre(t,e,a,m,i),l.alias!=="global"&&Hre(t,l,a),r.data.stopy=Math.max(a.data.stopy+Jt.c4ShapeMargin,r.data.stopy),r.data.stopx=Math.max(a.data.stopx+Jt.c4ShapeMargin,r.data.stopx),Dk=Math.max(Dk,r.data.stopx),Rk=Math.max(Rk,r.data.stopy)}}var Dk,Rk,Wre,PN,Jt,Lk,BN,Zx,_k,wPe,Hre,Yre,so,Ure,kPe,EPe,SPe,FN,Xre=O(()=>{"use strict";Ar();Uee();xt();TD();Ur();LD();jt();sg();ar();Ti();Dk=0,Rk=0,Wre=4,PN=2;F2.yy=U2;Jt={},Lk=class{static{o(this,"Bounds")}constructor(e){this.name="",this.data={},this.data.startx=void 0,this.data.stopx=void 0,this.data.starty=void 0,this.data.stopy=void 0,this.data.widthLimit=void 0,this.nextData={},this.nextData.startx=void 0,this.nextData.stopx=void 0,this.nextData.starty=void 0,this.nextData.stopy=void 0,this.nextData.cnt=0,BN(e.db.getConfig())}setData(e,r,n,i){this.nextData.startx=this.data.startx=e,this.nextData.stopx=this.data.stopx=r,this.nextData.starty=this.data.starty=n,this.nextData.stopy=this.data.stopy=i}updateVal(e,r,n,i){e[r]===void 0?e[r]=n:e[r]=i(n,e[r])}insert(e){this.nextData.cnt=this.nextData.cnt+1;let r=this.nextData.startx===this.nextData.stopx?this.nextData.stopx+e.margin:this.nextData.stopx+e.margin*2,n=r+e.width,i=this.nextData.starty+e.margin*2,a=i+e.height;(r>=this.data.widthLimit||n>=this.data.widthLimit||this.nextData.cnt>Wre)&&(r=this.nextData.startx+e.margin+Jt.nextLinePaddingX,i=this.nextData.stopy+e.margin*2,this.nextData.stopx=n=r+e.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=a=i+e.height,this.nextData.cnt=1),e.x=r,e.y=i,this.updateVal(this.data,"startx",r,Math.min),this.updateVal(this.data,"starty",i,Math.min),this.updateVal(this.data,"stopx",n,Math.max),this.updateVal(this.data,"stopy",a,Math.max),this.updateVal(this.nextData,"startx",r,Math.min),this.updateVal(this.nextData,"starty",i,Math.min),this.updateVal(this.nextData,"stopx",n,Math.max),this.updateVal(this.nextData,"stopy",a,Math.max)}init(e){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},BN(e.db.getConfig())}bumpLastMargin(e){this.data.stopx+=e,this.data.stopy+=e}},BN=o(function(t){Vn(Jt,t),t.fontFamily&&(Jt.personFontFamily=Jt.systemFontFamily=Jt.messageFontFamily=t.fontFamily),t.fontSize&&(Jt.personFontSize=Jt.systemFontSize=Jt.messageFontSize=t.fontSize),t.fontWeight&&(Jt.personFontWeight=Jt.systemFontWeight=Jt.messageFontWeight=t.fontWeight)},"setConf"),Zx=o((t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),"c4ShapeFont"),_k=o(t=>({fontFamily:t.boundaryFontFamily,fontSize:t.boundaryFontSize,fontWeight:t.boundaryFontWeight}),"boundaryFont"),wPe=o(t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),"messageFont");o(gc,"calcC4ShapeTextWH");Hre=o(function(t,e,r){e.x=r.data.startx,e.y=r.data.starty,e.width=r.data.stopx-r.data.startx,e.height=r.data.stopy-r.data.starty,e.label.y=Jt.c4ShapeMargin-35;let n=e.wrap&&Jt.wrap,i=_k(Jt);i.fontSize=i.fontSize+2,i.fontWeight="bold";let a=xa(e.label.text,i);gc("label",e,n,i,a),dc.drawBoundary(t,e,Jt)},"drawBoundary"),Yre=o(function(t,e,r,n){let i=0;for(let a of n){i=0;let s=r[a],l=Zx(Jt,s.typeC4Shape.text);switch(l.fontSize=l.fontSize-2,s.typeC4Shape.width=xa("\xAB"+s.typeC4Shape.text+"\xBB",l),s.typeC4Shape.height=l.fontSize+2,s.typeC4Shape.Y=Jt.c4ShapePadding,i=s.typeC4Shape.Y+s.typeC4Shape.height-4,s.image={width:0,height:0,Y:0},s.typeC4Shape.text){case"person":case"external_person":s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height;break}s.sprite&&(s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height);let u=s.wrap&&Jt.wrap,h=Jt.width-Jt.c4ShapePadding*2,f=Zx(Jt,s.typeC4Shape.text);if(f.fontSize=f.fontSize+2,f.fontWeight="bold",gc("label",s,u,f,h),s.label.Y=i+8,i=s.label.Y+s.label.height,s.type&&s.type.text!==""){s.type.text="["+s.type.text+"]";let m=Zx(Jt,s.typeC4Shape.text);gc("type",s,u,m,h),s.type.Y=i+5,i=s.type.Y+s.type.height}else if(s.techn&&s.techn.text!==""){s.techn.text="["+s.techn.text+"]";let m=Zx(Jt,s.techn.text);gc("techn",s,u,m,h),s.techn.Y=i+5,i=s.techn.Y+s.techn.height}let d=i,p=s.label.width;if(s.descr&&s.descr.text!==""){let m=Zx(Jt,s.typeC4Shape.text);gc("descr",s,u,m,h),s.descr.Y=i+20,i=s.descr.Y+s.descr.height,p=Math.max(s.label.width,s.descr.width),d=i-s.descr.textLines*5}p=p+Jt.c4ShapePadding,s.width=Math.max(s.width||Jt.width,p,Jt.width),s.height=Math.max(s.height||Jt.height,d,Jt.height),s.margin=s.margin||Jt.c4ShapeMargin,t.insert(s),dc.drawC4Shape(e,s,Jt)}t.bumpLastMargin(Jt.c4ShapeMargin)},"drawC4ShapeArray"),so=class{static{o(this,"Point")}constructor(e,r){this.x=e,this.y=r}},Ure=o(function(t,e){let r=t.x,n=t.y,i=e.x,a=e.y,s=r+t.width/2,l=n+t.height/2,u=Math.abs(r-i),h=Math.abs(n-a),f=h/u,d=t.height/t.width,p=null;return n==a&&ri?p=new so(r,l):r==i&&na&&(p=new so(s,n)),r>i&&n=f?p=new so(r,l+f*t.width/2):p=new so(s-u/h*t.height/2,n+t.height):r=f?p=new so(r+t.width,l+f*t.width/2):p=new so(s+u/h*t.height/2,n+t.height):ra?d>=f?p=new so(r+t.width,l-f*t.width/2):p=new so(s+t.height/2*u/h,n):r>i&&n>a&&(d>=f?p=new so(r,l-t.width/2*f):p=new so(s-t.height/2*u/h,n)),p},"getIntersectPoint"),kPe=o(function(t,e){let r={x:0,y:0};r.x=e.x+e.width/2,r.y=e.y+e.height/2;let n=Ure(t,r);r.x=t.x+t.width/2,r.y=t.y+t.height/2;let i=Ure(e,r);return{startPoint:n,endPoint:i}},"getIntersectPoints"),EPe=o(function(t,e,r,n){let i=0;for(let a of e){i=i+1;let s=a.wrap&&Jt.wrap,l=wPe(Jt);n.db.getC4Type()==="C4Dynamic"&&(a.label.text=i+": "+a.label.text);let h=xa(a.label.text,l);gc("label",a,s,l,h),a.techn&&a.techn.text!==""&&(h=xa(a.techn.text,l),gc("techn",a,s,l,h)),a.descr&&a.descr.text!==""&&(h=xa(a.descr.text,l),gc("descr",a,s,l,h));let f=r(a.from),d=r(a.to),p=kPe(f,d);a.startPoint=p.startPoint,a.endPoint=p.endPoint}dc.drawRels(t,e,Jt)},"drawRels");o(jre,"drawInsideBoundary");SPe=o(function(t,e,r,n){Jt=ve().c4;let i=ve().securityLevel,a;i==="sandbox"&&(a=je("#i"+e));let s=i==="sandbox"?je(a.nodes()[0].contentDocument.body):je("body"),l=n.db;n.db.setWrap(Jt.wrap),Wre=l.getC4ShapeInRow(),PN=l.getC4BoundaryInRow(),K.debug(`C:${JSON.stringify(Jt,null,2)}`);let u=i==="sandbox"?s.select(`[id="${e}"]`):je(`[id="${e}"]`);dc.insertComputerIcon(u),dc.insertDatabaseIcon(u),dc.insertClockIcon(u);let h=new Lk(n);h.setData(Jt.diagramMarginX,Jt.diagramMarginX,Jt.diagramMarginY,Jt.diagramMarginY),h.data.widthLimit=screen.availWidth,Dk=Jt.diagramMarginX,Rk=Jt.diagramMarginY;let f=n.db.getTitle(),d=n.db.getBoundaries("");jre(u,"",h,d,n),dc.insertArrowHead(u),dc.insertArrowEnd(u),dc.insertArrowCrossHead(u),dc.insertArrowFilledHead(u),EPe(u,n.db.getRels(),n.db.getC4Shape,n),h.data.stopx=Dk,h.data.stopy=Rk;let p=h.data,g=p.stopy-p.starty+2*Jt.diagramMarginY,v=p.stopx-p.startx+2*Jt.diagramMarginX;f&&u.append("text").text(f).attr("x",(p.stopx-p.startx)/2-4*Jt.diagramMarginX).attr("y",p.starty+Jt.diagramMarginY),Zr(u,g,v,Jt.useMaxWidth);let x=f?60:0;u.attr("viewBox",p.startx-Jt.diagramMarginX+" -"+(Jt.diagramMarginY+x)+" "+v+" "+(g+x)),K.debug("models:",p)},"draw"),FN={drawPersonOrSystemArray:Yre,drawBoundary:Hre,setConf:BN,draw:SPe}});var CPe,Kre,Qre=O(()=>{"use strict";CPe=o(t=>`.person {
+`},"getStyles"),jK=o((t,e)=>{e!==void 0&&(tw[t]=e)},"addStylesForDiagram"),XK=fRe});var e2={};ur(e2,{clear:()=>wr,getAccDescription:()=>Rr,getAccTitle:()=>Dr,getDiagramTitle:()=>Nr,setAccDescription:()=>Lr,setAccTitle:()=>Ar,setDiagramTitle:()=>Mr});var fL,dL,pL,mL,wr,Ar,Dr,Lr,Rr,Mr,Nr,Ki=P(()=>{"use strict";Vr();Sr();fL="",dL="",pL="",mL=o(t=>Tr(t,Lt()),"sanitizeText"),wr=o(()=>{fL="",pL="",dL=""},"clear"),Ar=o(t=>{fL=mL(t).replace(/^\s+/g,"")},"setAccTitle"),Dr=o(()=>fL,"getAccTitle"),Lr=o(t=>{pL=mL(t).replace(/\n\s+/g,`
+`)},"setAccDescription"),Rr=o(()=>pL,"getAccDescription"),Mr=o(t=>{dL=mL(t)},"setDiagramTitle"),Nr=o(()=>dL,"getDiagramTitle")});var KK,dRe,ge,t2,iw,r2,yL,pRe,rw,Qp,i2,gL,Ut=P(()=>{"use strict";Kp();bt();Sr();Vr();Xi();hL();Ki();KK=Q,dRe=_x,ge=Lt,t2=x4,iw=Nf,r2=o(t=>Tr(t,ge()),"sanitizeText"),yL=El,pRe=o(()=>e2,"getCommonDb"),rw={},Qp=o((t,e,r)=>{rw[t]&&KK.warn(`Diagram with id ${t} already registered. Overwriting.`),rw[t]=e,r&&cL(t,r),jK(t,e.styles),e.injectUtils?.(KK,dRe,ge,r2,yL,pRe(),()=>{})},"registerDiagram"),i2=o(t=>{if(t in rw)return rw[t];throw new gL(t)},"getDiagram"),gL=class extends Error{static{o(this,"DiagramNotFoundError")}constructor(e){super(`Diagram ${e} not found.`)}}});var fc,Ff,Bs,hc,cu,n2,vL,xL,nw,aw,QK,mRe,gRe,yRe,vRe,xRe,bRe,TRe,kRe,CRe,wRe,ERe,SRe,ARe,_Re,DRe,LRe,RRe,ZK,NRe,IRe,JK,MRe,ORe,PRe,BRe,$f,FRe,$Re,zRe,GRe,VRe,a2,bL=P(()=>{"use strict";Ut();Vr();Ki();fc=[],Ff=[""],Bs="global",hc="",cu=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],n2=[],vL="",xL=!1,nw=4,aw=2,mRe=o(function(){return QK},"getC4Type"),gRe=o(function(t){QK=Tr(t,ge())},"setC4Type"),yRe=o(function(t,e,r,i,n,a,s,l,u){if(t==null||e===void 0||e===null||r===void 0||r===null||i===void 0||i===null)return;let h={},f=n2.find(d=>d.from===e&&d.to===r);if(f?h=f:n2.push(h),h.type=t,h.from=e,h.to=r,h.label={text:i},n==null)h.techn={text:""};else if(typeof n=="object"){let[d,p]=Object.entries(n)[0];h[d]={text:p}}else h.techn={text:n};if(a==null)h.descr={text:""};else if(typeof a=="object"){let[d,p]=Object.entries(a)[0];h[d]={text:p}}else h.descr={text:a};if(typeof s=="object"){let[d,p]=Object.entries(s)[0];h[d]=p}else h.sprite=s;if(typeof l=="object"){let[d,p]=Object.entries(l)[0];h[d]=p}else h.tags=l;if(typeof u=="object"){let[d,p]=Object.entries(u)[0];h[d]=p}else h.link=u;h.wrap=$f()},"addRel"),vRe=o(function(t,e,r,i,n,a,s){if(e===null||r===null)return;let l={},u=fc.find(h=>h.alias===e);if(u&&e===u.alias?l=u:(l.alias=e,fc.push(l)),r==null?l.label={text:""}:l.label={text:r},i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]=f}else l.sprite=n;if(typeof a=="object"){let[h,f]=Object.entries(a)[0];l[h]=f}else l.tags=a;if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.link=s;l.typeC4Shape={text:t},l.parentBoundary=Bs,l.wrap=$f()},"addPersonOrSystem"),xRe=o(function(t,e,r,i,n,a,s,l){if(e===null||r===null)return;let u={},h=fc.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,fc.push(u)),r==null?u.label={text:""}:u.label={text:r},i==null)u.techn={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.techn={text:i};if(n==null)u.descr={text:""};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.descr={text:n};if(typeof a=="object"){let[f,d]=Object.entries(a)[0];u[f]=d}else u.sprite=a;if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.tags=s;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.wrap=$f(),u.typeC4Shape={text:t},u.parentBoundary=Bs},"addContainer"),bRe=o(function(t,e,r,i,n,a,s,l){if(e===null||r===null)return;let u={},h=fc.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,fc.push(u)),r==null?u.label={text:""}:u.label={text:r},i==null)u.techn={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.techn={text:i};if(n==null)u.descr={text:""};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.descr={text:n};if(typeof a=="object"){let[f,d]=Object.entries(a)[0];u[f]=d}else u.sprite=a;if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.tags=s;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.wrap=$f(),u.typeC4Shape={text:t},u.parentBoundary=Bs},"addComponent"),TRe=o(function(t,e,r,i,n){if(t===null||e===null)return;let a={},s=cu.find(l=>l.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,cu.push(a)),e==null?a.label={text:""}:a.label={text:e},r==null)a.type={text:"system"};else if(typeof r=="object"){let[l,u]=Object.entries(r)[0];a[l]={text:u}}else a.type={text:r};if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.tags=i;if(typeof n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.link=n;a.parentBoundary=Bs,a.wrap=$f(),hc=Bs,Bs=t,Ff.push(hc)},"addPersonOrSystemBoundary"),kRe=o(function(t,e,r,i,n){if(t===null||e===null)return;let a={},s=cu.find(l=>l.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,cu.push(a)),e==null?a.label={text:""}:a.label={text:e},r==null)a.type={text:"container"};else if(typeof r=="object"){let[l,u]=Object.entries(r)[0];a[l]={text:u}}else a.type={text:r};if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.tags=i;if(typeof n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.link=n;a.parentBoundary=Bs,a.wrap=$f(),hc=Bs,Bs=t,Ff.push(hc)},"addContainerBoundary"),CRe=o(function(t,e,r,i,n,a,s,l){if(e===null||r===null)return;let u={},h=cu.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,cu.push(u)),r==null?u.label={text:""}:u.label={text:r},i==null)u.type={text:"node"};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.type={text:i};if(n==null)u.descr={text:""};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.descr={text:n};if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.tags=s;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.nodeType=t,u.parentBoundary=Bs,u.wrap=$f(),hc=Bs,Bs=e,Ff.push(hc)},"addDeploymentNode"),wRe=o(function(){Bs=hc,Ff.pop(),hc=Ff.pop(),Ff.push(hc)},"popBoundaryParseStack"),ERe=o(function(t,e,r,i,n,a,s,l,u,h,f){let d=fc.find(p=>p.alias===e);if(!(d===void 0&&(d=cu.find(p=>p.alias===e),d===void 0))){if(r!=null)if(typeof r=="object"){let[p,m]=Object.entries(r)[0];d[p]=m}else d.bgColor=r;if(i!=null)if(typeof i=="object"){let[p,m]=Object.entries(i)[0];d[p]=m}else d.fontColor=i;if(n!=null)if(typeof n=="object"){let[p,m]=Object.entries(n)[0];d[p]=m}else d.borderColor=n;if(a!=null)if(typeof a=="object"){let[p,m]=Object.entries(a)[0];d[p]=m}else d.shadowing=a;if(s!=null)if(typeof s=="object"){let[p,m]=Object.entries(s)[0];d[p]=m}else d.shape=s;if(l!=null)if(typeof l=="object"){let[p,m]=Object.entries(l)[0];d[p]=m}else d.sprite=l;if(u!=null)if(typeof u=="object"){let[p,m]=Object.entries(u)[0];d[p]=m}else d.techn=u;if(h!=null)if(typeof h=="object"){let[p,m]=Object.entries(h)[0];d[p]=m}else d.legendText=h;if(f!=null)if(typeof f=="object"){let[p,m]=Object.entries(f)[0];d[p]=m}else d.legendSprite=f}},"updateElStyle"),SRe=o(function(t,e,r,i,n,a,s){let l=n2.find(u=>u.from===e&&u.to===r);if(l!==void 0){if(i!=null)if(typeof i=="object"){let[u,h]=Object.entries(i)[0];l[u]=h}else l.textColor=i;if(n!=null)if(typeof n=="object"){let[u,h]=Object.entries(n)[0];l[u]=h}else l.lineColor=n;if(a!=null)if(typeof a=="object"){let[u,h]=Object.entries(a)[0];l[u]=parseInt(h)}else l.offsetX=parseInt(a);if(s!=null)if(typeof s=="object"){let[u,h]=Object.entries(s)[0];l[u]=parseInt(h)}else l.offsetY=parseInt(s)}},"updateRelStyle"),ARe=o(function(t,e,r){let i=nw,n=aw;if(typeof e=="object"){let a=Object.values(e)[0];i=parseInt(a)}else i=parseInt(e);if(typeof r=="object"){let a=Object.values(r)[0];n=parseInt(a)}else n=parseInt(r);i>=1&&(nw=i),n>=1&&(aw=n)},"updateLayoutConfig"),_Re=o(function(){return nw},"getC4ShapeInRow"),DRe=o(function(){return aw},"getC4BoundaryInRow"),LRe=o(function(){return Bs},"getCurrentBoundaryParse"),RRe=o(function(){return hc},"getParentBoundaryParse"),ZK=o(function(t){return t==null?fc:fc.filter(e=>e.parentBoundary===t)},"getC4ShapeArray"),NRe=o(function(t){return fc.find(e=>e.alias===t)},"getC4Shape"),IRe=o(function(t){return Object.keys(ZK(t))},"getC4ShapeKeys"),JK=o(function(t){return t==null?cu:cu.filter(e=>e.parentBoundary===t)},"getBoundaries"),MRe=JK,ORe=o(function(){return n2},"getRels"),PRe=o(function(){return vL},"getTitle"),BRe=o(function(t){xL=t},"setWrap"),$f=o(function(){return xL},"autoWrap"),FRe=o(function(){fc=[],cu=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],hc="",Bs="global",Ff=[""],n2=[],Ff=[""],vL="",xL=!1,nw=4,aw=2},"clear"),$Re={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},zRe={FILLED:0,OPEN:1},GRe={LEFTOF:0,RIGHTOF:1,OVER:2},VRe=o(function(t){vL=Tr(t,ge())},"setTitle"),a2={addPersonOrSystem:vRe,addPersonOrSystemBoundary:TRe,addContainer:xRe,addContainerBoundary:kRe,addComponent:bRe,addDeploymentNode:CRe,popBoundaryParseStack:wRe,addRel:yRe,updateElStyle:ERe,updateRelStyle:SRe,updateLayoutConfig:ARe,autoWrap:$f,setWrap:BRe,getC4ShapeArray:ZK,getC4Shape:NRe,getC4ShapeKeys:IRe,getBoundaries:JK,getBoundarys:MRe,getCurrentBoundaryParse:LRe,getParentBoundaryParse:RRe,getRels:ORe,getTitle:PRe,getC4Type:mRe,getC4ShapeInRow:_Re,getC4BoundaryInRow:DRe,setAccTitle:Ar,getAccTitle:Dr,getAccDescription:Rr,setAccDescription:Lr,getConfig:o(()=>ge().c4,"getConfig"),clear:FRe,LINETYPE:$Re,ARROWTYPE:zRe,PLACEMENT:GRe,setTitle:VRe,setC4Type:gRe}});function Zp(t,e){return t==null||e==null?NaN:t0)for(var r=new Array(n),i=0,n,a;i{"use strict";dc();o(KL,"default")});function QL(){for(var t=this._groups,e=-1,r=t.length;++e