b&&(b=h),E=v*v*w,T=Math.max(b/E,E/x),T>C){v-=h;break}C=T}s.push(u={value:v,dice:m Ki))l.moveTo(0,0);else if(v>V0-Ki)l.moveTo(m*Lh(g),m*wl(g)),l.arc(0,0,m,g,y,!x),p>Ki&&(l.moveTo(p*Lh(y),p*wl(y)),l.arc(0,0,p,y,g,x));else{var b=g,T=y,C=g,w=y,E=v,_=v,A=s.apply(this,arguments)/2,D=A>Ki&&(n?+n.apply(this,arguments):Ed(p*p+m*m)),O=z5(ID(m-p)/2,+r.apply(this,arguments)),R=O,k=O,L,S;if(D>Ki){var I=OD(D/p*wl(A)),M=OD(D/m*wl(A));(E-=I*2)>Ki?(I*=x?1:-1,C+=I,w-=I):(E=0,C=w=(g+y)/2),(_-=M*2)>Ki?(M*=x?1:-1,b+=M,T-=M):(_=0,b=T=(g+y)/2)}var P=m*Lh(b),B=m*wl(b),F=p*Lh(w),z=p*wl(w);if(O>Ki){var $=m*Lh(T),U=m*wl(T),K=p*Lh(C),ee=p*wl(C),Y;if(v0;){if(h=av(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 xl(){var t=Rv();return t.copy=function(){return _5(t,xl())},Ah.apply(t,arguments),Rke(t)}var xq=N(()=>{"use strict";bh();fD();Lv();vq();o(Rke,"linearish");o(xl,"linear")});function pD(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],a=t[n],s;return a{"use strict";o(pD,"nice")});function vn(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(hvn(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)=>(mD.setTime(+a),gD.setTime(+s),t(mD),t(gD),Math.floor(r(mD,gD))),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 mD,gD,xu=N(()=>{"use strict";mD=new Date,gD=new Date;o(vn,"timeInterval")});var lc,Tq,yD=N(()=>{"use strict";xu();lc=vn(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);lc.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?vn(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):lc);Tq=lc.range});var Zs,wq,vD=N(()=>{"use strict";xu();Zs=vn(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),wq=Zs.range});var bu,Nke,D5,Mke,xD=N(()=>{"use strict";xu();bu=vn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),Nke=bu.range,D5=vn(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),Mke=D5.range});var Tu,Ike,L5,Oke,bD=N(()=>{"use strict";xu();Tu=vn(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()),Ike=Tu.range,L5=vn(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),Oke=L5.range});var Do,Pke,Mv,Bke,R5,Fke,TD=N(()=>{"use strict";xu();Do=vn(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),Pke=Do.range,Mv=vn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),Bke=Mv.range,R5=vn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),Fke=R5.range});function bd(t){return vn(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 Td(t){return vn(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 bl,_h,N5,M5,uc,I5,O5,Eq,$ke,zke,Gke,Vke,Uke,Hke,wd,$0,Sq,Cq,Dh,Aq,_q,Dq,Wke,qke,Yke,Xke,jke,Kke,wD=N(()=>{"use strict";xu();o(bd,"timeWeekday");bl=bd(0),_h=bd(1),N5=bd(2),M5=bd(3),uc=bd(4),I5=bd(5),O5=bd(6),Eq=bl.range,$ke=_h.range,zke=N5.range,Gke=M5.range,Vke=uc.range,Uke=I5.range,Hke=O5.range;o(Td,"utcWeekday");wd=Td(0),$0=Td(1),Sq=Td(2),Cq=Td(3),Dh=Td(4),Aq=Td(5),_q=Td(6),Dq=wd.range,Wke=$0.range,qke=Sq.range,Yke=Cq.range,Xke=Dh.range,jke=Aq.range,Kke=_q.range});var wu,Qke,P5,Zke,kD=N(()=>{"use strict";xu();wu=vn(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()),Qke=wu.range,P5=vn(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()),Zke=P5.range});var Js,Jke,Tl,eEe,ED=N(()=>{"use strict";xu();Js=vn(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());Js.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:vn(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)});Jke=Js.range,Tl=vn(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());Tl.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:vn(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)});eEe=Tl.range});function Rq(t,e,r,n,i,a){let s=[[Zs,1,1e3],[Zs,5,5*1e3],[Zs,15,15*1e3],[Zs,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";bh();yD();vD();xD();bD();TD();wD();kD();ED();o(Rq,"ticker");[rEe,nEe]=Rq(Tl,P5,wd,R5,L5,D5),[SD,CD]=Rq(Js,wu,bl,Do,Tu,bu)});var B5=N(()=>{"use strict";yD();vD();xD();bD();TD();wD();kD();ED();Nq()});function AD(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 _D(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 Iv(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function DD(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=Ov(i),f=Pv(i),d=Ov(a),p=Pv(a),m=Ov(s),g=Pv(s),y=Ov(l),v=Pv(l),x=Ov(u),b=Pv(u),T={a:P,A:B,b:F,B:z,c:null,d:Fq,e:Fq,f:CEe,g:PEe,G:FEe,H:kEe,I:EEe,j:SEe,L:Uq,m:AEe,M:_Ee,p:$,q:U,Q:Gq,s:Vq,S:DEe,u:LEe,U:REe,V:NEe,w:MEe,W:IEe,x:null,X:null,y:OEe,Y:BEe,Z:$Ee,"%":zq},C={a:K,A:ee,b:Y,B:ce,c:null,d:$q,e:$q,f:UEe,g:JEe,G:tSe,H:zEe,I:GEe,j:VEe,L:Wq,m:HEe,M:WEe,p:Z,q:ue,Q:Gq,s:Vq,S:qEe,u:YEe,U:XEe,V:jEe,w:KEe,W:QEe,x:null,X:null,y:ZEe,Y:eSe,Z:rSe,"%":zq},w={a:O,A:R,b:k,B:L,c:S,d:Pq,e:Pq,f:xEe,g:Oq,G:Iq,H:Bq,I:Bq,j:mEe,L:vEe,m:pEe,M:gEe,p:D,q:dEe,Q:TEe,s:wEe,S:yEe,u:lEe,U:cEe,V:uEe,w:oEe,W:hEe,x:I,X:M,y:Oq,Y:Iq,Z:fEe,"%":bEe};T.x=E(r,T),T.X=E(n,T),T.c=E(e,T),C.x=E(r,C),C.X=E(n,C),C.c=E(e,C);function E(Q,j){return function(ne){var te=[],he=-1,le=0,J=Q.length,Se,se,ae;for(ne instanceof Date||(ne=new Date(+ne));++he{"use strict";cm();em();o(s7e,"copyObject");Bo=s7e});function o7e(t,e){for(var r=-1,n=Array(t);++r
"},r),Ze.lineBreakRegex.test(t)))return t;let n=t.split(" ").filter(Boolean),i=[],a="";return n.forEach((s,l)=>{let u=ea(`${s} `,r),h=ea(a,r);if(u>e){let{hyphenatedStrings:p,remainingWord:m}=X7e(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}`),X7e=Q0((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(ea(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(kT,"calculateTextHeight");o(ea,"calculateTextWidth");L9=Q0((t,e)=>{let{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};let[,a]=Fo(r),s=["sans-serif",n],l=t.split(Ze.lineBreakRegex),u=[],h=Ge("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=q7e();v.text=y||k9;let x=Y7e(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}`),w9=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")}},j7e=o(function(t){return wT=wT||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),wT.innerHTML=t,unescape(wT.textContent)},"entityDecode");o(R9,"isDetailedError");K7e=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"),Fo=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(Fn,"cleanAndMerge");Vt={assignWithDepth:Gn,wrapLabel:D9,calculateTextHeight:kT,calculateTextWidth:ea,calculateTextDimensions:L9,cleanAndMerge:Fn,detectInit:B7e,detectDirective:Xj,isSubstringInArray:F7e,interpolateToCurve:E9,calcLabelPosition:V7e,calcCardinalityPosition:U7e,calcTerminalLabelPosition:H7e,formatUrl:$7e,getStylesFromArray:C9,generateId:A9,random:_9,runFunc:z7e,entityDecode:j7e,insertTitle:K7e,isLabelCoordinateInPath:Q7e,parseFontSize:Fo,InitIDGenerator:w9},Qj=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"),ta=o(function(t){return t.replace(/fl°°/g,"").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),Gh=o((t,e,{counter:r=0,prefix:n,suffix:i},a)=>a||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");o(ii,"handleUndefinedAttr");o(Q7e,"isLabelCoordinateInPath")});function Dl(t,e,r,n,i){if(!e[t].width)if(r)e[t].text=D9(e[t].text,i,n),e[t].textLines=e[t].text.split(Ze.lineBreakRegex).length,e[t].width=i,e[t].height=kT(e[t].text,n);else{let a=e[t].text.split(Ze.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(ea(l,n),e[t].width),s=kT(l,n),e[t].height=e[t].height+s}}function rK(t,e,r,n,i){let a=new AT(i);a.data.widthLimit=r.data.widthLimit/Math.min(N9,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&&Ut.wrap,f=ET(Ut);if(f.fontSize=f.fontSize+2,f.fontWeight="bold",Dl("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=ET(Ut);Dl("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=ET(Ut);g.fontSize=g.fontSize-2,Dl("descr",l,h,g,a.data.widthLimit),l.descr.Y=u+20,u=l.descr.Y+l.descr.height}if(s==0||s%N9===0){let g=r.data.startx+Ut.diagramMarginX,y=r.data.stopy+Ut.diagramMarginY+u;a.setData(g,g,y,y)}else{let g=a.data.stopx!==a.data.startx?a.data.stopx+Ut.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&&tK(a,t,d,p),e=l.alias;let m=i.db.getBoundaries(e);m.length>0&&rK(t,e,a,m,i),l.alias!=="global"&&eK(t,l,a),r.data.stopy=Math.max(a.data.stopy+Ut.c4ShapeMargin,r.data.stopy),r.data.stopx=Math.max(a.data.stopx+Ut.c4ShapeMargin,r.data.stopx),ST=Math.max(ST,r.data.stopx),CT=Math.max(CT,r.data.stopy)}}var ST,CT,Jj,N9,Ut,AT,M9,d2,ET,Z7e,eK,tK,Ds,Zj,J7e,eAe,tAe,I9,nK=N(()=>{"use strict";pr();ZY();yt();yA();dr();AA();qt();c0();nr();yi();ST=0,CT=0,Jj=4,N9=2;Zy.yy=iv;Ut={},AT=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,M9(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>Jj)&&(r=this.nextData.startx+e.margin+Ut.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},M9(e.db.getConfig())}bumpLastMargin(e){this.data.stopx+=e,this.data.stopy+=e}},M9=o(function(t){Gn(Ut,t),t.fontFamily&&(Ut.personFontFamily=Ut.systemFontFamily=Ut.messageFontFamily=t.fontFamily),t.fontSize&&(Ut.personFontSize=Ut.systemFontSize=Ut.messageFontSize=t.fontSize),t.fontWeight&&(Ut.personFontWeight=Ut.systemFontWeight=Ut.messageFontWeight=t.fontWeight)},"setConf"),d2=o((t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),"c4ShapeFont"),ET=o(t=>({fontFamily:t.boundaryFontFamily,fontSize:t.boundaryFontSize,fontWeight:t.boundaryFontWeight}),"boundaryFont"),Z7e=o(t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),"messageFont");o(Dl,"calcC4ShapeTextWH");eK=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=Ut.c4ShapeMargin-35;let n=e.wrap&&Ut.wrap,i=ET(Ut);i.fontSize=i.fontSize+2,i.fontWeight="bold";let a=ea(e.label.text,i);Dl("label",e,n,i,a),Cl.drawBoundary(t,e,Ut)},"drawBoundary"),tK=o(function(t,e,r,n){let i=0;for(let a of n){i=0;let s=r[a],l=d2(Ut,s.typeC4Shape.text);switch(l.fontSize=l.fontSize-2,s.typeC4Shape.width=ea("\xAB"+s.typeC4Shape.text+"\xBB",l),s.typeC4Shape.height=l.fontSize+2,s.typeC4Shape.Y=Ut.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&&Ut.wrap,h=Ut.width-Ut.c4ShapePadding*2,f=d2(Ut,s.typeC4Shape.text);if(f.fontSize=f.fontSize+2,f.fontWeight="bold",Dl("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=d2(Ut,s.typeC4Shape.text);Dl("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=d2(Ut,s.techn.text);Dl("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=d2(Ut,s.typeC4Shape.text);Dl("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+Ut.c4ShapePadding,s.width=Math.max(s.width||Ut.width,p,Ut.width),s.height=Math.max(s.height||Ut.height,d,Ut.height),s.margin=s.margin||Ut.c4ShapeMargin,t.insert(s),Cl.drawC4Shape(e,s,Ut)}t.bumpLastMargin(Ut.c4ShapeMargin)},"drawC4ShapeArray"),Ds=class{static{o(this,"Point")}constructor(e,r){this.x=e,this.y=r}},Zj=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 Ds(r,l):r==i&&na&&(p=new Ds(s,n)),r>i&&n=f?p=new Ds(r,l+f*t.width/2):p=new Ds(s-u/h*t.height/2,n+t.height):r=f?p=new Ds(r+t.width,l+f*t.width/2):p=new Ds(s+u/h*t.height/2,n+t.height):ra?d>=f?p=new Ds(r+t.width,l-f*t.width/2):p=new Ds(s+t.height/2*u/h,n):r>i&&n>a&&(d>=f?p=new Ds(r,l-t.width/2*f):p=new Ds(s-t.height/2*u/h,n)),p},"getIntersectPoint"),J7e=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=Zj(t,r);r.x=t.x+t.width/2,r.y=t.y+t.height/2;let i=Zj(e,r);return{startPoint:n,endPoint:i}},"getIntersectPoints"),eAe=o(function(t,e,r,n){let i=0;for(let a of e){i=i+1;let s=a.wrap&&Ut.wrap,l=Z7e(Ut);n.db.getC4Type()==="C4Dynamic"&&(a.label.text=i+": "+a.label.text);let h=ea(a.label.text,l);Dl("label",a,s,l,h),a.techn&&a.techn.text!==""&&(h=ea(a.techn.text,l),Dl("techn",a,s,l,h)),a.descr&&a.descr.text!==""&&(h=ea(a.descr.text,l),Dl("descr",a,s,l,h));let f=r(a.from),d=r(a.to),p=J7e(f,d);a.startPoint=p.startPoint,a.endPoint=p.endPoint}Cl.drawRels(t,e,Ut)},"drawRels");o(rK,"drawInsideBoundary");tAe=o(function(t,e,r,n){Ut=ge().c4;let i=ge().securityLevel,a;i==="sandbox"&&(a=Ge("#i"+e));let s=i==="sandbox"?Ge(a.nodes()[0].contentDocument.body):Ge("body"),l=n.db;n.db.setWrap(Ut.wrap),Jj=l.getC4ShapeInRow(),N9=l.getC4BoundaryInRow(),X.debug(`C:${JSON.stringify(Ut,null,2)}`);let u=i==="sandbox"?s.select(`[id="${e}"]`):Ge(`[id="${e}"]`);Cl.insertComputerIcon(u),Cl.insertDatabaseIcon(u),Cl.insertClockIcon(u);let h=new AT(n);h.setData(Ut.diagramMarginX,Ut.diagramMarginX,Ut.diagramMarginY,Ut.diagramMarginY),h.data.widthLimit=screen.availWidth,ST=Ut.diagramMarginX,CT=Ut.diagramMarginY;let f=n.db.getTitle(),d=n.db.getBoundaries("");rK(u,"",h,d,n),Cl.insertArrowHead(u),Cl.insertArrowEnd(u),Cl.insertArrowCrossHead(u),Cl.insertArrowFilledHead(u),eAe(u,n.db.getRels(),n.db.getC4Shape,n),h.data.stopx=ST,h.data.stopy=CT;let p=h.data,g=p.stopy-p.starty+2*Ut.diagramMarginY,v=p.stopx-p.startx+2*Ut.diagramMarginX;f&&u.append("text").text(f).attr("x",(p.stopx-p.startx)/2-4*Ut.diagramMarginX).attr("y",p.starty+Ut.diagramMarginY),hn(u,g,v,Ut.useMaxWidth);let x=f?60:0;u.attr("viewBox",p.startx-Ut.diagramMarginX+" -"+(Ut.diagramMarginY+x)+" "+v+" "+(g+x)),X.debug("models:",p)},"draw"),I9={drawPersonOrSystemArray:tK,drawBoundary:eK,setConf:M9,draw:tAe}});var rAe,iK,aK=N(()=>{"use strict";rAe=o(t=>`.person {
+`},"getStyles"),BV=o((t,e)=>{e!==void 0&&(F3[t]=e)},"addStylesForDiagram"),FV=E5e});var ev={};ur(ev,{clear:()=>wr,getAccDescription:()=>Lr,getAccTitle:()=>_r,getDiagramTitle:()=>Rr,setAccDescription:()=>Dr,setAccTitle:()=>Cr,setDiagramTitle:()=>Or});var AA,_A,DA,LA,wr,Cr,_r,Dr,Lr,Or,Rr,ui=N(()=>{"use strict";dr();Wn();AA="",_A="",DA="",LA=o(t=>ar(t,Qt()),"sanitizeText"),wr=o(()=>{AA="",DA="",_A=""},"clear"),Cr=o(t=>{AA=LA(t).replace(/^\s+/g,"")},"setAccTitle"),_r=o(()=>AA,"getAccTitle"),Dr=o(t=>{DA=LA(t).replace(/\n\s+/g,`
+`)},"setAccDescription"),Lr=o(()=>DA,"getAccDescription"),Or=o(t=>{_A=LA(t)},"setDiagramTitle"),Rr=o(()=>_A,"getDiagramTitle")});var $V,S5e,ge,tv,G3,rv,NA,C5e,$3,md,nv,RA,Xt=N(()=>{"use strict";pd();pt();Wn();dr();Ci();CA();ui();$V=X,S5e=Ay,ge=Qt,tv=r3,G3=dh,rv=o(t=>ar(t,ge()),"sanitizeText"),NA=nc,C5e=o(()=>ev,"getCommonDb"),$3={},md=o((t,e,r)=>{$3[t]&&$V.warn(`Diagram with id ${t} already registered. Overwriting.`),$3[t]=e,r&&EA(t,r),BV(t,e.styles),e.injectUtils?.($V,S5e,ge,rv,NA,C5e(),()=>{})},"registerDiagram"),nv=o(t=>{if(t in $3)return $3[t];throw new RA(t)},"getDiagram"),RA=class extends Error{static{o(this,"DiagramNotFoundError")}constructor(e){super(`Diagram ${e} not found.`)}}});var ml,Th,ns,pl,ic,iv,MA,IA,z3,V3,GV,A5e,_5e,D5e,L5e,R5e,N5e,M5e,I5e,O5e,P5e,B5e,F5e,$5e,G5e,z5e,V5e,U5e,zV,H5e,W5e,VV,q5e,Y5e,X5e,j5e,wh,K5e,Q5e,Z5e,J5e,eTe,av,OA=N(()=>{"use strict";Xt();dr();ui();ml=[],Th=[""],ns="global",pl="",ic=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],iv=[],MA="",IA=!1,z3=4,V3=2,A5e=o(function(){return GV},"getC4Type"),_5e=o(function(t){GV=ar(t,ge())},"setC4Type"),D5e=o(function(t,e,r,n,i,a,s,l,u){if(t==null||e===void 0||e===null||r===void 0||r===null||n===void 0||n===null)return;let h={},f=iv.find(d=>d.from===e&&d.to===r);if(f?h=f:iv.push(h),h.type=t,h.from=e,h.to=r,h.label={text:n},i==null)h.techn={text:""};else if(typeof i=="object"){let[d,p]=Object.entries(i)[0];h[d]={text:p}}else h.techn={text:i};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=wh()},"addRel"),L5e=o(function(t,e,r,n,i,a,s){if(e===null||r===null)return;let l={},u=ml.find(h=>h.alias===e);if(u&&e===u.alias?l=u:(l.alias=e,ml.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.descr={text:""};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.descr={text:n};if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]=f}else l.sprite=i;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=ns,l.wrap=wh()},"addPersonOrSystem"),R5e=o(function(t,e,r,n,i,a,s,l){if(e===null||r===null)return;let u={},h=ml.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,ml.push(u)),r==null?u.label={text:""}:u.label={text:r},n==null)u.techn={text:""};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.techn={text:n};if(i==null)u.descr={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.descr={text:i};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=wh(),u.typeC4Shape={text:t},u.parentBoundary=ns},"addContainer"),N5e=o(function(t,e,r,n,i,a,s,l){if(e===null||r===null)return;let u={},h=ml.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,ml.push(u)),r==null?u.label={text:""}:u.label={text:r},n==null)u.techn={text:""};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.techn={text:n};if(i==null)u.descr={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.descr={text:i};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=wh(),u.typeC4Shape={text:t},u.parentBoundary=ns},"addComponent"),M5e=o(function(t,e,r,n,i){if(t===null||e===null)return;let a={},s=ic.find(l=>l.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,ic.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 n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.tags=n;if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.link=i;a.parentBoundary=ns,a.wrap=wh(),pl=ns,ns=t,Th.push(pl)},"addPersonOrSystemBoundary"),I5e=o(function(t,e,r,n,i){if(t===null||e===null)return;let a={},s=ic.find(l=>l.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,ic.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 n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.tags=n;if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.link=i;a.parentBoundary=ns,a.wrap=wh(),pl=ns,ns=t,Th.push(pl)},"addContainerBoundary"),O5e=o(function(t,e,r,n,i,a,s,l){if(e===null||r===null)return;let u={},h=ic.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,ic.push(u)),r==null?u.label={text:""}:u.label={text:r},n==null)u.type={text:"node"};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.type={text:n};if(i==null)u.descr={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.descr={text:i};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=ns,u.wrap=wh(),pl=ns,ns=e,Th.push(pl)},"addDeploymentNode"),P5e=o(function(){ns=pl,Th.pop(),pl=Th.pop(),Th.push(pl)},"popBoundaryParseStack"),B5e=o(function(t,e,r,n,i,a,s,l,u,h,f){let d=ml.find(p=>p.alias===e);if(!(d===void 0&&(d=ic.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(n!=null)if(typeof n=="object"){let[p,m]=Object.entries(n)[0];d[p]=m}else d.fontColor=n;if(i!=null)if(typeof i=="object"){let[p,m]=Object.entries(i)[0];d[p]=m}else d.borderColor=i;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"),F5e=o(function(t,e,r,n,i,a,s){let l=iv.find(u=>u.from===e&&u.to===r);if(l!==void 0){if(n!=null)if(typeof n=="object"){let[u,h]=Object.entries(n)[0];l[u]=h}else l.textColor=n;if(i!=null)if(typeof i=="object"){let[u,h]=Object.entries(i)[0];l[u]=h}else l.lineColor=i;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"),$5e=o(function(t,e,r){let n=z3,i=V3;if(typeof e=="object"){let a=Object.values(e)[0];n=parseInt(a)}else n=parseInt(e);if(typeof r=="object"){let a=Object.values(r)[0];i=parseInt(a)}else i=parseInt(r);n>=1&&(z3=n),i>=1&&(V3=i)},"updateLayoutConfig"),G5e=o(function(){return z3},"getC4ShapeInRow"),z5e=o(function(){return V3},"getC4BoundaryInRow"),V5e=o(function(){return ns},"getCurrentBoundaryParse"),U5e=o(function(){return pl},"getParentBoundaryParse"),zV=o(function(t){return t==null?ml:ml.filter(e=>e.parentBoundary===t)},"getC4ShapeArray"),H5e=o(function(t){return ml.find(e=>e.alias===t)},"getC4Shape"),W5e=o(function(t){return Object.keys(zV(t))},"getC4ShapeKeys"),VV=o(function(t){return t==null?ic:ic.filter(e=>e.parentBoundary===t)},"getBoundaries"),q5e=VV,Y5e=o(function(){return iv},"getRels"),X5e=o(function(){return MA},"getTitle"),j5e=o(function(t){IA=t},"setWrap"),wh=o(function(){return IA},"autoWrap"),K5e=o(function(){ml=[],ic=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],pl="",ns="global",Th=[""],iv=[],Th=[""],MA="",IA=!1,z3=4,V3=2},"clear"),Q5e={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},Z5e={FILLED:0,OPEN:1},J5e={LEFTOF:0,RIGHTOF:1,OVER:2},eTe=o(function(t){MA=ar(t,ge())},"setTitle"),av={addPersonOrSystem:L5e,addPersonOrSystemBoundary:M5e,addContainer:R5e,addContainerBoundary:I5e,addComponent:N5e,addDeploymentNode:O5e,popBoundaryParseStack:P5e,addRel:D5e,updateElStyle:B5e,updateRelStyle:F5e,updateLayoutConfig:$5e,autoWrap:wh,setWrap:j5e,getC4ShapeArray:zV,getC4Shape:H5e,getC4ShapeKeys:W5e,getBoundaries:VV,getBoundarys:q5e,getCurrentBoundaryParse:V5e,getParentBoundaryParse:U5e,getRels:Y5e,getTitle:X5e,getC4Type:A5e,getC4ShapeInRow:G5e,getC4BoundaryInRow:z5e,setAccTitle:Cr,getAccTitle:_r,getAccDescription:Lr,setAccDescription:Dr,getConfig:o(()=>ge().c4,"getConfig"),clear:K5e,LINETYPE:Q5e,ARROWTYPE:Z5e,PLACEMENT:J5e,setTitle:eTe,setC4Type:_5e}});function gd(t,e){return t==null||e==null?NaN:t0)for(var r=new Array(i),n=0,i,a;n{"use strict";oU()});var Q3,XA,jA=N(()=>{"use strict";Q3="http://www.w3.org/1999/xhtml",XA={svg:"http://www.w3.org/2000/svg",xhtml:Q3,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}});function ac(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),XA.hasOwnProperty(e)?{space:XA[e],local:t}:t}var Z3=N(()=>{"use strict";jA();o(ac,"default")});function vTe(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Q3&&e.documentElement.namespaceURI===Q3?e.createElement(t):e.createElementNS(r,t)}}function xTe(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function ov(t){var e=ac(t);return(e.local?xTe:vTe)(e)}var KA=N(()=>{"use strict";Z3();jA();o(vTe,"creatorInherit");o(xTe,"creatorFixed");o(ov,"default")});function bTe(){}function Eh(t){return t==null?bTe:function(){return this.querySelector(t)}}var J3=N(()=>{"use strict";o(bTe,"none");o(Eh,"default")});function QA(t){typeof t!="function"&&(t=Eh(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i{"use strict";gl();o(h8,"default")});function f8(){for(var t=this._groups,e=-1,r=t.length;++e