@visuallyjs/browser-ui 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- var _b=Object.defineProperty,Q0=Object.defineProperties,eL=Object.getOwnPropertyDescriptor,tL=Object.getOwnPropertyDescriptors;var Ob=Object.getOwnPropertySymbols;var rL=Object.prototype.hasOwnProperty,nL=Object.prototype.propertyIsEnumerable;var nE=(i,r,e)=>r in i?_b(i,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[r]=e,tn=(i,r)=>{for(var e in r||(r={}))rL.call(r,e)&&nE(i,e,r[e]);if(Ob)for(var e of Ob(r))nL.call(r,e)&&nE(i,e,r[e]);return i},Bc=(i,r)=>Q0(i,tL(r));var Ze=(i,r,e,t)=>{for(var n=t>1?void 0:t?eL(r,e):r,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(t?s(r,e,n):s(n))||n);return t&&n&&_b(r,e,n),n};var c=(i,r,e)=>(nE(i,typeof r!="symbol"?r+"":r,e),e);function Fc(i){let r=i.graph,e=i.source,t=i.target,n=i.nodeFilter,o=i.edgeFilter,s={},a={},l={},h={dist:s,previous:a,edges:l,path:[]},d=i.processAll,u={},p={},m=i.strict!==!1,g=C=>C.getFullId?C.getFullId():C.id,E=[],y=C=>{let _=p[C.getFullId()];return u[_.v.id]},x=(C,_)=>{let w,$;if(C.objectType===ce.objectType){for(s[C.getFullId()]=_,w=y(C),$=0;$<w.length;$++)w[$].p!=C&&(s[w[$].p.getFullId()]=_+C.getParent().getInternalEdge(C,w[$].p).cost);m||(s[C.getParent().id]=_)}else for(s[C.id]=_,w=u[C.id],$=0;$<w.length;$++)s[w[$].p.getFullId()]=_},f=C=>n&&!n(C)?1/0:s[g(C)],b=(C,_,w)=>{if(C.objectType===ce.objectType){let $=y(C);for(let N=0;N<$.length;N++)a[$[N].p.getFullId()]=w.node;m||(a[C.getParent().id]=w.node)}a[_]=w.node},A=(C,_,w)=>{if(C.objectType===ce.objectType){let $=y(C);for(let N=0;N<$.length;N++)l[$[N].p.getFullId()]=w;m||(l[C.getParent().id]=w)}l[_]=w},T=(C,_,w,$,N)=>{let M=-1,D=null,V=1/0;for(let J=0;J<C.length;J++)if(!_[J]){let fe=N(C[J]);fe<V?(V=fe,M=J,D=C[J]):fe===V&&C[J].objectType===ce.objectType&&C[J].getParent()===D&&(M=J,D=C[J])}return{node:D,index:M}},S=(C,_)=>{let w=_.getFullId(),$=C[w];return $==null&&(w=_.getParent?_.getParent().id:_.id,$=C[w]),$==null?null:{p:$,id:w}},R=(C,_,w,$,N,M)=>{let D=[],V=$,J=S(_,V);for(;J!=null;)D.splice(0,0,{vertex:V,cost:C[J.id],edge:w[J.id]}),V=J.p,J=S(_,V);return D.splice(0,0,{vertex:V,cost:0,edge:null}),D},v=C=>{for(let _=0;_<C.length;_++){let w=C[_],$=w.getPorts();E.push(w);let N={v:w,i:E.length-1};u[w.id]=[],x(w,1/0);for(let M=0;M<$.length;M++)E.push($[M]),p[$[M].getFullId()]=N,u[w.id].push({p:$[M],i:E.length-1}),x($[M],1/0)}};if(v(r.nodes),v(r.groups),e==null&&(e=r.getVertex(i.sourceId)),t==null&&(t=r.getVertex(i.targetId)),e==null||t==null)return h;x(e,0);let O=new Array(r.nodes.length),P=0,I=(C,_,w,$)=>{for(let N=0;N<_.length;N++){let M=_[N];if(w(M)){let D=$(M),V=D.tp||D.tn,J=g(V),fe=f(C.node)+M.getCost(),X=f(V);fe<X&&(x(V,fe),b(V,J,C),A(V,J,M))}}};for(;P<E.length;){let C=T(E,O,s,g,f),_=C.node?g(C.node):null;if(!C.node||f(C.node)==1/0||t&&(_==g(t)||!m&&C.node.objectType===ce.objectType&&C.node.isChildOf(t))&&(h.path=R(s,a,l,t,g),h.pathDistance=h.path[h.path.length-1].cost,!d))break;O[C.index]=!0,P=P+1,I(C,C.node.getAllEdges(),w=>o&&!o(w)?!1:!w.isDirected()||C.node==w.source||!m&&w.source.objectType===ce.objectType&&w.source.isChildOf(C.node),w=>{var $=w.source.objectType===ce.objectType?w.source.getParent():w.source,N=w.source.objectType===ce.objectType?w.source:null,M=w.target.objectType===ce.objectType?w.target.getParent():w.target,D=w.target.objectType===ce.objectType?w.target:null;return w.source==C.node||!m&&w.source.objectType===ce.objectType&&w.source.isChildOf(C.node)?{tn:M,tp:D}:{tn:$,tp:N}})}return h}function Rb(i){let r=i.graph,e=r.getVertexCount(),t={},n={},o,s,a;for(o=0;o<e;o++){let l=r.getVertexAt(o);for(t[l.id]||(t[l.id]={}),n[l.id]||(n[l.id]={}),t[l.id][l.id]=0,s=0;s<e;s++)if(o!=s){let d=r.getVertexAt(s);t[l.id][d.id]||(t[l.id][d.id]=1/0),n[l.id][d.id]||(n[l.id][d.id]=[])}let h=l.getEdges();for(a=0;a<h.length;a++)h[a].source==l?t[l.id][h[a].target.id]=h[a].getCost():(t[h[a].source.id]||(t[h[a].source.id]={},n[h[a].source.id]={}),t[l.id][h[a].source.id]=h[a].getCost())}for(a=0;a<e;a++)for(o=0;o<e;o++)for(s=0;s<e;s++)if(o!=s&&s!=a&&o!=a){let l=r.getVertexAt(o).id,h=r.getVertexAt(s).id,d=r.getVertexAt(a).id;t[l][d]+t[d][h]<=t[l][h]&&t[l][d]+t[d][h]!=1/0&&(t[l][h]=t[l][d]+t[d][h],n[l][h]||(n[l][h]=[]),n[l][h].unshift([r.getVertexAt(a),t[l][h]]))}return{paths:t,parents:n}}var Uc=class{constructor(r){c(this,"vertices");c(this,"te");this.vertices=[r],this.te=new Set}addVertex(r){this.vertices.push(r),r.getAllEdges().forEach(e=>this.te.add(e))}get edges(){return Array.from(this.te)}};var iL=[null,[1,-1],[1,1],[-1,1],[-1,-1]],oL=[null,[-1,-1],[-1,1],[1,1],[1,-1]],Li=2*Math.PI;function wi(i,r){return{x:i.x+r.x,y:i.y+r.y}}function Vb(i,r){return{x:i.x-r.x,y:i.y-r.y}}function Nr(i,r){return r.x===i.x?r.y>i.y?1/0:-1/0:r.y===i.y?r.x>i.x?0:-0:(r.y-i.y)/(r.x-i.x)}function Gb(i,r){return-1/Nr(i,r)}function Ue(i,r){return Math.sqrt(Math.pow(r.y-i.y,2)+Math.pow(r.x-i.x,2))}function MG(i,r){return Math.abs(r.y-i.y)+Math.abs(r.x-i.x)}function Ls(i,r){return r.x>i.x||r.x==i.x?r.y>i.y?2:1:r.y>i.y?3:4}function El(i,r){let e=Nr(i,r),t=Math.atan(e),n=Ls(i,r);return(n==4||n==3)&&(t+=Math.PI),t<0&&(t+=2*Math.PI),t}function tt(i,r){return!(i.x+i.width<r.x||i.x>r.x+r.width||i.y+i.height<r.y||i.y>r.y+r.height)}function sE(i,r){let e=Math.max(0,Math.min(i.x+i.width,r.x+r.width)-Math.max(i.x,r.x)),t=Math.max(0,Math.min(i.y+i.height,r.y+r.height)-Math.max(i.y,r.y));return e*t}function Lb(i){let r=i[1].y-i[0].y,e=i[0].x-i[1].x;return{A:r,B:e,C:r*i[0].x+e*i[0].y}}function aE(i,r){return r=r==null?3:r,Math.floor(i*Math.pow(10,r))/Math.pow(10,r)}var Qn=1e-6;function lE(i,r){let e=Lb(i),t=Lb(r),n=e.A*t.B-t.A*e.B;if(Math.abs(n)<Qn)return null;{let o={x:(t.B*e.C-e.B*t.C)/n,y:(e.A*t.C-t.A*e.C)/n},s=Math.min(i[0].x,i[1].x),a=Math.max(i[0].x,i[1].x),l=Math.min(i[0].y,i[1].y),h=Math.max(i[0].y,i[1].y),d=Math.min(r[0].x,r[1].x),u=Math.max(r[0].x,r[1].x),p=Math.min(r[0].y,r[1].y),m=Math.max(r[0].y,r[1].y);return o.x>=s-Qn&&o.x<=a+Qn&&o.y>=l-Qn&&o.y<=h+Qn&&o.x>=d-Qn&&o.x<=u+Qn&&o.y>=p-Qn&&o.y<=m+Qn?o:null}}function hr(i,r){let e=[];return[[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y}],[{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height}],[{x:r.x,y:r.y},{x:r.x,y:r.y+r.height}],[{x:r.x,y:r.y+r.height},{x:r.x+r.width,y:r.y+r.height}]].forEach(n=>{let o=lE(i,n);o!=null&&e.push(o)}),e}function $b(i,r){return ws(r,i[0],!0)||ws(r,i[1],!0)||hr(i,r).length>0}function VG(i,r,e){let t=i.x,n=i.x+i.width,o=i.y,s=i.y+i.height,a=r.x,l=r.x+r.width,h=r.y,d=r.y+r.height,u=(p,m,g,E)=>e?p<=m&&g>=E:p<m&&g>E;return u(t,a,n,l)&&u(o,h,s,d)}function ws(i,r,e){return e?i.x<=r.x&&i.x+i.width>=r.x&&i.y<=r.y&&i.y+i.height>=r.y:i.x<r.x&&i.x+i.width>r.x&&i.y<r.y&&i.y+i.height>r.y}function kt(i,r,e){let t=Nr(i,r),n=Ls(i,r),o=e>0?iL[n]:oL[n],s=Math.atan(t),a=Math.abs(e*Math.sin(s))*o[1],l=Math.abs(e*Math.cos(s))*o[0];return{x:i.x+l,y:i.y+a}}function Dt(i,r,e){let t=Nr(i,r),n=Math.atan(-1/t),o=e/2*Math.sin(n),s=e/2*Math.cos(n);return[{x:r.x+s,y:r.y+o},{x:r.x-s,y:r.y-o}]}function GG(i,r,e){let t={x:(i.x+r.x)/2,y:(i.y+r.y)/2},n=Nr(i,r),o=Math.atan(-1/n),s=e/2*Math.sin(o),a=e/2*Math.cos(o);return[{x:t.x,y:t.y},{x:t.x-a,y:t.y-s}]}function le(i,r,e,t){e=e==null?r.thresholdX==null?r.width/2:r.thresholdX:e,t=t==null?r.thresholdY==null?r.height/2:r.thresholdY:t;let n=Math.floor(i.x/r.width),o=r.width*n,s=o+r.width,a=Math.abs(i.x-o)<=e?o:Math.abs(s-i.x)<=e?s:i.x,l=Math.floor(i.y/r.height),h=r.height*l,d=h+r.height,u=Math.abs(i.y-h)<=t?h:Math.abs(d-i.y)<=t?d:i.y;return{x:a,y:u}}function $G(i,r){let e=Math.floor(i.x/r.width),t=r.width*e,n=t+r.width,o=Math.floor(i.y/r.height),s=r.height*o,a=s+r.height;return{x:n,y:a}}function sL(i,r,e,t){let n=Math.max(i,r);i=Math.min(i,r),r=n;let o=Math.max(e,t);return e=Math.min(e,t),t=o,i<=e&&e<=r&&i<=t&&t<=r?{point1:e,point2:t}:i<=e&&e<=r&&t>=r?{point1:e,point2:r}:e<=i&&i<=t&&t<=r?{point1:i,point2:t}:i===e&&r===t||r===e&&i===t?{point1:i,point2:r}:e<=i&&i<=t&&e<=r&&r<=t?{point1:i,point2:r}:null}function hE(i,r,e,t,n=0){let o=sL(i,r,e,t);return o==null?!1:Math.abs(o.point2-o.point1)>n}function Bb(i,r,e){let t=i.x-r,n=i.y-e,o=i.width+2*r,s=i.height+2*e,a=Object.assign({},i);return Object.assign(a,{x:t,y:n,width:o,height:s})}function Fb(i,r){let e=Math.min(i.x,r.x),t=Math.min(i.y,r.y),n=Math.max(i.x+i.width,r.x+r.width),o=Math.max(i.y+i.height,r.y+r.height),s=n-e,a=o-t;return{x:e,y:t,width:s,height:a}}function Ub(i,r){let e=i[0].x,t=i[1].x,n=i[0].y,o=i[1].y,s=r[0].x,a=r[1].x,l=r[0].y,h=r[1].y;if(e===t&&n===o||s===a&&l===h)return null;let d=(h-l)*(t-e)-(a-s)*(o-n);if(d===0)return null;let u=((a-s)*(n-l)-(h-l)*(e-s))/d,p=e+u*(t-e),m=n+u*(o-n);return{x:p,y:m}}function wb(i,r){if(i[0].x===i[1].x){let e=i[0].y<i[1].y?1:-1;return[{x:i[0].x+e*r,y:i[0].y},{x:i[0].x+e*r,y:i[1].y}]}else if(i[0].y===i[1].y){let e=i[0].x<i[1].x?1:-1;return[{y:i[0].y+e*r,x:i[0].x},{y:i[0].y+e*r,x:i[1].x}]}else{let e=Nr(i[0],i[1]),t=Math.atan(-1/e),n=length/2*Math.sin(t),o=length/2*Math.cos(t);return[{x:i[0].x+o,y:i[0].y+n},{x:i[1].x+o,y:i[1].y+n}]}}function Yb(i,r){return[wb(i,r),wb(i,-r)]}function BG(i,r,e){if(i[0].x===i[1].x){let t=i[0].y<i[1].y?1:-1;return[r,{x:r.x,y:r.y+t*e}]}else if(i[0].y===i[1].y){let t=i[0].x<i[1].x?1:-1;return[r,{x:r.x+t*e,y:r.y}]}else{let t=Nr(i[0],i[1]),n=Math.atan(-1/t),o=e*Math.sin(n),s=e*Math.cos(n);return[r,{x:r.x+s,y:r.y+o}]}}var Yc=(i,r,e,t)=>Math.abs(e-i)+Math.abs(t-r),FG=(i,r,e,t)=>Math.pow(Math.pow(e-i,2)+Math.pow(t-r,2),.5),UG=(i,r,e,t)=>Math.max(Math.abs(e-i),Math.abs(t-r)),YG=(i,r,e,t)=>{let n=Math.abs(e-i),o=Math.abs(t-r),s=Math.SQRT2-1;return n<o?s*n+o:s*o+n};function fl(i){let r=i%360;return r<0&&(r+=360),r}function Db(i,r){return i.x*r.x+i.y*r.y}function iE(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function Nb(i){let r=iE(i);return r===0?{x:0,y:0}:{x:i.x/r,y:i.y/r}}function aL(i,r,e){e=e*Math.PI/180;let t=Math.cos(e),n=Math.sin(e),o=(i.x-r.x)*t-(i.y-r.y)*n+r.x,s=(i.x-r.x)*n+(i.y-r.y)*t+r.y;return{x:o,y:s}}function oE(i){let r=i.x+i.width/2,e=i.y+i.height/2,t={x:r,y:e},n=i.r||0,o=i.width/2,s=i.height/2,a=[{x:r-o,y:e-s},{x:r+o,y:e-s},{x:r+o,y:e+s},{x:r-o,y:e+s}];return n===0?a:a.map(l=>aL(l,t,n))}function Ib(i){let r=oE(i),e=[],t={x:r[1].x-r[0].x,y:r[1].y-r[0].y};iE(t)>0&&e.push(Nb({x:-t.y,y:t.x}));let n={x:r[3].x-r[0].x,y:r[3].y-r[0].y};return iE(n)>0&&e.push(Nb({x:-n.y,y:n.x})),e.length===0&&(e.push({x:1,y:0}),e.push({x:0,y:1})),e}function Mb(i,r){let e=Db(i,r[0]),t=e;for(let n=1;n<r.length;n++){let o=Db(i,r[n]);o<e?e=o:o>t&&(t=o)}return{min:e,max:t}}function lL(i,r,e,t){return i<=t&&e<=r}function zb(i,r){if(i.r===0&&r.r===0)return tt(i,r);let e=oE(i),t=oE(r),n=[...Ib(i),...Ib(r)];for(let o of n){let s=Mb(o,e),a=Mb(o,t);if(!lL(s.min,s.max,a.min,a.max))return!1}return!0}var hL=!0;function U(...i){if(hL&&typeof console!="undefined")try{let r=arguments[arguments.length-1];console.log(r)}catch(r){}}function jb(i,r){let e=i.prototype;for(;e!=null;){if(e instanceof r)return!0;e=e.prototype}return!1}function cE(i,r){let e=i.indexOf(r);return e>-1&&i.splice(e,1),e!==-1}function qG(i,r,e){i.findIndex(e)===-1&&i.push(r)}function Hb(i,r,e,t){let n=i[r];return n==null&&(n=[],i[r]=n),n[t?"unshift":"push"](e),n}function QG(i,r,e,t){let n=i.get(r);return n==null&&(n=[],i.set(r,n)),n[t?"unshift":"push"](e),n}function dE(i,r,e){return i.indexOf(r)===-1?(e?i.unshift(r):i.push(r),!0):!1}function uE(i,r){let e=null;return i.forEach(t=>{r(t)&&(e=t)}),e}function Nt(i,r){let e=i.findIndex(r);return e>-1&&i.splice(e,1),e!==-1}function Ie(i,r,e){let t={x:i.x-r.x,y:i.y-r.y},n=Math.cos(e/360*Math.PI*2),o=Math.sin(e/360*Math.PI*2);return{x:t.x*n-t.y*o+r.x,y:t.y*n+t.x*o+r.y,cr:n,sr:o}}function Ct(i){if(i==null)return null;let r=i.replace(/^\s\s*/,""),e=/\s/,t=r.length;for(;e.test(r.charAt(--t)););return r.slice(0,t+1)}function pE(i,r,e,t){if(r.length===0)r.push(i);else{let n=t?-1:1,o=0,s=r.length,a=Math.floor((o+s)/2);for(;s>o;)e(i,r[a])*n<0?s=a:o=a+1,a=Math.floor((o+s)/2);r.splice(a,0,i)}}function Di(){return{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}function ft(i){return{x:i.x,y:i.y}}function ei(i){return{width:i.width,height:i.height}}function e$(i){return{x:i.x,y:i.y,width:i.width,height:i.height}}function mE(i,r,e){return{x:i.x+e*r.x,y:i.y+e*r.y,width:i.width,height:i.height}}var Yt=[];for(let i=0;i<256;i++)Yt[i]=(i<16?"0":"")+i.toString(16);function B(){let i=Math.random()*4294967295|0,r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return Yt[i&255]+Yt[i>>8&255]+Yt[i>>16&255]+Yt[i>>24&255]+"-"+Yt[r&255]+Yt[r>>8&255]+"-"+Yt[r>>16&15|64]+Yt[r>>24&255]+"-"+Yt[e&63|128]+Yt[e>>8&255]+"-"+Yt[e>>16&255]+Yt[e>>24&255]+Yt[t&255]+Yt[t>>8&255]+Yt[t>>16&255]+Yt[t>>24&255]}function yl(i=6){return B().substring(0,i-1)}function cL(i){return[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}]}function kb(i,r){let e=cL(r).map(t=>({p:t,d:Ue(t,i)}));return e.sort((t,n)=>Math.sign(t.d-n.d)),e[0].p}function we(i,r,e){if(i==null)return null;if(r==="$data"||r==null)return i;let t=r.match(/^\{(.*)\}$/);if(t){let a={},l=t[1].split(",");for(let h=0;h<l.length;h++){let d=l[h].split(":"),u=we(i,d[1]);a[Ct(d[0])]=u||d[1].replace(/'/g,"")}return a}r=r.replace(/\['([^']*)'\]/g,".$1");let n=i,o=n,s=null;return r.replace(/([^\.])+/g,(a,l,h,d)=>{if(s!=null)return;let u=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),p=h+a.length>=d.length,m=function(){return o[u[1]]||function(){return o[u[1]]=[],o[u[1]]}()};if(p)if(u){let g=m(),E=u[3];e==null?s=g[E]:g[E]=e}else e==null?s=o[a]:o[a]=e;else if(u){let g=m();o=g[u[3]]||function(){return g[u[3]]={},g[u[3]]}()}else o=o[a]||function(){return o[a]={},o[a]}()}),s}function xl(i,r){let e={left:[],right:[]};for(let t=0;t<i.length;t++){let n=i[t];r(n)?e.left.push(n):e.right.push(n)}return e}function Wb(i){return i.filter(r=>r!=null&&Ct(r).length>0)}function Zb(i,r){for(let e=0;e<i.length;e++){let t=i[e];t==null||t.length===0||r(e,t)}}function Xc(i,r,e){let t=e.map((n,o)=>{let[s,a]=[r.x+r.width*n.x,r.y+r.height*n.y],l=Math.sqrt(Math.pow(i.x-s,2)+Math.pow(i.y-a,2));return{p:n,idx:o,distance:l}});return t.sort((n,o)=>n.distance<o.distance?-1:1),t[0]}function Ns(i,r,e){return i.has(r)||i.set(r,e()),i.get(r)}function Is(i,r,e){return i[r]==null&&(i[r]=e()),i[r]}function zc(i){return Object.prototype.toString.call(i)==="[object Number]"}function j(i){return typeof i=="string"}function Co(i){return typeof i=="boolean"}function cr(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Object]"}function dL(i){return Object.prototype.toString.call(i)==="[object Date]"}function rn(i){return Object.prototype.toString.call(i)==="[object Function]"}function uL(i){return rn(i)&&((i==null?void 0:i.toString())||"").startsWith("class")}function t$(i){return rn(i)&&i.name!=null&&i.name.length>0}function bl(i){for(let r in i)if(i.hasOwnProperty(r))return!1;return!0}function Al(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null)return!1;for(let e in i){let t=i[e],n=r[e];if(!Xb(t,n))return!1}return!0}function r$(i){let r={};for(let e in i)i[e]!=null&&(r[e]=i[e]);return r}function lt(i){if(j(i))return""+i;if(Co(i))return!!i;if(dL(i))return new Date(i.getTime());if(rn(i))return i;if(Array.isArray(i))return i.map(r=>lt(r));if(cr(i)){let r={};for(let e in i)r[e]=lt(i[e]);return r}else return i}function bn(i,r,e,t){let n={},o,s,a={};for(e=e||[],t=t||[],s=0;s<e.length;s++)n[e[s]]=!0;for(s=0;s<t.length;s++)a[t[s]]=!0;let l=lt(i);for(s in r)if(l[s]==null||a[s])l[s]=r[s];else if(n[s])o=[],o.push.apply(o,Array.isArray(l[s])?l[s]:[l[s]]),o.push(r[s]),l[s]=o;else if(j(r[s])||Co(r[s])||rn(r[s])||zc(r[s]))l[s]=r[s];else if(Array.isArray(r[s]))o=[],Array.isArray(l[s])&&o.push.apply(o,l[s]),o.push.apply(o,r[s]),l[s]=o;else if(cr(r[s])){cr(l[s])||(l[s]={});for(let h in r[s])l[s][h]=r[s][h]}return l}function Xb(i,r){if(i!=null&&r==null)return!1;if((i==null||j(i)||Co(i)||zc(i))&&i!==r)return!1;if(Array.isArray(i))if(Array.isArray(r)){if(!pL(i,r))return!1}else return!1;else if(cr(i))if(cr(i)){if(!Al(i,r))return!1}else return!1;return!0}function pL(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null||i.length!==r.length)return!1;for(let e=0;e<i.length;e++)if(!Xb(i[e],r[e]))return!1;return!0}function Jb(i,r){return i.x===r.x&&i.y===r.y}function Kb(i,r){let e=i.slice(),t={x:e[0],y:e[1],cr:0,sr:0};return r.forEach(n=>{t=Ie(t,n.c,n.r)}),t}function qb(i,r){return r.forEach(e=>{i=Ie(i,e.c,e.r)}),i}function gE(i,r,e){if(i==null)return;let t=i,n=t;return r.replace(/([^\.])+/g,(o,s,a,l)=>{let h=o.match(/([^\[0-9]+){1}(\[)([0-9+])/),d=a+o.length>=l.length,u=function(){return n[h[1]]||function(){return n[h[1]]=[],n[h[1]]}()};if(d)h?u()[h[3]]=e:n[o]=e;else if(h){let p=u();n=p[h[3]]||function(){return p[h[3]]={},p[h[3]]}()}else n=n[o]||function(){return n[o]={},n[o]}();return""}),i}function Po(i,r,e,t){let n=s=>{let a=s.match(/(\${.*?})/g);if(a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-1)]||"";h!=null&&(s=s.replace(a[l],h))}if(a=s.match(/({{.*?}})/g),a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-2)]||"";h!=null&&(s=s.replace(a[l],h))}return s},o=s=>{if(s!=null){if(uL(s))return s;if(j(s))return n(s);if(rn(s)&&!t&&(e==null||(s.name||"").indexOf(e)===0))return s(r);if(Array.isArray(s)){let a=[];for(let l=0;l<s.length;l++)a.push(o(s[l]));return a}else if(cr(s)){let a={};for(let l in s)a[l]=o(s[l]);return a}else return s}};return o(i)}var Ds=class{constructor(r,...e){this.sorter=r;c(this,"stack");this.stack=e.slice(),this.stack.sort(this.sorter)}get length(){return this.stack.length}add(r){pE(r,this.stack,this.sorter,!0)}update(r){this.delete(r),this.add(r)}pop(){return this.stack.pop()}delete(r){let e=this.stack.indexOf(r);e>-1&&this.stack.splice(e,1)}head(){return this.stack.length===0?null:this.stack[0]}peek(){return this.stack.length===0?null:this.stack[this.stack.length-1]}isEmpty(){return this.stack.length===0}clear(){this.stack.length=0}};function EE(i){return H(i)?i.getParent().id:i.getFullId()}function ti(i){return H(i)?i.getParent():i}function K(i){return i!=null&&i.objectType===he.objectType}function fE(i){return K(i)&&i.group!=null}function Y(i){return i!=null&&i.objectType===oe.objectType}function yE(i){return Y(i)&&i.group!=null}function rt(i){return i!=null&&i.objectType===Ye.objectType}function H(i){return i!=null&&i.objectType===ce.objectType}function tA(i){return i.objectType===he.objectType||i.objectType===oe.objectType}function Ni(i){return K(i)||Y(i)||H(i)}function xE(i){return i.id}var mL=".";function Sl(i,r){if(r==null)return i.edges;{let e=[];for(let t=0;t<i.edges.length;t++)r(i.edges[t])&&e.push(i.edges[t]);return e}}function gL(i,r){let e=Sl(i,r).slice(0);if(K(i)||Y(i))for(let t=0;t<i.ports.length;t++)e.push.apply(e,Sl(i.ports[t],r));return e}function Qb(i){return Sl(i,r=>r.source==i)}function eA(i){return Sl(i,r=>r.target==i)}function u$(i){let r=Qb(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,Qb(i.ports[e]));return r}function p$(i){let r=eA(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,eA(i.ports[e]));return r}function bE(i,r,e,t){let n=new Set,o=(a,l)=>{let h=l.source===a||l.target===a;return h?t?t(l):h:!1},s=a=>{a.members.forEach(l=>{let h=o.bind(null,l);(e?gL(l,h):Sl(l,h)).forEach(u=>n.add(u)),!r&&Y(l)&&s(l)})};return s(i),Array.from(n)}function Kc(i){let r=0,e=i.group;for(;e!=null;)r++,e=e.group;return r}function An(i){let r=ti(i),e=[],t=r.group;for(;t!=null;)e.push(t),t=t.group;return e}function je(i,r){return i==null||r==null?!1:An(i).indexOf(r)!==-1}function rA(i,r){let e=!1,t=n=>{for(let o=0;o<n.members.length;o++)if(Y(n.members[o]))if(n.members[o].id===i.id){e=!0;break}else t(n.members[o])};return t(r),e}function Ms(i){let r=[],e=t=>{t.members.forEach(n=>{r.push(n),Y(n)&&e(n)})};return e(i),r}function m$(i,r){let t=!(K(i)||Y(i))||r?i.getSourceEdges():i.getAllSourceEdges();return Array.from(new Set(t.map(n=>n.target)))}function g$(i,r){let t=!(K(i)||Y(i))||r?i.getTargetEdges():i.getAllTargetEdges();return Array.from(new Set(t.map(n=>n.source)))}function E$(i,r){let e=new Set,t=K(i)||Y(i),n=!t||r?i.getSourceEdges():i.getAllSourceEdges(),o=!t||r?i.getTargetEdges():i.getAllTargetEdges();return n.forEach(s=>e.add(s.target)),o.forEach(s=>e.add(s.source)),Array.from(e)}function nA(i,r){return i.getSourceEdges().find(e=>e.target===r)!=null||i.getTargetEdges().find(e=>e.source==r)!=null}var vl=class{constructor(r){c(this,"nodes",[]);c(this,"id");c(this,"edges",[]);c(this,"groups",[]);c(this,"we",new Map);c(this,"Ir",new Map);c(this,"Ue",new Map);c(this,"defaultDirected");c(this,"defaultCost");c(this,"Jt");c(this,"typeFunction");c(this,"enableSubgraphs");c(this,"portSeparator");c(this,"Go",{});r=r||{},this.nodes=[],this.edges=[],this.groups=[],this.id=r.id,this.defaultDirected=r.defaultDirected!==!1,this.defaultCost=r.defaultCost||1,this.Jt=r.defaultIdFunction||xE,this.typeFunction=r.typeFunction||function(e){return e.type||"default"},this.enableSubgraphs=r.enableSubgraphs===!0,this.portSeparator=r.portSeparator||mL}ca(r){delete this.Go[r.id]}da(r){this.Go[r.id]=r}zg(){this.Go={}}getIdFunction(){return this.Jt}setIdFunction(r){this.Jt=r}getType(r){return this.typeFunction(r)}getId(r,e){return r==null?B():typeof r=="string"?r:(e||this.getIdFunction())(r)||B()}getTopLevelElements(){return this.Go}setEnableSubgraphs(r){this.enableSubgraphs=r}setPortSeparator(r){this.portSeparator=r}getPortSeparator(){return this.portSeparator}splitPortId(r){return r!=null?r.split(this.portSeparator):[]}getVertexByPortId(r){let e=this.splitPortId(r);if(e.length===2)return this.we.get(e[0])||this.Ue.get(e[0])}getVertex(r,e){if(r==null)return null;let t;if(typeof r!="string"){if(r.constructor===ce||r.constructor===he||r.constructor===oe)return r;let s=r;if(t=this.Jt(r),typeof t!="string")return s}t=r;let n=this.enableSubgraphs?t.split("/"):[t],o=s=>{if(this.we.has(s))return this.we.get(s);if(this.Ue.has(s))return this.Ue.get(s);let a=s.split(this.portSeparator),l=a[0],h=this.we.get(l)||this.Ue.get(l);if(a.length===2&&h!=null){let d=h.getPort(a[1]);return d==null&&e&&(d=h.$addPort(a[1])),d}else return h};if(n.length==1)return o(n[0]);if(n.length>1&&n.length%2==0)throw"Subgraph path format error.";{let s=null,a=null;for(let l=0;l<n.length-1;l+=2)s=o(n[l]),a=s.getGraph(n[l+1]);return a.getVertex(n[n.length-1])}}clear(){this.nodes.length=0,this.groups.length=0,this.we.clear(),this.Ir.clear(),this.Ue.clear(),this.zg()}getVertices(){return this.nodes}getVertexCount(){return this.nodes.length}getVertexAt(r){return this.nodes[r]}getEdgeCount(){return this.Ir.size}addEdge(r,e,t){let n=r.directed==null?this.defaultDirected===!0:r.directed!==!1,o=r.cost||this.defaultCost,s=this.getVertex(r.source,!0),a=this.getVertex(r.target,!0);if(e=e||this.getId(r.data,t),s==null||s.objectType==null)throw new TypeError("Unknown source node ["+r.source+"]");if(a==null||a.objectType==null)throw new TypeError("Unknown target node ["+r.target+"]");let l=new Ye({source:s,target:a,cost:o,directed:n,data:r.data||{},id:e,graph:this,transient:r.transient,anchors:r.anchors});return l.source.$addEdge(l),l.source!==l.target&&l.target.$addEdge(l),this.Ir.set(e,l),r.geometry!=null&&(l.geometry=r.geometry),l}addNode(r,e){let t=new he(this,r||{},e||this.Jt);return this.we.has(t.id)?null:(this.nodes.push(t),this.we.set(t.id,t),this.da(t),t)}addNodes(r,e){for(let t=0;t<r.length;t++)this.addNode(r[t],e||this.Jt)}addGroup(r,e){let t=new oe(this,r,e||this.Jt);return this.Ue.has(t.id)?this.Ue.get(t.id):(this.groups.push(t),this.Ue.set(t.id,t),this.da(t),t)}getGroupCount(){return this.groups.length}getGroupAt(r){return this.groups[r]}getGroups(){return this.groups}$addMemberToGroup(r,e){let t=typeof e=="string"?this.Ue.get(e):e,n=this.getVertex(r);n&&t&&(t.$addMember(n),this.ca(n))}$removeMemberFromGroup(r){let e=this.getVertex(r);e&&e.group&&(e.group.$removeMember(e),this.da(e))}getGroup(r){return typeof r=="string"?this.Ue.get(r):r}deleteGroup(r,e){let t={group:typeof r=="string"?this.Ue.get(r):r,edges:[],nodes:[],nestedGroups:[],children:[]};if(t.group){t.parentGroup=t.group.group,t.children=t.group.members.slice();let n;if(e){let{left:l,right:h}=xl(t.group.getMembers(),d=>Y(d));l.forEach(d=>{t.nestedGroups.push(this.deleteGroup(d,!0))}),h.forEach(d=>{t.nodes.push(this.deleteNode(d))})}else t.group.getMembers().forEach(l=>delete l.group);t.group.members.length=0,t.edges=t.group.getAllDirectEdges().slice();let o=t.edges.length;for(n=0;n<o;n++)this.deleteEdge(t.edges[n]);let s=t.group.getPorts();for(let l=0;l<s.length;l++)this.deletePort(s[l]);this.Ue.delete(t.group.id);let a=-1;for(let l=0;l<this.groups.length;l++)if(this.groups[l].id===t.group.id){a=l;break}a>-1&&this.groups.splice(a,1),t.group.group!=null&&t.group.group.$removeMember(r),this.ca(t.group)}return t}deletePort(r){let e=r.getEdges();for(let t=0;t<e.length;t++)this.deleteEdge(e[t]);return e}$_removeNodeFromCache(r){let e=-1;for(let t=0;t<this.nodes.length;t++)if(this.nodes[t].id===r.id){e=t;break}e>-1&&(this.nodes.splice(e,1),r.group!=null&&r.group.$removeMember(r)),this.we.delete(r.id)}deleteNode(r){let e=this.getVertex(r),t={node:null,edges:[],parentGroup:null};if(e){t.node=e,t.parentGroup=e.group;let n=e.getPorts();for(let s=0;s<n.length;s++)this.deletePort(n[s]);let o=e;this.$_removeNodeFromCache(o),t.edges=e.getEdges().slice();for(let s=0;s<t.edges.length;s++)this.deleteEdge(t.edges[s]);this.ca(e)}return t}deleteEdge(r){if(r=this.getEdge(r),r==null)return;let e=this.getVertex(r.source,!1);e&&e.$deleteEdge(r);let t=this.getVertex(r.target,!1);t&&t.$deleteEdge(r),this.Ir.delete(r.getId())}getEdge(r){if(r!=null){if(typeof r!="string"){if(r.constructor===Ye)return r;let e=r;if(r=this.Jt(r),typeof r!="string")return e}return this.Ir.get(r)}}getEdges(r){r=r||{};let e=r.source!=null,t=r.target!=null,n=r.node?this.getVertex(r.node):null,o=r.filter||function(){return!0},s=d=>(!e||(r.source===!0?d.source===n:d.source!==n))&&(!t||(r.target===!0?d.target===n:d.target!==n)),a=[],l=d=>{o(d)&&s(d)&&a.push(d)},h;if(r.node){let u=this.getVertex(r.node).getAllEdges();for(h=0;h<u.length;h++)l(u[h])}else this.Ir.forEach((d,u)=>l(d));return a}getAllEdges(){let r=[];return this.Ir.forEach((e,t)=>r.push(e)),r}renamePort(r,e){return r.getParent().$renamePort(r,e)?(r.id=e,!0):!1}findPath(r,e,t,n,o){let s=this.getVertex(r),a=this.getVertex(e);return Fc({graph:this,source:s,target:a,strict:t!==!1,nodeFilter:n,edgeFilter:o})}getDistance(r,e,t){return this.findPath(r,e,t).pathDistance}setTarget(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.target;return r.target.$deleteEdge(r),r.target=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}setSource(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.source;return r.source.$deleteEdge(r),r.source=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}printPath(r,e){let t=this.getVertex(r),n=this.getVertex(e),o=this.findPath(t,n).path,s="["+t.id+" - "+n.id+"] : ";for(let a=0;a<o.length;a++)s=s+"{ vertex:"+o[a].vertex.id+", cost:"+o[a].cost+", edge: "+(o[a].edge&&o[a].edge.getId())+" } ";return s}getDiameter(r){let e=0;for(let t=0;t<this.nodes.length;t++)for(let n=0;n<this.nodes.length;n++)if(n!=t){let o=Fc({graph:this,source:this.nodes[t],target:this.nodes[n]});if(o.path==null||o.path.length==0){if(!r)return 1/0}else e=Math.max(e,o.pathDistance)}return e}getCentrality(r){let e=this.getVertex(r);return(e.getIndegreeCentrality()+e.getOutdegreeCentrality())/(this.getVertexCount()-1)}getIndegreeCentrality(r){return this.getVertex(r).getIndegreeCentrality()/(this.getVertexCount()-1)}getOutdegreeCentrality(r){return this.getVertex(r).getOutdegreeCentrality()/(this.getVertexCount()-1)}getCloseness(r){return 1/this.getFarness(r)}getFarness(r){let e=this.getVertex(r),t=Fc({graph:this,source:e,target:e,processAll:!0}),n=0;for(let o in t.dist)n+=t.dist[o];return n/(this.getVertexCount()-1)}getBetweenness(r){let e=this.getVertexCount(),t=(e-1)*(e-2)/2,n=0,o=0,s=(h,d,u,p,m)=>{let g=u.parents[h][d];if(g.length==0){let E=p.slice();E.unshift(h),m.push(E)}else for(let E=0;E<g.length;E++)if(p.indexOf(g[E][0].id)==-1){let y=p.slice();y.unshift(g[E][0].id),s(h,g[E][0].id,u,y,m)}},a=this.getVertex(r),l=Rb({graph:this,focus:a});for(let h in l.paths)for(let d in l.paths[h])if(h!=d){let u=[],p=0;s(h,d,l,[d],u);for(let m=0;m<u.length;m++){let g=u[m].indexOf(a.id);g>0&&g<u[m].length-1&&p++}n+=p/u.length,o+=p}return n/t}inspect(){let r="";for(let e=0;e<this.nodes.length;e++)r+=this.nodes[e].inspect()+`
2
- `;return r}serialize(){let r={nodes:[],edges:[],groups:[]},e,t,n;for(let o=0;o<this.nodes.length;o++)if(e=this.nodes[o],!e.transient){r.nodes.push(Object.assign({},e.data)),t=e.getAllEdges();for(let s=0;s<t.length;s++)if(t[s].source==e||t[s].source.objectType===ce.objectType&&t[s].source.getParent()==e){let a={source:t[s].source.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}for(let o=0;o<this.groups.length;o++){n=this.groups[o],r.groups.push(Object.assign({},n.data)),t=n.getEdges();for(let s=0;s<t.length;s++)if(t[s].source===n){let a={source:n.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}return r}getClusters(){return this.Oc(this.nodes,this.groups)}getCluster(r){let e=K(r)?[r]:[],t=Y(r)?[r]:[];return this.Oc(e,t)[0]}Oc(r,e){let t=[],n={},o,s=(a,l)=>{if(a==null||n[a.id])return;l==null?(l=new Uc(a),t.push(l)):l.addVertex(a),n[a.id]=!0;let h=a.getAllEdges();for(let d=0;d<h.length;d++){let u=h[d].source===a?h[d].target:h[d].source;s(u,l)}};for(o=0;o<r.length;o++)s(this.nodes[o]);for(o=0;o<e.length;o++)s(this.groups[o]);return t}},jc=class{constructor(r,e={}){this.graph=r;this.data=e;c(this,"atts",new Map);c(this,"type");this.data=this.data||{},this.type=r.getType(this.data)}setAttribute(r,e){this.atts.set(r,e)}getAttribute(r){return this.atts.get(r)}getType(){return this.type}setType(r){this.type=r}};function Tl(i){return i instanceof ce?i.id:i}var Hc=class extends jc{constructor(e,t,n){super(e,t);this.graph=e;c(this,"id");c(this,"transient");c(this,"transientRenderer");c(this,"dummy");c(this,"edges",[]);c(this,"indegreeCentrality",0);c(this,"outdegreeCentrality",0);c(this,"graphs",[]);this.id=e.getId(t,n),this.data=typeof t=="string"?{id:t}:t}getIndegreeCentrality(){return this.indegreeCentrality}getOutdegreeCentrality(){return this.outdegreeCentrality}addGraph(e){return e=typeof e=="string"?new vl({id:e}):e,this.graphs.push(e),e.id||(e.id=""+this.graphs.length),e}getGraph(e){for(let t=0;t<this.graphs.length;t++)if(this.graphs[t].id===e)return this.graphs[t]}getFullId(){return this.id}getEdges(e){if(e==null||e.filter==null)return this.edges;{let t=[];for(let n=0;n<this.edges.length;n++)e.filter(this.edges[n])&&t.push(this.edges[n]);return t}}getSourceEdges(){return this.getEdges({filter:e=>e.source==this})}getTargetEdges(){return this.getEdges({filter:e=>e.target==this})}$addEdge(e){this.edges.push(e),(e.source===this||!e.isDirected())&&this.outdegreeCentrality++,(e.target===this||!e.isDirected())&&this.indegreeCentrality++}$deleteEdge(e){let t=-1;for(let n=0;n<this.edges.length;n++)if(this.edges[n].getId()===e.getId()){t=n;break}return t>-1?(this.edges.splice(t,1),(e.source===this||!e.isDirected())&&this.outdegreeCentrality--,(e.target===this||!e.isDirected())&&this.indegreeCentrality--,!0):!1}inspect(){let e="{ id:"+this.id+`, edges:[
1
+ var Db=Object.defineProperty,d0=Object.defineProperties,u0=Object.getOwnPropertyDescriptor,p0=Object.getOwnPropertyDescriptors;var wb=Object.getOwnPropertySymbols;var g0=Object.prototype.hasOwnProperty,m0=Object.prototype.propertyIsEnumerable;var hE=(i,r,e)=>r in i?Db(i,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[r]=e,rn=(i,r)=>{for(var e in r||(r={}))g0.call(r,e)&&hE(i,e,r[e]);if(wb)for(var e of wb(r))m0.call(r,e)&&hE(i,e,r[e]);return i},Yc=(i,r)=>d0(i,p0(r));var Ye=(i,r,e,t)=>{for(var n=t>1?void 0:t?u0(r,e):r,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(t?s(r,e,n):s(n))||n);return t&&n&&Db(r,e,n),n};var c=(i,r,e)=>(hE(i,typeof r!="symbol"?r+"":r,e),e);function zc(i){let r=i.graph,e=i.source,t=i.target,n=i.nodeFilter,o=i.edgeFilter,s={},a={},l={},h={dist:s,previous:a,edges:l,path:[]},d=i.processAll,u={},p={},g=i.strict!==!1,m=C=>C.getFullId?C.getFullId():C.id,E=[],y=C=>{let R=p[C.getFullId()];return u[R.v.id]},x=(C,R)=>{let w,B;if(C.objectType===de.objectType){for(s[C.getFullId()]=R,w=y(C),B=0;B<w.length;B++)w[B].p!=C&&(s[w[B].p.getFullId()]=R+C.getParent().getInternalEdge(C,w[B].p).cost);g||(s[C.getParent().id]=R)}else for(s[C.id]=R,w=u[C.id],B=0;B<w.length;B++)s[w[B].p.getFullId()]=R},f=C=>n&&!n(C)?1/0:s[m(C)],b=(C,R,w)=>{if(C.objectType===de.objectType){let B=y(C);for(let N=0;N<B.length;N++)a[B[N].p.getFullId()]=w.node;g||(a[C.getParent().id]=w.node)}a[R]=w.node},A=(C,R,w)=>{if(C.objectType===de.objectType){let B=y(C);for(let N=0;N<B.length;N++)l[B[N].p.getFullId()]=w;g||(l[C.getParent().id]=w)}l[R]=w},T=(C,R,w,B,N)=>{let M=-1,D=null,G=1/0;for(let J=0;J<C.length;J++)if(!R[J]){let fe=N(C[J]);fe<G?(G=fe,M=J,D=C[J]):fe===G&&C[J].objectType===de.objectType&&C[J].getParent()===D&&(M=J,D=C[J])}return{node:D,index:M}},S=(C,R)=>{let w=R.getFullId(),B=C[w];return B==null&&(w=R.getParent?R.getParent().id:R.id,B=C[w]),B==null?null:{p:B,id:w}},O=(C,R,w,B,N,M)=>{let D=[],G=B,J=S(R,G);for(;J!=null;)D.splice(0,0,{vertex:G,cost:C[J.id],edge:w[J.id]}),G=J.p,J=S(R,G);return D.splice(0,0,{vertex:G,cost:0,edge:null}),D},v=C=>{for(let R=0;R<C.length;R++){let w=C[R],B=w.getPorts();E.push(w);let N={v:w,i:E.length-1};u[w.id]=[],x(w,1/0);for(let M=0;M<B.length;M++)E.push(B[M]),p[B[M].getFullId()]=N,u[w.id].push({p:B[M],i:E.length-1}),x(B[M],1/0)}};if(v(r.nodes),v(r.groups),e==null&&(e=r.getVertex(i.sourceId)),t==null&&(t=r.getVertex(i.targetId)),e==null||t==null)return h;x(e,0);let _=new Array(r.nodes.length),P=0,I=(C,R,w,B)=>{for(let N=0;N<R.length;N++){let M=R[N];if(w(M)){let D=B(M),G=D.tp||D.tn,J=m(G),fe=f(C.node)+M.getCost(),X=f(G);fe<X&&(x(G,fe),b(G,J,C),A(G,J,M))}}};for(;P<E.length;){let C=T(E,_,s,m,f),R=C.node?m(C.node):null;if(!C.node||f(C.node)==1/0||t&&(R==m(t)||!g&&C.node.objectType===de.objectType&&C.node.isChildOf(t))&&(h.path=O(s,a,l,t,m),h.pathDistance=h.path[h.path.length-1].cost,!d))break;_[C.index]=!0,P=P+1,I(C,C.node.getAllEdges(),w=>o&&!o(w)?!1:!w.isDirected()||C.node==w.source||!g&&w.source.objectType===de.objectType&&w.source.isChildOf(C.node),w=>{var B=w.source.objectType===de.objectType?w.source.getParent():w.source,N=w.source.objectType===de.objectType?w.source:null,M=w.target.objectType===de.objectType?w.target.getParent():w.target,D=w.target.objectType===de.objectType?w.target:null;return w.source==C.node||!g&&w.source.objectType===de.objectType&&w.source.isChildOf(C.node)?{tn:M,tp:D}:{tn:B,tp:N}})}return h}function Nb(i){let r=i.graph,e=r.getVertexCount(),t={},n={},o,s,a;for(o=0;o<e;o++){let l=r.getVertexAt(o);for(t[l.id]||(t[l.id]={}),n[l.id]||(n[l.id]={}),t[l.id][l.id]=0,s=0;s<e;s++)if(o!=s){let d=r.getVertexAt(s);t[l.id][d.id]||(t[l.id][d.id]=1/0),n[l.id][d.id]||(n[l.id][d.id]=[])}let h=l.getEdges();for(a=0;a<h.length;a++)h[a].source==l?t[l.id][h[a].target.id]=h[a].getCost():(t[h[a].source.id]||(t[h[a].source.id]={},n[h[a].source.id]={}),t[l.id][h[a].source.id]=h[a].getCost())}for(a=0;a<e;a++)for(o=0;o<e;o++)for(s=0;s<e;s++)if(o!=s&&s!=a&&o!=a){let l=r.getVertexAt(o).id,h=r.getVertexAt(s).id,d=r.getVertexAt(a).id;t[l][d]+t[d][h]<=t[l][h]&&t[l][d]+t[d][h]!=1/0&&(t[l][h]=t[l][d]+t[d][h],n[l][h]||(n[l][h]=[]),n[l][h].unshift([r.getVertexAt(a),t[l][h]]))}return{paths:t,parents:n}}var Xc=class{constructor(r){c(this,"vertices");c(this,"ne");this.vertices=[r],this.ne=new Set}addVertex(r){this.vertices.push(r),r.getAllEdges().forEach(e=>this.ne.add(e))}get edges(){return Array.from(this.ne)}};var E0=[null,[1,-1],[1,1],[-1,1],[-1,-1]],f0=[null,[-1,-1],[-1,1],[1,1],[1,-1]],Li=2*Math.PI;function wi(i,r){return{x:i.x+r.x,y:i.y+r.y}}function Fb(i,r){return{x:i.x-r.x,y:i.y-r.y}}function Nr(i,r){return r.x===i.x?r.y>i.y?1/0:-1/0:r.y===i.y?r.x>i.x?0:-0:(r.y-i.y)/(r.x-i.x)}function Ub(i,r){return-1/Nr(i,r)}function Pe(i,r){return Math.sqrt(Math.pow(r.y-i.y,2)+Math.pow(r.x-i.x,2))}function kG(i,r){return Math.abs(r.y-i.y)+Math.abs(r.x-i.x)}function Is(i,r){return r.x>i.x||r.x==i.x?r.y>i.y?2:1:r.y>i.y?3:4}function yl(i,r){let e=Nr(i,r),t=Math.atan(e),n=Is(i,r);return(n==4||n==3)&&(t+=Math.PI),t<0&&(t+=2*Math.PI),t}function tt(i,r){return!(i.x+i.width<r.x||i.x>r.x+r.width||i.y+i.height<r.y||i.y>r.y+r.height)}function uE(i,r){let e=Math.max(0,Math.min(i.x+i.width,r.x+r.width)-Math.max(i.x,r.x)),t=Math.max(0,Math.min(i.y+i.height,r.y+r.height)-Math.max(i.y,r.y));return e*t}function Ib(i){let r=i[1].y-i[0].y,e=i[0].x-i[1].x;return{A:r,B:e,C:r*i[0].x+e*i[0].y}}function pE(i,r){return r=r==null?3:r,Math.floor(i*Math.pow(10,r))/Math.pow(10,r)}var Qn=1e-6;function xl(i,r){let e=Ib(i),t=Ib(r),n=e.A*t.B-t.A*e.B;if(Math.abs(n)<Qn)return null;{let o={x:(t.B*e.C-e.B*t.C)/n,y:(e.A*t.C-t.A*e.C)/n},s=Math.min(i[0].x,i[1].x),a=Math.max(i[0].x,i[1].x),l=Math.min(i[0].y,i[1].y),h=Math.max(i[0].y,i[1].y),d=Math.min(r[0].x,r[1].x),u=Math.max(r[0].x,r[1].x),p=Math.min(r[0].y,r[1].y),g=Math.max(r[0].y,r[1].y);return o.x>=s-Qn&&o.x<=a+Qn&&o.y>=l-Qn&&o.y<=h+Qn&&o.x>=d-Qn&&o.x<=u+Qn&&o.y>=p-Qn&&o.y<=g+Qn?o:null}}function hr(i,r){let e=[];return[[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y}],[{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height}],[{x:r.x,y:r.y},{x:r.x,y:r.y+r.height}],[{x:r.x,y:r.y+r.height},{x:r.x+r.width,y:r.y+r.height}]].forEach(n=>{let o=xl(i,n);o!=null&&e.push(o)}),e}function Yb(i,r){return Ms(r,i[0],!0)||Ms(r,i[1],!0)||hr(i,r).length>0}function WG(i,r,e){let t=i.x,n=i.x+i.width,o=i.y,s=i.y+i.height,a=r.x,l=r.x+r.width,h=r.y,d=r.y+r.height,u=(p,g,m,E)=>e?p<=g&&m>=E:p<g&&m>E;return u(t,a,n,l)&&u(o,h,s,d)}function Ms(i,r,e){return e?i.x<=r.x&&i.x+i.width>=r.x&&i.y<=r.y&&i.y+i.height>=r.y:i.x<r.x&&i.x+i.width>r.x&&i.y<r.y&&i.y+i.height>r.y}function kt(i,r,e){let t=Nr(i,r),n=Is(i,r),o=e>0?E0[n]:f0[n],s=Math.atan(t),a=Math.abs(e*Math.sin(s))*o[1],l=Math.abs(e*Math.cos(s))*o[0];return{x:i.x+l,y:i.y+a}}function Dt(i,r,e){let t=Nr(i,r),n=Math.atan(-1/t),o=e/2*Math.sin(n),s=e/2*Math.cos(n);return[{x:r.x+s,y:r.y+o},{x:r.x-s,y:r.y-o}]}function ZG(i,r,e){let t={x:(i.x+r.x)/2,y:(i.y+r.y)/2},n=Nr(i,r),o=Math.atan(-1/n),s=e/2*Math.sin(o),a=e/2*Math.cos(o);return[{x:t.x,y:t.y},{x:t.x-a,y:t.y-s}]}function he(i,r,e,t){e=e==null?r.thresholdX==null?r.width/2:r.thresholdX:e,t=t==null?r.thresholdY==null?r.height/2:r.thresholdY:t;let n=Math.floor(i.x/r.width),o=r.width*n,s=o+r.width,a=Math.abs(i.x-o)<=e?o:Math.abs(s-i.x)<=e?s:i.x,l=Math.floor(i.y/r.height),h=r.height*l,d=h+r.height,u=Math.abs(i.y-h)<=t?h:Math.abs(d-i.y)<=t?d:i.y;return{x:a,y:u}}function JG(i,r){let e=Math.floor(i.x/r.width),t=r.width*e,n=t+r.width,o=Math.floor(i.y/r.height),s=r.height*o,a=s+r.height;return{x:n,y:a}}function y0(i,r,e,t){let n=Math.max(i,r);i=Math.min(i,r),r=n;let o=Math.max(e,t);return e=Math.min(e,t),t=o,i<=e&&e<=r&&i<=t&&t<=r?{point1:e,point2:t}:i<=e&&e<=r&&t>=r?{point1:e,point2:r}:e<=i&&i<=t&&t<=r?{point1:i,point2:t}:i===e&&r===t||r===e&&i===t?{point1:i,point2:r}:e<=i&&i<=t&&e<=r&&r<=t?{point1:i,point2:r}:null}function gE(i,r,e,t,n=0){let o=y0(i,r,e,t);return o==null?!1:Math.abs(o.point2-o.point1)>n}function zb(i,r,e){let t=i.x-r,n=i.y-e,o=i.width+2*r,s=i.height+2*e,a=Object.assign({},i);return Object.assign(a,{x:t,y:n,width:o,height:s})}function Xb(i,r){let e=Math.min(i.x,r.x),t=Math.min(i.y,r.y),n=Math.max(i.x+i.width,r.x+r.width),o=Math.max(i.y+i.height,r.y+r.height),s=n-e,a=o-t;return{x:e,y:t,width:s,height:a}}function jb(i,r){let e=i[0].x,t=i[1].x,n=i[0].y,o=i[1].y,s=r[0].x,a=r[1].x,l=r[0].y,h=r[1].y;if(e===t&&n===o||s===a&&l===h)return null;let d=(h-l)*(t-e)-(a-s)*(o-n);if(d===0)return null;let u=((a-s)*(n-l)-(h-l)*(e-s))/d,p=e+u*(t-e),g=n+u*(o-n);return{x:p,y:g}}function Mb(i,r){if(i[0].x===i[1].x){let e=i[0].y<i[1].y?1:-1;return[{x:i[0].x+e*r,y:i[0].y},{x:i[0].x+e*r,y:i[1].y}]}else if(i[0].y===i[1].y){let e=i[0].x<i[1].x?1:-1;return[{y:i[0].y+e*r,x:i[0].x},{y:i[0].y+e*r,x:i[1].x}]}else{let e=Nr(i[0],i[1]),t=Math.atan(-1/e),n=length/2*Math.sin(t),o=length/2*Math.cos(t);return[{x:i[0].x+o,y:i[0].y+n},{x:i[1].x+o,y:i[1].y+n}]}}function Hb(i,r){return[Mb(i,r),Mb(i,-r)]}function KG(i,r,e){if(i[0].x===i[1].x){let t=i[0].y<i[1].y?1:-1;return[r,{x:r.x,y:r.y+t*e}]}else if(i[0].y===i[1].y){let t=i[0].x<i[1].x?1:-1;return[r,{x:r.x+t*e,y:r.y}]}else{let t=Nr(i[0],i[1]),n=Math.atan(-1/t),o=e*Math.sin(n),s=e*Math.cos(n);return[r,{x:r.x+s,y:r.y+o}]}}var jc=(i,r,e,t)=>Math.abs(e-i)+Math.abs(t-r),qG=(i,r,e,t)=>Math.pow(Math.pow(e-i,2)+Math.pow(t-r,2),.5),QG=(i,r,e,t)=>Math.max(Math.abs(e-i),Math.abs(t-r)),e$=(i,r,e,t)=>{let n=Math.abs(e-i),o=Math.abs(t-r),s=Math.SQRT2-1;return n<o?s*n+o:s*o+n};function bl(i){let r=i%360;return r<0&&(r+=360),r}function Vb(i,r){return i.x*r.x+i.y*r.y}function cE(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function Gb(i){let r=cE(i);return r===0?{x:0,y:0}:{x:i.x/r,y:i.y/r}}function x0(i,r,e){e=e*Math.PI/180;let t=Math.cos(e),n=Math.sin(e),o=(i.x-r.x)*t-(i.y-r.y)*n+r.x,s=(i.x-r.x)*n+(i.y-r.y)*t+r.y;return{x:o,y:s}}function dE(i){let r=i.x+i.width/2,e=i.y+i.height/2,t={x:r,y:e},n=i.r||0,o=i.width/2,s=i.height/2,a=[{x:r-o,y:e-s},{x:r+o,y:e-s},{x:r+o,y:e+s},{x:r-o,y:e+s}];return n===0?a:a.map(l=>x0(l,t,n))}function $b(i){let r=dE(i),e=[],t={x:r[1].x-r[0].x,y:r[1].y-r[0].y};cE(t)>0&&e.push(Gb({x:-t.y,y:t.x}));let n={x:r[3].x-r[0].x,y:r[3].y-r[0].y};return cE(n)>0&&e.push(Gb({x:-n.y,y:n.x})),e.length===0&&(e.push({x:1,y:0}),e.push({x:0,y:1})),e}function Bb(i,r){let e=Vb(i,r[0]),t=e;for(let n=1;n<r.length;n++){let o=Vb(i,r[n]);o<e?e=o:o>t&&(t=o)}return{min:e,max:t}}function b0(i,r,e,t){return i<=t&&e<=r}function kb(i,r){if(i.r===0&&r.r===0)return tt(i,r);let e=dE(i),t=dE(r),n=[...$b(i),...$b(r)];for(let o of n){let s=Bb(o,e),a=Bb(o,t);if(!b0(s.min,s.max,a.min,a.max))return!1}return!0}var A0=!0;function U(...i){if(A0&&typeof console!="undefined")try{let r=arguments[arguments.length-1];console.log(r)}catch(r){}}function Zb(i,r){let e=i.prototype;for(;e!=null;){if(e instanceof r)return!0;e=e.prototype}return!1}function mE(i,r){let e=i.indexOf(r);return e>-1&&i.splice(e,1),e!==-1}function c$(i,r,e){i.findIndex(e)===-1&&i.push(r)}function Jb(i,r,e,t){let n=i[r];return n==null&&(n=[],i[r]=n),n[t?"unshift":"push"](e),n}function d$(i,r,e,t){let n=i.get(r);return n==null&&(n=[],i.set(r,n)),n[t?"unshift":"push"](e),n}function EE(i,r,e){return i.indexOf(r)===-1?(e?i.unshift(r):i.push(r),!0):!1}function fE(i,r){let e=null;return i.forEach(t=>{r(t)&&(e=t)}),e}function Nt(i,r){let e=i.findIndex(r);return e>-1&&i.splice(e,1),e!==-1}function Me(i,r,e){let t={x:i.x-r.x,y:i.y-r.y},n=Math.cos(e/360*Math.PI*2),o=Math.sin(e/360*Math.PI*2);return{x:t.x*n-t.y*o+r.x,y:t.y*n+t.x*o+r.y,cr:n,sr:o}}function Ct(i){if(i==null)return null;let r=i.replace(/^\s\s*/,""),e=/\s/,t=r.length;for(;e.test(r.charAt(--t)););return r.slice(0,t+1)}function yE(i,r,e,t){if(r.length===0)r.push(i);else{let n=t?-1:1,o=0,s=r.length,a=Math.floor((o+s)/2);for(;s>o;)e(i,r[a])*n<0?s=a:o=a+1,a=Math.floor((o+s)/2);r.splice(a,0,i)}}function Di(){return{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}function ft(i){return{x:i.x,y:i.y}}function ei(i){return{width:i.width,height:i.height}}function u$(i){return{x:i.x,y:i.y,width:i.width,height:i.height}}function xE(i,r,e){return{x:i.x+e*r.x,y:i.y+e*r.y,width:i.width,height:i.height}}var Yt=[];for(let i=0;i<256;i++)Yt[i]=(i<16?"0":"")+i.toString(16);function $(){let i=Math.random()*4294967295|0,r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return Yt[i&255]+Yt[i>>8&255]+Yt[i>>16&255]+Yt[i>>24&255]+"-"+Yt[r&255]+Yt[r>>8&255]+"-"+Yt[r>>16&15|64]+Yt[r>>24&255]+"-"+Yt[e&63|128]+Yt[e>>8&255]+"-"+Yt[e>>16&255]+Yt[e>>24&255]+Yt[t&255]+Yt[t>>8&255]+Yt[t>>16&255]+Yt[t>>24&255]}function _o(i=6){return $().substring(0,i-1)}function S0(i){return[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}]}function Kb(i,r){let e=S0(r).map(t=>({p:t,d:Pe(t,i)}));return e.sort((t,n)=>Math.sign(t.d-n.d)),e[0].p}function De(i,r,e){if(i==null)return null;if(r==="$data"||r==null)return i;let t=r.match(/^\{(.*)\}$/);if(t){let a={},l=t[1].split(",");for(let h=0;h<l.length;h++){let d=l[h].split(":"),u=De(i,d[1]);a[Ct(d[0])]=u||d[1].replace(/'/g,"")}return a}r=r.replace(/\['([^']*)'\]/g,".$1");let n=i,o=n,s=null;return r.replace(/([^\.])+/g,(a,l,h,d)=>{if(s!=null)return;let u=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),p=h+a.length>=d.length,g=function(){return o[u[1]]||function(){return o[u[1]]=[],o[u[1]]}()};if(p)if(u){let m=g(),E=u[3];e==null?s=m[E]:m[E]=e}else e==null?s=o[a]:o[a]=e;else if(u){let m=g();o=m[u[3]]||function(){return m[u[3]]={},m[u[3]]}()}else o=o[a]||function(){return o[a]={},o[a]}()}),s}function Al(i,r){let e={left:[],right:[]};for(let t=0;t<i.length;t++){let n=i[t];r(n)?e.left.push(n):e.right.push(n)}return e}function qb(i){return i.filter(r=>r!=null&&Ct(r).length>0)}function Qb(i,r){for(let e=0;e<i.length;e++){let t=i[e];t==null||t.length===0||r(e,t)}}function kc(i,r,e){let t=e.map((n,o)=>{let[s,a]=[r.x+r.width*n.x,r.y+r.height*n.y],l=Math.sqrt(Math.pow(i.x-s,2)+Math.pow(i.y-a,2));return{p:n,idx:o,distance:l}});return t.sort((n,o)=>n.distance<o.distance?-1:1),t[0]}function Gs(i,r,e){return i.has(r)||i.set(r,e()),i.get(r)}function $s(i,r,e){return i[r]==null&&(i[r]=e()),i[r]}function Hc(i){return Object.prototype.toString.call(i)==="[object Number]"}function j(i){return typeof i=="string"}function Po(i){return typeof i=="boolean"}function cr(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Object]"}function T0(i){return Object.prototype.toString.call(i)==="[object Date]"}function nn(i){return Object.prototype.toString.call(i)==="[object Function]"}function v0(i){return nn(i)&&((i==null?void 0:i.toString())||"").startsWith("class")}function p$(i){return nn(i)&&i.name!=null&&i.name.length>0}function Sl(i){for(let r in i)if(i.hasOwnProperty(r))return!1;return!0}function Tl(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null)return!1;for(let e in i){let t=i[e],n=r[e];if(!Wb(t,n))return!1}return!0}function g$(i){let r={};for(let e in i)i[e]!=null&&(r[e]=i[e]);return r}function lt(i){if(j(i))return""+i;if(Po(i))return!!i;if(T0(i))return new Date(i.getTime());if(nn(i))return i;if(Array.isArray(i))return i.map(r=>lt(r));if(cr(i)){let r={};for(let e in i)r[e]=lt(i[e]);return r}else return i}function Sn(i,r,e,t){let n={},o,s,a={};for(e=e||[],t=t||[],s=0;s<e.length;s++)n[e[s]]=!0;for(s=0;s<t.length;s++)a[t[s]]=!0;let l=lt(i);for(s in r)if(l[s]==null||a[s])l[s]=r[s];else if(n[s])o=[],o.push.apply(o,Array.isArray(l[s])?l[s]:[l[s]]),o.push(r[s]),l[s]=o;else if(j(r[s])||Po(r[s])||nn(r[s])||Hc(r[s]))l[s]=r[s];else if(Array.isArray(r[s]))o=[],Array.isArray(l[s])&&o.push.apply(o,l[s]),o.push.apply(o,r[s]),l[s]=o;else if(cr(r[s])){cr(l[s])||(l[s]={});for(let h in r[s])l[s][h]=r[s][h]}return l}function Wb(i,r){if(i!=null&&r==null)return!1;if((i==null||j(i)||Po(i)||Hc(i))&&i!==r)return!1;if(Array.isArray(i))if(Array.isArray(r)){if(!C0(i,r))return!1}else return!1;else if(cr(i))if(cr(i)){if(!Tl(i,r))return!1}else return!1;return!0}function C0(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null||i.length!==r.length)return!1;for(let e=0;e<i.length;e++)if(!Wb(i[e],r[e]))return!1;return!0}function eA(i,r){return i.x===r.x&&i.y===r.y}function tA(i,r){let e=i.slice(),t={x:e[0],y:e[1],cr:0,sr:0};return r.forEach(n=>{t=Me(t,n.c,n.r)}),t}function rA(i,r){return r.forEach(e=>{i=Me(i,e.c,e.r)}),i}function bE(i,r,e){if(i==null)return;let t=i,n=t;return r.replace(/([^\.])+/g,(o,s,a,l)=>{let h=o.match(/([^\[0-9]+){1}(\[)([0-9+])/),d=a+o.length>=l.length,u=function(){return n[h[1]]||function(){return n[h[1]]=[],n[h[1]]}()};if(d)h?u()[h[3]]=e:n[o]=e;else if(h){let p=u();n=p[h[3]]||function(){return p[h[3]]={},p[h[3]]}()}else n=n[o]||function(){return n[o]={},n[o]}();return""}),i}function Oo(i,r,e,t){let n=s=>{let a=s.match(/(\${.*?})/g);if(a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-1)]||"";h!=null&&(s=s.replace(a[l],h))}if(a=s.match(/({{.*?}})/g),a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-2)]||"";h!=null&&(s=s.replace(a[l],h))}return s},o=s=>{if(s!=null){if(v0(s))return s;if(j(s))return n(s);if(nn(s)&&!t&&(e==null||(s.name||"").indexOf(e)===0))return s(r);if(Array.isArray(s)){let a=[];for(let l=0;l<s.length;l++)a.push(o(s[l]));return a}else if(cr(s)){let a={};for(let l in s)a[l]=o(s[l]);return a}else return s}};return o(i)}var Vs=class{constructor(r,...e){this.sorter=r;c(this,"stack");this.stack=e.slice(),this.stack.sort(this.sorter)}get length(){return this.stack.length}add(r){yE(r,this.stack,this.sorter,!0)}update(r){this.delete(r),this.add(r)}pop(){return this.stack.pop()}delete(r){let e=this.stack.indexOf(r);e>-1&&this.stack.splice(e,1)}head(){return this.stack.length===0?null:this.stack[0]}peek(){return this.stack.length===0?null:this.stack[this.stack.length-1]}isEmpty(){return this.stack.length===0}clear(){this.stack.length=0}};function _l(i){return H(i)?i.getParent().id:i.getFullId()}function ti(i){return H(i)?i.getParent():i}function K(i){return i!=null&&i.objectType===ce.objectType}function AE(i){return K(i)&&i.group!=null}function Y(i){return i!=null&&i.objectType===se.objectType}function SE(i){return Y(i)&&i.group!=null}function rt(i){return i!=null&&i.objectType===ze.objectType}function H(i){return i!=null&&i.objectType===de.objectType}function oA(i){return i.objectType===ce.objectType||i.objectType===se.objectType}function Ni(i){return K(i)||Y(i)||H(i)}function v$(i,...r){let e=_l(i.source),t=_l(i.target);return r.find(n=>e===n.id||t===n.id)!=null}function TE(i){return i.id}var P0=".";function vl(i,r){if(r==null)return i.edges;{let e=[];for(let t=0;t<i.edges.length;t++)r(i.edges[t])&&e.push(i.edges[t]);return e}}function _0(i,r){let e=vl(i,r).slice(0);if(K(i)||Y(i))for(let t=0;t<i.ports.length;t++)e.push.apply(e,vl(i.ports[t],r));return e}function nA(i){return vl(i,r=>r.source==i)}function iA(i){return vl(i,r=>r.target==i)}function C$(i){let r=nA(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,nA(i.ports[e]));return r}function P$(i){let r=iA(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,iA(i.ports[e]));return r}function vE(i,r,e,t){let n=new Set,o=(a,l)=>{let h=l.source===a||l.target===a;return h?t?t(l):h:!1},s=a=>{a.members.forEach(l=>{let h=o.bind(null,l);(e?_0(l,h):vl(l,h)).forEach(u=>n.add(u)),!r&&Y(l)&&s(l)})};return s(i),Array.from(n)}function ed(i){let r=0,e=i.group;for(;e!=null;)r++,e=e.group;return r}function Tn(i){let r=ti(i),e=[],t=r.group;for(;t!=null;)e.push(t),t=t.group;return e}function We(i,r){return i==null||r==null?!1:Tn(i).indexOf(r)!==-1}function sA(i,r){let e=!1,t=n=>{for(let o=0;o<n.members.length;o++)if(Y(n.members[o]))if(n.members[o].id===i.id){e=!0;break}else t(n.members[o])};return t(r),e}function Bs(i){let r=[],e=t=>{t.members.forEach(n=>{r.push(n),Y(n)&&e(n)})};return e(i),r}function _$(i,r){let t=!(K(i)||Y(i))||r?i.getSourceEdges():i.getAllSourceEdges();return Array.from(new Set(t.map(n=>n.target)))}function O$(i,r){let t=!(K(i)||Y(i))||r?i.getTargetEdges():i.getAllTargetEdges();return Array.from(new Set(t.map(n=>n.source)))}function R$(i,r){let e=new Set,t=K(i)||Y(i),n=!t||r?i.getSourceEdges():i.getAllSourceEdges(),o=!t||r?i.getTargetEdges():i.getAllTargetEdges();return n.forEach(s=>e.add(s.target)),o.forEach(s=>e.add(s.source)),Array.from(e)}function aA(i,r){return i.getSourceEdges().find(e=>e.target===r)!=null||i.getTargetEdges().find(e=>e.source==r)!=null}var Pl=class{constructor(r){c(this,"nodes",[]);c(this,"id");c(this,"edges",[]);c(this,"groups",[]);c(this,"we",new Map);c(this,"Vr",new Map);c(this,"Ue",new Map);c(this,"defaultDirected");c(this,"defaultCost");c(this,"Kt");c(this,"typeFunction");c(this,"enableSubgraphs");c(this,"portSeparator");c(this,"Bo",{});r=r||{},this.nodes=[],this.edges=[],this.groups=[],this.id=r.id,this.defaultDirected=r.defaultDirected!==!1,this.defaultCost=r.defaultCost||1,this.Kt=r.defaultIdFunction||TE,this.typeFunction=r.typeFunction||function(e){return e.type||"default"},this.enableSubgraphs=r.enableSubgraphs===!0,this.portSeparator=r.portSeparator||P0}Ea(r){delete this.Bo[r.id]}fa(r){this.Bo[r.id]=r}iE(){this.Bo={}}getIdFunction(){return this.Kt}setIdFunction(r){this.Kt=r}getType(r){return this.typeFunction(r)}getId(r,e){return r==null?$():typeof r=="string"?r:(e||this.getIdFunction())(r)||$()}getTopLevelElements(){return this.Bo}setEnableSubgraphs(r){this.enableSubgraphs=r}setPortSeparator(r){this.portSeparator=r}getPortSeparator(){return this.portSeparator}splitPortId(r){return r!=null?r.split(this.portSeparator):[]}getVertexByPortId(r){let e=this.splitPortId(r);if(e.length===2)return this.we.get(e[0])||this.Ue.get(e[0])}getVertex(r,e){if(r==null)return null;let t;if(typeof r!="string"){if(r.constructor===de||r.constructor===ce||r.constructor===se)return r;let s=r;if(t=this.Kt(r),typeof t!="string")return s}t=r;let n=this.enableSubgraphs?t.split("/"):[t],o=s=>{if(this.we.has(s))return this.we.get(s);if(this.Ue.has(s))return this.Ue.get(s);let a=s.split(this.portSeparator),l=a[0],h=this.we.get(l)||this.Ue.get(l);if(a.length===2&&h!=null){let d=h.getPort(a[1]);return d==null&&e&&(d=h.$addPort(a[1])),d}else return h};if(n.length==1)return o(n[0]);if(n.length>1&&n.length%2==0)throw"Subgraph path format error.";{let s=null,a=null;for(let l=0;l<n.length-1;l+=2)s=o(n[l]),a=s.getGraph(n[l+1]);return a.getVertex(n[n.length-1])}}clear(){this.nodes.length=0,this.groups.length=0,this.we.clear(),this.Vr.clear(),this.Ue.clear(),this.iE()}getVertices(){return this.nodes}getVertexCount(){return this.nodes.length}getVertexAt(r){return this.nodes[r]}getEdgeCount(){return this.Vr.size}addEdge(r,e,t){let n=r.directed==null?this.defaultDirected===!0:r.directed!==!1,o=r.cost||this.defaultCost,s=this.getVertex(r.source,!0),a=this.getVertex(r.target,!0);if(e=e||this.getId(r.data,t),s==null||s.objectType==null)throw new TypeError("Unknown source node ["+r.source+"]");if(a==null||a.objectType==null)throw new TypeError("Unknown target node ["+r.target+"]");let l=new ze({source:s,target:a,cost:o,directed:n,data:r.data||{},id:e,graph:this,transient:r.transient,anchors:r.anchors});return l.source.$addEdge(l),l.source!==l.target&&l.target.$addEdge(l),this.Vr.set(e,l),r.geometry!=null&&(l.geometry=r.geometry),l}addNode(r,e){let t=new ce(this,r||{},e||this.Kt);return this.we.has(t.id)?null:(this.nodes.push(t),this.we.set(t.id,t),this.fa(t),t)}addNodes(r,e){for(let t=0;t<r.length;t++)this.addNode(r[t],e||this.Kt)}addGroup(r,e){let t=new se(this,r,e||this.Kt);return this.Ue.has(t.id)?this.Ue.get(t.id):(this.groups.push(t),this.Ue.set(t.id,t),this.fa(t),t)}getGroupCount(){return this.groups.length}getGroupAt(r){return this.groups[r]}getGroups(){return this.groups}$addMemberToGroup(r,e){let t=typeof e=="string"?this.Ue.get(e):e,n=this.getVertex(r);n&&t&&(t.$addMember(n),this.Ea(n))}$removeMemberFromGroup(r){let e=this.getVertex(r);e&&e.group&&(e.group.$removeMember(e),this.fa(e))}getGroup(r){return typeof r=="string"?this.Ue.get(r):r}deleteGroup(r,e){let t={group:typeof r=="string"?this.Ue.get(r):r,edges:[],nodes:[],nestedGroups:[],children:[]};if(t.group){t.parentGroup=t.group.group,t.children=t.group.members.slice();let n;if(e){let{left:l,right:h}=Al(t.group.getMembers(),d=>Y(d));l.forEach(d=>{t.nestedGroups.push(this.deleteGroup(d,!0))}),h.forEach(d=>{t.nodes.push(this.deleteNode(d))})}else t.group.getMembers().forEach(l=>delete l.group);t.group.members.length=0,t.edges=t.group.getAllDirectEdges().slice();let o=t.edges.length;for(n=0;n<o;n++)this.deleteEdge(t.edges[n]);let s=t.group.getPorts();for(let l=0;l<s.length;l++)this.deletePort(s[l]);this.Ue.delete(t.group.id);let a=-1;for(let l=0;l<this.groups.length;l++)if(this.groups[l].id===t.group.id){a=l;break}a>-1&&this.groups.splice(a,1),t.group.group!=null&&t.group.group.$removeMember(r),this.Ea(t.group)}return t}deletePort(r){let e=r.getEdges();for(let t=0;t<e.length;t++)this.deleteEdge(e[t]);return e}$_removeNodeFromCache(r){let e=-1;for(let t=0;t<this.nodes.length;t++)if(this.nodes[t].id===r.id){e=t;break}e>-1&&(this.nodes.splice(e,1),r.group!=null&&r.group.$removeMember(r)),this.we.delete(r.id)}deleteNode(r){let e=this.getVertex(r),t={node:null,edges:[],parentGroup:null};if(e){t.node=e,t.parentGroup=e.group;let n=e.getPorts();for(let s=0;s<n.length;s++)this.deletePort(n[s]);let o=e;this.$_removeNodeFromCache(o),t.edges=e.getEdges().slice();for(let s=0;s<t.edges.length;s++)this.deleteEdge(t.edges[s]);this.Ea(e)}return t}deleteEdge(r){if(r=this.getEdge(r),r==null)return;let e=this.getVertex(r.source,!1);e&&e.$deleteEdge(r);let t=this.getVertex(r.target,!1);t&&t.$deleteEdge(r),this.Vr.delete(r.getId())}getEdge(r){if(r!=null){if(typeof r!="string"){if(r.constructor===ze)return r;let e=r;if(r=this.Kt(r),typeof r!="string")return e}return this.Vr.get(r)}}getEdges(r){r=r||{};let e=r.source!=null,t=r.target!=null,n=r.node?this.getVertex(r.node):null,o=r.filter||function(){return!0},s=d=>(!e||(r.source===!0?d.source===n:d.source!==n))&&(!t||(r.target===!0?d.target===n:d.target!==n)),a=[],l=d=>{o(d)&&s(d)&&a.push(d)},h;if(r.node){let u=this.getVertex(r.node).getAllEdges();for(h=0;h<u.length;h++)l(u[h])}else this.Vr.forEach((d,u)=>l(d));return a}getAllEdges(){let r=[];return this.Vr.forEach((e,t)=>r.push(e)),r}renamePort(r,e){return r.getParent().$renamePort(r,e)?(r.id=e,!0):!1}findPath(r,e,t,n,o){let s=this.getVertex(r),a=this.getVertex(e);return zc({graph:this,source:s,target:a,strict:t!==!1,nodeFilter:n,edgeFilter:o})}getDistance(r,e,t){return this.findPath(r,e,t).pathDistance}setTarget(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.target;return r.target.$deleteEdge(r),r.target=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}setSource(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.source;return r.source.$deleteEdge(r),r.source=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}printPath(r,e){let t=this.getVertex(r),n=this.getVertex(e),o=this.findPath(t,n).path,s="["+t.id+" - "+n.id+"] : ";for(let a=0;a<o.length;a++)s=s+"{ vertex:"+o[a].vertex.id+", cost:"+o[a].cost+", edge: "+(o[a].edge&&o[a].edge.getId())+" } ";return s}getDiameter(r){let e=0;for(let t=0;t<this.nodes.length;t++)for(let n=0;n<this.nodes.length;n++)if(n!=t){let o=zc({graph:this,source:this.nodes[t],target:this.nodes[n]});if(o.path==null||o.path.length==0){if(!r)return 1/0}else e=Math.max(e,o.pathDistance)}return e}getCentrality(r){let e=this.getVertex(r);return(e.getIndegreeCentrality()+e.getOutdegreeCentrality())/(this.getVertexCount()-1)}getIndegreeCentrality(r){return this.getVertex(r).getIndegreeCentrality()/(this.getVertexCount()-1)}getOutdegreeCentrality(r){return this.getVertex(r).getOutdegreeCentrality()/(this.getVertexCount()-1)}getCloseness(r){return 1/this.getFarness(r)}getFarness(r){let e=this.getVertex(r),t=zc({graph:this,source:e,target:e,processAll:!0}),n=0;for(let o in t.dist)n+=t.dist[o];return n/(this.getVertexCount()-1)}getBetweenness(r){let e=this.getVertexCount(),t=(e-1)*(e-2)/2,n=0,o=0,s=(h,d,u,p,g)=>{let m=u.parents[h][d];if(m.length==0){let E=p.slice();E.unshift(h),g.push(E)}else for(let E=0;E<m.length;E++)if(p.indexOf(m[E][0].id)==-1){let y=p.slice();y.unshift(m[E][0].id),s(h,m[E][0].id,u,y,g)}},a=this.getVertex(r),l=Nb({graph:this,focus:a});for(let h in l.paths)for(let d in l.paths[h])if(h!=d){let u=[],p=0;s(h,d,l,[d],u);for(let g=0;g<u.length;g++){let m=u[g].indexOf(a.id);m>0&&m<u[g].length-1&&p++}n+=p/u.length,o+=p}return n/t}inspect(){let r="";for(let e=0;e<this.nodes.length;e++)r+=this.nodes[e].inspect()+`
2
+ `;return r}serialize(){let r={nodes:[],edges:[],groups:[]},e,t,n;for(let o=0;o<this.nodes.length;o++)if(e=this.nodes[o],!e.transient){r.nodes.push(Object.assign({},e.data)),t=e.getAllEdges();for(let s=0;s<t.length;s++)if(t[s].source==e||t[s].source.objectType===de.objectType&&t[s].source.getParent()==e){let a={source:t[s].source.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}for(let o=0;o<this.groups.length;o++){n=this.groups[o],r.groups.push(Object.assign({},n.data)),t=n.getEdges();for(let s=0;s<t.length;s++)if(t[s].source===n){let a={source:n.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}return r}getClusters(){return this.Mc(this.nodes,this.groups)}getCluster(r){let e=K(r)?[r]:[],t=Y(r)?[r]:[];return this.Mc(e,t)[0]}Mc(r,e){let t=[],n={},o,s=(a,l)=>{if(a==null||n[a.id])return;l==null?(l=new Xc(a),t.push(l)):l.addVertex(a),n[a.id]=!0;let h=a.getAllEdges();for(let d=0;d<h.length;d++){let u=h[d].source===a?h[d].target:h[d].source;s(u,l)}};for(o=0;o<r.length;o++)s(this.nodes[o]);for(o=0;o<e.length;o++)s(this.groups[o]);return t}},Wc=class{constructor(r,e={}){this.graph=r;this.data=e;c(this,"atts",new Map);c(this,"type");this.data=this.data||{},this.type=r.getType(this.data)}setAttribute(r,e){this.atts.set(r,e)}getAttribute(r){return this.atts.get(r)}getType(){return this.type}setType(r){this.type=r}};function Cl(i){return i instanceof de?i.id:i}var Zc=class extends Wc{constructor(e,t,n){super(e,t);this.graph=e;c(this,"id");c(this,"transient");c(this,"transientRenderer");c(this,"dummy");c(this,"edges",[]);c(this,"indegreeCentrality",0);c(this,"outdegreeCentrality",0);c(this,"graphs",[]);this.id=e.getId(t,n),this.data=typeof t=="string"?{id:t}:t}getIndegreeCentrality(){return this.indegreeCentrality}getOutdegreeCentrality(){return this.outdegreeCentrality}addGraph(e){return e=typeof e=="string"?new Pl({id:e}):e,this.graphs.push(e),e.id||(e.id=""+this.graphs.length),e}getGraph(e){for(let t=0;t<this.graphs.length;t++)if(this.graphs[t].id===e)return this.graphs[t]}getFullId(){return this.id}getEdges(e){if(e==null||e.filter==null)return this.edges;{let t=[];for(let n=0;n<this.edges.length;n++)e.filter(this.edges[n])&&t.push(this.edges[n]);return t}}getSourceEdges(){return this.getEdges({filter:e=>e.source==this})}getTargetEdges(){return this.getEdges({filter:e=>e.target==this})}$addEdge(e){this.edges.push(e),(e.source===this||!e.isDirected())&&this.outdegreeCentrality++,(e.target===this||!e.isDirected())&&this.indegreeCentrality++}$deleteEdge(e){let t=-1;for(let n=0;n<this.edges.length;n++)if(this.edges[n].getId()===e.getId()){t=n;break}return t>-1?(this.edges.splice(t,1),(e.source===this||!e.isDirected())&&this.outdegreeCentrality--,(e.target===this||!e.isDirected())&&this.indegreeCentrality--,!0):!1}inspect(){let e="{ id:"+this.id+`, edges:[
3
3
  `;for(let t=0;t<this.edges.length;t++)e+=this.edges[t].inspect()+`
4
- `;return e+="]}",e}isChildOf(e){return!1}},kc=class kc extends Hc{constructor(e,t,n){super(e,t,n);c(this,"objectType",kc.objectType);c(this,"ports",[]);c(this,"group");c(this,"portMap",{});c(this,"defaultInternalCost",0);c(this,"internalEdges",{})}getAllEdges(e){let t=e==null?null:{filter:e},n=this.getEdges(t).slice(0);for(let o=0;o<this.ports.length;o++)n.push.apply(n,this.ports[o].getEdges(t));return n}getAllSourceEdges(){let e=this.getSourceEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getAllTargetEdges(){let e=this.getTargetEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getDirectEdges(e){return this.getEdges(e==null?null:{filter:e})}getDirectSourceEdges(){return this.getSourceEdges()}getDirectTargetEdges(){return this.getTargetEdges()}getPortEdges(e){let t=[];for(let n=0;n<this.ports.length;n++)t.push.apply(t,this.ports[n].getEdges(e==null?null:{filter:e}));return t}getPortSourceEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getPortTargetEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getIndegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getIndegreeCentrality();return this.indegreeCentrality+e}getOutdegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getOutdegreeCentrality();return this.outdegreeCentrality+e}getPorts(){return this.ports}$addPort(e,t){let n=this.graph.getId(e,t),o=this.getPort(n);return o==null&&(o=new ce(this,e,t),this.ports.push(o),this.portMap[o.id]=o),o}$setPort(e,t){let n=this.getPort(e);return n||(n=this.$addPort({id:e})),n.data=t,n.setType(this.graph.getType(t)),n}getPort(e){return this.portMap[e]}$renamePort(e,t){return this.portMap[e.id]?(this.portMap[t]=this.portMap[e.id],delete this.portMap[e.id],!0):!1}$removePort(e){let t=!1;if(e){let n=Tl(e),o=-1;for(let s=0;s<this.ports.length;s++)if(this.ports[s].id===n){o=s;break}if(o!=-1){let s=this.ports[o];this.graph.deletePort(s),this.ports.splice(o,1),t=!0}delete this.portMap[n]}return t}$setDefaultInternalCost(e){this.defaultInternalCost=e}getInternalEdge(e,t){let n=Tl(e),o=Tl(t),s={source:this.portMap[n],target:this.portMap[o],cost:1/0};if(s.source&&s.target){let a=this.internalEdges[n+"-"+o]||{cost:this.defaultInternalCost,directed:!1};Object.assign(s,a)}return s}$setInternalEdge(e,t,n,o){let s=Tl(e),a=Tl(t);return this.internalEdges[s+"-"+a]={cost:n||this.defaultInternalCost,directed:o},this.getInternalEdge(e,t)}};c(kc,"objectType","Node");var he=kc,Wc=class Wc extends Hc{constructor(e,t,n){super(e.graph,t,n);this.parent=e;c(this,"objectType",Wc.objectType)}getParent(){return this.parent}getFullId(){return this.parent.id+this.graph.getPortSeparator()+this.id}isChildOf(e){return this.parent===e}getAllEdges(e){return this.getEdges(e==null?null:{filter:e})}};c(Wc,"objectType","Port");var ce=Wc,Zc=class Zc extends he{constructor(e,t,n){super(e,t,n);c(this,"objectType",Zc.objectType);c(this,"members",[]);c(this,"$o",{})}$addMember(e){return this.$o[e.id]!=null?!1:(this.members.push(e),this.$o[e.id]=e,e.group=this,!0)}getMemberCount(){return this.members.length}getMembers(){return this.members}$removeMember(e){let t=typeof e=="string"?this.$o[e]:e;if(t){let n=this.members.indexOf(t);return n!=-1&&(this.members.splice(n,1),delete this.$o[t.id]),t.group&&t.group.id===this.id&&delete t.group,!0}else return!1}getAllDirectEdges(e){let t=[],n,o=e==null?null:{filter:e};t.push.apply(t,this.getEdges(o).slice(0));let s=this.getPorts();for(n=0;n<s.length;n++)t.push.apply(t,s[n].getEdges(o));return t}getInternalEdges(e){let t=[],n={};for(let o=0;o<this.members.length;o++)Array.prototype.push.apply(t,this.members[o].getAllEdges(e).filter(function(s){let a=s.getId(),l=n[a]==null;return n[a]=!0,l}));return t}};c(Zc,"objectType","Group");var oe=Zc,Jc=class Jc extends jc{constructor(e){super(e.graph,e.data);c(this,"objectType",Jc.objectType);c(this,"source");c(this,"target");c(this,"cost");c(this,"directed");c(this,"id");c(this,"geometry");c(this,"transient");c(this,"anchors");this.transient=e.transient===!0,this.source=e.source,this.target=e.target,this.cost=e.cost||1,this.directed=e.directed!==!1,this.id=e.id,e.anchors&&(this.anchors=e.anchors)}getCost(){return this.cost}setCost(e){this.cost=e}getId(){return this.id==null?this.source.id+"_"+this.target.id:this.id}getFullId(){return this.getId()}setId(e){this.id=e}isDirected(){return this.directed}setDirected(e){this.directed=e}inspect(){if(this.id!=null)return"{ id:"+this.id+", cost:"+this.cost+", directed:"+this.directed+", source:"+this.source.id+", target:"+this.target.id+"}"}};c(Jc,"objectType","Edge");var Ye=Jc;var iA="undoRedo",Oo="userActivity",Cl="api",Pl="dataLoad",oA="transient",sA="copyPaste";var EL=(i,r,e)=>{let t=i.nodes||[],n=i.edges||[],o=i.groups||[],s=new Map,a=new Map,l=new Map,h=r.getGroups().map(p=>p.id),d=p=>{let m=l.get(p);m!=null&&m.forEach(g=>{h.push(r.addGroup(g).id)}),l.delete(p),m!=null&&m.forEach(g=>{d(g.id)})};for(let p=0;p<o.length;p++){let m=o[p];if(e.groupDecorator&&e.groupDecorator(m),m[r.groupProperty]!=null&&h.indexOf(m[r.groupProperty])===-1)Ns(l,m[r.groupProperty],()=>[]).push(m);else{let g=r.addGroup(m);a.set(g.id,m),h.push(g.id),d(g.id)}}l.forEach((p,m)=>{if(h.indexOf(m)===-1)throw new Error("Parent group ["+m+"] not found");p.forEach(g=>h.push(r.addGroup(g).id))});for(let p=0;p<t.length;p++){e.nodeDecorator&&e.nodeDecorator(t[p]);let m=r.addNode(t[p]);s.set(m.id,t[p])}function u(p){return j(p)?s.get(p)||a.get(p)||{}:{}}for(let p=0;p<n.length;p++){let m=n[p].data||{},g={source:n[p].source,target:n[p].target,cost:n[p].cost||1,directed:n[p].directed,data:m};if(e.edgeDecorator){let E=u(n[p].source),y=u(n[p].target);e.edgeDecorator(m,E,y)}n[p].anchors&&(g.anchors=n[p].anchors),n[p].geometry&&(g.geometry=n[p].geometry),r.$_addEdge(g,Pl,null)}},fL=(i,r)=>{let e=i.getGraph(),t={nodes:[],edges:[],groups:[]},n,o,s;for(let a=0;a<e.nodes.length;a++){n=e.nodes[a];let l=n.transient;if(!l){let h=Object.assign({},n.data);n.group==null&&delete h[i.groupProperty],t.nodes.push(h)}o=n.getAllEdges();for(let h=0;h<o.length;h++){let d=o[h],u={},p=!1;(d.source===n||d.source.objectType===ce.objectType&&d.source.getParent()==n)&&(d.source.dummy?(p=!0,u.source={x:d.source.data[i.modelLeftAttribute],y:d.source.data[i.modelTopAttribute]}):u.source=d.source.getFullId(),d.target.dummy?(p=!0,u.target={x:d.target.data[i.modelLeftAttribute],y:d.target.data[i.modelTopAttribute]}):u.target=d.target.getFullId(),(!l||p)&&(d.data&&(u.data=Object.assign({},d.data)),d.geometry&&(u.geometry=Object.assign({},d.geometry)),t.edges.push(u)))}}for(let a=0;a<e.groups.length;a++){s=e.groups[a];let l=Object.assign({},s.data);s.group==null&&delete l[i.groupProperty],t.groups.push(l),o=s.getEdges();for(let h=0;h<o.length;h++)if(o[h].source===s||o[h].source.objectType===ce.objectType&&o[h].source.getParent()==s){let d={source:s.getFullId()};o[h].target.dummy?d.target={x:o[h].target.data[i.modelLeftAttribute],y:o[h].target.data[i.modelTopAttribute]}:d.target=o[h].target.getFullId(),o[h].data&&(d.data=Object.assign({},o[h].data)),o[h].geometry&&(d.geometry=Object.assign({},o[h].geometry)),t.edges.push(d)}}return t},yL=(i,r,e)=>{let t=n=>{let o=r.addNode(n);if(n.children)for(let s=0;s<n.children.length;s++){let a=r.addNode(n.children[s]);r.$_addEdge({source:o,target:a},Pl,null),t(n.children[s])}};t(i)},Wt="json",AE="hierarchical-json",aA={[Wt]:fL},lA={[Wt]:EL,[AE]:yL};function hA(i,r){lA[i]=r}function Z$(i,r){aA[i]=r}function cA(i,r,e,t){let n=lA[i];if(n==null)throw new Error("VisuallyJs - parse - ["+i+"] is an unsupported type");return n(r,e,t)}function SE(i,r,e){let t=aA[i];if(t===null)throw new Error("VisuallyJs - exportData - ["+i+"] is an unsupported type");return t(r,e)}var TE=class{constructor(){c(this,"ze",{});c(this,"ua",!1);c(this,"pa",!1);c(this,"Yg",{ready:!0});c(this,"_c",[])}fire(r,e,t){return this.fireUnchecked(r,e,t)}fireUnchecked(r,e,t){let n=null;if(this.pa)this._c.unshift(arguments);else{if(this.pa=!0,!this.ua&&this.ze[r]){let o=this.ze[r].length,s=0,a=!1;if(!this.shouldFireEvent||this.shouldFireEvent(r,e,t))for(;!a&&s<o&&n!==!1;){if(this.Yg[r])this.ze[r][s](e,t);else try{n=this.ze[r][s](e,t)}catch(l){U("VisuallyJs: fire failed for event "+r+" : "+(l.message||l))}s++,(this.ze==null||this.ze[r]==null)&&(a=!0)}}this.pa=!1,this.Xg()}return n}Xg(){let r=this._c.pop();r&&this.fire.apply(this,r)}unbind(r,e){if(arguments.length===0)this.ze={};else if(arguments.length===1){if(typeof r=="string")delete this.ze[r];else if(r.ii){let t;for(let n in r.ii)t=r.ii[n],cE(this.ze[t]||[],r)}}else arguments.length===2&&cE(this.ze[r]||[],e);return this}getListener(r){return this.ze[r]||[]}isSuspendEvents(){return this.ua}setSuspendEvents(r){this.ua=r}bind(r,e,t){return this.bindUnchecked(r,e,t)}bindAll(r,e,t){return r.forEach(n=>this.bind(n,e,t)),this}bindUnchecked(r,e,t){return(o=>{Hb(this.ze,o,e,t),e.ii=e.ii||{},e.ii[B()]=o})(r),this}silently(r){this.setSuspendEvents(!0);try{r()}catch(e){U("Cannot execute silent function "+e)}this.setSuspendEvents(!1)}},zt=class extends TE{shouldFireEvent(r,e,t){return!0}};var Ol=class{constructor(r,e){this.instance=r;c(this,"result");c(this,"Rc",[]);c(this,"cn",{});this.result=r.getGraph().findPath(e.source,e.target,e.strict,e.nodeFilter,e.edgeFilter);for(let t=0;t<this.result.path.length;t++)this.Rc.push(this.result.path[t].vertex),this.cn[this.result.path[t].vertex.getFullId()]=[this.result.path[t].vertex,t]}deleteEdges(){for(let r=0;r<this.result.path.length;r++)this.result.path[r].edge&&this.instance.removeEdge(this.result.path[r].edge);return this}deleteVertices(){for(let r=0;r<this.result.path.length;r++)this.instance.removeNode(this.result.path[r].vertex);return this}contains(r,e){let t=this.instance.findGraphObject(r),n=!1;if(t){for(let o=0;o<this.result.path.length;o++)if(this.result.path[o].vertex==t||this.result.path[o].edge==t||!e&&this.result.path[o].vertex.objectType==ce.objectType&&this.result.path[o].vertex.isChildOf(t)){n=!0;break}}return n}getVertices(){return this.Rc}getVertex(r){return this.cn[typeof r=="string"?r:r.id][0]}getAllEdgesFor(r){let e=this.cn[r.id][1];return e<this.result.path.length-1?[this.result.path[e+1].edge]:[]}filter(r,e){U("not implemented.")}Ye(r,e){for(let t=e||0;t<this.result.path.length;t++)try{r(t,this.result.path[t])}catch(n){U("Path iterator function failed",n)}}each(r){this.Ye((e,t)=>{r(e,t)})}eachVertex(r){this.Ye((e,t)=>{r(e,t.vertex)})}eachEdge(r){this.Ye((e,t)=>{r(e,t.edge)},1)}eachNode(r){this.Ye((e,t)=>{K(t.vertex)&&r(e,t.vertex)})}eachGroup(r){this.Ye((e,t)=>{Y(t.vertex)&&r(e,t.vertex)})}getVertexCount(){return this.result.path.length}getNodeAt(r){return this.result.path[r].vertex}getEdgeCount(){return this.result.path.length==0?0:this.result.path.length-1}getEdgeAt(r){return r<0&&(r=this.result.path.length-1+r),this.result.path.length>r+1?this.result.path[r+1].edge:null}deleteAll(){this.deleteVertices()}isEmpty(){return this.result.path.length==0}getCost(){return this.result.pathDistance}exists(){return this.result.pathDistance!=null}};var qc=class{constructor(r,e){c(this,"Lc",new Map);c(this,"wc",new Map);c(this,"Dc",new Map);if(e!=null){let t=e.nodes||{};for(let s in t)this.Lc.set(s,t[s]);let n=e.groups||{};for(let s in n)this.wc.set(s,n[s]);let o=e.ports||{};for(let s in o)this.Dc.set(s,o[s])}}getNodeDefinition(r){return this.Lc.get(r)||{}}getGroupDefinition(r){return this.wc.get(r)||{}}getPortDefinition(r){return this.Dc.get(r)||{}}};var Sn=class i{constructor(r){c(this,"instance");c(this,"adapter");c(this,"$vertices",[]);c(this,"parameters");c(this,"done");c(this,"width");c(this,"height");c(this,"container");c(this,"containerSize");c(this,"padding");c(this,"xShift");c(this,"yShift");c(this,"oi");this.oi=r.options.locationFunction,this.adapter=r.adapter,this.instance=r.instance,this.container=r.container,this.containerSize=this.adapter.getSize(this.container),this.width=r.options.width||this.containerSize.width,this.height=r.options.height||this.containerSize.height,this.padding=r.options.padding,this.done=!1,this.parameters=r.options||{}}dn(){this.done=!1,this.$vertices.length=0,this.reset()}static jg(){return{padding:{x:0,y:0}}}Hg(){let r=Object.assign(i.jg(),this.getDefaultParameters()||{});return Object.assign(r,this.parameters||{}),this.parameters=r,this.parameters}getSize(r,e){return Is(e,r,()=>{let t=this.adapter.getViewportPositionById(r);return t!=null?{width:t.width,height:t.height}:{width:0,height:0}})}kg(r,e,t,n,o){t=t||10,n=n||10;let s=Math.floor(Math.random()*t),a=Math.floor(Math.random()*n);return{x:s,y:a}}Nc(r){if(this.instance==null)return;this.containerSize=this.adapter.getSize(this.container),this.width=this.containerSize.width,this.height=this.containerSize.height;let e=this.Hg();this.$vertices=this.adapter.getElements().slice();let t={},n={},o=1/0,s=1/0,a=-1/0,l=-1/0,h=(p,m,g)=>{let E=n[p]||{width:0,height:0};o=Math.min(o,m),s=Math.min(s,g),a=Math.max(a,m+E.width),l=Math.max(l,g+E.height),t[p]={x:m,y:g}},d=p=>t[p];this.$vertices.forEach(p=>this.getSize(p.id,n)),this.begin(this.instance,d,h,n,e);let u=()=>{let p={};this.$vertices.forEach(m=>p[m.id]=t[m.id]),this.end(this.instance,d,h,n,e),r&&r({positions:p,bounds:{xmin:o,ymin:s,xmax:a,ymax:l},sizes:n,layout:this})};for(;!this.done;)this.step(this.instance,d,h,n,e);u()}relayout(r,e){this.dn(),r!=null&&(this.parameters=r),this.Nc(e)}layout(r){this.done=!1,this.Nc(r)}};var Qc=class{};var dA={},nt={get:(i,r)=>{let e=dA[i];if(e)return r.options=r.options||{},new e(r);throw{message:"VisuallyJs: unknown layout type '"+i+"'"}},register:(i,r)=>{dA[i]=r}};var ed=class ed extends Sn{constructor(e){super(e);c(this,"type",ed.type)}getDefaultParameters(){return{}}reset(){}begin(e,t,n,o,s){this.$vertices.forEach(a=>n(a.id,0,0))}end(e,t,n,o,s){}step(e,t,n,o,s){this.done=!0}};c(ed,"type","Empty");var Vs=ed;nt.register(Vs.type,Vs);function xL(i){return{x:i.data.left,y:i.data.top}}var ri=class extends Sn{constructor(e){super(e);c(this,"Ic");c(this,"absoluteBacked");this.absoluteBacked=e.options.absoluteBacked===!0,this.Ic=e.options.locationFunction}$_findLocation(e,t){return(t!=null&&t.locationFunction?t.locationFunction:this.Ic||xL)(e)}begin(e,t,n,o,s){let a=this.adapter.getElements(),l=a.length;for(let h=0;h<l;h++){let d=a[h],u=d.getFullId(),p=t(u);p==null&&(p=this.$_findLocation(d,s),isNaN(p.x)&&(p.x=0),isNaN(p.y)&&(p.y=0)),n(u,p.x,p.y)}}step(e,t,n,o,s){this.done=!0}end(e,t,n,o,s){}reset(){}getAbsolutePosition(e,t){return e==null?{x:null,y:null}:this.$_findLocation(e,t)}},bL="Absolute",td=class td extends ri{constructor(e){super(e);c(this,"type",td.type)}getDefaultParameters(){return{}}};c(td,"type",bL);var _o=td;nt.register(_o.type,_o);function AL(i,r,e,t){return i[r]<=t&&t<=i[r]+i[e]}var rd=[(i,r)=>i.x+i.width-r.x,(i,r)=>i.x-(r.x+r.width)],nd=[(i,r)=>i.y+i.height-r.y,(i,r)=>i.y-(r.y+r.height)],uA=[null,[rd[0],nd[1]],[rd[0],nd[0]],[rd[1],nd[0]],[rd[1],nd[1]]],SL=(i,r,e,t,n)=>{isNaN(e)&&(e=0);let o=r.y+r.height,s=e==1/0||e==-1/0?r.x+r.width/2:(o-t)/e,a=Math.atan(e),l,h,d;return AL(r,"x","width",s)?(l=uA[n][1](i,r),h=l/Math.sin(a),d=h*Math.cos(a),{x:d,y:l}):(d=uA[n][0](i,r),h=d/Math.cos(a),l=h*Math.sin(a),{x:d,y:l})};function Ii(i,r){let e=i.center||{x:i.x+i.width/2,y:i.y+i.height/2},t=r.center||{x:r.x+r.width/2,y:r.y+r.height/2},n=Nr(e,t),o=Ls(e,t),s=n==1/0||n==-1/0||isNaN(n)?0:e.y-n*e.x;return SL(i,r,n,s,o)}function ni(i,r,e){let t=r.width+2*e.x,n=r.height+2*e.y;return{x:i.x-t/2,y:i.y-n/2,width:t,height:n}}function pA(i){let r=[];if(i==null)return null;if(Array.isArray(i)){let e=[];return e.push.apply(e,i),e}else for(let e in i)r.push(i[e]);return r}var TL={x:20,y:20},vL=1/0;function mA(i,r){let e={x:i.x,y:i.y};if(r!=null){let t=le(i,r);i.x=t.x,i.y=t.y,i.center!=null&&(i.center.x=i.x+i.width/2,i.center.y=i.y+i.height/2)}return{moved:e.x!==i.x||e.y!==i.y,pos:i}}var Mi=class{constructor(r){c(this,"De");c(this,"H");c(this,"ma");c(this,"pt");c(this,"Vc");c(this,"Vr",null);c(this,"un");c(this,"k");c(this,"pn");c(this,"Mc");c(this,"W",[]);c(this,"he",new Map);c(this,"Bo",new Map);c(this,"mn",new Map);c(this,"gn",new Set);c(this,"Fo",!1);c(this,"Gc");c(this,"Ot",new Map);this.pn=r.positionGetter,this.Mc=r.positionSetter,this.k=r.getId,this.un=r.getSize,this.H=pA(r.elements||[]),this.pt=r.filter||(e=>!0),this.Vc=r.exclude||(e=>!1),this.ma=r.constrain||((e,t,n)=>n)}executeAtPoint(r,e){return this.H.length>0?(this.si((e==null?void 0:e.getSize)||this.un,(e==null?void 0:e.getPosition)||this.pn,e==null?void 0:e.knownLocations),this.ga(r),this.Vr=null,this.Ea(e)):{original:{},current:{}}}executeAtCenter(r){if(this.H.length>0){let e=this.si((r==null?void 0:r.getSize)||this.un,(r==null?void 0:r.getPosition)||this.pn,r==null?void 0:r.knownLocations);return this.ga({x:(e.minx+e.maxx)/2,y:(e.miny+e.maxy)/2}),this.Vr=null,this.Ea(r)}else return{original:{},current:{}}}executeWithFocus(r,e){return this.H.length>0?(this.si((e==null?void 0:e.getSize)||this.un,(e==null?void 0:e.getPosition)||this.pn,e==null?void 0:e.knownLocations,e==null?void 0:e.knownSizes),this.Vr={id:r,bounds:this.he.get(r),element:this.H.find(t=>t.id===r)},this.ga(this.Vr.bounds.center),this.Ea(e)):{original:{},current:{}}}snapToGrid(r){let e={original:{},current:{}};this.si(this.un,this.pn);for(let t=0;t<this.W.length;t++){let n=this.he.get(this.W[t].id),{moved:o,pos:s}=mA(this.W[t].bounds,r);o&&(e.original[this.W[t].id]=n,e.current[this.W[t].id]=s)}return this.$c(e),e}setElements(r){return this.H=pA(r),this}startTracking(r,e,t){return this.setElements(r),this.si(this.un,this.pn),this.Gc=t||vL,this.mn.clear(),this.gn.clear(),this.Bo.entries().forEach(n=>{this.mn.set(n[0],Object.assign({},n[1]))}),this.Fo=e,this}stopTracking(){this.mn.clear(),this.gn.clear(),this.Fo=!1}addElement(r,e){return r!=null&&(e||this.H.indexOf(r)===-1)&&this.H.push(r),this}addElements(r,e){if(e)Array.prototype.push.apply(this.H,r);else for(let t=0;t<r.length;t++)this.addElement(r[t]);return this}removeElement(r){let e=-1;for(let t=0;t<this.H.length;t++)if(this.H[t]===r){e=t;break}return e!==-1&&this.H.splice(e,1),this}reset(){this.H.length=0}ga(r){r!=null&&(this.De=r)}si(r,e,t,n){return this.W.length=0,this.he.clear(),this.Bo.clear(),this.Ot.clear(),this.Wg(this.H,r,e,t,n)}Wg(r,e,t,n,o){let s,a,l,h;s=a=1/0,l=h=-1/0,n=n||{},o=o||{};for(let d=0;d<r.length;d++){let u=n[r[d].id]||t(r[d]),p=o[r[d].id]||e(r[d]),m=this.k(r[d]),g={x:u.x,y:u.y,width:p.width,height:p.height,center:{x:u.x+p.width/2,y:u.y+p.height/2}};this.he.set(m,g),this.Bo.set(m,Object.assign({},g)),this.W.push({bounds:g,id:m,element:r[d]}),this.Ot.set(m,p),s=Math.min(s,u.x),a=Math.min(a,u.y),l=Math.max(l,u.x+p.width),h=Math.max(h,u.y+p.height)}return{minx:s,maxx:l,miny:a,maxy:h}}Zg(r,e,t,n){if(this.mn.has(r)){let o=this.mn.get(r),s=this.he.get(r),a={x:s.x+o.width/2,y:s.y+o.height/2},l=Ue(o.center,a),h=l/Math.ceil(l/10),d=Math.round(l/h)+1,u=Math.atan2(o.center.y-a.y,o.center.x-a.x);if(l>this.Gc)return null;let p=null,m=0;for(let g=1;g<d;g++){let E={x:a.x+g*h*Math.cos(u),y:a.y+g*h*Math.sin(u)},y=ni(E,o,{x:0,y:0});mA(y,n);let x=!0;for(let f=0;f<this.W.length;f++){let b=this.W[f];if(b.id!==r&&!t(b.id,b.element)){let A=b.bounds,T=ni(A.center,A,e);if(tt(y,T)){x=!1;break}}}if(x)m=g,p={x:E.x-o.width/2,y:E.y-o.height/2};else break}return p!=null?{moved:!0,reverted:m===d-1,positionReached:p}:null}else return null}Jg(r={},e,t,n,o){if((this.Fo&&!o||!this.Fo&&o)&&this.gn.size>0){let a=!1;for(;!a;){let l=!0;this.gn.forEach(h=>{let d=this.Zg(h,e,t,n);if(d!=null&&d.moved){let u=this.mn.get(h),p=d.reverted?{x:u.x,y:u.y}:d.positionReached;r[h]=p;let m=this.he.get(h);m.x=p.x,m.y=p.y,m.center.x=p.x+u.width/2,m.center.y=p.y+u.height/2,d.reverted&&this.gn.delete(h),l=!1}}),a=l}}}Ea(r){let e={};if(this.H.length>1){r=r||{};let n=r.filter||this.pt,o=r.padding||TL,s=r.iterations,a=r.exclude||this.Vc;r.gather&&Object.assign(e,this.Kg(o,this.ma,n,a)),Object.assign(e,this.qg(o,this.ma,n,s,a,r.grid)),this.Jg(e,o,a,r.grid,r.invertTrackbackPreference)}let t={original:{},current:{}};for(let n in e)t.original[n]=this.Bo.get(n),t.current[n]=e[n],this.gn.add(n);return this.$c(t),t}Kg(r,e,t,n){let o={},s=ni(this.De,{width:0,height:0},r);this.Bc();let a={},l=h=>{let d=[this.De,h],u=[];Array.prototype.push.apply(u,hr(d,s).map(p=>[s,p,null]));for(let p in a){let m=this.he.get(p);Array.prototype.push.apply(u,hr(d,m).map(g=>[m,g,p]))}return u.filter(p=>p!=null)};for(let h=0;h<this.W.length;h++){if(n(this.W[h].id,this.W[h].element))continue;let d=this.W[h].bounds,u=this.W[h].bounds,p=ni(d.center,u,r);if(t(this.W[h].id,this.W[h].element)){let m=l(d.center);if(m.length>0){m.sort((y,x)=>{let f=Ue(y[1],d),b=Ue(x[1],d);return f<b?-1:1});let g=m[0][0],E=Ii(g,p);d.x+=E.x,d.y+=E.y,d.center.x+=E.x,d.center.y+=E.y,o[this.W[h].id]=d,a[this.W[h].id]=!0}}}return o}qg(r,e,t,n,o,s){n=n||2;let a,l;this.Vr!=null?(a=ni(this.De,this.Vr.bounds,{x:0,y:0}),l=this.Vr.id):a=ni(this.De,{width:0,height:0},r),this.Bc();let h=1,d=!0,u,p,m={},g=(x,f,b,A)=>{f.x+=b,f.y+=A,f.center.x+=b,f.center.y+=A,m[x]=f},E=(x,f)=>{if(s==null)return f;{let b=wi(x,f),A=b.x/s.width,T=b.y/s.height,S=f.x>=0?Math.ceil(A):Math.floor(A),R=f.y>=0?Math.ceil(T):Math.floor(T),v={x:s.width*S,y:s.height*R};return Vb(v,x)}},y=()=>{let x,f;for(let b=0;b<this.W.length;b++){if(x=this.W[b],o(x.id,x.element))continue;let A=x.bounds,T=ni(A.center,A,r);x.id!==l&&t(x.id,x.element)&&tt(a,T)&&(u=Ii(a,T),u=E(A,u),p=e(x.id,A,u),g(x.id,A,p.x,p.y),T=ni(A.center,A,r));for(let S=0;S<this.W.length;S++)if(b!==S){if(f=this.W[S],f.id===l||o(f.id,f.element))continue;if(t(f.id,f.element)){let R=f.bounds,v=ni(R.center,R,r);tt(T,v)&&(d=!0,u=Ii(T,v),u=E(R,u),p=e(f.id,R,u),g(f.id,R,p.x,p.y))}}}d&&h<n&&(d=!1,h++,y())};return y(),m}$c(r){for(let e=0;e<this.H.length;e++){let t=this.k(this.H[e]);r.current[t]&&this.Mc(this.H[e],r.current[t])}}Bc(){let r={};this.W.sort((e,t)=>{let n=r[e.id]||Math.min(Ue(e.bounds,this.De),Ue(wi(e.bounds,{x:e.bounds.width,y:0}),this.De),Ue(wi(e.bounds,{x:e.bounds.width,y:e.bounds.height}),this.De),Ue(wi(e.bounds,{x:0,y:e.bounds.height}),this.De)),o=r[t.id]||Math.min(Ue(t.bounds,this.De),Ue(wi(t.bounds,{x:t.bounds.width,y:0}),this.De),Ue(wi(t.bounds,{x:t.bounds.width,y:t.bounds.height}),this.De),Ue(wi(t.bounds,{x:0,y:t.bounds.height}),this.De));return r[e.id]=n,r[t.id]=o,n===o?0:n<o?-1:1})}};var gA={x:30,y:30},od=class od extends Sn{constructor(e){super(e);c(this,"Fc");c(this,"Uc");c(this,"type",od.type);c(this,"padding",gA);this.Fc=e.options.centerRoot===!0,this.padding=e.options.padding||gA,this.Uc=e.options.centerContent===!0}getDefaultParameters(){return{padding:this.padding,locationFunction:this.oi}}begin(e,t,n,o,s){}end(e,t,n,o,s){}reset(){}step(e,t,n,o,s){let a=this.$vertices.slice(),l=0,h=0,d,u,p=10;if(this.Fc&&a.length>0){let y=this.getSize(a[0].id,o);p=Math.max(y.width,y.height)+80,n(a[0].id,0,0),a=a.slice(1)}if(a.length===0){this.done=!0;return}let m=2*Math.PI/a.length,g=-Math.PI/2;for(d=0;d<a.length;d++)if(u=a[d],n(u.id,l+Math.sin(g)*p,h+Math.cos(g)*p),g+=m,d>0){let y=a[d-1],x=this.getSize(y.id,o),f=t(y.id),b={x:f.x-s.padding.x,y:f.y-s.padding.y,width:x.width+2*s.padding.x,height:x.height+2*s.padding.y},A=a[d],T=this.getSize(A.id,o),S=t(A.id),R={x:S.x-s.padding.x,y:S.y-s.padding.y,width:T.width+2*s.padding.x,height:T.height+2*s.padding.y},v=Ii(b,R),O=[f.x+x.width/2,f.y+x.height/2],P=[S.x+v.x+T.width/2,S.y+v.y+ +(T.height/2)],I=Math.sqrt(Math.pow(O[0]-P[0],2)+Math.pow(O[1]-P[1],2));p=Math.max(p,I/2/Math.sin(m/2))}let E=this.Uc?{x:this.width/2,y:this.height/2}:{x:0,y:0};for(d=0;d<a.length;d++)u=a[d],n(u.id,l+Math.sin(g)*p+E.x,h+Math.cos(g)*p+E.y),g+=m;this.done=!0}};c(od,"type","Circular");var id=od;nt.register(id.type,id);var vE="Grid",CE="Column",PE="Row";var Pe="width",Me="height",l2="rotation",sd="v",EA="h",Se="top",He="left",yt="right",ht="bottom",It="center",Q="x",ye="y",Tn="dlr",ii="drl",nn="none",on="orthogonal",fA="manhattan",ad="diagonal",yA="metro",xA=-1,pe="v",ne="h",bA="undefined",be="default",Pt="true",ct="false",AA="left",SA="top",TA="rotation",vA="width",CA="height",it="source",vn="target";var CL={x:30,y:30},Vi="row",OE="column",Ro=class extends Sn{constructor(e){super(e);c(this,"En",[]);c(this,"fa");c(this,"ya");c(this,"me");c(this,"yn");c(this,"xn");c(this,"Mr");c(this,"Gr");c(this,"xa");c(this,"type");this.type=vE,this.me=e.options.orientation||Vi,this.padding=e.options.padding||CL,this.fa=e.options.verticalAlignment||It,this.ya=e.options.horizontalAlignment||It,this.yn=e.options.rows||-1,this.xn=e.options.columns||-1,this.xa=e.options.sort}getDefaultParameters(){return{orientation:Vi,rows:-1,columns:-1}}begin(e,t,n,o,s){this.En.length=0;let a,l;if(this.xa!=null){let p=this.$vertices.slice();p.sort(this.xa),this.$vertices=p}if(this.yn===-1&&this.xn===-1){let p=Math.round(Math.sqrt(this.$vertices.length));a=p+(this.me===Vi?1:0),l=p+(this.me===OE?1:0)}else this.yn!==-1?(a=this.yn,l=Math.ceil(this.$vertices.length/a)):this.xn!==-1&&(l=this.xn,a=Math.ceil(this.$vertices.length/l));this.Mr=-1/0,this.Gr=-1/0;let h=0,[d,u]=this.me===Vi?[a,l]:[l,a];for(let p=0;p<d;p++){this.En[p]=[];for(let m=0;m<u;m++)if(h=p*u+m,h<this.$vertices.length){let g=this.$vertices[h],E=this.getSize(g.id,o);this.Mr=Math.max(this.Mr,E.width),this.Gr=Math.max(this.Gr,E.height),this.En[p][m]={vertex:g,size:E}}}}end(e,t,n,o,s){}reset(){}Qg(e){let t=this.me===Vi&&this.yn===1||this.ya===He?0:this.ya===It?(this.Mr-e.width)/2:this.Mr-e.width,n=this.me===OE&&this.xn===1||this.fa===Se?0:this.fa===It?(this.Gr-e.height)/2:this.Gr-e.height;return{padX:t,padY:n}}step(e,t,n,o,s){let a=0,l=0;for(let h=0;h<this.En.length;h++){for(let d=0;d<this.En[h].length;d++){let u=this.En[h][d],{padX:p,padY:m}=this.Qg(u.size);n(u.vertex.id,a+p,l+m),this.me===Vi?a+=this.padding.x*2+(this.yn===1?u.size.width:this.Mr):l+=this.padding.y*2+(this.xn===1?u.size.height:this.Gr)}this.me===Vi?(l+=this.padding.y*2+this.Gr,a=0):(a+=this.padding.x*2+this.Mr,l=0)}this.done=!0}};c(Ro,"type",vE),nt.register(Ro.type,Ro);var _l=class extends Ro{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:OE,columns:1})})),this.type=CE}};c(_l,"type",CE),nt.register(_l.type,_l);var Rl=class extends Ro{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:Vi,rows:1})})),this.type=PE}};c(Rl,"type",PE),nt.register(Rl.type,Rl);var PA=1e-11,hd=class hd extends ri{constructor(e){super(e);c(this,"Uo");c(this,"type",hd.type);c(this,"H",new Map);c(this,"ai",new Map);c(this,"li");c(this,"_t");c(this,"zo",1/0);c(this,"Yo",-1/0);c(this,"Xo",1/0);c(this,"jo",-1/0);c(this,"Rt",[]);c(this,"ba",new Map);c(this,"Lt");c(this,"Aa");this.Lt=bn(this.getDefaultParameters(),e.options),this._t=e.options.absoluteBacked!==!1}getDefaultParameters(){return{iterations:15,spacing:250,r:.25,locationFunction:this.oi}}bn(e,t,n){return t=aE(t),n=aE(n),e.x=t,e.y=n,e.center.x=t+e.width/2,e.center.y=n+e.height/2,{eE:t,tE:n}}An(e){return this.ai.get(e.id)===!0}rE(e){this.ai.set(e.id,!0)}reset(){super.reset(),this.H.clear(),this.ai.clear(),this.Uo=0,this.zo=this.Xo=1/0,this.Yo=this.jo=-1/0,this.ba.clear()}begin(e,t,n,o,s){this.Rt.length=0,this.H.clear(),this.Uo=0,this.zo=1/0,this.Yo=-1/0,this.Xo=1/0,this.jo=-1/0,this.Aa=this.Lt.r,this._t&&this.$vertices.forEach(a=>{let l=this.$_findLocation(a,s);l!=null&&l.x!=null&&l.y!=null&&n(a.id,l.x,l.y)})}mt(e,t,n){let o=H(e)?e.getParent():e,s=this.H.get(o.id);if(!s){let a=t(o.id)||this.kg(o.id,n,this.width,this.height,!0),l=this.getSize(o.id,n);l.width===0&&(l.width=1),l.height===0&&(l.height=1),s={id:o.id,n:o,x:a.x,y:a.y,f:[0,0],width:l.width,height:l.height,center:{x:a.x+l.width/2,y:a.y+l.height/2}},this.H.set(o.id,s),this.ba.set(o.id,this.instance.getAllEdgesFor(o).filter(h=>this.adapter.filter(h.target)))}return s}Sa(e,t,n){return this.Rt[e]?this.Rt[e]:(this.Rt[e]=this.mt(this.$vertices[e],t,n),this.Rt[e])}step(e,t,n,o,s){let a;for(this.li=0,a=0;a<this.$vertices.length;a++){let l=this.Sa(a,t,o);if(this._t&&!this.An(l)){let d=this.getAbsolutePosition(l.n,s);if(d!=null&&d.x!=null&&d.y!=null&&!isNaN(d.x)&&!isNaN(d.y)){this.zc(l,d.x,d.y),n(l.id,d.x,d.y),this.rE(l),l.x=d.x,l.y=d.y,l.f[0]=0,l.f[1]=0;continue}}for(let d=a+1;d<this.$vertices.length;d++){let u=this.Sa(d,t,o);this.nE(l,u)}let h=this.ba.get(l.id);for(let d=0;d<h.length;d++)this.iE(l,h[d],t,o)}if(this.li!==0){let l=s.spacing*.62;for(a=0;a<this.$vertices.length;a++){let h=this.Sa(a,t,o);if(!this.An(h)){let d=h.f[0],u=h.f[1],p=Math.sqrt(d*d+u*u);p>l&&(d=d/p*l,u=u/p*l),this.zc(h,h.x+d,h.y+u)}h.f[0]=0,h.f[1]=0}}this.Uo++,(this.li===0||this.Uo>=this.Lt.iterations)&&(this.oE(n,o),this.done=!0)}end(e,t,n,o,s){this.ai.clear(),this.H.forEach((a,l)=>{this.ai.set(l,!0)})}zc(e,t,n){let{eE:o,tE:s}=this.bn(e,t,n);this.zo=Math.min(this.zo,o),this.Xo=Math.min(this.Xo,s),this.Yo=Math.max(this.Yo,o),this.jo=Math.max(this.jo,s)}oE(e,t){this.H.forEach((n,o)=>{let s=this.H.get(o);e(o,Math.floor(s.x),Math.floor(s.y))})}nE(e,t){let n=this.An(e),o=this.An(t);if(n&&o||e.width===0||e.height===0||t.width===0||t.height===0)return;let s,a,l,h;if(tt(e,t))h=1,s=1,a=1;else{let d=[e.center,t.center],u=hr(d,e)[0],p=hr(d,t)[0];s=p.x-u.x,a=p.y-u.y,l=s*s+a*a,h=Math.sqrt(l),h<PA&&(h=1,s=1,a=1)}if(h<this.Lt.spacing){this.li++;let d=this.Aa*(this.Lt.spacing-h),u=1,p=1,m=u*d*s/h,g=p*d*a/h,E=o?0:(n?2:1)*m,y=o?0:(n?2:1)*g,x=n?0:(o?2:1)*m,f=n?0:(o?2:1)*g;t.f[0]+=E,t.f[1]+=y,e.f[0]-=x,e.f[1]-=f}}iE(e,t,n,o){let s=this.mt(t.target,n,o),a=this.An(e),l=this.An(s);if(a&&l)return;this.li++;let h,d,u,p,m;if(tt(e,s))p=-2*this.Lt.spacing,h=-2*this.Lt.spacing,d=-2*this.Lt.spacing;else{let y=[e.center,s.center],x=hr(y,e)[0],f=hr(y,s)[0];h=f.x-x.x,d=f.y-x.y,u=h*h+d*d,p=Math.sqrt(u),p<PA&&(p=1,h=1,d=1)}m=this.Aa*(p-this.Lt.spacing),(t.cost==null||t.cost<1)&&(t.cost=1),m*=Math.log(t.cost)*.5+1;let g=m*h/p,E=m*d/p;s.f[0]-=l?0:(a?2:1)*g,s.f[1]-=l?0:(a?2:1)*E,e.f[0]+=a?0:(l?2:1)*g,e.f[1]+=a?0:(l?2:1)*E}};c(hd,"type","ForceDirected");var ld=hd;nt.register(ld.type,ld);function PL(i,r){for(let e=0;e<i.length;e++)if(i[e].target!==r||i[e].source!==r)return!1;return!0}var Gs=class extends ri{constructor(e){super(e);c(this,"Yc");c(this,"Sn");c(this,"Xc");this.Yc=!!e.options.ignoreLoops,this.Xc=e.options.ignorePorts===!0,this.Sn=e.options.getRootNode||(t=>e.options.multipleRoots!==!1?t.filter(n=>{if(tA(n)){let o=n.getTargetEdges();return(o.length===0||PL(o,n))&&this.adapter.filter(n)}else return!1}).getAll():this.$vertices.length>0?[this.$vertices[0]]:null)}begin(e,t,n,o,s){super.begin(e,t,n,o,s),s.ignoreLoops=this.Yc,s.getRootNode=this.Sn,s.getChildVertices=s.getChildVertices||((a,l,h)=>{let d=[];return h.getAllEdgesFor(a).forEach(u=>{let p=H(u.target)?u.target.getParent():u.target;(u.source===a||this.Xc!==!0&&H(u.source)&&u.source.getParent()===a)&&this.adapter.filter(p)&&d.push(p)}),d}),s.rootNode=s.getRootNode(e),s.rootNode||(this.done=!0)}};var OA=It,_A={x:60,y:60},RA="auto",LA=It;function Ll(i){return i.parents.length>0?i.parents[0].loc:null}function cd(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function OL(i){return i.parents.length>0?i.parents[0].root===!0:!1}function wA(i){return i.parents.length>0?i.parents[0].childGroup:null}function _L(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var dd=class{constructor(r,e){this.dataSource=r;c(this,"$r");c(this,"Kt");c(this,"Pe");c(this,"L",[]);c(this,"Br",[]);c(this,"hi",{});c(this,"ne");c(this,"Q");c(this,"wt");c(this,"ge");c(this,"ci");c(this,"Se");c(this,"_t");c(this,"I");c(this,"Tn",-1/0);c(this,"vn",1/0);c(this,"di");c(this,"Dt");c(this,"pi");c(this,"Ne",[]);c(this,"positions",new Map);c(this,"Ta",{[It]:r=>Ll(r)+cd(r,this.Q)/2-(r.size-this.Q)/2,start:r=>Ll(r),end:r=>Ll(r)+cd(r,0)-(r.size-this.Q)});c(this,"k");c(this,"Nt");c(this,"qt");c(this,"mi");c(this,"Ra",{center:(r,e,t)=>(e+t)/2-cd(r)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.$r=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Kt=e.compress===!0,this._t=e.absoluteBacked===!0,this.k=e.idFunction,this.Nt=e.sizeFunction,this.qt=e.childVerticesFunction,this.mi=e.absolutePositionFunction,this.ge=e.axisIndex,this.Se=this.ge!==1,this.ci=this.ge===0?1:0,this.di=this.Se?"y":"x",this.Dt=this.Se?Pe:Me,this.pi=this.Se?Me:Pe,this.Pe=e.invert===!0,this.I=e.alignment||LA,this.ne=e.padding,this.Q=this.Se?this.ne.x:this.ne.y,this.wt=this.Se?this.ne.y:this.ne.x}execute(){let r,e,t;for(let n=0;n<this.$r.length;n++){r=this.$r[n];let o=this.Nt(r.id),s=this.Qe(r,o,0,null,null),a=0;s.root=!0,a=this.gi(s,0);let l=0,h,d,u=(m,g)=>this.Kt&&m.parents&&m.parents.length>0?this.positions.get(this.k(m.parents[0].node)).position[this.di]+this.va(m,this.ci)+this.wt:g,p=!1;if(a===0&&this._t===!0){let m=this.mi(r);!isNaN(m.x)&&!isNaN(m.y)&&(this.Ei(r.id,m,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.ge===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.ge===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.Ei(this.k(this.L[e].entries[t].node),{x:h,y:d},e);this.Pe?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.wt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.wt,l+=this.L[e].otherAxisSize)}}return this.positions}Ei(r,e,t){this.positions.set(r,{position:e,layer:t});let n=this.Nt(r),o=this.ge===0?e.x+n.width:e.y+n.height;this.Tn=Math.max(this.Tn,o),this.vn=Math.min(this.vn,o)}mt(r){let e=this.L[r];return e||(e={entries:[],pointer:0},this.L[r]=e),e}Qe(r,e,t,n,o){let s=this.mt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Dt],children:[]},l=e[this.pi];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.Dt]+this.Q,s.entries.push(a),n&&n.children.push(a),a}Ca(r,e){let t=this.Br[e];t||(t=[],this.Br[e]=t),r.index=t.length,t.push(r)}Pa(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.mt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.Q)}}va(r,e){let t=r.parents.map(n=>n.dimensions[e===0?Pe:Me]);return Math.max.apply(null,t)}Oa(r){if(r.size>0){let e=this.Ta[this.I](r),t=this.Br[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.Q}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.Q;o!==0&&this._a(r),this.Ca(r,r.depth)}}La(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.Ra[this.I](r,e,t),o=n-Ll(r);if(this.Pa(r,n),!OL(r)){let s=wA(r),a=_L(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}_a(r){let e=r;for(;e!=null;)this.La(e),e=wA(e)}gi(r,e){if(this.hi[r.node.id])return;this.hi[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[]},n=[],o,s={},a=this.mt(e+1),l=this.qt(r.node,e,this.dataSource);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.Nt(this.k(h)),u=a.entries.find(p=>this.k(p.node)===this.k(h));if(u!=null){u.parents.push(r);let p=Ll(u),m=cd(u,this.Q),g=p+m/2-u.size/2,E=g-u.loc,y=x=>{for(let f=x.childGroupIndex;f<x.childGroup.nodes.length;f++)x.childGroup.nodes[f].loc+=E,x.children.forEach(y),x.childGroup.size+=E};y(u)}else{let p=this.Qe(h,d,e+1,r,t);p.childGroupIndex=t.nodes.length,t.nodes.push(p);let m=d[this.Dt];t.size+=m+this.Q,n.push(p)}s[h.id]=!0}}for(this.Oa(t),o=0;o<n.length;o++)this.gi(n[o],e+1);return l.length}};var RL="Hierarchical",pd=class pd extends Gs{constructor(e){super(e);c(this,"type",pd.type);c(this,"me");c(this,"Se");c(this,"ge");c(this,"Kt");c(this,"Pe");c(this,"I");c(this,"jc");c(this,"L",[]);c(this,"qt");this.Pe=e.options.invert,this.jc=e.options.spacing||RA,this.Kt=this.jc==="compress",this.I=e.options.align||OA,this.me=e.options.orientation!=null?e.options.orientation:"horizontal"}getDefaultParameters(){return{padding:_A,orientation:this.me,locationFunction:this.oi,align:this.I}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.me=s.orientation,this.Se=this.me==="horizontal",this.ge=this.Se?0:1,this.padding=s.padding,this.L.length=0,this.qt=s.getChildVertices}step(e,t,n,o,s){new dd(e,{rootNode:s.rootNode,compress:this.Kt,padding:this.padding,axisIndex:this.ge,invert:this.Pe,alignment:this.I,idFunction:h=>e.getNodeId(h),sizeFunction:h=>this.getSize(h,o),childVerticesFunction:(h,d,u)=>this.qt(h,d,u),absoluteBacked:this.absoluteBacked,absolutePositionFunction:h=>this.getAbsolutePosition(h,s)}).execute().forEach((h,d)=>{n(d,h.position.x,h.position.y)}),this.done=!0}getHierarchy(){return this.L}getOrientation(){return this.me}};c(pd,"type",RL);var ud=pd;nt.register(ud.type,ud);var _E=class{constructor(r){this.focus=r;c(this,"id");c(this,"children",new Set);c(this,"he",new Map);c(this,"Hc",new Map);c(this,"group");c(this,"extents");c(this,"offsets");this.id=B(),this.group=[r]}setPosition(r,e,t){this.he.set(r,{x:e,y:t})}getPosition(r){return this.he.get(r)}getIncidentAngle(r){return this.Hc.get(r)}setIncidentAngle(r,e){this.Hc.set(r,e)}getPositions(){return this.he}},LL=100,wL={x:50,y:50},gd=class gd extends Gs{constructor(e){super(e);c(this,"type",gd.type);c(this,"kc");c(this,"et",[]);c(this,"clusterMagnetizer");c(this,"groupPadding");this.groupPadding=e.options.groupPadding||LL,this.padding=e.options.padding||wL,this.clusterMagnetizer=new Mi({positionGetter:t=>({x:t.extents[0],y:t.extents[2]}),positionSetter:(t,n)=>{for(let o=0;o<t.group.length;o++){let s=t.offsets[t.group[o].id];t.setPosition(t.group[o].id,n.x+s.x,n.y+s.y)}},getSize:t=>({width:t.extents[1]-t.extents[0],height:t.extents[3]-t.extents[2]}),getId:t=>t.focus.id,filter:t=>this.et[0].focus.id!==t})}getDefaultParameters(){return{padding:this.padding,locationFunction:this.oi,groupPadding:this.groupPadding,getChildEdges:(e,t,n)=>n.getAllEdgesFor(e,o=>{let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target;return s===e&&s!==a&&this.adapter.filter(a)})}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.et.length=0,this.kc=s.getChildEdges}Wc(e,t,n,o,s,a,l){let h=(T,S,R,v)=>({x:T-a.padding.x,y:S-a.padding.y,width:R+2*a.padding.x,height:v+2*a.padding.y}),d,u=new _E(e),p=s?s.position:{x:0,y:0},m=p.x,g=p.y,E={},y=T=>E[T]||(E[T]=this.getSize(T,o),E[T]),x,f,b;u.setPosition(e.id,p.x,p.y);let A=this.kc(e,l,this.instance);for(let T=0;T<A.length;T++){let S=A[T].target,R=H(S)?S.getParent():S;u.children.add(R)}if(x=y(u.focus.id),d=Math.max(x.width,x.height),b=h(m-x.width/2,g-x.height/2,x.width,x.height),n(u.focus.id,-(x.width/2),-(x.height/2)),u.children.size>0){this.et.push(u);let T=2*Math.PI/(u.children.size+(s?1:0)),S=s?s.incidentAngle+Math.PI+T:Math.PI,R=S,v=null;u.children.forEach(N=>{f=y(N.id);let M=h(m+Math.sin(S)*f.width,g+Math.cos(S)*f.height,f.width,f.height),D=Ii(b,M),V=Math.sqrt(Math.pow(M.x+D.x-m,2)+Math.pow(M.y+D.y-g,2));if(d=Math.max(d,V),u.setPosition(N.id,M.x+D.x,M.y+D.y),S+=T,v!=null){let J=y(v.id),fe=u.getPosition(v.id),X=h(fe.x,fe.y,J.width,J.height),ge=y(N.id),Ge=u.getPosition(N.id),Xe=h(Ge.x,Ge.y,ge.width,ge.height),Ut=Ii(X,Xe),nr={x:fe.x+J.width/2,y:fe.y+J.height/2},Ht={x:Ge.x+Ut.x+ge.width/2,y:Ge.y+Ut.y+ +(ge.height/2)},vr=Math.sqrt(Math.pow(nr.x-Ht.x,2)+Math.pow(nr.y-Ht.y,2));d=Math.max(d,vr/2/Math.sin(T/2))}v=N}),S=R,u.children.forEach(N=>{u.setIncidentAngle(N.id,S),u.setPosition(N.id,m+Math.sin(S)*d,g+Math.cos(S)*d),S+=T});let O=u.getPosition(e.id),P=O.x,I=y(e.id),C=P+I.width,_=O.y,w=_+I.height,$;u.children.forEach(N=>{if(!this.Wc(N,t,n,o,{parent:e,incidentAngle:u.getIncidentAngle(N.id),position:u.getPosition(N.id)},a,l+1)){$=y(N.id),u.group.push(N);let D=u.getPosition(N.id);P=Math.min(P,D.x),C=Math.max(C,D.x+$.width),_=Math.min(_,D.y),w=Math.max(w,D.y+$.height)}}),u.extents=[P,C,_,w],u.offsets={};for(let N=0;N<u.group.length;N++){let M=u.group[N],D=u.getPosition(M.id);u.offsets[M.id]={x:D.x-u.extents[0],y:D.y-u.extents[2]}}}return u.children.size}step(e,t,n,o,s){if(s.rootNode&&s.rootNode.length>0){if(this.Wc(s.rootNode[0],t,n,o,null,s,0),this.et.length>0){let a=(this.et[0].extents[0]+this.et[0].extents[1])/2,l=(this.et[0].extents[2]+this.et[0].extents[3])/2;this.clusterMagnetizer.setElements(this.et),this.clusterMagnetizer.executeAtPoint({x:a,y:l},{padding:{x:100,y:100}})}for(let a=0;a<this.et.length;a++)this.et[a].getPositions().forEach((h,d)=>{n(d,h.x,h.y)})}this.done=!0}};c(gd,"type","Balloon");var md=gd;nt.register(md.type,md);var $s=class{constructor(r){this.model=r}};var Cr="edge",wl="vertex",Ed="center",RE=30;function dt(i){return i.type===Cr}var fd=class extends $s{constructor(e,t){super(e);this.vertexSet=t;c(this,"Qt",new Map);c(this,"Ho",!1);c(this,"er");c(this,"Fr",[]);c(this,"Zc",new Set);c(this,"fi");this.fi=e.layout.fi}sE(e){let t=this.model.getAdjacentVertices(e);return t.vertices.filter(n=>this.Qt.has(n.id)==!1).filter(n=>t.target.findIndex(o=>o.id===n.id)!==-1?t.source.findIndex(o=>o.id===n.id)===-1:!1).length}Jc(e,t){let n=this.model.getAdjacentVertices(e.id),o=n.vertices;Array.from(n.filteredEdges).forEach(h=>this.Zc.add(h));let s=[],a,l;for(a=0;a<o.length;a++)if(!this.Qt.has(o[a].id))if(l=this.model.getVertex(o[a].id),l!=null)if(this.sE(o[a].id)===0){let d=t+1,u=this.model.getAdjacentVertices(o[a].id).target.filter(p=>this.Qt.has(p.id));if(u.length>0){let p=Math.max(...u.map(m=>this.vertexSet.findLayerIndex(m.id)));d=Math.max(d,p+1)}this.vertexSet.addToLayer(d,l),s.push(l),o[a].edges.forEach(p=>{let m={edge:p,id:p.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1,type:Cr,entries:[]};this.vertexSet.edgeNodes.push(m),this.vertexSet.edgeNodeMap.set(p.id,m)})}else o[a].edges.forEach(d=>{let u={edge:d,id:d.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1/0,type:Cr,entries:[]};this.vertexSet.edgeNodes.push(u),this.vertexSet.edgeNodeMap.set(d.id,u),this.Fr.push([l,t+1,u])});else this.model.excludedNodes[o[a].id]=!0;for(a=0;a<s.length;a++)this.Qt.set(s[a].id,!0),this.Jc(s[a],t+1)}aE(){let e,t=(o,s)=>o.span>s.span?-1:o.span<s.span?1:o.rootLayer<s.rootLayer?-1:o.rootLayer>s.rootLayer?1:0,n=[];this.vertexSet.edgeNodes.forEach(o=>{o.rootLayer=this.model.getLayer(o.sourceNode),o.targetLayer=this.model.getLayer(o.targetNode),o.rootLayer!=null&&o.targetLayer!=null&&(o.span=o.targetLayer-o.rootLayer,o.span>1&&(n.length===0?n.push(o):t(o,n[0])<=0?n.unshift(o):n.push(o)))});for(let o=0;o<n.length;o++){let s=n[o];if(s.span>1){let l=this.vertexSet.layers[s.rootLayer].entries.filter(u=>!dt(u)),h=l.findIndex(u=>u.obj.id===s.sourceNode.id),d=l.length===1?!1:h<l.length/2;e=this.vertexSet.insertEdgeNodeInLayer(s.rootLayer+1,s,d),this.vertexSet.edgeEntryMap.set(e.id,e);for(let u=s.rootLayer+2;u<s.targetLayer;u++){let p=this.vertexSet.addToLayer(u,s,d);this.vertexSet.edgeEntryMap.set(p.id,p),p.previous=e,e.next=p,e=p}}}}execute(e){for(this.Qt.clear(),this.Ho=!1,this.er=0,this.Fr.length=0,this.Qt.set(e.id,!0);!this.Ho;)if(this.Jc(e,this.er),this.Fr.length>0)if(this.Fr=this.Fr.filter(t=>!this.Qt.has(t[0].id)),this.Fr.length>0){let t=this.Fr.splice(0,1)[0];e=t[0],this.er=t[1],this.Qt.set(e.id,!0),this.vertexSet.addToLayer(this.er,e)}else this.Ho=!0;else this.Ho=!0;this.fi&&this.lE(),this.aE()}lE(){let e=this.vertexSet.layers.length-1;if(!(e<=0))for(let t=0;t<e;t++)this.vertexSet.layers[t].entries.filter(s=>!dt(s)&&s.leaf).forEach(s=>{this.vertexSet.removeFromLayer(t,s),this.vertexSet.addToLayer(e,s)})}getFilteredEdges(){return Array.from(this.Zc)}};var LE=i=>{let r=0;for(let e=0;e<i.length;e++){let t=i[e];t.length>0&&t[0].leaf&&r++,t.length>1&&t[t.length-1].leaf&&r++}return r};function DL(i){let r=0;return i.forEach(e=>r+=e[1]),r/i.length}var Bs=class{constructor(r,e,t){this.vertexSet=r;this.getAdjacentEntries=e;c(this,"yi");c(this,"xi");t=t||{},this.yi=t.maxIterations||24,this.xi=t.maxIterationsWithoutImprovement||5}hE(){let r=[];for(let e=0;e<this.vertexSet.layers.length;e++)r.push(this.vertexSet.layers[e].entries.slice());return r}execute(){let r=this.hE(),e=r,t=0,n=this.Kc(r),o=LE(e);for(let s=0;s<this.yi;s++){let a=this.cE(s,e),l=this.Kc(a);if(l.total<n.total)n=l,t=0,o=LE(a);else if(l.total===n.total){let h=LE(a);h>o&&(n=l,t=0,o=h)}else t++;if(e=a,n.total===0||t>=this.xi)break}this.vertexSet.layers.forEach((s,a)=>{s.entries=n.ordering[a]})}Kc(r){let e=0,t=[],n;for(let o=r.length-2;o>-1;o--)n=this.dE(o,r,o+1),t[o]=n,e+=n.length;return{total:e,layers:t,ordering:r}}dE(r,e,t){let n=[],o=e[r],s=e[t],a=new Array(s.length);for(let u=0;u<a.length;u++)a[u]=[];let l=[],h,d=[];for(h=0;h<o.length;h++){let u=o[h],p=h,m=this.getAdjacentEntries(e,t,u),g=[];for(let E=0;E<m.length;E++){let y=m[E][1];g.push(y)}g.sort(function(E,y){return E-y}),l[p]=g}for(h=0;h<l.length;h++)d=d.concat(l[h].map(u=>[h,u]));for(h=0;h<d.length;h++){let u=d[h],p={sourceLayer:r,targetLayer:t,sourceVertex:u[0],targetVertex:u[1]};a[u[1]].push(p);for(let m=u[1]+1;m<a.length;m++)n.push(...a[m])}return n}cE(r,e){let t=[],n;if(r%2===0){for(n=e.length-1;n>0;n--)t[n]=this.qc(n,e,!1);t[0]=e[0].slice()}else{for(n=0;n<e.length-1;n++)t[n]=this.qc(n,e,!0);t[e.length-1]=e[e.length-1].slice()}return t}qc(r,e,t){let n=e[r],o=n.length,s=[],a=t?r+1:r-1,l={},h;if(o===1)return n;for(h=0;h<o;h++){let d=n[h],u=this.getAdjacentEntries(e,a,d),p=u.filter(g=>!dt(g[0])),m=u.filter(g=>dt(g[0]));m.length>0&&(m.sort((g,E)=>g[0].obj.span>E[0].obj.span?-1:E[0].obj.span>g[0].obj.span?1:0),p.push(m[0])),u.length>0?s.push([d,DL(p)]):(l[d.obj.id]=!0,s.push([d,-1]))}return s.sort((d,u)=>l[d[0].id]||l[u[0].id]?0:d[1]<u[1]?-1:u[1]<d[1]?1:d[0].type===wl&&u[0].type===wl?0:d[0].type===Cr&&u[0].leaf?-1:u[0].type===Cr&&d[0].leaf?1:0),s.map(d=>d[0])}};var DA="xmax",NA="ymax",IA="xmin",MA="ymin",yd="_min",xd="_max",bd=class{constructor(r,e,t,n,o){this.D=r;this.de=e;this.axis=t;this.Pe=n;this.uE=o;c(this,"bi",{})}execute(){this.bi={};let r=this.uE(),e={},t=this.axis===0?{[yd]:IA,[xd]:DA}:{[yd]:MA,[xd]:NA},n=this.axis===1?{[yd]:IA,[xd]:DA}:{[yd]:MA,[xd]:NA},o=null;for(let a=0;a<this.de.layers.length-1;a++){let l=this.de.layers[a],h=this.de.layers[a+1],d=Math.min(l[t.Te],h[t.Te]),p=Math.max(l[t.It],h[t.It])-d,m=this.Pe?n.Te:n.It,g=this.Pe?n.It:n.Te,E=l[m],x=h[g]-E,f={id:`r${a}`,type:"channel",axis:this.axis,left:this.axis===0?d:E,top:this.axis===1?d:E,width:this.axis===0?p:x,height:this.axis===1?p:x,lines:[]};this.de.regions.push(f);for(let b=0;b<l.entries.length;b++){let A=l.entries[b],T=r.getVertexPosition(A.id)||A.loc,S={left:T.x,top:T.y,width:A.size.width,height:A.size.height,type:A.type,id:A.id,lines:[],paddingRegion:null,paddingRegionGate:null,gateDown:null,gateUp:null};this.de.regions.push(S),this.bi[A.id]=S;let R=S;if(this.axis===0){let v=this.axis===0?S.top+S.height:S.left+S.width,O=this.axis===0?f.top:f.left;if(v<O){let P={left:this.axis===0?T.x:T.x+A.size.width,top:this.axis===0?T.y+A.size.height:T.y,width:this.axis===0?A.size.width:O-v,height:this.axis===0?O-v:A.size.height,type:A.type,id:`${A.id}_pad`,lines:[]};this.de.regions.push(P),S.paddingRegion=P,S.paddingRegionGate=this.ko(A,T,S,P,!0),R=P}}S.gateDown=this.ko(A,T,R,f,!0),o!=null&&(S.gateUp=this.ko(A,T,o,S,!1))}o=f}let s=this.de.layers[this.de.layers.length-1];for(let a=0;a<s.entries.length;a++){let l=s.entries[a],h=r.getVertexPosition(l.id),d={left:h.x,top:h.y,width:l.size.width,height:l.size.height,type:l.type,id:l.id,lines:[],gateUp:null};this.de.regions.push(d),this.bi[l.id]=d,o!=null&&(d.gateUp=this.ko(l,h,o,d,!1))}return this.de.edgeNodes.forEach(a=>{let l=a.edge,h=H(l.source)?l.source.getParent():l.source,d=H(l.target)?l.target.getParent():l.target,u=this.D.entryMap[h.id],p=this.D.entryMap[d.id],m=this.bi[u.id],g=this.bi[p.id],E=[],y=u.layer<p.layer?1:-1;if(u.layer<p.layer){m.paddingRegionGate!=null&&E.push(m.paddingRegionGate),E.push(m.gateDown);for(let f=0;f<a.entries.length;f++){let b=a.entries[f],A=`r${b.layer-1}:${b.id}`;E.push(this.de.gateMap[A]);let T=`${b.id}:r${b.layer}`;E.push(this.de.gateMap[T])}E.push(g.gateUp)}else{E.push(m.gateUp);for(let f=a.entries.length-1;f>-1;f--){let b=a.entries[f],A=`${b.id}:r${b.layer}`;E.push(this.de.gateMap[A]);let T=`r${b.layer-1}:${b.id}`;E.push(this.de.gateMap[T])}g.paddingRegionGate!=null&&E.push(g.paddingRegionGate),E.push(g.gateDown)}let x={id:l.id,sourceId:l.source.id,targetId:l.target.id,path:E.map(f=>f.id),pathDirection:y};this.de.edgeRoutingMap[l.id]=x,this.de.edgeRouting.push(x),e[l.id]=E}),e}ko(r,e,t,n,o){let s=this.axis===0?e.x:e.y,a=this.axis===0?r.size.width:r.size.height,l=this.axis===0?e.y:e.x,h=this.axis===0?r.size.height:r.size.width,d=this.Pe?l+(o?0:h):l+(o?h:0);return this.pE(t,n,this.axis,{point1:s,point2:s+a},a,d,{x:this.axis===0?s+a/2:d,y:this.axis===0?d:s+a/2})}pE(r,e,t,n,o,s,a){let l={id:`${r.id}:${e.id}`,a:{type:r.type,id:r.id},b:{type:e.type,id:e.id},axis:t,otherAxisLocation:s,segment:n,length:o,midpoint:a,edges:[]};return this.de.gates.push(l),this.de.gateMap[l.id]=l,l}};function NL(i,r){let e=[],t=[],n=[],o={},s={},a={},l=i.getAllEdges(),h=[],d=new Set,u=(p,m)=>{let g=ti(p.source),y={edge:p,isSource:g===m,sourceVertex:g,targetVertex:ti(p.target)};return h.push(y),y};Y(i)&&i.getMembers().forEach(p=>{p.getAllEdges().forEach(m=>{(je(m.source,i)&&!je(m.target,i)||je(m.target,i)&&!je(m.source,i))&&u(m,p)})}),r!=null?l.forEach(p=>{r(p)?u(p,i):d.add(p)}):l.forEach(p=>u(p,i));for(let p=0;p<h.length;p++){let m=h[p].isSource?h[p].targetVertex.id:h[p].sourceVertex.id;o[m]||(o[m]={id:m,edges:new Set},e.push(o[m])),o[m].edges.add(h[p].edge),h[p].isSource?(s[m]||(s[m]={id:m,edges:new Set},t.push(s[m])),s[m].edges.add(h[p].edge)):(a[m]||(a[m]={id:m,edges:new Set},n.push(a[m])),a[m].edges.add(h[p].edge))}return{vertices:e,source:t,target:n,filteredEdges:d}}function IL(i){return i.target.length===1&&(i.source.length===0||i.source[0].id===i.target[0].id)}var Ad=class{constructor(r,e,t){this.instance=r;this.layout=t;c(this,"ne");c(this,"cn",{});c(this,"Ot",{});c(this,"Wo",null);c(this,"Qc",[]);c(this,"ed",new Map);c(this,"wa");c(this,"Ie");c(this,"Ai");c(this,"Si",[]);c(this,"unattachedRootPadding");c(this,"vertexEntryMap",new Map);c(this,"entryMap",{});c(this,"assignedVertices",new Map);c(this,"axis");c(this,"invert");c(this,"sets",[]);c(this,"excludedNodes",{});c(this,"td");c(this,"adjacentVertices",{});this.ne=e.padding||{x:50,y:50},this.unattachedRootPadding=e.unattachedRootPadding,this.axis=e.axis,this.invert=e.invert===!0,this.td=e.setPosition,this.wa=e.getSize,this.Wo=e.rootNode,this.Ie=e.edgeNodeSize,this.Ai=e.edgeFilter}nextRoot(){let r=this.Si.find(t=>!this.assignedVertices.has(t.id));return r?r.obj:null}getVertex(r){return this.cn[r]}setRootNode(r){this.Wo=r}getLayer(r){return this.getLayerForId(r.id)}getLayerForId(r){return this.assignedVertices.get(r)}getSize(r){return this.Ot[r.id]}getNodeSizeInMainAxis(r){return this.getSizeInMainAxis(this.getSize(r))}getNodeSizeInOtherAxis(r){return this.getSizeInOtherAxis(this.getSize(r))}rd(){let r={width:50,height:50};return this.axis===0?r.width=this.Ie:r.height=this.Ie,r}getSizeInMainAxis(r){return this.axis===0?r.width:r.height}getSizeInOtherAxis(r){return this.axis===0?r.height:r.width}getPaddingInMainAxis(){return this.axis===0?this.ne.x:this.ne.y}getPaddingInOtherAxis(){return this.axis===0?this.ne.x:this.ne.y}initialize(){this.Si.length=0,this.Qc.length=0,this.ed.clear(),this.assignedVertices.clear();let r=this.layout.$vertices.length;if(r>0){let e;for(let t=0;t<r;t++){e=this.layout.$vertices[t],this.Ot[e.id]=this.wa(e.id),this.cn[e.id]=e;let n=NL(e,this.Ai);this.adjacentVertices[e.id]=n;let o={obj:e,id:e.id,adjacent:n.vertices,sourceEdges:n.source,targetEdges:n.target,leaf:IL(n),size:this.wa(e.id),type:wl,layer:-1,vertexSet:null};this.Si.push(o),this.vertexEntryMap.set(e.id,o),n.target.length===0&&(this.Qc.push(o),this.ed.set(e.id,o))}this.Si.sort((t,n)=>{let o=this.Wo?this.Wo.id:"";return t.obj.id===o?-1:n.obj.id===o||t.adjacent.length===0?1:n.adjacent.length===0||t.targetEdges.length<n.targetEdges.length?-1:n.targetEdges.length<t.targetEdges.length?1:t.sourceEdges.length>n.sourceEdges.length?-1:n.sourceEdges.length>t.sourceEdges.length?1:0})}}isEmpty(){return this.Si.length===0}getAdjacentEntries(r,e,t){let n=[];for(let o=0;o<r[e].length;o++)this.areConnected(r[e][o],t)&&n.push([r[e][o],o]);return n}getAdjacentEntriesInLayer(r,e){let t=[];for(let n=0;n<r.length;n++)this.areConnected(r[n],e)&&t.push({entry:r[n],index:n});return t}areConnected(r,e){return dt(r)&&r.obj.edge.source===e.obj||dt(e)&&e.obj.edge.source===r.obj||dt(r)&&r.obj.edge.target===e.obj||dt(e)&&e.obj.edge.target===r.obj||dt(r)&&dt(e)&&(r.next===e||r.previous===e||e.next===r||e.previous===r)?!0:this.areAdjacent(r.obj.id,e.obj.id)}areAdjacent(r,e){let t=this.getAdjacentVertices(r),n=this.getAdjacentVertices(e);return t!=null&&t.vertices.findIndex(o=>o.id===e)!==-1||n!=null&&n.vertices.findIndex(o=>o.id===r)!==-1}getAdjacentVertices(r){return this.adjacentVertices[r]||{vertices:[],source:[],target:[],filteredEdges:new Set}}isLeaf(r){let e=this.vertexEntryMap.get(r);return e!=null?e.leaf:!1}};function Dl(i){return i.parents.length>0?i.parents[0].loc:null}function Sd(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function ML(i){return i.parents.length>0?i.parents[0].root===!0:!1}function VA(i){return i.parents.length>0?i.parents[0].childGroup:null}function VL(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var Td=class{constructor(r,e){this.model=r;c(this,"Tn",-1/0);c(this,"vn",1/0);c(this,"$r");c(this,"Kt");c(this,"Pe");c(this,"L",[]);c(this,"Br",[]);c(this,"hi",{});c(this,"ne");c(this,"Q");c(this,"wt");c(this,"ge");c(this,"ci");c(this,"Se");c(this,"_t");c(this,"I");c(this,"di");c(this,"Dt");c(this,"pi");c(this,"Ne",[]);c(this,"he",new Map);c(this,"Ta",{center:r=>Dl(r)+Sd(r,this.Q)/2-(r.size-this.Q)/2,start:r=>Dl(r),end:r=>Dl(r)+Sd(r,0)-(r.size-this.Q)});c(this,"k");c(this,"Nt");c(this,"qt");c(this,"mi");c(this,"Ra",{center:(r,e,t)=>(e+t)/2-Sd(r,0)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.$r=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Kt=e.compress===!0,this._t=e.absoluteBacked===!0,this.k=e.idFunction,this.Nt=e.sizeFunction,this.qt=e.childVerticesFunction,this.mi=e.absolutePositionFunction,this.ge=e.axisIndex,this.Se=this.ge!==1,this.ci=this.ge===0?1:0,this.di=this.Se?ye:Q,this.Dt=this.Se?Pe:Me,this.pi=this.Se?Me:Pe,this.Pe=e.invert===!0,this.I=e.alignment||Ed,this.ne=e.padding,this.Q=this.Se?this.ne.x:this.ne.y,this.wt=this.Se?this.ne.y:this.ne.x}execute(){let r,e,t;for(let n=0;n<this.$r.length;n++){r=this.$r[n];let o=this.Nt(r.id),s=this.Qe(r,o,0,null,null),a=0;s.root=!0,a=this.gi(s,0);let l=0,h,d,u=(m,g)=>this.Kt&&m.parents&&m.parents.length>0?this.he.get(this.k(m.parents[0].node)).position[this.di]+this.va(m,this.ci)+this.wt:g,p=!1;if(a===0&&this._t===!0){let m=this.mi(r);!isNaN(m.x)&&!isNaN(m.y)&&(this.Ei(r.id,m,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.ge===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.ge===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.Ei(this.k(this.L[e].entries[t].node),{x:h,y:d},e);this.Pe?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.wt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.wt,l+=this.L[e].otherAxisSize)}}return this.he}Ei(r,e,t){this.he.set(r,{position:e,layer:t});let n=this.Nt(r),o=this.ge===0?e.x+n.width:e.y+n.height,s=this.ge===0?e.x:e.y;this.Tn=Math.max(this.Tn,o),this.vn=Math.min(this.vn,s)}mt(r){let e=this.L[r];return e||(e={entries:[],pointer:0,otherAxis:null,otherAxisSize:null},this.L[r]=e),e}Qe(r,e,t,n,o){let s=this.mt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,childGroupIndex:o==null?void 0:o.nodes.length,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Dt],children:[]},l=e[this.pi];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.Dt]+(r.type===Cr?0:this.Q),s.entries.push(a),n&&n.children.push(a),a}Ca(r,e){let t=this.Br[e];t||(t=[],this.Br[e]=t),r.index=t.length,t.push(r)}Pa(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.mt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.Q)}}va(r,e){let t=r.parents.map(n=>n.dimensions[e===0?Pe:Me]);return Math.max.apply(null,t)}Oa(r){if(r.size>0){let e=this.Ta[this.I](r),t=this.Br[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.Q}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.Q;o!==0&&this._a(r),this.Ca(r,r.depth)}}La(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.Ra[this.I](r,e,t),o=n-Dl(r);if(this.Pa(r,n),!ML(r)){let s=VA(r),a=VL(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}_a(r){let e=r;for(;e!=null;)this.La(e),e=VA(e)}gi(r,e){if(this.hi[r.node.id])return;this.hi[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[],index:-1,id:B()},n=[],o,s={},a=this.mt(e+1),l=this.qt(r.node,e,this.model);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.Nt(this.k(h)),u=a.entries.find(p=>this.k(p.node)===this.k(h));if(u!=null){u.parents.push(r);let p=u.loc+u.size/2,m=Dl(u),g=Sd(u,this.Q),E=m+g/2,y=E-p;y>0&&this.mE(u,y,r)}else{let p=this.Qe(h,d,e+1,r,t);t.nodes.push(p);let m=d[this.Dt];t.size+=m+this.Q,n.push(p)}s[h.id]=!0}}for(this.Oa(t),o=0;o<n.length;o++)this.gi(n[o],e+1);return l.length}mE(r,e,t){let n={},o=s=>{let a=s.childGroup;if(n[a.id]!==!0){n[a.id]=!0;let l=s.childGroupIndex;for(let h=l;h<a.nodes.length;h++)a.nodes[h].loc+=e;l===0?a.loc+=e:a.size+=e}s.children.forEach(o)};o(r)}};var vd=class extends $s{constructor(e,t,n){super(e);this.model=e;this.vertexSet=t;c(this,"rr");c(this,"er");c(this,"ne");c(this,"Cn");c(this,"Pn");c(this,"I");c(this,"Ie");c(this,"Ti");n=n||{},this.ne=n.padding||{x:50,y:50},this.Cn=n.unattachedRootPadding||150,this.rr=n.lastPlacements,this.Pn=n.strategy||"parent",this.Ie=n.edgeNodeSize,this.Ti=n.gatherUnattachedRoots,this.I=n.alignment||"center"}gE(e,t){return{mainAxis:(e.length-1)*t+e.reduce((n,o)=>dt(o)?n+this.Ie:n+this.model.getSizeInMainAxis(o.size),0),otherAxis:e.reduce((n,o)=>Math.max(n,this.model.getSizeInOtherAxis(o.size)),0)}}execute(e){let t=0,n,o=this.model.getPaddingInMainAxis(),s=this.model.getPaddingInOtherAxis(),a=this.model.axis,l=this.rr?this.rr.maximumPointer+o:0,h=this.vertexSet.layers,d=l,u=h.map(g=>this.gE(g.entries,o)),p={rootId:e.id,rootSize:this.model.getNodeSizeInMainAxis(e),maximumPointer:d,rootPosition:d,biggestLayer:Math.max(...u.map(g=>g.mainAxis))},m=this.model.getNodeSizeInMainAxis(e);return n=this.Pn==="center"?(p.biggestLayer-m)/2:this.Pn==="start"?0:p.biggestLayer-m,h.length>0&&(this.model.invert?t-=u[0].otherAxis+2*s:t+=this.model.getNodeSizeInOtherAxis(e)+2*s,this.Pn==="parent"?this.EE(p,l):this.fE(h,n,a,p,l,t,u,o,s)),p.maximumPointer=Math.max(p.maximumPointer,p.rootPosition+p.rootSize+o),p}fE(e,t,n,o,s,a,l,h,d){let u=s,p;for(let m=0;m<e.length;m++){this.er=e[m],t=this.Pn==="center"?(o.biggestLayer-l[m].mainAxis)/2:this.Pn==="start"?0:o.biggestLayer-l[m].mainAxis,u=s;for(let g=0;g<this.er.entries.length;g++){p=this.er.entries[g];let E=t+u,y=a,x=n===0?E:y,f=n===0?y:E;if(dt(p)){let b=n===0?this.Ie:y,A=n===0?y:this.Ie;p.loc={x,y:f,w:b,h:A},u+=this.Ie+h}else this.vertexSet.setPosition(p.obj,x,f,m),u+=this.model.getSizeInMainAxis(p.size)+h}o.maximumPointer=Math.max(o.maximumPointer,u),m<e.length-1&&(this.model.invert?a-=l[m+1].otherAxis+2*d:a+=l[m].otherAxis+2*d)}}EE(e,t){let n=new Td(this.model.layout.instance,{rootNode:this.vertexSet.layers[0].entries,padding:this.ne,axisIndex:this.model.axis,invert:this.model.invert,alignment:this.I,idFunction:d=>this.model.layout.instance.getNodeId(d),sizeFunction:d=>this.model.entryMap[d].size,childVerticesFunction:(d,u,p)=>{let m=[];if(u<this.vertexSet.layers.length-1){let g=this.model.getAdjacentEntriesInLayer(this.vertexSet.layers[u+1].entries,d).map(E=>E.entry);m.push(...g)}return m},absoluteBacked:this.model.layout.absoluteBacked,absolutePositionFunction:d=>this.model.layout.getAbsolutePosition(d,this.model.layout.parameters)}),o=n.execute(),s=n.Tn,a=n.vn,l=0,h=0;if(this.Ti&&o.size===1&&this.rr!=null){let d=this.rr.rootPosition+this.rr.rootSize+this.Cn;o.get(e.rootId).position[this.model.axis===0?"x":"y"]=d,e.maximumPointer=d+e.rootSize}else if(this.rr){let d=this.rr.maximumPointer-a;this.model.axis===0?l=d:h=d}o.forEach((d,u)=>{this.vertexSet.setPositionById(u,d.position.x+l,d.position.y+h,d.layer),u===e.rootId&&(e.rootPosition=this.model.axis===0?d.position.x+l:d.position.y+h)}),e.maximumPointer=t+(s-a)}};var Cd=class{constructor(r,e){this.D=r;this.index=e;c(this,"layers",[]);c(this,"regions",[]);c(this,"gateMap",{});c(this,"edgeNodes",[]);c(this,"edgeNodeMap",new Map);c(this,"gates",[]);c(this,"edgeRoutingMap",{});c(this,"edgeRouting",[]);c(this,"nd",[]);c(this,"edgeEntryMap",new Map)}addToLayer(r,e,t){let n=this.od(r),o=dt(e),s;return o?(s={id:B(),obj:e,previous:null,size:this.D.rd(),next:null,leaf:!1,type:Cr,layer:r,vertexSet:this},e.entries.push(s)):(s=this.D.vertexEntryMap.get(e.id),s.layer=r,s.vertexSet=this),this.D.entryMap[s.id]=s,t?n.entries.unshift(s):n.entries.push(s),this.D.assignedVertices.set(e.id,r),this.nd.push(s),s}findLayerIndex(r){var e;return(e=this.nd.find(t=>t.id===r))==null?void 0:e.layer}insertEdgeNodeInLayer(r,e,t){let n=this.od(r),o=this.D.rd();this.D.assignedVertices.set(e.id,r);let s={id:B(),obj:e,size:o,leaf:!1,type:Cr,layer:r,vertexSet:this};e.entries.push(s),this.D.entryMap[s.id]=s;let a=t?1:-1,l=t?0:n.entries.length-1,h=null;for(;h==null&&l>=0&&l<n.entries.length;)dt(n.entries[l])?n.entries[l].obj.span<e.span&&(h=l):h=l,l+=a;let d=h!=null?t?h:h+1:t?0:n.entries.length;return n.entries.splice(d,0,s),s}removeFromLayer(r,e){let t=this.layers[r];t.entries.splice(t.entries.indexOf(e),1),this.D.assignedVertices.delete(e.id)}setPositionById(r,e,t,n){if(!this.D.layout.absoluteBacked)this.On(r,e,t,n);else{let o=this.D.layout.model.getVertex(r),s=this.D.layout.getAbsolutePosition(o);s.x!=null&&s.y!=null&&!isNaN(s.x)&&!isNaN(s.y)?this.On(r,s.x,s.y,n):this.On(r,e,t,n)}}setPosition(r,e,t,n){if(!this.D.layout.absoluteBacked)this.On(r.id,e,t,n);else{let o=this.D.layout.getAbsolutePosition(r);o.x!=null&&o.y!=null&&!isNaN(o.x)&&!isNaN(o.y)?this.On(r.id,o.x,o.y,n):this.On(r.id,e,t,n)}}od(r){return this.layers[r]==null&&(this.layers[r]={layer:r,entries:[],xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0}),this.layers[r]}On(r,e,t,n){this.D.td(r,e,t,n);let o=this.layers[n],s=this.D.vertexEntryMap.get(r)||this.edgeEntryMap.get(r);if(s){let a=e+s.size.width,l=t+s.size.height;o.xmin=Math.min(o.xmin,e),o.ymin=Math.min(o.ymin,t),o.xmax=Math.max(o.xmax,a),o.ymax=Math.max(o.ymax,l)}}};var GA="Hierarchy",Lo=class extends ri{constructor(e){super(e);c(this,"type",GA);c(this,"axis");c(this,"model");c(this,"Cn");c(this,"xi");c(this,"yi");c(this,"Pe");c(this,"Ti");c(this,"sd");c(this,"Sn");c(this,"ad");c(this,"I");c(this,"ld");c(this,"fi");c(this,"Ie");c(this,"Ai");c(this,"Da");c(this,"routingInformation");c(this,"resultSets",[]);this.Cn=e.options.unattachedRootPadding==null?150:e.options.unattachedRootPadding,this.axis=e.options.axis?e.options.axis==="horizontal"?0:1:0,this.xi=e.options.maxIterationsWithoutImprovement||5,this.yi=e.options.maxIterations||24,this.ad=e.options.rootNode,this.Sn=e.options.getRootNode,this.ld=e.options.placementStrategy,this.Ie=e.options.edgeNodeSize||RE,this.Pe=e.options.invert===!0,this.Ti=e.options.gatherUnattachedRoots===!0,this.I=e.options.alignment||Ed,this.sd=e.options.generateRouting===!0,this.Ai=e.options.edgeFilter,this.Da=e.options.filteredEdgeProcessor,this.fi=e.options.leavesAtBottom}begin(e,t,n,o,s){this.resultSets.length=0;let a=this.Sn?this.Sn():this.ad;this.model=new Ad(e,{getSize:l=>this.getSize(l,o),axis:this.axis,padding:this.padding,setPosition:n,rootNode:a,invert:s.invert===!0,unattachedRootPadding:this.Cn,edgeNodeSize:this.Ie,edgeFilter:this.Ai},this),this.model.initialize()}end(e,t,n,o,s){}reset(){}getDefaultParameters(){return{padding:{x:50,y:50},unattachedRootPadding:150,axis:"horizontal",maxIterations:24,maxIterationsWithoutImprovement:2,placementStrategy:"parent",alignment:"center",edgeNodeSize:RE}}step(e,t,n,o,s){let a=0;if(!this.model.isEmpty()){let l=this.model.nextRoot(),h=null;for(;l!=null;){let d=new Cd(this.model,a++);d.addToLayer(0,l),this.model.sets.push(d);let u=new fd(this.model,d);u.execute(l),new Bs(d,(g,E,y)=>this.model.getAdjacentEntries(g,E,y),{maxIterations:this.yi,maxIterationsWithoutImprovement:this.xi}).execute(),h=new vd(this.model,d,{padding:this.padding,strategy:this.ld,edgeNodeSize:this.Ie,lastPlacements:h,gatherUnattachedRoots:this.Ti,unattachedRootPadding:this.Cn,alignment:this.I}).execute(l);let p=[];if(d.layers.flatMap(g=>g.entries.map(E=>{if(dt(E)){p.push(E);let y=this.axis===0?g.ymax-g.ymin:g.xmax-g.xmin;this.axis===0?E.size.height=y:E.size.width=y}})),this.Da){let g=u.getFilteredEdges().map(E=>{let y=this.model.entryMap[E.source.id],x=this.model.entryMap[E.target.id],f=d.layers[y.layer].entries.findIndex(A=>A.id===y.id),b=d.layers[x.layer].entries.findIndex(A=>A.id===x.id);return{sourceEntry:y,sourceEntryIndex:f,targetEntry:x,targetEntryIndex:b,edge:E}});this.Da(g,this)}let m={};this.sd&&(this.routingInformation=this.model.sets.map(g=>{let E={gates:g.gates,edges:g.edgeRouting,edgeMap:g.edgeRoutingMap,regions:g.regions,getVertexPosition:y=>t(y),getVertexSize:y=>o[y]};return new bd(this.model,d,this.axis,this.Pe,()=>E).execute(),E})),this.resultSets.push({node:l,edgeNodes:p,paths:m}),l=this.model.nextRoot()}}this.done=!0}getRoutingInformation(){return this.routingInformation}};c(Lo,"type",GA),nt.register(Lo.type,Lo);var Pd=class{constructor(r){this.color=r}generate(r){return this.color}},oi=class i{constructor(r,e,t){this.r=r;this.g=e;this.b=t}toString(){return`rgb(${this.r}, ${this.g}, ${this.b})`}static fromString(r){if(r.startsWith("#")){let e=r.substring(1);e.length===3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]].join(""));let t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),o=parseInt(e.substring(4,6),16);return new i(t,n,o)}else if(r.startsWith("rgb")){let e=r.match(/\d+/g);if(e&&e.length>=3)return new i(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}else{let e=GL(r);return i.fromString(e)}}};function GL(i){let r=document.createElement("div");r.style.color=i,document.body.appendChild(r);let e=getComputedStyle(r).color;return document.body.removeChild(r),e}function $A(){return new oi(Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20))}var Fs=class{constructor(){c(this,"assignedColors",[])}generate(r){let n=0,o=$A(),s=this.assignedColors.find(a=>FA(a,o)<20);for(;s!=null&&n<10;)o=$A(),s=this.assignedColors.find(a=>FA(a,o)<20),n++;return this.assignedColors.push(o),o.toString()}reset(){this.assignedColors.length=0}},BA=class{constructor(...r){c(this,"colors");c(this,"counter",0);this.colors=r}generate(r){let e=this.colors[this.counter];return this.counter++,this.counter>=this.colors.length&&(this.counter=0),e}};function FA(i,r){let e=(i.r+r.r)/2,t=i.r-r.r,n=i.g-r.g,o=i.b-r.b;return Math.sqrt(((512+e)*t*t>>8)+4*n*n+((767-e)*o*o>>8))}function Od(i){let r=j(i)?oi.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new oi(Math.floor(r.r*.3),Math.floor(r.g*.3),Math.floor(r.b*.3)):new oi(Math.min(255,Math.floor(r.r+(255-r.r)*.7)),Math.min(255,Math.floor(r.g+(255-r.g)*.7)),Math.min(255,Math.floor(r.b+(255-r.b)*.7)))}function Yj(i){let r=j(i)?oi.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new oi(0,0,0):new oi(255,255,255)}var wE="empty",$L=[{dx:0,dy:-1,axis:pe,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:pe,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1},{dx:-1,dy:-1,axis:Tn,directionFromParent:-1},{dx:1,dy:-1,axis:ii,directionFromParent:-1},{dx:1,dy:1,axis:Tn,directionFromParent:1},{dx:-1,dy:1,axis:ii,directionFromParent:1}],BL=[{dx:0,dy:-1,axis:pe,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:pe,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1}],UA=(i,r,e,t)=>BL.filter(n=>n.axis!==e||n.directionFromParent===t),DE=(i,r,e,t)=>{let n=[];switch(e){case ii:n.push({x:-t,y:0}),n.push({x:-t,y:t}),n.push({x:0,y:t});break;case Tn:n.push({x:t,y:0}),n.push({x:t,y:t}),n.push({x:0,y:t});break;case ne:n.push({x:t,y:-1}),n.push({x:t,y:0}),n.push({x:t,y:1});break;case pe:n.push({x:-1,y:t}),n.push({x:0,y:t}),n.push({x:1,y:t});break}return $L.filter(o=>n.find(s=>s.x===o.dx&&s.y===o.dy))};var Ys=class{constructor(r,e,t,n,o,s){this.gridCellSize=t;this.vertexBorder=n;this.vertexBuffer=o;this.getCoincidentObstacles=s;c(this,"gt",{});c(this,"vi");c(this,"hd");c(this,"sourceId");c(this,"targetId");c(this,"sourceObstacles",[]);c(this,"targetObstacles",[]);c(this,"sourceBuffers",[]);c(this,"targetBuffers",[]);c(this,"sourceAxis");c(this,"sourceDirection");c(this,"targetAxis");c(this,"targetDirection");this.vi={x:Math.min(r.x,e.x),y:Math.min(r.y,e.y)},this.hd=t*(n+o)}Zo(r,e){return{x:Math.floor((r-this.vi.x)/this.gridCellSize),y:Math.floor((e-this.vi.y)/this.gridCellSize)}}yE(r){let e=this.Zo(r.x,r.y),t=this.Zo(r.x+r.width,r.y+r.height);return{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}xE(r,e){let t=r*this.gridCellSize,n=e*this.gridCellSize,o=this.vi.x+t,s=this.vi.y+n;return{x:o,y:s,width:this.gridCellSize,height:this.gridCellSize}}makeKey(r,e){return`${r}_${e}`}bE(r){return this.sourceObstacles.indexOf(r)!==-1||this.sourceBuffers.indexOf(r)!==-1||this.targetObstacles.indexOf(r)!==-1||this.targetBuffers.indexOf(r)!==-1}AE(r,e,t,n){let o=this.makeKey(r,e);if(this.gt[o]==null){let s=this.xE(r,e),a=s.x,l=s.y,h=this.getCoincidentObstacles(a,l,this.hd),d=[],u=[],p=!1,m=!1;h.forEach(g=>{if(!p&&(this.sourceId===g.id||this.sourceObstacles.indexOf(g.id)!==-1)&&(p=!0),!m&&(this.targetId===g.id||this.targetObstacles.indexOf(g.id)!==-1)&&(m=!0),!this.bE(g.id)){let E=Bb(this.yE(g),this.vertexBorder,this.vertexBorder);u.push(g.id),E.x<=r&&E.x+E.width>=r&&E.y<=e&&E.y+E.height>=e&&d.push(g.id)}}),this.gt[o]={key:o,f:0,g:1/0,h:null,opened:!1,closed:!1,x:r,y:e,cx:a,cy:l,ax:t,ay:n,parent:null,fixedAxis:null,directionFromParent:null,obstacles:d,buffers:u,hasSourceObstacles:p,hasTargetObstacles:m}}else t&&(this.gt[o].ax=t),n&&(this.gt[o].ay=n);return this.gt[o]}setSourceCell(r,e,t,n,o,s,a){this.sourceId=r;let l=this.getCell(e,t,n,o);return this.sourceObstacles=l.obstacles.slice(),this.sourceBuffers=l.buffers.slice(),this.sourceAxis=s,this.sourceDirection=a,l.opened=!0,l.g=0,l.f=0,l.fixedAxis=s,l.directionFromParent=a,l}setTargetCell(r,e,t,n,o,s,a){this.targetId=r;let l=this.getCell(e,t,n,o);return this.targetObstacles=l.obstacles.slice(),this.targetBuffers=l.buffers.slice(),this.targetAxis=s,this.targetDirection=a,l.fixedAxis=s,l.directionFromParent=this.targetDirection,l}get sourceAndTargetObstacles(){let r=this.sourceObstacles.slice(),e=this.targetObstacles.slice();return r.push(...e),r}getCell(r,e,t,n){return this.AE(r,e,t,n)}reinitialize(){Object.entries(this.gt).forEach(r=>{r[1].f=0,r[1].g=1/0,r[1].h=null,r[1].closed=!1,r[1].opened=!1,r[1].parent=null,r[1].directionFromParent=null,r[1].ax=null,r[1].ay=null,r[1].fixedAxis=null}),this.sourceObstacles.length=0,this.sourceBuffers.length=0,this.targetObstacles.length=0,this.targetBuffers.length=0}};function Us(i,r){return i===0&&r===0?void 0:i===0&&r!==0?pe:i!==0&&r===0?ne:Math.sign(r)===Math.sign(i)?Tn:ii}function YA(i,r,e){return e==null?0:e===ne?i>0?1:-1:e===pe?r>0?1:-1:e===Tn?i>0&&r>0?1:-1:i<0&&r>0?1:-1}function NE(i){let r=Us(i.ox,i.oy);return{axis:r,direction:YA(i.ox,i.oy,r)}}function zA(i,r){let e=Math.abs(r.x-i.x),t=Math.abs(r.y-i.y);return e>t?ne:pe}function Ir(i){if(i.parent==null)return i.fixedAxis;{let r=Math.sign(i.parent.x-i.x),e=Math.sign(i.parent.y-i.y);return Us(r,e)}}function XA(i){if(i.parent==null)return i.directionFromParent;{let r=Math.sign(i.x-i.parent.x),e=Math.sign(i.y-i.parent.y),t=Us(r,e);return YA(r,e,t)}}function FL(i,r,e){if(r.f<e.f)return-1;if(e.f<r.f)return 1;if(r.h<e.h)return-1;if(e.h<r.h)return 1;{let t=Ir(i);return Ir(r)===t?-1:Ir(e)===t?1:0}}var _d=class{constructor(){c(this,"node")}sort(r,e){return FL(this.node,r,e)}};var Zt="group:added",Gi="group:member:added",zs="group:member:removed",_e="group:removed",wo="dataLoadStart",IE="dataAppendStart",Mr="dataLoadEnd",ME="dataAppendEnd",VE="dataUpdated",Cn="graphClearStart",Jt="graphCleared",jA="graphChanged",Te="group:updated",Re="node:updated",dr="port:updated",xt="edge:updated",ur="edge:added",Kt="node:added",bt="edge:removed",ve="node:removed",si="port:added",Vr="port:removed",sn="edge:target",an="edge:source",qt="select",Qt="deselect",ir="selection:cleared",ai="edge:geometry",li="edge:pathEdited",HA="edge:dragStart",kA="edge:drag",WA="edge:dragEnd",ZA="edge:dragAbort",Rd="edge:typeChanged",Ld="node:typeChanged",wd="port:typeChanged",Dd="group:typeChanged",JA="group:move:start",Do="group:move",Gr="group:move:end",Nd="internal:group:sizeChanged",Id="internal:group:sizeChangedRedo",Md="internal:group:sizeChangedUndo",KA="internal:edge:redraw",qA="renderer:added",Xs="node:move:start",Mt="node:move",Vt="node:move:end",Vd="node:move:abort",js="undoredo:update",QA="undo",eS="redo",$i="destroy";var UL=[Kt,si,ur,Zt,ve,Vr,bt,_e,Re,dr,xt,Te,Vt,Gr,an,sn,Gi,zs],No=(i,r,e)=>{i.instance.bind(r,e),i.bindings.push([r,e])},Nl=class{constructor(r,e){this.instance=r;c(this,"bindings",[]);c(this,"Jo",null);if(e.saveUrl==null&&e.autoSaveHandler==null)throw new Error("VisuallyJs autosave: neither saveUrl nor autoSaveHandler was specified");function t(a){return function(){a&&a.apply(a,arguments),e.onAfterAutoSave&&e.onAfterAutoSave()}}let n=!1,o=function(){if(!n){try{e.onBeforeAutoSave&&e.onBeforeAutoSave()}catch(a){}e.autoSaveHandler!=null?e.autoSaveHandler(r):r.save({type:e.type||Wt,url:e.saveUrl,success:t(e.onAutoSaveSuccess),error:t(e.onAutoSaveError),headers:e.saveHeaders})}},s=()=>{e.debounceTimeout==null?o():this.Jo==null?this.Jo=setTimeout(o,e.debounceTimeout):(clearTimeout(this.Jo),this.Jo=setTimeout(o,e.debounceTimeout))};No(this,wo,()=>{n=!0}),No(this,Mr,()=>{n=!1}),No(this,Cn,()=>{n=!0}),No(this,Jt,()=>{n=!1}),No(this,VE,s),No(this,li,s)}discard(){this.bindings.forEach(r=>this.instance.unbind(r[0],r[1])),this.bindings.length=0}},Gd=class{constructor(r){this.instance=r;c(this,"bindings",[]);let e=()=>{r.fire(VE)};UL.forEach(t=>No(this,t,e))}};var tS="mixed",$d="isolated",rS="nodesOnly",nS="groupsOnly",iS="edgesOnly",Io=class Io extends zt{constructor(e,t){super();this.instance=e;c(this,"nr",1/0);c(this,"cd",1/0);c(this,"dd",1/0);c(this,"ue",[]);c(this,"ee",[]);c(this,"te",[]);c(this,"capacityPolicy");c(this,"generator");c(this,"onReload");c(this,"onBeforeReload");c(this,"onClear");c(this,"autoFill");c(this,"Ve",{});c(this,"Ur");c(this,"Ko",!1);c(this,"edgeFactory");t=t||{},this.edgeFactory=e.edgeFactory,this.generator=t.generator,this.onReload=t.onReload,this.onBeforeReload=t.onBeforeReload,this.autoFill=t.autoFill===!0,this.onClear=t.onClear||function(){},this.Ur=t.mode||tS,this.instance.bind(ve,n=>{this.Vt(n.node)}),this.instance.bind(_e,n=>{this.Vt(n.group)}),this.instance.bind(Vr,n=>{this.Vt(n.port)}),this.instance.bind(bt,n=>{this.Vt(n.edge)}),this.instance.bind(sn,n=>{this.Ve[n.edge.getFullId()]&&this.fire(sn,n)}),this.instance.bind(an,n=>{this.Ve[n.edge.getFullId()]&&this.fire(an,n)}),this.instance.bind(Kt,n=>{this.generator&&this.autoFill&&!this.Ko&&this.reload()}),this.instance.bind(Zt,n=>{this.generator&&this.autoFill&&!this.Ko&&this.reload()}),this.instance.bind(Re,n=>{this.Ve[n.vertex.getFullId()]&&this.fire(Re,n)}),this.instance.bind(Te,n=>{this.Ve[n.vertex.getFullId()]&&this.fire(Te,n)}),this.instance.bind(xt,n=>{this.Ve[n.edge.getFullId()]&&this.fire(xt,n)}),this.instance.bind(dr,n=>{n.port!=null&&this.Ve[n.port.getFullId()]&&this.fire(dr,n)}),this.instance.bind(Jt,()=>{this.clear()}),this.instance.bind(Mr,()=>{this.reload()}),this.setCapacityPolicy(Io.DISCARD_EXISTING),t.lazy!==!0&&this.reload()}isEmpty(){return this.ue.length===0&&this.ee.length===0&&this.te.length===0}ud(e){return e.objectType===Ye.objectType?this.te:e.objectType===he.objectType?this.ue:this.ee}setMode(e){this.Ur=e,e===$d?this.SE():e===iS?this.pd():e===rS?(this.Na(),this.md()):e===nS&&(this.Na(),this.gd())}TE(e){let t=[],n=this.ud(e),o=e.objectType===Ye.objectType?this.cd:e.objectType===he.objectType?this.nr:this.dd;if(n.length>=o){if(this.capacityPolicy===Io.DISCARD_NEW)return!1;t=n.splice(0,1),this.Ia(t[0],":removed"),delete this.Ve[t[0].getFullId()]}return n.push(e),this.Ia(e,":added"),t}Ia(e,t){let n=e.objectType.toLowerCase()+t,o={Group:s=>({data:s.data,group:s}),Node:s=>({data:s.data,node:s}),Port:s=>({data:s.data,node:s.getParent(),port:s}),Edge:s=>({data:s.data,edge:s})};this.fire(n,o[e.objectType](e))}Ed(e,t){if(this.vE(e)&&!this.Ve[e.getFullId()]){let n=this.TE(e);return n===!1?[[],[]]:(this.Ve[e.getFullId()]=e,t&&t(e,!0),[[e],n])}return[[],[]]}vE(e){return this.Ur===tS||this.Ur===rS&&e.objectType===he.objectType||this.Ur===nS&&e.objectType===oe.objectType||this.Ur===iS&&e.objectType===Ye.objectType?!0:this.Ur===$d?e.objectType===Ye.objectType?this.ue.length===0&&this.ee.length===0:this.te.length===0:!1}Vt(e,t){let n=e.getFullId();return Nt(this.ud(e),s=>s.getFullId()==n)?(delete this.Ve[e.getFullId()],t&&t(e,!1),this.Ia(e,":removed"),[[],[e]]):[[],[]]}CE(e,t){return this.Ve[e.getFullId()]?this.Vt(e,t):this.Ed(e,t)}Va(e,t,n){let o=[],s=[],a;if(e==null)return o;let l=h=>{let d;if(j(h))d=this.instance.getNode(h)||this.instance.getEdge(h)||this.instance.getGroup(h),d!=null&&(a=t(d,n),o.push.apply(o,a[0]),s.push.apply(s,a[1]));else if(h.eachVertex&&h.eachEdge)h.eachVertex((u,p)=>{l(p)}),h.eachEdge((u,p)=>{l(p)});else if(h.Ye)h.each((u,p)=>{l(p.vertex||p)});else if(h.length!=null)for(let u=0;u<h.length;u++)l(h[u]);else a=t(h,n),o.push.apply(o,a[0]),s.push.apply(s,a[1])};return l(e),[o,s]}remove(e,t){return this.Va(e,this.Vt.bind(this),t)}append(e,t){return this.Va(e,this.Ed.bind(this),t)}toggle(e,t){return this.Va(e,this.CE.bind(this),t)}setMaxNodes(e){this.nr=e}setMaxGroups(e){this.dd=e}setMaxEdges(e){this.cd=e}setCapacityPolicy(e){this.capacityPolicy=e}Na(){for(let e=this.te.length,t=0;t<e;t++)this.Vt(this.te[0])}gd(){for(let e=this.ue.length,t=0;t<e;t++)this.Vt(this.ue[0])}md(){for(let e=this.ee.length,t=0;t<e;t++)this.Vt(this.ee[0])}pd(){this.gd(),this.md()}SE(){this.pd(),this.Na()}clear(e){this.ue.length=0,this.te.length=0,this.ee.length=0,this.Ve={},this.fire(Cn),e||this.onClear(this)}PE(e){let t=[];for(let n=0;n<e.length;n++)this.Ve[e[n].getId()]!=null&&t.push(e[n]);return t}reload(){this.generator!=null&&(this.onBeforeReload&&this.onBeforeReload(),this.clear(),this.Ko=!0,this.fire(wo,{}),this.generator(this,this.instance),this.fire(Mr,{}),this.onReload&&this.onReload(),this.Ko=!1)}Ye(e,t){let n=t===Ye.objectType?this.te:t===oe.objectType?this.ee:this.ue;for(let o=0;o<n.length;o++)try{e(o,n[o])}catch(s){}}eachNode(e){this.Ye(e,he.objectType)}eachGroup(e){this.Ye(e,oe.objectType)}eachVertex(e){this.Ye(e,he.objectType),this.Ye(e,oe.objectType)}eachEdge(e){this.Ye(e,Ye.objectType)}getNodeCount(){return this.ue.length}getNodeAt(e){return this.ue[e]}getNodes(){return this.ue}getNode(e){return this.ue.find(t=>t.id===e)}getGroupAt(e){return this.ee[e]}getGroups(){return this.ee}getGroup(e){return this.ee.find(t=>t.id===e)}getGroupCount(){return this.ee.length}getAll(){let e=[];return Array.prototype.push.apply(e,this.ue),Array.prototype.push.apply(e,this.te),Array.prototype.push.apply(e,this.ee),e}getAllEdgesFor(e,t){return this.PE(e.getAllEdges(t))}getEdgeCount(){return this.te.length}getAllEdges(){return this.getEdges()}getEdgeAt(e){return this.te[e]}getEdges(){return this.te}getGroupType(e){return this.instance.getGroupType(e)}getNodeType(e){return this.instance.getNodeType(e)}getModel(){return this.instance.getModel()}getGraph(){return this.instance.getGraph()}getNodeId(e){return this.instance.getNodeId(e)}getGroupId(e){return this.instance.getGroupId(e)}getPortType(e){return this.instance.getPortType(e)}addPort(e,t){return this.instance.addPort(e,t)}getPortId(e){return this.instance.getPortId(e)}getEdge(e){return this.instance.getEdge(e)}getEdgeType(e){return this.instance.getEdgeType(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}containsVertex(e){return this.getVertex(e)!=null}getObjectInfo(e){return this.instance.getObjectInfo(e)}beforeConnect(e,t,n,o){return this.instance.beforeConnect(e,t,n,o)}beforeMoveConnection(e,t,n){return this.instance.beforeMoveConnection(e,t,n)}beforeStartConnect(e,t){return this.instance.beforeStartConnect(e,t)}beforeDetach(e,t,n){return this.instance.beforeDetach(e,t,n)}beforeStartDetach(e,t){return this.instance.beforeStartDetach(e,t)}get debugEnabled(){return this.instance.debugEnabled}OE(e){return new Io(this.instance,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1;for(let h in e){let d=e[h]===a[h];if(!d&&!t)return!1;l=l||d}return l},o=this.OE();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getAncestors(e){return this.instance.getAncestors(e).filter(t=>this.containsVertex(t.id))}getDescendants(e){return this.instance.getDescendants(e)}getType(e){return this.instance.getType(e)}isAncestor(e,t){return this.instance.isAncestor(e,t)}isDescendantGroup(e,t){return this.instance.isDescendantGroup(e,t)}resolveFullId(e){return this.instance.resolveFullId(e)}};c(Io,"DISCARD_EXISTING","discardExisting"),c(Io,"DISCARD_NEW","discardNew");var pr=Io;var hi=class{constructor(r,e,t){this.obj=r;this.instance=e;this.manager=t;c(this,"edgeId");c(this,"source");c(this,"target");c(this,"Ma");c(this,"Ga");c(this,"Ci");c(this,"fd");c(this,"yd");c(this,"xd");c(this,"bd");this.source=r.source.getFullId(),this.target=r.target.getFullId(),H(r.source)&&(this.Ma=r.source.id,this.source=r.source.getParent().getFullId()),H(r.target)&&(this.Ga=r.target.id,this.target=r.target.getParent().getFullId()),this.edgeId=r.getId(),this.Ci=r.geometry,r.source.dummy&&(this.fd=!0,this.xd={x:r.source.data[e.modelLeftAttribute],y:r.source.data[e.modelTopAttribute]}),r.target.dummy&&(this.yd=!0,this.bd={x:r.target.data[e.modelLeftAttribute],y:r.target.data[e.modelTopAttribute]})}generateSourceIdentifier(){return this.fd?this.xd:this.Ma==null?this.source:this.source+this.instance.getGraph().getPortSeparator()+this.Ma}generateTargetIdentifier(){return this.yd?this.bd:this.Ga==null?this.target:this.target+this.instance.getGraph().getPortSeparator()+this.Ga}Qe(){let r={source:this.generateSourceIdentifier(),target:this.generateTargetIdentifier(),data:this.obj.data,geometry:this.Ci},e=this.instance.$_addEdge(r,iA,null);this.manager.edgeChange(this.edgeId,e)}tt(){this.instance.removeEdge(this.obj)}edgeChange(r){this.obj=r,this.edgeId=this.obj.getId()}},Fd=class extends hi{constructor(){super(...arguments);c(this,"type","addEdge")}undo(){this.tt()}redo(){this.Qe()}hasDeltas(){return this.obj!=null}},Ud=class extends hi{constructor(){super(...arguments);c(this,"type","removeEdge")}undo(){this.Qe()}redo(){this.tt()}hasDeltas(){return this.obj!=null}},Bd=class extends hi{constructor(e,t,n,o,s){super(n,e,t);this.oldVertex=o;this.newVertex=s}verticesAreTheSame(){return Ni(this.newVertex)&&Ni(this.oldVertex)&&this.newVertex.id===this.oldVertex.id}pointsAreTheSame(){return!Ni(this.newVertex)&&!Ni(this.oldVertex)&&Jb(this.newVertex,this.oldVertex)}hasDeltas(){return this.obj!=null&&!this.verticesAreTheSame()&&!this.pointsAreTheSame()}},Yd=class extends Bd{constructor(){super(...arguments);c(this,"type","edgeSourceChanged")}undo(){this.instance.setSource(this.obj,this.oldVertex)}redo(){this.instance.setSource(this.obj,this.newVertex)}},zd=class extends Bd{constructor(){super(...arguments);c(this,"type","edgeTargetChanged")}undo(){this.instance.setTarget(this.obj,this.oldVertex)}redo(){this.instance.setTarget(this.obj,this.newVertex)}};var Mo=class i{constructor(r){this.actions=r;c(this,"id");c(this,"type","compound");this.actions==null&&(this.actions=[]),this.id=B()}$mergeInto(r){this.actions.reverse().forEach(e=>r.addAction(e,!0))}addAction(r,e){e?this.actions.unshift(r):this.actions.push(r)}undo(){this.actions.slice().reverse().forEach(r=>r.undo())}redo(){this.actions.forEach(r=>r.redo())}edgeChange(r,e){this.actions.forEach(t=>{t instanceof hi&&t.edgeId===r&&t.edgeChange(e)})}hasDeltas(){for(let r=0;r<this.actions.length;r++)if(this.actions[r].hasDeltas())return!0;return!1}compress(){let r=new i,e={},t={},n={};for(let o=0;o<this.actions.length;o++){let s=this.actions[o];oS(s)?e[s.obj.id]!=null?Object.assign(e[s.obj.id].$nd,s.$nd):(e[s.obj.id]=s,r.addAction(s)):sS(s)?t[s.obj.id]!=null?Object.assign(t[s.obj.id].pos,s.pos):(t[s.obj.id]=s,r.addAction(s)):aS(s)?n[s.group.id]!=null?Object.assign(n[s.group.id].newGroupSize,s.newGroupSize):(n[s.group.id]=s,r.addAction(s)):r.addAction(s)}return r}};var Hs=class{constructor(r,e,t,n){this.obj=r;this.originalPosition=e;this.pos=t;this.renderer=n;c(this,"type","moveAction")}redo(){this.renderer.setPosition(this.obj,this.pos.x,this.pos.y)}undo(){this.renderer.setPosition(this.obj,this.originalPosition.x,this.originalPosition.y)}hasDeltas(){return this.pos.x!==this.originalPosition.x||this.pos.y!==this.originalPosition.y}};var Xd=class{constructor(r,e){this.obj=r;this.instance=e}$add(){this.obj.objectType===he.objectType?this.obj=this.instance.addNode(this.obj.data):this.obj.objectType===oe.objectType&&(this.obj=this.instance.addGroup(this.obj.data))}Ad(){this.instance.remove(this.obj)}getTerminusId(){return this.obj.getFullId()}hasDeltas(){return this.obj!=null}},Ml=class extends Xd{constructor(){super(...arguments);c(this,"type","terminusAdd")}undo(){this.Ad()}redo(){this.$add()}},Il=class extends Xd{constructor(){super(...arguments);c(this,"type","terminusRemove")}undo(){this.$add()}redo(){this.Ad()}isConnectedTo(e){let t=this.getTerminusId();return e.source===t||e.target===t}},jd=class extends Il{constructor(e,t){super(e.group,t);c(this,"type","groupRemove");c(this,"childrenRemoved");c(this,"orphanedChildren");this.childrenRemoved=e.removeChildren,this.orphanedChildren=e.children.slice()}$add(){super.$add(),this.childrenRemoved||this.orphanedChildren.forEach(e=>this.instance.$addToGroup(e,this.obj,null,null,null,null))}},Vl=class{constructor(r,e,t,n,o){this.group=r;this.originalGroupSize=e;this.newGroupSize=t;this.instance=n;this.source=o;c(this,"type","groupSizeChanged")}hasDeltas(){return Math.round(this.originalGroupSize.width)!==Math.round(this.newGroupSize.width)||Math.round(this.originalGroupSize.height)!==Math.round(this.newGroupSize.height)}redo(){this.zr(Id,this.newGroupSize,this.originalGroupSize)}undo(){this.zr(Md,this.originalGroupSize,this.newGroupSize)}zr(r,e,t){this.instance.fire(r,{group:this.group,source:this.source,sizeAfterUndo:e,sizeBeforeUndo:t})}};function ks(i,r,e){let t;i=i||{},r=r||{};let n=i,o=r;if(e)for(t=0;t<e.length;t++)n[e[t]]=o[e[t]];else for(t in o)n[t]=o[t];return i}function m5(i,r){i=i.length==null||typeof i=="string"?[i]:i;for(let e=0;e<i.length;e++)r(i[e])}function Hd(i,r,e){return function(){let t=null;try{r!=null&&(t=r.apply(this,arguments))}catch(n){U("VisuallyJs: function failed : "+n)}if(i!=null&&(e==null||t!==e))try{t=i.apply(this,arguments)}catch(n){U("VisuallyJs: wrapped function failed : "+n)}return t}}var Bi=class{constructor(r,e,t,n,o,s,a){this.obj=r;this.instance=t;this.typeChanged=o;this.newType=s;this.previousType=a;c(this,"type","update");c(this,"$nd");c(this,"$od");c(this,"reason");this.$nd=ks({},r.data),this.$od=ks({},e),this.reason=n}Sd(r){this.obj.objectType===he.objectType?this.instance.$_updateNode(this.obj,r,this.reason,!0):this.obj.objectType===oe.objectType?this.instance.$_updateGroup(this.obj,r,this.reason,!0):this.obj.objectType===ce.objectType?this.instance.$_updatePort(this.obj,r,this.reason,!0):this.obj.objectType===Ye.objectType&&this.instance.$_updateEdge(this.obj,r,this.reason,!0)}undo(){this.Sd(this.$od),this.typeChanged&&this.instance.setType(this.obj,this.previousType)}redo(){this.Sd(this.$nd),this.typeChanged&&this.instance.setType(this.obj,this.newType)}hasDeltas(){return!Al(this.$nd,this.$od)||this.typeChanged&&this.newType!==this.previousType}};var kd=class{constructor(r,e,t){this.obj=r;this._n=e;this.instance=t}Qe(){this.instance.addPort(this._n,this.obj.data)}tt(){this.instance.removePort(this._n,this.obj.id)}getTerminusId(){return this.obj.getFullId()}},Wd=class extends kd{constructor(){super(...arguments);c(this,"type","portAdd")}undo(){this.tt()}redo(){this.Qe()}hasDeltas(){return this.obj!=null}},Zd=class extends kd{constructor(){super(...arguments);c(this,"type","portRemove")}undo(){this.Qe()}redo(){this.tt()}isConnectedTo(e){let t=this.getTerminusId();return e.generateSourceIdentifier()===t||e.generateTargetIdentifier()===t}hasDeltas(){return this.obj!=null}};var Jd=class{constructor(r,e,t){this.node=r;this.group=e;this.instance=t}hasDeltas(){return this.node!=null}},Kd=class extends Jd{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.sourceGroup=n;this.Ba=o;this.$a=s;this.instance=a;this.renderer=l;c(this,"type","addGroupMember")}redo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.$a!=null&&this.renderer.setPosition(this.node.id,this.$a.x,this.$a.y)}undo(){this.sourceGroup?this.instance.addToGroup(this.node,this.sourceGroup):this.instance.removeFromGroup(this.node),this.renderer!=null&&this.Ba!=null&&this.renderer.setPosition(this.node.id,this.Ba.x,this.Ba.y)}},qd=class extends Jd{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.targetGroup=n;this.Ua=o;this.Fa=s;this.instance=a;this.renderer=l;c(this,"type","removeGroupMember")}redo(){this.instance.removeFromGroup(this.node),this.renderer!=null&&this.Fa!=null&&this.renderer.setPosition(this.node.id,this.Fa.x,this.Fa.y)}undo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Ua!=null&&this.renderer.setPosition(this.node.id,this.Ua.x,this.Ua.y)}},Qd=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupCollapse")}redo(){this.renderer.collapseGroup(this.group)}undo(){this.renderer.expandGroup(this.group)}hasDeltas(){return this.group!=null}},eu=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupExpand")}redo(){this.renderer.expandGroup(this.group)}undo(){this.renderer.collapseGroup(this.group)}hasDeltas(){return this.group!=null}};var Gl=class{constructor(r,e,t){this.za=r;this.vertex=e;this.pos=t;c(this,"type","rendererVertexRemovedAction")}redo(){}undo(){this.za.setPosition(this.vertex,this.pos.x,this.pos.y)}hasDeltas(){return this.vertex!=null}};var lS="internal.connection",tu="internal.element:repainted",$l="context:update",ru="group:collapse",nu="group:expand",$r="zoom",iu="render:start",Pn="render:end",hS="adhocLayout",Ws="afterLayoutRefresh",Bl="group:relayout",Br="group:render",Zs="internal.vertex:updated",Fr="node:render",ou="node:visibility",su="plugin:added",cS="plugin:removed",On="relayout",dS="objectRepainted",ze="click",At="contextmenu",Vo="dblclick",Ur="dbltap",uS="focus",me="mousedown",GE="mouseenter",$E="mouseexit",se="mousemove",pS="mouseleave",ae="mouseup",ot="mouseout",st="mouseover",W="tap",mS="touchstart",gS="touchend",ES="touchmove",fS="vertex:click",yS="vertex:dblclick",xS="vertex:dbltap",bS="vertex:mouseout",AS="vertex:mouseover",SS="vertex:mousemove",d3="vertex:mouseup",u3="vertex:mousedown",TS="vertex:contextmenu",vS="vertex:tap",CS="edge:click",PS="edge:dblclick",OS="edge:dbltap",au="edge:mouseout",lu="edge:mouseover",_S="edge:mouseup",Fl="edge:mousedown",RS="edge:contextmenu",LS="edge:tap",_n="canvasClick",wS="canvasDblClick",hu="edge:redraw",cu="start",du="lasso:update",uu="lasso:end",Fi="pan",Rn="modeChanged",p3="allGroupsRelayout",DS="groupRelayoutAdhoc",m3="groupMemberRemoved",NS="newVertexAddedToGroup",IS="existingVertexAddedToGroup";var Js=class extends Bi{constructor(e,t,n,o,s,a,l){super(e,t,n,o,s,a,l);this.obj=e;this.instance=n;this.typeChanged=s;this.newType=a;this.previousType=l;c(this,"type","vertexUpdate");o===Ks&&t[this.instance.modelRotationAttribute]==null&&(this.$od[this.instance.modelRotationAttribute]=0)}};var Go=class{constructor(r,e,t,n){this.obj=r;this.previousType=e;this.newType=t;this.instance=n;c(this,"type","setTypeAction")}hasDeltas(){return this.previousType!==this.newType}redo(){this.instance.setType(this.obj,this.newType)}undo(){this.instance.setType(this.obj,this.previousType)}};var BE=class{constructor(r,e,t,n,o){this.T=r;this._E=e;this.vd=t;this.Ci=n;this.za=o;c(this,"type","edgePath")}Td(r){this.T.setEdgeGeometry(this._E,r,null,this.za)}undo(){this.Td(this.vd)}redo(){this.Td(this.Ci)}hasDeltas(){return!Al(this.vd,this.Ci)}},YL=50,FE="Cannot start a new transaction while one is active. Either commit/rollback the current transaction before creating a new one, or pass a cleanup flag in to this method",zL="Cannot rollback transaction from here; it has been appended to. Close all transaction appenders before attempting to rollback the transaction.",pu=class{constructor(r){c(this,"T");c(this,"qo");c(this,"Mt");c(this,"Ya");c(this,"undoStack");c(this,"redoStack");c(this,"Xa",[]);c(this,"pe");c(this,"Et",0);this.T=r.instance,this.Mt=!1,this.undoStack=[],this.redoStack=[],this.qo=r.maximumSize||YL,this.Ya=r.onChange,this.RE()}Cd(r){this.Mt=r}dataLoadStart(){this.clear(),this.Cd(!0)}dataAppendStart(){this.dataLoadStart()}dataLoadEnd(){this.Cd(!1)}dataAppendEnd(){this.dataLoadEnd()}RE(){this.T.bind(Jt,()=>{this.clear()}),this.T.bind(Kt,r=>{this.command(new Ml(r.node,this.T))}),this.T.bind(ve,r=>{this.command(new Il(r.node,this.T))}),this.T.bind(Re,r=>{bl(r.updates)||this.command(new Js(r.vertex,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(Zt,r=>{this.command(new Ml(r.group,this.T))}),this.T.bind(_e,r=>{this.command(new jd(r,this.T))}),this.T.bind(Te,r=>{bl(r.updates)||this.command(new Js(r.vertex,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(Nd,r=>{let e=new Vl(r.group,r.originalGroupSize,r.newGroupSize,this.T,r.source);e.hasDeltas()&&this.command(e)}),this.T.bind(ur,r=>{this.command(new Fd(r.edge,this.T,this))}),this.T.bind(bt,r=>{this.command(new Ud(r.edge,this.T,this))}),this.T.bind(xt,r=>{bl(r.updates)||this.command(new Bi(r.edge,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(an,r=>{this.command(new Yd(this.T,this,r.edge,r.old,r.new))}),this.T.bind(sn,r=>{this.command(new zd(this.T,this,r.edge,r.old,r.new))}),this.T.bind(li,r=>{this.command(new BE(this.T,r.edge,r.originalGeometry,r.geometry,r.ui))}),this.T.bind(si,r=>{this.command(new Wd(r.port,r.vertex,this.T))}),this.T.bind(Vr,r=>{this.command(new Zd(r.port,r.vertex,this.T))}),this.T.bind(dr,r=>{bl(r.updates)||this.command(new Bi(r.port,r.originalData,this.T,null,!1,null,null))}),this.T.bind(Gi,r=>{r.vertexIsNew!==!0&&this.command(new Kd(r.vertex,r.group,r.sourceGroup,r.originalPosition,r.pos,this.T,r.source))}),this.T.bind(zs,r=>{this.command(new qd(r.vertex,r.group,r.targetGroup,r.originalPosition,r.newPosition,this.T,r.source))}),this.T.bind(Ld,r=>{r.isPartOfUpdate||this.command(new Go(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(wd,r=>{r.isPartOfUpdate||this.command(new Go(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Dd,r=>{r.isPartOfUpdate||this.command(new Go(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Rd,r=>{r.isPartOfUpdate||this.command(new Go(r.obj,r.previousType,r.newType,this.T))}),this.T.bind("renderer:added",r=>{r.renderer.bind(Vt,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Hs(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(Gr,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Hs(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(ru,e=>{this.command(new Qd(e.group,r.renderer))}),r.renderer.bind(nu,e=>{this.command(new eu(e.group,r.renderer))}),r.renderer.bind(ve,e=>{this.command(new Gl(r.renderer,e.vertex,e.pos))}),r.renderer.bind(_e,e=>{this.command(new Gl(r.renderer,e.vertex,e.pos))})})}Pi(){this.Ya&&this.Ya(this,this.undoStack.length,this.redoStack.length)}command(r,e){if(!this.Mt){if(!r.hasDeltas())return;HL(r)&&(r=r.compress()),this.pe!=null?this.pe.addAction(r,e):(this.undoStack.push(r),this.undoStack.length>this.qo&&this.undoStack.splice(this.undoStack.length-this.qo-1,this.undoStack.length-this.qo),this.redoStack.length=0,this.Pi())}}edgeChange(r,e){let t=n=>{n.forEach(o=>{o instanceof hi&&o.edgeId===r?o.edgeChange(e):o instanceof Mo&&o.edgeChange(r,e)})};t(this.undoStack),t(this.redoStack)}undo(){let r=this.undoStack.pop();r&&(this.Mt=!0,this.redoStack.push(r),r.undo(),this.Mt=!1,this.Pi())}redo(){let r=this.redoStack.pop();r&&(this.Mt=!0,this.undoStack.push(r),r.redo(),this.Mt=!1,this.Pi())}clear(){this.undoStack.length=0,this.redoStack.length=0,this.pe=null,this.Et=0,this.Mt=!1,this.Pi()}transaction(r,e,t){if(this.pe!=null&&e==null)return U(FE),!1;if(this.openTransaction(e)==null){if(t)return r()}else try{if(r()!==!1){let a=this.pe;return this.Et===0?(this.pe=null,this.command(a)):this.Et--,a.id}else return this.rollbackTransaction(),!1}catch(s){return U("Exception thrown in transaction "+s.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}mergeTransaction(r){if(this.pe!=null)return this.transaction(r,ut);try{let e=this.transaction(r);if(e!==!1){if(this.undoStack.length>1){let t=this.undoStack.pop(),n=this.undoStack.pop();this.LE(t,n),this.undoStack.push(t)}return e}else return this.rollbackTransaction(),!1}catch(e){return U("Exception thrown in transaction "+e.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}LE(r,e){e instanceof Mo?e.$mergeInto(r):r.addAction(e,!0)}wE(){return this.pe=new Mo,this.Et=0,this.pe.id}openTransaction(r){if(!this.Mt){let e=!0;if(this.pe!=null)if(r!=null)if(r===XL)this.commitTransaction();else if(r===jL)this.rollbackTransaction();else if(r===ut)e=!1,this.Et++;else throw new Error(FE);else throw new Error(FE);return e&&this.wE(),this.pe.id}return null}rollbackTransaction(){this.pe!=null&&(this.Et>0?(this.Et--,U(zL)):(this.pe.undo(),this.pe=null,this.Pi(),this.Xa.length=0))}commitTransaction(r){if(this.pe!=null)if(r!==!0&&this.Et>0)this.Et--;else{let e=this.pe;this.pe=null,this.command(e),this.Et=0,this.DE()}}DE(){this.pe==null&&(this.Xa.forEach(r=>{try{r()}catch(e){}}),this.Xa.length=0)}},XL="commitCurrent",jL="rollbackCurrent",ut="appendToCurrent";function HL(i){return i instanceof Mo}function oS(i){return i instanceof Bi||i instanceof Js}function sS(i){return i instanceof Hs}function aS(i){return i instanceof Vl}var mu="1.2.2";var UE="type",YE="default",kL="group",$S="groupResized",WL="addPort",ZL="addNewPort",JL="removePort",gu="updatePort",qs="moved",J6="layout",zE="updateVertex",MS="updateNode",VS="updateGroup",BS="magnetizer",fu="setPosition",FS="snapToGrid",K6="sizeGroupToFit",Ul="drawingToolsResize",Ks="rotation",US="resized",GS="updated",Eu=class extends zt{constructor(e){super();c(this,"graph");c(this,"autoSaver");c(this,"idFunction");c(this,"typeProperty");c(this,"edgeTypeProperty");c(this,"portTypeProperty");c(this,"groupProperty");c(this,"typeFunction");c(this,"edgeIdFunction");c(this,"edgeTypeFunction");c(this,"portIdFunction");c(this,"portTypeFunction");c(this,"portExtractor");c(this,"portUpdater");c(this,"portDataProperty");c(this,"portOrderProperty");c(this,"modelTopAttribute");c(this,"modelLeftAttribute");c(this,"modelWidthAttribute");c(this,"modelHeightAttribute");c(this,"modelRotationAttribute");c(this,"model");c(this,"ja");c(this,"Pd");c(this,"debugEnabled");c(this,"defaultObjectFactory");c(this,"nodeFactory");c(this,"edgeFactory");c(this,"portFactory");c(this,"groupFactory");c(this,"undoRedo");c(this,"Od");c(this,"beforeConnect");c(this,"beforeMoveConnection");c(this,"beforeStartConnect");c(this,"beforeDetach");c(this,"beforeStartDetach");c(this,"Ee");c(this,"Yr",new Map);c(this,"Oi",{});c(this,"$transientVerticesByRenderer",{});e=e||{};let t=e.undoRedo||{};t.enabled!==!1&&(this.undoRedo=new pu({instance:this,maximumSize:t.maximumSize,onChange:(o,s,a)=>{this.fire(js,{undoCount:s,redoCount:a})}})),this.idFunction=e.idFunction||xE,this.typeProperty=e.typeProperty||UE,this.edgeTypeProperty=e.edgeTypeProperty||UE,this.portTypeProperty=e.portTypeProperty||UE,this.groupProperty=e.groupProperty||kL,this.typeFunction=e.typeFunction||(o=>o[this.typeProperty]||YE),this.edgeIdFunction=e.edgeIdFunction||this.idFunction,this.edgeTypeFunction=e.edgeTypeFunction||(o=>o[this.edgeTypeProperty]||YE),this.portIdFunction=e.portIdFunction||this.idFunction,this.portTypeFunction=e.portTypeFunction||(o=>o[this.portTypeProperty]||YE),this.portExtractor=e.portExtractor,this.portUpdater=e.portUpdater,this.portDataProperty=e.portDataProperty,this.portOrderProperty=e.portOrderProperty,this.debugEnabled=!1,this.model=new qc(this,e.model),this.defaultObjectFactory=(o,s,a,l)=>(a=a==null||!cr(a)?{}:a,a=lt(a),a.id=a.id||B(),a.type=a.type||(s==null?null:s.type||s),l(a),!0),this.modelLeftAttribute=e.modelLeftAttribute||AA,this.modelTopAttribute=e.modelTopAttribute||SA,this.modelWidthAttribute=e.modelWidthAttribute||vA,this.modelHeightAttribute=e.modelHeightAttribute||CA,this.modelRotationAttribute=e.modelRotationAttribute||TA,this.Oi=Object.assign({},e.groupTemplates||{}),this.nodeFactory=e.nodeFactory||this.defaultObjectFactory,this.edgeFactory=e.edgeFactory||this.defaultObjectFactory,this.portFactory=e.portFactory||this.defaultObjectFactory,this.groupFactory=e.groupFactory||this.defaultObjectFactory,this.Pd=e.autoSave&&e.autoSave.enabled!==!1,this.Od={portSeparator:e.portSeparator,defaultCost:e.defaultCost,defaultDirected:e.defaultDirected,enableSubgraphs:e.enableSubgraphs},this.portDataProperty!=null&&this.portExtractor==null&&(this.portExtractor=o=>{let s=o[this.portDataProperty]||[];return this.portOrderProperty!=null&&s.sort((a,l)=>{let h=a[this.portOrderProperty],d=l[this.portOrderProperty],u=h==null?1/0:h,p=d==null?1/0:d;return u-p}),s}),this.portDataProperty!=null&&this.portUpdater==null&&(this.portUpdater=(o,s,a)=>{let l={};return this.portOrderProperty!=null&&a.sort((h,d)=>{let u=h.data[this.portOrderProperty],p=d.data[this.portOrderProperty],m=u==null?1/0:u,g=p==null?1/0:p;return m-g}),l[this.portDataProperty]=a.map(h=>h.data),Object.assign(o,l)}),this.graph=new vl(this.Od),this.Pd&&(this.autoSaver=new Nl(this,e.autoSave)),new Gd(this);let n=(o,s)=>{if(this.model==null)return!0;let a=this.getType(o),l=this.getType(s),h=H(o)?o.getParent():o,d=H(s)?s.getParent():s,u=H(o)?this.model.getPortDefinition(a):K(o)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),p=H(s)?this.model.getPortDefinition(l):K(s)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l),m=K(h)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),g=K(d)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l);return u.maxConnections!=null&&o.getEdges().length>=u.maxConnections||p.maxConnections!=null&&s.getEdges().length>=p.maxConnections?!1:o===s?!(m.allowLoopback===!1||u.allowLoopback===!1||p.allowLoopback===!1||g.allowLoopback===!1):h===d?!(m.allowVertexLoopback===!1||u.allowVertexLoopback===!1||p.allowVertexLoopback===!1||g.allowVertexLoopback===!1):!0};if(this.beforeConnect=e.beforeConnect||n,this.beforeMoveConnection=e.beforeMoveConnection||n,this.beforeStartConnect=e.beforeStartConnect||((o,s)=>({})),this.beforeDetach=e.beforeDetach||((o,s,a)=>!0),this.beforeStartDetach=e.beforeStartDetach||((o,s)=>!0),this.Ee=this.Qo(o=>{this.N(s=>s.$selectionCleared(o)),this.fire(ir,{selection:o})}),e.selectionMode&&this.Ee.setMode(e.selectionMode),e.maxSelectedNodes&&this.Ee.setMaxNodes(e.maxSelectedNodes),e.maxSelectedGroups&&this.Ee.setMaxGroups(e.maxSelectedGroups),e.maxSelectedEdges&&this.Ee.setMaxEdges(e.maxSelectedEdges),e.selectionCapacityPolicy&&this.Ee.setCapacityPolicy(e.selectionCapacityPolicy),e.events)for(let o in e.events)this.bind(o,e.events[o]);e.data!=null&&this.load({data:e.data})}get portSeparator(){return this.graph.portSeparator}NE(e,t,n){return{id:`${e}_${n}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y}}es(e,t,n,o){if(j(e))return[this.graph.getVertex(e,!0),!1];if(K(e)||Y(e)||H(e))return[e,!1];{let s=e,a=s.x==null?0:s.x,l=s.y==null?0:s.y;return[this._d(this.NE(t,{x:a,y:l},n),o),!0]}}Qo(e){return new pr(this,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1,h=e;for(let d in h){let u=h[d]===a[d];if(!u&&!t)return!1;l=l||u}return l},o=this.Qo();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getModel(){return this.model}setAutoSave(e){this.autoSaver!=null&&this.autoSaver.discard(),this.autoSaver=new Nl(this,e)}connect(e){let t,n=this.graph.getVertex(e.source),o=this.graph.getVertex(e.target),s=e.cost,a=e.directed;if(!n)if(!e.doNotCreateMissingNodes)n=this.graph.addNode(e.source),this.Ha(n);else return;if(!o)if(!e.doNotCreateMissingNodes)o=this.graph.addNode(e.target),this.Ha(o);else return;let l=e.data||{},h=this.beforeStartConnect(n,this.edgeTypeFunction(l));return h&&(typeof h=="object"&&(l=Object.assign(h,l)),this.beforeConnect(n,o,l,!1)!==!1&&(t=this.$_addEdge({source:n,target:o,cost:s,directed:a,data:l,geometry:e.geometry},Cl,null))),t}clear(){return this.N(e=>e.$graphClearStart()),this.fire(Cn),this.graph.clear(),this.$transientVerticesByRenderer={},this.N(e=>e.$graphClearEnd()),this.fire(Jt,this),this}destroy(){this.clear(),delete this.Yr,delete this.$transientVerticesByRenderer}getGraph(){return this.graph}getNodeCount(){return this.graph.getVertexCount()}getNodeAt(e){return this.graph.getVertexAt(e)}getNodes(){return this.graph.getVertices()}eachNode(e){let t;for(let n=0,o=this.graph.getVertexCount();n<o;n++)t=this.graph.getVertexAt(n),e(n,t)}eachGroup(e){let t;for(let n=0,o=this.graph.getGroupCount();n<o;n++)t=this.graph.getGroupAt(n),e(n,t)}eachVertex(e){this.eachNode(e),this.eachGroup(e)}eachEdge(e){let t=this.graph.getEdges();for(let n=0,o=t.length;n<o;n++)e(n,t[n])}getEdgeCount(){return this.graph.getEdgeCount()}getGroupCount(){return this.graph.getGroupCount()}getGroupAt(e){return this.graph.getGroupAt(e)}getGroups(){return this.graph.getGroups()}addGroupTemplate(e,t){this.Oi[e]=t}getDescendants(e){return Ms(e)}getAncestors(e){return An(e)}isAncestor(e,t){return je(e,t)}isDescendantGroup(e,t){return rA(e,t)}getClusters(){return this.graph.getClusters()}getCluster(e){let t=j(e)?this.getVertex(e):e;return this.graph.getCluster(t)}getNodeId(e){return typeof e=="string"?e:this.idFunction(e)}getNodeType(e){return this.typeFunction(e)||"default"}getGroupId(e){return typeof e=="string"?e:this.idFunction(e)}getGroupType(e){return this.typeFunction(e)||"default"}getEdgeType(e){return this.edgeTypeFunction(e)||"default"}getPortId(e){return this.portIdFunction(e)}getPortType(e){return this.portTypeFunction(e)||"default"}getType(e){return(K(e)?this.typeFunction:H(e)?this.portTypeFunction:this.edgeTypeFunction)(e.data)||"default"}setType(e,t){let n=this.getType(e);if(n===t)return;let o=e.objectType===he.objectType?this.typeProperty:e.objectType===ce.objectType?this.portTypeProperty:this.edgeTypeProperty;e.data[o]=t,e.type=t,this.$dispatchTypeChange(e,n,t,!1)}$dispatchTypeChange(e,t,n,o){let s,a;K(e)?(s=Ld,a=()=>this.N(l=>l.$nodeTypeChanged(e,t,n))):H(e)?(s=wd,a=()=>this.N(l=>l.$portTypeChanged(e,t,n))):rt(e)?(s=Rd,a=()=>this.N(l=>l.$edgeTypeChanged(e,t,n))):Y(e)&&(s=Dd,a=()=>this.N(l=>l.$groupTypeChanged(e,t,n))),s!=null&&(this.fire(s,{obj:e,previousType:t,newType:n,isPartOfUpdate:o}),a())}resolveFullId(e){if(rt(e))return e.id;if(K(e))return e.id;if(Y(e))return e.id;if(H(e))return e.parent.id+this.graph.portSeparator+e.id}resolveNode(e){return H(e)?e.parent:e}addNode(e,t){let n=this.idFunction(e),o=null;n==null&&typeof e!="string"&&(e.id=B());let s=this.graph.addNode(e,this.idFunction);if(s!=null){if(this.portExtractor!=null){let a=this.portExtractor(s.data,s);if(a!=null)for(let l=0;l<a.length;l++)s.$addPort(a[l],this.portIdFunction)}if(typeof e!="string"&&e[this.groupProperty]!=null)if(o=this.getGroup(e[this.groupProperty]),o!=null)this.graph.$addMemberToGroup(s,o);else throw new Error("parent group ["+e[this.groupProperty]+"] not found");return this.Ha(s,o),o!=null&&this.fire(Gi,{group:o,vertex:s,vertexIsNew:!0}),s}else return this.graph.getVertex(n)}Ha(e,t){let n={node:e,parentGroup:t};this.N(o=>o.$nodeAdded(n)),this.fire(Kt,n)}IE(e,t){let n={group:e,parentGroup:t};this.N(o=>o.$groupAdded(n)),this.fire(Zt,n)}addFactoryNode(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t={}),t.type=t.type||e;try{this.nodeFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addNode(a);try{n&&n(l)}catch(h){U("WARN: Factory node callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: Factory node threw an error",a),s!==!1&&this.rollbackTransaction()}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t]);return this}Rd(e){return Is(this.$transientVerticesByRenderer,e.id,()=>({}))}$addTransientVertex(e,t){let n=this.graph.addNode(e);if(n.transient=!0,t!=null){let o=this.Rd(t);o[n.id]=n,n.transientRenderer=t.id}return n}_d(e,t){let n=this.$addTransientVertex(e,t);return n.dummy=!0,this.N(o=>{o.$renderDummyVertex(n)}),n}ts(e){this.graph.deleteNode(e),this.N(t=>{t.$nodeRemoved({vertex:e,node:e,edges:[],parentGroupIsBeingRemoved:!1})})}$setEdgeDetached(e,t,n){let o=this._d({id:`${e.id}_${n===it?"0":"1"}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y});n===it?this.setSource(e,o):this.setTarget(e,o)}$cleanupTransientVertex(e,t){let n=e.getAllEdges()||[];this.graph.deleteNode(e);for(let o=0;o<n.length;o++)this.graph.deleteEdge(n[o]),t.$edgeRemoved({edge:n[o],source:t});if(t.$nodeRemoved({vertex:e,node:e,edges:n,parentGroupIsBeingRemoved:!1}),t!=null){let o=this.Rd(t);o&&delete o[e.id]}}$addTransientEdge(e,t,n,o,s,a){let l={source:t,target:n,data:o||{},geometry:s,transient:!0},h=this.graph.addEdge(l);return e.$edgeAdded({edge:h,source:e,geometry:h.geometry,transient:!0,reason:oA},a),h}addFactoryGroup(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t==null&&n==null&&(t={})),t.type=t.type||e;try{this.groupFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addGroup(a);try{n&&n(l)}catch(h){U("WARN: Factory group callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: group factory threw an error",a),s!==!1&&this.rollbackTransaction()}}addFactoryGroupWithTemplate(e,t,n,o,s,a){o==null&&(n!=null?(n=typeof n=="object"?n:{},o=typeof n=="function"?n:null):n==null&&o==null&&(n={})),n.type=n.type||e;try{this.groupFactory(this,e,n,l=>{a!==!1&&this.openTransaction(ut);let h=this.Oi[t]!=null?this.addGroupWithTemplate(l,t):this.addGroup(l);try{o&&o(h)}catch(d){U("WARN: Factory group callback threw an error",d)}a!==!1&&this.commitTransaction()},()=>{s&&s(),a!==!1&&this.rollbackTransaction()})}catch(l){U("WARN: group factory threw an error",l),a!==!1&&this.rollbackTransaction()}}addGroup(e,t){let n,o;if(this.idFunction(e)==null&&typeof e!="string"&&(e.id=B()),o=this.graph.addGroup(e,this.idFunction),o!=null){if(typeof e!="string"&&e[this.groupProperty]!=null){if(n=this.getGroup(e[this.groupProperty]),n==null)throw new Error("Cannot find parent group ["+e[this.groupProperty]+"]");this.graph.$addMemberToGroup(o,n)}this.IE(o,n),n!=null&&this.fire(Gi,{group:n,vertex:o,vertexIsNew:!0})}return o}addToGroup(e,t,n){return this.$addToGroup(e,t,null,null,n,null)}addGroupWithTemplate(e,t){let n;return this.transaction(()=>{let o;if(typeof t=="string"){let l=this.Oi[t];if(l==null)return U("No group template found with name ["+t+"]"),null;try{o=l}catch(h){return U("Error parsing group template ["+t+"]: "+h.message),null}}else o=t;n=this.addGroup(e);let s=new Map,a=(l,h)=>{(l.nodes||[]).forEach(d=>{let u=d.id,p=Object.assign({},d,{id:B(),group:h.id}),m=this.addNode(p);s.set(u,m.id)}),(l.groups||[]).forEach(d=>{let u=d.id,p=d.groupTemplate,m=Object.assign({},d,{id:B(),group:h.id});p&&typeof p!="string"&&delete m.groupTemplate;let g=this.addGroup(m);if(s.set(u,g.id),p)if(typeof p=="string"){let E=this.Oi[p];if(E)try{a(E,g)}catch(y){U("Error parsing nested group template ["+p+"]: "+y.message)}else U("No group template found for nested group with name ["+p+"]")}else a(p,g)}),(l.edges||[]).forEach(d=>{let u=d.source.split(this.portSeparator),p=d.target.split(this.portSeparator),m=s.get(u[0])||u[0],g=s.get(p[0])||p[0],E=u[1]==null?m:[m,u[1]].join(this.portSeparator),y=p[1]==null?g:[g,p[1]].join(this.portSeparator);this.addEdge({source:E,target:y,data:d.data||{}})})};return a(o,n),n},ut),n}$addToGroup(e,t,n,o,s,a){let l=!1,h=this.getObjectInfo(t),d=this.getObjectInfo(e);if(n=n||d.obj.group,d.obj&&h.obj&&(l=h.obj.$addMember(d.obj),l)){n&&n.$removeMember(d.obj),d.obj.data[this.groupProperty]=h.obj.id;let u={vertex:d.obj,group:h.obj,pos:s,originalPosition:o,source:a,positionInGroup:s};n&&(u.sourceGroup=n),this.N(p=>{p.$groupMemberAdded(u)}),this.fire(Gi,u)}return l}removeFromGroup(e){return this.$removeFromGroup(e,null,null,null,null)}$removeFromGroup(e,t,n,o,s){let a=this.getObjectInfo(e),l;if(a.obj&&a.obj.group&&(l=a.obj.group,l.$removeMember(a.obj))){let h={vertex:a.obj,group:l,newPosition:o,originalPosition:n,source:s};t&&(h.targetGroup=t),this.N(d=>{d.$groupMemberRemoved(h)}),delete a.obj.data[this.groupProperty],this.fire(zs,h)}return l}Ld(e,t,n,o){e.nestedGroups.forEach(a=>this.Ld(a,t,!0,o)),e.nodes.forEach(a=>this.wd(a,!0,o));for(let a=0;a<e.edges.length;a++)this.ka(e.edges[a]);let s={vertex:e.group,edges:e.edges,group:e.group,removeChildren:t,children:e.children,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:n};this.N(a=>a.$groupRemoved(s)),o||this.fire(_e,s)}wd(e,t,n){for(let s=0;s<e.edges.length;s++)this.ka(e.edges[s]);let o={vertex:e.node,node:e.node,edges:e.edges,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:t};this.N(s=>s.$nodeRemoved(o)),n||this.fire(ve,o)}removeGroup(e,t,n){let o=this.graph.getVertex(j(e)?e:e.id);if(o){this.openTransaction(ut);let s=this.graph.deleteGroup(o,t);return s.group&&(t||s.children.forEach(a=>delete a.data[this.groupProperty]),this.Ld(s,t===!0,!1,n)),this.commitTransaction(),!0}return!1}getNode(e){return this.graph.getVertex(e)}getEdge(e){return this.graph.getEdge(e)}getGroup(e){return this.graph.getGroup(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}getPort(e){let t=this.graph.getVertexByPortId(e);if(t)return t.getPort(this.graph.splitPortId(e)[1])}exists(...e){for(let t=0;t<e.length;t++)if(this.graph.getVertex(e[t])==null)return!1;return!0}removeNode(e){if(!j(e)&&e.transient===!0)return!1;let t=this.graph.getVertex(j(e)?e:e.id);if(t!=null){this.openTransaction(ut);let n=t.getAllEdges()||[];for(let s=0;s<n.length;s++)this.removeEdge(n[s]);let o=this.graph.deleteNode(t);return this.wd(o,!1),this.commitTransaction(),!0}return!1}addEdge(e){return this.$_addEdge(e,Cl,null)}$_addEdge(e,t,n,o){let s=this.$_deriveEdgeId(e.data),[a,l]=this.es(e.source,s,0,n),[h,d]=this.es(e.target,s,1,n);if(a==null||a.objectType==null)throw new TypeError("Unknown source node ["+e.source+"]");if(h==null||h.objectType==null)throw new TypeError("Unknown target node ["+e.target+"]");if(!l&&a.dummy)return U(`Cannot add edge to dummy vertex ${a.id}`),null;if(!d&&h.dummy)return U(`Cannot add edge to dummy vertex ${h.id}`),null;let u=Object.assign(e,{source:a,target:h});if(this.beforeConnect(a,h,e.data,e.addedByMouse===!0)!==!1){let p=this.graph.addEdge(u,s,this.edgeIdFunction),m={edge:p,source:n,geometry:e.geometry,addedByMouse:e.addedByMouse,reason:t};return this.N(g=>g.$edgeAdded(m,e.context)),o||this.fire(ur,m,null),p}else return this.debugEnabled&&U("Could not add edge"),null}ka(e,t){let n={edge:e,source:t};this.N((o,s)=>o.$edgeRemoved(n)),this.fire(bt,n,null)}removeEdge(e,t){let n=this.graph.getEdge(e);return n!=null&&(this.graph.deleteEdge(n),n.source.dummy&&K(n.source)&&this.ts(n.source),n.target.dummy&&K(n.target)&&this.ts(n.target),this.ka(n,t)),this}setTarget(e,t){if(t==null)return{success:!1};let[n]=this.es(t,e.id,1);if(n==null||this.beforeConnect(e.source,n,e.data)===!1)return{success:!1};let o=this.graph.setTarget(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.ts(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeTargetChanged(l)}),this.fire(sn,l)}return o}setSource(e,t){if(t==null)return{success:!1};let[n]=this.es(t,e.id,0);if(n==null||this.beforeConnect(n,e.target,e.data)===!1)return{success:!1};let o=this.graph.setSource(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.ts(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeSourceChanged(l)}),this.fire(an,l)}return o}addNewPort(e,t,n){let o=this.graph.getVertex(e);this.portFactory(this,t,n,s=>{let a=this.portIdFunction(s),l=o.$addPort(a);l.data=s,this.rs(o,ZL);let h={vertex:o,data:s,port:l};this.N(d=>d.$portAdded(h)),this.fire(si,h,null)},()=>{})}addPort(e,t){let n=this.graph.getVertex(e),o=n.$addPort(t,this.portIdFunction);this.rs(n,WL);let s={vertex:n,data:t,port:o};return this.N(a=>a.$portAdded(s)),this.fire(si,s,null),o}removePort(e,t){let n;if(typeof e=="string"){let o=this.graph.splitPortId(e);o.length===2?(n=this.graph.getVertex(o[0]),t=o[1]):n=this.graph.getVertex(e)}else H(e)?(t=e.id,n=e.getParent()):n=this.graph.getVertex(e);if(n!=null&&t!=null){let o=n.getPort(t);if(o){this.openTransaction(ut);let s=o.getAllEdges();for(let l=s.length,h=0;h<l;h++)this.removeEdge(s[0]);n.$removePort(o),this.rs(n,JL);let a={vertex:n,port:o,edges:s};return this.N(l=>l.$portRemoved(a)),this.fire(Vr,a,null),this.commitTransaction(),!0}}return!1}remove(e,t){if(e==null)return;let n=this.getObjectInfo(e);this.setSuspendRendering(!0);try{if(n.obj&&K(n.obj))this.removeNode(n.obj);else if(n.obj&&Y(n.obj))this.removeGroup(n.obj);else if(n.obj&&rt(n.obj))this.removeEdge(n.obj);else if(n.obj&&H(n.obj))this.removePort(n.obj);else{if(e.getNodeCount!=null)for(;e.getNodeCount()>0;)this.removeNode(e.getNodeAt(0));if(e.getEdgeCount!=null)for(;e.getEdgeCount()>0;)this.removeEdge(e.getEdgeAt(0));if(e.getGroupCount!=null)for(;e.getGroupCount()>0;)this.removeGroup(e.getGroupAt(0),t!==!1)}}finally{this.setSuspendRendering(!1,!0)}}setSuspendRendering(e,t){for(let n in this.Yr)this.Yr.get(n).setSuspendRendering(e,t)}batch(e){this.setSuspendRendering(!0);try{e()}catch(t){U("Error in transaction "+t)}finally{this.setSuspendRendering(!1,!0)}}updateGroup(e,t){this.$_updateVertex(e,t,VS,!1)}$_updateGroup(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateNode(e,t){this.$_updateVertex(e,t,MS,!1)}$_updateNode(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateVertex(e,t){this.$_updateVertex(e,t,zE,!1)}$_updateVertex(e,t,n,o,s){let a=this.getObjectInfo(e);if(a.obj){let h=(H(a.obj)?a.obj.getParent():a.obj).objectType===he.objectType?Re:Te;this.Dd(a.obj,t,o,h,(d,u)=>({vertex:d,updates:t||{},originalData:u,reason:n||zE,source:s}))}}updateVertices(e,t){this.VE(e,zE,!1,t)}VE(e,t,n,o){this.transaction(()=>{e.forEach(s=>{this.$_updateVertex(s.id,s.updates,t,n)})},o||ut)}updatePort(e,t){this.$_updatePort(e,t,gu,!1)}$_updatePort(e,t,n,o){let s=this.getObjectInfo(e);s.obj&&this.Dd(s.obj,t,o,dr,(a,l)=>({port:a,vertex:a.getParent(),updates:t||{},originalData:l,reason:n||gu}))}updateEdge(e,t){this.$_updateEdge(e,t,GS,!1)}$_updateEdge(e,t,n,o){let s=typeof e=="string"?this.graph.getEdge(e):e;if(s!=null){let a=Object.assign({},s.data);if(t)if(o)s.data=Object.assign({},t);else for(let u in t)s.data[u]==null?s.data[u]=t[u]:gE(s.data,u,t[u]);let{changed:l,newType:h,previousType:d}=this.Nd(a,s,!0);this.fire(xt,{edge:s,updates:t||{},originalData:a,reason:n,typeChanged:l,newType:h,previousType:d},null)}}update(e,t){this.bn(e,t,null,!1)}bn(e,t,n,o){if(K(e)){let s=n==null?MS:n;this.$_updateVertex(e,t,s,o)}else if(Y(e)){let s=n==null?VS:n;this.$_updateVertex(e,t,s,o)}else if(rt(e)){let s=n==null?GS:n;this.$_updateEdge(e,t,s,o)}else if(H(e)){let s=n==null?gu:n;this.$_updatePort(e,t,s,o)}}setEdgeGeometry(e,t,n,o){n=lt(n||e.geometry),e.geometry=lt(t),this.fire(li,{edge:e,geometry:t,originalGeometry:n,ui:o}),this.N(s=>{s.$edgeGeometryUpdated(e,t,n)})}clearEdgeGeometry(e){this.setEdgeGeometry(e,null,null,null)}getPath(e){return new Ol(this,e)}findGraphObject(e){return e==null?null:e==="*"?this.graph:e.constructor===he||e.constructor===ce||e.constructor===oe||e.constructor===Ye?e:j(e)||cr(e)?this.graph.getVertex(e):null}is(e,t,n,o){return t||n.clear(),n.append(e,s=>{let a={obj:s,selection:n};o&&(this.N(l=>{l.$select(a)}),this.fire(qt,a))})}ME(e,t,n){e=e||{};let o=[],s={},a=h=>{s[h.getId()]||(o.push(h),s[h.getId()]=!0)},l=(h,d,u,p)=>{if(h!=null){let m;rt(h)?m=[h]:m=t(h),e.filter&&(m=m.filter(e.filter));for(let g=0;g<m.length;g++){let E=d&&h===this.graph||m[g].source===h||n&&H(m[g].source)&&m[g].source.getParent()===h,y=u&&h===this.graph||m[g].target===h||n&&H(m[g].target)&&m[g].target.getParent()===h;(d&&E||u&&y||p&&(E||y))&&a(m[g])}}};return l(this.findGraphObject(e.source),!0,!1,!1),l(this.findGraphObject(e.target),!1,!0,!1),l(this.findGraphObject(e.element),!1,!1,!0),o}Nd(e,t,n){let o=t.objectType===Ye.objectType?this.edgeTypeProperty:t.objectType===ce.objectType?this.portTypeProperty:this.typeProperty;if(t.data[o]!=null&&t.data[o]!==e[o]){let s=t.data[o],a=e[o];return t.type=s,this.$dispatchTypeChange(t,a,s,n),{changed:!0,newType:s,previousType:a}}return{changed:!1,newType:null,previousType:null}}Dd(e,t,n,o,s){if(e&&e.objectType){let a=Object.assign({},e.data),l=e.objectType===ce.objectType?e.getFullId():e.id,h=e.objectType===ce.objectType?this.portIdFunction(a):null,d;if(t){if(n)e.data=Object.assign({},t);else for(let E in t)gE(e.data,E,t[E]);e.objectType===ce.objectType&&(d=this.portIdFunction(e.data),d!==e.id&&this.graph.renamePort(e,d),this.rs(e.getParent(),gu))}let u=s(e,a);u.originalId=l,h!=null&&(u.originalPortId=h),this.N(E=>E.$vertexUpdated(u));let{changed:p,newType:m,previousType:g}=this.Nd(a,e,!0);p&&(u.typeChanged=!0,u.newType=m,u.previousType=g),this.fire(o,u,null)}}rs(e,t){if(this.portUpdater!=null){let n=this.portUpdater(e.data,e,e.getPorts());if(n!=null&&(e.data=n,!this.ja)){let o=Y(e)?Te:Re,s={vertex:e,updates:{},originalData:e.data,reason:t};this.N(a=>a.$vertexUpdated(s)),this.fire(o,s)}}}getEdges(e){return this.ME(e,t=>t.getEdges(),!1)}getAllEdges(){return this.graph.getAllEdges()}getAllEdgesFor(e,t){return e.getAllEdges(t)}selectAllEdges(){return this.filter(rt)}addAllEdgesToSelection(){this.addToSelection(this.getAllEdges())}setSelection(e){let t=this._i(e);this.is(t,!1,this.Ee,!0)}select(e,t){let n=this.Qo(),o=this._i(e),s=this.is(o,!0,n);if(t)for(let a=0;a<s[0].length;a++){let l=s[0][a];if(K(l||Y(l)||H(l))){let h=l.getAllEdges();for(let d=0;d<h.length;d++)n.append(h[d])}}return n}Id(e,t,n,o){let s=e.getAllEdges();for(let a=0,l=s.length;a<l;a++)if(s[a].source===e){let h=s[a].target,d=h.getFullId();o[d]||(t.append(h),n&&t.append(s[a]),o[d]=!0,this.Id(h,t,n,o))}}selectDescendants(e,t,n){let o=this.getObjectInfo(e),s=this.Qo();if(o.obj&&o.obj.objectType===he.objectType){t&&this.is(o.obj,!0,s);let a={};a[o.obj.getFullId()]=!0,this.Id(o.obj,s,n,a)}return s}_i(e){return e instanceof Ol||e instanceof pr?e:j(e)?this.getVertex(e)||this.getEdge(e):Array.isArray(e)?e.map(t=>j(t)?this.getVertex(e)||this.getEdge(e):t):e}addToSelection(e){let t=this._i(e);if(t){let n=this.is(t,!0,this.Ee,!1);n[1]!=null&&n[1].length>0&&this.Ri(!1,n[1]),n[0]!=null&&n[0].length>0&&this.Ri(!0,n[0])}}Ri(e,t){let n=e?qt:Qt;for(let o=0;o<t.length;o++){let s={obj:t[o],selection:this.Ee};this.N(a=>{e?a.$select(s):a.$deselect(s)}),this.fire(n,s)}}toggleSelection(e){let t=this._i(e);if(t){let n=[],o=this.Ee.toggle(t,(s,a)=>{a||n.push(s)});this.Ri(!1,o[1]),this.Ri(!1,n),this.Ri(!0,o[0])}}removeFromSelection(e){let t=this._i(e);t&&this.Ee.remove(t,n=>{let o={obj:n,selection:this.Ee};this.N(s=>{s.$deselect(o)}),this.fire(Qt,o)})}addPathToSelection(e){this.addToSelection(this.getPath(e))}clearSelection(){this.Ee.clear()}getSelection(){return this.Ee}setMaxSelectedNodes(e){this.Ee.setMaxNodes(e)}setMaxSelectedEdges(e){this.Ee.setMaxEdges(e)}setSelectionCapacityPolicy(e){this.Ee.setCapacityPolicy(e)}GE(e){this.fire(e),this.ja=!1}Vd(e,t,n){e=e||{};let o=e.type||"json",s=e.data,a=e.url,l=e.jsonp,h=e.onload,d=e.parameters||{},u=e.error||function(m){};if(s==null&&a==null)throw new TypeError("You must supply either data or url to load.");let p=m=>{e.incremental===!1&&this.clear(),this.ja=!0,t===wo?(this.undoRedo&&this.undoRedo.dataLoadStart(),this.N(g=>g.$dataLoadStart())):t===IE&&(this.undoRedo&&this.undoRedo.dataAppendStart(),this.N(g=>g.$dataAppendStart())),this.fire(t),cA(o,m,this,d),this.GE(n),h&&h(this,m),this.fire(jA),n===Mr?(this.N(g=>g.$dataLoadEnd()),this.undoRedo&&this.undoRedo.dataLoadEnd()):n===ME&&(this.N(g=>g.$dataAppendEnd()),this.undoRedo&&this.undoRedo.dataAppendEnd())};if(s)p(s);else if(a){if(l){let E=a.indexOf("?")===-1?"?":"&";a=a+E+"callback=?"}let m=o===Wt||o===AE?Wt:e.dataType,g=e.headers||{Accept:"application/json"};this.fetchUrl({url:a,success:p,dataType:m,error:u,headers:g})}return this}load(e){return this.Vd(e,wo,Mr)}append(e){return this.Vd(e,IE,ME)}save(e){if(e==null){U("VisuallyJs: save method requires at least URL parameter - no params given.");return}if(e.url==null){U("VisuallyJs: save method requires at least URL parameter");return}let t=e.data||this.exportData(e),n={"Content-Type":"application/json"};Object.assign(n,e.headers||{}),this.fetchUrl({url:e.url,type:"POST",data:t,success:e.success||function(o){},error:e.error||function(o){},headers:n})}exportData(e){return e=e||{},SE(e.type||Wt,this,e.parameters)}toJSON(){return SE(Wt,this,{})}getRenderer(e){return this.Yr.get(e)}N(e,t){this.Yr.forEach((n,o)=>{if(t==null||t!==n)try{e(n,o)}catch(s){U("WARN: could not invoke renderer "+o+" ["+s+"]")}})}$addRenderer(e,t){t=t||B(),this.Yr.set(t,e),e.id=t,e.onDestroy(n=>{this.Yr.delete(n.id)}),this.fire(qA,{renderer:e,id:t})}getObjectInfo(e){let t={obj:null,type:null,id:null};if(e!=null){if(typeof e=="string")e=this.getNode(e)||this.getGroup(e)||this.getPort(e)||this.getEdge(e);else if(typeof e=="object"&&typeof e.objectType=="undefined"){let n=this.idFunction(e),o=this.edgeIdFunction(e);e=this.getNode(n)||this.getGroup(n)||this.getEdge(o)}if(e!=null)t.obj=e;else return t;t.obj!=null&&(t.id=t.obj.id,t.type=t.obj.objectType)}return t}undo(){this.undoRedo&&(this.undoRedo.undo(),this.fire(QA,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}redo(){this.undoRedo&&(this.undoRedo.redo(),this.fire(eS,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}transaction(e,t){return this.undoRedo?this.undoRedo.transaction(e,t):null}$transaction(e,t,n){return this.undoRedo?this.undoRedo.transaction(e,t,n):null}mergeTransaction(e){return this.undoRedo?this.undoRedo.mergeTransaction(e):null}openTransaction(e){return this.undoRedo?this.undoRedo.openTransaction(e):null}rollbackTransaction(){this.undoRedo&&this.undoRedo.rollbackTransaction()}commitTransaction(e){this.undoRedo&&this.undoRedo.commitTransaction(e)}flushUndoRedo(){this.undoRedo&&this.undoRedo.clear()}get version(){return mu}$_deriveEdgeId(e){return e==null?B():typeof e=="string"?e:this.edgeIdFunction(e)||B()}};var aW="csv";function YS(i){let r=[],e="",t=!1;for(let n=0;n<i.length;n++){let o=i[n],s=i[n+1];t?o==='"'&&s==='"'?(e+='"',n++):o==='"'?t=!1:e+=o:o==='"'?t=!0:o===","?(r.push(e),e=""):e+=o}return r.push(e),r}var XE=class{constructor(r,e){c(this,"csv");c(this,"lines");c(this,"startLine");c(this,"headers");this.csv=r,this.lines=r.split(/\r?\n/).map(t=>t.trim()),e=e||{},this.startLine=e.skipLines!=null?e.skipLines:e.readHeaders?1:0,e.readHeaders?this.lines[0]&&this.lines[0].length>0&&(this.headers=YS(this.lines[0])):this.headers=e.headers}Md(r){for(let e=this.startLine;e<this.lines.length;e++){let t=this.lines[e].trim();if(t.length===0)continue;let n=YS(t);r(n)}}readLines(r){this.Md(e=>r(e))}readRecords(r){this.Md(e=>{let t={};for(let n=0;n<e.length;n++){let o=this.headers?this.headers[n]||`Field ${n+1}`:`Field ${n+1}`;t[o]=e[n]}r(t)})}},zS=(i,r,e)=>{e=e||{};let t=e.nodeDecorator||(l=>l),n=e.edgeDecorator||(l=>l),o=new Map,s=[];new XE(i,{readHeaders:e.readHeaders!==!1,headers:e.readHeaders===!1?["source","target","value"]:null}).readRecords(l=>{o.has(l.source)||o.set(l.source,t({id:l.source},!0)),o.has(l.target)||o.set(l.target,t({id:l.target},!1)),s.push({source:l.source,target:l.target,data:n({value:parseFloat(l.value)},o.get(l.source),o.get(l.target))})}),s.sort((l,h)=>h.data.value-l.data.value),Array.from(o.values()).forEach(l=>r.addNode(l)),s.forEach(l=>r.addEdge(l))};function XS(i){return i.eachNode!=null&&i.eachEdge!=null&&i.eachGroup!=null&&i.filter!=null}function jS(i,r){return r?i:i.toLowerCase()}function KL(i){i=""+i;let r=i.split(/\s/),e=[],t=[],n=4;for(let o=0;o<r.length;o++){let s=Ct(r[o].replace(/[^\w]*/,""));s.length>0&&(e.push({token:s,context:""}),t.unshift(s),t.splice(n-1),t.length>1&&(t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse()))}for(t.pop();t.length>1;)t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse(),t.pop();return e}var qL=KL;function NW(i){return i=Ct(i),[{token:i.replace(/\s/g,"_"),context:i}]}function QL(i){return[{token:Ct(i),context:i}]}function ew(i,r){return i.score>r.score?-1:1}var tw=i=>i.id;function rw(i,r,e){if(i.length===0){i.push(r);return}let t=(n,o)=>{let s=n+Math.floor((o-n)/2),a=i[s],l=e(a,r),h;if(l===0){i.splice(s,0,r);return}else if(l===-1){if(s===i.length-1){i.push(r);return}else if(h=e(i[s+1],r),h!==l){i.splice(s+1,0,r);return}t(s+1,o)}else{if(s===0){i.unshift(r);return}else if(h=e(i[s-1],r),h!==l){i.splice(s,0,r);return}t(n,n+Math.floor((o-n)/2))}};t(0,i.length-1)}var nw=10,Qs=class{constructor(r){c(this,"fields");c(this,"root");c(this,"tokenizer");c(this,"searchTokenizer");c(this,"limit");c(this,"exclusions");c(this,"caseSensitive");c(this,"idFunction");c(this,"sorter");c(this,"Gd",0);c(this,"Li",new Map);c(this,"Xr",[]);c(this,"os",0);c(this,"we",{});r=r||{},this.fields=r.fields,this.root=this.Wa(),this.tokenizer=r.tokenizer||qL,this.searchTokenizer=r.searchTokenizer||QL,this.limit=r.limit||nw,this.exclusions=r.exclusions||[],this.caseSensitive=r.caseSensitive===!0,this.idFunction=r.idFunction||tw,this.sorter=r.sorter||ew}Wa(r){return{index:this.Gd++,children:{},documentIds:{},key:r}}$E(r,e,t){let n=this.we[r];n||(n={},this.we[r]=n),n[e.index]=e}BE(r,e,t){let n=(o,s,a,l)=>{if(s!==a.length){var h=a[s],d=o.children[h];d||(d=this.Wa(h),o.children[h]=d),d.documentIds[l]=d.documentIds[l]||[],d.documentIds[l].push(a),this.$E(l,d,t),n(d,s+1,a,l)}};n(this.root,0,r,e)}removeExclusions(r){let e={};for(let t in r)this.exclusions.indexOf(t)===-1&&(e[t]=r[t]);return e}add(r){let e=t=>{let n=this.removeExclusions(t);rw(this.Xr,{document:n,score:1},this.sorter);var o=this.idFunction(t),s={fields:a=>{for(let l=0;l<this.fields.length;l++){let h=t[this.fields[l]];typeof h=="string"&&a(h)}},document:a=>{for(let l in t)if(l!=="id"){let h=t[l];typeof h=="string"&&a(h)}}};this.Li.set(o,n),s[this.fields?"fields":"document"](a=>{if(a){let l=this.tokenizer(a);for(let h=0;h<l.length;h++)this.BE(jS(l[h].token,this.caseSensitive),o,l[h].context)}}),this.os++};if(r.constructor===Array)for(let t=0;t<r.length;t++)e(r[t]);else e(r)}addAll(...r){for(let e=0;e<r.length;e++)this.add(r[e])}reindex(r){this.remove(r),this.add(r)}remove(r){let e=this.idFunction(r),t=this.we[e],n;if(t)for(n in t)delete t[n].documentIds[e];let o=-1;for(n=0;n<this.Xr.length;n++)if(this.idFunction(this.Xr[n].document)===e){o=n;break}o!==-1&&(this.Xr.splice(o,1),this.os=this.Xr.length),this.Li.delete(e)}clear(){this.Li.clear(),this.we={},this.Gd=0,this.Xr.length=0,this.os=0,this.root=this.Wa()}getDocumentCount(){return this.os}getDocumentList(){return this.Xr}getDocument(r){return this.Li.get(r)}search(r,e){let t=this.searchTokenizer(r),n={},o=[],s={},a={},l=(d,u,p)=>{let m=n[d];m||(m={},n[d]=m,s[d]=0,a[d]=[]),a[d].push(p),m[u]||(m[u]=!0,s[d]++)},h=(d,u,p)=>{if(u===p.length){for(let g in d.documentIds)if(d.documentIds.hasOwnProperty(g)){let E=d.documentIds[g];for(let y=0;y<E.length;y++)l(g,p,E[y])}return}let m=p[u];d.children[m]&&h(d.children[m],u+1,p)};for(let d=0;d<t.length;d++)h(this.root,0,jS(t[d].token,this.caseSensitive));for(let d in n)o.unshift({document:this.Li.get(d),score:s[d],contexts:a[d]});return o.sort(this.sorter),o.slice(0,e==null?this.limit:e)}},HS=class{constructor(r,e){this.instance=r;c(this,"nodeIndex");c(this,"groupIndex");c(this,"edgeIndex");c(this,"portIndex");this.nodeIndex=new Qs(e),this.groupIndex=new Qs(e),this.edgeIndex=new Qs(e),this.portIndex=new Qs(e),r.bind(Kt,t=>{this.$d(t.node)}),r.bind(ve,t=>{this.nodeIndex.remove(t.node.data),t.node.getPorts().forEach(n=>this.portIndex.remove(n.data))}),r.bind(Re,t=>{this.nodeIndex.remove(t.vertex.data),this.nodeIndex.add(t.vertex.data)}),r.bind(Zt,t=>{this.Bd(t.group)}),r.bind(_e,t=>{this.groupIndex.remove(t.group.data)}),r.bind(Te,t=>{this.groupIndex.remove(t.vertex.data),this.groupIndex.add(t.vertex.data)}),r.bind(ur,t=>{this.Fd(t.edge)}),r.bind(bt,t=>{this.edgeIndex.remove({id:t.edge.getId()})}),r.bind(xt,t=>{let n=Object.assign(t.originalData||{},{id:t.edge.getId()});this.edgeIndex.remove(n);let o=Object.assign(t.edge.data||{},{id:t.edge.getId()});this.edgeIndex.add(o)}),r.bind(si,t=>{this.portIndex.add(t.port.data)}),r.bind(Vr,t=>{this.portIndex.remove(t.port.data)}),r.bind(dr,t=>{this.portIndex.remove(t.port.data),this.portIndex.add(t.port.data)}),r.bind(Jt,()=>{this.nodeIndex.clear(),this.groupIndex.clear(),this.edgeIndex.clear(),this.portIndex.clear()}),this.instance.eachNode((t,n)=>{this.$d(n)}),this.instance.eachGroup((t,n)=>{this.Bd(n)}),this.instance.eachEdge((t,n)=>{this.Fd(n)})}$d(r){this.nodeIndex.add(r.data),r.getPorts().forEach(e=>this.portIndex.add(e.data))}Bd(r){this.groupIndex.add(r.data)}Fd(r){let e=Object.assign(r.data||{},{id:r.getId()});this.edgeIndex.add(e)}search(r){let e=this.nodeIndex.search(r).map(s=>this.instance.getNode(s.document.id)),t=this.portIndex.search(r).map(s=>this.instance.getPort(s.document.id)),n=this.groupIndex.search(r).map(s=>this.instance.getGroup(s.document.id)),o=this.edgeIndex.search(r).map(s=>this.instance.getEdge(s.document.id));return{nodes:e,groups:n,edges:o,ports:t}}};var kS="context",jE="lookup",WS="default",ci="element",Ui="text",$o="tmpl",di="each",Yl="if",ZS="root",JS="class",KS="style",Bo="$value",zl="$key",qS="attribute";function HE(i,r){if(i==null)return i;{let e=i.replace(/\n/g,"").replace(/^[\s]+</,"<").replace("/>",">").replace(/>[\s]+$/,">").split(/^<|>$/)[1].split(r);return Wb(e)}}function eT(i){return i.length>0?i[i.length-1]:null}function tT(i){if(i==null||i.length===0)return!1;for(let r=i.length-1;r>-1;r--)if(i[r].type==="each")return!0;return!1}function kE(i,r,e,t,n){let o=B(),s={w:r,expressions:[],id:o};return e.bindings[i]=s,r.replace(/\{\{([^\}]*)\}\}/g,(a,l,h,d)=>{let u=!1;return l.startsWith(":")&&(u=!0,l=l.substring(1)),s.expressions.push([a,l,u]),""}),o}function QS(i,r,e,t,n){e.atts[i]=r,kE(i,r,e,t,n)}function rT(i,r){let e=HE(i,r.attributesRe),t={el:Ct(e[0]),atts:{},bindings:{}},n=(o,s)=>{let a=o.match(/([^=]+)=['"](.*)['"]/);return a==null&&s==null?t.atts[o]="":a==null?QS(o,"",t,s,r):QS(a[1],a[2],t,s,r),a};for(let o=1;o<e.length;o++){let s=Ct(e[o]);s!=null&&s.length>0&&n(s)}return t}var iw=["*","-","+","/","%"],nT=["==",">","<",">=","<=","===","!=","!==","||"],ow=/([(])|([)])|(===)|(==)|(!==)|(!=)|(!{1,2})|(\|\|)|(<=)|(>=)|(<)|(>)|(\+)|(-)|(\*)|(\/)|(\s+)|([0-9\.]+)|(\$data\[[0-9]+\])|(\$value\[[0-9]+\])|(\$key)|(\$value)|('[^']+')|([#a-zA-Z\$]+[0-9a-zA-Z_\$\.]*)/g,Xl="bool",iT="num",oT="group",sT="var",sw="op",WE="comp",aT="exp",lT="string",hT="array",cT="key",dT="value";function aw(i){return i[i.length-1]}function uT(i){return i.t===oT}function lw(i){return i.t===sT}function hw(i){return i.t===aT}function cw(i){return i.t===iT}function dw(i){return i.t===Xl}function uw(i){return i.t===lT}function pw(i){return i.t===hT}function mw(i){return i.t===cT}function gw(i){return i.t===dT}function Ew(i){let r=i.match(ow),e,t=[{t:"root",c:[],e:i,v:null}];for(let n=0;n<r.length;n++){e=r[n];let o=aw(t);if(e==="("){let s={t:oT,c:[],v:null};o.c.push(s),t.push(s)}else if(e===")")t.pop();else if(e.match(/\$value\[[0-9]+\]/)){let s=parseInt(e.substring(7,e.length-1),10);o.c.push({t:hT,v:e,index:s})}else if(e.match(/\$key/))o.c.push({t:cT,v:null});else if(e.match(/\$value/))o.c.push({t:dT,v:null});else if(e.match(/^#/))o.c.push({t:aT,v:e.substring(1)});else if(e.match(/'[a-zA-Z0-9#_\$\.]+'/))o.c.push({t:lT,v:e.replace(/'/g,"")});else if(e.match(/true/))o.c.push({t:Xl,v:!0});else if(e.match(/false/))o.c.push({t:Xl,v:!1});else if(e.match(/^[0-9\.]+$/)){let s=e.indexOf(".")!==-1?parseFloat(e):parseInt(e,10);o.c.push({t:iT,v:s})}else e.match(/[a-zA-Z_\$\.]+/)?o.c.push({t:sT,v:e}):iw.indexOf(e)!==-1?o.c.push({t:sw,v:e}):nT.indexOf(e)!==-1?o.c.push({t:WE,v:e}):e.match(/!{1,2}/)&&(e.length===1?(o.c.push({t:Xl,v:!1}),o.c.push({t:WE,v:"=="})):(o.c.push({t:Xl,v:!1}),o.c.push({t:WE,v:"!=="})))}return t[0]}function fw(i){let r=null,e={t:"root",c:[],v:""},t={t:"root",c:[],v:""},n=e.c;for(let a=0;a<i.c.length;a++)if(nT.indexOf(i.c[a].v)!==-1){if(r!=null)throw new Error("Cannot parse expression; more than one comparator.");r=i.c[a].v,n=t.c}else n.push(i.c[a]);let o=a=>(uT(a)&&(a.c=s(a)),a),s=a=>{let l=a.c;if(l.length===0)return[];let h=[],d=o(l[0]);if(l.length===1)return[d];if(l.length===3)return[d,l[1],o(l[2])];{let u=d,p=null,m;for(let g=1;g<l.length;g+=2)m=l[g],(m.v==="+"||m.v==="-"?1:2)===2?p==null?(p={t:"group",c:[u,m],v:null},h.push(p)):p.c.push(u,m):(p!=null?p.c.push(u):h.push(u),p=null,h.push(m)),u=o(l[g+1]);return p!=null?p.c.push(u):h.push(u),h}};return e.c=s(e),t.c=s(t),{left:e,right:t,comparator:r}}function jl(i){let r=Ew(i);return fw(r)}function Yi(i,r,e,t,n){let o=ZE(i.left.c,r,e,t,n);if(i.comparator==null)return o;{let s=ZE(i.right.c,r,e,t,n);if(i.comparator==="==")return o==s;if(i.comparator==="===")return o===s;if(i.comparator===">")return o>s;if(i.comparator===">=")return o>=s;if(i.comparator==="<")return o<s;if(i.comparator==="<=")return o<=s;if(i.comparator==="!=")return o!=s;if(i.comparator==="!==")return o!==s;if(i.comparator==="||")return o||s}}function ZE(i,r,e,t,n){let o=i.map(l=>uT(l)?ZE(l.c,r,e,t,n):lw(l)?r(l.v):hw(l)?e(l.v):pw(l)?r(Bo)[l.index]:mw(l)?r(zl):gw(l)?r(Bo):cw(l)||uw(l)||dw(l)?l.v:l),s=o[0],a;for(let l=1;l<o.length;l+=2){a=o[l].v;let h=o[l+1];a==="+"?s+=h:a==="-"?s-=h:a==="*"?s*=h:a==="/"&&(s/=h)}return typeof s=="undefined"?"":n!=null?n(s,t):s}var zi=class{constructor(r){this.instance=r;c(this,"tag");c(this,"remove");c(this,"uuid");c(this,"children",[]);c(this,"elements",[]);c(this,"bindings");c(this,"context");c(this,"compiledBindings");this.uuid=B(),r.entries[this.uuid]=this,this.compiledBindings={}}Ud(r){for(let e in r){let t=r[e];t.expressions.length>0&&(this.compiledBindings[e]={id:B(),name:e,expressions:t.expressions.map(([n,o,s])=>{let[a,l]=o==null?[null,null]:o.split(":");return{source:n,expression:jl(a),once:s,format:l}})})}}};var yu=class yu extends zi{constructor(e,t){super(t);c(this,"type","text");c(this,"value");this.value=e.value,this.bindings={};let n={id:B(),w:e.value,expressions:[]};e.value.replace(/\{\{([^\}]*)\}\}/g,function(o,s,a,l){let h=!1;return s.startsWith(":")&&(h=!0,s=s.substring(1)),n.expressions.push([o,s,h]),""}),this.Ud({[yu.TEXT_BINDING_NAME]:n})}};c(yu,"TEXT_BINDING_NAME","__element");var Xi=yu;var xu=class xu extends zi{constructor(e,t){super(t);c(this,"type",xu.type);c(this,"comment");this.comment=e}};c(xu,"type","comment");var ea=xu;var bu=class bu extends zi{constructor(e,t,n,o,s){super(t);this.templateResolver=n;this.stack=o;this.parseIdStack=s;c(this,"type",bu.type);c(this,"namespace");c(this,"atts");c(this,"custom");let a=e.el.split(":");this.tag=e.el,a.length===2&&(this.namespace=a[0]),this.atts=e.atts,this.Ud(e.bindings),this.remove=!1}};c(bu,"type",ci);var Yr=bu;var JE={},ui={construct:(i,r,e,t,n,o)=>{let s=JE[i];if(s)return new s(r,e,t,n,o);throw{message:"Recado: unknown element '"+i+"'"}},register:(i,r)=>{JE[i]=r},exists:i=>JE[i]!=null};var Su=class Su extends Yr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"key");c(this,"type",di);this.context=e.atts.in,this.key=e.atts.key,this.tag=Su.tag}};c(Su,"tag","r-each");var Au=Su;ui.register(Au.tag,Au);function KE(i,r,e){i.entryMap[r]=i.entryMap[r]||[],i.entryMap[r].push(e)}function pT(i,r,e,t){for(let n=0;n<r.children.length;n++){let o=r.children[n];KE(i,e,o)}Array.from(r.fragment.childNodes).forEach(n=>t.added.push({el:n})),i.placeholder.before(r.fragment)}var Tu=class{constructor(r,e,t){this.instance=r;this.tagName=e;this.options=t;c(this,"id");c(this,"template");c(this,"rendered");c(this,"updated");c(this,"fragments",{});c(this,"mounted");c(this,"defaultableFragmentKeys");c(this,"fragmentKeys");c(this,"parsedTemplates",{});c(this,"defaultNamespace");c(this,"decorator");this.id=`custom-${e}`;let n=t.fragments||{};this.defaultableFragmentKeys=t.defaultableFragmentKeys||[],this.template=t.template,this.defaultNamespace=t.defaultNamespace,this.decorator=t.decorator||((s,a)=>null);let o=new Set;for(let s in n){this.fragments[s]=this.fragments[s]||{},o.add(s);for(let a in n[s]){let l=`custom-${e}-${s}-${a}`,h=n[s][a];r.addTemplate(l,h),this.fragments[s][a]=r.parseAndCache(l,d=>{if(d===l)return h})}}this.fragmentKeys=Array.from(o),this.fragmentKeys.sort(),this.parsedTemplates[be]=this.zd(this.id),this.rendered=t.rendered||function(s,a,l){},this.updated=t.updated||function(s,a,l){},this.mounted=t.mounted}zd(r){return this.instance.parseAndCache(r,e=>{if(e===r)return this.template})}extractTemplateData(r,e){let t=r.split(":"),n=[];for(let o=0;o<t.length;o++){let s=e[t[o]];if(s==null)if(this.defaultableFragmentKeys.indexOf(t[o])!==-1)n.push(be);else return null;else n.push(s)}return n.join(":")}getAST(r){if(r==null)return this.parsedTemplates[be];{let e=[],t={};if(this.fragmentKeys.forEach(n=>{let o=this.extractTemplateData(n,r);o!=null&&(t[n]=this.fragments[n][o]||[],e.push(`${n}:${o}`))}),e.length>0){let n=e.join(" ");if(this.parsedTemplates[n]!=null)return this.parsedTemplates[n];{let o=this.zd(n);return this.Yd(o[0],t),this.parsedTemplates[n]=o,o}}return this.parsedTemplates[be]}}Yd(r,e){let t=[];for(let n=0;n<r.children.length;n++)if(r.children[n].tag==="r-fragment"){let o=e[r.children[n].atts.key]||[];t.push(...o)}else t.push(r.children[n]),this.Yd(r.children[n],e);r.children=t}};function mT(i,r,e,t){t?i.el.style[r]=e:i.el.setAttribute(r,e)}function yw(i,r){i.el.nodeValue=r}function xw(i,r){let e=[];for(let t=0;t<r.children.length;t++)e.push(...Hl(i,r.children[t]));return e}function Hl(i,r){let e=xw(i,r);return r.type===ci?(i.removeElement(r.el),e.unshift(r.el)):r.type===Ui?(i.removeTextNode(r.el),e.unshift(r.el)):r.type===di&&(r.entryMap={}),e}function gT(i,r,e,t){for(let n in i.bindings)if(n!==JS){let o=i.bindings[n],s=o.binding,a=o.originalValue,l=!1;for(let h=0;h<s.expressions.length;h++)if(!s.expressions[h].once){let d=Yi(s.expressions[h].expression,r,u=>e(u),s.expressions[h].format,t);a=a.replace(s.expressions[h].source,d),d!==o.results[h].result&&(l=!0,o.results[h].result=d)}l&&(i.type===ci?n!==KS?mT(i,n,a,!1):a.split(";").forEach(h=>{let d=h.indexOf(":"),u=h.substring(0,d);mT(i,u,h.substring(d+1),!0)}):i.type===Ui&&yw(i,a))}}function ET(){return{added:[],removed:[],elements:[]}}var Cu=class Cu extends Yr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"type","if");c(this,"tag",Cu.tag);c(this,"test");c(this,"expression");this.test=e.atts.test,this.expression=jl(this.test)}};c(Cu,"tag","r-if");var vu=Cu;ui.register(vu.tag,vu);function qE(i,r,e,t,n){return i.resolution=Yi(i.entry.expression,o=>we(r,o),o=>e(o),t,n),i.resolution}var Fo=class extends Yr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"templateId");c(this,"lookup");c(this,"default");if(this.context=e.atts[kS],this.type=$o,this.remove=!0,e.atts[jE])this.lookup=e.atts[jE],this.default=e.atts[WS]||"";else{this.templateId=e.atts.id;let a=tT(o);if(s.indexOf(this.templateId)!==-1){if(!a)throw new TypeError("recursive template call ["+this.templateId+"]")}else{let l=n(this.templateId);s.push(this.templateId);let h=this.instance.parse(l,n,null,s);for(let d=0;d<h.length;d++)h[d].context=this.context;this.children=h,s.pop()}}}};c(Fo,"tag","r-tmpl"),ui.register(Fo.tag,Fo);function fT(i,r){if(Array.isArray(i))for(let e=0;e<i.length;e++)r(i[e],e);else if(cr(i)){let e=i;for(let t in e)r(e[t],t)}}var Uo=class{constructor(r){c(this,"templateResolver");c(this,"defaultTemplate");c(this,"defaultNamespace");c(this,"macros");c(this,"entries");c(this,"customTags",{});c(this,"formatter");c(this,"Rt",new Map);c(this,"ss",new Map);c(this,"openRe",new RegExp("<([^/>]*?)>$|<([^/].*[^/])>$"));c(this,"closeRe",new RegExp("^</([^>]+)>"));c(this,"openCloseRe",new RegExp("<(.*)(/>$)"));c(this,"tokenizerRe",/(<[^\^>]+\/>)|(<!--[\s\S]*?-->)|(<[\/a-zA-Z0-9\-:]+(?:\s*[\(a-zA-Z\-\):]+=\"[^\"]*\"|\s*[a-zA-Z\-:]+='[^']+'|\s*[\(a-zA-Z\-\):]|\s*\{\{.*\}\}|\s*\{#.*\})*>)/);c(this,"commentRe",/<!--[\s\S]*?-->/);c(this,"attributesRe",/([\(a-zA-Z0-9\-_:\)]+="[^"]*")|\s+([\(a-zA-Z0-9\-_:\)]+(?=\s.|$))/);c(this,"as");c(this,"namespaceHandlers",{});c(this,"namespaces",{});r=r||{},this.as=r.templates||{},this.entries={},this.defaultTemplate=r.defaultTemplate,this.templateResolver=r.templateResolver||this.Xd(),this.macros=r.templateMacros||{},this.formatter=r.formatter,this.defaultNamespace=r.defaultNamespace}resolveTemplate(r){return this.as[r]!=null?this.as[r]:this.templateResolver(r)}setAttribute(r,e,t){let n=e.split(":");n.length===1?r.setAttribute(n[0],t):this.namespaces[n[0]]==null?r.setAttribute(e,t):r.setAttributeNS(this.namespaces[n[0]],n[1],t)}clearCache(){this.Rt.clear(),this.ss.clear()}parseAttributes(r){return HE(r,this.attributesRe)}jd(r,e){return t=>{let n=e?null:this.Rt.get(t);return n==null&&(n=r(t)),n==null&&(n=this.defaultTemplate),n!=null&&this.Rt.set(t,n),n}}addTemplate(r,e){this.as[r]=e}template(r,e,t,n,o){e=e||{};let s=n?null:this.ss.get(r);if(s!=null)return this.render(s,e,t,o).fragment;{let a=this.parseAndCache(r,t,n);return a!=null?this.render(a,e,t,o).fragment:this.cf()}}mounted(r){r.$recado.mountings.forEach(e=>{e.mount(e.el,e.data,this,e.parent,e.context)})}parseAndCache(r,e,t){let n=this.ss.get(r);if(n==null||t===!0){e=this.jd(e||(s=>this.resolveTemplate(s)),t);let o=e(r);if(o!=null){let s=yT(this,o,e,null,[r]);return this.ss.set(r,s),s}}else return n}data(r,e,t){return we(r,e,t)}each(r,e,t,n,o){let s;if(Array.isArray(r))for(s=0;s<r.length;s++)e(r[s],t,s,n,o);else for(s in r)r.hasOwnProperty(s)&&e({$key:s,$value:r[s]},t,s,n,o)}lookupValueInDataOrContext(r,e,t){return t.indexOf("$context.")===0?we(e,t.substring(9)):we(r,t)}update(r,e,t){let n=r.$recado,o=ET();return t=t||{},n!=null&&this.Rn(n,e,o,t),o}onUpdate(r,e){r.$recado!=null&&(r.$recado.updaters=r.$recado.updaters||[],r.$recado.updaters.push(e))}Rn(r,e,t,n,o){if(r.type===ZS)for(let s=0;s<r.children.length;s++)this.Rn(r.children[s],e,t,n,o);else if(r.type===ci||r.type===Ui){let s=e,a=this.customTags[r.entry.tag];a!=null&&(s=Object.assign({},e),Object.assign(s,a.decorator(e,n)||{})),gT(r,l=>this.lookupValueInDataOrContext(s,n,l),l=>this.wi(l,s,n),this.formatter),a!=null&&a.updated&&a.updated(r.el,s,this);for(let l=0;l<r.children.length;l++)this.Rn(r.children[l],s,t,n,o)}else if(r.type===Yl){let s=r,a=s.resolution,l=qE(s,e,h=>this.wi(h,e,n),null,this.formatter);if(!l){for(let h=0;h<r.children.length;h++)Hl(this,r.children[h]).map(d=>t.removed.push({el:d}));r.children.length=0}if(l)if(a)for(let h=0;h<r.children.length;h++)this.Rn(r.children[h],e,t,n,s.defaultNamespace||o);else{let h=this.render(r.entry.children,e,this.templateResolver,n,s.defaultNamespace||o);r.children=h.children;for(let d=0;d<r.children.length;d++){let u=r.children[d];s.placeholder.before(u.el),t.added.push({el:u.el})}}}else if(r.type===$o){let s=r.entry.context==null||r.entry.context.length===0?e:this.lookupValueInDataOrContext(e,n,r.entry.context);for(let a=0;a<r.children.length;a++)this.Rn(r.children[a],s,t,n)}else if(r.type===di){let s=r,a=this.lookupValueInDataOrContext(e,n,r.entry.context);if(a==null)Hl(this,r).map(l=>t.removed.push({el:l}));else if(s.entry.key==null||s.entry.key.length===0)U("WARN: Cannot update r-each entry when no `key` parameter was set.");else{let l={},h=[],d=[];fT(a,(u,p)=>{let m=we(u,s.entry.key);if(l[m]=u,s.entryMap[m]!=null){let g=s.entryMap[m];for(let E=0;E<g.length;E++)h.push({data:u,key:m,execution:g[E]})}else h.push({data:u,key:m})});for(let u in s.entryMap)if(l[u]==null)for(let p=0;p<s.entryMap[u].length;p++)d.push({e:s.entryMap[u][p],key:u});for(let u=0;u<d.length;u++)delete s.entryMap[d[u].key],Hl(this,d[u].e).map(p=>t.removed.push({el:p}));for(let u=0;u<h.length;u++){let p=h[u];if(p.execution)this.Rn(p.execution,p.data,t,n),p.execution.el!=null?s.placeholder.before(p.execution.el):p.execution.children.forEach(m=>{m.el!=null&&s.placeholder.before(m.el)});else{let m=this.render(r.entry.children,p.data,null,n);pT(s,m,p.key,t)}}}}if(r.updaters)for(let s=0;s<r.updaters.length;s++)r.updaters[s](r.el);return t}remove(r,e){e&&r.parentNode&&r.parentNode.removeChild(r)}registerTag(r,e){this.customTags[r]=new Tu(this,r,e)}parse(r,e,t,n){return yT(this,r,e,t,n)}wi(r,e,t){return this.macros[r]&&this.macros[r](e,t)||""}render(r,e,t,n,o){let s={id:B(),fragment:this.cf(),children:[],type:"root",bindings:{},entry:null,mountings:[]},a=s.fragment,l=null,h=s;a.$recado=s,n=n||{};let d=(f,b,A)=>{let T={id:b,entry:f,placeholder:this.cc(`${di}:${b}`),entryMap:{},type:di,children:[]};return E(T.placeholder,A),h.children.push(T),T},u=(f,b,A)=>{let T={placeholder:this.cc(`${$o}:${b}`),entry:f,id:b,children:[],type:$o};return E(T.placeholder,A),h.children.push(T),T},p=(f,b,A,T)=>{y(f,T);let S={id:B(),entry:b,bindings:A,children:[],el:f,type:ci};return h.children.push(S),f.$recado=S,S},m=(f,b,A,T)=>{y(f,T);let S={id:B(),el:f,entry:b,bindings:A,children:[],type:Ui};return h.children.push(S),f.$recado=S,S},g=(f,b,A)=>{let T=B(),S={id:T,entry:f,resolution:!1,placeholder:this.cc(`${Yl}:${T}`),type:Yl,children:[],defaultNamespace:A};return E(S.placeholder,b),h.children.push(S),S},E=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},y=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},x=(f,b,A,T)=>{b=b||{};let S=!1,R=null;if(f.type===Yl){let v=h,O=g(f,A,o);if(h=O,S=qE(O,b,P=>this.wi(P,b,n),null,this.formatter),S)for(let P=0;P<f.children.length;P++)x(f.children[P],b,O.placeholder,T);h=v,R=O}else if(f.type===di){let v=f,O=l,P=f.context===Bo?b:this.lookupValueInDataOrContext(b,n,f.context),I=h,C=B(),_=d(v,C,A);h=_,P!=null&&fT(P,(w,$)=>{let N=v.key&&cr(w)?we(w,v.key):$||null;for(let M=0;M<f.children.length;M++){let D=x(f.children[M],w,_.placeholder,$);N!=null&&KE(_,N,D)}}),l=O,h=I,R=_}else if(f.type===$o){let v=f,O=l,P=h,I=B(),C=u(v,I,A);h=C;let _=f.context==null||f.context.length===0?b:we(b,f.context),w=v.lookup!=null?we(b,v.lookup.replace(/[\{\{\}\}]/g,"")):v.templateId,$=this.parseAndCache(w,t);$==null&&v.default!=null&&($=this.parseAndCache(v.default,t));for(let N=0;N<$.length;N++)x($[N],_,C.placeholder,T);l=O,h=P,R=C}else if(f.type===ci){let v,O=f,P,I={},C=[];if(this.customTags[f.tag]!=null){P=this.customTags[f.tag];let N=Object.assign({},b);Object.assign(N,P.decorator(b,n)||{});let M=this.render(P.getAST(N),N,t,n,P.defaultNamespace);v=M.fragment.childNodes[0];let D=M.children[0].bindings;for(let V in D)I[V]=D[V];C.push(...M.children[0].children)}else if(O.namespace!=null&&this.namespaceHandlers[O.namespace])v=this.namespaceHandlers[O.namespace](f.tag);else{let N=o||this.defaultNamespace;N!=null&&this.namespaceHandlers[N]?v=this.namespaceHandlers[N](`${N}:${f.tag}`):v=this.ce(f.tag)}for(let N in O.atts)if(O.atts.hasOwnProperty(N)){let M=O.atts[N];if(f.compiledBindings[N]!=null){let D=f.compiledBindings[N];I[N]={id:D.id,binding:D,results:[],originalValue:M,type:qS};for(let V=0;V<D.expressions.length;V++){let J=D.expressions[V],fe=Yi(J.expression,X=>X===zl?T:X===Bo?b:this.lookupValueInDataOrContext(b,n,X),X=>this.wi(X,b,n),J.format,this.formatter);M=M.replace(J.source,fe),I[N].results.push({source:J.source,result:fe})}}this.setAttribute(v,N,M)}P&&(P.rendered&&P.rendered(v,b,this,l,n),P.mounted&&s.mountings.push({mount:P.mounted,el:v,data:b,parent:l,context:n}));let _=l,w=h,$=p(v,O,I,A);$.children.push(...C),h=$,l=v;for(let N=0;N<f.children.length;N++)x(f.children[N],b,null,T);h=w,l=_,R=$}else if(f.type===Ui){let v=f.value||"",O={},P=f.compiledBindings[Xi.TEXT_BINDING_NAME];if(P!=null){O[Xi.TEXT_BINDING_NAME]={id:P.id,binding:P,results:[],originalValue:v,type:Ui};for(let _=0;_<P.expressions.length;_++){let w=P.expressions[_],$=Yi(w.expression,N=>N===zl?T:N===Bo?b:this.lookupValueInDataOrContext(b,n,N),N=>this.wi(N,b,n),w.format,this.formatter);v=v.replace(w.source,$),O[Xi.TEXT_BINDING_NAME].results.push({source:w.source,result:$})}}let I=this.ctn(v);R=m(I,f,O,A)}return R};for(let f=0;f<r.length;f++)x(r[f],e||{},null,null),l=null,h=s;return s}};function bw(i){return ui.exists(i)}function Aw(i,r,e,t,n,o){return ui.construct(r,e,i,t,n,o)}function yT(i,r,e,t,n){n=n||[],e=i.jd(e||(E=>i.resolveTemplate(E)),null);let o=[],s=[],a=(E,y)=>{let x=E.match(y);return x==null?null:x},l=()=>o.length>0?o[o.length-1]:null,h=E=>{let y=l();return y!=null&&y.tag===E},d=(E,y)=>{o.length>0&&l().children.push(E),y?o.length===0&&s.push(E):o.push(E)},u=E=>{d(E,!0)},p=()=>{let E=o.pop();if(o.length===0&&!E.remove)s.push(E);else if(E.remove){let y=l();y&&y.children.pop()}return E},m=(E,y,x,f)=>{let b=rT(E,i);return bw(b.el)?Aw(i,b.el,b,x,o,n):new Yr(b,i,x,o,n)},g=[{re:i.commentRe,handler:(E,y,x,f,b)=>{d(new ea(E,f),!0)}},{re:i.openRe,handler:(E,y,x,f,b)=>{let A=m(E,y,x,b);d(A,A.remove)}},{re:i.closeRe,handler:(E,y,x,f,b)=>{if(y[1]!==Fo.tag)if(h(y[1]))p();else throw new TypeError("Unbalanced closing tag '"+y[1]+"'; opening tag was '"+p().tag+"'")}},{re:i.openCloseRe,handler:(E,y,x,f,b)=>{let A=m(E,y,x,b);d(A,!0)}},{re:/.*/,handler:(E,y,x,f,b)=>{let A=new Xi({value:E},f);u(A),E.match(/^[\s]*$/)!=null||kE(Xi.TEXT_BINDING_NAME,E,A,null,f)}}];if(Zb(Ct(r).split(i.tokenizerRe),(E,y)=>{let x=Ct(y);for(let f=0;f<g.length;f++){let b=a(x,g[f].re);if(b){g[f].handler(y,b,e,i,n);break}}}),s.length>0&&t)for(let E in t)s[0][E]=t[E];return s}function xT(i,r){let e=typeof i=="string"?parseFloat(i):i;if(isNaN(e))return i;let t=/^(['|,])?(\.(\d+))?([df])$/,n=r.match(t);if(!n)return e.toString();let o=n[1],s=n[3]?parseInt(n[3],10):null,a=n[4],l;a==="d"?l=Math.floor(e).toString():l=s!==null?e.toFixed(s):e.toString();let h=l.split("."),d="";return o===","?d=",":o==="'"?d=" ":d=1e3.toLocaleString().substring(1,2),h[0]=h[0].replace(/\B(?=(\d{3})+(?!\d))/g,d),h.join(".")}var kl=class{constructor(){c(this,"childNodes");this.childNodes=[]}removeChild(r){this.childNodes=this.childNodes.filter(e=>e!==r)}appendChild(r){this.childNodes.push(r)}insertAfter(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t,0,e)}insertBefore(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t-1,0,e)}toString(){let r="";for(let e=0;e<this.childNodes.length;e++)r+=this.childNodes[e].toString();return r}},Pu=class extends kl{constructor(e){super();c(this,"nodeType",1);c(this,"parentElement");c(this,"tag");c(this,"atts");c(this,"style",{});this.tag=e,this.atts={}}getAttribute(e){return this.atts[e]}setAttributeNS(e,t,n){this.atts[e+":"+t]=n}setAttribute(e,t){this.atts[e]=t}toString(){let e="<"+this.tag,t="";for(let n in this.atts)t+=" "+n+'="'+this.atts[n]+'"';e=e+t+">";for(let n=0;n<this.childNodes.length;n++)e+=this.childNodes[n].toString();return e+"</"+this.tag+">"}after(e){this.parentElement.insertAfter(this,e)}before(e){this.parentElement.insertBefore(this,e)}},Ou=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",3)}toString(){return this.nodeValue}after(r){this.parentElement.insertAfter(this,r)}},_u=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",8)}before(r){this.parentElement.insertBefore(this,r)}};var QE=class extends Uo{Xd(){return null}ce(r){return new Pu(r)}cf(){return new kl}ctn(r){return new Ou(r)}cc(r){return new _u(r)}removeElement(r){}removeTextNode(r){}};function Ru(i){let r={};for(let e=0;e<i.length;e++)r[i[e].id]=i[e];return r}function ef(i,r){let e=r===0?"x":"y";return i.target[e]<i.source[e]?-1:1}function bT(i,r,e){let t=e===0?"x":"y";return i.source[t]>r.source[t]&&i.source[t]<r.target[t]||r.source[t]>i.source[t]&&r.source[t]<i.target[t]||i.target[t]>r.target[t]&&i.target[t]<r.source[t]||r.target[t]>i.target[t]&&r.target[t]<i.source[t]}function Lu(i,r,e,t,n){let o=i,s=r;for(let a=0;a<o.length;a++){let l=o[a];l.sourcePosition=t(l.sourceId),l.sourceSize=n(l.sourceId),l.targetPosition=t(l.targetId),l.targetSize=n(l.targetId),l.sourceCenter={x:l.sourcePosition.x+l.sourceSize.width/2,y:l.sourcePosition.y+l.sourceSize.height/2},l.targetCenter={x:l.targetPosition.x+l.targetSize.width/2,y:l.targetPosition.y+l.targetSize.height/2};for(let h=0;h<l.path.length;h++){let d=e[l.path[h]],u=h<l.path.length-1?e[l.path[h+1]]:null;d.edges=d.edges||[],d.edges.push({edge:l,next:u})}}for(let a=0;a<s.length;a++)if(s[a].edges){let l=s[a];l.edges.sort((u,p)=>{let m=u.edge.pathDirection,g=p.edge.pathDirection,E=u.edge.path.indexOf(l.id),y=p.edge.path.indexOf(l.id),x=m===1?E+1:E-1,f=g===1?y+1:y-1,b=x>=0&&x<u.edge.path.length?e[u.edge.path[x]]:null,A=f>=0&&f<p.edge.path.length?e[p.edge.path[f]]:null,T=m===1?E-1:E+1,S=g===1?y-1:y+1,R=T>=0&&T<u.edge.path.length?e[u.edge.path[T]]:null,v=S>=0&&S<p.edge.path.length?e[p.edge.path[S]]:null,O=l.axis===0?Q:ye,P=b?b.midpoint[O]:R?R.midpoint[O]:p.edge.sourceCenter[O]!==u.edge.sourceCenter[O]?u.edge.sourceCenter[O]:u.edge.targetCenter[O],I=b?A.midpoint[O]:v?v.midpoint[O]:u.edge.sourceCenter[O]!==p.edge.sourceCenter[O]?p.edge.sourceCenter[O]:p.edge.targetCenter[O];return P-I});let h=s[a].length/(s[a].edges.length+1),d=h;for(let u=0;u<s[a].edges.length;u++)s[a].edges[u].location=d,d+=h}}function wu(i,r,e){for(let t=0;t<i.length;t++){let n=i[t];n.regionPath=n.regionPath||[];for(let o=0;o<n.path.length;o++){let s=e[n.path[o]],a=s.edges.find(d=>d.edge.id===n.id),l=a.edge.pathDirection;if(!(a.edge.pathDirection===1&&s.b.type==="vertex"||a.edge.pathDirection===-1&&s.a.type==="vertex")){let d=a.next.edges.find(A=>A.edge.id===n.id),u=r.find(A=>A.id===(l===1?s.b.id:s.a.id)),p=s.axis===0?l===1?0:u.height:l===1?0:u.width,m=s.axis===0?l===1?u.height:0:l===1?u.width:0,g=s.segment.point1-(s.axis===0?u.left:u.top),E=a.next.segment.point1-(s.axis===0?u.left:u.top),y=s.axis===0?"x":"y",x=s.axis===0?"y":"x",f={[y]:a.location+g,[x]:p},b={[y]:d.location+E,[x]:m};u.lines.push({source:f,target:b,id:n.id}),n.regionPath.push(u)}}}}var Du="separate",SJ="bus";function AT(i){let r=i.axis,e=i.gates,t=i.gateMap||Ru(e),n=i.mode||Du,o=i.regions,s=i.edges,a=i.pad||10,l={};Lu(s,e,t,i.getVertexPosition,i.getVertexSize),wu(s,o,t);for(let h=0;h<o.length;h++){o[h].edgeMap={};let d=[],u=o[h].lines;for(let x=0;x<u.length;x++){let f=[];for(let b=0;b<d.length;b++)e:for(let A=0;A<d[b].length;A++)if(bT(u[x],d[b][A],r)){f.push(b);break e}if(f.length===0)d.push([u[x]]);else{let b=[u[x]],A=[];for(let T=0;T<d.length;T++)f.indexOf(T)!==-1?b=b.concat(d[T]):A.push(d[T]);A.push(b),d=A}}for(let x=0;x<d.length;x++)d[x].sort((f,b)=>{let A=ef(f,r),T=ef(b,r),S=r==0?"x":"y";return A===T?A<0?f.source[S]-b.source[S]:b.source[S]-f.source[S]:f.source[S]-b.source[S]});o[h].lineSets=d;let p=r===0?o[h].height:o[h].width,m=r===0?o[h].left:o[h].top,g=r===0?o[h].top:o[h].left,E=r===0?"x":"y",y=r===1?"x":"y";if(n===Du)for(let x=0;x<d.length;x++){let f=(p-a)/(d[x].length+1),b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];l[T.id]=l[T.id]||[],o[h].edgeMap[T.id]=[{[E]:T.source[E]+m,[y]:T.source[y]+g},{[E]:T.source[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:T.target[y]+g}],b+=f}}else for(let x=0;x<d.length;x++){let f=(p-a)/2,b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];o[h].edgeMap[T.id]=[{[E]:T.source[E]+m,[y]:T.source[y]+g},{[E]:T.source[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:T.target[y]+g}]}}}for(let h=0;h<s.length;h++){let d=s[h];l[d.id]=[],d.regionPath.forEach(p=>{let m=p.edgeMap[d.id];l[d.id].push(...m)})}return l}function ST(i){let r=i.gates,e=Ru(r),t=i.regions,n=i.edges,o={};Lu(n,r,e,i.getVertexPosition,i.getVertexSize),wu(n,t,e);for(let s=0;s<t.length;s++){t[s].edgeMap={};let a=t[s].lines;for(let l=0;l<a.length;l++){let h=a[l];t[s].edgeMap[h.id]=[{x:h.source.x+t[s].left,y:h.source.y+t[s].top},{x:h.target.x+t[s].left,y:h.target.y+t[s].top}]}}for(let s=0;s<n.length;s++){let a=n[s];o[a.id]=[],a.regionPath.forEach(h=>{let d=h.edgeMap[a.id];o[a.id].push(...d)})}return o}var TT=4;function vT(i){return{x:Math.ceil(i.x+i.width/2),y:Math.ceil(i.y+i.height/2)}}var ta={sortRect:i=>{let r,e=1/0,t=-1/0;i.forEach(s=>{r=vT(s),t=Math.max(t,r.x,r.y),e=Math.min(e,r.x,r.y)});let n=t-e;return i.sort(s=>(r=vT(s),ta.toHilbertCoordinates(n,r.x-e,r.y-e)))},toHilbertCoordinates:(i,r,e)=>{let t=i,n=(1<<t)-1,o=0,s=r^e,a=~r&n,l=~e&n,h=a^e,d=0,u=0;for(let p=1;p<t;p++)u=(u&s|(d^l)&h)>>1,d=(d&(u^a)|~d&(u^l))>>1;return o=~d&(u^r)|d&(u^l),ta.hilbertInterleaveBits(o,s)},hilbertInterleaveBits:(i,r)=>{let e=0,t=Math.max(i,r),n=0;for(;t>0;)n++,t>>=1;for(let o=0;o<n;o++){let s=1<<o,a=(r&s)>0?1<<2*o:0,l=(i&s)>0?1<<2*o+1:0;e+=a+l}return e}};function CT(i){return i.height*i.width}function tf(i,r){i.x===1/0?(i.height=r.height,i.width=r.width,i.x=r.x,i.y=r.y):(i.height=Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y),i.width=Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x),i.x=Math.min(i.x,r.x),i.y=Math.min(i.y,r.y))}function rf(i){i.x=Math.min(...i.children.map(r=>r.x)),i.y=Math.min(...i.children.map(r=>r.y)),i.width=Math.max(...i.children.map(r=>r.x+r.width))-i.x,i.height=Math.max(...i.children.map(r=>r.y+r.height))-i.y,i.parent!=null&&rf(i.parent)}function PT(i,r){return i.x===1/0?CT(r):(Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y))*(Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x))-CT(i)}function nf(i){let r=Math.floor(i.children.length/2),e=Yo(),t=Yo();return ta.sortRect(i.children).forEach((n,o)=>{o<=r?zo(e,n):zo(t,n)}),i.children.length=0,[e,t]}function Yo(i){return{x:1/0,y:1/0,width:0,height:0,children:[],parent:null,id:i,data:null}}function Nu(i){return i.children==null||i.children.length===0}function OT(i){return Nu(i)||Nu(i.children[0])}function zo(i,r){r.parent=i,i.children.push(r),tf(i,r)}function of(i,r){let e=i.children.indexOf(r);return e>=0?(i.children.splice(e,1),!0):!1}function Sw(i){return i.reduce(function(r,e){return Array.isArray(e)?r.concat(Sw(e)):r.concat(e)},[])}function _T(i,r){let e=i.map(r);return i[e.indexOf(Math.min.apply(null,e))]}function RT(i){i.parent&&(of(i.parent,i),rf(i.parent))}var ra=class{constructor(r){c(this,"nr");c(this,"ie");c(this,"jr",{});this.nr=r||TT,this.ie=Yo()}search(r,e){let t=[];return this.Hd(r,(n,o)=>t.push(n),e),t}searchAndRank(r,e){let t=[];return this.Hd(r,(n,o)=>t.push({node:n,overlap:sE(n,r)}),e),t.sort((n,o)=>n.overlap<o.overlap?-1:1),t}Hd(r,e,t){if(this.ie.children.length===0)return;t=t||{};let n=Object.assign({},r);t.margin&&(n.x-=t.margin,n.y-=t.margin,n.width+=2*t.margin,n.height+=2*t.margin);let o=s=>{if(tt(s,n))for(let a=0;a<s.children.length;a++){let l=s.children[a];if(tt(l,n))if(l.id!=null){if(t.minimumOverlap!=null&&sE(l,n)<t.minimumOverlap)continue;if(e(l,n),t.greedy)return}else o(l)}};o(this.ie)}findIntersectionsWithLine(r,e){let t=[];e=e||[];let n=o=>{$b(r,o)&&(Nu(o)?e.indexOf(o.id)===-1&&t.push(o):o.children.forEach(n))};return n(this.ie),t}insert(r){let e=n=>{let o=this.ie;if(o){let s={x:n.x,y:n.y,width:n.width,height:n.height,data:n.data,children:[],id:n.id};for(n.id&&(this.jr[n.id]=s);!OT(o);)tf(o,s),o=_T(o.children,a=>PT(a,s));zo(o,s),this.FE(s)}},t=Array.isArray(r)?r:[r];for(let n=0;n<t.length;n++)e(t[n])}FE(r){let e=r;for(;e.parent&&e.parent.children.length>this.nr;)e=e.parent,e!=this.ie?(of(e.parent,e),nf(e).forEach(t=>{zo(e.parent,t)})):e==this.ie&&nf(e).forEach(t=>{zo(e,t)})}kd(r,e){e===void 0&&(e=1);let t=Math.ceil(r.length/this.nr),n=[],o=0,s;for(let a=0;a<t;a++){s=Yo(),o=Math.min(this.nr,r.length);for(let l=0;l<o;l++){let h=r.pop();h.id&&(this.jr[h.id]=h),zo(s,h)}n.push(s)}return t>1?this.kd(n,e+1):n}load(r){if(r!=null&&r.length>0){let e=ta.sortRect(r);this.ie=this.kd(e)[0]||Yo()}}getBounds(){return{x:this.ie.x,y:this.ie.y,width:this.ie.width,height:this.ie.height}}getExtents(){return{xmin:this.ie.x,ymin:this.ie.y,xmax:this.ie.x+this.ie.width,ymax:this.ie.y+this.ie.height}}removeById(r){let e=this.searchById(r);return e&&e.parent&&this.Wd(e),e}Wd(r,e){let t=[],n=r.parent;for(RT(r),r.id!=null&&delete this.jr[r.id];n!=null&&n!==this.ie;)n.children.length<=this.nr/2&&(RT(n),t.push(...this.UE(n))),n=n.parent;e&&t.push(...e),this.insert(t)}searchById(r){return r==null?null:this.jr[r]}update(r,e,t,n,o,s){let a=this.searchById(r);a?this.Wd(a,[{x:e,y:t,width:n,height:o,data:s||a.data,children:[],id:r}]):this.insert({id:r,x:e,y:t,width:n,height:o,data:s,children:[]})}clear(){this.ie=Yo(),this.jr={}}getLeafNodes(){return Object.values(this.jr)}has(r){return this.jr.hasOwnProperty(r)}UE(r){let e=[],t=n=>{n.id!=null?e.push(n):n.children.forEach(t)};return t(r),e}};var Iu=class i{constructor(r){this.instance=r;c(this,"ue",[]);c(this,"ee",[]);c(this,"te",[])}static from(r){let e=new i(r.instance);return e.ue=r.ue.slice(),e.ee=r.ee.slice(),e.te=r.te.slice(),e}paste(r,e){let t=e&&e.origin,n=e&&e.hermetic===!0,o=e&&e.shallow===!0,s=this.zE(r,t,n,o);return this.instance.transaction(()=>{s.groups.forEach(a=>this.instance.addGroup(a)),s.nodes.forEach(a=>this.instance.addNode(a)),s.edges.forEach(a=>this.instance.$_addEdge(a,sA,null))}),s}zE(r,e,t,n){let o={nodes:[],groups:[],edges:[],vertexMap:new Map,edgeMap:new Map,origin:{x:0,y:0},transform:{x:0,y:0}},s=[],a=this.instance.modelLeftAttribute,l=this.instance.modelTopAttribute,h=1/0,d=1/0,u=new Map;function p(g){let E=r.getCoordinates(g,!0);u.set(g.id,E),g.group==null&&(h=Math.min(h,E.x),d=Math.min(d,E.y))}this.ee.forEach(p),this.ue.forEach(p),o.origin.x=h,o.origin.y=d,o.transform.x=e!=null?e.x-o.origin.x:0,o.transform.y=e!=null?e.y-o.origin.y:0;let m=(g,E,y)=>{y=y||0;let x=Object.assign({},g.data),f=B();if(o.vertexMap.set(g.getFullId(),f),x.id=f,E==null){let b=u.get(g.getFullId());x[a]=b.x+o.transform.x,x[l]=b.y+o.transform.y,x[this.instance.groupProperty]!=null&&delete x[this.instance.groupProperty]}else x[this.instance.groupProperty]=E.id;return!n&&Y(g)&&g.getMembers().forEach(b=>{let A=m(b,x,y+1);Y(b)?s.push(A):o.nodes.push(A[0])}),[x,y]};return this.ue.forEach(g=>o.nodes.push(m(g,null,0)[0])),this.ee.forEach(g=>s.push(m(g,null,0))),s.sort((g,E)=>g[1]<E[1]?-1:1),o.groups=s.map(g=>g[0]),this.te.forEach(g=>{let E,y,x=g.source,f=H(x)?x.getParent():x,b=o.vertexMap.get(f.id),A=g.target,T=H(A)?A.getParent():A,S=o.vertexMap.get(T.id);if(b==null){if(t)return;E=f.id}else E=b;if(S==null){if(t)return;y=T.id}else y=S;let R={source:E,target:y,data:Object.assign({},g.data||{})};if(R.data.id!=null){let v=B();o.edgeMap.set(R.data.id,v),R.data.id=v}g.geometry!=null&&S!=null&&b!=null&&(R.geometry=r.transformGeometry(g,o.transform.x,o.transform.y)),o.edges.push(R)}),o}};var Mu=class{constructor(r){this.instance=r;c(this,"stack",[])}copy(r){let e=this.instance.select(r);this.stack.push(Iu.from(e))}paste(r){let t=r&&r.clear===!0?this.stack.pop():this.stack[this.stack.length-1];return t!=null?t.paste(this.$getCopyDataTransformer(),r):null}clear(){this.stack.length=0}copyCurrentSelection(){this.copy(this.instance.getSelection())}pasteCurrentSelection(r){return this.copyCurrentSelection(),this.paste(r)}};var sf="Anchor",Ot="top",_t="left",Rt="right",Lt="bottom",af={[Ot]:{x:0,y:-1},[Lt]:{x:0,y:1},[Rt]:{x:1,y:0},[_t]:{x:-1,y:0}},F9=[_t,Rt],U9=[Ot,Lt],Y9={[Ot]:[_t,Rt],[Lt]:[_t,Rt],[_t]:[Lt,Ot],[Rt]:[Lt,Ot]},z9={[Ot]:Lt,[Lt]:Ot,[_t]:Rt,[Rt]:_t},Tw=(s=>(s.Circle="Circle",s.Ellipse="Ellipse",s.Triangle="Triangle",s.Diamond="Diamond",s.Rectangle="Rectangle",s.Square="Square",s))(Tw||{}),Wl=(f=>(f.Assign="Assign",f.AutoDefault="AutoDefault",f.Bottom="Bottom",f.BottomLeft="BottomLeft",f.BottomRight="BottomRight",f.Center="Center",f.Continuous="Continuous",f.ContinuousBottom="ContinuousBottom",f.ContinuousLeft="ContinuousLeft",f.ContinuousRight="ContinuousRight",f.ContinuousTop="ContinuousTop",f.ContinuousLeftRight="ContinuousLeftRight",f.ContinuousTopBottom="ContinuousTopBottom",f.Left="Left",f.Right="Right",f.Top="Top",f.TopLeft="TopLeft",f.TopRight="TopRight",f))(Wl||{});var ln={};function na(i,r){ln[i]=r}var mr={lineIntersection(i,r,e,t,n){return ln[i.type].lineIntersection(i,r,e,t,n)},boxIntersection(i,r,e,t,n){return ln[i.type].boxIntersection(i,r,e,t,n)},boundingBoxIntersection(i,r){return ln[i.type].boundingBoxIntersection(i,r)},pointOnPath(i,r,e){return ln[i.type].pointOnPath(i,r,e)},gradientAtPoint(i,r,e){return ln[i.type].gradientAtPoint(i,r,e)},pointAlongPathFrom(i,r,e,t){return ln[i.type].pointAlongPathFrom(i,r,e,t)},findClosestPointOnPath(i,r,e){return ln[i.type].findClosestPointOnPath(i,r,e)},getPath(i,r){return ln[i.type].getPath(i,r)}};function lf(i){return ln[i.type].getLength(i)}function LT(i,r){return ln[i].create(r)}function vw(){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}function wT(i,r,e){return vw()}function DT(i,r,e,t,n){return[]}function Zl(i,r,e,t,n){let o=[];return o.push.apply(o,mr.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,mr.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,mr.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,mr.lineIntersection(i,r,e+n,r,e)),o}function NT(i,r){return Zl(i,r.x,r.y,r.width,r.height)}function ia(i){return Object.assign({extents:Di()},i)}function Cw(){return{sx:0,sy:0,tx:0,ty:0,so:{x:0,y:0},to:{x:0,y:0},x:0,y:0,w:0,h:0,quadrant:1,startStubX:0,startStubY:0,endStubX:0,endStubY:0,isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1,opposite:!1,perpendicular:!1,orthogonal:!1,sourceAxis:Q,stubs:[0,0]}}function oa(i,r,e){return{x:i.x,y:i.y,ox:i.ox,oy:i.oy,curX:i.curX+r,curY:i.curY+e}}function Vu(i,r,e,t){let n=e.gap||0,o=e.stub||t,s=Array.isArray(o)?o[0]:o,a=Array.isArray(o)?o[1]:o;return{type:i,internalSegments:[],segmentProportionalLengths:[],segmentProportions:[],totalLength:0,cssClass:e.cssClass||"",hoverClass:e.hoverClass||"",gap:n,stub:o,sourceStub:s,targetStub:a,sourceGap:Array.isArray(n)?n[0]:n,targetGap:Array.isArray(n)?n[1]:n,typeDescriptor:"connector",geometry:null,idPrefix:"_vjs_connector",bounds:Di(),x:0,y:0,width:0,height:0,edited:!1,strokeWidth:1,typeId:null,quadrant:0,paintInfo:Cw()}}function hf(i,r,e){let t=e===0?r.anchors.source:r.anchors.target;t.isFixed=!0,t.fixedLocation=Object.assign({},i,{offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY})}var IT=.45,Pw=62;function Gu(i,r,e){let t=Vu(i,r,e,[0,0]);return Object.assign(t,{curviness:e.curviness||10,gap:e.gap||5,proximityLimit:e.proximityLimit||80,clockwise:e.orientation&&e.orientation==="clockwise",loopbackDistance:e.loopbackDistance||Pw,isLoopbackCurrently:!1,constrain:nn,smooth:!0})}var Ln={subtract:(i,r)=>({x:i.x-r.x,y:i.y-r.y}),dotProduct:(i,r)=>i.x*r.x+i.y*r.y,square:i=>Math.sqrt(i.x*i.x+i.y*i.y),scale:(i,r)=>({x:i.x*r,y:i.y*r})},MT=64,Ow=Math.pow(2,-MT-1);function _w(i,r){let e=[],t=Rw(i,r),n=r.length-1,o=2*n-1,s=cf(t,o,e,0),a=Ln.subtract(i,r[0]),l=Ln.square(a),h=0,d;for(let u=0;u<s;u++)a=Ln.subtract(i,df(r,n,e[u],null,null)),d=Ln.square(a),d<l&&(l=d,h=e[u]);return a=Ln.subtract(i,r[n]),d=Ln.square(a),d<l&&(l=d,h=1),{location:h,distance:l}}function FT(i,r){let e=_w(i,r);return{point:df(r,r.length-1,e.location,null,null),location:e.location}}function Rw(i,r){let e=r.length-1,t=2*e-1,n=[],o=[],s=[],a=[],l=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]];for(let u=0;u<=e;u++)n[u]=Ln.subtract(r[u],i);for(let u=0;u<=e-1;u++)o[u]=Ln.subtract(r[u+1],r[u]),o[u]=Ln.scale(o[u],3);for(let u=0;u<=e-1;u++)for(let p=0;p<=e;p++)s[u]||(s[u]=[]),s[u][p]=Ln.dotProduct(o[u],n[p]);for(let u=0;u<=t;u++)a[u]||(a[u]=[]),a[u].y=0,a[u].x=parseFloat(""+u)/t;let h=e,d=e-1;for(let u=0;u<=h+d;u++){let p=Math.max(0,u-d),m=Math.min(u,h);for(let g=p;g<=m;g++){let E=u-g;a[g+E].y+=s[E][g]*l[E][g]}}return a}function cf(i,r,e,t){let n=[],o=[],s,a,l=[],h=[];switch(Lw(i,r)){case 0:return 0;case 1:{if(t>=MT)return e[0]=(i[0].x+i[r].x)/2,1;if(ww(i,r))return e[0]=Dw(i,r),1;break}}df(i,r,.5,n,o),s=cf(n,r,l,t+1),a=cf(o,r,h,t+1);for(let d=0;d<s;d++)e[d]=l[d];for(let d=0;d<a;d++)e[d+s]=h[d];return s+a}function Lw(i,r){let e=0,t,n;t=n=Math.sign(i[0].y);for(let o=1;o<=r;o++)t=Math.sign(i[o].y),t!=n&&e++,n=t;return e}function ww(i,r){let e,t,n,o,s,a,l,h,d,u,p,m,g,E,y,x;a=i[0].y-i[r].y,l=i[r].x-i[0].x,h=i[0].x*i[r].y-i[r].x*i[0].y;let f,b;f=b=0;for(let A=1;A<r;A++){let T=a*i[A].x+l*i[A].y+h;T>f?f=T:T<b&&(b=T)}return p=0,m=1,g=0,E=a,y=l,x=h-f,d=p*y-E*m,u=1/d,t=(m*x-y*g)*u,E=a,y=l,x=h-b,d=p*y-E*m,u=1/d,n=(m*x-y*g)*u,o=Math.min(t,n),s=Math.max(t,n),e=s-o,e<Ow?1:0}function Dw(i,r){let e=1,t=0,n=i[r].x-i[0].x,o=i[r].y-i[0].y,s=i[0].x-0,a=i[0].y-0,l=n*t-o*e,h=1/l,d=(n*a-o*s)*h;return 0+e*d}function df(i,r,e,t,n){let o=[[]];for(let s=0;s<=r;s++)o[0][s]=i[s];for(let s=1;s<=r;s++)for(let a=0;a<=r-s;a++)o[s]||(o[s]=[]),o[s][a]||(o[s][a]={}),o[s][a].x=(1-e)*o[s-1][a].x+e*o[s-1][a+1].x,o[s][a].y=(1-e)*o[s-1][a].y+e*o[s-1][a+1].y;if(t!=null)for(let s=0;s<=r;s++)t[s]=o[s][0];if(n!=null)for(let s=0;s<=r;s++)n[s]=o[r-s][s];return o[r][0]}function Nw(i,r){let e=[];i--;for(let t=0;t<=i;t++)e.push(Iw(t/i,r));return e}function Iw(i,r){let e={x:0,y:0};if(i===0)return r[0];let t=r.length-1;if(i===1)return r[t];let n=r,o=1-i;if(t===0)return r[0];if(t===1)return{x:o*n[0].x+i*n[1].x,y:o*n[0].y+i*n[1].y};if(4>t){let s=o*o,a=i*i,l=0,h,d,u;return t===2?(n=[n[0],n[1],n[2],e],h=s,d=2*(o*i),u=a):t===3&&(h=s*o,d=3*(s*i),u=3*(o*a),l=i*a),{x:h*n[0].x+d*n[1].x+u*n[2].x+l*n[3].x,y:h*n[0].y+d*n[1].y+u*n[2].y+l*n[3].y}}else return e}function UT(i){let r=0;if(!$T(i)){let t=Nw(16,i);for(let n=0;n<15;n++){let o=t[n],s=t[n+1];r+=GT(o,s)}}return r}var VT=new Map;function Mw(i){let r=VT.get(i);if(!r){r=[];let e=()=>l=>Math.pow(l,i),t=()=>l=>Math.pow(1-l,i),n=l=>h=>l,o=()=>l=>l,s=()=>l=>1-l,a=l=>h=>{let d=1;for(let u=0;u<l.length;u++)d=d*l[u](h);return d};r.push(e());for(let l=1;l<i;l++){let h=[n(i)];for(let d=0;d<i-l;d++)h.push(o());for(let d=0;d<l;d++)h.push(s());r.push(a(h))}r.push(t()),VT.set(i,r)}return r}function sa(i,r){let e=Mw(i.length-1),t=0,n=0;for(let o=0;o<i.length;o++)t=t+i[o].x*e[o](1-r),n=n+i[o].y*e[o](1-r);return{x:t,y:n}}function GT(i,r){return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))}function $T(i){return i[0].x===i[1].x&&i[0].y===i[1].y}function $u(i,r,e){if($T(i))return{point:i[0],location:r};let t=sa(i,r),n=0,o=r,s=e>0?1:-1,a=null;for(;n<Math.abs(e);)o+=.005*s,a=sa(i,o),n+=GT(a,t),t=a;return{point:a,location:o}}function YT(i,r,e){return $u(i,r,e).point}function zT(i,r,e){return $u(i,r,e).location}function Bu(i,r){let e=sa(i,r),t=sa(i.slice(0,i.length-1),r),n=t.y-e.y,o=t.x-e.x;return n===0?1/0:Math.atan(n/o)}function VK(i,r,e){let t=$u(i,r,e);return t.location>1&&(t.location=1),t.location<0&&(t.location=0),Bu(i,t.location)}function GK(i,r,e,t){t=t==null?0:t;let n=$u(i,r,t),o=Bu(i,n.location),s=Math.atan(-1/o),a=e/2*Math.sin(s),l=e/2*Math.cos(s);return[{x:n.point.x+l,y:n.point.y+a},{x:n.point.x-l,y:n.point.y-a}]}function wn(i,r,e,t,n){let o=t-r,s=i-e,a=i*(r-t)+r*(e-i),l=Vw(n),h=[o*l[0][0]+s*l[1][0],o*l[0][1]+s*l[1][1],o*l[0][2]+s*l[1][2],o*l[0][3]+s*l[1][3]+a],d=Gw.apply(null,h),u=[];if(d!=null)for(let p=0;p<3;p++){let m=d[p],g=Math.pow(m,2),E=Math.pow(m,3),y={x:l[0][0]*E+l[0][1]*g+l[0][2]*m+l[0][3],y:l[1][0]*E+l[1][1]*g+l[1][2]*m+l[1][3]},x;e-i!==0?x=(y.x-i)/(e-i):x=(y.y-r)/(t-r),m>=0&&m<=1&&x>=0&&x<=1&&u.push(y)}return u}function $K(i,r,e,t,n){let o=[];return o.push.apply(o,wn(i,r,i+e,r,n)),o.push.apply(o,wn(i+e,r,i+e,r+t,n)),o.push.apply(o,wn(i+e,r+t,i,r+t,n)),o.push.apply(o,wn(i,r+t,i,r,n)),o}function BK(i,r){let e=[];return e.push.apply(e,wn(i.x,i.y,i.x+i.width,i.y,r)),e.push.apply(e,wn(i.x+i.width,i.y,i.x+i.width,i.y+i.height,r)),e.push.apply(e,wn(i.x+i.width,i.y+i.height,i.x,i.y+i.height,r)),e.push.apply(e,wn(i.x,i.y+i.height,i.x,i.y,r)),e}function BT(i,r){return[-i[0][r]+3*i[1][r]+-3*i[2][r]+i[3][r],3*i[0][r]-6*i[1][r]+3*i[2][r],-3*i[0][r]+3*i[1][r],i[0][r]]}function Vw(i){return[BT(i,"x"),BT(i,"y")]}function Gw(i,r,e,t){let n=r/i,o=e/i,s=t/i,a=(3*o-Math.pow(n,2))/9,l=(9*n*o-27*s-2*Math.pow(n,3))/54,h=Math.pow(a,3)+Math.pow(l,2),d,u,p=[0,0,0];if(h>=0)d=Math.sign(l+Math.sqrt(h))*Math.pow(Math.abs(l+Math.sqrt(h)),1/3),u=Math.sign(l-Math.sqrt(h))*Math.pow(Math.abs(l-Math.sqrt(h)),1/3),p[0]=-n/3+(d+u),p[1]=-n/3-(d+u)/2,p[2]=-n/3-(d+u)/2,Math.abs(Math.sqrt(3)*(d-u)/2)!==0&&(p[1]=-1,p[2]=-1);else{let m=Math.acos(l/Math.sqrt(-Math.pow(a,3)));p[0]=2*Math.sqrt(-a)*Math.cos(m/3)-n/3,p[1]=2*Math.sqrt(-a)*Math.cos((m+2*Math.PI)/3)-n/3,p[2]=2*Math.sqrt(-a)*Math.cos((m+4*Math.PI)/3)-n/3}for(let m=0;m<3;m++)(p[m]<0||p[m]>1)&&(p[m]=-1);return p}var Xo="Bezier";function uf(i,r,e){return e&&(r=zT(i,r>0?0:1,r)),r}var $w={create(i){let r=ia(i),e=i.cp1,t=i.cp2,n=[{x:r.x1,y:r.y1},{x:e.x,y:e.y},{x:t.x,y:t.y},{x:r.x2,y:r.y2}],o={xmin:Math.min(r.x1,r.x2,e.x,t.x),ymin:Math.min(r.y1,r.y2,e.y,t.y),xmax:Math.max(r.x1,r.x2,e.x,t.x),ymax:Math.max(r.y1,r.y2,e.y,t.y)};return Object.assign(r,{cp1:e,cp2:t,curve:n,extents:o,length:0,type:Xo})},boundingBoxIntersection(i,r){return NT(i,r)},boxIntersection(i,r,e,t,n){return Zl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){let t=FT({x:r,y:e},i.curve);return{d:Math.sqrt(Math.pow(t.point.x-r,2)+Math.pow(t.point.y-e,2)),x:t.point.x,y:t.point.y,l:1-t.location,s:i,x1:null,y1:null,x2:null,y2:null}},getLength(i){return(i.length==null||i.length===0)&&(i.length=UT(i.curve)),i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"C "+i.cp1.x+" "+i.cp1.y+" "+i.cp2.x+" "+i.cp2.y+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return r=uf(i.curve,r,e),Bu(i.curve,r)},lineIntersection(i,r,e,t,n){return wn(r,e,t,n,i.curve)},pointAlongPathFrom(i,r,e,t){return r=uf(i.curve,r,t),YT(i.curve,r,e)},pointOnPath(i,r,e){return r=uf(i.curve,r,e),sa(i.curve,r)}};na(Xo,$w);var Jl={};function Bw(i){return i.x1!=null&&!isNaN(i.x1)&&i.y1!=null&&!isNaN(i.y1)&&i.x2!=null&&!isNaN(i.x2)&&i.y2!=null&&!isNaN(i.y2)}function XT(i){return i.curX!=null&&!isNaN(i.curX)&&i.curY!=null&&!isNaN(i.curY)&&i.x!=null&&!isNaN(i.x)&&i.y!=null&&!isNaN(i.y)&&i.ox!=null&&!isNaN(i.ox)&&i.oy!=null&&!isNaN(i.oy)}function Fw(i){return!i.source||!i.target||!XT(i.source)||!XT(i.target)||i.segments==null||i.segments.length===0?!1:i.segments.find(r=>!Bw(r))==null}var zr=i=>lt(i.geometry),$e={get:(i,r,e)=>{let t=Jl[r];if(t)return t.create(i,e);throw"VisuallyJs: unknown connector type '"+r+"'"},register:(i,r)=>{Jl[i]=r},compute:(i,r,e)=>{let t=Jl[i.connector.type];if(t)return t.compute(i,r,e);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},update:(i,r,e,t,n)=>{let o=Jl[i.connector.type];if(o)return o.update(i,r,e,t,n);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},markEdited(i,r){r=r||zr(i.connector),i.connector.edited=!0,i.edge.geometry=r,$e.$_setAnchorsFromGeometry(i,r)},importGeometry(i,r){if(Fw(r)){let e=i.connector;e.geometry=lt(r),e.edited=!0,$e.$_setAnchorsFromGeometry(i,r)}else U("VisuallyJS WARN: edge geometry invalid")},$_setAnchorsFromGeometry(i,r){hf(r.source,i,0),hf(r.target,i,1)},transformGeometry(i,r,e,t){let n=Jl[i.type];if(n)return n.transformGeometry(r,e,t);throw"VisuallyJs: unknown connector type '"+i.type+"'"},setGeometry(i,r,e){if(r!=null){let t=i.connector;t.geometry=lt(r),e||(t.edited=!0,i.edge.geometry=zr(t))}}};function fq(i){return i.geometry}function yq(i,r){return i.geometry=r,!0}function Uw(i,r){let e=r.extents;i.bounds.xmin=Math.min(i.bounds.xmin,e.xmin),i.bounds.xmax=Math.max(i.bounds.xmax,e.xmax),i.bounds.ymin=Math.min(i.bounds.ymin,e.ymin),i.bounds.ymax=Math.max(i.bounds.ymax,e.ymax)}function mf(i){i.totalLength=0,i.internalSegments.length=0,i.segmentProportions.length=0,i.segmentProportionalLengths.length=0}function Xr(i,r,e){if(e.x1===e.x2&&e.y1===e.y2)return;let t=LT(r,e);i.internalSegments.push(t),i.totalLength+=lf(t),Uw(i,t)}function pf(i,r,e){let t,n,o;if(e&&(r=r>0?r/i.totalLength:(i.totalLength+r)/i.totalLength),r===1)t=i.internalSegments.length-1,o=1;else if(r===0)o=0,t=0;else if(r>=.5){for(t=0,o=0,n=i.segmentProportions.length-1;n>-1;n--)if(i.segmentProportions[n][1]>=r&&i.segmentProportions[n][0]<=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}}else for(t=i.segmentProportions.length-1,o=1,n=0;n<i.segmentProportions.length;n++)if(i.segmentProportions[n][1]>=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}return{segment:i.internalSegments[t],proportion:o,index:t}}function gr(i,r,e){let t=pf(i,r,e);return t.segment&&mr.pointOnPath(t.segment,t.proportion,!1)||{x:0,y:0}}function xq(i,r,e){let t=pf(i,r,e);return t.segment&&mr.gradientAtPoint(t.segment,t.proportion,!1)||0}function Be(i,r,e,t){let n=pf(i,r,t);return n.segment&&mr.pointAlongPathFrom(n.segment,n.proportion,e,!1)||{x:0,y:0}}function gf(i){let r=0;for(let e=0;e<i.internalSegments.length;e++){let t=lf(i.internalSegments[e]);i.segmentProportionalLengths[e]=t/i.totalLength,i.segmentProportions[e]=[r,r+=t/i.totalLength]}}function jT(i){return!((i.ox===0||i.ox==null)&&(i.oy===0||i.oy==null))}function Ef(i,r){i.strokeWidth=r.strokeWidth;let e=r.sourcePos.curX,t=r.targetPos.curX,n=r.sourcePos.curY,o=r.targetPos.curY,s=t<e,a=o<n,l={x:r.sourcePos.ox,y:r.sourcePos.oy},h={x:r.targetPos.ox,y:r.targetPos.oy},d=s?t:e,u=a?o:n,p=Math.abs(t-e),m=Math.abs(o-n),g=!jT(r.sourcePos),E=!jT(r.targetPos);if(g||E){let S=p>m,R=S?e:n,v=S?t:o,O=R>v?-1:1,P=R>v?1:-1;g&&(l.x=S?O:0,l.y=S?0:O),E&&(h.x=S?P:0,h.y=S?0:P)}let y=e+i.sourceGap*l.x,x=n+i.sourceGap*l.y,f=t+i.targetGap*h.x,b=o+i.targetGap*h.y,A=l.x*h.x+l.y*h.y,T={sx:y,sy:x,tx:f,ty:b,so:l,to:h,x:d,y:u,w:p,h:m,quadrant:Ls({x:e,y:n},{x:t,y:o}),startStubX:y+l.x*i.sourceStub,startStubY:x+l.y*i.sourceStub,endStubX:f+h.x*i.targetStub,endStubY:b+h.y*i.targetStub,isXGreaterThanStubTimes2:Math.abs(y-f)>i.sourceStub+i.targetStub,isYGreaterThanStubTimes2:Math.abs(x-b)>i.sourceStub+i.targetStub,opposite:A===-1,perpendicular:A===0,orthogonal:A===1,sourceAxis:l.x===0?ye:Q,stubs:[i.sourceStub,i.targetStub]};return T.anchorOrientation=T.opposite?"opposite":T.orthogonal?"orthogonal":"perpendicular",T}function bq(i,r){let e=i.connector;e.paintInfo=Ef(e,r),mf(e),$e.compute(i,e.paintInfo,r),e.x=e.paintInfo.x,e.y=e.paintInfo.y,e.width=e.paintInfo.w,e.height=e.paintInfo.h,e.quadrant=e.paintInfo.quadrant,gf(e)}function ji(i){i.connector.geometry=null,i.connector.edited=!1,[i.anchors.source,i.anchors.target].forEach(r=>{r.locations.length>0&&(delete r.fixedLocation,r.isFixed=!1)})}function HT(i){i.bounds=Di()}function kT(i,r,e){let t={d:1/0,s:null,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null,index:null,connectorLocation:null};for(let n=0;n<i.internalSegments.length;n++){let o=mr.findClosestPointOnPath(i.internalSegments[n],r,e);o.d<t.d&&(t.d=o.d,t.l=o.l,t.x=o.x,t.y=o.y,t.s=i.internalSegments[n],t.x1=o.x1,t.x2=o.x2,t.y1=o.y1,t.y2=o.y2,t.index=n,t.connectorLocation=i.segmentProportions[n][0]+o.l*(i.segmentProportions[n][1]-i.segmentProportions[n][0]))}return t}function Aq(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,mr.lineIntersection(i.internalSegments[s],r,e,t,n));return o}function Sq(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,mr.boxIntersection(i.internalSegments[s],r,e,t,n));return o}function WT(i,r){let e=[];for(let t=0;t<i.internalSegments.length;t++)e.push.apply(e,mr.boundingBoxIntersection(i.internalSegments[t],r));return e}function Tq(i){return i.typeDescriptor==="connector"}function ZT(i){let r="";for(let e=0;e<i.internalSegments.length;e++)r+=mr.getPath(i.internalSegments[e],e===0),r+=" ";return r}function Yw(i,r,e,t,n,o,s){let a=t,l=n,h=r.sx,d=r.sy,u=r.tx,p=r.ty,m,g;if(r.perpendicular){let E=h+a.ox*i.loopbackDistance,y=d+a.oy*i.loopbackDistance,x=u+l.ox*i.loopbackDistance,f=p+l.oy*i.loopbackDistance;m={x:E,y},g={x,y:f}}else{let E=Math.sign(r.tx-r.sx),y=Math.sign(r.ty-r.sy),x=a.ox===0?.25*i.loopbackDistance*-E:a.ox*i.loopbackDistance,f=a.oy===0?.25*i.loopbackDistance*-y:a.oy*i.loopbackDistance,b=l.ox===0?.25*i.loopbackDistance*E:l.ox*i.loopbackDistance,A=l.oy===0?.25*i.loopbackDistance*y:l.oy*i.loopbackDistance;m={x:r.sx+x,y:r.sy+f},g={x:r.tx+b,y:r.ty+A}}return[m,g]}function zw(i,r,e,t,n,o,s){let a=t,l=n,h,d,[u,p]=[i.scale*r.w,i.scale*r.h];return e.sourceInfo.id===e.targetInfo.id?[h,d]=Yw(i,r,e,t,n,o,s):(h={x:r.sx+a.ox*u,y:r.sy+a.oy*p},d={x:r.tx+l.ox*u,y:r.ty+l.oy*p}),[h,d]}function JT(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp1]}function Xw(i,r,e,t,n,o,s){let a=r.sx,l=r.sy,h=r.tx,d=r.ty,u,p=(a+h)/2,m=(l+d)/2,g=Math.sqrt(Math.pow(h-a,2)+Math.pow(d-l,2));return u=jw(p,m,r.quadrant,e.sourcePos,e.targetPos,i.curviness,i.curviness,g,i.proximityLimit),[u,u]}function jw(i,r,e,t,n,o,s,a,l){if(a<=l)return{x:i,y:r};if(e===1)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===2)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s};if(e===3)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===4)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s}}function KT(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp2]}function Fu(i,r,e,t,n){let o=i.connector,s,a;o.type===jo?[s,a]=KT(o):[s,a]=JT(o);let l={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}],source:e.sourcePos,target:e.targetPos};return Xr(o,Xo,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}),l}function Uu(i,r,e){let t=i.connector,n=e.sourcePos,o=e.targetPos,s=Math.abs(n.curX-o.curX),a=Math.abs(n.curY-o.curY),l,h;t.type===jo?t.edited?[l,h]=KT(t):[l,h]=zw(t,r,e,n,o,s,a):t.edited?[l,h]=JT(t):[l,h]=Xw(t,r,e,n,o,s,a);let d={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}],source:e.sourcePos,target:e.targetPos};return Xr(t,Xo,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}),d}function Yu(i,r,e){return{source:oa(i.source,r,e),target:oa(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e,cp1:{x:t.cp1.x+r,y:t.cp1.y+e},cp2:{x:t.cp2.x+r,y:t.cp2.y+e}}))}}var jo="Bezier";function Hw(i,r){let e=Gu(jo,i,r);return Object.assign(e,{scale:r.scale||IT})}$e.register(jo,{compute:Uu,update:Fu,create:Hw,transformGeometry:Yu});var zu="QuadraticBezier";function kw(i,r){let e=Gu(zu,i,r);return Object.assign(e,{curviness:r.curviness||10,gap:r.gap||5,proximityLimit:r.proximityLimit||80,clockwise:r.orientation&&r.orientation==="clockwise",AA:{x:0,y:0}})}$e.register(zu,{compute:Uu,update:Fu,create:kw,transformGeometry:Yu});var ff="perpendicular",yf="orthogonal",xf="opposite",aa="Orthogonal",qT="Smooth",QT=30;function Kl(i,r,e,t){let n=Math.max(r,e),o=Math.min(r,e);return t?o<=i&&n>=i:o<i&&n>i}function ev(i,r,e){return Xu(r,"h",e,1)}function tv(i,r,e){return Xu(r,"h",e,-1)}function rv(i,r,e){return Xu(r,"v",e,1)}function nv(i,r,e){return Xu(r,"v",e,-1)}function Xu(i,r,e,t){let n=r==="h"?"v":"h",o=[],s=i,a=t===-1?-1:e.length;for(;s!==a;){let l=e[s];if(l.o===n)o.push(l),s+=t;else return{segment:l,others:o,index:s}}return null}function ju(i,r,e,t){let n=null,o;if(t!=null){if(o=i.indexOf(t),o===-1)return null;o+=r}else o=r===-1?i.length-2:1;for(let s=o;s>0&&s<i.length-1;s+=r)if(i[s].o===e){n=[i[s],s];break}return n}function Hu(i,r,e,t){let n=i.indexOf(t),o=ju(i,r,e,t);return o&&o[1]==n+r?o:null}function Ho(i){return{[ne]:Math.sign(i.x2-i.x1),[pe]:Math.sign(i.y2-i.y1)}}function bf(i,r){return i.curX===r.curX&&i.curY===r.curY}function ql(i,r,e,t,n,o){if(i.lastx===r&&i.lasty===e)return;let s=i.lastx==null?t.sx:i.lastx,a=i.lasty==null?t.sy:i.lasty,l=s===r?pe:ne;i.lastx=r,i.lasty=e;let h={x1:s,y1:a,x2:r,y2:e,o:l};i.orthogonalSegments.push(h)}function iv(i,r,e){let t=i[1],n=!1,o=[{x:t.x1,y:t.y1},{x:t.x2,y:t.y2}];if(t.o===ne){if(Kl(t.x2,i[0].x1,i[0].x2)||hr(o,r).length>0){let a=rv(t,1,i);if(a!=null){let l=(a.segment.y1+a.segment.y2)/2;if(n=!0,l<t.y1){let h=Math.round((r.y-e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:pe}),a.segment.y1=h}else{let h=Math.round((r.y2+e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:pe}),a.segment.y1=h}}}}else if(t.o===pe&&(Kl(t.y2,i[0].y1,i[0].y2)||hr(o,r).length>0)){let a=ev(t,1,i);if(a!=null){let l=(a.segment.x1+a.segment.x2)/2;if(n=!0,l<t.x1){let h=Math.round((r.x-e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:ne}),a.segment.x1=h}else{let h=Math.round((r.x2+e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:ne}),a.segment.x1=h}}}return n}function ov(i,r,e){let t=i.length-2,n=i[t],o=!1,s=[{x:n.x1,y:n.y1},{x:n.x2,y:n.y2}],a=i[i.length-1];if(n.o===ne){if(Kl(n.x1,a.x1,a.x2)||hr(s,r).length>0){let h=nv(n,t,i);if(h!=null){let d=(h.segment.y1+h.segment.y2)/2;if(o=!0,d<n.y1){let u=Math.round((r.y-e)*100)/100,p=n.y1;h.others.forEach(m=>{m.y1=u,m.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:pe}),h.segment.y2=u}else{let u=Math.round((r.y2+e)*100)/100,p=n.y1;h.others.forEach(m=>{m.y1=u,m.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:pe}),h.segment.y2=u}}}}else if(n.o===pe&&(Kl(n.y1,a.y1,a.y2)||hr(s,r).length>0)){let h=tv(n,t,i);if(h!=null){let d=(h.segment.x1+h.segment.x2)/2;if(o=!0,d<n.x1){let u=Math.round((r.x-e)*100)/100,p=n.x1;h.others.forEach(m=>{m.x1=u,m.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:ne}),h.segment.x2=u}else{let u=Math.round((r.x2+e)*100)/100,p=n.x1;h.others.forEach(m=>{m.x1=u,m.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:ne}),h.segment.x2=u}}}return o}function sv(i,r,e,t,n){if(i.vertexAvoidance===!1)return{segments:r,sourceAdjusted:!1,targetAdjusted:!1};{let o,s;return n?(o=ov(r,t,i.targetStub),s=iv(r,e,i.sourceStub)):(s=iv(r,e,i.sourceStub),o=ov(r,t,i.targetStub)),{segments:r,sourceAdjusted:s,targetAdjusted:o}}}var Nn="Straight";function Dn(i,r,e){return e>r?r<=i&&i<=e:r>=i&&i>=e}function ku(i,r,e){return e>=Math.min(i,r)&&e<=Math.max(i,r)}function Wu(i,r,e){return Math.abs(e-i)<Math.abs(e-r)?i:r}var ko={create(i){let r=ia(i),e=Math.sqrt(Math.pow(r.x2-r.x1,2)+Math.pow(r.y2-r.y1,2)),t=Nr({x:r.x1,y:r.y1},{x:r.x2,y:r.y2}),n=-1/t,o={xmin:Math.min(r.x1,r.x2),ymin:Math.min(r.y1,r.y2),xmax:Math.max(r.x1,r.x2),ymax:Math.max(r.y1,r.y2)};return Object.assign(r,{length:e,m:t,m2:n,extents:o,type:Nn})},boundingBoxIntersection(i,r){return ko.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){let o=[];return o.push.apply(o,ko.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,ko.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,ko.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,ko.lineIntersection(i,r,e+n,r,e)),o},findClosestPointOnPath(i,r,e){let t={d:1/0,x:null,y:null,l:null,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2};if(i.m===0)t.y=i.y1,t.x=ku(i.x1,i.x2,r)?r:Wu(i.x1,i.x2,r);else if(i.m===1/0||i.m===-1/0)t.x=i.x1,t.y=ku(i.y1,i.y2,e)?e:Wu(i.y1,i.y2,e);else{let o=i.y1-i.m*i.x1,s=e-i.m2*r,a=(s-o)/(i.m-i.m2),l=i.m*a+o;t.x=ku(i.x1,i.x2,a)?a:Wu(i.x1,i.x2,a),t.y=ku(i.y1,i.y2,l)?l:Wu(i.y1,i.y2,l)}let n=Ue({x:t.x,y:t.y},{x:i.x1,y:i.y1});return t.d=Ue({x:r,y:e},t),t.l=n/i.length,t},getLength(i){return i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"L "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return i.m},lineIntersection(i,r,e,t,n){let o=Math.abs(Nr({x:r,y:e},{x:t,y:n})),s=Math.abs(i.m),a=s===1/0?i.x1:i.y1-s*i.x1,l=[],h=o===1/0?r:e-o*r;if(o!==s)if(o===1/0&&s===0)Dn(r,i.x1,i.x2)&&Dn(i.y1,e,n)&&l.push({x:r,y:i.y1});else if(o===0&&s===1/0)Dn(e,i.y1,i.y2)&&Dn(i.x1,r,t)&&l.push({x:i.x1,y:e});else{let d,u;o===1/0?(d=r,Dn(d,i.x1,i.x2)&&(u=s*r+a,Dn(u,e,n)&&l.push({x:d,y:u}))):o===0?(u=e,Dn(u,i.y1,i.y2)&&(d=(e-a)/s,Dn(d,r,t)&&l.push({x:d,y:u}))):(d=(h-a)/(s-o),u=s*d+a,Dn(d,i.x1,i.x2)&&Dn(u,i.y1,i.y2)&&l.push({x:d,y:u}))}return l},pointAlongPathFrom(i,r,e,t){let n=ko.pointOnPath(i,r,t),o=e<=0?{x:i.x1,y:i.y1}:{x:i.x2,y:i.y2};return e<=0&&Math.abs(e)>1&&(e*=-1),kt(n,o,e)},pointOnPath(i,r,e){if(r===0&&!e)return{x:i.x1,y:i.y1};if(r===1&&!e)return{x:i.x2,y:i.y2};{let t=e?r>0?r:i.length+r:r*i.length;return kt({x:i.x1,y:i.y1},{x:i.x2,y:i.y2},t)}}};na(Nn,ko);var av=1e-10;function lv(i){let r=Math.floor(i),e=Math.ceil(i);return i-r<av?r:e-i<av?e:i}var Ql="Arc";function hv(i,r,e,t){return El({x:i,y:r},{x:e,y:t})}function Ww(i,r){if(i.anticlockwise){let e=i.startAngle<i.endAngle?i.startAngle+Li:i.startAngle,t=Math.abs(e-i.endAngle);return e-t*r}else{let e=i.endAngle<i.startAngle?i.endAngle+Li:i.endAngle,t=Math.abs(e-i.startAngle);return i.startAngle+t*r}}var Zu={create(i){let r=ia(i),e=i.cx,t=i.cy,n=i.r,o=i.ac,s,a;i.startAngle&&i.endAngle?(s=i.startAngle,a=i.endAngle,r.x1=e+n*Math.cos(s),r.y1=t+n*Math.sin(s),r.x2=e+n*Math.cos(a),r.y2=t+n*Math.sin(a)):(s=hv(e,t,r.x1,r.y1),a=hv(e,t,r.x2,r.y2)),a<0&&(a+=Li),s<0&&(s+=Li);let l=a<s?a+Li:a,h=Math.abs(l-s);o&&(h=Li-h);let d=2*Math.PI*n,u=h/Li,p=d*u,m={xmin:e-n,xmax:e+n,ymin:t-n,ymax:t+n};return Object.assign(r,{extents:m,length:p,frac:u,circumference:d,sweep:h,startAngle:s,endAngle:a,anticlockwise:o,cx:e,cy:t,radius:n,type:Ql})},boundingBoxIntersection(i,r){return Zu.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){return Zl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){return wT(i,r,e)},getLength(i){return i.length},getPath(i,r){let e=i.sweep>Math.PI?1:0,t=i.anticlockwise?0:1;return(r?"M"+i.x1+" "+i.y1+" ":"")+"A "+i.radius+" "+i.radius+" 0 "+e+","+t+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){let t=Zu.pointOnPath(i,r,e),n=Gb({x:i.cx,y:i.cy},t);return!i.anticlockwise&&(n===1/0||n===-1/0)&&(n*=-1),n},lineIntersection(i,r,e,t,n){return DT(i,r,e,t,n)},pointAlongPathFrom(i,r,e,t){let n=Zu.pointOnPath(i,r,t),o=e/i.circumference*2*Math.PI,s=i.anticlockwise?-1:1,a=n.theta+s*o,l=i.cx+i.radius*Math.cos(a),h=i.cy+i.radius*Math.sin(a);return{x:l,y:h}},pointOnPath(i,r,e){if(r===0)return{x:i.x1,y:i.y1,theta:i.startAngle};if(r===1)return{x:i.x2,y:i.y2,theta:i.endAngle};e&&(r=r/length);let t=Ww(i,r),n=i.cx+i.radius*Math.cos(t),o=i.cy+i.radius*Math.sin(t);return{x:lv(n),y:lv(o),theta:t}}};na(Ql,Zu);var cv={x:[Q,ye],y:[ye,Q]};function dv(i,r){return[i.startStubX,i.startStubY,i.endStubX,i.endStubY]}var eh=new Map;eh.set(ff,dv),eh.set(yf,dv),eh.set(xf,(i,r)=>{let e=i,t=e.sourceAxis,n={[Q]:function(){return e.so[t]===1&&(e.startStubX>e.endStubX&&e.tx>e.startStubX||e.sx>e.endStubX&&e.tx>e.sx)||e.so[t]===-1&&(e.startStubX<e.endStubX&&e.tx<e.startStubX||e.sx<e.endStubX&&e.tx<e.sx)},[ye]:function(){return e.so[t]===1&&(e.startStubY>e.endStubY&&e.ty>e.startStubY||e.sy>e.endStubY&&e.ty>e.sy)||e.so[t]===-1&&(e.startStubY<e.endStubY&&e.ty<e.startStubY||e.sy<e.endStubY&&e.ty<e.sy)}};return!r&&n[e.sourceAxis]()?{[Q]:[(i.sx+i.tx)/2,i.startStubY,(i.sx+i.tx)/2,i.endStubY],[ye]:[i.startStubX,(i.sy+i.ty)/2,i.endStubX,(i.sy+i.ty)/2]}[e.sourceAxis]:[i.startStubX,i.startStubY,i.endStubX,i.endStubY]});var th=new Map;th.set(ff,(i,r,e,t,n,o,s,a,l,h)=>{let d={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]},u={x:[[i.startStubX,i.endStubX],null,[i.endStubX,i.startStubX]],y:[[i.startStubY,i.endStubY],null,[i.endStubY,i.startStubY]]},p={x:[{x:a,y:i.startStubY},{x:a,y:i.endStubY}],y:[{x:i.startStubX,y:l},{x:i.endStubX,y:l}]},m={x:[{x:i.endStubX,y:i.startStubY}],y:[{x:i.startStubX,y:i.endStubY}]},g={x:[{x:i.startStubX,y:i.endStubY},{x:i.endStubX,y:i.endStubY}],y:[{x:i.endStubX,y:i.startStubY},{x:i.endStubX,y:i.endStubY}]},E={x:[{x:i.startStubX,y:l},{x:i.endStubX,y:l},{x:i.endStubX,y:i.endStubY}],y:[{x:a,y:i.startStubY},{x:a,y:i.endStubY},{x:i.endStubX,y:i.endStubY}]},y={x:[i.startStubY,i.endStubY],y:[i.startStubX,i.endStubX]},x=cv[e][0],f=cv[e][1],b=i.so[x]+1,A=i.to[f]+1,T=i.to[f]===-1&&y[e][1]<y[e][0]||i.to[f]===1&&y[e][1]>y[e][0],S=u[e][b][0],R=u[e][b][1],v=d[e][b][A];if(i.quadrant===v[3]||i.quadrant===v[2]&&T)return p[e];if(i.quadrant===v[2]&&R<S)return m[e];if(i.quadrant===v[2]&&R>=S||i.quadrant===v[1]&&!T)return E[e];if(i.quadrant===v[0]||i.quadrant===v[1]&&T)return g[e]}),th.set(yf,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:i.so.x===-1?Math.min(t,o):Math.max(t,o),[ye]:i.so.y===-1?Math.min(t,o):Math.max(t,o)}[e];return{[Q]:[{x:d,y:n},{x:d,y:s},{x:o,y:s}],[ye]:[{x:n,y:d},{x:s,y:d},{x:s,y:o}]}[e]}),th.set(xf,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:ye,[ye]:Q}[e],u=e===Q?i.isXGreaterThanStubTimes2:i.isYGreaterThanStubTimes2;if(r.sourceInfo.id===r.targetInfo.id){let p={[Q]:Me,[ye]:Pe}[e],m=n+(1-r.sourcePos[d])*r.sourceInfo[p]+h;return{[Q]:[{x:t,y:m},{x:o,y:m}],[ye]:[{x:m,y:t},{x:m,y:o}]}[e]}else{if(!u||i.so[e]===1&&t>o||i.so[e]===-1&&t<o)return{[Q]:[{x:t,y:l},{x:o,y:l}],[ye]:[{x:a,y:t},{x:a,y:o}]}[e];if(i.so[e]===1&&t<o||i.so[e]===-1&&t>o)return{[Q]:i.sy===i.ty?[{y:i.ty,x:o}]:[{x:a,y:i.sy},{x:a,y:i.ty}],[ye]:i.sx===i.tx?[{x:i.tx,y:o}]:[{x:i.sx,y:l},{x:i.tx,y:l}]}[e]}});function uv(i,r,e){let t={lastx:null,lasty:null,orthogonalSegments:[]},n=e.targetPos.curX>=e.sourcePos.curX?e.sourcePos.curX:e.targetPos.curX,o=e.targetPos.curY>=e.sourcePos.curY?e.sourcePos.curY:e.targetPos.curY,s=eh.get(r.anchorOrientation)(r,i.alwaysRespectStubs),a=r.sourceAxis===Q?0:1,l=r.sourceAxis===Q?1:0,h=s[a],d=s[l],u=s[a+2],p=s[l+2];ql(t,s[0],s[1],r,n,o);let m=r.startStubX+(r.endStubX-r.startStubX)*i.midpoint,g=r.startStubY+(r.endStubY-r.startStubY)*i.midpoint,y=th.get(r.anchorOrientation)(r,e,r.sourceAxis,h,d,u,p,m,g,Math.max(i.sourceStub,i.targetStub));if(y)for(let x=0;x<y.length;x++)ql(t,y[x].x,y[x].y,r,n,o);return ql(t,s[2],s[3],r,n,o),ql(t,r.tx,r.ty,r,n,o),t.orthogonalSegments}function Ju(i,r){let e=r;return i.smooth===!0&&e.length>=2?Kw(i,e).map(n=>Xr(i,n.type,n.segment)):i.cornerRadius!=null&&e.length>1?Zw(i,e):e.map(t=>Xr(i,Nn,t)),i.$pathSegments=e,e}function pv(i){return Math.atan2(i.y1-i.y2,i.x1-i.x2)}function mv(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}function Zw(i,r){let e=null,t,n,o;for(let s=0;s<r.length-1;s++){if(e=e||Object.assign({},r[s]),t=Object.assign({},r[s+1]),n=pv(e),o=pv(t),i.cornerRadius>0&&n!==o){let a=Math.min(mv(e),mv(t)),l=Math.min(i.cornerRadius,.99*a/2),h={x:e.x2+l*Math.cos(n),y:e.y2+l*Math.sin(n)},d={x:t.x1-l*Math.cos(o),y:t.y1-l*Math.sin(o)},u=Math.atan((n-o)/(1+n*o)),p=Dt({x:e.x1,y:e.y1},h,1e4),m=Dt({x:t.x1,y:t.y1},d,1e4),g=lE(p,m),E=g!=null?Ue(g,h):0;E>0?(e.x2=h.x,e.y2=h.y,t.x1=d.x,t.y1=d.y,Xr(i,Nn,Object.assign({},e)),i.slightlyWonky?Xr(i,Ql,Object.assign({r:l,cx:g.x,cy:g.y,ac:u>0},e)):Xr(i,Ql,{r:E,x1:h.x,y1:h.y,x2:d.x,y2:d.y,cx:g.x,cy:g.y,ac:u>0})):Xr(i,Nn,Object.assign({},e))}else Xr(i,Nn,Object.assign({},e));e=t}t!=null&&Xr(i,Nn,Object.assign({},e))}var Jw=(i,r)=>{let e=r.x-i.x,t=r.y-i.y;return{length:Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),angle:Math.atan2(t,e)}},gv=(i,r,e,t,n)=>{let a=Jw(r||i,e||i),l=a.angle+(n?Math.PI:0),h=a.length*t,d=i.x+Math.cos(l)*h,u=i.y+Math.sin(l)*h;return{x:d,y:u}};function Af(i,r){let e=[];for(let t=1;t<i.length;t++){let n=gv(i[t-1],i[t-2],i[t],r),o=gv(i[t],i[t-1],i[t+1],r,!0);e.push({type:Xo,segment:{x1:i[t-1].x,y1:i[t-1].y,cp1:n,cp2:o,x2:i[t].x,y2:i[t].y}})}return e}function Kw(i,r){let e=[{x:r[0].x1,y:r[0].y1}];for(let t=1;t<r.length;t++)e.push({x:r[t].x1,y:r[t].y1});return e.push({x:r[r.length-1].x2,y:r[r.length-1].y2}),Af(e,i.smoothing)}function qw(i,r,e){return Sf([{x1:r.sx,y1:r.sy,x2:r.startStubX,y2:r.startStubY},{x1:r.startStubX,y1:r.startStubY,x2:r.endStubX,y2:r.endStubY},{x1:r.endStubX,y1:r.endStubY,x2:r.tx,y2:r.ty}])}function Ku(i,r,e,t,n){let o=i.connector;o.lastx=null,o.lasty=null,o.lastOrientation=null;let s=e.sourcePos,a=e.targetPos;return o.$pathSegments=o.geometry.segments,o.constrain===on?Ev(s,a,o,r,e,t,n):Qw(s,a,o,r.quadrant,t,n),Ju(o,o.$pathSegments),{segments:o.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function qu(i,r,e){let t=i.connector;return t.lastx=null,t.lasty=null,t.lastOrientation=null,t.constrain===on?t.$pathSegments=uv(t,r,e):t.$pathSegments=qw(t,r,e),Ju(t,t.$pathSegments),{segments:t.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function Qw(i,r,e,t,n,o){if(o){let s=e.geometry.segments[e.geometry.segments.length-1];s.x2=r.curX,s.y2=r.curY,e.geometry.target.curX=r.curX,e.geometry.target.curY=r.curY}else if(n){let s=e.geometry.segments[0];s.x1=i.curX,s.y1=i.curY,e.geometry.source.curX=i.curX,e.geometry.source.curY=i.curY}e.geometry.quadrant=t,e.$pathSegments=e.geometry.segments}function Qu(i,r,e){return{source:oa(i.source,r,e),target:oa(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e}))}}function Sf(i){return i.length===0?[]:i.filter(r=>!(r.x1===r.x2&&r.y1===r.y2))}var eD=.15,In="Straight";function la(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}$e.register(In,{compute:qu,update:Ku,create:Tf,transformGeometry:Qu});function tD(i,r){let e=Object.assign(r,{constrain:on});return Tf(i,e)}$e.register(aa,{compute:qu,update:Ku,create:tD,transformGeometry:Qu});function rD(i,r){let e=Object.assign(r,{constrain:nn,smooth:!0});return Tf(i,e)}$e.register(qT,{compute:qu,update:Ku,create:rD,transformGeometry:Qu});function nD(i){return i==null?null:i===fA?on:i===yA?ad:i}function Tf(i,r){let e=nD(r.constrain);r.stub=r.stub==null?e===on?QT:null:r.stub;let t=Vu(In,i,r,[0,0]),n=r.midpoint==null||isNaN(r.midpoint)?.5:r.midpoint,o=r.alwaysRespectStubs!==!1,s=r.loopbackRadius||25;return Object.assign(t,{cornerRadius:r.cornerRadius!=null?r.cornerRadius:null,smooth:r.smooth===!0,smoothing:r.smoothing==null?eD:r.smoothing,geometry:{segments:[]},constrain:e==null?nn:e,$pathSegments:[],loopbackRadius:s,isLoopbackCurrently:!1,alwaysRespectStubs:o,midpoint:n,lastOrientation:null,lastx:null,lasty:null,slightlyWonky:r.slightlyWonky===!0})}function yv(i,r,e){fv(1,i,r,e),fv(0,i,r,e)}var Hi="x2",ki="x1",Wi="y1",Zi="y2";function iD(i,r,e){let t=e===i.x1?{value:i.x2,coord:Hi,prev:!0}:{value:i.x1,coord:ki,prev:!0},n=e===r.x1?{value:r.x2,coord:Hi,prev:!1}:{value:r.x1,coord:ki,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function oD(i,r,e){let t=e===i.y1?{value:i.y2,coord:Zi,prev:!0}:{value:i.y1,coord:Wi,prev:!0},n=e===r.y1?{value:r.y2,coord:Zi,prev:!1}:{value:r.y1,coord:Wi,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function sD(i,r){if(r.length<5)return r;function e(d,u,p){let m=p===d.x1?d.x2:d.x1,g=p===u.x1?u.x2:u.x1;if(m>u.x1&&u.x2>m||m>u.x2&&u.x1>m)return m;if(g>d.x1&&d.x2>g||g>d.x2&&d.x1>g)return g}function t(d,u,p){let m=p===d.y1?d.y2:d.y1,g=p===u.y1?u.y2:u.y1;if(m>u.y1&&u.y2>m||m>u.y2&&u.y1>m)return m;if(g>d.y1&&d.y2>g||g>d.y2&&d.y1>g)return g}let n=r[1],o,s,a=Math.max(i.sourceStub,i.targetStub),l=[];for(let d=2;d<r.length-2;d++)if(o=r[d],s=Ho(n)[n.o],o.o!==n.o)if(la(o)<a){let p=r[d+1];if(Ho(p)[p.o]!==s){let g=Object.assign({},o);if(o.o===pe){let E=iD(n,p,o.x1),y=e(n,p,o.x1);if(y!=null){if(g.x1=y,g.x2=y,E.prev){let x=Object.assign({},n);n.x2===o.x1?x.x2=y:x.x1=y,l.push({start:d-1,segments:[x,g]})}else{let x=Object.assign({},p);p.x1===o.x1?x.x1=y:x.x2=y,l.push({start:d-1,segments:[g,x]})}n=p,d+=1}else n=o}else if(o.o===ne){let E=oD(n,p,o.y1),y=t(n,p,o.y1);if(y!=null){if(g.y1=y,g.y2=y,E.prev){let x=Object.assign({},n);n.y2===o.y1?x.y2=y:x.y1=y,l.push({start:d-1,segments:[x,g]})}else{let x=Object.assign({},p);p.y1===o.y1?x.y1=y:x.y2=y,l.push({start:d-1,segments:[g,x]})}n=p,d+=1}else n=o}}else n=o}else n=o;else n=o;let h=r.slice();for(let d=0;d<l.length;d++)h.splice(l[d].start-d,3,...l[d].segments);return l.length>0?vf(h):h}function fv(i,r,e,t){let n=r.$pathSegments.slice();i===1&&n.reverse();let o=n[0],s=n[n.length-1],a=i===1?r.targetStub:r.sourceStub,l=i===1?t.targetPos.curX:t.sourcePos.curX,h=i===1?t.targetPos.curY:t.sourcePos.curY,d=i===1?e.to:e.so,u=i===1?Hi:ki,p=i===1?Zi:Wi,m=i===1?ki:Hi,g=i===1?Wi:Zi,E=1,y=n.length-2,x=1,f=n[1];o[m]=l+a*d.x,o[g]=h+a*d.y,o[u]=l,o[p]=h,o.o=o.x1===o.x2?"v":"h";let b=Ho(o),A=o.o,T=o.o===ne?pe:ne,S=o.o===ne?[Hi,ki]:[Zi,Wi],R=o.o===ne?[ki,Hi]:[Wi,Zi],v=o.o===ne?[Zi,Wi]:[Hi,ki],O=o.o===ne?[Wi,Zi]:[ki,Hi],P=S[i],I=R[i],C=v[i],_=O[i];if(f!=null)if(f.o===o.o){f[I]=o[P],f[C]=f[_]=o[C];let $=Ho(f)[A],N=Hu(n,x,T,f);if($!==b[A]){if(N!=null){let M=Hu(n,x,A,N[0]);if(M!=null)n.splice(E,1),M[0][I]=o[P],N[0][P]=o[P],N[0][I]=o[P],N[0][_]=o[C];else{let D=(N[0][C]+N[0][_])/2;N[0][_]=D,f[C]=f[_]=D;let V={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[_]:o[C],[I]:o[P]};n.splice(E,0,V)}}}else if(f[C]=f[_]=o[C],N!=null)N[0][_]=o[C];else if(f[C]!==s[_]){let M={o:f.o==="h"?"v":"h",[P]:f[P],[I]:f[P],[C]:s[C],[_]:f[_]},D=n.length-1;n.splice(D,0,M)}}else{f[_]=o[C],f[P]=f[I]=o[P];let $=Hu(n,x,A,f);if($!=null){let N=Ho($[0])[A];$[0][I]=o[P];let M=Ho($[0])[A];if(N!==M&&$[1]===y){n.splice($[1],1);let D=(f[C]+f[_])/2;f[_]=D,f[P]=f[I]=s[I];let V={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:D,[_]:D,[I]:o[P]};n.splice(E,0,V);let J={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[_]:o[C],[I]:o[P]};n.splice(E,0,J)}}else{let N=(f[C]+f[_])/2;f[_]=N,f[P]=f[I]=s[I];let M={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:N,[_]:N,[I]:o[P]};n.splice(E,0,M);let D={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[_]:o[C],[I]:o[P]};n.splice(E,0,D)}}let w=sD(r,n);i===1&&w.reverse(),r.$pathSegments=w}function Ev(i,r,e,t,n,o,s){let a=e.geometry;if(o||s){let l=i.curX-a.source.curX,h=i.curY-a.source.curY,d=r.curX-a.target.curX,u=r.curY-a.target.curY;if(l===d&&h===u){let p=[];e.$pathSegments.forEach(m=>{let g=Object.assign({},m);g.x1+=l,g.x2+=l,g.y1+=h,g.y2+=h,p.push(g)}),e.$pathSegments=p;return}yv(e,t,n)}}function aD(i,r,e){let t=i.findIndex(n=>n.x1===r.x1&&n.y1===r.y1&&n.x2===r.x2&&n.y2===r.y2);if(t>-1){let n=i[t].o,o=i[t];return{segment:o,index:t,axis:n,prev:t>1?i[t-1]:null,next:t<i.length-2?i[t+1]:null,left:e?ju(i,-1,n,o):null,right:e?ju(i,1,n,o):null}}else return null}function xv(i,r,e,t,n){let o=aD(r.$pathSegments,e);if(o!=null){o.axis===pe?o.segment.x1=o.segment.x2=t.x:o.segment.y1=o.segment.y2=t.y;let s=o.axis===pe,a=o.index,l=o.index,h=a>1?r.$pathSegments[a-1]:null,d=o.segment;for(;h!=null;)h.o===d.o?s?(h.x1=d.x1,h.x2=d.x2):(h.y1=d.y1,h.y2=d.y2):(h.x2=d.x1,h.y2=d.y1),d=h,a--,h=a>1?r.$pathSegments[a-1]:null;if(d.x1!==r.$pathSegments[0].x2){let m={o:ne,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,m),l++}else if(d.y1!==r.$pathSegments[0].y2){let m={o:pe,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,m),l++}d=o.segment,a=l;let u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;for(;u!=null;)u.o===d.o?s?(u.x1=d.x1,u.x2=d.x2):(u.y1=d.y1,u.y2=d.y2):(u.x1=d.x2,u.y1=d.y2),d=u,a++,u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;let p=r.$pathSegments[r.$pathSegments.length-1];if(d.x2!==p.x1){let m={o:ne,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,m)}else if(d.y2!==p.y1){let m={o:pe,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,m)}if(n!==!0){let m=i.instance.getElement(i.sourceId),g=i.instance.getElement(i.targetId);sv(r,r.$pathSegments,m,g,!1).sourceAdjusted&&(l+=1)}return r.edited=!0,{ctx:o,segments:r.$pathSegments,index:l}}else return null}function vf(i){let r=[lt(i[0])],e=lt(i[i.length-1]),t=i.slice(1,i.length-1).filter(s=>la(s)>0).map(lt);if(t.length===0)return i;let n=null,o=null;for(let s=0;s<t.length;s++)n==null||o==null?(n=t[s],o=t[s].o):t[s].o===o?(n.y2=t[s].y2,n.x2=t[s].x2):(r.push(n),n=t[s],o=t[s].o);if(r.push(n),r.push(e),r.length===3){let s=r[1],a=s.o,l=Object.assign({},s),h=Object.assign({},s),d=Object.assign({},s);h.o=a===ne?pe:ne,h.x1=l.x1,h.y1=l.y1,h.x2=l.x1,h.y2=l.y1,d.o=a===ne?pe:ne,d.x1=l.x2,d.y1=l.y2,d.x2=l.x2,d.y2=l.y2,r=[r[0],h,l,d,r[2]]}return r}function bv(i){let r=vf(i.$pathSegments);i.$pathSegments=r,i.geometry!=null&&(i.geometry.segments=r)}var ep=class extends zt{constructor(e){super();c(this,"$context");this.$context=e||{}}getFromContext(e){return this.$context[e]}ensureContext(e,t){let n=this.$context[e];return n==null&&(n=t(),this.$context[e]=n,this.fire($l,{key:e,value:n})),n}updateContext(e,t){this.$context[e]=t,this.fire($l,{key:e,value:t})}};var Ji=(e=>(e.SVG="SVG",e.HTML="HTML",e))(Ji||{});var Mn="px",jr="50px",Pr="block",pt="none",qe="absolute",Cf="fixed",Av="static",Sv="relative",xre="data-vjs-group",mt="data-vjs-managed",rh="data-vjs-not-draggable",Tv="data-vjs-no-events",vv="data-vjs-elements-draggable",Pf="tabindex",te="data-vjs-vertex",hn="data-vjs-port",nh="data-vjs-port-id",Hr="data-vjs-port-type",tp="data-vjs-edge-type",Cv="data-vjs-source",Wo="data-vjs-target",Of="data-vjs-allow-loopback",_f="data-vjs-source-port-id",rp="data-vjs-target-port-id",ha="data-vjs-source-port",Zo="data-vjs-target-port",Ki="data-vjs-source-port-type",qi="data-vjs-target-port-type",np="data-vjs-magnet",Qe="data-vjs-edge",ip="data-vjs-overlay-id",Er="*";var ca="vjs-connector",Pv="vjs-connector-path",Ov="vjs-connector-outline",_v="vjs-connector-transient",ih="vjs-connected",Rf="vjs-group-collapsed",Lf="vjs-group-expanded",op="vjs-toggle-group-collapse",da="vjs-overlay",oh="vjs-overlay-hide",Rv="vjs-label-overlay",Qi="vjs-node",Lv="vjs-port",Jo="vjs-group",wv="vjs-dummy-vertex",sh="vjs-selected-connection",eo="vjs-selected-element",ua="vjs-edge-delete",sp="vjs-edge-delete-i";var wf="allowNestedGroups",ah="anchor",lh="anchors",Dv="astarVertexBorder",Nv="astarVertexBuffer",kre="edgesDetachable",ap="connector",Iv="cssClass",Mv="edgeRelocateHandleSize",Wre="groupSize",Vv="hoverClass",lp="hoverPaintStyle",Gv="maxConnections",Zre="nodeSize",Ko="paintStyle",Jre="reattachEdges",Df="scope",$v=[.05,3];function Bv(i){return i.type!=null&&i.options!=null}function mi(i){let r=null;return j(i)?r={type:i,options:{}}:r=i,r.options.id=r.options.id||B(),r}var hp="always",to="hover";function Nf(i,r){let e=i.location==null?.5:i.location;if(r!=null)try{let t=typeof r=="string"?parseFloat(r):r;isNaN(t)||(e=t)}catch(t){}i.location=e}var pi=class{constructor(r,e){this.connection=r;c(this,"id");c(this,"cssClass");c(this,"ls");c(this,"visible",!0);c(this,"location",.5);c(this,"events");c(this,"attributes");c(this,"ignoreTypes",!1);e=e||{},this.id=e.id||B(),this.cssClass=e.cssClass||"",Nf(this,e.location),this.events=e.events||{},this.attributes=e.attributes||{},this.ls=r.instance.$isTouchDevice()?hp:e.visibility||hp,this.ls===to&&(this.visible=!1)}},Vn=class extends pi{constructor(e,t,n){super(t,n);this.component=t;c(this,"paintStyle");c(this,"$hollow");c(this,"isSimpleShape",!0);n=n||{},this.paintStyle=n.paintStyle||{strokeWidth:1},this.$hollow=n.hollow===!0}$getStyle(e){let t=this.paintStyle.stroke||e.stroke,n=this.$hollow?"none":this.paintStyle.fill||e.stroke,o=this.paintStyle.strokeWidth||e.strokeWidth;return{stroke:t,fill:n,lineWidth:o}}updateFrom(e,t){}};var Fv={},at={get:(i,r,e,t)=>{let n=Fv[r];if(n)return new n(i,e,t);throw{message:"VisuallyJs: unknown overlay type '"+r+"'"}},register:(i,r)=>{Fv[i]=r}};var cp=class cp extends pi{constructor(e,t,n){super(t,n);this.instance=e;this.connection=t;c(this,"label");c(this,"type",cp.type);c(this,"useHTMLElement");c(this,"rotatable");c(this,"font");c(this,"isSimpleShape",!1);n=n||{label:""},this.useHTMLElement=e.containerType!=="SVG"&&n.useHTMLElement===!0,this.font=n.font,this.setLabel(n.label),this.rotatable=n.rotatable}getLabel(){return rn(this.label)?this.label(this):this.label}setLabel(e){this.label=e,this.instance.updateLabel(this)}updateFrom(e,t){e.font!=null&&(this.font=e.font),e.label!=null&&this.setLabel(e.label),e.location!=null&&Nf(this,e.location),If(this,t)}};c(cp,"type","Label");var fr=cp;function kr(i){return i.type===fr.type}at.register(fr.type,fr);function If(i,r){if(r){let e=r.fontSize;e!=null&&(i.font=i.font||{},i.font.size=e);let t=r.fontStyle;t!=null&&(i.font=i.font||{},i.font.style=t);let n=r.fontFamily;n!=null&&(i.font=i.font||{},i.font.family=n)}}var Vf="labelLocation",lD=[ah,lh,"cssClass",ap,Ko,lp],hD="parent";function dp(i,r){let e=h=>h?r[h]:null,t=(h,d)=>{if(h==null)return null;{let u=h[hD],p;if(Array.isArray(u)?p=u:p=[u],p.find(g=>d.indexOf(g)!==-1))throw new Error("circular view reference");return d.push(...p),p.map(g=>e(g)).filter(g=>g!=null)}},n=(h,d,u)=>{let p=lD.slice();d.mergeStrategy==="override"&&Array.prototype.push.apply(p,["events","overlays"]);let m=bn(h,d,[],p);return o(t(h,u),m,u)},o=(h,d,u)=>{if(h==null)return d;{let p=d;for(let m=0;m<h.length;m++)p=n(h[m],p,u);return p}},s=h=>{if(h==null)return{};if(typeof h=="string")return e(h);if(h.length){let d=!1,u=0,p;for(;!d&&u<h.length;)p=s(h[u]),p?d=!0:u++;return p}},a=s(i),l=[];return a?o(t(a,l),a,l):{}}function pa(i){return(r,e,t)=>{let n=Xc(e,{x:0,y:0,width:1,height:1},i);return Object.assign(n.p,{portId:i[n.idx].portId})}}function Mf(i){i.anchorPositions!=null&&(i.anchorPositionFinder=pa(i.anchorPositions))}var up=class{constructor(r,e,t,n){this.model=r;this.viewOptions=t;c(this,"defMap",{nodes:new Map,edges:new Map,groups:new Map,ports:new Map});c(this,"nodes");c(this,"edges");c(this,"groups");c(this,"ports");this.viewOptions=this.viewOptions||{},this.nodes=this.viewOptions.nodes||{},this.edges=this.viewOptions.edges||{},this.ports=this.viewOptions.ports||{},this.groups=this.viewOptions.groups||{};let o,s;function a(l,h){return d=>{l.call(h,{overlay:d.overlay,e:d.e,connection:d.overlay.connection,edge:d.overlay.connection.edge,model:d.overlay.connection.instance.model})}}for(let l in this.viewOptions.edges){if(o=this.getEdgeDefinition(l),o.overlays)for(s=0;s<o.overlays.length;s++){let h=o.overlays[s];if(Bv(h)){let d=h.options;if(d.events!=null)for(let u in d.events){let p=d.events[u];d.events[u]=a(p,h)}}}n.$registerConnectionType(l,o)}}getEdgeDefinition(r){if(r==null)return null;if(this.defMap.edges.has(r))return this.defMap.edges.get(r);{let e=dp([r,be],this.edges);if(e.label!=null){e.overlays=e.overlays||[];let t={type:fr.type,options:{useHTMLElement:e.useHTMLLabel===!0,id:"label",label:e.label,rotatable:e.labelsRotatable}};e.labelClass&&(t.options.cssClass=e.labelClass);let n=e.labelLocationAttribute||Vf;e.labelLocation?t.options.location=e.labelLocation:t.options.location=`{{${n}}}`,e.labelLocationAttribute&&(t.options.labelLocationAttribute=e.labelLocationAttribute),e.labelFont&&(t.options.font=Object.assign({},e.labelFont)),e.overlays.push(t),delete e.label}if(e.deleteButton!=null){e.overlays=e.overlays||[];let t=(e.deleteButtonClass||ua)+" "+sp,n=e.deleteButtonLocation||.1;(Array.isArray(n)?n:[n]).forEach(s=>{e.overlays.push({type:fr.type,options:{location:s,label:"\u2716",cssClass:t,visibility:e.deleteButton===to?to:hp}})})}return delete e.parent,this.defMap.edges.set(r,e),e}}getNodeDefinition(r){if(r==null)return null;if(this.defMap.nodes.has(r))return this.defMap.nodes.get(r);{let e=dp([r,be],this.nodes);return delete e.parent,Mf(e),this.defMap.nodes.set(r,e),e}}getPortDefinition(r){if(r==null)return null;if(this.defMap.ports.has(r))return this.defMap.ports.get(r);{let e=dp([r,be],this.ports);return delete e.parent,Mf(e),this.defMap.ports.set(r,e),e}}getGroupDefinition(r){if(r==null)return null;if(this.defMap.groups.has(r))return this.defMap.groups.get(r);{let e=dp([r,be],this.groups);return delete e.parent,Mf(e),this.defMap.groups.set(r,e),e}}getTypeDefinition(r){let e=this.model.getType(r);if(K(r))return this.getNodeDefinition(e);if(Y(r))return this.getGroupDefinition(e);if(H(r))return this.getPortDefinition(e)}};function pp(){return new Set}var Uv=class{constructor(){c(this,"affectedElements",new Set)}};function cD(i){return{id:i,el:null,dirty:!0,x:NaN,y:NaN,width:NaN,height:NaN,modelObject:null,r:0,c:{x:0,y:0},ro:{x:0,y:0},x2:0,y2:0,t:{id:i,c:{x:0,y:0},x:NaN,y:NaN,width:NaN,height:NaN,r:0,x2:0,y2:0,cr:0,sr:0,ro:{x:0,y:0}}}}function dD(i,r,e,t,n,o){let s=o/360*Math.PI*2,a={x:r+t/2,y:e+n/2},l=Math.cos(s),h=Math.sin(s),d=(A,T)=>Ie({x:A,y:T},a,o),u=d(r,e),p=d(r+t,e),m=d(r+t,e+n),g=d(r,e+n),E=d(r+t/2,e+n/2),y=Math.min(u.x,p.x,m.x,g.x),x=Math.max(u.x,p.x,m.x,g.x),f=Math.min(u.y,p.y,m.y,g.y),b=Math.max(u.y,p.y,m.y,g.y);return{x:y,y:f,width:x-y,height:b-f,c:E,r:o,x2:x,y2:b,cr:l,sr:h,id:i,ro:{x:y,y:f}}}var mp=(i,r)=>{let e=0;return r.value>i.value?e=-1:r.value<i.value&&(e=1),e},Yv=(i,r)=>mp(i,r)*-1;function gp(i,r,e,t,n){pE({id:i,value:r,otherBound:e},t,mp,n)}function ro(i,r){let e=r.findIndex(t=>t.id===i);e>-1&&r.splice(e,1)}var Ep=class{constructor(r,e){this.instance=r;this.getRenderedElement=e;c(this,"Zd",null);c(this,"rtree");c(this,"Xe",!1);c(this,"Za",!0);c(this,"P",{xmin:[],xmax:[],ymin:[],ymax:[]});c(this,"V",{});c(this,"Ja",{});c(this,"je",{xmin:0,xmax:0,ymin:0,ymax:0});this.rtree=new ra(4)}setSuspended(r){this.Xe=r,this.Xe||(this.recomputeBounds(),this.YE())}getExtents(){return Object.assign({},this.je)}XE(r,e,t){e!=null&&(ro(r,this.P.xmin),ro(r,this.P.xmax),ro(r,this.P.ymin),ro(r,this.P.ymax),gp(r,e.t.x,e.t.x2,this.P.xmin,!1),gp(r,e.t.x2,e.t.x,this.P.xmax,!0),gp(r,e.t.y,e.t.y2,this.P.ymin,!1),gp(r,e.t.y2,e.t.y,this.P.ymax,!0),t!==!0&&this.hs())}hs(){this.je.xmin=this.P.xmin.length>0?this.P.xmin[0].value:0,this.je.xmax=this.P.xmax.length>0?this.P.xmax[0].value:0,this.je.ymin=this.P.ymin.length>0?this.P.ymin[0].value:0,this.je.ymax=this.P.ymax.length>0?this.P.ymax[0].value:0}recomputeBounds(){if(this.Za){this.Za=!1,this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0;for(let r in this.V){let e=this.V[r];this.P.xmin.push({id:r,value:e.t.x,otherBound:e.t.x2}),this.P.xmax.push({id:r,value:e.t.x2,otherBound:e.t.x}),this.P.ymin.push({id:r,value:e.t.y,otherBound:e.t.y2}),this.P.ymax.push({id:r,value:e.t.y2,otherBound:e.t.y})}this.P.xmin.sort(mp),this.P.ymin.sort(mp),this.P.xmax.sort(Yv),this.P.ymax.sort(Yv),this.hs()}}findVerticesAtPoint(r,e,t,n,o){t=t==null?0:t;let s=[];if(o=o||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(o.indexOf(l.id)===-1&&l.value-t<r&&l.otherBound+t>r){let h=this.V[l.id];if(h.y-t<e&&h.y2+t>e&&(s.push(h),n))return s}}else{let a=this.rtree.search({x:r-t,y:e-t,width:t===0?1:t*2,height:t===0?1:t*2});for(let l=0;l<a.length;l++){let h=a[l].id;if(o.indexOf(h)===-1&&(s.push(this.V[h]),n))return s}}return s}findVerticesIntersectingWithRect(r,e,t,n,o){e=e==null?0:e;let s=[];if(n=n||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(n.indexOf(l.id)===-1&&hE(l.value-e,l.otherBound+e,r.x,r.x+r.width,1)){let d=this.V[l.id];if(hE(d.y-e,d.y2+e,r.y,r.y+r.height,1)&&(s.push(d),t))return s}}else{let a=o?1:0,l=this.rtree.search({x:r.x-e+a,y:r.y-e+a,width:r.width+2*e-2*a,height:r.height+2*e-2*a});for(let h=0;h<l.length;h++){let d=l[h].id;if(n.indexOf(d)===-1&&(s.push(this.V[d]),t))return s}}return s}findVerticesEnclosedByRect(r,e,t,n,o){let s=r.x+r.width,a=r.y+r.height;return this.findVerticesIntersectingWithRect(r,e,t,n,o).filter(l=>o?r.x<l.x&&r.y<l.y&&s>l.x2&&a>l.y2:r.x<=l.x&&r.y<=l.y&&s>=l.x2&&a>=l.y2)}hasVerticesIntersectingWithRect(r,e,t,n){return this.findVerticesIntersectingWithRect(r,e,!0,t,n).length>0}hasLineOfSight(r,e,t){let n=Yb(r,e/2);return this.rtree.findIntersectionsWithLine(n[0],t).length===0&&this.rtree.findIntersectionsWithLine(n[1],t).length===0}jE(r,e,t){e.t=dD(r,e.x,e.y,e.width,e.height,e.r),this.Ja[r]=e.t,this.Za=!0,t!==!0&&(this.Xe||this.XE(r,e,t)),this.rtree!=null&&e.modelObject!=null&&(this.Xe||this.rtree.update(r,e.t.x,e.t.y,e.t.width,e.t.height,{id:r}))}updateElement(r,e,t,n,o,s,a,l){let h=Is(this.V,r,()=>this.addElement(r,this.getRenderedElement(r),a,{x:e,y:t},{width:n,height:o},s));return h!=null&&(h.dirty=!1,a!=null&&(h.modelObject=a),e!=null&&(h.x=e),t!=null&&(h.y=t),n!=null&&(h.width=n),o!=null&&(h.height=o),h.c.x=h.x+h.width/2,h.c.y=h.y+h.height/2,h.x2=h.x+h.width,h.y2=h.y+h.height,s!=null&&(h.r=s||0),h.r==null||h.r===0?h.ro={x:h.x,y:h.y}:h.ro=Ie({x:h.x,y:h.y},h.c,h.r),this.Zd==null?this.jE(r,h,l):this.Zd.affectedElements.add(r)),h}$forEachElement(r){for(let e in this.V)r(this.V[e])}$refreshEveryElement(){for(let r in this.V)this.$refreshElement(r,!0)}$refreshElement(r,e,t,n,o){let s=this.V[r];if(s!=null){let a=n||(this.instance.$_useModelForSizes&&s.modelObject.objectType!==ce.objectType?{width:s.width,height:s.height}:this.instance.$getSize(s.el)),l=t&&!isNaN(t.x)&&!isNaN(t.y)?t:null;return l==null&&(l=this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s,a)),this.updateElement(r,l==null?void 0:l.x,l==null?void 0:l.y,a.width,a.height,o,null,e)}else return null}HE(r,e){return this.updateElement(r,null,null,null,null,e,null,!1)}getBoundsWidth(){return this.je.xmax-this.je.xmin}getBoundsHeight(){return this.je.ymax-this.je.ymin}getX(){return this.je.xmin}getY(){return this.je.ymin}setSize(r,e,t){if(this.V[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}$_updatePosition(r,e,t){if(this.V[r]!=null)return this.updateElement(r,e,t,null,null,null,null,!1)}$_updateSize(r,e,t){if(this.V[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}reset(){this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0,this.V={},this.Ja={},this.rtree.clear(),this.hs()}remove(r){ro(r,this.P.xmin),ro(r,this.P.xmax),ro(r,this.P.ymin),ro(r,this.P.ymax),delete this.V[r],delete this.Ja[r],this.rtree!=null&&this.rtree.removeById(r),this.hs()}$computeGroupContentExtents(r,e,t,n,o){let s=r.members.map(l=>l.id),a=t!=null?t[r.id]:null;if(a==null){let l=this.instance.viewport.getGroupElement(r.id);o=o||this.instance.$_getGroupContentAreaInfo(r.id),a={x:l.x+o.internalOffset.x,y:l.y+o.internalOffset.y}}return this.$computeExtentsForElementIds(s,e?null:a.x,e?null:a.y,t,n)}$computeExtentsForElementIds(r,e=0,t=0,n,o){let s=1/0,a=-1/0,l=1/0,h=-1/0;return n=n||{},o=o||{},r.forEach(d=>{var p,m,g,E,y,x,f,b;let u=this.getElement(d);if(u!=null){let A=((p=n[u.id])==null?void 0:p.x)||((m=u.t)==null?void 0:m.x)||u.x,T=((g=n[u.id])==null?void 0:g.y)||((E=u.t)==null?void 0:E.y)||u.y,S=((y=o[u.id])==null?void 0:y.width)||((x=u.t)==null?void 0:x.width)||u.width,R=((f=o[u.id])==null?void 0:f.height)||((b=u.t)==null?void 0:b.height)||u.height;s=Math.min(s,A-e),l=Math.min(l,T-t),a=Math.max(a,A-e+S),h=Math.max(h,T-t+R)}}),{xmin:s,xmax:a,ymin:l,ymax:h}}YE(){this.rtree.clear();let r=Object.values(this.V).map(e=>({id:e.id,x:e.t.x,y:e.t.y,width:e.t.width,height:e.t.height,children:[]}));this.rtree.load(r)}getPosition(r){return this.V[r]}getElements(){return this.V}isEmpty(){return Object.keys(this.V).length===0}getElement(r){return this.V[r]}getElementPosition(r){return this.V[r]!=null?ft(this.V[r]):null}getElementSize(r){return this.V[r]!=null?ei(this.V[r]):null}getElementBounds(r){return this.V[r]!=null?Object.assign(ft(this.V[r]),ei(this.V[r])):null}getGroupElement(r){return this.getElement(r)}getNodeElement(r){return this.getElement(r)}addElement(r,e,t,n,o,s){let a=cD(r);a.el=e;let l=Object.assign(a,{connections:[],modelObject:t,visible:!0});if(this.V[r]=l,Y(t)){let m=a;m.collapsed=!1,m.enabled=!0,m.contentArea=this.instance.$getGroupContentAreaElement(e),m.contentAreaOffset=this.instance.$getElementPositionInUIRelativeToParent(m.contentArea)}let h=n==null?{x:0,y:0}:n,d=o==null?{width:0,height:0}:o,u=s==null?0:s,p=this.updateElement(r,h.x,h.y,d.width,d.height,u,t,!0);return p.el=e,l}getTopLevelExtents(){let r=this.instance.model.graph.getTopLevelElements(),e=Object.keys(r);return e.length===0?{xmin:0,xmax:0,ymin:0,ymax:0}:this.$computeExtentsForElementIds(e,0,0,{},{})}};var uD="currentFace",zv={[Ot]:Lt,[Rt]:_t,[_t]:Rt,[Lt]:Ot},Xv={[Ot]:Rt,[Rt]:Lt,[_t]:Ot,[Lt]:_t},jv={[Ot]:_t,[Rt]:Ot,[_t]:Lt,[Lt]:Rt};function hh(i,r){return i.faces.indexOf(r)!==-1}function pD(i,r){return(i.clockwise?Xv:jv)[r]}function mD(i,r){return(i.clockwise?jv:Xv)[r]}function Gf(i,r,e){let t=()=>hh(i,r)===!0&&!e(r);return i.lockedAxis==null?i.lockedFace==null?t():i.lockedFace===r:i.lockedAxis.indexOf(r)!==-1}function gD(i,r){if(hh(i,r))return r;if(hh(i,zv[r]))return zv[r];{let e=pD(i,r);if(hh(i,e))return e;{let t=mD(i,r);if(hh(i,t))return t}}return r}function Hv(i,r,e){let t={type:i,locations:[{x:0,y:0,offx:0,offy:0,ox:0,oy:0}],currentLocation:0,locked:!1,id:B(),cssClass:e.cssClass||"",isContinuous:!0,timestamp:null,faces:e.faces||r,lockedFace:null,lockedAxis:null,clockwise:e.clockwise!==!1,Jd:null};return Object.defineProperty(t,uD,{get(){return this.Jd},set(n){this.Jd=gD(this,n)}}),t}var kv={Continuous:{faces:[Ot,_t,Lt,Rt]},ContinuousTop:{faces:[Ot]},ContinuousRight:{faces:[Rt]},ContinuousBottom:{faces:[Lt]},ContinuousLeft:{faces:[_t]},ContinuousLeftRight:{faces:[_t,Rt]},ContinuousTopBottom:{faces:[Ot,Lt]}};function ED(i,r){let e=1/0,t=-1;for(let n=0;n<i.locations.length;n++){let o=Math.sqrt(Math.pow(r.x-i.locations[n].x,2)+Math.pow(r.y-i.locations[n].y,2));o<e&&(e=o,t=n,i.currentLocation=n)}return t}var Wv={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},Zv={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},Jv={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},Kv={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},fD={x:0,y:0,ox:0,oy:-1,offx:0,offy:0},yD={x:1,y:0,ox:1,oy:-1,offx:0,offy:0},xD={x:0,y:1,ox:0,oy:1,offx:0,offy:0},bD={x:1,y:1,ox:0,oy:1,offx:0,offy:0},AD={x:.5,y:.5,ox:0,oy:0,offx:0,offy:0},qv={Top:[Wv],Bottom:[Zv],Left:[Jv],Right:[Kv],TopLeft:[fD],TopRight:[yD],BottomLeft:[xD],BottomRight:[bD],Center:[AD],AutoDefault:[Wv,Jv,Zv,Kv]};function Qv(i,r){r=r||{};let e=qv[i];if(e!=null)return $f(i,e.map(n=>Object.assign({iox:n.ox,ioy:n.oy},n)),r,null);let t=kv[i];if(t!=null)return Hv(i,t.faces,r);throw{message:"VisuallyJs: unknown anchor type '"+i+"'"}}function $f(i,r,e,t){return{objectType:sf,type:i,locations:r,currentLocation:0,id:B(),isContinuous:!1,isDynamic:r.length>1,isFixed:t!=null,fixedLocation:t,timestamp:null,cssClass:e.cssClass||""}}function eC(i){return i.type==null&&i.x!=null&&i.y!=null&&i.ox!=null&&i.oy!=null}function fp(i,r,e){let t=St(i);return r!=null&&r<i.length?t.currentLocation=r:e!=null&&ED(t,e),t}function SD(i){return i.objectType===sf}function St(i,r){if(SD(i))return i;if(r!=null&&(isNaN(r.offsetX)&&(r.offsetX=0),isNaN(r.offsetY)&&(r.offsetY=0),isNaN(r.ox)&&(r.ox=0),isNaN(r.oy)&&(r.oy=0)),j(i)){let e=Qv(i,null);return r!=null&&(e.fixedLocation=r,e.isFixed=!0),e}else{if(eC(i))return $f(null,[{x:i.x,y:i.y,ox:i.ox,oy:i.oy,offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY}],{},r);if(Array.isArray(i)){let e=i.map(t=>{if(j(t)){let n=qv[t];return n!=null?Object.assign({iox:n[0].ox,ioy:n[0].oy,cls:""},n[0]):null}else if(eC(t))return Object.assign({iox:t.ox,ioy:t.oy,offx:t.offsetX==null?0:t.offsetX,offy:t.offsetY==null?0:t.offsetY,cls:null},t)}).filter(t=>t!=null);return $f("Dynamic",e,{},null)}else if(i.type!=null){let e=i;return Qv(e.type,e.options)}else throw`Cannot parse anchor specification ${i}`}}var Doe="___sourceMarker",Noe="___targetMarker",xp="__label",oC="vjs-default-label",tC="overlay",TD="labelLocation";function vD(i,r){let e=null;if(j(r))e=at.get(i.instance,r,i,{});else if(r.type!=null&&r.options!=null){let t=r,n=Object.assign({},t.options);e=at.get(i.instance,t.type,i,n)}else e=r;return e.id=e.id||B(),De.cacheTypeItem(i,tC,e,e.id),i.overlays[e.id]=e,e}function ch(i,r){let e=vD(i,r);if(e.type===fr.type&&!j(r)){let t=e,o=r.options.labelLocationAttribute||TD,s=i.edge.data[o];s&&(t.location=s),If(t,i.edge.data)}return e}function Ff(i,r){return i.overlays[r]}function CD(i){return i.overlays}function PD(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!1)}function OD(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!0)}function qo(i,r,e){let t=i.overlays[r];t&&(i.instance.setOverlayVisible(t,!1),e||i.instance.destroyOverlay(t),delete i.overlays[r],i.overlayPositions&&delete i.overlayPositions[r],i.overlayPlacements&&delete i.overlayPlacements[r])}function Ioe(i){return Ff(i,xp)}var rC="add",nC="remove",yp="anchors",Bf="connector";function iC(i,r,e){for(let t in i.overlays)r===rC?i.instance.$addOverlayClass(i.overlays[t],e):r===nC&&i.instance.$removeOverlayClass(i.overlays[t],e)}function sC(i,r,e){let t=null;r.connector!=null&&(t=De.getCachedTypeItem(i,Bf,e.connector),t==null&&(t=er.Kd(i,r.connector,e.connector),De.cacheTypeItem(i,Bf,t,e.connector)),er.setPreparedConnector(i,t)),De.applyType(i,r,e);let n={};function o(h,d){let u=h.options;if(d)return d.updateFrom(u,i.edge.data),n[u.id]=!0,i.instance.$reattachOverlay(d,i),d;{let p=De.getCachedTypeItem(i,tC,u.id);return p!=null?(i.instance.$reattachOverlay(p,i),p.ls!==to&&i.instance.setOverlayVisible(p,!0),p.updateFrom(u,i.edge.data),i.overlays[p.id]=p):p=ch(i,h),n[p.id]=!0,p}}if(r.overlays)for(let h in r.overlays)o(r.overlays[h],i.overlays[r.overlays[h].options.id]);if(r.sourceMarker){let h=i.sourceMarker==null?null:i.sourceMarker.id===r.sourceMarker.options.id?i.sourceMarker:null;i.sourceMarker=o(r.sourceMarker,h)}else i.sourceMarker=null;if(r.targetMarker){let h=i.targetMarker==null?null:i.targetMarker.id===r.targetMarker.options.id?i.targetMarker:null;i.targetMarker=o(r.targetMarker,h)}else i.targetMarker=null;for(let h in i.overlays)i.overlays[h].ignoreTypes!==!0&&n[i.overlays[h].id]==null&&qo(i,i.overlays[h].id,!0);r.detachable!=null&&(i.detachable=r.detachable===!0),r.reattach!=null&&(i.reattach=r.reattach===!0),r.scope&&(i.scope=r.scope);let s=null;r.anchor?(s=De.getCachedTypeItem(i,yp,e.anchor),s==null&&(s=[St(r.anchor),St(r.anchor)],De.cacheTypeItem(i,yp,s,e.anchor))):r.anchors&&(s=De.getCachedTypeItem(i,yp,e.anchors),s==null&&(s=[St(r.anchors[0]),St(r.anchors[1])],De.cacheTypeItem(i,yp,s,e.anchors))),s!=null&&(i.anchors.source=s[0],i.anchors.target=s[1]);let a={};i.instance.$_extractSimpleEdgeStyles(r,a)&&i.instance.$_setLineStyle(i,a,!1),i.instance.$applyConnectorType(i.connector,r)}function Wr(i,r){De.addClass(i,r),iC(i,rC,r),i.connector&&i.instance.$addConnectorClass(i.connector,r)}function Or(i,r){De.removeClass(i,r),iC(i,nC,r),i.connector&&i.instance.$removeConnectorClass(i.connector,r)}var er={getAbsoluteOverlayPosition(i,r){return i.overlayPositions?i.overlayPositions[r.id]:null},setPreparedConnector(i,r,e,t,n){if(i.connector!==r){let o,s="";if(i.connector!=null&&(o=i.connector,s=i.instance.$getConnectorClass(i.connector),i.instance.$destroyConnector(i)),i.connector=r,n&&De.cacheTypeItem(i,Bf,r,n),Wr(i,s),o!=null){let a=CD(i);for(let l in a)i.instance.$reattachOverlay(a[l],i)}e||i.instance.$paintConnection(i)}},destroy(i){for(let r in i.overlays)i.instance.destroyOverlay(i.overlays[r]);i.overlays={},i.overlayPositions={},i.sourceElement=null,i.targetElement=null,i.instance.$destroyConnector(i),i.connector=null,De.destroy(i)},setVisible(i,r){De.setVisible(i,r),r?OD(i):PD(i),i.connector&&i.instance.$setConnectorVisible(i.connector,r),i.instance.$paintConnection(i)},Kd(i,r,e){let t={},n;if(j(r))n=$e.get(i,r,t);else{let o=r;n=$e.get(i,o.type,bn(o.options||{},t))}return e!=null&&(n.typeId=e),n},qd(i,r,e,t,n){let o=er.Kd(i,r,n);er.setPreparedConnector(i,o,e,t,n)}};function Uf(i){return i==null?null:i.split(" ").filter(r=>r!=null&&r.length>0)}function aC(i,r,e){for(let t in r)i[t]=e}var _D="connector",RD="override",LD="cssClass",lC="__default",wD="anchor",DD="anchors";function bp(i,r){let e={},t=i.$defaultType,n=Object.assign({},t);return aC(e,t,lC),i.$types.forEach(o=>{if(o!==lC){let s=i.instance.$getConnectionType(o);if(s!=null){let a=new Set([_D,wD,DD]);if(s.mergeStrategy===RD)for(let l in s)a.add(l);n=bn(n,s,[LD],Array.from(a)),aC(e,s,o)}}}),r&&(n=Po(n,r,"_")),ma(i)&&sC(i,n,e),e}function ma(i){return i.objectType===Yf}var Yf="connection";function hC(i,r){let e=i.instance.$getConnectionType(r);e!=null&&e.cssClass&&ma(i)&&Or(i,e.cssClass)}function Ap(i){if(i.paintStyle&&i.hoverPaintStyle){let r={};Object.assign(r,i.paintStyle),Object.assign(r,i.hoverPaintStyle),i.hoverPaintStyle=r}}var Hoe="add",koe="remove";function cC(i,r,e){return e=e||{},{cssClass:e.cssClass||"",hoverClass:e.hoverClass||i.defaults.hoverClass,$types:new Set,$typeCache:{},id:e.id||B(),$defaultType:{scope:e.scope||i.defaultScope,overlays:{}},instance:i,deleted:!1,objectType:r,visible:!0,$hover:!1,paintStyle:{},paintStyleInUse:{},hoverPaintStyle:{}}}var De={create(i,r,e){e=e||{};let t=e.cssClass||"",n=e.hoverClass||i.defaults.hoverClass,o=new Set,s={},a=e.id||r+new Date().getTime(),l={scope:e.scope||i.defaultScope,overlays:{}};return{cssClass:t,instance:i,hoverClass:n,$types:o,$typeCache:s,$defaultType:l,id:a}},addClass(i,r){let e=(i.cssClass||"").split(" ");e.push(r),i.cssClass=e.join(" ")},removeClass(i,r,e){let t=(i.cssClass||"").split(" ");i.cssClass=t.filter(n=>n!==r).join(" ")},cacheTypeItem(i,r,e,t){i.$typeCache[t]=i.$typeCache[t]||{},i.$typeCache[t][r]=e},hasType(i,r){return i.$types.has(r)},removeType(i,r,e){let t=Uf(r),n=!1,o=s=>i.$types.has(s)?(hC(i,s),i.$types.delete(s),!0):!1;if(t!=null){for(let s=0,a=t.length;s<a;s++)n=o(t[s])||n;n&&bp(i,e)}},addType(i,r,e){let t=Uf(r),n=!1;if(t!=null){for(let o=0,s=t.length;o<s;o++)i.$types.has(t[o])||(i.$types.add(t[o]),n=!0);n&&bp(i,e)}},getCachedTypeItem(i,r,e){return i.$typeCache[e]?i.$typeCache[e][r]:null},setPaintStyle(i,r){i.paintStyle=r,i.paintStyleInUse=i.paintStyle,Ap(i)},setHoverPaintStyle(i,r){i.hoverPaintStyle=r,Ap(i)},getType(i){return Array.from(i.$types.keys())},clearTypes(i,r){i.$types.forEach(e=>{hC(i,e)}),i.$types.clear(),bp(i,r)},setType(i,r,e){return De.clearTypes(i),(Uf(r)||[]).forEach(i.$types.add,i.$types),bp(i,e)},applyType(i,r,e){De.setPaintStyle(i,r.paintStyle),De.setHoverPaintStyle(i,r.hoverPaintStyle),i.paintStyleInUse=i.paintStyle},appendToDefaultType(i,r){Object.assign(i.$defaultType,r)},destroy(i){i.deleted=!0,delete i.instance},setVisible(i,r){i.visible=r}};function dC(i,r){return r.theta-i.theta}function uC(i,r){let e=i.theta<0?-Math.PI-i.theta:Math.PI-i.theta,t=r.theta<0?-Math.PI-r.theta:Math.PI-r.theta;return e-t}var pC={[Ot]:uC,[Rt]:dC,[Lt]:dC,[_t]:uC};function mC(i,r,e,t,n){let o=e?i.width:i.height,s=e?i.height:i.width,a=[],l=o/(r.length+1);for(let h=0;h<r.length;h++){let d=(h+1)*l,u=t*s;n&&(d=o-d);let p=e?d:u,m=i.x+p,g=i.width===0?0:p/i.width,E=e?u:d,y=i.y+E,x=i.height===0?0:E/i.height;if(i.r!==0&&i.r!=null){let f=Ie({x:m,y},i.c,i.r);m=f.x,y=f.y}a.push({x:m,y,xLoc:g,yLoc:x,c:r[h].c,a:r[h].anchor})}return a}function Qo(i){return!i.isFixed&&i.isContinuous===!0}function gC(i){return[i.currentLocation,i.locations[i.currentLocation]]}function use(i,r,e,t,n){let o={x:i.x+t*r,y:i.y+t*e},s=Dt(i,o,n),a=Dt(o,i,n),l=Math.min(s[0].x,s[1].x,a[0].x,a[1].x),h=Math.max(s[0].x,s[1].x,a[0].x,a[1].x),d=Math.min(s[0].y,s[1].y,a[0].y,a[1].y),u=Math.max(s[0].y,s[1].y,a[0].y,a[1].y);return{x:l,y:d,width:h-l,height:u-d}}function Sp(i,r,e,t){let n,o=t.rotation,s={curX:r.x+i.x*e.width+(isNaN(i.offsetX)?0:i.offsetX),curY:r.y+i.y*e.height+(isNaN(i.offsetY)?0:i.offsetY),x:i.x,y:i.y,ox:i.ox,oy:i.oy};if(o!=null&&o.length>0&&!(o.length===0&&o[0].r===0)){let a=[i.ox,i.oy],l={x:s.curX,y:s.curY,cr:0,sr:0};o.forEach(h=>{l=Ie(l,h.c,h.r),a=[Math.round(a[0]*l.cr-a[1]*l.sr),Math.round(a[1]*l.cr+a[0]*l.sr)].slice()}),n={curX:l.x,curY:l.y,x:i.x,y:i.y,ox:a[0],oy:a[1]}}else n=Object.assign({},s);return n}function EC(i,r,e,t,n,o,s,a){let l=Ir(r),h=XA(r),d=s(e,t,l,h);d.sort((p,m)=>{let g=p.axis===l&&p.directionFromParent===r.directionFromParent,E=p.axis===l&&p.directionFromParent!==r.directionFromParent,y=m.axis===l&&m.directionFromParent===r.directionFromParent,x=m.axis===l&&m.directionFromParent!==r.directionFromParent;return g||x?-1:y||E?1:0});let u=[];for(let p=0;p<d.length;p++){let m=d[p],g=e+m.dx,E=t+m.dy,y=m.axis,x=m.directionFromParent,f=r.ax+m.dx*n,b=r.ay+m.dy*n,A=i.getCell(g,E,null,null),T=A===a,S={cx:g,cy:E,obj:A,axis:y,directionFromParent:x,ax:f,ay:b,g:r.g+(g-r.x===0||E-r.y===0?1:Math.SQRT2),obstacles:A.obstacles,buffers:A.buffers,isTarget:T};if(A===a)return[S];u.push(S)}return u}function zf(i){let r=[],e=Ir(i),t=i,n=!1,o=0;for(;!n&&t!=null;)r.push(t),o++,Ir(t)!==e&&(n=!0),t=t.parent;return r.length===0?null:{source:i,target:r[r.length-1],isFirstSegment:r[r.length-1].parent==null,axis:Ir(i),length:o}}function ND(i){return i.axis===Tn||i.axis===ii}function ID(i){return i.axis===pe&&i.source.ax===i.target.ax||i.axis===ne&&i.source.ay===i.target.ay}function fC(i,r,e){r.push({ax2:i.source.ax,ay2:i.source.ay,ax1:i.target.ax,ay1:i.target.ay,axis:i.axis,pathId:e})}function MD(i,r,e){if(ND(i)||ID(i))fC(i,r,e);else{let t=i.axis===ne?(i.source.ax+i.target.ax)/2:i.source.ax,n=i.axis===pe?(i.source.ay+i.target.ay)/2:i.source.ay,o=i.axis===ne?(i.source.ax+i.target.ax)/2:i.target.ax,s=i.axis===pe?(i.source.ay+i.target.ay)/2:i.target.ay,a=i.axis===pe?ne:pe,l={ax2:i.source.ax,ay2:i.source.ay,ax1:t,ay1:n,axis:i.axis,pathId:e};r.push(l);let h={ax2:t,ay2:n,ax1:o,ay1:s,axis:a,pathId:e};r.push(h);let d={ax2:o,ay2:s,ax1:i.target.ax,ay1:i.target.ay,axis:a,pathId:e};r.push(d)}}function yC(i,r,e){if(e===ne)return[{x:i-50,y:r},{x:i+50,y:r}];if(e===pe)return[{x:i,y:r-50},{x:i,y:r+50}];if(e===Tn)return[{x:i+50,y:r+50},{x:i-50,y:r-50}];if(e===ii)return[{x:i-50,y:r+50},{x:i+50,y:r-50}]}function Xf(i,r,e,t,n,o){let s=i,a=[];n=n||B();let l=zf(s);if(l.isFirstSegment)t===nn?fC(l,a,n):MD(l,a,n);else{let d=l.source.ax,u=l.source.ay,p=!1,m=zf(l.target);for(;!p&&m!=null;){let g=yC(d,u,l.axis),E;E=yC(m.isFirstSegment?m.target.ax:m.target.cx,m.isFirstSegment?m.target.ay:m.target.cy,m.axis);let y=Ub(g,E);y!=null&&(a.push({ax1:y.x,ay1:y.y,ax2:d,ay2:u,axis:l.axis,pathId:n}),d=y.x,u=y.y,l=m),m.isFirstSegment?p=!0:m=zf(m.target)}m!=null&&a.push({ax1:m.target.ax,ay1:m.target.ay,ax2:d,ay2:u,pathId:n,axis:m.axis})}return a.reverse(),{id:n,segments:a,targetCell:i,sourceCell:r,isEmpty:a.length===0}}function xC(i,r,e,t,n,o){let s=Xf(i,r,e,t,o,!1);if(s.segments.length<2)return s;let a=[],l=0,h=!1;function d(u){let p={x:s.segments[u].ax1,y:s.segments[u].ay1},m=u+1,g=!1;for(;!g;){let E=s.segments[m];if(E==null||!n(e,[p,{x:E.ax2,y:E.ay2}]))return{startIdx:u,endIdx:m-1,segment:{ax1:p.x,ay1:p.y,ax2:s.segments[m-1].ax2,ay2:s.segments[m-1].ay2},finished:E==null};m++}}for(;!h;){let u=d(l);a.push(u.segment),u.finished?h=!0:l=u.endIdx+1}return{targetCell:s.targetCell,sourceCell:s.sourceCell,isEmpty:s.isEmpty,segments:a,id:s.id}}function bC(i,r,e,t,n,o,s,a,l,h,d,u,p,m,g,E,y){E==null?E=new Ys(i,r,s,h,d,u):E.reinitialize();let x=E.Zo(i.x,i.y),f=E.Zo(r.x,r.y),b=NE(n);b.axis==null&&(b.axis=zA(i,r));let A=NE(o),T=E.setSourceCell(e,x.x,x.y,i.x,i.y,b.axis,b.direction),S=E.setTargetCell(t,f.x,f.y,r.x,r.y,A.axis,A.direction);if(S.x===T.x&&S.y===T.y)return{targetCell:S,sourceCell:T,segments:[],id:wE,isEmpty:!0};S.fixedAxis=S.fixedAxis||b.axis;let R=T,v=S,O=()=>a===nn?xC(v,R,E,a,g,y):Xf(v,R,E,a,y,!0),P=new _d,I=new Ds(P.sort.bind(P),T),C,_,w=Yc(T.x,T.y,S.x,S.y)*100,$=0;for(;I.length>0;){if(C=I.pop(),C.closed=!0,_=Ir(C),$++,$>w)throw`too many iterations ${$} `;if(C===S)return O();P.node=C;let N=EC(E,C,C.x,C.y,s,u,m,S);for(let M=0,D=N.length;M<D;M++){let V=N[M];if(V.isTarget)return V.obj.parent=C,O();if(V.obj.closed||V.obj===T||V.obj===S||V.obstacles.length>0||V.buffers.length>0)continue;let J=0;V.axis!==_&&(J=.5),(!V.obj.opened||V.g<V.obj.g)&&(V.obj.g=V.g,V.obj.h=l(V.cx,V.cy,S.x,S.y)+J,V.obj.f=V.obj.g+V.obj.h,V.obj.parent=C,V.obj.ax=V.ax,V.obj.ay=V.ay,V.obj.opened?I.update(V.obj):(I.add(V.obj),V.obj.opened=!0))}}return{targetCell:S,sourceCell:T,segments:[],id:wE,isEmpty:!0}}function AC(i,r,e,t,n,o,s,a,l,h,d,u,p,m){return bC(i,r,e,t,n,o,a,l,h,d,u,s.findVerticesAtPoint.bind(s),s.findVerticesIntersectingWithRect.bind(s),(g,E,y,x)=>{if(l===nn||l==null)return DE(g,E,y,x);if(l===ad)return DE(g,E,y,x);if(l===on)return UA(g,E,y,x)},(g,E)=>{let y=a*d;return s.hasLineOfSight(E,y,g.sourceAndTargetObstacles)},p,m)}var VD=10;function GD(i,r,e,t,n,o,s){let a=t.x+i.x*n.width,l=t.y+i.y*n.height;if(o!=null&&o.length>0){let h=Kb([a,l,0,0],o);a=h.x,l=h.y}return Math.sqrt(Math.pow(r-a,2)+Math.pow(e-l,2))}var dh=class{constructor(r,e){this.instance=r;c(this,"Qd");c(this,"$anchorLists",new Map);c(this,"eu");c(this,"Di");c(this,"Ni");c(this,"Ii");c(this,"cs",new Map);c(this,"tu",null);c(this,"gt");e=e||{},this.Di=e.gridCellSize||VD,this.eu=e.avoidVertices===!0,this.Ni=e.vertexBuffer||2,this.Ii=e.vertexBorder||2}$computePath(r,e){let t=this.instance.viewport.getPosition(r.sourceId),n=this.instance.viewport.getPosition(r.targetId),o=r.connector,s=ft(t),a=ei(t),l=ft(n),h=ei(n),d=this.instance.$getRotations(r.sourceId),u=this.instance.$getRotations(r.targetId);if(H(t.modelObject)){let x=this.instance.getElement(t.modelObject.parent.id);if(x.r!==0){let f={x:s.x+a.width/2,y:s.y+a.height/2},b=Ie(f,x.c,x.r);s.x=b.x-a.width/2,s.y=b.y-a.height/2,d.pop(),d.push({r:x.r,c:b})}}if(H(n.modelObject)){let x=this.instance.getElement(n.modelObject.parent.id);if(x.r!==0){let f={x:l.x+h.width/2,y:l.y+h.height/2},b=Ie(f,x.c,x.r);l.x=b.x-h.width/2,l.y=b.y-h.height/2,u.pop(),u.push({r:x.r,c:b})}}let p=this.ru(r.anchors.source,{xy:s,wh:a,elementId:t.id,timestamp:e,rotation:d,txy:l,twh:h}),m=this.ru(r.anchors.target,{xy:l,wh:h,elementId:n.id,timestamp:e,rotation:u,txy:s,twh:a});HT(r.connector);let g={sourcePos:p,targetPos:m,strokeWidth:r.paintStyleInUse.strokeWidth,sourceInfo:t,targetInfo:n};o.paintInfo=Ef(o,g),mf(o),o.x=o.paintInfo.x,o.y=o.paintInfo.y,o.quadrant=o.paintInfo.quadrant;let E=o.geometry==null||o.geometry.source==null?!1:!bf(p,o.geometry.source),y=o.geometry==null||o.geometry.target==null?!1:!bf(m,o.geometry.target);if(this.instance.$_discardEdgeEditsOnDrag&&(E||y)&&ji(r),o.edited){let x=this.kE(r,o,g,e,E,y);$e.setGeometry(r,x,!1)}else{let x=this.WE(r,o,g,e);$e.setGeometry(r,x,!0)}gf(o),o.width=Math.max(10,o.bounds.xmax-o.x),o.height=Math.max(10,o.bounds.ymax-o.y)}$connectionDetachedFromElement(r,e){this.ZE(r,e)}$connectionRemoved(r){Qo(r.connection.anchors.source)&&this.nu(r.connection.sourceId,r.connection.anchors.source),Qo(r.connection.anchors.target)&&this.nu(r.connection.targetId,r.connection.anchors.target)}$elementRemoved(r){r!=null&&this.$anchorLists.delete(r.id)}$redrawConnections(r,e){let t=new Set,n=new Set;if(!this.instance.ft){e=e||B();let o={};for(let s=0;s<r.length;s++){let a=r[s];if(a.visible===!1)continue;t.add(a);let l=a.sourceId,h=a.targetId,d=Qo(a.anchors.source),u=Qo(a.anchors.target);if(d||u){let p=(a.anchors.source.faces||[]).join("-"),m=(a.anchors.target.faces||[]).join("-"),g=[l,p,h,m].join("-"),E=o[g];d&&!this.$anchorLists.has(l)&&this.$anchorLists.set(l,{top:[],right:[],bottom:[],left:[]}),u&&!this.$anchorLists.has(h)&&this.$anchorLists.set(h,{top:[],right:[],bottom:[],left:[]});let y=this.instance.viewport.getPosition(h),x=this.instance.viewport.getPosition(l);if(h===l&&(d||u))this.ds(l,a.anchors.source,-Math.PI/2,0,a,h,0,!1,Se,t),this.ds(h,a.anchors.target,-Math.PI/2,0,a,l,1,!1,Se,t);else{let f=this.instance.$getRotations(l),b=this.instance.$getRotations(h);E||(E=this.JE(l,h,x,y,a.anchors.source,a.anchors.target,f,b,a,a.connector.sourceStub+a.connector.targetStub,e,g),o[g]=E),d&&this.ds(l,a.anchors.source,E.theta,0,a,h,0,!1,E.a[0],t),u&&this.ds(h,a.anchors.target,E.theta2,-1,a,l,1,!0,E.a[1],t)}d&&n.add(l),u&&n.add(h)}}n.forEach(s=>{this.KE(s,this.$anchorLists.get(s))})}return t}$reset(){this.$anchorLists.clear(),this.cs.clear()}ZE(r,e){let t=this.$anchorLists.get(e.id),n=0;t!=null&&function(o){if(o){let s=a=>a.c.id===r.id;Nt(o.top,s),Nt(o.left,s),Nt(o.bottom,s),Nt(o.right,s),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t),n===0&&this.$anchorLists.delete(e.id)}qE(r,e){let t;if(r.isFixed&&r.fixedLocation!=null)t=Sp(r.fixedLocation,e.xy,e.wh,e);else{let n=e.xy,o=e.wh,s=e.txy,a=e.twh,[l,h]=gC(r);if(r.locations.length===1||s==null||a==null)t=Sp(h,n,o,e);else{let[d,u]=this.QE(n,o,s,a,e.rotation,e.tRotation,r.locations,e.otherAnchor);d!==l&&(r.currentLocation=d),t=Sp(u,n,o,e)}}return r.computedPosition=t,t}KE(r,e){let t=this.instance.viewport.getPosition(r),n=(o,s,a,l,h,d)=>{if(a.length>0){let u=a.sort(pC[o]),p=o===yt||o===Se,m=mC(t,u,l,h,p);for(let g=0;g<m.length;g++)m[g].a.locations[0]={x:m[g].xLoc,y:m[g].yLoc,ox:d.x,oy:d.y,offsetX:0,offsetY:0},m[g].a.currentLocation=0}};n(ht,t,e.bottom,!0,1,{x:0,y:1}),n(Se,t,e.top,!0,0,{x:0,y:-1}),n(He,t,e.left,!1,0,{x:-1,y:0}),n(yt,t,e.right,!1,1,{x:1,y:0})}ds(r,e,t,n,o,s,a,l,h,d){this.$anchorLists.has(r)||this.$anchorLists.set(r,{top:[],right:[],bottom:[],left:[]});let u=this.$anchorLists.get(r),p=-1,m=-1,g={theta:t,order:n,c:o,elId:s,anchor:e},E=u[h],y=e.currentFace?u[e.currentFace]:null,x;if(y){let f=y.findIndex(b=>b.anchor.id===e.id);if(f!==-1){y.splice(f,1);for(let b=0;b<y.length;b++)x=y[b].c,x.placeholder!==!0&&d.add(x)}}for(let f=0;f<E.length;f++)x=E[f].c,x.placeholder!==!0&&d.add(x);if(p!==-1)E[p]=g;else{let f=l?m!==-1?m:0:E.length;E.splice(f,0,g)}e.currentFace=h}nu(r,e){let t=this.$anchorLists.get(r),n=0;t!=null&&function(o,s){if(o){let a=l=>l.anchor.id===s;Nt(o.top,a),Nt(o.left,a),Nt(o.bottom,a),Nt(o.right,a),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t,e.id),n===0&&this.$anchorLists.delete(r)}ru(r,e){let t=this.qE(r,e);return r.computedPosition=t,r.timestamp=e.timestamp,t}WE(r,e,t,n){return this.eu||r.avoidVertices?this.ef(r,e,t,n):this.us(r,e,t)}kE(r,e,t,n,o,s){return $e.update(r,e.paintInfo,t,o,s)}us(r,e,t){return $e.compute(r,e.paintInfo,t)}ef(r,e,t,n){if(e.edited)this.us(r,e,t);else{let o=e,s=SC(t.sourcePos,e.sourceGap),a=SC(t.targetPos,e.targetGap),l={x:s.curX+e.sourceStub*s.ox,y:s.curY+e.sourceStub*s.oy},h={x:a.curX+e.targetStub*a.ox,y:a.curY+e.targetStub*a.oy},d=Math.min(l.x,h.x),u=Math.max(l.x,h.x),p=Math.min(l.y,h.y),m=Math.max(l.y,h.y),g={x:d,y:p,width:Math.max(u-d,10),height:Math.max(m-p,10)};if(!this.instance.viewport.hasVerticesIntersectingWithRect(g,0,[],!1))return this.us(r,e,t);(this.gt==null||n!==this.Qd)&&(this.gt=new Ys(l,h,this.Di,this.Ii,this.Ni,(E,y,x)=>this.instance.viewport.findVerticesAtPoint(E,y,x))),this.Qd=n;try{let E=r.edge?r.edge.id:r.id,y=AC(l,h,r.sourceId,r.targetId,s,a,this.instance.viewport,this.Di,o.constrain,Yc,this.Ii,this.Ni,this.gt,E);if(y.isEmpty)$e.compute(r,e.paintInfo,t);else{y.segments.unshift({ax1:s.curX,ay1:s.curY,ax2:l.x,ay2:l.y,axis:Us(s.ox,s.oy),pathId:E}),y.segments.push({ax1:h.x,ay1:h.y,ax2:a.curX,ay2:a.curY,axis:Us(a.ox,a.oy),pathId:E});let x=Sf(y.segments.map(b=>Object.assign({x1:b.ax1,y1:b.ay1,x2:b.ax2,y2:b.ay2,o:b.axis||$D(b)},b)));return Ju(r.connector,x),{segments:o.$pathSegments,source:t.sourcePos,target:t.targetPos,quadrant:e.paintInfo.quadrant}}}catch(E){return this.us(r,e,t)}}}JE(r,e,t,n,o,s,a,l,h,d,u,p){if(u===this.tu){let v=this.cs.get(p);if(v!=null)return v}else this.cs.clear();this.tu=u;let m={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"};if(r===e)return{orientation:m.IDENTITY,a:[Se,Se]};let g=Math.atan2(n.c.y-t.c.y,n.c.x-t.c.x),E=Math.atan2(t.c.y-n.c.y,t.c.x-n.c.x),y=[],x={};((v,O)=>{for(let P=0;P<v.length;P++)if(x[v[P]]={[He]:{x:O[P][0].x,y:O[P][0].c.y},[yt]:{x:O[P][0].x+O[P][0].width,y:O[P][0].c.y},[Se]:{x:O[P][0].c.x,y:O[P][0].y},[ht]:{x:O[P][0].c.x,y:O[P][0].y+O[P][0].height}},O[P][1]!=null&&O[P][1].length>0)for(let I in x[v[P]])x[v[P]][I]=qb(x[v[P]][I],O[P][1])})([it,vn],[[t,a],[n,l]]);let f=[Se,He,yt,ht];for(let v=0;v<f.length;v++)for(let O=0;O<f.length;O++)y.push({source:f[v],target:f[O],dist:Math.round(Ue(x.source[f[v]],x.target[f[O]]))});y.sort(function(v,O){if(v.dist<O.dist)return-1;if(O.dist<v.dist)return 1;{let P={[He]:0,[Se]:1,[yt]:2,[ht]:3},I=P[v.source],C=P[O.source],_=P[v.target],w=P[O.target];return I<C?-1:C<I?1:_<w?-1:w<_?1:0}});let b=y[0].source,A=y[0].target,T={},S={};for(let v=0;v<y.length;v++){let O=y[v];if(!Qo(o)||Gf(o,O.source,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(T[P]==null){let I=h.connector.sourceGap+h.connector.sourceStub,C=af[P],_=this.Di*(this.Ii+this.Ni),w={x:x.source[P].x+I*C.x,y:x.source[P].y+I*C.y,width:Math.max(1,Math.abs(_*C.x)),height:Math.max(1,Math.abs(_*C.y))};T[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[r],!1)}return T[P]})?b=y[v].source:b=null,!Qo(s)||Gf(s,O.target,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(S[P]==null){let I=h.connector.targetGap+h.connector.targetStub,C=af[P],_=this.Di*(this.Ii+this.Ni),w={x:x.target[P].x+I*C.x,y:x.target[P].y+I*C.y,width:Math.max(1,Math.abs(_*C.x)),height:Math.max(1,Math.abs(_*C.y))};S[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[e],!1)}return S[P]})?A=y[v].target:A=null,b!=null&&A!=null)break}b==null&&(b=y[0].source),A==null&&(A=y[0].target);let R={a:[b,A],theta:g,theta2:E};return this.cs.set(p,R),R}QE(r,e,t,n,o,s,a,l){if(l!=null){let h=a.map((p,m)=>{let g=r.x+p.x*e.width,E=r.y+p.y*e.height;return{x:g,y:E,idx:m}}),d=l.locations.map((p,m)=>{let g=t.x+p.x*n.width,E=t.y+p.y*n.height;return{idx:m,x:g,y:E}}),u=[];for(let p=0;p<h.length;p++)for(let m=0;m<d.length;m++){let g=Math.round(Ue(h[p],d[m]));u.push({d:g,idx:p,idx2:m})}return u.sort((p,m)=>p.d-m.d),[u[0].idx,a[u[0].idx]]}else{let h=t.x+n.width/2,d=t.y+n.height/2,u=a.map((p,m)=>({d:GD(p,h,d,r,e,o,s),idx:m}));return u.sort((p,m)=>p.d-m.d),[u[0].idx,a[u[0].idx]]}}};c(dh,"type",be);function $D(i){return i.axis!=null?i.axis:i.ax1===i.ax2?pe:i.ay1===i.ay2?ne:null}function SC(i,r){return{curX:i.curX+i.ox*r,curY:i.curY+i.oy*r,ox:i.ox,oy:i.oy,x:i.x,y:i.y}}var TC="fill",jf="stroke",vC="stroke-width",hle="strokeWidth",Le="svg",CC="defs",ee="path",ke="circle",PC="ellipse",et="text",Hf="tspan",Z="rect",q="g",cle="version",dle="xmlns",ule="fill",kf="stroke-dasharray",ple="stroke-linejoin",mle="stroke-linecap",gle="stroke-miterlimit",Ele="stroke-dashoffset",fle="stroke-opacity",yle="stroke",xle="stroke-width",Tp="vector-effect",vp="non-scaling-stroke",ble="text-anchor",Gt="http://www.w3.org/2000/svg",Ale="http://www.w3.org/1999/xlink",Sle="http://www.w3.org/1999/xhtml";var Cp=class{constructor(r,e){c(this,"$properties");c(this,"$values");this.$values=e||{},this.$properties=Object.keys(e),r.bindAll([Re,Te],t=>{this.$properties.forEach(n=>{t.updates[n]!=null&&(this.$values[n]=t.updates[n])})})}getValue(r,e){return this.$values[r]||e}getValues(){return Object.assign({},this.$values)}};var BD=.5;function OC(i,r){var b,A;let e=cC(i,Yf,r),t=r.overlays||[],n={},o=i.$defaultOverlays;o&&t.push(...o);for(let T=0;T<t.length;T++){let S=mi(t[T]);n[S.options.id]=S}if(e.$defaultType.overlays=n,r.label&&(e.$defaultType.overlays[xp]={type:fr.type,options:{label:r.label,useHTMLElement:r.useHTMLLabel===!0,location:r.labelLocation||BD,id:xp,cssClass:oC,rotatable:r.labelsRotatable}}),r.sourceMarker){let T=mi(r.sourceMarker);T.options.location=0,T.options.direction=-1,T.sourceMarker=!0,e.$defaultType.sourceMarker=T}if(r.targetMarker){let T=mi(r.targetMarker);T.options.location=1,T.options.direction=1,T.targetMarker=!0,e.$defaultType.targetMarker=T}let s=r.source,a=r.target,l=(r.anchors?r.anchors[0]:r.anchor)||i.$defaultAnchors[0]||i.$defaultAnchor,h=(r.anchors?r.anchors[1]:r.anchor)||i.$defaultAnchors[1]||i.$defaultAnchor,d=(b=r.edge.anchors)==null?void 0:b.source,u=(A=r.edge.anchors)==null?void 0:A.target,p=St(l,d),m=St(h,u),g=i.$_edgesDetachable;r.detachable===!1&&(g=!1);let E=i.$_reattachEdges===!0,y=ks({},r.paintStyle||i.defaults.paintStyle);De.appendToDefaultType(e,{detachable:g,reattach:E,paintStyle:y,hoverPaintStyle:ks({},r.hoverPaintStyle||i.defaults.hoverPaintStyle)}),r.outlineWidth&&(y.outlineWidth=r.outlineWidth),r.outlineColor&&(y.outlineStroke=r.outlineColor),r.lineWidth&&(y.strokeWidth=r.lineWidth),r.color&&(y.stroke=r.color),r.gradient&&(y.gradient=r.gradient),r.dashArray&&(y.dashArray=r.dashArray);let x=Object.assign(e,{anchorDefs:{source:l,target:h},anchors:{source:p,target:m},sourceId:r.edge.source.getFullId(),sourceElement:s,targetId:r.edge.target.getFullId(),targetElement:a,scope:r.scope,lastPaintedAt:null,visible:!0,paintStyle:r.paintStyle,hoverPaintStyle:r.hoverPaintStyle,detachable:g,reattach:E,edge:r.edge,suspendedElement:null,suspendedElementId:null,suspendedElementType:null,suspendedEndpoint:null,suspendedIndex:null,overlays:{},overlayPlacements:{},overlayPositions:{},connector:null,proxies:{[it]:[],[vn]:[]},avoidVertices:r.avoidVertices===!0,sourceMarker:null,targetMarker:null});er.qd(x,r.connector||i.$defaultConnector,!0);let f=[be,r.type].join(" ");return/[^\s]/.test(f)&&De.addType(x,f,r.data),x}var uh=class{constructor(r){c(this,"grid");c(this,"snap",!1);c(this,"fitGroupsToGrid",!1);r!=null&&(this.snap=r.snap===!0,this.grid=r.size,this.fitGroupsToGrid=r.fitGroupsToGrid!==!1)}};var Pp=class{constructor(r){c(this,"afterGroupCollapse");c(this,"afterGroupExpand");c(this,"afterGroupResize");c(this,"afterGroupShrink");c(this,"afterGroupGrow");c(this,"afterLayout");c(this,"afterDrag");c(this,"constant");c(this,"trackback");c(this,"trackbackThreshold");c(this,"constrainToViewport");c(this,"repositionDraggedElement");c(this,"grid");r=r||{},this.afterDrag=r.afterDrag===!0,this.constant=r.constant===!0,this.trackback=r.trackback!==!1,this.trackbackThreshold=r.trackbackThreshold,this.constrainToViewport=r.constrainToViewport===!0,this.repositionDraggedElement=r.repositionDraggedElement===!0,this.afterLayout=r.afterLayout===!0,this.afterGroupResize=r.afterGroupResize===!0,this.afterGroupShrink=r.afterGroupShrink===!0||this.afterGroupResize&&r.afterGroupShrink!==!1,this.afterGroupGrow=r.afterGroupGrow===!0||this.afterGroupResize&&r.afterGroupGrow!==!1,this.afterGroupCollapse=r.afterGroupCollapse===!0,this.afterGroupExpand=r.afterGroupExpand===!0,this.constant&&this.afterDrag&&(this.constant=!1),this.constant&&(this.repositionDraggedElement=!1)}};var _C={},cn={get:i=>{let r=_C[i];if(!r)U("WARN: VisuallyJs: unknown UI plugin '"+i+"'");else return new r},register:(i,r)=>{_C[i]=r}};function Je(i){return function(r){cn.register(i,r)}}function Op(i,r,e,t,n,o,s){s=s||r.minSize;let a=r.maxSize,l=r.padding||0,h=(s==null?void 0:s.width)||0,d=(s==null?void 0:s.height)||0,u=0,p=0;isFinite(i.xmin)&&i.xmin<l&&n&&(u=l-i.xmin),isFinite(i.ymin)&&i.ymin<l&&n&&(p=l-i.ymin);let m=(isFinite(i.xmax)?i.xmax:0)+u+l,g=(isFinite(i.ymax)?i.ymax:0)+p+l,E=Math.min((a==null?void 0:a.width)||m,m),y=Math.min((a==null?void 0:a.height)||g,g);if(E=Math.max(h,E),y=Math.max(d,y),e){if(isFinite(i.xmin)&&i.xmin>l&&t){let x=i.xmin-l,f=E-x;E=Math.max((s==null?void 0:s.width)||f,f),E>f&&(x-=E-f),u=-x}if(isFinite(i.ymin)&&i.ymin>l&&t){let x=i.ymin-l,f=y-x;y=Math.max((s==null?void 0:s.height)||f,f),y>f&&(x-=y-f),p=-x}}if(o.grid&&o.fitGroupsToGrid!==!1){let x=E/o.grid.width;E=o.grid.width*Math.ceil(x);let f=y/o.grid.height;y=o.grid.height*Math.ceil(f);let b=u/o.grid.width;u=o.grid.width*Math.ceil(b);let A=p/o.grid.height;p=o.grid.height*Math.ceil(A)}return{width:E,height:y,layoutShiftX:u,layoutShiftY:p}}function RC(i,r,e,t){let n=i.$_connMap[r.id];if(n){if(n.proxies==null||n.proxies[e]==null||n.proxies[e].length===0)return;let o=n.proxies[e].pop(),s=o.originalElement,a=o.element,l=o.originalAnchor;return t!=null&&(l=St(t)),i.$sourceOrTargetChanged(a.id,s.id,n,s.el,e),e===it?n.anchors.source=l:n.anchors.target=l,er.setVisible(n,o.originallyVisible),s}return null}function LC(i,r,e,t,n){let o=i.$_connMap[r.id];if(o){let s=e==="source"?0:1;if(n==null)if(Y(t.modelObject)){let d=i.view.getGroupDefinition(i.model.getNodeType(t.modelObject.data));n=St(d.anchor||i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous")}else n=St(i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous");let a=eT(o.proxies[e]),l=a!=null?a.originalElement.id:e===it?o.sourceId:o.targetId,h=a!=null?a.originalAnchor:e===it?o.anchors.source:o.anchors.target;e===it?o.anchors.source=n:o.anchors.target=n,i.$sourceOrTargetChanged(l,t.id,o,t.el,e),o.proxies[e].push({originalAnchor:h,element:t,originalElement:i.$getManagedElement(l),originallyVisible:o.visible}),er.setVisible(o,!0),i.$revalidateElementById(t.id)}}var FD=["color","lineWidth","outlineWidth","outlineColor","dashArray","gradient"];function _p(i,r,e){r!=null&&(dE(r.connections,i),r.connections.length===1&&i.instance.$addClassToElement(r.el,ih)),e!=null&&(r==null||i.sourceId!==i.targetId)&&(dE(e.connections,i),e.connections.length===1&&i.instance.$addClassToElement(e.el,ih))}function Rp(i,r,e){if(r!=null){let t=r.connections.length;Nt(r.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,r),t>0&&r.connections.length===0&&i.instance.$removeClassFromElement(r.el,ih)}if(e!=null){let t=e.connections.length;(r==null||i.sourceId!==i.targetId)&&Nt(e.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,e),t>0&&e.connections.length===0&&i.instance.$removeClassFromElement(e.el,ih)}}var UD=2,YD=2,Lp=class extends zt{constructor(e,t,n,o,s){var l,h,d,u,p,m,g,E,y,x,f,b,A,T;super();c(this,"Ka",[]);c(this,"qa",[]);c(this,"containerType",null);c(this,"id");c(this,"defaults");c(this,"Vi",{});c(this,"hoverSuspended",!1);c(this,"ft",!1);c(this,"iu",null);c(this,"$_dataLoading",!1);c(this,"zoomToFitOnLoad");c(this,"plugins",[]);c(this,"pluginMap",new Map);c(this,"connectorClass",ca);c(this,"connectorOutlineClass",Ov);c(this,"connectorPathClass",Pv);c(this,"overlayClass",da);c(this,"labelOverlayClass",Rv);c(this,"$_connMap",{});c(this,"allowNestedGroups");c(this,"$_discardEdgeEditsOnDrag");c(this,"$_vertexBuffer");c(this,"$_vertexBorder");c(this,"ps");c(this,"viewport",new Ep(this,e=>this.getRenderedElement(e)));c(this,"router");c(this,"Qa",new Map);c(this,"fe");c(this,"nl",new Set);c(this,"ou");c(this,"$defaultConnector");c(this,"$defaultOverlays");c(this,"$defaultAnchor");c(this,"$defaultAnchors");c(this,"su");c(this,"au");c(this,"$isInMotion");c(this,"magnetizerProfile");c(this,"magnetizer");c(this,"$unrenderedVertices",new Map);c(this,"$unprocessedGroupMemberships",new Map);c(this,"$_useModelForSizes");c(this,"$_writeSizeToElements");c(this,"$_useModelForPositions");c(this,"$_allowUnattachedEdges");c(this,"$_edgesDetachable");c(this,"$_reattachEdges");c(this,"$paintConnectorOutline");c(this,"$connectorOutlineColor");c(this,"$connectorOutlineWidth");c(this,"J",1);c(this,"$collapsedGroupSizeCalculator");c(this,"lu");c(this,"il");c(this,"ol");c(this,"view");c(this,"gridProfile");c(this,"$connectionEstablished");c(this,"vertexList",[]);c(this,"logicalPorts");c(this,"objectFilter");c(this,"layoutMap",new Map);c(this,"$_layout");c(this,"model");c(this,"dataSource");c(this,"$relayoutOnEdgeConnect");c(this,"$relayoutOnResize");c(this,"$relayoutOnVertexRemove");c(this,"ms");c(this,"rootElement");c(this,"Gt",[]);c(this,"$_dataHooks",[]);this.model=e,this.dataSource=t,this.rootElement=n,this.id=o.id||B(),this.gridProfile=new uh(o.grid),this.$connectionEstablished=o.connectionEstablished||(S=>{}),this.logicalPorts=o.logicalPorts===!0,this.objectFilter=o.objectFilter||function(S){return!0},this.$defaultConnector=((l=o.edges)==null?void 0:l.connector)||In,this.su=(h=o.edges)==null?void 0:h.sourceMarker,this.au=(d=o.edges)==null?void 0:d.targetMarker,this.$defaultOverlays=(((u=o.edges)==null?void 0:u.overlays)||[]).map(S=>mi(S)),this.$defaultAnchor=((p=o.edges)==null?void 0:p.anchor)||"Continuous",this.$defaultAnchors=((m=o.edges)==null?void 0:m.anchors)||[null,null],this.$relayoutOnEdgeConnect=o.relayoutOnEdgeConnect,this.$relayoutOnResize=o.relayoutOnResize,this.$relayoutOnVertexRemove=o.relayoutOnVertexRemove,this.defaults={[lp]:null,[Gv]:1,[Ko]:{strokeWidth:2,stroke:"#000000"},[Df]:"vjs_defaultscope",[wf]:!0,[Mv]:20},s&&Object.assign(this.defaults,s),Object.assign(this.Vi,this.defaults),this.Vi[Ko]!=null&&(this.Vi[Ko].strokeWidth=this.Vi[Ko].strokeWidth||2),this.ou=this.defaults[Df],this.allowNestedGroups=this.Vi[wf]!==!1,this.$_discardEdgeEditsOnDrag=o.edges&&o.edges.discardEditsOnDrag===!0,this.$_vertexBuffer=o.edges?o.edges[Nv]:UD,this.$_vertexBorder=o.edges?o.edges[Dv]:YD,this.ps=((g=o.edges)==null?void 0:g.avoidVertices)===!0,this.$_allowUnattachedEdges=((E=o.edges)==null?void 0:E.allowUnattached)===!0,this.$_edgesDetachable=((y=o.edges)==null?void 0:y.detachable)!==!1,this.$_reattachEdges=((x=o.edges)==null?void 0:x.reattach)===!0,this.$paintConnectorOutline=((f=o.edges)==null?void 0:f.paintOutline)!==!1,this.$connectorOutlineWidth=((b=o.edges)==null?void 0:b.outlineWidth)||20,this.$connectorOutlineColor=((A=o.edges)==null?void 0:A.outlineColor)||"transparent",this.zoomToFitOnLoad=o.zoomToFit===!0,this.router=o.router?o.router(this):new dh(this,{gridCellSize:((T=o.edges)==null?void 0:T.astarGridCellSize)||10,avoidVertices:this.ps}),this.$_useModelForSizes=o.useModelForSizes===!0,this.$_writeSizeToElements=o.writeSizeToElements!==!1,this.$_useModelForPositions=o.useModelForPositions!==!1,this.magnetizerProfile=new Pp(o.magnetizer||{}),this.magnetizer=new Mi({positionGetter:S=>this.getElementPosition(S.id),getSize:S=>this.getElementSize(S.id),getId:S=>S.id,positionSetter:(S,R)=>{}}),this.ms=!0,o.edges!=null&&o.edges.simpleEdgeStyles===!1&&(this.ms=!1),this.setContainer(n),this.$setView(o.view),this.sl(xt,S=>{let R=this.$_connMap[S.edge.getId()];if(R){let v=this.dataSource.getEdgeType(S.edge.data),O=[...new Set([be,v])];if(this.$_setConnectionType(R,O.join(" "),S.edge.data),this.ms===!0){let P={};this.$_extractSimpleEdgeStyles(S.edge.data,P)&&this.$_setLineStyle(R,P,!0)}this.oe(P=>{P.$edgeUpdated(S.edge,R)})}}),this.sl(Md,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(R),this.oe(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.sl(Id,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(R),this.oe(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.$_layout=nt.get(Vs.type,{adapter:this.$createDefaultLayoutAdapter(),instance:this.model,dataSource:this.dataSource,container:this.rootElement,options:{}});let a=o.layout||{type:_o.type};this.setLayout(a,!0),this.$collapsedGroupSizeCalculator=o.getCollapsedGroupSize,this.lu=o.defaultCollapsedGroupSize||{width:200,height:150},this.il=o.canCollapseGroup,this.ol=o.canExpandGroup}get defaultScope(){return this.ou}get $modelTopAttribute(){return this.model.modelTopAttribute}get $modelLeftAttribute(){return this.model.modelLeftAttribute}get $modelWidthAttribute(){return this.model.modelWidthAttribute}get $modelHeightAttribute(){return this.model.modelHeightAttribute}get $modelRotationAttribute(){return this.model.modelRotationAttribute}get currentZoom(){return this.J}getLayout(){return this.$_layout}$edgeTargetChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.target.getFullId(),s=this.$getManagedElement(o);s==null&&H(t.target)&&(s=this.hu(t.target),s==null&&(s=this.$getManagedElement(t.target.parent.id))),n?s!=null?(this.dataSource.debugEnabled&&console.log("DEBUG: target change",n),this.tf(n,s,!Ni(e.old))):(delete this.$_connMap[t.getId()],this.al(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Target for Edge "+t.getId()+" changed to Node "+s.id+"; we have no valid connection.")}}$select(e){if(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$addClassToElement(t,eo)}else if(rt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$addConnectorClass(t.connector,sh)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$addClassToElement(t,eo)}}setSuspendRendering(e,t){}$deselect(e){if(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$removeClassFromElement(t,eo)}else if(rt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$removeConnectorClass(t.connector,sh)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$removeClassFromElement(t,eo)}}$selectionCleared(e){this.$getSelector(this.fe,z(sh)).forEach(t=>this.$removeClassFromElement(t,sh)),this.$getSelector(this.fe,z(eo)).forEach(t=>this.$removeClassFromElement(t,eo))}hu(e){let t=this.getRenderedPort(e);if(t!=null)return this.$manage(t,e,null,null,null,!1)}$edgeSourceChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.source.getFullId(),s=this.$getManagedElement(o);s==null&&H(t.source)&&(s=this.hu(t.source),s==null&&(s=this.$getManagedElement(t.source.parent.id))),n&&s?s!=null?this.rf(n,s,!Ni(e.old)):(delete this.$_connMap[t.getId()],this.al(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Source for Edge "+t.getId()+" changed to Node "+t.source.getFullId()+"; we have no valid connection.")}}onDestroy(e){this.bind($i,e)}sl(e,t){this.Ka.push({event:e,fn:t}),this.dataSource.bind(e,t,!0)}$dataLoadStart(){this.$_dataLoading=!0,this.$_setSuspendDrawing(!0),this.viewport.setSuspended(!0),this.fire(iu)}$dataAppendStart(){this.$_setSuspendDrawing(!0)}$dataAppendEnd(e){}$dataLoadEnd(e){if(this.$unrenderedVertices.size===0){let t=B();this.$_setSuspendDrawing(!1,!1),e?this.viewport.setSuspended(!1):(this.relayout(null,!0),this.viewport.setSuspended(!1),this.$flushUnrenderedEdges(t),this.$redrawEveryConnection()),this.zoomToFitOnLoad&&!e&&this.zoomToFit(),this.$_dataLoading=!1,this.fire(Pn)}}zoomToFit(e){this.$zoomToFit(e)}zoomToFitIfNecessary(e){this.$zoomToFitIfNecessary(e)}zoomToElements(e){this.$zoomToElements(e)}cloneVertex(e,t){var o,s;let n=this.getObjectInfo(e,!1);if(n.obj){let a=t==null?void 0:t.newPosition,l=lt(n.obj.data);if(delete l.id,a!=null)l[this.$modelLeftAttribute]=a.x,l[this.$modelTopAttribute]=a.y;else{let d=((o=t==null?void 0:t.offsetPosition)==null?void 0:o.x)||50,u=((s=t==null?void 0:t.offsetPosition)==null?void 0:s.y)||50;l[this.$modelLeftAttribute]+=d,l[this.$modelTopAttribute]+=u}let h;return this.model.transaction(()=>{h=Y(n.obj)?this.model.addGroup(l):this.model.addNode(l),a==null&&(this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)!==!1||!this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)===!0)&&this.gs(h,null,!1,{},{},null,!0,!1,!1),(t==null?void 0:t.selectAfterCreate)===!0&&setTimeout(()=>this.model.setSelection(h))},ut),h}}cu(){let e,t,n,o,s,a=!1,l=B();for(e=0,n=this.dataSource.getGroupCount();e<n;e++)o=this.dataSource.getGroupAt(e),this.objectFilter(o)&&(this.$doRenderGroup(o),a=!0);for(e=0,n=this.dataSource.getNodeCount();e<n;e++)t=this.dataSource.getNodeAt(e),this.objectFilter(t)&&(this.$doRenderNode(t),a=!0);let h=this.dataSource.getAllEdges();for(e=0,n=h.length;e<n;e++)s=h[e],this.objectFilter(s)&&(this.du(h[e],Pl,null,null,l),a=!0);return this.$flushUnrenderedEdges(l),a}$_hasUnrenderedEdges(){return this.Gt.length!==0}nf(e,t,n,o){let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target,l=n.sourcePortType||(H(o.source)?null:this.$getAttribute(e,Ki)||this.$getAttribute(e,Hr)),h=n.targetPortType||(H(o.target)?null:this.$getAttribute(e,qi)||this.$getAttribute(t,Hr));return{sourceDef:l!=null?this.view.getPortDefinition(l):this.view.getTypeDefinition(o.source),targetDef:h!=null?this.view.getPortDefinition(h):this.view.getTypeDefinition(o.target),sourceParentDef:this.view.getTypeDefinition(s),targetParentDef:this.view.getTypeDefinition(a)}}$_extractSimpleEdgeStyles(e,t){let n=!1;return FD.forEach(o=>{e.hasOwnProperty(o)&&(n=!0,t[o]=e[o])}),n}of(e,t,n,o){var R,v;let s=e.edge,a=e.context||{},l=a.edgeType||this.dataSource.getEdgeType(s.data),h=e.def||this.view.getEdgeDefinition(l),d=H(s.source)?s.source.getParent():s.source,u=this.getElement(d.id),p=H(s.target)?s.target.getParent():s.target,m=this.getElement(p.id),{sourceDef:g,targetDef:E,sourceParentDef:y,targetParentDef:x}=this.nf(u.el,m.el,a,s),f={type:l,data:s.data,cost:s.getCost(),directed:s.isDirected(),geometry:s.geometry,id:s.id,edge:s,anchor:null,anchors:[null,null],source:t,target:n,sourceMarker:h.sourceMarker||this.su,targetMarker:h.targetMarker||this.au};[ap,Iv,Vv].forEach(O=>{h.hasOwnProperty(O)&&(f[O]=h[O])}),f.anchor&&!f.anchors&&(f.anchors=[f.anchor,f.anchor],delete f.anchor);let A=(O,P,I,C,_)=>{if(C&&C[I]){let w=O[P]||[C[I],C[I]];w[_]=C[I],O[P]=w}};g!=null&&A(f,lh,ah,g,0),E!=null&&A(f,lh,ah,E,1);let T=f;if(T.avoidVertices=this.ps||h.avoidVertices,this.dataSource.debugEnabled&&console.log("Renderer","adding connection with params",T),h!=null&&Object.assign(f,Po(h,s.data,null,!0)),this.$manage(T.source,s.source,null,null,null,!1),(R=s.anchors)!=null&&R.source)f.anchors[0]=St(s.anchors.source);else{let O=a.positionOnSource||{x:0,y:0},P=g.anchorPositions||y.anchorPositions,I=g.anchorPositionFinder||y.anchorPositionFinder;if(P!=null)f.anchors[0]=fp(P.slice(),null,O);else if(I!=null){let C=I(u.el,O,s.source,E);f.anchors[0]=C}}if(this.$manage(T.target,s.target,null,null,null,!1),(v=s.anchors)!=null&&v.target)f.anchors[1]=St(s.anchors.target);else{let O=a.positionOnTarget||{x:0,y:0},P=E.anchorPositions||x.anchorPositions,I=E.anchorPositionFinder||x.anchorPositionFinder;if(a.targetAnchor!=null)f.anchors[1]=fp([a.targetAnchor]);else if(P!=null)f.anchors[1]=fp(P.slice(),null,O);else if(I!=null){let C=I(m.el,O,s.target,E);f.anchors[1]=C}}this.ms===!0&&this.$_extractSimpleEdgeStyles(s.data,f);let S=OC(this,f);if(S!=null){_p(S,this.getElement(S.sourceId),this.getElement(S.targetId)),T.geometry&&($e.importGeometry(S,T.geometry),this.$repaintUIElementById(S.sourceId),this.$repaintUIElementById(S.targetId)),S.edge=s,this.$_connMap[s.getId()]=S,s.source.dummy&&(S.anchors.source.isFixed=!0,S.anchors.source.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),s.target.dummy&&(S.anchors.target.isFixed=!0,S.anchors.target.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.$relayoutOnEdgeConnect&&this.refresh(),(m.visible===!1||u.visible===!1)&&this.Es(s,!1),T.geometry||this.$repaintUIElementById(S.sourceId);let O={connection:S,edge:s,reason:e.reason};this.oe(P=>P.$edgeRendered(O)),this.fire(lS,O)}else U("VisuallyJs - WARN : An edge could not be rendered "+s+" and is being removed from the dataset."),this.model.removeEdge(s,this);return S}$graphClearStart(){this.$_layout&&this.$_layout.dn(),this.layoutMap.clear(),this.reset()}$graphClearEnd(){}$groupRemoved(e){let t=this.viewport.getGroupElement(e.group.id);return t&&(this.vertexList=this.vertexList.filter(o=>o.id!==e.group.id),e.removeChildren===!1&&e.children.forEach(o=>{let s=this.$getManagedElement(o.id);o.data[this.$modelLeftAttribute]=s.x,o.data[this.$modelTopAttribute]=s.y,this.$appendElementToVertexLayer(s.el),this.$setViewportElementPosition(s,s)}),e.group.getPorts().map(o=>this.$getManagedElement(o.getFullId())).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.$__unmanage(t.el,e.removeChildren===!0,!0),this.oe(o=>{o.$groupRemoved(t)})),t}du(e,t,n,o,s,a){this.Gt.push({edge:e,reason:t,context:n,def:o}),a&&this.$flushUnrenderedEdges(s)}$flushUnrenderedEdges(e){let t=this.Gt.length,n=[];if(t>0){let o=[];for(let s=0;s<this.Gt.length;s++)this.sf(this.Gt[s],e)==null?o.push(this.Gt[s]):n.push(this.Gt[s].edge);this.Gt=o}return n}sf(e,t){let n=this.getRenderedElement(e.edge.target),o=this.getRenderedElement(e.edge.source);return n==null||o==null?null:this.of(e,o,n,t)}$edgeAdded(e,t){if(e.source!==this||e.transient===!0&&e.source===this){let n=e.edge;if(this.objectFilter(n.source)&&this.objectFilter(n.target)){let o=this.view.getEdgeDefinition(this.dataSource.getEdgeType(n.data||{}));if(o&&o.ignore===!0)return;this.du(n,e.reason,t,o,null,!this.$_dataLoading)}}}$edgeRemoved(e){if(e.edge.transient||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()];n&&(this.dataSource.debugEnabled&&console.log("Renderer","removing edge",t),delete this.$_connMap[t.getId()],this.al(n,{fireEvent:!1,force:!0}),this.oe(o=>{o.$edgeRemoved(t,n)}))}}$edgeGeometryUpdated(e,t,n){let o=this.getRenderedConnection(e.id);o!=null&&(t!=null?$e.importGeometry(o,t):ji(o),this.$repaintUIElementById(e.source.getFullId()),this.fire(ai,{edge:e,geometry:t,originalGeometry:n}))}$exportEdgeGeometry(e){let t=this.$_connMap[e.id];return t==null?null:zr(t.connector)}$nodeAdded(e){let t=e.node;this.objectFilter(t)&&this.$doRenderNode(t,e.eventInfo)}$groupAdded(e){let t=e.group;this.objectFilter(t)&&this.$doRenderGroup(t,e.eventInfo)}$portAdded(e){this.objectFilter(e.port.getParent())&&setTimeout(()=>this.$flushUnrenderedEdges(B()))}$vertexUpdated(e){if(e.vertex!=null){let t=this.getElement(e.vertex.getFullId());if(t){let n=null,o=e.vertex.data[this.$modelLeftAttribute],s=null,a=e.vertex.data[this.$modelTopAttribute];if(e.updates!=null){if((e.updates[this.$modelWidthAttribute]!=null||e.updates[this.$modelHeightAttribute]!=null)&&(n=e.vertex.data[this.$modelWidthAttribute],s=e.vertex.data[this.$modelHeightAttribute],this.$_useModelForSizes)){let d=this.$resolveVertexSizeFromModel(e.vertex,this.view.getTypeDefinition(e.vertex));this.$setElementSizeInUI(t.el,d.width,d.height),n=d.width,s=d.height,this.oe(u=>{u.$vertexResized(this.getElement(e.vertex.getFullId()),n,s)})}e.updates[this.$modelRotationAttribute]!=null&&this.uu(e.vertex,e.updates[this.$modelRotationAttribute],!1,!0)}let l=o,h=a;if(e.vertex.group!=null){let d=this.$_getGroupContentAreaInfo(e.vertex.group.id).pageOrigin;l+=d.x,h+=d.y}if(this.viewport.updateElement(t.id,l,h,n,s,null,e.vertex,!1),(e.updates[this.$modelLeftAttribute]!=null||e.updates[this.$modelTopAttribute]!=null)&&this.$setViewportElementPosition(t,{x:o,y:a}),this.$doVertexUpdated(t),this.$repaintUIElement(this.getElement(t.id)),e.reason===qs&&this.ps){let d=this.model.getAllEdges().filter(u=>ti(u.source).id!==e.vertex.id&&ti(u.target).id!==e.vertex.id);this.repaintEdges(d)}e.reason===fu?this.af(this.getElement(t.id),e.originalData):this.fire(Zs,this.getElement(t.id)),this.oe(d=>d.$vertexUpdated(this.getElement(t.id),e.reason))}}}af(e,t){let n={x:t[this.$modelLeftAttribute],y:t[this.$modelTopAttribute]},o={dragGroup:[{element:e,vertex:e.modelObject,pos:{x:e.x,y:e.y},originalPos:n}],positions:{[e.id]:{x:e.x,y:e.y}},ui:this},s=Y(e.modelObject)?Gr:Vt;this.fire(s,o)}lf(e){this.fire(ve,e)}getLayoutFor(e){return fE(e)||yE(e)?this.layoutMap.get(e.group.id):this.$_layout}$groupMemberAdded(e){this.$_processGroupAddition(e,!1)||(this.$unprocessedGroupMemberships.has(e.group.id)||this.$unprocessedGroupMemberships.set(e.group.id,[]),this.$unprocessedGroupMemberships.get(e.group.id).push(e))}$_processGroupAddition(e,t){let n=this.$getManagedElement(e.vertex.id),o=this.viewport.getGroupElement(e.group.id);if(o!=null&&n!=null){this.$appendElement(n.el,o.contentArea);let s=this.$_getGroupContentAreaInfo(e.group.id),a=e.positionInGroup?e.positionInGroup.x:n.x-o.x,l=e.positionInGroup?e.positionInGroup.y:n.y-o.y;return this.$_updateVertexPositions({positions:{[n.id]:{x:a,y:l}},sizes:null,offset:{x:o.x+s.internalOffset.x,y:o.y+s.internalOffset.y},storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),e.source!=this&&this.relayoutGroup(e.group.id,IS),this.oe(h=>{h.$groupMemberAdded(n)}),t||setTimeout(()=>this.$revalidateElement(n.el)),!0}else return!1}$groupMemberRemoved(e){let t=this.$getManagedElement(e.vertex.id),n=this.viewport.getGroupElement(e.group.id),o=this.$_getGroupContentAreaInfo(e.group.id);this.$appendElementToVertexLayer(t.el),this.$_updateVertexPositions({positions:{[t.id]:{x:t.x-n.x-o.internalOffset.x,y:t.y-n.y-o.internalOffset.y}},sizes:null,offset:null,storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.oe(s=>{s.$groupMemberRemoved(t)})}$nodeRemoved(e){let t=this.$getManagedElement(e.node.id);return t&&(e.node.getPorts().map(o=>this.$getManagedElement(o.getFullId())).filter(o=>o!=null).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.vertexList=this.vertexList.filter(o=>o.id!==e.node.id),this.$__unmanage(t.el,!1,!0),this.oe(o=>{o.$nodeRemoved(t)}),this.lf(t)),t}$portRemoved(e){let t=this.$getManagedElement(e.port.getFullId());if(t){let n=this.$getManagedElement(e.port.getParent().id);n.el!==t.el?this.$__unmanage(t.el,!1,!1):(this.$removeAttribute(n.el,nh),this.$removeAttribute(n.el,Hr))}}$edgeTypeChanged(e,t,n){let o=this.$_connMap[e.getId()];if(o){let s=this.view.getEdgeDefinition(n);if(s&&s.ignore===!0)return;s.connector&&er.qd(o,s.connector),De.setType(o,n,e.data)}}$groupTypeChanged(e,t,n){}$nodeTypeChanged(e,t,n){this.$reRenderNode(e)}$portTypeChanged(e,t,n){}$vertexRendered(e,t,n,o){if(!t)throw new Error("Cannot render vertex");let s=K(e),a=Y(e);this.$setAttribute(t,te,e.getFullId());let l=s?Qi:a?Jo:H(e)?Lv:"";this.$addClassToElement(t,l),t.jtk=t.jtk||{},t.jtk[e.objectType.toLowerCase()]=e,t.jtk.vertex=e;let h=this.getElement(e.id),d=h!=null;if(d&&(this.$setAttribute(t,mt,this.$getAttribute(h.el,mt)),h.el=t,this.model.getSelection().containsVertex(e.id)&&this.$addClassToElement(t,eo)),K(e)||Y(e))if(this.vertexList.push(e),e.group==null)this.$appendVertexElement(t);else{let g=this.pu(e.group);this.$appendElement(t,g)}let u=null,p=e.data[this.$modelRotationAttribute];this.$_useModelForSizes?(u=this.$resolveVertexSizeFromModel(e,n),this.$_writeSizeToElements!==!1&&this.$setElementSizeInUI(t,u.width,u.height),e.data[this.$modelWidthAttribute]=u.width,e.data[this.$modelHeightAttribute]=u.height):u=this.$getSize(t);let m=this.$manage(t,e,null,u,null,!1);if(p!=null&&this.uu(e,p,!this.$_dataLoading,!1),K(e)){if(!d){let g={el:t,id:e.id,vertex:e,size:u};this.fire(Fr,g)}}else if(Y(e)){let g={el:t,vertex:e,id:e.id,size:u},E=m,y=n;E.contentArea=this.$getGroupContentAreaElement(t),E.elastic=y.elastic===!0;let x=y.layout||{type:_o.type};this.layoutMap.set(e.id,this.mu(x,e)),this.fire(Br,g),this.$unprocessedGroupMemberships.has(e.id)&&(this.$unprocessedGroupMemberships.get(e.id).forEach(b=>this.$_processGroupAddition(b,!0)),this.$unprocessedGroupMemberships.delete(e.id))}this.$unrenderedVertices.delete(e.id),this.$_dataLoading&&this.$isAsynchronousRender()?this.$dataLoadEnd(!1):this.$_dataLoading||(d&&this.oe(g=>{g.$vertexRerendered({el:t,id:e.id,vertex:e,size:u})}),this.$flushUnrenderedEdges(null),this.$unrenderedVertices.size===0&&this.refresh())}$redrawEveryConnection(){let e=B();this.gu(Object.values(this.$_connMap),e)}$redrawConnectionsForViewportElement(e,t){let n=e.connections||[];return this.gu(n,t),n}gu(e,t){this.router.$redrawConnections(e,t),e.forEach(n=>{this.$paintConnection(n,{timestamp:t})})}Es(e,t,n){let o=this.$_connMap[e.id];o&&er.setVisible(o,t)}isVisible(e){return this.Eu(e,t=>{switch(t.type){case Ye.objectType:let n=this.$_connMap[t.obj.id];return n?n.visible:!1;case he.objectType:case oe.objectType:return t.managedElement.visible!==!1}})}setVisible(e,t,n){if(e==null)return;let o=s=>{switch(s.type){case Ye.objectType:this.Es(s.obj,t,n);break;case he.objectType:case oe.objectType:this.hf(s,t,n);break;case ce.objectType:U("WARN togglePort method not implemented in 7.x");break}};this.Eu(e,o)}hf(e,t,n){if(e.el&&(this.$setElementVisible(e.el,t),e.el.SA=t,e.managedElement.visible=t,this.fire(ou,{node:e.obj,el:e.el,state:t}),!n)){let o=this.dataSource.getAllEdgesFor(e.obj);for(let s=0;s<o.length;s++)if(!t)this.Es(o[s],t,n);else{let a=ti(o[s].source),l=ti(o[s].target),h=a===e.obj?l:a;this.isVisible(h)&&this.Es(o[s],t,n)}}}Eu(e,t){let n;if(XS(e))n={nodes:[],edges:[]},e.eachVertex((o,s)=>{n.nodes.push(t(this.getObjectInfo(s,!1)))}),e.eachEdge((o,s)=>{n.edges.push(t(this.getObjectInfo(s,!1)))});else if(this.$isArrayLike(e)){n=[];for(let o=0;o<e.length;o++)n.push(t(this.getObjectInfo(e[o],!1)))}else n=t(this.getObjectInfo(e,!1));return n}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);return n!=null?n:this.$_getDefaultSizeForVertex(e,t)}$_getDefaultSizeForVertex(e,t){let n=K(e)?this.defaults.nodeSize||{width:100,height:80}:this.defaults.groupSize||{width:300,height:300};return t.defaultSize&&(n.width=t.defaultSize.width,n.height=t.defaultSize.height),n}$_getModelSizeForVertex(e){let t=e.data[this.$modelWidthAttribute],n=e.data[this.$modelHeightAttribute];if(t!=null&&n!=null)return{width:e.data[this.$modelWidthAttribute],height:e.data[this.$modelHeightAttribute]}}getContainer(){return this.fe}setZoom(e,t){return this.J=e,e}k(e){if(e==null)return null;let t=this.$getAttribute(e,mt);return(!t||t==="undefined")&&(t=`vjs-${B()}`,this.$setAttribute(e,mt,t)),t}setContainer(e){this.fe=e}fu(e,t,n,o){let s=n===0?e.sourceId:e.targetId;if(o){let l=n===0?e.anchors.source:e.anchors.target;l.isFixed=!1,delete l.fixedLocation}let a={index:n,originalSourceId:n===0?s:e.sourceId,newSourceId:e.sourceId,originalTargetId:n===1?s:e.targetId,newTargetId:e.targetId,connection:e};return n===0?(a.newSourceId=t.id,e.sourceId=t.id,e.sourceElement=t.el):(a.newTargetId=t.id,e.targetId=t.id,e.targetElement=t.el),a}rf(e,t,n){Rp(e,this.getElement(e.sourceId)),this.$repaintUIElement(this.getElement(e.sourceId));let o=this.fu(e,t,0,n);_p(e,this.getElement(o.newSourceId),this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(o.newSourceId))}tf(e,t,n){Rp(e,this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(e.targetId));let o=this.fu(e,t,1,n);_p(e,this.getElement(e.sourceId),this.getElement(o.newTargetId)),this.$repaintUIElement(this.getElement(o.newTargetId))}$_setConnectionType(e,t,n){let o=De.setType(e,t,n);return this.$paintConnection(e),o}$_setSuspendDrawing(e,t){let n=this.ft;return this.ft=e,e?this.iu=""+new Date().getTime():this.iu=null,this.ft||(this.autoSizeGroups(Array.from(this.nl.keys()).map(o=>o.modelObject)),this.nl.clear(),t&&this.repaintEverything()),n}$batch(e,t){let n=this.ft===!0;n||this.$_setSuspendDrawing(!0),e(),n||this.$_setSuspendDrawing(!1,!t)}df(e,t){return this.dataSource.beforeDetach(e.edge.source,e.edge.target,e.edge)}al(e,t){return e!=null&&e.deleted!==!0&&(t=t||{},t.force||this.df(e)===!0)?(Rp(e,this.getElement(e.sourceId),this.getElement(e.targetId)),this.router.$connectionRemoved({connection:e,reason:Cl,edge:e.edge}),delete this.$_connMap[e.id],er.destroy(e),!0):!1}$manage(e,t,n,o,s,a){let l=t.getFullId();this.$getAttribute(e,mt)==null&&this.$setAttribute(e,mt,l);let h=this.getElement(l);if(h==null)h=this.viewport.addElement(l,e,t,n,o,s),this.ft||this.viewport.$refreshElement(l,!1,n,o);else if(a)return this.viewport.$refreshElement(l);return h}$getManagedElement(e){return this.viewport.getElement(e)}$__unmanage(e,t,n){let o=s=>{let a=this.k(s),l=this.getElement(a);this.router.$elementRemoved(l),this.viewport.remove(a),this.$removeAttribute(s,mt),s&&n&&this.$removeElement(s)};t&&this.$getAssociatedElements(e).map(o),o(e)}rotate(e,t){this.getObjectInfo(e,!1).obj&&this.model.$_updateVertex(e,{[this.$modelRotationAttribute]:t},Ks,!1)}setSize(e,t,n){this.getObjectInfo(e,!1).obj&&this.model.transaction(()=>{this.model.$_updateVertex(e,{[this.$modelWidthAttribute]:t,[this.$modelHeightAttribute]:n},US,!1)},ut)}uu(e,t,n,o){let s=j(e)?e:e.id;if(this.getElement(s)){this.viewport.HE(s,t);let a=this.getElement(s);if(this.$syncManagedElementWithView(a,!1),this.oe(l=>{l.$vertexRotated(a,t)}),n!==!0)return this.$repaintUIElementById(s)}}$getRotation(e){let t=this.getElement(e);return t!=null&&t.r||0}$getRotations(e){let t=[],n=this.getElement(e),o=s=>{if((K(s.modelObject)||Y(s.modelObject))&&s.modelObject.group){let a=this.getElement(s.modelObject.group.id);a!=null&&(t.push({r:a.r,c:a.c}),o(a))}};return n!=null&&(H(n.modelObject)?n=this.getElement(n.modelObject.parent.id):t.push({r:n.r||0,c:n.c}),o(n)),t}$revalidateElement(e,t){let n=this.k(e);return this.$revalidateElementById(n)}$revalidateElementById(e,t){return this.$revalidateManagedElement(this.getElement(e),t)}$revalidateManagedElement(e,t){return e!=null?(this.viewport.$refreshElement(e.id),this.$repaintUIElement(e)):pp()}repaintEverything(e){let t=B();e!==!0&&this.viewport.$refreshEveryElement(),this.viewport.recomputeBounds(),this.viewport.$forEachElement(n=>this.$repaintUIElement(n,t,!0))}$repaintUIElementById(e,t,n,o){this.$repaintUIElement(this.getElement(e),t,n,o)}$repaintUIElement(e,t,n,o){let s=pp(),a=l=>{l.forEach(h=>s.add(h))};if(!this.ft){if(e!=null){let l=this.$getAssociatedElements(e.el).map(h=>this.getElement(this.k(h))).filter(h=>h!=null&&h.id!==e.id);t==null&&(t=B());for(let h=0;h<l.length;h++)(H(l[h].modelObject)||!n)&&this.viewport.$refreshElement(l[h].id);if(a(this.$redrawConnectionsForViewportElement(e,t)),l.length>0)for(let h=0;h<l.length;h++)a(this.$redrawConnectionsForViewportElement(l[h],t))}o&&this.fire(tu,e)}return s}reset(){this.$_connMap={},this.vertexList.length=0,this.viewport.reset(),this.router.$reset(),this.Gt.length=0,this.$unrenderedVertices.clear(),this.nl.clear()}getRenderedConnection(e){return this.$_connMap[e]}getNodes(){return this.vertexList.filter(K)}getGroups(){return this.vertexList.filter(Y)}getUIGroups(){return this.getGroups().map(e=>this.viewport.getGroupElement(e.id))}destroy(){for(let e=0;e<this.qa.length;e++)this.off(this.fe,this.qa[e][0],this.qa[e][1]);this.reset(),this.unbind(),this.Qa.clear()}$registerConnectionType(e,t){let n=Object.assign({},t);if(this.Qa.set(e,n),t.overlays){let o={};for(let s=0;s<t.overlays.length;s++){let a=mi(t.overlays[s]);o[a.options.id]=a}n.overlays=o}if(t.sourceMarker){let o=mi(t.sourceMarker);o.options.direction=-1,o.options.location=0,o.sourceMarker=!0,n.sourceMarker=o}if(t.targetMarker){let o=mi(t.targetMarker);o.options.direction=1,o.options.location=1,o.targetMarker=!0,n.targetMarker=o}}$getConnectionType(e){return this.Qa.get(e)}$sourceOrTargetChanged(e,t,n,o,s){let a,l,h,d;e!==t&&(s===it?(n.sourceId=t,n.sourceElement=o,h=this.getElement(e),a=this.getElement(t),l=this.getElement(n.targetId),d=l):s===vn&&(n.targetId=t,n.targetElement=o,l=this.getElement(t),d=this.getElement(e),a=this.getElement(n.sourceId),h=a),Rp(n,h,d),_p(n,a,l))}ll(e,t,n,o){n=n||{},o=o||{},t=t||{};let s={},a=An(e);a.unshift(e),a.forEach(l=>{let h=this.viewport.getGroupElement(l.id),d=o[l.id]||this.viewport.$computeGroupContentExtents(l,!1,t,n,null),u=this.hl(l,t,n,d,!1);if(u!=null&&(s[l.id]=u,n[l.id]=u.size,t[l.id]=u.position,(u.originalSize.width!==u.size.width||u.originalSize.height!==u.size.height)&&(this.$trackGroupSizeChanges({[l.id]:{element:h,originalGroupSize:u.originalSize,newGroupSize:u.size}}),l.group==null))){let p=u.size.width-u.originalSize.width,m=u.size.height-u.originalSize.height;if(this.magnetizerProfile.afterGroupShrink&&(p<0||m<0)){let g=this.$provisionallyGather(l,t,n,!1,!1);this.$_updateVertexPositions({positions:g.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}else if(this.magnetizerProfile.afterGroupGrow){let g=this.$provisionallyMagnetize(l,!1,t,n,!1,!1);this.$_updateVertexPositions({positions:g.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}}})}expandGroup(e){this.model.$transaction(()=>{let t=j(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o=this.ol?this.ol(t,n.lastExpandedSize):null;if(o===!1)return;let s=n.el;if(this.yu(n)==null){n.collapsed=!1,this.$updateElementClasses(s,[Lf],[Rf]);let l=new Set,h=new Set,d=new Set;this.xu(n,l,h,d,!0),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!0)),l.forEach(p=>this.$_unproxyEdge(p.edge,p.index));let u={};if(this.$_useModelForSizes&&n.lastExpandedSize!=null&&(u[t.id]=n.lastExpandedSize,this.model.updateGroup(t,n.lastExpandedSize)),o!=null){let p=o;for(let m in p)this.model.updateVertex(m,p[m])}this.ll(t,null,u,null),this.magnetizerProfile.afterGroupExpand===!0&&this.magnetize(n.modelObject),this.$revalidateManagedElement(n),this.oe(p=>{p.$groupExpanded(n)}),this.fire(nu,{group:t})}}},ut,!0)}$_proxyEdge(e,t,n,o){LC(this,e,t,n,o)}$_unproxyEdge(e,t,n){return RC(this,e,t,n)}xu(e,t,n,o,s){let a=e.modelObject.members.map(d=>d.id),l=bE(e.modelObject,!0,!0);this.viewport.$refreshElement(e.id),a.forEach(d=>{this.viewport.$refreshElement(d)});let h=xl(l,d=>!(a.indexOf(d.source.id)!==-1&&a.indexOf(d.target.id)!==-1));h.left.forEach(d=>{t.add({edge:d,index:a.indexOf(d.source.id)===-1?vn:it})}),h.right.forEach(d=>{o.add(d)}),this.bu(e).forEach(d=>{this.xu(d,t,n,o,!1)})}toggleGroup(e){let t=this.viewport.getGroupElement(j(e)?e:e.id);t!=null&&(t.collapsed?this.expandGroup(e):this.collapseGroup(e))}yu(e){let t=null;if(e.modelObject.group==null)return null;{let n=e.modelObject.group;for(;n!=null;){let o=this.$getManagedElement(n.id);o.collapsed&&(t=o),n=o.modelObject.group}return t}}collapseGroup(e){this.model.$transaction(()=>{let t=j(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o={width:n.width,height:n.height},s=this.il==null?null:this.il(t,o);if(s===!1)return;let a=n.el;if(n.lastExpandedSize=o,this.yu(n)==null){n.collapsed=!0,this.$updateElementClasses(a,[Rf],[Lf]);let h=new Set,d=new Set;this.Au(n,h,d),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!1)),h.forEach(p=>this.$_proxyEdge(p.edge,p.index,n));let u={};if(this.$_useModelForSizes){let p=this.$getCollapsedGroupSize(t,{width:n.width,height:n.height});u[t.id]=p,this.model.updateGroup(t,p)}if(s!=null){let p=s;for(let m in p)this.model.updateVertex(m,p[m])}this.ll(t,null,u,null),this.$revalidateManagedElement(n),this.magnetizerProfile.afterGroupCollapse===!0&&this.gather(n.modelObject),this.oe(p=>{p.$groupCollapsed(n)}),this.fire(ru,{group:t})}}},ut,!0)}$computeCollapsedGroupSize(e,t){return this.$collapsedGroupSizeCalculator!=null?this.$collapsedGroupSizeCalculator(e,t):null}$getCollapsedGroupSize(e,t){try{let o=this.$computeCollapsedGroupSize(e,t);if(o!=null)return o}catch(o){U("ERROR: user function getGroupCollapsedSize threw error",o)}let n=this.getGroupDefinition(e);return n&&n.collapsedSize?n.collapsedSize:this.lu}bu(e){return e.modelObject.members.filter(t=>t.objectType===oe.objectType).map(t=>this.viewport.getGroupElement(t.id))}Au(e,t,n){let o=e.modelObject.members.map(a=>a.id),s=bE(e.modelObject,!0,!0);if(e.proxied!==!1){let a=xl(s,l=>!(o.indexOf(l.source.id)!==-1&&o.indexOf(l.target.id)!==-1));a.left.forEach(l=>{t.add({edge:l,index:o.indexOf(l.source.id)===-1?vn:it})}),a.right.forEach(l=>{n.add(l)})}else s.forEach(a=>n.add(a));this.bu(e).forEach(a=>{this.Au(a,t,n)})}uf(){return this.Su(this.dataSource.getGroups().filter(this.objectFilter))}Su(e){let t=[];return e.forEach(n=>{let o=An(n);t.push({group:n,depth:o.length})}),t.sort((n,o)=>n.depth===o.depth?0:n.depth>o.depth?-1:1),t}relayoutGroup(e,t){let n=Y(e)?e:this.dataSource.getGroup(e),o=this.layoutMap.get(n.id);if(o==null)return;let s=this.getElement(n.id),a=s;o.relayout(null,h=>{this.$_updateVertexPositions({positions:h.positions,sizes:h.sizes,resizedGroups:null,offset:{x:a.x,y:a.y},storePositionsInModel:!0,repaintConnections:!1,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.fire(Bl,{element:s,positions:h.positions,sizes:h.sizes,extents:h.bounds})});let l=!0;this.$_dataLoading&&this.$_useModelForSizes&&(l=!1),t===NS&&(l=!1),l&&this.autoSizeGroup(n),this.$revalidateManagedElement(s)}$_updateVertexPositions(e){let t=e.offset||{x:0,y:0},n=new Set,o=pp();for(let s in e.positions){let a=e.positions[s],l=e.sizes!=null?e.sizes[s].width:null,h=e.sizes!=null?e.sizes[s].height:null,d=this.viewport.updateElement(s,a.x+t.x,a.y+t.y,l,h,null,null,!1);e.writeSizesToElements&&l!=null&&h!=null&&this.$setElementSizeInUI(this.getElement(s).el,l,h),n.add(this.getElement(s)),this.$setViewportElementPosition(d,a),e.storePositionsInModel&&this.$storePositionInModel({id:s,pos:a})}if(e.resizedGroups!=null)for(let s in e.resizedGroups){let a=e.resizedGroups[s].newGroupSize;this.viewport.updateElement(s,null,null,a.width,a.height,null,e.resizedGroups[s].group,!1),n.add(this.getElement(s)),this.$_useModelForSizes&&this.pf(s,a)}if(e.rotations!=null)for(let s in e.rotations){let a=this.getElement(s);this.viewport.updateElement(s,null,null,null,null,e.rotations[s],null,!1),n.add(a),e.writeRotationsToElements&&this.$setElementRotation(a.el,e.rotations[s])}return e.repaintConnections&&n.forEach(s=>{this.$repaintUIElement(s).forEach(l=>o.add(l))}),o}relayout(e,t){this.Tu(n=>{this.$_layout.relayout(e,n)},n=>{this.$afterRelayout(n)},On,t)}refresh(e){this.Tu(t=>{this.$_layout.layout(t)},t=>{this.$afterRefresh(t)},Ws,e)}Tu(e,t,n,o){if(!this.ft){let s={};e(a=>{let l=a.positions;if(this.magnetizerProfile.afterLayout){let p=[];for(let g in l)p.push(this.dataSource.getVertex(g));this.magnetizer.setElements(p);let m=this.magnetizer.executeAtCenter({getPosition:g=>l[g.id],getSize:g=>a.sizes[g.id]});for(let g in m.current)l[g]=m.current[g]}let h=this.mf(),d=h.orderedGroups.length>0&&!(this.$_dataLoading&&this.$_useModelForSizes),u={};if(d){let p=(g,E)=>h.info[g].positions[E]||this.getElementPosition(E),m=(g,E)=>a.sizes[E]||h.info[g].sizes[E]||this.getElementSize(E);h.orderedGroups.forEach(g=>{let E=Di();g.group.members.forEach(x=>{let f=p(g.group.id,x.id),b=m(g.group.id,x.id);E.xmin=Math.min(E.xmin,f.x),E.ymin=Math.min(E.ymin,f.y),E.xmax=Math.max(E.xmax,f.x+b.width),E.ymax=Math.max(E.ymax,f.y+b.height)});let y=this.hl(g.group,l,a.sizes,E,!1);if(y!=null&&(s[g.group.id]={group:g.group,newGroupSize:y.size,originalGroupSize:y.originalSize},l[g.group.id]!=null&&(l[g.group.id]=y.position),u[g.group.id]=this.$_getGroupContentAreaInfo(g.group.id),a.sizes[g.group.id]=y.size,y.layoutShiftX!==0||y.layoutShiftY!==0)){let x=h.info[g.group.id].positions;for(let f in x)x[f].x+=y.layoutShiftX,x[f].y+=y.layoutShiftY}})}this.$_updateVertexPositions({positions:l,sizes:a.sizes,resizedGroups:s,offset:null,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),h.orderedGroups.reverse().forEach(p=>{let m=p.group.id,g=h.info[m],E=l[m]||ft(g.element),y=u[m]||this.$_getGroupContentAreaInfo(m);y&&(E.x+=y.internalOffset.x,E.y+=y.internalOffset.y),this.$_updateVertexPositions({positions:g.positions,sizes:g.sizes,resizedGroups:s,offset:E,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}),o!==!0&&this.repaintEverything(!0),t({bounds:a.bounds,positions:a.positions,sizes:a.sizes,layout:a.layout}),this.fire(n,{positions:a.positions,sizes:a.sizes,layout:a.layout});for(let p in h.info)this.fire(Bl,h.info[p])})}}repaintEdge(e){let t=this.getRenderedConnection(e.id);this.$paintConnection(t)}repaintEdges(e){let t=B();e.forEach(n=>{let o=this.getRenderedConnection(n.id);this.$paintConnection(o,{timestamp:t})})}$paintConnection(e,t){if(!this.ft&&e.visible!==!1){t=t||{};let n=t.timestamp;if(n!=null&&n===e.lastPaintedAt)return;if(n==null||n!==e.lastPaintedAt){this.router.$computePath(e,n);let o=e.sourceMarker;if(o!=null&&o.visible){let a=this.$drawOverlay(o,e.connector,e.paintStyleInUse);e.overlayPlacements[o.id]=a,e.connector.internalSegments.length>0&&(e.connector.internalSegments[0].x1=a.tail.x,e.connector.internalSegments[0].y1=a.tail.y)}let s=e.targetMarker;if(s!=null&&s.visible){let a=this.$drawOverlay(s,e.connector,e.paintStyleInUse);e.overlayPlacements[s.id]=a;let l=e.connector.internalSegments.length-1;e.connector.internalSegments.length>0&&(e.connector.internalSegments[l].x2=a.tail.x,e.connector.internalSegments[l].y2=a.tail.y)}for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l!==o&&l!==s&&l.visible&&(e.overlayPlacements[a]=this.$drawOverlay(l,e.connector,e.paintStyleInUse,er.getAbsoluteOverlayPosition(e,l)))}this.$paintConnector(e,e.paintStyleInUse);for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l.visible&&this.$paintOverlay(l,e.overlayPlacements[a],e.connector)}}e.lastPaintedAt=n,t.fireEvent&&this.fire(KA,e)}}$addOverlay(e,t,n){let o=ch(e,t);return o!=null&&(o.ignoreTypes=!0,n||this.$repaintUIElementById(e.sourceId)),o}$removeOverlay(e,t){qo(e,t),this.$repaintUIElementById(e.sourceId)}$_setLineStyle(e,t,n){t.hasOwnProperty("lineWidth")&&(e.paintStyle.strokeWidth=t.lineWidth,e.hoverPaintStyle.strokeWidth=t.lineWidth),t.hasOwnProperty("outlineWidth")&&(e.paintStyle.outlineWidth=t.outlineWidth,e.hoverPaintStyle.outlineWidth=t.outlineWidth),t.hasOwnProperty("color")&&(e.paintStyle.stroke=t.color),t.hasOwnProperty("outlineColor")&&(e.paintStyle.outlineStroke=t.outlineColor),t.hasOwnProperty("dashArray")&&(e.paintStyle.dashArray=t.dashArray),Ap(e),n&&this.$paintConnection(e)}$setView(e){this.view=new up(this.dataSource,this.dataSource.getModel(),e,this)}findIntersectingVertices(e){if(e.dontIncludeNodes===!0&&e.dontIncludeGroups===!0&&e.dontIncludeNodesInsideGroups===!0)return[];let t={x:e.origin.x,y:e.origin.y,width:e.dimensions.width,height:e.dimensions.height},o=(e.enclosed?this.viewport.findVerticesEnclosedByRect(t,0,!1,[],!1):this.viewport.findVerticesIntersectingWithRect(t,0,!1,[],!1)).filter(a=>{let l=K(a.modelObject),h=l&&fE(a.modelObject),d=Y(a.modelObject),u=d&&yE(a.modelObject),p=e.dontIncludeNodes===!0&&l,m=e.dontIncludeGroups===!0&&d,g=e.dontIncludeNodesInsideGroups&&h,E=e.dontIncludeNestedGroups&&u;return!(p||m||g||E)}),s=e.filter||(()=>!0);return o.filter(a=>s(a.modelObject)).map(a=>({enclosed:e.enclosed,id:a.id,r:a,v:a.modelObject,el:a.el}))}findEnclosedVertices(e){return this.findIntersectingVertices(Object.assign(e,{enclosed:!0}))}pu(e){let t=this.viewport.getGroupElement(e.id);return t==null?null:this.$getGroupContentAreaElement(t.el)}$_getGroupContentAreaInfo(e){let t=this.viewport.getGroupElement(e);if(t==null)return{pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0},contentArea:null,isGroupElement:!0};{let n=this.$getGroupContentAreaElement(t.el);if(n!==t.el){let o=this.$getElementPositionInUIRelativeToParent(n);return{pageOrigin:{x:t.x+o.x,y:t.y+o.y},internalOffset:{x:o.x,y:o.y},contentArea:n,isGroupElement:!1}}else return{pageOrigin:{x:t.x,y:t.y},internalOffset:{x:0,y:0},contentArea:t.el,isGroupElement:!0}}}getElementPosition(e){return this.viewport.getElementPosition(e)}getElementSize(e){return this.viewport.getElementSize(e)}getElement(e){return this.viewport.getElement(e)}getGroupElement(e){return this.viewport.getGroupElement(e)}getObjectInfo(e,t){if(e==null)return{id:null,obj:null,el:null,type:null,managedElement:null};if(ma(e)){let n=e.edge;return{obj:n,id:n.id,type:Ye.objectType,el:e.connector.canvas,managedElement:null}}else if(this.$isElement(e)){let n=this.getModelObjectFromElement(e,!0,t);if(n!=null){let o=this.dataSource.resolveFullId(n.obj);return{el:n.el,obj:n.obj,type:n.obj.objectType,id:o,managedElement:this.getElement(o)}}else{let o=this.k(e);return{id:o,obj:null,el:e,type:null,uiOnly:!0,managedElement:this.getElement(o)}}}else{let n=this.dataSource.getObjectInfo(e);return n.obj!=null?n.type===Ye.objectType?Object.assign({el:this.getRenderedConnection(n.id).connector.canvas,managedElement:null},n):Object.assign({el:this.getRenderedElement(n.obj),managedElement:this.getElement(n.obj.getFullId())},n):Object.assign({el:null,managedElement:null},n)}}cl(){let e=this.dataSource.getNodes().filter(t=>t.group==null);return e.push(...this.dataSource.getGroups().filter(t=>t.group==null)),e}gf(e,t,n,o,s,a,l,h,d,u){let p={invertTrackbackPreference:u};if(t&&(p.origin=t),n&&(p.gather=n),!h&&!d&&this.magnetizer.setElements(a),e){let g=this.getObjectInfo(e,!1);if(g.obj)if(!l)p.focus=g.obj.id;else{let E=this.getElement(g.obj.id);p.origin={x:E.x+E.width/2,y:E.y+E.height/2},p.filter=y=>y===g.obj.id}}o&&(p.knownLocations=o),s&&(p.knownSizes=s);let m=this.getGrid();return m&&(p.grid=m),p}fs(e,t,n,o,s,a,l,h,d,u){a==null&&(a=h?[]:this.cl());let p=this.gf(e,t,n,o,s,a,l,h,d,u);return p.focus!=null?this.magnetizer.executeWithFocus(p.focus,p):t!=null?this.magnetizer.executeAtPoint(t,p):this.magnetizer.executeAtCenter(p)}gs(e,t,n,o,s,a,l,h,d){let u=this.fs(e,t,n,o,s,null,a,l,h,d);this.ys(u,BS)}magnetize(e,t){this.gs(e,null,!1,null,null,t,!1,!1,!1)}$provisionallyMagnetize(e,t,n,o,s,a){return this.fs(e,null,!1,n,o,null,t,!1,s,a)}$provisionallyGather(e,t,n,o,s){return this.fs(e,null,!0,t,n,null,!1,!1,o,s)}magnetizeAtPoint(e){this.gs(null,e,!1,null,null,null,!1,!1,!1)}gather(e){this.gs(e,null,!0,null,null,null,!1,!1,!1)}$startMagnetizer(){this.magnetizer.startTracking(this.cl(),this.magnetizerProfile.trackback,this.magnetizerProfile.trackbackThreshold)}$stopMagnetizer(){this.magnetizer.stopTracking()}$startMotion(){this.$isInMotion=!0}$stopMotion(){this.$isInMotion=!1}vu(e){return{[this.$modelLeftAttribute]:e.x,[this.$modelTopAttribute]:e.y}}Ef(e,t){let n=this.vu(t);this.model.updateVertex(e,n)}ys(e,t,n){this.model.openTransaction(ut);try{for(let o in e.current){let s=this.vu(e.current[o]);this.model.$_updateVertex(o,s,t,!1)}n&&n()}catch(o){U("Exception thrown when setting position",o)}finally{this.model.commitTransaction()}}$storePositionInModel(e){let t=typeof e=="string"?e:e.id,n=typeof e=="string"?null:e.pos,o=this.getModelPositionAttributes(),s=typeof e=="string"?o.x:e.leftAttribute||o.x,a=typeof e=="string"?o.y:e.topAttribute||o.y,l=e.obj||this.dataSource.getVertex(t);return l&&(n==null&&(n=this.getElementPosition(l.id)),we(l.data,s,n.x),we(l.data,a,n.y)),n}pf(e,t){let n=j(e)?this.dataSource.getVertex(e):e;n&&(t==null&&(t=this.getElementSize(n.id)),we(n.data,this.$modelWidthAttribute,t.width),we(n.data,this.$modelHeightAttribute,t.height))}setMagnetizedPosition(e,t,n){this.setPosition(e,t,n,!0)}setPosition(e,t,n,o,s){let a=this.getObjectInfo(e,!1);if(a.obj)if(a.obj.group==null){let l=this.ff(a.obj,t,n,o,s===!1,!1,!1,!1);this.ys(l,fu)}else{let l=a.obj.group,h=this.viewport.getGroupElement(l.id);if(h!=null){let d={[a.id]:{x:t+h.x,y:n+h.y}},u={[a.id]:{x:t,y:n}},p=this.viewport.$computeGroupContentExtents(l,!1,d,null,null);this.ys({original:{},current:u},fu,()=>{this.ll(l,u,null,{[l.id]:p})})}}}adHocGroupLayout(e,t){if(t){let n=this.dataSource.getObjectInfo(e);if(n.obj){let o=this.layoutMap.get(n.id);this.layoutMap.set(n.id,this.mu(t,n.obj)),this.relayoutGroup(n.obj,DS),this.layoutMap.set(n.id,o)}}}getGroupDefinition(e){return this.view.getGroupDefinition(this.model.getNodeType(e.data))}getPortDefinition(e){return this.view.getPortDefinition(this.model.getPortType(e.data))}getNodeDefinition(e){return this.view.getNodeDefinition(this.model.getNodeType(e.data))}ff(e,t,n,o,s,a,l,h){let d={x:t,y:n};if(o){let u=this.fs(e,{x:t,y:n},!1,{[e.id]:{x:t,y:n}},null,null,s,a,l,h);return u.original[e.id]={x:t,y:n},u.current[e.id]={x:t,y:n},u}else return this.yf()&&(d=le(d,this.getGrid())),{original:{[e.id]:d},current:{[e.id]:d}}}getModelPositionAttributes(){return{x:this.$modelLeftAttribute,y:this.$modelTopAttribute}}storePositionsInModel(e){e=e||{};let t=this.getModelPositionAttributes(),n=e.leftAttribute||t.x,o=e.topAttribute||t.y,s=(a,l)=>{let h=this.getElement(l.id);we(l.data,n,h.x),we(l.data,o,h.y)};this.dataSource.eachNode((a,l)=>s(a,l)),this.dataSource.eachGroup((a,l)=>s(a,l))}setGrid(e){this.gridProfile==null?this.gridProfile=new uh({size:e}):this.gridProfile.grid=e}getGrid(){return this.gridProfile==null?null:this.gridProfile.grid}yf(){return this.gridProfile!=null&&this.gridProfile.snap}TA(e){if(this.gridProfile!=null){let t=this.$getSize(e),n=le({x:t.width,y:t.height},this.gridProfile.grid);return this.$setElementSizeInUI(e,n.x,n.y),{width:n.x,height:n.y}}return null}snapToGrid(e,t){t=t||this.getGrid();let n;if(t){e!=null&&(n=this.getObjectInfo(e,!1).obj),n!=null?this.magnetizer.setElements([n]):this.magnetizer.setElements(this.cl());let o=this.magnetizer.snapToGrid(t);return this.ys(o,FS),o}}autoSizeGroup(e,t){let n=new Set;return n.add(e),this.$_sizeGroupsToFit(n,null,null,t)[e.id]}$_sizeGroupsToFit(e,t,n,o){let s=this.Su(Array.from(e));t=t||{},n=n||{};let a={};return s.forEach(l=>{if(a[l.group.id]==null){let h=this.xf(l.group,o,t,n);Object.assign(a,h)}}),this.$trackGroupSizeChanges(a),a}xf(e,t,n,o){let s={};n=n||{},o=o||{};let a=l=>{let h=this.viewport.getGroupElement(l.id),d=this.viewport.$computeGroupContentExtents(l,!1,null,o,null),u=this.hl(l,n,o,d,t);u!=null&&(o[l.id]=u.size,s[l.id]={element:h,newGroupSize:u.size,originalGroupSize:u.originalSize},l.group&&a(l.group))};return e&&a(e),s}mf(){let e={orderedGroups:this.uf(),info:{}};return e.orderedGroups.forEach(t=>{let n=this.layoutMap.get(t.group.id);if(n!=null){let o=this.viewport.getGroupElement(t.group.id);n.relayout(null,s=>{e.info[t.group.id]={positions:s.positions,sizes:s.sizes,extents:s.bounds,element:o}})}}),e}getGroupContentExtents(e,t){return this.viewport.$computeGroupContentExtents(e,t,null,null,null)}$trackGroupSizeChanges(e){for(let t in e){let n=e[t];if(n.originalGroupSize.width!==n.newGroupSize.width||n.originalGroupSize.height!==n.newGroupSize.height){let o=n.element.modelObject,s={[this.$modelWidthAttribute]:n.newGroupSize.width,[this.$modelHeightAttribute]:n.newGroupSize.height};o.data[this.$modelWidthAttribute]=n.newGroupSize.width,o.data[this.$modelHeightAttribute]=n.newGroupSize.height;let a=this.viewport.updateElement(o.id,null,null,n.newGroupSize.width,n.newGroupSize.height,null,null,!1);this.$doVertexUpdated(a),this.$repaintUIElement(a,null,!0),this.model.fire(Nd,{group:o,originalGroupSize:n.originalGroupSize,newGroupSize:n.newGroupSize,source:this}),this.oe(l=>{l.$groupResized(n)}),this.model.fire(Te,{vertex:o,updates:s,originalData:o.data,reason:$S},null)}}}hl(e,t,n,o,s){t=t||{},n=n||{};let a=this.getGroupDefinition(e),l=s||a.autoShrink||a.autoGrow||a.autoSize||a.elastic,h=a.autoShrink===!0||a.elastic===!0||a.autoSize===!0&&a.autoShrink!==!1,d=a.autoGrow===!0||a.elastic===!0||a.autoSize===!0&&a.autoGrow!==!1;if(!l)return null;let u=P=>t[P]||this.getElementPosition(P),p=P=>n[P]||this.getElementSize(P),m=this.$_getGroupContentAreaInfo(e.id),g=m.contentArea,E=0,y=0,x,f,b=p(e.id),A=m.isGroupElement?p(e.id):this.$getSize(g),T=Math.max(A.width,b.width),S=Math.max(A.height,b.height),R=Object.assign({},u(e.id)),v,O=null;if(O!=null)E=O.layoutShiftX,y=O.layoutShiftY,x=O.width,f=O.height,v={x:R.x-E,y:R.y-y};else{let P=Op(o,a,!1,h,d,this.gridProfile);x=P.width,f=P.height,E=P.layoutShiftX,y=P.layoutShiftY,v={x:R.x-E,y:R.y-y}}if(x=parseInt(x,10),f=parseInt(f,10),this.$setElementSizeInUI(g,x,f),!m.isGroupElement){let P=this.viewport.getGroupElement(e.id),I=this.$getSize(P.el),C=I.width-T,_=I.height-S;if(!s&&h===!1){let w=!1;C<0&&(this.$setElementWidth(g,T-m.internalOffset.x),C=0,w=!0),_<0&&(this.$setElementHeight(g,S-m.internalOffset.y),_=0,w=!0),w&&(I=this.$getSize(P.el))}if(!s&&d===!1){let w=!1;C>0&&(this.$setElementWidth(g,T-m.internalOffset.x),C=0,w=!0),_>0&&(this.$setElementHeight(g,S-m.internalOffset.y),_=0,w=!0),w&&(I=this.$getSize(P.el))}x=I.width,f=I.height}return{position:v,size:{width:x,height:f},originalSize:{width:T,height:S},layoutShiftX:E,layoutShiftY:y}}autoSizeGroups(e,t){return e=e||this.getGroups(),this.$_sizeGroupsToFit(new Set(e),null,null,t)}Cu(e){let t={container:this.fe,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createDefaultLayoutAdapter()};return t.options.locationFunction||(t.options.locationFunction=n=>({x:we(n.data,this.$modelLeftAttribute),y:we(n.data,this.$modelTopAttribute)})),nt.get(e.type,t)}mu(e,t){let n=this.pu(t);n==null&&(n=this.$getManagedElement(t.id).el);let o={container:n,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createGroupLayoutAdapter(t)};return o.options.locationFunction||(o.options.locationFunction=s=>{let a={x:we(s.data,this.$modelLeftAttribute),y:we(s.data,this.$modelTopAttribute)};return j(a.x)&&(a.x=parseInt(a.x,10)),j(a.y)&&(a.y=parseInt(a.y,10)),a}),nt.get(e.type,o)}setLayout(e,t){e&&(this.$_layout=this.Cu(e),t||this.refresh())}adHocLayout(e){e&&this.model.transaction(()=>{for(let n in this.$_connMap){let o=this.$_connMap[n].edge;this.model.clearEdgeGeometry(o)}this.Cu(e).layout(n=>{for(let o in n.positions)this.Ef(o,n.positions[o])})})}$_doRenderTransientVertex(e,t,n,o,s,a,l){let h=this.$renderTransientVertex(t,n,o,s,a,l);return this.$appendVertexElement(h),this.$manage(h,e,t,n,null,!1)}$addTransientVertex(e,t,n,o,s,a){let l=this.model.$addTransientVertex(n,this),h=this.$_doRenderTransientVertex(l,e,t,n,o,s,a);return{vertex:l,el:h}}$renderDummyVertex(e){let t={x:e.data[this.$modelLeftAttribute]||0,y:e.data[this.$modelTopAttribute]||0};this.$_doRenderTransientVertex(e,t,{width:1,height:1},e.data,{},[Qi,wv].join(" "),{[te]:e.id})}$removeTransientVertex(e){this.model.$cleanupTransientVertex(e.modelObject,this)}$addTransientEdge(e,t,n,o){return this.model.$addTransientEdge(this,e,t,n,null,o)}$isUnattachedEdgeAllowed(e){let t=this.model.getEdgeType(e.data),n=this.view.getEdgeDefinition(t);return n.allowUnattached!=null?n.allowUnattached:this.$_allowUnattachedEdges===!0}Pu(e){(e.plugins||[]).forEach(n=>{this.Ou(n,!0)})}addPlugin(e){return this.Ou(e,!0)}Ou(e,t){let n=j(e)?e:e.type,o=j(e)?{}:e.options||{},s=cn.get(n);if(s!=null)return s.initialise(this,o),this.plugins.push(s),this.pluginMap.set(n,s),t&&this.fire(su,s),s}getPlugin(e){return this.pluginMap.get(e)}oe(e){this.plugins.forEach(t=>{try{e(t)}catch(n){U(`WARN: could not dispatch event to plugin ${t.id} [${n}]`)}})}registerDataHook(e){this.$_dataHooks.push(e)}save(e){let t={data:this.model.exportData(e),zoom:this.J};return this.$_dataHooks.forEach(n=>{n.save(t)}),t}saveToUrl(e){this.model.save(Object.assign(e,{data:this.save(e)}))}load(e,t){this.model.load({data:e.data,onload:()=>{e.zoom&&this.setZoom(e.zoom),this.$_dataHooks.forEach(n=>{n.load(e)}),t&&t()}})}$isArrayLike(e){return!j(e)&&Array.isArray(e)}};var zD=20,XD=20,wp=class wp extends Vn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"length");c(this,"foldback");c(this,"direction");c(this,"type",wp.type);c(this,"contentTags",[ee]);n=n||{},this.width=n.width||zD,this.length=n.length||XD,this.direction=(n.direction||1)<0?-1:1,this.foldback=n.foldback||.623}draw(e,t,n){let o,s,a,l,h;if(this.location>1||this.location<0){let g=this.location<0?1:0;o=Be(e,g,this.location,!1),s=Be(e,g,this.location-this.direction*this.length/2,!1),a=kt(o,s,this.length)}else if(this.location===1){if(o={x:e.paintInfo.tx,y:e.paintInfo.ty},s=Be(e,this.location,-this.length),a=kt(o,s,this.length),this.direction===-1){let g=a;a=o,o=g}}else if(this.location===0){if(a={x:e.paintInfo.sx,y:e.paintInfo.sy},s=Be(e,this.location,this.length),o=kt(a,s,this.length),this.direction===-1){let g=a;a=o,o=g}}else o=Be(e,this.location,this.direction*this.length/2),s=gr(e,this.location),a=kt(o,s,this.length);l=Dt(o,a,this.width),h=kt(o,a,this.foldback*this.length);let{stroke:d,fill:u,lineWidth:p}=this.$getStyle(t);return{atts:[{d:isNaN(h.x)||isNaN(h.y)?"M 0 0":"M"+o.x+","+o.y+" L"+l[0].x+","+l[0].y+" L"+h.x+","+h.y+" L"+l[1].x+","+l[1].y+" Z","stroke-width":p,stroke:d,fill:u}],xmin:Math.min(o.x,l[0].x,l[1].x),xmax:Math.max(o.x,l[0].x,l[1].x),ymin:Math.min(o.y,l[0].y,l[1].y),ymax:Math.max(o.y,l[0].y,l[1].y),tail:h}}};c(wp,"type","Arrow");var _r=wp;at.register(_r.type,_r);var Np=class Np extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",Np.type);this.foldback=1}};c(Np,"type","PlainArrow");var Dp=Np;at.register(Dp.type,Dp);var Mp=class Mp extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",Mp.type);this.length=this.length/2,this.foldback=2}};c(Mp,"type","Diamond");var Ip=Mp;at.register(Ip.type,Ip);var Wf="Custom",Zf=class extends pi{constructor(e,t,n){super(t,n);this.connection=t;c(this,"create");c(this,"isSimpleShape",!1);c(this,"rotatable");c(this,"type",Wf);this.create=n.create,this.rotatable=n.rotatable}updateFrom(e,t){}};function dn(i){return i.type===Wf}at.register(Wf,Zf);var jD=5,Gp=class Gp extends Vn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"Oe");c(this,"Hr");c(this,"type",Gp.type);c(this,"contentTags",[ke]);n=n||{},this.Oe=n.radius||jD,this.Hr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h;if(this.location===0)if(this.Hr==="center")l={x:e.paintInfo.sx,y:e.paintInfo.sy},h=Be(e,this.location,this.Oe);else{let d={x:e.paintInfo.sx,y:e.paintInfo.sy},u=Be(e,this.location,this.Oe);l=kt(d,u,this.Oe),h=Be(e,this.location,2*this.Oe)}else if(this.location===1)if(this.Hr==="center")l={x:e.paintInfo.tx,y:e.paintInfo.ty},h=Be(e,this.location,-this.Oe);else{let d={x:e.paintInfo.tx,y:e.paintInfo.ty},u=Be(e,this.location,-this.Oe);l=kt(d,u,this.Oe),h=Be(e,this.location,-2*this.Oe)}else l=gr(e,this.location),h=Be(e,this.location,this.Oe);return{atts:[{cx:l.x,cy:l.y,r:this.Oe,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.Oe,xmax:l.x+this.Oe,ymin:l.y-this.Oe,ymax:l.y+this.Oe,tail:h}}};c(Gp,"type","Dot");var Vp=Gp;at.register(Vp.type,Vp);var HD=10,kD=10,Bp=class Bp extends Vn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"height");c(this,"_u");c(this,"Hr");c(this,"type",Bp.type);c(this,"contentTags",[ee]);n=n||{},this.width=n.width||HD,this.height=n.height||kD,this._u=n.rotate===!0,this.Hr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h,d,u,p,m,g,E,y,x,f,b,A,T,S,R;if(this._u){if(this.location===0){let v={x:e.paintInfo.sx,y:e.paintInfo.sy},O,P;this.Hr==="center"?(P=Be(e,this.location,this.width/2),O=kt(P,v,this.width)):(O=v,P=Be(e,this.location,this.width)),S=Dt(P,O,this.height),R=Dt(O,P,this.height),m=P}else if(this.location===1){let v={x:e.paintInfo.tx,y:e.paintInfo.ty},O,P;this.Hr==="center"?(P=Be(e,this.location,-this.width/2),O=kt(P,v,this.width)):(O=v,P=Be(e,this.location,-this.width)),S=Dt(O,P,this.height),R=Dt(P,O,this.height),m=P}else{let v=Be(e,this.location,this.width/2),O=gr(e,this.location),P=kt(v,O,this.width);S=Dt(v,P,this.height),R=Dt(P,v,this.height),m=P}g=S[0].x,E=S[0].y,y=S[1].x,x=S[1].y,f=R[1].x,b=R[1].y,A=R[0].x,T=R[0].y}else{let v;this.location===0?v={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?v={x:e.paintInfo.tx,y:e.paintInfo.ty}:v=gr(e,this.location),m=v,g=v.x-this.width/2,E=v.y-this.height/2,y=g+this.width,x=E,f=y,b=E+this.height,A=g,T=E+this.height}return h=Math.min(g,y,f,A),d=Math.max(g,y,f,A),u=Math.min(E,x,b,T),p=Math.max(E,x,b,T),l=`M ${g} ${E} L ${y} ${x} L ${f} ${b} L ${A} ${T} Z`,{atts:[{"stroke-width":a,stroke:o,fill:s,d:l}],xmin:h,xmax:d,ymin:u,ymax:p,tail:m}}};c(Bp,"type","Rectangle");var $p=Bp;at.register($p.type,$p);var WD=8,ZD=5,Up=class Up extends Vn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"rx");c(this,"ry");c(this,"type",Up.type);c(this,"contentTags",[PC]);n=n||{},this.rx=n.rx||WD,this.ry=n.ry||ZD}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l;return this.location===0?l={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?l={x:e.paintInfo.tx,y:e.paintInfo.ty}:l=gr(e,this.location),{atts:[{cx:l.x,cy:l.y,rx:this.rx,ry:this.ry,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.rx,xmax:l.x+this.rx,ymin:l.y-this.ry,ymax:l.y+this.ry,tail:Be(e,this.location,(this.ry+this.rx)/2)}}};c(Up,"type","Ellipse");var Fp=Up;at.register(Fp.type,Fp);var Yp=class{constructor(r,e){this.surface=r;c(this,"ir");c(this,"Ru");e=e||{edgeMappings:[]},this.ir=e.edgeMappings||[],this.Ru=this.surface.model.edgeTypeFunction,this.bf()}computeTypes(r){let e=[this.Ru(r)];for(let t=0;t<this.ir.length;t++){let n=this.ir[t].property,o=this.ir[t].mappings;if(j(n)){if(r[n]!=null){let s=j(r[n])?r[n].split(" "):[r[n]];e.push(...s.filter(a=>o[a]!=null).map(a=>`${n}_${a}`))}o[Er]!=null&&r[n]!=null&&e.push(`${n}_${Er}`)}else{let s=n.map(a=>r[a]);if(s.every(a=>a!=null)){let a=s.join(" ");o[a]!=null&&e.push(`${n.join("_")}_${a.replace(/ /g,"_")}`)}}}return e.join(" ")}bf(){for(let r=0;r<this.ir.length;r++){let e=this.ir[r].property,t=this.ir[r].mappings;for(let n in t)if(t.hasOwnProperty(n)){let o=j(e)?`${e}_${n}`:`${e.join("_")}_${n.replace(/ /g,"_")}`;this.surface.$registerConnectionType(o,t[n])}}this.surface.model.edgeTypeFunction=r=>this.computeTypes(r)}getPropertyMappings(){return this.ir}};function JD(i,r,e,t,n,o,s){return new Touch({target:i,identifier:B(),pageX:r,pageY:e,screenX:t,screenY:n,clientX:o||t,clientY:s||n})}function KD(...i){let r=[];return r.push(...i),r.item=function(e){return this[e]},r}function qD(i,r,e,t,n,o,s){return KD(JD(i,r,e,t,n,o,s))}function ga(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function ph(i){return i.srcElement||i.target}function Jf(i,r,e,t){if(t){let n=i.composedPath?i.composedPath():i.path;if(typeof n!="undefined"&&n.indexOf)return{path:n,end:n.indexOf(e)};{let o={path:[],end:-1},s=a=>{o.path.push(a),a===e?o.end=o.path.length-1:a.parentNode!=null&&s(a.parentNode)};return s(r),o}}else return{path:[r],end:1}}function QD(i,r){let e=0,t;for(e=0,t=i.length;e<t&&i[e][0]!==r;e++);e<i.length&&i.splice(e,1)}var eN=1,wC=!1,DC=!1;function Gn(){return wC||"ontouchstart"in document.documentElement||navigator.maxTouchPoints!=null&&navigator.maxTouchPoints>0}function Ei(){return DC||"onmousedown"in document.documentElement}function tN(i){wC=i}function rN(i){DC=i}var gi={[me]:mS,[ae]:gS,[se]:ES};function Kf(i,r){if(i==null)return{x:0,y:0};let e=es(i),t=ty(e,0);return r(t)}function Ee(i){return Kf(i,r=>({x:r.pageX,y:r.pageY}))}function nN(i){return Kf(i,r=>({x:r.screenX,y:r.screenY}))}function iN(i){return Kf(i,r=>({x:r.clientX,y:r.clientY}))}function ty(i,r){return i.item?i.item(r):i[r]}function es(i){return i.touches!=null&&i.touches.length>0?i.touches:i.changedTouches&&i.changedTouches.length>0?i.changedTouches:i.targetTouches&&i.targetTouches.length>0?i.targetTouches:[i]}function VC(i){return es(i).length}function oN(i){if(i==null)return{x:0,y:0};if(i.pageX!==null)return{x:i.pageX,y:i.pageY};{let r=es(i),e=ty(r,0);return e!=null&&e.pageX!=null?{x:e.pageX,y:e.pageY}:{x:0,y:0}}}function zp(i,r,e,t,n){IC(i,r,e),t.or=e.or,i.addEventListener&&i.addEventListener(r,e,!1,n)}function mh(i,r,e){e!=null&&NC(i,t=>{sN(t,r,e),e.or!=null&&t.removeEventListener&&(t.removeEventListener(r,e,!1),Gn()&&gi[r]&&t.removeEventListener(gi[r],e,!1)),e.Lu&&mh(i,e.Lu[1],e.Lu[0])})}function NC(i,r){if(i==null)return;let e=typeof i=="string"?document.querySelectorAll(i):Array.isArray(i)?i:[i];for(let t=0;t<e.length;t++)r(e[t])}function IC(i,r,e){let t=eN++;return i.kr=i.kr||{},i.kr[r]=i.kr[r]||{},i.kr[r][t]=e,e.or=t,t}function sN(i,r,e){if(i.kr&&i.kr[r]&&delete i.kr[r][e.or],e.Wr){for(let t=0;t<e.Wr.length;t++)mh(i,e.Wr[t][0],e.Wr[t][1]);e.Wr.length=0}e.dl&&e.dl()}var aN=/:not\(([^)]+)\)/;function Xp(i,r,e,t){if(i==null)return e;{let n=i.split(","),o=[],s=[];n.forEach(l=>{let h=l.match(aN);h!=null?s.push(h[1]):o.push(l)}),s.length>0&&o.length===0&&o.push(Er);let a=l=>{a.or=e.or;let h=ph(l),d=!1,u=h,p=Jf(l,h,r,i!=null);if(p.end!=-1)for(let m=0;!d&&m<p.end;m++){u=p.path[m];for(let g=0;g<s.length;g++)if(ga(u,s[g],r))return;for(let g=0;!d&&g<o.length;g++)if(ga(u,o[g],r)){e.apply(u,[l,u]),d=!0;break}}};return lN(e,t,a),a}}function lN(i,r,e){i.Wr=i.Wr||[],i.Wr.push([r,e])}var jp=(i,r,e,t,n)=>{if(Gn()&&gi[r]){let o=Xp(t,i,e,gi[r]);zp(i,gi[r],o,e,n)}r===uS&&i.getAttribute(Pf)==null&&i.setAttribute(Pf,"1"),zp(i,r,Xp(t,i,e,r),e,n)},qf={[W]:{touches:1,taps:1},[Ur]:{touches:1,taps:2},[At]:{touches:2,taps:1}};function MC(i,r,e,t){for(let n in e.Me[i])e.Me[i].hasOwnProperty(n)&&e.Me[i][n].apply(t,[r])}var Qf=class{static generate(r,e){return(t,n,o,s)=>{if(n==At&&Ei())jp(t,n,o,s);else{if(t.He==null){let a=t.He={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},l=function(){a.down=!1},h=function(){a.taps=0},d=p=>{let m=ph(p),g=Jf(p,m,t,s!=null),E=!1;for(let y=0;y<g.end;y++){if(E)return;m=g.path[y];for(let x=0;x<a.downSelectors.length;x++)if(a.downSelectors[x]==null||ga(m,a.downSelectors[x],t)){a.down=!0,setTimeout(l,r),setTimeout(h,e),E=!0;break}}},u=p=>{if(a.down){let m=ph(p),g,E;a.taps++;let y=VC(p);for(let x in qf)if(qf.hasOwnProperty(x)){let f=qf[x];if(f.touches===y&&(f.taps===1||f.taps===a.taps))for(let b=0;b<a[x].length;b++){E=Jf(p,m,t,a[x][b][1]!=null);for(let A=0;A<E.end;A++)if(g=E.path[A],a[x][b][1]==null||ga(g,a[x][b][1],t)){a[x][b][0].apply(g,[p,g]);break}}}}};t.He.downHandler=d,t.He.upHandler=u,jp(t,me,d),jp(t,ae,u)}t.He.downSelectors.push(s),t.He[n].push([o,s]),o.dl=function(){t.He!=null&&(Nt(t.He.downSelectors,a=>a===s),QD(t.He[n],o),t.He.downSelectors.length===0&&(mh(t,me,t.He.downHandler),mh(t,ae,t.He.upHandler),delete t.He))}}}}},ey=class{static generate(){let r=[];return(e,t,n,o)=>{if(!e.Me){e.Me={over:!1,mouseenter:[],mouseexit:[]};let s=l=>{let h=ph(l);(o==null&&h==e&&!e.Me.over||ga(h,o,e)&&(h.Me==null||!h.Me.over))&&(MC(GE,l,e,h),h.Me=h.Me||{},h.Me.over=!0,r.push(h))},a=l=>{let h=ph(l);for(let d=0;d<r.length;d++)h==r[d]&&!ga(l.relatedTarget||l.toElement,"*",h)&&(h.Me.over=!1,r.splice(d,1),MC($E,l,e,h))};zp(e,st,Xp(o,e,s,st),s),zp(e,ot,Xp(o,e,a,ot),a)}n.dl=function(){delete e.Me[t][n.or]},IC(e,t,n),e.Me[t][n.or]=n}}},xe=class{constructor(r){c(this,"clickThreshold");c(this,"dblClickThreshold");c(this,"tapHandler");c(this,"mouseEnterExitHandler");r=r||{},this.clickThreshold=r.clickThreshold||250,this.dblClickThreshold=r.dblClickThreshold||450,this.mouseEnterExitHandler=ey.generate(),this.tapHandler=Qf.generate(this.clickThreshold,this.dblClickThreshold)}Af(r,e,t,n,o){if(t==null)return;let s=r;e===W||e===Ur||e===At?this.tapHandler(s,e,t,n,o):e===GE||e==$E?this.mouseEnterExitHandler(s,e,t,n,o):jp(s,e,t,n,o)}on(r,e,t,n,o){let s=n==null?null:t,a=n==null?t:n;return this.Af(r,e,a,s,o),this}off(r,e,t){return mh(r,e,t),this}trigger(r,e,t,n,o){let s=Ei()&&(typeof MouseEvent=="undefined"||t==null||t.constructor===MouseEvent),a=Gn()&&!Ei()&&gi[e]?gi[e]:e,l=!(Gn()&&!Ei()&&gi[e]),h=Ee(t),d=nN(t),u=iN(t);return NC(r,p=>{let m;t=t||{screenX:d.x,screenY:d.y,clientX:u.x,clientY:u.y};let g=f=>{n&&(f.payload=n)},E={TouchEvent:f=>{let b=qD(p,h.x,h.y,d.x,d.y,u.x,u.y);(f.initTouchEvent||f.initEvent)(a,!0,!0,window,null,d.x,d.y,u.x,u.y,!1,!1,!1,!1,b,b,b,1,0)},MouseEvents:f=>{f.initMouseEvent(a,!0,!0,window,o==null?1:o,d.x,d.y,u.x,u.y,t.ctrlKey===!0,t.altKey===!0,t.shiftKey===!0,t.metaKey===!0,1,p)}},y=!l&&!s&&Gn()&&gi[e],x=y?"TouchEvent":"MouseEvents";m=document.createEvent(x),E[x](m),g(m),p.dispatchEvent(m)}),this}};var hN=["stroke-linejoin","stroke-dashoffset","stroke-linecap"];function de(i,r){for(let e in r){let t=r[e];if(e==="style"&&typeof t=="object"){let n=Object.entries(t);for(let o=0;o<n.length;o++){let s=n[o];i.style[s[0]]=s[1]}}else i.setAttribute(e,""+r[e])}}function G(i,r,e,t){return r=r||{},fa(Gt,i,e,t,r)}function GC(i,r){let e=r.map(t=>G("stop",{offset:`${t[0]}%`,"stop-color":t[1]}));i.replaceChildren(...e)}function cN(i,r){i.gradient==null&&(i.gradient=G("linearGradient",{id:yl(),gradientUnits:"userSpaceOnUse"}),i.canvas.insertBefore(i.gradient,i.canvas.childNodes[0])),i.gradient.setAttribute("x1",`${i.x}`),i.gradient.setAttribute("x2",`${i.x+i.width}`),GC(i.gradient,r)}function $C(i,r,e){let t=yl(),n=G("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:i,x2:r});return GC(n,e),{id:t,g:n}}function ry(i,r,e,t){r.setAttribute(TC,e.fill?e.fill:pt),!t&&e.gradient?(cN(i,e.gradient),r.setAttribute(jf,`url(#${i.gradient.id})`)):r.setAttribute(jf,e.stroke?e.stroke:pt),e.strokeWidth&&r.setAttribute(vC,e.strokeWidth),e.dashArray?r.setAttribute(kf,e.dashArray):r.removeAttribute(kf),hN.forEach(n=>{e[n]&&r.setAttribute(n,e[n])})}function Ea(i,r,e){e>=0?i.insertBefore(r,i.childNodes[e]):i.appendChild(r)}function dN(i,r,e){let t=[];return i!=null&&i.split(/\n/).forEach(o=>{t.push(...uN(o,r,e))}),t}function uN(i,r,e){let t=(i||"").split(/\s/),n=[];if(t.length===0)return[];if(t.length===1)return[i];let o=[t[0]],s=1,a=0,l=!1,h=G(Hf);for(e.appendChild(h);!l;){let d=t.slice(a,s+1),u=d.join(" ");h.innerHTML=u,h.getBBox().width<r||o.length===0?(o=d.slice(),s+=1,s>=t.length&&(l=!0)):(n.push(o),a=s,o=[t[a]],s=a+1,s>=t.length&&(l=!0))}return e.removeChild(h),n.push(o),n.map(d=>d.join(" "))}function pN(i,r,e){return dN(i,r,e).map(t=>{let n=G(Hf);return n.innerHTML=t,n})}function Hp(i,r,e){let n=i.getAttribute(Q)||"50%",o=pN(r,e,i);i.innerHTML="";let s=0;return o.forEach((a,l)=>{i.appendChild(a),a.setAttribute("dominant-baseline","hanging"),a.setAttribute(Q,n),a.setAttribute("dy",s==0?"0":`${s+3}`),s=a.getBBox().height}),o.length>0&&o[0].setAttribute("dy",`${-i.getBBox().height/2}`),i}var ny="data-vjs-container",iy="data-vjs-group-content",kp="data-vjs-expanded-content",Wp="data-vjs-collapsed-content",yr="data-vjs-enabled",ts="data-vjs-scope",gh="data-vjs-is-group",Hme="element",kme="connection",Ke="div",oy="position",Zr=z(ca),BC=Ae(iy),$n=z(da),FC=z(op);function $t(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function ie(i,r){i.stopPropagation?i.stopPropagation():i.returnValue=!1,!r&&i.preventDefault&&i.preventDefault()}function Bt(i,r,e,t){if(i.contains(e))return null;if(t&&$t(i,r,e))return i;for(i=i.parentNode;i!=null&&i!==e;){if($t(i,r))return i;i=i.parentNode}}function hge(i,r,e){e=e||document.body;let t=[],n=Bt(i,r,e,!1);for(;n!=null;)t.push(n),n=Bt(n,r,e,!1);return t}function rs(i){return i.srcElement||i.target}function UC(i,r){r=Ct(r),typeof i.className.baseVal!="undefined"?i.className.baseVal=r:i.className=r}function Zp(i){return i.className!=null?typeof i.className.baseVal=="undefined"?i.className:i.className.baseVal:""}function YC(i,r,e){let t=r==null?[]:Array.isArray(r)?r:r.split(/\s+/),n=e==null?[]:Array.isArray(e)?e:e.split(/\s+/),o=Zp(i),s=o.split(/\s+/),a=(l,h)=>{for(let d=0;d<h.length;d++)if(l)s.indexOf(h[d])===-1&&s.push(h[d]);else{let u=s.indexOf(h[d]);u!==-1&&s.splice(u,1)}};a(!0,t),a(!1,n),UC(i,s.join(" "))}function Bn(i){return!j(i)&&!Array.isArray(i)&&i.length!=null&&i.documentElement==null&&i.nodeType==null}function cge(i){return!j(i)&&(Array.isArray(i)||Bn(i))}function XC(i){return!j(i)&&(Array.isArray(i)||Bn(i))}function jC(i){return Zp(i)}function L(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?Ct(n).split(/\s+/).forEach(s=>{t.classList.add(s)}):YC(t,n))};Bn(i)?i.forEach(t=>e(t,r)):e(i,r)}function un(i,r){return i.classList?i.classList.contains(r):Zp(i).indexOf(r)!==-1}function F(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?Ct(n).split(/\s+/).forEach(s=>{t.classList.remove(s)}):YC(t,null,n))};Bn(i)?i.forEach(t=>e(t,r)):e(i,r)}function sy(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?t.classList.toggle(n):un(t,n)?F(t,n):L(t,n))};Bn(i)?i.forEach(t=>e(t,r)):e(i,r)}function Xt(i,r=[],e=[]){let n=Zp(i).split(" ").filter(o=>e.indexOf(o)===-1&&r.indexOf(o)===-1);n.push(...r),UC(i,n.join(" "))}function HC(i,r){let e=null;if(arguments.length===1){if(!j(i)){let t=document.createDocumentFragment();return t.appendChild(i),Array.from(t.childNodes)}e=Array.from(document.querySelectorAll(i))}else e=Array.from(i.querySelectorAll(r));return e}function Jr(i,r,e,t){return fa(null,i,r,e,t)}function fa(i,r,e,t,n){let o=i==null?document.createElement(r):document.createElementNS(i,r);return e=e||{},Object.assign(o.style,e),t&&L(o,t),de(o,n||{}),o}function Kr(i,r,e,t,n,o,s){let a=fa(i,r||Ke,e,t,n);return o!=null&&(s?o.insertBefore(a,o.lastChild):o.appendChild(a)),a}function no(i,r){let e=i.getBoundingClientRect(),t=document.body,n=document.documentElement,o=window.pageYOffset||n.scrollTop||t.scrollTop,s=window.pageXOffset||n.scrollLeft||t.scrollLeft,a=n.clientTop||t.clientTop||0,l=n.clientLeft||t.clientLeft||0,h=e.top+o-a,d=e.left+s-l;return{x:r?d:Math.round(d),y:r?h:Math.round(h)}}function Jp(i){return i==null?"HTML":i instanceof SVGElement?"SVG":"HTML"}function wt(i){return Jp(i)==="SVG"}function io(i){return i.nodeType!=null&&i.nodeType!==3&&i.nodeType!==8}var zC=class i{static setNodeText(r,e){r.text=e;try{r.textContent=e}catch(t){}}static getNodeText(r){return r!=null?r.text||r.textContent:""}static getChild(r,e){let t=null;for(let n=0;n<r.childNodes.length;n++)if(r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e){t=r.childNodes[n];break}return t}static getChildren(r,e){let t=[];for(let n=0;n<r.childNodes.length;n++)r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e&&t.push(r.childNodes[n]);return t}static xmlToString(r){try{return new XMLSerializer().serializeToString(r).replace(/\s*xmlns=\"http\:\/\/www.w3.org\/1999\/xhtml\"/g,"")}catch(e){try{return r.xml}catch(t){throw new Error("Cannot serialize XML "+t)}}}static createElement(r,e,t){let n;if(n=document.createElement(r),t&&i.setNodeText(n,t),e)for(let o in e)n.setAttribute(o,e[o]);return n}};function ya(i,r){r=r||150;let e=null;return()=>{window.clearTimeout(e),e=window.setTimeout(i,r)}}function xa(i){let r=new XMLHttpRequest,e=i.type||"GET";if(r){let t=i.dataType===Wt?o=>JSON.parse(o):o=>o;r.open(e,i.url,!0);let n=i.headers||{};for(let o in n)r.setRequestHeader(o,n[o]);r.onreadystatechange=()=>{r.readyState===4&&((""+r.status)[0]==="2"?i.success(t(r.responseText)):i.error&&i.error(r.responseText,r.status))},r.send(i.data?JSON.stringify(i.data):null)}else i.error&&i.error("ajax not supported")}function Kp(i,r,e){let t=r.getBoundingClientRect(),n=Ee(i);return{x:t.width===0?0:(n.x-t.x)/t.width,y:t.height===0?0:(n.y-t.y)/t.height}}function kC(i){return i==null?!1:Object.prototype.toString.call(i).match(/\[object .*Element]/)!=null}function dge(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Text]"}function fi(i,r){return"["+i+"='"+r+"']"}function uge(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function pge(i){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r=>{i(r.matches)})}function z(...i){return i.map(r=>"."+r).join(",")}function mge(...i){return i.join(" ")}function Ae(...i){return i.map(r=>"["+r+"]").join(",")}var Eh=Ae(mt);function ba(i,r,e){return function(t){return t[i]/r*(e?-1:1)}}var WC="deltaY",ZC="deltaX",mN="wheelDeltaY",gN="wheelDeltaX",qp="webkit",Aa="mac",fh="win",ay="ie",ly="safari",hy="firefox",cy="default";function JC(i){return i.deltaY*(i.deltaMode===1?25:1)/120}function KC(i){return i.deltaX*(i.deltaMode===1?25:1)/120}var dy={[qp]:{[Aa]:ba(WC,120),[fh]:ba(WC,100)},[ly]:ba(mN,120,!0),[hy]:{[Aa]:JC,[fh]:JC},[ay]:function(i){return i.wheelDelta/120},[cy]:function(i){return i.deltaY||i.wheelDelta}},uy={[qp]:{[Aa]:ba(ZC,120),[fh]:ba(ZC,100)},[ly]:ba(gN,120,!0),[hy]:{[Aa]:KC,[fh]:KC},[ay]:function(i){return i.wheelDelta/120},[cy]:function(i){return i.deltaX||i.wheelDelta}},qC=typeof navigator!="undefined",QC=qC?/Mac/.test(navigator.userAgent)?Aa:fh:Aa,Sa=qC?navigator.userAgent.indexOf("Firefox")!==-1?hy:/Chrome/.test(navigator.userAgent)?qp:/Safari/.test(navigator.userAgent)?ly:/WebKit/.test(navigator.userAgent)?qp:/Trident/.test(navigator.userAgent)?ay:"default":cy,EN=typeof dy[Sa]=="function"?dy[Sa]:dy[Sa][QC],fN=typeof uy[Sa]=="function"?uy[Sa]:uy[Sa][QC],yN=function(i){return EN(i||event)},xN=function(i){return fN(i||event)},bN=function(i,r,e){let t=n=>{let o=yN(n),s=xN(n);n.normalizedWheelDelta=o,(!e||n.metaKey||n.ctrlKey)&&i(n,s,o,n.metaKey||n.ctrlKey)};return i.Sf=t,t},AN=typeof document!="undefined",eP=AN?"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll":"wheel";function yh(i,r,e,t){let n=bN(r,e,t);return i.addEventListener?i.addEventListener(eP,n,!1):i.attachEvent&&i.attachEvent("onmousewheel",n),n}function xh(i,r){let e=r.Sf;e!=null&&(i.removeEventListener?i.removeEventListener(eP,e,!1):i.detachEvent&&i.detachEvent("onmousewheel",e))}function tP(i){return i.startEditingPath!=null&&i.stopEditingPath!=null}var rP="vjs-paper",nP="vjs-paper-no-scale",iP="vjs-paper-canvas",oP=20,iEe="vjs-paper-node",bh="start",ns="center",Ah="end";function sP(i){return kr(i)&&i.useHTMLElement===!0}var Sh=class{constructor(r,e){this.instance=r;this.overlay=e;c(this,"htmlElementOverlay");this.htmlElementOverlay=e}static getElement(r,e,t,n){if(e.contentElement==null){if(n&&t){e.contentElement=n(t);let s=r.overlayClass+" "+(e.cssClass?e.cssClass:"");L(e.contentElement,s)}else e.contentElement=Jr(Ke,{},r.overlayClass+" "+(e.cssClass?e.cssClass:""));t&&t.edge&&e.contentElement.setAttribute(Qe,t.edge.id),e.contentElement.setAttribute(ip,e.id);for(let s in e.attributes)e.contentElement.setAttribute(s,e.attributes[s]);e.contentElement.style.position=qe,r.$appendOverlayElement(e.contentElement);let o="translate(-50%, -50%)";e.contentElement.style.webkitTransform=o,e.contentElement.style.mozTransform=o,e.contentElement.style.msTransform=o,e.contentElement.style.oTransform=o,e.contentElement.style.transform=o,e.visible||L(e.contentElement,oh),e.contentElement.jtk={overlay:e}}return e.contentElement}static destroy(r){r.contentElement&&r.contentElement.parentNode&&r.contentElement.parentNode.removeChild(r.contentElement),delete r.contentElement}};function py(i,r,e){if(r.contentElements==null){r.contentElements=[];let t=Object.assign({[ip]:r.id},r.attributes);e.forEach(n=>{let o=G(n,t),s=i.overlayClass+" "+(r.cssClass?r.cssClass:"");L(o,s),o.jtk={overlay:r},r.contentElements.push(o)})}return r.contentElements.forEach(t=>{var o;let n=t.parentNode;if(n==null){let s=(o=r.connection)==null?void 0:o.connector;n=s!=null?s.canvas:null,n!=null&&Ea(n,t,-1)}}),r.contentElements}function aP(i,r,e,t){let n=r;py(i,n,r.contentTags);let o=[-t.x,-t.y],s=Object.assign({transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"},e.paintStyle);n.contentElements.forEach((a,l)=>{let h=e.atts[l],d=Object.assign(s,h);de(a,d)})}function Th(i,r){return py(i,r,r.contentTags)}function is(i,r){return py(i,r,[q]),r.bgElement==null&&(r.bgElement=G(Z),r.contentElements[0].appendChild(r.bgElement)),r.textElement==null&&(r.textElement=G(et),r.contentElements[0].appendChild(r.textElement)),r.contentElements}function lP(i,r,e,t){is(i,r);let n=rn(r.label)?r.label(r):r.label,o=[-t.x,-t.y],s="translate("+o[0]+","+o[1]+")";r.rotatable&&e.d.rotation&&(s+=` rotate(${e.d.rotation}, ${e.d.loc.x}, ${e.d.loc.y})`);let a={x:e.d.loc.x,y:e.d.loc.y,"text-anchor":"middle","dominant-baseline":"middle","pointer-events":"visibleStroke",transform:s};r.font&&r.font.size&&(a["font-size"]=r.font.size),r.font&&r.font.style&&(a["font-style"]=r.font.style),r.font&&r.font.family&&(a["font-family"]=r.font.family),de(r.textElement,a),r.textElement.textContent=n;let l=r.textElement.getBBox(),h=i.currentZoom,d=l.width/h,u=l.height/h,p=5,m={transform:s,x:a.x-p-d/2,y:a.y-p-u/2,width:d+2*p,height:u+2*p,fill:n==null||n.length===0?"none":"white"};de(r.bgElement,m)}function my(i,r){i.contentElements!=null&&i.contentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),i.backgroundContentElements!=null&&i.backgroundContentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),delete i.contentElements,delete i.backgroundContentElements}var Qp=class extends pi{constructor(){super(...arguments);c(this,"contentElements");c(this,"backgroundContentElements")}};var yi="transform",gy=/translate\(([-0-9\.]+),\s*([-0-9\.]+)\)/,hP=/rotate\(([-0-9\.]+)\)/,SN=/translate\(([-0-9\.]+[%|px|em|rem]?),\s*([-0-9\.]+[%|px|em|rem]+)\)/;function We(i){let r=i;return r.width&&r.width.baseVal?ON(r):r.getBBox?_N(r):TN(i)}function mn(i,r){let e=i;return wt(i.parentElement)?vh(e,r):e.x&&e.x.baseVal?CN(e):vN(e)}function Ne(i,r){let e=i;wt(i.parentElement)?pn(e,r):(e.x&&e.x.baseVal&&PN(e,r),tr(e,r))}function em(i,r,e){if(i===r)return{x:0,y:0};let t=r.createSVGPoint();if(e){let l=i.getBBox();t.x=l.x,t.y=l.y}else t.x=0,t.y=0;let n=i.getScreenCTM(),o=t.matrixTransform(n),s=r.getScreenCTM().inverse(),a=o.matrixTransform(s);return{x:Math.round(a.x),y:Math.round(a.y)}}function cP(i,r,e,t,n){let o=i;if(o instanceof HTMLElement)o.style[e]=`${r}px`;else if(o[t]&&o[t].baseVal)o.setAttribute(t,r);else if(o.localName===q){let s=vh(o);s[n]=r,pn(o,s)}}function mP(i,r){cP(i,r,He,Q,Q)}function gP(i,r){cP(i,r,Se,ye,ye)}function Rr(i,r,e){let t=i;t instanceof HTMLElement?dP(i,r,e):t.width&&t.width.baseVal&&(dP(i,r,e),i.setAttribute(Pe,`${r}`),i.setAttribute(Me,`${e}`))}function EP(i,r){let e=i;e instanceof HTMLElement?uP(i,r):e.width&&e.width.baseVal&&(uP(i,r),i.setAttribute(Pe,`${r}`))}function fP(i,r){let e=i;e instanceof HTMLElement?pP(i,r):e.height&&e.height.baseVal&&(pP(i,r),i.setAttribute(Me,`${r}`))}function TN(i){return{width:i.offsetWidth,height:i.offsetHeight}}function vN(i){return{x:parseFloat(i.offsetLeft),y:parseFloat(i.offsetTop)}}function HEe(i){return{x:parseInt(i.style.left,10),y:parseInt(i.style.top,10)}}function tr(i,r){i.style.left=r.x+"px",i.style.top=r.y+"px"}function dP(i,r,e){i.style.width=`${r}px`,i.style.height=`${e}px`}function uP(i,r){i.style.width=`${r}px`}function pP(i,r){i.style.height=`${r}px`}function CN(i){try{return{x:parseFloat(i.x.baseVal.value),y:parseFloat(i.y.baseVal.value)}}catch(r){return{x:0,y:0}}}function PN(i,r){i.setAttribute("x",`${r.x}`),i.setAttribute("y",`${r.y}`)}function ON(i){try{return{width:parseFloat(i.width.baseVal.value),height:parseFloat(i.height.baseVal.value)}}catch(r){return{width:0,height:0}}}function _N(i){try{let r=i.getBBox();return{width:r.width,height:r.height}}catch(r){return{width:0,height:0}}}function vh(i,r){let e,t,n,o,s;if(e=i.getAttribute(yi),e!=null){if(t=e.match(gy),o=parseFloat(t[1]),s=parseFloat(t[2]),n=e.match(hP),n!=null){let a=parseFloat(n[1]),l=r||i.getBBox(),h={x:o+l.width/2,y:s+l.height/2},d=Ie(h,{x:o,y:s},a),u=Ie({x:o,y:s},d,-a);o=u.x,s=u.y}return{x:o,y:s}}else if(e=i.style.transform,e!=null){t=e.match(gy);try{return{x:parseFloat(t[1]),y:parseFloat(t[2])}}catch(a){return{x:0,y:0}}}return{x:0,y:0}}function xi(i,r){if(wt(i.parentElement)){let t=(i.getAttribute(yi)||"").match(gy);i.setAttribute(yi,(t==null?"":`${t[0]} `)+`rotate(${r})`)}else{let e=(i.style.transform||"").match(SN),t=r==0?"":"rotate("+r+"deg)";i.style.transform=(e==null?"":`${e[0]} `)+t,i.style.transformOrigin="center center"}}function pn(i,r){let t=(i.getAttribute(yi)||"").match(hP);i.setAttribute(yi,`translate(${r.x.toFixed(2)}, ${r.y.toFixed(2)})`+(t==null?"":` ${t[0]}`))}function RN(i,r,e){let t={x:r.x+i.width/2,y:r.y+i.height/2};return Ie(r,t,e)}function yP(i,r){let e=RN(i,r,i.r);pn(i.el,e),xi(i.el,i.r)}var tm=class{static paint(r,e,t){if(t!=null){let n=[r.width,r.height];if(isFinite(n[0])&&isFinite(n[1])){let o={[Pe]:""+(n[0]||0),[Me]:""+(n[1]||0)};de(r.canvas,o),Ne(r.canvas,r)}}}};var Ey="vjs-surface",xP="vjs-surface-direct-render",bP="vjs-surface-touch-device",AP="vjs-surface-pointer-device",fy="vjs-surface-nopan",yy="vjs-surface-canvas",xy="vjs-surface-pan",ife="vjs-surface-pan-left",ofe="vjs-surface-pan-top",sfe="vjs-surface-pan-right",afe="vjs-surface-pan-bottom",by="vjs-surface-pan-active",Ay="vjs-surface-flash",SP="vjs-flash-vertex",Sy="vjs-surface-panning",Ty="vjs-surface-element-dragging",Ch="vjs-element-dragging",vy="vjs-group-child-element-dragging",Ph="vjs-most-recently-dragged",Fn="vjs-surface-edge-dragging",Cy="vjs-edge-relocating",rm="vjs-edge-will-relocate",TP="vjs-lasso",Oh="vjs-lasso-mask",vP="vjs-lasso-mask-left",CP="vjs-lasso-mask-top",PP="vjs-lasso-mask-right",OP="vjs-lasso-mask-bottom",nm="vjs-miniview",_P="vjs-miniview-canvas",RP="vjs-miniview-panner",LP="vjs-miniview-lasso",wP="vjs-miniview-element",DP="vjs-miniview-group-element",_h="vjs-miniview-selected",Py="vjs-miniview-panning",NP="vjs-miniview-collapse",im="vjs-miniview-collapsed",IP="vjs-miniview-click-to-center",gt="vjs-drag-select-defeat",Oy="vjs-default-node",_y="vjs-default-group",oo="vjs-connector-source-drag",so="vjs-connector-target-drag",MP="vjs-connector-transient-drag",gn="vjs-palette-selected-element",Rh="vjs-palette-tap-mode-active",VP="vjs-palette-drag-active",GP="vjs-palette-drag-hover",$P="vjs-palette-drag-hover-cannot-drop",BP="vjs-palette-current",om="vjs-palette-current-shape-type",Lh="vjs-drag-hover-cannot-drop",Ry="vjs-drag-original-group",xr="vjs-drag-active",br="vjs-drag-hover",Ly="vjs-source-hover",wy="vjs-target-hover",wh="vjs-hover",FP="vjs-transient-vertex",Dy="vjs-edge-click-entry-method";function LN(i,r){if(r.outlineStroke!=null){let e=r.outlineWidth||1,t=r.strokeWidth+2*e,n=Object.assign({},r);return n.stroke=r.outlineStroke,n.strokeWidth=t,n}else if(i.$paintConnectorOutline){let e=i.$connectorOutlineWidth,t=Object.assign({},r);return t.stroke=i.$connectorOutlineColor||"transparent",t.strokeWidth=e,t}}function UP(i,r,e){DN(i,r);let t=r.connector;tm.paint(t,i,e);let n="",o={x:-t.x,y:-t.y};if(t.internalSegments.length>0){n=ZT(t);let s={d:n,transform:"translate("+o.x+","+o.y+")","pointer-events":"visibleStroke",[Qe]:r.edge.id},a=LN(i,e);a!=null&&(t.bgPath==null?(t.bgPath=G(ee,s),L(t.bgPath,i.connectorOutlineClass),Ea(t.canvas,t.bgPath,0)):de(t.bgPath,s),ry(t,t.bgPath,a,!0)),t.path==null?(t.path=G(ee,s),Ea(t.canvas,t.path,a!=null?1:0),L(t.path,i.connectorPathClass),r.edge.transient&&L(t.canvas,_v)):(t.path.parentNode!==t.canvas&&Ea(t.canvas,t.path,a!=null?1:0),de(t.path,s)),ry(t,t.path,e,!1),r.detachable&&wN(r,o,i.defaults.edgeRelocateHandleSize)}}function wN(i,r,e){if(i.detachable){let t=i.connector,n={x:t.paintInfo.sx,y:t.paintInfo.sy},o=i.anchors.source.computedPosition.ox,s=i.anchors.source.computedPosition.oy;n.x+=o*e/2,n.y+=s*e/2;let a={d:`M ${n.x-e/2} ${n.y-e/2} L ${n.x+e} ${n.y-e/2} L ${n.x+e} ${n.y+e/2} L ${n.x-e/2} ${n.y+e/2} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.sourceZone==null?(t.sourceZone=G(ee,a),L(t.sourceZone,oo),t.canvas.appendChild(t.sourceZone)):de(t.sourceZone,a);let l={x:t.paintInfo.tx,y:t.paintInfo.ty},h=Be(t,1,e),d=Dt(h,l,e),u=Dt(l,h,e),p={d:`M ${d[0].x} ${d[0].y} L ${d[1].x} ${d[1].y} L ${u[1].x} ${u[1].y} L ${u[0].x} ${u[0].y} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.targetZone==null?(t.targetZone=G(ee,p),L(t.targetZone,so),t.canvas.appendChild(t.targetZone)):de(t.targetZone,p)}}function DN(i,r){let e=r.connector;if(e.canvas!=null)return e.canvas;{let t=i.containerType==="HTML"?G(Le,{[Pe]:"0",[Me]:"0",style:{"pointer-events":pt,position:qe},[Qe]:r.edge.id}):G(q,{[Qe]:r.edge.id});return e.canvas=t,i.$appendEdgeElement(e.canvas),e.cssClass!=null&&L(t,e.cssClass),L(t,i.connectorClass),e.classesToAddWhenRendered!=null&&(L(t,e.classesToAddWhenRendered.join(" ")),delete e.classesToAddWhenRendered),t.jtk=t.jtk||{},t.jtk.connection=r,t}}var sm=class{constructor(r,e){this.container=r;c(this,"ar",!0);c(this,"ye");c(this,"ul");c(this,"Mi");c(this,"pl");c(this,"ke");c(this,"wu");c(this,"rt");c(this,"lr");c(this,"$t",{});c(this,"Ln",[]);c(this,"K");c(this,"Zr");c(this,"Gi");c(this,"$i");c(this,"Bi");c(this,"ml");e=e||{init:null},this.ye=new xe,this.ul=this.Tf.bind(this),this.ye.on(r,me,"*",this.ul),this.Mi=this.vf.bind(this),this.pl=this.Cf.bind(this),this.Bi=e.translate||(t=>Object.assign({},t)),this.ml=e.init}$enable(){this.ar=!0}$disable(){this.ar=!1}addHandler(r){let e=this.$t[r.selector];e==null&&(this.$t[r.selector]=[],e=this.$t[r.selector],this.Ln.push(r.selector)),e.push(r),e.sort((t,n)=>{let o=t.priority==null?0:t.priority,s=n.priority==null?0:n.priority;return o>s?-1:s>o?1:0})}removeHandler(r){let e=this.$t[r.selector];e!=null&&(this.$t[r.selector]=e.filter(t=>t!==r),this.$t[r.selector].length===0&&(delete this.$t[r.selector],this.Ln=this.Ln.filter(t=>t!==r.selector)))}Tf(r){if(!this.ar||r.Pf===!0)return;let e=!1;this.rt=r.target;let t=()=>{e||(e=!0,this.ml&&this.ml(r),this.lr=We(this.rt),this.ke=null,this.K=Ee(r),this.Gi=this.Bi(this.K),this.Zr=Object.assign({},this.K),this.$i=Object.assign({},this.Gi))};for(let n=0;n<this.Ln.length;n++)if($t(this.rt,this.Ln[n],this.container)){let o=this.$t[this.Ln[n]];if(o!=null){t();for(let s=0;s<o.length;s++){let a=this.rt,l=this.lr;if(o[s].target){if(a=this.rt.closest(o[s].target),a==null)continue;l=We(a)}if(this.wu=o[s].start({pagePosition:this.K,e:r,el:a,size:l,translatedPosition:this.Gi}),this.wu!==!1){this.rt=a,this.lr=l,this.ke=o[s],ie(r),r.Pf=!0;break}}}}this.ke!=null&&(this.ye.on(document,se,this.Mi),this.ye.on(document,ae,this.pl))}vf(r){if(!this.ar)return;let e=Ee(r),t=this.Bi(e);this.ke!=null&&(this.ke.constrainFunction&&(this.ke.usesPageCoordinates?(e=this.ke.constrainFunction(e,this.rt,{width:0,height:0},this.lr,this.Zr,r),t=this.Bi(e)):t=this.ke.constrainFunction(t,this.rt,{width:0,height:0},this.lr,this.$i,r)),this.ke.drag({e:r,el:this.rt,pagePosition:e,size:this.lr,originalPagePosition:this.K,translatedPosition:t,originalTranslatedPosition:this.Gi}),this.Zr=e,this.$i={x:t.x,y:t.y})}Cf(r){this.Zr=Ee(r),this.$i=this.Bi(this.Zr),this.ke!=null&&this.ke.stop({e:r,el:this.rt,pagePosition:this.Zr,size:this.lr,originalPagePosition:this.K,translatedPosition:this.$i,originalTranslatedPosition:this.Gi}),this.q()}q(){this.ye.off(document,se,this.Mi),this.ye.off(document,ae,this.pl),this.ke=null,this.rt=null,this.lr=null,this.K=null,this.Zr=null}destroy(){Object.values(this.$t).forEach(r=>r.forEach(e=>e.destroy&&e.destroy())),this.ye.off(this.container,me,this.ul),this.q()}};var am={FILL:"#FFFFFF",STROKE:"#000000",TEXT_COLOR:"#000000",STROKE_WIDTH:1.25},Dh="start",Nh="center",Ih="end",Jfe="Default",Kfe="Default shapes",YP="vjs-shape",lm="vjs-shape-label",Mh="vjs-shape";var NN="http://www.w3.org/2000/svg",IN="http://www.w3.org/1999/xlink",MN="svg",VN="xlink",GN="html";function Ny(i){let r=document.getElementById(i);return r!=null?r.innerHTML:null}var os=class extends Uo{constructor(r){super(r),this.namespaceHandlers[MN]=e=>document.createElementNS(NN,e.split(":")[1]),this.namespaceHandlers[GN]=e=>document.createElement(e.split(":")[1]),this.namespaces[VN]=IN}ce(r){return document.createElement(r)}cf(){return document.createDocumentFragment()}ctn(r){return document.createTextNode(r)}cc(r){return document.createComment(r)}Xd(){return Ny}removeElement(r){r.parentElement.removeChild(r)}removeTextNode(r){r.parentNode.removeChild(r)}};function Ar(i){return new os(i||{})}var hm="link",cm="clone",dm="trash",zP="cross",XP="plus",jP="circle",HP="gear",kP={x:0,y:0,width:32,height:32},Vh={[cm]:{id:cm,viewBox:kP,shapes:[{tag:ee,atts:{d:"M 6 24 L 2 24 L 2 2 L 24 2 L 24 6 M 8 8 L 30 8 L 30 30 L 8 30 Z",stroke:"currentColor","stroke-width":3,fill:"none","stroke-linejoin":"round"}}]},[hm]:{id:hm,viewBox:kP,shapes:[{tag:Z,atts:{x:0,y:0,width:32,height:32,fill:"transparent",stroke:"none"}},{tag:ke,atts:{cx:5,cy:16,r:5,fill:"currentColor"}},{tag:ee,atts:{d:"M 5 16 L 22 16",stroke:"currentColor","stroke-width":3,fill:"none"}},{tag:ee,atts:{d:"M 22 16 L 20 8 L 30 16 L 20 24",fill:"currentColor"}}]},[dm]:{id:dm,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},shapes:[{tag:ee,atts:{d:"M 7 30 L 4 2 L 28 2 L 25 30 Z","stroke-width":"3"}},{tag:ee,atts:{d:"M 12 26 L 10 8"}},{tag:ee,atts:{d:"M 20 26 L 22 8"}},{tag:ee,atts:{d:"M 16 26 L 16 8.5"}}]},[zP]:{id:zP,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:ee,atts:{d:"M 2 2 L 30 30"}},{tag:ee,atts:{d:"M 30 2 L 2 30"}}]},[XP]:{id:XP,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:ee,atts:{d:"M 16 2 L 16 30"}},{tag:ee,atts:{d:"M 2 16 L 30 16"}}]},[jP]:{id:jP,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:ke,atts:{cx:16,cy:16,r:15}}]},[HP]:{id:HP,viewBox:{x:0,y:0,width:32,height:32},atts:{},shapes:[{tag:ee,atts:{"fill-rule":"evenodd",d:"M 16.0000,4.5000 L 18.1126,3.3755 L 18.6424,1.7428 L 20.8402,2.3317 L 20.4827,4.0106 L 21.7500,6.0407 L 24.1418,6.1232 L 25.4170,4.9741 L 27.0259,6.5830 L 25.8768,7.8582 L 25.9593,10.2500 L 27.9894,11.5173 L 29.6683,11.1598 L 30.2572,13.3576 L 28.6245,13.8874 L 27.5000,16.0000 L 28.6245,18.1126 L 30.2572,18.6424 L 29.6683,20.8402 L 27.9894,20.4827 L 25.9593,21.7500 L 25.8768,24.1418 L 27.0259,25.4170 L 25.4170,27.0259 L 24.1418,25.8768 L 21.7500,25.9593 L 20.4827,27.9894 L 20.8402,29.6683 L 18.6424,30.2572 L 18.1126,28.6245 L 16.0000,27.5000 L 13.8874,28.6245 L 13.3576,30.2572 L 11.1598,29.6683 L 11.5173,27.9894 L 10.2500,25.9593 L 7.8582,25.8768 L 6.5830,27.0259 L 4.9741,25.4170 L 6.1232,24.1418 L 6.0407,21.7500 L 4.0106,20.4827 L 2.3317,20.8402 L 1.7428,18.6424 L 3.3755,18.1126 L 4.5000,16.0000 L 3.3755,13.8874 L 1.7428,13.3576 L 2.3317,11.1598 L 4.0106,11.5173 L 6.0407,10.2500 L 6.1232,7.8582 L 4.9741,6.5830 L 6.5830,4.9741 L 7.8582,6.1232 L 10.2500,6.0407 L 11.5173,4.0106 L 11.1598,2.3317 L 13.3576,1.7428 L 13.8874,3.3755 Z M 23.2500,16.0000 A 7.25,7.25 0 1 0 8.7500,16.0000 A 7.25,7.25 0 1 0 23.2500,16.0000 Z"}}]}};function cye(i,r){let e=typeof i=="string"?Vh[i]:i;if(e==null)return null;{let t=Object.assign({},e);return t.id=r,t}}function um(i,r,e,t,n,o,s){t=t||[],n=n||{};let a=Object.assign({viewBox:`0 0 ${i.viewBox.width} ${i.viewBox.height}`,"pointer-events":"all",width:r,height:e},i.atts||{}),l=G(Le,Object.assign(n||{},a),null,t.join(" "));return i.shapes.forEach(h=>{let d=G(h.tag,Object.assign(h.atts,s||{}));l.appendChild(d)}),o&&o.appendChild(l),l}function pm(i,r,e,t,n,o,s){return um(Vh[i],r,e,t,n,o,s)}var $N={x:0,y:0,width:32,height:32},BN={stroke:"currentColor",fill:"none"},Iy=class extends HTMLElement{static get observedAttributes(){return["icon-id","width","height"]}findIcon(r){return Vh[r]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){let r=this.getAttribute("icon-id"),e=this.getAttribute("width")||"32",t=this.getAttribute("height")||"32",n=this.findIcon(r)||Vh[r];if(!n){this.innerHTML="";return}let o=n.viewBox||$N,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width",e),s.setAttribute("height",t),s.setAttribute("viewBox",`${o.x} ${o.y} ${o.width} ${o.height}`);let a=tn(tn({},BN),n.atts);for(let[l,h]of Object.entries(a))s.setAttribute(l,h);n.shapes.forEach(l=>{let h=document.createElementNS("http://www.w3.org/2000/svg",l.tag);for(let[d,u]of Object.entries(l.atts))h.setAttribute(d,u);s.appendChild(h)}),this.innerHTML="",this.appendChild(s)}};customElements.define("vjs-icon",Iy);var FN="label",WP="transform",ZP="x",JP="y",mm="origin",KP="originX",qP="originY",UN="orientation",QP="size",eO="key",YN="iconId",Ta="middle",My="type",gm="category",tO="horizontal",jye="vertical",Em="vjs-shape-icon",zN="vjs-include-icon",XN="vjs-include-icons",jN="category",HN="type",lo="__vjsRootSet",ao=FN,Vy="fill",Gh="outline",$h="outlineWidth",Gy="color",Bh="#FFFFFF",ss="#000000",Fh=2,rO="#000000",kN=.8,va=class{constructor(r,e){c(this,"compiledShapes",new Map);c(this,"templateRenderer",Ar({defaultNamespace:"svg"}));c(this,"shapeSets",new Map);c(this,"defaultCategoryId");c(this,"labelPosition");c(this,"rootSet");c(this,"iconContainerTemplate",`<svg:svg class="${Em}" x="{{x}}" y="{{y}}" viewBox="{{viewBox}}" width="{{width}}" height="{{height}}" style="overflow:visible"/>`);c(this,"iconContainerAst");c(this,"iconSpecs",new Map);c(this,"iconList",[]);c(this,"typeParameter");c(this,"categoryParameter");c(this,"multilineLabels");c(this,"labelFillRatio");e=e||{},r==null?(U("WARN: no shapes were provided to shape library."),r=[]):Array.isArray(r)||(r=[r]),this.typeParameter=e.typeParameter||HN,this.categoryParameter=e.categoryParameter||jN,this.multilineLabels=e.multilineLabels!==!1,this.labelFillRatio=e.labelFillRatio||kN,this.labelPosition=e.labelPosition||"center",this.Of(r),this.defaultCategoryId=this.rootSet.children.length>0?this.rootSet.children[0].id:be,this.iconContainerAst=this.templateRenderer.parse(this.iconContainerTemplate)}useMultilineLabels(){return this.multilineLabels}refresh(r,e,t){this._f(r,e);let n=r.closest(".vjs-shape")||r;this.$applyMultilineLabel(n.querySelector(":scope > .vjs-shape-label"),e,t||ao)}Of(r){let e=(t,n)=>{let o=[];return t!=null&&t.forEach(s=>{let a=Object.assign(s,{parent:n,children:e(s.children,s.id)});if(this.shapeSets.set(a.id,a),a.icons){let l=Ns(this.iconSpecs,a.id,()=>new Map);a.icons.forEach(h=>{l.set(h.id,h)}),this.iconList.push(...a.icons)}o.push(a)}),o};this.rootSet={children:e(r,lo),parent:null,id:lo,name:lo,shapes:[]}}getShapeSet(r){return this.shapeSets.get(r)}getShapeSets(){return Array.from(this.shapeSets.values())}getShapeDefinition(r,e){return e=e||this.defaultCategoryId,this.shapeSets.get(e).shapes.find(t=>t.type===r)}$getShapeDefinitionForObject(r,e,t){let n=e||this.typeParameter,o=t||this.categoryParameter;return this.getShapeDefinition(r[n],r[o])}getShapeTemplate(r,e){let t=this.getShapeDefinition(r,e);return t==null?(U(`Cannot find shape [${r}] in set [${e}]. Returning default shape.`),this.Rf()):t.template}getCompiledShape(r,e){let t=this.Lf(r,e);if(!this.compiledShapes.has(t)){let n=this.templateRenderer.parse(this.getShapeTemplate(r,e)),o=s=>this.templateRenderer.render(n,s).fragment;this.compiledShapes.set(t,o)}return this.compiledShapes.get(t)}wf(r){r.setAttribute&&r.setAttribute(Tp,vp),r.hasChildNodes&&r.childNodes.forEach(e=>this.wf(e))}renderCompiledShape(r,e,t,n){e=r.outlineWidth||e||1;let o=t||this.typeParameter,s=n||this.categoryParameter,a=this.getShapeDefinition(r[o],r[s]),l=a.square?Math.min(r.width,r.height):r.width,h=a.square?Math.min(r.width,r.height):r.height;return this.getCompiledShape(r[o],r[s])(Object.assign({outlineWidth:e},r,{width:l,height:h})).childNodes[0]}renderShapeLabel(r,e,t,n,o,s,a){e=e||ao;let l=G(et,{x:"50%",y:"50%",fill:o,stroke:s,"text-anchor":Ta,"dominant-baseline":Ta,class:lm,"stroke-width":t||"0.25px"});l.textContent=n||r[e]||"";let h=r.fontSize||(a==null?void 0:a.size),d=r.fontStyle||(a==null?void 0:a.style),u=r.fontWeight||(a==null?void 0:a.weight),p=r.fontFamily||(a==null?void 0:a.family);return h&&l.setAttribute("font-size",h.toString()),d&&l.setAttribute("font-style",d),u&&l.setAttribute("font-weight",u),p&&l.setAttribute("font-family",p),l}Lf(r,e){return e=e||this.defaultCategoryId,[r,e].join(":")}Df(r,e,t){return{center:{x:"{{width/2}}",y:"{{height/2}}",transform:"",textAnchor:Ta,dominantBaseline:Ta},top:{x:"{{width/2}}",y:"0",transform:`translate(0, -${e+t})`,textAnchor:Ta,dominantBaseline:"hanging"},bottom:{x:"{{width/2}}",y:"{{height}}",transform:`translate(0, ${t})`,textAnchor:Ta,dominantBaseline:"auto"}}[r]}Nf(r,e,t=ao){let n={};return this.shapeSets.forEach(o=>{o.shapes.forEach(s=>{let a=s.font||e,l=a==null?14:a.size||14,h=a==null?"normal":a.style||"normal",d=a==null?"normal":a.weight||"normal",u=(a==null?void 0:a.family)||"",p=s.labelPosition||this.labelPosition,{x:m,y:g,transform:E,textAnchor:y,dominantBaseline:x}=this.Df(p,l,20),b=(s.collapsedTemplate==null?s.template:`<svg:g ${kp}>${s.template}</svg:g><svg:g ${Wp}>${s.collapsedTemplate}</svg:g>`)+(r?`<svg:text x="${m}" y="${g}" transform="${E}" fill="{{color}}" stroke="{{color}}" stroke-width="0.25px" text-anchor="${y}" dominant-baseline="${x}" class="${lm}" font-size="{{fontSize || ${l}}}" font-style="{{fontStyle || '${h}'}}" font-weight="{{fontWeight || '${d}'}}" font-family="{{fontFamily || '${u}'}}">{{${t}}}</svg:text>`:"");n[`${o.id}:${s.type}`]=b,n[`${be}:${s.type}`]=b})}),n}getShapeTagDefinition(r,e,t,n={size:14,style:"normal"},o=ao,s=Bh,a=ss,l=ss,h=Fh){return e=e||h,{template:r?`<svg:g class="${Mh}" fill="{{fill}}" stroke="{{outline}}" stroke-width="{{outlineWidth}}">
5
- <r-fragment key="${gm}:${My}"/>
6
- </svg:g>`:`<svg:svg class="${Mh}" fill="{{fill}}" stroke="{{outline}}" viewBox="0 0 {{width}} {{height}}" preserveAspectRatio="none" stroke-width="{{outlineWidth}}">
7
- <r-fragment key="${gm}:${My}"/>
8
- </svg:svg>`,fragments:{[`${gm}:${My}`]:this.Nf(t,n,o)},defaultNamespace:"svg",decorator:(d,u)=>d.fill==null||d.outline==null||d.color==null||d.outlineWidth==null||d.fontSize==null||d.fontStyle==null?{fill:d.fill||s,outline:d.outline||a,color:d.color||l,outlineWidth:d.outlineWidth||h,fontSize:d.fontSize,fontStyle:d.fontStyle}:null,defaultableFragmentKeys:[gm],rendered:(d,u,p,m)=>{this.refresh(d,u,o)},updated:(d,u,p)=>{this.refresh(d,u,o)},mounted:(d,u,p,m)=>{this.$applyMultilineLabel(d.querySelector(z(lm)),u,o)}}}Rf(){return'<svg:rect x="0" y="0" width="{{width}}" height="{{height}}"/>'}Du(r,e){return e!=null?this.iconSpecs.get(e).get(r):this.iconList.find(t=>t.id===r)}$applyMultilineLabel(r,e,t){if(this.multilineLabels&&r!=null){let n=e.width,o=e.height;if(r!=null&&n!=null&&o!=null){let s=this.labelFillRatio*n;Hp(r,e[t],s)}}}_f(r,e){Array.from(r.querySelectorAll(`svg.${Em}:not(:scope .vjs-group *, :scope .vjs-node *)`)).forEach(t=>t.parentNode.removeChild(t)),Array.from(r.querySelectorAll(zN)).forEach(t=>{let n=t.getAttribute(eO),o=n!=null?e[n]:t.getAttribute(YN);if(o!=null){let s=this.Du(o,e.category);if(s!=null){let a=parseFloat(t.getAttribute(ZP))*e.width,l=parseFloat(t.getAttribute(JP))*e.height,h=Math.min(e.width,e.height),d=parseFloat(t.getAttribute(QP))*h,u=t.getAttribute(KP)||t.getAttribute(mm)||Dh,p=t.getAttribute(qP)||t.getAttribute(mm)||Dh,m=um(s,d,d,[Em],{[Tp]:vp,x:a,y:l},r),g=u===Nh?-d/2:u===Ih?-d:0,E=p===Nh?-d/2:p===Ih?-d:0;m.setAttribute(WP,`translate(${g}, ${E})`)}}}),Array.from(r.querySelectorAll(XN)).forEach(t=>{let n=t.getAttribute(eO),o=e[n];if(o!=null&&o.length>0){let s=Math.min(e.width,e.height),a=parseFloat(t.getAttribute(QP))*s,l=t.getAttribute(KP)||t.getAttribute(mm)||Dh,h=t.getAttribute(qP)||t.getAttribute(mm)||Dh,d=G(q),u=(t.getAttribute(UN)||tO)===tO;r.appendChild(d);let p=0,m=5,g=0;o.forEach(T=>{let S=this.Du(T,e.category);S!=null&&(um(S,a,a,[Em],{[Tp]:vp,x:p,y:g},d),u?p+=a+m:g+=a+m)});let E=parseFloat(t.getAttribute(ZP))*e.width,y=parseFloat(t.getAttribute(JP))*e.height,x=u?p-m:0,f=u?0:g-m,b=l===Nh?-x/2:l===Ih?-x:0,A=h===Nh?-f/2:h===Ih?-f:0;d.setAttribute(WP,`translate(${E+b}, ${y+A})`)}})}parseDefs(){let r=[];return this.rootSet.children.forEach(e=>{if(e.defs)for(let t in e.defs){let n=this.templateRenderer.parse(e.defs[t]);n[0].atts.id=t,r.push(n)}}),r}getDefsElements(){return this.parseDefs().map(r=>this.templateRenderer.render(r,{}).fragment.childNodes[0])}getSvgDefsElement(){let r=G(Le),e=G(CC);return r.appendChild(e),this.getDefsElements().forEach(t=>{e.appendChild(t)}),r}};var Jye={id:"flowchart",name:"Flowchart",shapes:[{type:"process",label:"Process",description:"A process (also known as 'Action') can represent a single step or a sub-process",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}"/>'},{type:"decision",label:"Decision",template:'<path d="M {{width/2}} 0 L {{width}} {{height/2}} L {{width/2}} {{height}} L 0 {{height/2}} Z"/>'},{type:"terminus",label:"Terminus",description:"Used to mark the start/end of the system",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}" rx="{{width/6}}"/>'},{type:"input",label:"Input/Output",description:"Represents something entering or leaving the system",template:'<path d="M {{width / 7}} 0 L {{width}} 1 L {{width - (width/7)}} {{height}} L 1 {{height}} Z"/>'},{type:"document",label:"Document",description:"A printed document or report",template:'<path d="M 0 {{height-(height/8)}} C {{width - (width/4)}},{{height + (height/8)}} {{width- (width/3)}},{{height/2}} {{width}},{{height-(height/8)}} L {{width}} 0 L 0 0 L 0 {{height-(height/8)}}"/>'},{type:"manualInput",label:"Manual Input",template:'<path d="M 0 {{height}} L 0 {{height/3}} L {{width}} {{height/9}} L {{width}} {{height}} Z"/>'},{type:"manualOperation",label:"Manual Operation",template:'<path d="M 0 0 L {{width}} 0 L {{width- (width/8)}} {{height}} L {{width/8}} {{height}} Z"/>'},{type:"preparation",label:"Preparation",template:'<path d="M 0 {{height/2}} L {{width/8}} 0 L {{width- (width/8}} 0 L {{width}} {{height/2}} L {{width-(width/8)}} {{height}} L {{width/ 8}} {{height}} Z"/>'},{type:"connector",label:"Connector",template:'<ellipse cx="{{width/2}}" cy="{{height/2}}" rx="{{width/2}}" ry="{{height/2}}"/>'},{type:"merge",label:"Merge",template:'<path d="M 0 0 L {{width}} 1 L {{width/2}} {{height}} Z"/>'},{type:"collate",label:"Collate",template:`<g><path d="M 0 0 L {{width}} 0 L {{width/2}} {{height/2}} Z"/>
4
+ `;return e+="]}",e}isChildOf(e){return!1}},Jc=class Jc extends Zc{constructor(e,t,n){super(e,t,n);c(this,"objectType",Jc.objectType);c(this,"ports",[]);c(this,"group");c(this,"portMap",{});c(this,"defaultInternalCost",0);c(this,"internalEdges",{})}getAllEdges(e){let t=e==null?null:{filter:e},n=this.getEdges(t).slice(0);for(let o=0;o<this.ports.length;o++)n.push.apply(n,this.ports[o].getEdges(t));return n}getAllSourceEdges(){let e=this.getSourceEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getAllTargetEdges(){let e=this.getTargetEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getDirectEdges(e){return this.getEdges(e==null?null:{filter:e})}getDirectSourceEdges(){return this.getSourceEdges()}getDirectTargetEdges(){return this.getTargetEdges()}getPortEdges(e){let t=[];for(let n=0;n<this.ports.length;n++)t.push.apply(t,this.ports[n].getEdges(e==null?null:{filter:e}));return t}getPortSourceEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getPortTargetEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getIndegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getIndegreeCentrality();return this.indegreeCentrality+e}getOutdegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getOutdegreeCentrality();return this.outdegreeCentrality+e}getPorts(){return this.ports}$addPort(e,t){let n=this.graph.getId(e,t),o=this.getPort(n);return o==null&&(o=new de(this,e,t),this.ports.push(o),this.portMap[o.id]=o),o}$setPort(e,t){let n=this.getPort(e);return n||(n=this.$addPort({id:e})),n.data=t,n.setType(this.graph.getType(t)),n}getPort(e){return this.portMap[e]}$renamePort(e,t){return this.portMap[e.id]?(this.portMap[t]=this.portMap[e.id],delete this.portMap[e.id],!0):!1}$removePort(e){let t=!1;if(e){let n=Cl(e),o=-1;for(let s=0;s<this.ports.length;s++)if(this.ports[s].id===n){o=s;break}if(o!=-1){let s=this.ports[o];this.graph.deletePort(s),this.ports.splice(o,1),t=!0}delete this.portMap[n]}return t}$setDefaultInternalCost(e){this.defaultInternalCost=e}getInternalEdge(e,t){let n=Cl(e),o=Cl(t),s={source:this.portMap[n],target:this.portMap[o],cost:1/0};if(s.source&&s.target){let a=this.internalEdges[n+"-"+o]||{cost:this.defaultInternalCost,directed:!1};Object.assign(s,a)}return s}$setInternalEdge(e,t,n,o){let s=Cl(e),a=Cl(t);return this.internalEdges[s+"-"+a]={cost:n||this.defaultInternalCost,directed:o},this.getInternalEdge(e,t)}};c(Jc,"objectType","Node");var ce=Jc,Kc=class Kc extends Zc{constructor(e,t,n){super(e.graph,t,n);this.parent=e;c(this,"objectType",Kc.objectType)}getParent(){return this.parent}getFullId(){return this.parent.id+this.graph.getPortSeparator()+this.id}isChildOf(e){return this.parent===e}getAllEdges(e){return this.getEdges(e==null?null:{filter:e})}};c(Kc,"objectType","Port");var de=Kc,qc=class qc extends ce{constructor(e,t,n){super(e,t,n);c(this,"objectType",qc.objectType);c(this,"members",[]);c(this,"Fo",{})}$addMember(e){return this.Fo[e.id]!=null?!1:(this.members.push(e),this.Fo[e.id]=e,e.group=this,!0)}getMemberCount(){return this.members.length}getMembers(){return this.members}$removeMember(e){let t=typeof e=="string"?this.Fo[e]:e;if(t){let n=this.members.indexOf(t);return n!=-1&&(this.members.splice(n,1),delete this.Fo[t.id]),t.group&&t.group.id===this.id&&delete t.group,!0}else return!1}getAllDirectEdges(e){let t=[],n,o=e==null?null:{filter:e};t.push.apply(t,this.getEdges(o).slice(0));let s=this.getPorts();for(n=0;n<s.length;n++)t.push.apply(t,s[n].getEdges(o));return t}getInternalEdges(e){let t=[],n={};for(let o=0;o<this.members.length;o++)Array.prototype.push.apply(t,this.members[o].getAllEdges(e).filter(function(s){let a=s.getId(),l=n[a]==null;return n[a]=!0,l}));return t}};c(qc,"objectType","Group");var se=qc,Qc=class Qc extends Wc{constructor(e){super(e.graph,e.data);c(this,"objectType",Qc.objectType);c(this,"source");c(this,"target");c(this,"cost");c(this,"directed");c(this,"id");c(this,"geometry");c(this,"transient");c(this,"anchors");this.transient=e.transient===!0,this.source=e.source,this.target=e.target,this.cost=e.cost||1,this.directed=e.directed!==!1,this.id=e.id,e.anchors&&(this.anchors=e.anchors)}getCost(){return this.cost}setCost(e){this.cost=e}getId(){return this.id==null?this.source.id+"_"+this.target.id:this.id}getFullId(){return this.getId()}setId(e){this.id=e}isDirected(){return this.directed}setDirected(e){this.directed=e}inspect(){if(this.id!=null)return"{ id:"+this.id+", cost:"+this.cost+", directed:"+this.directed+", source:"+this.source.id+", target:"+this.target.id+"}"}};c(Qc,"objectType","Edge");var ze=Qc;var lA="undoRedo",Ro="userActivity",Ol="api",Rl="dataLoad",hA="transient",cA="copyPaste";var O0=(i,r,e)=>{let t=i.nodes||[],n=i.edges||[],o=i.groups||[],s=new Map,a=new Map,l=new Map,h=r.getGroups().map(p=>p.id),d=p=>{let g=l.get(p);g!=null&&g.forEach(m=>{h.push(r.addGroup(m).id)}),l.delete(p),g!=null&&g.forEach(m=>{d(m.id)})};for(let p=0;p<o.length;p++){let g=o[p];if(e.groupDecorator&&e.groupDecorator(g),g[r.groupProperty]!=null&&h.indexOf(g[r.groupProperty])===-1)Gs(l,g[r.groupProperty],()=>[]).push(g);else{let m=r.addGroup(g);a.set(m.id,g),h.push(m.id),d(m.id)}}l.forEach((p,g)=>{if(h.indexOf(g)===-1)throw new Error("Parent group ["+g+"] not found");p.forEach(m=>h.push(r.addGroup(m).id))});for(let p=0;p<t.length;p++){e.nodeDecorator&&e.nodeDecorator(t[p]);let g=r.addNode(t[p]);s.set(g.id,t[p])}function u(p){return j(p)?s.get(p)||a.get(p)||{}:{}}for(let p=0;p<n.length;p++){let g=n[p].data||{},m={source:n[p].source,target:n[p].target,cost:n[p].cost||1,directed:n[p].directed,data:g};if(e.edgeDecorator){let E=u(n[p].source),y=u(n[p].target);e.edgeDecorator(g,E,y)}n[p].anchors&&(m.anchors=n[p].anchors),n[p].geometry&&(m.geometry=n[p].geometry),r.$_addEdge(m,Rl,null)}},R0=(i,r)=>{let e=i.getGraph(),t={nodes:[],edges:[],groups:[]},n,o,s;for(let a=0;a<e.nodes.length;a++){n=e.nodes[a];let l=n.transient;if(!l){let h=Object.assign({},n.data);n.group==null&&delete h[i.groupProperty],t.nodes.push(h)}o=n.getAllEdges();for(let h=0;h<o.length;h++){let d=o[h],u={},p=!1;(d.source===n||d.source.objectType===de.objectType&&d.source.getParent()==n)&&(d.source.dummy?(p=!0,u.source={x:d.source.data[i.modelLeftAttribute],y:d.source.data[i.modelTopAttribute]}):u.source=d.source.getFullId(),d.target.dummy?(p=!0,u.target={x:d.target.data[i.modelLeftAttribute],y:d.target.data[i.modelTopAttribute]}):u.target=d.target.getFullId(),(!l||p)&&(d.data&&(u.data=Object.assign({},d.data)),d.geometry&&(u.geometry=Object.assign({},d.geometry)),t.edges.push(u)))}}for(let a=0;a<e.groups.length;a++){s=e.groups[a];let l=Object.assign({},s.data);s.group==null&&delete l[i.groupProperty],t.groups.push(l),o=s.getEdges();for(let h=0;h<o.length;h++)if(o[h].source===s||o[h].source.objectType===de.objectType&&o[h].source.getParent()==s){let d={source:s.getFullId()};o[h].target.dummy?d.target={x:o[h].target.data[i.modelLeftAttribute],y:o[h].target.data[i.modelTopAttribute]}:d.target=o[h].target.getFullId(),o[h].data&&(d.data=Object.assign({},o[h].data)),o[h].geometry&&(d.geometry=Object.assign({},o[h].geometry)),t.edges.push(d)}}return t},L0=(i,r,e)=>{let t=n=>{let o=r.addNode(n);if(n.children)for(let s=0;s<n.children.length;s++){let a=r.addNode(n.children[s]);r.$_addEdge({source:o,target:a},Rl,null),t(n.children[s])}};t(i)},Wt="json",CE="hierarchical-json",dA={[Wt]:R0},uA={[Wt]:O0,[CE]:L0};function pA(i,r){uA[i]=r}function lB(i,r){dA[i]=r}function gA(i,r,e,t){let n=uA[i];if(n==null)throw new Error("VisuallyJs - parse - ["+i+"] is an unsupported type");return n(r,e,t)}function PE(i,r,e){let t=dA[i];if(t===null)throw new Error("VisuallyJs - exportData - ["+i+"] is an unsupported type");return t(r,e)}var _E=class{constructor(){c(this,"ze",{});c(this,"ya",!1);c(this,"xa",!1);c(this,"oE",{ready:!0});c(this,"Gc",[])}fire(r,e,t){return this.fireUnchecked(r,e,t)}fireUnchecked(r,e,t){let n=null;if(this.xa)this.Gc.unshift(arguments);else{if(this.xa=!0,!this.ya&&this.ze[r]){let o=this.ze[r].length,s=0,a=!1;if(!this.shouldFireEvent||this.shouldFireEvent(r,e,t))for(;!a&&s<o&&n!==!1;){if(this.oE[r])this.ze[r][s](e,t);else try{n=this.ze[r][s](e,t)}catch(l){U("VisuallyJs: fire failed for event "+r+" : "+(l.message||l))}s++,(this.ze==null||this.ze[r]==null)&&(a=!0)}}this.xa=!1,this.sE()}return n}sE(){let r=this.Gc.pop();r&&this.fire.apply(this,r)}unbind(r,e){if(arguments.length===0)this.ze={};else if(arguments.length===1){if(typeof r=="string")delete this.ze[r];else if(r.si){let t;for(let n in r.si)t=r.si[n],mE(this.ze[t]||[],r)}}else arguments.length===2&&mE(this.ze[r]||[],e);return this}getListener(r){return this.ze[r]||[]}isSuspendEvents(){return this.ya}setSuspendEvents(r){this.ya=r}bind(r,e,t){return this.bindUnchecked(r,e,t)}bindAll(r,e,t){return r.forEach(n=>this.bind(n,e,t)),this}bindUnchecked(r,e,t){return(o=>{Jb(this.ze,o,e,t),e.si=e.si||{},e.si[$()]=o})(r),this}silently(r){this.setSuspendEvents(!0);try{r()}catch(e){U("Cannot execute silent function "+e)}this.setSuspendEvents(!1)}},zt=class extends _E{shouldFireEvent(r,e,t){return!0}};var Ll=class{constructor(r,e){this.instance=r;c(this,"result");c(this,"$c",[]);c(this,"dn",{});this.result=r.getGraph().findPath(e.source,e.target,e.strict,e.nodeFilter,e.edgeFilter);for(let t=0;t<this.result.path.length;t++)this.$c.push(this.result.path[t].vertex),this.dn[this.result.path[t].vertex.getFullId()]=[this.result.path[t].vertex,t]}deleteEdges(){for(let r=0;r<this.result.path.length;r++)this.result.path[r].edge&&this.instance.removeEdge(this.result.path[r].edge);return this}deleteVertices(){for(let r=0;r<this.result.path.length;r++)this.instance.removeNode(this.result.path[r].vertex);return this}contains(r,e){let t=this.instance.findGraphObject(r),n=!1;if(t){for(let o=0;o<this.result.path.length;o++)if(this.result.path[o].vertex==t||this.result.path[o].edge==t||!e&&this.result.path[o].vertex.objectType==de.objectType&&this.result.path[o].vertex.isChildOf(t)){n=!0;break}}return n}getVertices(){return this.$c}getVertex(r){return this.dn[typeof r=="string"?r:r.id][0]}getAllEdgesFor(r){let e=this.dn[r.id][1];return e<this.result.path.length-1?[this.result.path[e+1].edge]:[]}filter(r,e){U("not implemented.")}Ye(r,e){for(let t=e||0;t<this.result.path.length;t++)try{r(t,this.result.path[t])}catch(n){U("Path iterator function failed",n)}}each(r){this.Ye((e,t)=>{r(e,t)})}eachVertex(r){this.Ye((e,t)=>{r(e,t.vertex)})}eachEdge(r){this.Ye((e,t)=>{r(e,t.edge)},1)}eachNode(r){this.Ye((e,t)=>{K(t.vertex)&&r(e,t.vertex)})}eachGroup(r){this.Ye((e,t)=>{Y(t.vertex)&&r(e,t.vertex)})}getVertexCount(){return this.result.path.length}getNodeAt(r){return this.result.path[r].vertex}getEdgeCount(){return this.result.path.length==0?0:this.result.path.length-1}getEdgeAt(r){return r<0&&(r=this.result.path.length-1+r),this.result.path.length>r+1?this.result.path[r+1].edge:null}deleteAll(){this.deleteVertices()}isEmpty(){return this.result.path.length==0}getCost(){return this.result.pathDistance}exists(){return this.result.pathDistance!=null}};var td=class{constructor(r,e){c(this,"Bc",new Map);c(this,"Fc",new Map);c(this,"Uc",new Map);if(e!=null){let t=e.nodes||{};for(let s in t)this.Bc.set(s,t[s]);let n=e.groups||{};for(let s in n)this.Fc.set(s,n[s]);let o=e.ports||{};for(let s in o)this.Uc.set(s,o[s])}}getNodeDefinition(r){return this.Bc.get(r)||{}}getGroupDefinition(r){return this.Fc.get(r)||{}}getPortDefinition(r){return this.Uc.get(r)||{}}};var vn=class i{constructor(r){c(this,"instance");c(this,"adapter");c(this,"$vertices",[]);c(this,"parameters");c(this,"done");c(this,"width");c(this,"height");c(this,"container");c(this,"containerSize");c(this,"padding");c(this,"xShift");c(this,"yShift");c(this,"ai");this.ai=r.options.locationFunction,this.adapter=r.adapter,this.instance=r.instance,this.container=r.container,this.containerSize=this.adapter.getSize(this.container),this.width=r.options.width||this.containerSize.width,this.height=r.options.height||this.containerSize.height,this.padding=r.options.padding,this.done=!1,this.parameters=r.options||{}}un(){this.done=!1,this.$vertices.length=0,this.reset()}static aE(){return{padding:{x:0,y:0}}}lE(){let r=Object.assign(i.aE(),this.getDefaultParameters()||{});return Object.assign(r,this.parameters||{}),this.parameters=r,this.parameters}getSize(r,e){return $s(e,r,()=>{let t=this.adapter.getViewportPositionById(r);return t!=null?{width:t.width,height:t.height}:{width:0,height:0}})}hE(r,e,t,n,o){t=t||10,n=n||10;let s=Math.floor(Math.random()*t),a=Math.floor(Math.random()*n);return{x:s,y:a}}zc(r){if(this.instance==null)return;this.containerSize=this.adapter.getSize(this.container),this.width=this.containerSize.width,this.height=this.containerSize.height;let e=this.lE();this.$vertices=this.adapter.getElements().slice();let t={},n={},o=1/0,s=1/0,a=-1/0,l=-1/0,h=(p,g,m)=>{let E=n[p]||{width:0,height:0};o=Math.min(o,g),s=Math.min(s,m),a=Math.max(a,g+E.width),l=Math.max(l,m+E.height),t[p]={x:g,y:m}},d=p=>t[p];this.$vertices.forEach(p=>this.getSize(p.id,n)),this.begin(this.instance,d,h,n,e);let u=()=>{let p={};this.$vertices.forEach(g=>p[g.id]=t[g.id]),this.end(this.instance,d,h,n,e),r&&r({positions:p,bounds:{xmin:o,ymin:s,xmax:a,ymax:l},sizes:n,layout:this})};for(;!this.done;)this.step(this.instance,d,h,n,e);u()}relayout(r,e){this.un(),r!=null&&(this.parameters=r),this.zc(e)}layout(r){this.done=!1,this.zc(r)}};var rd=class{};var mA={},nt={get:(i,r)=>{let e=mA[i];if(e)return r.options=r.options||{},new e(r);throw{message:"VisuallyJs: unknown layout type '"+i+"'"}},register:(i,r)=>{mA[i]=r}};var nd=class nd extends vn{constructor(e){super(e);c(this,"type",nd.type)}getDefaultParameters(){return{}}reset(){}begin(e,t,n,o,s){this.$vertices.forEach(a=>n(a.id,0,0))}end(e,t,n,o,s){}step(e,t,n,o,s){this.done=!0}};c(nd,"type","Empty");var Fs=nd;nt.register(Fs.type,Fs);function w0(i){return{x:i.data.left,y:i.data.top}}var ri=class extends vn{constructor(e){super(e);c(this,"Yc");c(this,"absoluteBacked");this.absoluteBacked=e.options.absoluteBacked===!0,this.Yc=e.options.locationFunction}$_findLocation(e,t){return(t!=null&&t.locationFunction?t.locationFunction:this.Yc||w0)(e)}begin(e,t,n,o,s){let a=this.adapter.getElements(),l=a.length;for(let h=0;h<l;h++){let d=a[h],u=d.getFullId(),p=t(u);p==null&&(p=this.$_findLocation(d,s),isNaN(p.x)&&(p.x=0),isNaN(p.y)&&(p.y=0)),n(u,p.x,p.y)}}step(e,t,n,o,s){this.done=!0}end(e,t,n,o,s){}reset(){}getAbsolutePosition(e,t){return e==null?{x:null,y:null}:this.$_findLocation(e,t)}},D0="Absolute",id=class id extends ri{constructor(e){super(e);c(this,"type",id.type)}getDefaultParameters(){return{}}};c(id,"type",D0);var Lo=id;nt.register(Lo.type,Lo);function N0(i,r,e,t){return i[r]<=t&&t<=i[r]+i[e]}var od=[(i,r)=>i.x+i.width-r.x,(i,r)=>i.x-(r.x+r.width)],sd=[(i,r)=>i.y+i.height-r.y,(i,r)=>i.y-(r.y+r.height)],EA=[null,[od[0],sd[1]],[od[0],sd[0]],[od[1],sd[0]],[od[1],sd[1]]],I0=(i,r,e,t,n)=>{isNaN(e)&&(e=0);let o=r.y+r.height,s=e==1/0||e==-1/0?r.x+r.width/2:(o-t)/e,a=Math.atan(e),l,h,d;return N0(r,"x","width",s)?(l=EA[n][1](i,r),h=l/Math.sin(a),d=h*Math.cos(a),{x:d,y:l}):(d=EA[n][0](i,r),h=d/Math.cos(a),l=h*Math.sin(a),{x:d,y:l})};function Ii(i,r){let e=i.center||{x:i.x+i.width/2,y:i.y+i.height/2},t=r.center||{x:r.x+r.width/2,y:r.y+r.height/2},n=Nr(e,t),o=Is(e,t),s=n==1/0||n==-1/0||isNaN(n)?0:e.y-n*e.x;return I0(i,r,n,s,o)}function ni(i,r,e){let t=r.width+2*e.x,n=r.height+2*e.y;return{x:i.x-t/2,y:i.y-n/2,width:t,height:n}}function fA(i){let r=[];if(i==null)return null;if(Array.isArray(i)){let e=[];return e.push.apply(e,i),e}else for(let e in i)r.push(i[e]);return r}var M0={x:20,y:20},V0=1/0;function yA(i,r){let e={x:i.x,y:i.y};if(r!=null){let t=he(i,r);i.x=t.x,i.y=t.y,i.center!=null&&(i.center.x=i.x+i.width/2,i.center.y=i.y+i.height/2)}return{moved:e.x!==i.x||e.y!==i.y,pos:i}}var Mi=class{constructor(r){c(this,"De");c(this,"k");c(this,"ba");c(this,"mt");c(this,"Xc");c(this,"Mr",null);c(this,"pn");c(this,"W");c(this,"mn");c(this,"jc");c(this,"Z",[]);c(this,"de",new Map);c(this,"Uo",new Map);c(this,"gn",new Map);c(this,"En",new Set);c(this,"zo",!1);c(this,"kc");c(this,"_t",new Map);this.mn=r.positionGetter,this.jc=r.positionSetter,this.W=r.getId,this.pn=r.getSize,this.k=fA(r.elements||[]),this.mt=r.filter||(e=>!0),this.Xc=r.exclude||(e=>!1),this.ba=r.constrain||((e,t,n)=>n)}executeAtPoint(r,e){return this.k.length>0?(this.li((e==null?void 0:e.getSize)||this.pn,(e==null?void 0:e.getPosition)||this.mn,e==null?void 0:e.knownLocations),this.Aa(r),this.Mr=null,this.Sa(e)):{original:{},current:{}}}executeAtCenter(r){if(this.k.length>0){let e=this.li((r==null?void 0:r.getSize)||this.pn,(r==null?void 0:r.getPosition)||this.mn,r==null?void 0:r.knownLocations);return this.Aa({x:(e.minx+e.maxx)/2,y:(e.miny+e.maxy)/2}),this.Mr=null,this.Sa(r)}else return{original:{},current:{}}}executeWithFocus(r,e){return this.k.length>0?(this.li((e==null?void 0:e.getSize)||this.pn,(e==null?void 0:e.getPosition)||this.mn,e==null?void 0:e.knownLocations,e==null?void 0:e.knownSizes),this.Mr={id:r,bounds:this.de.get(r),element:this.k.find(t=>t.id===r)},this.Aa(this.Mr.bounds.center),this.Sa(e)):{original:{},current:{}}}snapToGrid(r){let e={original:{},current:{}};this.li(this.pn,this.mn);for(let t=0;t<this.Z.length;t++){let n=this.de.get(this.Z[t].id),{moved:o,pos:s}=yA(this.Z[t].bounds,r);o&&(e.original[this.Z[t].id]=n,e.current[this.Z[t].id]=s)}return this.Hc(e),e}setElements(r){return this.k=fA(r),this}startTracking(r,e,t){return this.setElements(r),this.li(this.pn,this.mn),this.kc=t||V0,this.gn.clear(),this.En.clear(),this.Uo.entries().forEach(n=>{this.gn.set(n[0],Object.assign({},n[1]))}),this.zo=e,this}stopTracking(){this.gn.clear(),this.En.clear(),this.zo=!1}addElement(r,e){return r!=null&&(e||this.k.indexOf(r)===-1)&&this.k.push(r),this}addElements(r,e){if(e)Array.prototype.push.apply(this.k,r);else for(let t=0;t<r.length;t++)this.addElement(r[t]);return this}removeElement(r){let e=-1;for(let t=0;t<this.k.length;t++)if(this.k[t]===r){e=t;break}return e!==-1&&this.k.splice(e,1),this}reset(){this.k.length=0}Aa(r){r!=null&&(this.De=r)}li(r,e,t,n){return this.Z.length=0,this.de.clear(),this.Uo.clear(),this._t.clear(),this.cE(this.k,r,e,t,n)}cE(r,e,t,n,o){let s,a,l,h;s=a=1/0,l=h=-1/0,n=n||{},o=o||{};for(let d=0;d<r.length;d++){let u=n[r[d].id]||t(r[d]),p=o[r[d].id]||e(r[d]),g=this.W(r[d]),m={x:u.x,y:u.y,width:p.width,height:p.height,center:{x:u.x+p.width/2,y:u.y+p.height/2}};this.de.set(g,m),this.Uo.set(g,Object.assign({},m)),this.Z.push({bounds:m,id:g,element:r[d]}),this._t.set(g,p),s=Math.min(s,u.x),a=Math.min(a,u.y),l=Math.max(l,u.x+p.width),h=Math.max(h,u.y+p.height)}return{minx:s,maxx:l,miny:a,maxy:h}}dE(r,e,t,n){if(this.gn.has(r)){let o=this.gn.get(r),s=this.de.get(r),a={x:s.x+o.width/2,y:s.y+o.height/2},l=Pe(o.center,a),h=l/Math.ceil(l/10),d=Math.round(l/h)+1,u=Math.atan2(o.center.y-a.y,o.center.x-a.x);if(l>this.kc)return null;let p=null,g=0;for(let m=1;m<d;m++){let E={x:a.x+m*h*Math.cos(u),y:a.y+m*h*Math.sin(u)},y=ni(E,o,{x:0,y:0});yA(y,n);let x=!0;for(let f=0;f<this.Z.length;f++){let b=this.Z[f];if(b.id!==r&&!t(b.id,b.element)){let A=b.bounds,T=ni(A.center,A,e);if(tt(y,T)){x=!1;break}}}if(x)g=m,p={x:E.x-o.width/2,y:E.y-o.height/2};else break}return p!=null?{moved:!0,reverted:g===d-1,positionReached:p}:null}else return null}uE(r={},e,t,n,o){if((this.zo&&!o||!this.zo&&o)&&this.En.size>0){let a=!1;for(;!a;){let l=!0;this.En.forEach(h=>{let d=this.dE(h,e,t,n);if(d!=null&&d.moved){let u=this.gn.get(h),p=d.reverted?{x:u.x,y:u.y}:d.positionReached;r[h]=p;let g=this.de.get(h);g.x=p.x,g.y=p.y,g.center.x=p.x+u.width/2,g.center.y=p.y+u.height/2,d.reverted&&this.En.delete(h),l=!1}}),a=l}}}Sa(r){let e={};if(this.k.length>1){r=r||{};let n=r.filter||this.mt,o=r.padding||M0,s=r.iterations,a=r.exclude||this.Xc;r.gather&&Object.assign(e,this.pE(o,this.ba,n,a)),Object.assign(e,this.mE(o,this.ba,n,s,a,r.grid)),this.uE(e,o,a,r.grid,r.invertTrackbackPreference)}let t={original:{},current:{}};for(let n in e)t.original[n]=this.Uo.get(n),t.current[n]=e[n],this.En.add(n);return this.Hc(t),t}pE(r,e,t,n){let o={},s=ni(this.De,{width:0,height:0},r);this.Wc();let a={},l=h=>{let d=[this.De,h],u=[];Array.prototype.push.apply(u,hr(d,s).map(p=>[s,p,null]));for(let p in a){let g=this.de.get(p);Array.prototype.push.apply(u,hr(d,g).map(m=>[g,m,p]))}return u.filter(p=>p!=null)};for(let h=0;h<this.Z.length;h++){if(n(this.Z[h].id,this.Z[h].element))continue;let d=this.Z[h].bounds,u=this.Z[h].bounds,p=ni(d.center,u,r);if(t(this.Z[h].id,this.Z[h].element)){let g=l(d.center);if(g.length>0){g.sort((y,x)=>{let f=Pe(y[1],d),b=Pe(x[1],d);return f<b?-1:1});let m=g[0][0],E=Ii(m,p);d.x+=E.x,d.y+=E.y,d.center.x+=E.x,d.center.y+=E.y,o[this.Z[h].id]=d,a[this.Z[h].id]=!0}}}return o}mE(r,e,t,n,o,s){n=n||2;let a,l;this.Mr!=null?(a=ni(this.De,this.Mr.bounds,{x:0,y:0}),l=this.Mr.id):a=ni(this.De,{width:0,height:0},r),this.Wc();let h=1,d=!0,u,p,g={},m=(x,f,b,A)=>{f.x+=b,f.y+=A,f.center.x+=b,f.center.y+=A,g[x]=f},E=(x,f)=>{if(s==null)return f;{let b=wi(x,f),A=b.x/s.width,T=b.y/s.height,S=f.x>=0?Math.ceil(A):Math.floor(A),O=f.y>=0?Math.ceil(T):Math.floor(T),v={x:s.width*S,y:s.height*O};return Fb(v,x)}},y=()=>{let x,f;for(let b=0;b<this.Z.length;b++){if(x=this.Z[b],o(x.id,x.element))continue;let A=x.bounds,T=ni(A.center,A,r);x.id!==l&&t(x.id,x.element)&&tt(a,T)&&(u=Ii(a,T),u=E(A,u),p=e(x.id,A,u),m(x.id,A,p.x,p.y),T=ni(A.center,A,r));for(let S=0;S<this.Z.length;S++)if(b!==S){if(f=this.Z[S],f.id===l||o(f.id,f.element))continue;if(t(f.id,f.element)){let O=f.bounds,v=ni(O.center,O,r);tt(T,v)&&(d=!0,u=Ii(T,v),u=E(O,u),p=e(f.id,O,u),m(f.id,O,p.x,p.y))}}}d&&h<n&&(d=!1,h++,y())};return y(),g}Hc(r){for(let e=0;e<this.k.length;e++){let t=this.W(this.k[e]);r.current[t]&&this.jc(this.k[e],r.current[t])}}Wc(){let r={};this.Z.sort((e,t)=>{let n=r[e.id]||Math.min(Pe(e.bounds,this.De),Pe(wi(e.bounds,{x:e.bounds.width,y:0}),this.De),Pe(wi(e.bounds,{x:e.bounds.width,y:e.bounds.height}),this.De),Pe(wi(e.bounds,{x:0,y:e.bounds.height}),this.De)),o=r[t.id]||Math.min(Pe(t.bounds,this.De),Pe(wi(t.bounds,{x:t.bounds.width,y:0}),this.De),Pe(wi(t.bounds,{x:t.bounds.width,y:t.bounds.height}),this.De),Pe(wi(t.bounds,{x:0,y:t.bounds.height}),this.De));return r[e.id]=n,r[t.id]=o,n===o?0:n<o?-1:1})}};var xA={x:30,y:30},ld=class ld extends vn{constructor(e){super(e);c(this,"Zc");c(this,"Jc");c(this,"type",ld.type);c(this,"padding",xA);this.Zc=e.options.centerRoot===!0,this.padding=e.options.padding||xA,this.Jc=e.options.centerContent===!0}getDefaultParameters(){return{padding:this.padding,locationFunction:this.ai}}begin(e,t,n,o,s){}end(e,t,n,o,s){}reset(){}step(e,t,n,o,s){let a=this.$vertices.slice(),l=0,h=0,d,u,p=10;if(this.Zc&&a.length>0){let y=this.getSize(a[0].id,o);p=Math.max(y.width,y.height)+80,n(a[0].id,0,0),a=a.slice(1)}if(a.length===0){this.done=!0;return}let g=2*Math.PI/a.length,m=-Math.PI/2;for(d=0;d<a.length;d++)if(u=a[d],n(u.id,l+Math.sin(m)*p,h+Math.cos(m)*p),m+=g,d>0){let y=a[d-1],x=this.getSize(y.id,o),f=t(y.id),b={x:f.x-s.padding.x,y:f.y-s.padding.y,width:x.width+2*s.padding.x,height:x.height+2*s.padding.y},A=a[d],T=this.getSize(A.id,o),S=t(A.id),O={x:S.x-s.padding.x,y:S.y-s.padding.y,width:T.width+2*s.padding.x,height:T.height+2*s.padding.y},v=Ii(b,O),_=[f.x+x.width/2,f.y+x.height/2],P=[S.x+v.x+T.width/2,S.y+v.y+ +(T.height/2)],I=Math.sqrt(Math.pow(_[0]-P[0],2)+Math.pow(_[1]-P[1],2));p=Math.max(p,I/2/Math.sin(g/2))}let E=this.Jc?{x:this.width/2,y:this.height/2}:{x:0,y:0};for(d=0;d<a.length;d++)u=a[d],n(u.id,l+Math.sin(m)*p+E.x,h+Math.cos(m)*p+E.y),m+=g;this.done=!0}};c(ld,"type","Circular");var ad=ld;nt.register(ad.type,ad);var OE="Grid",RE="Column",LE="Row";var _e="width",Ve="height",AF="rotation",hd="v",bA="h",Te="top",Ze="left",yt="right",ht="bottom",It="center",ee="x",ye="y",Cn="dlr",ii="drl",on="none",sn="orthogonal",AA="manhattan",cd="diagonal",SA="metro",TA=-1,pe="v",ne="h",vA="undefined",be="default",Pt="true",ct="false",CA="left",PA="top",_A="rotation",OA="width",RA="height",it="source",Pn="target";var G0={x:30,y:30},Vi="row",wE="column",wo=class extends vn{constructor(e){super(e);c(this,"yn",[]);c(this,"Ta");c(this,"va");c(this,"H");c(this,"xn");c(this,"bn");c(this,"Gr");c(this,"$r");c(this,"Ca");c(this,"type");this.type=OE,this.H=e.options.orientation||Vi,this.padding=e.options.padding||G0,this.Ta=e.options.verticalAlignment||It,this.va=e.options.horizontalAlignment||It,this.xn=e.options.rows||-1,this.bn=e.options.columns||-1,this.Ca=e.options.sort}getDefaultParameters(){return{orientation:Vi,rows:-1,columns:-1}}begin(e,t,n,o,s){this.yn.length=0;let a,l;if(this.Ca!=null){let p=this.$vertices.slice();p.sort(this.Ca),this.$vertices=p}if(this.xn===-1&&this.bn===-1){let p=Math.round(Math.sqrt(this.$vertices.length));a=p+(this.H===Vi?1:0),l=p+(this.H===wE?1:0)}else this.xn!==-1?(a=this.xn,l=Math.ceil(this.$vertices.length/a)):this.bn!==-1&&(l=this.bn,a=Math.ceil(this.$vertices.length/l));this.Gr=-1/0,this.$r=-1/0;let h=0,[d,u]=this.H===Vi?[a,l]:[l,a];for(let p=0;p<d;p++){this.yn[p]=[];for(let g=0;g<u;g++)if(h=p*u+g,h<this.$vertices.length){let m=this.$vertices[h],E=this.getSize(m.id,o);this.Gr=Math.max(this.Gr,E.width),this.$r=Math.max(this.$r,E.height),this.yn[p][g]={vertex:m,size:E}}}}end(e,t,n,o,s){}reset(){}gE(e){let t=this.H===Vi&&this.xn===1||this.va===Ze?0:this.va===It?(this.Gr-e.width)/2:this.Gr-e.width,n=this.H===wE&&this.bn===1||this.Ta===Te?0:this.Ta===It?(this.$r-e.height)/2:this.$r-e.height;return{padX:t,padY:n}}step(e,t,n,o,s){let a=0,l=0;for(let h=0;h<this.yn.length;h++){for(let d=0;d<this.yn[h].length;d++){let u=this.yn[h][d],{padX:p,padY:g}=this.gE(u.size);n(u.vertex.id,a+p,l+g),this.H===Vi?a+=this.padding.x*2+(this.xn===1?u.size.width:this.Gr):l+=this.padding.y*2+(this.bn===1?u.size.height:this.$r)}this.H===Vi?(l+=this.padding.y*2+this.$r,a=0):(a+=this.padding.x*2+this.Gr,l=0)}this.done=!0}};c(wo,"type",OE),nt.register(wo.type,wo);var wl=class extends wo{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:wE,columns:1})})),this.type=RE}};c(wl,"type",RE),nt.register(wl.type,wl);var Dl=class extends wo{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:Vi,rows:1})})),this.type=LE}};c(Dl,"type",LE),nt.register(Dl.type,Dl);var LA=1e-11,ud=class ud extends ri{constructor(e){super(e);c(this,"Yo");c(this,"type",ud.type);c(this,"k",new Map);c(this,"hi",new Map);c(this,"ci");c(this,"Rt");c(this,"Xo",1/0);c(this,"jo",-1/0);c(this,"ko",1/0);c(this,"Ho",-1/0);c(this,"Lt",[]);c(this,"Pa",new Map);c(this,"wt");c(this,"Oa");this.wt=Sn(this.getDefaultParameters(),e.options),this.Rt=e.options.absoluteBacked!==!1}getDefaultParameters(){return{iterations:15,spacing:250,r:.25,locationFunction:this.ai}}An(e,t,n){return t=pE(t),n=pE(n),e.x=t,e.y=n,e.center.x=t+e.width/2,e.center.y=n+e.height/2,{EE:t,fE:n}}Sn(e){return this.hi.get(e.id)===!0}yE(e){this.hi.set(e.id,!0)}reset(){super.reset(),this.k.clear(),this.hi.clear(),this.Yo=0,this.Xo=this.ko=1/0,this.jo=this.Ho=-1/0,this.Pa.clear()}begin(e,t,n,o,s){this.Lt.length=0,this.k.clear(),this.Yo=0,this.Xo=1/0,this.jo=-1/0,this.ko=1/0,this.Ho=-1/0,this.Oa=this.wt.r,this.Rt&&this.$vertices.forEach(a=>{let l=this.$_findLocation(a,s);l!=null&&l.x!=null&&l.y!=null&&n(a.id,l.x,l.y)})}gt(e,t,n){let o=H(e)?e.getParent():e,s=this.k.get(o.id);if(!s){let a=t(o.id)||this.hE(o.id,n,this.width,this.height,!0),l=this.getSize(o.id,n);l.width===0&&(l.width=1),l.height===0&&(l.height=1),s={id:o.id,n:o,x:a.x,y:a.y,f:[0,0],width:l.width,height:l.height,center:{x:a.x+l.width/2,y:a.y+l.height/2}},this.k.set(o.id,s),this.Pa.set(o.id,this.instance.getAllEdgesFor(o).filter(h=>this.adapter.filter(h.target)))}return s}_a(e,t,n){return this.Lt[e]?this.Lt[e]:(this.Lt[e]=this.gt(this.$vertices[e],t,n),this.Lt[e])}step(e,t,n,o,s){let a;for(this.ci=0,a=0;a<this.$vertices.length;a++){let l=this._a(a,t,o);if(this.Rt&&!this.Sn(l)){let d=this.getAbsolutePosition(l.n,s);if(d!=null&&d.x!=null&&d.y!=null&&!isNaN(d.x)&&!isNaN(d.y)){this.Kc(l,d.x,d.y),n(l.id,d.x,d.y),this.yE(l),l.x=d.x,l.y=d.y,l.f[0]=0,l.f[1]=0;continue}}for(let d=a+1;d<this.$vertices.length;d++){let u=this._a(d,t,o);this.xE(l,u)}let h=this.Pa.get(l.id);for(let d=0;d<h.length;d++)this.bE(l,h[d],t,o)}if(this.ci!==0){let l=s.spacing*.62;for(a=0;a<this.$vertices.length;a++){let h=this._a(a,t,o);if(!this.Sn(h)){let d=h.f[0],u=h.f[1],p=Math.sqrt(d*d+u*u);p>l&&(d=d/p*l,u=u/p*l),this.Kc(h,h.x+d,h.y+u)}h.f[0]=0,h.f[1]=0}}this.Yo++,(this.ci===0||this.Yo>=this.wt.iterations)&&(this.AE(n,o),this.done=!0)}end(e,t,n,o,s){this.hi.clear(),this.k.forEach((a,l)=>{this.hi.set(l,!0)})}Kc(e,t,n){let{EE:o,fE:s}=this.An(e,t,n);this.Xo=Math.min(this.Xo,o),this.ko=Math.min(this.ko,s),this.jo=Math.max(this.jo,o),this.Ho=Math.max(this.Ho,s)}AE(e,t){this.k.forEach((n,o)=>{let s=this.k.get(o);e(o,Math.floor(s.x),Math.floor(s.y))})}xE(e,t){let n=this.Sn(e),o=this.Sn(t);if(n&&o||e.width===0||e.height===0||t.width===0||t.height===0)return;let s,a,l,h;if(tt(e,t))h=1,s=1,a=1;else{let d=[e.center,t.center],u=hr(d,e)[0],p=hr(d,t)[0];s=p.x-u.x,a=p.y-u.y,l=s*s+a*a,h=Math.sqrt(l),h<LA&&(h=1,s=1,a=1)}if(h<this.wt.spacing){this.ci++;let d=this.Oa*(this.wt.spacing-h),u=1,p=1,g=u*d*s/h,m=p*d*a/h,E=o?0:(n?2:1)*g,y=o?0:(n?2:1)*m,x=n?0:(o?2:1)*g,f=n?0:(o?2:1)*m;t.f[0]+=E,t.f[1]+=y,e.f[0]-=x,e.f[1]-=f}}bE(e,t,n,o){let s=this.gt(t.target,n,o),a=this.Sn(e),l=this.Sn(s);if(a&&l)return;this.ci++;let h,d,u,p,g;if(tt(e,s))p=-2*this.wt.spacing,h=-2*this.wt.spacing,d=-2*this.wt.spacing;else{let y=[e.center,s.center],x=hr(y,e)[0],f=hr(y,s)[0];h=f.x-x.x,d=f.y-x.y,u=h*h+d*d,p=Math.sqrt(u),p<LA&&(p=1,h=1,d=1)}g=this.Oa*(p-this.wt.spacing),(t.cost==null||t.cost<1)&&(t.cost=1),g*=Math.log(t.cost)*.5+1;let m=g*h/p,E=g*d/p;s.f[0]-=l?0:(a?2:1)*m,s.f[1]-=l?0:(a?2:1)*E,e.f[0]+=a?0:(l?2:1)*m,e.f[1]+=a?0:(l?2:1)*E}};c(ud,"type","ForceDirected");var dd=ud;nt.register(dd.type,dd);function $0(i,r){for(let e=0;e<i.length;e++)if(i[e].target!==r||i[e].source!==r)return!1;return!0}var Us=class extends ri{constructor(e){super(e);c(this,"qc");c(this,"Tn");c(this,"Qc");this.qc=!!e.options.ignoreLoops,this.Qc=e.options.ignorePorts===!0,this.Tn=e.options.getRootNode||(t=>e.options.multipleRoots!==!1?t.filter(n=>{if(oA(n)){let o=n.getTargetEdges();return(o.length===0||$0(o,n))&&this.adapter.filter(n)}else return!1}).getAll():this.$vertices.length>0?[this.$vertices[0]]:null)}begin(e,t,n,o,s){super.begin(e,t,n,o,s),s.ignoreLoops=this.qc,s.getRootNode=this.Tn,s.getChildVertices=s.getChildVertices||((a,l,h)=>{let d=[];return h.getAllEdgesFor(a).forEach(u=>{let p=H(u.target)?u.target.getParent():u.target;(u.source===a||this.Qc!==!0&&H(u.source)&&u.source.getParent()===a)&&this.adapter.filter(p)&&d.push(p)}),d}),s.rootNode=s.getRootNode(e),s.rootNode||(this.done=!0)}};var wA=It,DA={x:60,y:60},NA="auto",IA=It;function Nl(i){return i.parents.length>0?i.parents[0].loc:null}function pd(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function B0(i){return i.parents.length>0?i.parents[0].root===!0:!1}function MA(i){return i.parents.length>0?i.parents[0].childGroup:null}function F0(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var gd=class{constructor(r,e){this.dataSource=r;c(this,"Br");c(this,"qt");c(this,"Pe");c(this,"L",[]);c(this,"Fr",[]);c(this,"di",{});c(this,"ie");c(this,"ee");c(this,"Dt");c(this,"ge");c(this,"pi");c(this,"Se");c(this,"Rt");c(this,"I");c(this,"vn",-1/0);c(this,"Cn",1/0);c(this,"mi");c(this,"Nt");c(this,"gi");c(this,"Ne",[]);c(this,"positions",new Map);c(this,"Ra",{[It]:r=>Nl(r)+pd(r,this.ee)/2-(r.size-this.ee)/2,start:r=>Nl(r),end:r=>Nl(r)+pd(r,0)-(r.size-this.ee)});c(this,"W");c(this,"It");c(this,"Qt");c(this,"Ei");c(this,"Va",{center:(r,e,t)=>(e+t)/2-pd(r)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Br=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.qt=e.compress===!0,this.Rt=e.absoluteBacked===!0,this.W=e.idFunction,this.It=e.sizeFunction,this.Qt=e.childVerticesFunction,this.Ei=e.absolutePositionFunction,this.ge=e.axisIndex,this.Se=this.ge!==1,this.pi=this.ge===0?1:0,this.mi=this.Se?"y":"x",this.Nt=this.Se?_e:Ve,this.gi=this.Se?Ve:_e,this.Pe=e.invert===!0,this.I=e.alignment||IA,this.ie=e.padding,this.ee=this.Se?this.ie.x:this.ie.y,this.Dt=this.Se?this.ie.y:this.ie.x}execute(){let r,e,t;for(let n=0;n<this.Br.length;n++){r=this.Br[n];let o=this.It(r.id),s=this.et(r,o,0,null,null),a=0;s.root=!0,a=this.fi(s,0);let l=0,h,d,u=(g,m)=>this.qt&&g.parents&&g.parents.length>0?this.positions.get(this.W(g.parents[0].node)).position[this.mi]+this.La(g,this.pi)+this.Dt:m,p=!1;if(a===0&&this.Rt===!0){let g=this.Ei(r);!isNaN(g.x)&&!isNaN(g.y)&&(this.yi(r.id,g,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.ge===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.ge===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.yi(this.W(this.L[e].entries[t].node),{x:h,y:d},e);this.Pe?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.Dt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.Dt,l+=this.L[e].otherAxisSize)}}return this.positions}yi(r,e,t){this.positions.set(r,{position:e,layer:t});let n=this.It(r),o=this.ge===0?e.x+n.width:e.y+n.height;this.vn=Math.max(this.vn,o),this.Cn=Math.min(this.Cn,o)}gt(r){let e=this.L[r];return e||(e={entries:[],pointer:0},this.L[r]=e),e}et(r,e,t,n,o){let s=this.gt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Nt],children:[]},l=e[this.gi];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.Nt]+this.ee,s.entries.push(a),n&&n.children.push(a),a}wa(r,e){let t=this.Fr[e];t||(t=[],this.Fr[e]=t),r.index=t.length,t.push(r)}Da(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.gt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.ee)}}La(r,e){let t=r.parents.map(n=>n.dimensions[e===0?_e:Ve]);return Math.max.apply(null,t)}Na(r){if(r.size>0){let e=this.Ra[this.I](r),t=this.Fr[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.ee}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.ee;o!==0&&this.Ia(r),this.wa(r,r.depth)}}Ma(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.Va[this.I](r,e,t),o=n-Nl(r);if(this.Da(r,n),!B0(r)){let s=MA(r),a=F0(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ia(r){let e=r;for(;e!=null;)this.Ma(e),e=MA(e)}fi(r,e){if(this.di[r.node.id])return;this.di[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[]},n=[],o,s={},a=this.gt(e+1),l=this.Qt(r.node,e,this.dataSource);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.It(this.W(h)),u=a.entries.find(p=>this.W(p.node)===this.W(h));if(u!=null){u.parents.push(r);let p=Nl(u),g=pd(u,this.ee),m=p+g/2-u.size/2,E=m-u.loc,y=x=>{for(let f=x.childGroupIndex;f<x.childGroup.nodes.length;f++)x.childGroup.nodes[f].loc+=E,x.children.forEach(y),x.childGroup.size+=E};y(u)}else{let p=this.et(h,d,e+1,r,t);p.childGroupIndex=t.nodes.length,t.nodes.push(p);let g=d[this.Nt];t.size+=g+this.ee,n.push(p)}s[h.id]=!0}}for(this.Na(t),o=0;o<n.length;o++)this.fi(n[o],e+1);return l.length}};var U0="Hierarchical",Ed=class Ed extends Us{constructor(e){super(e);c(this,"type",Ed.type);c(this,"H");c(this,"Se");c(this,"ge");c(this,"qt");c(this,"Pe");c(this,"I");c(this,"ed");c(this,"L",[]);c(this,"Qt");this.Pe=e.options.invert,this.ed=e.options.spacing||NA,this.qt=this.ed==="compress",this.I=e.options.align||wA,this.H=e.options.orientation!=null?e.options.orientation:"horizontal"}getDefaultParameters(){return{padding:DA,orientation:this.H,locationFunction:this.ai,align:this.I}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.H=s.orientation,this.Se=this.H==="horizontal",this.ge=this.Se?0:1,this.padding=s.padding,this.L.length=0,this.Qt=s.getChildVertices}step(e,t,n,o,s){new gd(e,{rootNode:s.rootNode,compress:this.qt,padding:this.padding,axisIndex:this.ge,invert:this.Pe,alignment:this.I,idFunction:h=>e.getNodeId(h),sizeFunction:h=>this.getSize(h,o),childVerticesFunction:(h,d,u)=>this.Qt(h,d,u),absoluteBacked:this.absoluteBacked,absolutePositionFunction:h=>this.getAbsolutePosition(h,s)}).execute().forEach((h,d)=>{n(d,h.position.x,h.position.y)}),this.done=!0}getHierarchy(){return this.L}getOrientation(){return this.H}};c(Ed,"type",U0);var md=Ed;nt.register(md.type,md);var DE=class{constructor(r){this.focus=r;c(this,"id");c(this,"children",new Set);c(this,"de",new Map);c(this,"td",new Map);c(this,"group");c(this,"extents");c(this,"offsets");this.id=$(),this.group=[r]}setPosition(r,e,t){this.de.set(r,{x:e,y:t})}getPosition(r){return this.de.get(r)}getIncidentAngle(r){return this.td.get(r)}setIncidentAngle(r,e){this.td.set(r,e)}getPositions(){return this.de}},Y0=100,z0={x:50,y:50},yd=class yd extends Us{constructor(e){super(e);c(this,"type",yd.type);c(this,"rd");c(this,"tt",[]);c(this,"clusterMagnetizer");c(this,"groupPadding");this.groupPadding=e.options.groupPadding||Y0,this.padding=e.options.padding||z0,this.clusterMagnetizer=new Mi({positionGetter:t=>({x:t.extents[0],y:t.extents[2]}),positionSetter:(t,n)=>{for(let o=0;o<t.group.length;o++){let s=t.offsets[t.group[o].id];t.setPosition(t.group[o].id,n.x+s.x,n.y+s.y)}},getSize:t=>({width:t.extents[1]-t.extents[0],height:t.extents[3]-t.extents[2]}),getId:t=>t.focus.id,filter:t=>this.tt[0].focus.id!==t})}getDefaultParameters(){return{padding:this.padding,locationFunction:this.ai,groupPadding:this.groupPadding,getChildEdges:(e,t,n)=>n.getAllEdgesFor(e,o=>{let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target;return s===e&&s!==a&&this.adapter.filter(a)})}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.tt.length=0,this.rd=s.getChildEdges}nd(e,t,n,o,s,a,l){let h=(T,S,O,v)=>({x:T-a.padding.x,y:S-a.padding.y,width:O+2*a.padding.x,height:v+2*a.padding.y}),d,u=new DE(e),p=s?s.position:{x:0,y:0},g=p.x,m=p.y,E={},y=T=>E[T]||(E[T]=this.getSize(T,o),E[T]),x,f,b;u.setPosition(e.id,p.x,p.y);let A=this.rd(e,l,this.instance);for(let T=0;T<A.length;T++){let S=A[T].target,O=H(S)?S.getParent():S;u.children.add(O)}if(x=y(u.focus.id),d=Math.max(x.width,x.height),b=h(g-x.width/2,m-x.height/2,x.width,x.height),n(u.focus.id,-(x.width/2),-(x.height/2)),u.children.size>0){this.tt.push(u);let T=2*Math.PI/(u.children.size+(s?1:0)),S=s?s.incidentAngle+Math.PI+T:Math.PI,O=S,v=null;u.children.forEach(N=>{f=y(N.id);let M=h(g+Math.sin(S)*f.width,m+Math.cos(S)*f.height,f.width,f.height),D=Ii(b,M),G=Math.sqrt(Math.pow(M.x+D.x-g,2)+Math.pow(M.y+D.y-m,2));if(d=Math.max(d,G),u.setPosition(N.id,M.x+D.x,M.y+D.y),S+=T,v!=null){let J=y(v.id),fe=u.getPosition(v.id),X=h(fe.x,fe.y,J.width,J.height),me=y(N.id),$e=u.getPosition(N.id),ke=h($e.x,$e.y,me.width,me.height),Ut=Ii(X,ke),nr={x:fe.x+J.width/2,y:fe.y+J.height/2},Ht={x:$e.x+Ut.x+me.width/2,y:$e.y+Ut.y+ +(me.height/2)},vr=Math.sqrt(Math.pow(nr.x-Ht.x,2)+Math.pow(nr.y-Ht.y,2));d=Math.max(d,vr/2/Math.sin(T/2))}v=N}),S=O,u.children.forEach(N=>{u.setIncidentAngle(N.id,S),u.setPosition(N.id,g+Math.sin(S)*d,m+Math.cos(S)*d),S+=T});let _=u.getPosition(e.id),P=_.x,I=y(e.id),C=P+I.width,R=_.y,w=R+I.height,B;u.children.forEach(N=>{if(!this.nd(N,t,n,o,{parent:e,incidentAngle:u.getIncidentAngle(N.id),position:u.getPosition(N.id)},a,l+1)){B=y(N.id),u.group.push(N);let D=u.getPosition(N.id);P=Math.min(P,D.x),C=Math.max(C,D.x+B.width),R=Math.min(R,D.y),w=Math.max(w,D.y+B.height)}}),u.extents=[P,C,R,w],u.offsets={};for(let N=0;N<u.group.length;N++){let M=u.group[N],D=u.getPosition(M.id);u.offsets[M.id]={x:D.x-u.extents[0],y:D.y-u.extents[2]}}}return u.children.size}step(e,t,n,o,s){if(s.rootNode&&s.rootNode.length>0){if(this.nd(s.rootNode[0],t,n,o,null,s,0),this.tt.length>0){let a=(this.tt[0].extents[0]+this.tt[0].extents[1])/2,l=(this.tt[0].extents[2]+this.tt[0].extents[3])/2;this.clusterMagnetizer.setElements(this.tt),this.clusterMagnetizer.executeAtPoint({x:a,y:l},{padding:{x:100,y:100}})}for(let a=0;a<this.tt.length;a++)this.tt[a].getPositions().forEach((h,d)=>{n(d,h.x,h.y)})}this.done=!0}};c(yd,"type","Balloon");var fd=yd;nt.register(fd.type,fd);var Ys=class{constructor(r){this.model=r}};var Cr="edge",Il="vertex",xd="center",NE=30;function dt(i){return i.type===Cr}var bd=class extends Ys{constructor(e,t){super(e);this.vertexSet=t;c(this,"er",new Map);c(this,"Wo",!1);c(this,"rr");c(this,"Ur",[]);c(this,"od",new Set);c(this,"xi");this.xi=e.layout.xi}SE(e){let t=this.model.getAdjacentVertices(e);return t.vertices.filter(n=>this.er.has(n.id)==!1).filter(n=>t.target.findIndex(o=>o.id===n.id)!==-1?t.source.findIndex(o=>o.id===n.id)===-1:!1).length}sd(e,t){let n=this.model.getAdjacentVertices(e.id),o=n.vertices;Array.from(n.filteredEdges).forEach(h=>this.od.add(h));let s=[],a,l;for(a=0;a<o.length;a++)if(!this.er.has(o[a].id))if(l=this.model.getVertex(o[a].id),l!=null)if(this.SE(o[a].id)===0){let d=t+1,u=this.model.getAdjacentVertices(o[a].id).target.filter(p=>this.er.has(p.id));if(u.length>0){let p=Math.max(...u.map(g=>this.vertexSet.findLayerIndex(g.id)));d=Math.max(d,p+1)}this.vertexSet.addToLayer(d,l),s.push(l),o[a].edges.forEach(p=>{let g={edge:p,id:p.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1,type:Cr,entries:[]};this.vertexSet.edgeNodes.push(g),this.vertexSet.edgeNodeMap.set(p.id,g)})}else o[a].edges.forEach(d=>{let u={edge:d,id:d.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1/0,type:Cr,entries:[]};this.vertexSet.edgeNodes.push(u),this.vertexSet.edgeNodeMap.set(d.id,u),this.Ur.push([l,t+1,u])});else this.model.excludedNodes[o[a].id]=!0;for(a=0;a<s.length;a++)this.er.set(s[a].id,!0),this.sd(s[a],t+1)}TE(){let e,t=(o,s)=>o.span>s.span?-1:o.span<s.span?1:o.rootLayer<s.rootLayer?-1:o.rootLayer>s.rootLayer?1:0,n=[];this.vertexSet.edgeNodes.forEach(o=>{o.rootLayer=this.model.getLayer(o.sourceNode),o.targetLayer=this.model.getLayer(o.targetNode),o.rootLayer!=null&&o.targetLayer!=null&&(o.span=o.targetLayer-o.rootLayer,o.span>1&&(n.length===0?n.push(o):t(o,n[0])<=0?n.unshift(o):n.push(o)))});for(let o=0;o<n.length;o++){let s=n[o];if(s.span>1){let l=this.vertexSet.layers[s.rootLayer].entries.filter(u=>!dt(u)),h=l.findIndex(u=>u.obj.id===s.sourceNode.id),d=l.length===1?!1:h<l.length/2;e=this.vertexSet.insertEdgeNodeInLayer(s.rootLayer+1,s,d),this.vertexSet.edgeEntryMap.set(e.id,e);for(let u=s.rootLayer+2;u<s.targetLayer;u++){let p=this.vertexSet.addToLayer(u,s,d);this.vertexSet.edgeEntryMap.set(p.id,p),p.previous=e,e.next=p,e=p}}}}execute(e){for(this.er.clear(),this.Wo=!1,this.rr=0,this.Ur.length=0,this.er.set(e.id,!0);!this.Wo;)if(this.sd(e,this.rr),this.Ur.length>0)if(this.Ur=this.Ur.filter(t=>!this.er.has(t[0].id)),this.Ur.length>0){let t=this.Ur.splice(0,1)[0];e=t[0],this.rr=t[1],this.er.set(e.id,!0),this.vertexSet.addToLayer(this.rr,e)}else this.Wo=!0;else this.Wo=!0;this.xi&&this.vE(),this.TE()}vE(){let e=this.vertexSet.layers.length-1;if(!(e<=0))for(let t=0;t<e;t++)this.vertexSet.layers[t].entries.filter(s=>!dt(s)&&s.leaf).forEach(s=>{this.vertexSet.removeFromLayer(t,s),this.vertexSet.addToLayer(e,s)})}getFilteredEdges(){return Array.from(this.od)}};var IE=i=>{let r=0;for(let e=0;e<i.length;e++){let t=i[e];t.length>0&&t[0].leaf&&r++,t.length>1&&t[t.length-1].leaf&&r++}return r};function X0(i){let r=0;return i.forEach(e=>r+=e[1]),r/i.length}var zs=class{constructor(r,e,t){this.vertexSet=r;this.getAdjacentEntries=e;c(this,"bi");c(this,"Ai");t=t||{},this.bi=t.maxIterations||24,this.Ai=t.maxIterationsWithoutImprovement||5}CE(){let r=[];for(let e=0;e<this.vertexSet.layers.length;e++)r.push(this.vertexSet.layers[e].entries.slice());return r}execute(){let r=this.CE(),e=r,t=0,n=this.ad(r),o=IE(e);for(let s=0;s<this.bi;s++){let a=this.PE(s,e),l=this.ad(a);if(l.total<n.total)n=l,t=0,o=IE(a);else if(l.total===n.total){let h=IE(a);h>o&&(n=l,t=0,o=h)}else t++;if(e=a,n.total===0||t>=this.Ai)break}this.vertexSet.layers.forEach((s,a)=>{s.entries=n.ordering[a]})}ad(r){let e=0,t=[],n;for(let o=r.length-2;o>-1;o--)n=this.OE(o,r,o+1),t[o]=n,e+=n.length;return{total:e,layers:t,ordering:r}}OE(r,e,t){let n=[],o=e[r],s=e[t],a=new Array(s.length);for(let u=0;u<a.length;u++)a[u]=[];let l=[],h,d=[];for(h=0;h<o.length;h++){let u=o[h],p=h,g=this.getAdjacentEntries(e,t,u),m=[];for(let E=0;E<g.length;E++){let y=g[E][1];m.push(y)}m.sort(function(E,y){return E-y}),l[p]=m}for(h=0;h<l.length;h++)d=d.concat(l[h].map(u=>[h,u]));for(h=0;h<d.length;h++){let u=d[h],p={sourceLayer:r,targetLayer:t,sourceVertex:u[0],targetVertex:u[1]};a[u[1]].push(p);for(let g=u[1]+1;g<a.length;g++)n.push(...a[g])}return n}PE(r,e){let t=[],n;if(r%2===0){for(n=e.length-1;n>0;n--)t[n]=this.ld(n,e,!1);t[0]=e[0].slice()}else{for(n=0;n<e.length-1;n++)t[n]=this.ld(n,e,!0);t[e.length-1]=e[e.length-1].slice()}return t}ld(r,e,t){let n=e[r],o=n.length,s=[],a=t?r+1:r-1,l={},h;if(o===1)return n;for(h=0;h<o;h++){let d=n[h],u=this.getAdjacentEntries(e,a,d),p=u.filter(m=>!dt(m[0])),g=u.filter(m=>dt(m[0]));g.length>0&&(g.sort((m,E)=>m[0].obj.span>E[0].obj.span?-1:E[0].obj.span>m[0].obj.span?1:0),p.push(g[0])),u.length>0?s.push([d,X0(p)]):(l[d.obj.id]=!0,s.push([d,-1]))}return s.sort((d,u)=>l[d[0].id]||l[u[0].id]?0:d[1]<u[1]?-1:u[1]<d[1]?1:d[0].type===Il&&u[0].type===Il?0:d[0].type===Cr&&u[0].leaf?-1:u[0].type===Cr&&d[0].leaf?1:0),s.map(d=>d[0])}};var VA="xmax",GA="ymax",$A="xmin",BA="ymin",Ad="_min",Sd="_max",Td=class{constructor(r,e,t,n,o){this.D=r;this.ue=e;this.axis=t;this.Pe=n;this._E=o;c(this,"Si",{})}execute(){this.Si={};let r=this._E(),e={},t=this.axis===0?{[Ad]:$A,[Sd]:VA}:{[Ad]:BA,[Sd]:GA},n=this.axis===1?{[Ad]:$A,[Sd]:VA}:{[Ad]:BA,[Sd]:GA},o=null;for(let a=0;a<this.ue.layers.length-1;a++){let l=this.ue.layers[a],h=this.ue.layers[a+1],d=Math.min(l[t.Te],h[t.Te]),p=Math.max(l[t.Vt],h[t.Vt])-d,g=this.Pe?n.Te:n.Vt,m=this.Pe?n.Vt:n.Te,E=l[g],x=h[m]-E,f={id:`r${a}`,type:"channel",axis:this.axis,left:this.axis===0?d:E,top:this.axis===1?d:E,width:this.axis===0?p:x,height:this.axis===1?p:x,lines:[]};this.ue.regions.push(f);for(let b=0;b<l.entries.length;b++){let A=l.entries[b],T=r.getVertexPosition(A.id)||A.loc,S={left:T.x,top:T.y,width:A.size.width,height:A.size.height,type:A.type,id:A.id,lines:[],paddingRegion:null,paddingRegionGate:null,gateDown:null,gateUp:null};this.ue.regions.push(S),this.Si[A.id]=S;let O=S;if(this.axis===0){let v=this.axis===0?S.top+S.height:S.left+S.width,_=this.axis===0?f.top:f.left;if(v<_){let P={left:this.axis===0?T.x:T.x+A.size.width,top:this.axis===0?T.y+A.size.height:T.y,width:this.axis===0?A.size.width:_-v,height:this.axis===0?_-v:A.size.height,type:A.type,id:`${A.id}_pad`,lines:[]};this.ue.regions.push(P),S.paddingRegion=P,S.paddingRegionGate=this.Zo(A,T,S,P,!0),O=P}}S.gateDown=this.Zo(A,T,O,f,!0),o!=null&&(S.gateUp=this.Zo(A,T,o,S,!1))}o=f}let s=this.ue.layers[this.ue.layers.length-1];for(let a=0;a<s.entries.length;a++){let l=s.entries[a],h=r.getVertexPosition(l.id),d={left:h.x,top:h.y,width:l.size.width,height:l.size.height,type:l.type,id:l.id,lines:[],gateUp:null};this.ue.regions.push(d),this.Si[l.id]=d,o!=null&&(d.gateUp=this.Zo(l,h,o,d,!1))}return this.ue.edgeNodes.forEach(a=>{let l=a.edge,h=H(l.source)?l.source.getParent():l.source,d=H(l.target)?l.target.getParent():l.target,u=this.D.entryMap[h.id],p=this.D.entryMap[d.id],g=this.Si[u.id],m=this.Si[p.id],E=[],y=u.layer<p.layer?1:-1;if(u.layer<p.layer){g.paddingRegionGate!=null&&E.push(g.paddingRegionGate),E.push(g.gateDown);for(let f=0;f<a.entries.length;f++){let b=a.entries[f],A=`r${b.layer-1}:${b.id}`;E.push(this.ue.gateMap[A]);let T=`${b.id}:r${b.layer}`;E.push(this.ue.gateMap[T])}E.push(m.gateUp)}else{E.push(g.gateUp);for(let f=a.entries.length-1;f>-1;f--){let b=a.entries[f],A=`${b.id}:r${b.layer}`;E.push(this.ue.gateMap[A]);let T=`r${b.layer-1}:${b.id}`;E.push(this.ue.gateMap[T])}m.paddingRegionGate!=null&&E.push(m.paddingRegionGate),E.push(m.gateDown)}let x={id:l.id,sourceId:l.source.id,targetId:l.target.id,path:E.map(f=>f.id),pathDirection:y};this.ue.edgeRoutingMap[l.id]=x,this.ue.edgeRouting.push(x),e[l.id]=E}),e}Zo(r,e,t,n,o){let s=this.axis===0?e.x:e.y,a=this.axis===0?r.size.width:r.size.height,l=this.axis===0?e.y:e.x,h=this.axis===0?r.size.height:r.size.width,d=this.Pe?l+(o?0:h):l+(o?h:0);return this.RE(t,n,this.axis,{point1:s,point2:s+a},a,d,{x:this.axis===0?s+a/2:d,y:this.axis===0?d:s+a/2})}RE(r,e,t,n,o,s,a){let l={id:`${r.id}:${e.id}`,a:{type:r.type,id:r.id},b:{type:e.type,id:e.id},axis:t,otherAxisLocation:s,segment:n,length:o,midpoint:a,edges:[]};return this.ue.gates.push(l),this.ue.gateMap[l.id]=l,l}};function j0(i,r){let e=[],t=[],n=[],o={},s={},a={},l=i.getAllEdges(),h=[],d=new Set,u=(p,g)=>{let m=ti(p.source),y={edge:p,isSource:m===g,sourceVertex:m,targetVertex:ti(p.target)};return h.push(y),y};Y(i)&&i.getMembers().forEach(p=>{p.getAllEdges().forEach(g=>{(We(g.source,i)&&!We(g.target,i)||We(g.target,i)&&!We(g.source,i))&&u(g,p)})}),r!=null?l.forEach(p=>{r(p)?u(p,i):d.add(p)}):l.forEach(p=>u(p,i));for(let p=0;p<h.length;p++){let g=h[p].isSource?h[p].targetVertex.id:h[p].sourceVertex.id;o[g]||(o[g]={id:g,edges:new Set},e.push(o[g])),o[g].edges.add(h[p].edge),h[p].isSource?(s[g]||(s[g]={id:g,edges:new Set},t.push(s[g])),s[g].edges.add(h[p].edge)):(a[g]||(a[g]={id:g,edges:new Set},n.push(a[g])),a[g].edges.add(h[p].edge))}return{vertices:e,source:t,target:n,filteredEdges:d}}function H0(i){return i.target.length===1&&(i.source.length===0||i.source[0].id===i.target[0].id)}var vd=class{constructor(r,e,t){this.instance=r;this.layout=t;c(this,"ie");c(this,"dn",{});c(this,"_t",{});c(this,"Jo",null);c(this,"hd",[]);c(this,"cd",new Map);c(this,"Ga");c(this,"Ie");c(this,"Ti");c(this,"vi",[]);c(this,"unattachedRootPadding");c(this,"vertexEntryMap",new Map);c(this,"entryMap",{});c(this,"assignedVertices",new Map);c(this,"axis");c(this,"invert");c(this,"sets",[]);c(this,"excludedNodes",{});c(this,"dd");c(this,"adjacentVertices",{});this.ie=e.padding||{x:50,y:50},this.unattachedRootPadding=e.unattachedRootPadding,this.axis=e.axis,this.invert=e.invert===!0,this.dd=e.setPosition,this.Ga=e.getSize,this.Jo=e.rootNode,this.Ie=e.edgeNodeSize,this.Ti=e.edgeFilter}nextRoot(){let r=this.vi.find(t=>!this.assignedVertices.has(t.id));return r?r.obj:null}getVertex(r){return this.dn[r]}setRootNode(r){this.Jo=r}getLayer(r){return this.getLayerForId(r.id)}getLayerForId(r){return this.assignedVertices.get(r)}getSize(r){return this._t[r.id]}getNodeSizeInMainAxis(r){return this.getSizeInMainAxis(this.getSize(r))}getNodeSizeInOtherAxis(r){return this.getSizeInOtherAxis(this.getSize(r))}ud(){let r={width:50,height:50};return this.axis===0?r.width=this.Ie:r.height=this.Ie,r}getSizeInMainAxis(r){return this.axis===0?r.width:r.height}getSizeInOtherAxis(r){return this.axis===0?r.height:r.width}getPaddingInMainAxis(){return this.axis===0?this.ie.x:this.ie.y}getPaddingInOtherAxis(){return this.axis===0?this.ie.x:this.ie.y}initialize(){this.vi.length=0,this.hd.length=0,this.cd.clear(),this.assignedVertices.clear();let r=this.layout.$vertices.length;if(r>0){let e;for(let t=0;t<r;t++){e=this.layout.$vertices[t],this._t[e.id]=this.Ga(e.id),this.dn[e.id]=e;let n=j0(e,this.Ti);this.adjacentVertices[e.id]=n;let o={obj:e,id:e.id,adjacent:n.vertices,sourceEdges:n.source,targetEdges:n.target,leaf:H0(n),size:this.Ga(e.id),type:Il,layer:-1,vertexSet:null};this.vi.push(o),this.vertexEntryMap.set(e.id,o),n.target.length===0&&(this.hd.push(o),this.cd.set(e.id,o))}this.vi.sort((t,n)=>{let o=this.Jo?this.Jo.id:"";return t.obj.id===o?-1:n.obj.id===o||t.adjacent.length===0?1:n.adjacent.length===0||t.targetEdges.length<n.targetEdges.length?-1:n.targetEdges.length<t.targetEdges.length?1:t.sourceEdges.length>n.sourceEdges.length?-1:n.sourceEdges.length>t.sourceEdges.length?1:0})}}isEmpty(){return this.vi.length===0}getAdjacentEntries(r,e,t){let n=[];for(let o=0;o<r[e].length;o++)this.areConnected(r[e][o],t)&&n.push([r[e][o],o]);return n}getAdjacentEntriesInLayer(r,e){let t=[];for(let n=0;n<r.length;n++)this.areConnected(r[n],e)&&t.push({entry:r[n],index:n});return t}areConnected(r,e){return dt(r)&&r.obj.edge.source===e.obj||dt(e)&&e.obj.edge.source===r.obj||dt(r)&&r.obj.edge.target===e.obj||dt(e)&&e.obj.edge.target===r.obj||dt(r)&&dt(e)&&(r.next===e||r.previous===e||e.next===r||e.previous===r)?!0:this.areAdjacent(r.obj.id,e.obj.id)}areAdjacent(r,e){let t=this.getAdjacentVertices(r),n=this.getAdjacentVertices(e);return t!=null&&t.vertices.findIndex(o=>o.id===e)!==-1||n!=null&&n.vertices.findIndex(o=>o.id===r)!==-1}getAdjacentVertices(r){return this.adjacentVertices[r]||{vertices:[],source:[],target:[],filteredEdges:new Set}}isLeaf(r){let e=this.vertexEntryMap.get(r);return e!=null?e.leaf:!1}};function Ml(i){return i.parents.length>0?i.parents[0].loc:null}function Cd(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function k0(i){return i.parents.length>0?i.parents[0].root===!0:!1}function FA(i){return i.parents.length>0?i.parents[0].childGroup:null}function W0(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var Pd=class{constructor(r,e){this.model=r;c(this,"vn",-1/0);c(this,"Cn",1/0);c(this,"Br");c(this,"qt");c(this,"Pe");c(this,"L",[]);c(this,"Fr",[]);c(this,"di",{});c(this,"ie");c(this,"ee");c(this,"Dt");c(this,"ge");c(this,"pi");c(this,"Se");c(this,"Rt");c(this,"I");c(this,"mi");c(this,"Nt");c(this,"gi");c(this,"Ne",[]);c(this,"de",new Map);c(this,"Ra",{center:r=>Ml(r)+Cd(r,this.ee)/2-(r.size-this.ee)/2,start:r=>Ml(r),end:r=>Ml(r)+Cd(r,0)-(r.size-this.ee)});c(this,"W");c(this,"It");c(this,"Qt");c(this,"Ei");c(this,"Va",{center:(r,e,t)=>(e+t)/2-Cd(r,0)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Br=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.qt=e.compress===!0,this.Rt=e.absoluteBacked===!0,this.W=e.idFunction,this.It=e.sizeFunction,this.Qt=e.childVerticesFunction,this.Ei=e.absolutePositionFunction,this.ge=e.axisIndex,this.Se=this.ge!==1,this.pi=this.ge===0?1:0,this.mi=this.Se?ye:ee,this.Nt=this.Se?_e:Ve,this.gi=this.Se?Ve:_e,this.Pe=e.invert===!0,this.I=e.alignment||xd,this.ie=e.padding,this.ee=this.Se?this.ie.x:this.ie.y,this.Dt=this.Se?this.ie.y:this.ie.x}execute(){let r,e,t;for(let n=0;n<this.Br.length;n++){r=this.Br[n];let o=this.It(r.id),s=this.et(r,o,0,null,null),a=0;s.root=!0,a=this.fi(s,0);let l=0,h,d,u=(g,m)=>this.qt&&g.parents&&g.parents.length>0?this.de.get(this.W(g.parents[0].node)).position[this.mi]+this.La(g,this.pi)+this.Dt:m,p=!1;if(a===0&&this.Rt===!0){let g=this.Ei(r);!isNaN(g.x)&&!isNaN(g.y)&&(this.yi(r.id,g,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.ge===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.ge===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.yi(this.W(this.L[e].entries[t].node),{x:h,y:d},e);this.Pe?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.Dt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.Dt,l+=this.L[e].otherAxisSize)}}return this.de}yi(r,e,t){this.de.set(r,{position:e,layer:t});let n=this.It(r),o=this.ge===0?e.x+n.width:e.y+n.height,s=this.ge===0?e.x:e.y;this.vn=Math.max(this.vn,o),this.Cn=Math.min(this.Cn,s)}gt(r){let e=this.L[r];return e||(e={entries:[],pointer:0,otherAxis:null,otherAxisSize:null},this.L[r]=e),e}et(r,e,t,n,o){let s=this.gt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,childGroupIndex:o==null?void 0:o.nodes.length,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Nt],children:[]},l=e[this.gi];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.Nt]+(r.type===Cr?0:this.ee),s.entries.push(a),n&&n.children.push(a),a}wa(r,e){let t=this.Fr[e];t||(t=[],this.Fr[e]=t),r.index=t.length,t.push(r)}Da(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.gt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.ee)}}La(r,e){let t=r.parents.map(n=>n.dimensions[e===0?_e:Ve]);return Math.max.apply(null,t)}Na(r){if(r.size>0){let e=this.Ra[this.I](r),t=this.Fr[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.ee}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.ee;o!==0&&this.Ia(r),this.wa(r,r.depth)}}Ma(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.Va[this.I](r,e,t),o=n-Ml(r);if(this.Da(r,n),!k0(r)){let s=FA(r),a=W0(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ia(r){let e=r;for(;e!=null;)this.Ma(e),e=FA(e)}fi(r,e){if(this.di[r.node.id])return;this.di[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[],index:-1,id:$()},n=[],o,s={},a=this.gt(e+1),l=this.Qt(r.node,e,this.model);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.It(this.W(h)),u=a.entries.find(p=>this.W(p.node)===this.W(h));if(u!=null){u.parents.push(r);let p=u.loc+u.size/2,g=Ml(u),m=Cd(u,this.ee),E=g+m/2,y=E-p;y>0&&this.LE(u,y,r)}else{let p=this.et(h,d,e+1,r,t);t.nodes.push(p);let g=d[this.Nt];t.size+=g+this.ee,n.push(p)}s[h.id]=!0}}for(this.Na(t),o=0;o<n.length;o++)this.fi(n[o],e+1);return l.length}LE(r,e,t){let n={},o=s=>{let a=s.childGroup;if(n[a.id]!==!0){n[a.id]=!0;let l=s.childGroupIndex;for(let h=l;h<a.nodes.length;h++)a.nodes[h].loc+=e;l===0?a.loc+=e:a.size+=e}s.children.forEach(o)};o(r)}};var _d=class extends Ys{constructor(e,t,n){super(e);this.model=e;this.vertexSet=t;c(this,"nr");c(this,"rr");c(this,"ie");c(this,"Pn");c(this,"On");c(this,"I");c(this,"Ie");c(this,"Ci");n=n||{},this.ie=n.padding||{x:50,y:50},this.Pn=n.unattachedRootPadding||150,this.nr=n.lastPlacements,this.On=n.strategy||"parent",this.Ie=n.edgeNodeSize,this.Ci=n.gatherUnattachedRoots,this.I=n.alignment||"center"}wE(e,t){return{mainAxis:(e.length-1)*t+e.reduce((n,o)=>dt(o)?n+this.Ie:n+this.model.getSizeInMainAxis(o.size),0),otherAxis:e.reduce((n,o)=>Math.max(n,this.model.getSizeInOtherAxis(o.size)),0)}}execute(e){let t=0,n,o=this.model.getPaddingInMainAxis(),s=this.model.getPaddingInOtherAxis(),a=this.model.axis,l=this.nr?this.nr.maximumPointer+o:0,h=this.vertexSet.layers,d=l,u=h.map(m=>this.wE(m.entries,o)),p={rootId:e.id,rootSize:this.model.getNodeSizeInMainAxis(e),maximumPointer:d,rootPosition:d,biggestLayer:Math.max(...u.map(m=>m.mainAxis))},g=this.model.getNodeSizeInMainAxis(e);return n=this.On==="center"?(p.biggestLayer-g)/2:this.On==="start"?0:p.biggestLayer-g,h.length>0&&(this.model.invert?t-=u[0].otherAxis+2*s:t+=this.model.getNodeSizeInOtherAxis(e)+2*s,this.On==="parent"?this.DE(p,l):this.NE(h,n,a,p,l,t,u,o,s)),p.maximumPointer=Math.max(p.maximumPointer,p.rootPosition+p.rootSize+o),p}NE(e,t,n,o,s,a,l,h,d){let u=s,p;for(let g=0;g<e.length;g++){this.rr=e[g],t=this.On==="center"?(o.biggestLayer-l[g].mainAxis)/2:this.On==="start"?0:o.biggestLayer-l[g].mainAxis,u=s;for(let m=0;m<this.rr.entries.length;m++){p=this.rr.entries[m];let E=t+u,y=a,x=n===0?E:y,f=n===0?y:E;if(dt(p)){let b=n===0?this.Ie:y,A=n===0?y:this.Ie;p.loc={x,y:f,w:b,h:A},u+=this.Ie+h}else this.vertexSet.setPosition(p.obj,x,f,g),u+=this.model.getSizeInMainAxis(p.size)+h}o.maximumPointer=Math.max(o.maximumPointer,u),g<e.length-1&&(this.model.invert?a-=l[g+1].otherAxis+2*d:a+=l[g].otherAxis+2*d)}}DE(e,t){let n=new Pd(this.model.layout.instance,{rootNode:this.vertexSet.layers[0].entries,padding:this.ie,axisIndex:this.model.axis,invert:this.model.invert,alignment:this.I,idFunction:d=>this.model.layout.instance.getNodeId(d),sizeFunction:d=>this.model.entryMap[d].size,childVerticesFunction:(d,u,p)=>{let g=[];if(u<this.vertexSet.layers.length-1){let m=this.model.getAdjacentEntriesInLayer(this.vertexSet.layers[u+1].entries,d).map(E=>E.entry);g.push(...m)}return g},absoluteBacked:this.model.layout.absoluteBacked,absolutePositionFunction:d=>this.model.layout.getAbsolutePosition(d,this.model.layout.parameters)}),o=n.execute(),s=n.vn,a=n.Cn,l=0,h=0;if(this.Ci&&o.size===1&&this.nr!=null){let d=this.nr.rootPosition+this.nr.rootSize+this.Pn;o.get(e.rootId).position[this.model.axis===0?"x":"y"]=d,e.maximumPointer=d+e.rootSize}else if(this.nr){let d=this.nr.maximumPointer-a;this.model.axis===0?l=d:h=d}o.forEach((d,u)=>{this.vertexSet.setPositionById(u,d.position.x+l,d.position.y+h,d.layer),u===e.rootId&&(e.rootPosition=this.model.axis===0?d.position.x+l:d.position.y+h)}),e.maximumPointer=t+(s-a)}};var Od=class{constructor(r,e){this.D=r;this.index=e;c(this,"layers",[]);c(this,"regions",[]);c(this,"gateMap",{});c(this,"edgeNodes",[]);c(this,"edgeNodeMap",new Map);c(this,"gates",[]);c(this,"edgeRoutingMap",{});c(this,"edgeRouting",[]);c(this,"pd",[]);c(this,"edgeEntryMap",new Map)}addToLayer(r,e,t){let n=this.md(r),o=dt(e),s;return o?(s={id:$(),obj:e,previous:null,size:this.D.ud(),next:null,leaf:!1,type:Cr,layer:r,vertexSet:this},e.entries.push(s)):(s=this.D.vertexEntryMap.get(e.id),s.layer=r,s.vertexSet=this),this.D.entryMap[s.id]=s,t?n.entries.unshift(s):n.entries.push(s),this.D.assignedVertices.set(e.id,r),this.pd.push(s),s}findLayerIndex(r){var e;return(e=this.pd.find(t=>t.id===r))==null?void 0:e.layer}insertEdgeNodeInLayer(r,e,t){let n=this.md(r),o=this.D.ud();this.D.assignedVertices.set(e.id,r);let s={id:$(),obj:e,size:o,leaf:!1,type:Cr,layer:r,vertexSet:this};e.entries.push(s),this.D.entryMap[s.id]=s;let a=t?1:-1,l=t?0:n.entries.length-1,h=null;for(;h==null&&l>=0&&l<n.entries.length;)dt(n.entries[l])?n.entries[l].obj.span<e.span&&(h=l):h=l,l+=a;let d=h!=null?t?h:h+1:t?0:n.entries.length;return n.entries.splice(d,0,s),s}removeFromLayer(r,e){let t=this.layers[r];t.entries.splice(t.entries.indexOf(e),1),this.D.assignedVertices.delete(e.id)}setPositionById(r,e,t,n){if(!this.D.layout.absoluteBacked)this._n(r,e,t,n);else{let o=this.D.layout.model.getVertex(r),s=this.D.layout.getAbsolutePosition(o);s.x!=null&&s.y!=null&&!isNaN(s.x)&&!isNaN(s.y)?this._n(r,s.x,s.y,n):this._n(r,e,t,n)}}setPosition(r,e,t,n){if(!this.D.layout.absoluteBacked)this._n(r.id,e,t,n);else{let o=this.D.layout.getAbsolutePosition(r);o.x!=null&&o.y!=null&&!isNaN(o.x)&&!isNaN(o.y)?this._n(r.id,o.x,o.y,n):this._n(r.id,e,t,n)}}md(r){return this.layers[r]==null&&(this.layers[r]={layer:r,entries:[],xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0}),this.layers[r]}_n(r,e,t,n){this.D.dd(r,e,t,n);let o=this.layers[n],s=this.D.vertexEntryMap.get(r)||this.edgeEntryMap.get(r);if(s){let a=e+s.size.width,l=t+s.size.height;o.xmin=Math.min(o.xmin,e),o.ymin=Math.min(o.ymin,t),o.xmax=Math.max(o.xmax,a),o.ymax=Math.max(o.ymax,l)}}};var UA="Hierarchy",Do=class extends ri{constructor(e){super(e);c(this,"type",UA);c(this,"axis");c(this,"model");c(this,"Pn");c(this,"Ai");c(this,"bi");c(this,"Pe");c(this,"Ci");c(this,"gd");c(this,"Tn");c(this,"Ed");c(this,"I");c(this,"fd");c(this,"xi");c(this,"Ie");c(this,"Ti");c(this,"$a");c(this,"routingInformation");c(this,"resultSets",[]);this.Pn=e.options.unattachedRootPadding==null?150:e.options.unattachedRootPadding,this.axis=e.options.axis?e.options.axis==="horizontal"?0:1:0,this.Ai=e.options.maxIterationsWithoutImprovement||5,this.bi=e.options.maxIterations||24,this.Ed=e.options.rootNode,this.Tn=e.options.getRootNode,this.fd=e.options.placementStrategy,this.Ie=e.options.edgeNodeSize||NE,this.Pe=e.options.invert===!0,this.Ci=e.options.gatherUnattachedRoots===!0,this.I=e.options.alignment||xd,this.gd=e.options.generateRouting===!0,this.Ti=e.options.edgeFilter,this.$a=e.options.filteredEdgeProcessor,this.xi=e.options.leavesAtBottom}begin(e,t,n,o,s){this.resultSets.length=0;let a=this.Tn?this.Tn():this.Ed;this.model=new vd(e,{getSize:l=>this.getSize(l,o),axis:this.axis,padding:this.padding,setPosition:n,rootNode:a,invert:s.invert===!0,unattachedRootPadding:this.Pn,edgeNodeSize:this.Ie,edgeFilter:this.Ti},this),this.model.initialize()}end(e,t,n,o,s){}reset(){}getDefaultParameters(){return{padding:{x:50,y:50},unattachedRootPadding:150,axis:"horizontal",maxIterations:24,maxIterationsWithoutImprovement:2,placementStrategy:"parent",alignment:"center",edgeNodeSize:NE}}step(e,t,n,o,s){let a=0;if(!this.model.isEmpty()){let l=this.model.nextRoot(),h=null;for(;l!=null;){let d=new Od(this.model,a++);d.addToLayer(0,l),this.model.sets.push(d);let u=new bd(this.model,d);u.execute(l),new zs(d,(m,E,y)=>this.model.getAdjacentEntries(m,E,y),{maxIterations:this.bi,maxIterationsWithoutImprovement:this.Ai}).execute(),h=new _d(this.model,d,{padding:this.padding,strategy:this.fd,edgeNodeSize:this.Ie,lastPlacements:h,gatherUnattachedRoots:this.Ci,unattachedRootPadding:this.Pn,alignment:this.I}).execute(l);let p=[];if(d.layers.flatMap(m=>m.entries.map(E=>{if(dt(E)){p.push(E);let y=this.axis===0?m.ymax-m.ymin:m.xmax-m.xmin;this.axis===0?E.size.height=y:E.size.width=y}})),this.$a){let m=u.getFilteredEdges().map(E=>{let y=this.model.entryMap[E.source.id],x=this.model.entryMap[E.target.id],f=d.layers[y.layer].entries.findIndex(A=>A.id===y.id),b=d.layers[x.layer].entries.findIndex(A=>A.id===x.id);return{sourceEntry:y,sourceEntryIndex:f,targetEntry:x,targetEntryIndex:b,edge:E}});this.$a(m,this)}let g={};this.gd&&(this.routingInformation=this.model.sets.map(m=>{let E={gates:m.gates,edges:m.edgeRouting,edgeMap:m.edgeRoutingMap,regions:m.regions,getVertexPosition:y=>t(y),getVertexSize:y=>o[y]};return new Td(this.model,d,this.axis,this.Pe,()=>E).execute(),E})),this.resultSets.push({node:l,edgeNodes:p,paths:g}),l=this.model.nextRoot()}}this.done=!0}getRoutingInformation(){return this.routingInformation}};c(Do,"type",UA),nt.register(Do.type,Do);var Rd=class{constructor(r){this.color=r}generate(r){return this.color}},oi=class i{constructor(r,e,t){this.r=r;this.g=e;this.b=t}toString(){return`rgb(${this.r}, ${this.g}, ${this.b})`}static fromString(r){if(r.startsWith("#")){let e=r.substring(1);e.length===3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]].join(""));let t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),o=parseInt(e.substring(4,6),16);return new i(t,n,o)}else if(r.startsWith("rgb")){let e=r.match(/\d+/g);if(e&&e.length>=3)return new i(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}else{let e=Z0(r);return i.fromString(e)}}};function Z0(i){let r=document.createElement("div");r.style.color=i,document.body.appendChild(r);let e=getComputedStyle(r).color;return document.body.removeChild(r),e}function YA(){return new oi(Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20))}var Xs=class{constructor(){c(this,"assignedColors",[])}generate(r){let n=0,o=YA(),s=this.assignedColors.find(a=>XA(a,o)<20);for(;s!=null&&n<10;)o=YA(),s=this.assignedColors.find(a=>XA(a,o)<20),n++;return this.assignedColors.push(o),o.toString()}reset(){this.assignedColors.length=0}},zA=class{constructor(...r){c(this,"colors");c(this,"counter",0);this.colors=r}generate(r){let e=this.colors[this.counter];return this.counter++,this.counter>=this.colors.length&&(this.counter=0),e}};function XA(i,r){let e=(i.r+r.r)/2,t=i.r-r.r,n=i.g-r.g,o=i.b-r.b;return Math.sqrt(((512+e)*t*t>>8)+4*n*n+((767-e)*o*o>>8))}function Ld(i){let r=j(i)?oi.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new oi(Math.floor(r.r*.3),Math.floor(r.g*.3),Math.floor(r.b*.3)):new oi(Math.min(255,Math.floor(r.r+(255-r.r)*.7)),Math.min(255,Math.floor(r.g+(255-r.g)*.7)),Math.min(255,Math.floor(r.b+(255-r.b)*.7)))}function tH(i){let r=j(i)?oi.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new oi(0,0,0):new oi(255,255,255)}var ME="empty",J0=[{dx:0,dy:-1,axis:pe,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:pe,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1},{dx:-1,dy:-1,axis:Cn,directionFromParent:-1},{dx:1,dy:-1,axis:ii,directionFromParent:-1},{dx:1,dy:1,axis:Cn,directionFromParent:1},{dx:-1,dy:1,axis:ii,directionFromParent:1}],K0=[{dx:0,dy:-1,axis:pe,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:pe,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1}],jA=(i,r,e,t)=>K0.filter(n=>n.axis!==e||n.directionFromParent===t),VE=(i,r,e,t)=>{let n=[];switch(e){case ii:n.push({x:-t,y:0}),n.push({x:-t,y:t}),n.push({x:0,y:t});break;case Cn:n.push({x:t,y:0}),n.push({x:t,y:t}),n.push({x:0,y:t});break;case ne:n.push({x:t,y:-1}),n.push({x:t,y:0}),n.push({x:t,y:1});break;case pe:n.push({x:-1,y:t}),n.push({x:0,y:t}),n.push({x:1,y:t});break}return J0.filter(o=>n.find(s=>s.x===o.dx&&s.y===o.dy))};var Hs=class{constructor(r,e,t,n,o,s){this.gridCellSize=t;this.vertexBorder=n;this.vertexBuffer=o;this.getCoincidentObstacles=s;c(this,"Et",{});c(this,"Pi");c(this,"yd");c(this,"sourceId");c(this,"targetId");c(this,"sourceObstacles",[]);c(this,"targetObstacles",[]);c(this,"sourceBuffers",[]);c(this,"targetBuffers",[]);c(this,"sourceAxis");c(this,"sourceDirection");c(this,"targetAxis");c(this,"targetDirection");this.Pi={x:Math.min(r.x,e.x),y:Math.min(r.y,e.y)},this.yd=t*(n+o)}Ko(r,e){return{x:Math.floor((r-this.Pi.x)/this.gridCellSize),y:Math.floor((e-this.Pi.y)/this.gridCellSize)}}IE(r){let e=this.Ko(r.x,r.y),t=this.Ko(r.x+r.width,r.y+r.height);return{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}VE(r,e){let t=r*this.gridCellSize,n=e*this.gridCellSize,o=this.Pi.x+t,s=this.Pi.y+n;return{x:o,y:s,width:this.gridCellSize,height:this.gridCellSize}}makeKey(r,e){return`${r}_${e}`}ME(r){return this.sourceObstacles.indexOf(r)!==-1||this.sourceBuffers.indexOf(r)!==-1||this.targetObstacles.indexOf(r)!==-1||this.targetBuffers.indexOf(r)!==-1}GE(r,e,t,n){let o=this.makeKey(r,e);if(this.Et[o]==null){let s=this.VE(r,e),a=s.x,l=s.y,h=this.getCoincidentObstacles(a,l,this.yd),d=[],u=[],p=!1,g=!1;h.forEach(m=>{if(!p&&(this.sourceId===m.id||this.sourceObstacles.indexOf(m.id)!==-1)&&(p=!0),!g&&(this.targetId===m.id||this.targetObstacles.indexOf(m.id)!==-1)&&(g=!0),!this.ME(m.id)){let E=zb(this.IE(m),this.vertexBorder,this.vertexBorder);u.push(m.id),E.x<=r&&E.x+E.width>=r&&E.y<=e&&E.y+E.height>=e&&d.push(m.id)}}),this.Et[o]={key:o,f:0,g:1/0,h:null,opened:!1,closed:!1,x:r,y:e,cx:a,cy:l,ax:t,ay:n,parent:null,fixedAxis:null,directionFromParent:null,obstacles:d,buffers:u,hasSourceObstacles:p,hasTargetObstacles:g}}else t&&(this.Et[o].ax=t),n&&(this.Et[o].ay=n);return this.Et[o]}setSourceCell(r,e,t,n,o,s,a){this.sourceId=r;let l=this.getCell(e,t,n,o);return this.sourceObstacles=l.obstacles.slice(),this.sourceBuffers=l.buffers.slice(),this.sourceAxis=s,this.sourceDirection=a,l.opened=!0,l.g=0,l.f=0,l.fixedAxis=s,l.directionFromParent=a,l}setTargetCell(r,e,t,n,o,s,a){this.targetId=r;let l=this.getCell(e,t,n,o);return this.targetObstacles=l.obstacles.slice(),this.targetBuffers=l.buffers.slice(),this.targetAxis=s,this.targetDirection=a,l.fixedAxis=s,l.directionFromParent=this.targetDirection,l}get sourceAndTargetObstacles(){let r=this.sourceObstacles.slice(),e=this.targetObstacles.slice();return r.push(...e),r}getCell(r,e,t,n){return this.GE(r,e,t,n)}reinitialize(){Object.entries(this.Et).forEach(r=>{r[1].f=0,r[1].g=1/0,r[1].h=null,r[1].closed=!1,r[1].opened=!1,r[1].parent=null,r[1].directionFromParent=null,r[1].ax=null,r[1].ay=null,r[1].fixedAxis=null}),this.sourceObstacles.length=0,this.sourceBuffers.length=0,this.targetObstacles.length=0,this.targetBuffers.length=0}};function js(i,r){return i===0&&r===0?void 0:i===0&&r!==0?pe:i!==0&&r===0?ne:Math.sign(r)===Math.sign(i)?Cn:ii}function HA(i,r,e){return e==null?0:e===ne?i>0?1:-1:e===pe?r>0?1:-1:e===Cn?i>0&&r>0?1:-1:i<0&&r>0?1:-1}function GE(i){let r=js(i.ox,i.oy);return{axis:r,direction:HA(i.ox,i.oy,r)}}function kA(i,r){let e=Math.abs(r.x-i.x),t=Math.abs(r.y-i.y);return e>t?ne:pe}function Ir(i){if(i.parent==null)return i.fixedAxis;{let r=Math.sign(i.parent.x-i.x),e=Math.sign(i.parent.y-i.y);return js(r,e)}}function WA(i){if(i.parent==null)return i.directionFromParent;{let r=Math.sign(i.x-i.parent.x),e=Math.sign(i.y-i.parent.y),t=js(r,e);return HA(r,e,t)}}function q0(i,r,e){if(r.f<e.f)return-1;if(e.f<r.f)return 1;if(r.h<e.h)return-1;if(e.h<r.h)return 1;{let t=Ir(i);return Ir(r)===t?-1:Ir(e)===t?1:0}}var wd=class{constructor(){c(this,"node")}sort(r,e){return q0(this.node,r,e)}};var Zt="group:added",Gi="group:member:added",ks="group:member:removed",Re="group:removed",No="dataLoadStart",$E="dataAppendStart",Mr="dataLoadEnd",BE="dataAppendEnd",FE="dataUpdated",_n="graphClearStart",Jt="graphCleared",ZA="graphChanged",ve="group:updated",Le="node:updated",dr="port:updated",xt="edge:updated",ur="edge:added",Kt="node:added",bt="edge:removed",Ce="node:removed",si="port:added",Vr="port:removed",an="edge:target",ln="edge:source",qt="select",Qt="deselect",ir="selection:cleared",ai="edge:geometry",li="edge:pathEdited",JA="edge:dragStart",KA="edge:drag",qA="edge:dragEnd",QA="edge:dragAbort",Dd="edge:typeChanged",Nd="node:typeChanged",Id="port:typeChanged",Md="group:typeChanged",eS="group:move:start",Io="group:move",Gr="group:move:end",Vd="internal:group:sizeChanged",Gd="internal:group:sizeChangedRedo",$d="internal:group:sizeChangedUndo",tS="internal:edge:redraw",rS="renderer:added",Ws="node:move:start",Mt="node:move",Vt="node:move:end",Bd="node:move:abort",Zs="undoredo:update",nS="undo",iS="redo",$i="destroy";var Q0=[Kt,si,ur,Zt,Ce,Vr,bt,Re,Le,dr,xt,ve,Vt,Gr,ln,an,Gi,ks],Mo=(i,r,e)=>{i.instance.bind(r,e),i.bindings.push([r,e])},Vl=class{constructor(r,e){this.instance=r;c(this,"bindings",[]);c(this,"qo",null);if(e.saveUrl==null&&e.autoSaveHandler==null)throw new Error("VisuallyJs autosave: neither saveUrl nor autoSaveHandler was specified");function t(a){return function(){a&&a.apply(a,arguments),e.onAfterAutoSave&&e.onAfterAutoSave()}}let n=!1,o=function(){if(!n){try{e.onBeforeAutoSave&&e.onBeforeAutoSave()}catch(a){}e.autoSaveHandler!=null?e.autoSaveHandler(r):r.save({type:e.type||Wt,url:e.saveUrl,success:t(e.onAutoSaveSuccess),error:t(e.onAutoSaveError),headers:e.saveHeaders})}},s=()=>{e.debounceTimeout==null?o():this.qo==null?this.qo=setTimeout(o,e.debounceTimeout):(clearTimeout(this.qo),this.qo=setTimeout(o,e.debounceTimeout))};Mo(this,No,()=>{n=!0}),Mo(this,Mr,()=>{n=!1}),Mo(this,_n,()=>{n=!0}),Mo(this,Jt,()=>{n=!1}),Mo(this,FE,s),Mo(this,li,s)}discard(){this.bindings.forEach(r=>this.instance.unbind(r[0],r[1])),this.bindings.length=0}},Fd=class{constructor(r){this.instance=r;c(this,"bindings",[]);let e=()=>{r.fire(FE)};Q0.forEach(t=>Mo(this,t,e))}};var oS="mixed",Ud="isolated",sS="nodesOnly",aS="groupsOnly",lS="edgesOnly",Vo=class Vo extends zt{constructor(e,t){super();this.instance=e;c(this,"ir",1/0);c(this,"xd",1/0);c(this,"bd",1/0);c(this,"pe",[]);c(this,"te",[]);c(this,"ne",[]);c(this,"capacityPolicy");c(this,"generator");c(this,"onReload");c(this,"onBeforeReload");c(this,"onClear");c(this,"autoFill");c(this,"Ve",{});c(this,"zr");c(this,"Qo",!1);c(this,"edgeFactory");t=t||{},this.edgeFactory=e.edgeFactory,this.generator=t.generator,this.onReload=t.onReload,this.onBeforeReload=t.onBeforeReload,this.autoFill=t.autoFill===!0,this.onClear=t.onClear||function(){},this.zr=t.mode||oS,this.instance.bind(Ce,n=>{this.Mt(n.node)}),this.instance.bind(Re,n=>{this.Mt(n.group)}),this.instance.bind(Vr,n=>{this.Mt(n.port)}),this.instance.bind(bt,n=>{this.Mt(n.edge)}),this.instance.bind(an,n=>{this.Ve[n.edge.getFullId()]&&this.fire(an,n)}),this.instance.bind(ln,n=>{this.Ve[n.edge.getFullId()]&&this.fire(ln,n)}),this.instance.bind(Kt,n=>{this.generator&&this.autoFill&&!this.Qo&&this.reload()}),this.instance.bind(Zt,n=>{this.generator&&this.autoFill&&!this.Qo&&this.reload()}),this.instance.bind(Le,n=>{this.Ve[n.vertex.getFullId()]&&this.fire(Le,n)}),this.instance.bind(ve,n=>{this.Ve[n.vertex.getFullId()]&&this.fire(ve,n)}),this.instance.bind(xt,n=>{this.Ve[n.edge.getFullId()]&&this.fire(xt,n)}),this.instance.bind(dr,n=>{n.port!=null&&this.Ve[n.port.getFullId()]&&this.fire(dr,n)}),this.instance.bind(Jt,()=>{this.clear()}),this.instance.bind(Mr,()=>{this.reload()}),this.setCapacityPolicy(Vo.DISCARD_EXISTING),t.lazy!==!0&&this.reload()}isEmpty(){return this.pe.length===0&&this.te.length===0&&this.ne.length===0}Ad(e){return e.objectType===ze.objectType?this.ne:e.objectType===ce.objectType?this.pe:this.te}setMode(e){this.zr=e,e===Ud?this.$E():e===lS?this.Sd():e===sS?(this.Ba(),this.Td()):e===aS&&(this.Ba(),this.vd())}BE(e){let t=[],n=this.Ad(e),o=e.objectType===ze.objectType?this.xd:e.objectType===ce.objectType?this.ir:this.bd;if(n.length>=o){if(this.capacityPolicy===Vo.DISCARD_NEW)return!1;t=n.splice(0,1),this.Fa(t[0],":removed"),delete this.Ve[t[0].getFullId()]}return n.push(e),this.Fa(e,":added"),t}Fa(e,t){let n=e.objectType.toLowerCase()+t,o={Group:s=>({data:s.data,group:s}),Node:s=>({data:s.data,node:s}),Port:s=>({data:s.data,node:s.getParent(),port:s}),Edge:s=>({data:s.data,edge:s})};this.fire(n,o[e.objectType](e))}Cd(e,t){if(this.FE(e)&&!this.Ve[e.getFullId()]){let n=this.BE(e);return n===!1?[[],[]]:(this.Ve[e.getFullId()]=e,t&&t(e,!0),[[e],n])}return[[],[]]}FE(e){return this.zr===oS||this.zr===sS&&e.objectType===ce.objectType||this.zr===aS&&e.objectType===se.objectType||this.zr===lS&&e.objectType===ze.objectType?!0:this.zr===Ud?e.objectType===ze.objectType?this.pe.length===0&&this.te.length===0:this.ne.length===0:!1}Mt(e,t){let n=e.getFullId();return Nt(this.Ad(e),s=>s.getFullId()==n)?(delete this.Ve[e.getFullId()],t&&t(e,!1),this.Fa(e,":removed"),[[],[e]]):[[],[]]}UE(e,t){return this.Ve[e.getFullId()]?this.Mt(e,t):this.Cd(e,t)}Ua(e,t,n){let o=[],s=[],a;if(e==null)return o;let l=h=>{let d;if(j(h))d=this.instance.getNode(h)||this.instance.getEdge(h)||this.instance.getGroup(h),d!=null&&(a=t(d,n),o.push.apply(o,a[0]),s.push.apply(s,a[1]));else if(h.eachVertex&&h.eachEdge)h.eachVertex((u,p)=>{l(p)}),h.eachEdge((u,p)=>{l(p)});else if(h.Ye)h.each((u,p)=>{l(p.vertex||p)});else if(h.length!=null)for(let u=0;u<h.length;u++)l(h[u]);else a=t(h,n),o.push.apply(o,a[0]),s.push.apply(s,a[1])};return l(e),[o,s]}remove(e,t){return this.Ua(e,this.Mt.bind(this),t)}append(e,t){return this.Ua(e,this.Cd.bind(this),t)}toggle(e,t){return this.Ua(e,this.UE.bind(this),t)}setMaxNodes(e){this.ir=e}setMaxGroups(e){this.bd=e}setMaxEdges(e){this.xd=e}setCapacityPolicy(e){this.capacityPolicy=e}Ba(){for(let e=this.ne.length,t=0;t<e;t++)this.Mt(this.ne[0])}vd(){for(let e=this.pe.length,t=0;t<e;t++)this.Mt(this.pe[0])}Td(){for(let e=this.te.length,t=0;t<e;t++)this.Mt(this.te[0])}Sd(){this.vd(),this.Td()}$E(){this.Sd(),this.Ba()}clear(e){this.pe.length=0,this.ne.length=0,this.te.length=0,this.Ve={},this.fire(_n),e||this.onClear(this)}zE(e){let t=[];for(let n=0;n<e.length;n++)this.Ve[e[n].getId()]!=null&&t.push(e[n]);return t}reload(){this.generator!=null&&(this.onBeforeReload&&this.onBeforeReload(),this.clear(),this.Qo=!0,this.fire(No,{}),this.generator(this,this.instance),this.fire(Mr,{}),this.onReload&&this.onReload(),this.Qo=!1)}Ye(e,t){let n=t===ze.objectType?this.ne:t===se.objectType?this.te:this.pe;for(let o=0;o<n.length;o++)try{e(o,n[o])}catch(s){}}eachNode(e){this.Ye(e,ce.objectType)}eachGroup(e){this.Ye(e,se.objectType)}eachVertex(e){this.Ye(e,ce.objectType),this.Ye(e,se.objectType)}eachEdge(e){this.Ye(e,ze.objectType)}getNodeCount(){return this.pe.length}getNodeAt(e){return this.pe[e]}getNodes(){return this.pe}getNode(e){return this.pe.find(t=>t.id===e)}getGroupAt(e){return this.te[e]}getGroups(){return this.te}getGroup(e){return this.te.find(t=>t.id===e)}getGroupCount(){return this.te.length}getAll(){let e=[];return Array.prototype.push.apply(e,this.pe),Array.prototype.push.apply(e,this.ne),Array.prototype.push.apply(e,this.te),e}getAllEdgesFor(e,t){return this.zE(e.getAllEdges(t))}getEdgeCount(){return this.ne.length}getAllEdges(){return this.getEdges()}getEdgeAt(e){return this.ne[e]}getEdges(){return this.ne}getGroupType(e){return this.instance.getGroupType(e)}getNodeType(e){return this.instance.getNodeType(e)}getModel(){return this.instance.getModel()}getGraph(){return this.instance.getGraph()}getNodeId(e){return this.instance.getNodeId(e)}getGroupId(e){return this.instance.getGroupId(e)}getPortType(e){return this.instance.getPortType(e)}addPort(e,t){return this.instance.addPort(e,t)}getPortId(e){return this.instance.getPortId(e)}getEdge(e){return this.instance.getEdge(e)}getEdgeType(e){return this.instance.getEdgeType(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}containsVertex(e){return this.getVertex(e)!=null}getObjectInfo(e){return this.instance.getObjectInfo(e)}beforeConnect(e,t,n,o){return this.instance.beforeConnect(e,t,n,o)}beforeMoveConnection(e,t,n){return this.instance.beforeMoveConnection(e,t,n)}beforeStartConnect(e,t){return this.instance.beforeStartConnect(e,t)}beforeDetach(e,t,n){return this.instance.beforeDetach(e,t,n)}beforeStartDetach(e,t){return this.instance.beforeStartDetach(e,t)}get debugEnabled(){return this.instance.debugEnabled}YE(e){return new Vo(this.instance,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1;for(let h in e){let d=e[h]===a[h];if(!d&&!t)return!1;l=l||d}return l},o=this.YE();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getAncestors(e){return this.instance.getAncestors(e).filter(t=>this.containsVertex(t.id))}getDescendants(e){return this.instance.getDescendants(e)}getType(e){return this.instance.getType(e)}isAncestor(e,t){return this.instance.isAncestor(e,t)}isDescendantGroup(e,t){return this.instance.isDescendantGroup(e,t)}resolveFullId(e){return this.instance.resolveFullId(e)}};c(Vo,"DISCARD_EXISTING","discardExisting"),c(Vo,"DISCARD_NEW","discardNew");var pr=Vo;var hi=class{constructor(r,e,t){this.obj=r;this.instance=e;this.manager=t;c(this,"edgeId");c(this,"source");c(this,"target");c(this,"za");c(this,"Ya");c(this,"Oi");c(this,"Pd");c(this,"Od");c(this,"_d");c(this,"Rd");this.source=r.source.getFullId(),this.target=r.target.getFullId(),H(r.source)&&(this.za=r.source.id,this.source=r.source.getParent().getFullId()),H(r.target)&&(this.Ya=r.target.id,this.target=r.target.getParent().getFullId()),this.edgeId=r.getId(),this.Oi=r.geometry,r.source.dummy&&(this.Pd=!0,this._d={x:r.source.data[e.modelLeftAttribute],y:r.source.data[e.modelTopAttribute]}),r.target.dummy&&(this.Od=!0,this.Rd={x:r.target.data[e.modelLeftAttribute],y:r.target.data[e.modelTopAttribute]})}generateSourceIdentifier(){return this.Pd?this._d:this.za==null?this.source:this.source+this.instance.getGraph().getPortSeparator()+this.za}generateTargetIdentifier(){return this.Od?this.Rd:this.Ya==null?this.target:this.target+this.instance.getGraph().getPortSeparator()+this.Ya}et(){let r={source:this.generateSourceIdentifier(),target:this.generateTargetIdentifier(),data:this.obj.data,geometry:this.Oi},e=this.instance.$_addEdge(r,lA,null);this.manager.edgeChange(this.edgeId,e)}rt(){this.instance.removeEdge(this.obj)}edgeChange(r){this.obj=r,this.edgeId=this.obj.getId()}},zd=class extends hi{constructor(){super(...arguments);c(this,"type","addEdge")}undo(){this.rt()}redo(){this.et()}hasDeltas(){return this.obj!=null}},Xd=class extends hi{constructor(){super(...arguments);c(this,"type","removeEdge")}undo(){this.et()}redo(){this.rt()}hasDeltas(){return this.obj!=null}},Yd=class extends hi{constructor(e,t,n,o,s){super(n,e,t);this.oldVertex=o;this.newVertex=s}verticesAreTheSame(){return Ni(this.newVertex)&&Ni(this.oldVertex)&&this.newVertex.id===this.oldVertex.id}pointsAreTheSame(){return!Ni(this.newVertex)&&!Ni(this.oldVertex)&&eA(this.newVertex,this.oldVertex)}hasDeltas(){return this.obj!=null&&!this.verticesAreTheSame()&&!this.pointsAreTheSame()}},jd=class extends Yd{constructor(){super(...arguments);c(this,"type","edgeSourceChanged")}undo(){this.instance.setSource(this.obj,this.oldVertex)}redo(){this.instance.setSource(this.obj,this.newVertex)}},Hd=class extends Yd{constructor(){super(...arguments);c(this,"type","edgeTargetChanged")}undo(){this.instance.setTarget(this.obj,this.oldVertex)}redo(){this.instance.setTarget(this.obj,this.newVertex)}};var Go=class i{constructor(r){this.actions=r;c(this,"id");c(this,"type","compound");this.actions==null&&(this.actions=[]),this.id=$()}$mergeInto(r){this.actions.reverse().forEach(e=>r.addAction(e,!0))}addAction(r,e){e?this.actions.unshift(r):this.actions.push(r)}undo(){this.actions.slice().reverse().forEach(r=>r.undo())}redo(){this.actions.forEach(r=>r.redo())}edgeChange(r,e){this.actions.forEach(t=>{t instanceof hi&&t.edgeId===r&&t.edgeChange(e)})}hasDeltas(){for(let r=0;r<this.actions.length;r++)if(this.actions[r].hasDeltas())return!0;return!1}compress(){let r=new i,e={},t={},n={};for(let o=0;o<this.actions.length;o++){let s=this.actions[o];hS(s)?e[s.obj.id]!=null?Object.assign(e[s.obj.id].$nd,s.$nd):(e[s.obj.id]=s,r.addAction(s)):cS(s)?t[s.obj.id]!=null?Object.assign(t[s.obj.id].pos,s.pos):(t[s.obj.id]=s,r.addAction(s)):dS(s)?n[s.group.id]!=null?Object.assign(n[s.group.id].newGroupSize,s.newGroupSize):(n[s.group.id]=s,r.addAction(s)):r.addAction(s)}return r}};var Js=class{constructor(r,e,t,n){this.obj=r;this.originalPosition=e;this.pos=t;this.renderer=n;c(this,"type","moveAction")}redo(){this.renderer.setPosition(this.obj,this.pos.x,this.pos.y)}undo(){this.renderer.setPosition(this.obj,this.originalPosition.x,this.originalPosition.y)}hasDeltas(){return this.pos.x!==this.originalPosition.x||this.pos.y!==this.originalPosition.y}};var kd=class{constructor(r,e){this.obj=r;this.instance=e}$add(){this.obj.objectType===ce.objectType?this.obj=this.instance.addNode(this.obj.data):this.obj.objectType===se.objectType&&(this.obj=this.instance.addGroup(this.obj.data))}Ld(){this.instance.remove(this.obj)}getTerminusId(){return this.obj.getFullId()}hasDeltas(){return this.obj!=null}},$l=class extends kd{constructor(){super(...arguments);c(this,"type","terminusAdd")}undo(){this.Ld()}redo(){this.$add()}},Gl=class extends kd{constructor(){super(...arguments);c(this,"type","terminusRemove")}undo(){this.$add()}redo(){this.Ld()}isConnectedTo(e){let t=this.getTerminusId();return e.source===t||e.target===t}},Wd=class extends Gl{constructor(e,t){super(e.group,t);c(this,"type","groupRemove");c(this,"childrenRemoved");c(this,"orphanedChildren");this.childrenRemoved=e.removeChildren,this.orphanedChildren=e.children.slice()}$add(){super.$add(),this.childrenRemoved||this.orphanedChildren.forEach(e=>this.instance.$addToGroup(e,this.obj,null,null,null,null))}},Bl=class{constructor(r,e,t,n,o){this.group=r;this.originalGroupSize=e;this.newGroupSize=t;this.instance=n;this.source=o;c(this,"type","groupSizeChanged")}hasDeltas(){return Math.round(this.originalGroupSize.width)!==Math.round(this.newGroupSize.width)||Math.round(this.originalGroupSize.height)!==Math.round(this.newGroupSize.height)}redo(){this.Yr(Gd,this.newGroupSize,this.originalGroupSize)}undo(){this.Yr($d,this.originalGroupSize,this.newGroupSize)}Yr(r,e,t){this.instance.fire(r,{group:this.group,source:this.source,sizeAfterUndo:e,sizeBeforeUndo:t})}};function Ks(i,r,e){let t;i=i||{},r=r||{};let n=i,o=r;if(e)for(t=0;t<e.length;t++)n[e[t]]=o[e[t]];else for(t in o)n[t]=o[t];return i}function _5(i,r){i=i.length==null||typeof i=="string"?[i]:i;for(let e=0;e<i.length;e++)r(i[e])}function Zd(i,r,e){return function(){let t=null;try{r!=null&&(t=r.apply(this,arguments))}catch(n){U("VisuallyJs: function failed : "+n)}if(i!=null&&(e==null||t!==e))try{t=i.apply(this,arguments)}catch(n){U("VisuallyJs: wrapped function failed : "+n)}return t}}var Bi=class{constructor(r,e,t,n,o,s,a){this.obj=r;this.instance=t;this.typeChanged=o;this.newType=s;this.previousType=a;c(this,"type","update");c(this,"$nd");c(this,"$od");c(this,"reason");this.$nd=Ks({},r.data),this.$od=Ks({},e),this.reason=n}wd(r){this.obj.objectType===ce.objectType?this.instance.$_updateNode(this.obj,r,this.reason,!0):this.obj.objectType===se.objectType?this.instance.$_updateGroup(this.obj,r,this.reason,!0):this.obj.objectType===de.objectType?this.instance.$_updatePort(this.obj,r,this.reason,!0):this.obj.objectType===ze.objectType&&this.instance.$_updateEdge(this.obj,r,this.reason,!0)}undo(){this.wd(this.$od),this.typeChanged&&this.instance.setType(this.obj,this.previousType)}redo(){this.wd(this.$nd),this.typeChanged&&this.instance.setType(this.obj,this.newType)}hasDeltas(){return!Tl(this.$nd,this.$od)||this.typeChanged&&this.newType!==this.previousType}};var Jd=class{constructor(r,e,t){this.obj=r;this.Rn=e;this.instance=t}et(){this.instance.addPort(this.Rn,this.obj.data)}rt(){this.instance.removePort(this.Rn,this.obj.id)}getTerminusId(){return this.obj.getFullId()}},Kd=class extends Jd{constructor(){super(...arguments);c(this,"type","portAdd")}undo(){this.rt()}redo(){this.et()}hasDeltas(){return this.obj!=null}},qd=class extends Jd{constructor(){super(...arguments);c(this,"type","portRemove")}undo(){this.et()}redo(){this.rt()}isConnectedTo(e){let t=this.getTerminusId();return e.generateSourceIdentifier()===t||e.generateTargetIdentifier()===t}hasDeltas(){return this.obj!=null}};var Qd=class{constructor(r,e,t){this.node=r;this.group=e;this.instance=t}hasDeltas(){return this.node!=null}},eu=class extends Qd{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.sourceGroup=n;this.ja=o;this.Xa=s;this.instance=a;this.renderer=l;c(this,"type","addGroupMember")}redo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Xa!=null&&this.renderer.setPosition(this.node.id,this.Xa.x,this.Xa.y)}undo(){this.sourceGroup?this.instance.addToGroup(this.node,this.sourceGroup):this.instance.removeFromGroup(this.node),this.renderer!=null&&this.ja!=null&&this.renderer.setPosition(this.node.id,this.ja.x,this.ja.y)}},tu=class extends Qd{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.targetGroup=n;this.Ha=o;this.ka=s;this.instance=a;this.renderer=l;c(this,"type","removeGroupMember")}redo(){this.instance.removeFromGroup(this.node),this.renderer!=null&&this.ka!=null&&this.renderer.setPosition(this.node.id,this.ka.x,this.ka.y)}undo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Ha!=null&&this.renderer.setPosition(this.node.id,this.Ha.x,this.Ha.y)}},ru=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupCollapse")}redo(){this.renderer.collapseGroup(this.group)}undo(){this.renderer.expandGroup(this.group)}hasDeltas(){return this.group!=null}},nu=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupExpand")}redo(){this.renderer.expandGroup(this.group)}undo(){this.renderer.collapseGroup(this.group)}hasDeltas(){return this.group!=null}};var Fl=class{constructor(r,e,t){this.Wa=r;this.vertex=e;this.pos=t;c(this,"type","rendererVertexRemovedAction")}redo(){}undo(){this.Wa.setPosition(this.vertex,this.pos.x,this.pos.y)}hasDeltas(){return this.vertex!=null}};var uS="internal.connection",iu="internal.element:repainted",Ul="context:update",ou="group:collapse",su="group:expand",$r="zoom",au="render:start",Br="render:end",pS="adhocLayout",qs="afterLayoutRefresh",Yl="group:relayout",Fr="group:render",Qs="internal.vertex:updated",Ur="node:render",lu="node:visibility",hu="plugin:added",gS="plugin:removed",On="relayout",mS="objectRepainted",Xe="click",At="contextmenu",$o="dblclick",Yr="dbltap",ES="focus",ge="mousedown",UE="mouseenter",YE="mouseexit",ae="mousemove",fS="mouseleave",le="mouseup",ot="mouseout",st="mouseover",W="tap",yS="touchstart",xS="touchend",bS="touchmove",AS="vertex:click",SS="vertex:dblclick",TS="vertex:dbltap",vS="vertex:mouseout",CS="vertex:mouseover",PS="vertex:mousemove",v3="vertex:mouseup",C3="vertex:mousedown",_S="vertex:contextmenu",OS="vertex:tap",RS="edge:click",LS="edge:dblclick",wS="edge:dbltap",cu="edge:mouseout",du="edge:mouseover",DS="edge:mouseup",zl="edge:mousedown",NS="edge:contextmenu",IS="edge:tap",Rn="canvasClick",MS="canvasDblClick",uu="edge:redraw",pu="start",gu="lasso:update",mu="lasso:end",Fi="pan",Ln="modeChanged",P3="allGroupsRelayout",VS="groupRelayoutAdhoc",_3="groupMemberRemoved",GS="newVertexAddedToGroup",$S="existingVertexAddedToGroup";var ea=class extends Bi{constructor(e,t,n,o,s,a,l){super(e,t,n,o,s,a,l);this.obj=e;this.instance=n;this.typeChanged=s;this.newType=a;this.previousType=l;c(this,"type","vertexUpdate");o===ta&&t[this.instance.modelRotationAttribute]==null&&(this.$od[this.instance.modelRotationAttribute]=0)}};var Bo=class{constructor(r,e,t,n){this.obj=r;this.previousType=e;this.newType=t;this.instance=n;c(this,"type","setTypeAction")}hasDeltas(){return this.previousType!==this.newType}redo(){this.instance.setType(this.obj,this.newType)}undo(){this.instance.setType(this.obj,this.previousType)}};var zE=class{constructor(r,e,t,n,o){this.T=r;this.XE=e;this.Nd=t;this.Oi=n;this.Wa=o;c(this,"type","edgePath")}Dd(r){this.T.setEdgeGeometry(this.XE,r,null,this.Wa)}undo(){this.Dd(this.Nd)}redo(){this.Dd(this.Oi)}hasDeltas(){return!Tl(this.Nd,this.Oi)}},ew=50,XE="Cannot start a new transaction while one is active. Either commit/rollback the current transaction before creating a new one, or pass a cleanup flag in to this method",tw="Cannot rollback transaction from here; it has been appended to. Close all transaction appenders before attempting to rollback the transaction.",Eu=class{constructor(r){c(this,"T");c(this,"es");c(this,"Gt");c(this,"Za");c(this,"undoStack");c(this,"redoStack");c(this,"Ja",[]);c(this,"me");c(this,"ft",0);this.T=r.instance,this.Gt=!1,this.undoStack=[],this.redoStack=[],this.es=r.maximumSize||ew,this.Za=r.onChange,this.jE()}Id(r){this.Gt=r}dataLoadStart(){this.clear(),this.Id(!0)}dataAppendStart(){this.dataLoadStart()}dataLoadEnd(){this.Id(!1)}dataAppendEnd(){this.dataLoadEnd()}jE(){this.T.bind(Jt,()=>{this.clear()}),this.T.bind(Kt,r=>{this.command(new $l(r.node,this.T))}),this.T.bind(Ce,r=>{this.command(new Gl(r.node,this.T))}),this.T.bind(Le,r=>{Sl(r.updates)||this.command(new ea(r.vertex,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(Zt,r=>{this.command(new $l(r.group,this.T))}),this.T.bind(Re,r=>{this.command(new Wd(r,this.T))}),this.T.bind(ve,r=>{Sl(r.updates)||this.command(new ea(r.vertex,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(Vd,r=>{let e=new Bl(r.group,r.originalGroupSize,r.newGroupSize,this.T,r.source);e.hasDeltas()&&this.command(e)}),this.T.bind(ur,r=>{this.command(new zd(r.edge,this.T,this))}),this.T.bind(bt,r=>{this.command(new Xd(r.edge,this.T,this))}),this.T.bind(xt,r=>{Sl(r.updates)||this.command(new Bi(r.edge,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(ln,r=>{this.command(new jd(this.T,this,r.edge,r.old,r.new))}),this.T.bind(an,r=>{this.command(new Hd(this.T,this,r.edge,r.old,r.new))}),this.T.bind(li,r=>{this.command(new zE(this.T,r.edge,r.originalGeometry,r.geometry,r.ui))}),this.T.bind(si,r=>{this.command(new Kd(r.port,r.vertex,this.T))}),this.T.bind(Vr,r=>{this.command(new qd(r.port,r.vertex,this.T))}),this.T.bind(dr,r=>{Sl(r.updates)||this.command(new Bi(r.port,r.originalData,this.T,null,!1,null,null))}),this.T.bind(Gi,r=>{r.vertexIsNew!==!0&&this.command(new eu(r.vertex,r.group,r.sourceGroup,r.originalPosition,r.pos,this.T,r.source))}),this.T.bind(ks,r=>{this.command(new tu(r.vertex,r.group,r.targetGroup,r.originalPosition,r.newPosition,this.T,r.source))}),this.T.bind(Nd,r=>{r.isPartOfUpdate||this.command(new Bo(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Id,r=>{r.isPartOfUpdate||this.command(new Bo(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Md,r=>{r.isPartOfUpdate||this.command(new Bo(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Dd,r=>{r.isPartOfUpdate||this.command(new Bo(r.obj,r.previousType,r.newType,this.T))}),this.T.bind("renderer:added",r=>{r.renderer.bind(Vt,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Js(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(Gr,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Js(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(ou,e=>{this.command(new ru(e.group,r.renderer))}),r.renderer.bind(su,e=>{this.command(new nu(e.group,r.renderer))}),r.renderer.bind(Ce,e=>{this.command(new Fl(r.renderer,e.vertex,e.pos))}),r.renderer.bind(Re,e=>{this.command(new Fl(r.renderer,e.vertex,e.pos))})})}_i(){this.Za&&this.Za(this,this.undoStack.length,this.redoStack.length)}command(r,e){if(!this.Gt){if(!r.hasDeltas())return;iw(r)&&(r=r.compress()),this.me!=null?this.me.addAction(r,e):(this.undoStack.push(r),this.undoStack.length>this.es&&this.undoStack.splice(this.undoStack.length-this.es-1,this.undoStack.length-this.es),this.redoStack.length=0,this._i())}}edgeChange(r,e){let t=n=>{n.forEach(o=>{o instanceof hi&&o.edgeId===r?o.edgeChange(e):o instanceof Go&&o.edgeChange(r,e)})};t(this.undoStack),t(this.redoStack)}undo(){let r=this.undoStack.pop();r&&(this.Gt=!0,this.redoStack.push(r),r.undo(),this.Gt=!1,this._i())}redo(){let r=this.redoStack.pop();r&&(this.Gt=!0,this.undoStack.push(r),r.redo(),this.Gt=!1,this._i())}clear(){this.undoStack.length=0,this.redoStack.length=0,this.me=null,this.ft=0,this.Gt=!1,this._i()}transaction(r,e,t){if(this.me!=null&&e==null)return U(XE),!1;if(this.openTransaction(e)==null){if(t)return r()}else try{if(r()!==!1){let a=this.me;return this.ft===0?(this.me=null,this.command(a)):this.ft--,a.id}else return this.rollbackTransaction(),!1}catch(s){return U("Exception thrown in transaction "+s.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}mergeTransaction(r){if(this.me!=null)return this.transaction(r,ut);try{let e=this.transaction(r);if(e!==!1){if(this.undoStack.length>1){let t=this.undoStack.pop(),n=this.undoStack.pop();this.kE(t,n),this.undoStack.push(t)}return e}else return this.rollbackTransaction(),!1}catch(e){return U("Exception thrown in transaction "+e.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}kE(r,e){e instanceof Go?e.$mergeInto(r):r.addAction(e,!0)}HE(){return this.me=new Go,this.ft=0,this.me.id}openTransaction(r){if(!this.Gt){let e=!0;if(this.me!=null)if(r!=null)if(r===rw)this.commitTransaction();else if(r===nw)this.rollbackTransaction();else if(r===ut)e=!1,this.ft++;else throw new Error(XE);else throw new Error(XE);return e&&this.HE(),this.me.id}return null}rollbackTransaction(){this.me!=null&&(this.ft>0?(this.ft--,U(tw)):(this.me.undo(),this.me=null,this._i(),this.Ja.length=0))}commitTransaction(r){if(this.me!=null)if(r!==!0&&this.ft>0)this.ft--;else{let e=this.me;this.me=null,this.command(e),this.ft=0,this.WE()}}WE(){this.me==null&&(this.Ja.forEach(r=>{try{r()}catch(e){}}),this.Ja.length=0)}},rw="commitCurrent",nw="rollbackCurrent",ut="appendToCurrent";function iw(i){return i instanceof Go}function hS(i){return i instanceof Bi||i instanceof ea}function cS(i){return i instanceof Js}function dS(i){return i instanceof Bl}var fu="1.2.3";var jE="type",HE="default",ow="group",YS="groupResized",sw="addPort",aw="addNewPort",lw="removePort",yu="updatePort",ra="moved",h6="layout",kE="updateVertex",BS="updateNode",FS="updateGroup",zS="magnetizer",bu="setPosition",XS="snapToGrid",c6="sizeGroupToFit",Xl="drawingToolsResize",ta="rotation",jS="resized",US="updated",xu=class extends zt{constructor(e){super();c(this,"graph");c(this,"autoSaver");c(this,"idFunction");c(this,"typeProperty");c(this,"edgeTypeProperty");c(this,"portTypeProperty");c(this,"groupProperty");c(this,"typeFunction");c(this,"edgeIdFunction");c(this,"edgeTypeFunction");c(this,"portIdFunction");c(this,"portTypeFunction");c(this,"portExtractor");c(this,"portUpdater");c(this,"portDataProperty");c(this,"portOrderProperty");c(this,"modelTopAttribute");c(this,"modelLeftAttribute");c(this,"modelWidthAttribute");c(this,"modelHeightAttribute");c(this,"modelRotationAttribute");c(this,"model");c(this,"Ka");c(this,"Vd");c(this,"debugEnabled");c(this,"defaultObjectFactory");c(this,"nodeFactory");c(this,"edgeFactory");c(this,"portFactory");c(this,"groupFactory");c(this,"undoRedo");c(this,"Md");c(this,"beforeConnect");c(this,"beforeMoveConnection");c(this,"beforeStartConnect");c(this,"beforeDetach");c(this,"beforeStartDetach");c(this,"Ee");c(this,"Xr",new Map);c(this,"Ri",{});c(this,"$transientVerticesByRenderer",{});e=e||{};let t=e.undoRedo||{};t.enabled!==!1&&(this.undoRedo=new Eu({instance:this,maximumSize:t.maximumSize,onChange:(o,s,a)=>{this.fire(Zs,{undoCount:s,redoCount:a})}})),this.idFunction=e.idFunction||TE,this.typeProperty=e.typeProperty||jE,this.edgeTypeProperty=e.edgeTypeProperty||jE,this.portTypeProperty=e.portTypeProperty||jE,this.groupProperty=e.groupProperty||ow,this.typeFunction=e.typeFunction||(o=>o[this.typeProperty]||HE),this.edgeIdFunction=e.edgeIdFunction||this.idFunction,this.edgeTypeFunction=e.edgeTypeFunction||(o=>o[this.edgeTypeProperty]||HE),this.portIdFunction=e.portIdFunction||this.idFunction,this.portTypeFunction=e.portTypeFunction||(o=>o[this.portTypeProperty]||HE),this.portExtractor=e.portExtractor,this.portUpdater=e.portUpdater,this.portDataProperty=e.portDataProperty,this.portOrderProperty=e.portOrderProperty,this.debugEnabled=!1,this.model=new td(this,e.model),this.defaultObjectFactory=(o,s,a,l)=>(a=a==null||!cr(a)?{}:a,a=lt(a),a.id=a.id||$(),a.type=a.type||(s==null?null:s.type||s),l(a),!0),this.modelLeftAttribute=e.modelLeftAttribute||CA,this.modelTopAttribute=e.modelTopAttribute||PA,this.modelWidthAttribute=e.modelWidthAttribute||OA,this.modelHeightAttribute=e.modelHeightAttribute||RA,this.modelRotationAttribute=e.modelRotationAttribute||_A,this.Ri=Object.assign({},e.groupTemplates||{}),this.nodeFactory=e.nodeFactory||this.defaultObjectFactory,this.edgeFactory=e.edgeFactory||this.defaultObjectFactory,this.portFactory=e.portFactory||this.defaultObjectFactory,this.groupFactory=e.groupFactory||this.defaultObjectFactory,this.Vd=e.autoSave&&e.autoSave.enabled!==!1,this.Md={portSeparator:e.portSeparator,defaultCost:e.defaultCost,defaultDirected:e.defaultDirected,enableSubgraphs:e.enableSubgraphs},this.portDataProperty!=null&&this.portExtractor==null&&(this.portExtractor=o=>{let s=o[this.portDataProperty]||[];return this.portOrderProperty!=null&&s.sort((a,l)=>{let h=a[this.portOrderProperty],d=l[this.portOrderProperty],u=h==null?1/0:h,p=d==null?1/0:d;return u-p}),s}),this.portDataProperty!=null&&this.portUpdater==null&&(this.portUpdater=(o,s,a)=>{let l={};return this.portOrderProperty!=null&&a.sort((h,d)=>{let u=h.data[this.portOrderProperty],p=d.data[this.portOrderProperty],g=u==null?1/0:u,m=p==null?1/0:p;return g-m}),l[this.portDataProperty]=a.map(h=>h.data),Object.assign(o,l)}),this.graph=new Pl(this.Md),this.Vd&&(this.autoSaver=new Vl(this,e.autoSave)),new Fd(this);let n=(o,s)=>{if(this.model==null)return!0;let a=this.getType(o),l=this.getType(s),h=H(o)?o.getParent():o,d=H(s)?s.getParent():s,u=H(o)?this.model.getPortDefinition(a):K(o)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),p=H(s)?this.model.getPortDefinition(l):K(s)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l),g=K(h)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),m=K(d)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l);return u.maxConnections!=null&&o.getEdges().length>=u.maxConnections||p.maxConnections!=null&&s.getEdges().length>=p.maxConnections?!1:o===s?!(g.allowLoopback===!1||u.allowLoopback===!1||p.allowLoopback===!1||m.allowLoopback===!1):h===d?!(g.allowVertexLoopback===!1||u.allowVertexLoopback===!1||p.allowVertexLoopback===!1||m.allowVertexLoopback===!1):!0};if(this.beforeConnect=e.beforeConnect||n,this.beforeMoveConnection=e.beforeMoveConnection||n,this.beforeStartConnect=e.beforeStartConnect||((o,s)=>({})),this.beforeDetach=e.beforeDetach||((o,s,a)=>!0),this.beforeStartDetach=e.beforeStartDetach||((o,s)=>!0),this.Ee=this.ts(o=>{this.N(s=>s.$selectionCleared(o)),this.fire(ir,{selection:o})}),e.selectionMode&&this.Ee.setMode(e.selectionMode),e.maxSelectedNodes&&this.Ee.setMaxNodes(e.maxSelectedNodes),e.maxSelectedGroups&&this.Ee.setMaxGroups(e.maxSelectedGroups),e.maxSelectedEdges&&this.Ee.setMaxEdges(e.maxSelectedEdges),e.selectionCapacityPolicy&&this.Ee.setCapacityPolicy(e.selectionCapacityPolicy),e.events)for(let o in e.events)this.bind(o,e.events[o]);e.data!=null&&this.load({data:e.data})}get portSeparator(){return this.graph.portSeparator}ZE(e,t,n){return{id:`${e}_${n}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y}}rs(e,t,n,o){if(j(e))return[this.graph.getVertex(e,!0),!1];if(K(e)||Y(e)||H(e))return[e,!1];{let s=e,a=s.x==null?0:s.x,l=s.y==null?0:s.y;return[this.Gd(this.ZE(t,{x:a,y:l},n),o),!0]}}ts(e){return new pr(this,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1,h=e;for(let d in h){let u=h[d]===a[d];if(!u&&!t)return!1;l=l||u}return l},o=this.ts();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getModel(){return this.model}setAutoSave(e){this.autoSaver!=null&&this.autoSaver.discard(),this.autoSaver=new Vl(this,e)}connect(e){let t,n=this.graph.getVertex(e.source),o=this.graph.getVertex(e.target),s=e.cost,a=e.directed;if(!n)if(!e.doNotCreateMissingNodes)n=this.graph.addNode(e.source),this.qa(n);else return;if(!o)if(!e.doNotCreateMissingNodes)o=this.graph.addNode(e.target),this.qa(o);else return;let l=e.data||{},h=this.beforeStartConnect(n,this.edgeTypeFunction(l));return h&&(typeof h=="object"&&(l=Object.assign(h,l)),this.beforeConnect(n,o,l,!1)!==!1&&(t=this.$_addEdge({source:n,target:o,cost:s,directed:a,data:l,geometry:e.geometry},Ol,null))),t}clear(){return this.N(e=>e.$graphClearStart()),this.fire(_n),this.graph.clear(),this.$transientVerticesByRenderer={},this.N(e=>e.$graphClearEnd()),this.fire(Jt,this),this}destroy(){this.clear(),delete this.Xr,delete this.$transientVerticesByRenderer}getGraph(){return this.graph}getNodeCount(){return this.graph.getVertexCount()}getNodeAt(e){return this.graph.getVertexAt(e)}getNodes(){return this.graph.getVertices()}eachNode(e){let t;for(let n=0,o=this.graph.getVertexCount();n<o;n++)t=this.graph.getVertexAt(n),e(n,t)}eachGroup(e){let t;for(let n=0,o=this.graph.getGroupCount();n<o;n++)t=this.graph.getGroupAt(n),e(n,t)}eachVertex(e){this.eachNode(e),this.eachGroup(e)}eachEdge(e){let t=this.graph.getEdges();for(let n=0,o=t.length;n<o;n++)e(n,t[n])}getEdgeCount(){return this.graph.getEdgeCount()}getGroupCount(){return this.graph.getGroupCount()}getGroupAt(e){return this.graph.getGroupAt(e)}getGroups(){return this.graph.getGroups()}addGroupTemplate(e,t){this.Ri[e]=t}getDescendants(e){return Bs(e)}getAncestors(e){return Tn(e)}isAncestor(e,t){return We(e,t)}isDescendantGroup(e,t){return sA(e,t)}getClusters(){return this.graph.getClusters()}getCluster(e){let t=j(e)?this.getVertex(e):e;return this.graph.getCluster(t)}getNodeId(e){return typeof e=="string"?e:this.idFunction(e)}getNodeType(e){return this.typeFunction(e)||"default"}getGroupId(e){return typeof e=="string"?e:this.idFunction(e)}getGroupType(e){return this.typeFunction(e)||"default"}getEdgeType(e){return this.edgeTypeFunction(e)||"default"}getPortId(e){return this.portIdFunction(e)}getPortType(e){return this.portTypeFunction(e)||"default"}getType(e){return(K(e)?this.typeFunction:H(e)?this.portTypeFunction:this.edgeTypeFunction)(e.data)||"default"}setType(e,t){let n=this.getType(e);if(n===t)return;let o=e.objectType===ce.objectType?this.typeProperty:e.objectType===de.objectType?this.portTypeProperty:this.edgeTypeProperty;e.data[o]=t,e.type=t,this.$dispatchTypeChange(e,n,t,!1)}$dispatchTypeChange(e,t,n,o){let s,a;K(e)?(s=Nd,a=()=>this.N(l=>l.$nodeTypeChanged(e,t,n))):H(e)?(s=Id,a=()=>this.N(l=>l.$portTypeChanged(e,t,n))):rt(e)?(s=Dd,a=()=>this.N(l=>l.$edgeTypeChanged(e,t,n))):Y(e)&&(s=Md,a=()=>this.N(l=>l.$groupTypeChanged(e,t,n))),s!=null&&(this.fire(s,{obj:e,previousType:t,newType:n,isPartOfUpdate:o}),a())}resolveFullId(e){if(rt(e))return e.id;if(K(e))return e.id;if(Y(e))return e.id;if(H(e))return e.parent.id+this.graph.portSeparator+e.id}resolveNode(e){return H(e)?e.parent:e}addNode(e,t){let n=this.idFunction(e),o=null;n==null&&typeof e!="string"&&(e.id=$());let s=this.graph.addNode(e,this.idFunction);if(s!=null){if(this.portExtractor!=null){let a=this.portExtractor(s.data,s);if(a!=null)for(let l=0;l<a.length;l++)s.$addPort(a[l],this.portIdFunction)}if(typeof e!="string"&&e[this.groupProperty]!=null)if(o=this.getGroup(e[this.groupProperty]),o!=null)this.graph.$addMemberToGroup(s,o);else throw new Error("parent group ["+e[this.groupProperty]+"] not found");return this.qa(s,o),o!=null&&this.fire(Gi,{group:o,vertex:s,vertexIsNew:!0}),s}else return this.graph.getVertex(n)}qa(e,t){let n={node:e,parentGroup:t};this.N(o=>o.$nodeAdded(n)),this.fire(Kt,n)}JE(e,t){let n={group:e,parentGroup:t};this.N(o=>o.$groupAdded(n)),this.fire(Zt,n)}addFactoryNode(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t={}),t.type=t.type||e;try{this.nodeFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addNode(a);try{n&&n(l)}catch(h){U("WARN: Factory node callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: Factory node threw an error",a),s!==!1&&this.rollbackTransaction()}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t]);return this}$d(e){return $s(this.$transientVerticesByRenderer,e.id,()=>({}))}$addTransientVertex(e,t){let n=this.graph.addNode(e);if(n.transient=!0,t!=null){let o=this.$d(t);o[n.id]=n,n.transientRenderer=t.id}return n}Gd(e,t){let n=this.$addTransientVertex(e,t);return n.dummy=!0,this.N(o=>{o.$renderDummyVertex(n)}),n}is(e){this.graph.deleteNode(e),this.N(t=>{t.$nodeRemoved({vertex:e,node:e,edges:[],parentGroupIsBeingRemoved:!1})})}$setEdgeDetached(e,t,n){let o=this.Gd({id:`${e.id}_${n===it?"0":"1"}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y});n===it?this.setSource(e,o):this.setTarget(e,o)}$cleanupTransientVertex(e,t){let n=e.getAllEdges()||[];this.graph.deleteNode(e);for(let o=0;o<n.length;o++)this.graph.deleteEdge(n[o]),t.$edgeRemoved({edge:n[o],source:t});if(t.$nodeRemoved({vertex:e,node:e,edges:n,parentGroupIsBeingRemoved:!1}),t!=null){let o=this.$d(t);o&&delete o[e.id]}}$addTransientEdge(e,t,n,o,s,a){let l={source:t,target:n,data:o||{},geometry:s,transient:!0},h=this.graph.addEdge(l);return e.$edgeAdded({edge:h,source:e,geometry:h.geometry,transient:!0,reason:hA},a),h}addFactoryGroup(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t==null&&n==null&&(t={})),t.type=t.type||e;try{this.groupFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addGroup(a);try{n&&n(l)}catch(h){U("WARN: Factory group callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: group factory threw an error",a),s!==!1&&this.rollbackTransaction()}}addFactoryGroupWithTemplate(e,t,n,o,s,a){o==null&&(n!=null?(n=typeof n=="object"?n:{},o=typeof n=="function"?n:null):n==null&&o==null&&(n={})),n.type=n.type||e;try{this.groupFactory(this,e,n,l=>{a!==!1&&this.openTransaction(ut);let h=this.Ri[t]!=null?this.addGroupWithTemplate(l,t):this.addGroup(l);try{o&&o(h)}catch(d){U("WARN: Factory group callback threw an error",d)}a!==!1&&this.commitTransaction()},()=>{s&&s(),a!==!1&&this.rollbackTransaction()})}catch(l){U("WARN: group factory threw an error",l),a!==!1&&this.rollbackTransaction()}}addGroup(e,t){let n,o;if(this.idFunction(e)==null&&typeof e!="string"&&(e.id=$()),o=this.graph.addGroup(e,this.idFunction),o!=null){if(typeof e!="string"&&e[this.groupProperty]!=null){if(n=this.getGroup(e[this.groupProperty]),n==null)throw new Error("Cannot find parent group ["+e[this.groupProperty]+"]");this.graph.$addMemberToGroup(o,n)}this.JE(o,n),n!=null&&this.fire(Gi,{group:n,vertex:o,vertexIsNew:!0})}return o}addToGroup(e,t,n){return this.$addToGroup(e,t,null,null,n,null)}addGroupWithTemplate(e,t){let n;return this.transaction(()=>{let o;if(typeof t=="string"){let l=this.Ri[t];if(l==null)return U("No group template found with name ["+t+"]"),null;try{o=l}catch(h){return U("Error parsing group template ["+t+"]: "+h.message),null}}else o=t;n=this.addGroup(e);let s=new Map,a=(l,h)=>{(l.nodes||[]).forEach(d=>{let u=d.id,p=Object.assign({},d,{id:$(),group:h.id}),g=this.addNode(p);s.set(u,g.id)}),(l.groups||[]).forEach(d=>{let u=d.id,p=d.groupTemplate,g=Object.assign({},d,{id:$(),group:h.id});p&&typeof p!="string"&&delete g.groupTemplate;let m=this.addGroup(g);if(s.set(u,m.id),p)if(typeof p=="string"){let E=this.Ri[p];if(E)try{a(E,m)}catch(y){U("Error parsing nested group template ["+p+"]: "+y.message)}else U("No group template found for nested group with name ["+p+"]")}else a(p,m)}),(l.edges||[]).forEach(d=>{let u=d.source.split(this.portSeparator),p=d.target.split(this.portSeparator),g=s.get(u[0])||u[0],m=s.get(p[0])||p[0],E=u[1]==null?g:[g,u[1]].join(this.portSeparator),y=p[1]==null?m:[m,p[1]].join(this.portSeparator);this.addEdge({source:E,target:y,data:d.data||{}})})};return a(o,n),n},ut),n}$addToGroup(e,t,n,o,s,a){let l=!1,h=this.getObjectInfo(t),d=this.getObjectInfo(e);if(n=n||d.obj.group,d.obj&&h.obj&&(l=h.obj.$addMember(d.obj),l)){n&&n.$removeMember(d.obj),d.obj.data[this.groupProperty]=h.obj.id;let u={vertex:d.obj,group:h.obj,pos:s,originalPosition:o,source:a,positionInGroup:s};n&&(u.sourceGroup=n),this.N(p=>{p.$groupMemberAdded(u)}),this.fire(Gi,u)}return l}removeFromGroup(e){return this.$removeFromGroup(e,null,null,null,null)}$removeFromGroup(e,t,n,o,s){let a=this.getObjectInfo(e),l;if(a.obj&&a.obj.group&&(l=a.obj.group,l.$removeMember(a.obj))){let h={vertex:a.obj,group:l,newPosition:o,originalPosition:n,source:s};t&&(h.targetGroup=t),this.N(d=>{d.$groupMemberRemoved(h)}),delete a.obj.data[this.groupProperty],this.fire(ks,h)}return l}Bd(e,t,n,o){e.nestedGroups.forEach(a=>this.Bd(a,t,!0,o)),e.nodes.forEach(a=>this.Fd(a,!0,o));for(let a=0;a<e.edges.length;a++)this.Qa(e.edges[a]);let s={vertex:e.group,edges:e.edges,group:e.group,removeChildren:t,children:e.children,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:n};this.N(a=>a.$groupRemoved(s)),o||this.fire(Re,s)}Fd(e,t,n){for(let s=0;s<e.edges.length;s++)this.Qa(e.edges[s]);let o={vertex:e.node,node:e.node,edges:e.edges,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:t};this.N(s=>s.$nodeRemoved(o)),n||this.fire(Ce,o)}removeGroup(e,t,n){let o=this.graph.getVertex(j(e)?e:e.id);if(o){this.openTransaction(ut);let s=this.graph.deleteGroup(o,t);return s.group&&(t||s.children.forEach(a=>delete a.data[this.groupProperty]),this.Bd(s,t===!0,!1,n)),this.commitTransaction(),!0}return!1}getNode(e){return this.graph.getVertex(e)}getEdge(e){return this.graph.getEdge(e)}getGroup(e){return this.graph.getGroup(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}getPort(e){let t=this.graph.getVertexByPortId(e);if(t)return t.getPort(this.graph.splitPortId(e)[1])}exists(...e){for(let t=0;t<e.length;t++)if(this.graph.getVertex(e[t])==null)return!1;return!0}removeNode(e){if(!j(e)&&e.transient===!0)return!1;let t=this.graph.getVertex(j(e)?e:e.id);if(t!=null){this.openTransaction(ut);let n=t.getAllEdges()||[];for(let s=0;s<n.length;s++)this.removeEdge(n[s]);let o=this.graph.deleteNode(t);return this.Fd(o,!1),this.commitTransaction(),!0}return!1}addEdge(e){return this.$_addEdge(e,Ol,null)}$_addEdge(e,t,n,o){let s=this.$_deriveEdgeId(e.data),[a,l]=this.rs(e.source,s,0,n),[h,d]=this.rs(e.target,s,1,n);if(a==null||a.objectType==null)throw new TypeError("Unknown source node ["+e.source+"]");if(h==null||h.objectType==null)throw new TypeError("Unknown target node ["+e.target+"]");if(!l&&a.dummy)return U(`Cannot add edge to dummy vertex ${a.id}`),null;if(!d&&h.dummy)return U(`Cannot add edge to dummy vertex ${h.id}`),null;let u=Object.assign(e,{source:a,target:h});if(this.beforeConnect(a,h,e.data,e.addedByMouse===!0)!==!1){let p=this.graph.addEdge(u,s,this.edgeIdFunction),g={edge:p,source:n,geometry:e.geometry,addedByMouse:e.addedByMouse,reason:t};return this.N(m=>m.$edgeAdded(g,e.context)),o||this.fire(ur,g,null),p}else return this.debugEnabled&&U("Could not add edge"),null}Qa(e,t){let n={edge:e,source:t};this.N((o,s)=>o.$edgeRemoved(n)),this.fire(bt,n,null)}removeEdge(e,t){let n=this.graph.getEdge(e);return n!=null&&(this.graph.deleteEdge(n),n.source.dummy&&K(n.source)&&this.is(n.source),n.target.dummy&&K(n.target)&&this.is(n.target),this.Qa(n,t)),this}setTarget(e,t){if(t==null)return{success:!1};let[n]=this.rs(t,e.id,1);if(n==null||this.beforeConnect(e.source,n,e.data)===!1)return{success:!1};let o=this.graph.setTarget(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.is(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeTargetChanged(l)}),this.fire(an,l)}return o}setSource(e,t){if(t==null)return{success:!1};let[n]=this.rs(t,e.id,0);if(n==null||this.beforeConnect(n,e.target,e.data)===!1)return{success:!1};let o=this.graph.setSource(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.is(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeSourceChanged(l)}),this.fire(ln,l)}return o}addNewPort(e,t,n){let o=this.graph.getVertex(e);this.portFactory(this,t,n,s=>{let a=this.portIdFunction(s),l=o.$addPort(a);l.data=s,this.os(o,aw);let h={vertex:o,data:s,port:l};this.N(d=>d.$portAdded(h)),this.fire(si,h,null)},()=>{})}addPort(e,t){let n=this.graph.getVertex(e),o=n.$addPort(t,this.portIdFunction);this.os(n,sw);let s={vertex:n,data:t,port:o};return this.N(a=>a.$portAdded(s)),this.fire(si,s,null),o}removePort(e,t){let n;if(typeof e=="string"){let o=this.graph.splitPortId(e);o.length===2?(n=this.graph.getVertex(o[0]),t=o[1]):n=this.graph.getVertex(e)}else H(e)?(t=e.id,n=e.getParent()):n=this.graph.getVertex(e);if(n!=null&&t!=null){let o=n.getPort(t);if(o){this.openTransaction(ut);let s=o.getAllEdges();for(let l=s.length,h=0;h<l;h++)this.removeEdge(s[0]);n.$removePort(o),this.os(n,lw);let a={vertex:n,port:o,edges:s};return this.N(l=>l.$portRemoved(a)),this.fire(Vr,a,null),this.commitTransaction(),!0}}return!1}remove(e,t){if(e==null)return;let n=this.getObjectInfo(e);this.setSuspendRendering(!0);try{if(n.obj&&K(n.obj))this.removeNode(n.obj);else if(n.obj&&Y(n.obj))this.removeGroup(n.obj);else if(n.obj&&rt(n.obj))this.removeEdge(n.obj);else if(n.obj&&H(n.obj))this.removePort(n.obj);else{if(e.getNodeCount!=null)for(;e.getNodeCount()>0;)this.removeNode(e.getNodeAt(0));if(e.getEdgeCount!=null)for(;e.getEdgeCount()>0;)this.removeEdge(e.getEdgeAt(0));if(e.getGroupCount!=null)for(;e.getGroupCount()>0;)this.removeGroup(e.getGroupAt(0),t!==!1)}}finally{this.setSuspendRendering(!1,!0)}}setSuspendRendering(e,t){for(let n in this.Xr)this.Xr.get(n).setSuspendRendering(e,t)}batch(e){this.setSuspendRendering(!0);try{e()}catch(t){U("Error in transaction "+t)}finally{this.setSuspendRendering(!1,!0)}}updateGroup(e,t){this.$_updateVertex(e,t,FS,!1)}$_updateGroup(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateNode(e,t){this.$_updateVertex(e,t,BS,!1)}$_updateNode(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateVertex(e,t){this.$_updateVertex(e,t,kE,!1)}$_updateVertex(e,t,n,o,s){let a=this.getObjectInfo(e);if(a.obj){let h=(H(a.obj)?a.obj.getParent():a.obj).objectType===ce.objectType?Le:ve;this.Ud(a.obj,t,o,h,(d,u)=>({vertex:d,updates:t||{},originalData:u,reason:n||kE,source:s}))}}updateVertices(e,t){this.KE(e,kE,!1,t)}KE(e,t,n,o){this.transaction(()=>{e.forEach(s=>{this.$_updateVertex(s.id,s.updates,t,n)})},o||ut)}updatePort(e,t){this.$_updatePort(e,t,yu,!1)}$_updatePort(e,t,n,o){let s=this.getObjectInfo(e);s.obj&&this.Ud(s.obj,t,o,dr,(a,l)=>({port:a,vertex:a.getParent(),updates:t||{},originalData:l,reason:n||yu}))}updateEdge(e,t){this.$_updateEdge(e,t,US,!1)}$_updateEdge(e,t,n,o){let s=typeof e=="string"?this.graph.getEdge(e):e;if(s!=null){let a=Object.assign({},s.data);if(t)if(o)s.data=Object.assign({},t);else for(let u in t)s.data[u]==null?s.data[u]=t[u]:bE(s.data,u,t[u]);let{changed:l,newType:h,previousType:d}=this.zd(a,s,!0);this.fire(xt,{edge:s,updates:t||{},originalData:a,reason:n,typeChanged:l,newType:h,previousType:d},null)}}update(e,t){this.An(e,t,null,!1)}An(e,t,n,o){if(K(e)){let s=n==null?BS:n;this.$_updateVertex(e,t,s,o)}else if(Y(e)){let s=n==null?FS:n;this.$_updateVertex(e,t,s,o)}else if(rt(e)){let s=n==null?US:n;this.$_updateEdge(e,t,s,o)}else if(H(e)){let s=n==null?yu:n;this.$_updatePort(e,t,s,o)}}setEdgeGeometry(e,t,n,o){n=lt(n||e.geometry),e.geometry=lt(t),this.fire(li,{edge:e,geometry:t,originalGeometry:n,ui:o}),this.N(s=>{s.$edgeGeometryUpdated(e,t,n)})}clearEdgeGeometry(e){this.setEdgeGeometry(e,null,null,null)}getPath(e){return new Ll(this,e)}findGraphObject(e){return e==null?null:e==="*"?this.graph:e.constructor===ce||e.constructor===de||e.constructor===se||e.constructor===ze?e:j(e)||cr(e)?this.graph.getVertex(e):null}ss(e,t,n,o){return t||n.clear(),n.append(e,s=>{let a={obj:s,selection:n};o&&(this.N(l=>{l.$select(a)}),this.fire(qt,a))})}qE(e,t,n){e=e||{};let o=[],s={},a=h=>{s[h.getId()]||(o.push(h),s[h.getId()]=!0)},l=(h,d,u,p)=>{if(h!=null){let g;rt(h)?g=[h]:g=t(h),e.filter&&(g=g.filter(e.filter));for(let m=0;m<g.length;m++){let E=d&&h===this.graph||g[m].source===h||n&&H(g[m].source)&&g[m].source.getParent()===h,y=u&&h===this.graph||g[m].target===h||n&&H(g[m].target)&&g[m].target.getParent()===h;(d&&E||u&&y||p&&(E||y))&&a(g[m])}}};return l(this.findGraphObject(e.source),!0,!1,!1),l(this.findGraphObject(e.target),!1,!0,!1),l(this.findGraphObject(e.element),!1,!1,!0),o}zd(e,t,n){let o=t.objectType===ze.objectType?this.edgeTypeProperty:t.objectType===de.objectType?this.portTypeProperty:this.typeProperty;if(t.data[o]!=null&&t.data[o]!==e[o]){let s=t.data[o],a=e[o];return t.type=s,this.$dispatchTypeChange(t,a,s,n),{changed:!0,newType:s,previousType:a}}return{changed:!1,newType:null,previousType:null}}Ud(e,t,n,o,s){if(e&&e.objectType){let a=Object.assign({},e.data),l=e.objectType===de.objectType?e.getFullId():e.id,h=e.objectType===de.objectType?this.portIdFunction(a):null,d;if(t){if(n)e.data=Object.assign({},t);else for(let E in t)bE(e.data,E,t[E]);e.objectType===de.objectType&&(d=this.portIdFunction(e.data),d!==e.id&&this.graph.renamePort(e,d),this.os(e.getParent(),yu))}let u=s(e,a);u.originalId=l,h!=null&&(u.originalPortId=h),this.N(E=>E.$vertexUpdated(u));let{changed:p,newType:g,previousType:m}=this.zd(a,e,!0);p&&(u.typeChanged=!0,u.newType=g,u.previousType=m),this.fire(o,u,null)}}os(e,t){if(this.portUpdater!=null){let n=this.portUpdater(e.data,e,e.getPorts());if(n!=null&&(e.data=n,!this.Ka)){let o=Y(e)?ve:Le,s={vertex:e,updates:{},originalData:e.data,reason:t};this.N(a=>a.$vertexUpdated(s)),this.fire(o,s)}}}getEdges(e){return this.qE(e,t=>t.getEdges(),!1)}getAllEdges(){return this.graph.getAllEdges()}getAllEdgesFor(e,t){return e.getAllEdges(t)}selectAllEdges(){return this.filter(rt)}addAllEdgesToSelection(){this.addToSelection(this.getAllEdges())}setSelection(e){let t=this.Li(e);this.ss(t,!1,this.Ee,!0)}select(e,t){let n=this.ts(),o=this.Li(e),s=this.ss(o,!0,n);if(t)for(let a=0;a<s[0].length;a++){let l=s[0][a];if(K(l||Y(l)||H(l))){let h=l.getAllEdges();for(let d=0;d<h.length;d++)n.append(h[d])}}return n}Yd(e,t,n,o){let s=e.getAllEdges();for(let a=0,l=s.length;a<l;a++)if(s[a].source===e){let h=s[a].target,d=h.getFullId();o[d]||(t.append(h),n&&t.append(s[a]),o[d]=!0,this.Yd(h,t,n,o))}}selectDescendants(e,t,n){let o=this.getObjectInfo(e),s=this.ts();if(o.obj&&o.obj.objectType===ce.objectType){t&&this.ss(o.obj,!0,s);let a={};a[o.obj.getFullId()]=!0,this.Yd(o.obj,s,n,a)}return s}Li(e){return e instanceof Ll||e instanceof pr?e:j(e)?this.getVertex(e)||this.getEdge(e):Array.isArray(e)?e.map(t=>j(t)?this.getVertex(e)||this.getEdge(e):t):e}addToSelection(e){let t=this.Li(e);if(t){let n=this.ss(t,!0,this.Ee,!1);n[1]!=null&&n[1].length>0&&this.wi(!1,n[1]),n[0]!=null&&n[0].length>0&&this.wi(!0,n[0])}}wi(e,t){let n=e?qt:Qt;for(let o=0;o<t.length;o++){let s={obj:t[o],selection:this.Ee};this.N(a=>{e?a.$select(s):a.$deselect(s)}),this.fire(n,s)}}toggleSelection(e){let t=this.Li(e);if(t){let n=[],o=this.Ee.toggle(t,(s,a)=>{a||n.push(s)});this.wi(!1,o[1]),this.wi(!1,n),this.wi(!0,o[0])}}removeFromSelection(e){let t=this.Li(e);t&&this.Ee.remove(t,n=>{let o={obj:n,selection:this.Ee};this.N(s=>{s.$deselect(o)}),this.fire(Qt,o)})}addPathToSelection(e){this.addToSelection(this.getPath(e))}clearSelection(){this.Ee.clear()}getSelection(){return this.Ee}setMaxSelectedNodes(e){this.Ee.setMaxNodes(e)}setMaxSelectedEdges(e){this.Ee.setMaxEdges(e)}setSelectionCapacityPolicy(e){this.Ee.setCapacityPolicy(e)}QE(e){this.fire(e),this.Ka=!1}Xd(e,t,n){e=e||{};let o=e.type||"json",s=e.data,a=e.url,l=e.jsonp,h=e.onload,d=e.parameters||{},u=e.error||function(g){};if(s==null&&a==null)throw new TypeError("You must supply either data or url to load.");let p=g=>{e.incremental===!1&&this.clear(),this.Ka=!0,t===No?(this.undoRedo&&this.undoRedo.dataLoadStart(),this.N(m=>m.$dataLoadStart())):t===$E&&(this.undoRedo&&this.undoRedo.dataAppendStart(),this.N(m=>m.$dataAppendStart())),this.fire(t),gA(o,g,this,d),this.QE(n),h&&h(this,g),this.fire(ZA),n===Mr?(this.N(m=>m.$dataLoadEnd()),this.undoRedo&&this.undoRedo.dataLoadEnd()):n===BE&&(this.N(m=>m.$dataAppendEnd()),this.undoRedo&&this.undoRedo.dataAppendEnd())};if(s)p(s);else if(a){if(l){let E=a.indexOf("?")===-1?"?":"&";a=a+E+"callback=?"}let g=o===Wt||o===CE?Wt:e.dataType,m=e.headers||{Accept:"application/json"};this.fetchUrl({url:a,success:p,dataType:g,error:u,headers:m})}return this}load(e){return this.Xd(e,No,Mr)}append(e){return this.Xd(e,$E,BE)}save(e){if(e==null){U("VisuallyJs: save method requires at least URL parameter - no params given.");return}if(e.url==null){U("VisuallyJs: save method requires at least URL parameter");return}let t=e.data||this.exportData(e),n={"Content-Type":"application/json"};Object.assign(n,e.headers||{}),this.fetchUrl({url:e.url,type:"POST",data:t,success:e.success||function(o){},error:e.error||function(o){},headers:n})}exportData(e){return e=e||{},PE(e.type||Wt,this,e.parameters)}toJSON(){return PE(Wt,this,{})}getRenderer(e){return this.Xr.get(e)}N(e,t){this.Xr.forEach((n,o)=>{if(t==null||t!==n)try{e(n,o)}catch(s){U("WARN: could not invoke renderer "+o+" ["+s+"]")}})}$addRenderer(e,t){t=t||$(),this.Xr.set(t,e),e.id=t,e.onDestroy(n=>{this.Xr.delete(n.id)}),this.fire(rS,{renderer:e,id:t})}getObjectInfo(e){let t={obj:null,type:null,id:null};if(e!=null){if(typeof e=="string")e=this.getNode(e)||this.getGroup(e)||this.getPort(e)||this.getEdge(e);else if(typeof e=="object"&&typeof e.objectType=="undefined"){let n=this.idFunction(e),o=this.edgeIdFunction(e);e=this.getNode(n)||this.getGroup(n)||this.getEdge(o)}if(e!=null)t.obj=e;else return t;t.obj!=null&&(t.id=t.obj.id,t.type=t.obj.objectType)}return t}undo(){this.undoRedo&&(this.undoRedo.undo(),this.fire(nS,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}redo(){this.undoRedo&&(this.undoRedo.redo(),this.fire(iS,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}transaction(e,t){return this.undoRedo?this.undoRedo.transaction(e,t):null}$transaction(e,t,n){return this.undoRedo?this.undoRedo.transaction(e,t,n):null}mergeTransaction(e){return this.undoRedo?this.undoRedo.mergeTransaction(e):null}openTransaction(e){return this.undoRedo?this.undoRedo.openTransaction(e):null}rollbackTransaction(){this.undoRedo&&this.undoRedo.rollbackTransaction()}commitTransaction(e){this.undoRedo&&this.undoRedo.commitTransaction(e)}flushUndoRedo(){this.undoRedo&&this.undoRedo.clear()}get version(){return fu}$_deriveEdgeId(e){return e==null?$():typeof e=="string"?e:this.edgeIdFunction(e)||$()}};var b6="csv";function HS(i){let r=[],e="",t=!1;for(let n=0;n<i.length;n++){let o=i[n],s=i[n+1];t?o==='"'&&s==='"'?(e+='"',n++):o==='"'?t=!1:e+=o:o==='"'?t=!0:o===","?(r.push(e),e=""):e+=o}return r.push(e),r}var WE=class{constructor(r,e){c(this,"csv");c(this,"lines");c(this,"startLine");c(this,"headers");this.csv=r,this.lines=r.split(/\r?\n/).map(t=>t.trim()),e=e||{},this.startLine=e.skipLines!=null?e.skipLines:e.readHeaders?1:0,e.readHeaders?this.lines[0]&&this.lines[0].length>0&&(this.headers=HS(this.lines[0])):this.headers=e.headers}jd(r){for(let e=this.startLine;e<this.lines.length;e++){let t=this.lines[e].trim();if(t.length===0)continue;let n=HS(t);r(n)}}readLines(r){this.jd(e=>r(e))}readRecords(r){this.jd(e=>{let t={};for(let n=0;n<e.length;n++){let o=this.headers?this.headers[n]||`Field ${n+1}`:`Field ${n+1}`;t[o]=e[n]}r(t)})}},kS=(i,r,e)=>{e=e||{};let t=e.nodeDecorator||(l=>l),n=e.edgeDecorator||(l=>l),o=new Map,s=[];new WE(i,{readHeaders:e.readHeaders!==!1,headers:e.readHeaders===!1?["source","target","value"]:null}).readRecords(l=>{o.has(l.source)||o.set(l.source,t({id:l.source},!0)),o.has(l.target)||o.set(l.target,t({id:l.target},!1)),s.push({source:l.source,target:l.target,data:n({value:parseFloat(l.value)},o.get(l.source),o.get(l.target))})}),s.sort((l,h)=>h.data.value-l.data.value),Array.from(o.values()).forEach(l=>r.addNode(l)),s.forEach(l=>r.addEdge(l))};function WS(i){return i.eachNode!=null&&i.eachEdge!=null&&i.eachGroup!=null&&i.filter!=null}function ZS(i,r){return r?i:i.toLowerCase()}function hw(i){i=""+i;let r=i.split(/\s/),e=[],t=[],n=4;for(let o=0;o<r.length;o++){let s=Ct(r[o].replace(/[^\w]*/,""));s.length>0&&(e.push({token:s,context:""}),t.unshift(s),t.splice(n-1),t.length>1&&(t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse()))}for(t.pop();t.length>1;)t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse(),t.pop();return e}var cw=hw;function H6(i){return i=Ct(i),[{token:i.replace(/\s/g,"_"),context:i}]}function dw(i){return[{token:Ct(i),context:i}]}function uw(i,r){return i.score>r.score?-1:1}var pw=i=>i.id;function gw(i,r,e){if(i.length===0){i.push(r);return}let t=(n,o)=>{let s=n+Math.floor((o-n)/2),a=i[s],l=e(a,r),h;if(l===0){i.splice(s,0,r);return}else if(l===-1){if(s===i.length-1){i.push(r);return}else if(h=e(i[s+1],r),h!==l){i.splice(s+1,0,r);return}t(s+1,o)}else{if(s===0){i.unshift(r);return}else if(h=e(i[s-1],r),h!==l){i.splice(s,0,r);return}t(n,n+Math.floor((o-n)/2))}};t(0,i.length-1)}var mw=10,na=class{constructor(r){c(this,"fields");c(this,"root");c(this,"tokenizer");c(this,"searchTokenizer");c(this,"limit");c(this,"exclusions");c(this,"caseSensitive");c(this,"idFunction");c(this,"sorter");c(this,"kd",0);c(this,"Di",new Map);c(this,"jr",[]);c(this,"as",0);c(this,"we",{});r=r||{},this.fields=r.fields,this.root=this.nl(),this.tokenizer=r.tokenizer||cw,this.searchTokenizer=r.searchTokenizer||dw,this.limit=r.limit||mw,this.exclusions=r.exclusions||[],this.caseSensitive=r.caseSensitive===!0,this.idFunction=r.idFunction||pw,this.sorter=r.sorter||uw}nl(r){return{index:this.kd++,children:{},documentIds:{},key:r}}ef(r,e,t){let n=this.we[r];n||(n={},this.we[r]=n),n[e.index]=e}tf(r,e,t){let n=(o,s,a,l)=>{if(s!==a.length){var h=a[s],d=o.children[h];d||(d=this.nl(h),o.children[h]=d),d.documentIds[l]=d.documentIds[l]||[],d.documentIds[l].push(a),this.ef(l,d,t),n(d,s+1,a,l)}};n(this.root,0,r,e)}removeExclusions(r){let e={};for(let t in r)this.exclusions.indexOf(t)===-1&&(e[t]=r[t]);return e}add(r){let e=t=>{let n=this.removeExclusions(t);gw(this.jr,{document:n,score:1},this.sorter);var o=this.idFunction(t),s={fields:a=>{for(let l=0;l<this.fields.length;l++){let h=t[this.fields[l]];typeof h=="string"&&a(h)}},document:a=>{for(let l in t)if(l!=="id"){let h=t[l];typeof h=="string"&&a(h)}}};this.Di.set(o,n),s[this.fields?"fields":"document"](a=>{if(a){let l=this.tokenizer(a);for(let h=0;h<l.length;h++)this.tf(ZS(l[h].token,this.caseSensitive),o,l[h].context)}}),this.as++};if(r.constructor===Array)for(let t=0;t<r.length;t++)e(r[t]);else e(r)}addAll(...r){for(let e=0;e<r.length;e++)this.add(r[e])}reindex(r){this.remove(r),this.add(r)}remove(r){let e=this.idFunction(r),t=this.we[e],n;if(t)for(n in t)delete t[n].documentIds[e];let o=-1;for(n=0;n<this.jr.length;n++)if(this.idFunction(this.jr[n].document)===e){o=n;break}o!==-1&&(this.jr.splice(o,1),this.as=this.jr.length),this.Di.delete(e)}clear(){this.Di.clear(),this.we={},this.kd=0,this.jr.length=0,this.as=0,this.root=this.nl()}getDocumentCount(){return this.as}getDocumentList(){return this.jr}getDocument(r){return this.Di.get(r)}search(r,e){let t=this.searchTokenizer(r),n={},o=[],s={},a={},l=(d,u,p)=>{let g=n[d];g||(g={},n[d]=g,s[d]=0,a[d]=[]),a[d].push(p),g[u]||(g[u]=!0,s[d]++)},h=(d,u,p)=>{if(u===p.length){for(let m in d.documentIds)if(d.documentIds.hasOwnProperty(m)){let E=d.documentIds[m];for(let y=0;y<E.length;y++)l(m,p,E[y])}return}let g=p[u];d.children[g]&&h(d.children[g],u+1,p)};for(let d=0;d<t.length;d++)h(this.root,0,ZS(t[d].token,this.caseSensitive));for(let d in n)o.unshift({document:this.Di.get(d),score:s[d],contexts:a[d]});return o.sort(this.sorter),o.slice(0,e==null?this.limit:e)}},JS=class{constructor(r,e){this.instance=r;c(this,"nodeIndex");c(this,"groupIndex");c(this,"edgeIndex");c(this,"portIndex");this.nodeIndex=new na(e),this.groupIndex=new na(e),this.edgeIndex=new na(e),this.portIndex=new na(e),r.bind(Kt,t=>{this.Hd(t.node)}),r.bind(Ce,t=>{this.nodeIndex.remove(t.node.data),t.node.getPorts().forEach(n=>this.portIndex.remove(n.data))}),r.bind(Le,t=>{this.nodeIndex.remove(t.vertex.data),this.nodeIndex.add(t.vertex.data)}),r.bind(Zt,t=>{this.Wd(t.group)}),r.bind(Re,t=>{this.groupIndex.remove(t.group.data)}),r.bind(ve,t=>{this.groupIndex.remove(t.vertex.data),this.groupIndex.add(t.vertex.data)}),r.bind(ur,t=>{this.Zd(t.edge)}),r.bind(bt,t=>{this.edgeIndex.remove({id:t.edge.getId()})}),r.bind(xt,t=>{let n=Object.assign(t.originalData||{},{id:t.edge.getId()});this.edgeIndex.remove(n);let o=Object.assign(t.edge.data||{},{id:t.edge.getId()});this.edgeIndex.add(o)}),r.bind(si,t=>{this.portIndex.add(t.port.data)}),r.bind(Vr,t=>{this.portIndex.remove(t.port.data)}),r.bind(dr,t=>{this.portIndex.remove(t.port.data),this.portIndex.add(t.port.data)}),r.bind(Jt,()=>{this.nodeIndex.clear(),this.groupIndex.clear(),this.edgeIndex.clear(),this.portIndex.clear()}),this.instance.eachNode((t,n)=>{this.Hd(n)}),this.instance.eachGroup((t,n)=>{this.Wd(n)}),this.instance.eachEdge((t,n)=>{this.Zd(n)})}Hd(r){this.nodeIndex.add(r.data),r.getPorts().forEach(e=>this.portIndex.add(e.data))}Wd(r){this.groupIndex.add(r.data)}Zd(r){let e=Object.assign(r.data||{},{id:r.getId()});this.edgeIndex.add(e)}search(r){let e=this.nodeIndex.search(r).map(s=>this.instance.getNode(s.document.id)),t=this.portIndex.search(r).map(s=>this.instance.getPort(s.document.id)),n=this.groupIndex.search(r).map(s=>this.instance.getGroup(s.document.id)),o=this.edgeIndex.search(r).map(s=>this.instance.getEdge(s.document.id));return{nodes:e,groups:n,edges:o,ports:t}}};var KS="context",ZE="lookup",qS="default",ci="element",Ui="text",Fo="tmpl",di="each",jl="if",QS="root",eT="class",tT="style",Uo="$value",Hl="$key",rT="attribute";function JE(i,r){if(i==null)return i;{let e=i.replace(/\n/g,"").replace(/^[\s]+</,"<").replace("/>",">").replace(/>[\s]+$/,">").split(/^<|>$/)[1].split(r);return qb(e)}}function iT(i){return i.length>0?i[i.length-1]:null}function oT(i){if(i==null||i.length===0)return!1;for(let r=i.length-1;r>-1;r--)if(i[r].type==="each")return!0;return!1}function KE(i,r,e,t,n){let o=$(),s={w:r,expressions:[],id:o};return e.bindings[i]=s,r.replace(/\{\{([^\}]*)\}\}/g,(a,l,h,d)=>{let u=!1;return l.startsWith(":")&&(u=!0,l=l.substring(1)),s.expressions.push([a,l,u]),""}),o}function nT(i,r,e,t,n){e.atts[i]=r,KE(i,r,e,t,n)}function sT(i,r){let e=JE(i,r.attributesRe),t={el:Ct(e[0]),atts:{},bindings:{}},n=(o,s)=>{let a=o.match(/([^=]+)=['"](.*)['"]/);return a==null&&s==null?t.atts[o]="":a==null?nT(o,"",t,s,r):nT(a[1],a[2],t,s,r),a};for(let o=1;o<e.length;o++){let s=Ct(e[o]);s!=null&&s.length>0&&n(s)}return t}var Ew=["*","-","+","/","%"],aT=["==",">","<",">=","<=","===","!=","!==","||"],fw=/([(])|([)])|(===)|(==)|(!==)|(!=)|(!{1,2})|(\|\|)|(<=)|(>=)|(<)|(>)|(\+)|(-)|(\*)|(\/)|(\s+)|([0-9\.]+)|(\$data\[[0-9]+\])|(\$value\[[0-9]+\])|(\$key)|(\$value)|('[^']+')|([#a-zA-Z\$]+[0-9a-zA-Z_\$\.]*)/g,kl="bool",lT="num",hT="group",cT="var",yw="op",qE="comp",dT="exp",uT="string",pT="array",gT="key",mT="value";function xw(i){return i[i.length-1]}function ET(i){return i.t===hT}function bw(i){return i.t===cT}function Aw(i){return i.t===dT}function Sw(i){return i.t===lT}function Tw(i){return i.t===kl}function vw(i){return i.t===uT}function Cw(i){return i.t===pT}function Pw(i){return i.t===gT}function _w(i){return i.t===mT}function Ow(i){let r=i.match(fw),e,t=[{t:"root",c:[],e:i,v:null}];for(let n=0;n<r.length;n++){e=r[n];let o=xw(t);if(e==="("){let s={t:hT,c:[],v:null};o.c.push(s),t.push(s)}else if(e===")")t.pop();else if(e.match(/\$value\[[0-9]+\]/)){let s=parseInt(e.substring(7,e.length-1),10);o.c.push({t:pT,v:e,index:s})}else if(e.match(/\$key/))o.c.push({t:gT,v:null});else if(e.match(/\$value/))o.c.push({t:mT,v:null});else if(e.match(/^#/))o.c.push({t:dT,v:e.substring(1)});else if(e.match(/'[a-zA-Z0-9#_\$\.]+'/))o.c.push({t:uT,v:e.replace(/'/g,"")});else if(e.match(/true/))o.c.push({t:kl,v:!0});else if(e.match(/false/))o.c.push({t:kl,v:!1});else if(e.match(/^[0-9\.]+$/)){let s=e.indexOf(".")!==-1?parseFloat(e):parseInt(e,10);o.c.push({t:lT,v:s})}else e.match(/[a-zA-Z_\$\.]+/)?o.c.push({t:cT,v:e}):Ew.indexOf(e)!==-1?o.c.push({t:yw,v:e}):aT.indexOf(e)!==-1?o.c.push({t:qE,v:e}):e.match(/!{1,2}/)&&(e.length===1?(o.c.push({t:kl,v:!1}),o.c.push({t:qE,v:"=="})):(o.c.push({t:kl,v:!1}),o.c.push({t:qE,v:"!=="})))}return t[0]}function Rw(i){let r=null,e={t:"root",c:[],v:""},t={t:"root",c:[],v:""},n=e.c;for(let a=0;a<i.c.length;a++)if(aT.indexOf(i.c[a].v)!==-1){if(r!=null)throw new Error("Cannot parse expression; more than one comparator.");r=i.c[a].v,n=t.c}else n.push(i.c[a]);let o=a=>(ET(a)&&(a.c=s(a)),a),s=a=>{let l=a.c;if(l.length===0)return[];let h=[],d=o(l[0]);if(l.length===1)return[d];if(l.length===3)return[d,l[1],o(l[2])];{let u=d,p=null,g;for(let m=1;m<l.length;m+=2)g=l[m],(g.v==="+"||g.v==="-"?1:2)===2?p==null?(p={t:"group",c:[u,g],v:null},h.push(p)):p.c.push(u,g):(p!=null?p.c.push(u):h.push(u),p=null,h.push(g)),u=o(l[m+1]);return p!=null?p.c.push(u):h.push(u),h}};return e.c=s(e),t.c=s(t),{left:e,right:t,comparator:r}}function Wl(i){let r=Ow(i);return Rw(r)}function Yi(i,r,e,t,n){let o=QE(i.left.c,r,e,t,n);if(i.comparator==null)return o;{let s=QE(i.right.c,r,e,t,n);if(i.comparator==="==")return o==s;if(i.comparator==="===")return o===s;if(i.comparator===">")return o>s;if(i.comparator===">=")return o>=s;if(i.comparator==="<")return o<s;if(i.comparator==="<=")return o<=s;if(i.comparator==="!=")return o!=s;if(i.comparator==="!==")return o!==s;if(i.comparator==="||")return o||s}}function QE(i,r,e,t,n){let o=i.map(l=>ET(l)?QE(l.c,r,e,t,n):bw(l)?r(l.v):Aw(l)?e(l.v):Cw(l)?r(Uo)[l.index]:Pw(l)?r(Hl):_w(l)?r(Uo):Sw(l)||vw(l)||Tw(l)?l.v:l),s=o[0],a;for(let l=1;l<o.length;l+=2){a=o[l].v;let h=o[l+1];a==="+"?s+=h:a==="-"?s-=h:a==="*"?s*=h:a==="/"&&(s/=h)}return typeof s=="undefined"?"":n!=null?n(s,t):s}var zi=class{constructor(r){this.instance=r;c(this,"tag");c(this,"remove");c(this,"uuid");c(this,"children",[]);c(this,"elements",[]);c(this,"bindings");c(this,"context");c(this,"compiledBindings");this.uuid=$(),r.entries[this.uuid]=this,this.compiledBindings={}}Jd(r){for(let e in r){let t=r[e];t.expressions.length>0&&(this.compiledBindings[e]={id:$(),name:e,expressions:t.expressions.map(([n,o,s])=>{let[a,l]=o==null?[null,null]:o.split(":");return{source:n,expression:Wl(a),once:s,format:l}})})}}};var Au=class Au extends zi{constructor(e,t){super(t);c(this,"type","text");c(this,"value");this.value=e.value,this.bindings={};let n={id:$(),w:e.value,expressions:[]};e.value.replace(/\{\{([^\}]*)\}\}/g,function(o,s,a,l){let h=!1;return s.startsWith(":")&&(h=!0,s=s.substring(1)),n.expressions.push([o,s,h]),""}),this.Jd({[Au.TEXT_BINDING_NAME]:n})}};c(Au,"TEXT_BINDING_NAME","__element");var Xi=Au;var Su=class Su extends zi{constructor(e,t){super(t);c(this,"type",Su.type);c(this,"comment");this.comment=e}};c(Su,"type","comment");var ia=Su;var Tu=class Tu extends zi{constructor(e,t,n,o,s){super(t);this.templateResolver=n;this.stack=o;this.parseIdStack=s;c(this,"type",Tu.type);c(this,"namespace");c(this,"atts");c(this,"custom");let a=e.el.split(":");this.tag=e.el,a.length===2&&(this.namespace=a[0]),this.atts=e.atts,this.Jd(e.bindings),this.remove=!1}};c(Tu,"type",ci);var zr=Tu;var ef={},ui={construct:(i,r,e,t,n,o)=>{let s=ef[i];if(s)return new s(r,e,t,n,o);throw{message:"Recado: unknown element '"+i+"'"}},register:(i,r)=>{ef[i]=r},exists:i=>ef[i]!=null};var Cu=class Cu extends zr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"key");c(this,"type",di);this.context=e.atts.in,this.key=e.atts.key,this.tag=Cu.tag}};c(Cu,"tag","r-each");var vu=Cu;ui.register(vu.tag,vu);function tf(i,r,e){i.entryMap[r]=i.entryMap[r]||[],i.entryMap[r].push(e)}function fT(i,r,e,t){for(let n=0;n<r.children.length;n++){let o=r.children[n];tf(i,e,o)}Array.from(r.fragment.childNodes).forEach(n=>t.added.push({el:n})),i.placeholder.before(r.fragment)}var Pu=class{constructor(r,e,t){this.instance=r;this.tagName=e;this.options=t;c(this,"id");c(this,"template");c(this,"rendered");c(this,"updated");c(this,"fragments",{});c(this,"mounted");c(this,"defaultableFragmentKeys");c(this,"fragmentKeys");c(this,"parsedTemplates",{});c(this,"defaultNamespace");c(this,"decorator");this.id=`custom-${e}`;let n=t.fragments||{};this.defaultableFragmentKeys=t.defaultableFragmentKeys||[],this.template=t.template,this.defaultNamespace=t.defaultNamespace,this.decorator=t.decorator||((s,a)=>null);let o=new Set;for(let s in n){this.fragments[s]=this.fragments[s]||{},o.add(s);for(let a in n[s]){let l=`custom-${e}-${s}-${a}`,h=n[s][a];r.addTemplate(l,h),this.fragments[s][a]=r.parseAndCache(l,d=>{if(d===l)return h})}}this.fragmentKeys=Array.from(o),this.fragmentKeys.sort(),this.parsedTemplates[be]=this.Kd(this.id),this.rendered=t.rendered||function(s,a,l){},this.updated=t.updated||function(s,a,l){},this.mounted=t.mounted}Kd(r){return this.instance.parseAndCache(r,e=>{if(e===r)return this.template})}extractTemplateData(r,e){let t=r.split(":"),n=[];for(let o=0;o<t.length;o++){let s=e[t[o]];if(s==null)if(this.defaultableFragmentKeys.indexOf(t[o])!==-1)n.push(be);else return null;else n.push(s)}return n.join(":")}getAST(r){if(r==null)return this.parsedTemplates[be];{let e=[],t={};if(this.fragmentKeys.forEach(n=>{let o=this.extractTemplateData(n,r);o!=null&&(t[n]=this.fragments[n][o]||[],e.push(`${n}:${o}`))}),e.length>0){let n=e.join(" ");if(this.parsedTemplates[n]!=null)return this.parsedTemplates[n];{let o=this.Kd(n);return this.qd(o[0],t),this.parsedTemplates[n]=o,o}}return this.parsedTemplates[be]}}qd(r,e){let t=[];for(let n=0;n<r.children.length;n++)if(r.children[n].tag==="r-fragment"){let o=e[r.children[n].atts.key]||[];t.push(...o)}else t.push(r.children[n]),this.qd(r.children[n],e);r.children=t}};function yT(i,r,e,t){t?i.el.style[r]=e:i.el.setAttribute(r,e)}function Lw(i,r){i.el.nodeValue=r}function ww(i,r){let e=[];for(let t=0;t<r.children.length;t++)e.push(...Zl(i,r.children[t]));return e}function Zl(i,r){let e=ww(i,r);return r.type===ci?(i.removeElement(r.el),e.unshift(r.el)):r.type===Ui?(i.removeTextNode(r.el),e.unshift(r.el)):r.type===di&&(r.entryMap={}),e}function xT(i,r,e,t){for(let n in i.bindings)if(n!==eT){let o=i.bindings[n],s=o.binding,a=o.originalValue,l=!1;for(let h=0;h<s.expressions.length;h++)if(!s.expressions[h].once){let d=Yi(s.expressions[h].expression,r,u=>e(u),s.expressions[h].format,t);a=a.replace(s.expressions[h].source,d),d!==o.results[h].result&&(l=!0,o.results[h].result=d)}l&&(i.type===ci?n!==tT?yT(i,n,a,!1):a.split(";").forEach(h=>{let d=h.indexOf(":"),u=h.substring(0,d);yT(i,u,h.substring(d+1),!0)}):i.type===Ui&&Lw(i,a))}}function bT(){return{added:[],removed:[],elements:[]}}var Ou=class Ou extends zr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"type","if");c(this,"tag",Ou.tag);c(this,"test");c(this,"expression");this.test=e.atts.test,this.expression=Wl(this.test)}};c(Ou,"tag","r-if");var _u=Ou;ui.register(_u.tag,_u);function rf(i,r,e,t,n){return i.resolution=Yi(i.entry.expression,o=>De(r,o),o=>e(o),t,n),i.resolution}var Yo=class extends zr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"templateId");c(this,"lookup");c(this,"default");if(this.context=e.atts[KS],this.type=Fo,this.remove=!0,e.atts[ZE])this.lookup=e.atts[ZE],this.default=e.atts[qS]||"";else{this.templateId=e.atts.id;let a=oT(o);if(s.indexOf(this.templateId)!==-1){if(!a)throw new TypeError("recursive template call ["+this.templateId+"]")}else{let l=n(this.templateId);s.push(this.templateId);let h=this.instance.parse(l,n,null,s);for(let d=0;d<h.length;d++)h[d].context=this.context;this.children=h,s.pop()}}}};c(Yo,"tag","r-tmpl"),ui.register(Yo.tag,Yo);function AT(i,r){if(Array.isArray(i))for(let e=0;e<i.length;e++)r(i[e],e);else if(cr(i)){let e=i;for(let t in e)r(e[t],t)}}var zo=class{constructor(r){c(this,"templateResolver");c(this,"defaultTemplate");c(this,"defaultNamespace");c(this,"macros");c(this,"entries");c(this,"customTags",{});c(this,"formatter");c(this,"Lt",new Map);c(this,"ls",new Map);c(this,"openRe",new RegExp("<([^/>]*?)>$|<([^/].*[^/])>$"));c(this,"closeRe",new RegExp("^</([^>]+)>"));c(this,"openCloseRe",new RegExp("<(.*)(/>$)"));c(this,"tokenizerRe",/(<[^\^>]+\/>)|(<!--[\s\S]*?-->)|(<[\/a-zA-Z0-9\-:]+(?:\s*[\(a-zA-Z\-\):]+=\"[^\"]*\"|\s*[a-zA-Z\-:]+='[^']+'|\s*[\(a-zA-Z\-\):]|\s*\{\{.*\}\}|\s*\{#.*\})*>)/);c(this,"commentRe",/<!--[\s\S]*?-->/);c(this,"attributesRe",/([\(a-zA-Z0-9\-_:\)]+="[^"]*")|\s+([\(a-zA-Z0-9\-_:\)]+(?=\s.|$))/);c(this,"hs");c(this,"namespaceHandlers",{});c(this,"namespaces",{});r=r||{},this.hs=r.templates||{},this.entries={},this.defaultTemplate=r.defaultTemplate,this.templateResolver=r.templateResolver||this.Qd(),this.macros=r.templateMacros||{},this.formatter=r.formatter,this.defaultNamespace=r.defaultNamespace}resolveTemplate(r){return this.hs[r]!=null?this.hs[r]:this.templateResolver(r)}setAttribute(r,e,t){let n=e.split(":");n.length===1?r.setAttribute(n[0],t):this.namespaces[n[0]]==null?r.setAttribute(e,t):r.setAttributeNS(this.namespaces[n[0]],n[1],t)}clearCache(){this.Lt.clear(),this.ls.clear()}parseAttributes(r){return JE(r,this.attributesRe)}eu(r,e){return t=>{let n=e?null:this.Lt.get(t);return n==null&&(n=r(t)),n==null&&(n=this.defaultTemplate),n!=null&&this.Lt.set(t,n),n}}addTemplate(r,e){this.hs[r]=e}template(r,e,t,n,o){e=e||{};let s=n?null:this.ls.get(r);if(s!=null)return this.render(s,e,t,o).fragment;{let a=this.parseAndCache(r,t,n);return a!=null?this.render(a,e,t,o).fragment:this.cf()}}mounted(r){r.$recado.mountings.forEach(e=>{e.mount(e.el,e.data,this,e.parent,e.context)})}parseAndCache(r,e,t){let n=this.ls.get(r);if(n==null||t===!0){e=this.eu(e||(s=>this.resolveTemplate(s)),t);let o=e(r);if(o!=null){let s=ST(this,o,e,null,[r]);return this.ls.set(r,s),s}}else return n}data(r,e,t){return De(r,e,t)}each(r,e,t,n,o){let s;if(Array.isArray(r))for(s=0;s<r.length;s++)e(r[s],t,s,n,o);else for(s in r)r.hasOwnProperty(s)&&e({$key:s,$value:r[s]},t,s,n,o)}lookupValueInDataOrContext(r,e,t){return t.indexOf("$context.")===0?De(e,t.substring(9)):De(r,t)}update(r,e,t){let n=r.$recado,o=bT();return t=t||{},n!=null&&this.Ln(n,e,o,t),o}onUpdate(r,e){r.$recado!=null&&(r.$recado.updaters=r.$recado.updaters||[],r.$recado.updaters.push(e))}Ln(r,e,t,n,o){if(r.type===QS)for(let s=0;s<r.children.length;s++)this.Ln(r.children[s],e,t,n,o);else if(r.type===ci||r.type===Ui){let s=e,a=this.customTags[r.entry.tag];a!=null&&(s=Object.assign({},e),Object.assign(s,a.decorator(e,n)||{})),xT(r,l=>this.lookupValueInDataOrContext(s,n,l),l=>this.Ni(l,s,n),this.formatter),a!=null&&a.updated&&a.updated(r.el,s,this);for(let l=0;l<r.children.length;l++)this.Ln(r.children[l],s,t,n,o)}else if(r.type===jl){let s=r,a=s.resolution,l=rf(s,e,h=>this.Ni(h,e,n),null,this.formatter);if(!l){for(let h=0;h<r.children.length;h++)Zl(this,r.children[h]).map(d=>t.removed.push({el:d}));r.children.length=0}if(l)if(a)for(let h=0;h<r.children.length;h++)this.Ln(r.children[h],e,t,n,s.defaultNamespace||o);else{let h=this.render(r.entry.children,e,this.templateResolver,n,s.defaultNamespace||o);r.children=h.children;for(let d=0;d<r.children.length;d++){let u=r.children[d];s.placeholder.before(u.el),t.added.push({el:u.el})}}}else if(r.type===Fo){let s=r.entry.context==null||r.entry.context.length===0?e:this.lookupValueInDataOrContext(e,n,r.entry.context);for(let a=0;a<r.children.length;a++)this.Ln(r.children[a],s,t,n)}else if(r.type===di){let s=r,a=this.lookupValueInDataOrContext(e,n,r.entry.context);if(a==null)Zl(this,r).map(l=>t.removed.push({el:l}));else if(s.entry.key==null||s.entry.key.length===0)U("WARN: Cannot update r-each entry when no `key` parameter was set.");else{let l={},h=[],d=[];AT(a,(u,p)=>{let g=De(u,s.entry.key);if(l[g]=u,s.entryMap[g]!=null){let m=s.entryMap[g];for(let E=0;E<m.length;E++)h.push({data:u,key:g,execution:m[E]})}else h.push({data:u,key:g})});for(let u in s.entryMap)if(l[u]==null)for(let p=0;p<s.entryMap[u].length;p++)d.push({e:s.entryMap[u][p],key:u});for(let u=0;u<d.length;u++)delete s.entryMap[d[u].key],Zl(this,d[u].e).map(p=>t.removed.push({el:p}));for(let u=0;u<h.length;u++){let p=h[u];if(p.execution)this.Ln(p.execution,p.data,t,n),p.execution.el!=null?s.placeholder.before(p.execution.el):p.execution.children.forEach(g=>{g.el!=null&&s.placeholder.before(g.el)});else{let g=this.render(r.entry.children,p.data,null,n);fT(s,g,p.key,t)}}}}if(r.updaters)for(let s=0;s<r.updaters.length;s++)r.updaters[s](r.el);return t}remove(r,e){e&&r.parentNode&&r.parentNode.removeChild(r)}registerTag(r,e){this.customTags[r]=new Pu(this,r,e)}parse(r,e,t,n){return ST(this,r,e,t,n)}Ni(r,e,t){return this.macros[r]&&this.macros[r](e,t)||""}render(r,e,t,n,o){let s={id:$(),fragment:this.cf(),children:[],type:"root",bindings:{},entry:null,mountings:[]},a=s.fragment,l=null,h=s;a.$recado=s,n=n||{};let d=(f,b,A)=>{let T={id:b,entry:f,placeholder:this.cc(`${di}:${b}`),entryMap:{},type:di,children:[]};return E(T.placeholder,A),h.children.push(T),T},u=(f,b,A)=>{let T={placeholder:this.cc(`${Fo}:${b}`),entry:f,id:b,children:[],type:Fo};return E(T.placeholder,A),h.children.push(T),T},p=(f,b,A,T)=>{y(f,T);let S={id:$(),entry:b,bindings:A,children:[],el:f,type:ci};return h.children.push(S),f.$recado=S,S},g=(f,b,A,T)=>{y(f,T);let S={id:$(),el:f,entry:b,bindings:A,children:[],type:Ui};return h.children.push(S),f.$recado=S,S},m=(f,b,A)=>{let T=$(),S={id:T,entry:f,resolution:!1,placeholder:this.cc(`${jl}:${T}`),type:jl,children:[],defaultNamespace:A};return E(S.placeholder,b),h.children.push(S),S},E=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},y=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},x=(f,b,A,T)=>{b=b||{};let S=!1,O=null;if(f.type===jl){let v=h,_=m(f,A,o);if(h=_,S=rf(_,b,P=>this.Ni(P,b,n),null,this.formatter),S)for(let P=0;P<f.children.length;P++)x(f.children[P],b,_.placeholder,T);h=v,O=_}else if(f.type===di){let v=f,_=l,P=f.context===Uo?b:this.lookupValueInDataOrContext(b,n,f.context),I=h,C=$(),R=d(v,C,A);h=R,P!=null&&AT(P,(w,B)=>{let N=v.key&&cr(w)?De(w,v.key):B||null;for(let M=0;M<f.children.length;M++){let D=x(f.children[M],w,R.placeholder,B);N!=null&&tf(R,N,D)}}),l=_,h=I,O=R}else if(f.type===Fo){let v=f,_=l,P=h,I=$(),C=u(v,I,A);h=C;let R=f.context==null||f.context.length===0?b:De(b,f.context),w=v.lookup!=null?De(b,v.lookup.replace(/[\{\{\}\}]/g,"")):v.templateId,B=this.parseAndCache(w,t);B==null&&v.default!=null&&(B=this.parseAndCache(v.default,t));for(let N=0;N<B.length;N++)x(B[N],R,C.placeholder,T);l=_,h=P,O=C}else if(f.type===ci){let v,_=f,P,I={},C=[];if(this.customTags[f.tag]!=null){P=this.customTags[f.tag];let N=Object.assign({},b);Object.assign(N,P.decorator(b,n)||{});let M=this.render(P.getAST(N),N,t,n,P.defaultNamespace);v=M.fragment.childNodes[0];let D=M.children[0].bindings;for(let G in D)I[G]=D[G];C.push(...M.children[0].children)}else if(_.namespace!=null&&this.namespaceHandlers[_.namespace])v=this.namespaceHandlers[_.namespace](f.tag);else{let N=o||this.defaultNamespace;N!=null&&this.namespaceHandlers[N]?v=this.namespaceHandlers[N](`${N}:${f.tag}`):v=this.ce(f.tag)}for(let N in _.atts)if(_.atts.hasOwnProperty(N)){let M=_.atts[N];if(f.compiledBindings[N]!=null){let D=f.compiledBindings[N];I[N]={id:D.id,binding:D,results:[],originalValue:M,type:rT};for(let G=0;G<D.expressions.length;G++){let J=D.expressions[G],fe=Yi(J.expression,X=>X===Hl?T:X===Uo?b:this.lookupValueInDataOrContext(b,n,X),X=>this.Ni(X,b,n),J.format,this.formatter);M=M.replace(J.source,fe),I[N].results.push({source:J.source,result:fe})}}this.setAttribute(v,N,M)}P&&(P.rendered&&P.rendered(v,b,this,l,n),P.mounted&&s.mountings.push({mount:P.mounted,el:v,data:b,parent:l,context:n}));let R=l,w=h,B=p(v,_,I,A);B.children.push(...C),h=B,l=v;for(let N=0;N<f.children.length;N++)x(f.children[N],b,null,T);h=w,l=R,O=B}else if(f.type===Ui){let v=f.value||"",_={},P=f.compiledBindings[Xi.TEXT_BINDING_NAME];if(P!=null){_[Xi.TEXT_BINDING_NAME]={id:P.id,binding:P,results:[],originalValue:v,type:Ui};for(let R=0;R<P.expressions.length;R++){let w=P.expressions[R],B=Yi(w.expression,N=>N===Hl?T:N===Uo?b:this.lookupValueInDataOrContext(b,n,N),N=>this.Ni(N,b,n),w.format,this.formatter);v=v.replace(w.source,B),_[Xi.TEXT_BINDING_NAME].results.push({source:w.source,result:B})}}let I=this.ctn(v);O=g(I,f,_,A)}return O};for(let f=0;f<r.length;f++)x(r[f],e||{},null,null),l=null,h=s;return s}};function Dw(i){return ui.exists(i)}function Nw(i,r,e,t,n,o){return ui.construct(r,e,i,t,n,o)}function ST(i,r,e,t,n){n=n||[],e=i.eu(e||(E=>i.resolveTemplate(E)),null);let o=[],s=[],a=(E,y)=>{let x=E.match(y);return x==null?null:x},l=()=>o.length>0?o[o.length-1]:null,h=E=>{let y=l();return y!=null&&y.tag===E},d=(E,y)=>{o.length>0&&l().children.push(E),y?o.length===0&&s.push(E):o.push(E)},u=E=>{d(E,!0)},p=()=>{let E=o.pop();if(o.length===0&&!E.remove)s.push(E);else if(E.remove){let y=l();y&&y.children.pop()}return E},g=(E,y,x,f)=>{let b=sT(E,i);return Dw(b.el)?Nw(i,b.el,b,x,o,n):new zr(b,i,x,o,n)},m=[{re:i.commentRe,handler:(E,y,x,f,b)=>{d(new ia(E,f),!0)}},{re:i.openRe,handler:(E,y,x,f,b)=>{let A=g(E,y,x,b);d(A,A.remove)}},{re:i.closeRe,handler:(E,y,x,f,b)=>{if(y[1]!==Yo.tag)if(h(y[1]))p();else throw new TypeError("Unbalanced closing tag '"+y[1]+"'; opening tag was '"+p().tag+"'")}},{re:i.openCloseRe,handler:(E,y,x,f,b)=>{let A=g(E,y,x,b);d(A,!0)}},{re:/.*/,handler:(E,y,x,f,b)=>{let A=new Xi({value:E},f);u(A),E.match(/^[\s]*$/)!=null||KE(Xi.TEXT_BINDING_NAME,E,A,null,f)}}];if(Qb(Ct(r).split(i.tokenizerRe),(E,y)=>{let x=Ct(y);for(let f=0;f<m.length;f++){let b=a(x,m[f].re);if(b){m[f].handler(y,b,e,i,n);break}}}),s.length>0&&t)for(let E in t)s[0][E]=t[E];return s}function TT(i,r){let e=typeof i=="string"?parseFloat(i):i;if(isNaN(e))return i;let t=/^(['|,])?(\.(\d+))?([df])$/,n=r.match(t);if(!n)return e.toString();let o=n[1],s=n[3]?parseInt(n[3],10):null,a=n[4],l;a==="d"?l=Math.floor(e).toString():l=s!==null?e.toFixed(s):e.toString();let h=l.split("."),d="";return o===","?d=",":o==="'"?d=" ":d=1e3.toLocaleString().substring(1,2),h[0]=h[0].replace(/\B(?=(\d{3})+(?!\d))/g,d),h.join(".")}var Jl=class{constructor(){c(this,"childNodes");this.childNodes=[]}removeChild(r){this.childNodes=this.childNodes.filter(e=>e!==r)}appendChild(r){this.childNodes.push(r)}insertAfter(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t,0,e)}insertBefore(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t-1,0,e)}toString(){let r="";for(let e=0;e<this.childNodes.length;e++)r+=this.childNodes[e].toString();return r}},Ru=class extends Jl{constructor(e){super();c(this,"nodeType",1);c(this,"parentElement");c(this,"tag");c(this,"atts");c(this,"style",{});this.tag=e,this.atts={}}getAttribute(e){return this.atts[e]}setAttributeNS(e,t,n){this.atts[e+":"+t]=n}setAttribute(e,t){this.atts[e]=t}toString(){let e="<"+this.tag,t="";for(let n in this.atts)t+=" "+n+'="'+this.atts[n]+'"';e=e+t+">";for(let n=0;n<this.childNodes.length;n++)e+=this.childNodes[n].toString();return e+"</"+this.tag+">"}after(e){this.parentElement.insertAfter(this,e)}before(e){this.parentElement.insertBefore(this,e)}},Lu=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",3)}toString(){return this.nodeValue}after(r){this.parentElement.insertAfter(this,r)}},wu=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",8)}before(r){this.parentElement.insertBefore(this,r)}};var nf=class extends zo{Qd(){return null}ce(r){return new Ru(r)}cf(){return new Jl}ctn(r){return new Lu(r)}cc(r){return new wu(r)}removeElement(r){}removeTextNode(r){}};function Du(i){let r={};for(let e=0;e<i.length;e++)r[i[e].id]=i[e];return r}function of(i,r){let e=r===0?"x":"y";return i.target[e]<i.source[e]?-1:1}function vT(i,r,e){let t=e===0?"x":"y";return i.source[t]>r.source[t]&&i.source[t]<r.target[t]||r.source[t]>i.source[t]&&r.source[t]<i.target[t]||i.target[t]>r.target[t]&&i.target[t]<r.source[t]||r.target[t]>i.target[t]&&r.target[t]<i.source[t]}function Nu(i,r,e,t,n){let o=i,s=r;for(let a=0;a<o.length;a++){let l=o[a];l.sourcePosition=t(l.sourceId),l.sourceSize=n(l.sourceId),l.targetPosition=t(l.targetId),l.targetSize=n(l.targetId),l.sourceCenter={x:l.sourcePosition.x+l.sourceSize.width/2,y:l.sourcePosition.y+l.sourceSize.height/2},l.targetCenter={x:l.targetPosition.x+l.targetSize.width/2,y:l.targetPosition.y+l.targetSize.height/2};for(let h=0;h<l.path.length;h++){let d=e[l.path[h]],u=h<l.path.length-1?e[l.path[h+1]]:null;d.edges=d.edges||[],d.edges.push({edge:l,next:u})}}for(let a=0;a<s.length;a++)if(s[a].edges){let l=s[a];l.edges.sort((u,p)=>{let g=u.edge.pathDirection,m=p.edge.pathDirection,E=u.edge.path.indexOf(l.id),y=p.edge.path.indexOf(l.id),x=g===1?E+1:E-1,f=m===1?y+1:y-1,b=x>=0&&x<u.edge.path.length?e[u.edge.path[x]]:null,A=f>=0&&f<p.edge.path.length?e[p.edge.path[f]]:null,T=g===1?E-1:E+1,S=m===1?y-1:y+1,O=T>=0&&T<u.edge.path.length?e[u.edge.path[T]]:null,v=S>=0&&S<p.edge.path.length?e[p.edge.path[S]]:null,_=l.axis===0?ee:ye,P=b?b.midpoint[_]:O?O.midpoint[_]:p.edge.sourceCenter[_]!==u.edge.sourceCenter[_]?u.edge.sourceCenter[_]:u.edge.targetCenter[_],I=b?A.midpoint[_]:v?v.midpoint[_]:u.edge.sourceCenter[_]!==p.edge.sourceCenter[_]?p.edge.sourceCenter[_]:p.edge.targetCenter[_];return P-I});let h=s[a].length/(s[a].edges.length+1),d=h;for(let u=0;u<s[a].edges.length;u++)s[a].edges[u].location=d,d+=h}}function Iu(i,r,e){for(let t=0;t<i.length;t++){let n=i[t];n.regionPath=n.regionPath||[];for(let o=0;o<n.path.length;o++){let s=e[n.path[o]],a=s.edges.find(d=>d.edge.id===n.id),l=a.edge.pathDirection;if(!(a.edge.pathDirection===1&&s.b.type==="vertex"||a.edge.pathDirection===-1&&s.a.type==="vertex")){let d=a.next.edges.find(A=>A.edge.id===n.id),u=r.find(A=>A.id===(l===1?s.b.id:s.a.id)),p=s.axis===0?l===1?0:u.height:l===1?0:u.width,g=s.axis===0?l===1?u.height:0:l===1?u.width:0,m=s.segment.point1-(s.axis===0?u.left:u.top),E=a.next.segment.point1-(s.axis===0?u.left:u.top),y=s.axis===0?"x":"y",x=s.axis===0?"y":"x",f={[y]:a.location+m,[x]:p},b={[y]:d.location+E,[x]:g};u.lines.push({source:f,target:b,id:n.id}),n.regionPath.push(u)}}}}var Mu="separate",MJ="bus";function CT(i){let r=i.axis,e=i.gates,t=i.gateMap||Du(e),n=i.mode||Mu,o=i.regions,s=i.edges,a=i.pad||10,l={};Nu(s,e,t,i.getVertexPosition,i.getVertexSize),Iu(s,o,t);for(let h=0;h<o.length;h++){o[h].edgeMap={};let d=[],u=o[h].lines;for(let x=0;x<u.length;x++){let f=[];for(let b=0;b<d.length;b++)e:for(let A=0;A<d[b].length;A++)if(vT(u[x],d[b][A],r)){f.push(b);break e}if(f.length===0)d.push([u[x]]);else{let b=[u[x]],A=[];for(let T=0;T<d.length;T++)f.indexOf(T)!==-1?b=b.concat(d[T]):A.push(d[T]);A.push(b),d=A}}for(let x=0;x<d.length;x++)d[x].sort((f,b)=>{let A=of(f,r),T=of(b,r),S=r==0?"x":"y";return A===T?A<0?f.source[S]-b.source[S]:b.source[S]-f.source[S]:f.source[S]-b.source[S]});o[h].lineSets=d;let p=r===0?o[h].height:o[h].width,g=r===0?o[h].left:o[h].top,m=r===0?o[h].top:o[h].left,E=r===0?"x":"y",y=r===1?"x":"y";if(n===Mu)for(let x=0;x<d.length;x++){let f=(p-a)/(d[x].length+1),b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];l[T.id]=l[T.id]||[],o[h].edgeMap[T.id]=[{[E]:T.source[E]+g,[y]:T.source[y]+m},{[E]:T.source[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:T.target[y]+m}],b+=f}}else for(let x=0;x<d.length;x++){let f=(p-a)/2,b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];o[h].edgeMap[T.id]=[{[E]:T.source[E]+g,[y]:T.source[y]+m},{[E]:T.source[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:T.target[y]+m}]}}}for(let h=0;h<s.length;h++){let d=s[h];l[d.id]=[],d.regionPath.forEach(p=>{let g=p.edgeMap[d.id];l[d.id].push(...g)})}return l}function PT(i){let r=i.gates,e=Du(r),t=i.regions,n=i.edges,o={};Nu(n,r,e,i.getVertexPosition,i.getVertexSize),Iu(n,t,e);for(let s=0;s<t.length;s++){t[s].edgeMap={};let a=t[s].lines;for(let l=0;l<a.length;l++){let h=a[l];t[s].edgeMap[h.id]=[{x:h.source.x+t[s].left,y:h.source.y+t[s].top},{x:h.target.x+t[s].left,y:h.target.y+t[s].top}]}}for(let s=0;s<n.length;s++){let a=n[s];o[a.id]=[],a.regionPath.forEach(h=>{let d=h.edgeMap[a.id];o[a.id].push(...d)})}return o}var _T=4;function OT(i){return{x:Math.ceil(i.x+i.width/2),y:Math.ceil(i.y+i.height/2)}}var oa={sortRect:i=>{let r,e=1/0,t=-1/0;i.forEach(s=>{r=OT(s),t=Math.max(t,r.x,r.y),e=Math.min(e,r.x,r.y)});let n=t-e;return i.sort(s=>(r=OT(s),oa.toHilbertCoordinates(n,r.x-e,r.y-e)))},toHilbertCoordinates:(i,r,e)=>{let t=i,n=(1<<t)-1,o=0,s=r^e,a=~r&n,l=~e&n,h=a^e,d=0,u=0;for(let p=1;p<t;p++)u=(u&s|(d^l)&h)>>1,d=(d&(u^a)|~d&(u^l))>>1;return o=~d&(u^r)|d&(u^l),oa.hilbertInterleaveBits(o,s)},hilbertInterleaveBits:(i,r)=>{let e=0,t=Math.max(i,r),n=0;for(;t>0;)n++,t>>=1;for(let o=0;o<n;o++){let s=1<<o,a=(r&s)>0?1<<2*o:0,l=(i&s)>0?1<<2*o+1:0;e+=a+l}return e}};function RT(i){return i.height*i.width}function sf(i,r){i.x===1/0?(i.height=r.height,i.width=r.width,i.x=r.x,i.y=r.y):(i.height=Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y),i.width=Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x),i.x=Math.min(i.x,r.x),i.y=Math.min(i.y,r.y))}function af(i){i.x=Math.min(...i.children.map(r=>r.x)),i.y=Math.min(...i.children.map(r=>r.y)),i.width=Math.max(...i.children.map(r=>r.x+r.width))-i.x,i.height=Math.max(...i.children.map(r=>r.y+r.height))-i.y,i.parent!=null&&af(i.parent)}function LT(i,r){return i.x===1/0?RT(r):(Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y))*(Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x))-RT(i)}function lf(i){let r=Math.floor(i.children.length/2),e=Xo(),t=Xo();return oa.sortRect(i.children).forEach((n,o)=>{o<=r?jo(e,n):jo(t,n)}),i.children.length=0,[e,t]}function Xo(i){return{x:1/0,y:1/0,width:0,height:0,children:[],parent:null,id:i,data:null}}function Vu(i){return i.children==null||i.children.length===0}function wT(i){return Vu(i)||Vu(i.children[0])}function jo(i,r){r.parent=i,i.children.push(r),sf(i,r)}function hf(i,r){let e=i.children.indexOf(r);return e>=0?(i.children.splice(e,1),!0):!1}function Iw(i){return i.reduce(function(r,e){return Array.isArray(e)?r.concat(Iw(e)):r.concat(e)},[])}function DT(i,r){let e=i.map(r);return i[e.indexOf(Math.min.apply(null,e))]}function NT(i){i.parent&&(hf(i.parent,i),af(i.parent))}var Ho=class{constructor(r){c(this,"ir");c(this,"oe");c(this,"kr",{});this.ir=r||_T,this.oe=Xo()}search(r,e){let t=[];return this.tu(r,(n,o)=>t.push(n),e),t}searchAndRank(r,e){let t=[];return this.tu(r,(n,o)=>t.push({node:n,overlap:uE(n,r)}),e),t.sort((n,o)=>n.overlap<o.overlap?-1:1),t}tu(r,e,t){if(this.oe.children.length===0)return;t=t||{};let n=Object.assign({},r);t.margin&&(n.x-=t.margin,n.y-=t.margin,n.width+=2*t.margin,n.height+=2*t.margin);let o=s=>{if(tt(s,n))for(let a=0;a<s.children.length;a++){let l=s.children[a];if(tt(l,n))if(l.id!=null){if(t.minimumOverlap!=null&&uE(l,n)<t.minimumOverlap)continue;if(e(l,n),t.greedy)return}else o(l)}};o(this.oe)}findIntersectionsWithLine(r,e){let t=[];e=e||[];let n=o=>{Yb(r,o)&&(Vu(o)?e.indexOf(o.id)===-1&&t.push(o):o.children.forEach(n))};return n(this.oe),t}insert(r){let e=n=>{let o=this.oe;if(o){let s={x:n.x,y:n.y,width:n.width,height:n.height,data:n.data,children:[],id:n.id};for(n.id&&(this.kr[n.id]=s);!wT(o);)sf(o,s),o=DT(o.children,a=>LT(a,s));jo(o,s),this.rf(s)}},t=Array.isArray(r)?r:[r];for(let n=0;n<t.length;n++)e(t[n])}rf(r){let e=r;for(;e.parent&&e.parent.children.length>this.ir;)e=e.parent,e!=this.oe?(hf(e.parent,e),lf(e).forEach(t=>{jo(e.parent,t)})):e==this.oe&&lf(e).forEach(t=>{jo(e,t)})}ru(r,e){e===void 0&&(e=1);let t=Math.ceil(r.length/this.ir),n=[],o=0,s;for(let a=0;a<t;a++){s=Xo(),o=Math.min(this.ir,r.length);for(let l=0;l<o;l++){let h=r.pop();h.id&&(this.kr[h.id]=h),jo(s,h)}n.push(s)}return t>1?this.ru(n,e+1):n}load(r){if(r!=null&&r.length>0){let e=oa.sortRect(r);this.oe=this.ru(e)[0]||Xo()}}getBounds(){return{x:this.oe.x,y:this.oe.y,width:this.oe.width,height:this.oe.height}}getExtents(){return{xmin:this.oe.x,ymin:this.oe.y,xmax:this.oe.x+this.oe.width,ymax:this.oe.y+this.oe.height}}removeById(r){let e=this.searchById(r);return e&&e.parent&&this.nu(e),e}nu(r,e){let t=[],n=r.parent;for(NT(r),r.id!=null&&delete this.kr[r.id];n!=null&&n!==this.oe;)n.children.length<=this.ir/2&&(NT(n),t.push(...this.nf(n))),n=n.parent;e&&t.push(...e),this.insert(t)}searchById(r){return r==null?null:this.kr[r]}update(r,e,t,n,o,s){let a=this.searchById(r);a?this.nu(a,[{x:e,y:t,width:n,height:o,data:s||a.data,children:[],id:r}]):this.insert({id:r,x:e,y:t,width:n,height:o,data:s,children:[]})}clear(){this.oe=Xo(),this.kr={}}getLeafNodes(){return Object.values(this.kr)}has(r){return this.kr.hasOwnProperty(r)}nf(r){let e=[],t=n=>{n.id!=null?e.push(n):n.children.forEach(t)};return t(r),e}};var Gu=class i{constructor(r){this.instance=r;c(this,"pe",[]);c(this,"te",[]);c(this,"ne",[])}static from(r){let e=new i(r.instance);return e.pe=r.pe.slice(),e.te=r.te.slice(),e.ne=r.ne.slice(),e}paste(r,e){let t=e&&e.origin,n=e&&e.hermetic===!0,o=e&&e.shallow===!0,s=this.of(r,t,n,o);return this.instance.transaction(()=>{s.groups.forEach(a=>this.instance.addGroup(a)),s.nodes.forEach(a=>this.instance.addNode(a)),s.edges.forEach(a=>this.instance.$_addEdge(a,cA,null))}),s}of(r,e,t,n){let o={nodes:[],groups:[],edges:[],vertexMap:new Map,edgeMap:new Map,origin:{x:0,y:0},transform:{x:0,y:0}},s=[],a=this.instance.modelLeftAttribute,l=this.instance.modelTopAttribute,h=1/0,d=1/0,u=new Map;function p(m){let E=r.getCoordinates(m,!0);u.set(m.id,E),m.group==null&&(h=Math.min(h,E.x),d=Math.min(d,E.y))}this.te.forEach(p),this.pe.forEach(p),o.origin.x=h,o.origin.y=d,o.transform.x=e!=null?e.x-o.origin.x:0,o.transform.y=e!=null?e.y-o.origin.y:0;let g=(m,E,y)=>{y=y||0;let x=Object.assign({},m.data),f=$();if(o.vertexMap.set(m.getFullId(),f),x.id=f,E==null){let b=u.get(m.getFullId());x[a]=b.x+o.transform.x,x[l]=b.y+o.transform.y,x[this.instance.groupProperty]!=null&&delete x[this.instance.groupProperty]}else x[this.instance.groupProperty]=E.id;return!n&&Y(m)&&m.getMembers().forEach(b=>{let A=g(b,x,y+1);Y(b)?s.push(A):o.nodes.push(A[0])}),[x,y]};return this.pe.forEach(m=>o.nodes.push(g(m,null,0)[0])),this.te.forEach(m=>s.push(g(m,null,0))),s.sort((m,E)=>m[1]<E[1]?-1:1),o.groups=s.map(m=>m[0]),this.ne.forEach(m=>{let E,y,x=m.source,f=H(x)?x.getParent():x,b=o.vertexMap.get(f.id),A=m.target,T=H(A)?A.getParent():A,S=o.vertexMap.get(T.id);if(b==null){if(t)return;E=f.id}else E=b;if(S==null){if(t)return;y=T.id}else y=S;let O={source:E,target:y,data:Object.assign({},m.data||{})};if(O.data.id!=null){let v=$();o.edgeMap.set(O.data.id,v),O.data.id=v}m.geometry!=null&&S!=null&&b!=null&&(O.geometry=r.transformGeometry(m,o.transform.x,o.transform.y)),o.edges.push(O)}),o}};var $u=class{constructor(r){this.instance=r;c(this,"stack",[])}copy(r){let e=this.instance.select(r);this.stack.push(Gu.from(e))}paste(r){let t=r&&r.clear===!0?this.stack.pop():this.stack[this.stack.length-1];return t!=null?t.paste(this.$getCopyDataTransformer(),r):null}clear(){this.stack.length=0}copyCurrentSelection(){this.copy(this.instance.getSelection())}pasteCurrentSelection(r){return this.copyCurrentSelection(),this.paste(r)}};var cf="Anchor",_t="top",Ot="left",Rt="right",Lt="bottom",df={[_t]:{x:0,y:-1},[Lt]:{x:0,y:1},[Rt]:{x:1,y:0},[Ot]:{x:-1,y:0}},Q9=[Ot,Rt],eK=[_t,Lt],tK={[_t]:[Ot,Rt],[Lt]:[Ot,Rt],[Ot]:[Lt,_t],[Rt]:[Lt,_t]},rK={[_t]:Lt,[Lt]:_t,[Ot]:Rt,[Rt]:Ot},Mw=(s=>(s.Circle="Circle",s.Ellipse="Ellipse",s.Triangle="Triangle",s.Diamond="Diamond",s.Rectangle="Rectangle",s.Square="Square",s))(Mw||{}),Kl=(f=>(f.Assign="Assign",f.AutoDefault="AutoDefault",f.Bottom="Bottom",f.BottomLeft="BottomLeft",f.BottomRight="BottomRight",f.Center="Center",f.Continuous="Continuous",f.ContinuousBottom="ContinuousBottom",f.ContinuousLeft="ContinuousLeft",f.ContinuousRight="ContinuousRight",f.ContinuousTop="ContinuousTop",f.ContinuousLeftRight="ContinuousLeftRight",f.ContinuousTopBottom="ContinuousTopBottom",f.Left="Left",f.Right="Right",f.Top="Top",f.TopLeft="TopLeft",f.TopRight="TopRight",f))(Kl||{});var hn={};function sa(i,r){hn[i]=r}var gr={lineIntersection(i,r,e,t,n){return hn[i.type].lineIntersection(i,r,e,t,n)},boxIntersection(i,r,e,t,n){return hn[i.type].boxIntersection(i,r,e,t,n)},boundingBoxIntersection(i,r){return hn[i.type].boundingBoxIntersection(i,r)},pointOnPath(i,r,e){return hn[i.type].pointOnPath(i,r,e)},gradientAtPoint(i,r,e){return hn[i.type].gradientAtPoint(i,r,e)},pointAlongPathFrom(i,r,e,t){return hn[i.type].pointAlongPathFrom(i,r,e,t)},findClosestPointOnPath(i,r,e){return hn[i.type].findClosestPointOnPath(i,r,e)},getPath(i,r){return hn[i.type].getPath(i,r)}};function uf(i){return hn[i.type].getLength(i)}function IT(i,r){return hn[i].create(r)}function Vw(){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}function MT(i,r,e){return Vw()}function VT(i,r,e,t,n){return[]}function ql(i,r,e,t,n){let o=[];return o.push.apply(o,gr.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,gr.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,gr.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,gr.lineIntersection(i,r,e+n,r,e)),o}function GT(i,r){return ql(i,r.x,r.y,r.width,r.height)}function aa(i){return Object.assign({extents:Di()},i)}function Gw(){return{sx:0,sy:0,tx:0,ty:0,so:{x:0,y:0},to:{x:0,y:0},x:0,y:0,w:0,h:0,quadrant:1,startStubX:0,startStubY:0,endStubX:0,endStubY:0,isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1,opposite:!1,perpendicular:!1,orthogonal:!1,sourceAxis:ee,stubs:[0,0]}}function la(i,r,e){return{x:i.x,y:i.y,ox:i.ox,oy:i.oy,curX:i.curX+r,curY:i.curY+e}}function Bu(i,r,e,t){let n=e.gap||0,o=e.stub||t,s=Array.isArray(o)?o[0]:o,a=Array.isArray(o)?o[1]:o;return{type:i,internalSegments:[],segmentProportionalLengths:[],segmentProportions:[],totalLength:0,cssClass:e.cssClass||"",hoverClass:e.hoverClass||"",gap:n,stub:o,sourceStub:s,targetStub:a,sourceGap:Array.isArray(n)?n[0]:n,targetGap:Array.isArray(n)?n[1]:n,typeDescriptor:"connector",geometry:null,idPrefix:"_vjs_connector",bounds:Di(),x:0,y:0,width:0,height:0,edited:!1,strokeWidth:1,typeId:null,quadrant:0,paintInfo:Gw()}}function pf(i,r,e){let t=e===0?r.anchors.source:r.anchors.target;t.isFixed=!0,t.fixedLocation=Object.assign({},i,{offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY})}var $T=.45,$w=62;function Fu(i,r,e){let t=Bu(i,r,e,[0,0]);return Object.assign(t,{curviness:e.curviness||10,gap:e.gap||5,proximityLimit:e.proximityLimit||80,clockwise:e.orientation&&e.orientation==="clockwise",loopbackDistance:e.loopbackDistance||$w,isLoopbackCurrently:!1,constrain:on,smooth:!0})}var wn={subtract:(i,r)=>({x:i.x-r.x,y:i.y-r.y}),dotProduct:(i,r)=>i.x*r.x+i.y*r.y,square:i=>Math.sqrt(i.x*i.x+i.y*i.y),scale:(i,r)=>({x:i.x*r,y:i.y*r})},BT=64,Bw=Math.pow(2,-BT-1);function Fw(i,r){let e=[],t=Uw(i,r),n=r.length-1,o=2*n-1,s=gf(t,o,e,0),a=wn.subtract(i,r[0]),l=wn.square(a),h=0,d;for(let u=0;u<s;u++)a=wn.subtract(i,mf(r,n,e[u],null,null)),d=wn.square(a),d<l&&(l=d,h=e[u]);return a=wn.subtract(i,r[n]),d=wn.square(a),d<l&&(l=d,h=1),{location:h,distance:l}}function XT(i,r){let e=Fw(i,r);return{point:mf(r,r.length-1,e.location,null,null),location:e.location}}function Uw(i,r){let e=r.length-1,t=2*e-1,n=[],o=[],s=[],a=[],l=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]];for(let u=0;u<=e;u++)n[u]=wn.subtract(r[u],i);for(let u=0;u<=e-1;u++)o[u]=wn.subtract(r[u+1],r[u]),o[u]=wn.scale(o[u],3);for(let u=0;u<=e-1;u++)for(let p=0;p<=e;p++)s[u]||(s[u]=[]),s[u][p]=wn.dotProduct(o[u],n[p]);for(let u=0;u<=t;u++)a[u]||(a[u]=[]),a[u].y=0,a[u].x=parseFloat(""+u)/t;let h=e,d=e-1;for(let u=0;u<=h+d;u++){let p=Math.max(0,u-d),g=Math.min(u,h);for(let m=p;m<=g;m++){let E=u-m;a[m+E].y+=s[E][m]*l[E][m]}}return a}function gf(i,r,e,t){let n=[],o=[],s,a,l=[],h=[];switch(Yw(i,r)){case 0:return 0;case 1:{if(t>=BT)return e[0]=(i[0].x+i[r].x)/2,1;if(zw(i,r))return e[0]=Xw(i,r),1;break}}mf(i,r,.5,n,o),s=gf(n,r,l,t+1),a=gf(o,r,h,t+1);for(let d=0;d<s;d++)e[d]=l[d];for(let d=0;d<a;d++)e[d+s]=h[d];return s+a}function Yw(i,r){let e=0,t,n;t=n=Math.sign(i[0].y);for(let o=1;o<=r;o++)t=Math.sign(i[o].y),t!=n&&e++,n=t;return e}function zw(i,r){let e,t,n,o,s,a,l,h,d,u,p,g,m,E,y,x;a=i[0].y-i[r].y,l=i[r].x-i[0].x,h=i[0].x*i[r].y-i[r].x*i[0].y;let f,b;f=b=0;for(let A=1;A<r;A++){let T=a*i[A].x+l*i[A].y+h;T>f?f=T:T<b&&(b=T)}return p=0,g=1,m=0,E=a,y=l,x=h-f,d=p*y-E*g,u=1/d,t=(g*x-y*m)*u,E=a,y=l,x=h-b,d=p*y-E*g,u=1/d,n=(g*x-y*m)*u,o=Math.min(t,n),s=Math.max(t,n),e=s-o,e<Bw?1:0}function Xw(i,r){let e=1,t=0,n=i[r].x-i[0].x,o=i[r].y-i[0].y,s=i[0].x-0,a=i[0].y-0,l=n*t-o*e,h=1/l,d=(n*a-o*s)*h;return 0+e*d}function mf(i,r,e,t,n){let o=[[]];for(let s=0;s<=r;s++)o[0][s]=i[s];for(let s=1;s<=r;s++)for(let a=0;a<=r-s;a++)o[s]||(o[s]=[]),o[s][a]||(o[s][a]={}),o[s][a].x=(1-e)*o[s-1][a].x+e*o[s-1][a+1].x,o[s][a].y=(1-e)*o[s-1][a].y+e*o[s-1][a+1].y;if(t!=null)for(let s=0;s<=r;s++)t[s]=o[s][0];if(n!=null)for(let s=0;s<=r;s++)n[s]=o[r-s][s];return o[r][0]}function jw(i,r){let e=[];i--;for(let t=0;t<=i;t++)e.push(Hw(t/i,r));return e}function Hw(i,r){let e={x:0,y:0};if(i===0)return r[0];let t=r.length-1;if(i===1)return r[t];let n=r,o=1-i;if(t===0)return r[0];if(t===1)return{x:o*n[0].x+i*n[1].x,y:o*n[0].y+i*n[1].y};if(4>t){let s=o*o,a=i*i,l=0,h,d,u;return t===2?(n=[n[0],n[1],n[2],e],h=s,d=2*(o*i),u=a):t===3&&(h=s*o,d=3*(s*i),u=3*(o*a),l=i*a),{x:h*n[0].x+d*n[1].x+u*n[2].x+l*n[3].x,y:h*n[0].y+d*n[1].y+u*n[2].y+l*n[3].y}}else return e}function jT(i){let r=0;if(!YT(i)){let t=jw(16,i);for(let n=0;n<15;n++){let o=t[n],s=t[n+1];r+=UT(o,s)}}return r}var FT=new Map;function kw(i){let r=FT.get(i);if(!r){r=[];let e=()=>l=>Math.pow(l,i),t=()=>l=>Math.pow(1-l,i),n=l=>h=>l,o=()=>l=>l,s=()=>l=>1-l,a=l=>h=>{let d=1;for(let u=0;u<l.length;u++)d=d*l[u](h);return d};r.push(e());for(let l=1;l<i;l++){let h=[n(i)];for(let d=0;d<i-l;d++)h.push(o());for(let d=0;d<l;d++)h.push(s());r.push(a(h))}r.push(t()),FT.set(i,r)}return r}function ha(i,r){let e=kw(i.length-1),t=0,n=0;for(let o=0;o<i.length;o++)t=t+i[o].x*e[o](1-r),n=n+i[o].y*e[o](1-r);return{x:t,y:n}}function UT(i,r){return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))}function YT(i){return i[0].x===i[1].x&&i[0].y===i[1].y}function Uu(i,r,e){if(YT(i))return{point:i[0],location:r};let t=ha(i,r),n=0,o=r,s=e>0?1:-1,a=null;for(;n<Math.abs(e);)o+=.005*s,a=ha(i,o),n+=UT(a,t),t=a;return{point:a,location:o}}function HT(i,r,e){return Uu(i,r,e).point}function kT(i,r,e){return Uu(i,r,e).location}function Yu(i,r){let e=ha(i,r),t=ha(i.slice(0,i.length-1),r),n=t.y-e.y,o=t.x-e.x;return n===0?1/0:Math.atan(n/o)}function ZK(i,r,e){let t=Uu(i,r,e);return t.location>1&&(t.location=1),t.location<0&&(t.location=0),Yu(i,t.location)}function JK(i,r,e,t){t=t==null?0:t;let n=Uu(i,r,t),o=Yu(i,n.location),s=Math.atan(-1/o),a=e/2*Math.sin(s),l=e/2*Math.cos(s);return[{x:n.point.x+l,y:n.point.y+a},{x:n.point.x-l,y:n.point.y-a}]}function Dn(i,r,e,t,n){let o=t-r,s=i-e,a=i*(r-t)+r*(e-i),l=Ww(n),h=[o*l[0][0]+s*l[1][0],o*l[0][1]+s*l[1][1],o*l[0][2]+s*l[1][2],o*l[0][3]+s*l[1][3]+a],d=Zw.apply(null,h),u=[];if(d!=null)for(let p=0;p<3;p++){let g=d[p],m=Math.pow(g,2),E=Math.pow(g,3),y={x:l[0][0]*E+l[0][1]*m+l[0][2]*g+l[0][3],y:l[1][0]*E+l[1][1]*m+l[1][2]*g+l[1][3]},x;e-i!==0?x=(y.x-i)/(e-i):x=(y.y-r)/(t-r),g>=0&&g<=1&&x>=0&&x<=1&&u.push(y)}return u}function KK(i,r,e,t,n){let o=[];return o.push.apply(o,Dn(i,r,i+e,r,n)),o.push.apply(o,Dn(i+e,r,i+e,r+t,n)),o.push.apply(o,Dn(i+e,r+t,i,r+t,n)),o.push.apply(o,Dn(i,r+t,i,r,n)),o}function qK(i,r){let e=[];return e.push.apply(e,Dn(i.x,i.y,i.x+i.width,i.y,r)),e.push.apply(e,Dn(i.x+i.width,i.y,i.x+i.width,i.y+i.height,r)),e.push.apply(e,Dn(i.x+i.width,i.y+i.height,i.x,i.y+i.height,r)),e.push.apply(e,Dn(i.x,i.y+i.height,i.x,i.y,r)),e}function zT(i,r){return[-i[0][r]+3*i[1][r]+-3*i[2][r]+i[3][r],3*i[0][r]-6*i[1][r]+3*i[2][r],-3*i[0][r]+3*i[1][r],i[0][r]]}function Ww(i){return[zT(i,"x"),zT(i,"y")]}function Zw(i,r,e,t){let n=r/i,o=e/i,s=t/i,a=(3*o-Math.pow(n,2))/9,l=(9*n*o-27*s-2*Math.pow(n,3))/54,h=Math.pow(a,3)+Math.pow(l,2),d,u,p=[0,0,0];if(h>=0)d=Math.sign(l+Math.sqrt(h))*Math.pow(Math.abs(l+Math.sqrt(h)),1/3),u=Math.sign(l-Math.sqrt(h))*Math.pow(Math.abs(l-Math.sqrt(h)),1/3),p[0]=-n/3+(d+u),p[1]=-n/3-(d+u)/2,p[2]=-n/3-(d+u)/2,Math.abs(Math.sqrt(3)*(d-u)/2)!==0&&(p[1]=-1,p[2]=-1);else{let g=Math.acos(l/Math.sqrt(-Math.pow(a,3)));p[0]=2*Math.sqrt(-a)*Math.cos(g/3)-n/3,p[1]=2*Math.sqrt(-a)*Math.cos((g+2*Math.PI)/3)-n/3,p[2]=2*Math.sqrt(-a)*Math.cos((g+4*Math.PI)/3)-n/3}for(let g=0;g<3;g++)(p[g]<0||p[g]>1)&&(p[g]=-1);return p}var ko="Bezier";function Ef(i,r,e){return e&&(r=kT(i,r>0?0:1,r)),r}var Jw={create(i){let r=aa(i),e=i.cp1,t=i.cp2,n=[{x:r.x1,y:r.y1},{x:e.x,y:e.y},{x:t.x,y:t.y},{x:r.x2,y:r.y2}],o={xmin:Math.min(r.x1,r.x2,e.x,t.x),ymin:Math.min(r.y1,r.y2,e.y,t.y),xmax:Math.max(r.x1,r.x2,e.x,t.x),ymax:Math.max(r.y1,r.y2,e.y,t.y)};return Object.assign(r,{cp1:e,cp2:t,curve:n,extents:o,length:0,type:ko})},boundingBoxIntersection(i,r){return GT(i,r)},boxIntersection(i,r,e,t,n){return ql(i,r,e,t,n)},findClosestPointOnPath(i,r,e){let t=XT({x:r,y:e},i.curve);return{d:Math.sqrt(Math.pow(t.point.x-r,2)+Math.pow(t.point.y-e,2)),x:t.point.x,y:t.point.y,l:1-t.location,s:i,x1:null,y1:null,x2:null,y2:null}},getLength(i){return(i.length==null||i.length===0)&&(i.length=jT(i.curve)),i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"C "+i.cp1.x+" "+i.cp1.y+" "+i.cp2.x+" "+i.cp2.y+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return r=Ef(i.curve,r,e),Yu(i.curve,r)},lineIntersection(i,r,e,t,n){return Dn(r,e,t,n,i.curve)},pointAlongPathFrom(i,r,e,t){return r=Ef(i.curve,r,t),HT(i.curve,r,e)},pointOnPath(i,r,e){return r=Ef(i.curve,r,e),ha(i.curve,r)}};sa(ko,Jw);var Ql={};function Kw(i){return i.x1!=null&&!isNaN(i.x1)&&i.y1!=null&&!isNaN(i.y1)&&i.x2!=null&&!isNaN(i.x2)&&i.y2!=null&&!isNaN(i.y2)}function WT(i){return i.curX!=null&&!isNaN(i.curX)&&i.curY!=null&&!isNaN(i.curY)&&i.x!=null&&!isNaN(i.x)&&i.y!=null&&!isNaN(i.y)&&i.ox!=null&&!isNaN(i.ox)&&i.oy!=null&&!isNaN(i.oy)}function qw(i){return!i.source||!i.target||!WT(i.source)||!WT(i.target)||i.segments==null||i.segments.length===0?!1:i.segments.find(r=>!Kw(r))==null}var cn=i=>lt(i.geometry),je={get:(i,r,e)=>{let t=Ql[r];if(t)return t.create(i,e);throw"VisuallyJs: unknown connector type '"+r+"'"},register:(i,r)=>{Ql[i]=r},compute:(i,r,e)=>{let t=Ql[i.connector.type];if(t)return t.compute(i,r,e);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},update:(i,r,e,t,n)=>{let o=Ql[i.connector.type];if(o)return o.update(i,r,e,t,n);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},importGeometry(i,r){if(qw(r)){let e=i.connector;e.geometry=lt(r),e.edited=!0,je.$_setAnchorsFromGeometry(i,r)}else U("VisuallyJS WARN: edge geometry invalid")},$_setAnchorsFromGeometry(i,r){pf(r.source,i,0),pf(r.target,i,1)},transformGeometry(i,r,e,t){let n=Ql[i.type];if(n)return n.transformGeometry(r,e,t);throw"VisuallyJs: unknown connector type '"+i.type+"'"},setGeometry(i,r,e){if(r!=null){let t=i.connector;t.geometry=lt(r),e||(t.edited=!0,i.edge.geometry=cn(t))}}};function Lq(i){return i.geometry}function wq(i,r){return i.geometry=r,!0}function Qw(i,r){let e=r.extents;i.bounds.xmin=Math.min(i.bounds.xmin,e.xmin),i.bounds.xmax=Math.max(i.bounds.xmax,e.xmax),i.bounds.ymin=Math.min(i.bounds.ymin,e.ymin),i.bounds.ymax=Math.max(i.bounds.ymax,e.ymax)}function yf(i){i.totalLength=0,i.internalSegments.length=0,i.segmentProportions.length=0,i.segmentProportionalLengths.length=0}function Wo(i){return Math.round(i*2)/2}function Xr(i,r,e){if(e.x1=Wo(e.x1),e.y1=Wo(e.y1),e.x2=Wo(e.x2),e.y2=Wo(e.y2),e.x1===e.x2&&e.y1===e.y2)return;let t=IT(r,e);i.internalSegments.push(t),i.totalLength+=uf(t),Qw(i,t)}function ff(i,r,e){let t,n,o;if(e&&(r=r>0?r/i.totalLength:(i.totalLength+r)/i.totalLength),r===1)t=i.internalSegments.length-1,o=1;else if(r===0)o=0,t=0;else if(r>=.5){for(t=0,o=0,n=i.segmentProportions.length-1;n>-1;n--)if(i.segmentProportions[n][1]>=r&&i.segmentProportions[n][0]<=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}}else for(t=i.segmentProportions.length-1,o=1,n=0;n<i.segmentProportions.length;n++)if(i.segmentProportions[n][1]>=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}return{segment:i.internalSegments[t],proportion:o,index:t}}function mr(i,r,e){let t=ff(i,r,e);return t.segment&&gr.pointOnPath(t.segment,t.proportion,!1)||{x:0,y:0}}function Dq(i,r,e){let t=ff(i,r,e);return t.segment&&gr.gradientAtPoint(t.segment,t.proportion,!1)||0}function Be(i,r,e,t){let n=ff(i,r,t);return n.segment&&gr.pointAlongPathFrom(n.segment,n.proportion,e,!1)||{x:0,y:0}}function xf(i){let r=0;for(let e=0;e<i.internalSegments.length;e++){let t=uf(i.internalSegments[e]);i.segmentProportionalLengths[e]=t/i.totalLength,i.segmentProportions[e]=[r,r+=t/i.totalLength]}}function ZT(i){return!((i.ox===0||i.ox==null)&&(i.oy===0||i.oy==null))}function bf(i,r){i.strokeWidth=r.strokeWidth;let e=r.sourcePos.curX,t=r.targetPos.curX,n=r.sourcePos.curY,o=r.targetPos.curY,s=t<e,a=o<n,l={x:r.sourcePos.ox,y:r.sourcePos.oy},h={x:r.targetPos.ox,y:r.targetPos.oy},d=s?t:e,u=a?o:n,p=Math.abs(t-e),g=Math.abs(o-n),m=!ZT(r.sourcePos),E=!ZT(r.targetPos);if(m||E){let S=p>g,O=S?e:n,v=S?t:o,_=O>v?-1:1,P=O>v?1:-1;m&&(l.x=S?_:0,l.y=S?0:_),E&&(h.x=S?P:0,h.y=S?0:P)}let y=e+i.sourceGap*l.x,x=n+i.sourceGap*l.y,f=t+i.targetGap*h.x,b=o+i.targetGap*h.y,A=l.x*h.x+l.y*h.y,T={sx:y,sy:x,tx:f,ty:b,so:l,to:h,x:d,y:u,w:p,h:g,quadrant:Is({x:e,y:n},{x:t,y:o}),startStubX:y+l.x*i.sourceStub,startStubY:x+l.y*i.sourceStub,endStubX:f+h.x*i.targetStub,endStubY:b+h.y*i.targetStub,isXGreaterThanStubTimes2:Math.abs(y-f)>i.sourceStub+i.targetStub,isYGreaterThanStubTimes2:Math.abs(x-b)>i.sourceStub+i.targetStub,opposite:A===-1,perpendicular:A===0,orthogonal:A===1,sourceAxis:l.x===0?ye:ee,stubs:[i.sourceStub,i.targetStub]};return T.anchorOrientation=T.opposite?"opposite":T.orthogonal?"orthogonal":"perpendicular",T}function Nq(i,r){let e=i.connector;e.paintInfo=bf(e,r),yf(e),je.compute(i,e.paintInfo,r),e.x=e.paintInfo.x,e.y=e.paintInfo.y,e.width=e.paintInfo.w,e.height=e.paintInfo.h,e.quadrant=e.paintInfo.quadrant,xf(e)}function ji(i){i.connector.geometry=null,i.connector.edited=!1,[i.anchors.source,i.anchors.target].forEach(r=>{r.locations.length>0&&(delete r.fixedLocation,r.isFixed=!1)})}function JT(i){i.bounds=Di()}function KT(i,r,e){let t={d:1/0,s:null,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null,index:null,connectorLocation:null};for(let n=0;n<i.internalSegments.length;n++){let o=gr.findClosestPointOnPath(i.internalSegments[n],r,e);o.d<t.d&&(t.d=o.d,t.l=o.l,t.x=o.x,t.y=o.y,t.s=i.internalSegments[n],t.x1=o.x1,t.x2=o.x2,t.y1=o.y1,t.y2=o.y2,t.index=n,t.connectorLocation=i.segmentProportions[n][0]+o.l*(i.segmentProportions[n][1]-i.segmentProportions[n][0]))}return t}function Iq(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,gr.lineIntersection(i.internalSegments[s],r,e,t,n));return o}function Mq(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,gr.boxIntersection(i.internalSegments[s],r,e,t,n));return o}function qT(i,r){let e=[];for(let t=0;t<i.internalSegments.length;t++)e.push.apply(e,gr.boundingBoxIntersection(i.internalSegments[t],r));return e}function Vq(i){return i.typeDescriptor==="connector"}function QT(i){let r="";for(let e=0;e<i.internalSegments.length;e++)r+=gr.getPath(i.internalSegments[e],e===0),r+=" ";return r}function eD(i,r,e,t,n,o,s){let a=t,l=n,h=r.sx,d=r.sy,u=r.tx,p=r.ty,g,m;if(r.perpendicular){let E=h+a.ox*i.loopbackDistance,y=d+a.oy*i.loopbackDistance,x=u+l.ox*i.loopbackDistance,f=p+l.oy*i.loopbackDistance;g={x:E,y},m={x,y:f}}else{let E=Math.sign(r.tx-r.sx),y=Math.sign(r.ty-r.sy),x=a.ox===0?.25*i.loopbackDistance*-E:a.ox*i.loopbackDistance,f=a.oy===0?.25*i.loopbackDistance*-y:a.oy*i.loopbackDistance,b=l.ox===0?.25*i.loopbackDistance*E:l.ox*i.loopbackDistance,A=l.oy===0?.25*i.loopbackDistance*y:l.oy*i.loopbackDistance;g={x:r.sx+x,y:r.sy+f},m={x:r.tx+b,y:r.ty+A}}return[g,m]}function tD(i,r,e,t,n,o,s){let a=t,l=n,h,d,[u,p]=[i.scale*r.w,i.scale*r.h];return e.sourceInfo.id===e.targetInfo.id?[h,d]=eD(i,r,e,t,n,o,s):(h={x:r.sx+a.ox*u,y:r.sy+a.oy*p},d={x:r.tx+l.ox*u,y:r.ty+l.oy*p}),[h,d]}function ev(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp1]}function rD(i,r,e,t,n,o,s){let a=r.sx,l=r.sy,h=r.tx,d=r.ty,u,p=(a+h)/2,g=(l+d)/2,m=Math.sqrt(Math.pow(h-a,2)+Math.pow(d-l,2));return u=nD(p,g,r.quadrant,e.sourcePos,e.targetPos,i.curviness,i.curviness,m,i.proximityLimit),[u,u]}function nD(i,r,e,t,n,o,s,a,l){if(a<=l)return{x:i,y:r};if(e===1)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===2)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s};if(e===3)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===4)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s}}function tv(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp2]}function zu(i,r,e,t,n){let o=i.connector,s,a;o.type===Zo?[s,a]=tv(o):[s,a]=ev(o);let l={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}],source:e.sourcePos,target:e.targetPos};return Xr(o,ko,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}),l}function Xu(i,r,e){let t=i.connector,n=e.sourcePos,o=e.targetPos,s=Math.abs(n.curX-o.curX),a=Math.abs(n.curY-o.curY),l,h;t.type===Zo?t.edited?[l,h]=tv(t):[l,h]=tD(t,r,e,n,o,s,a):t.edited?[l,h]=ev(t):[l,h]=rD(t,r,e,n,o,s,a);let d={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}],source:e.sourcePos,target:e.targetPos};return Xr(t,ko,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}),d}function ju(i,r,e){return{source:la(i.source,r,e),target:la(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e,cp1:{x:t.cp1.x+r,y:t.cp1.y+e},cp2:{x:t.cp2.x+r,y:t.cp2.y+e}}))}}var Zo="Bezier";function iD(i,r){let e=Fu(Zo,i,r);return Object.assign(e,{scale:r.scale||$T})}je.register(Zo,{compute:Xu,update:zu,create:iD,transformGeometry:ju});var Hu="QuadraticBezier";function oD(i,r){let e=Fu(Hu,i,r);return Object.assign(e,{curviness:r.curviness||10,gap:r.gap||5,proximityLimit:r.proximityLimit||80,clockwise:r.orientation&&r.orientation==="clockwise",WA:{x:0,y:0}})}je.register(Hu,{compute:Xu,update:zu,create:oD,transformGeometry:ju});var Af="perpendicular",Sf="orthogonal",Tf="opposite",Hi="Orthogonal",rv="Smooth",nv=30;function eh(i,r,e,t){let n=Math.max(r,e),o=Math.min(r,e);return t?o<=i&&n>=i:o<i&&n>i}function iv(i,r,e){return ku(r,"h",e,1)}function ov(i,r,e){return ku(r,"h",e,-1)}function sv(i,r,e){return ku(r,"v",e,1)}function av(i,r,e){return ku(r,"v",e,-1)}function ku(i,r,e,t){let n=r==="h"?"v":"h",o=[],s=i,a=t===-1?-1:e.length;for(;s!==a;){let l=e[s];if(l.o===n)o.push(l),s+=t;else return{segment:l,others:o,index:s}}return null}function Wu(i,r,e,t){let n=null,o;if(t!=null){if(o=i.indexOf(t),o===-1)return null;o+=r}else o=r===-1?i.length-2:1;for(let s=o;s>0&&s<i.length-1;s+=r)if(i[s].o===e){n=[i[s],s];break}return n}function Zu(i,r,e,t){let n=i.indexOf(t),o=Wu(i,r,e,t);return o&&o[1]==n+r?o:null}function Jo(i){return{[ne]:Math.sign(i.x2-i.x1),[pe]:Math.sign(i.y2-i.y1)}}function vf(i,r){return i.curX===r.curX&&i.curY===r.curY}function th(i,r,e,t,n,o){if(i.lastx===r&&i.lasty===e)return;let s=i.lastx==null?t.sx:i.lastx,a=i.lasty==null?t.sy:i.lasty,l=s===r?pe:ne;i.lastx=r,i.lasty=e;let h={x1:s,y1:a,x2:r,y2:e,o:l};i.orthogonalSegments.push(h)}function lv(i,r,e){let t=i[1],n=!1,o=[{x:t.x1,y:t.y1},{x:t.x2,y:t.y2}];if(t.o===ne){if(eh(t.x2,i[0].x1,i[0].x2)||hr(o,r).length>0){let a=sv(t,1,i);if(a!=null){let l=(a.segment.y1+a.segment.y2)/2;if(n=!0,l<t.y1){let h=Math.round((r.y-e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:pe}),a.segment.y1=h}else{let h=Math.round((r.y2+e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:pe}),a.segment.y1=h}}}}else if(t.o===pe&&(eh(t.y2,i[0].y1,i[0].y2)||hr(o,r).length>0)){let a=iv(t,1,i);if(a!=null){let l=(a.segment.x1+a.segment.x2)/2;if(n=!0,l<t.x1){let h=Math.round((r.x-e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:ne}),a.segment.x1=h}else{let h=Math.round((r.x2+e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:ne}),a.segment.x1=h}}}return n}function hv(i,r,e){let t=i.length-2,n=i[t],o=!1,s=[{x:n.x1,y:n.y1},{x:n.x2,y:n.y2}],a=i[i.length-1];if(n.o===ne){if(eh(n.x1,a.x1,a.x2)||hr(s,r).length>0){let h=av(n,t,i);if(h!=null){let d=(h.segment.y1+h.segment.y2)/2;if(o=!0,d<n.y1){let u=Math.round((r.y-e)*100)/100,p=n.y1;h.others.forEach(g=>{g.y1=u,g.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:pe}),h.segment.y2=u}else{let u=Math.round((r.y2+e)*100)/100,p=n.y1;h.others.forEach(g=>{g.y1=u,g.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:pe}),h.segment.y2=u}}}}else if(n.o===pe&&(eh(n.y1,a.y1,a.y2)||hr(s,r).length>0)){let h=ov(n,t,i);if(h!=null){let d=(h.segment.x1+h.segment.x2)/2;if(o=!0,d<n.x1){let u=Math.round((r.x-e)*100)/100,p=n.x1;h.others.forEach(g=>{g.x1=u,g.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:ne}),h.segment.x2=u}else{let u=Math.round((r.x2+e)*100)/100,p=n.x1;h.others.forEach(g=>{g.x1=u,g.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:ne}),h.segment.x2=u}}}return o}function cv(i,r,e,t,n){if(i.vertexAvoidance===!1)return{segments:r,sourceAdjusted:!1,targetAdjusted:!1};{let o,s;return n?(o=hv(r,t,i.targetStub),s=lv(r,e,i.sourceStub)):(s=lv(r,e,i.sourceStub),o=hv(r,t,i.targetStub)),{segments:r,sourceAdjusted:s,targetAdjusted:o}}}var In="Straight";function Nn(i,r,e){return e>r?r<=i&&i<=e:r>=i&&i>=e}function Ju(i,r,e){return e>=Math.min(i,r)&&e<=Math.max(i,r)}function Ku(i,r,e){return Math.abs(e-i)<Math.abs(e-r)?i:r}var Ko={create(i){let r=aa(i),e=Math.sqrt(Math.pow(r.x2-r.x1,2)+Math.pow(r.y2-r.y1,2)),t=Nr({x:r.x1,y:r.y1},{x:r.x2,y:r.y2}),n=-1/t,o={xmin:Math.min(r.x1,r.x2),ymin:Math.min(r.y1,r.y2),xmax:Math.max(r.x1,r.x2),ymax:Math.max(r.y1,r.y2)};return Object.assign(r,{length:e,m:t,m2:n,extents:o,type:In})},boundingBoxIntersection(i,r){return Ko.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){let o=[];return o.push.apply(o,Ko.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,Ko.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,Ko.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,Ko.lineIntersection(i,r,e+n,r,e)),o},findClosestPointOnPath(i,r,e){let t={d:1/0,x:null,y:null,l:null,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2};if(i.m===0)t.y=i.y1,t.x=Ju(i.x1,i.x2,r)?r:Ku(i.x1,i.x2,r);else if(i.m===1/0||i.m===-1/0)t.x=i.x1,t.y=Ju(i.y1,i.y2,e)?e:Ku(i.y1,i.y2,e);else{let o=i.y1-i.m*i.x1,s=e-i.m2*r,a=(s-o)/(i.m-i.m2),l=i.m*a+o;t.x=Ju(i.x1,i.x2,a)?a:Ku(i.x1,i.x2,a),t.y=Ju(i.y1,i.y2,l)?l:Ku(i.y1,i.y2,l)}let n=Pe({x:t.x,y:t.y},{x:i.x1,y:i.y1});return t.d=Pe({x:r,y:e},t),t.l=n/i.length,t},getLength(i){return i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"L "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return i.m},lineIntersection(i,r,e,t,n){let o=Math.abs(Nr({x:r,y:e},{x:t,y:n})),s=Math.abs(i.m),a=s===1/0?i.x1:i.y1-s*i.x1,l=[],h=o===1/0?r:e-o*r;if(o!==s)if(o===1/0&&s===0)Nn(r,i.x1,i.x2)&&Nn(i.y1,e,n)&&l.push({x:r,y:i.y1});else if(o===0&&s===1/0)Nn(e,i.y1,i.y2)&&Nn(i.x1,r,t)&&l.push({x:i.x1,y:e});else{let d,u;o===1/0?(d=r,Nn(d,i.x1,i.x2)&&(u=s*r+a,Nn(u,e,n)&&l.push({x:d,y:u}))):o===0?(u=e,Nn(u,i.y1,i.y2)&&(d=(e-a)/s,Nn(d,r,t)&&l.push({x:d,y:u}))):(d=(h-a)/(s-o),u=s*d+a,Nn(d,i.x1,i.x2)&&Nn(u,i.y1,i.y2)&&l.push({x:d,y:u}))}return l},pointAlongPathFrom(i,r,e,t){let n=Ko.pointOnPath(i,r,t),o=e<=0?{x:i.x1,y:i.y1}:{x:i.x2,y:i.y2};return e<=0&&Math.abs(e)>1&&(e*=-1),kt(n,o,e)},pointOnPath(i,r,e){if(r===0&&!e)return{x:i.x1,y:i.y1};if(r===1&&!e)return{x:i.x2,y:i.y2};{let t=e?r>0?r:i.length+r:r*i.length;return kt({x:i.x1,y:i.y1},{x:i.x2,y:i.y2},t)}}};sa(In,Ko);var dv=1e-10;function uv(i){let r=Math.floor(i),e=Math.ceil(i);return i-r<dv?r:e-i<dv?e:i}var rh="Arc";function pv(i,r,e,t){return yl({x:i,y:r},{x:e,y:t})}function sD(i,r){if(i.anticlockwise){let e=i.startAngle<i.endAngle?i.startAngle+Li:i.startAngle,t=Math.abs(e-i.endAngle);return e-t*r}else{let e=i.endAngle<i.startAngle?i.endAngle+Li:i.endAngle,t=Math.abs(e-i.startAngle);return i.startAngle+t*r}}var qu={create(i){let r=aa(i),e=i.cx,t=i.cy,n=i.r,o=i.ac,s,a;i.startAngle&&i.endAngle?(s=i.startAngle,a=i.endAngle,r.x1=e+n*Math.cos(s),r.y1=t+n*Math.sin(s),r.x2=e+n*Math.cos(a),r.y2=t+n*Math.sin(a)):(s=pv(e,t,r.x1,r.y1),a=pv(e,t,r.x2,r.y2)),a<0&&(a+=Li),s<0&&(s+=Li);let l=a<s?a+Li:a,h=Math.abs(l-s);o&&(h=Li-h);let d=2*Math.PI*n,u=h/Li,p=d*u,g={xmin:e-n,xmax:e+n,ymin:t-n,ymax:t+n};return Object.assign(r,{extents:g,length:p,frac:u,circumference:d,sweep:h,startAngle:s,endAngle:a,anticlockwise:o,cx:e,cy:t,radius:n,type:rh})},boundingBoxIntersection(i,r){return qu.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){return ql(i,r,e,t,n)},findClosestPointOnPath(i,r,e){return MT(i,r,e)},getLength(i){return i.length},getPath(i,r){let e=i.sweep>Math.PI?1:0,t=i.anticlockwise?0:1;return(r?"M"+i.x1+" "+i.y1+" ":"")+"A "+i.radius+" "+i.radius+" 0 "+e+","+t+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){let t=qu.pointOnPath(i,r,e),n=Ub({x:i.cx,y:i.cy},t);return!i.anticlockwise&&(n===1/0||n===-1/0)&&(n*=-1),n},lineIntersection(i,r,e,t,n){return VT(i,r,e,t,n)},pointAlongPathFrom(i,r,e,t){let n=qu.pointOnPath(i,r,t),o=e/i.circumference*2*Math.PI,s=i.anticlockwise?-1:1,a=n.theta+s*o,l=i.cx+i.radius*Math.cos(a),h=i.cy+i.radius*Math.sin(a);return{x:l,y:h}},pointOnPath(i,r,e){if(r===0)return{x:i.x1,y:i.y1,theta:i.startAngle};if(r===1)return{x:i.x2,y:i.y2,theta:i.endAngle};e&&(r=r/length);let t=sD(i,r),n=i.cx+i.radius*Math.cos(t),o=i.cy+i.radius*Math.sin(t);return{x:uv(n),y:uv(o),theta:t}}};sa(rh,qu);var gv={x:[ee,ye],y:[ye,ee]};function mv(i,r){return[i.startStubX,i.startStubY,i.endStubX,i.endStubY]}var nh=new Map;nh.set(Af,mv),nh.set(Sf,mv),nh.set(Tf,(i,r)=>{let e=i,t=e.sourceAxis,n={[ee]:function(){return e.so[t]===1&&(e.startStubX>e.endStubX&&e.tx>e.startStubX||e.sx>e.endStubX&&e.tx>e.sx)||e.so[t]===-1&&(e.startStubX<e.endStubX&&e.tx<e.startStubX||e.sx<e.endStubX&&e.tx<e.sx)},[ye]:function(){return e.so[t]===1&&(e.startStubY>e.endStubY&&e.ty>e.startStubY||e.sy>e.endStubY&&e.ty>e.sy)||e.so[t]===-1&&(e.startStubY<e.endStubY&&e.ty<e.startStubY||e.sy<e.endStubY&&e.ty<e.sy)}};return!r&&n[e.sourceAxis]()?{[ee]:[(i.sx+i.tx)/2,i.startStubY,(i.sx+i.tx)/2,i.endStubY],[ye]:[i.startStubX,(i.sy+i.ty)/2,i.endStubX,(i.sy+i.ty)/2]}[e.sourceAxis]:[i.startStubX,i.startStubY,i.endStubX,i.endStubY]});var ih=new Map;ih.set(Af,(i,r,e,t,n,o,s,a,l,h)=>{let d={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]},u={x:[[i.startStubX,i.endStubX],null,[i.endStubX,i.startStubX]],y:[[i.startStubY,i.endStubY],null,[i.endStubY,i.startStubY]]},p={x:[{x:a,y:i.startStubY},{x:a,y:i.endStubY}],y:[{x:i.startStubX,y:l},{x:i.endStubX,y:l}]},g={x:[{x:i.endStubX,y:i.startStubY}],y:[{x:i.startStubX,y:i.endStubY}]},m={x:[{x:i.startStubX,y:i.endStubY},{x:i.endStubX,y:i.endStubY}],y:[{x:i.endStubX,y:i.startStubY},{x:i.endStubX,y:i.endStubY}]},E={x:[{x:i.startStubX,y:l},{x:i.endStubX,y:l},{x:i.endStubX,y:i.endStubY}],y:[{x:a,y:i.startStubY},{x:a,y:i.endStubY},{x:i.endStubX,y:i.endStubY}]},y={x:[i.startStubY,i.endStubY],y:[i.startStubX,i.endStubX]},x=gv[e][0],f=gv[e][1],b=i.so[x]+1,A=i.to[f]+1,T=i.to[f]===-1&&y[e][1]<y[e][0]||i.to[f]===1&&y[e][1]>y[e][0],S=u[e][b][0],O=u[e][b][1],v=d[e][b][A];if(i.quadrant===v[3]||i.quadrant===v[2]&&T)return p[e];if(i.quadrant===v[2]&&O<S)return g[e];if(i.quadrant===v[2]&&O>=S||i.quadrant===v[1]&&!T)return E[e];if(i.quadrant===v[0]||i.quadrant===v[1]&&T)return m[e]}),ih.set(Sf,(i,r,e,t,n,o,s,a,l,h)=>{let d={[ee]:i.so.x===-1?Math.min(t,o):Math.max(t,o),[ye]:i.so.y===-1?Math.min(t,o):Math.max(t,o)}[e];return{[ee]:[{x:d,y:n},{x:d,y:s},{x:o,y:s}],[ye]:[{x:n,y:d},{x:s,y:d},{x:s,y:o}]}[e]}),ih.set(Tf,(i,r,e,t,n,o,s,a,l,h)=>{let d={[ee]:ye,[ye]:ee}[e],u=e===ee?i.isXGreaterThanStubTimes2:i.isYGreaterThanStubTimes2;if(r.sourceInfo.id===r.targetInfo.id){let p={[ee]:Ve,[ye]:_e}[e],g=n+(1-r.sourcePos[d])*r.sourceInfo[p]+h;return{[ee]:[{x:t,y:g},{x:o,y:g}],[ye]:[{x:g,y:t},{x:g,y:o}]}[e]}else{if(!u||i.so[e]===1&&t>o||i.so[e]===-1&&t<o)return{[ee]:[{x:t,y:l},{x:o,y:l}],[ye]:[{x:a,y:t},{x:a,y:o}]}[e];if(i.so[e]===1&&t<o||i.so[e]===-1&&t>o)return{[ee]:i.sy===i.ty?[{y:i.ty,x:o}]:[{x:a,y:i.sy},{x:a,y:i.ty}],[ye]:i.sx===i.tx?[{x:i.tx,y:o}]:[{x:i.sx,y:l},{x:i.tx,y:l}]}[e]}});function Ev(i,r,e){let t={lastx:null,lasty:null,orthogonalSegments:[]},n=e.targetPos.curX>=e.sourcePos.curX?e.sourcePos.curX:e.targetPos.curX,o=e.targetPos.curY>=e.sourcePos.curY?e.sourcePos.curY:e.targetPos.curY,s=nh.get(r.anchorOrientation)(r,i.alwaysRespectStubs),a=r.sourceAxis===ee?0:1,l=r.sourceAxis===ee?1:0,h=s[a],d=s[l],u=s[a+2],p=s[l+2];th(t,s[0],s[1],r,n,o);let g=r.startStubX+(r.endStubX-r.startStubX)*i.midpoint,m=r.startStubY+(r.endStubY-r.startStubY)*i.midpoint,y=ih.get(r.anchorOrientation)(r,e,r.sourceAxis,h,d,u,p,g,m,Math.max(i.sourceStub,i.targetStub));if(y)for(let x=0;x<y.length;x++)th(t,y[x].x,y[x].y,r,n,o);return th(t,s[2],s[3],r,n,o),th(t,r.tx,r.ty,r,n,o),t.orthogonalSegments}function Qu(i,r){let e=r;return i.smooth===!0&&e.length>=2?hD(i,e).map(n=>Xr(i,n.type,n.segment)):i.cornerRadius!=null&&e.length>1?aD(i,e):e.map(t=>Xr(i,In,t)),i.$pathSegments=e,e}function fv(i){return Math.atan2(i.y1-i.y2,i.x1-i.x2)}function yv(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}function aD(i,r){let e=null,t,n,o;for(let s=0;s<r.length-1;s++){if(e=e||Object.assign({},r[s]),t=Object.assign({},r[s+1]),n=fv(e),o=fv(t),i.cornerRadius>0&&n!==o){let a=Math.min(yv(e),yv(t)),l=Math.min(i.cornerRadius,.99*a/2),h={x:e.x2+l*Math.cos(n),y:e.y2+l*Math.sin(n)},d={x:t.x1-l*Math.cos(o),y:t.y1-l*Math.sin(o)},u=Math.atan((n-o)/(1+n*o)),p=Dt({x:e.x1,y:e.y1},h,1e4),g=Dt({x:t.x1,y:t.y1},d,1e4),m=xl(p,g),E=m!=null?Pe(m,h):0;E>0?(e.x2=h.x,e.y2=h.y,t.x1=d.x,t.y1=d.y,Xr(i,In,Object.assign({},e)),i.slightlyWonky?Xr(i,rh,Object.assign({r:l,cx:m.x,cy:m.y,ac:u>0},e)):Xr(i,rh,{r:E,x1:h.x,y1:h.y,x2:d.x,y2:d.y,cx:m.x,cy:m.y,ac:u>0})):Xr(i,In,Object.assign({},e))}else Xr(i,In,Object.assign({},e));e=t}t!=null&&Xr(i,In,Object.assign({},e))}var lD=(i,r)=>{let e=r.x-i.x,t=r.y-i.y;return{length:Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),angle:Math.atan2(t,e)}},xv=(i,r,e,t,n)=>{let a=lD(r||i,e||i),l=a.angle+(n?Math.PI:0),h=a.length*t,d=i.x+Math.cos(l)*h,u=i.y+Math.sin(l)*h;return{x:d,y:u}};function Cf(i,r){let e=[];for(let t=1;t<i.length;t++){let n=xv(i[t-1],i[t-2],i[t],r),o=xv(i[t],i[t-1],i[t+1],r,!0);e.push({type:ko,segment:{x1:i[t-1].x,y1:i[t-1].y,cp1:n,cp2:o,x2:i[t].x,y2:i[t].y}})}return e}function hD(i,r){let e=[{x:r[0].x1,y:r[0].y1}];for(let t=1;t<r.length;t++)e.push({x:r[t].x1,y:r[t].y1});return e.push({x:r[r.length-1].x2,y:r[r.length-1].y2}),Cf(e,i.smoothing)}function cD(i,r,e){return Pf([{x1:r.sx,y1:r.sy,x2:r.startStubX,y2:r.startStubY},{x1:r.startStubX,y1:r.startStubY,x2:r.endStubX,y2:r.endStubY},{x1:r.endStubX,y1:r.endStubY,x2:r.tx,y2:r.ty}])}function ep(i,r,e,t,n){let o=i.connector;o.lastx=null,o.lasty=null,o.lastOrientation=null;let s=e.sourcePos,a=e.targetPos;return o.$pathSegments=o.geometry.segments,o.constrain===sn?bv(s,a,o,r,e,t,n):dD(s,a,o,r.quadrant,t,n),Qu(o,o.$pathSegments),{segments:o.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function tp(i,r,e){let t=i.connector;return t.lastx=null,t.lasty=null,t.lastOrientation=null,t.constrain===sn?t.$pathSegments=Ev(t,r,e):t.$pathSegments=cD(t,r,e),Qu(t,t.$pathSegments),{segments:t.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function dD(i,r,e,t,n,o){if(o){let s=e.geometry.segments[e.geometry.segments.length-1];s.x2=r.curX,s.y2=r.curY,e.geometry.target.curX=r.curX,e.geometry.target.curY=r.curY}else if(n){let s=e.geometry.segments[0];s.x1=i.curX,s.y1=i.curY,e.geometry.source.curX=i.curX,e.geometry.source.curY=i.curY}e.geometry.quadrant=t,e.$pathSegments=e.geometry.segments}function rp(i,r,e){return{source:la(i.source,r,e),target:la(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e}))}}function Pf(i){return i.length===0?[]:i.filter(r=>!(r.x1===r.x2&&r.y1===r.y2))}var uD=.15,jr="Straight";function ca(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}je.register(jr,{compute:tp,update:ep,create:_f,transformGeometry:rp});function pD(i,r){let e=Object.assign(r,{constrain:sn});return _f(i,e)}je.register(Hi,{compute:tp,update:ep,create:pD,transformGeometry:rp});function gD(i,r){let e=Object.assign(r,{constrain:on,smooth:!0});return _f(i,e)}je.register(rv,{compute:tp,update:ep,create:gD,transformGeometry:rp});function mD(i){return i==null?null:i===AA?sn:i===SA?cd:i}function _f(i,r){let e=mD(r.constrain);r.stub=r.stub==null?e===sn?nv:null:r.stub;let t=Bu(jr,i,r,[0,0]),n=r.midpoint==null||isNaN(r.midpoint)?.5:r.midpoint,o=r.alwaysRespectStubs!==!1,s=r.loopbackRadius||25;return Object.assign(t,{cornerRadius:r.cornerRadius!=null?r.cornerRadius:null,smooth:r.smooth===!0,smoothing:r.smoothing==null?uD:r.smoothing,geometry:{segments:[]},constrain:e==null?on:e,$pathSegments:[],loopbackRadius:s,isLoopbackCurrently:!1,alwaysRespectStubs:o,midpoint:n,lastOrientation:null,lastx:null,lasty:null,slightlyWonky:r.slightlyWonky===!0})}function Sv(i,r,e){Av(1,i,r,e),Av(0,i,r,e)}var ki="x2",Wi="x1",Zi="y1",Ji="y2";function ED(i,r,e){let t=e===i.x1?{value:i.x2,coord:ki,prev:!0}:{value:i.x1,coord:Wi,prev:!0},n=e===r.x1?{value:r.x2,coord:ki,prev:!1}:{value:r.x1,coord:Wi,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function fD(i,r,e){let t=e===i.y1?{value:i.y2,coord:Ji,prev:!0}:{value:i.y1,coord:Zi,prev:!0},n=e===r.y1?{value:r.y2,coord:Ji,prev:!1}:{value:r.y1,coord:Zi,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function yD(i,r){if(r.length<5)return r;function e(d,u,p){let g=p===d.x1?d.x2:d.x1,m=p===u.x1?u.x2:u.x1;if(g>u.x1&&u.x2>g||g>u.x2&&u.x1>g)return g;if(m>d.x1&&d.x2>m||m>d.x2&&d.x1>m)return m}function t(d,u,p){let g=p===d.y1?d.y2:d.y1,m=p===u.y1?u.y2:u.y1;if(g>u.y1&&u.y2>g||g>u.y2&&u.y1>g)return g;if(m>d.y1&&d.y2>m||m>d.y2&&d.y1>m)return m}let n=r[1],o,s,a=Math.max(i.sourceStub,i.targetStub),l=[];for(let d=2;d<r.length-2;d++)if(o=r[d],s=Jo(n)[n.o],o.o!==n.o)if(ca(o)<a){let p=r[d+1];if(Jo(p)[p.o]!==s){let m=Object.assign({},o);if(o.o===pe){let E=ED(n,p,o.x1),y=e(n,p,o.x1);if(y!=null){if(m.x1=y,m.x2=y,E.prev){let x=Object.assign({},n);n.x2===o.x1?x.x2=y:x.x1=y,l.push({start:d-1,segments:[x,m]})}else{let x=Object.assign({},p);p.x1===o.x1?x.x1=y:x.x2=y,l.push({start:d-1,segments:[m,x]})}n=p,d+=1}else n=o}else if(o.o===ne){let E=fD(n,p,o.y1),y=t(n,p,o.y1);if(y!=null){if(m.y1=y,m.y2=y,E.prev){let x=Object.assign({},n);n.y2===o.y1?x.y2=y:x.y1=y,l.push({start:d-1,segments:[x,m]})}else{let x=Object.assign({},p);p.y1===o.y1?x.y1=y:x.y2=y,l.push({start:d-1,segments:[m,x]})}n=p,d+=1}else n=o}}else n=o}else n=o;else n=o;let h=r.slice();for(let d=0;d<l.length;d++)h.splice(l[d].start-d,3,...l[d].segments);return l.length>0?Of(h):h}function Av(i,r,e,t){let n=r.$pathSegments.slice();i===1&&n.reverse();let o=n[0],s=n[n.length-1],a=i===1?r.targetStub:r.sourceStub,l=i===1?t.targetPos.curX:t.sourcePos.curX,h=i===1?t.targetPos.curY:t.sourcePos.curY,d=i===1?e.to:e.so,u=i===1?ki:Wi,p=i===1?Ji:Zi,g=i===1?Wi:ki,m=i===1?Zi:Ji,E=1,y=n.length-2,x=1,f=n[1];o[g]=l+a*d.x,o[m]=h+a*d.y,o[u]=l,o[p]=h,o.o=o.x1===o.x2?"v":"h";let b=Jo(o),A=o.o,T=o.o===ne?pe:ne,S=o.o===ne?[ki,Wi]:[Ji,Zi],O=o.o===ne?[Wi,ki]:[Zi,Ji],v=o.o===ne?[Ji,Zi]:[ki,Wi],_=o.o===ne?[Zi,Ji]:[Wi,ki],P=S[i],I=O[i],C=v[i],R=_[i];if(f!=null)if(f.o===o.o){f[I]=o[P],f[C]=f[R]=o[C];let B=Jo(f)[A],N=Zu(n,x,T,f);if(B!==b[A]){if(N!=null){let M=Zu(n,x,A,N[0]);if(M!=null)n.splice(E,1),M[0][I]=o[P],N[0][P]=o[P],N[0][I]=o[P],N[0][R]=o[C];else{let D=(N[0][C]+N[0][R])/2;N[0][R]=D,f[C]=f[R]=D;let G={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[R]:o[C],[I]:o[P]};n.splice(E,0,G)}}}else if(f[C]=f[R]=o[C],N!=null)N[0][R]=o[C];else if(f[C]!==s[R]){let M={o:f.o==="h"?"v":"h",[P]:f[P],[I]:f[P],[C]:s[C],[R]:f[R]},D=n.length-1;n.splice(D,0,M)}}else{f[R]=o[C],f[P]=f[I]=o[P];let B=Zu(n,x,A,f);if(B!=null){let N=Jo(B[0])[A];B[0][I]=o[P];let M=Jo(B[0])[A];if(N!==M&&B[1]===y){n.splice(B[1],1);let D=(f[C]+f[R])/2;f[R]=D,f[P]=f[I]=s[I];let G={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:D,[R]:D,[I]:o[P]};n.splice(E,0,G);let J={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[R]:o[C],[I]:o[P]};n.splice(E,0,J)}}else{let N=(f[C]+f[R])/2;f[R]=N,f[P]=f[I]=s[I];let M={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:N,[R]:N,[I]:o[P]};n.splice(E,0,M);let D={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[R]:o[C],[I]:o[P]};n.splice(E,0,D)}}let w=yD(r,n);i===1&&w.reverse(),r.$pathSegments=w}function bv(i,r,e,t,n,o,s){let a=e.geometry;if(o||s){let l=i.curX-a.source.curX,h=i.curY-a.source.curY,d=r.curX-a.target.curX,u=r.curY-a.target.curY;if(l===d&&h===u){let p=[];e.$pathSegments.forEach(g=>{let m=Object.assign({},g);m.x1+=l,m.x2+=l,m.y1+=h,m.y2+=h,p.push(m)}),e.$pathSegments=p;return}Sv(e,t,n)}}function xD(i,r,e){let t=i.findIndex(n=>n.x1===r.x1&&n.y1===r.y1&&n.x2===r.x2&&n.y2===r.y2);if(t>-1){let n=i[t].o,o=i[t];return{segment:o,index:t,axis:n,prev:t>1?i[t-1]:null,next:t<i.length-2?i[t+1]:null,left:e?Wu(i,-1,n,o):null,right:e?Wu(i,1,n,o):null}}else return null}function Tv(i,r,e,t,n){let o=xD(r.$pathSegments,e);if(o!=null){o.axis===pe?o.segment.x1=o.segment.x2=t.x:o.segment.y1=o.segment.y2=t.y;let s=o.axis===pe,a=o.index,l=o.index,h=a>1?r.$pathSegments[a-1]:null,d=o.segment;for(;h!=null;)h.o===d.o?s?(h.x1=d.x1,h.x2=d.x2):(h.y1=d.y1,h.y2=d.y2):(h.x2=d.x1,h.y2=d.y1),d=h,a--,h=a>1?r.$pathSegments[a-1]:null;if(d.x1!==r.$pathSegments[0].x2){let g={o:ne,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,g),l++}else if(d.y1!==r.$pathSegments[0].y2){let g={o:pe,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,g),l++}d=o.segment,a=l;let u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;for(;u!=null;)u.o===d.o?s?(u.x1=d.x1,u.x2=d.x2):(u.y1=d.y1,u.y2=d.y2):(u.x1=d.x2,u.y1=d.y2),d=u,a++,u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;let p=r.$pathSegments[r.$pathSegments.length-1];if(d.x2!==p.x1){let g={o:ne,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,g)}else if(d.y2!==p.y1){let g={o:pe,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,g)}if(n!==!0){let g=i.instance.getElement(i.sourceId),m=i.instance.getElement(i.targetId);cv(r,r.$pathSegments,g,m,!1).sourceAdjusted&&(l+=1)}return r.edited=!0,{ctx:o,segments:r.$pathSegments,index:l}}else return null}function Of(i){let r=[lt(i[0])],e=lt(i[i.length-1]),t=i.slice(1,i.length-1).filter(s=>ca(s)>0).map(lt);if(t.length===0)return i;let n=null,o=null;for(let s=0;s<t.length;s++)n==null||o==null?(n=t[s],o=t[s].o):t[s].o===o?(n.y2=t[s].y2,n.x2=t[s].x2):(r.push(n),n=t[s],o=t[s].o);if(r.push(n),r.push(e),r.length===3){let s=r[1],a=s.o,l=Object.assign({},s),h=Object.assign({},s),d=Object.assign({},s);h.o=a===ne?pe:ne,h.x1=l.x1,h.y1=l.y1,h.x2=l.x1,h.y2=l.y1,d.o=a===ne?pe:ne,d.x1=l.x2,d.y1=l.y2,d.x2=l.x2,d.y2=l.y2,r=[r[0],h,l,d,r[2]]}return r}function vv(i){let r=Of(i.$pathSegments);i.$pathSegments=r,i.geometry!=null&&(i.geometry.segments=r)}var np=class extends zt{constructor(e){super();c(this,"$context");this.$context=e||{}}getFromContext(e){return this.$context[e]}ensureContext(e,t){let n=this.$context[e];return n==null&&(n=t(),this.$context[e]=n,this.fire(Ul,{key:e,value:n})),n}updateContext(e,t){this.$context[e]=t,this.fire(Ul,{key:e,value:t})}};var Ki=(e=>(e.SVG="SVG",e.HTML="HTML",e))(Ki||{});var Mn="px",Hr="50px",Pr="block",pt="none",qe="absolute",Rf="fixed",Cv="static",Pv="relative",Dre="data-vjs-group",gt="data-vjs-managed",oh="data-vjs-not-draggable",_v="data-vjs-no-events",Ov="data-vjs-elements-draggable",Lf="tabindex",te="data-vjs-vertex",dn="data-vjs-port",sh="data-vjs-port-id",kr="data-vjs-port-type",ip="data-vjs-edge-type",Rv="data-vjs-source",qo="data-vjs-target",wf="data-vjs-allow-loopback",Df="data-vjs-source-port-id",op="data-vjs-target-port-id",da="data-vjs-source-port",Qo="data-vjs-target-port",qi="data-vjs-source-port-type",Qi="data-vjs-target-port-type",sp="data-vjs-magnet",Qe="data-vjs-edge",ap="data-vjs-overlay-id",Er="*";var ua="vjs-connector",lp="vjs-connector-path",Lv="vjs-connector-outline",wv="vjs-connector-transient",ah="vjs-connected",Nf="vjs-group-collapsed",If="vjs-group-expanded",hp="vjs-toggle-group-collapse",pa="vjs-overlay",lh="vjs-overlay-hide",Dv="vjs-label-overlay",eo="vjs-node",Nv="vjs-port",es="vjs-group",Iv="vjs-dummy-vertex",hh="vjs-selected-connection",to="vjs-selected-element",ga="vjs-edge-delete",cp="vjs-edge-delete-i";var Mf="allowNestedGroups",ch="anchor",dh="anchors",Mv="astarVertexBorder",Vv="astarVertexBuffer",sne="edgesDetachable",dp="connector",Gv="cssClass",$v="edgeRelocateHandleSize",ane="groupSize",Bv="hoverClass",up="hoverPaintStyle",Fv="maxConnections",lne="nodeSize",ts="paintStyle",hne="reattachEdges",Vf="scope",Uv=[.05,3];function Yv(i){return i.type!=null&&i.options!=null}function gi(i){let r=null;return j(i)?r={type:i,options:{}}:r=i,r.options.id=r.options.id||$(),r}var pp="always",ro="hover";function Gf(i,r){let e=i.location==null?.5:i.location;if(r!=null)try{let t=typeof r=="string"?parseFloat(r):r;isNaN(t)||(e=t)}catch(t){}i.location=e}var pi=class{constructor(r,e){this.connection=r;c(this,"id");c(this,"cssClass");c(this,"cs");c(this,"visible",!0);c(this,"location",.5);c(this,"events");c(this,"attributes");c(this,"ignoreTypes",!1);e=e||{},this.id=e.id||$(),this.cssClass=e.cssClass||"",Gf(this,e.location),this.events=e.events||{},this.attributes=e.attributes||{},this.cs=r.instance.$isTouchDevice()?pp:e.visibility||pp,this.cs===ro&&(this.visible=!1)}},Vn=class extends pi{constructor(e,t,n){super(t,n);this.component=t;c(this,"paintStyle");c(this,"$hollow");c(this,"isSimpleShape",!0);n=n||{},this.paintStyle=n.paintStyle||{strokeWidth:1},this.$hollow=n.hollow===!0}$getStyle(e){let t=this.paintStyle.stroke||e.stroke,n=this.$hollow?"none":this.paintStyle.fill||e.stroke,o=this.paintStyle.strokeWidth||e.strokeWidth;return{stroke:t,fill:n,lineWidth:o}}updateFrom(e,t){}};var zv={},at={get:(i,r,e,t)=>{let n=zv[r];if(n)return new n(i,e,t);throw{message:"VisuallyJs: unknown overlay type '"+r+"'"}},register:(i,r)=>{zv[i]=r}};var gp=class gp extends pi{constructor(e,t,n){super(t,n);this.instance=e;this.connection=t;c(this,"label");c(this,"type",gp.type);c(this,"useHTMLElement");c(this,"rotatable");c(this,"font");c(this,"isSimpleShape",!1);n=n||{label:""},this.useHTMLElement=e.containerType!=="SVG"&&n.useHTMLElement===!0,this.font=n.font,this.setLabel(n.label),this.rotatable=n.rotatable}getLabel(){return nn(this.label)?this.label(this):this.label}setLabel(e){this.label=e,this.instance.updateLabel(this)}updateFrom(e,t){e.font!=null&&(this.font=e.font),e.label!=null&&this.setLabel(e.label),e.location!=null&&Gf(this,e.location),$f(this,t)}};c(gp,"type","Label");var fr=gp;function Wr(i){return i.type===fr.type}at.register(fr.type,fr);function $f(i,r){if(r){let e=r.fontSize;e!=null&&(i.font=i.font||{},i.font.size=e);let t=r.fontStyle;t!=null&&(i.font=i.font||{},i.font.style=t);let n=r.fontFamily;n!=null&&(i.font=i.font||{},i.font.family=n)}}var Ff="labelLocation",bD=[ch,dh,"cssClass",dp,ts,up],AD="parent";function mp(i,r){let e=h=>h?r[h]:null,t=(h,d)=>{if(h==null)return null;{let u=h[AD],p;if(Array.isArray(u)?p=u:p=[u],p.find(m=>d.indexOf(m)!==-1))throw new Error("circular view reference");return d.push(...p),p.map(m=>e(m)).filter(m=>m!=null)}},n=(h,d,u)=>{let p=bD.slice();d.mergeStrategy==="override"&&Array.prototype.push.apply(p,["events","overlays"]);let g=Sn(h,d,[],p);return o(t(h,u),g,u)},o=(h,d,u)=>{if(h==null)return d;{let p=d;for(let g=0;g<h.length;g++)p=n(h[g],p,u);return p}},s=h=>{if(h==null)return{};if(typeof h=="string")return e(h);if(h.length){let d=!1,u=0,p;for(;!d&&u<h.length;)p=s(h[u]),p?d=!0:u++;return p}},a=s(i),l=[];return a?o(t(a,l),a,l):{}}function ma(i){return(r,e,t)=>{let n=kc(e,{x:0,y:0,width:1,height:1},i);return Object.assign(n.p,{portId:i[n.idx].portId})}}function Bf(i){i.anchorPositions!=null&&(i.anchorPositionFinder=ma(i.anchorPositions))}var Ep=class{constructor(r,e,t,n){this.model=r;this.viewOptions=t;c(this,"defMap",{nodes:new Map,edges:new Map,groups:new Map,ports:new Map});c(this,"nodes");c(this,"edges");c(this,"groups");c(this,"ports");this.viewOptions=this.viewOptions||{},this.nodes=this.viewOptions.nodes||{},this.edges=this.viewOptions.edges||{},this.ports=this.viewOptions.ports||{},this.groups=this.viewOptions.groups||{};let o,s;function a(l,h){return d=>{l.call(h,{overlay:d.overlay,e:d.e,connection:d.overlay.connection,edge:d.overlay.connection.edge,model:d.overlay.connection.instance.model})}}for(let l in this.viewOptions.edges){if(o=this.getEdgeDefinition(l),o.overlays)for(s=0;s<o.overlays.length;s++){let h=o.overlays[s];if(Yv(h)){let d=h.options;if(d.events!=null)for(let u in d.events){let p=d.events[u];d.events[u]=a(p,h)}}}n.$registerConnectionType(l,o)}}getEdgeDefinition(r){if(r==null)return null;if(this.defMap.edges.has(r))return this.defMap.edges.get(r);{let e=mp([r,be],this.edges);if(e.label!=null){e.overlays=e.overlays||[];let t={type:fr.type,options:{useHTMLElement:e.useHTMLLabel===!0,id:"label",label:e.label,rotatable:e.labelsRotatable}};e.labelClass&&(t.options.cssClass=e.labelClass);let n=e.labelLocationAttribute||Ff;e.labelLocation?t.options.location=e.labelLocation:t.options.location=`{{${n}}}`,e.labelLocationAttribute&&(t.options.labelLocationAttribute=e.labelLocationAttribute),e.labelFont&&(t.options.font=Object.assign({},e.labelFont)),e.overlays.push(t),delete e.label}if(e.deleteButton!=null){e.overlays=e.overlays||[];let t=(e.deleteButtonClass||ga)+" "+cp,n=e.deleteButtonLocation||.1;(Array.isArray(n)?n:[n]).forEach(s=>{e.overlays.push({type:fr.type,options:{location:s,label:"\u2716",cssClass:t,visibility:e.deleteButton===ro?ro:pp}})})}return delete e.parent,this.defMap.edges.set(r,e),e}}getNodeDefinition(r){if(r==null)return null;if(this.defMap.nodes.has(r))return this.defMap.nodes.get(r);{let e=mp([r,be],this.nodes);return delete e.parent,Bf(e),this.defMap.nodes.set(r,e),e}}getPortDefinition(r){if(r==null)return null;if(this.defMap.ports.has(r))return this.defMap.ports.get(r);{let e=mp([r,be],this.ports);return delete e.parent,Bf(e),this.defMap.ports.set(r,e),e}}getGroupDefinition(r){if(r==null)return null;if(this.defMap.groups.has(r))return this.defMap.groups.get(r);{let e=mp([r,be],this.groups);return delete e.parent,Bf(e),this.defMap.groups.set(r,e),e}}getTypeDefinition(r){let e=this.model.getType(r);if(K(r))return this.getNodeDefinition(e);if(Y(r))return this.getGroupDefinition(e);if(H(r))return this.getPortDefinition(e)}};function fp(){return new Set}var Xv=class{constructor(){c(this,"affectedElements",new Set)}};function SD(i){return{id:i,el:null,dirty:!0,x:NaN,y:NaN,width:NaN,height:NaN,modelObject:null,r:0,c:{x:0,y:0},ro:{x:0,y:0},x2:0,y2:0,t:{id:i,c:{x:0,y:0},x:NaN,y:NaN,width:NaN,height:NaN,r:0,x2:0,y2:0,cr:0,sr:0,ro:{x:0,y:0}}}}function TD(i,r,e,t,n,o){let s=o/360*Math.PI*2,a={x:r+t/2,y:e+n/2},l=Math.cos(s),h=Math.sin(s),d=(A,T)=>Me({x:A,y:T},a,o),u=d(r,e),p=d(r+t,e),g=d(r+t,e+n),m=d(r,e+n),E=d(r+t/2,e+n/2),y=Math.min(u.x,p.x,g.x,m.x),x=Math.max(u.x,p.x,g.x,m.x),f=Math.min(u.y,p.y,g.y,m.y),b=Math.max(u.y,p.y,g.y,m.y);return{x:y,y:f,width:x-y,height:b-f,c:E,r:o,x2:x,y2:b,cr:l,sr:h,id:i,ro:{x:y,y:f}}}var yp=(i,r)=>{let e=0;return r.value>i.value?e=-1:r.value<i.value&&(e=1),e},jv=(i,r)=>yp(i,r)*-1;function xp(i,r,e,t,n){yE({id:i,value:r,otherBound:e},t,yp,n)}function no(i,r){let e=r.findIndex(t=>t.id===i);e>-1&&r.splice(e,1)}var bp=class{constructor(r,e){this.instance=r;this.getRenderedElement=e;c(this,"iu",null);c(this,"rtree");c(this,"edgertree");c(this,"Xe",!1);c(this,"il",!0);c(this,"P",{xmin:[],xmax:[],ymin:[],ymax:[]});c(this,"V",{});c(this,"ol",{});c(this,"je",{xmin:0,xmax:0,ymin:0,ymax:0});this.rtree=new Ho(4),this.edgertree=new Ho(4)}setSuspended(r){this.Xe=r,this.Xe||(this.recomputeBounds(),this.sf())}getExtents(){return Object.assign({},this.je)}af(r,e,t){e!=null&&(no(r,this.P.xmin),no(r,this.P.xmax),no(r,this.P.ymin),no(r,this.P.ymax),xp(r,e.t.x,e.t.x2,this.P.xmin,!1),xp(r,e.t.x2,e.t.x,this.P.xmax,!0),xp(r,e.t.y,e.t.y2,this.P.ymin,!1),xp(r,e.t.y2,e.t.y,this.P.ymax,!0),t!==!0&&this.ds())}ds(){this.je.xmin=this.P.xmin.length>0?this.P.xmin[0].value:0,this.je.xmax=this.P.xmax.length>0?this.P.xmax[0].value:0,this.je.ymin=this.P.ymin.length>0?this.P.ymin[0].value:0,this.je.ymax=this.P.ymax.length>0?this.P.ymax[0].value:0}recomputeBounds(){if(this.il){this.il=!1,this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0;for(let r in this.V){let e=this.V[r];this.P.xmin.push({id:r,value:e.t.x,otherBound:e.t.x2}),this.P.xmax.push({id:r,value:e.t.x2,otherBound:e.t.x}),this.P.ymin.push({id:r,value:e.t.y,otherBound:e.t.y2}),this.P.ymax.push({id:r,value:e.t.y2,otherBound:e.t.y})}this.P.xmin.sort(yp),this.P.ymin.sort(yp),this.P.xmax.sort(jv),this.P.ymax.sort(jv),this.ds()}}findVerticesAtPoint(r,e,t,n,o){t=t==null?0:t;let s=[];if(o=o||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(o.indexOf(l.id)===-1&&l.value-t<r&&l.otherBound+t>r){let h=this.V[l.id];if(h.y-t<e&&h.y2+t>e&&(s.push(h),n))return s}}else{let a=this.rtree.search({x:r-t,y:e-t,width:t===0?1:t*2,height:t===0?1:t*2});for(let l=0;l<a.length;l++){let h=a[l].id;if(o.indexOf(h)===-1&&(s.push(this.V[h]),n))return s}}return s}findVerticesIntersectingWithRect(r,e,t,n,o){e=e==null?0:e;let s=[];if(n=n||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(n.indexOf(l.id)===-1&&gE(l.value-e,l.otherBound+e,r.x,r.x+r.width,1)){let d=this.V[l.id];if(gE(d.y-e,d.y2+e,r.y,r.y+r.height,1)&&(s.push(d),t))return s}}else{let a=o?1:0,l=this.rtree.search({x:r.x-e+a,y:r.y-e+a,width:r.width+2*e-2*a,height:r.height+2*e-2*a});for(let h=0;h<l.length;h++){let d=l[h].id;if(n.indexOf(d)===-1&&(s.push(this.V[d]),t))return s}}return s}findConnectorBoundsIntersectingWithRect(r,e,t,n,o){let s=[],a=o?1:0,l=this.edgertree.search({x:r.x-e+a,y:r.y-e+a,width:r.width+2*e-2*a,height:r.height+2*e-2*a});for(let h=0;h<l.length;h++){let d=l[h].id;if(n.indexOf(d)===-1&&(s.push(l[h]),t))return s}return s}findVerticesEnclosedByRect(r,e,t,n,o){let s=r.x+r.width,a=r.y+r.height;return this.findVerticesIntersectingWithRect(r,e,t,n,o).filter(l=>o?r.x<l.x&&r.y<l.y&&s>l.x2&&a>l.y2:r.x<=l.x&&r.y<=l.y&&s>=l.x2&&a>=l.y2)}hasVerticesIntersectingWithRect(r,e,t,n){return this.findVerticesIntersectingWithRect(r,e,!0,t,n).length>0}hasLineOfSight(r,e,t){let n=Hb(r,e/2);return this.rtree.findIntersectionsWithLine(n[0],t).length===0&&this.rtree.findIntersectionsWithLine(n[1],t).length===0}lf(r,e,t){e.t=TD(r,e.x,e.y,e.width,e.height,e.r),this.ol[r]=e.t,this.il=!0,t!==!0&&(this.Xe||this.af(r,e,t)),this.rtree!=null&&e.modelObject!=null&&(this.Xe||this.rtree.update(r,e.t.x,e.t.y,e.t.width,e.t.height,{id:r}))}updateElement(r,e,t,n,o,s,a,l){let h=$s(this.V,r,()=>this.addElement(r,this.getRenderedElement(r),a,{x:e,y:t},{width:n,height:o},s));return h!=null&&(h.dirty=!1,a!=null&&(h.modelObject=a),e!=null&&(h.x=e),t!=null&&(h.y=t),n!=null&&(h.width=n),o!=null&&(h.height=o),h.c.x=h.x+h.width/2,h.c.y=h.y+h.height/2,h.x2=h.x+h.width,h.y2=h.y+h.height,s!=null&&(h.r=s||0),h.r==null||h.r===0?h.ro={x:h.x,y:h.y}:h.ro=Me({x:h.x,y:h.y},h.c,h.r),this.iu==null?this.lf(r,h,l):this.iu.affectedElements.add(r)),h}$updateEdge(r){this.edgertree.update(r.id,r.x,r.y,r.width,r.height)}$removeEdge(r){this.edgertree.removeById(r)}$forEachElement(r){for(let e in this.V)r(this.V[e])}$refreshEveryElement(){for(let r in this.V)this.$refreshElement(r,!0)}$refreshElement(r,e,t,n,o){let s=this.V[r];if(s!=null){let a=n||(this.instance.$_useModelForSizes&&s.modelObject.objectType!==de.objectType?{width:s.width,height:s.height}:this.instance.$getSize(s.el)),l=t&&!isNaN(t.x)&&!isNaN(t.y)?t:null;return l==null&&(l=this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s,a)),this.updateElement(r,l==null?void 0:l.x,l==null?void 0:l.y,a.width,a.height,o,null,e)}else return null}hf(r,e){return this.updateElement(r,null,null,null,null,e,null,!1)}getBoundsWidth(){return this.je.xmax-this.je.xmin}getBoundsHeight(){return this.je.ymax-this.je.ymin}getX(){return this.je.xmin}getY(){return this.je.ymin}setSize(r,e,t){if(this.V[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}$_updatePosition(r,e,t){if(this.V[r]!=null)return this.updateElement(r,e,t,null,null,null,null,!1)}$_updateSize(r,e,t){if(this.V[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}reset(){this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0,this.V={},this.ol={},this.rtree.clear(),this.edgertree.clear(),this.ds()}remove(r){no(r,this.P.xmin),no(r,this.P.xmax),no(r,this.P.ymin),no(r,this.P.ymax),delete this.V[r],delete this.ol[r],this.rtree!=null&&this.rtree.removeById(r),this.ds()}$computeGroupContentExtents(r,e,t,n,o){let s=r.members.map(l=>l.id),a=t!=null?t[r.id]:null;if(a==null){let l=this.instance.viewport.getGroupElement(r.id);o=o||this.instance.$_getGroupContentAreaInfo(r.id),a={x:l.x+o.internalOffset.x,y:l.y+o.internalOffset.y}}return this.$computeExtentsForElementIds(s,e?null:a.x,e?null:a.y,t,n)}$computeExtentsForElementIds(r,e=0,t=0,n,o){let s=1/0,a=-1/0,l=1/0,h=-1/0;return n=n||{},o=o||{},r.forEach(d=>{var p,g,m,E,y,x,f,b;let u=this.getElement(d);if(u!=null){let A=((p=n[u.id])==null?void 0:p.x)||((g=u.t)==null?void 0:g.x)||u.x,T=((m=n[u.id])==null?void 0:m.y)||((E=u.t)==null?void 0:E.y)||u.y,S=((y=o[u.id])==null?void 0:y.width)||((x=u.t)==null?void 0:x.width)||u.width,O=((f=o[u.id])==null?void 0:f.height)||((b=u.t)==null?void 0:b.height)||u.height;s=Math.min(s,A-e),l=Math.min(l,T-t),a=Math.max(a,A-e+S),h=Math.max(h,T-t+O)}}),{xmin:s,xmax:a,ymin:l,ymax:h}}sf(){this.rtree.clear();let r=Object.values(this.V).map(e=>({id:e.id,x:e.t.x,y:e.t.y,width:e.t.width,height:e.t.height,children:[]}));this.rtree.load(r)}getPosition(r){return this.V[r]}getElements(){return this.V}isEmpty(){return Object.keys(this.V).length===0}getElement(r){return this.V[r]}getElementPosition(r){return this.V[r]!=null?ft(this.V[r]):null}getElementSize(r){return this.V[r]!=null?ei(this.V[r]):null}getElementBounds(r){return this.V[r]!=null?Object.assign(ft(this.V[r]),ei(this.V[r])):null}getGroupElement(r){return this.getElement(r)}getNodeElement(r){return this.getElement(r)}addElement(r,e,t,n,o,s){let a=SD(r);a.el=e;let l=Object.assign(a,{connections:[],modelObject:t,visible:!0});if(this.V[r]=l,Y(t)){let g=a;g.collapsed=!1,g.enabled=!0,g.contentArea=this.instance.$getGroupContentAreaElement(e),g.contentAreaOffset=this.instance.$getElementPositionInUIRelativeToParent(g.contentArea)}let h=n==null?{x:0,y:0}:n,d=o==null?{width:0,height:0}:o,u=s==null?0:s,p=this.updateElement(r,h.x,h.y,d.width,d.height,u,t,!0);return p.el=e,l}getTopLevelExtents(){let r=this.instance.model.graph.getTopLevelElements(),e=Object.keys(r);return e.length===0?{xmin:0,xmax:0,ymin:0,ymax:0}:this.$computeExtentsForElementIds(e,0,0,{},{})}};var vD="currentFace",Hv={[_t]:Lt,[Rt]:Ot,[Ot]:Rt,[Lt]:_t},kv={[_t]:Rt,[Rt]:Lt,[Ot]:_t,[Lt]:Ot},Wv={[_t]:Ot,[Rt]:_t,[Ot]:Lt,[Lt]:Rt};function uh(i,r){return i.faces.indexOf(r)!==-1}function CD(i,r){return(i.clockwise?kv:Wv)[r]}function PD(i,r){return(i.clockwise?Wv:kv)[r]}function Uf(i,r,e){let t=()=>uh(i,r)===!0&&!e(r);return i.lockedAxis==null?i.lockedFace==null?t():i.lockedFace===r:i.lockedAxis.indexOf(r)!==-1}function _D(i,r){if(uh(i,r))return r;if(uh(i,Hv[r]))return Hv[r];{let e=CD(i,r);if(uh(i,e))return e;{let t=PD(i,r);if(uh(i,t))return t}}return r}function Zv(i,r,e){let t={type:i,locations:[{x:0,y:0,offx:0,offy:0,ox:0,oy:0}],currentLocation:0,locked:!1,id:$(),cssClass:e.cssClass||"",isContinuous:!0,timestamp:null,faces:e.faces||r,lockedFace:null,lockedAxis:null,clockwise:e.clockwise!==!1,ou:null};return Object.defineProperty(t,vD,{get(){return this.ou},set(n){this.ou=_D(this,n)}}),t}var Jv={Continuous:{faces:[_t,Ot,Lt,Rt]},ContinuousTop:{faces:[_t]},ContinuousRight:{faces:[Rt]},ContinuousBottom:{faces:[Lt]},ContinuousLeft:{faces:[Ot]},ContinuousLeftRight:{faces:[Ot,Rt]},ContinuousTopBottom:{faces:[_t,Lt]}};function OD(i,r){let e=1/0,t=-1;for(let n=0;n<i.locations.length;n++){let o=Math.sqrt(Math.pow(r.x-i.locations[n].x,2)+Math.pow(r.y-i.locations[n].y,2));o<e&&(e=o,t=n,i.currentLocation=n)}return t}var Kv={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},qv={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},Qv={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},eC={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},RD={x:0,y:0,ox:0,oy:-1,offx:0,offy:0},LD={x:1,y:0,ox:1,oy:-1,offx:0,offy:0},wD={x:0,y:1,ox:0,oy:1,offx:0,offy:0},DD={x:1,y:1,ox:0,oy:1,offx:0,offy:0},ND={x:.5,y:.5,ox:0,oy:0,offx:0,offy:0},tC={Top:[Kv],Bottom:[qv],Left:[Qv],Right:[eC],TopLeft:[RD],TopRight:[LD],BottomLeft:[wD],BottomRight:[DD],Center:[ND],AutoDefault:[Kv,Qv,qv,eC]};function rC(i,r){r=r||{};let e=tC[i];if(e!=null)return Yf(i,e.map(n=>Object.assign({iox:n.ox,ioy:n.oy},n)),r,null);let t=Jv[i];if(t!=null)return Zv(i,t.faces,r);throw{message:"VisuallyJs: unknown anchor type '"+i+"'"}}function Yf(i,r,e,t){return{objectType:cf,type:i,locations:r,currentLocation:0,id:$(),isContinuous:!1,isDynamic:r.length>1,isFixed:t!=null,fixedLocation:t,timestamp:null,cssClass:e.cssClass||""}}function nC(i){return i.type==null&&i.x!=null&&i.y!=null&&i.ox!=null&&i.oy!=null}function Ap(i,r,e){let t=St(i);return r!=null&&r<i.length?t.currentLocation=r:e!=null&&OD(t,e),t}function ID(i){return i.objectType===cf}function St(i,r){if(ID(i))return i;if(r!=null&&(isNaN(r.offsetX)&&(r.offsetX=0),isNaN(r.offsetY)&&(r.offsetY=0),isNaN(r.ox)&&(r.ox=0),isNaN(r.oy)&&(r.oy=0)),j(i)){let e=rC(i,null);return r!=null&&(e.fixedLocation=r,e.isFixed=!0),e}else{if(nC(i))return Yf(null,[{x:i.x,y:i.y,ox:i.ox,oy:i.oy,offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY}],{},r);if(Array.isArray(i)){let e=i.map(t=>{if(j(t)){let n=tC[t];return n!=null?Object.assign({iox:n[0].ox,ioy:n[0].oy,cls:""},n[0]):null}else if(nC(t))return Object.assign({iox:t.ox,ioy:t.oy,offx:t.offsetX==null?0:t.offsetX,offy:t.offsetY==null?0:t.offsetY,cls:null},t)}).filter(t=>t!=null);return Yf("Dynamic",e,{},null)}else if(i.type!=null){let e=i;return rC(e.type,e.options)}else throw`Cannot parse anchor specification ${i}`}}var joe="___sourceMarker",Hoe="___targetMarker",Tp="__label",lC="vjs-default-label",iC="overlay",MD="labelLocation";function VD(i,r){let e=null;if(j(r))e=at.get(i.instance,r,i,{});else if(r.type!=null&&r.options!=null){let t=r,n=Object.assign({},t.options);e=at.get(i.instance,t.type,i,n)}else e=r;return e.id=e.id||$(),Ne.cacheTypeItem(i,iC,e,e.id),i.overlays[e.id]=e,e}function ph(i,r){let e=VD(i,r);if(e.type===fr.type&&!j(r)){let t=e,o=r.options.labelLocationAttribute||MD,s=i.edge.data[o];s&&(t.location=s),$f(t,i.edge.data)}return e}function Xf(i,r){return i.overlays[r]}function GD(i){return i.overlays}function $D(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!1)}function BD(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!0)}function rs(i,r,e){let t=i.overlays[r];t&&(i.instance.setOverlayVisible(t,!1),e||i.instance.destroyOverlay(t),delete i.overlays[r],i.overlayPositions&&delete i.overlayPositions[r],i.overlayPlacements&&delete i.overlayPlacements[r])}function koe(i){return Xf(i,Tp)}var oC="add",sC="remove",Sp="anchors",zf="connector";function aC(i,r,e){for(let t in i.overlays)r===oC?i.instance.$addOverlayClass(i.overlays[t],e):r===sC&&i.instance.$removeOverlayClass(i.overlays[t],e)}function hC(i,r,e){let t=null;r.connector!=null&&(t=Ne.getCachedTypeItem(i,zf,e.connector),t==null&&(t=er.su(i,r.connector,e.connector),Ne.cacheTypeItem(i,zf,t,e.connector)),er.setPreparedConnector(i,t)),Ne.applyType(i,r,e);let n={};function o(h,d){let u=h.options;if(d)return d.updateFrom(u,i.edge.data),n[u.id]=!0,i.instance.$reattachOverlay(d,i),d;{let p=Ne.getCachedTypeItem(i,iC,u.id);return p!=null?(i.instance.$reattachOverlay(p,i),p.cs!==ro&&i.instance.setOverlayVisible(p,!0),p.updateFrom(u,i.edge.data),i.overlays[p.id]=p):p=ph(i,h),n[p.id]=!0,p}}if(r.overlays)for(let h in r.overlays)o(r.overlays[h],i.overlays[r.overlays[h].options.id]);if(r.sourceMarker){let h=i.sourceMarker==null?null:i.sourceMarker.id===r.sourceMarker.options.id?i.sourceMarker:null;i.sourceMarker=o(r.sourceMarker,h)}else i.sourceMarker=null;if(r.targetMarker){let h=i.targetMarker==null?null:i.targetMarker.id===r.targetMarker.options.id?i.targetMarker:null;i.targetMarker=o(r.targetMarker,h)}else i.targetMarker=null;for(let h in i.overlays)i.overlays[h].ignoreTypes!==!0&&n[i.overlays[h].id]==null&&rs(i,i.overlays[h].id,!0);r.detachable!=null&&(i.detachable=r.detachable===!0),r.reattach!=null&&(i.reattach=r.reattach===!0),r.scope&&(i.scope=r.scope);let s=null;r.anchor?(s=Ne.getCachedTypeItem(i,Sp,e.anchor),s==null&&(s=[St(r.anchor),St(r.anchor)],Ne.cacheTypeItem(i,Sp,s,e.anchor))):r.anchors&&(s=Ne.getCachedTypeItem(i,Sp,e.anchors),s==null&&(s=[St(r.anchors[0]),St(r.anchors[1])],Ne.cacheTypeItem(i,Sp,s,e.anchors))),s!=null&&(i.anchors.source=s[0],i.anchors.target=s[1]);let a={};i.instance.$_extractSimpleEdgeStyles(r,a)&&i.instance.$_setLineStyle(i,a,!1),i.instance.$applyConnectorType(i.connector,r)}function Zr(i,r){Ne.addClass(i,r),aC(i,oC,r),i.connector&&i.instance.$addConnectorClass(i.connector,r)}function _r(i,r){Ne.removeClass(i,r),aC(i,sC,r),i.connector&&i.instance.$removeConnectorClass(i.connector,r)}var er={getAbsoluteOverlayPosition(i,r){return i.overlayPositions?i.overlayPositions[r.id]:null},setPreparedConnector(i,r,e,t,n){if(i.connector!==r){let o,s="";if(i.connector!=null&&(o=i.connector,s=i.instance.$getConnectorClass(i.connector),i.instance.$destroyConnector(i)),i.connector=r,n&&Ne.cacheTypeItem(i,zf,r,n),Zr(i,s),o!=null){let a=GD(i);for(let l in a)i.instance.$reattachOverlay(a[l],i)}e||i.instance.$paintConnection(i)}},destroy(i){for(let r in i.overlays)i.instance.destroyOverlay(i.overlays[r]);i.overlays={},i.overlayPositions={},i.sourceElement=null,i.targetElement=null,i.instance.$destroyConnector(i),i.connector=null,Ne.destroy(i)},setVisible(i,r){Ne.setVisible(i,r),r?BD(i):$D(i),i.connector&&i.instance.$setConnectorVisible(i.connector,r),i.instance.$paintConnection(i)},su(i,r,e){let t={},n;if(j(r))n=je.get(i,r,t);else{let o=r;n=je.get(i,o.type,Sn(o.options||{},t))}return e!=null&&(n.typeId=e),n},au(i,r,e,t,n){let o=er.su(i,r,n);er.setPreparedConnector(i,o,e,t,n)}};function jf(i){return i==null?null:i.split(" ").filter(r=>r!=null&&r.length>0)}function cC(i,r,e){for(let t in r)i[t]=e}var FD="connector",UD="override",YD="cssClass",dC="__default",zD="anchor",XD="anchors";function vp(i,r){let e={},t=i.$defaultType,n=Object.assign({},t);return cC(e,t,dC),i.$types.forEach(o=>{if(o!==dC){let s=i.instance.$getConnectionType(o);if(s!=null){let a=new Set([FD,zD,XD]);if(s.mergeStrategy===UD)for(let l in s)a.add(l);n=Sn(n,s,[YD],Array.from(a)),cC(e,s,o)}}}),r&&(n=Oo(n,r,"_")),Ea(i)&&hC(i,n,e),e}function Ea(i){return i.objectType===Hf}var Hf="connection";function uC(i,r){let e=i.instance.$getConnectionType(r);e!=null&&e.cssClass&&Ea(i)&&_r(i,e.cssClass)}function Cp(i){if(i.paintStyle&&i.hoverPaintStyle){let r={};Object.assign(r,i.paintStyle),Object.assign(r,i.hoverPaintStyle),i.hoverPaintStyle=r}}var ose="add",sse="remove";function pC(i,r,e){return e=e||{},{cssClass:e.cssClass||"",hoverClass:e.hoverClass||i.defaults.hoverClass,$types:new Set,$typeCache:{},id:e.id||$(),$defaultType:{scope:e.scope||i.defaultScope,overlays:{}},instance:i,deleted:!1,objectType:r,visible:!0,$hover:!1,paintStyle:{},paintStyleInUse:{},hoverPaintStyle:{}}}var Ne={create(i,r,e){e=e||{};let t=e.cssClass||"",n=e.hoverClass||i.defaults.hoverClass,o=new Set,s={},a=e.id||r+new Date().getTime(),l={scope:e.scope||i.defaultScope,overlays:{}};return{cssClass:t,instance:i,hoverClass:n,$types:o,$typeCache:s,$defaultType:l,id:a}},addClass(i,r){let e=(i.cssClass||"").split(" ");e.push(r),i.cssClass=e.join(" ")},removeClass(i,r,e){let t=(i.cssClass||"").split(" ");i.cssClass=t.filter(n=>n!==r).join(" ")},cacheTypeItem(i,r,e,t){i.$typeCache[t]=i.$typeCache[t]||{},i.$typeCache[t][r]=e},hasType(i,r){return i.$types.has(r)},removeType(i,r,e){let t=jf(r),n=!1,o=s=>i.$types.has(s)?(uC(i,s),i.$types.delete(s),!0):!1;if(t!=null){for(let s=0,a=t.length;s<a;s++)n=o(t[s])||n;n&&vp(i,e)}},addType(i,r,e){let t=jf(r),n=!1;if(t!=null){for(let o=0,s=t.length;o<s;o++)i.$types.has(t[o])||(i.$types.add(t[o]),n=!0);n&&vp(i,e)}},getCachedTypeItem(i,r,e){return i.$typeCache[e]?i.$typeCache[e][r]:null},setPaintStyle(i,r){i.paintStyle=r,i.paintStyleInUse=i.paintStyle,Cp(i)},setHoverPaintStyle(i,r){i.hoverPaintStyle=r,Cp(i)},getType(i){return Array.from(i.$types.keys())},clearTypes(i,r){i.$types.forEach(e=>{uC(i,e)}),i.$types.clear(),vp(i,r)},setType(i,r,e){return Ne.clearTypes(i),(jf(r)||[]).forEach(i.$types.add,i.$types),vp(i,e)},applyType(i,r,e){Ne.setPaintStyle(i,r.paintStyle),Ne.setHoverPaintStyle(i,r.hoverPaintStyle),i.paintStyleInUse=i.paintStyle},appendToDefaultType(i,r){Object.assign(i.$defaultType,r)},destroy(i){i.deleted=!0,delete i.instance},setVisible(i,r){i.visible=r}};function gC(i,r){return r.theta-i.theta}function mC(i,r){let e=i.theta<0?-Math.PI-i.theta:Math.PI-i.theta,t=r.theta<0?-Math.PI-r.theta:Math.PI-r.theta;return e-t}var EC={[_t]:mC,[Rt]:gC,[Lt]:gC,[Ot]:mC};function fC(i,r,e,t,n){let o=e?i.width:i.height,s=e?i.height:i.width,a=[],l=o/(r.length+1);for(let h=0;h<r.length;h++){let d=(h+1)*l,u=t*s;n&&(d=o-d);let p=e?d:u,g=i.x+p,m=i.width===0?0:p/i.width,E=e?u:d,y=i.y+E,x=i.height===0?0:E/i.height;if(i.r!==0&&i.r!=null){let f=Me({x:g,y},i.c,i.r);g=f.x,y=f.y}a.push({x:g,y,xLoc:m,yLoc:x,c:r[h].c,a:r[h].anchor})}return a}function ns(i){return!i.isFixed&&i.isContinuous===!0}function yC(i){return[i.currentLocation,i.locations[i.currentLocation]]}function Cse(i,r,e,t,n){let o={x:i.x+t*r,y:i.y+t*e},s=Dt(i,o,n),a=Dt(o,i,n),l=Math.min(s[0].x,s[1].x,a[0].x,a[1].x),h=Math.max(s[0].x,s[1].x,a[0].x,a[1].x),d=Math.min(s[0].y,s[1].y,a[0].y,a[1].y),u=Math.max(s[0].y,s[1].y,a[0].y,a[1].y);return{x:l,y:d,width:h-l,height:u-d}}function Pp(i,r,e,t){let n,o=t.rotation,s={curX:r.x+i.x*e.width+(isNaN(i.offsetX)?0:i.offsetX),curY:r.y+i.y*e.height+(isNaN(i.offsetY)?0:i.offsetY),x:i.x,y:i.y,ox:i.ox,oy:i.oy};if(o!=null&&o.length>0&&!(o.length===0&&o[0].r===0)){let a=[i.ox,i.oy],l={x:s.curX,y:s.curY,cr:0,sr:0};o.forEach(h=>{l=Me(l,h.c,h.r),a=[Math.round(a[0]*l.cr-a[1]*l.sr),Math.round(a[1]*l.cr+a[0]*l.sr)].slice()}),n={curX:l.x,curY:l.y,x:i.x,y:i.y,ox:a[0],oy:a[1]}}else n=Object.assign({},s);return n}function xC(i,r,e,t,n,o,s,a){let l=Ir(r),h=WA(r),d=s(e,t,l,h);d.sort((p,g)=>{let m=p.axis===l&&p.directionFromParent===r.directionFromParent,E=p.axis===l&&p.directionFromParent!==r.directionFromParent,y=g.axis===l&&g.directionFromParent===r.directionFromParent,x=g.axis===l&&g.directionFromParent!==r.directionFromParent;return m||x?-1:y||E?1:0});let u=[];for(let p=0;p<d.length;p++){let g=d[p],m=e+g.dx,E=t+g.dy,y=g.axis,x=g.directionFromParent,f=r.ax+g.dx*n,b=r.ay+g.dy*n,A=i.getCell(m,E,null,null),T=A===a,S={cx:m,cy:E,obj:A,axis:y,directionFromParent:x,ax:f,ay:b,g:r.g+(m-r.x===0||E-r.y===0?1:Math.SQRT2),obstacles:A.obstacles,buffers:A.buffers,isTarget:T};if(A===a)return[S];u.push(S)}return u}function kf(i){let r=[],e=Ir(i),t=i,n=!1,o=0;for(;!n&&t!=null;)r.push(t),o++,Ir(t)!==e&&(n=!0),t=t.parent;return r.length===0?null:{source:i,target:r[r.length-1],isFirstSegment:r[r.length-1].parent==null,axis:Ir(i),length:o}}function jD(i){return i.axis===Cn||i.axis===ii}function HD(i){return i.axis===pe&&i.source.ax===i.target.ax||i.axis===ne&&i.source.ay===i.target.ay}function bC(i,r,e){r.push({ax2:i.source.ax,ay2:i.source.ay,ax1:i.target.ax,ay1:i.target.ay,axis:i.axis,pathId:e})}function kD(i,r,e){if(jD(i)||HD(i))bC(i,r,e);else{let t=i.axis===ne?(i.source.ax+i.target.ax)/2:i.source.ax,n=i.axis===pe?(i.source.ay+i.target.ay)/2:i.source.ay,o=i.axis===ne?(i.source.ax+i.target.ax)/2:i.target.ax,s=i.axis===pe?(i.source.ay+i.target.ay)/2:i.target.ay,a=i.axis===pe?ne:pe,l={ax2:i.source.ax,ay2:i.source.ay,ax1:t,ay1:n,axis:i.axis,pathId:e};r.push(l);let h={ax2:t,ay2:n,ax1:o,ay1:s,axis:a,pathId:e};r.push(h);let d={ax2:o,ay2:s,ax1:i.target.ax,ay1:i.target.ay,axis:a,pathId:e};r.push(d)}}function AC(i,r,e){if(e===ne)return[{x:i-50,y:r},{x:i+50,y:r}];if(e===pe)return[{x:i,y:r-50},{x:i,y:r+50}];if(e===Cn)return[{x:i+50,y:r+50},{x:i-50,y:r-50}];if(e===ii)return[{x:i-50,y:r+50},{x:i+50,y:r-50}]}function Wf(i,r,e,t,n,o){let s=i,a=[];n=n||$();let l=kf(s);if(l.isFirstSegment)t===on?bC(l,a,n):kD(l,a,n);else{let d=l.source.ax,u=l.source.ay,p=!1,g=kf(l.target);for(;!p&&g!=null;){let m=AC(d,u,l.axis),E;E=AC(g.isFirstSegment?g.target.ax:g.target.cx,g.isFirstSegment?g.target.ay:g.target.cy,g.axis);let y=jb(m,E);y!=null&&(a.push({ax1:y.x,ay1:y.y,ax2:d,ay2:u,axis:l.axis,pathId:n}),d=y.x,u=y.y,l=g),g.isFirstSegment?p=!0:g=kf(g.target)}g!=null&&a.push({ax1:g.target.ax,ay1:g.target.ay,ax2:d,ay2:u,pathId:n,axis:g.axis})}return a.reverse(),{id:n,segments:a,targetCell:i,sourceCell:r,isEmpty:a.length===0}}function SC(i,r,e,t,n,o){let s=Wf(i,r,e,t,o,!1);if(s.segments.length<2)return s;let a=[],l=0,h=!1;function d(u){let p={x:s.segments[u].ax1,y:s.segments[u].ay1},g=u+1,m=!1;for(;!m;){let E=s.segments[g];if(E==null||!n(e,[p,{x:E.ax2,y:E.ay2}]))return{startIdx:u,endIdx:g-1,segment:{ax1:p.x,ay1:p.y,ax2:s.segments[g-1].ax2,ay2:s.segments[g-1].ay2},finished:E==null};g++}}for(;!h;){let u=d(l);a.push(u.segment),u.finished?h=!0:l=u.endIdx+1}return{targetCell:s.targetCell,sourceCell:s.sourceCell,isEmpty:s.isEmpty,segments:a,id:s.id}}function TC(i,r,e,t,n,o,s,a,l,h,d,u,p,g,m,E,y){E==null?E=new Hs(i,r,s,h,d,u):E.reinitialize();let x=E.Ko(i.x,i.y),f=E.Ko(r.x,r.y),b=GE(n);b.axis==null&&(b.axis=kA(i,r));let A=GE(o),T=E.setSourceCell(e,x.x,x.y,i.x,i.y,b.axis,b.direction),S=E.setTargetCell(t,f.x,f.y,r.x,r.y,A.axis,A.direction);if(S.x===T.x&&S.y===T.y)return{targetCell:S,sourceCell:T,segments:[],id:ME,isEmpty:!0};S.fixedAxis=S.fixedAxis||b.axis;let O=T,v=S,_=()=>a===on?SC(v,O,E,a,m,y):Wf(v,O,E,a,y,!0),P=new wd,I=new Vs(P.sort.bind(P),T),C,R,w=jc(T.x,T.y,S.x,S.y)*100,B=0;for(;I.length>0;){if(C=I.pop(),C.closed=!0,R=Ir(C),B++,B>w)throw`too many iterations ${B} `;if(C===S)return _();P.node=C;let N=xC(E,C,C.x,C.y,s,u,g,S);for(let M=0,D=N.length;M<D;M++){let G=N[M];if(G.isTarget)return G.obj.parent=C,_();if(G.obj.closed||G.obj===T||G.obj===S||G.obstacles.length>0||G.buffers.length>0)continue;let J=0;G.axis!==R&&(J=.5),(!G.obj.opened||G.g<G.obj.g)&&(G.obj.g=G.g,G.obj.h=l(G.cx,G.cy,S.x,S.y)+J,G.obj.f=G.obj.g+G.obj.h,G.obj.parent=C,G.obj.ax=G.ax,G.obj.ay=G.ay,G.obj.opened?I.update(G.obj):(I.add(G.obj),G.obj.opened=!0))}}return{targetCell:S,sourceCell:T,segments:[],id:ME,isEmpty:!0}}function vC(i,r,e,t,n,o,s,a,l,h,d,u,p,g){return TC(i,r,e,t,n,o,a,l,h,d,u,s.findVerticesAtPoint.bind(s),s.findVerticesIntersectingWithRect.bind(s),(m,E,y,x)=>{if(l===on||l==null)return VE(m,E,y,x);if(l===cd)return VE(m,E,y,x);if(l===sn)return jA(m,E,y,x)},(m,E)=>{let y=a*d;return s.hasLineOfSight(E,y,m.sourceAndTargetObstacles)},p,g)}var WD=10;function ZD(i,r,e,t,n,o,s){let a=t.x+i.x*n.width,l=t.y+i.y*n.height;if(o!=null&&o.length>0){let h=tA([a,l,0,0],o);a=h.x,l=h.y}return Math.sqrt(Math.pow(r-a,2)+Math.pow(e-l,2))}var gh=class{constructor(r,e){this.instance=r;c(this,"lu");c(this,"$anchorLists",new Map);c(this,"hu");c(this,"Ii");c(this,"Vi");c(this,"Mi");c(this,"us",new Map);c(this,"cu",null);c(this,"Et");e=e||{},this.Ii=e.gridCellSize||WD,this.hu=e.avoidVertices===!0,this.Vi=e.vertexBuffer||2,this.Mi=e.vertexBorder||2}$computePath(r,e){let t=this.instance.viewport.getPosition(r.sourceId),n=this.instance.viewport.getPosition(r.targetId),o=r.connector,s=ft(t),a=ei(t),l=ft(n),h=ei(n),d=this.instance.$getRotations(r.sourceId),u=this.instance.$getRotations(r.targetId);if(H(t.modelObject)){let x=this.instance.getElement(t.modelObject.parent.id);if(x.r!==0){let f={x:s.x+a.width/2,y:s.y+a.height/2},b=Me(f,x.c,x.r);s.x=b.x-a.width/2,s.y=b.y-a.height/2,d.pop(),d.push({r:x.r,c:b})}}if(H(n.modelObject)){let x=this.instance.getElement(n.modelObject.parent.id);if(x.r!==0){let f={x:l.x+h.width/2,y:l.y+h.height/2},b=Me(f,x.c,x.r);l.x=b.x-h.width/2,l.y=b.y-h.height/2,u.pop(),u.push({r:x.r,c:b})}}let p=this.du(r.anchors.source,{xy:s,wh:a,elementId:t.id,timestamp:e,rotation:d,txy:l,twh:h}),g=this.du(r.anchors.target,{xy:l,wh:h,elementId:n.id,timestamp:e,rotation:u,txy:s,twh:a});JT(r.connector);let m={sourcePos:p,targetPos:g,strokeWidth:r.paintStyleInUse.strokeWidth,sourceInfo:t,targetInfo:n};o.paintInfo=bf(o,m),yf(o),o.x=o.paintInfo.x,o.y=o.paintInfo.y,o.quadrant=o.paintInfo.quadrant;let E=o.geometry==null||o.geometry.source==null?!1:!vf(p,o.geometry.source),y=o.geometry==null||o.geometry.target==null?!1:!vf(g,o.geometry.target);if(this.instance.$_discardEdgeEditsOnDrag&&(E||y)&&ji(r),o.edited){let x=this.df(r,o,m,e,E,y);je.setGeometry(r,x,!1)}else{let x=this.uf(r,o,m,e);je.setGeometry(r,x,!0)}xf(o),o.width=Math.max(10,o.bounds.xmax-o.x),o.height=Math.max(10,o.bounds.ymax-o.y)}$connectionDetachedFromElement(r,e){this.pf(r,e)}$connectionRemoved(r){ns(r.connection.anchors.source)&&this.uu(r.connection.sourceId,r.connection.anchors.source),ns(r.connection.anchors.target)&&this.uu(r.connection.targetId,r.connection.anchors.target)}$elementRemoved(r){r!=null&&this.$anchorLists.delete(r.id)}$redrawConnections(r,e){let t=new Set,n=new Set;if(!this.instance.yt){e=e||$();let o={};for(let s=0;s<r.length;s++){let a=r[s];if(a.visible===!1)continue;t.add(a);let l=a.sourceId,h=a.targetId,d=ns(a.anchors.source),u=ns(a.anchors.target);if(d||u){let p=(a.anchors.source.faces||[]).join("-"),g=(a.anchors.target.faces||[]).join("-"),m=[l,p,h,g].join("-"),E=o[m];d&&!this.$anchorLists.has(l)&&this.$anchorLists.set(l,{top:[],right:[],bottom:[],left:[]}),u&&!this.$anchorLists.has(h)&&this.$anchorLists.set(h,{top:[],right:[],bottom:[],left:[]});let y=this.instance.viewport.getPosition(h),x=this.instance.viewport.getPosition(l);if(h===l&&(d||u))this.ps(l,a.anchors.source,-Math.PI/2,0,a,h,0,!1,Te,t),this.ps(h,a.anchors.target,-Math.PI/2,0,a,l,1,!1,Te,t);else{let f=this.instance.$getRotations(l),b=this.instance.$getRotations(h);E||(E=this.mf(l,h,x,y,a.anchors.source,a.anchors.target,f,b,a,a.connector.sourceStub+a.connector.targetStub,e,m),o[m]=E),d&&this.ps(l,a.anchors.source,E.theta,0,a,h,0,!1,E.a[0],t),u&&this.ps(h,a.anchors.target,E.theta2,-1,a,l,1,!0,E.a[1],t)}d&&n.add(l),u&&n.add(h)}}n.forEach(s=>{this.gf(s,this.$anchorLists.get(s))})}return t}$reset(){this.$anchorLists.clear(),this.us.clear()}pf(r,e){let t=this.$anchorLists.get(e.id),n=0;t!=null&&function(o){if(o){let s=a=>a.c.id===r.id;Nt(o.top,s),Nt(o.left,s),Nt(o.bottom,s),Nt(o.right,s),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t),n===0&&this.$anchorLists.delete(e.id)}Ef(r,e){let t;if(r.isFixed&&r.fixedLocation!=null)t=Pp(r.fixedLocation,e.xy,e.wh,e);else{let n=e.xy,o=e.wh,s=e.txy,a=e.twh,[l,h]=yC(r);if(r.locations.length===1||s==null||a==null)t=Pp(h,n,o,e);else{let[d,u]=this.ff(n,o,s,a,e.rotation,e.tRotation,r.locations,e.otherAnchor);d!==l&&(r.currentLocation=d),t=Pp(u,n,o,e)}}return t.curX=Wo(t.curX),t.curY=Wo(t.curY),r.computedPosition=t,t}gf(r,e){let t=this.instance.viewport.getPosition(r),n=(o,s,a,l,h,d)=>{if(a.length>0){let u=a.sort(EC[o]),p=o===yt||o===Te,g=fC(t,u,l,h,p);for(let m=0;m<g.length;m++)g[m].a.locations[0]={x:g[m].xLoc,y:g[m].yLoc,ox:d.x,oy:d.y,offsetX:0,offsetY:0},g[m].a.currentLocation=0}};n(ht,t,e.bottom,!0,1,{x:0,y:1}),n(Te,t,e.top,!0,0,{x:0,y:-1}),n(Ze,t,e.left,!1,0,{x:-1,y:0}),n(yt,t,e.right,!1,1,{x:1,y:0})}ps(r,e,t,n,o,s,a,l,h,d){this.$anchorLists.has(r)||this.$anchorLists.set(r,{top:[],right:[],bottom:[],left:[]});let u=this.$anchorLists.get(r),p=-1,g=-1,m={theta:t,order:n,c:o,elId:s,anchor:e},E=u[h],y=e.currentFace?u[e.currentFace]:null,x;if(y){let f=y.findIndex(b=>b.anchor.id===e.id);if(f!==-1){y.splice(f,1);for(let b=0;b<y.length;b++)x=y[b].c,x.placeholder!==!0&&d.add(x)}}for(let f=0;f<E.length;f++)x=E[f].c,x.placeholder!==!0&&d.add(x);if(p!==-1)E[p]=m;else{let f=l?g!==-1?g:0:E.length;E.splice(f,0,m)}e.currentFace=h}uu(r,e){let t=this.$anchorLists.get(r),n=0;t!=null&&function(o,s){if(o){let a=l=>l.anchor.id===s;Nt(o.top,a),Nt(o.left,a),Nt(o.bottom,a),Nt(o.right,a),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t,e.id),n===0&&this.$anchorLists.delete(r)}du(r,e){let t=this.Ef(r,e);return r.computedPosition=t,r.timestamp=e.timestamp,t}uf(r,e,t,n){return this.hu||r.avoidVertices?this.yf(r,e,t,n):this.ms(r,e,t)}df(r,e,t,n,o,s){return je.update(r,e.paintInfo,t,o,s)}ms(r,e,t){return je.compute(r,e.paintInfo,t)}yf(r,e,t,n){if(e.edited)this.ms(r,e,t);else{let o=e,s=CC(t.sourcePos,e.sourceGap),a=CC(t.targetPos,e.targetGap),l={x:s.curX+e.sourceStub*s.ox,y:s.curY+e.sourceStub*s.oy},h={x:a.curX+e.targetStub*a.ox,y:a.curY+e.targetStub*a.oy},d=Math.min(l.x,h.x),u=Math.max(l.x,h.x),p=Math.min(l.y,h.y),g=Math.max(l.y,h.y),m={x:d,y:p,width:Math.max(u-d,10),height:Math.max(g-p,10)};if(!this.instance.viewport.hasVerticesIntersectingWithRect(m,0,[],!1))return this.ms(r,e,t);(this.Et==null||n!==this.lu)&&(this.Et=new Hs(l,h,this.Ii,this.Mi,this.Vi,(E,y,x)=>this.instance.viewport.findVerticesAtPoint(E,y,x))),this.lu=n;try{let E=r.edge?r.edge.id:r.id,y=vC(l,h,r.sourceId,r.targetId,s,a,this.instance.viewport,this.Ii,o.constrain,jc,this.Mi,this.Vi,this.Et,E);if(y.isEmpty)je.compute(r,e.paintInfo,t);else{y.segments.unshift({ax1:s.curX,ay1:s.curY,ax2:l.x,ay2:l.y,axis:js(s.ox,s.oy),pathId:E}),y.segments.push({ax1:h.x,ay1:h.y,ax2:a.curX,ay2:a.curY,axis:js(a.ox,a.oy),pathId:E});let x=Pf(y.segments.map(b=>Object.assign({x1:b.ax1,y1:b.ay1,x2:b.ax2,y2:b.ay2,o:b.axis||JD(b)},b)));return Qu(r.connector,x),{segments:o.$pathSegments,source:t.sourcePos,target:t.targetPos,quadrant:e.paintInfo.quadrant}}}catch(E){return this.ms(r,e,t)}}}mf(r,e,t,n,o,s,a,l,h,d,u,p){if(u===this.cu){let v=this.us.get(p);if(v!=null)return v}else this.us.clear();this.cu=u;let g={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"};if(r===e)return{orientation:g.IDENTITY,a:[Te,Te]};let m=Math.atan2(n.c.y-t.c.y,n.c.x-t.c.x),E=Math.atan2(t.c.y-n.c.y,t.c.x-n.c.x),y=[],x={};((v,_)=>{for(let P=0;P<v.length;P++)if(x[v[P]]={[Ze]:{x:_[P][0].x,y:_[P][0].c.y},[yt]:{x:_[P][0].x+_[P][0].width,y:_[P][0].c.y},[Te]:{x:_[P][0].c.x,y:_[P][0].y},[ht]:{x:_[P][0].c.x,y:_[P][0].y+_[P][0].height}},_[P][1]!=null&&_[P][1].length>0)for(let I in x[v[P]])x[v[P]][I]=rA(x[v[P]][I],_[P][1])})([it,Pn],[[t,a],[n,l]]);let f=[Te,Ze,yt,ht];for(let v=0;v<f.length;v++)for(let _=0;_<f.length;_++)y.push({source:f[v],target:f[_],dist:Math.round(Pe(x.source[f[v]],x.target[f[_]]))});y.sort(function(v,_){if(v.dist<_.dist)return-1;if(_.dist<v.dist)return 1;{let P={[Ze]:0,[Te]:1,[yt]:2,[ht]:3},I=P[v.source],C=P[_.source],R=P[v.target],w=P[_.target];return I<C?-1:C<I?1:R<w?-1:w<R?1:0}});let b=y[0].source,A=y[0].target,T={},S={};for(let v=0;v<y.length;v++){let _=y[v];if(!ns(o)||Uf(o,_.source,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(T[P]==null){let I=h.connector.sourceGap+h.connector.sourceStub,C=df[P],R=this.Ii*(this.Mi+this.Vi),w={x:x.source[P].x+I*C.x,y:x.source[P].y+I*C.y,width:Math.max(1,Math.abs(R*C.x)),height:Math.max(1,Math.abs(R*C.y))};T[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[r],!1)}return T[P]})?b=y[v].source:b=null,!ns(s)||Uf(s,_.target,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(S[P]==null){let I=h.connector.targetGap+h.connector.targetStub,C=df[P],R=this.Ii*(this.Mi+this.Vi),w={x:x.target[P].x+I*C.x,y:x.target[P].y+I*C.y,width:Math.max(1,Math.abs(R*C.x)),height:Math.max(1,Math.abs(R*C.y))};S[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[e],!1)}return S[P]})?A=y[v].target:A=null,b!=null&&A!=null)break}b==null&&(b=y[0].source),A==null&&(A=y[0].target);let O={a:[b,A],theta:m,theta2:E};return this.us.set(p,O),O}ff(r,e,t,n,o,s,a,l){if(l!=null){let h=a.map((p,g)=>{let m=r.x+p.x*e.width,E=r.y+p.y*e.height;return{x:m,y:E,idx:g}}),d=l.locations.map((p,g)=>{let m=t.x+p.x*n.width,E=t.y+p.y*n.height;return{idx:g,x:m,y:E}}),u=[];for(let p=0;p<h.length;p++)for(let g=0;g<d.length;g++){let m=Math.round(Pe(h[p],d[g]));u.push({d:m,idx:p,idx2:g})}return u.sort((p,g)=>p.d-g.d),[u[0].idx,a[u[0].idx]]}else{let h=t.x+n.width/2,d=t.y+n.height/2,u=a.map((p,g)=>({d:ZD(p,h,d,r,e,o,s),idx:g}));return u.sort((p,g)=>p.d-g.d),[u[0].idx,a[u[0].idx]]}}};c(gh,"type",be);function JD(i){return i.axis!=null?i.axis:i.ax1===i.ax2?pe:i.ay1===i.ay2?ne:null}function CC(i,r){return{curX:i.curX+i.ox*r,curY:i.curY+i.oy*r,ox:i.ox,oy:i.oy,x:i.x,y:i.y}}var PC="fill",Zf="stroke",_C="stroke-width",Sle="strokeWidth",we="svg",OC="defs",q="path",Fe="circle",RC="ellipse",et="text",Jf="tspan",Z="rect",Q="g",Tle="version",vle="xmlns",LC="fill",Kf="stroke-dasharray",Cle="stroke-linejoin",Ple="stroke-linecap",_le="stroke-miterlimit",Ole="stroke-dashoffset",Rle="stroke-opacity",Lle="stroke",wle="stroke-width",_p="vector-effect",Op="non-scaling-stroke",Dle="text-anchor",Gt="http://www.w3.org/2000/svg",Nle="http://www.w3.org/1999/xlink",Ile="http://www.w3.org/1999/xhtml";var Rp=class{constructor(r,e){c(this,"$properties");c(this,"$values");this.$values=e||{},this.$properties=Object.keys(e),r.bindAll([Le,ve],t=>{this.$properties.forEach(n=>{t.updates[n]!=null&&(this.$values[n]=t.updates[n])})})}getValue(r,e){return this.$values[r]||e}getValues(){return Object.assign({},this.$values)}};var KD=.5;function wC(i,r){var b,A;let e=pC(i,Hf,r),t=r.overlays||[],n={},o=i.$defaultOverlays;o&&t.push(...o);for(let T=0;T<t.length;T++){let S=gi(t[T]);n[S.options.id]=S}if(e.$defaultType.overlays=n,r.label&&(e.$defaultType.overlays[Tp]={type:fr.type,options:{label:r.label,useHTMLElement:r.useHTMLLabel===!0,location:r.labelLocation||KD,id:Tp,cssClass:lC,rotatable:r.labelsRotatable}}),r.sourceMarker){let T=gi(r.sourceMarker);T.options.location=0,T.options.direction=-1,T.sourceMarker=!0,e.$defaultType.sourceMarker=T}if(r.targetMarker){let T=gi(r.targetMarker);T.options.location=1,T.options.direction=1,T.targetMarker=!0,e.$defaultType.targetMarker=T}let s=r.source,a=r.target,l=(r.anchors?r.anchors[0]:r.anchor)||i.$defaultAnchors[0]||i.$defaultAnchor,h=(r.anchors?r.anchors[1]:r.anchor)||i.$defaultAnchors[1]||i.$defaultAnchor,d=(b=r.edge.anchors)==null?void 0:b.source,u=(A=r.edge.anchors)==null?void 0:A.target,p=St(l,d),g=St(h,u),m=i.$_edgesDetachable;r.detachable===!1&&(m=!1);let E=i.$_reattachEdges===!0,y=Ks({},r.paintStyle||i.defaults.paintStyle);Ne.appendToDefaultType(e,{detachable:m,reattach:E,paintStyle:y,hoverPaintStyle:Ks({},r.hoverPaintStyle||i.defaults.hoverPaintStyle)}),r.outlineWidth&&(y.outlineWidth=r.outlineWidth),r.outlineColor&&(y.outlineStroke=r.outlineColor),r.lineWidth&&(y.strokeWidth=r.lineWidth),r.color&&(y.stroke=r.color),r.gradient&&(y.gradient=r.gradient),r.dashArray&&(y.dashArray=r.dashArray);let x=Object.assign(e,{anchorDefs:{source:l,target:h},anchors:{source:p,target:g},sourceId:r.edge.source.getFullId(),sourceElement:s,targetId:r.edge.target.getFullId(),targetElement:a,scope:r.scope,lastPaintedAt:null,visible:!0,paintStyle:r.paintStyle,hoverPaintStyle:r.hoverPaintStyle,detachable:m,reattach:E,edge:r.edge,suspendedElement:null,suspendedElementId:null,suspendedElementType:null,suspendedEndpoint:null,suspendedIndex:null,overlays:{},overlayPlacements:{},overlayPositions:{},connector:null,proxies:{[it]:[],[Pn]:[]},avoidVertices:r.avoidVertices===!0,sourceMarker:null,targetMarker:null});er.au(x,r.connector||i.$defaultConnector,!0);let f=[be,r.type].join(" ");return/[^\s]/.test(f)&&Ne.addType(x,f,r.data),x}var mh=class{constructor(r){c(this,"grid");c(this,"snap",!1);c(this,"fitGroupsToGrid",!1);r!=null&&(this.snap=r.snap===!0,this.grid=r.size,this.fitGroupsToGrid=r.fitGroupsToGrid!==!1)}};var Lp=class{constructor(r){c(this,"afterGroupCollapse");c(this,"afterGroupExpand");c(this,"afterGroupResize");c(this,"afterGroupShrink");c(this,"afterGroupGrow");c(this,"afterLayout");c(this,"afterDrag");c(this,"constant");c(this,"trackback");c(this,"trackbackThreshold");c(this,"constrainToViewport");c(this,"repositionDraggedElement");c(this,"grid");r=r||{},this.afterDrag=r.afterDrag===!0,this.constant=r.constant===!0,this.trackback=r.trackback!==!1,this.trackbackThreshold=r.trackbackThreshold,this.constrainToViewport=r.constrainToViewport===!0,this.repositionDraggedElement=r.repositionDraggedElement===!0,this.afterLayout=r.afterLayout===!0,this.afterGroupResize=r.afterGroupResize===!0,this.afterGroupShrink=r.afterGroupShrink===!0||this.afterGroupResize&&r.afterGroupShrink!==!1,this.afterGroupGrow=r.afterGroupGrow===!0||this.afterGroupResize&&r.afterGroupGrow!==!1,this.afterGroupCollapse=r.afterGroupCollapse===!0,this.afterGroupExpand=r.afterGroupExpand===!0,this.constant&&this.afterDrag&&(this.constant=!1),this.constant&&(this.repositionDraggedElement=!1)}};var DC={},un={get:i=>{let r=DC[i];if(!r)U("WARN: VisuallyJs: unknown UI plugin '"+i+"'");else return new r},register:(i,r)=>{DC[i]=r}};function He(i){return function(r){un.register(i,r)}}function wp(i,r,e,t,n,o,s){s=s||r.minSize;let a=r.maxSize,l=r.padding||0,h=(s==null?void 0:s.width)||0,d=(s==null?void 0:s.height)||0,u=0,p=0;isFinite(i.xmin)&&i.xmin<l&&n&&(u=l-i.xmin),isFinite(i.ymin)&&i.ymin<l&&n&&(p=l-i.ymin);let g=(isFinite(i.xmax)?i.xmax:0)+u+l,m=(isFinite(i.ymax)?i.ymax:0)+p+l,E=Math.min((a==null?void 0:a.width)||g,g),y=Math.min((a==null?void 0:a.height)||m,m);if(E=Math.max(h,E),y=Math.max(d,y),e){if(isFinite(i.xmin)&&i.xmin>l&&t){let x=i.xmin-l,f=E-x;E=Math.max((s==null?void 0:s.width)||f,f),E>f&&(x-=E-f),u=-x}if(isFinite(i.ymin)&&i.ymin>l&&t){let x=i.ymin-l,f=y-x;y=Math.max((s==null?void 0:s.height)||f,f),y>f&&(x-=y-f),p=-x}}if(o.grid&&o.fitGroupsToGrid!==!1){let x=E/o.grid.width;E=o.grid.width*Math.ceil(x);let f=y/o.grid.height;y=o.grid.height*Math.ceil(f);let b=u/o.grid.width;u=o.grid.width*Math.ceil(b);let A=p/o.grid.height;p=o.grid.height*Math.ceil(A)}return{width:E,height:y,layoutShiftX:u,layoutShiftY:p}}function NC(i,r,e,t){let n=i.$_connMap[r.id];if(n){if(n.proxies==null||n.proxies[e]==null||n.proxies[e].length===0)return;let o=n.proxies[e].pop(),s=o.originalElement,a=o.element,l=o.originalAnchor;return t!=null&&(l=St(t)),i.$sourceOrTargetChanged(a.id,s.id,n,s.el,e),e===it?n.anchors.source=l:n.anchors.target=l,er.setVisible(n,o.originallyVisible),s}return null}function IC(i,r,e,t,n){let o=i.$_connMap[r.id];if(o){let s=e==="source"?0:1;if(n==null)if(Y(t.modelObject)){let d=i.view.getGroupDefinition(i.model.getNodeType(t.modelObject.data));n=St(d.anchor||i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous")}else n=St(i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous");let a=iT(o.proxies[e]),l=a!=null?a.originalElement.id:e===it?o.sourceId:o.targetId,h=a!=null?a.originalAnchor:e===it?o.anchors.source:o.anchors.target;e===it?o.anchors.source=n:o.anchors.target=n,i.$sourceOrTargetChanged(l,t.id,o,t.el,e),o.proxies[e].push({originalAnchor:h,element:t,originalElement:i.$getManagedElement(l),originallyVisible:o.visible}),er.setVisible(o,!0),i.$revalidateElementById(t.id)}}var qD=["color","lineWidth","outlineWidth","outlineColor","dashArray","gradient"];function Dp(i,r,e){r!=null&&(EE(r.connections,i),r.connections.length===1&&i.instance.$addClassToElement(r.el,ah)),e!=null&&(r==null||i.sourceId!==i.targetId)&&(EE(e.connections,i),e.connections.length===1&&i.instance.$addClassToElement(e.el,ah))}function Np(i,r,e){if(r!=null){let t=r.connections.length;Nt(r.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,r),t>0&&r.connections.length===0&&i.instance.$removeClassFromElement(r.el,ah)}if(e!=null){let t=e.connections.length;(r==null||i.sourceId!==i.targetId)&&Nt(e.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,e),t>0&&e.connections.length===0&&i.instance.$removeClassFromElement(e.el,ah)}}var QD=2,eN=2,Ip=class extends zt{constructor(e,t,n,o,s){var l,h,d,u,p,g,m,E,y,x,f,b,A,T;super();c(this,"sl",[]);c(this,"al",[]);c(this,"containerType",null);c(this,"id");c(this,"defaults");c(this,"Gi",{});c(this,"hoverSuspended",!1);c(this,"yt",!1);c(this,"pu",null);c(this,"$_dataLoading",!1);c(this,"zoomToFitOnLoad");c(this,"plugins",[]);c(this,"pluginMap",new Map);c(this,"ll",[]);c(this,"connectorClass",ua);c(this,"connectorOutlineClass",Lv);c(this,"connectorPathClass",lp);c(this,"overlayClass",pa);c(this,"labelOverlayClass",Dv);c(this,"$_connMap",{});c(this,"allowNestedGroups");c(this,"$_discardEdgeEditsOnDrag");c(this,"$_vertexBuffer");c(this,"$_vertexBorder");c(this,"gs");c(this,"viewport",new bp(this,e=>this.getRenderedElement(e)));c(this,"router");c(this,"hl",new Map);c(this,"fe");c(this,"cl",new Set);c(this,"mu");c(this,"$defaultConnector");c(this,"$defaultOverlays");c(this,"$defaultAnchor");c(this,"$defaultAnchors");c(this,"gu");c(this,"Eu");c(this,"$isInMotion");c(this,"magnetizerProfile");c(this,"magnetizer");c(this,"$unrenderedVertices",new Map);c(this,"$unprocessedGroupMemberships",new Map);c(this,"$_useModelForSizes");c(this,"$_writeSizeToElements");c(this,"$_useModelForPositions");c(this,"$_allowUnattachedEdges");c(this,"$_edgesDetachable");c(this,"$_reattachEdges");c(this,"$paintConnectorOutline");c(this,"$connectorOutlineColor");c(this,"$connectorOutlineWidth");c(this,"K",1);c(this,"$collapsedGroupSizeCalculator");c(this,"fu");c(this,"dl");c(this,"ul");c(this,"view");c(this,"gridProfile");c(this,"$connectionEstablished");c(this,"vertexList",[]);c(this,"logicalPorts");c(this,"objectFilter");c(this,"layoutMap",new Map);c(this,"$_layout");c(this,"model");c(this,"dataSource");c(this,"$relayoutOnEdgeConnect");c(this,"$relayoutOnResize");c(this,"$relayoutOnVertexRemove");c(this,"Es");c(this,"rootElement");c(this,"$t",[]);c(this,"$_dataHooks",[]);this.model=e,this.dataSource=t,this.rootElement=n,this.id=o.id||$(),this.gridProfile=new mh(o.grid),this.$connectionEstablished=o.connectionEstablished||(S=>{}),this.logicalPorts=o.logicalPorts===!0,this.objectFilter=o.objectFilter||function(S){return!0},this.$defaultConnector=((l=o.edges)==null?void 0:l.connector)||jr,this.gu=(h=o.edges)==null?void 0:h.sourceMarker,this.Eu=(d=o.edges)==null?void 0:d.targetMarker,this.$defaultOverlays=(((u=o.edges)==null?void 0:u.overlays)||[]).map(S=>gi(S)),this.$defaultAnchor=((p=o.edges)==null?void 0:p.anchor)||"Continuous",this.$defaultAnchors=((g=o.edges)==null?void 0:g.anchors)||[null,null],this.$relayoutOnEdgeConnect=o.relayoutOnEdgeConnect,this.$relayoutOnResize=o.relayoutOnResize,this.$relayoutOnVertexRemove=o.relayoutOnVertexRemove,this.defaults={[up]:null,[Fv]:1,[ts]:{strokeWidth:2,stroke:"#000000"},[Vf]:"vjs_defaultscope",[Mf]:!0,[$v]:20},s&&Object.assign(this.defaults,s),Object.assign(this.Gi,this.defaults),this.Gi[ts]!=null&&(this.Gi[ts].strokeWidth=this.Gi[ts].strokeWidth||2),this.mu=this.defaults[Vf],this.allowNestedGroups=this.Gi[Mf]!==!1,this.$_discardEdgeEditsOnDrag=o.edges&&o.edges.discardEditsOnDrag===!0,this.$_vertexBuffer=o.edges?o.edges[Vv]:QD,this.$_vertexBorder=o.edges?o.edges[Mv]:eN,this.gs=((m=o.edges)==null?void 0:m.avoidVertices)===!0,this.$_allowUnattachedEdges=((E=o.edges)==null?void 0:E.allowUnattached)===!0,this.$_edgesDetachable=((y=o.edges)==null?void 0:y.detachable)!==!1,this.$_reattachEdges=((x=o.edges)==null?void 0:x.reattach)===!0,this.$paintConnectorOutline=((f=o.edges)==null?void 0:f.paintOutline)!==!1,this.$connectorOutlineWidth=((b=o.edges)==null?void 0:b.outlineWidth)||20,this.$connectorOutlineColor=((A=o.edges)==null?void 0:A.outlineColor)||"transparent",this.zoomToFitOnLoad=o.zoomToFit===!0,this.router=o.router?o.router(this):new gh(this,{gridCellSize:((T=o.edges)==null?void 0:T.astarGridCellSize)||10,avoidVertices:this.gs}),this.$_useModelForSizes=o.useModelForSizes===!0,this.$_writeSizeToElements=o.writeSizeToElements!==!1,this.$_useModelForPositions=o.useModelForPositions!==!1,this.magnetizerProfile=new Lp(o.magnetizer||{}),this.magnetizer=new Mi({positionGetter:S=>this.getElementPosition(S.id),getSize:S=>this.getElementSize(S.id),getId:S=>S.id,positionSetter:(S,O)=>{}}),this.Es=!0,o.edges!=null&&o.edges.simpleEdgeStyles===!1&&(this.Es=!1),this.setContainer(n),this.$setView(o.view),this.pl(xt,S=>{let O=this.$_connMap[S.edge.getId()];if(O){let v=this.dataSource.getEdgeType(S.edge.data),_=[...new Set([be,v])];if(this.$_setConnectionType(O,_.join(" "),S.edge.data),this.Es===!0){let P={};this.$_extractSimpleEdgeStyles(S.edge.data,P)&&this.$_setLineStyle(O,P,!0)}this.se(P=>{P.$edgeUpdated(S.edge,O)})}}),this.pl($d,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var O=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(O),this.se(v=>{v.$groupResized({element:O,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.pl(Gd,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var O=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(O),this.se(v=>{v.$groupResized({element:O,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.$_layout=nt.get(Fs.type,{adapter:this.$createDefaultLayoutAdapter(),instance:this.model,dataSource:this.dataSource,container:this.rootElement,options:{}});let a=o.layout||{type:Lo.type};this.setLayout(a,!0),this.$collapsedGroupSizeCalculator=o.getCollapsedGroupSize,this.fu=o.defaultCollapsedGroupSize||{width:200,height:150},this.dl=o.canCollapseGroup,this.ul=o.canExpandGroup}get defaultScope(){return this.mu}get $modelTopAttribute(){return this.model.modelTopAttribute}get $modelLeftAttribute(){return this.model.modelLeftAttribute}get $modelWidthAttribute(){return this.model.modelWidthAttribute}get $modelHeightAttribute(){return this.model.modelHeightAttribute}get $modelRotationAttribute(){return this.model.modelRotationAttribute}get currentZoom(){return this.K}getLayout(){return this.$_layout}$edgeTargetChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.target.getFullId(),s=this.$getManagedElement(o);s==null&&H(t.target)&&(s=this.yu(t.target),s==null&&(s=this.$getManagedElement(t.target.parent.id))),n?s!=null?(this.dataSource.debugEnabled&&console.log("DEBUG: target change",n),this.xf(n,s,!Ni(e.old))):(delete this.$_connMap[t.getId()],this.ml(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Target for Edge "+t.getId()+" changed to Node "+s.id+"; we have no valid connection.")}}$select(e){if(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$addClassToElement(t,to)}else if(rt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$addConnectorClass(t.connector,hh)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$addClassToElement(t,to)}}setSuspendRendering(e,t){}$deselect(e){if(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$removeClassFromElement(t,to)}else if(rt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$removeConnectorClass(t.connector,hh)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$removeClassFromElement(t,to)}}$selectionCleared(e){this.$getSelector(this.fe,z(hh)).forEach(t=>this.$removeClassFromElement(t,hh)),this.$getSelector(this.fe,z(to)).forEach(t=>this.$removeClassFromElement(t,to))}yu(e){let t=this.getRenderedPort(e);if(t!=null)return this.$manage(t,e,null,null,null,!1)}$edgeSourceChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.source.getFullId(),s=this.$getManagedElement(o);s==null&&H(t.source)&&(s=this.yu(t.source),s==null&&(s=this.$getManagedElement(t.source.parent.id))),n&&s?s!=null?this.bf(n,s,!Ni(e.old)):(delete this.$_connMap[t.getId()],this.ml(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Source for Edge "+t.getId()+" changed to Node "+t.source.getFullId()+"; we have no valid connection.")}}onDestroy(e){this.bind($i,e)}pl(e,t){this.sl.push({event:e,fn:t}),this.dataSource.bind(e,t,!0)}$dataLoadStart(){this.$_dataLoading=!0,this.$_setSuspendDrawing(!0),this.viewport.setSuspended(!0),this.fire(au)}$dataAppendStart(){this.$_setSuspendDrawing(!0)}$dataAppendEnd(e){}$dataLoadEnd(e){if(this.$unrenderedVertices.size===0){let t=$();this.$_setSuspendDrawing(!1,!1),e?this.viewport.setSuspended(!1):(this.relayout(null,!0),this.viewport.setSuspended(!1),this.$flushUnrenderedEdges(t),this.$redrawEveryConnection()),this.zoomToFitOnLoad&&!e&&this.zoomToFit(),this.$_dataLoading=!1,this.fire(Br)}}zoomToFit(e){this.$zoomToFit(e)}zoomToFitIfNecessary(e){this.$zoomToFitIfNecessary(e)}zoomToElements(e){this.$zoomToElements(e)}cloneVertex(e,t){var o,s;let n=this.getObjectInfo(e,!1);if(n.obj){let a=t==null?void 0:t.newPosition,l=lt(n.obj.data);if(delete l.id,a!=null)l[this.$modelLeftAttribute]=a.x,l[this.$modelTopAttribute]=a.y;else{let d=((o=t==null?void 0:t.offsetPosition)==null?void 0:o.x)||50,u=((s=t==null?void 0:t.offsetPosition)==null?void 0:s.y)||50;l[this.$modelLeftAttribute]+=d,l[this.$modelTopAttribute]+=u}let h;return this.model.transaction(()=>{h=Y(n.obj)?this.model.addGroup(l):this.model.addNode(l),a==null&&(this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)!==!1||!this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)===!0)&&this.fs(h,null,!1,{},{},null,!0,!1,!1),(t==null?void 0:t.selectAfterCreate)===!0&&setTimeout(()=>this.model.setSelection(h))},ut),h}}xu(){let e,t,n,o,s,a=!1,l=$();for(e=0,n=this.dataSource.getGroupCount();e<n;e++)o=this.dataSource.getGroupAt(e),this.objectFilter(o)&&(this.$doRenderGroup(o),a=!0);for(e=0,n=this.dataSource.getNodeCount();e<n;e++)t=this.dataSource.getNodeAt(e),this.objectFilter(t)&&(this.$doRenderNode(t),a=!0);let h=this.dataSource.getAllEdges();for(e=0,n=h.length;e<n;e++)s=h[e],this.objectFilter(s)&&(this.bu(h[e],Rl,null,null,l),a=!0);return this.$flushUnrenderedEdges(l),a}$_hasUnrenderedEdges(){return this.$t.length!==0}Af(e,t,n,o){let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target,l=n.sourcePortType||(H(o.source)?null:this.$getAttribute(e,qi)||this.$getAttribute(e,kr)),h=n.targetPortType||(H(o.target)?null:this.$getAttribute(e,Qi)||this.$getAttribute(t,kr));return{sourceDef:l!=null?this.view.getPortDefinition(l):this.view.getTypeDefinition(o.source),targetDef:h!=null?this.view.getPortDefinition(h):this.view.getTypeDefinition(o.target),sourceParentDef:this.view.getTypeDefinition(s),targetParentDef:this.view.getTypeDefinition(a)}}$_extractSimpleEdgeStyles(e,t){let n=!1;return qD.forEach(o=>{e.hasOwnProperty(o)&&(n=!0,t[o]=e[o])}),n}Sf(e,t,n,o){var O,v;let s=e.edge,a=e.context||{},l=a.edgeType||this.dataSource.getEdgeType(s.data),h=e.def||this.view.getEdgeDefinition(l),d=H(s.source)?s.source.getParent():s.source,u=this.getElement(d.id),p=H(s.target)?s.target.getParent():s.target,g=this.getElement(p.id),{sourceDef:m,targetDef:E,sourceParentDef:y,targetParentDef:x}=this.Af(u.el,g.el,a,s),f={type:l,data:s.data,cost:s.getCost(),directed:s.isDirected(),geometry:s.geometry,id:s.id,edge:s,anchor:null,anchors:[null,null],source:t,target:n,sourceMarker:h.sourceMarker||this.gu,targetMarker:h.targetMarker||this.Eu};[dp,Gv,Bv].forEach(_=>{h.hasOwnProperty(_)&&(f[_]=h[_])}),f.anchor&&!f.anchors&&(f.anchors=[f.anchor,f.anchor],delete f.anchor);let A=(_,P,I,C,R)=>{if(C&&C[I]){let w=_[P]||[C[I],C[I]];w[R]=C[I],_[P]=w}};m!=null&&A(f,dh,ch,m,0),E!=null&&A(f,dh,ch,E,1);let T=f;if(T.avoidVertices=this.gs||h.avoidVertices,this.dataSource.debugEnabled&&console.log("Renderer","adding connection with params",T),h!=null&&Object.assign(f,Oo(h,s.data,null,!0)),this.$manage(T.source,s.source,null,null,null,!1),(O=s.anchors)!=null&&O.source)f.anchors[0]=St(s.anchors.source);else{let _=a.positionOnSource||{x:0,y:0},P=m.anchorPositions||y.anchorPositions,I=m.anchorPositionFinder||y.anchorPositionFinder;if(P!=null)f.anchors[0]=Ap(P.slice(),null,_);else if(I!=null){let C=I(u.el,_,s.source,E);f.anchors[0]=C}}if(this.$manage(T.target,s.target,null,null,null,!1),(v=s.anchors)!=null&&v.target)f.anchors[1]=St(s.anchors.target);else{let _=a.positionOnTarget||{x:0,y:0},P=E.anchorPositions||x.anchorPositions,I=E.anchorPositionFinder||x.anchorPositionFinder;if(a.targetAnchor!=null)f.anchors[1]=Ap([a.targetAnchor]);else if(P!=null)f.anchors[1]=Ap(P.slice(),null,_);else if(I!=null){let C=I(g.el,_,s.target,E);f.anchors[1]=C}}this.Es===!0&&this.$_extractSimpleEdgeStyles(s.data,f);let S=wC(this,f);if(S!=null){Dp(S,this.getElement(S.sourceId),this.getElement(S.targetId)),T.geometry&&(je.importGeometry(S,T.geometry),this.$repaintUIElementById(S.sourceId),this.$repaintUIElementById(S.targetId)),S.edge=s,this.$_connMap[s.getId()]=S,s.source.dummy&&(S.anchors.source.isFixed=!0,S.anchors.source.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),s.target.dummy&&(S.anchors.target.isFixed=!0,S.anchors.target.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.$relayoutOnEdgeConnect&&this.refresh(),(g.visible===!1||u.visible===!1)&&this.ys(s,!1),T.geometry||this.$repaintUIElementById(S.sourceId);let _={connection:S,edge:s,reason:e.reason};this.se(P=>P.$edgeRendered(_)),this.fire(uS,_)}else U("VisuallyJs - WARN : An edge could not be rendered "+s+" and is being removed from the dataset."),this.model.removeEdge(s,this);return S}$graphClearStart(){this.$_layout&&this.$_layout.un(),this.layoutMap.clear(),this.reset()}$graphClearEnd(){}$groupRemoved(e){let t=this.viewport.getGroupElement(e.group.id);return t&&(this.vertexList=this.vertexList.filter(o=>o.id!==e.group.id),e.removeChildren===!1&&e.children.forEach(o=>{let s=this.$getManagedElement(o.id);o.data[this.$modelLeftAttribute]=s.x,o.data[this.$modelTopAttribute]=s.y,this.$appendElementToVertexLayer(s.el),this.$setViewportElementPosition(s,s)}),e.group.getPorts().map(o=>this.$getManagedElement(o.getFullId())).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.$__unmanage(t.el,e.removeChildren===!0,!0),this.se(o=>{o.$groupRemoved(t)})),t}bu(e,t,n,o,s,a){this.$t.push({edge:e,reason:t,context:n,def:o}),a&&this.$flushUnrenderedEdges(s)}$flushUnrenderedEdges(e){let t=this.$t.length,n=[];if(t>0){let o=[];for(let s=0;s<this.$t.length;s++)this.Tf(this.$t[s],e)==null?o.push(this.$t[s]):n.push(this.$t[s].edge);this.$t=o}return n}Tf(e,t){let n=this.getRenderedElement(e.edge.target),o=this.getRenderedElement(e.edge.source);return n==null||o==null?null:this.Sf(e,o,n,t)}$edgeAdded(e,t){if(e.source!==this||e.transient===!0&&e.source===this){let n=e.edge;if(this.objectFilter(n.source)&&this.objectFilter(n.target)){let o=this.view.getEdgeDefinition(this.dataSource.getEdgeType(n.data||{}));if(o&&o.ignore===!0)return;this.bu(n,e.reason,t,o,null,!this.$_dataLoading)}}}$edgeRemoved(e){if(e.edge.transient||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()];n&&(this.viewport.$removeEdge(t.id),this.dataSource.debugEnabled&&console.log("Renderer","removing edge",t),delete this.$_connMap[t.getId()],this.ml(n,{fireEvent:!1,force:!0}),this.se(o=>{o.$edgeRemoved(t,n)}))}}$edgeGeometryUpdated(e,t,n){let o=this.getRenderedConnection(e.id);o!=null&&(t!=null?je.importGeometry(o,t):ji(o),this.$repaintUIElementById(e.source.getFullId()),this.fire(ai,{edge:e,geometry:t,originalGeometry:n}))}$exportEdgeGeometry(e){let t=this.$_connMap[e.id];return t==null?null:cn(t.connector)}$nodeAdded(e){let t=e.node;this.objectFilter(t)&&this.$doRenderNode(t,e.eventInfo)}$groupAdded(e){let t=e.group;this.objectFilter(t)&&this.$doRenderGroup(t,e.eventInfo)}$portAdded(e){this.objectFilter(e.port.getParent())&&setTimeout(()=>this.$flushUnrenderedEdges($()))}$vertexUpdated(e){if(e.vertex!=null){let t=this.getElement(e.vertex.getFullId());if(t){let n=null,o=e.vertex.data[this.$modelLeftAttribute],s=null,a=e.vertex.data[this.$modelTopAttribute];if(e.updates!=null){if((e.updates[this.$modelWidthAttribute]!=null||e.updates[this.$modelHeightAttribute]!=null)&&(n=e.vertex.data[this.$modelWidthAttribute],s=e.vertex.data[this.$modelHeightAttribute],this.$_useModelForSizes)){let d=this.$resolveVertexSizeFromModel(e.vertex,this.view.getTypeDefinition(e.vertex));this.$setElementSizeInUI(t.el,d.width,d.height),n=d.width,s=d.height,this.se(u=>{u.$vertexResized(this.getElement(e.vertex.getFullId()),n,s)})}e.updates[this.$modelRotationAttribute]!=null&&this.Au(e.vertex,e.updates[this.$modelRotationAttribute],!1,!0)}let l=o,h=a;if(e.vertex.group!=null){let d=this.$_getGroupContentAreaInfo(e.vertex.group.id).pageOrigin;l+=d.x,h+=d.y}if(this.viewport.updateElement(t.id,l,h,n,s,null,e.vertex,!1),(e.updates[this.$modelLeftAttribute]!=null||e.updates[this.$modelTopAttribute]!=null)&&this.$setViewportElementPosition(t,{x:o,y:a}),this.$doVertexUpdated(t),this.$repaintUIElement(this.getElement(t.id)),e.reason===ra&&this.gs){let d=this.model.getAllEdges().filter(u=>ti(u.source).id!==e.vertex.id&&ti(u.target).id!==e.vertex.id);this.repaintEdges(d)}e.reason===bu?this.vf(this.getElement(t.id),e.originalData):this.fire(Qs,this.getElement(t.id)),this.se(d=>d.$vertexUpdated(this.getElement(t.id),e.reason))}}}vf(e,t){let n={x:t[this.$modelLeftAttribute],y:t[this.$modelTopAttribute]},o={dragGroup:[{element:e,vertex:e.modelObject,pos:{x:e.x,y:e.y},originalPos:n}],positions:{[e.id]:{x:e.x,y:e.y}},ui:this},s=Y(e.modelObject)?Gr:Vt;this.fire(s,o)}Cf(e){this.fire(Ce,e)}getLayoutFor(e){return AE(e)||SE(e)?this.layoutMap.get(e.group.id):this.$_layout}$groupMemberAdded(e){this.$_processGroupAddition(e,!1)||(this.$unprocessedGroupMemberships.has(e.group.id)||this.$unprocessedGroupMemberships.set(e.group.id,[]),this.$unprocessedGroupMemberships.get(e.group.id).push(e))}$_processGroupAddition(e,t){let n=this.$getManagedElement(e.vertex.id),o=this.viewport.getGroupElement(e.group.id);if(o!=null&&n!=null){this.$appendElement(n.el,o.contentArea);let s=this.$_getGroupContentAreaInfo(e.group.id),a=e.positionInGroup?e.positionInGroup.x:n.x-o.x,l=e.positionInGroup?e.positionInGroup.y:n.y-o.y;return this.$_updateVertexPositions({positions:{[n.id]:{x:a,y:l}},sizes:null,offset:{x:o.x+s.internalOffset.x,y:o.y+s.internalOffset.y},storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),e.source!=this&&this.relayoutGroup(e.group.id,$S),this.se(h=>{h.$groupMemberAdded(n)}),t||setTimeout(()=>this.$revalidateElement(n.el)),!0}else return!1}$groupMemberRemoved(e){let t=this.$getManagedElement(e.vertex.id),n=this.viewport.getGroupElement(e.group.id),o=this.$_getGroupContentAreaInfo(e.group.id);this.$appendElementToVertexLayer(t.el),this.$_updateVertexPositions({positions:{[t.id]:{x:t.x-n.x-o.internalOffset.x,y:t.y-n.y-o.internalOffset.y}},sizes:null,offset:null,storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.se(s=>{s.$groupMemberRemoved(t)})}$nodeRemoved(e){let t=this.$getManagedElement(e.node.id);return t&&(e.node.getPorts().map(o=>this.$getManagedElement(o.getFullId())).filter(o=>o!=null).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.vertexList=this.vertexList.filter(o=>o.id!==e.node.id),this.$__unmanage(t.el,!1,!0),this.se(o=>{o.$nodeRemoved(t)}),this.Cf(t)),t}$portRemoved(e){let t=this.$getManagedElement(e.port.getFullId());if(t){let n=this.$getManagedElement(e.port.getParent().id);n.el!==t.el?this.$__unmanage(t.el,!1,!1):(this.$removeAttribute(n.el,sh),this.$removeAttribute(n.el,kr))}}$edgeTypeChanged(e,t,n){let o=this.$_connMap[e.getId()];if(o){let s=this.view.getEdgeDefinition(n);if(s&&s.ignore===!0)return;s.connector&&er.au(o,s.connector),Ne.setType(o,n,e.data)}}$groupTypeChanged(e,t,n){}$nodeTypeChanged(e,t,n){this.$reRenderNode(e)}$portTypeChanged(e,t,n){}$vertexRendered(e,t,n,o){if(!t)throw new Error("Cannot render vertex");let s=K(e),a=Y(e);this.$setAttribute(t,te,e.getFullId());let l=s?eo:a?es:H(e)?Nv:"";this.$addClassToElement(t,l),t.jtk=t.jtk||{},t.jtk[e.objectType.toLowerCase()]=e,t.jtk.vertex=e;let h=this.getElement(e.id),d=h!=null;if(d&&(this.$setAttribute(t,gt,this.$getAttribute(h.el,gt)),h.el=t,this.model.getSelection().containsVertex(e.id)&&this.$addClassToElement(t,to)),K(e)||Y(e))if(this.vertexList.push(e),e.group==null)this.$appendVertexElement(t);else{let m=this.Su(e.group);this.$appendElement(t,m)}let u=null,p=e.data[this.$modelRotationAttribute];this.$_useModelForSizes?(u=this.$resolveVertexSizeFromModel(e,n),this.$_writeSizeToElements!==!1&&this.$setElementSizeInUI(t,u.width,u.height),e.data[this.$modelWidthAttribute]=u.width,e.data[this.$modelHeightAttribute]=u.height):u=this.$getSize(t);let g=this.$manage(t,e,null,u,null,!1);if(p!=null&&this.Au(e,p,!this.$_dataLoading,!1),K(e)){if(!d){let m={el:t,id:e.id,vertex:e,size:u};this.fire(Ur,m)}}else if(Y(e)){let m={el:t,vertex:e,id:e.id,size:u},E=g,y=n;E.contentArea=this.$getGroupContentAreaElement(t),E.elastic=y.elastic===!0;let x=y.layout||{type:Lo.type};this.layoutMap.set(e.id,this.Tu(x,e)),this.fire(Fr,m),this.$unprocessedGroupMemberships.has(e.id)&&(this.$unprocessedGroupMemberships.get(e.id).forEach(b=>this.$_processGroupAddition(b,!0)),this.$unprocessedGroupMemberships.delete(e.id))}this.$unrenderedVertices.delete(e.id),this.$_dataLoading&&this.$isAsynchronousRender()?this.$dataLoadEnd(!1):this.$_dataLoading||(d&&this.se(m=>{m.$vertexRerendered({el:t,id:e.id,vertex:e,size:u})}),this.$flushUnrenderedEdges(null),this.$unrenderedVertices.size===0&&this.refresh())}$redrawEveryConnection(){let e=$();this.vu(Object.values(this.$_connMap),e)}$redrawConnectionsForViewportElement(e,t,n){let o=e.connections||[];return this.vu(o,t,n),o}vu(e,t,n){this.router.$redrawConnections(e,t),e.forEach(o=>{this.$paintConnection(o,{timestamp:t,fireEvent:n})})}ys(e,t,n){let o=this.$_connMap[e.id];o&&er.setVisible(o,t)}isVisible(e){return this.Cu(e,t=>{switch(t.type){case ze.objectType:let n=this.$_connMap[t.obj.id];return n?n.visible:!1;case ce.objectType:case se.objectType:return t.managedElement.visible!==!1}})}setVisible(e,t,n){if(e==null)return;let o=s=>{switch(s.type){case ze.objectType:this.ys(s.obj,t,n);break;case ce.objectType:case se.objectType:this.Pf(s,t,n);break;case de.objectType:U("WARN togglePort method not implemented in 7.x");break}};this.Cu(e,o)}Pf(e,t,n){if(e.el&&(this.$setElementVisible(e.el,t),e.el.ZA=t,e.managedElement.visible=t,this.fire(lu,{node:e.obj,el:e.el,state:t}),!n)){let o=this.dataSource.getAllEdgesFor(e.obj);for(let s=0;s<o.length;s++)if(!t)this.ys(o[s],t,n);else{let a=ti(o[s].source),l=ti(o[s].target),h=a===e.obj?l:a;this.isVisible(h)&&this.ys(o[s],t,n)}}}Cu(e,t){let n;if(WS(e))n={nodes:[],edges:[]},e.eachVertex((o,s)=>{n.nodes.push(t(this.getObjectInfo(s,!1)))}),e.eachEdge((o,s)=>{n.edges.push(t(this.getObjectInfo(s,!1)))});else if(this.$isArrayLike(e)){n=[];for(let o=0;o<e.length;o++)n.push(t(this.getObjectInfo(e[o],!1)))}else n=t(this.getObjectInfo(e,!1));return n}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);return n!=null?n:this.$_getDefaultSizeForVertex(e,t)}$_getDefaultSizeForVertex(e,t){let n=K(e)?this.defaults.nodeSize||{width:100,height:80}:this.defaults.groupSize||{width:300,height:300};return t.defaultSize&&(n.width=t.defaultSize.width,n.height=t.defaultSize.height),n}$_getModelSizeForVertex(e){let t=e.data[this.$modelWidthAttribute],n=e.data[this.$modelHeightAttribute];if(t!=null&&n!=null)return{width:e.data[this.$modelWidthAttribute],height:e.data[this.$modelHeightAttribute]}}getContainer(){return this.fe}setZoom(e,t){return this.K=e,e}W(e){if(e==null)return null;let t=this.$getAttribute(e,gt);return(!t||t==="undefined")&&(t=`vjs-${$()}`,this.$setAttribute(e,gt,t)),t}setContainer(e){this.fe=e}Pu(e,t,n,o){let s=n===0?e.sourceId:e.targetId;if(o){let l=n===0?e.anchors.source:e.anchors.target;l.isFixed=!1,delete l.fixedLocation}let a={index:n,originalSourceId:n===0?s:e.sourceId,newSourceId:e.sourceId,originalTargetId:n===1?s:e.targetId,newTargetId:e.targetId,connection:e};return n===0?(a.newSourceId=t.id,e.sourceId=t.id,e.sourceElement=t.el):(a.newTargetId=t.id,e.targetId=t.id,e.targetElement=t.el),a}bf(e,t,n){Np(e,this.getElement(e.sourceId)),this.$repaintUIElement(this.getElement(e.sourceId));let o=this.Pu(e,t,0,n);Dp(e,this.getElement(o.newSourceId),this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(o.newSourceId))}xf(e,t,n){Np(e,this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(e.targetId));let o=this.Pu(e,t,1,n);Dp(e,this.getElement(e.sourceId),this.getElement(o.newTargetId)),this.$repaintUIElement(this.getElement(o.newTargetId))}$_setConnectionType(e,t,n){let o=Ne.setType(e,t,n);return this.$paintConnection(e),o}$_setSuspendDrawing(e,t){let n=this.yt;return this.yt=e,e?this.pu=""+new Date().getTime():this.pu=null,this.yt||(this.autoSizeGroups(Array.from(this.cl.keys()).map(o=>o.modelObject)),this.cl.clear(),t&&this.repaintEverything()),n}$batch(e,t){let n=this.yt===!0;n||this.$_setSuspendDrawing(!0),e(),n||this.$_setSuspendDrawing(!1,!t)}Of(e,t){return this.dataSource.beforeDetach(e.edge.source,e.edge.target,e.edge)}ml(e,t){return e!=null&&e.deleted!==!0&&(t=t||{},t.force||this.Of(e)===!0)?(Np(e,this.getElement(e.sourceId),this.getElement(e.targetId)),this.router.$connectionRemoved({connection:e,reason:Ol,edge:e.edge}),delete this.$_connMap[e.id],er.destroy(e),!0):!1}$manage(e,t,n,o,s,a){let l=t.getFullId();this.$getAttribute(e,gt)==null&&this.$setAttribute(e,gt,l);let h=this.getElement(l);if(h==null)h=this.viewport.addElement(l,e,t,n,o,s),this.yt||this.viewport.$refreshElement(l,!1,n,o);else if(a)return this.viewport.$refreshElement(l);return h}$getManagedElement(e){return this.viewport.getElement(e)}$__unmanage(e,t,n){let o=s=>{let a=this.W(s),l=this.getElement(a);this.router.$elementRemoved(l),this.viewport.remove(a),this.$removeAttribute(s,gt),s&&n&&this.$removeElement(s)};t&&this.$getAssociatedElements(e).map(o),o(e)}rotate(e,t){this.getObjectInfo(e,!1).obj&&this.model.$_updateVertex(e,{[this.$modelRotationAttribute]:t},ta,!1)}setSize(e,t,n){this.getObjectInfo(e,!1).obj&&this.model.transaction(()=>{this.model.$_updateVertex(e,{[this.$modelWidthAttribute]:t,[this.$modelHeightAttribute]:n},jS,!1)},ut)}Au(e,t,n,o){let s=j(e)?e:e.id;if(this.getElement(s)){this.viewport.hf(s,t);let a=this.getElement(s);if(this.$syncManagedElementWithView(a,!1),this.se(l=>{l.$vertexRotated(a,t)}),n!==!0)return this.$repaintUIElementById(s)}}$getRotation(e){let t=this.getElement(e);return t!=null&&t.r||0}$getRotations(e){let t=[],n=this.getElement(e),o=s=>{if((K(s.modelObject)||Y(s.modelObject))&&s.modelObject.group){let a=this.getElement(s.modelObject.group.id);a!=null&&(t.push({r:a.r,c:a.c}),o(a))}};return n!=null&&(H(n.modelObject)?n=this.getElement(n.modelObject.parent.id):t.push({r:n.r||0,c:n.c}),o(n)),t}$revalidateElement(e,t){let n=this.W(e);return this.$revalidateElementById(n)}$revalidateElementById(e,t){return this.$revalidateManagedElement(this.getElement(e),t)}$revalidateManagedElement(e,t){return e!=null?(this.viewport.$refreshElement(e.id),this.$repaintUIElement(e)):fp()}repaintEverything(e){let t=$();e!==!0&&this.viewport.$refreshEveryElement(),this.viewport.recomputeBounds(),this.viewport.$forEachElement(n=>this.$repaintUIElement(n,t,!0))}$repaintUIElementById(e,t,n,o){this.$repaintUIElement(this.getElement(e),t,n,o)}$repaintUIElement(e,t,n,o){let s=fp(),a=l=>{l.forEach(h=>s.add(h))};if(!this.yt){if(e!=null){let l=this.$getAssociatedElements(e.el).map(h=>this.getElement(this.W(h))).filter(h=>h!=null&&h.id!==e.id);t==null&&(t=$());for(let h=0;h<l.length;h++)(H(l[h].modelObject)||!n)&&this.viewport.$refreshElement(l[h].id);if(a(this.$redrawConnectionsForViewportElement(e,t,o)),l.length>0)for(let h=0;h<l.length;h++)a(this.$redrawConnectionsForViewportElement(l[h],t,o))}o&&this.fire(iu,e)}return s}reset(){this.$_connMap={},this.vertexList.length=0,this.viewport.reset(),this.router.$reset(),this.$t.length=0,this.$unrenderedVertices.clear(),this.cl.clear()}getRenderedConnection(e){return this.$_connMap[e]}getNodes(){return this.vertexList.filter(K)}getGroups(){return this.vertexList.filter(Y)}getUIGroups(){return this.getGroups().map(e=>this.viewport.getGroupElement(e.id))}destroy(){for(let e=0;e<this.al.length;e++)this.off(this.fe,this.al[e][0],this.al[e][1]);this.reset(),this.unbind(),this.hl.clear()}$registerConnectionType(e,t){let n=Object.assign({},t);if(this.hl.set(e,n),t.overlays){let o={};for(let s=0;s<t.overlays.length;s++){let a=gi(t.overlays[s]);o[a.options.id]=a}n.overlays=o}if(t.sourceMarker){let o=gi(t.sourceMarker);o.options.direction=-1,o.options.location=0,o.sourceMarker=!0,n.sourceMarker=o}if(t.targetMarker){let o=gi(t.targetMarker);o.options.direction=1,o.options.location=1,o.targetMarker=!0,n.targetMarker=o}}$getConnectionType(e){return this.hl.get(e)}$sourceOrTargetChanged(e,t,n,o,s){let a,l,h,d;e!==t&&(s===it?(n.sourceId=t,n.sourceElement=o,h=this.getElement(e),a=this.getElement(t),l=this.getElement(n.targetId),d=l):s===Pn&&(n.targetId=t,n.targetElement=o,l=this.getElement(t),d=this.getElement(e),a=this.getElement(n.sourceId),h=a),Np(n,h,d),Dp(n,a,l))}gl(e,t,n,o){n=n||{},o=o||{},t=t||{};let s={},a=Tn(e);a.unshift(e),a.forEach(l=>{let h=this.viewport.getGroupElement(l.id),d=o[l.id]||this.viewport.$computeGroupContentExtents(l,!1,t,n,null),u=this.El(l,t,n,d,!1);if(u!=null&&(s[l.id]=u,n[l.id]=u.size,t[l.id]=u.position,(u.originalSize.width!==u.size.width||u.originalSize.height!==u.size.height)&&(this.$trackGroupSizeChanges({[l.id]:{element:h,originalGroupSize:u.originalSize,newGroupSize:u.size}}),l.group==null))){let p=u.size.width-u.originalSize.width,g=u.size.height-u.originalSize.height;if(this.magnetizerProfile.afterGroupShrink&&(p<0||g<0)){let m=this.$provisionallyGather(l,t,n,!1,!1);this.$_updateVertexPositions({positions:m.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}else if(this.magnetizerProfile.afterGroupGrow){let m=this.$provisionallyMagnetize(l,!1,t,n,!1,!1);this.$_updateVertexPositions({positions:m.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}}})}expandGroup(e){this.model.$transaction(()=>{let t=j(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o=this.ul?this.ul(t,n.lastExpandedSize):null;if(o===!1)return;let s=n.el;if(this.Ou(n)==null){n.collapsed=!1,this.$updateElementClasses(s,[If],[Nf]);let l=new Set,h=new Set,d=new Set;this._u(n,l,h,d,!0),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!0)),l.forEach(p=>this.$_unproxyEdge(p.edge,p.index));let u={};if(this.$_useModelForSizes&&n.lastExpandedSize!=null&&(u[t.id]=n.lastExpandedSize,this.model.updateGroup(t,n.lastExpandedSize)),o!=null){let p=o;for(let g in p)this.model.updateVertex(g,p[g])}this.gl(t,null,u,null),this.magnetizerProfile.afterGroupExpand===!0&&this.magnetize(n.modelObject),this.$revalidateManagedElement(n),this.se(p=>{p.$groupExpanded(n)}),this.fire(su,{group:t})}}},ut,!0)}$_proxyEdge(e,t,n,o){IC(this,e,t,n,o)}$_unproxyEdge(e,t,n){return NC(this,e,t,n)}_u(e,t,n,o,s){let a=e.modelObject.members.map(d=>d.id),l=vE(e.modelObject,!0,!0);this.viewport.$refreshElement(e.id),a.forEach(d=>{this.viewport.$refreshElement(d)});let h=Al(l,d=>!(a.indexOf(d.source.id)!==-1&&a.indexOf(d.target.id)!==-1));h.left.forEach(d=>{t.add({edge:d,index:a.indexOf(d.source.id)===-1?Pn:it})}),h.right.forEach(d=>{o.add(d)}),this.Ru(e).forEach(d=>{this._u(d,t,n,o,!1)})}toggleGroup(e){let t=this.viewport.getGroupElement(j(e)?e:e.id);t!=null&&(t.collapsed?this.expandGroup(e):this.collapseGroup(e))}Ou(e){let t=null;if(e.modelObject.group==null)return null;{let n=e.modelObject.group;for(;n!=null;){let o=this.$getManagedElement(n.id);o.collapsed&&(t=o),n=o.modelObject.group}return t}}collapseGroup(e){this.model.$transaction(()=>{let t=j(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o={width:n.width,height:n.height},s=this.dl==null?null:this.dl(t,o);if(s===!1)return;let a=n.el;if(n.lastExpandedSize=o,this.Ou(n)==null){n.collapsed=!0,this.$updateElementClasses(a,[Nf],[If]);let h=new Set,d=new Set;this.Lu(n,h,d),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!1)),h.forEach(p=>this.$_proxyEdge(p.edge,p.index,n));let u={};if(this.$_useModelForSizes){let p=this.$getCollapsedGroupSize(t,{width:n.width,height:n.height});u[t.id]=p,this.model.updateGroup(t,p)}if(s!=null){let p=s;for(let g in p)this.model.updateVertex(g,p[g])}this.gl(t,null,u,null),this.$revalidateManagedElement(n),this.magnetizerProfile.afterGroupCollapse===!0&&this.gather(n.modelObject),this.se(p=>{p.$groupCollapsed(n)}),this.fire(ou,{group:t})}}},ut,!0)}$computeCollapsedGroupSize(e,t){return this.$collapsedGroupSizeCalculator!=null?this.$collapsedGroupSizeCalculator(e,t):null}$getCollapsedGroupSize(e,t){try{let o=this.$computeCollapsedGroupSize(e,t);if(o!=null)return o}catch(o){U("ERROR: user function getGroupCollapsedSize threw error",o)}let n=this.getGroupDefinition(e);return n&&n.collapsedSize?n.collapsedSize:this.fu}Ru(e){return e.modelObject.members.filter(t=>t.objectType===se.objectType).map(t=>this.viewport.getGroupElement(t.id))}Lu(e,t,n){let o=e.modelObject.members.map(a=>a.id),s=vE(e.modelObject,!0,!0);if(e.proxied!==!1){let a=Al(s,l=>!(o.indexOf(l.source.id)!==-1&&o.indexOf(l.target.id)!==-1));a.left.forEach(l=>{t.add({edge:l,index:o.indexOf(l.source.id)===-1?Pn:it})}),a.right.forEach(l=>{n.add(l)})}else s.forEach(a=>n.add(a));this.Ru(e).forEach(a=>{this.Lu(a,t,n)})}_f(){return this.wu(this.dataSource.getGroups().filter(this.objectFilter))}wu(e){let t=[];return e.forEach(n=>{let o=Tn(n);t.push({group:n,depth:o.length})}),t.sort((n,o)=>n.depth===o.depth?0:n.depth>o.depth?-1:1),t}relayoutGroup(e,t){let n=Y(e)?e:this.dataSource.getGroup(e),o=this.layoutMap.get(n.id);if(o==null)return;let s=this.getElement(n.id),a=s;o.relayout(null,h=>{this.$_updateVertexPositions({positions:h.positions,sizes:h.sizes,resizedGroups:null,offset:{x:a.x,y:a.y},storePositionsInModel:!0,repaintConnections:!1,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.fire(Yl,{element:s,positions:h.positions,sizes:h.sizes,extents:h.bounds})});let l=!0;this.$_dataLoading&&this.$_useModelForSizes&&(l=!1),t===GS&&(l=!1),l&&this.autoSizeGroup(n),this.$revalidateManagedElement(s)}$_updateVertexPositions(e){let t=e.offset||{x:0,y:0},n=new Set,o=fp();for(let s in e.positions){let a=e.positions[s],l=e.sizes!=null?e.sizes[s].width:null,h=e.sizes!=null?e.sizes[s].height:null,d=this.viewport.updateElement(s,a.x+t.x,a.y+t.y,l,h,null,null,!1);e.writeSizesToElements&&l!=null&&h!=null&&this.$setElementSizeInUI(this.getElement(s).el,l,h),n.add(this.getElement(s)),this.$setViewportElementPosition(d,a),e.storePositionsInModel&&this.$storePositionInModel({id:s,pos:a})}if(e.resizedGroups!=null)for(let s in e.resizedGroups){let a=e.resizedGroups[s].newGroupSize;this.viewport.updateElement(s,null,null,a.width,a.height,null,e.resizedGroups[s].group,!1),n.add(this.getElement(s)),this.$_useModelForSizes&&this.Rf(s,a)}if(e.rotations!=null)for(let s in e.rotations){let a=this.getElement(s);this.viewport.updateElement(s,null,null,null,null,e.rotations[s],null,!1),n.add(a),e.writeRotationsToElements&&this.$setElementRotation(a.el,e.rotations[s])}return e.repaintConnections&&n.forEach(s=>{this.$repaintUIElement(s).forEach(l=>o.add(l))}),o}relayout(e,t){this.Du(n=>{this.$_layout.relayout(e,n)},n=>{this.$afterRelayout(n)},On,t)}refresh(e){this.Du(t=>{this.$_layout.layout(t)},t=>{this.$afterRefresh(t)},qs,e)}Du(e,t,n,o){if(!this.yt){let s={};e(a=>{let l=a.positions;if(this.magnetizerProfile.afterLayout){let p=[];for(let m in l)p.push(this.dataSource.getVertex(m));this.magnetizer.setElements(p);let g=this.magnetizer.executeAtCenter({getPosition:m=>l[m.id],getSize:m=>a.sizes[m.id]});for(let m in g.current)l[m]=g.current[m]}let h=this.Lf(),d=h.orderedGroups.length>0&&!(this.$_dataLoading&&this.$_useModelForSizes),u={};if(d){let p=(m,E)=>h.info[m].positions[E]||this.getElementPosition(E),g=(m,E)=>a.sizes[E]||h.info[m].sizes[E]||this.getElementSize(E);h.orderedGroups.forEach(m=>{let E=Di();m.group.members.forEach(x=>{let f=p(m.group.id,x.id),b=g(m.group.id,x.id);E.xmin=Math.min(E.xmin,f.x),E.ymin=Math.min(E.ymin,f.y),E.xmax=Math.max(E.xmax,f.x+b.width),E.ymax=Math.max(E.ymax,f.y+b.height)});let y=this.El(m.group,l,a.sizes,E,!1);if(y!=null&&(s[m.group.id]={group:m.group,newGroupSize:y.size,originalGroupSize:y.originalSize},l[m.group.id]!=null&&(l[m.group.id]=y.position),u[m.group.id]=this.$_getGroupContentAreaInfo(m.group.id),a.sizes[m.group.id]=y.size,y.layoutShiftX!==0||y.layoutShiftY!==0)){let x=h.info[m.group.id].positions;for(let f in x)x[f].x+=y.layoutShiftX,x[f].y+=y.layoutShiftY}})}this.$_updateVertexPositions({positions:l,sizes:a.sizes,resizedGroups:s,offset:null,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),h.orderedGroups.reverse().forEach(p=>{let g=p.group.id,m=h.info[g],E=l[g]||ft(m.element),y=u[g]||this.$_getGroupContentAreaInfo(g);y&&(E.x+=y.internalOffset.x,E.y+=y.internalOffset.y),this.$_updateVertexPositions({positions:m.positions,sizes:m.sizes,resizedGroups:s,offset:E,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}),o!==!0&&this.repaintEverything(!0),t({bounds:a.bounds,positions:a.positions,sizes:a.sizes,layout:a.layout}),this.fire(n,{positions:a.positions,sizes:a.sizes,layout:a.layout});for(let p in h.info)this.fire(Yl,h.info[p])})}}repaintEdge(e){let t=this.getRenderedConnection(e.id);this.$paintConnection(t)}repaintEdges(e){let t=$();e.forEach(n=>{let o=this.getRenderedConnection(n.id);this.$paintConnection(o,{timestamp:t})})}$paintConnection(e,t){if(!this.yt&&e.visible!==!1){t=t||{};let n=t.timestamp;if(n!=null&&n===e.lastPaintedAt)return;if(n==null||n!==e.lastPaintedAt){this.router.$computePath(e,n);let o=e.sourceMarker;if(o!=null&&o.visible){let a=this.$drawOverlay(o,e.connector,e.paintStyleInUse);e.overlayPlacements[o.id]=a,e.connector.internalSegments.length>0&&(e.connector.internalSegments[0].x1=a.tail.x,e.connector.internalSegments[0].y1=a.tail.y)}let s=e.targetMarker;if(s!=null&&s.visible){let a=this.$drawOverlay(s,e.connector,e.paintStyleInUse);e.overlayPlacements[s.id]=a;let l=e.connector.internalSegments.length-1;e.connector.internalSegments.length>0&&(e.connector.internalSegments[l].x2=a.tail.x,e.connector.internalSegments[l].y2=a.tail.y)}for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l!==o&&l!==s&&l.visible&&(e.overlayPlacements[a]=this.$drawOverlay(l,e.connector,e.paintStyleInUse,er.getAbsoluteOverlayPosition(e,l)))}this.$paintConnector(e,e.paintStyleInUse);for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l.visible&&this.$paintOverlay(l,e.overlayPlacements[a],e.connector)}this.viewport.$updateEdge({id:e.edge.id,x:e.connector.x,y:e.connector.y,width:e.connector.width,height:e.connector.height})}e.lastPaintedAt=n,t.fireEvent&&this.fire(tS,e),this.ll.length>0&&this.ll.forEach(o=>o.$edgeRedraw(e))}}$addOverlay(e,t,n){let o=ph(e,t);return o!=null&&(o.ignoreTypes=!0,n||this.$repaintUIElementById(e.sourceId)),o}$removeOverlay(e,t){rs(e,t),this.$repaintUIElementById(e.sourceId)}$_setLineStyle(e,t,n){t.hasOwnProperty("lineWidth")&&(e.paintStyle.strokeWidth=t.lineWidth,e.hoverPaintStyle.strokeWidth=t.lineWidth),t.hasOwnProperty("outlineWidth")&&(e.paintStyle.outlineWidth=t.outlineWidth,e.hoverPaintStyle.outlineWidth=t.outlineWidth),t.hasOwnProperty("color")&&(e.paintStyle.stroke=t.color),t.hasOwnProperty("outlineColor")&&(e.paintStyle.outlineStroke=t.outlineColor),t.hasOwnProperty("dashArray")&&(e.paintStyle.dashArray=t.dashArray),Cp(e),n&&this.$paintConnection(e)}$setView(e){this.view=new Ep(this.dataSource,this.dataSource.getModel(),e,this)}findIntersectingVertices(e){if(e.dontIncludeNodes===!0&&e.dontIncludeGroups===!0&&e.dontIncludeNodesInsideGroups===!0)return[];let t={x:e.origin.x,y:e.origin.y,width:e.dimensions.width,height:e.dimensions.height},o=(e.enclosed?this.viewport.findVerticesEnclosedByRect(t,0,!1,[],!1):this.viewport.findVerticesIntersectingWithRect(t,0,!1,[],!1)).filter(a=>{let l=K(a.modelObject),h=l&&AE(a.modelObject),d=Y(a.modelObject),u=d&&SE(a.modelObject),p=e.dontIncludeNodes===!0&&l,g=e.dontIncludeGroups===!0&&d,m=e.dontIncludeNodesInsideGroups&&h,E=e.dontIncludeNestedGroups&&u;return!(p||g||m||E)}),s=e.filter||(()=>!0);return o.filter(a=>s(a.modelObject)).map(a=>({enclosed:e.enclosed,id:a.id,r:a,v:a.modelObject,el:a.el}))}findEnclosedVertices(e){return this.findIntersectingVertices(Object.assign(e,{enclosed:!0}))}Su(e){let t=this.viewport.getGroupElement(e.id);return t==null?null:this.$getGroupContentAreaElement(t.el)}$_getGroupContentAreaInfo(e){let t=this.viewport.getGroupElement(e);if(t==null)return{pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0},contentArea:null,isGroupElement:!0};{let n=this.$getGroupContentAreaElement(t.el);if(n!==t.el){let o=this.$getElementPositionInUIRelativeToParent(n);return{pageOrigin:{x:t.x+o.x,y:t.y+o.y},internalOffset:{x:o.x,y:o.y},contentArea:n,isGroupElement:!1}}else return{pageOrigin:{x:t.x,y:t.y},internalOffset:{x:0,y:0},contentArea:t.el,isGroupElement:!0}}}getElementPosition(e){return this.viewport.getElementPosition(e)}getElementSize(e){return this.viewport.getElementSize(e)}getElement(e){return this.viewport.getElement(e)}getGroupElement(e){return this.viewport.getGroupElement(e)}getObjectInfo(e,t){if(e==null)return{id:null,obj:null,el:null,type:null,managedElement:null};if(Ea(e)){let n=e.edge;return{obj:n,id:n.id,type:ze.objectType,el:e.connector.canvas,managedElement:null}}else if(this.$isElement(e)){let n=this.getModelObjectFromElement(e,!0,t);if(n!=null){let o=this.dataSource.resolveFullId(n.obj);return{el:n.el,obj:n.obj,type:n.obj.objectType,id:o,managedElement:this.getElement(o)}}else{let o=this.W(e);return{id:o,obj:null,el:e,type:null,uiOnly:!0,managedElement:this.getElement(o)}}}else{let n=this.dataSource.getObjectInfo(e);return n.obj!=null?n.type===ze.objectType?Object.assign({el:this.getRenderedConnection(n.id).connector.canvas,managedElement:null},n):Object.assign({el:this.getRenderedElement(n.obj),managedElement:this.getElement(n.obj.getFullId())},n):Object.assign({el:null,managedElement:null},n)}}fl(){let e=this.dataSource.getNodes().filter(t=>t.group==null);return e.push(...this.dataSource.getGroups().filter(t=>t.group==null)),e}wf(e,t,n,o,s,a,l,h,d,u){let p={invertTrackbackPreference:u};if(t&&(p.origin=t),n&&(p.gather=n),!h&&!d&&this.magnetizer.setElements(a),e){let m=this.getObjectInfo(e,!1);if(m.obj)if(!l)p.focus=m.obj.id;else{let E=this.getElement(m.obj.id);p.origin={x:E.x+E.width/2,y:E.y+E.height/2},p.filter=y=>y===m.obj.id}}o&&(p.knownLocations=o),s&&(p.knownSizes=s);let g=this.getGrid();return g&&(p.grid=g),p}xs(e,t,n,o,s,a,l,h,d,u){a==null&&(a=h?[]:this.fl());let p=this.wf(e,t,n,o,s,a,l,h,d,u);return p.focus!=null?this.magnetizer.executeWithFocus(p.focus,p):t!=null?this.magnetizer.executeAtPoint(t,p):this.magnetizer.executeAtCenter(p)}fs(e,t,n,o,s,a,l,h,d){let u=this.xs(e,t,n,o,s,null,a,l,h,d);this.bs(u,zS)}magnetize(e,t){this.fs(e,null,!1,null,null,t,!1,!1,!1)}$provisionallyMagnetize(e,t,n,o,s,a){return this.xs(e,null,!1,n,o,null,t,!1,s,a)}$provisionallyGather(e,t,n,o,s){return this.xs(e,null,!0,t,n,null,!1,!1,o,s)}magnetizeAtPoint(e){this.fs(null,e,!1,null,null,null,!1,!1,!1)}gather(e){this.fs(e,null,!0,null,null,null,!1,!1,!1)}$startMagnetizer(){this.magnetizer.startTracking(this.fl(),this.magnetizerProfile.trackback,this.magnetizerProfile.trackbackThreshold)}$stopMagnetizer(){this.magnetizer.stopTracking()}$startMotion(){this.$isInMotion=!0}$stopMotion(){this.$isInMotion=!1}Nu(e){return{[this.$modelLeftAttribute]:e.x,[this.$modelTopAttribute]:e.y}}Df(e,t){let n=this.Nu(t);this.model.updateVertex(e,n)}bs(e,t,n){this.model.openTransaction(ut);try{for(let o in e.current){let s=this.Nu(e.current[o]);this.model.$_updateVertex(o,s,t,!1)}n&&n()}catch(o){U("Exception thrown when setting position",o)}finally{this.model.commitTransaction()}}$storePositionInModel(e){let t=typeof e=="string"?e:e.id,n=typeof e=="string"?null:e.pos,o=this.getModelPositionAttributes(),s=typeof e=="string"?o.x:e.leftAttribute||o.x,a=typeof e=="string"?o.y:e.topAttribute||o.y,l=e.obj||this.dataSource.getVertex(t);return l&&(n==null&&(n=this.getElementPosition(l.id)),De(l.data,s,n.x),De(l.data,a,n.y)),n}Rf(e,t){let n=j(e)?this.dataSource.getVertex(e):e;n&&(t==null&&(t=this.getElementSize(n.id)),De(n.data,this.$modelWidthAttribute,t.width),De(n.data,this.$modelHeightAttribute,t.height))}setMagnetizedPosition(e,t,n){this.setPosition(e,t,n,!0)}setPosition(e,t,n,o,s){let a=this.getObjectInfo(e,!1);if(a.obj)if(a.obj.group==null){let l=this.Nf(a.obj,t,n,o,s===!1,!1,!1,!1);this.bs(l,bu)}else{let l=a.obj.group,h=this.viewport.getGroupElement(l.id);if(h!=null){let d={[a.id]:{x:t+h.x,y:n+h.y}},u={[a.id]:{x:t,y:n}},p=this.viewport.$computeGroupContentExtents(l,!1,d,null,null);this.bs({original:{},current:u},bu,()=>{this.gl(l,u,null,{[l.id]:p})})}}}adHocGroupLayout(e,t){if(t){let n=this.dataSource.getObjectInfo(e);if(n.obj){let o=this.layoutMap.get(n.id);this.layoutMap.set(n.id,this.Tu(t,n.obj)),this.relayoutGroup(n.obj,VS),this.layoutMap.set(n.id,o)}}}getGroupDefinition(e){return this.view.getGroupDefinition(this.model.getNodeType(e.data))}getPortDefinition(e){return this.view.getPortDefinition(this.model.getPortType(e.data))}getNodeDefinition(e){return this.view.getNodeDefinition(this.model.getNodeType(e.data))}Nf(e,t,n,o,s,a,l,h){let d={x:t,y:n};if(o){let u=this.xs(e,{x:t,y:n},!1,{[e.id]:{x:t,y:n}},null,null,s,a,l,h);return u.original[e.id]={x:t,y:n},u.current[e.id]={x:t,y:n},u}else return this.If()&&(d=he(d,this.getGrid())),{original:{[e.id]:d},current:{[e.id]:d}}}getModelPositionAttributes(){return{x:this.$modelLeftAttribute,y:this.$modelTopAttribute}}storePositionsInModel(e){e=e||{};let t=this.getModelPositionAttributes(),n=e.leftAttribute||t.x,o=e.topAttribute||t.y,s=(a,l)=>{let h=this.getElement(l.id);De(l.data,n,h.x),De(l.data,o,h.y)};this.dataSource.eachNode((a,l)=>s(a,l)),this.dataSource.eachGroup((a,l)=>s(a,l))}setGrid(e){this.gridProfile==null?this.gridProfile=new mh({size:e}):this.gridProfile.grid=e}getGrid(){return this.gridProfile==null?null:this.gridProfile.grid}If(){return this.gridProfile!=null&&this.gridProfile.snap}JA(e){if(this.gridProfile!=null){let t=this.$getSize(e),n=he({x:t.width,y:t.height},this.gridProfile.grid);return this.$setElementSizeInUI(e,n.x,n.y),{width:n.x,height:n.y}}return null}snapToGrid(e,t){t=t||this.getGrid();let n;if(t){e!=null&&(n=this.getObjectInfo(e,!1).obj),n!=null?this.magnetizer.setElements([n]):this.magnetizer.setElements(this.fl());let o=this.magnetizer.snapToGrid(t);return this.bs(o,XS),o}}autoSizeGroup(e,t){let n=new Set;return n.add(e),this.$_sizeGroupsToFit(n,null,null,t)[e.id]}$_sizeGroupsToFit(e,t,n,o){let s=this.wu(Array.from(e));t=t||{},n=n||{};let a={};return s.forEach(l=>{if(a[l.group.id]==null){let h=this.Vf(l.group,o,t,n);Object.assign(a,h)}}),this.$trackGroupSizeChanges(a),a}Vf(e,t,n,o){let s={};n=n||{},o=o||{};let a=l=>{let h=this.viewport.getGroupElement(l.id),d=this.viewport.$computeGroupContentExtents(l,!1,null,o,null),u=this.El(l,n,o,d,t);u!=null&&(o[l.id]=u.size,s[l.id]={element:h,newGroupSize:u.size,originalGroupSize:u.originalSize},l.group&&a(l.group))};return e&&a(e),s}Lf(){let e={orderedGroups:this._f(),info:{}};return e.orderedGroups.forEach(t=>{let n=this.layoutMap.get(t.group.id);if(n!=null){let o=this.viewport.getGroupElement(t.group.id);n.relayout(null,s=>{e.info[t.group.id]={positions:s.positions,sizes:s.sizes,extents:s.bounds,element:o}})}}),e}getGroupContentExtents(e,t){return this.viewport.$computeGroupContentExtents(e,t,null,null,null)}$trackGroupSizeChanges(e){for(let t in e){let n=e[t];if(n.originalGroupSize.width!==n.newGroupSize.width||n.originalGroupSize.height!==n.newGroupSize.height){let o=n.element.modelObject,s={[this.$modelWidthAttribute]:n.newGroupSize.width,[this.$modelHeightAttribute]:n.newGroupSize.height};o.data[this.$modelWidthAttribute]=n.newGroupSize.width,o.data[this.$modelHeightAttribute]=n.newGroupSize.height;let a=this.viewport.updateElement(o.id,null,null,n.newGroupSize.width,n.newGroupSize.height,null,null,!1);this.$doVertexUpdated(a),this.$repaintUIElement(a,null,!0),this.model.fire(Vd,{group:o,originalGroupSize:n.originalGroupSize,newGroupSize:n.newGroupSize,source:this}),this.se(l=>{l.$groupResized(n)}),this.model.fire(ve,{vertex:o,updates:s,originalData:o.data,reason:YS},null)}}}El(e,t,n,o,s){t=t||{},n=n||{};let a=this.getGroupDefinition(e),l=s||a.autoShrink||a.autoGrow||a.autoSize||a.elastic,h=a.autoShrink===!0||a.elastic===!0||a.autoSize===!0&&a.autoShrink!==!1,d=a.autoGrow===!0||a.elastic===!0||a.autoSize===!0&&a.autoGrow!==!1;if(!l)return null;let u=P=>t[P]||this.getElementPosition(P),p=P=>n[P]||this.getElementSize(P),g=this.$_getGroupContentAreaInfo(e.id),m=g.contentArea,E=0,y=0,x,f,b=p(e.id),A=g.isGroupElement?p(e.id):this.$getSize(m),T=Math.max(A.width,b.width),S=Math.max(A.height,b.height),O=Object.assign({},u(e.id)),v,_=null;if(_!=null)E=_.layoutShiftX,y=_.layoutShiftY,x=_.width,f=_.height,v={x:O.x-E,y:O.y-y};else{let P=wp(o,a,!1,h,d,this.gridProfile);x=P.width,f=P.height,E=P.layoutShiftX,y=P.layoutShiftY,v={x:O.x-E,y:O.y-y}}if(x=parseInt(x,10),f=parseInt(f,10),this.$setElementSizeInUI(m,x,f),!g.isGroupElement){let P=this.viewport.getGroupElement(e.id),I=this.$getSize(P.el),C=I.width-T,R=I.height-S;if(!s&&h===!1){let w=!1;C<0&&(this.$setElementWidth(m,T-g.internalOffset.x),C=0,w=!0),R<0&&(this.$setElementHeight(m,S-g.internalOffset.y),R=0,w=!0),w&&(I=this.$getSize(P.el))}if(!s&&d===!1){let w=!1;C>0&&(this.$setElementWidth(m,T-g.internalOffset.x),C=0,w=!0),R>0&&(this.$setElementHeight(m,S-g.internalOffset.y),R=0,w=!0),w&&(I=this.$getSize(P.el))}x=I.width,f=I.height}return{position:v,size:{width:x,height:f},originalSize:{width:T,height:S},layoutShiftX:E,layoutShiftY:y}}autoSizeGroups(e,t){return e=e||this.getGroups(),this.$_sizeGroupsToFit(new Set(e),null,null,t)}Iu(e){let t={container:this.fe,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createDefaultLayoutAdapter()};return t.options.locationFunction||(t.options.locationFunction=n=>({x:De(n.data,this.$modelLeftAttribute),y:De(n.data,this.$modelTopAttribute)})),nt.get(e.type,t)}Tu(e,t){let n=this.Su(t);n==null&&(n=this.$getManagedElement(t.id).el);let o={container:n,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createGroupLayoutAdapter(t)};return o.options.locationFunction||(o.options.locationFunction=s=>{let a={x:De(s.data,this.$modelLeftAttribute),y:De(s.data,this.$modelTopAttribute)};return j(a.x)&&(a.x=parseInt(a.x,10)),j(a.y)&&(a.y=parseInt(a.y,10)),a}),nt.get(e.type,o)}setLayout(e,t){e&&(this.$_layout=this.Iu(e),t||this.refresh())}adHocLayout(e){e&&this.model.transaction(()=>{for(let n in this.$_connMap){let o=this.$_connMap[n].edge;this.model.clearEdgeGeometry(o)}this.Iu(e).layout(n=>{for(let o in n.positions)this.Df(o,n.positions[o])})})}$_doRenderTransientVertex(e,t,n,o,s,a,l){let h=this.$renderTransientVertex(t,n,o,s,a,l);return this.$appendVertexElement(h),this.$manage(h,e,t,n,null,!1)}$addTransientVertex(e,t,n,o,s,a){let l=this.model.$addTransientVertex(n,this),h=this.$_doRenderTransientVertex(l,e,t,n,o,s,a);return{vertex:l,el:h}}$renderDummyVertex(e){let t={x:e.data[this.$modelLeftAttribute]||0,y:e.data[this.$modelTopAttribute]||0};this.$_doRenderTransientVertex(e,t,{width:1,height:1},e.data,{},[eo,Iv].join(" "),{[te]:e.id})}$removeTransientVertex(e){this.model.$cleanupTransientVertex(e.modelObject,this)}$addTransientEdge(e,t,n,o){return this.model.$addTransientEdge(this,e,t,n,null,o)}$isUnattachedEdgeAllowed(e){let t=this.model.getEdgeType(e.data),n=this.view.getEdgeDefinition(t);return n.allowUnattached!=null?n.allowUnattached:this.$_allowUnattachedEdges===!0}Vu(e){(e.plugins||[]).forEach(n=>{this.Mu(n,!0)})}addPlugin(e){return this.Mu(e,!0)}Mu(e,t){let n=j(e)?e:e.type,o=j(e)?{}:e.options||{},s=un.get(n);if(s!=null)return s.initialise(this,o),this.plugins.push(s),this.pluginMap.set(n,s),s.tracksEdgeRedraws&&this.ll.push(s),t&&this.fire(hu,s),s}getPlugin(e){return this.pluginMap.get(e)}se(e){this.plugins.forEach(t=>{try{e(t)}catch(n){U(`WARN: could not dispatch event to plugin ${t.id} [${n}]`)}})}registerDataHook(e){this.$_dataHooks.push(e)}save(e){let t={data:this.model.exportData(e),zoom:this.K};return this.$_dataHooks.forEach(n=>{n.save(t)}),t}saveToUrl(e){this.model.save(Object.assign(e,{data:this.save(e)}))}load(e,t){this.model.load({data:e.data,onload:()=>{e.zoom&&this.setZoom(e.zoom),this.$_dataHooks.forEach(n=>{n.load(e)}),t&&t()}})}$isArrayLike(e){return!j(e)&&Array.isArray(e)}};var tN=20,rN=20,Mp=class Mp extends Vn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"length");c(this,"foldback");c(this,"direction");c(this,"type",Mp.type);c(this,"contentTags",[q]);n=n||{},this.width=n.width||tN,this.length=n.length||rN,this.direction=(n.direction||1)<0?-1:1,this.foldback=n.foldback||.623}draw(e,t,n){let o,s,a,l,h;if(this.location>1||this.location<0){let m=this.location<0?1:0;o=Be(e,m,this.location,!1),s=Be(e,m,this.location-this.direction*this.length/2,!1),a=kt(o,s,this.length)}else if(this.location===1){if(o={x:e.paintInfo.tx,y:e.paintInfo.ty},s=Be(e,this.location,-this.length),a=kt(o,s,this.length),this.direction===-1){let m=a;a=o,o=m}}else if(this.location===0){if(a={x:e.paintInfo.sx,y:e.paintInfo.sy},s=Be(e,this.location,this.length),o=kt(a,s,this.length),this.direction===-1){let m=a;a=o,o=m}}else o=Be(e,this.location,this.direction*this.length/2),s=mr(e,this.location),a=kt(o,s,this.length);l=Dt(o,a,this.width),h=kt(o,a,this.foldback*this.length);let{stroke:d,fill:u,lineWidth:p}=this.$getStyle(t);return{atts:[{d:isNaN(h.x)||isNaN(h.y)?"M 0 0":"M"+o.x+","+o.y+" L"+l[0].x+","+l[0].y+" L"+h.x+","+h.y+" L"+l[1].x+","+l[1].y+" Z","stroke-width":p,stroke:d,fill:u}],xmin:Math.min(o.x,l[0].x,l[1].x),xmax:Math.max(o.x,l[0].x,l[1].x),ymin:Math.min(o.y,l[0].y,l[1].y),ymax:Math.max(o.y,l[0].y,l[1].y),tail:h}}};c(Mp,"type","Arrow");var Or=Mp;at.register(Or.type,Or);var Gp=class Gp extends Or{constructor(e,t,n){super(e,t,n);c(this,"type",Gp.type);this.foldback=1}};c(Gp,"type","PlainArrow");var Vp=Gp;at.register(Vp.type,Vp);var Bp=class Bp extends Or{constructor(e,t,n){super(e,t,n);c(this,"type",Bp.type);this.length=this.length/2,this.foldback=2}};c(Bp,"type","Diamond");var $p=Bp;at.register($p.type,$p);var qf="Custom",Qf=class extends pi{constructor(e,t,n){super(t,n);this.connection=t;c(this,"create");c(this,"isSimpleShape",!1);c(this,"rotatable");c(this,"type",qf);this.create=n.create,this.rotatable=n.rotatable}updateFrom(e,t){}};function pn(i){return i.type===qf}at.register(qf,Qf);var nN=5,Up=class Up extends Vn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"Oe");c(this,"Hr");c(this,"type",Up.type);c(this,"contentTags",[Fe]);n=n||{},this.Oe=n.radius||nN,this.Hr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h;if(this.location===0)if(this.Hr==="center")l={x:e.paintInfo.sx,y:e.paintInfo.sy},h=Be(e,this.location,this.Oe);else{let d={x:e.paintInfo.sx,y:e.paintInfo.sy},u=Be(e,this.location,this.Oe);l=kt(d,u,this.Oe),h=Be(e,this.location,2*this.Oe)}else if(this.location===1)if(this.Hr==="center")l={x:e.paintInfo.tx,y:e.paintInfo.ty},h=Be(e,this.location,-this.Oe);else{let d={x:e.paintInfo.tx,y:e.paintInfo.ty},u=Be(e,this.location,-this.Oe);l=kt(d,u,this.Oe),h=Be(e,this.location,-2*this.Oe)}else l=mr(e,this.location),h=Be(e,this.location,this.Oe);return{atts:[{cx:l.x,cy:l.y,r:this.Oe,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.Oe,xmax:l.x+this.Oe,ymin:l.y-this.Oe,ymax:l.y+this.Oe,tail:h}}};c(Up,"type","Dot");var Fp=Up;at.register(Fp.type,Fp);var iN=10,oN=10,zp=class zp extends Vn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"height");c(this,"Gu");c(this,"Hr");c(this,"type",zp.type);c(this,"contentTags",[q]);n=n||{},this.width=n.width||iN,this.height=n.height||oN,this.Gu=n.rotate===!0,this.Hr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h,d,u,p,g,m,E,y,x,f,b,A,T,S,O;if(this.Gu){if(this.location===0){let v={x:e.paintInfo.sx,y:e.paintInfo.sy},_,P;this.Hr==="center"?(P=Be(e,this.location,this.width/2),_=kt(P,v,this.width)):(_=v,P=Be(e,this.location,this.width)),S=Dt(P,_,this.height),O=Dt(_,P,this.height),g=P}else if(this.location===1){let v={x:e.paintInfo.tx,y:e.paintInfo.ty},_,P;this.Hr==="center"?(P=Be(e,this.location,-this.width/2),_=kt(P,v,this.width)):(_=v,P=Be(e,this.location,-this.width)),S=Dt(_,P,this.height),O=Dt(P,_,this.height),g=P}else{let v=Be(e,this.location,this.width/2),_=mr(e,this.location),P=kt(v,_,this.width);S=Dt(v,P,this.height),O=Dt(P,v,this.height),g=P}m=S[0].x,E=S[0].y,y=S[1].x,x=S[1].y,f=O[1].x,b=O[1].y,A=O[0].x,T=O[0].y}else{let v;this.location===0?v={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?v={x:e.paintInfo.tx,y:e.paintInfo.ty}:v=mr(e,this.location),g=v,m=v.x-this.width/2,E=v.y-this.height/2,y=m+this.width,x=E,f=y,b=E+this.height,A=m,T=E+this.height}return h=Math.min(m,y,f,A),d=Math.max(m,y,f,A),u=Math.min(E,x,b,T),p=Math.max(E,x,b,T),l=`M ${m} ${E} L ${y} ${x} L ${f} ${b} L ${A} ${T} Z`,{atts:[{"stroke-width":a,stroke:o,fill:s,d:l}],xmin:h,xmax:d,ymin:u,ymax:p,tail:g}}};c(zp,"type","Rectangle");var Yp=zp;at.register(Yp.type,Yp);var sN=8,aN=5,jp=class jp extends Vn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"rx");c(this,"ry");c(this,"type",jp.type);c(this,"contentTags",[RC]);n=n||{},this.rx=n.rx||sN,this.ry=n.ry||aN}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l;return this.location===0?l={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?l={x:e.paintInfo.tx,y:e.paintInfo.ty}:l=mr(e,this.location),{atts:[{cx:l.x,cy:l.y,rx:this.rx,ry:this.ry,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.rx,xmax:l.x+this.rx,ymin:l.y-this.ry,ymax:l.y+this.ry,tail:Be(e,this.location,(this.ry+this.rx)/2)}}};c(jp,"type","Ellipse");var Xp=jp;at.register(Xp.type,Xp);var Hp=class{constructor(r,e){this.surface=r;c(this,"or");c(this,"$u");e=e||{edgeMappings:[]},this.or=e.edgeMappings||[],this.$u=this.surface.model.edgeTypeFunction,this.Mf()}computeTypes(r){let e=[this.$u(r)];for(let t=0;t<this.or.length;t++){let n=this.or[t].property,o=this.or[t].mappings;if(j(n)){if(r[n]!=null){let s=j(r[n])?r[n].split(" "):[r[n]];e.push(...s.filter(a=>o[a]!=null).map(a=>`${n}_${a}`))}o[Er]!=null&&r[n]!=null&&e.push(`${n}_${Er}`)}else{let s=n.map(a=>r[a]);if(s.every(a=>a!=null)){let a=s.join(" ");o[a]!=null&&e.push(`${n.join("_")}_${a.replace(/ /g,"_")}`)}}}return e.join(" ")}Mf(){for(let r=0;r<this.or.length;r++){let e=this.or[r].property,t=this.or[r].mappings;for(let n in t)if(t.hasOwnProperty(n)){let o=j(e)?`${e}_${n}`:`${e.join("_")}_${n.replace(/ /g,"_")}`;this.surface.$registerConnectionType(o,t[n])}}this.surface.model.edgeTypeFunction=r=>this.computeTypes(r)}getPropertyMappings(){return this.or}};function lN(i,r,e,t,n,o,s){return new Touch({target:i,identifier:$(),pageX:r,pageY:e,screenX:t,screenY:n,clientX:o||t,clientY:s||n})}function hN(...i){let r=[];return r.push(...i),r.item=function(e){return this[e]},r}function cN(i,r,e,t,n,o,s){return hN(lN(i,r,e,t,n,o,s))}function fa(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function Eh(i){return i.srcElement||i.target}function ey(i,r,e,t){if(t){let n=i.composedPath?i.composedPath():i.path;if(typeof n!="undefined"&&n.indexOf)return{path:n,end:n.indexOf(e)};{let o={path:[],end:-1},s=a=>{o.path.push(a),a===e?o.end=o.path.length-1:a.parentNode!=null&&s(a.parentNode)};return s(r),o}}else return{path:[r],end:1}}function dN(i,r){let e=0,t;for(e=0,t=i.length;e<t&&i[e][0]!==r;e++);e<i.length&&i.splice(e,1)}var uN=1,MC=!1,VC=!1;function Gn(){return MC||"ontouchstart"in document.documentElement||navigator.maxTouchPoints!=null&&navigator.maxTouchPoints>0}function Ei(){return VC||"onmousedown"in document.documentElement}function pN(i){MC=i}function gN(i){VC=i}var mi={[ge]:yS,[le]:xS,[ae]:bS};function ty(i,r){if(i==null)return{x:0,y:0};let e=is(i),t=oy(e,0);return r(t)}function Ee(i){return ty(i,r=>({x:r.pageX,y:r.pageY}))}function mN(i){return ty(i,r=>({x:r.screenX,y:r.screenY}))}function EN(i){return ty(i,r=>({x:r.clientX,y:r.clientY}))}function oy(i,r){return i.item?i.item(r):i[r]}function is(i){return i.touches!=null&&i.touches.length>0?i.touches:i.changedTouches&&i.changedTouches.length>0?i.changedTouches:i.targetTouches&&i.targetTouches.length>0?i.targetTouches:[i]}function FC(i){return is(i).length}function fN(i){if(i==null)return{x:0,y:0};if(i.pageX!==null)return{x:i.pageX,y:i.pageY};{let r=is(i),e=oy(r,0);return e!=null&&e.pageX!=null?{x:e.pageX,y:e.pageY}:{x:0,y:0}}}function kp(i,r,e,t,n){$C(i,r,e),t.ar=e.ar,i.addEventListener&&i.addEventListener(r,e,!1,n)}function fh(i,r,e){e!=null&&GC(i,t=>{yN(t,r,e),e.ar!=null&&t.removeEventListener&&(t.removeEventListener(r,e,!1),Gn()&&mi[r]&&t.removeEventListener(mi[r],e,!1)),e.Bu&&fh(i,e.Bu[1],e.Bu[0])})}function GC(i,r){if(i==null)return;let e=typeof i=="string"?document.querySelectorAll(i):Array.isArray(i)?i:[i];for(let t=0;t<e.length;t++)r(e[t])}function $C(i,r,e){let t=uN++;return i.Wr=i.Wr||{},i.Wr[r]=i.Wr[r]||{},i.Wr[r][t]=e,e.ar=t,t}function yN(i,r,e){if(i.Wr&&i.Wr[r]&&delete i.Wr[r][e.ar],e.Zr){for(let t=0;t<e.Zr.length;t++)fh(i,e.Zr[t][0],e.Zr[t][1]);e.Zr.length=0}e.yl&&e.yl()}var xN=/:not\(([^)]+)\)/;function Wp(i,r,e,t){if(i==null)return e;{let n=i.split(","),o=[],s=[];n.forEach(l=>{let h=l.match(xN);h!=null?s.push(h[1]):o.push(l)}),s.length>0&&o.length===0&&o.push(Er);let a=l=>{a.ar=e.ar;let h=Eh(l),d=!1,u=h,p=ey(l,h,r,i!=null);if(p.end!=-1)for(let g=0;!d&&g<p.end;g++){u=p.path[g];for(let m=0;m<s.length;m++)if(fa(u,s[m],r))return;for(let m=0;!d&&m<o.length;m++)if(fa(u,o[m],r)){e.apply(u,[l,u]),d=!0;break}}};return bN(e,t,a),a}}function bN(i,r,e){i.Zr=i.Zr||[],i.Zr.push([r,e])}var Zp=(i,r,e,t,n)=>{if(Gn()&&mi[r]){let o=Wp(t,i,e,mi[r]);kp(i,mi[r],o,e,n)}r===ES&&i.getAttribute(Lf)==null&&i.setAttribute(Lf,"1"),kp(i,r,Wp(t,i,e,r),e,n)},ry={[W]:{touches:1,taps:1},[Yr]:{touches:1,taps:2},[At]:{touches:2,taps:1}};function BC(i,r,e,t){for(let n in e.Me[i])e.Me[i].hasOwnProperty(n)&&e.Me[i][n].apply(t,[r])}var ny=class{static generate(r,e){return(t,n,o,s)=>{if(n==At&&Ei())Zp(t,n,o,s);else{if(t.ke==null){let a=t.ke={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},l=function(){a.down=!1},h=function(){a.taps=0},d=p=>{let g=Eh(p),m=ey(p,g,t,s!=null),E=!1;for(let y=0;y<m.end;y++){if(E)return;g=m.path[y];for(let x=0;x<a.downSelectors.length;x++)if(a.downSelectors[x]==null||fa(g,a.downSelectors[x],t)){a.down=!0,setTimeout(l,r),setTimeout(h,e),E=!0;break}}},u=p=>{if(a.down){let g=Eh(p),m,E;a.taps++;let y=FC(p);for(let x in ry)if(ry.hasOwnProperty(x)){let f=ry[x];if(f.touches===y&&(f.taps===1||f.taps===a.taps))for(let b=0;b<a[x].length;b++){E=ey(p,g,t,a[x][b][1]!=null);for(let A=0;A<E.end;A++)if(m=E.path[A],a[x][b][1]==null||fa(m,a[x][b][1],t)){a[x][b][0].apply(m,[p,m]);break}}}}};t.ke.downHandler=d,t.ke.upHandler=u,Zp(t,ge,d),Zp(t,le,u)}t.ke.downSelectors.push(s),t.ke[n].push([o,s]),o.yl=function(){t.ke!=null&&(Nt(t.ke.downSelectors,a=>a===s),dN(t.ke[n],o),t.ke.downSelectors.length===0&&(fh(t,ge,t.ke.downHandler),fh(t,le,t.ke.upHandler),delete t.ke))}}}}},iy=class{static generate(){let r=[];return(e,t,n,o)=>{if(!e.Me){e.Me={over:!1,mouseenter:[],mouseexit:[]};let s=l=>{let h=Eh(l);(o==null&&h==e&&!e.Me.over||fa(h,o,e)&&(h.Me==null||!h.Me.over))&&(BC(UE,l,e,h),h.Me=h.Me||{},h.Me.over=!0,r.push(h))},a=l=>{let h=Eh(l);for(let d=0;d<r.length;d++)h==r[d]&&!fa(l.relatedTarget||l.toElement,"*",h)&&(h.Me.over=!1,r.splice(d,1),BC(YE,l,e,h))};kp(e,st,Wp(o,e,s,st),s),kp(e,ot,Wp(o,e,a,ot),a)}n.yl=function(){delete e.Me[t][n.ar]},$C(e,t,n),e.Me[t][n.ar]=n}}},xe=class{constructor(r){c(this,"clickThreshold");c(this,"dblClickThreshold");c(this,"tapHandler");c(this,"mouseEnterExitHandler");r=r||{},this.clickThreshold=r.clickThreshold||250,this.dblClickThreshold=r.dblClickThreshold||450,this.mouseEnterExitHandler=iy.generate(),this.tapHandler=ny.generate(this.clickThreshold,this.dblClickThreshold)}Gf(r,e,t,n,o){if(t==null)return;let s=r;e===W||e===Yr||e===At?this.tapHandler(s,e,t,n,o):e===UE||e==YE?this.mouseEnterExitHandler(s,e,t,n,o):Zp(s,e,t,n,o)}on(r,e,t,n,o){let s=n==null?null:t,a=n==null?t:n;return this.Gf(r,e,a,s,o),this}off(r,e,t){return fh(r,e,t),this}trigger(r,e,t,n,o){let s=Ei()&&(typeof MouseEvent=="undefined"||t==null||t.constructor===MouseEvent),a=Gn()&&!Ei()&&mi[e]?mi[e]:e,l=!(Gn()&&!Ei()&&mi[e]),h=Ee(t),d=mN(t),u=EN(t);return GC(r,p=>{let g;t=t||{screenX:d.x,screenY:d.y,clientX:u.x,clientY:u.y};let m=f=>{n&&(f.payload=n)},E={TouchEvent:f=>{let b=cN(p,h.x,h.y,d.x,d.y,u.x,u.y);(f.initTouchEvent||f.initEvent)(a,!0,!0,window,null,d.x,d.y,u.x,u.y,!1,!1,!1,!1,b,b,b,1,0)},MouseEvents:f=>{f.initMouseEvent(a,!0,!0,window,o==null?1:o,d.x,d.y,u.x,u.y,t.ctrlKey===!0,t.altKey===!0,t.shiftKey===!0,t.metaKey===!0,1,p)}},y=!l&&!s&&Gn()&&mi[e],x=y?"TouchEvent":"MouseEvents";g=document.createEvent(x),E[x](g),m(g),p.dispatchEvent(g)}),this}};var AN=["stroke-linejoin","stroke-dashoffset","stroke-linecap"];function ie(i,r){for(let e in r){let t=r[e];if(e==="style"&&typeof t=="object"){let n=Object.entries(t);for(let o=0;o<n.length;o++){let s=n[o];i.style[s[0]]=s[1]}}else i.setAttribute(e,""+r[e])}}function V(i,r,e,t){return r=r||{},xa(Gt,i,e,t,r)}function UC(i,r){let e=r.map(t=>V("stop",{offset:`${t[0]}%`,"stop-color":t[1]}));i.replaceChildren(...e)}function SN(i,r){i.gradient==null&&(i.gradient=V("linearGradient",{id:_o(),gradientUnits:"userSpaceOnUse"}),i.canvas.insertBefore(i.gradient,i.canvas.childNodes[0])),i.gradient.setAttribute("x1",`${i.x}`),i.gradient.setAttribute("x2",`${i.x+i.width}`),UC(i.gradient,r)}function YC(i,r,e){let t=_o(),n=V("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:i,x2:r});return UC(n,e),{id:t,g:n}}function sy(i,r,e,t){r.setAttribute(PC,e.fill?e.fill:pt),!t&&e.gradient?(SN(i,e.gradient),r.setAttribute(Zf,`url(#${i.gradient.id})`)):r.setAttribute(Zf,e.stroke?e.stroke:pt),e.strokeWidth&&r.setAttribute(_C,e.strokeWidth),e.dashArray?r.setAttribute(Kf,e.dashArray):r.removeAttribute(Kf),AN.forEach(n=>{e[n]&&r.setAttribute(n,e[n])})}function ya(i,r,e){e>=0?i.insertBefore(r,i.childNodes[e]):i.appendChild(r)}function TN(i,r,e){let t=[];return i!=null&&i.split(/\n/).forEach(o=>{t.push(...vN(o,r,e))}),t}function vN(i,r,e){let t=(i||"").split(/\s/),n=[];if(t.length===0)return[];if(t.length===1)return[i];let o=[t[0]],s=1,a=0,l=!1,h=V(Jf);for(e.appendChild(h);!l;){let d=t.slice(a,s+1),u=d.join(" ");h.innerHTML=u,h.getBBox().width<r||o.length===0?(o=d.slice(),s+=1,s>=t.length&&(l=!0)):(n.push(o),a=s,o=[t[a]],s=a+1,s>=t.length&&(l=!0))}return e.removeChild(h),n.push(o),n.map(d=>d.join(" "))}function CN(i,r,e){return TN(i,r,e).map(t=>{let n=V(Jf);return n.innerHTML=t,n})}function Jp(i,r,e){let n=i.getAttribute(ee)||"50%",o=CN(r,e,i);i.innerHTML="";let s=0;return o.forEach((a,l)=>{i.appendChild(a),a.setAttribute("dominant-baseline","hanging"),a.setAttribute(ee,n),a.setAttribute("dy",s==0?"0":`${s+3}`),s=a.getBBox().height}),o.length>0&&o[0].setAttribute("dy",`${-i.getBBox().height/2}`),i}var ay="data-vjs-container",ly="data-vjs-group-content",Kp="data-vjs-expanded-content",qp="data-vjs-collapsed-content",yr="data-vjs-enabled",os="data-vjs-scope",yh="data-vjs-is-group",ime="element",ome="connection",Ke="div",hy="position",Jr=z(ua),zC=Ae(ly),$n=z(pa),XC=z(hp);function $t(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function oe(i,r){i.stopPropagation?i.stopPropagation():i.returnValue=!1,!r&&i.preventDefault&&i.preventDefault()}function Bt(i,r,e,t){if(i.contains(e))return null;if(t&&$t(i,r,e))return i;for(i=i.parentNode;i!=null&&i!==e;){if($t(i,r))return i;i=i.parentNode}}function Ame(i,r,e){e=e||document.body;let t=[],n=Bt(i,r,e,!1);for(;n!=null;)t.push(n),n=Bt(n,r,e,!1);return t}function ss(i){return i.srcElement||i.target}function jC(i,r){r=Ct(r),typeof i.className.baseVal!="undefined"?i.className.baseVal=r:i.className=r}function Qp(i){return i.className!=null?typeof i.className.baseVal=="undefined"?i.className:i.className.baseVal:""}function HC(i,r,e){let t=r==null?[]:Array.isArray(r)?r:r.split(/\s+/),n=e==null?[]:Array.isArray(e)?e:e.split(/\s+/),o=Qp(i),s=o.split(/\s+/),a=(l,h)=>{for(let d=0;d<h.length;d++)if(l)s.indexOf(h[d])===-1&&s.push(h[d]);else{let u=s.indexOf(h[d]);u!==-1&&s.splice(u,1)}};a(!0,t),a(!1,n),jC(i,s.join(" "))}function Bn(i){return!j(i)&&!Array.isArray(i)&&i.length!=null&&i.documentElement==null&&i.nodeType==null}function Sme(i){return!j(i)&&(Array.isArray(i)||Bn(i))}function WC(i){return!j(i)&&(Array.isArray(i)||Bn(i))}function ZC(i){return Qp(i)}function L(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?Ct(n).split(/\s+/).forEach(s=>{t.classList.add(s)}):HC(t,n))};Bn(i)?i.forEach(t=>e(t,r)):e(i,r)}function gn(i,r){return i.classList?i.classList.contains(r):Qp(i).indexOf(r)!==-1}function F(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?Ct(n).split(/\s+/).forEach(s=>{t.classList.remove(s)}):HC(t,null,n))};Bn(i)?i.forEach(t=>e(t,r)):e(i,r)}function cy(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?t.classList.toggle(n):gn(t,n)?F(t,n):L(t,n))};Bn(i)?i.forEach(t=>e(t,r)):e(i,r)}function Xt(i,r=[],e=[]){let n=Qp(i).split(" ").filter(o=>e.indexOf(o)===-1&&r.indexOf(o)===-1);n.push(...r),jC(i,n.join(" "))}function JC(i,r){let e=null;if(arguments.length===1){if(!j(i)){let t=document.createDocumentFragment();return t.appendChild(i),Array.from(t.childNodes)}e=Array.from(document.querySelectorAll(i))}else e=Array.from(i.querySelectorAll(r));return e}function Kr(i,r,e,t){return xa(null,i,r,e,t)}function xa(i,r,e,t,n){let o=i==null?document.createElement(r):document.createElementNS(i,r);return e=e||{},Object.assign(o.style,e),t&&L(o,t),ie(o,n||{}),o}function qr(i,r,e,t,n,o,s){let a=xa(i,r||Ke,e,t,n);return o!=null&&(s?o.insertBefore(a,o.lastChild):o.appendChild(a)),a}function io(i,r){let e=i.getBoundingClientRect(),t=document.body,n=document.documentElement,o=window.pageYOffset||n.scrollTop||t.scrollTop,s=window.pageXOffset||n.scrollLeft||t.scrollLeft,a=n.clientTop||t.clientTop||0,l=n.clientLeft||t.clientLeft||0,h=e.top+o-a,d=e.left+s-l;return{x:r?d:Math.round(d),y:r?h:Math.round(h)}}function eg(i){return i==null?"HTML":i instanceof SVGElement?"SVG":"HTML"}function wt(i){return eg(i)==="SVG"}function oo(i){return i.nodeType!=null&&i.nodeType!==3&&i.nodeType!==8}var kC=class i{static setNodeText(r,e){r.text=e;try{r.textContent=e}catch(t){}}static getNodeText(r){return r!=null?r.text||r.textContent:""}static getChild(r,e){let t=null;for(let n=0;n<r.childNodes.length;n++)if(r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e){t=r.childNodes[n];break}return t}static getChildren(r,e){let t=[];for(let n=0;n<r.childNodes.length;n++)r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e&&t.push(r.childNodes[n]);return t}static xmlToString(r){try{return new XMLSerializer().serializeToString(r).replace(/\s*xmlns=\"http\:\/\/www.w3.org\/1999\/xhtml\"/g,"")}catch(e){try{return r.xml}catch(t){throw new Error("Cannot serialize XML "+t)}}}static createElement(r,e,t){let n;if(n=document.createElement(r),t&&i.setNodeText(n,t),e)for(let o in e)n.setAttribute(o,e[o]);return n}};function ba(i,r){r=r||150;let e=null;return()=>{window.clearTimeout(e),e=window.setTimeout(i,r)}}function Aa(i){let r=new XMLHttpRequest,e=i.type||"GET";if(r){let t=i.dataType===Wt?o=>JSON.parse(o):o=>o;r.open(e,i.url,!0);let n=i.headers||{};for(let o in n)r.setRequestHeader(o,n[o]);r.onreadystatechange=()=>{r.readyState===4&&((""+r.status)[0]==="2"?i.success(t(r.responseText)):i.error&&i.error(r.responseText,r.status))},r.send(i.data?JSON.stringify(i.data):null)}else i.error&&i.error("ajax not supported")}function tg(i,r,e){let t=r.getBoundingClientRect(),n=Ee(i);return{x:t.width===0?0:(n.x-t.x)/t.width,y:t.height===0?0:(n.y-t.y)/t.height}}function KC(i){return i==null?!1:Object.prototype.toString.call(i).match(/\[object .*Element]/)!=null}function Tme(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Text]"}function fi(i,r){return"["+i+"='"+r+"']"}function vme(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function Cme(i){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r=>{i(r.matches)})}function z(...i){return i.map(r=>"."+r).join(",")}function Pme(...i){return i.join(" ")}function Ae(...i){return i.map(r=>"["+r+"]").join(",")}var xh=Ae(gt);function Sa(i,r,e){return function(t){return t[i]/r*(e?-1:1)}}var qC="deltaY",QC="deltaX",PN="wheelDeltaY",_N="wheelDeltaX",rg="webkit",Ta="mac",bh="win",dy="ie",uy="safari",py="firefox",gy="default";function eP(i){return i.deltaY*(i.deltaMode===1?25:1)/120}function tP(i){return i.deltaX*(i.deltaMode===1?25:1)/120}var my={[rg]:{[Ta]:Sa(qC,120),[bh]:Sa(qC,100)},[uy]:Sa(PN,120,!0),[py]:{[Ta]:eP,[bh]:eP},[dy]:function(i){return i.wheelDelta/120},[gy]:function(i){return i.deltaY||i.wheelDelta}},Ey={[rg]:{[Ta]:Sa(QC,120),[bh]:Sa(QC,100)},[uy]:Sa(_N,120,!0),[py]:{[Ta]:tP,[bh]:tP},[dy]:function(i){return i.wheelDelta/120},[gy]:function(i){return i.deltaX||i.wheelDelta}},rP=typeof navigator!="undefined",nP=rP?/Mac/.test(navigator.userAgent)?Ta:bh:Ta,va=rP?navigator.userAgent.indexOf("Firefox")!==-1?py:/Chrome/.test(navigator.userAgent)?rg:/Safari/.test(navigator.userAgent)?uy:/WebKit/.test(navigator.userAgent)?rg:/Trident/.test(navigator.userAgent)?dy:"default":gy,ON=typeof my[va]=="function"?my[va]:my[va][nP],RN=typeof Ey[va]=="function"?Ey[va]:Ey[va][nP],LN=function(i){return ON(i||event)},wN=function(i){return RN(i||event)},DN=function(i,r,e){let t=n=>{let o=LN(n),s=wN(n);n.normalizedWheelDelta=o,(!e||n.metaKey||n.ctrlKey)&&i(n,s,o,n.metaKey||n.ctrlKey)};return i.$f=t,t},NN=typeof document!="undefined",iP=NN?"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll":"wheel";function Ah(i,r,e,t){let n=DN(r,e,t);return i.addEventListener?i.addEventListener(iP,n,!1):i.attachEvent&&i.attachEvent("onmousewheel",n),n}function Sh(i,r){let e=r.$f;e!=null&&(i.removeEventListener?i.removeEventListener(iP,e,!1):i.detachEvent&&i.detachEvent("onmousewheel",e))}function oP(i){return i.startEditingPath!=null&&i.stopEditingPath!=null}var sP="vjs-paper",aP="vjs-paper-no-scale",lP="vjs-paper-canvas",hP=20,EEe="vjs-paper-node",Th="start",as="center",vh="end";function cP(i){return Wr(i)&&i.useHTMLElement===!0}var Ch=class{constructor(r,e){this.instance=r;this.overlay=e;c(this,"htmlElementOverlay");this.htmlElementOverlay=e}static getElement(r,e,t,n){if(e.contentElement==null){if(n&&t){e.contentElement=n(t);let s=r.overlayClass+" "+(e.cssClass?e.cssClass:"");L(e.contentElement,s)}else e.contentElement=Kr(Ke,{},r.overlayClass+" "+(e.cssClass?e.cssClass:""));t&&t.edge&&e.contentElement.setAttribute(Qe,t.edge.id),e.contentElement.setAttribute(ap,e.id);for(let s in e.attributes)e.contentElement.setAttribute(s,e.attributes[s]);e.contentElement.style.position=qe,r.$appendOverlayElement(e.contentElement);let o="translate(-50%, -50%)";e.contentElement.style.webkitTransform=o,e.contentElement.style.mozTransform=o,e.contentElement.style.msTransform=o,e.contentElement.style.oTransform=o,e.contentElement.style.transform=o,e.visible||L(e.contentElement,lh),e.contentElement.jtk={overlay:e}}return e.contentElement}static destroy(r){r.contentElement&&r.contentElement.parentNode&&r.contentElement.parentNode.removeChild(r.contentElement),delete r.contentElement}};function fy(i,r,e){if(r.contentElements==null){r.contentElements=[];let t=Object.assign({[ap]:r.id},r.attributes);e.forEach(n=>{let o=V(n,t),s=i.overlayClass+" "+(r.cssClass?r.cssClass:"");L(o,s),o.jtk={overlay:r},r.contentElements.push(o)})}return r.contentElements.forEach(t=>{var o;let n=t.parentNode;if(n==null){let s=(o=r.connection)==null?void 0:o.connector;n=s!=null?s.canvas:null,n!=null&&ya(n,t,-1)}}),r.contentElements}function dP(i,r,e,t){let n=r;fy(i,n,r.contentTags);let o=[-t.x,-t.y],s=Object.assign({transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"},e.paintStyle);n.contentElements.forEach((a,l)=>{let h=e.atts[l],d=Object.assign(s,h);ie(a,d)})}function Ph(i,r){return fy(i,r,r.contentTags)}function ls(i,r){return fy(i,r,[Q]),r.bgElement==null&&(r.bgElement=V(Z),r.contentElements[0].appendChild(r.bgElement)),r.textElement==null&&(r.textElement=V(et),r.contentElements[0].appendChild(r.textElement)),r.contentElements}function uP(i,r,e,t){ls(i,r);let n=nn(r.label)?r.label(r):r.label,o=[-t.x,-t.y],s="translate("+o[0]+","+o[1]+")";r.rotatable&&e.d.rotation&&(s+=` rotate(${e.d.rotation}, ${e.d.loc.x}, ${e.d.loc.y})`);let a={x:e.d.loc.x,y:e.d.loc.y,"text-anchor":"middle","dominant-baseline":"middle","pointer-events":"visibleStroke",transform:s};r.font&&r.font.size&&(a["font-size"]=r.font.size),r.font&&r.font.style&&(a["font-style"]=r.font.style),r.font&&r.font.family&&(a["font-family"]=r.font.family),ie(r.textElement,a),r.textElement.textContent=n;let l=r.textElement.getBBox(),h=i.currentZoom,d=l.width/h,u=l.height/h,p=5,g={transform:s,x:a.x-p-d/2,y:a.y-p-u/2,width:d+2*p,height:u+2*p,fill:n==null||n.length===0?"none":"white"};ie(r.bgElement,g)}function yy(i,r){i.contentElements!=null&&i.contentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),i.backgroundContentElements!=null&&i.backgroundContentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),delete i.contentElements,delete i.backgroundContentElements}var ng=class extends pi{constructor(){super(...arguments);c(this,"contentElements");c(this,"backgroundContentElements")}};var yi="transform",xy=/translate\(([-0-9\.]+),\s*([-0-9\.]+)\)/,pP=/rotate\(([-0-9\.]+)\)/,IN=/translate\(([-0-9\.]+[%|px|em|rem]?),\s*([-0-9\.]+[%|px|em|rem]+)\)/;function Je(i){let r=i;return r.width&&r.width.baseVal?BN(r):r.getBBox?FN(r):MN(i)}function En(i,r){let e=i;return wt(i.parentElement)?_h(e,r):e.x&&e.x.baseVal?GN(e):VN(e)}function Ie(i,r){let e=i;wt(i.parentElement)?mn(e,r):(e.x&&e.x.baseVal&&$N(e,r),tr(e,r))}function ig(i,r,e){if(i===r)return{x:0,y:0};let t=r.createSVGPoint();if(e){let l=i.getBBox();t.x=l.x,t.y=l.y}else t.x=0,t.y=0;let n=i.getScreenCTM(),o=t.matrixTransform(n),s=r.getScreenCTM().inverse(),a=o.matrixTransform(s);return{x:Math.round(a.x),y:Math.round(a.y)}}function gP(i,r,e,t,n){let o=i;if(o instanceof HTMLElement)o.style[e]=`${r}px`;else if(o[t]&&o[t].baseVal)o.setAttribute(t,r);else if(o.localName===Q){let s=_h(o);s[n]=r,mn(o,s)}}function yP(i,r){gP(i,r,Ze,ee,ee)}function xP(i,r){gP(i,r,Te,ye,ye)}function Rr(i,r,e){let t=i;t instanceof HTMLElement?mP(i,r,e):t.width&&t.width.baseVal&&(mP(i,r,e),i.setAttribute(_e,`${r}`),i.setAttribute(Ve,`${e}`))}function bP(i,r){let e=i;e instanceof HTMLElement?EP(i,r):e.width&&e.width.baseVal&&(EP(i,r),i.setAttribute(_e,`${r}`))}function AP(i,r){let e=i;e instanceof HTMLElement?fP(i,r):e.height&&e.height.baseVal&&(fP(i,r),i.setAttribute(Ve,`${r}`))}function MN(i){return{width:i.offsetWidth,height:i.offsetHeight}}function VN(i){return{x:parseFloat(i.offsetLeft),y:parseFloat(i.offsetTop)}}function ife(i){return{x:parseInt(i.style.left,10),y:parseInt(i.style.top,10)}}function tr(i,r){i.style.left=r.x+"px",i.style.top=r.y+"px"}function mP(i,r,e){i.style.width=`${r}px`,i.style.height=`${e}px`}function EP(i,r){i.style.width=`${r}px`}function fP(i,r){i.style.height=`${r}px`}function GN(i){try{return{x:parseFloat(i.x.baseVal.value),y:parseFloat(i.y.baseVal.value)}}catch(r){return{x:0,y:0}}}function $N(i,r){i.setAttribute("x",`${r.x}`),i.setAttribute("y",`${r.y}`)}function BN(i){try{return{width:parseFloat(i.width.baseVal.value),height:parseFloat(i.height.baseVal.value)}}catch(r){return{width:0,height:0}}}function FN(i){try{let r=i.getBBox();return{width:r.width,height:r.height}}catch(r){return{width:0,height:0}}}function _h(i,r){let e,t,n,o,s;if(e=i.getAttribute(yi),e!=null){if(t=e.match(xy),o=parseFloat(t[1]),s=parseFloat(t[2]),n=e.match(pP),n!=null){let a=parseFloat(n[1]),l=r||i.getBBox(),h={x:o+l.width/2,y:s+l.height/2},d=Me(h,{x:o,y:s},a),u=Me({x:o,y:s},d,-a);o=u.x,s=u.y}return{x:o,y:s}}else if(e=i.style.transform,e!=null){t=e.match(xy);try{return{x:parseFloat(t[1]),y:parseFloat(t[2])}}catch(a){return{x:0,y:0}}}return{x:0,y:0}}function xi(i,r){if(wt(i.parentElement)){let t=(i.getAttribute(yi)||"").match(xy);i.setAttribute(yi,(t==null?"":`${t[0]} `)+`rotate(${r})`)}else{let e=(i.style.transform||"").match(IN),t=r==0?"":"rotate("+r+"deg)";i.style.transform=(e==null?"":`${e[0]} `)+t,i.style.transformOrigin="center center"}}function mn(i,r){let t=(i.getAttribute(yi)||"").match(pP);i.setAttribute(yi,`translate(${r.x.toFixed(2)}, ${r.y.toFixed(2)})`+(t==null?"":` ${t[0]}`))}function UN(i,r,e){let t={x:r.x+i.width/2,y:r.y+i.height/2};return Me(r,t,e)}function SP(i,r){let e=UN(i,r,i.r);mn(i.el,e),xi(i.el,i.r)}var og=class{static paint(r,e,t){if(t!=null){let n=[r.width,r.height];if(isFinite(n[0])&&isFinite(n[1])){let o={[_e]:""+(n[0]||0),[Ve]:""+(n[1]||0)};ie(r.canvas,o),Ie(r.canvas,r)}}}};var by="vjs-surface",TP="vjs-surface-direct-render",vP="vjs-surface-touch-device",CP="vjs-surface-pointer-device",Ay="vjs-surface-nopan",Sy="vjs-surface-canvas",Ty="vjs-surface-pan",Efe="vjs-surface-pan-left",ffe="vjs-surface-pan-top",yfe="vjs-surface-pan-right",xfe="vjs-surface-pan-bottom",vy="vjs-surface-pan-active",Cy="vjs-surface-flash",PP="vjs-flash-vertex",Py="vjs-surface-panning",_y="vjs-surface-element-dragging",Oh="vjs-element-dragging",Oy="vjs-group-child-element-dragging",Rh="vjs-most-recently-dragged",Fn="vjs-surface-edge-dragging",Ry="vjs-edge-relocating",sg="vjs-edge-will-relocate",_P="vjs-lasso",Lh="vjs-lasso-mask",OP="vjs-lasso-mask-left",RP="vjs-lasso-mask-top",LP="vjs-lasso-mask-right",wP="vjs-lasso-mask-bottom",ag="vjs-miniview",DP="vjs-miniview-canvas",NP="vjs-miniview-panner",IP="vjs-miniview-lasso",MP="vjs-miniview-element",VP="vjs-miniview-group-element",wh="vjs-miniview-selected",Ly="vjs-miniview-panning",GP="vjs-miniview-collapse",lg="vjs-miniview-collapsed",$P="vjs-miniview-click-to-center",mt="vjs-drag-select-defeat",wy="vjs-default-node",Dy="vjs-default-group",so="vjs-connector-source-drag",ao="vjs-connector-target-drag",BP="vjs-connector-transient-drag",fn="vjs-palette-selected-element",Dh="vjs-palette-tap-mode-active",FP="vjs-palette-drag-active",UP="vjs-palette-drag-hover",YP="vjs-palette-drag-hover-cannot-drop",zP="vjs-palette-current",hg="vjs-palette-current-shape-type",Nh="vjs-drag-hover-cannot-drop",Ny="vjs-drag-original-group",xr="vjs-drag-active",br="vjs-drag-hover",Iy="vjs-source-hover",My="vjs-target-hover",Ih="vjs-hover",XP="vjs-transient-vertex",Vy="vjs-edge-click-entry-method";function YN(i,r){if(r.outlineStroke!=null){let e=r.outlineWidth||1,t=r.strokeWidth+2*e,n=Object.assign({},r);return n.stroke=r.outlineStroke,n.strokeWidth=t,n}else if(i.$paintConnectorOutline){let e=i.$connectorOutlineWidth,t=Object.assign({},r);return t.stroke=i.$connectorOutlineColor||"transparent",t.strokeWidth=e,t}}function jP(i,r,e){XN(i,r);let t=r.connector;og.paint(t,i,e);let n="",o={x:-t.x,y:-t.y};if(t.internalSegments.length>0){n=QT(t);let s={d:n,transform:"translate("+o.x+","+o.y+")","pointer-events":"visibleStroke",[Qe]:r.edge.id},a=YN(i,e);a!=null&&(t.bgPath==null?(t.bgPath=V(q,s),L(t.bgPath,i.connectorOutlineClass),ya(t.canvas,t.bgPath,0)):ie(t.bgPath,s),sy(t,t.bgPath,a,!0)),t.path==null?(t.path=V(q,s),ya(t.canvas,t.path,a!=null?1:0),L(t.path,i.connectorPathClass),r.edge.transient&&L(t.canvas,wv)):(t.path.parentNode!==t.canvas&&ya(t.canvas,t.path,a!=null?1:0),ie(t.path,s)),sy(t,t.path,e,!1),r.detachable&&zN(r,o,i.defaults.edgeRelocateHandleSize)}}function zN(i,r,e){if(i.detachable){let t=i.connector,n={x:t.paintInfo.sx,y:t.paintInfo.sy},o=i.anchors.source.computedPosition.ox,s=i.anchors.source.computedPosition.oy;n.x+=o*e/2,n.y+=s*e/2;let a={d:`M ${n.x-e/2} ${n.y-e/2} L ${n.x+e} ${n.y-e/2} L ${n.x+e} ${n.y+e/2} L ${n.x-e/2} ${n.y+e/2} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.sourceZone==null?(t.sourceZone=V(q,a),L(t.sourceZone,so),t.canvas.appendChild(t.sourceZone)):ie(t.sourceZone,a);let l={x:t.paintInfo.tx,y:t.paintInfo.ty},h=Be(t,1,e),d=Dt(h,l,e),u=Dt(l,h,e),p={d:`M ${d[0].x} ${d[0].y} L ${d[1].x} ${d[1].y} L ${u[1].x} ${u[1].y} L ${u[0].x} ${u[0].y} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.targetZone==null?(t.targetZone=V(q,p),L(t.targetZone,ao),t.canvas.appendChild(t.targetZone)):ie(t.targetZone,p)}}function XN(i,r){let e=r.connector;if(e.canvas!=null)return e.canvas;{let t=i.containerType==="HTML"?V(we,{[_e]:"0",[Ve]:"0",style:{"pointer-events":pt,position:qe},[Qe]:r.edge.id}):V(Q,{[Qe]:r.edge.id});return e.canvas=t,i.$appendEdgeElement(e.canvas),e.cssClass!=null&&L(t,e.cssClass),L(t,i.connectorClass),e.classesToAddWhenRendered!=null&&(L(t,e.classesToAddWhenRendered.join(" ")),delete e.classesToAddWhenRendered),t.jtk=t.jtk||{},t.jtk.connection=r,t}}var cg=class{constructor(r,e){this.container=r;c(this,"lr",!0);c(this,"ye");c(this,"xl");c(this,"$i");c(this,"Al");c(this,"He");c(this,"Fu");c(this,"nt");c(this,"hr");c(this,"Bt",{});c(this,"wn",[]);c(this,"q");c(this,"Jr");c(this,"Bi");c(this,"Fi");c(this,"Ui");c(this,"Sl");e=e||{init:null},this.ye=new xe,this.xl=this.Bf.bind(this),this.ye.on(r,ge,"*",this.xl),this.$i=this.Ff.bind(this),this.Al=this.Uf.bind(this),this.Ui=e.translate||(t=>Object.assign({},t)),this.Sl=e.init}$enable(){this.lr=!0}$disable(){this.lr=!1}addHandler(r){let e=this.Bt[r.selector];e==null&&(this.Bt[r.selector]=[],e=this.Bt[r.selector],this.wn.push(r.selector)),e.push(r),e.sort((t,n)=>{let o=t.priority==null?0:t.priority,s=n.priority==null?0:n.priority;return o>s?-1:s>o?1:0})}removeHandler(r){let e=this.Bt[r.selector];e!=null&&(this.Bt[r.selector]=e.filter(t=>t!==r),this.Bt[r.selector].length===0&&(delete this.Bt[r.selector],this.wn=this.wn.filter(t=>t!==r.selector)))}Bf(r){if(!this.lr||r.zf===!0)return;let e=!1;this.nt=r.target;let t=()=>{e||(e=!0,this.Sl&&this.Sl(r),this.hr=Je(this.nt),this.He=null,this.q=Ee(r),this.Bi=this.Ui(this.q),this.Jr=Object.assign({},this.q),this.Fi=Object.assign({},this.Bi))};for(let n=0;n<this.wn.length;n++)if($t(this.nt,this.wn[n],this.container)){let o=this.Bt[this.wn[n]];if(o!=null){t();for(let s=0;s<o.length;s++){let a=this.nt,l=this.hr;if(o[s].target){if(a=this.nt.closest(o[s].target),a==null)continue;l=Je(a)}if(this.Fu=o[s].start({pagePosition:this.q,e:r,el:a,size:l,translatedPosition:this.Bi}),this.Fu!==!1){this.nt=a,this.hr=l,this.He=o[s],oe(r),r.zf=!0;break}}}}this.He!=null&&(this.ye.on(document,ae,this.$i),this.ye.on(document,le,this.Al))}Ff(r){if(!this.lr)return;let e=Ee(r),t=this.Ui(e);this.He!=null&&(this.He.constrainFunction&&(this.He.usesPageCoordinates?(e=this.He.constrainFunction(e,this.nt,{width:0,height:0},this.hr,this.Jr,r),t=this.Ui(e)):t=this.He.constrainFunction(t,this.nt,{width:0,height:0},this.hr,this.Fi,r)),this.He.drag({e:r,el:this.nt,pagePosition:e,size:this.hr,originalPagePosition:this.q,translatedPosition:t,originalTranslatedPosition:this.Bi}),this.Jr=e,this.Fi={x:t.x,y:t.y})}Uf(r){this.Jr=Ee(r),this.Fi=this.Ui(this.Jr),this.He!=null&&this.He.stop({e:r,el:this.nt,pagePosition:this.Jr,size:this.hr,originalPagePosition:this.q,translatedPosition:this.Fi,originalTranslatedPosition:this.Bi}),this.Q()}Q(){this.ye.off(document,ae,this.$i),this.ye.off(document,le,this.Al),this.He=null,this.nt=null,this.hr=null,this.q=null,this.Jr=null}destroy(){Object.values(this.Bt).forEach(r=>r.forEach(e=>e.destroy&&e.destroy())),this.ye.off(this.container,ge,this.xl),this.Q()}};var dg={FILL:"#FFFFFF",STROKE:"#000000",TEXT_COLOR:"#000000",STROKE_WIDTH:1.25},Mh="start",Vh="center",Gh="end",lye="Default",hye="Default shapes",HP="vjs-shape",ug="vjs-shape-label",$h="vjs-shape";var jN="http://www.w3.org/2000/svg",HN="http://www.w3.org/1999/xlink",kN="svg",WN="xlink",ZN="html";function Gy(i){let r=document.getElementById(i);return r!=null?r.innerHTML:null}var hs=class extends zo{constructor(r){super(r),this.namespaceHandlers[kN]=e=>document.createElementNS(jN,e.split(":")[1]),this.namespaceHandlers[ZN]=e=>document.createElement(e.split(":")[1]),this.namespaces[WN]=HN}ce(r){return document.createElement(r)}cf(){return document.createDocumentFragment()}ctn(r){return document.createTextNode(r)}cc(r){return document.createComment(r)}Qd(){return Gy}removeElement(r){r.parentElement.removeChild(r)}removeTextNode(r){r.parentNode.removeChild(r)}};function Ar(i){return new hs(i||{})}var pg="link",gg="clone",mg="trash",kP="cross",WP="plus",ZP="circle",JP="gear",KP={x:0,y:0,width:32,height:32},Bh={[gg]:{id:gg,viewBox:KP,shapes:[{tag:q,atts:{d:"M 6 24 L 2 24 L 2 2 L 24 2 L 24 6 M 8 8 L 30 8 L 30 30 L 8 30 Z",stroke:"currentColor","stroke-width":3,fill:"none","stroke-linejoin":"round"}}]},[pg]:{id:pg,viewBox:KP,shapes:[{tag:Z,atts:{x:0,y:0,width:32,height:32,fill:"transparent",stroke:"none"}},{tag:Fe,atts:{cx:5,cy:16,r:5,fill:"currentColor"}},{tag:q,atts:{d:"M 5 16 L 22 16",stroke:"currentColor","stroke-width":3,fill:"none"}},{tag:q,atts:{d:"M 22 16 L 20 8 L 30 16 L 20 24",fill:"currentColor"}}]},[mg]:{id:mg,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},shapes:[{tag:q,atts:{d:"M 7 30 L 4 2 L 28 2 L 25 30 Z","stroke-width":"3"}},{tag:q,atts:{d:"M 12 26 L 10 8"}},{tag:q,atts:{d:"M 20 26 L 22 8"}},{tag:q,atts:{d:"M 16 26 L 16 8.5"}}]},[kP]:{id:kP,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:q,atts:{d:"M 2 2 L 30 30"}},{tag:q,atts:{d:"M 30 2 L 2 30"}}]},[WP]:{id:WP,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:q,atts:{d:"M 16 2 L 16 30"}},{tag:q,atts:{d:"M 2 16 L 30 16"}}]},[ZP]:{id:ZP,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:Fe,atts:{cx:16,cy:16,r:15}}]},[JP]:{id:JP,viewBox:{x:0,y:0,width:32,height:32},atts:{},shapes:[{tag:q,atts:{"fill-rule":"evenodd",d:"M 16.0000,4.5000 L 18.1126,3.3755 L 18.6424,1.7428 L 20.8402,2.3317 L 20.4827,4.0106 L 21.7500,6.0407 L 24.1418,6.1232 L 25.4170,4.9741 L 27.0259,6.5830 L 25.8768,7.8582 L 25.9593,10.2500 L 27.9894,11.5173 L 29.6683,11.1598 L 30.2572,13.3576 L 28.6245,13.8874 L 27.5000,16.0000 L 28.6245,18.1126 L 30.2572,18.6424 L 29.6683,20.8402 L 27.9894,20.4827 L 25.9593,21.7500 L 25.8768,24.1418 L 27.0259,25.4170 L 25.4170,27.0259 L 24.1418,25.8768 L 21.7500,25.9593 L 20.4827,27.9894 L 20.8402,29.6683 L 18.6424,30.2572 L 18.1126,28.6245 L 16.0000,27.5000 L 13.8874,28.6245 L 13.3576,30.2572 L 11.1598,29.6683 L 11.5173,27.9894 L 10.2500,25.9593 L 7.8582,25.8768 L 6.5830,27.0259 L 4.9741,25.4170 L 6.1232,24.1418 L 6.0407,21.7500 L 4.0106,20.4827 L 2.3317,20.8402 L 1.7428,18.6424 L 3.3755,18.1126 L 4.5000,16.0000 L 3.3755,13.8874 L 1.7428,13.3576 L 2.3317,11.1598 L 4.0106,11.5173 L 6.0407,10.2500 L 6.1232,7.8582 L 4.9741,6.5830 L 6.5830,4.9741 L 7.8582,6.1232 L 10.2500,6.0407 L 11.5173,4.0106 L 11.1598,2.3317 L 13.3576,1.7428 L 13.8874,3.3755 Z M 23.2500,16.0000 A 7.25,7.25 0 1 0 8.7500,16.0000 A 7.25,7.25 0 1 0 23.2500,16.0000 Z"}}]}};function Sye(i,r){let e=typeof i=="string"?Bh[i]:i;if(e==null)return null;{let t=Object.assign({},e);return t.id=r,t}}function Eg(i,r,e,t,n,o,s){t=t||[],n=n||{};let a=Object.assign({viewBox:`0 0 ${i.viewBox.width} ${i.viewBox.height}`,"pointer-events":"all",width:r,height:e},i.atts||{}),l=V(we,Object.assign(n||{},a),null,t.join(" "));return i.shapes.forEach(h=>{let d=V(h.tag,Object.assign(h.atts,s||{}));l.appendChild(d)}),o&&o.appendChild(l),l}function fg(i,r,e,t,n,o,s){return Eg(Bh[i],r,e,t,n,o,s)}var JN={x:0,y:0,width:32,height:32},KN={stroke:"currentColor",fill:"none"},$y=class extends HTMLElement{static get observedAttributes(){return["icon-id","width","height"]}findIcon(r){return Bh[r]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){let r=this.getAttribute("icon-id"),e=this.getAttribute("width")||"32",t=this.getAttribute("height")||"32",n=this.findIcon(r)||Bh[r];if(!n){this.innerHTML="";return}let o=n.viewBox||JN,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width",e),s.setAttribute("height",t),s.setAttribute("viewBox",`${o.x} ${o.y} ${o.width} ${o.height}`);let a=rn(rn({},KN),n.atts);for(let[l,h]of Object.entries(a))s.setAttribute(l,h);n.shapes.forEach(l=>{let h=document.createElementNS("http://www.w3.org/2000/svg",l.tag);for(let[d,u]of Object.entries(l.atts))h.setAttribute(d,u);s.appendChild(h)}),this.innerHTML="",this.appendChild(s)}};customElements.define("vjs-icon",$y);var qN="label",qP="transform",QP="x",e_="y",yg="origin",t_="originX",r_="originY",QN="orientation",n_="size",i_="key",eI="iconId",Ca="middle",By="type",xg="category",o_="horizontal",nxe="vertical",bg="vjs-shape-icon",tI="vjs-include-icon",rI="vjs-include-icons",nI="category",iI="type",ho="__vjsRootSet",lo=qN,Fy="fill",Fh="outline",Uh="outlineWidth",Uy="color",Yh="#FFFFFF",cs="#000000",zh=2,s_="#000000",oI=.8,Pa=class{constructor(r,e){c(this,"compiledShapes",new Map);c(this,"templateRenderer",Ar({defaultNamespace:"svg"}));c(this,"shapeSets",new Map);c(this,"defaultCategoryId");c(this,"labelPosition");c(this,"rootSet");c(this,"iconContainerTemplate",`<svg:svg class="${bg}" x="{{x}}" y="{{y}}" viewBox="{{viewBox}}" width="{{width}}" height="{{height}}" style="overflow:visible"/>`);c(this,"iconContainerAst");c(this,"iconSpecs",new Map);c(this,"iconList",[]);c(this,"typeParameter");c(this,"categoryParameter");c(this,"multilineLabels");c(this,"labelFillRatio");e=e||{},r==null?(U("WARN: no shapes were provided to shape library."),r=[]):Array.isArray(r)||(r=[r]),this.typeParameter=e.typeParameter||iI,this.categoryParameter=e.categoryParameter||nI,this.multilineLabels=e.multilineLabels!==!1,this.labelFillRatio=e.labelFillRatio||oI,this.labelPosition=e.labelPosition||"center",this.Yf(r),this.defaultCategoryId=this.rootSet.children.length>0?this.rootSet.children[0].id:be,this.iconContainerAst=this.templateRenderer.parse(this.iconContainerTemplate)}useMultilineLabels(){return this.multilineLabels}refresh(r,e,t){this.Xf(r,e);let n=r.closest(".vjs-shape")||r;this.$applyMultilineLabel(n.querySelector(":scope > .vjs-shape-label"),e,t||lo)}Yf(r){let e=(t,n)=>{let o=[];return t!=null&&t.forEach(s=>{let a=Object.assign(s,{parent:n,children:e(s.children,s.id)});if(this.shapeSets.set(a.id,a),a.icons){let l=Gs(this.iconSpecs,a.id,()=>new Map);a.icons.forEach(h=>{l.set(h.id,h)}),this.iconList.push(...a.icons)}o.push(a)}),o};this.rootSet={children:e(r,ho),parent:null,id:ho,name:ho,shapes:[]}}getShapeSet(r){return this.shapeSets.get(r)}getShapeSets(){return Array.from(this.shapeSets.values())}getShapeDefinition(r,e){return e=e||this.defaultCategoryId,this.shapeSets.get(e).shapes.find(t=>t.type===r)}$getShapeDefinitionForObject(r,e,t){let n=e||this.typeParameter,o=t||this.categoryParameter;return this.getShapeDefinition(r[n],r[o])}getShapeTemplate(r,e){let t=this.getShapeDefinition(r,e);return t==null?(U(`Cannot find shape [${r}] in set [${e}]. Returning default shape.`),this.jf()):t.template}getCompiledShape(r,e){let t=this.kf(r,e);if(!this.compiledShapes.has(t)){let n=this.templateRenderer.parse(this.getShapeTemplate(r,e)),o=s=>this.templateRenderer.render(n,s).fragment;this.compiledShapes.set(t,o)}return this.compiledShapes.get(t)}Hf(r){r.setAttribute&&r.setAttribute(_p,Op),r.hasChildNodes&&r.childNodes.forEach(e=>this.Hf(e))}renderCompiledShape(r,e,t,n){e=r.outlineWidth||e||1;let o=t||this.typeParameter,s=n||this.categoryParameter,a=this.getShapeDefinition(r[o],r[s]),l=a.square?Math.min(r.width,r.height):r.width,h=a.square?Math.min(r.width,r.height):r.height;return this.getCompiledShape(r[o],r[s])(Object.assign({outlineWidth:e},r,{width:l,height:h})).childNodes[0]}renderShapeLabel(r,e,t,n,o,s,a){e=e||lo;let l=V(et,{x:"50%",y:"50%",fill:o,stroke:s,"text-anchor":Ca,"dominant-baseline":Ca,class:ug,"stroke-width":t||"0.25px"});l.textContent=n||r[e]||"";let h=r.fontSize||(a==null?void 0:a.size),d=r.fontStyle||(a==null?void 0:a.style),u=r.fontWeight||(a==null?void 0:a.weight),p=r.fontFamily||(a==null?void 0:a.family);return h&&l.setAttribute("font-size",h.toString()),d&&l.setAttribute("font-style",d),u&&l.setAttribute("font-weight",u),p&&l.setAttribute("font-family",p),l}kf(r,e){return e=e||this.defaultCategoryId,[r,e].join(":")}Wf(r,e,t){return{center:{x:"{{width/2}}",y:"{{height/2}}",transform:"",textAnchor:Ca,dominantBaseline:Ca},top:{x:"{{width/2}}",y:"0",transform:`translate(0, -${e+t})`,textAnchor:Ca,dominantBaseline:"hanging"},bottom:{x:"{{width/2}}",y:"{{height}}",transform:`translate(0, ${t})`,textAnchor:Ca,dominantBaseline:"auto"}}[r]}Zf(r,e,t=lo){let n={};return this.shapeSets.forEach(o=>{o.shapes.forEach(s=>{let a=s.font||e,l=a==null?14:a.size||14,h=a==null?"normal":a.style||"normal",d=a==null?"normal":a.weight||"normal",u=(a==null?void 0:a.family)||"",p=s.labelPosition||this.labelPosition,{x:g,y:m,transform:E,textAnchor:y,dominantBaseline:x}=this.Wf(p,l,20),b=(s.collapsedTemplate==null?s.template:`<svg:g ${Kp}>${s.template}</svg:g><svg:g ${qp}>${s.collapsedTemplate}</svg:g>`)+(r?`<svg:text x="${g}" y="${m}" transform="${E}" fill="{{color}}" stroke="{{color}}" stroke-width="0.25px" text-anchor="${y}" dominant-baseline="${x}" class="${ug}" font-size="{{fontSize || ${l}}}" font-style="{{fontStyle || '${h}'}}" font-weight="{{fontWeight || '${d}'}}" font-family="{{fontFamily || '${u}'}}">{{${t}}}</svg:text>`:"");n[`${o.id}:${s.type}`]=b,n[`${be}:${s.type}`]=b})}),n}getShapeTagDefinition(r,e,t,n={size:14,style:"normal"},o=lo,s=Yh,a=cs,l=cs,h=zh){return e=e||h,{template:r?`<svg:g class="${$h}" fill="{{fill}}" stroke="{{outline}}" stroke-width="{{outlineWidth}}">
5
+ <r-fragment key="${xg}:${By}"/>
6
+ </svg:g>`:`<svg:svg class="${$h}" fill="{{fill}}" stroke="{{outline}}" viewBox="0 0 {{width}} {{height}}" preserveAspectRatio="none" stroke-width="{{outlineWidth}}">
7
+ <r-fragment key="${xg}:${By}"/>
8
+ </svg:svg>`,fragments:{[`${xg}:${By}`]:this.Zf(t,n,o)},defaultNamespace:"svg",decorator:(d,u)=>d.fill==null||d.outline==null||d.color==null||d.outlineWidth==null||d.fontSize==null||d.fontStyle==null?{fill:d.fill||s,outline:d.outline||a,color:d.color||l,outlineWidth:d.outlineWidth||h,fontSize:d.fontSize,fontStyle:d.fontStyle}:null,defaultableFragmentKeys:[xg],rendered:(d,u,p,g)=>{this.refresh(d,u,o)},updated:(d,u,p)=>{this.refresh(d,u,o)},mounted:(d,u,p,g)=>{this.$applyMultilineLabel(d.querySelector(z(ug)),u,o)}}}jf(){return'<svg:rect x="0" y="0" width="{{width}}" height="{{height}}"/>'}Uu(r,e){return e!=null?this.iconSpecs.get(e).get(r):this.iconList.find(t=>t.id===r)}$applyMultilineLabel(r,e,t){if(this.multilineLabels&&r!=null){let n=e.width,o=e.height;if(r!=null&&n!=null&&o!=null){let s=this.labelFillRatio*n;Jp(r,e[t],s)}}}Xf(r,e){Array.from(r.querySelectorAll(`svg.${bg}:not(:scope .vjs-group *, :scope .vjs-node *)`)).forEach(t=>t.parentNode.removeChild(t)),Array.from(r.querySelectorAll(tI)).forEach(t=>{let n=t.getAttribute(i_),o=n!=null?e[n]:t.getAttribute(eI);if(o!=null){let s=this.Uu(o,e.category);if(s!=null){let a=parseFloat(t.getAttribute(QP))*e.width,l=parseFloat(t.getAttribute(e_))*e.height,h=Math.min(e.width,e.height),d=parseFloat(t.getAttribute(n_))*h,u=t.getAttribute(t_)||t.getAttribute(yg)||Mh,p=t.getAttribute(r_)||t.getAttribute(yg)||Mh,g=Eg(s,d,d,[bg],{[_p]:Op,x:a,y:l},r),m=u===Vh?-d/2:u===Gh?-d:0,E=p===Vh?-d/2:p===Gh?-d:0;g.setAttribute(qP,`translate(${m}, ${E})`)}}}),Array.from(r.querySelectorAll(rI)).forEach(t=>{let n=t.getAttribute(i_),o=e[n];if(o!=null&&o.length>0){let s=Math.min(e.width,e.height),a=parseFloat(t.getAttribute(n_))*s,l=t.getAttribute(t_)||t.getAttribute(yg)||Mh,h=t.getAttribute(r_)||t.getAttribute(yg)||Mh,d=V(Q),u=(t.getAttribute(QN)||o_)===o_;r.appendChild(d);let p=0,g=5,m=0;o.forEach(T=>{let S=this.Uu(T,e.category);S!=null&&(Eg(S,a,a,[bg],{[_p]:Op,x:p,y:m},d),u?p+=a+g:m+=a+g)});let E=parseFloat(t.getAttribute(QP))*e.width,y=parseFloat(t.getAttribute(e_))*e.height,x=u?p-g:0,f=u?0:m-g,b=l===Vh?-x/2:l===Gh?-x:0,A=h===Vh?-f/2:h===Gh?-f:0;d.setAttribute(qP,`translate(${E+b}, ${y+A})`)}})}parseDefs(){let r=[];return this.rootSet.children.forEach(e=>{if(e.defs)for(let t in e.defs){let n=this.templateRenderer.parse(e.defs[t]);n[0].atts.id=t,r.push(n)}}),r}getDefsElements(){return this.parseDefs().map(r=>this.templateRenderer.render(r,{}).fragment.childNodes[0])}getSvgDefsElement(){let r=V(we),e=V(OC);return r.appendChild(e),this.getDefsElements().forEach(t=>{e.appendChild(t)}),r}};var lxe={id:"flowchart",name:"Flowchart",shapes:[{type:"process",label:"Process",description:"A process (also known as 'Action') can represent a single step or a sub-process",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}"/>'},{type:"decision",label:"Decision",template:'<path d="M {{width/2}} 0 L {{width}} {{height/2}} L {{width/2}} {{height}} L 0 {{height/2}} Z"/>'},{type:"terminus",label:"Terminus",description:"Used to mark the start/end of the system",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}" rx="{{width/6}}"/>'},{type:"input",label:"Input/Output",description:"Represents something entering or leaving the system",template:'<path d="M {{width / 7}} 0 L {{width}} 1 L {{width - (width/7)}} {{height}} L 1 {{height}} Z"/>'},{type:"document",label:"Document",description:"A printed document or report",template:'<path d="M 0 {{height-(height/8)}} C {{width - (width/4)}},{{height + (height/8)}} {{width- (width/3)}},{{height/2}} {{width}},{{height-(height/8)}} L {{width}} 0 L 0 0 L 0 {{height-(height/8)}}"/>'},{type:"manualInput",label:"Manual Input",template:'<path d="M 0 {{height}} L 0 {{height/3}} L {{width}} {{height/9}} L {{width}} {{height}} Z"/>'},{type:"manualOperation",label:"Manual Operation",template:'<path d="M 0 0 L {{width}} 0 L {{width- (width/8)}} {{height}} L {{width/8}} {{height}} Z"/>'},{type:"preparation",label:"Preparation",template:'<path d="M 0 {{height/2}} L {{width/8}} 0 L {{width- (width/8}} 0 L {{width}} {{height/2}} L {{width-(width/8)}} {{height}} L {{width/ 8}} {{height}} Z"/>'},{type:"connector",label:"Connector",template:'<ellipse cx="{{width/2}}" cy="{{height/2}}" rx="{{width/2}}" ry="{{height/2}}"/>'},{type:"merge",label:"Merge",template:'<path d="M 0 0 L {{width}} 1 L {{width/2}} {{height}} Z"/>'},{type:"collate",label:"Collate",template:`<g><path d="M 0 0 L {{width}} 0 L {{width/2}} {{height/2}} Z"/>
9
9
  <path d="M 0 {{height}} L {{width}} {{height}} L {{width/2}} {{height/2}} Z"/>
10
10
  </g>`},{type:"subroutine",label:"Subroutine",template:`<g>
11
11
  <rect x="0" y="0" width="{{width}}" height="{{height}}"/>
@@ -27,7 +27,7 @@ var _b=Object.defineProperty,Q0=Object.defineProperties,eL=Object.getOwnProperty
27
27
  <path d="M {{width}} {{height/5}} A {{width/2}} {{height/5}} 0 0 1 0 {{height/5}}" fill="none"/>
28
28
  <path d="M {{width}} {{height/ 3}} A {{width/2}} {{height/ 5}} 0 0 1 0 {{height/ 3}}" fill="none"/>
29
29
  </g>
30
- `},{type:"dataStorage",label:"Data Storage",template:'<path d="M {{width/5}} 0 A {{width/5}} {{height/2}} 0 0 0 {{width/5}} {{height}} L {{width-(width/5)}} {{height}} A {{(width/5)}} {{height/2}} 0 0 1 {{width-(width/5)}} 0 L {{width/5}} 0"/>'}]};var txe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 20 85 L 45 15 L 55 15 L 80 85 M 30 60 L 70 60" fill="none" stroke="currentColor" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/><svg:path d="M 15 85 L 30 85 M 70 85 L 85 85" fill="none" stroke="currentColor" stroke-width="8" stroke-linecap="round"/></svg:svg>',WN='<svg:svg viewBox="0 0 100 100"><svg:rect x="10" y="10" width="80" height="80" rx="5" fill="none" stroke="currentColor" stroke-width="2" stroke-dasharray="8,4" opacity="0.6"/><svg:path d="M 35 75 L 48 30 L 52 30 L 65 75 M 40 62 L 60 62" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg:svg>',rxe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 35 20 L 65 20 M 50 20 L 50 80 M 35 80 L 65 80" fill="none" stroke="currentColor" stroke-width="6" stroke-linecap="round"/><svg:path d="M 70 50 L 78 30 L 86 50 M 73 45 L 83 45" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg:svg>',nxe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 20 20 L 60 20 L 85 45 L 85 80 L 20 80 Z" fill="none" stroke="currentColor" stroke-width="6" stroke-linejoin="round"/><svg:circle cx="35" cy="35" r="5" fill="currentColor"/><svg:line x1="35" y1="55" x2="70" y2="55" stroke="currentColor" stroke-width="6" stroke-linecap="round"/><svg:line x1="35" y1="68" x2="60" y2="68" stroke="currentColor" stroke-width="6" stroke-linecap="round"/></svg:svg>',nO={id:"basic",name:"Basic",shapes:[{type:"rectangle",label:"Rectangle",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}"/>'},{type:"rounded-rectangle",label:"Rounded Rectangle",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}" rx="{{width/10}}"/>'},{type:"ellipse",label:"Ellipse",template:'<ellipse cx="{{width/2}}" cy="{{height/2}}" rx="{{width/2}}" ry="{{height/2}}"/>'},{type:"diamond",label:"Diamond",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height/2}} {{width/2}} {{height}} 0 {{height /2}}"/>'},{type:"isosceles-triangle",label:"Isosceles Triangle",template:'<polygon points="{{width/2}} 0 {{width}} {{height}} 0 {{height}}"/>'},{type:"inverted-isosceles-triangle",label:"Inverted Isosceles Triangle",template:'<polygon points="{{width/2}} {{height}} {{width}} 0 0 0"/>'},{type:"right-triangle",label:"Right Triangle",template:'<polygon points="0 0 0 {{height}} {{width}} {{height}}"/>'},{type:"label",label:"Label",icon:WN,template:`<g>
30
+ `},{type:"dataStorage",label:"Data Storage",template:'<path d="M {{width/5}} 0 A {{width/5}} {{height/2}} 0 0 0 {{width/5}} {{height}} L {{width-(width/5)}} {{height}} A {{(width/5)}} {{height/2}} 0 0 1 {{width-(width/5)}} 0 L {{width/5}} 0"/>'}]};var pxe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 20 85 L 45 15 L 55 15 L 80 85 M 30 60 L 70 60" fill="none" stroke="currentColor" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/><svg:path d="M 15 85 L 30 85 M 70 85 L 85 85" fill="none" stroke="currentColor" stroke-width="8" stroke-linecap="round"/></svg:svg>',sI='<svg:svg viewBox="0 0 100 100"><svg:rect x="10" y="10" width="80" height="80" rx="5" fill="none" stroke="currentColor" stroke-width="2" stroke-dasharray="8,4" opacity="0.6"/><svg:path d="M 35 75 L 48 30 L 52 30 L 65 75 M 40 62 L 60 62" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg:svg>',gxe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 35 20 L 65 20 M 50 20 L 50 80 M 35 80 L 65 80" fill="none" stroke="currentColor" stroke-width="6" stroke-linecap="round"/><svg:path d="M 70 50 L 78 30 L 86 50 M 73 45 L 83 45" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg:svg>',mxe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 20 20 L 60 20 L 85 45 L 85 80 L 20 80 Z" fill="none" stroke="currentColor" stroke-width="6" stroke-linejoin="round"/><svg:circle cx="35" cy="35" r="5" fill="currentColor"/><svg:line x1="35" y1="55" x2="70" y2="55" stroke="currentColor" stroke-width="6" stroke-linecap="round"/><svg:line x1="35" y1="68" x2="60" y2="68" stroke="currentColor" stroke-width="6" stroke-linecap="round"/></svg:svg>',a_={id:"basic",name:"Basic",shapes:[{type:"rectangle",label:"Rectangle",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}"/>'},{type:"rounded-rectangle",label:"Rounded Rectangle",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}" rx="{{width/10}}"/>'},{type:"ellipse",label:"Ellipse",template:'<ellipse cx="{{width/2}}" cy="{{height/2}}" rx="{{width/2}}" ry="{{height/2}}"/>'},{type:"diamond",label:"Diamond",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height/2}} {{width/2}} {{height}} 0 {{height /2}}"/>'},{type:"isosceles-triangle",label:"Isosceles Triangle",template:'<polygon points="{{width/2}} 0 {{width}} {{height}} 0 {{height}}"/>'},{type:"inverted-isosceles-triangle",label:"Inverted Isosceles Triangle",template:'<polygon points="{{width/2}} {{height}} {{width}} 0 0 0"/>'},{type:"right-triangle",label:"Right Triangle",template:'<polygon points="0 0 0 {{height}} {{width}} {{height}}"/>'},{type:"label",label:"Label",icon:sI,template:`<g>
31
31
  <r-if test="!text">
32
32
  <svg:rect x="0" y="0" width="{{width}}" height="{{height}}" stroke="#888" stroke-dasharray="2" stroke-width="1" fill="{{'transparent'}}"/>
33
33
  </r-if>
@@ -40,50 +40,50 @@ var _b=Object.defineProperty,Q0=Object.defineProperties,eL=Object.getOwnProperty
40
40
  <r-if test="scaled === false">
41
41
  <svg:text dominant-baseline="hanging" stroke="none" fill="{{color}}" font-size="{{fontSize}}" font-style="{{fontStyle}}">{{text}}</svg:text>
42
42
  </r-if>
43
- </g>`,payload:{text:"Label",scaled:!0},properties:[{id:"fill",label:"Background Color",type:"color",defaultValue:"transparent"},{id:"color",label:"Text Color",type:"color",defaultValue:"#000000"},{id:"text",label:"Text",type:"string",defaultValue:"Text"},{id:"scaled",label:"Scaled",type:"boolean",defaultValue:!0}]},{type:"inverted-right-triangle",label:"Right Triangle",template:'<polygon points="{{width}} {{height}} {{width}} 0 0 {{height}}"/>'},{type:"hexagon",label:"Hexagon (pointy)",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*1732/6000}} {{width}} {{height-(height*1732/6000)}} {{width/2}} {{height}} 0 {{height-(height*1732/6000)}} 0 {{height*1732/6000}}"/>'},{type:"hexagon-flat",label:"Hexagon (flat)",square:!0,template:'<polygon points="0 {{height/2}} {{width*1732/6000}} {{height}} {{width-(width*1732/6000)}} {{height}} {{width}} {{height/2}} {{width-(width*1732/6000)}} 0 {{width*1732/6000}} 0"/>'},{type:"octagon",label:"Octagon",square:!0,template:'<polygon points="{{width * 293 / 1000}} 0 {{width * 707 / 1000}} 0 {{width}} {{height * 293 / 1000}} {{width}} {{height * 707 / 1000}} {{width * 707 / 1000}} {{height}} {{width * 293 / 1000}} {{height}} 0 {{height * 707 / 1000}} 0 {{height * 293 / 1000}}"/>'},{type:"pentagon",label:"Pentagon",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*343/1000}} {{width*793/1000}} {{height*904/1000}} {{width*206/1000}} {{height*904/1000}} 0 {{height*343/1000}}"/>'},{type:"parallelogram",label:"Parallelogram",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width}} 0 {{width * 7 / 8}} {{height}}"/>'},{type:"trapezoid",label:"Trapezoid",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width * 7 / 8}} 0 {{width}} {{height}}"/>'},{type:"cross",label:"Cross",template:'<path d="M 0 {{height*3/10}} L 0 {{height * 7/10}} L {{width *3/10}} {{ height * 7/10}} L {{width *3/10}} {{height}} L {{width *7/10}} {{height}} L {{width*7/10}} {{height*7/10}} L {{width}} {{height * 7/10}} L {{width}} {{height*3/10}} L {{width *7/10}} {{height*3/10}} L {{width*7/10}} 0 L {{width*3/10}} 0 L {{width*3/10}} {{height*3 /10}} Z"/>'},{type:"l-shape-bl",label:"L Shape (Bottom left)",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} {{height / 2}} L {{width/2}} {{height/2}} L {{width/2}} 0 Z"/>'},{type:"l-shape-br",label:"L Shape (Bottom right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L {{width/2}} 0 L {{width/2}} {{height/2}} L 0 {{height/2}} L 0 {{height}} Z"/>'},{type:"l-shape-tl",label:"L Shape (Top left)",template:'<path d="M 0 0 L 0 {{height}} L {{width/2}} {{height}} L {{width/2}} {{height / 2}} L {{width}} {{height/2}} L {{width}} 0 Z"/>'},{type:"l-shape-tr",label:"L Shape (Top right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L 0 0 L 0 {{height/2}} L {{width/2}} {{height/2}} L {{width/2}} {{height}} Z"/>'},{type:"u-shape",label:"U Shape",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} 0 L {{width*2/3}} 0 L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} 0 Z"/>'},{type:"inverted-u-shape",label:"U Shape (Inverted)",template:'<path d="M 0 0 L {{width}} 0 L {{width}} {{height}} L {{width*2/3}} {{height}} L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} {{height}} L 0 {{height}} Z"/>'}]};var Ca=class extends Qc{constructor(e){super();this.ui=e}getViewportPositionById(e){return this.ui.viewport.getPosition(e)}getSize(e){return this.ui.$getSize(e)}};var fm=class extends Ca{constructor(e){super(e);this.uiCore=e}filter(e){return e.group==null}getElements(){let e=this.uiCore.getNodes();return Array.prototype.push.apply(e,this.uiCore.getGroups()),e=e.filter((t,n,o)=>t.group==null),e}};var ym=class extends Ca{constructor(e,t){super(t);this.group=e;this.ui=t}getElements(){return this.group.getMembers()}filter(e){return(Y(e)||K(e))&&e.group==this.group}};var xm=class{constructor(r){this.ui=r}transformGeometry(r,e,t){let n=this.ui.getRenderedConnection(r.id);return n!=null&&r.geometry!=null?$e.transformGeometry(n.connector,r.geometry,e,t):r.geometry}getCoordinates(r,e){let t=this.ui.viewport.getElement(r.id);return{x:t.x,y:t.y,width:t.width,height:t.height}}};var bm=class extends Mu{constructor(e){super(e.model);this.ui=e;c(this,"transformer");this.transformer=new xm(this.ui)}$getCopyDataTransformer(){return this.transformer}paste(e){return e=e||{},e.event&&(e.origin=this.ui.mapEventLocation(e.event)),super.paste(e)}};function Un(i){return kr(i)&&i.useHTMLElement!==!0}function ho(i){return i.isSimpleShape}function ZN(i,r){i.canvas&&(i.canvas.style.display=r?"block":"none")}function JN(i){i.canvas&&i.canvas.parentNode.removeChild(i.canvas),delete i.canvas}function as(i,r){if(i.useHTMLElement&&r.containerType!=="SVG"){let e=Sh.getElement(r,i,i.connection);return L(e,r.labelOverlayClass),e}else return is(r,i),i.textElement}function Pa(i,r){return Sh.getElement(r,i,i.connection,e=>{let t=i.create(e,e.edge,r,r.model);return L(t,r.overlayClass),t})}var Oa=class extends Lp{constructor(e,t,n,o,s,a){var l;super(e,t,n,o,a);c(this,"$suspendRendering");c(this,"clipboard");c(this,"$shapeLibrary");c(this,"$_propertyMapper");c(this,"M");c(this,"gl");c(this,"Nu");c(this,"wn");c(this,"hr");c(this,"Ge");c(this,"dr");c(this,"Iu");c(this,"ye");c(this,"Vu",[`[${Tv}='true']`]);c(this,"El");c(this,"Mu",new Set([rh,Wo,Zo,rp,qi,np,ts]));c(this,"nt",null);c(this,"Ui",[]);if(o=o||{},a=a||{},this.ye=new xe,this.clipboard=new bm(this),this.M=s,this.containerType=Jp(this.getContainer()),this.Iu=a.hoverEvents!==!1,this.dr=Eh,this.gl=this.createRenderer("node",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.Nu=this.createRenderer("group",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.El=(l=o.dragOptions)==null?void 0:l.canDrop,o.edges!=null&&o.edges.propertyMappings!=null&&(this.$_propertyMapper=new Yp(this,{edgeMappings:o.edges.propertyMappings})),this.wn=[],this.Gu(),this.on(n,"animationend",z(Qi,Jo),h=>{let d=h.target;d.style.animation=null,F(d,Ay)}),a.resizeObserver!==!1&&!this.$_useModelForSizes)try{this.Ge=new ResizeObserver(h=>{window.requestAnimationFrame(()=>{if(!this.$_dataLoading){let d=[];h.forEach(u=>{if(u.borderBoxSize!=null&&u.borderBoxSize.length>0){let p=this.$getAttribute(u.target,mt);if(p!=null){let m={width:u.borderBoxSize[0].inlineSize,height:u.borderBoxSize[0].blockSize},g=this.viewport.getElement(p);g!=null&&(g.width!==m.width||g.height!==m.height)&&d.push(this.$getManagedElement(p))}}}),d.forEach(u=>this.$revalidateManagedElement(u)),this.$relayoutOnResize&&d.length>0&&this.relayout()}})})}catch(h){U("WARN: ResizeObserver could not be attached.")}if(o.shapes!=null)if(o.shapes.library==null&&o.shapes.sets==null)U('Render option "shapes" passed to UI but no "library" or "sets" value is present. Shape library is not enabled.');else{o.shapes.library!=null?this.$shapeLibrary=o.shapes.library:this.$shapeLibrary=new va(o.shapes.sets,o.shapes);let h=this.getShapeLibrary().getShapeTagDefinition(o.useSvgContainer===!0,o.shapes.strokeWidth||2,o.shapes.showLabels,o.shapes.font,o.shapes.labelAttribute,o.shapes.defaultFillColor,o.shapes.defaultOutlineColor,o.shapes.defaultColor);this.registerTag(o.shapes.tagName||YP,h),this.If(),this.Vf()}}$syncManagedElementWithView(e,t){let n=e.el,o=s=>{if((K(e.modelObject)||Y(e.modelObject))&&e.modelObject.group){let a=this.getGroupElement(e.modelObject.group.id),l=this.$_getGroupContentAreaInfo(e.modelObject.group.id);s.x-=a.x+l.internalOffset.x,s.y-=a.y+l.internalOffset.y}};if(wt(n.parentElement)){let s=Ie(e,e.c,e.r);o(s),pn(n,s),xi(n,e.r)}else{xi(n,e.r);let s=ft(e);o(s),Ne(n,s)}t&&(this.$repaintUIElement(e),this.oe(s=>s.$vertexSynced(e)))}$addTransferrableVertexAttributes(e){e.forEach(t=>this.Mu.add(t))}$enableVertexDrag(){this.hr.$enable()}$disableVertexDrag(){this.hr.$disable()}$canDrop(e,t,n){return this.El!=null?this.El(e,t,n):!0}addElementEventFilter(e){this.Vu.push(e)}$vertexRendered(e,t,n,o){super.$vertexRendered(e,t,n,o),this.M.usesWrapperElement&&t.firstElementChild!=null&&this.Mu.forEach(s=>{t.firstElementChild.hasAttribute(s)&&(t.setAttribute(s,t.firstElementChild.getAttribute(s)),t.firstElementChild.removeAttribute(s))})}$createDefaultLayoutAdapter(){return new fm(this)}$createGroupLayoutAdapter(e){return new ym(e,this)}$startPanRepeat(e,t,n,o,s,a){U("startPanRepeat not implemented in BrowserUI. Subclasses should implement.")}$stopPanRepeat(){U("stopPanRepeat not implemented in BrowserUI. Subclasses should implement.")}If(){this.nt=this.getShapeLibrary().getSvgDefsElement(),this.nt.style.position="absolute",this.nt.style.width="1px",this.nt.style.height="1px",this.nt.style.left="-10000px",this.nt.style.top="-10000px",this.getContainer().appendChild(this.nt)}Vf(){this.$shapeLibrary&&this.$shapeLibrary.getShapeSets().forEach(t=>{t.shapes.forEach(n=>{var o,s;n.objectType===oe.objectType&&n.members!=null&&((o=n.members.nodes)==null||o.forEach(a=>a.category=a.category||t.id),(s=n.members.groups)==null||s.forEach(a=>a.category=a.category||t.id),this.model.addGroupTemplate(`${t.id}:${n.type}`,n.members))})})}Mf(e,t,n){let s=["edge",t].join(":");if(n.Gf=e,e.events[t]!=null)try{e.events[t]({e:n,overlay:e})}catch(a){U("WARN: VisuallyJs overlay event threw exception "+a)}this.Fi(t,s,e.connection,n,e)}$isAsynchronousRender(){return this.M.asynchronous===!0}$isDraggingSupported(){return!1}$removeElement(e){e!=null&&e.parentNode&&e.parentNode.removeChild(e)}$appendElement(e,t,n){t&&(n?t.insertBefore(e,t.firstElementChild):t.appendChild(e))}$setElementVisible(e,t){e.style.display=t?Pr:pt}$doVertexUpdated(e){this.M.reactive===!1&&this.M.update(e.el,e.modelObject.data,e.modelObject,this)}$graphClearStart(){this.vertexList.forEach(e=>{let t=this.$getManagedElement(e.id);t!=null&&this.M.cleanupVertex(e.id,t.el)}),super.$graphClearStart()}$appendElementToContainer(e,t){this.$appendElement(e,this.fe,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.fe,t)}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.getContainer(),t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendEdgeElement(e,t){this.$appendElementToVertexLayer(e,t)}$getAssociatedElements(e){let t=[];if(e.nodeType!==3&&e.nodeType!==8){let n=e.querySelectorAll(Eh);Array.prototype.push.apply(t,n)}return t.filter(n=>n.nodeType!==3&&n.nodeType!==8)}$getClassFromElement(e){return jC(e)}$addClassToElement(e,t){L(e,t)}$elementHasClass(e,t){return un(e,t)}$removeClassFromElement(e,t){F(e,t)}$toggleClassOnElement(e,t){sy(e,t)}$updateElementClasses(e,t,n){Xt(e,t,n)}$setAttribute(e,t,n){e.setAttribute(t,n)}$getAttribute(e,t){return e.getAttribute(t)}$setAttributes(e,t){for(let n in t)e.setAttribute(n,t[n])}$removeAttribute(e,t){e.removeAttribute&&e.removeAttribute(t)}on(e,t,n,o){let s=a=>{o==null?this.ye.on(a,t,n):this.ye.on(a,t,n,o)};return Bn(e)?e.forEach(a=>s(a)):s(e),this}off(e,t,n){return Bn(e)?e.forEach(o=>this.ye.off(o,t,n)):this.ye.off(e,t,n),this}trigger(e,t,n,o,s){this.ye.trigger(e,t,n,o,s)}$getOffsetRelativeToRoot(e){return no(e)}$f(e,t,n){function o(l){return l.offsetParent||l.parentNode}let s=e!==n&&o(e)!==n?o(e):null,a=l=>{l!=null&&l!==document.body&&!isNaN(l.scrollTop)&&!isNaN(l.scrollLeft)&&(l.scrollTop>0||l.scrollLeft>0)&&(t.x-=l.scrollLeft,t.y-=l.scrollTop)};for(;s!=null;){let l=mn(s)||{x:0,y:0};t.x+=l.x,t.y+=l.y,a(s),s=o(s)===n?null:o(s)}}$getElementPositionInUIRelativeToCanvasOrigin(e,t){let n=e.el,o={x:0,y:0};if(this.containerType==="SVG"){let s=em(n,this.getContainer(),!0);if(H(e.modelObject)){let a=this.getElement(e.modelObject.parent.id);if(a.r!==0){let l=em(a.el,this.getContainer(),!0),h={x:l.x+a.width/2,y:l.y+a.height/2},d=Ie(h,l,a.r);return Ie(s,d,-a.r)}}else if(e.r!==0){let a={x:s.x+t.width/2,y:s.y+t.height/2},l=Ie(a,s,e.r);return Ie(s,l,-e.r)}return s}else{if(n.namespaceURI===Gt){let l=n.closest(Le);l!=null&&l!==n&&(o=em(n,l,!0),n=l)}let s=this.getContainer(),a=mn(n,t);if(this.$f(n,a,s),s!=null&&!isNaN(s.scrollTop)&&!isNaN(s.scrollLeft)&&(s.scrollTop>0||s.scrollLeft>0)){let l=n.offsetParent!=null?this.$getStyle(n.offsetParent,oy):Av,h=this.$getStyle(n,oy);h!==qe&&h!==Cf&&l!==qe&&l!==Cf&&(a.x-=s.scrollLeft,a.y-=s.scrollTop)}return{x:a.x+o.x,y:a.y+o.y}}}$setElementSizeInUI(e,t,n){Rr(e,t,n)}$setElementWidth(e,t){EP(e,t)}$setElementHeight(e,t){fP(e,t)}$getSize(e){return We(e)}$setElementRotation(e,t){xi(e,t)}$setVisibleElementRotation(e,t){xi(e.el,t),this.oe(n=>n.$vertexRotated(e,t))}$getElementPositionInUIRelativeToParent(e){return mn(e)}$getElementPositionInWindow(e){return e.getBoundingClientRect()}$getStyle(e,t){return typeof window.getComputedStyle!==bA?getComputedStyle(e,null).getPropertyValue(t):e.currentStyle[t]}$getGroupContentAreaElement(e){let t=this.$getSelector(e,BC);return t&&t.length>0?t[0]:this.M.usesWrapperElement&&e.childElementCount>0?e.firstElementChild:e}$getSelector(e,t){return HC.apply(null,arguments)}$setViewportElementPosition(e,t){e.r!==0?wt(e.el.parentElement)?yP(e,t):Ne(e.el,t):Ne(e.el,t)}setDraggable(e,t){let n=this.getObjectInfo(e,!1);n.obj&&(t?this.$removeAttribute(n.el,rh):this.$setAttribute(n.el,rh,Pt))}isDraggable(e){let t=this.$getAttribute(e,rh);return t==null||t===ct}toggleDraggable(e){let t=this.isDraggable(e);return this.setDraggable(e,!t),!t}Fi(e,t,n,o,s,a){let l=n.edge;if(!l.transient||a){let h={obj:l,e:o,model:this.model,ui:this,connection:n,overlay:s,def:null},d=this.view.getEdgeDefinition(this.model.getEdgeType(l.data));d&&d.events&&d.events[e]?d.events[e](h):e===W&&this.$edgeTap(h),this.fireUnchecked(t,h)}}$edgeTap(e){}getLabelLocationAttribute(e){return this.view.getEdgeDefinition(this.model.getEdgeType(e.data||{})).labelLocationAttribute||Vf}xs(e,t){let o=Bt(rs(t),$n,this.getContainer(),!0).jtk.overlay;o&&this.Mf(o,e,t)}Bf(e){this.xs(ze,e)}Ff(e){this.xs(Vo,e)}Uf(e){this.xs(W,e)}zf(e){this.xs(Ur,e)}bs(e,t,n){if(!n.defaultPrevented&&n.Gf==null){let o=Bt(rs(n),Zr,this.getContainer(),!0);this.Fi(e,t,o.jtk.connection,n,null)}}Yf(e){this.bs(ze,CS,e)}Xf(e){this.bs(Vo,PS,e)}jf(e){this.bs(W,LS,e)}Hf(e){this.bs(Ur,OS,e)}$u(e,t){let o=Bt(rs(t),$n,this.getContainer(),!0).jtk.overlay;o&&this.Bu(o.connection,e,t)}kf(e){this.$u(!0,e)}Wf(e){this.$u(!1,e)}Bu(e,t,n){if(e&&!e.edge.transient){let o=n.toElement,s=n.target;if(o!=null&&o!==s){if(o.getAttribute(Qe)===e.edge.id)return;let h=o.closest(".vjs-connector");if(h!=null&&h.getAttribute(Qe)===e.edge.id)return;let d=o.closest(".vjs-overlay");if(d!=null&&d.getAttribute(Qe)===e.edge.id)return}this.$setConnectorHover(e,t),t?(Xt(e.sourceElement,[Ly]),Xt(e.targetElement,[wy])):(Xt(e.sourceElement,[],[Ly]),Xt(e.targetElement,[],[wy]));let a=t?st:ot,l=t?lu:au;this.Fi(a,l,e,n,null)}}Fu(e,t){var o;let n=rs(t).parentNode;this.Bu((o=n.jtk)==null?void 0:o.connection,e,t)}Zf(e){this.Fu(!0,e)}Jf(e){this.Fu(!1,e)}Uu(e,t){let n=rs(t).parentNode;if(n.jtk&&n.jtk.connection){let o=t.target;if(!o.classList.contains(oo)&&!o.classList.contains(so)){let s=e?ae:me,a=e?_S:Fl;this.Fi(s,a,n.jtk.connection,t,null)}}}Kf(e){this.Uu(!0,e)}qf(e){this.Uu(!1,e)}Qf(e){let t=rs(e).parentNode;t.jtk&&t.jtk.connection&&this.Fi(At,RS,t.jtk.connection,e,null)}ey(e){let t=e.target,n=this.getModelObjectFromElement(t,!0,!1);if(n!=null)return this.Vu.find(s=>Bt(t,s,n.el,!0))!=null?null:{el:n.el,obj:n.obj,e,model:this.model,ui:this}}ur(e,t,n){if(!e.defaultPrevented){let o=this.ey(e);if(o!=null){let s=K(o.obj)?this.getNodeDefinition(o.obj):Y(o.obj)?this.getGroupDefinition(o.obj):H(o.obj)?this.getPortDefinition(o.obj):null;s&&s.events&&s.events[t]&&s.events[t](o),this.fireUnchecked(n,o)}}}ny(e){this.ur(e,ze,fS)}iy(e){this.ur(e,Vo,yS)}ly(e){this.ur(e,W,vS)}hy(e){this.ur(e,Ur,xS)}uy(e){this.ur(e,At,TS)}py(e){this.ur(e,ot,bS)}my(e){this.ur(e,st,AS)}gy(e){this.ur(e,se,SS)}Ey(e){let t=this.getModelObjectFromElement(e.target.closest(".vjs-group"),!0,!1);t!=null&&Y(t.obj)&&this.toggleGroup(t.obj)}fy(e,t,n){let o=n.bind(this);this.wn.push({eventName:e,handler:o}),this.ye.on(this.getContainer(),e,t,o)}addDragHandler(e){this.hr==null?this.Ui.push(e):this.hr.addHandler(e)}yy(){this.hr!=null&&this.hr.destroy(),this.Ui=this.Ui||[],this.hr=new sm(this.fe,{translate:e=>this.fromPageLocation(e.x,e.y),init:e=>this.zu(e)}),this.Ui.forEach(e=>this.hr.addHandler(e)),this.Ui.length=0}zu(e){}snapPageLocationToGrid(e,t,n){let o=this.fromPageLocation(e,t),s=le(o,n);return this.toPageLocation(s.x,s.y)}$getNodesInViewport(){return this.As(he.objectType,this.getContainer())}$getGroupsInViewport(){return this.As(oe.objectType,this.getContainer(),e=>this.$getGroupContentAreaElement(e))}$isTouchDevice(){return Gn()}$isArrayLike(e){return super.$isArrayLike(e)||Bn(e)}As(e,t,n){let o=t.getBoundingClientRect(),s={};return Object.values(this.viewport.getElements()).filter(l=>{if(l.modelObject.objectType===e){let h=n?n(l.el):l.el;return s[l.modelObject.id]=h.getBoundingClientRect(),tt(s[l.modelObject.id],o)}else return!1}).map(l=>({el:l,bb:s[l.id]}))}Gu(){if(this.wn!=null){this.fl();let e=[[ze,$n,this.Bf],[Vo,$n,this.Ff],[W,$n,this.Uf],[Ur,$n,this.zf],[ze,Zr,this.Yf],[Vo,Zr,this.Xf],[W,Zr,this.jf],[Ur,Zr,this.Hf],[ze,this.dr,this.ny],[Vo,this.dr,this.iy],[W,this.dr,this.ly],[Ur,this.dr,this.hy],[W,FC,this.Ey],[At,Zr,this.Qf],[ae,Zr,this.Kf],[me,Zr,this.qf],[At,Eh,this.uy]];this.Iu===!0&&e.push.apply(e,[[st,Zr,this.Zf],[ot,Zr,this.Jf],[st,$n,this.kf],[ot,$n,this.Wf],[ot,this.dr,this.py],[st,this.dr,this.my],[se,this.dr,this.gy]]),e.forEach(t=>{this.fy(t[0],t[1],t[2])})}}fl(){let e=this.getContainer();e&&this.wn!=null&&(this.wn.forEach(t=>{this.ye.off(e,t.eventName,t.handler)}),this.wn.length=0)}setContainer(e){if(e===document||e===document.body)throw new Error("Cannot set document or document.body as container element");this.fl(),this.$setAttribute(e,ny,B().replace("-",""));let t=this.getContainer();t!=null&&(t.removeAttribute(ny),Array.from(t.childNodes).filter(o=>o!=null&&(un(o,ca)||un(o,da)||o.getAttribute&&o.getAttribute(mt)!=null)).forEach(o=>{e.appendChild(o)})),super.setContainer(e),this.containerType=Jp(e),this.ye!=null&&(this.yy(),this.Gu())}reset(){super.reset(),this.Ge&&this.Ge.disconnect(),this.getContainer().querySelectorAll([Eh,Zr,$n].join(",")).forEach(n=>n.parentNode&&n.parentNode.removeChild(n))}destroy(){this.nt!=null&&this.nt.parentNode!=null&&this.nt.parentNode.removeChild(this.nt),this.fl(),super.destroy()}$__unmanage(e,t,n){this.Ge!=null&&this.Ge.unobserve(e),super.$__unmanage(e,t,n)}$addOverlayClass(e,t){if(ho(e))Th(this,e).map(n=>L(n,t));else if(Un(e))is(this,e).map(n=>L(n,t));else if(kr(e))L(as(e,this),t);else if(dn(e))L(Pa(e,this),t);else throw"Could not add class to overlay of type ["+e.type+"]"}$removeOverlayClass(e,t){if(ho(e))Th(this,e).map(n=>F(n,t));else if(Un(e))is(this,e).map(n=>F(n,t));else if(kr(e))F(as(e,this),t);else if(dn(e))F(Pa(e,this),t);else throw"Could not remove class from overlay of type ["+e.type+"]"}getGroupDefinition(e){return this.yl(this.view.getGroupDefinition(this.model.getNodeType(e.data)))}getPortDefinition(e){return this.yl(this.view.getPortDefinition(this.model.getPortType(e.data)))}getNodeDefinition(e){return this.yl(this.view.getNodeDefinition(this.model.getNodeType(e.data)))}getVertexDefinition(e){if(Y(e))return this.getGroupDefinition(e);if(H(e))return this.getPortDefinition(e);if(K(e))return this.getNodeDefinition(e)}yl(e){return e!=null&&e.template&&e.templateId==null&&this.M.addTemplate&&(e.templateId=B(),this.M.addTemplate(e.templateId,e.template)),e}registerTag(e,t){this.M.recado!=null&&this.M.recado.registerTag(e,t)}createRenderer(e,t,n){return(s,a,l,h,d,u)=>{let p=n(a),m=a,g;m=Object.assign({},l?l.parameters||{}:{}),Object.assign(m,a);let E={};for(g in m)m.hasOwnProperty(g)&&m[g]!=null&&(m[g].constructor==Function?E[g]=m[g](a):E[g]=m[g]);if(m=E,l){let y=l.templateId||`vjs-${e}-${p}`;if(l.templateIdResolver&&(y=l.templateIdResolver(m,this,this.model,s)),this.$_useModelForSizes){let x=this.$resolveVertexSizeFromModel(s,l);m[this.$modelWidthAttribute]=x.width,m[this.$modelHeightAttribute]=x.height}d?this.M.rerender(y,m,this.model,e,this,l,s,h,u):this.M.render(y,m,this.model,e,this,l,s,h)}}}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.initialSize!=null)return Object.assign({},a.initialSize)}return this.$_getDefaultSizeForVertex(e,t)}$doRenderNode(e,t){if(this.getElement(e.id)==null){let n=this.getNodeDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.gl(e,e.data,n,t,!1,null))}}$reRenderNode(e){let t=this.$getManagedElement(e.id);if(t==null)this.$doRenderNode(e);else{let n=this.getNodeDefinition(e);this.gl(e,e.data,n,null,!0,t.el)}}$doRenderGroup(e,t){if(this.getElement(e.id)==null){let n=this.getGroupDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.Nu(e,e.data,n,t,!1,null))}}$paintOverlay(e,t,n){if(ho(e))aP(this,e,t,n);else if(Un(e))lP(this,e,t,n);else if(kr(e)){as(e,this);let o=t,s=e;this.Yu(s,o,e.rotatable!=null)}else if(dn(e)){Pa(e,this);let o=t,s=e;this.Yu(s,o,e.rotatable!=null)}else throw"Could not paint overlay of type ["+e.type+"]"}Yu(e,t,n){if(e.location===0||e.location===1){let s=(e.location===0?e.connection.anchors.source:e.connection.anchors.target).computedPosition;this.$setAttributes(e.contentElement,{"data-anchor-x":`${s.x}`,"data-anchor-y":`${s.y}`,"data-anchor-ox":`${s.ox}`,"data-anchor-oy":`${s.oy}`})}e.contentElement.style.left=t.d.minx+Mn,e.contentElement.style.top=t.d.miny+Mn,n&&xi(e.contentElement,t.d.rotation||0)}setOverlayVisible(e,t){e.visible=t;function n(o){o!=null&&(t?F(o,oh):L(o,oh))}if(ho(e)){let o=e;o.contentElements&&o.contentElements.forEach(n)}else Un(e)?e.contentElements&&e.contentElements.forEach(n):kr(e)?n(as(e,this)):dn(e)&&n(Pa(e,this))}$reattachOverlay(e,t){ho(e)?Th(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):Un(e)?is(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):kr(e)?this.$appendElement(as(e,this),this.getContainer()):dn(e)&&this.$appendElement(Pa(e,this),this.getContainer())}$setOverlayHover(e,t){let n;ho(e)?n=Th(this,e):Un(e)?n=is(this,e):kr(e)?n=[as(e,this)]:dn(e)&&(n=[Pa(e,this)]),n!=null&&n.length>0&&(n.forEach(o=>{Xt(o,t?[wh]:[],t?[]:[wh])}),this.$setHover(e.connection,t))}destroyOverlay(e){ho(e)&&e instanceof Qp?my(e):Un(e)?my(e):sP(e)?(e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement),delete e.cachedDimensions):dn(e)&&e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement)}$drawOverlay(e,t,n,o){if(ho(e))return e.draw(t,n,o);if(Un(e)){let s=gr(t,e.location),a=n.stroke,l=n.stroke,h=n.strokeWidth,d=null;if(e.rotatable!=null){let u=e.location,p=!1;(j(e.location)||e.location<0||e.location>1)&&(u=parseInt(""+e.location,10),p=!0);let m=gr(t,u,p),g=Be(t,u,.01,p);d=fl(El(m,g)*180/Math.PI),e.rotatable!=="strict"&&d>90&&d<270&&(d=fl(d-180))}return{d:{loc:s,rotation:d},"stroke-width":h,stroke:a,fill:l,xmin:s.x,xmax:s.x,ymin:s.y,ymax:s.y,tail:s}}else if(kr(e)||dn(e)){let s={x:0,y:0};if(o)s={x:o.x,y:o.y};else{let d=e.location,u=!1;(j(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0),s=gr(t,d,u)}let a=s.x,l=s.y,h=null;if(e.rotatable!=null){let d=e.location,u=!1;(j(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0);let p=gr(t,d,u),m=Be(t,d,.01,u);h=fl(El(p,m)*180/Math.PI),e.rotatable!=="strict"&&h>90&&h<270&&(h=fl(h-180))}return{d:{minx:a,miny:l,cxy:s,rotation:h},xmin:a,xmax:a,ymin:l,ymax:l,tail:s}}else U("WARN: VisuallyJs - could not draw overlay of type ["+e.type+"]. Overlay type unknown.")}updateLabel(e){let t=as(e,this),n=e.getLabel();n!=null?(t.innerText=n,t.textContent=n):(t.innerText="",t.textContent="")}$setHover(e,t){e.connector!=null&&this.$setConnectorHover(e,t)}$paintConnector(e,t){UP(this,e,t)}$setConnectorHover(e,t){if(t===!1||!this.$isInMotion&&!this.hoverSuspended){e.$hover=t;let n=e.connector,o=n.canvas;o!=null&&(n.hoverClass!=null&&Xt(o,t?[n.hoverClass]:[],t?[]:[n.hoverClass]),Xt(o,t?[wh]:[],t?[]:[wh])),e.hoverPaintStyle!=null&&(e.paintStyleInUse=t?e.hoverPaintStyle:e.paintStyle),Object.values(e.overlays).forEach(s=>{s.ls===to&&this.setOverlayVisible(s,t)}),this.ft||this.$paintConnection(e)}}$destroyConnector(e){e.connector!=null&&JN(e.connector)}$addConnectorClass(e,t){e.canvas&&L(e.canvas,t)}$removeConnectorClass(e,t){e.canvas&&F(e.canvas,t)}$getConnectorClass(e){return e.canvas?e.canvas.className.baseVal:""}$setConnectorVisible(e,t){ZN(e,t)}$applyConnectorType(e,t){if(t.cssClass){let n=Array.isArray(t.cssClass)?t.cssClass:[t.cssClass];e.canvas?L(e.canvas,n.join(" ")):e.classesToAddWhenRendered=n}}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.M.cleanupVertex(e.node.id,t.el),requestAnimationFrame(()=>{this.$relayoutOnVertexRemove&&this.refresh()})),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t)return this.M.cleanupVertex(e.group.id,t.el),requestAnimationFrame(()=>{this.$relayoutOnVertexRemove&&this.refresh()}),t}addClass(e,t){e.constructor===pr?(e.eachVertex((n,o)=>this.addClass(o,t)),e.eachEdge((n,o)=>this.addClass(o,t))):this.xl(e,t,L)}removeClass(e,t){e.constructor===pr?(e.eachVertex((n,o)=>this.removeClass(o,t)),e.eachEdge((n,o)=>this.removeClass(o,t))):this.xl(e,t,F)}toggleClass(e,t){e.constructor===pr?(e.eachVertex((n,o)=>this.toggleClass(o,t)),e.eachEdge((n,o)=>this.toggleClass(o,t))):this.xl(e,t,sy)}hasClass(e,t){if(e!=null){let n=this.getObjectInfo(e,!1);return n.el?un(n.el,t):io(e)?un(e,t):!1}}xl(e,t,n){let o=s=>{let a=this.getObjectInfo(s,!1);a.el?n(a.el,t):io(s)&&n(s,t)};e!=null&&(Bn(e)?n(e,t):XC(e)?e.forEach(s=>o(s)):o(e))}$setConnectionVisible(e,t){er.setVisible(e,t)}$manage(e,t,n,o,s,a){return this.getElement(t.getFullId())||(()=>{if(this.containerType==="SVG"&&!wt(e))throw new Error("ERROR: cannot manage non-svg element when container is an SVG element.");let l=super.$manage(e,t,n,o,s,a);return l!=null&&this.Ge!=null&&this.Ge.observe(l.el),l})()}$getModelInfoForDragElement(e,t,n){let o=null,s=null,a=null,l=null,h=null,d=Bt(e,Ae(hn),this.getContainer(),!0)||Bt(e,Ae(te),this.getContainer(),!0);if(d!=null&&(h=this.getModelObjectFromElement(d,!1,n)),h!=null&&!rt(h.obj)){l=h.obj;let u=h.missingPortCreated,p=H(l)?l.getParent():l,m={},g=t?Ki:qi;if(o=e.getAttribute(g)||e.getAttribute(Hr),!H(l)){let E=t?[ha,_f]:[Zo,rp];if(a=e.getAttribute(E[0])||e.getAttribute(E[1])||e.getAttribute(hn)||e.getAttribute(nh),a!=null){let y=l.getPort(a);n?(l=l.$addPort({id:a,type:o}),u=!0):l=y||l}}return H(l)&&(a=l.id,s=this.model.getPortType(l)),o!=null?m=this.view.getPortDefinition(o):m=this.view.getTypeDefinition(l),{vertexEl:d,objEl:this.getModelObjectFromElement(e,!0,!0).el,obj:l,vertex:p,typeDef:m,portType:o||s,portId:a,missingPortCreated:u}}else return null}$isElement(e){return io(e)}getElementFromEvent(e){let t=Bt(e.target,Ae(mt),this.getContainer(),!0);return t!=null?this.getElement(t.getAttribute(mt)):null}getModelObjectFromElement(e,t,n){let o=s=>{let a;if(s.jtk!=null){if(s.jtk.node!=null)return{obj:s.jtk.node,el:s,missingPortCreated:!1};if(s.jtk.group!=null)return{obj:s.jtk.group,el:s,missingPortCreated:!1};if(s.jtk.port!=null)return{obj:s.jtk.port,el:s,missingPortCreated:!1};if(s.jtk.overlay!=null)return{obj:s.jtk.overlay.connection.edge,el:s,missingPortCreated:!1}}let l=s.getAttribute(te);if(l!=null){let h=this.model.getVertex(l);h!=null&&(a={obj:h,el:s,missingPortCreated:!1})}if(a==null){let h=s.getAttribute(hn)||s.getAttribute(ha)||s.getAttribute(Zo);if(h!=null){let d=Bt(s,Ae(mt),this.fe,!1);if(d!=null){let u=d.getAttribute(mt),p=this.model.getNode(u)||this.model.getGroup(u);if(p)if(n){let m=s.getAttribute(Hr)||s.getAttribute(Ki)||s.getAttribute(qi)||be;return{obj:p.$addPort({id:h,type:m}),el:s,missingPortCreated:!0}}else{let m=p.getPort(h);return m==null?null:{obj:m,el:s,missingPortCreated:!1}}}}}if(a==null&&t===!0){let h=s.parentElement;return h!=null&&h!==this.fe?o(h):null}else return a};return o(e)}getRenderedPort(e){let n=(H(e)?e.getFullId():e).split(this.model.portSeparator),o=this.getRenderedElement(n[0]);return o?o.querySelector(fi(hn,n[1]))||o.querySelector(fi(Zo,n[1]))||o.querySelector(fi(ha,n[1]))||o:null}$isSupportedElement(e){return io(e)}$afterRefresh(e){}$afterRelayout(e){}$zoomToFit(e){}$zoomToFitIfNecessary(e){}$zoomToElements(e){}$renderTransientVertex(e,t,n,o,s,a){let l=G(Le,a,o,s);return Rr(l,t.width,t.height),this.containerType==="SVG"?pn(l,e):Ne(l,e),l}getRenderedElement(e){var a;if(e==null)return null;let n=(j(e)?e:e.getFullId()).split(this.model.portSeparator),o=(a=this.$getManagedElement(n[0]))==null?void 0:a.el;function s(l,h){return o.querySelector(`:scope [${l}="${h}"]:not(:scope [data-vjs-managed] [${l}="${h}"])`)}if(o&&n.length>1){let l=s(hn,n[1])||s(ha,n[1])||s(Zo,n[1]);if(l==null){if(this.logicalPorts===!0||o.getAttribute(hn)===n[1]||o.getAttribute(ha)===n[1]||o.getAttribute(Zo)===n[1]||o.getAttribute(nh)===n[1]||o.getAttribute(_f)===n[1]||o.getAttribute(rp)===n[1])return o}else return l}else return o}getZoom(){return this.currentZoom}getEffectiveVisibleZoom(){return this.getZoom()}getShapeLibrary(){return this.$shapeLibrary}$getEdgePropertyMappings(){var e;return(e=this.$_propertyMapper)==null?void 0:e.getPropertyMappings()}setSuspendRendering(e,t){this.$suspendRendering=e,this.$_setSuspendDrawing(e),t&&this.refresh()}isSuspendRendering(){return this.$suspendRendering}$getCollapsedGroupSize(e,t){let n=this.$computeCollapsedGroupSize(e,t);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.collapsedSize!=null)return Object.assign({},a.collapsedSize)}return super.$getCollapsedGroupSize(e,t)}$drawAdHocEdge(e,t,n,o=[],s,a,l={}){let h=document.createElement("div"),d=e.lineWidth||2,u=e.color||"#000000",p=Math.max(d,Math.abs(n.x-t.x)),m=Math.max(d,Math.abs(n.y-t.y)),g=G(Le,{viewBox:`0 0 ${p} ${m}`});g.style.overflow="visible";let E=t.x<n.x?0:p,y=t.y<n.y?0:m,x=t.x>n.x?0:p,f=t.y>n.y?0:m,b=[{x1:E,x2:x,y1:y,y2:f,extents:{xmin:0,ymin:0,xmax:p,ymax:m},type:Nn,length:0}],A={internalSegments:b,totalLength:0,segmentProportions:[[0,1]],segmentProportionalLengths:[1],paintInfo:{sx:E,sy:y,tx:x,ty:f,so:{x:1,y:0},to:{x:-1,y:0},quadrant:1,x:E,y,w:x-E,h:f-y,startStubX:0,endStubX:0,startStubY:0,endStubY:0,opposite:!1,perpendicular:!1,orthogonal:!1,stubs:[0,0],sourceAxis:"x",isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1}},T=(R,v,O)=>{let[P,I]=j(R)?[R,{}]:[R.type,R.options],C=Po(I,l,"_");C.location=v,C.direction=O;let _=at.get(this,P,{instance:this},C),w=this.$drawOverlay(_,A,{stroke:u,fill:u});if(_.isSimpleShape){let $=_,N=w;$.contentTags.forEach((M,D)=>{let V=G(M,N.atts[D]);g.appendChild(V)})}else if(Un(_)){let $=_,N=w;$.contentElements.forEach(M=>{pn(M,N.d.loc),g.appendChild(M)})}else if(dn(_)){let $=_,N=w;$.contentElements.forEach(M=>{pn(M,N.d.loc),g.appendChild(M)})}return w};if(s!=null){let R=T(s,0,-1);E=R.tail.x,y=R.tail.y,b[0].x1=E,b[0].y1=y}if(a!=null){let R=T(a,1,1);x=R.tail.x,f=R.tail.y,b[0].x2=x,b[0].y2=f}b[0].length=Math.sqrt(Math.pow(x-E,2)+Math.pow(f-y,2)),A.totalLength=b[0].length;let S=G(ee,{stroke:u,"stroke-width":d,"stroke-dasharray":e.dashArray||"",d:`M ${E},${y} L ${x},${f}`});return g.appendChild(S),o.forEach(R=>{let[v,O]=j(R)?[R,{}]:[R.type,R.options],P=Po(O,l,"_"),I=at.get(this,v,{instance:this},P),C=this.$drawOverlay(I,A,{stroke:u,fill:u});if(I.isSimpleShape){let _=I,w=C;_.contentTags.forEach(($,N)=>{let M=G($,w.atts[N]);g.appendChild(M)})}else if(Un(I)){let _=I,w=C;_.contentElements.forEach($=>{pn($,w.d.loc),g.appendChild($)})}else if(kr(I))if(I.useHTMLElement){let _=C,w=I.contentElement;h.appendChild(w),w.style.left=`${_.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${_.d.cxy.y}px)`}else{let _=G(ee,C.atts[0]);g.appendChild(_)}else if(dn(I)){let _=C,w=I.create(null,null,this,this.model);w.style.position=qe,w.style.transform="translate(-50%, -50%)",h.appendChild(w),w.style.left=`${_.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${_.d.cxy.y}px)`}}),h.appendChild(g),h}toBack(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;n.el.parentElement.insertBefore(n.el,n.el.parentElement.childNodes[0]),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a)),t&&n.obj.group!=null&&this.toBack(n.obj.group)}}toFront(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;t&&n.obj.group!=null&&this.toFront(n.obj.group,t),n.el.parentElement.insertBefore(n.el,null),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a))}}$setGroupElementSize(e,t){let n=this.getGroupElement(e.id);if(wt(n.el))this.$setElementSizeInUI(n.el,t.width,t.height);else{let o=n.contentArea||n.el;this.$setElementSizeInUI(o,t.width,t.height)}}setMode(e,t){}batch(e){this.setSuspendEvents(!0),this.model.batch(e),this.setSuspendEvents(!1)}setEnabled(e,t){let n=e.getFullId(),o=this.getRenderedElement(n)||this.getRenderedPort(n);return o!=null&&io(o)&&(t?o.removeAttribute(yr):o.setAttribute(yr,ct)),t}flashVertex(e,t=1e3,n=SP){let o=Array.isArray(e)?e:[e],s=`${n} ${t}ms`;o.forEach(a=>{let l=this.getObjectInfo(a,!1);l.obj&&l.el&&(l.el.style.animation=s,L(l.el,Ay))})}flashSelection(e,t=1e3,n){this.flashVertex(e.getNodes(),t,n),this.flashVertex(e.getGroups(),t,n)}reload(){this.dataSource instanceof pr?this.dataSource.reload():U("VisuallyJs - WARN: UI not rendering a selection, `reload` has no effect. Not fatal.")}};var _a=`<div data-vjs-vertex="{{id}}" class="${Qi} ${Oy}">{{label}}</div>`,KN="<div/>",qN=`<div data-vjs-vertex="{{id}}" class="${Jo} ${_y}">{{label}}</div>`,Ra=`<svg:rect data-vjs-vertex="{{id}}" class="${Qi} ${Oy}" x="0" y="0" width="80" height="60"/>`,QN='<svg:rect x="0" y="0" width="100%" height="30"/>',eI=`<svg:rect data-vjs-vertex="{{id}}" class="${Jo} ${_y}" x="0" y="0" width="300" height="250"/>`,tI={html:{"vjs-node-default":_a,"vjs-group-default":qN,"vjs-port-default":KN},svg:{"vjs-node-default":Ra,"vjs-group-default":eI,"vjs-port-default":QN}},iO=(i,r)=>tI[i][r],Am=class{constructor(r,e,t){c(this,"recado");c(this,"asynchronous",!1);c(this,"reactive",!1);c(this,"usesWrapperElement",!1);c(this,"uicore",null);c(this,"currentVertex",null);if(t=t||{},this.recado=Ar({defaultTemplate:r,templates:t.templates,templateMacros:t.templateMacros,templateResolver:e}),t.tags)for(let n in t.tags)this.registerTag(n,t.tags[n])}render(r,e,t,n,o,s,a,l){this.uicore=o,this.currentVertex=a;let h=this.recado.template(r,e,null,!1,{obj:a,ui:o,model:o.model}),d=h.childNodes[0];o.$vertexRendered(a,d,s,null),h.$recado.mountings.length>0&&this.recado.mounted(h),this.currentVertex=null}rerender(r,e,t,n,o,s,a,l,h){this.q(h),this.render(r,e,t,n,o,s,a,l)}q(r){this.recado.remove(r,!0)}cleanupVertex(r,e){this.q(e)}cleanupPort(r,e){this.q(e)}addTemplate(r,e){this.recado.addTemplate(r,e)}registerTag(r,e){this.recado.registerTag(r,{template:e.template,rendered:(t,n,o,s)=>{e.rendered&&e.rendered(t,n,o,this.uicore,this.currentVertex)},updated:(t,n,o)=>{e.updated&&e.updated(t,n,o,this.uicore,this.currentVertex)},mounted:e.mounted,fragments:e.fragments})}update(r,e,t,n){if(r.$recado){this.currentVertex=t,this.uicore=n;let o=this.recado.update(r,e,{obj:t});for(let s=0;s<o.removed.length;s++)o.removed[s].el.nodeType!==3&&o.removed[s].el.nodeType!==8&&n.$__unmanage(o.removed[s].el,!1,!0)}}removeElement(r){this.q(r)}};function Uh(i,r,e){let t=n=>iO(r?"svg":"html",n)||Ny(n)||i;return new Am(i,t,e)}var rI="pointerdown",nI="pointermove",iI="pointerup",oI="touchstart",oO="touchmove",sO="touchend";function aO(i,r,e,t){return Math.sqrt(Math.pow(e-i,2)+Math.pow(t-r,2))}var Sm=class{constructor(r){c(this,"isPointerDevice");c(this,"isTouchDevice");c(this,"center");c(this,"radius");c(this,"startRadius");c(this,"onPinchStart");c(this,"onPinch");c(this,"onPinchEnd");c(this,"eventManager");c(this,"listenerTypes",{pointer:r=>{let e={},t=[],n=0,o=!1,s=()=>{n===2&&(this.center={x:(t[1].p[0]+t[0].p[0])/2,y:(t[1].p[1]+t[0].p[1])/2},this.radius=aO(t[1].p[0],t[1].p[1],t[0].p[0],t[0].p[1]))},a=d=>{n>=2||o||(t[n]={e:d,p:[d.pageX,d.pageY]},e[""+d.pointerId]=n,n++,s(),n===2&&(this.startRadius=this.radius,this.zr(this.onPinchStart)))},l=d=>{e[""+d.pointerId]!=null&&(delete e[""+d.pointerId],n--,o=n!==0,this.Xu())},h=d=>{if(o||n!==2)return;let u=e[d.pointerId];u!=null&&(t[u].p=[d.pageX,d.pageY],s(),this.zr(this.onPinch))};this.bind(r.el,rI,a,{passive:!1}),this.bind(document,iI,l,{passive:!1}),this.bind(document,nI,h,{passive:!1})},touch:r=>{let e=d=>d.touches||[],t=(d,u)=>d.item?d.item(u):d[u],n=d=>{let u=t(d,0),p=t(d,1);return aO(u.pageX,u.pageY,p.pageX,p.pageY)},o=d=>{let u=t(d,0),p=t(d,1);return{x:(u.pageX+p.pageX)/2,y:(u.pageY+p.pageY)/2}},s=!1,a=d=>{let u=e(d);u.length===2&&r.enableWheelZoom!==!1&&(this.center=o(u),this.radius=this.startRadius=n(u),s=!0,this.bind(document,oO,h),this.bind(document,sO,l),ie(d),this.zr(this.onPinchStart))},l=d=>{s=!1,ie(d),this.unbind(document,oO,h),this.unbind(document,sO,l),this.Xu()},h=d=>{if(s){let u=e(d);u.length===2&&(ie(d),this.radius=n(u),this.center=o(u),this.zr(this.onPinch))}};this.bind(r.el,oI,a)}});this.eventManager=new xe,this.isPointerDevice="onpointerdown"in document.documentElement,this.isTouchDevice="ontouchstart"in document.documentElement,this.center={x:0,y:0},this.radius=0,this.startRadius=0,this.onPinch=r.onPinch,this.onPinchStart=r.onPinchStart,this.onPinchEnd=r.onPinchEnd,this.isPointerDevice?this.listenerTypes.pointer(r):this.isTouchDevice&&this.listenerTypes.touch(r)}zr(r){r(this.center,this.startRadius,this.radius,this.radius/this.startRadius)}Xu(){this.onPinchEnd()}bind(r,e,t,n){this.eventManager.on(r,e,t)}unbind(r,e,t){this.eventManager.off(r,e,t)}destroy(){}};var Tm=class{constructor(r,e){this.panZoom=r;this.elementPositionSetter=e;c(this,"fixedElements",{})}by(r,e){if(e===Q){let t=r.pos[e];if(r.alignX===yt){let n=We(r.el);return t-n.width}return t}else{let t=r.pos[e];if(r.alignY===ht){let n=We(r.el);return t-n.height}return t}}Al(r){let e,t;for(let n in this.fixedElements)if(this.fixedElements.hasOwnProperty(n)){if(e=e||this.panZoom.getApparentCanvasLocation(),t=t==null?this.panZoom.getZoom():t,r!=null&&r!==n)continue;let o=this.fixedElements[n],s=(a,l,h)=>{if(o[a]){let d=this.by(o,l);o.requestedPosition[l]=d,e[l]/t+d<0?h(o.el,-(e[l]/t)):h(o.el,d)}};s(He,"x",(a,l)=>{mP(a,l),o.currentPosition.x=l}),s(Se,"y",(a,l)=>{gP(a,l),o.currentPosition.y=l})}}pan(){this.Al()}append(r,e,t,n,o){if(r==null)return;let s=r;if(wt(this.panZoom.canvasElement)&&!wt(r))return U("ERROR: cannot add non-svg element to fixed layer when container is an SVG element."),null;t=t||{};let a=this.panZoom.idFunction(r);return this.fixedElements[a]={el:s,left:t.left,top:t.top,pos:e,alignX:t.alignX||He,alignY:t.alignY||Se,currentPosition:Object.assign({},e),requestedPosition:Object.assign({},e),id:n},wt(s)||(s.style.position="absolute"),this.elementPositionSetter(s,e),o?this.panZoom.canvasElement.appendChild(r):this.panZoom.canvasElement.insertBefore(r,this.panZoom.canvasElement.childNodes[0]),this.Al(a),this.fixedElements[a]}remove(r){let e=this.panZoom.idFunction(r);e&&this.fixedElements[e]&&(this.panZoom.canvasElement.removeChild(this.fixedElements[e].el),delete this.fixedElements[e],this.Al())}destroy(){this.panZoom=null,this.fixedElements=null}};var sI="transformOrigin",lO="transform",aI="translateX",lI="translateY",hI="scale",hO="px",cI="vjs-pan-zoom",dI="vjs-pan-zoom-canvas";function ls(){}function cO(i){let r=i,e=0,t=0;for(;r!=null;)isNaN(r.scrollLeft)||(e+=r.scrollLeft),isNaN(r.scrollTop)||(t+=r.scrollTop),r=r.parentNode;return{x:e,y:t}}var La=class{constructor(r){c(this,"canvasElement");c(this,"viewportElement");c(this,"ju");c(this,"Bt");c(this,"eventManager");c(this,"pinchListener");c(this,"position",{x:0,y:0});c(this,"zoom");c(this,"transformOrigin",{x:0,y:0});c(this,"Sl");c(this,"panning",!1);c(this,"aboutToPan",!1);c(this,"Tl");c(this,"pinchZooming",!1);c(this,"zooming",!1);c(this,"zoomingWithWheel",!1);c(this,"downAt");c(this,"Jr");c(this,"Dn");c(this,"zoomRange");c(this,"zoomAtZoomStart");c(this,"maximumZoomTravel",150);c(this,"distanceAtZoomStart");c(this,"lastDistance");c(this,"canvasAtPanStart");c(this,"lastMouseX",-1);c(this,"lastMouseY",-1);c(this,"fixedTransformOrigin",null);c(this,"lastMovedAt",null);c(this,"lastVelocity",0);c(this,"lastAcceleration",0);c(this,"onZoom");c(this,"onMaybeZoom");c(this,"onPan");c(this,"onPanStart");c(this,"onMouseDown");c(this,"onMouseUp");c(this,"onMouseMove");c(this,"onSetTransformOrigin");c(this,"clamp");c(this,"clampZoom");c(this,"enablePan");c(this,"panWithMetaKey");c(this,"enableWheelZoom");c(this,"enableAnimation");c(this,"wheelCssFilterSpec");c(this,"wheelFilter");c(this,"wheelCssFilter");c(this,"wheelZoomRequiresMetaKey");c(this,"wheelDirection");c(this,"wheelSensitivity");c(this,"wheelPan");c(this,"wheelPanAxis");c(this,"background");c(this,"fixedLayer");c(this,"vl");c(this,"Cl");c(this,"zi");c(this,"Pl");c(this,"Ol");c(this,"viewport");c(this,"Ss");c(this,"Ge");c(this,"consumeRightClick");c(this,"smartMinimumZoom");c(this,"idFunction");c(this,"enabled");c(this,"clampToBackground");c(this,"clampToBackgroundExtents");c(this,"filter");c(this,"Yi",{});c(this,"_l",!1);c(this,"handlers",{start:(r,e)=>{if(this.pinchZooming)return;(n=>{if(this.enabled){let o=n.srcElement||n.target;return o===this.canvasElement||o===this.viewportElement||o.$jtkDecoration||this.background&&this.background.owns(o)||this.filter(o,n)===!0||n.Ry===!0}else return!1})(r)&&(this.$computeCompoundZoom(),this.zoomingWithWheel=!1,this.lastMouseX=-1,this.lastMouseY=-1,r.which===3&&this.enableWheelZoom!==!1&&(r.mozInputSource==null||r.mozInputSource===1)?(this.zooming=!0,this.downAt=Ee(r),this.Jr=this.$_getViewportSize(),this.pr(),this.Ku(r),this.canvasAtPanStart=Object.assign({},this.position),this.zoomAtZoomStart=this.zoom):e.length<=1&&this._y(r)&&(this.Jr=this.$_getViewportSize(),this.pr(),this.panning=!0,this.aboutToPan=!0,this.downAt=Ee(r),this.canvasAtPanStart=Object.assign({},this.position),ie(r))),this.onMouseDown(r,this)},move:(r,e)=>{let t,n,o;if(this.zoomingWithWheel=!1,!this.pinchZooming){if(this.zooming)o=Ee(r),t=o.x-this.downAt.x,n=o.y-this.downAt.y,this.Nl(t,n,r);else if(this.panning&&this.enablePan&&this.downAt!=null){ie(r),this.aboutToPan&&(this.aboutToPan=!1,this.onPanStart()),o=Ee(r),t=(o.x-this.downAt.x)/this.Ss,n=(o.y-this.downAt.y)/this.Ss;let s=this.it({x:this.canvasAtPanStart.x+t,y:this.canvasAtPanStart.y+n,animate:!1});this.onPan(s.x,s.y,this.zoom,this.zoom,r),this.background&&this.background.pan(),this.fixedLayer.pan(),ie(r)}this.onMouseMove(r,this)}},end:(r,e)=>{this.pinchZooming||(this.zooming=!1,this.downAt=null,this.panning=!1,this.aboutToPan=!1,this.Jr=null,this.zoomingWithWheel=!1,this.eventManager.off(document,se,this.vl),this.eventManager.off(document,ae,this.Cl),this.eventManager.on(document,se,this.zi),this.onMouseUp(r,this))},[At]:r=>{}});r.events=r.events||{},this.zoom=r.zoom||1,this.zoomRange=r.zoomRange||$v,this.Sl=r.zoomStep||.25,this.fixedLayer=new Tm(this,r.elementPositionSetter),this.eventManager=new xe,this.viewport=r.viewport,this.canvasElement=r.canvasElement,this.Ge=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.pr()})}),this.Ge.observe(this.canvasElement),this.fixedTransformOrigin=r.fixedTransformOrigin,this.it({x:0,y:0,animate:!1}),this.viewportElement=r.viewportElement,L(this.viewportElement,cI),L(this.canvasElement,dI),new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.$_getViewportSize()})}).observe(this.viewportElement),this.idFunction=r.idFunction,this.onZoom=r.events.zoom||ls,this.onMaybeZoom=r.events.maybeZoom||(()=>!0),this.onPan=r.events.pan||ls,this.onPanStart=r.events.panStart||ls,this.onMouseDown=r.events.mousedown||ls,this.onMouseUp=r.events.mouseup||ls,this.onMouseMove=r.events.mousemove||ls,this.onSetTransformOrigin=r.events.transformOrigin||ls,this.clamp=r.clamp!==!1,this.clampZoom=r.clampZoom!==!1,this.panWithMetaKey=r.panWithMetaKey===!0,this.enablePan=r.enablePan!==!1,this.Tl=r.panFilter&&typeof r.panFilter=="function"?r.panFilter:null,this.enableAnimation=r.enableAnimation!==!1;let t=r.wheel||{};this.enableWheelZoom=t.zoom!==!1,this.wheelFilter=t.filter||(()=>!0),this.wheelCssFilterSpec=t.cssFilter,this.wheelZoomRequiresMetaKey=t.useMetaKey===!0,this.wheelDirection=t.reverse===!0?-1:1,this.wheelSensitivity=this.wheelDirection*(t.sensitivity||10),this.wheelPan=t.pan===!0,this.wheelPanAxis=t.axis||"both",this.Hu(),this.consumeRightClick=r.consumeRightClick!==!1,this.smartMinimumZoom=r.smartMinimumZoom,this.vl=function(n){this.Rl("move",n)}.bind(this),this.Cl=function(n){this.Rl("end",n)}.bind(this),this.zi=function(n){this.zoomingWithWheel=!1}.bind(this),this.enabled=r.enabled!==!1,this.clampToBackground=r.clampToBackground,this.clampToBackgroundExtents=r.clampToBackgroundExtents,this.filter=r.filter||(()=>!1),(this.enableWheelZoom||this.wheelPan)&&(this.Bt=(n,o,s,a)=>this.wheelPanOrZoom(n,o,s,a),yh(this.viewportElement,this.Bt,!0,this.wheelZoomRequiresMetaKey)),this.pinchListener=new Sm({el:this.viewportElement,enableWheelZoom:this.enableWheelZoom,onPinch:(n,o,s,a)=>{this.J(a*this.zoomAtZoomStart);let l=n.x-this.downAt.x,h=n.y-this.downAt.y;this.it({x:this.canvasAtPanStart.x+l,y:this.canvasAtPanStart.y+h,animate:!1})},onPinchStart:(n,o)=>{this.pinchZooming=!0,this.downAt=n,this.distanceAtZoomStart=this.lastDistance=o,this.zoomAtZoomStart=this.zoom,this.Ll(this.downAt.x,this.downAt.y),this.canvasAtPanStart=Object.assign({},this.position)},onPinchEnd:()=>{this.pinchZooming=!1,this.downAt=null}}),this.J(this.zoom,null,!1,!1,!0),this.wl(),this.background=new $y,r.background&&this.background.addBackground(r.background),this.Pl=n=>{this.start(n)},this.eventManager.on(this.viewportElement,me,this.Pl),this.eventManager.on(document,se,this.zi),this.Ol=n=>{this.Rl(At,n)},this.eventManager.on(this.viewportElement,At,this.Ol),this.pr(),this.$computeCompoundZoom()}getCompoundZoom(){return this.Ss}$addWheelSelectorFilter(r){r!=null&&r.length>0&&(this.wheelCssFilterSpec=[r,this.wheelCssFilterSpec||""].join(" "),this.Hu())}$computeCompoundZoom(r){r=r||this.$_getViewportSize();let e=this.viewportElement.getBoundingClientRect();this.Ss=e.width/r.width}$_getViewportSize(){return this.Jr=We(this.viewportElement),this.Jr}pr(){return this.Dn=We(this.canvasElement),this.Dn}Hu(){this.wheelCssFilterSpec!=null&&this.wheelCssFilterSpec.length>0&&(this.wheelCssFilter=r=>{let e=r.srcElement||r.target;return!$t(e,this.wheelCssFilterSpec)})}Ay(r,e,t,n){n=n||150;let{x:o,y:s}=this.position,a=this.zoom,l=r-a,h=e-o,d=t-s,u=null,p=m=>{u||(u=m);let g=m-u,E=g/n,y=a+E*l,x=o+E*h,f=s+E*d;this.canvasElement.style.transform=`scale(${y}) translateX(${x/y}px) translateY(${f/y}px)`,g<n?requestAnimationFrame(p):(this.zoom=r,this.position={x:e,y:t},this.onPan(e,t,this.zoom,this.zoom))};requestAnimationFrame(p)}it(r){let e=this.ku(r.x,r.y);if(this.enableAnimation&&r.animate)if(r.zoom!=null){let t=this.Wu(r.zoom);this.Ay(t,e.x,e.y,r.animationDuration)}else this.position=e,this.Zu(null,r.onComplete);else this.position=e,this.Dl(),r.onComplete&&r.onComplete(this.position);return this.position}Ju(r,e,t,n,o){let s=this.position;return this.it({x:s.x+r,y:s.y+e,animate:t,onComplete:n,animationDuration:o})}Sy(r,e,t,n){n||this.pan(-e*100,-t*100)}Ty(r,e,t,n){this.zoomAtZoomStart=this.zoom,this.zoomingWithWheel||(this.Ku(r),this.zoomingWithWheel=!0),this.Nl(0,r.normalizedWheelDelta*this.wheelSensitivity,r,!0)}wheelPanOrZoom(r,e,t,n){this.wheelFilter(r)&&(this.wheelCssFilter==null||this.wheelCssFilter(r))&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),!this.wheelPan||n?this.Ty(r,e,t,n):(e=this.wheelPanAxis==="both"||this.wheelPanAxis===Q?e:0,t=this.wheelPanAxis==="both"||this.wheelPanAxis===ye?t:0,this.Sy(r,e,t,n)))}vy(r,e,t){this.canvasElement.animate(r,{duration:e||250}).finished.then(()=>{for(let n in r)this.canvasElement.style[n]=r[n];t&&t(this.position)})}qu(){return`${hI}(${this.zoom}) ${aI}(${this.position.x/this.zoom}${hO}) ${lI}(${this.position.y/this.zoom}${hO})`}Dl(){this.canvasElement.style[lO]=this.qu()}Zu(r,e){if(this.canvasElement.animate!=null){let t={[lO]:this.qu()};this.vy(t,r,e)}else this.Dl()}Cy(){return this.fixedTransformOrigin==null?`${this.transformOrigin.x}% ${this.transformOrigin.y}%`:`${this.fixedTransformOrigin.x} ${this.fixedTransformOrigin.y}`}wl(){this.canvasElement.style[sI]=this.Cy()}Py(r,e){let t=this.fromPageLocation(r,e),n=this.Dn||this.pr();return{width:n.width,height:n.height,xy:t,xScale:t.x/n.width,yScale:t.y/n.height,o:{x:t.x/n.width*100,y:t.y/n.height*100}}}Qu(r,e,t){let n,o,s,a,l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t;n=-(l*(1-this.zoom)),o=-(h*(1-this.zoom)),this.transformOrigin=r,this.wl(),l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t,s=-(l*(1-this.zoom)),a=-(h*(1-this.zoom));let d=this.Ju(s-n,a-o,!1);this.onSetTransformOrigin&&this.onSetTransformOrigin(this.transformOrigin,d)}Ll(r,e){if(this.fixedTransformOrigin==null){let t=this.Py(r,e);this.Qu(t.o,t.width,t.height)}}Ku(r){if(this.fixedTransformOrigin==null){let e=Ee(r);this.Ll(e.x,e.y)}}$setTransformOriginToCanvasPoint(r,e){if(this.fixedTransformOrigin==null){let t=this.Dn||this.pr();this.Qu({x:r/t.width*100,y:e/t.height*100},t.width,t.height)}}Wu(r){let e=this.zoomRange[0];if(this.smartMinimumZoom){e=.5;let t=this.getBoundsInfo().minimumFill;r/t<e&&(r=t*e)}else r<e&&(r=e);return r>this.zoomRange[1]&&(r=this.zoomRange[1]),r}J(r,e,t,n,o){if(r==null||isNaN(r)||r<0)return;r=this.Wu(r);let s=this.zoom,a=l=>{if(!this._l&&(o||this.onZoom(0,0,r,s,e,t),this.background!=null&&this.background.setZoom(r),this.fixedLayer.pan(),this.clampZoom)){let h=this.position,d=this.ku(h.x,h.y);(d.x!=h.x||d.y!=h.y)&&this.it({x:d.x,y:d.y,animate:!1})}};if(n){let l=this.getViewportCenter();this.$setTransformOriginToCanvasPoint(l.x,l.y),this.zoom=r,this.Zu(null,a)}else this.zoom=r,this.Dl(),a(this.position);return this.zoom}Nl(r,e,t,n){e<-this.maximumZoomTravel&&(e=-this.maximumZoomTravel),e>this.maximumZoomTravel&&(e=this.maximumZoomTravel),this.Oy(this.zoomAtZoomStart,e,-this.maximumZoomTravel,this.maximumZoomTravel,t,n)}Oy(r,e,t,n,o,s){let a=e/(e>=0?n:t),l=e>=0?1:0,h=r+a*(this.zoomRange[l]-r);this.J(h,o,s)}ku(r,e,t){if(!this.clamp&&!this.clampToBackground&&!this.clampToBackgroundExtents)return{x:r,y:e};{let n=this.Jr||this.$_getViewportSize(),o=this.ot(),s=r,a=e,l=this.clamp?this.getBoundsInfo():{x:0,y:0,width:0,height:0,vw:n.width,vh:n.height,padding:t,minimumFill:1};if(t=0,(this.clampToBackground||this.clampToBackgroundExtents)&&this.background!=null){let g=this.background.getWidth(),E=this.background.getHeight(),y=Math.max(l.x+l.width,g),x=Math.max(l.y+l.height,E);l.width=y-l.width,l.height=x-l.height;let f=l.vw/l.width,b=l.vh/l.height;l.minimumFill=Math.min(f,b),this.clampToBackgroundExtents&&(t=Math.max(l.vw,l.vh))}let h=[l.x+l.width,l.y+l.height];this.background&&(h[0]=Math.max(h[0],this.background.getWidth()),h[1]=Math.max(h[1],this.background.getHeight()));let d=r+o.x+h[0]*this.zoom-t,u=e+o.y+h[1]*this.zoom-t,p=r+o.x+l.x*this.zoom+t,m=e+o.y+l.y*this.zoom+t;return d<0&&(s-=d),p>l.vw&&(s-=p-l.vw),u<0&&(a-=u),m>l.vh&&(a-=m-l.vh),{x:s,y:a}}}ot(){let r=this.Dn||this.pr(),e=this.transformOrigin.x/100*r.width,t=this.transformOrigin.y/100*r.height;return{x:e*(1-this.zoom),y:t*(1-this.zoom)}}_y(r){let e=r.srcElement||r.target;return this.panWithMetaKey&&!(r.metaKey||r.ctrlKey)?!1:this.Tl!=null?this.Tl(e)!==!1:!0}Rl(r,e){r===At&&this.consumeRightClick&&e.preventDefault&&e.preventDefault();let t=es(e);this.handlers[r](e,t)}start(r){this.enabled&&r!=null&&(this.eventManager.off(document,se,this.zi),this.eventManager.on(document,se,this.vl),this.eventManager.on(document,ae,this.Cl),this.handlers.start(r,es(r)))}getBoundsInfo(r,e){let t=this.Jr||this.$_getViewportSize();if(this.viewport.isEmpty())return{width:0,height:0,x:0,y:0,vw:t.width,vh:t.height,minimumFill:1,zoom:1};r=r||0,e=e||.9;let n=this.viewport.getTopLevelExtents(),o=n.xmax-n.xmin,s=n.ymax-n.ymin,a=t.width/((o+r*2)/e),l=t.height/((s+r*2)/e),h=Math.min(a,l);return{width:o,height:s,x:n.xmin,y:n.ymin,vw:t.width,vh:t.height,minimumFill:h,zoom:this.zoom}}add(r,e){e&&(r.$jtkDecoration=!0)}suspend(r){let e=typeof r=="string"?r:this.idFunction(r);this.Yi[e]=!0}isSuspended(r){let e=typeof r=="string"?r:r.id;return this.Yi[e]===!0}restore(r){let e=typeof r=="string"?r:r.id;delete this.Yi[e]}remove(r){let e=this.idFunction(r);delete this.Yi[e]}reset(){this.Yi={},this.it({x:0,y:0,animate:!1})}zoomToFit(r){r=r||{};let e=this.getBoundsInfo(r.padding,r.fill);r.doNotZoomIfVisible&&e.minimumFill>this.zoom||this.J(e.minimumFill),this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToFitIfNecessary(r){let e=Object.assign(r||{},{});e.doNotZoomIfVisible=!0,this.zoomToFit(e)}zoomToElements(r){let e=this.$_getViewportSize(),t={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:e.width,vh:e.height};for(let o=0;o<r.elements.length;o++){let s=r.elements[o],a=this.viewport.getPosition(this.idFunction(s));a&&(t.x=Math.min(t.x,a.x),t.y=Math.min(t.y,a.y),t.xMax=Math.max(t.xMax,a.x2),t.yMax=Math.max(t.yMax,a.y2))}let n=r.fill||.9;t.width=t.xMax-t.x,t.height=t.yMax-t.y,t.z=n*Math.min(t.vw/t.width,t.vh/t.height),r.doNotZoomIfVisible&&t.z>this.zoom||this.J(t.z),this.centerContent({bounds:t,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToBackground(r){if(r=r||{},this.background!=null){let e=this.background.getWidth(),t=this.background.getHeight(),n=this.$_getViewportSize(),o=n.width/e,s=n.height/t,a=Math.min(o,s),l={width:e,height:t,x:0,y:0,vw:n.width,vh:n.height,padding:0,minimumFill:a,zoom:a};this.J(l.minimumFill),this.centerContent({bounds:l,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}}zoomToExtents(r){let e=Array.isArray(r.extents)?r.extents:[r.extents];if(e.length>0){let t=this.$_getViewportSize(),n={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:t.width,vh:t.height};e.forEach(s=>{n.x=Math.min(n.x,s.x),n.y=Math.min(n.y,s.y),n.xMax=Math.max(n.xMax,s.x+s.width),n.yMax=Math.max(n.yMax,s.y+s.height)});let o=r.fill||.9;n.width=n.xMax-n.x,n.height=n.yMax-n.y,n.z=o*Math.min(n.vw/n.width,n.vh/n.height),r.doNotZoomIfVisible&&n.z>this.zoom||this.J(n.z),this.centerContent({bounds:n,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}}setFilter(r){this.filter=r||(()=>!1)}centerBackground(r){if(this.background!=null){let e=Object.assign({},this.getBoundsInfo());e.x=this.background.getWidth()/2,e.y=this.background.getHeight()/2,e.width=1,e.height=1,this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,vertical:!0,horizontal:!0})}}alignBackground(r,e){if(this.background!=null){let t=r.split(" "),n=t[0]||He,o=t[1]||Se,s=this.getBoundsInfo(),a=n===He?0:s.vw-this.background.getWidth()*this.zoom,l=o===Se?0:s.vh-this.background.getHeight()*this.zoom,h=this.ot();this.it({x:a-h.x,y:l-h.y,animate:!0,animationDuration:e}),this.background.pan(),this.fixedLayer.pan()}}nudgeZoom(r,e){let t=no(this.viewportElement),n=this.$_getViewportSize(),o=t.x+n.width/2,s=t.y+n.height/2;return this.Ll(o,s),this.J(this.zoom+r,e)}nudgeWheelZoom(r,e){this.zoomAtZoomStart=this.zoom,this.Nl(0,r,e,!0)}alignContent(r){r=r||{};let e=r.bounds||this.getBoundsInfo(),t=this.position;r.zoom&&this.setZoom(r.zoom,!1);let n=this.Dn||this.pr(),o=(1-1/this.zoom)*n.height,s=(1-1/this.zoom)*n.width,a=this.ot(),l=e.x*this.zoom+e.width*this.zoom/2,h=e.y*this.zoom+e.height*this.zoom/2,d=e.vw/2-l,u=e.vh/2-h,p=r.padding||10,m=this.position.x,g=this.position.y,E=o*this.transformOrigin.y/100-e.y+p/this.zoom,y=(E-e.height-2*p+e.vh/this.zoom)*this.zoom,x=r.alignY==null?g:r.alignY===ht?y:r.alignY===It?u-a.y:E*this.zoom,f=s*this.transformOrigin.x/100-e.x+p/this.zoom,b=(f-e.width-2*p+e.vw/this.zoom)*this.zoom,A=r.alignX==null?m:r.alignX===yt?b:r.alignX===It?d-a.x:f*this.zoom;this.it({x:A,y:x,animate:!r.doNotAnimate,animationDuration:r.animationDuration,onComplete:()=>{this._l||(r.doNotFirePanEvent||this.onPan(A-t.x,x-t.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan()),r.onComplete&&r.onComplete({x:A,y:x})}})}alignContentTop(r){r=r||{},r.alignY=Se,this.alignContent(r)}alignContentBottom(r){r=r||{},r.alignY=ht,this.alignContent(r)}alignContentLeft(r){r=r||{},r.alignX=He,this.alignContent(r)}alignContentRight(r){r=r||{},r.alignX=yt,this.alignContent(r)}centerContent(r){r=r||{},r.alignX=r.horizontal===!1?null:It,r.alignY=r.vertical===!1?null:It,this.alignContent(r)}centerContentHorizontally(r){this.centerContent(Object.assign({horizontal:!0,vertical:!1},r))}centerContentVertically(r){this.centerContent(Object.assign({vertical:!0,horizontal:!1},r))}centerOn(r){let e=Object.assign({},this.getBoundsInfo());Object.assign(e,r.bounds);let t=()=>{this.$setTransformOriginToCanvasPoint(e.x+e.width/2,e.y+e.height/2),r.onComplete&&r.onComplete(e)};this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:t,vertical:r.vertical!==!1,horizontal:r.horizontal!==!1,zoom:r.zoom})}centerOnHorizontally(r){this.centerOn({vertical:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,bounds:r.bounds})}centerOnVertically(r){this.centerOn({bounds:r.bounds,horizontal:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}centerOnAndZoom(r){let e=r.fillRatio||.6,t=r.bounds,n=this.getBoundsInfo(),o=n.vw<n.vh?[n.vw,"width"]:[n.vh,"height"],s=e*o[0],a=s/t[o[1]];a<this.zoomRange[0]&&(a=this.zoomRange[0]),a>this.zoomRange[1]&&(a=this.zoomRange[1]),this.$setTransformOriginToCanvasPoint(t.x+t.width/2,t.y+t.height/2),this.centerOn({bounds:t,zoom:a,doNotAnimate:r.doNotAnimate})}getViewportCenter(){let r=Object.assign({},this.getBoundsInfo()),e=this.ot(),t=this.position,n={x:r.vw/2,y:r.vh/2};return{x:(n.x-(t.x+e.x))/this.zoom,y:(n.y-(t.y+e.y))/this.zoom}}setViewportCenter(r){let e=Object.assign({},this.getBoundsInfo()),t=this.ot(),n={x:e.vw/2,y:e.vh/2},o={x:-(r.x*this.zoom-n.x+t.x),y:-(r.y*this.zoom-n.y+t.y)};this.it({x:o.x,y:o.y,animate:!1})}setClamping(r){this.clamp=r}isClamping(){return this.clamp}setZoom(r,e){return this.J(r,null,null,e)}zoomIn(r,e){return this.setTransformOrigin(r.x,r.y),this.J(this.zoom+this.Sl,null,null,e)}zoomOut(r,e){return this.setTransformOrigin(r.x,r.y),this.J(this.zoom-this.Sl,null,null,e)}setZoomRange(r,e){return r!=null&&r.length===2&&r[0]<r[1]&&r[0]!=null&&r[1]!=null&&r[0]>0&&r[1]>0&&(this.zoomRange=r,e||(this.zoom<this.zoomRange[0]||this.zoom>this.zoomRange[1])&&this.J(this.zoom)),this.zoomRange}getZoomRange(){return this.zoomRange}getZoom(){return this.zoom}getPan(){return Object.assign({},this.position)}pan(r,e,t,n){this.Ju(r,e,t,o=>{this.onPan(o.x,o.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan(),n&&n(o)})}setPan(r,e,t,n){let o=this.it({x:r,y:e,animate:t,onComplete:n});return this.onPan(o.x,o.y,this.zoom,this.zoom),o}startPanRepeat(r,e,t,n,o,s){this.stopPanRepeat();let a=()=>{let l=r*t,h=e*n;s&&s({x:l,y:h}),this.pan(l,h,!1)};a(),this.ju=window.setInterval(()=>a(),o)}stopPanRepeat(){window.clearTimeout(this.ju)}setTransformOrigin(r,e){this.transformOrigin={x:r,y:e},this.wl()}fromPageLocation(r,e,t){let n=this.ot(),o=this.position,s=cO(this.viewportElement),a=this.viewportElement.getBoundingClientRect(),l=this.getCompoundZoom(),h={x:((r-(a.x+s.x))/l-(o.x+n.x))/this.zoom,y:((e-(a.y+s.y))/l-(o.y+n.y))/this.zoom};return t&&(h.x=Math.round(h.x),h.y=Math.round(h.y)),h}fromWindowLocation(r,e,t){let n=this.ot(),o=this.position,s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l={x:((r-s.x)/a-(o.x+n.x))/this.zoom,y:((e-s.y)/a-(o.y+n.y))/this.zoom};return t&&(l.x=Math.round(l.x),l.y=Math.round(l.y)),l}toPageLocation(r,e){let t=this.ot(),n=this.position,o=cO(this.viewportElement),s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l=a*(this.zoom*r+(n.x+t.x))+(s.x+o.x),h=a*(this.zoom*e+(n.y+t.y))+(s.y+o.y);return{x:l,y:h}}toViewportLocation(r,e){let t=this.ot(),n=this.position,o=this.getCompoundZoom(),s=o*(this.zoom*r+(n.x+t.x)),a=o*(this.zoom*e+(n.y+t.y));return{x:s,y:a}}mapEventLocation(r){let e=Ee(r);return this.fromPageLocation(e.x,e.y)}setEnabled(r){this.enabled=r}getApparentCanvasLocation(){let r=this.ot(),e=this.position;return{x:e.x+r.x,y:e.y+r.y}}setApparentCanvasLocation(r,e){let t=this.ot(),n=this.it({x:r-t.x,y:e-t.y,animate:!1});return this.background&&this.background.pan(),this.fixedLayer.pan(),n}getVisibleContentArea(){this.$_getViewportSize();let r=this.getApparentCanvasLocation(),e=this.getBoundsInfo(),t=-r.x/e.zoom,n=-r.y/e.zoom,o=e.vw/e.zoom,s=e.vh/e.zoom;return{x:t,y:n,width:o,height:s}}floatElement(r,e){if(r==null)return;let t=r;t.style.position="absolute",t.style.left=e.x+"px",t.style.top=e.y+"px",this.viewportElement.appendChild(r)}fixElement(r,e,t,n,o){return this.fixedLayer.append(r,e,t,n,o)}unfixElement(r){this.fixedLayer.remove(r)}isInViewport(r,e){let t=this.viewportElement.getBoundingClientRect();return t.x<=r&&r<=t.x+t.width&&t.y<=e&&e<=t.y+t.height}setWheelFilter(r){this.wheelFilter=r||(e=>!0)}addBackground(r){this.background.addBackground(r)}removeBackground(r){this.background.removeBackground(r)}destroy(){this.Ge!=null&&(this.Ge.disconnect(),this.Ge=null),this.Bt!=null&&xh(this.viewportElement,this.Bt),this.pinchListener.destroy(),this.fixedLayer.destroy(),this.background.destroy(),this.pinchListener=null,this.fixedLayer=null,this.background=null,this.eventManager.off(document,se,this.zi),this.eventManager.off(this.viewportElement,me,this.Pl),this.eventManager.off(this.viewportElement,At,this.Ol),delete this.onMaybeZoom,delete this.onPan,delete this.onMouseDown,delete this.onMouseUp,delete this.onMouseMove,delete this.onSetTransformOrigin,this._l=!0}isBackgroundElement(r){return this.background==null?!1:this.background.owns(r)}},$y=class{constructor(){c(this,"backgrounds",[])}addBackground(r){this.backgrounds.push(r)}removeBackground(r){this.backgrounds=this.backgrounds.filter(e=>e!==r)}getWidth(){return Math.max(...this.backgrounds.map(r=>r.getWidth()))}getHeight(){return Math.max(...this.backgrounds.map(r=>r.getHeight()))}setZoom(r,e){this.backgrounds.forEach(t=>t.setZoom(r,e))}owns(r){return this.backgrounds.find(e=>e.owns(r))!=null}pan(){this.backgrounds.forEach(r=>r.pan())}destroy(){this.backgrounds.forEach(r=>r.destroy()),this.backgrounds.length=0}Ft(r){this.backgrounds.forEach(e=>e.Ft(r))}};function pTe(i,r,e,t=500){let n=i.getPan(),o=i.getZoom(),s=performance.now(),a=h=>h<.5?4*h*h*h:1-Math.pow(-2*h+2,3)/2;function l(h){let d=h-s,u=Math.min(d/t,1),p=a(u),m=o+(e-o)*p;i.setZoom(m);let g={x:n.x+(r.x-n.x)*p,y:n.y+(r.y-n.y)*p};i.setPan(g.x,g.y,!0),u<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}var By={},vm=class{constructor(r,e,t,n){this.adapter=e;this.container=t;this.id=n;c(this,"fixedElements",new Set);c(this,"floatedElements",new Set);c(this,"appendedElements",new Set)}getFixedElement(r){return Array.from(this.fixedElements).find(e=>e.id===r)}getBounds(){let r=1/0,e=-1/0,t=1/0,n=-1/0,o=s=>{let a=mn(s.el),l=We(s.el);r=Math.min(r,a.x),e=Math.max(e,a.x+l.width),t=Math.min(t,a.y),n=Math.max(n,a.y+l.height)};return this.fixedElements.forEach(o),this.floatedElements.forEach(o),this.appendedElements.forEach(o),{x:r,y:t,width:e-r,height:n-t}}clear(){this.appendedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.floatedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.fixedElements.forEach(r=>this.adapter.unfixElement(r.el)),this.appendedElements.clear(),this.floatedElements.clear(),this.fixedElements.clear()}},Yh=class extends vm{constructor(e,t,n,o,s,a){super(t,n,o,s);this.methods=e;c(this,"incremental");this.incremental=a===!0}decorate(e){this.methods.decorate(e)}reset(e){this.methods.reset(e)}};function uI(i){return function(e,t,n,o){let s=new i(e,t,n,o);return new Yh(s,e,t,n,o,s.incremental)}}var Cm={get:(i,r,e,t,n)=>{let o=By[i];if(o)return new o(r,e,t,n);throw{message:"VisuallyJs: unknown decorator type '"+i+"'"}},register:(i,r)=>{jb(r,vm)?By[i]=r:By[i]=uI(r)}};function dO(i,r,e){if(i==null)return[];let t=[],n=o=>{let s,a,l,h,d=o;if(typeof d=="string"?(s=d,a={},h=B()):d.type!=null&&(s=d.type,a=d.options||{},h=d.id||B()),s!=null&&a!=null)l=Cm.get(s,a,r,e,h);else{let u=o;h=u.id||B(),u.reset!=null&&typeof u.reset=="function"&&u.decorate!=null&&typeof u.decorate=="function"?l=new Yh(u,{},r,e,h,u.incremental):U('Cannot register decorator. Ensure both "reset" and "decorate" methods are provided.')}return l||(U("Decorator ["+s+"] nor registered VisuallyJs. Not fatal."),null)};for(let o=0;o<i.length;o++){let s=n(i[o]);s&&t.push(s)}return t}var Pm=class{constructor(r,e){this.path=r;this.ui=e}getVertexCount(){return this.path.getVertexCount()}getEdgeCount(){return this.path.getEdgeCount()}setVisible(r){this.ui.setVisible(this.path,r)}addVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.addClass(t,r)})}removeVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.removeClass(t,r)})}addEdgeClass(r){this.path.eachEdge((e,t)=>{Wr(this.ui.$_connMap[t.getId()],r)})}removeEdgeClass(r){this.path.eachEdge((e,t)=>{Or(this.ui.$_connMap[t.getId()],r)})}addClass(r){this.addVertexClass(r),this.addEdgeClass(r)}removeClass(r){this.removeVertexClass(r),this.removeEdgeClass(r)}};var uO="default",Cve="center",pI="perimeter",Om=fi(Cv,Pt),mI=fi(Wo,Pt);function gI(i){return EI(i,mI)}function EI(i,r){let e=Array.from(i.getContainer().querySelectorAll(r)),t=Array.from(i.getContainer().querySelectorAll(".vjs-surface")),n=[];return t.forEach(o=>{let s=Array.from(o.querySelectorAll(r));n.push(...s)}),e.filter(o=>n.indexOf(o)===-1)}function _m(i,r,e){return i.$getModelInfoForDragElement(r,e,!0)}function Rm(i,r,e,t,n){let o=null,s=i.getEffectiveVisibleZoom(),a={x:e.x-s*((n==null?void 0:n.x)||0),y:e.y-s*((n==null?void 0:n.y)||0),width:e.width,height:e.height};for(let l=0;l<r.length;l++)if(tt(a,r[l].r)){o=r[l];let h=r[l].modelInfo.typeDef,d=r[l].modelInfo.objEl,u=Kp(t,d,s);r[l].positionOnElement=u,h.anchorPositionFinder!=null?r[l].anchor=h.anchorPositionFinder(d,u,o.modelInfo.vertex,h):r[l].anchor=null;break}return o}function fI(i,r,e,t,n,o){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections!==-1&&e.obj.getEdges().length>=e.typeDef.maxConnections)return!1;if(r){let s=o?e.obj:t,a=o?t:e.obj;if(i.model.beforeConnect(s,a,n,!0)===!1)return!1}return!0}function zh(i,r,e,t,n,o){return pO(i,r,e,!1,t,n,o)}function mO(i,r,e,t,n,o){return pO(i,r,e,!0,t,n,o)}function pO(i,r,e,t,n,o,s){let a=[],l=[];return gI(i).forEach(d=>{if(d.getAttribute(yr)!==ct){if(s!=null&&d.getAttribute(ts)!==s)return;let u=_m(i,d,!1);if(!n&&u.obj===e)return;if(fI(i,r,u,e,o,t)){let p=d.getBoundingClientRect();a.push({modelInfo:u,isGroup:Y(u.obj),r:p,targetEl:d,targetPortType:d.getAttribute(Hr)||d.getAttribute(qi),magnet:d.getAttribute(np)===Pt}),L(d,xr)}else r&&(d.setAttribute(yr,ct),l.push(d))}}),a.sort((d,u)=>{if(d.isGroup&&!u.isGroup)return 1;if(!d.isGroup&&u.isGroup)return-1;if(d.isGroup&&u.isGroup){if(je(d.modelInfo.vertex,u.modelInfo.obj))return-1;if(je(u.modelInfo.vertex,d.modelInfo.obj))return-1}else return 0}),{dropTargets:a,disabledDropTargets:l}}var wa=class{constructor(r){c(this,"surface");c(this,"container");c(this,"edgeSnap");c(this,"edgeSnapRequiresMagnets");c(this,"edgeSnapSizeThreshold");c(this,"edgeSnapThreshold");c(this,"edgeSnapType");c(this,"allowLoopbackEdges");c(this,"activeFiltering");c(this,"$active",!1);c(this,"rtree");c(this,"disabledDropTargets",[]);c(this,"dropTargets",[]);c(this,"currentDropTarget");this.surface=r.instance,this.container=this.surface.getContainer(),this.activeFiltering=r.activeFiltering===!0,this.allowLoopbackEdges=r.allowLoopbackEdges===!0;let e=r.edgeSnap||{enabled:!1};this.edgeSnap=e.enabled===!0,this.edgeSnapThreshold=e.threshold||50,this.edgeSnapSizeThreshold=e.sizeThreshold||30,this.edgeSnapType=e.type||uO,this.edgeSnapRequiresMagnets=e.requireMagnets===!0,this.surface.bind($r,t=>{this.$active&&requestAnimationFrame(()=>this.$refreshTree(!0))}),this.surface.bind(tu,t=>{this.$active&&this.rtree.has(t.id)&&requestAnimationFrame(()=>this.$refreshTree(!0,t.id))}),this.rtree=new ra}$refreshTree(r,...e){this.rtree.clear(),this.dropTargets.forEach(t=>{(!this.edgeSnapRequiresMagnets||t.magnet)&&(r&&(e.length===0||e.indexOf(t.modelInfo.obj.id)!==-1)&&(t.r=t.targetEl.getBoundingClientRect()),this.rtree.insert({x:t.r.x,y:t.r.y,width:t.r.width,height:t.r.height,children:[],id:t.modelInfo.obj.id}))})}ep(r,e,t,n){let o=this.rtree.search({x:r.x-e,y:r.y-e,width:e*2,height:e*2});return o.length>0?(o.sort((s,a)=>{let l=Ue(r,{x:s.x+s.width/2,y:s.y+s.height/2}),h=Ue(r,{x:a.x+a.width/2,y:a.y+a.height/2});return Math.sign(l-h)}),ws(o[0],r,!0)?r:n===pI||n===uO&&(o[0].width>t||o[0].height>t)?kb(r,o[0]):{x:o[0].x+o[0].width/2,y:o[0].y+o[0].height/2}):r}};function Lm(i){let r=[{x:.5,y:0,ox:0,oy:-1},{x:1,y:.5,ox:1,oy:0},{x:.5,y:1,ox:0,oy:1},{x:0,y:.5,ox:-1,oy:0}].map((e,t)=>[e,Ue(e,i)]);return r.sort((e,t)=>e[1]<t[1]?-1:e[1]>t[1]?1:0),{ox:r[0][0].ox,oy:r[0][0].oy}}var Yn=class{constructor(r,e){this.draggableInstance=r;this.options=e;c(this,"Nn");c(this,"O",{x:0,y:0});c(this,"Ts",{x:0,y:0});c(this,"vs",!1);c(this,"se",null);c(this,"rp");this.rp=e.boundsStrategy||"contained",typeof IntersectionObserver!="undefined"&&(this.Nn=new IntersectionObserver(t=>{this.options.shouldHandle()&&t.forEach(n=>{this.se=n.rootBounds,n.isIntersecting?this.Kr():this.vs||this.np(n.boundingClientRect)})},{root:this.draggableInstance.$getDragViewportContainer(),threshold:.99}))}updateDragElementPosition(r){this.options.shouldHandle()&&(this.se&&!this.Ly(r)?this.np(r):this.Kr())}$updateRootBounds(){this.se=this.draggableInstance.$getDragViewportContainer().getBoundingClientRect()}wy(r){return this.se?!(r.right<this.se.left||r.left>this.se.right||r.bottom<this.se.top||r.top>this.se.bottom):!0}Dy(r){return this.se?this.se.left<r.left&&this.se.right>r.right&&this.se.top<r.top&&this.se.bottom>r.bottom:!0}Ly(r){return this.rp==="contained"?this.Dy(r):this.wy(r)}np(r){if(!this.se)return;let e=0,t=0;if(r.x<this.se.x?e=1:r.x+r.width>this.se.x+this.se.width&&(e=-1),r.y<this.se.y?t=1:r.y+r.height>this.se.y+this.se.height&&(t=-1),e===0&&t===0){this.Kr();return}(!this.vs||this.Ts.x!==e||this.Ts.y!==t)&&(this.Kr(),this.Ts={x:e,y:t},this.vs=!0,this.draggableInstance.$startPanRepeat(e,t,this.options.autoPanDelta,this.options.autoPanDelta,this.options.autoPanRepeat,n=>{let o=this.draggableInstance.getEffectiveVisibleZoom();this.O.x+=n.x/o,this.O.y+=n.y/o,this.options.onPan(this.O)}))}Kr(){this.draggableInstance.$stopPanRepeat(),this.vs=!1,this.Ts={x:0,y:0}}reset(){this.O.x=0,this.O.y=0,this.Kr()}observe(r){this.Nn!=null&&this.Nn.observe(r)}unobserve(r){this.Nn!=null&&(this.Nn.unobserve(r),this.Kr())}disconnect(){var r;(r=this.Nn)==null||r.disconnect(),this.Kr()}};var Xn="keyup",zn="drag",Xh="click",jh="idle",mCe="dragging",wm="awaitingClick",Fy="locked",Dm=class extends wa{constructor(e){super(e);c(this,"pageDownAt");c(this,"canvasPositionAtDown");c(this,"currentPagePosition");c(this,"scrollAtPageDown");c(this,"currentSource");c(this,"currentPoints",[]);c(this,"mousemoveHandler");c(this,"tapHandler");c(this,"canvasTapHandler");c(this,"documentKeypressHandler");c(this,"currentMethod",zn);c(this,"currentState",jh);c(this,"Il");c(this,"Vl");c(this,"Ml");c(this,"Gl");c(this,"transientInfo");c(this,"transientEdge");c(this,"transientConnection");c(this,"transientTargetAnchor");c(this,"u");c(this,"method");c(this,"R");c(this,"O",{x:0,y:0});this.currentMethod=e.method||zn,this.Il=e.Il,this.Vl=e.Vl,this.Ml=e.Ml,this.Gl=e.Gl,this.tapHandler=this.Ny.bind(this),this.mousemoveHandler=this.Mi.bind(this),this.canvasTapHandler=this.Iy.bind(this),this.documentKeypressHandler=this.$l.bind(this),this.surface.addDragHandler({selector:Om,start:t=>this.Vy(t),drag:t=>this.My(t),stop:t=>{this.Gy(t)},usesPageCoordinates:!0,constrainFunction:(t,n,o,s,a,l)=>{if(this.edgeSnap){let h=this.surface.getEffectiveVisibleZoom(),d=h*this.O.x,u=h*this.O.y,p={x:t.x-this.scrollAtPageDown.x-d,y:t.y-this.scrollAtPageDown.y-u},m=this.ep(p,this.edgeSnapThreshold*h,this.edgeSnapSizeThreshold*h,this.edgeSnapType);return{x:m.x+this.scrollAtPageDown.x+d,y:m.y+this.scrollAtPageDown.y+u}}else return t}}),this.surface.on(this.container,W,Om,this.tapHandler),this.surface.addDragSelectorFilter(Om),this.currentMethod===zn&&this.surface.dragOptions.autoPan!==!1&&(this.R=new Yn(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:t=>{this.O.x=t.x,this.O.y=t.y,this.ip()},shouldHandle:()=>!0}))}q(){this.rtree.clear(),this.dropTargets.forEach(e=>{F(e.targetEl,xr),H(e.modelInfo.obj)&&e.modelInfo.obj.edges.length===0&&e.modelInfo.missingPortCreated&&e.modelInfo.obj.getParent().$removePort(e.modelInfo.obj.id)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(e=>{e.removeAttribute(yr)}),this.disabledDropTargets.length=0,F(document.body,gt),F(document.body,Dy),F(this.surface.rootElement,Fn),this.surface.off(document,se,this.mousemoveHandler),this.surface.off(this.surface.getContainer(),W,this.canvasTapHandler),document.removeEventListener(Xn,this.documentKeypressHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.targetEl,br),this.currentDropTarget=null),this.transientInfo!=null&&(this.O={x:0,y:0},this.R&&this.R.reset(),this.surface.$removeTransientVertex(this.transientInfo.el)),this.transientConnection=null,this.currentPoints.length=0,this.currentSource=null,this.currentState=jh}op(e,t,n,o){var h;let s=n.getAttribute(tp)||((h=e.typeDef)==null?void 0:h.edgeType),a=Ee(t);this.canvasPositionAtDown=this.surface.fromPageLocation(a.x,a.y),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientInfo=this.surface.$addTransientVertex(this.canvasPositionAtDown,{width:10,height:10},{},{position:qe,left:`${this.canvasPositionAtDown.x}px`,top:`${this.canvasPositionAtDown.y}px`},FP);let l=Object.assign({},o||{});if(s!=null&&(l.type=s),this.transientEdge=this.surface.$addTransientEdge(e.obj,this.transientInfo.vertex,l,{targetAnchor:{x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}}),L(this.surface.rootElement,Fn),this.R!=null){this.R.$updateRootBounds();let d=this.transientInfo.el.el.getBoundingClientRect();this.R.updateDragElementPosition(d)}}sp(e){return this.currentPagePosition={x:e.x,y:e.y},this.ip()}ip(){if(this.currentPagePosition!=null){let e=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),t=this.transientInfo.el.id;this.surface.viewport.$_updatePosition(t,e.x,e.y),this.surface.$repaintUIElement(this.surface.$getManagedElement(t));let n=this.transientInfo.el.el.getBoundingClientRect();return this.surface.fire(kA,this.transientEdge),{x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:n.width,height:n.height}}}ap(e){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections>=0&&e.obj.getEdges().length>=e.typeDef.maxConnections)return{canStart:!1,payload:null};let t=this.surface.model.beforeStartConnect(e.obj,e.obj.type);return t===!1?{canStart:!1,payload:null}:{canStart:!0,payload:Co(t)?{}:t}}Vy(e){if(e.e.which===3||e.e.button===2)return!1;if(this.currentMethod===zn){this.$active=!0;let t=e.el;if(t.getAttribute(yr)!==ct){this.pageDownAt=Object.assign({},e.pagePosition),this.scrollAtPageDown={x:window.scrollX,y:window.scrollY},this.u={};let n=_m(this.surface,t,!0);if(n!=null){let o=this.ap(n);if(o.canStart){this.currentSource=n.obj,this.u.sourcePortType=t.getAttribute(Hr)||t.getAttribute(Ki),this.u.edgeType=t.getAttribute(tp)||"";let s=t.getAttribute(ts);this.u.scope=s,this.op(n,e.e,t,o.payload),L(document.body,gt);let a=n.typeDef.allowLoopback===!0||t.getAttribute(Of)===Pt||this.allowLoopbackEdges,l=zh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);return this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.$refreshTree(),this.surface.$startMotion(),this.surface.fire(HA,this.transientEdge),!0}}}}return!1}Bl(){this.surface.$stopPanRepeat()}Fl(e){if(this.transientEdge!=null){ie(e);let t=this.transientEdge.source,n,o;if(this.currentDropTarget!=null)n=this.currentDropTarget.modelInfo.obj,o=Kp(e,this.currentDropTarget.targetEl,this.surface.currentZoom),this.u.targetPortType=this.currentDropTarget.targetPortType,this.u.targetAnchor=this.currentDropTarget.anchor,this.u.positionOnTarget=o,this.u.targetAnchor!=null&&this.u.targetAnchor.portId!=null?H(n)?this.u.targetAnchor.portId!==n.id&&(n=n.getParent().$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||be})):(Y(n)||K(n))&&(n=n.$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||be})):this.currentDropTarget.modelInfo.missingPortCreated=!1;else if(this.surface.$isUnattachedEdgeAllowed(this.transientEdge)){let s=Ee(e);n=this.surface.fromPageLocation(s.x,s.y)}else this.surface.fire(ZA);this.$_exitTapMode(),n!=null&&this.surface.model.edgeFactory(this.surface.model,this.transientEdge.type,this.transientEdge.data||{},s=>{let a=this.surface.model.$_addEdge({source:t,target:n,data:s,addedByMouse:!0,context:Object.assign({positionOnTarget:o},this.u)},Oo,null);this.surface.fire(WA,a)},()=>{})}}Gy(e){this.Bl(),this.surface.$stopMotion(),this.Fl(e.e),this.$active=!1}lp(e,t){this.$y();let n=e();if(this.currentMethod===Xh&&this.currentState==wm){let s=Ee(t);this.sp(s)}let o=Rm(this.surface,this.dropTargets,n,t,this.O);if(o!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,br),o!=null){if(L(o.targetEl,br),o.anchor!=null)this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0},o.anchor),this.transientConnection.anchors.target.isFixed=!0;else if(o.positionOnElement!=null){let s=Lm(o.positionOnElement);this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},s),this.transientConnection.anchors.target.isFixed=!0}}else delete this.transientConnection.anchors.target.fixedLocation,this.transientConnection.anchors.target.isFixed=!1;this.currentDropTarget=o}Mi(e){let t=Ee(e);this.lp(()=>({x:t.x,y:t.y,width:5,height:5}),e)}My(e){this.lp(()=>{let t=Object.assign({},e.pagePosition),n;if(this.transientInfo!=null)n=this.sp(t),this.R!=null&&this.transientInfo!=null&&this.R.updateDragElementPosition({left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height,width:n.width,height:n.height,x:n.x,y:n.y});else{let o=this.surface.mapEventLocation(e.e);n={x:o.x,y:o.y,width:5,height:5}}return n},e.e)}$y(){this.transientEdge!=null&&(this.transientConnection=this.transientConnection||this.surface.getRenderedConnection(this.transientEdge.id),this.transientTargetAnchor=this.transientTargetAnchor||this.transientConnection.anchors.target)}Ny(e){if(this.currentMethod===Xh&&this.currentState!==Fy){let t=e.target||e.srcElement;if(t.getAttribute(yr)!==ct){let n=_m(this.surface,t,!0);if(n!=null){if(this.currentState===jh){ie(e),this.$active=!0,this.pageDownAt=Ee(e),this.u={};let o=this.ap(n);if(o.canStart){this.u.sourcePortType=t.getAttribute(Hr)||t.getAttribute(Ki),this.u.edgeType=t.getAttribute(tp);let s=t.getAttribute(ts);this.u.scope=s,this.currentSource=n.obj,L(document.body,Dy),this.op(n,e,t,o.payload);let a=n.typeDef.allowLoopback===!0||t.getAttribute(Of)===Pt||this.allowLoopbackEdges,l=zh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.currentState=wm,this.surface.on(this.surface.$getCanvasElement(),W,this.canvasTapHandler),this.surface.on(document,se,this.mousemoveHandler),document.addEventListener(Xn,this.documentKeypressHandler),this.surface.$disableVertexDrag(),this.surface.$startMotion()}}else if(this.currentState===wm){for(let o=0;o<this.dropTargets.length;o++)if(this.dropTargets[o].modelInfo.obj===n.obj){this.currentDropTarget=this.dropTargets[o];break}this.currentDropTarget!=null&&this.Fl(e),this.$active=!1}}}}}$_exitTapMode(){this.surface.$enableVertexDrag(),this.surface.$stopMotion(),this.q()}Iy(e){if(!e.defaultPrevented&&this.currentMethod===Xh)if(e.which===3||e.button===2)this.$_exitTapMode();else{let t=Ee(e);for(let n=0;n<this.dropTargets.length;n++)ws(this.dropTargets[n].r,t,!0)&&(this.currentDropTarget=this.dropTargets[n],this.Fl(e),this.$_exitTapMode())}}$l(e){this.currentState===wm&&(e.keyCode===27||e.key==="Escape")&&this.$_exitTapMode()}};var Uy="primed",Yy="idle",zy="active",Nm=class extends wa{constructor(e){super(e);c(this,"Ul");c(this,"Cs");c(this,"Ut");c(this,"transientVertex");c(this,"currentEdge");c(this,"currentConnection");c(this,"currentIndex");c(this,"R");c(this,"O",{x:0,y:0});c(this,"mouseMoveHandler");c(this,"mouseUpHandler");c(this,"documentKeypressHandler");c(this,"currentPosition");c(this,"currentPagePosition");c(this,"Ps",!1);c(this,"qr");c(this,"In");this.Ul=e.inputHandler,this.Cs=e.method||zn,this.Ut=Yy,this.documentKeypressHandler=this.$l.bind(this),this.mouseMoveHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex){if(this.Ut===Uy){this.qr=St({x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.surface.$_proxyEdge(this.currentEdge,this.currentIndex,this.transientVertex.el,this.qr),this.In=this.currentEdge[this.currentIndex];let a=this.currentConnection.connector.canvas;L(this.surface.rootElement,Fn),Xt(a,[Cy],[rm]),this.Ps=!0,this.Ut=zy,this.Ul.currentState=Fy}if(ie(n),this.currentPagePosition=Ee(n),this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),this.edgeSnap){let a=this.surface.getEffectiveVisibleZoom(),l=a*this.O.x,h=a*this.O.y,d={x:this.currentPagePosition.x-l,y:this.currentPagePosition.y-h},u=this.ep(d,this.edgeSnapThreshold*a,this.edgeSnapSizeThreshold*a,this.edgeSnapType);this.currentPagePosition={x:u.x+l,y:u.y+h},this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y,!0)}this.hp();let o={x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:5,height:5},s=Rm(this.surface,this.dropTargets,o,n,this.O);if(s!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,br),s!=null){if(L(s.targetEl,br),s.anchor!=null)this.qr.fixedLocation=Object.assign({offsetX:0,offsetY:0},s.anchor),this.qr.isFixed=!0;else if(s.positionOnElement!=null){let a=Lm(s.positionOnElement);this.qr.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},a),this.qr.isFixed=!0}}this.currentDropTarget=s,this.R!=null&&this.R.updateDragElementPosition(this.transientVertex.el.el.getBoundingClientRect())}},this.mouseUpHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex)if(ie(n),this.Ps)if(this.currentPosition=this.surface.fromPageLocation(n.pageX,n.pageY,!0),this.currentDropTarget!=null){let o=this.currentEdge,s=this.currentDropTarget.modelInfo.obj,a=this.currentIndex;this.surface.model.beforeMoveConnection(a===it?s:o.source,a===it?o.target:s,o)===!1?this.zl():(this.q(this.currentDropTarget.anchor),a===it?this.surface.model.setSource(o,s):this.surface.model.setTarget(o,s))}else this.In.dummy===!0?(this.surface.model.updateVertex(this.In,{[this.surface.$modelLeftAttribute]:this.currentPosition.x,[this.surface.$modelTopAttribute]:this.currentPosition.y}),this.q()):this.zl();else(this.Cs===zn||this.Ut===zy)&&this.q();else this.q();this.$active=!1};let t=n=>o=>{if(!o.defaultPrevented){let s=Bt(o.target,Ae(Qe),this.container,!1);if(s!=null){if(this.currentEdge=this.surface.model.getEdge(s.getAttribute(Qe)),this.currentEdge.transient)this.$active=!1,this.currentEdge=null,this.Ut=Yy;else if(this.In=this.currentEdge[n],this.currentConnection=this.surface.getRenderedConnection(this.currentEdge.id),this.currentConnection.detachable||this.In.dummy===!0){if(this.$active=!0,this.Ps=!1,this.currentIndex=n,ie(o),this.O={x:0,y:0},this.currentPagePosition=Ee(o),this.currentPosition=this.surface.fromPageLocation(o.pageX,o.pageY,!0),this.surface.on(document,se,this.mouseMoveHandler),this.surface.on(document,ae,this.mouseUpHandler),this.Ut=Uy,this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex=this.surface.$addTransientVertex(this.currentPosition,{width:1,height:1},{},{},MP),this.By(),L(this.currentConnection.connector.canvas,rm),this.Cs===Xh)document.addEventListener(Xn,this.documentKeypressHandler);else if(this.R!=null){this.R.$updateRootBounds();let a=this.transientVertex.el.el.getBoundingClientRect();this.R.updateDragElementPosition(a)}this.surface.$startMotion(),this.surface.fireUnchecked("edge:relocate:start",this.currentEdge)}}}};this.surface.on(this.container,me,z(oo),t(it)),this.surface.on(this.container,me,z(so),t(vn)),this.Cs===zn&&this.surface.dragOptions.autoPan!==!1&&(this.R=new Yn(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:n=>{this.O.x=n.x,this.O.y=n.y,this.hp()},shouldHandle:()=>!0}))}hp(){let e={x:this.currentPosition.x,y:this.currentPosition.y},t={[this.transientVertex.vertex.id]:e};this.surface.$_updateVertexPositions({positions:t,sizes:null,offset:{x:0,y:0},repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.surface.fire(hu,this.currentEdge)}zl(e){if(e===!0||this.surface.model.beforeDetach(this.currentEdge.source,this.currentEdge.target,this.currentEdge)===!1||this.currentConnection.reattach)this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex),this.surface.$repaintUIElementById(this.currentEdge.source.id),this.q();else{let n=this.currentEdge.id;this.q(),this.surface.$isUnattachedEdgeAllowed(this.currentEdge)?this.surface.model.$setEdgeDetached(this.currentEdge,{x:this.currentPosition.x+this.O.x,y:this.currentPosition.y+this.O.y},this.currentIndex):this.surface.model.removeEdge(n)}}q(e){if(this.rtree.clear(),this.qr=null,this.dropTargets.forEach(t=>{F(t.targetEl,xr)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(t=>{t.removeAttribute(yr)}),this.disabledDropTargets.length=0,F(document.body,gt),F(this.surface.rootElement,Fn),Xt(this.currentConnection.connector.canvas,[],[Cy,rm]),document.removeEventListener(Xn,this.documentKeypressHandler),this.surface.off(document,se,this.mouseMoveHandler),this.surface.off(document,ae,this.mouseUpHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.modelInfo.objEl,br),this.currentDropTarget=null),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex!=null&&this.surface.$removeTransientVertex(this.transientVertex.el),this.surface.$stopMotion(),this.currentEdge!=null){let t=this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex,e);t&&this.surface.$repaintUIElement(t),this.surface.fireUnchecked("edge:relocate:end",this.currentEdge)}this.Ps=!1,this.Ut=Yy,this.Ul.currentState=jh,this.In=null}By(){if(this.currentIndex===it){let e=mO(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}else{let e=zh(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}this.$refreshTree()}$l(e){(this.Ut===zy||this.Ut===Uy)&&(e.keyCode===27||e.key==="Escape")&&this.zl(!0)}};var Sr="pan",bi="select",hs="disabled",jn="vertexDrawing";var Da="vjs-anchor-placeholder",gPe="vjs-anchor-candidate",Xy="vjs-connection-edit",Im="vjs-edge-guideline",Hn="vjs-edge-handle";var jy=z(Da),gO=12,EO=15;function Hy(i,r,e,t){let n=G(q,e||{});L(n,r),t||(n.style.display=pt);let o=G(ke,Object.assign({cx:`${i/2}`,cy:`${i/2}`,r:`${i/2}`},e||{}));return n.appendChild(o),n}function yI(i,r,e,t,n,o,s){let a=G(q);L(a,n),s||(a.style.display=pt);let l=G(Z,Object.assign({width:i,height:r,x:"0",y:"0",rx:e,ry:t},o||{}));return a.appendChild(l),a}function fO(i,r,e,t,n,o,s){let a=Hy(t,n,o,s);return i.$appendElementToToolsLayer(a),Ne(a,{x:r,y:e}),a}function yO(i,r,e,t,n,o,s,a,l,h){let d=yI(t,n,o,s,a,l,h);return i.$appendElementToToolsLayer(d),Ne(d,{x:r,y:e}),d}function bO(i,r,e){let t=i.faces,n=[{face:He,dist:Math.abs(r.x-e.x),midx:e.x,midy:e.y+e.height/2,x:0,y:.5,ox:-1,oy:0},{face:yt,dist:Math.abs(e.x+e.width-r.x),midx:e.x+e.width,midy:e.y+e.height/2,x:1,y:.5,ox:1,oy:0},{face:Se,dist:Math.abs(r.y-e.y),midx:e.x+e.width/2,midy:e.y,x:.5,y:0,ox:0,oy:-1},{face:ht,dist:Math.abs(e.y+e.height-r.y),midx:e.x+e.width/2,midy:e.y+e.height,x:.5,y:1,ox:0,oy:1}],o=new Map;o.set(Se,[0,-1]),o.set(ht,[0,1]),o.set(He,[-1,0]),o.set(yt,[1,0]),n.sort(function(l,h){return l.dist<h.dist?-1:1});let s=null,a=null;for(let l=0;l<n.length;l++)if(t.indexOf(n[l].face)!=-1){s=n[l].face,r={x:n[l].midx,y:n[l].midy},a={x:n[l].x,y:n[l].y,offsetX:0,offsetY:0,ox:n[l].ox,oy:n[l].oy};break}return[a,s]}function AO(i,r,e){let t=Xc(r,e,i.locations);return xO(t.p,e)}function SO(i,r,e,t,n,o,s,a){let l=a.getVertexDefinition(n),h=r(e,t,n,l);if(h!=null){let d={x:h.x,y:h.y,ox:h.ox,oy:h.oy,offx:h.offsetX||0,offy:h.offsetY||0,cls:""};return xO(d,o)}}function xO(i,r){let e=i.offsetX==null?0:i.offsetX,t=i.offsetY==null?0:i.offsetY;return Object.assign({curX:r.x+i.x*r.width+e,curY:r.y+i.y*r.height+t,offsetX:e,offsetY:t},i)}var co=class{constructor(r,e){this.ui=r;c(this,"current");c(this,"currentConnector");c(this,"currentEdge");c(this,"cp");c(this,"Fy");c(this,"$generatedGeometry");c(this,"$hasEdits",!1);c(this,"dp",[]);c(this,"currentOverlays",[]);c(this,"sourceDimensions");c(this,"targetDimensions");c(this,"mr");c(this,"gr");c(this,"Yl");c(this,"Er");c(this,"Os");c(this,"buttonSize");c(this,"pp");c(this,"sourceAnchorPositionFinder");c(this,"targetAnchorPositionFinder");c(this,"eventManager");c(this,"Xl");c(this,"fr");c(this,"Uy",{});c(this,"yr",{rotation:0,center:{x:0,y:0}});e=e||{},this.buttonSize=e.buttonSize||gO,this.pp=e.anchorPlaceholderSize||EO,this.Er=!1,this.ui.model.bind(Cn,()=>{this.deactivate()}),this.ui.bind(ai,l=>{l.edge==this.currentEdge&&this.zt()}),this.eventManager=new xe,this.$addDragHandler({selector:jy+" *",target:jy,constrainFunction:(l,h,d,u,p,m)=>{let g=h._s.anchor,E={x:l.x,y:l.y},y=!1,x=this.fr.managedElement,f={x:x.x,y:x.y,width:x.width,height:x.height};this.yr.rotation!==0&&(y=!0,E=Ie(l,this.yr.center,-this.yr.rotation));let b={x:(E.x-f.x)/f.width,y:(E.y-f.y)/f.height},A;if(this.Xl!=null)A=SO(g,this.Xl,x.el,b,this.fr.obj,f,this.current,this.ui),this.$hasEdits=!0;else if(g.isContinuous){let[T,S]=bO(g,E,f);A=T,S!=null&&(g.currentFace=S),this.$hasEdits=!0}else A=AO(g,l,f),this.$hasEdits=!0;return g.fixedLocation=A,g.isFixed=!0,l={x:A.x*f.width,y:A.y*f.height},this.ui.$repaintUIElement(x),y&&(l=Ie(l,this.yr.center,this.yr.rotation)),l},start:l=>{let d=l.el._s.vertex;if(this.fr=this.ui.getObjectInfo(d,!1),this.dp.length=0,this.fr.obj!=null)this.Yl=this.$cloneCurrentGeometry(),this.Xl=this.currentEdge.source.id===this.fr.id?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder,this.yr.rotation=this.ui.$getRotation(d.id),this.yr.rotation!==0&&(this.yr.center={x:this.fr.managedElement.t.c.x,y:this.fr.managedElement.t.c.y});else return!1},stop:l=>{this.dp.forEach(d=>d.parentNode.removeChild(d));let h=this.$cloneCurrentGeometry();this.$updateModel(h,this.Yl),this.Yl=null,this.fr=null},drag:l=>{this.zt()}});let t=(l,h)=>{this.zy(l)?h(l):Y(l)&&(je(this.currentEdge.source,l)?h(this.currentEdge.source):je(this.currentEdge.target,l)&&h(this.currentEdge.target))},n=l=>{this.Er&&this.currentEdge&&(l.dragGroup.forEach(h=>{t(h.vertex,d=>{this.Yy(d)})}),this.zt())},o=l=>{this.Er&&this.currentEdge&&l.dragGroup.forEach(h=>{t(h.vertex,d=>this.Xy(d))})};this.ui.bind(Vt,l=>{o(l)}),this.ui.bind(Mt,l=>{n(l)}),this.ui.bind(Gr,l=>{o(l)}),this.ui.bind(Do,l=>{n(l)});let s=l=>{this.Er&&this.currentEdge&&t(l.vertex,h=>this.zt())};this.ui.model.bind(Re,s),this.ui.model.bind(Te,s);let a=l=>{this.Er&&this.currentEdge&&l.id===this.currentEdge.id&&this.zt()};this.ui.bind(hu,l=>{a(l)}),this.ui.model.bind(an,l=>{a(l.edge)}),this.ui.model.bind(sn,l=>{a(l.edge)})}isBusy(){return this.Os}$cloneCurrentGeometry(){return lt(this.currentConnector.geometry)}mp(r){return this.ui.view.getTypeDefinition(r).anchorPositions}gp(r,e){let t={type:e.type,options:Object.assign(e.options,{id:B()})};this.currentOverlays.push(this.ui.$addOverlay(r,t)),this.$repaintConnection()}jy(r,e){this.Ep(),e.forEach(t=>{this.gp(r,t)})}Ep(){this.currentOverlays.forEach(r=>{qo(this.current,r.id)})}Hy(r){let e=r.deleteButtonClass||ua,t=r.deleteButtonLocation||.1,n=()=>this.ui.model.removeEdge(this.currentEdge),o=()=>{r.onMaybeDelete?r.onMaybeDelete(this.currentEdge,this.current,n):n()};(Array.isArray(t)?t:[t]).forEach(a=>{this.gp(this.current,{type:fr.type,options:{label:"\u2716",location:a,cssClass:e,events:{click:o}}})})}$repaintConnection(r){if(this.current){let e=Object.assign(r||{},{fireEvent:!0});this.ui.$paintConnection(this.current,e),this.zt(r)}}$updateModel(r,e){this.ui.model.setEdgeGeometry(this.currentEdge,r,e,this.ui)}zt(r){this.current&&(this.jl(),this.$repaint(r))}jl(){if(this.current){let r=(e,t)=>{let n=e===0?this.current.anchors.source:this.current.anchors.target,o=this.ui.getElement(e===0?this.current.sourceId:this.current.targetId);if((e===0?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder)!=null||n.isDynamic||n.isContinuous){let a=Object.assign({},n.computedPosition),[l,h]=[a.curX-o.x,a.curY-o.y],d;t!=null?d=t:(d=Hy(this.pp,Da,{[Qe]:this.currentEdge.id},!0),d._s={anchor:n,idx:e,edge:this.currentEdge,vertex:e===0?this.currentEdge.source:this.currentEdge.target}),this.ui.$appendElementToToolsLayer(d);let u=this.ui.$getSize(d),p={x:o.x+(l-u.width/2),y:o.y+(h-u.height/2)};return Ne(d,p),[[o.x,o.y],d]}else return[[0,0],null]};this.ui.$removeElement(this.mr),this.currentEdge.source.dummy||([this.sourceDimensions,this.mr]=r(0,this.mr)),this.ui.$removeElement(this.gr),this.currentEdge.target.dummy||([this.targetDimensions,this.gr]=r(1,this.gr))}}ky(){this.current&&(this.mr&&(this.mr.parentNode.removeChild(this.mr),delete this.mr._s),this.gr&&(this.gr.parentNode.removeChild(this.gr),delete this.gr._s)),this.mr=null,this.gr=null,this.sourceDimensions=null,this.targetDimensions=null}Wy(){this.current&&ji(this.current)}reset(){this.$hasEdits=!1,this.$generatedGeometry=null,this.deactivate(),this.Wy(),this.$clearHandles(),this.ui.$repaintUIElementById(this.current.sourceId),this.ui.$repaintUIElementById(this.current.targetId)}isActive(){return this.Er}$setElementPosition(r,e,t){let n=this.ui.$getSize(r),o=e-n.width/2,s=t-n.height/2;Ne(r,{x:o,y:s})}activate(r,e,t){if(!(this.current!=null&&this.current===e)){if(this.deactivate(),this.current=e,this.currentConnector=this.current.connector,this.currentEdge=r,this.cp=this.ui.model.getEdgeType(r.data),this.Fy=this.ui.view.getEdgeDefinition(this.cp),r.geometry==null&&(this.$generatedGeometry=this.ui.$exportEdgeGeometry(r)),t=t||{},this.sourceAnchorPositionFinder=t.anchorPositionFinder,this.targetAnchorPositionFinder=t.anchorPositionFinder,t.anchorPositions!=null)this.sourceAnchorPositionFinder=pa(t.anchorPositions),this.targetAnchorPositionFinder=pa(t.anchorPositions);else{let n=this.mp(this.currentEdge.source);n!=null&&(this.sourceAnchorPositionFinder=pa(n));let o=this.mp(this.currentEdge.target);o!=null&&(this.targetAnchorPositionFinder=pa(o))}this.$activate(e,t),t.overlays&&this.jy(e,t.overlays),t.deleteButton===!0&&this.Hy(t),this.jl(),Wr(this.current,Xy),this.Er=!0}}deactivate(r){this.current!=null&&(this.Ep(),Or(this.current,Xy),this.ky()),this.$clearHandles(),this.$hasEdits=!1,this.$generatedGeometry=null,this.Er=!1,this.current=null,this.currentEdge=null,this.sourceAnchorPositionFinder=null,this.targetAnchorPositionFinder=null,this.Os=!1}$makeAndAppendCircularHandle(r,e,t,n,o,s){let a=fO(this.ui,r,e,t,o,{[Qe]:this.currentEdge.id},s);return this.$setElementPosition(a,r,e),a}$makeAndAppendRectangularHandle(r,e,t,n,o,s,a,l){let h=yO(this.ui,r,e,t,n,o,s,a,{[Qe]:this.currentEdge.id},l);return this.$setElementPosition(h,r,e),h}$makeAndAppendDeleteHandle(r,e,t,n,o,s){let a=this.$makeAndAppendCircularHandle(r,e,t,n,o,s),l=G(et,{x:`${t/2}`,y:`${n/2}`,[Qe]:this.currentEdge.id});return l.innerHTML="\u2716",a.appendChild(l),a}$addDragHandler(r){this.ui.addDragHandler({selector:r.selector,target:r.target,start:e=>{let t=r.start(e);return t!==!1&&(this.Os=!0),t},drag:e=>r.drag(e),stop:e=>{this.Os=!1,r.stop(e)},constrainFunction:r.constrainFunction,usesPageCoordinates:r.usesPageCoordinates}),this.Uy[r.selector]=r}Yy(r){this.jl(),this.$elementDragging(r)}Xy(r){this.$elementDragged(r)}zy(r){return this.currentEdge==null?!1:r.id===EE(this.currentEdge.source)||r.id===EE(this.currentEdge.target)}};var Lr=new Map;function xI(i,r,e){let t=Lr.get(i);return new t(r,e)}function bI(i){return i.type===In&&i.constrain===on?aa:i.type}var Na=class{constructor(r,e){this.ui=r;this.Rs=e;c(this,"Hl",new Map);c(this,"fp");c(this,"Xe",!1);c(this,"Vn");c(this,"st");r.bind($i,()=>(this.destroy(),!0)),this.Rs=this.Rs||{},this.fp=this.Rs.hoverMode===!0,this.ui.model.bind(bt,t=>{this.Vn&&this.Vn.id===t.edge.id&&this.stopEditing()}),this.fp&&(this.ui.bindUnchecked("edge:relocate:start",t=>{this.Vn&&this.Vn.id===t.id&&(this.Xe=!0,this.stopEditing())}),this.ui.bindUnchecked("edge:relocate:end",t=>{this.Xe=!1}),Ei()&&(this.ui.bind(lu,t=>{t.obj.transient||(!this.st||!this.st.isBusy()&&this.st.$supportsHoverMode)&&this.startEditing(t.obj)}),this.ui.bind(au,t=>{}))),this.ui.$_attachEdgePathEditor(this)}startEditing(r,e){if(!this.Xe){let t=this.yp(r);if(t!=null){let n=t.edge;e=Object.assign({},e||{});let o=bI(t.connector);if(Lr.has(o)){if(this.st=this.Hl.get(o),this.st==null){let s=Object.assign({},this.Rs||{});this.st=xI(o,this.ui,s),this.Hl.set(o,this.st)}this.Vn=n,this.st.activate(n,t,e)}else throw new Error("No editor available for connector type ["+o+"]")}}}stopEditing(){this.st&&this.st.deactivate(),this.Vn=null,this.st=null}clearEdits(r){let e=this.yp(r);return e!=null?(ji(e),!0):!1}yp(r){return r==null?null:typeof r=="string"?this.ui.getRenderedConnection(r):ma(r)?r:this.ui.getRenderedConnection(r.getId())}destroy(){this.stopEditing(),this.Hl.clear()}};function ky(){}function Hh(i,r){let e=document.createElement("div");return L(e,r.join(" ")),i.appendChild(e),e}var Ia=class{constructor(r){c(this,"visibleOrigin",{x:0,y:0});c(this,"size",{width:0,height:0});c(this,"Ls");c(this,"el");c(this,"at");c(this,"masks",{});c(this,"origin",{x:0,y:0});c(this,"canvasOrigin",{x:0,y:0});c(this,"canvasExtent",{x:0,y:0});c(this,"O",{x:0,y:0});c(this,"Yt");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"onClick");c(this,"hasMoved",!1);c(this,"down",!1);c(this,"moving",!1);c(this,"invert");c(this,"surface");c(this,"pt");c(this,"eventManager");c(this,"kl");c(this,"downListener");c(this,"upListener");c(this,"moveListener");c(this,"downEvent",me);c(this,"upEvent",ae);c(this,"moveEvent",se);c(this,"enabled",!1);c(this,"Wl");c(this,"xp");c(this,"yt");c(this,"Ky",[".vjs-connector-path",".vjs-connector-outline"]);this.surface=r.surface,this.onStart=r.onStart||ky,this.onEnd=r.onEnd||ky,this.onSelect=r.onSelect||ky,this.onClick=r.onClick||null,this.Ls=r.generateLassoContent,this.kl=r.mapToGrid,this.invert=r.invert===!0,this.downListener=this.Qr.bind(this),this.upListener=this.xr.bind(this),this.moveListener=this.en.bind(this),this.eventManager=new xe,this.Wl=r.enableInGroups===null?!0:r.enableInGroups,this.Zy(r.filter),this.invert?this.Jy():this.el=Hh(this.surface.getContainer(),[TP,r.cssClass||""]),this.at=G(Z,{width:1,height:1,x:0,y:0,fill:"transparent"}),this.eventManager.on(this.surface.$getCanvasElement().parentNode,this.downEvent,this.downListener),this.surface.bind(_n,e=>{this.down&&this.onClick&&this.onClick(this.visibleOrigin,e)}),this.surface.addVertexDragFilter(e=>this.enabled&&this.Wl!==!1?e.vertex.objectType===he.objectType?!0:!(this.Wl==="metaKey"?e.e.metaKey:!0):!0),r.autoPan!==!1&&(this.Yt=new Yn(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:e=>{this.O.x=e.x,this.O.y=e.y,this.bp()},shouldHandle:()=>!0}))}qy(r){let e=r.srcElement||r.target;return this.Ky.find(t=>$t(e,t))!=null}Zy(r){r==null?this.pt=function(){return!1}:j(r)?this.pt=e=>{let t=e.srcElement||e.target;return $t(t,r)}:this.pt=r}Ap(r,e,t){this.visibleOrigin=r,this.size=e;let n=this.surface.fromPageLocation(r.x,r.y);if(this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+e.width,this.origin.y+e.height),this.invert){let o=window.innerWidth,s=window.innerHeight,a=window.pageXOffset,l=window.pageYOffset,h=s-r.y+l,d=s-h+e.height,u=o-r.x+a,p=o-u+e.width;this.masks.top.style.bottom=h+"px",this.masks.bottom.style.top=d+"px",this.masks.left.style.right=u+"px",this.masks.right.style.left=p+"px",this.masks.top.style.left=o-u+"px",this.masks.top.style.right=o-p+"px",this.masks.bottom.style.left=o-u+"px",this.masks.bottom.style.right=o-p+"px"}else{let o=this.surface.getEffectiveVisibleZoom();tr(this.el,{x:n.x,y:n.y}),Rr(this.el,e.width/o,e.height/o)}if(this.at.setAttribute("x",`${t.x}`),this.at.setAttribute("y",`${t.y}`),this.Yt!=null&&this.at.parentElement!=null){let o=this.at.getBoundingClientRect();this.Yt.updateDragElementPosition(o)}}Ft(r){let e=r?Pr:pt;this.invert?(this.masks.top.style.display=e,this.masks.left.style.display=e,this.masks.right.style.display=e,this.masks.bottom.style.display=e):this.el.style.display=e,r?this.surface.addClass(document.body,gt):this.surface.removeClass(document.body,gt)}Sp(r){return this.kl==null?r:this.kl(r)}Qr(r){if(this.enabled&&!this.qy(r)&&!this.pt(r)){ie(r),this.down=!0,this.eventManager.on(document,this.upEvent,this.upListener),this.eventManager.on(document,this.moveEvent,this.moveListener),this.O.x=0,this.O.y=0,this.hasMoved=!1;let e={width:1,height:1};this.origin=this.Sp(Ee(r)),this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+e.width,this.origin.y+e.height);let t=this.surface.getElementFromEvent(r);if(!this.invert&&this.Ls){let n=this.Ls(this.origin,r);n!=null?(this.xp=n,this.el.replaceChildren(n)):this.el.innerHTML=""}this.Ap(this.origin,e,this.canvasOrigin),this.onStart(this.origin,this.canvasOrigin,r.shiftKey,r,t),this.Yt!=null&&(this.Yt.reset(),this.surface.$appendElementToToolsLayer(this.at),this.Yt.observe(this.at))}}bp(r){if(this.yt!=null){let e=this.surface.fromPageLocation(this.yt.x,this.yt.y),t={x:this.canvasOrigin.x+this.O.x,y:this.canvasOrigin.y+this.O.y},n=this.surface.toPageLocation(t.x,t.y),o={width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)},s={width:Math.abs(this.yt.x-n.x),height:Math.abs(this.yt.y-n.y)},a={x:Math.min(n.x,this.yt.x),y:Math.min(n.y,this.yt.y)},l={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)};o.width>0&&o.height>0&&(this.hasMoved=!0,this.Ap(a,s,e),this.onSelect(a,s,l,o,[n.x<this.yt.x,n.y<this.yt.y],r,this.xp))}}en(r){this.down&&(this.moving||(this.Ft(!0),this.moving=!0),ie(r),this.yt=this.Sp(Ee(r)),this.bp(r.shiftKey))}xr(r){if(this.down){this.at.parentElement&&this.at.parentElement.removeChild(this.at),this.Yt!=null&&(this.Yt.unobserve(this.at),this.Yt.reset());let e=this.moving;this.down=!1,this.moving=!1,ie(r),this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener),this.Ft(!1),e&&this.hasMoved&&this.onEnd(this.visibleOrigin,this.size),this.Ls&&(this.el.innerHTML="")}}Jy(){this.masks.top=Hh(document.body,[Oh,CP]),this.masks.bottom=Hh(document.body,[Oh,OP]),this.masks.left=Hh(document.body,[Oh,vP]),this.masks.right=Hh(document.body,[Oh,PP])}isActive(){return this.down}setEnabled(r){this.enabled=r}};var Ce=class{$groupMemberAdded(r){}$groupMemberRemoved(r){}$nodeRemoved(r){}$groupRemoved(r){}$groupResized(r){}$groupCollapsed(r){}$groupExpanded(r){}$vertexRotated(r,e){}$vertexResized(r,e,t){}$vertexRerendered(r){}$vertexUpdated(r,e){}$vertexSynced(r){}$edgeRemoved(r){}$edgeUpdated(r){}$edgeRendered(r){}};var TO="logarithmic",vO="absolute";var CO={},uo={get:i=>{let r=CO[i];if(r)return r;throw{message:`VisuallyJs: unknown background [${i}]`}},register:(i,r)=>{CO[i]=r}};var Vm=class Vm{constructor(r){c(this,"type",Vm.type);c(this,"canvas");c(this,"onBackgroundReady");c(this,"imagePlaceholder");c(this,"ui");c(this,"image");c(this,"url");this.ui=r.ui,this.canvas=r.canvas,this.onBackgroundReady=r.options.onBackgroundReady||((e,t)=>{}),this.image=r.options.img,this.url=r.options.url,this.imagePlaceholder=new Image,this.imagePlaceholder.onload=()=>{this.canvas.style.backgroundImage="url('"+this.imagePlaceholder.src+"')",this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.width=this.imagePlaceholder.width+"px",this.canvas.style.height=this.imagePlaceholder.height+"px",this.onBackgroundReady(this,r.ui)},this.Mn(r.options)}Mn(r){this.imagePlaceholder.src=this.image?this.image.src:this.url}setUrl(r){this.imagePlaceholder&&(this.imagePlaceholder.src=r)}owns(r){return r===this.canvas}getWidth(){return this.imagePlaceholder&&this.imagePlaceholder.width||0}getHeight(){return this.imagePlaceholder&&this.imagePlaceholder.height||0}setZoom(r,e){}pan(){}destroy(){this.imagePlaceholder=null}Ft(r){}};c(Vm,"type","simple");var Mm=Vm;uo.register(Mm.type,Mm);var AI="vjs-background-tile",Wy=class{constructor(r,e,t){c(this,"scaledImageSize");c(this,"scaledImageSizeH");c(this,"container");c(this,"zoom");c(this,"specs");c(this,"url");c(this,"urlGenerator");c(this,"apparentZoom");c(this,"xTiles");c(this,"yTiles");c(this,"Xt",[]);let n=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.width,o=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.height;this.scaledImageSize=n,this.scaledImageSizeH=o,this.container=document.createElement("div"),this.container.style.position="relative",this.container.style.height="100%",this.container.style.width="100%",this.container.style.display="none",e.canvas.insertBefore(this.container,e.canvas.firstElementChild),this.zoom=t,this.specs=r.getTileSpecs(t),this.url=e.options.url,this.urlGenerator=r.urlGenerator,this.apparentZoom=Math.min(this.specs.xSize,this.specs.ySize),this.xTiles=this.specs.xCount,this.yTiles=this.specs.yCount;for(let s=0;s<this.xTiles;s++){this.Xt[s]=this.Xt[s]||[];for(let a=0;a<this.yTiles;a++){let l=document.createElement("img");l.Qy=!0,l.className=AI,l.ondragstart=function(){return!1},this.container.appendChild(l),l.style.position="absolute",l.style.opacity=0,this.Xt[s][a]=[l,new Image,!1]}}}ex(r,e,t){return this.url.replace("{z}",r+"").replace("{x}",e+"").replace("{y}",t+"")}nx(r,e,t){return this.urlGenerator==null?this.ex(r,e,t):this.urlGenerator(r,e,t)}setActive(r){this.container.style.display=r?"block":"none"}ix(r,e,t,n){r.style.left=t*this.scaledImageSize+"px",r.style.top=n*this.scaledImageSizeH+"px",r.style.width=this.scaledImageSize+"px",r.style.height=this.scaledImageSizeH+"px",e.onload=function(){r.setAttribute("src",e.src),r.style.opacity=1},e.src=this.nx(this.zoom,t,n)}ensureLoaded(r,e,t,n){for(let o=r;o<=t;o++)for(let s=e;s<=n;s++)this.Xt[o]!=null&&this.Xt[o][s]!=null&&(this.Xt[o][s][2]||(this.ix(this.Xt[o][s][0],this.Xt[o][s][1],o,s),this.Xt[o][s][2]=!0))}},$m=class $m{constructor(r){c(this,"type",$m.type);c(this,"canvas");c(this,"viewport");c(this,"layers",[]);c(this,"currentLayer");c(this,"widgetZoom");c(this,"width");c(this,"height");c(this,"tileSize");c(this,"panDebounceTimeout");c(this,"zoomDebounceTimeout");c(this,"maxZoom");c(this,"ui");c(this,"tiling");c(this,"urlGenerator");c(this,"Tp");c(this,"vp");if(r.options.maxZoom==null)throw new Error("Parameter `maxZoom` not set; cannot initialize TiledBackground");if(!r.options.tileSize)throw new Error("Parameter `tileSize not set; cannot initialize TiledBackground. It should be in the form {w:width, h:height}.");if(!r.options.width||!r.options.height)throw new Error("Parameters `width` and `height` must be set");this.canvas=r.canvas,this.viewport=r.viewport,this.urlGenerator=r.options.urlGenerator,this.ui=r.ui,this.tiling=r.options.tiling||TO,this.width=r.options.width,this.height=r.options.height,this.maxZoom=r.options.maxZoom,this.tileSize=r.options.tileSize,this.panDebounceTimeout=r.options.panDebounceTimeout||50,this.zoomDebounceTimeout=r.options.zoomDebounceTimeout||120,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.Tp=this.debounce(this.Cp,this.zoomDebounceTimeout),this.vp=this.debounce(this.Pp,this.panDebounceTimeout);for(let e=0;e<=r.options.maxZoom;e++)this.layers.push(new Wy(this,r,e));this.setZoom(r.ui.getZoom(),!0),r.options.onBackgroundReady!=null&&setTimeout(r.options.onBackgroundReady,0)}lx(){if(this.widgetZoom<=this.layers[0].apparentZoom)return 0;if(this.widgetZoom>=this.layers[this.layers.length-1].apparentZoom)return this.layers.length-1;for(let r=this.layers.length-1;r>0;r--)if(this.layers[r].apparentZoom>=this.widgetZoom&&this.widgetZoom>=this.layers[r-1].apparentZoom)return r}hx(r){let e=this.layers[r];this.currentLayer!=null&&this.currentLayer!==e&&this.currentLayer.setActive(!1),e.setActive(!0),this.currentLayer=e}Pp(){let r=this.ui.getApparentCanvasLocation(),e=this.ui.$getSize(this.viewport),t=e.width,n=e.height,o=this.currentLayer.scaledImageSize*this.widgetZoom,s=this.currentLayer.scaledImageSizeH*this.widgetZoom,a=r.x<0?Math.floor(-r.x/o):r.x<t?0:null,l=r.y<0?Math.floor(-r.y/s):r.y<n?0:null,h=Math.min(this.currentLayer.xTiles,Math.floor((t-r.x)/o)),d=Math.min(this.currentLayer.yTiles,Math.floor((n-r.y)/s));a==null||l==null||this.currentLayer.ensureLoaded(a,l,h,d)}getCurrentLayer(){return this.currentLayer}debounce(r,e){e=e||150;let t=null;return()=>{window.clearTimeout(t),t=window.setTimeout(r.bind(this),e)}}Cp(){this.hx(this.lx()),this.Pp()}setZoom(r,e){this.widgetZoom=r,e?this.Cp():this.Tp()}pan(){this.vp()}owns(r){return r===this.canvas||r.Qy===!0}getHeight(){return this.height}getWidth(){return this.width}destroy(){}setUrl(r){U("WARN: setUrl not implemented for Tiled backgrounds.")}getTileSpecs(r){return this.tiling===vO?this.ux(r):this.px(r)}ux(r){let e=Math.pow(2,this.maxZoom-r),t=Math.ceil(this.width/e/this.tileSize.width),n=Math.ceil(this.height/e/this.tileSize.height),o=t*this.tileSize.width/this.width,s=n*this.tileSize.height/this.height;return{xCount:t,yCount:n,xSize:o,ySize:s}}px(r){let e=this.width>this.height?1:this.width/this.height,t=this.height>this.width?1:this.height/this.width,n=Math.pow(2,r+1)*this.tileSize.width*e,o=Math.pow(2,r+1)*this.tileSize.height*t,s=Math.ceil(n/this.tileSize.width),a=Math.ceil(o/this.tileSize.height),l=n/this.width,h=o/this.height;return{xCount:s,yCount:a,xSize:l,ySize:h}}Ft(r){}};c($m,"type","tiled");var Gm=$m;uo.register(Gm.type,Gm);var SI=(e=>(e.dotted="dotted",e.lines="lines",e))(SI||{}),n0e="dotted",i0e="lines",TI={width:50,height:50},vI=2,PO="#ddd",kh="#ddd",CI=2,PI=1,OI="vjs-background",_I="vjs-background-border",cs="vjs-background-grid",RI="vjs-background-grid-minor",LI="vjs-background-grid-major",Bm="vjs-background-grid-dotted-major",wI="vjs-background-grid-dotted-minor",Fm=class Fm{constructor(r){c(this,"Xe",!1);c(this,"type",Fm.type);c(this,"grid");c(this,"ui");c(this,"showBorder",!0);c(this,"minWidth");c(this,"minHeight");c(this,"maxWidth");c(this,"maxHeight");c(this,"showTickMarks");c(this,"tickMarksPerCell");c(this,"autoShrink",!0);c(this,"dotRadius");c(this,"tickDotRadius");c(this,"gridType");c(this,"currentBounds");c(this,"We",{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});c(this,"backgroundContainer");c(this,"ws");c(this,"Xi");this.ui=r.ui,this.showBorder=r.options.showBorder===!0,this.ws=`p${B().substring(0,8)}`,this.Xi=`p${B().substring(0,8)}`,this.gridType=r.options.gridType||"lines",this.backgroundContainer=G(Le),this.backgroundContainer.style.position=qe,L(this.backgroundContainer,OI),this.Ft(r.visible),r.canvas.insertBefore(this.backgroundContainer,r.canvas.firstElementChild),this.ui.bind(Vt,e=>{this.Ar()}),this.ui.bind(Mt,e=>{this.Ar()}),this.ui.bind(iu,()=>{this.Xe=!0}),this.ui.bind(Pn,()=>{this.Xe=!1,this.Ar()}),this.ui.bind(Fr,e=>{this.Ar()}),this.ui.bind(Br,e=>{this.Ar()}),this.ui.model.bind(ve,e=>{this.Ar()}),this.ui.model.bind(_e,e=>{this.Ar()}),this.grid=r.options.grid||this.ui.getGrid()||TI,this.showTickMarks=r.options.showTickMarks===!0,this.tickMarksPerCell=r.options.tickMarksPerCell||vI,this.dotRadius=r.options.dotRadius||CI,this.tickDotRadius=r.options.tickDotRadius||PI,this.minWidth=r.options.minWidth||2e4,this.minHeight=r.options.minHeight||2e4,this.maxWidth=r.options.maxWidth,this.maxHeight=r.options.maxHeight,this.autoShrink=r.options.autoShrink!=!1,this.Ar()}owns(r){return r===this.backgroundContainer||r.parentNode===this.backgroundContainer}getWidth(){return this.currentBounds!=null?this.currentBounds.width+(this.currentBounds.x<0?this.currentBounds.x:0):0}getHeight(){return this.currentBounds!=null?this.currentBounds.height+(this.currentBounds.y<0?this.currentBounds.y:0):0}setZoom(r,e){}pan(){}destroy(){this.backgroundContainer.parentNode&&this.backgroundContainer.parentNode.removeChild(this.backgroundContainer),this.backgroundContainer=null}Ar(){this.Xe||requestAnimationFrame(()=>{this.currentBounds=Object.assign({},this.ui.getViewportBoundsInfo());let r=this.grid.width*(Math.floor(this.currentBounds.x/this.grid.width)-1),e=this.grid.height*(Math.floor(this.currentBounds.y/this.grid.height)-1),t=this.grid.width*(Math.floor(this.currentBounds.width/this.grid.width)+3),n=this.grid.height*(Math.floor(this.currentBounds.height/this.grid.height)+3);if(!isNaN(r)&&!isNaN(e)&&!isNaN(t)&&!isNaN(n)){if(this.minWidth!=null){let s=-this.minWidth/2;s<r&&(t+=r-s,r=s);let a=this.minWidth/2;a>r+t&&(t+=a-(r+t))}if(this.minHeight!=null){let s=-this.minHeight/2;s<e&&(n+=e-s,e=s);let a=this.minHeight/2;a>e+n&&(n+=a-(e+n))}if(this.maxWidth!=null){let s=-this.maxWidth/2;s>r&&(t-=s-r,r=s);let a=this.maxWidth/2;a<r+t&&(t-=r+t-a)}if(this.maxHeight!=null){let s=-this.maxHeight/2;s>e&&(n-=s-e,e=s);let a=this.maxHeight/2;a<e+n&&(n-=e+n-a)}this.autoShrink!==!0&&(r=Math.min(r,this.We.minX),e=Math.min(e,this.We.minY),t=Math.max(r+t,this.We.maxX)-r,n=Math.max(e+n,this.We.maxY)-e);let o=this.ui.$getFixedViewportBoundsInfo();o!=null&&(r=o.x,e=o.y,t=o.width,n=o.height),Ne(this.backgroundContainer,{x:r,y:e}),this.backgroundContainer.setAttribute("width",`${t}`),this.backgroundContainer.setAttribute("height",`${n}`),this.backgroundContainer.setAttribute("viewBox",`0 0 ${t} ${n}`),this.backgroundContainer.innerHTML=this.generateGrid(),this.We.minX=Math.min(this.We.minX,r),this.We.minY=Math.min(this.We.minY,e),this.We.maxX=Math.max(this.We.maxX,r+t),this.We.maxY=Math.max(this.We.maxY,e+n)}else this.backgroundContainer.innerHTML=""})}mx(r,e){return`<pattern id="${this.Xi}" width="${r}" height="${e}" patternUnits="userSpaceOnUse">
44
- <path d="M ${r} 0 L 0 0 0 ${e}" class="${cs} ${RI}" fill="none" stroke="${PO}" stroke-width="1"/>
45
- </pattern>`}gx(){return`<pattern id="${this.ws}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.Xi})"/>`:"")+`<path d="M ${this.grid.width} 0 L 0 0 0 ${this.grid.height}" class="${cs} ${LI}" fill="none" stroke="${kh}" stroke-width="1.5"/></pattern>`}Ex(r,e){let t=`<pattern id="${this.Xi}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`;for(let n=0;n<this.tickMarksPerCell+2;n++){let o=n*r;for(let s=0;s<this.tickMarksPerCell+2;s++){let a=s*e;t+=`<circle cx="${o}" cy="${a}" r="${this.tickDotRadius}" class="${cs} ${wI}" fill="${PO}" stroke="none"/>`}}return t+"</pattern>`"}fx(){return`<pattern id="${this.ws}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.Xi})"/>`:"")+`<circle cx="0" cy="0" r="${this.dotRadius}" class="${cs} ${Bm}" fill="${kh}" stroke="none"/>
46
- <circle cx="${this.grid.width}" cy="0" r="${this.dotRadius}" class="${cs} ${Bm}" fill="${kh}" stroke="none"/>
47
- <circle cx="${this.grid.width}" cy="${this.grid.height}" r="${this.dotRadius}" class="${cs} ${Bm}" fill="${kh}" stroke="none"/>
48
- <circle cx="0" cy="${this.grid.height}" r="${this.dotRadius}" class="${cs} ${Bm}" fill="${kh}" stroke="none"/></pattern>`}yx(){let r=this.grid.width/(this.tickMarksPerCell+1),e=this.grid.height/(this.tickMarksPerCell+1),t=()=>this.gridType==="lines"?this.mx(r,e):this.Ex(r,e),n=()=>this.gridType==="lines"?this.gx():this.fx();return"<defs>"+(this.showTickMarks?t():"")+n()+"</defs>"}generateGrid(){let r=this.yx(),e=this.showBorder?`<rect class="${_I}" x="0" y="0" width="100%" height="100%" fill="${pt}"/>`:"",t=`<rect x="0" y="0" width="100%" height="100%" fill="url(#${this.ws})" stroke="${pt}"/>`;return r+e+t}Ft(r){this.backgroundContainer.style.display=r?Pr:pt}};c(Fm,"type","grid");var Ma=Fm;uo.register(Ma.type,Ma);var ds=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"background");c(this,"Ds",!0);c(this,"ui")}initialise(e,t){this.ui=e;let n=t.type,o=uo.get(n);return this.Ds=t.options!=null?t.visible!==!1:!0,this.background=new o({type:n,ui:this.ui,canvas:e.$getCanvasElement(),viewport:e.rootElement,options:t,visible:this.Ds}),e.addBackground(this.background),!0}destroy(){this.ui.removeBackground(this.background),this.background.destroy()}reset(){}setUrl(e){this.background.setUrl!=null?this.background.setUrl(e):U("The current background does not support the `setUrl` method")}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}toggle(){this.setVisible(!this.Ds)}setVisible(e){this.Ds=e,this.background.Ft(e)}};c(ds,"type","background"),cn.register(ds.type,ds);var Va="c-state",Um=class{constructor(r,e,t){this.id=r;this.state=e;this.ui=t;for(let n in e)if(e.hasOwnProperty(n)){let o=n===Er?`${Va}-${r}`:`${Va}-${r}-${n}`;t.$registerConnectionType(o,e[n])}}activate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${Va}-${this.id}-${a}`:null;l&&De.addType(s,l,o.data),this.state[Er]&&De.addType(s,`${Va}-${this.id}`,o.data),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state["*"]&&L(l,this.state["*"].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state[Er]&&L(l,this.state[Er].cssClass)})}deactivate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${Va}-${this.id}-${a}`:null;l&&De.removeType(s,l,o.data),this.state[Er]&&De.removeType(s,`${Va}-${this.id}`),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state["*"]&&F(l,this.state[Er].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state[Er]&&F(l,this.state[Er].cssClass)})}};var Zy=class{constructor(r){this.ui=r;c(this,"Op",{});c(this,"model");c(this,"currentStates",[]);c(this,"viewOptions");if(this.model=r.view,this.viewOptions=this.model.viewOptions,this.viewOptions.states)for(let e in this.viewOptions.states)this.Op[e]=new Um(e,this.viewOptions.states[e],r)}getState(r){return this.Op[r]}activateState(r,e){let t=this.getState(r);if(t){let n=this._p(e);t.activate(n,this.ui,this.ui.dataSource),this.currentStates.push(t)}}deactivateState(r,e){let t=this.getState(r);t&&(e=this._p(e),t.deactivate(e,this.ui,this.ui.dataSource),Nt(this.currentStates,function(n){return n==t}))}resetState(){for(let r=0;r<this.currentStates.length;r++)this.currentStates[r].deactivate(this.ui.dataSource,this.ui,this.ui.dataSource);this.currentStates.length=0}_p(r){if(r==null)return this.ui.dataSource;if(typeof r=="string")return this.ui.model.select(r,!0);if(r.jtk){let e=r.jtk;return this.ui.model.select(e.port||e.node,!0)}else return r}},Wh=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"model")}destroy(){}initialise(e,t){return this.model=new Zy(e),!0}reset(){}activateState(e,t){this.model.activateState(e,t)}deactivateState(e,t){this.model.deactivateState(e,t)}resetState(){this.model.resetState()}};c(Wh,"type","ui-states"),cn.register(Wh.type,Wh);var OO="direct",fLe="orthogonal",Zh=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"instance");c(this,"mode");c(this,"orthogonalMode");c(this,"orthogonalPadding");c(this,"layoutListener");c(this,"Rp");c(this,"he");c(this,"Ot")}destroy(){}xx(){let e=this.ui.getLayout();if(e.type!==Lo.type){U(`INFO: cannot run edge routing; layout is of type ${e.type}. You must use the HierarchyLayout with the edge routing plugin`);return}if(!this.ui.$_hasUnrenderedEdges()){let t=e.axis;this.Rp.forEach(n=>{let o=this.mode===OO?ST(n):AT(n);for(let s in o){let a=this.ui.getRenderedConnection(s),l=a.connector,h=n.edgeMap[s],d=h.pathDirection;if(l.type!==In){U(`Cannot process edge routing for edge ${s} - connector must be Straight type`);continue}let u=o[s],p=this.instance.getEdge(s),m=this.he[p.source.id],g=this.he[p.target.id],E=this.Ot[p.source.id],y=this.Ot[p.target.id],x=[],f=u[0].x,b=u[0].y;for(let A=1;A<u.length-1;A++)x.push({x1:f,y1:b,x2:u[A].x,y2:u[A].y}),f=u[A].x,b=u[A].y;x.push({x1:f,y1:b,x2:u[u.length-1].x,y2:u[u.length-1].y}),$e.importGeometry(a,{source:{curX:u[0].x,curY:u[0].y,ox:t===0?d:0,oy:t===1?d:0,x:(u[0].x-m.x)/E.width,y:(u[0].y-m.y)/E.height},target:{curX:u[u.length-1].x,curY:u[u.length-1].y,ox:t===0?-d:0,oy:t===1?-d:0,x:(u[u.length-1].x-g.x)/y.width,y:(u[u.length-1].y-g.y)/y.height},segments:x})}}),this.ui.repaintEverything()}}initialise(e,t){return this.mode=t.mode||OO,this.ui=e,this.instance=e.model,this.orthogonalMode=t.orthogonalMode||Du,this.orthogonalPadding=t.orthogonalPadding|10,this.layoutListener=(n,o)=>{try{let s=n.layout.getRoutingInformation();this.Rp=s.map(a=>Object.assign({mode:this.orthogonalMode,pad:this.orthogonalPadding,axis:n.layout.axis},a)),this.he=Object.assign({},n.positions),this.Ot=Object.assign({},n.sizes),this.xx()}catch(s){U("Cannot retrieve edge routing. Make sure you're using a Hierarchy layout and you have generateRouting:true in its options`")}},this.ui.bind(On,(n,o)=>this.layoutListener(n,o)),!0}reset(){this.ui.unbind(On,this.layoutListener)}};c(Zh,"type","edgeRouting"),cn.register(Zh.type,Zh);var _O="vjs-selected-edge-highlight",Ym=class Ym extends Ce{constructor(){super(...arguments);c(this,"id",Ym.type);c(this,"Sr",new Map);c(this,"Lp",_O);c(this,"ji");c(this,"S");c(this,"wp",e=>{rt(e.obj)&&(this.bx(e.obj),this.Ax())});c(this,"Np",e=>{rt(e.obj)&&(this.Zl(e.obj.getId()),this.Dp())});c(this,"Ip",e=>{this.reset()});c(this,"Ns",e=>{e.edge&&this.Hi(e.edge)});c(this,"Vp",e=>{e.edge&&this.Hi(e.edge)});c(this,"Mp",e=>{e.dragGroup.forEach(t=>this.Gp(t.vertex))})}initialise(e,t){return this.S=e,this.Lp=t&&t.className||_O,this.ji=t&&t.paintStyle||{fill:"none",stroke:"var(--vjs-color-edit)",strokeWidth:2},this.S.model.bind(qt,this.wp),!0}destroy(){this.reset(),this.S.model.unbind(qt,this.wp)}reset(){this.Sr.forEach(e=>{this.S.$removeElement(e)}),this.Sr.clear(),this.Dp()}Ax(){this.S.model.bind(Qt,this.Np),this.S.model.bind(ir,this.Ip),this.S.model.bind(ai,this.Ns),this.S.model.bind(li,this.Vp),this.S.bind(Mt,this.Mp),this.S.bind(ai,this.Ns)}Dp(){this.S.model.unbind(Qt,this.Np),this.S.model.unbind(ir,this.Ip),this.S.model.unbind(ai,this.Ns),this.S.model.unbind(li,this.Vp),this.S.unbind(Mt,this.Mp),this.S.unbind(ai,this.Ns)}$edgeRemoved(e){this.Zl(e.getId())}$edgeUpdated(e){this.Hi(e)}$vertexUpdated(e,t){this.Gp(e.modelObject)}Gp(e){this.Sr.forEach((t,n)=>{let o=this.S.model.getEdge(n);o&&(o.source===e||o.target===e)&&this.Hi(o)})}bx(e){var s;let t=e.getId();if(this.Sr.has(t)){this.Hi(e);return}let n=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!n)return;let o=G(Z,{fill:this.ji.fill||"none",stroke:this.ji.stroke||"var(--vjs-color-edit)","stroke-width":this.ji.strokeWidth||2,"stroke-dasharray":this.ji.dashArray,"pointer-events":"none",rx:2},{},this.Lp);this.$p(o,n),this.S.$appendElementToToolsLayer(o),this.Sr.set(t,o)}Hi(e){var s;let t=e.getId(),n=this.Sr.get(t);if(!n)return;let o=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!o){this.Zl(t);return}this.$p(n,o)}Zl(e){let t=this.Sr.get(e);t&&(this.S.$removeElement(t),this.Sr.delete(e))}$p(e,t){let o=t.canvas.getBBox(),s=t.x+o.x,a=t.y+o.y;de(e,{x:s,y:a,width:o.width,height:o.height})}};c(Ym,"type","selected-edge-highlight");var Ga=Ym;cn.register(Ga.type,Ga);var kn=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"surfaceMode",bi);c(this,"surface");c(this,"lasso");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"selectionFilter");c(this,"autoExit");c(this,"lassoSelections",[]);c(this,"ki")}destroy(){}initialise(e,t){return e.bind(Rn,n=>{this.lasso.enabled=n===bi}),this.autoExit=t.autoExit!==!1,this.selectionFilter=t.selectionFilter,this.onStart=t.onStart,this.onSelect=t.onSelect,this.onEnd=t.onEnd,this.lasso=new Ia({surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:t.cssClass,generateLassoContent:t.generateLassoContent,enableInGroups:t.enableInGroups,onStart:(n,o,s,a,l)=>{e.hoverSuspended=!0,this.lassoSelections.length=0,l!=null&&Y(l.modelObject)?this.ki=l:this.ki=null,this.onStart&&this.onStart(),e.fireUnchecked(cu,{canvasPosition:o})},onSelect:(n,o,s,a,l,h)=>{e.model.clearSelection(),h&&this.lassoSelections.length>0&&e.model.removeFromSelection(this.lassoSelections);let d=[],u,p=e.findIntersectingVertices({origin:s,dimensions:a,enclosed:!l[0],dontIncludeNodesInsideGroups:this.ki==null,filter:E=>this.ki==null||je(E,this.ki.modelObject)}),m=p.length,g={};for(u=0;u<m;u++)(this.selectionFilter==null||this.selectionFilter(p[u].v)!==!1)&&(d.push(p[u].v),g[p[u].id]=!0,e.model.addToSelection(p[u].v));if(this.lassoSelections=d,m=d.length,t.includeEdges){let E={};for(u=0;u<m;u++){let y=[],x;Array.prototype.push.apply(y,d[u].getAllEdges());for(let f=0;f<y.length;f++)if(x=y[f].getId(),!E[x]){let b=y[f].source.objectType===ce.objectType?y[f].source.getParent().id:y[f].source.id,A=y[f].target.objectType===ce.objectType?y[f].target.getParent().id:y[f].target.id;g[b]&&g[A]&&d.push(y[f]),E[x]=!0}}}e.model.addToSelection(d),this.onSelect&&this.onSelect(d),e.fireUnchecked(du,{canvasPosition:s,canvasSize:a})},onEnd:(n,o)=>{e.hoverSuspended=!1,this.autoExit&&e.mode!==hs&&e.setMode(Sr),e.fireUnchecked(uu),this.onEnd&&this.onEnd()},filter:t.filter}),!1}reset(){}};c(kn,"type","lasso"),kn=Ze([Je("lasso")],kn);var DI="vjs-surface-elastic-group-resize",Jy="elasticGroupFrame:resize",Ky="elasticGroupFrame:remove",$a=class i{constructor(r,e,t,n){this.surface=r;this.focusVertex=e;this.group=t;this.groupDef=n;c(this,"groupEntry");c(this,"focusPosition");c(this,"siblingEntries",[]);c(this,"xMinEntries",[]);c(this,"xMaxEntries",[]);c(this,"yMinEntries",[]);c(this,"yMaxEntries",[]);c(this,"managedElement");c(this,"uiGroup");c(this,"frame");c(this,"layout");c(this,"uiGroupContentArea");c(this,"Sx");c(this,"layoutShiftX",0);c(this,"layoutShiftY",0);c(this,"width",0);c(this,"height",0);c(this,"minSize");c(this,"x",0);c(this,"y",0);c(this,"parent");this.managedElement=r.viewport.getGroupElement(t.id),this.uiGroup=r.getGroupElement(t.id),this.uiGroupContentArea=this.surface.$getGroupContentAreaElement(this.uiGroup.el),wt(this.uiGroupContentArea)?this.frame=G(Z):(this.frame=G(Le),this.frame.appendChild(G(Z,{x:0,y:0,width:"100%",height:"100%"}))),this.layout=r.layoutMap.get(t.id),this.frame.style.visibility="hidden",r.$appendElement(this.frame,this.uiGroupContentArea,!0),L(this.frame,DI),this.groupEntry=r.viewport.getElementBounds(t.id),this.surface.$_useModelForSizes?this.minSize={width:t.data[this.surface.$modelWidthAttribute],height:t.data[this.surface.$modelHeightAttribute]}:this.minSize={width:this.groupEntry.width,height:this.groupEntry.height};let o=Object.assign({},r.viewport.getElement(e.id));if(this.focusPosition=mE(o,this.groupEntry,-1),t.members.filter(a=>a.id!==e.id).forEach(a=>{let l=r.viewport.getElement(a.id),h=mE(l,this.groupEntry,-1);this.siblingEntries.push(l),this.xMinEntries.push(h),this.xMaxEntries.push(h),this.yMinEntries.push(h),this.yMaxEntries.push(h)}),this.Tx(),this.Sx=this.getCurrentExtents(),t.group){let a=this.surface.getGroupElement(t.group.id);a.elastic&&(this.parent=new i(r,t,t.group,a))}}Tx(){this.xMinEntries.sort((r,e)=>r.x<e.x?-1:1),this.yMinEntries.sort((r,e)=>r.y<e.y?-1:1),this.xMaxEntries.sort((r,e)=>r.x+r.width>e.x+e.width?-1:1),this.yMaxEntries.sort((r,e)=>r.y+r.height>e.y+e.height?-1:1)}setFocusPosition(r,e,t,n,o){let s=(n==null?void 0:n.width)||this.focusPosition.width,a=(n==null?void 0:n.height)||this.focusPosition.height,l={x:r.x-(o?this.groupEntry.x:0),y:r.y-(o?this.groupEntry.y:0)};this.focusPosition.x=l.x,this.focusPosition.y=l.y,this.focusPosition.width=s,this.focusPosition.height=a,this.vx(e,t)}vx(r,e){let t=e==null?!1:e.metaKey||e.ctrlKey,n=this.getCurrentExtents(),o=Op(n,this.groupDef,r,!0,!0,this.surface.gridProfile,t?null:this.minSize);this.width=o.width,this.height=o.height,this.layoutShiftX=o.layoutShiftX,this.layoutShiftY=o.layoutShiftY,Rr(this.frame,this.width,this.height),Ne(this.frame,{x:-this.layoutShiftX,y:-this.layoutShiftY}),this.parent&&this.parent.setFocusPosition({x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},!1,e,{width:this.width,height:this.height},!0),this.frame.style.visibility="visible",this.surface.fireUnchecked(Jy,{groupId:this.group.id,width:this.width,height:this.height,x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY})}getCurrentExtents(){let r=this.xMaxEntries[0]||{x:-1/0,width:0},e=this.yMaxEntries[0]||{y:-1/0,height:0};return{xmin:Math.min(this.focusPosition.x,(this.xMinEntries[0]||{x:1/0}).x),ymin:Math.min(this.focusPosition.y,(this.yMinEntries[0]||{y:1/0}).y),xmax:Math.max(this.focusPosition.x+this.focusPosition.width,r.x+r.width),ymax:Math.max(this.focusPosition.y+this.focusPosition.height,e.y+e.height)}}cleanup(){this.frame&&this.frame.parentNode&&this.frame.parentNode.removeChild(this.frame),this.parent&&this.parent.cleanup(),this.surface.fireUnchecked(Ky,{groupId:this.group.id})}getValues(r){return r==this.group.id?{layoutShiftX:this.layoutShiftX,layoutShiftY:this.layoutShiftY,width:this.width,height:this.height}:this.parent?this.parent.getValues(r):null}Jl(r,e){r=r||{},e=e||{};let t=(s,a,l)=>{r[s]=r[s]||{original:a,current:l},r[s].current=l},n={x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},o=Object.assign({},n);if(this.group.group){let s=this.surface.viewport.getElementPosition(this.group.group.id);o.x-=s.x,o.y-=s.y}return(this.layoutShiftX!==0||this.layoutShiftY!==0)&&(this.group.members.forEach(s=>{let a=this.surface.viewport.getElement(s.id),l={x:a.x+this.layoutShiftX-this.groupEntry.x,y:a.y+this.layoutShiftY-this.groupEntry.y};t(s.id,{x:a.x,y:a.y},l)}),t(this.group.id,{x:this.groupEntry.x,y:this.groupEntry.y},o)),(this.width!==this.groupEntry.width||this.height!==this.groupEntry.height)&&(e[this.group.id]={element:this.managedElement,originalGroupSize:{width:this.groupEntry.width,height:this.groupEntry.height},newGroupSize:{width:this.width,height:this.height}}),this.surface.viewport.updateElement(this.group.id,n.x,n.y,this.width,this.height,null,this.group,!1),this.surface.$setGroupElementSize(this.managedElement.modelObject,{width:this.width,height:this.height}),this.surface.$setViewportElementPosition(this.managedElement,o),this.surface.$repaintUIElement(this.managedElement),this.parent&&this.parent.Jl(r,e),{movedElements:r,resizedGroups:e}}};var RO="resize";function Jh(i,r,e){let t={width:i.width,height:i.height,position:i.position||qe},n=i.atts||{};i.display!=null&&(t.display=i.display),i.id!=null&&(n.id=i.id),i.top!=null&&(t.top=i.top+"px"),i.left!=null&&(t.left=i.left+"px"),i.right!=null&&(t.right=i.right+"px"),i.bottom!=null&&(t.bottom=i.bottom+"px");let o=fa(i.ns,i.type||Ke,t,i.clazz,n);return r!=null&&(e?r.insertBefore(o,r.lastChild):r.appendChild(o)),o}var qy="vjs-node-id",LO="vjs-miniview-type",wO="miniview",Wn=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"panzoom");c(this,"containerElement");c(this,"canvasElement");c(this,"pannerElement");c(this,"lassoElement");c(this,"uiBounds");c(this,"suspended");c(this,"Kl");c(this,"typeFunction");c(this,"Tr");c(this,"Is");c(this,"wheelSensitivity");c(this,"wheelReverse");c(this,"panning",!1);c(this,"downAt",null);c(this,"pannerAtMouseDown",null);c(this,"zoomingWithWheel",!1);c(this,"elementFilter");c(this,"visible",!0);c(this,"pannerPos");c(this,"activeTracking");c(this,"Bp");c(this,"Fp");c(this,"Up");c(this,"vertexMap",{});c(this,"enableWheelZoom");c(this,"eventManager");c(this,"ql");c(this,"uiBindings",[]);c(this,"Ql");c(this,"viewport");c(this,"Bt");c(this,"Qr");c(this,"en");c(this,"xr");c(this,"eh")}destroy(){this.panzoom.destroy(),this.eventManager.off(this.pannerElement,me,this.Qr),this.canvasElement.parentNode.removeChild(this.canvasElement),this.pannerElement.parentNode.removeChild(this.pannerElement),this.lassoElement.parentNode&&this.lassoElement.parentNode.removeChild(this.lassoElement),this.eventManager.off(window,RO,this.eh),F(this.containerElement,nm),F(this.containerElement,im),this.Kl&&(this.eventManager.off(this.Tr,ze,this.Ql),this.Tr.parentNode.removeChild(this.Tr)),this.uiBindings.forEach(e=>this.ui.unbind(e[0],e[1])),this.ui.model.unbind(Mr,this.ql),this.Bt&&xh(this.containerElement,this.Bt),this.panzoom=null}Cx(e){}Px(e){}ae(e,t){let n=t.bind(this);this.uiBindings.push([e,n]),this.ui.bindUnchecked(e,n)}initialise(e,t){this.ui=e,this.activeTracking=t.activeTracking!==!1,this.Bp=t.clickToCenter!==!1,this.wheelReverse=this.wheelReverse||this.ui.$wheelReverse===!0,this.Fp=t.showLasso!==!1,this.Up=t.trackSelection!==!1,this.Qr=this.downListener.bind(this),this.en=this.moveListener.bind(this),this.xr=this.upListener.bind(this),this.containerElement=t.container,this.pannerElement=Jh({position:qe,width:jr,height:jr,left:0,top:0,clazz:RP},this.containerElement),this.canvasElement=Jh({position:Sv,width:jr,height:jr,left:0,top:0,clazz:_P},this.containerElement),this.lassoElement=Jh({position:qe,width:jr,height:jr,left:0,top:0,clazz:LP}),this.suspended=t.suspended===!0,this.Kl=t.collapsible!==!1,this.typeFunction=t.typeFunction,this.Tr=null,this.Is=!1,this.enableWheelZoom=t.enableWheelZoom!==!1,this.wheelSensitivity=t.wheelSensitivity||10,this.elementFilter=t.elementFilter||(o=>!0),this.visible=t.visible!==!1,this.eventManager=new xe,L(this.containerElement,nm),this.Ql=this.toggleCollapsed.bind(this),this.Kl&&(this.Tr=Jh({type:"div"}),this.Tr.className=NP,this.containerElement.appendChild(this.Tr),this.ui.on(this.Tr,ze,this.Ql)),this.viewport=this.ui.viewport,this.panzoom=new La({viewport:this.viewport,viewportElement:this.containerElement,canvasElement:this.canvasElement,elementPositionSetter:(o,s)=>Ne(o,s),wheel:{zoom:!1},enablePan:!1,enableAnimation:!1,idFunction:o=>o.viewportEntry?o.viewportEntry.id:this.ui.k(o),events:{pan:()=>{this.zp()},mousedown:()=>{L(this.pannerElement,Py)},mouseup:()=>{F(this.pannerElement,Py)}},zoomRange:[-1/0,1/0]}),this.eh=ya(()=>{this.$e()},100),this.eventManager.on(window,RO,this.eh),this.enableWheelZoom!==!1&&(this.Bt=this.wheelZoom.bind(this),yh(this.containerElement,this.Bt)),this.pannerElement.style.transformOrigin="0 0",L(this.containerElement,nm),this.eventManager.on(this.pannerElement,me,this.Qr),this.ql=()=>{this.$e(),this.lt(!0),setTimeout(()=>{this.$e(),this.lt(!0)},0)},this.ae(Pn,this.ql),this.setVisible(this.visible),this.ae(Fi,this.$e),this.ae($r,this.$e),this.ae(Vt,this.Vs),this.ae(Mt,o=>{this.activeTracking&&this.Vs(o)}),this.ae(Fr,this.th),this.ae(Bl,this.Ox),this.ae(On,this._x),this.ae(Br,this.Yp),this.ae(Gr,this.Vs),this.ae(Do,o=>{this.activeTracking&&this.Vs(o)}),this.Fp&&(this.ae(cu,o=>{this.canvasElement.appendChild(this.lassoElement),this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width="1px",this.lassoElement.style.height="1px"}),this.ae(du,o=>{this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width=`${o.canvasSize.width}px`,this.lassoElement.style.height=`${o.canvasSize.height}px`}),this.ae(uu,()=>{this.lassoElement.parentElement&&this.lassoElement.parentElement.removeChild(this.lassoElement)})),this.Up&&(this.ui.model.bind(qt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&L(s,_h)}),this.ui.model.bind(Qt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&F(s,_h)}),this.ui.model.bind(ir,o=>{Array.from(this.canvasElement.querySelectorAll(`.${_h}`)).forEach(s=>F(s,_h))}));let n=o=>{this.uiBounds=o.bounds;for(let s in o.positions){let a=o.positions[s],l=this.vertexMap[s];l&&tr(l,a)}this.lt(!0)};return this.ae(On,n),this.ae(Ws,n),this.ae(dS,this.Gn),this.ae(ou,this.Rx),this.ae(Jy,this.Cx),this.ae(Ky,this.Px),this.Lx(),this.Bp&&(L(this.containerElement,IP),this.eventManager.on(this.canvasElement,W,Ae(qy),o=>{let s=o.target.getAttribute(qy);s&&this.vertexMap[s]&&this.ui.centerOn(s)})),!0}reset(){this.wx(),this.panzoom.setZoom(1),this.panzoom.reset(),this.$e()}Xp(e){let t=this.ui.viewport.getElement(e.id);if(t!=null){let n=ft(t);if(e.group){let o=this.ui.viewport.getElement(e.group.id);o!=null&&(n.x-=o.x,n.y-=o.y)}return n}return{x:0,y:0}}Lx(){let e=this.ui.model,t=e.getNodes(),n=e.getGroups();for(let o=0;o<n.length;o++){let s=this.ui.getRenderedElement(n[o]);s!=null&&this.Yp({el:s,id:n[o].id,vertex:n[o],pos:this.Xp(n[o])})}for(let o=0;o<t.length;o++){let s=this.ui.getRenderedElement(t[o]);s!=null&&this.th({el:s,id:t[o].id,vertex:t[o],pos:this.Xp(t[o])})}(n.length>0||t.length>0)&&this.lt(!0)}Yp(e){this.th(e,DP)}$groupCollapsed(e){this.jp(e.modelObject,!1),this.Gn({id:e.id})}$groupExpanded(e){this.jp(e.modelObject,!0),this.Gn({id:e.id})}$vertexRotated(e,t){let n=this.vertexMap[e.id];n!=null&&(n.style.transform="rotate("+t+"deg)",n.style.transformOrigin="50% 50%")}$vertexResized(e,t,n){let o=this.vertexMap[e.id];o!=null&&Rr(o,t,n)}$vertexUpdated(e,t){this.vertexMap[e.id]&&(this.Ms(e),this.lt(!0))}downListener(e){this.panning=!0,this.downAt=Ee(e),this.pannerAtMouseDown=mn(this.pannerElement),this.eventManager.on(document,ae,this.xr),this.eventManager.on(document,se,this.en),ie(e)}moveListener(e){if(this.zoomingWithWheel=!1,this.panning){let t=Ee(e),n=t.x-this.downAt.x,o=t.y-this.downAt.y,s={x:this.pannerAtMouseDown.x+n,y:this.pannerAtMouseDown.y+o};this.zp(s),tr(this.pannerElement,s)}}upListener(e){this.panning=!1,this.downAt=null,this.eventManager.off(document,ae,this.xr),this.eventManager.off(document,se,this.en)}wheelZoom(e){ie(e);let t=this.panzoom.mapEventLocation(e);this.ui.panZoom.$setTransformOriginToCanvasPoint(t.x,t.y),this.ui.nudgeWheelZoom(e.normalizedWheelDelta*this.wheelSensitivity*(this.wheelReverse?-1:1),e)}toggleCollapsed(){this.Is=!this.Is,this.Is?L(this.containerElement,im):F(this.containerElement,im),this.lt(!0)}lt(e){this.panzoom&&this.panzoom.zoomToFit({onComplete:this.$e,doNotFirePanEvent:e})}Vs(e){e.dragGroup.forEach(t=>{let n=t.vertex;n&&this.elementFilter(n)===!1||this.Ms(t.element)}),this.lt(!0)}Ox(e){let t=this.vertexMap[e.element.id];e.element.modelObject.members.forEach(o=>{let s=this.vertexMap[o.id];if(s!=null){let a=this.ui.getElement(o.id);tr(s,{x:a.x-e.element.x,y:a.y-e.element.y}),Rr(s,a.width,a.height)}});let n=ft(e.element);if(e.element.modelObject.group){let o=this.ui.viewport.getGroupElement(e.element.modelObject.group.id);o&&(n.x-=o.x,n.y-=o.y)}tr(t,n),Rr(t,e.element.width,e.element.height),this.$e()}_x(e){this.uiBounds=this.ui.getViewportBoundsInfo();for(let t in e.positions){let n=e.positions[t],o=this.vertexMap[t];o&&tr(o,n)}this.lt(!0)}Dx(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++){let s=this.vertexMap[n[o].id];s&&t.appendChild(s)}}th(e,t){if(this.elementFilter(e.vertex)===!1)return;let n=e.vertex,o=n.id;if(this.vertexMap[o]!=null)return;let s=e.pos||{x:0,y:0},a=e.size||this.$__getSize(e.id),l=Jh({position:qe,width:a.width+Mn,height:a.height+Mn,left:s.x,top:s.y,clazz:wP+(t?" "+t:"")});if(l.vertex=n,l.viewportEntry=this.ui.getElement(o),this.typeFunction&&l.setAttribute(LO,this.typeFunction(e.vertex)),this.uiBounds=this.ui.getViewportBoundsInfo(),l.setAttribute(qy,o),this.canvasElement.appendChild(l),this.panzoom.add(l),this.vertexMap[o]=l,n.data.rotation!=null&&(l.style.transform="rotate("+n.data.rotation+"deg)",l.style.transformOrigin="50% 50%"),e.vertex.group){let h=this.vertexMap[e.vertex.group.id];h&&(h.appendChild(l),this.panzoom.suspend(e.el))}Y(e.vertex)&&this.Dx(e.vertex,l),this.ui.$_dataLoading||(this.lt(!0),this.$e())}setVisible(e){this.visible=e,this.containerElement.style.display=e?Pr:pt}getPan(){return this.panzoom.getPan()}jp(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++)this.vertexMap[n[o].id].style.display=t?"block":"none"}$__getSize(e){return this.ui.viewport.getElementSize(e)}Gn(e){let t=this.vertexMap[e.id];if(t){let n=e.size||this.$__getSize(e.id);if(t.style.width=n.width+Mn,t.style.height=n.height+Mn,this.$e(),this.typeFunction){let o=e.obj||this.ui.model.getVertex(e.id);o&&t.setAttribute(LO,this.typeFunction(o))}}}invalidate(e){if(e)this.Gn({id:e});else for(let t in this.vertexMap)this.Gn({id:t})}setSuspended(e,t){this.suspended=e,t&&this.$e()}Hp(e,t){let n=this.vertexMap[e.id];n&&(this.panzoom.remove(n),delete this.vertexMap[e.id],n.parentNode.removeChild(n),t||this.lt(!0)),t||this.$e()}$nodeRemoved(e){this.Hp(e,!1)}$groupRemoved(e){let t=e.id;this.vertexMap[t]&&this.Hp(e,!1)}$groupResized(e){this.Gn({id:e.element.id,size:e.newGroupSize}),this.lt(!0)}Ms(e){let t=this.vertexMap[e.id];if(t){let n=e.modelObject.group,o=n==null?{x:0,y:0}:this.ui.getGroupElement(n.id);tr(t,{x:e.x-o.x,y:e.y-o.y})}}$groupMemberRemoved(e){let t=this.vertexMap[e.id];t&&(this.canvasElement.appendChild(t),this.Ms(e))}$groupMemberAdded(e){let t=e.modelObject.group;if(t){let n=this.vertexMap[t.id],o=this.vertexMap[e.id];n&&o&&(n.appendChild(o),this.Ms(e))}}wx(){let e;for(let t in this.vertexMap)e=this.vertexMap[t],this.panzoom.remove(e),delete this.vertexMap[t],e.parentNode.removeChild(e);this.$e()}Rx(e){let t=(e.node||e.group).id,n=this.vertexMap[t];n&&(n.style.display=e.state?"block":"none")}$e(){if(this.ui&&this.panzoom&&!this.suspended){this.uiBounds=this.ui.getViewportBoundsInfo();let e=this.ui.panZoom.getApparentCanvasLocation(),t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom;this.pannerElement.style.width=this.uiBounds.vw+Mn,this.pannerElement.style.height=this.uiBounds.vh+Mn,this.pannerElement.style.transform="scale("+o+")";let s={x:e.x*o,y:e.y*o};this.pannerPos={x:t.x-s.x,y:t.y-s.y},tr(this.pannerElement,this.pannerPos)}}zp(e){if(this.panzoom!=null){this.uiBounds=this.ui.getViewportBoundsInfo(),e=e||mn(this.pannerElement);let t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom,s=(t.x-e.x)/o,a=(t.y-e.y)/o,l=this.ui.setApparentCanvasLocation(s,a);return{x:t.x-l.x*o,y:t.y-l.y*o}}}getRenderedVertex(e){return this.getRenderedElement(e)}getRenderedElement(e){return this.vertexMap[e]}};c(Wn,"type",wO),Wn=Ze([Je(wO)],Wn);var DO="vjs-pan-mode",NO="vjs-zoom-to-fit",IO="vjs-zoom-in",MO="vjs-zoom-out",Qy="vjs-select-mode",VO="vjs-undo",GO="vjs-redo",$O="vjs-clear-dataset",yDe="vjs-selected-mode",zm="vjs-controls",BO="vjs-export-controls",FO="vjs-controls-reset-selection",xDe="vjs-copy-paste-controls";var UO=class{constructor(r){c(this,"ui");this.ui=r.ui}};var NI="Clear dataset?",ex="vjs-selected-mode",YO="vjs-controls-has-selection",zO="can-undo",XO="can-redo",jO="data-undo",HO="data-redo",us="data-mode",kO="data-reset",WO="data-clear",ZO="data-zoom-in",JO="data-zoom-out",KO="data-reset-selection",II="data-vjs-orientation",MI="0 0 32 30",VI="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",GI="0 0 24 24",$I="M18.2848192,17.5777124 L20.8535534,20.1464466 C21.0488155,20.3417088 21.0488155,20.6582912 20.8535534,20.8535534 C20.6582912,21.0488155 20.3417088,21.0488155 20.1464466,20.8535534 L17.5777124,18.2848192 L15.9160251,20.7773501 C15.6899572,21.116452 15.1749357,21.0571624 15.0318354,20.6755617 L12.0318354,12.6755617 C11.8811067,12.2736185 12.2736185,11.8811067 12.6755617,12.0318354 L20.6755617,15.0318354 C21.0571624,15.1749357 21.116452,15.6899572 20.7773501,15.9160251 L18.2848192,17.5777124 L18.2848192,17.5777124 Z M17.2312404,17.0782479 L19.4104716,15.6254271 L13.3544004,13.3544004 L15.6254271,19.4104716 L17.0782479,17.2312404 C17.0974475,17.2011742 17.1201804,17.1727128 17.1464466,17.1464466 C17.1727128,17.1201804 17.2011742,17.0974475 17.2312404,17.0782479 L17.2312404,17.0782479 Z M5.5,3 C5.77614237,3 6,3.22385763 6,3.5 C6,3.77614237 5.77614237,4 5.5,4 C4.67157288,4 4,4.67157288 4,5.5 C4,5.77614237 3.77614237,6 3.5,6 C3.22385763,6 3,5.77614237 3,5.5 C3,4.11928813 4.11928813,3 5.5,3 Z M8.5,4 C8.22385763,4 8,3.77614237 8,3.5 C8,3.22385763 8.22385763,3 8.5,3 L10.5,3 C10.7761424,3 11,3.22385763 11,3.5 C11,3.77614237 10.7761424,4 10.5,4 L8.5,4 Z M13.5,4 C13.2238576,4 13,3.77614237 13,3.5 C13,3.22385763 13.2238576,3 13.5,3 L15.5,3 C15.7761424,3 16,3.22385763 16,3.5 C16,3.77614237 15.7761424,4 15.5,4 L13.5,4 Z M8.5,21 C8.22385763,21 8,20.7761424 8,20.5 C8,20.2238576 8.22385763,20 8.5,20 L10.5,20 C10.7761424,20 11,20.2238576 11,20.5 C11,20.7761424 10.7761424,21 10.5,21 L8.5,21 Z M3,8.5 C3,8.22385763 3.22385763,8 3.5,8 C3.77614237,8 4,8.22385763 4,8.5 L4,10.5 C4,10.7761424 3.77614237,11 3.5,11 C3.22385763,11 3,10.7761424 3,10.5 L3,8.5 Z M3,13.5 C3,13.2238576 3.22385763,13 3.5,13 C3.77614237,13 4,13.2238576 4,13.5 L4,15.5 C4,15.7761424 3.77614237,16 3.5,16 C3.22385763,16 3,15.7761424 3,15.5 L3,13.5 Z M3,18.5 C3,18.2238576 3.22385763,18 3.5,18 C3.77614237,18 4,18.2238576 4,18.5 C4,19.3284271 4.67157288,20 5.5,20 C5.77614237,20 6,20.2238576 6,20.5 C6,20.7761424 5.77614237,21 5.5,21 C4.11928813,21 3,19.8807119 3,18.5 Z M21,10.5 C21,10.7761424 20.7761424,11 20.5,11 C20.2238576,11 20,10.7761424 20,10.5 L20,8.5 C20,8.22385763 20.2238576,8 20.5,8 C20.7761424,8 21,8.22385763 21,8.5 L21,10.5 Z M21,5.5 C21,5.77614237 20.7761424,6 20.5,6 C20.2238576,6 20,5.77614237 20,5.5 C20,4.67157288 19.3284271,4 18.5,4 C18.2238576,4 18,3.77614237 18,3.5 C18,3.22385763 18.2238576,3 18.5,3 C19.8807119,3 21,4.11928813 21,5.5 Z",BI="0 0 24 24",FI="M 3.88,20.08 L 3.58,15.46 M 3.58,15.46 L 14.48,0.78 M 14.48,0.78 L 18.25,3.76 M 18.25,3.76 L 7.78,18.2 M 7.7,18.2 L 3.88,20.08 M 3.58,15.46 L 7.76,18.20 M 2,5 V 20.6 M 22,5 V 20.6 M 22,20.6 H 3.94 M 2,5 H 11.2 M 17.6,5 H 22",UI="0 0 24 24",YI="M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5 M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5 M14 5.5a1.5 1.5 0 0 1 3 0v6.5 M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47",zI="0 0 24 24",XI="M2,5 V2 H5 M9,2 H11 M13,2 H15 M19,2 H22 V5 M22,9 V11 M22,13 V15 M22,19 V22 H19 M15,22 H13 M11,22 H9 M5,22 H2 V19 M2,15 V13 M2,11 V9 M9,9 L15,15 M15,9 L9,15",jI="0 0 24 24",HI="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",qO="0 0 32 32",kI="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",WI="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0";function ZI(){return`<i class="${DO}" ${ex} ${us}="${Sr}" title="Pan Mode">
49
- <svg:svg viewBox="${UI}" stroke="currentColor" fill="none"><svg:path d="${YI}"/></svg:svg>
50
- </i>`}function JI(){return`<i class="${NO}" ${kO} title="Zoom To Fit">
51
- <svg:svg viewBox="${MI}" stroke="currentColor" fill="currentColor"><svg:path d="${VI}"/></svg:svg>
52
- </i>`}function KI(){return`<i class="${IO}" ${ZO} title="Zoom In">
53
- <svg:svg viewBox="${qO}" stroke="currentColor" fill="currentColor">
54
- <svg:path d="${kI}" fill="none" stroke-width="2"/>
43
+ </g>`,payload:{text:"Label",scaled:!0},properties:[{id:"fill",label:"Background Color",type:"color",defaultValue:"transparent"},{id:"color",label:"Text Color",type:"color",defaultValue:"#000000"},{id:"text",label:"Text",type:"string",defaultValue:"Text"},{id:"scaled",label:"Scaled",type:"boolean",defaultValue:!0}]},{type:"inverted-right-triangle",label:"Right Triangle",template:'<polygon points="{{width}} {{height}} {{width}} 0 0 {{height}}"/>'},{type:"hexagon",label:"Hexagon (pointy)",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*1732/6000}} {{width}} {{height-(height*1732/6000)}} {{width/2}} {{height}} 0 {{height-(height*1732/6000)}} 0 {{height*1732/6000}}"/>'},{type:"hexagon-flat",label:"Hexagon (flat)",square:!0,template:'<polygon points="0 {{height/2}} {{width*1732/6000}} {{height}} {{width-(width*1732/6000)}} {{height}} {{width}} {{height/2}} {{width-(width*1732/6000)}} 0 {{width*1732/6000}} 0"/>'},{type:"octagon",label:"Octagon",square:!0,template:'<polygon points="{{width * 293 / 1000}} 0 {{width * 707 / 1000}} 0 {{width}} {{height * 293 / 1000}} {{width}} {{height * 707 / 1000}} {{width * 707 / 1000}} {{height}} {{width * 293 / 1000}} {{height}} 0 {{height * 707 / 1000}} 0 {{height * 293 / 1000}}"/>'},{type:"pentagon",label:"Pentagon",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*343/1000}} {{width*793/1000}} {{height*904/1000}} {{width*206/1000}} {{height*904/1000}} 0 {{height*343/1000}}"/>'},{type:"parallelogram",label:"Parallelogram",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width}} 0 {{width * 7 / 8}} {{height}}"/>'},{type:"trapezoid",label:"Trapezoid",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width * 7 / 8}} 0 {{width}} {{height}}"/>'},{type:"cross",label:"Cross",template:'<path d="M 0 {{height*3/10}} L 0 {{height * 7/10}} L {{width *3/10}} {{ height * 7/10}} L {{width *3/10}} {{height}} L {{width *7/10}} {{height}} L {{width*7/10}} {{height*7/10}} L {{width}} {{height * 7/10}} L {{width}} {{height*3/10}} L {{width *7/10}} {{height*3/10}} L {{width*7/10}} 0 L {{width*3/10}} 0 L {{width*3/10}} {{height*3 /10}} Z"/>'},{type:"l-shape-bl",label:"L Shape (Bottom left)",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} {{height / 2}} L {{width/2}} {{height/2}} L {{width/2}} 0 Z"/>'},{type:"l-shape-br",label:"L Shape (Bottom right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L {{width/2}} 0 L {{width/2}} {{height/2}} L 0 {{height/2}} L 0 {{height}} Z"/>'},{type:"l-shape-tl",label:"L Shape (Top left)",template:'<path d="M 0 0 L 0 {{height}} L {{width/2}} {{height}} L {{width/2}} {{height / 2}} L {{width}} {{height/2}} L {{width}} 0 Z"/>'},{type:"l-shape-tr",label:"L Shape (Top right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L 0 0 L 0 {{height/2}} L {{width/2}} {{height/2}} L {{width/2}} {{height}} Z"/>'},{type:"u-shape",label:"U Shape",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} 0 L {{width*2/3}} 0 L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} 0 Z"/>'},{type:"inverted-u-shape",label:"U Shape (Inverted)",template:'<path d="M 0 0 L {{width}} 0 L {{width}} {{height}} L {{width*2/3}} {{height}} L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} {{height}} L 0 {{height}} Z"/>'}]};var _a=class extends rd{constructor(e){super();this.ui=e}getViewportPositionById(e){return this.ui.viewport.getPosition(e)}getSize(e){return this.ui.$getSize(e)}};var Ag=class extends _a{constructor(e){super(e);this.uiCore=e}filter(e){return e.group==null}getElements(){let e=this.uiCore.getNodes();return Array.prototype.push.apply(e,this.uiCore.getGroups()),e=e.filter((t,n,o)=>t.group==null),e}};var Sg=class extends _a{constructor(e,t){super(t);this.group=e;this.ui=t}getElements(){return this.group.getMembers()}filter(e){return(Y(e)||K(e))&&e.group==this.group}};var Tg=class{constructor(r){this.ui=r}transformGeometry(r,e,t){let n=this.ui.getRenderedConnection(r.id);return n!=null&&r.geometry!=null?je.transformGeometry(n.connector,r.geometry,e,t):r.geometry}getCoordinates(r,e){let t=this.ui.viewport.getElement(r.id);return{x:t.x,y:t.y,width:t.width,height:t.height}}};var vg=class extends $u{constructor(e){super(e.model);this.ui=e;c(this,"transformer");this.transformer=new Tg(this.ui)}$getCopyDataTransformer(){return this.transformer}paste(e){return e=e||{},e.event&&(e.origin=this.ui.mapEventLocation(e.event)),super.paste(e)}};function Un(i){return Wr(i)&&i.useHTMLElement!==!0}function co(i){return i.isSimpleShape}function aI(i,r){i.canvas&&(i.canvas.style.display=r?"block":"none")}function lI(i){i.canvas&&i.canvas.parentNode.removeChild(i.canvas),delete i.canvas}function ds(i,r){if(i.useHTMLElement&&r.containerType!=="SVG"){let e=Ch.getElement(r,i,i.connection);return L(e,r.labelOverlayClass),e}else return ls(r,i),i.textElement}function Oa(i,r){return Ch.getElement(r,i,i.connection,e=>{let t=i.create(e,e.edge,r,r.model);return L(t,r.overlayClass),t})}var Ra=class extends Ip{constructor(e,t,n,o,s,a){var l;super(e,t,n,o,a);c(this,"$suspendRendering");c(this,"clipboard");c(this,"$shapeLibrary");c(this,"$_propertyMapper");c(this,"M");c(this,"Tl");c(this,"zu");c(this,"Dn");c(this,"dr");c(this,"Ge");c(this,"ur");c(this,"Yu");c(this,"ye");c(this,"Xu",[`[${_v}='true']`]);c(this,"vl");c(this,"ju",new Set([oh,qo,Qo,op,Qi,sp,os]));c(this,"it",null);c(this,"Yi",[]);if(o=o||{},a=a||{},this.ye=new xe,this.clipboard=new vg(this),this.M=s,this.containerType=eg(this.getContainer()),this.Yu=a.hoverEvents!==!1,this.ur=xh,this.Tl=this.createRenderer("node",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.zu=this.createRenderer("group",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.vl=(l=o.dragOptions)==null?void 0:l.canDrop,o.edges!=null&&o.edges.propertyMappings!=null&&(this.$_propertyMapper=new Hp(this,{edgeMappings:o.edges.propertyMappings})),this.Dn=[],this.ku(),this.on(n,"animationend",z(eo,es),h=>{let d=h.target;d.style.animation=null,F(d,Cy)}),a.resizeObserver!==!1&&!this.$_useModelForSizes)try{this.Ge=new ResizeObserver(h=>{window.requestAnimationFrame(()=>{if(!this.$_dataLoading){let d=[];h.forEach(u=>{if(u.borderBoxSize!=null&&u.borderBoxSize.length>0){let p=this.$getAttribute(u.target,gt);if(p!=null){let g={width:u.borderBoxSize[0].inlineSize,height:u.borderBoxSize[0].blockSize},m=this.viewport.getElement(p);m!=null&&(m.width!==g.width||m.height!==g.height)&&d.push(this.$getManagedElement(p))}}}),d.forEach(u=>this.$revalidateManagedElement(u)),this.$relayoutOnResize&&d.length>0&&this.relayout()}})})}catch(h){U("WARN: ResizeObserver could not be attached.")}if(o.shapes!=null)if(o.shapes.library==null&&o.shapes.sets==null)U('Render option "shapes" passed to UI but no "library" or "sets" value is present. Shape library is not enabled.');else{o.shapes.library!=null?this.$shapeLibrary=o.shapes.library:this.$shapeLibrary=new Pa(o.shapes.sets,o.shapes);let h=this.getShapeLibrary().getShapeTagDefinition(o.useSvgContainer===!0,o.shapes.strokeWidth||2,o.shapes.showLabels,o.shapes.font,o.shapes.labelAttribute,o.shapes.defaultFillColor,o.shapes.defaultOutlineColor,o.shapes.defaultColor);this.registerTag(o.shapes.tagName||HP,h),this.Jf(),this.Kf()}}$syncManagedElementWithView(e,t){let n=e.el,o=s=>{if((K(e.modelObject)||Y(e.modelObject))&&e.modelObject.group){let a=this.getGroupElement(e.modelObject.group.id),l=this.$_getGroupContentAreaInfo(e.modelObject.group.id);s.x-=a.x+l.internalOffset.x,s.y-=a.y+l.internalOffset.y}};if(wt(n.parentElement)){let s=Me(e,e.c,e.r);o(s),mn(n,s),xi(n,e.r)}else{xi(n,e.r);let s=ft(e);o(s),Ie(n,s)}t&&(this.$repaintUIElement(e),this.se(s=>s.$vertexSynced(e)))}$addTransferrableVertexAttributes(e){e.forEach(t=>this.ju.add(t))}$enableVertexDrag(){this.dr.$enable()}$disableVertexDrag(){this.dr.$disable()}$canDrop(e,t,n){return this.vl!=null?this.vl(e,t,n):!0}addElementEventFilter(e){this.Xu.push(e)}$vertexRendered(e,t,n,o){super.$vertexRendered(e,t,n,o),this.M.usesWrapperElement&&t.firstElementChild!=null&&this.ju.forEach(s=>{t.firstElementChild.hasAttribute(s)&&(t.setAttribute(s,t.firstElementChild.getAttribute(s)),t.firstElementChild.removeAttribute(s))})}$createDefaultLayoutAdapter(){return new Ag(this)}$createGroupLayoutAdapter(e){return new Sg(e,this)}$startPanRepeat(e,t,n,o,s,a){U("startPanRepeat not implemented in BrowserUI. Subclasses should implement.")}$stopPanRepeat(){U("stopPanRepeat not implemented in BrowserUI. Subclasses should implement.")}Jf(){this.it=this.getShapeLibrary().getSvgDefsElement(),this.it.style.position="absolute",this.it.style.width="1px",this.it.style.height="1px",this.it.style.left="-10000px",this.it.style.top="-10000px",this.getContainer().appendChild(this.it)}Kf(){this.$shapeLibrary&&this.$shapeLibrary.getShapeSets().forEach(t=>{t.shapes.forEach(n=>{var o,s;n.objectType===se.objectType&&n.members!=null&&((o=n.members.nodes)==null||o.forEach(a=>a.category=a.category||t.id),(s=n.members.groups)==null||s.forEach(a=>a.category=a.category||t.id),this.model.addGroupTemplate(`${t.id}:${n.type}`,n.members))})})}qf(e,t,n){let s=["edge",t].join(":");if(n.Qf=e,e.events[t]!=null)try{e.events[t]({e:n,overlay:e})}catch(a){U("WARN: VisuallyJs overlay event threw exception "+a)}this.zi(t,s,e.connection,n,e)}$isAsynchronousRender(){return this.M.asynchronous===!0}$isDraggingSupported(){return!1}$removeElement(e){e!=null&&e.parentNode&&e.parentNode.removeChild(e)}$appendElement(e,t,n){t&&(n?t.insertBefore(e,t.firstElementChild):t.appendChild(e))}$setElementVisible(e,t){e.style.display=t?Pr:pt}$doVertexUpdated(e){this.M.reactive===!1&&this.M.update(e.el,e.modelObject.data,e.modelObject,this)}$graphClearStart(){this.vertexList.forEach(e=>{let t=this.$getManagedElement(e.id);t!=null&&this.M.cleanupVertex(e.id,t.el)}),super.$graphClearStart()}$appendElementToContainer(e,t){this.$appendElement(e,this.fe,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.fe,t)}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.getContainer(),t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendEdgeElement(e,t){this.$appendElementToVertexLayer(e,t)}$getAssociatedElements(e){let t=[];if(e.nodeType!==3&&e.nodeType!==8){let n=e.querySelectorAll(xh);Array.prototype.push.apply(t,n)}return t.filter(n=>n.nodeType!==3&&n.nodeType!==8)}$getClassFromElement(e){return ZC(e)}$addClassToElement(e,t){L(e,t)}$elementHasClass(e,t){return gn(e,t)}$removeClassFromElement(e,t){F(e,t)}$toggleClassOnElement(e,t){cy(e,t)}$updateElementClasses(e,t,n){Xt(e,t,n)}$setAttribute(e,t,n){e.setAttribute(t,n)}$getAttribute(e,t){return e.getAttribute(t)}$setAttributes(e,t){for(let n in t)e.setAttribute(n,t[n])}$removeAttribute(e,t){e.removeAttribute&&e.removeAttribute(t)}on(e,t,n,o){let s=a=>{o==null?this.ye.on(a,t,n):this.ye.on(a,t,n,o)};return Bn(e)?e.forEach(a=>s(a)):s(e),this}off(e,t,n){return Bn(e)?e.forEach(o=>this.ye.off(o,t,n)):this.ye.off(e,t,n),this}trigger(e,t,n,o,s){this.ye.trigger(e,t,n,o,s)}$getOffsetRelativeToRoot(e){return io(e)}ey(e,t,n){function o(l){return l.offsetParent||l.parentNode}let s=e!==n&&o(e)!==n?o(e):null,a=l=>{l!=null&&l!==document.body&&!isNaN(l.scrollTop)&&!isNaN(l.scrollLeft)&&(l.scrollTop>0||l.scrollLeft>0)&&(t.x-=l.scrollLeft,t.y-=l.scrollTop)};for(;s!=null;){let l=En(s)||{x:0,y:0};t.x+=l.x,t.y+=l.y,a(s),s=o(s)===n?null:o(s)}}$getElementPositionInUIRelativeToCanvasOrigin(e,t){let n=e.el,o={x:0,y:0};if(this.containerType==="SVG"){let s=ig(n,this.getContainer(),!0);if(H(e.modelObject)){let a=this.getElement(e.modelObject.parent.id);if(a.r!==0){let l=ig(a.el,this.getContainer(),!0),h={x:l.x+a.width/2,y:l.y+a.height/2},d=Me(h,l,a.r);return Me(s,d,-a.r)}}else if(e.r!==0){let a={x:s.x+t.width/2,y:s.y+t.height/2},l=Me(a,s,e.r);return Me(s,l,-e.r)}return s}else{if(n.namespaceURI===Gt){let l=n.closest(we);l!=null&&l!==n&&(o=ig(n,l,!0),n=l)}let s=this.getContainer(),a=En(n,t);if(this.ey(n,a,s),s!=null&&!isNaN(s.scrollTop)&&!isNaN(s.scrollLeft)&&(s.scrollTop>0||s.scrollLeft>0)){let l=n.offsetParent!=null?this.$getStyle(n.offsetParent,hy):Cv,h=this.$getStyle(n,hy);h!==qe&&h!==Rf&&l!==qe&&l!==Rf&&(a.x-=s.scrollLeft,a.y-=s.scrollTop)}return{x:a.x+o.x,y:a.y+o.y}}}$setElementSizeInUI(e,t,n){Rr(e,t,n)}$setElementWidth(e,t){bP(e,t)}$setElementHeight(e,t){AP(e,t)}$getSize(e){return Je(e)}$setElementRotation(e,t){xi(e,t)}$setVisibleElementRotation(e,t){xi(e.el,t),this.se(n=>n.$vertexRotated(e,t))}$getElementPositionInUIRelativeToParent(e){return En(e)}$getElementPositionInWindow(e){return e.getBoundingClientRect()}$getStyle(e,t){return typeof window.getComputedStyle!==vA?getComputedStyle(e,null).getPropertyValue(t):e.currentStyle[t]}$getGroupContentAreaElement(e){let t=this.$getSelector(e,zC);return t&&t.length>0?t[0]:this.M.usesWrapperElement&&e.childElementCount>0?e.firstElementChild:e}$getSelector(e,t){return JC.apply(null,arguments)}$setViewportElementPosition(e,t){e.r!==0?wt(e.el.parentElement)?SP(e,t):Ie(e.el,t):Ie(e.el,t)}setDraggable(e,t){let n=this.getObjectInfo(e,!1);n.obj&&(t?this.$removeAttribute(n.el,oh):this.$setAttribute(n.el,oh,Pt))}isDraggable(e){let t=this.$getAttribute(e,oh);return t==null||t===ct}toggleDraggable(e){let t=this.isDraggable(e);return this.setDraggable(e,!t),!t}zi(e,t,n,o,s,a){let l=n.edge;if(!l.transient||a){let h={obj:l,e:o,model:this.model,ui:this,connection:n,overlay:s,def:null},d=this.view.getEdgeDefinition(this.model.getEdgeType(l.data));d&&d.events&&d.events[e]?d.events[e](h):e===W&&this.$edgeTap(h),this.fireUnchecked(t,h)}}$edgeTap(e){}getLabelLocationAttribute(e){return this.view.getEdgeDefinition(this.model.getEdgeType(e.data||{})).labelLocationAttribute||Ff}As(e,t){let o=Bt(ss(t),$n,this.getContainer(),!0).jtk.overlay;o&&this.qf(o,e,t)}ny(e){this.As(Xe,e)}iy(e){this.As($o,e)}ly(e){this.As(W,e)}hy(e){this.As(Yr,e)}Ss(e,t,n){if(!n.defaultPrevented&&n.Qf==null){let o=Bt(ss(n),Jr,this.getContainer(),!0);this.zi(e,t,o.jtk.connection,n,null)}}uy(e){this.Ss(Xe,RS,e)}py(e){this.Ss($o,LS,e)}my(e){this.Ss(W,IS,e)}gy(e){this.Ss(Yr,wS,e)}Hu(e,t){let o=Bt(ss(t),$n,this.getContainer(),!0).jtk.overlay;o&&this.Wu(o.connection,e,t)}Ey(e){this.Hu(!0,e)}fy(e){this.Hu(!1,e)}Wu(e,t,n){if(e&&!e.edge.transient){let o=n.toElement,s=n.target;if(o!=null&&o!==s){if(o.getAttribute(Qe)===e.edge.id)return;let h=o.closest(".vjs-connector");if(h!=null&&h.getAttribute(Qe)===e.edge.id)return;let d=o.closest(".vjs-overlay");if(d!=null&&d.getAttribute(Qe)===e.edge.id)return}this.$setConnectorHover(e,t),t?(Xt(e.sourceElement,[Iy]),Xt(e.targetElement,[My])):(Xt(e.sourceElement,[],[Iy]),Xt(e.targetElement,[],[My]));let a=t?st:ot,l=t?du:cu;this.zi(a,l,e,n,null)}}Zu(e,t){var o;let n=ss(t).parentNode;this.Wu((o=n.jtk)==null?void 0:o.connection,e,t)}yy(e){this.Zu(!0,e)}by(e){this.Zu(!1,e)}Ju(e,t){let n=ss(t).parentNode;if(n.jtk&&n.jtk.connection){let o=t.target;if(!o.classList.contains(so)&&!o.classList.contains(ao)){let s=e?le:ge,a=e?DS:zl;this.zi(s,a,n.jtk.connection,t,null)}}}Ay(e){this.Ju(!0,e)}Sy(e){this.Ju(!1,e)}Ty(e){let t=ss(e).parentNode;t.jtk&&t.jtk.connection&&this.zi(At,NS,t.jtk.connection,e,null)}vy(e){let t=e.target,n=this.getModelObjectFromElement(t,!0,!1);if(n!=null)return this.Xu.find(s=>Bt(t,s,n.el,!0))!=null?null:{el:n.el,obj:n.obj,e,model:this.model,ui:this}}pr(e,t,n){if(!e.defaultPrevented){let o=this.vy(e);if(o!=null){let s=K(o.obj)?this.getNodeDefinition(o.obj):Y(o.obj)?this.getGroupDefinition(o.obj):H(o.obj)?this.getPortDefinition(o.obj):null;s&&s.events&&s.events[t]&&s.events[t](o),this.fireUnchecked(n,o)}}}Cy(e){this.pr(e,Xe,AS)}Py(e){this.pr(e,$o,SS)}Oy(e){this.pr(e,W,OS)}_y(e){this.pr(e,Yr,TS)}Ry(e){this.pr(e,At,_S)}Ly(e){this.pr(e,ot,vS)}wy(e){this.pr(e,st,CS)}Dy(e){this.pr(e,ae,PS)}Ny(e){let t=this.getModelObjectFromElement(e.target.closest(".vjs-group"),!0,!1);t!=null&&Y(t.obj)&&this.toggleGroup(t.obj)}Iy(e,t,n){let o=n.bind(this);this.Dn.push({eventName:e,handler:o}),this.ye.on(this.getContainer(),e,t,o)}addDragHandler(e){this.dr==null?this.Yi.push(e):this.dr.addHandler(e)}Vy(){this.dr!=null&&this.dr.destroy(),this.Yi=this.Yi||[],this.dr=new cg(this.fe,{translate:e=>this.fromPageLocation(e.x,e.y),init:e=>this.Ku(e)}),this.Yi.forEach(e=>this.dr.addHandler(e)),this.Yi.length=0}Ku(e){}snapPageLocationToGrid(e,t,n){let o=this.fromPageLocation(e,t),s=he(o,n);return this.toPageLocation(s.x,s.y)}$getNodesInViewport(){return this.Ts(ce.objectType,this.getContainer())}$getGroupsInViewport(){return this.Ts(se.objectType,this.getContainer(),e=>this.$getGroupContentAreaElement(e))}$isTouchDevice(){return Gn()}$isArrayLike(e){return super.$isArrayLike(e)||Bn(e)}Ts(e,t,n){let o=t.getBoundingClientRect(),s={};return Object.values(this.viewport.getElements()).filter(l=>{if(l.modelObject.objectType===e){let h=n?n(l.el):l.el;return s[l.modelObject.id]=h.getBoundingClientRect(),tt(s[l.modelObject.id],o)}else return!1}).map(l=>({el:l,bb:s[l.id]}))}ku(){if(this.Dn!=null){this.Cl();let e=[[Xe,$n,this.ny],[$o,$n,this.iy],[W,$n,this.ly],[Yr,$n,this.hy],[Xe,Jr,this.uy],[$o,Jr,this.py],[W,Jr,this.my],[Yr,Jr,this.gy],[Xe,this.ur,this.Cy],[$o,this.ur,this.Py],[W,this.ur,this.Oy],[Yr,this.ur,this._y],[W,XC,this.Ny],[At,Jr,this.Ty],[le,Jr,this.Ay],[ge,Jr,this.Sy],[At,xh,this.Ry]];this.Yu===!0&&e.push.apply(e,[[st,Jr,this.yy],[ot,Jr,this.by],[st,$n,this.Ey],[ot,$n,this.fy],[ot,this.ur,this.Ly],[st,this.ur,this.wy],[ae,this.ur,this.Dy]]),e.forEach(t=>{this.Iy(t[0],t[1],t[2])})}}Cl(){let e=this.getContainer();e&&this.Dn!=null&&(this.Dn.forEach(t=>{this.ye.off(e,t.eventName,t.handler)}),this.Dn.length=0)}setContainer(e){if(e===document||e===document.body)throw new Error("Cannot set document or document.body as container element");this.Cl(),this.$setAttribute(e,ay,$().replace("-",""));let t=this.getContainer();t!=null&&(t.removeAttribute(ay),Array.from(t.childNodes).filter(o=>o!=null&&(gn(o,ua)||gn(o,pa)||o.getAttribute&&o.getAttribute(gt)!=null)).forEach(o=>{e.appendChild(o)})),super.setContainer(e),this.containerType=eg(e),this.ye!=null&&(this.Vy(),this.ku())}reset(){super.reset(),this.Ge&&this.Ge.disconnect(),this.getContainer().querySelectorAll([xh,Jr,$n].join(",")).forEach(n=>n.parentNode&&n.parentNode.removeChild(n))}destroy(){this.it!=null&&this.it.parentNode!=null&&this.it.parentNode.removeChild(this.it),this.Cl(),super.destroy()}$__unmanage(e,t,n){this.Ge!=null&&this.Ge.unobserve(e),super.$__unmanage(e,t,n)}$addOverlayClass(e,t){if(co(e))Ph(this,e).map(n=>L(n,t));else if(Un(e))ls(this,e).map(n=>L(n,t));else if(Wr(e))L(ds(e,this),t);else if(pn(e))L(Oa(e,this),t);else throw"Could not add class to overlay of type ["+e.type+"]"}$removeOverlayClass(e,t){if(co(e))Ph(this,e).map(n=>F(n,t));else if(Un(e))ls(this,e).map(n=>F(n,t));else if(Wr(e))F(ds(e,this),t);else if(pn(e))F(Oa(e,this),t);else throw"Could not remove class from overlay of type ["+e.type+"]"}getGroupDefinition(e){return this.Pl(this.view.getGroupDefinition(this.model.getNodeType(e.data)))}getPortDefinition(e){return this.Pl(this.view.getPortDefinition(this.model.getPortType(e.data)))}getNodeDefinition(e){return this.Pl(this.view.getNodeDefinition(this.model.getNodeType(e.data)))}getVertexDefinition(e){if(Y(e))return this.getGroupDefinition(e);if(H(e))return this.getPortDefinition(e);if(K(e))return this.getNodeDefinition(e)}Pl(e){return e!=null&&e.template&&e.templateId==null&&this.M.addTemplate&&(e.templateId=$(),this.M.addTemplate(e.templateId,e.template)),e}registerTag(e,t){this.M.recado!=null&&this.M.recado.registerTag(e,t)}createRenderer(e,t,n){return(s,a,l,h,d,u)=>{let p=n(a),g=a,m;g=Object.assign({},l?l.parameters||{}:{}),Object.assign(g,a);let E={};for(m in g)g.hasOwnProperty(m)&&g[m]!=null&&(g[m].constructor==Function?E[m]=g[m](a):E[m]=g[m]);if(g=E,l){let y=l.templateId||`vjs-${e}-${p}`;if(l.templateIdResolver&&(y=l.templateIdResolver(g,this,this.model,s)),this.$_useModelForSizes){let x=this.$resolveVertexSizeFromModel(s,l);g[this.$modelWidthAttribute]=x.width,g[this.$modelHeightAttribute]=x.height}d?this.M.rerender(y,g,this.model,e,this,l,s,h,u):this.M.render(y,g,this.model,e,this,l,s,h)}}}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.initialSize!=null)return Object.assign({},a.initialSize)}return this.$_getDefaultSizeForVertex(e,t)}$doRenderNode(e,t){if(this.getElement(e.id)==null){let n=this.getNodeDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.Tl(e,e.data,n,t,!1,null))}}$reRenderNode(e){let t=this.$getManagedElement(e.id);if(t==null)this.$doRenderNode(e);else{let n=this.getNodeDefinition(e);this.Tl(e,e.data,n,null,!0,t.el)}}$doRenderGroup(e,t){if(this.getElement(e.id)==null){let n=this.getGroupDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.zu(e,e.data,n,t,!1,null))}}$paintOverlay(e,t,n){if(co(e))dP(this,e,t,n);else if(Un(e))uP(this,e,t,n);else if(Wr(e)){ds(e,this);let o=t,s=e;this.qu(s,o,e.rotatable!=null)}else if(pn(e)){Oa(e,this);let o=t,s=e;this.qu(s,o,e.rotatable!=null)}else throw"Could not paint overlay of type ["+e.type+"]"}qu(e,t,n){if(e.location===0||e.location===1){let s=(e.location===0?e.connection.anchors.source:e.connection.anchors.target).computedPosition;this.$setAttributes(e.contentElement,{"data-anchor-x":`${s.x}`,"data-anchor-y":`${s.y}`,"data-anchor-ox":`${s.ox}`,"data-anchor-oy":`${s.oy}`})}e.contentElement.style.left=t.d.minx+Mn,e.contentElement.style.top=t.d.miny+Mn,n&&xi(e.contentElement,t.d.rotation||0)}setOverlayVisible(e,t){e.visible=t;function n(o){o!=null&&(t?F(o,lh):L(o,lh))}if(co(e)){let o=e;o.contentElements&&o.contentElements.forEach(n)}else Un(e)?e.contentElements&&e.contentElements.forEach(n):Wr(e)?n(ds(e,this)):pn(e)&&n(Oa(e,this))}$reattachOverlay(e,t){co(e)?Ph(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):Un(e)?ls(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):Wr(e)?this.$appendElement(ds(e,this),this.getContainer()):pn(e)&&this.$appendElement(Oa(e,this),this.getContainer())}$setOverlayHover(e,t){let n;co(e)?n=Ph(this,e):Un(e)?n=ls(this,e):Wr(e)?n=[ds(e,this)]:pn(e)&&(n=[Oa(e,this)]),n!=null&&n.length>0&&(n.forEach(o=>{Xt(o,t?[Ih]:[],t?[]:[Ih])}),this.$setHover(e.connection,t))}destroyOverlay(e){co(e)&&e instanceof ng?yy(e):Un(e)?yy(e):cP(e)?(e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement),delete e.cachedDimensions):pn(e)&&e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement)}$drawOverlay(e,t,n,o){if(co(e))return e.draw(t,n,o);if(Un(e)){let s=mr(t,e.location),a=n.stroke,l=n.stroke,h=n.strokeWidth,d=null;if(e.rotatable!=null){let u=e.location,p=!1;(j(e.location)||e.location<0||e.location>1)&&(u=parseInt(""+e.location,10),p=!0);let g=mr(t,u,p),m=Be(t,u,.01,p);d=bl(yl(g,m)*180/Math.PI),e.rotatable!=="strict"&&d>90&&d<270&&(d=bl(d-180))}return{d:{loc:s,rotation:d},"stroke-width":h,stroke:a,fill:l,xmin:s.x,xmax:s.x,ymin:s.y,ymax:s.y,tail:s}}else if(Wr(e)||pn(e)){let s={x:0,y:0};if(o)s={x:o.x,y:o.y};else{let d=e.location,u=!1;(j(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0),s=mr(t,d,u)}let a=s.x,l=s.y,h=null;if(e.rotatable!=null){let d=e.location,u=!1;(j(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0);let p=mr(t,d,u),g=Be(t,d,.01,u);h=bl(yl(p,g)*180/Math.PI),e.rotatable!=="strict"&&h>90&&h<270&&(h=bl(h-180))}return{d:{minx:a,miny:l,cxy:s,rotation:h},xmin:a,xmax:a,ymin:l,ymax:l,tail:s}}else U("WARN: VisuallyJs - could not draw overlay of type ["+e.type+"]. Overlay type unknown.")}updateLabel(e){let t=ds(e,this),n=e.getLabel();n!=null?(t.innerText=n,t.textContent=n):(t.innerText="",t.textContent="")}$setHover(e,t){e.connector!=null&&this.$setConnectorHover(e,t)}$paintConnector(e,t){jP(this,e,t)}$setConnectorHover(e,t){if(t===!1||!this.$isInMotion&&!this.hoverSuspended){e.$hover=t;let n=e.connector,o=n.canvas;o!=null&&(n.hoverClass!=null&&Xt(o,t?[n.hoverClass]:[],t?[]:[n.hoverClass]),Xt(o,t?[Ih]:[],t?[]:[Ih])),e.hoverPaintStyle!=null&&(e.paintStyleInUse=t?e.hoverPaintStyle:e.paintStyle),Object.values(e.overlays).forEach(s=>{s.cs===ro&&this.setOverlayVisible(s,t)}),this.yt||this.$paintConnection(e)}}$destroyConnector(e){e.connector!=null&&lI(e.connector)}$addConnectorClass(e,t){e.canvas&&L(e.canvas,t)}$removeConnectorClass(e,t){e.canvas&&F(e.canvas,t)}$getConnectorClass(e){return e.canvas?e.canvas.className.baseVal:""}$setConnectorVisible(e,t){aI(e,t)}$applyConnectorType(e,t){if(t.cssClass){let n=Array.isArray(t.cssClass)?t.cssClass:[t.cssClass];e.canvas?L(e.canvas,n.join(" ")):e.classesToAddWhenRendered=n}}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.M.cleanupVertex(e.node.id,t.el),requestAnimationFrame(()=>{this.$relayoutOnVertexRemove&&this.refresh()})),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t)return this.M.cleanupVertex(e.group.id,t.el),requestAnimationFrame(()=>{this.$relayoutOnVertexRemove&&this.refresh()}),t}addClass(e,t){e.constructor===pr?(e.eachVertex((n,o)=>this.addClass(o,t)),e.eachEdge((n,o)=>this.addClass(o,t))):this.Ol(e,t,L)}removeClass(e,t){e.constructor===pr?(e.eachVertex((n,o)=>this.removeClass(o,t)),e.eachEdge((n,o)=>this.removeClass(o,t))):this.Ol(e,t,F)}toggleClass(e,t){e.constructor===pr?(e.eachVertex((n,o)=>this.toggleClass(o,t)),e.eachEdge((n,o)=>this.toggleClass(o,t))):this.Ol(e,t,cy)}hasClass(e,t){if(e!=null){let n=this.getObjectInfo(e,!1);return n.el?gn(n.el,t):oo(e)?gn(e,t):!1}}Ol(e,t,n){let o=s=>{let a=this.getObjectInfo(s,!1);a.el?n(a.el,t):oo(s)&&n(s,t)};e!=null&&(Bn(e)?n(e,t):WC(e)?e.forEach(s=>o(s)):o(e))}$setConnectionVisible(e,t){er.setVisible(e,t)}$manage(e,t,n,o,s,a){return this.getElement(t.getFullId())||(()=>{if(this.containerType==="SVG"&&!wt(e))throw new Error("ERROR: cannot manage non-svg element when container is an SVG element.");let l=super.$manage(e,t,n,o,s,a);return l!=null&&this.Ge!=null&&this.Ge.observe(l.el),l})()}$getModelInfoForDragElement(e,t,n){let o=null,s=null,a=null,l=null,h=null,d=Bt(e,Ae(dn),this.getContainer(),!0)||Bt(e,Ae(te),this.getContainer(),!0);if(d!=null&&(h=this.getModelObjectFromElement(d,!1,n)),h!=null&&!rt(h.obj)){l=h.obj;let u=h.missingPortCreated,p=H(l)?l.getParent():l,g={},m=t?qi:Qi;if(o=e.getAttribute(m)||e.getAttribute(kr),!H(l)){let E=t?[da,Df]:[Qo,op];if(a=e.getAttribute(E[0])||e.getAttribute(E[1])||e.getAttribute(dn)||e.getAttribute(sh),a!=null){let y=l.getPort(a);n?(l=l.$addPort({id:a,type:o}),u=!0):l=y||l}}return H(l)&&(a=l.id,s=this.model.getPortType(l)),o!=null?g=this.view.getPortDefinition(o):g=this.view.getTypeDefinition(l),{vertexEl:d,objEl:this.getModelObjectFromElement(e,!0,!0).el,obj:l,vertex:p,typeDef:g,portType:o||s,portId:a,missingPortCreated:u}}else return null}$isElement(e){return oo(e)}getElementFromEvent(e){let t=Bt(e.target,Ae(gt),this.getContainer(),!0);return t!=null?this.getElement(t.getAttribute(gt)):null}getModelObjectFromElement(e,t,n){let o=s=>{let a;if(s.jtk!=null){if(s.jtk.node!=null)return{obj:s.jtk.node,el:s,missingPortCreated:!1};if(s.jtk.group!=null)return{obj:s.jtk.group,el:s,missingPortCreated:!1};if(s.jtk.port!=null)return{obj:s.jtk.port,el:s,missingPortCreated:!1};if(s.jtk.overlay!=null)return{obj:s.jtk.overlay.connection.edge,el:s,missingPortCreated:!1}}let l=s.getAttribute(te);if(l!=null){let h=this.model.getVertex(l);h!=null&&(a={obj:h,el:s,missingPortCreated:!1})}if(a==null){let h=s.getAttribute(dn)||s.getAttribute(da)||s.getAttribute(Qo);if(h!=null){let d=Bt(s,Ae(gt),this.fe,!1);if(d!=null){let u=d.getAttribute(gt),p=this.model.getNode(u)||this.model.getGroup(u);if(p)if(n){let g=s.getAttribute(kr)||s.getAttribute(qi)||s.getAttribute(Qi)||be;return{obj:p.$addPort({id:h,type:g}),el:s,missingPortCreated:!0}}else{let g=p.getPort(h);return g==null?null:{obj:g,el:s,missingPortCreated:!1}}}}}if(a==null&&t===!0){let h=s.parentElement;return h!=null&&h!==this.fe?o(h):null}else return a};return o(e)}getRenderedPort(e){let n=(H(e)?e.getFullId():e).split(this.model.portSeparator),o=this.getRenderedElement(n[0]);return o?o.querySelector(fi(dn,n[1]))||o.querySelector(fi(Qo,n[1]))||o.querySelector(fi(da,n[1]))||o:null}$isSupportedElement(e){return oo(e)}$afterRefresh(e){}$afterRelayout(e){}$zoomToFit(e){}$zoomToFitIfNecessary(e){}$zoomToElements(e){}$renderTransientVertex(e,t,n,o,s,a){let l=V(we,a,o,s);return Rr(l,t.width,t.height),this.containerType==="SVG"?mn(l,e):Ie(l,e),l}getRenderedElement(e){var a;if(e==null)return null;let n=(j(e)?e:e.getFullId()).split(this.model.portSeparator),o=(a=this.$getManagedElement(n[0]))==null?void 0:a.el;function s(l,h){return o.querySelector(`:scope [${l}="${h}"]:not(:scope [data-vjs-managed] [${l}="${h}"])`)}if(o&&n.length>1){let l=s(dn,n[1])||s(da,n[1])||s(Qo,n[1]);if(l==null){if(this.logicalPorts===!0||o.getAttribute(dn)===n[1]||o.getAttribute(da)===n[1]||o.getAttribute(Qo)===n[1]||o.getAttribute(sh)===n[1]||o.getAttribute(Df)===n[1]||o.getAttribute(op)===n[1])return o}else return l}else return o}getZoom(){return this.currentZoom}getEffectiveVisibleZoom(){return this.getZoom()}getShapeLibrary(){return this.$shapeLibrary}$getEdgePropertyMappings(){var e;return(e=this.$_propertyMapper)==null?void 0:e.getPropertyMappings()}setSuspendRendering(e,t){this.$suspendRendering=e,this.$_setSuspendDrawing(e),t&&this.refresh()}isSuspendRendering(){return this.$suspendRendering}$getCollapsedGroupSize(e,t){let n=this.$computeCollapsedGroupSize(e,t);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.collapsedSize!=null)return Object.assign({},a.collapsedSize)}return super.$getCollapsedGroupSize(e,t)}$drawAdHocEdge(e,t,n,o=[],s,a,l={}){let h=document.createElement("div"),d=e.lineWidth||2,u=e.color||"#000000",p=Math.max(d,Math.abs(n.x-t.x)),g=Math.max(d,Math.abs(n.y-t.y)),m=V(we,{viewBox:`0 0 ${p} ${g}`});m.style.overflow="visible";let E=t.x<n.x?0:p,y=t.y<n.y?0:g,x=t.x>n.x?0:p,f=t.y>n.y?0:g,b=[{x1:E,x2:x,y1:y,y2:f,extents:{xmin:0,ymin:0,xmax:p,ymax:g},type:In,length:0}],A={internalSegments:b,totalLength:0,segmentProportions:[[0,1]],segmentProportionalLengths:[1],paintInfo:{sx:E,sy:y,tx:x,ty:f,so:{x:1,y:0},to:{x:-1,y:0},quadrant:1,x:E,y,w:x-E,h:f-y,startStubX:0,endStubX:0,startStubY:0,endStubY:0,opposite:!1,perpendicular:!1,orthogonal:!1,stubs:[0,0],sourceAxis:"x",isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1}},T=(O,v,_)=>{let[P,I]=j(O)?[O,{}]:[O.type,O.options],C=Oo(I,l,"_");C.location=v,C.direction=_;let R=at.get(this,P,{instance:this},C),w=this.$drawOverlay(R,A,{stroke:u,fill:u});if(R.isSimpleShape){let B=R,N=w;B.contentTags.forEach((M,D)=>{let G=V(M,N.atts[D]);m.appendChild(G)})}else if(Un(R)){let B=R,N=w;B.contentElements.forEach(M=>{mn(M,N.d.loc),m.appendChild(M)})}else if(pn(R)){let B=R,N=w;B.contentElements.forEach(M=>{mn(M,N.d.loc),m.appendChild(M)})}return w};if(s!=null){let O=T(s,0,-1);E=O.tail.x,y=O.tail.y,b[0].x1=E,b[0].y1=y}if(a!=null){let O=T(a,1,1);x=O.tail.x,f=O.tail.y,b[0].x2=x,b[0].y2=f}b[0].length=Math.sqrt(Math.pow(x-E,2)+Math.pow(f-y,2)),A.totalLength=b[0].length;let S=V(q,{stroke:u,"stroke-width":d,"stroke-dasharray":e.dashArray||"",d:`M ${E},${y} L ${x},${f}`});return m.appendChild(S),o.forEach(O=>{let[v,_]=j(O)?[O,{}]:[O.type,O.options],P=Oo(_,l,"_"),I=at.get(this,v,{instance:this},P),C=this.$drawOverlay(I,A,{stroke:u,fill:u});if(I.isSimpleShape){let R=I,w=C;R.contentTags.forEach((B,N)=>{let M=V(B,w.atts[N]);m.appendChild(M)})}else if(Un(I)){let R=I,w=C;R.contentElements.forEach(B=>{mn(B,w.d.loc),m.appendChild(B)})}else if(Wr(I))if(I.useHTMLElement){let R=C,w=I.contentElement;h.appendChild(w),w.style.left=`${R.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${R.d.cxy.y}px)`}else{let R=V(q,C.atts[0]);m.appendChild(R)}else if(pn(I)){let R=C,w=I.create(null,null,this,this.model);w.style.position=qe,w.style.transform="translate(-50%, -50%)",h.appendChild(w),w.style.left=`${R.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${R.d.cxy.y}px)`}}),h.appendChild(m),h}toBack(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;n.el.parentElement.insertBefore(n.el,n.el.parentElement.childNodes[0]),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a)),t&&n.obj.group!=null&&this.toBack(n.obj.group)}}toFront(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;t&&n.obj.group!=null&&this.toFront(n.obj.group,t),n.el.parentElement.insertBefore(n.el,null),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a))}}$setGroupElementSize(e,t){let n=this.getGroupElement(e.id);if(wt(n.el))this.$setElementSizeInUI(n.el,t.width,t.height);else{let o=n.contentArea||n.el;this.$setElementSizeInUI(o,t.width,t.height)}}setMode(e,t){}batch(e){this.setSuspendEvents(!0),this.model.batch(e),this.setSuspendEvents(!1)}setEnabled(e,t){let n=e.getFullId(),o=this.getRenderedElement(n)||this.getRenderedPort(n);return o!=null&&oo(o)&&(t?o.removeAttribute(yr):o.setAttribute(yr,ct)),t}flashVertex(e,t=1e3,n=PP){let o=Array.isArray(e)?e:[e],s=`${n} ${t}ms`;o.forEach(a=>{let l=this.getObjectInfo(a,!1);l.obj&&l.el&&(l.el.style.animation=s,L(l.el,Cy))})}flashSelection(e,t=1e3,n){this.flashVertex(e.getNodes(),t,n),this.flashVertex(e.getGroups(),t,n)}reload(){this.dataSource instanceof pr?this.dataSource.reload():U("VisuallyJs - WARN: UI not rendering a selection, `reload` has no effect. Not fatal.")}};var La=`<div data-vjs-vertex="{{id}}" class="${eo} ${wy}">{{label}}</div>`,hI="<div/>",cI=`<div data-vjs-vertex="{{id}}" class="${es} ${Dy}">{{label}}</div>`,wa=`<svg:rect data-vjs-vertex="{{id}}" class="${eo} ${wy}" x="0" y="0" width="80" height="60"/>`,dI='<svg:rect x="0" y="0" width="100%" height="30"/>',uI=`<svg:rect data-vjs-vertex="{{id}}" class="${es} ${Dy}" x="0" y="0" width="300" height="250"/>`,pI={html:{"vjs-node-default":La,"vjs-group-default":cI,"vjs-port-default":hI},svg:{"vjs-node-default":wa,"vjs-group-default":uI,"vjs-port-default":dI}},l_=(i,r)=>pI[i][r],Cg=class{constructor(r,e,t){c(this,"recado");c(this,"asynchronous",!1);c(this,"reactive",!1);c(this,"usesWrapperElement",!1);c(this,"uicore",null);c(this,"currentVertex",null);if(t=t||{},this.recado=Ar({defaultTemplate:r,templates:t.templates,templateMacros:t.templateMacros,templateResolver:e}),t.tags)for(let n in t.tags)this.registerTag(n,t.tags[n])}render(r,e,t,n,o,s,a,l){this.uicore=o,this.currentVertex=a;let h=this.recado.template(r,e,null,!1,{obj:a,ui:o,model:o.model}),d=h.childNodes[0];o.$vertexRendered(a,d,s,null),h.$recado.mountings.length>0&&this.recado.mounted(h),this.currentVertex=null}rerender(r,e,t,n,o,s,a,l,h){this.Q(h),this.render(r,e,t,n,o,s,a,l)}Q(r){this.recado.remove(r,!0)}cleanupVertex(r,e){this.Q(e)}cleanupPort(r,e){this.Q(e)}addTemplate(r,e){this.recado.addTemplate(r,e)}registerTag(r,e){this.recado.registerTag(r,{template:e.template,rendered:(t,n,o,s)=>{e.rendered&&e.rendered(t,n,o,this.uicore,this.currentVertex)},updated:(t,n,o)=>{e.updated&&e.updated(t,n,o,this.uicore,this.currentVertex)},mounted:e.mounted,fragments:e.fragments})}update(r,e,t,n){if(r.$recado){this.currentVertex=t,this.uicore=n;let o=this.recado.update(r,e,{obj:t});for(let s=0;s<o.removed.length;s++)o.removed[s].el.nodeType!==3&&o.removed[s].el.nodeType!==8&&n.$__unmanage(o.removed[s].el,!1,!0)}}removeElement(r){this.Q(r)}};function Xh(i,r,e){let t=n=>l_(r?"svg":"html",n)||Gy(n)||i;return new Cg(i,t,e)}var gI="pointerdown",mI="pointermove",EI="pointerup",fI="touchstart",h_="touchmove",c_="touchend";function d_(i,r,e,t){return Math.sqrt(Math.pow(e-i,2)+Math.pow(t-r,2))}var Pg=class{constructor(r){c(this,"isPointerDevice");c(this,"isTouchDevice");c(this,"center");c(this,"radius");c(this,"startRadius");c(this,"onPinchStart");c(this,"onPinch");c(this,"onPinchEnd");c(this,"eventManager");c(this,"listenerTypes",{pointer:r=>{let e={},t=[],n=0,o=!1,s=()=>{n===2&&(this.center={x:(t[1].p[0]+t[0].p[0])/2,y:(t[1].p[1]+t[0].p[1])/2},this.radius=d_(t[1].p[0],t[1].p[1],t[0].p[0],t[0].p[1]))},a=d=>{n>=2||o||(t[n]={e:d,p:[d.pageX,d.pageY]},e[""+d.pointerId]=n,n++,s(),n===2&&(this.startRadius=this.radius,this.Yr(this.onPinchStart)))},l=d=>{e[""+d.pointerId]!=null&&(delete e[""+d.pointerId],n--,o=n!==0,this.Qu())},h=d=>{if(o||n!==2)return;let u=e[d.pointerId];u!=null&&(t[u].p=[d.pageX,d.pageY],s(),this.Yr(this.onPinch))};this.bind(r.el,gI,a,{passive:!1}),this.bind(document,EI,l,{passive:!1}),this.bind(document,mI,h,{passive:!1})},touch:r=>{let e=d=>d.touches||[],t=(d,u)=>d.item?d.item(u):d[u],n=d=>{let u=t(d,0),p=t(d,1);return d_(u.pageX,u.pageY,p.pageX,p.pageY)},o=d=>{let u=t(d,0),p=t(d,1);return{x:(u.pageX+p.pageX)/2,y:(u.pageY+p.pageY)/2}},s=!1,a=d=>{let u=e(d);u.length===2&&r.enableWheelZoom!==!1&&(this.center=o(u),this.radius=this.startRadius=n(u),s=!0,this.bind(document,h_,h),this.bind(document,c_,l),oe(d),this.Yr(this.onPinchStart))},l=d=>{s=!1,oe(d),this.unbind(document,h_,h),this.unbind(document,c_,l),this.Qu()},h=d=>{if(s){let u=e(d);u.length===2&&(oe(d),this.radius=n(u),this.center=o(u),this.Yr(this.onPinch))}};this.bind(r.el,fI,a)}});this.eventManager=new xe,this.isPointerDevice="onpointerdown"in document.documentElement,this.isTouchDevice="ontouchstart"in document.documentElement,this.center={x:0,y:0},this.radius=0,this.startRadius=0,this.onPinch=r.onPinch,this.onPinchStart=r.onPinchStart,this.onPinchEnd=r.onPinchEnd,this.isPointerDevice?this.listenerTypes.pointer(r):this.isTouchDevice&&this.listenerTypes.touch(r)}Yr(r){r(this.center,this.startRadius,this.radius,this.radius/this.startRadius)}Qu(){this.onPinchEnd()}bind(r,e,t,n){this.eventManager.on(r,e,t)}unbind(r,e,t){this.eventManager.off(r,e,t)}destroy(){}};var _g=class{constructor(r,e){this.panZoom=r;this.elementPositionSetter=e;c(this,"fixedElements",{})}My(r,e){if(e===ee){let t=r.pos[e];if(r.alignX===yt){let n=Je(r.el);return t-n.width}return t}else{let t=r.pos[e];if(r.alignY===ht){let n=Je(r.el);return t-n.height}return t}}_l(r){let e,t;for(let n in this.fixedElements)if(this.fixedElements.hasOwnProperty(n)){if(e=e||this.panZoom.getApparentCanvasLocation(),t=t==null?this.panZoom.getZoom():t,r!=null&&r!==n)continue;let o=this.fixedElements[n],s=(a,l,h)=>{if(o[a]){let d=this.My(o,l);o.requestedPosition[l]=d,e[l]/t+d<0?h(o.el,-(e[l]/t)):h(o.el,d)}};s(Ze,"x",(a,l)=>{yP(a,l),o.currentPosition.x=l}),s(Te,"y",(a,l)=>{xP(a,l),o.currentPosition.y=l})}}pan(){this._l()}append(r,e,t,n,o){if(r==null)return;let s=r;if(wt(this.panZoom.canvasElement)&&!wt(r))return U("ERROR: cannot add non-svg element to fixed layer when container is an SVG element."),null;t=t||{};let a=this.panZoom.idFunction(r);return this.fixedElements[a]={el:s,left:t.left,top:t.top,pos:e,alignX:t.alignX||Ze,alignY:t.alignY||Te,currentPosition:Object.assign({},e),requestedPosition:Object.assign({},e),id:n},wt(s)||(s.style.position="absolute"),this.elementPositionSetter(s,e),o?this.panZoom.canvasElement.appendChild(r):this.panZoom.canvasElement.insertBefore(r,this.panZoom.canvasElement.childNodes[0]),this._l(a),this.fixedElements[a]}remove(r){let e=this.panZoom.idFunction(r);e&&this.fixedElements[e]&&(this.panZoom.canvasElement.removeChild(this.fixedElements[e].el),delete this.fixedElements[e],this._l())}destroy(){this.panZoom=null,this.fixedElements=null}};var yI="transformOrigin",u_="transform",xI="translateX",bI="translateY",AI="scale",p_="px",SI="vjs-pan-zoom",TI="vjs-pan-zoom-canvas";function us(){}function g_(i){let r=i,e=0,t=0;for(;r!=null;)isNaN(r.scrollLeft)||(e+=r.scrollLeft),isNaN(r.scrollTop)||(t+=r.scrollTop),r=r.parentNode;return{x:e,y:t}}var Da=class{constructor(r){c(this,"canvasElement");c(this,"viewportElement");c(this,"ep");c(this,"Ft");c(this,"eventManager");c(this,"pinchListener");c(this,"position",{x:0,y:0});c(this,"zoom");c(this,"transformOrigin",{x:0,y:0});c(this,"Rl");c(this,"panning",!1);c(this,"aboutToPan",!1);c(this,"Ll");c(this,"pinchZooming",!1);c(this,"zooming",!1);c(this,"zoomingWithWheel",!1);c(this,"downAt");c(this,"Kr");c(this,"Nn");c(this,"zoomRange");c(this,"zoomAtZoomStart");c(this,"maximumZoomTravel",150);c(this,"distanceAtZoomStart");c(this,"lastDistance");c(this,"canvasAtPanStart");c(this,"lastMouseX",-1);c(this,"lastMouseY",-1);c(this,"fixedTransformOrigin",null);c(this,"lastMovedAt",null);c(this,"lastVelocity",0);c(this,"lastAcceleration",0);c(this,"onZoom");c(this,"onMaybeZoom");c(this,"onPan");c(this,"onPanStart");c(this,"onMouseDown");c(this,"onMouseUp");c(this,"onMouseMove");c(this,"onSetTransformOrigin");c(this,"clamp");c(this,"clampZoom");c(this,"enablePan");c(this,"panWithMetaKey");c(this,"enableWheelZoom");c(this,"enableAnimation");c(this,"wheelCssFilterSpec");c(this,"wheelFilter");c(this,"wheelCssFilter");c(this,"wheelZoomRequiresMetaKey");c(this,"wheelDirection");c(this,"wheelSensitivity");c(this,"wheelPan");c(this,"wheelPanAxis");c(this,"background");c(this,"fixedLayer");c(this,"wl");c(this,"Dl");c(this,"Xi");c(this,"Nl");c(this,"Il");c(this,"viewport");c(this,"vs");c(this,"Ge");c(this,"consumeRightClick");c(this,"smartMinimumZoom");c(this,"idFunction");c(this,"enabled");c(this,"clampToBackground");c(this,"clampToBackgroundExtents");c(this,"filter");c(this,"ji",{});c(this,"Vl",!1);c(this,"handlers",{start:(r,e)=>{if(this.pinchZooming)return;(n=>{if(this.enabled){let o=n.srcElement||n.target;return o===this.canvasElement||o===this.viewportElement||o.$jtkDecoration||this.background&&this.background.owns(o)||this.filter(o,n)===!0||n.jy===!0}else return!1})(r)&&(this.$computeCompoundZoom(),this.zoomingWithWheel=!1,this.lastMouseX=-1,this.lastMouseY=-1,r.which===3&&this.enableWheelZoom!==!1&&(r.mozInputSource==null||r.mozInputSource===1)?(this.zooming=!0,this.downAt=Ee(r),this.Kr=this.$_getViewportSize(),this.mr(),this.ap(r),this.canvasAtPanStart=Object.assign({},this.position),this.zoomAtZoomStart=this.zoom):e.length<=1&&this.Xy(r)&&(this.Kr=this.$_getViewportSize(),this.mr(),this.panning=!0,this.aboutToPan=!0,this.downAt=Ee(r),this.canvasAtPanStart=Object.assign({},this.position),oe(r))),this.onMouseDown(r,this)},move:(r,e)=>{let t,n,o;if(this.zoomingWithWheel=!1,!this.pinchZooming){if(this.zooming)o=Ee(r),t=o.x-this.downAt.x,n=o.y-this.downAt.y,this.Fl(t,n,r);else if(this.panning&&this.enablePan&&this.downAt!=null){oe(r),this.aboutToPan&&(this.aboutToPan=!1,this.onPanStart()),o=Ee(r),t=(o.x-this.downAt.x)/this.vs,n=(o.y-this.downAt.y)/this.vs;let s=this.ot({x:this.canvasAtPanStart.x+t,y:this.canvasAtPanStart.y+n,animate:!1});this.onPan(s.x,s.y,this.zoom,this.zoom,r),this.background&&this.background.pan(),this.fixedLayer.pan(),oe(r)}this.onMouseMove(r,this)}},end:(r,e)=>{this.pinchZooming||(this.zooming=!1,this.downAt=null,this.panning=!1,this.aboutToPan=!1,this.Kr=null,this.zoomingWithWheel=!1,this.eventManager.off(document,ae,this.wl),this.eventManager.off(document,le,this.Dl),this.eventManager.on(document,ae,this.Xi),this.onMouseUp(r,this))},[At]:r=>{}});r.events=r.events||{},this.zoom=r.zoom||1,this.zoomRange=r.zoomRange||Uv,this.Rl=r.zoomStep||.25,this.fixedLayer=new _g(this,r.elementPositionSetter),this.eventManager=new xe,this.viewport=r.viewport,this.canvasElement=r.canvasElement,this.Ge=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.mr()})}),this.Ge.observe(this.canvasElement),this.fixedTransformOrigin=r.fixedTransformOrigin,this.ot({x:0,y:0,animate:!1}),this.viewportElement=r.viewportElement,L(this.viewportElement,SI),L(this.canvasElement,TI),new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.$_getViewportSize()})}).observe(this.viewportElement),this.idFunction=r.idFunction,this.onZoom=r.events.zoom||us,this.onMaybeZoom=r.events.maybeZoom||(()=>!0),this.onPan=r.events.pan||us,this.onPanStart=r.events.panStart||us,this.onMouseDown=r.events.mousedown||us,this.onMouseUp=r.events.mouseup||us,this.onMouseMove=r.events.mousemove||us,this.onSetTransformOrigin=r.events.transformOrigin||us,this.clamp=r.clamp!==!1,this.clampZoom=r.clampZoom!==!1,this.panWithMetaKey=r.panWithMetaKey===!0,this.enablePan=r.enablePan!==!1,this.Ll=r.panFilter&&typeof r.panFilter=="function"?r.panFilter:null,this.enableAnimation=r.enableAnimation!==!1;let t=r.wheel||{};this.enableWheelZoom=t.zoom!==!1,this.wheelFilter=t.filter||(()=>!0),this.wheelCssFilterSpec=t.cssFilter,this.wheelZoomRequiresMetaKey=t.useMetaKey===!0,this.wheelDirection=t.reverse===!0?-1:1,this.wheelSensitivity=this.wheelDirection*(t.sensitivity||10),this.wheelPan=t.pan===!0,this.wheelPanAxis=t.axis||"both",this.rp(),this.consumeRightClick=r.consumeRightClick!==!1,this.smartMinimumZoom=r.smartMinimumZoom,this.wl=function(n){this.Ml("move",n)}.bind(this),this.Dl=function(n){this.Ml("end",n)}.bind(this),this.Xi=function(n){this.zoomingWithWheel=!1}.bind(this),this.enabled=r.enabled!==!1,this.clampToBackground=r.clampToBackground,this.clampToBackgroundExtents=r.clampToBackgroundExtents,this.filter=r.filter||(()=>!1),(this.enableWheelZoom||this.wheelPan)&&(this.Ft=(n,o,s,a)=>this.wheelPanOrZoom(n,o,s,a),Ah(this.viewportElement,this.Ft,!0,this.wheelZoomRequiresMetaKey)),this.pinchListener=new Pg({el:this.viewportElement,enableWheelZoom:this.enableWheelZoom,onPinch:(n,o,s,a)=>{this.K(a*this.zoomAtZoomStart);let l=n.x-this.downAt.x,h=n.y-this.downAt.y;this.ot({x:this.canvasAtPanStart.x+l,y:this.canvasAtPanStart.y+h,animate:!1})},onPinchStart:(n,o)=>{this.pinchZooming=!0,this.downAt=n,this.distanceAtZoomStart=this.lastDistance=o,this.zoomAtZoomStart=this.zoom,this.Gl(this.downAt.x,this.downAt.y),this.canvasAtPanStart=Object.assign({},this.position)},onPinchEnd:()=>{this.pinchZooming=!1,this.downAt=null}}),this.K(this.zoom,null,!1,!1,!0),this.$l(),this.background=new Yy,r.background&&this.background.addBackground(r.background),this.Nl=n=>{this.start(n)},this.eventManager.on(this.viewportElement,ge,this.Nl),this.eventManager.on(document,ae,this.Xi),this.Il=n=>{this.Ml(At,n)},this.eventManager.on(this.viewportElement,At,this.Il),this.mr(),this.$computeCompoundZoom()}getCompoundZoom(){return this.vs}$addWheelSelectorFilter(r){r!=null&&r.length>0&&(this.wheelCssFilterSpec=[r,this.wheelCssFilterSpec||""].join(" "),this.rp())}$computeCompoundZoom(r){r=r||this.$_getViewportSize();let e=this.viewportElement.getBoundingClientRect();this.vs=e.width/r.width}$_getViewportSize(){return this.Kr=Je(this.viewportElement),this.Kr}mr(){return this.Nn=Je(this.canvasElement),this.Nn}rp(){this.wheelCssFilterSpec!=null&&this.wheelCssFilterSpec.length>0&&(this.wheelCssFilter=r=>{let e=r.srcElement||r.target;return!$t(e,this.wheelCssFilterSpec)})}Gy(r,e,t,n){n=n||150;let{x:o,y:s}=this.position,a=this.zoom,l=r-a,h=e-o,d=t-s,u=null,p=g=>{u||(u=g);let m=g-u,E=m/n,y=a+E*l,x=o+E*h,f=s+E*d;this.canvasElement.style.transform=`scale(${y}) translateX(${x/y}px) translateY(${f/y}px)`,m<n?requestAnimationFrame(p):(this.zoom=r,this.position={x:e,y:t},this.onPan(e,t,this.zoom,this.zoom))};requestAnimationFrame(p)}ot(r){let e=this.np(r.x,r.y);if(this.enableAnimation&&r.animate)if(r.zoom!=null){let t=this.ip(r.zoom);this.Gy(t,e.x,e.y,r.animationDuration)}else this.position=e,this.op(null,r.onComplete);else this.position=e,this.Bl(),r.onComplete&&r.onComplete(this.position);return this.position}sp(r,e,t,n,o){let s=this.position;return this.ot({x:s.x+r,y:s.y+e,animate:t,onComplete:n,animationDuration:o})}$y(r,e,t,n){n||this.pan(-e*100,-t*100)}By(r,e,t,n){this.zoomAtZoomStart=this.zoom,this.zoomingWithWheel||(this.ap(r),this.zoomingWithWheel=!0),this.Fl(0,r.normalizedWheelDelta*this.wheelSensitivity,r,!0)}wheelPanOrZoom(r,e,t,n){this.wheelFilter(r)&&(this.wheelCssFilter==null||this.wheelCssFilter(r))&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),!this.wheelPan||n?this.By(r,e,t,n):(e=this.wheelPanAxis==="both"||this.wheelPanAxis===ee?e:0,t=this.wheelPanAxis==="both"||this.wheelPanAxis===ye?t:0,this.$y(r,e,t,n)))}Fy(r,e,t){this.canvasElement.animate(r,{duration:e||250}).finished.then(()=>{for(let n in r)this.canvasElement.style[n]=r[n];t&&t(this.position)})}lp(){return`${AI}(${this.zoom}) ${xI}(${this.position.x/this.zoom}${p_}) ${bI}(${this.position.y/this.zoom}${p_})`}Bl(){this.canvasElement.style[u_]=this.lp()}op(r,e){if(this.canvasElement.animate!=null){let t={[u_]:this.lp()};this.Fy(t,r,e)}else this.Bl()}Uy(){return this.fixedTransformOrigin==null?`${this.transformOrigin.x}% ${this.transformOrigin.y}%`:`${this.fixedTransformOrigin.x} ${this.fixedTransformOrigin.y}`}$l(){this.canvasElement.style[yI]=this.Uy()}zy(r,e){let t=this.fromPageLocation(r,e),n=this.Nn||this.mr();return{width:n.width,height:n.height,xy:t,xScale:t.x/n.width,yScale:t.y/n.height,o:{x:t.x/n.width*100,y:t.y/n.height*100}}}hp(r,e,t){let n,o,s,a,l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t;n=-(l*(1-this.zoom)),o=-(h*(1-this.zoom)),this.transformOrigin=r,this.$l(),l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t,s=-(l*(1-this.zoom)),a=-(h*(1-this.zoom));let d=this.sp(s-n,a-o,!1);this.onSetTransformOrigin&&this.onSetTransformOrigin(this.transformOrigin,d)}Gl(r,e){if(this.fixedTransformOrigin==null){let t=this.zy(r,e);this.hp(t.o,t.width,t.height)}}ap(r){if(this.fixedTransformOrigin==null){let e=Ee(r);this.Gl(e.x,e.y)}}$setTransformOriginToCanvasPoint(r,e){if(this.fixedTransformOrigin==null){let t=this.Nn||this.mr();this.hp({x:r/t.width*100,y:e/t.height*100},t.width,t.height)}}ip(r){let e=this.zoomRange[0];if(this.smartMinimumZoom){e=.5;let t=this.getBoundsInfo().minimumFill;r/t<e&&(r=t*e)}else r<e&&(r=e);return r>this.zoomRange[1]&&(r=this.zoomRange[1]),r}K(r,e,t,n,o){if(r==null||isNaN(r)||r<0)return;r=this.ip(r);let s=this.zoom,a=l=>{if(!this.Vl&&(o||this.onZoom(0,0,r,s,e,t),this.background!=null&&this.background.setZoom(r),this.fixedLayer.pan(),this.clampZoom)){let h=this.position,d=this.np(h.x,h.y);(d.x!=h.x||d.y!=h.y)&&this.ot({x:d.x,y:d.y,animate:!1})}};if(n){let l=this.getViewportCenter();this.$setTransformOriginToCanvasPoint(l.x,l.y),this.zoom=r,this.op(null,a)}else this.zoom=r,this.Bl(),a(this.position);return this.zoom}Fl(r,e,t,n){e<-this.maximumZoomTravel&&(e=-this.maximumZoomTravel),e>this.maximumZoomTravel&&(e=this.maximumZoomTravel),this.Yy(this.zoomAtZoomStart,e,-this.maximumZoomTravel,this.maximumZoomTravel,t,n)}Yy(r,e,t,n,o,s){let a=e/(e>=0?n:t),l=e>=0?1:0,h=r+a*(this.zoomRange[l]-r);this.K(h,o,s)}np(r,e,t){if(!this.clamp&&!this.clampToBackground&&!this.clampToBackgroundExtents)return{x:r,y:e};{let n=this.Kr||this.$_getViewportSize(),o=this.st(),s=r,a=e,l=this.clamp?this.getBoundsInfo():{x:0,y:0,width:0,height:0,vw:n.width,vh:n.height,padding:t,minimumFill:1};if(t=0,(this.clampToBackground||this.clampToBackgroundExtents)&&this.background!=null){let m=this.background.getWidth(),E=this.background.getHeight(),y=Math.max(l.x+l.width,m),x=Math.max(l.y+l.height,E);l.width=y-l.width,l.height=x-l.height;let f=l.vw/l.width,b=l.vh/l.height;l.minimumFill=Math.min(f,b),this.clampToBackgroundExtents&&(t=Math.max(l.vw,l.vh))}let h=[l.x+l.width,l.y+l.height];this.background&&(h[0]=Math.max(h[0],this.background.getWidth()),h[1]=Math.max(h[1],this.background.getHeight()));let d=r+o.x+h[0]*this.zoom-t,u=e+o.y+h[1]*this.zoom-t,p=r+o.x+l.x*this.zoom+t,g=e+o.y+l.y*this.zoom+t;return d<0&&(s-=d),p>l.vw&&(s-=p-l.vw),u<0&&(a-=u),g>l.vh&&(a-=g-l.vh),{x:s,y:a}}}st(){let r=this.Nn||this.mr(),e=this.transformOrigin.x/100*r.width,t=this.transformOrigin.y/100*r.height;return{x:e*(1-this.zoom),y:t*(1-this.zoom)}}Xy(r){let e=r.srcElement||r.target;return this.panWithMetaKey&&!(r.metaKey||r.ctrlKey)?!1:this.Ll!=null?this.Ll(e)!==!1:!0}Ml(r,e){r===At&&this.consumeRightClick&&e.preventDefault&&e.preventDefault();let t=is(e);this.handlers[r](e,t)}start(r){this.enabled&&r!=null&&(this.eventManager.off(document,ae,this.Xi),this.eventManager.on(document,ae,this.wl),this.eventManager.on(document,le,this.Dl),this.handlers.start(r,is(r)))}getBoundsInfo(r,e){let t=this.Kr||this.$_getViewportSize();if(this.viewport.isEmpty())return{width:0,height:0,x:0,y:0,vw:t.width,vh:t.height,minimumFill:1,zoom:1};r=r||0,e=e||.9;let n=this.viewport.getTopLevelExtents(),o=n.xmax-n.xmin,s=n.ymax-n.ymin,a=t.width/((o+r*2)/e),l=t.height/((s+r*2)/e),h=Math.min(a,l);return{width:o,height:s,x:n.xmin,y:n.ymin,vw:t.width,vh:t.height,minimumFill:h,zoom:this.zoom}}add(r,e){e&&(r.$jtkDecoration=!0)}suspend(r){let e=typeof r=="string"?r:this.idFunction(r);this.ji[e]=!0}isSuspended(r){let e=typeof r=="string"?r:r.id;return this.ji[e]===!0}restore(r){let e=typeof r=="string"?r:r.id;delete this.ji[e]}remove(r){let e=this.idFunction(r);delete this.ji[e]}reset(){this.ji={},this.ot({x:0,y:0,animate:!1})}zoomToFit(r){r=r||{};let e=this.getBoundsInfo(r.padding,r.fill);r.doNotZoomIfVisible&&e.minimumFill>this.zoom||this.K(e.minimumFill),this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToFitIfNecessary(r){let e=Object.assign(r||{},{});e.doNotZoomIfVisible=!0,this.zoomToFit(e)}zoomToElements(r){let e=this.$_getViewportSize(),t={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:e.width,vh:e.height};for(let o=0;o<r.elements.length;o++){let s=r.elements[o],a=this.viewport.getPosition(this.idFunction(s));a&&(t.x=Math.min(t.x,a.x),t.y=Math.min(t.y,a.y),t.xMax=Math.max(t.xMax,a.x2),t.yMax=Math.max(t.yMax,a.y2))}let n=r.fill||.9;t.width=t.xMax-t.x,t.height=t.yMax-t.y,t.z=n*Math.min(t.vw/t.width,t.vh/t.height),r.doNotZoomIfVisible&&t.z>this.zoom||this.K(t.z),this.centerContent({bounds:t,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToBackground(r){if(r=r||{},this.background!=null){let e=this.background.getWidth(),t=this.background.getHeight(),n=this.$_getViewportSize(),o=n.width/e,s=n.height/t,a=Math.min(o,s),l={width:e,height:t,x:0,y:0,vw:n.width,vh:n.height,padding:0,minimumFill:a,zoom:a};this.K(l.minimumFill),this.centerContent({bounds:l,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}}zoomToExtents(r){let e=Array.isArray(r.extents)?r.extents:[r.extents];if(e.length>0){let t=this.$_getViewportSize(),n={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:t.width,vh:t.height};e.forEach(s=>{n.x=Math.min(n.x,s.x),n.y=Math.min(n.y,s.y),n.xMax=Math.max(n.xMax,s.x+s.width),n.yMax=Math.max(n.yMax,s.y+s.height)});let o=r.fill||.9;n.width=n.xMax-n.x,n.height=n.yMax-n.y,n.z=o*Math.min(n.vw/n.width,n.vh/n.height),r.doNotZoomIfVisible&&n.z>this.zoom||this.K(n.z),this.centerContent({bounds:n,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}}setFilter(r){this.filter=r||(()=>!1)}centerBackground(r){if(this.background!=null){let e=Object.assign({},this.getBoundsInfo());e.x=this.background.getWidth()/2,e.y=this.background.getHeight()/2,e.width=1,e.height=1,this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,vertical:!0,horizontal:!0})}}alignBackground(r,e){if(this.background!=null){let t=r.split(" "),n=t[0]||Ze,o=t[1]||Te,s=this.getBoundsInfo(),a=n===Ze?0:s.vw-this.background.getWidth()*this.zoom,l=o===Te?0:s.vh-this.background.getHeight()*this.zoom,h=this.st();this.ot({x:a-h.x,y:l-h.y,animate:!0,animationDuration:e}),this.background.pan(),this.fixedLayer.pan()}}nudgeZoom(r,e){let t=io(this.viewportElement),n=this.$_getViewportSize(),o=t.x+n.width/2,s=t.y+n.height/2;return this.Gl(o,s),this.K(this.zoom+r,e)}nudgeWheelZoom(r,e){this.zoomAtZoomStart=this.zoom,this.Fl(0,r,e,!0)}alignContent(r){r=r||{};let e=r.bounds||this.getBoundsInfo(),t=this.position;r.zoom&&this.setZoom(r.zoom,!1);let n=this.Nn||this.mr(),o=(1-1/this.zoom)*n.height,s=(1-1/this.zoom)*n.width,a=this.st(),l=e.x*this.zoom+e.width*this.zoom/2,h=e.y*this.zoom+e.height*this.zoom/2,d=e.vw/2-l,u=e.vh/2-h,p=r.padding||10,g=this.position.x,m=this.position.y,E=o*this.transformOrigin.y/100-e.y+p/this.zoom,y=(E-e.height-2*p+e.vh/this.zoom)*this.zoom,x=r.alignY==null?m:r.alignY===ht?y:r.alignY===It?u-a.y:E*this.zoom,f=s*this.transformOrigin.x/100-e.x+p/this.zoom,b=(f-e.width-2*p+e.vw/this.zoom)*this.zoom,A=r.alignX==null?g:r.alignX===yt?b:r.alignX===It?d-a.x:f*this.zoom;this.ot({x:A,y:x,animate:!r.doNotAnimate,animationDuration:r.animationDuration,onComplete:()=>{this.Vl||(r.doNotFirePanEvent||this.onPan(A-t.x,x-t.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan()),r.onComplete&&r.onComplete({x:A,y:x})}})}alignContentTop(r){r=r||{},r.alignY=Te,this.alignContent(r)}alignContentBottom(r){r=r||{},r.alignY=ht,this.alignContent(r)}alignContentLeft(r){r=r||{},r.alignX=Ze,this.alignContent(r)}alignContentRight(r){r=r||{},r.alignX=yt,this.alignContent(r)}centerContent(r){r=r||{},r.alignX=r.horizontal===!1?null:It,r.alignY=r.vertical===!1?null:It,this.alignContent(r)}centerContentHorizontally(r){this.centerContent(Object.assign({horizontal:!0,vertical:!1},r))}centerContentVertically(r){this.centerContent(Object.assign({vertical:!0,horizontal:!1},r))}centerOn(r){let e=Object.assign({},this.getBoundsInfo());Object.assign(e,r.bounds);let t=()=>{this.$setTransformOriginToCanvasPoint(e.x+e.width/2,e.y+e.height/2),r.onComplete&&r.onComplete(e)};this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:t,vertical:r.vertical!==!1,horizontal:r.horizontal!==!1,zoom:r.zoom})}centerOnHorizontally(r){this.centerOn({vertical:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,bounds:r.bounds})}centerOnVertically(r){this.centerOn({bounds:r.bounds,horizontal:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}centerOnAndZoom(r){let e=r.fillRatio||.6,t=r.bounds,n=this.getBoundsInfo(),o=n.vw<n.vh?[n.vw,"width"]:[n.vh,"height"],s=e*o[0],a=s/t[o[1]];a<this.zoomRange[0]&&(a=this.zoomRange[0]),a>this.zoomRange[1]&&(a=this.zoomRange[1]),this.$setTransformOriginToCanvasPoint(t.x+t.width/2,t.y+t.height/2),this.centerOn({bounds:t,zoom:a,doNotAnimate:r.doNotAnimate})}getViewportCenter(){let r=Object.assign({},this.getBoundsInfo()),e=this.st(),t=this.position,n={x:r.vw/2,y:r.vh/2};return{x:(n.x-(t.x+e.x))/this.zoom,y:(n.y-(t.y+e.y))/this.zoom}}setViewportCenter(r){let e=Object.assign({},this.getBoundsInfo()),t=this.st(),n={x:e.vw/2,y:e.vh/2},o={x:-(r.x*this.zoom-n.x+t.x),y:-(r.y*this.zoom-n.y+t.y)};this.ot({x:o.x,y:o.y,animate:!1})}setClamping(r){this.clamp=r}isClamping(){return this.clamp}setZoom(r,e){return this.K(r,null,null,e)}zoomIn(r,e){return this.setTransformOrigin(r.x,r.y),this.K(this.zoom+this.Rl,null,null,e)}zoomOut(r,e){return this.setTransformOrigin(r.x,r.y),this.K(this.zoom-this.Rl,null,null,e)}setZoomRange(r,e){return r!=null&&r.length===2&&r[0]<r[1]&&r[0]!=null&&r[1]!=null&&r[0]>0&&r[1]>0&&(this.zoomRange=r,e||(this.zoom<this.zoomRange[0]||this.zoom>this.zoomRange[1])&&this.K(this.zoom)),this.zoomRange}getZoomRange(){return this.zoomRange}getZoom(){return this.zoom}getPan(){return Object.assign({},this.position)}pan(r,e,t,n){this.sp(r,e,t,o=>{this.onPan(o.x,o.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan(),n&&n(o)})}setPan(r,e,t,n){let o=this.ot({x:r,y:e,animate:t,onComplete:n});return this.onPan(o.x,o.y,this.zoom,this.zoom),o}startPanRepeat(r,e,t,n,o,s){this.stopPanRepeat();let a=()=>{let l=r*t,h=e*n;s&&s({x:l,y:h}),this.pan(l,h,!1)};a(),this.ep=window.setInterval(()=>a(),o)}stopPanRepeat(){window.clearTimeout(this.ep)}setTransformOrigin(r,e){this.transformOrigin={x:r,y:e},this.$l()}fromPageLocation(r,e,t){let n=this.st(),o=this.position,s=g_(this.viewportElement),a=this.viewportElement.getBoundingClientRect(),l=this.getCompoundZoom(),h={x:((r-(a.x+s.x))/l-(o.x+n.x))/this.zoom,y:((e-(a.y+s.y))/l-(o.y+n.y))/this.zoom};return t&&(h.x=Math.round(h.x),h.y=Math.round(h.y)),h}fromWindowLocation(r,e,t){let n=this.st(),o=this.position,s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l={x:((r-s.x)/a-(o.x+n.x))/this.zoom,y:((e-s.y)/a-(o.y+n.y))/this.zoom};return t&&(l.x=Math.round(l.x),l.y=Math.round(l.y)),l}toPageLocation(r,e){let t=this.st(),n=this.position,o=g_(this.viewportElement),s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l=a*(this.zoom*r+(n.x+t.x))+(s.x+o.x),h=a*(this.zoom*e+(n.y+t.y))+(s.y+o.y);return{x:l,y:h}}toViewportLocation(r,e){let t=this.st(),n=this.position,o=this.getCompoundZoom(),s=o*(this.zoom*r+(n.x+t.x)),a=o*(this.zoom*e+(n.y+t.y));return{x:s,y:a}}mapEventLocation(r){let e=Ee(r);return this.fromPageLocation(e.x,e.y)}setEnabled(r){this.enabled=r}getApparentCanvasLocation(){let r=this.st(),e=this.position;return{x:e.x+r.x,y:e.y+r.y}}setApparentCanvasLocation(r,e){let t=this.st(),n=this.ot({x:r-t.x,y:e-t.y,animate:!1});return this.background&&this.background.pan(),this.fixedLayer.pan(),n}getVisibleContentArea(){this.$_getViewportSize();let r=this.getApparentCanvasLocation(),e=this.getBoundsInfo(),t=-r.x/e.zoom,n=-r.y/e.zoom,o=e.vw/e.zoom,s=e.vh/e.zoom;return{x:t,y:n,width:o,height:s}}floatElement(r,e){if(r==null)return;let t=r;t.style.position="absolute",t.style.left=e.x+"px",t.style.top=e.y+"px",this.viewportElement.appendChild(r)}fixElement(r,e,t,n,o){return this.fixedLayer.append(r,e,t,n,o)}unfixElement(r){this.fixedLayer.remove(r)}isInViewport(r,e){let t=this.viewportElement.getBoundingClientRect();return t.x<=r&&r<=t.x+t.width&&t.y<=e&&e<=t.y+t.height}setWheelFilter(r){this.wheelFilter=r||(e=>!0)}addBackground(r){this.background.addBackground(r)}removeBackground(r){this.background.removeBackground(r)}destroy(){this.Ge!=null&&(this.Ge.disconnect(),this.Ge=null),this.Ft!=null&&Sh(this.viewportElement,this.Ft),this.pinchListener.destroy(),this.fixedLayer.destroy(),this.background.destroy(),this.pinchListener=null,this.fixedLayer=null,this.background=null,this.eventManager.off(document,ae,this.Xi),this.eventManager.off(this.viewportElement,ge,this.Nl),this.eventManager.off(this.viewportElement,At,this.Il),delete this.onMaybeZoom,delete this.onPan,delete this.onMouseDown,delete this.onMouseUp,delete this.onMouseMove,delete this.onSetTransformOrigin,this.Vl=!0}isBackgroundElement(r){return this.background==null?!1:this.background.owns(r)}},Yy=class{constructor(){c(this,"backgrounds",[])}addBackground(r){this.backgrounds.push(r)}removeBackground(r){this.backgrounds=this.backgrounds.filter(e=>e!==r)}getWidth(){return Math.max(...this.backgrounds.map(r=>r.getWidth()))}getHeight(){return Math.max(...this.backgrounds.map(r=>r.getHeight()))}setZoom(r,e){this.backgrounds.forEach(t=>t.setZoom(r,e))}owns(r){return this.backgrounds.find(e=>e.owns(r))!=null}pan(){this.backgrounds.forEach(r=>r.pan())}destroy(){this.backgrounds.forEach(r=>r.destroy()),this.backgrounds.length=0}Ut(r){this.backgrounds.forEach(e=>e.Ut(r))}};function CTe(i,r,e,t=500){let n=i.getPan(),o=i.getZoom(),s=performance.now(),a=h=>h<.5?4*h*h*h:1-Math.pow(-2*h+2,3)/2;function l(h){let d=h-s,u=Math.min(d/t,1),p=a(u),g=o+(e-o)*p;i.setZoom(g);let m={x:n.x+(r.x-n.x)*p,y:n.y+(r.y-n.y)*p};i.setPan(m.x,m.y,!0),u<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}var zy={},Og=class{constructor(r,e,t,n){this.adapter=e;this.container=t;this.id=n;c(this,"fixedElements",new Set);c(this,"floatedElements",new Set);c(this,"appendedElements",new Set)}getFixedElement(r){return Array.from(this.fixedElements).find(e=>e.id===r)}getBounds(){let r=1/0,e=-1/0,t=1/0,n=-1/0,o=s=>{let a=En(s.el),l=Je(s.el);r=Math.min(r,a.x),e=Math.max(e,a.x+l.width),t=Math.min(t,a.y),n=Math.max(n,a.y+l.height)};return this.fixedElements.forEach(o),this.floatedElements.forEach(o),this.appendedElements.forEach(o),{x:r,y:t,width:e-r,height:n-t}}clear(){this.appendedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.floatedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.fixedElements.forEach(r=>this.adapter.unfixElement(r.el)),this.appendedElements.clear(),this.floatedElements.clear(),this.fixedElements.clear()}},jh=class extends Og{constructor(e,t,n,o,s,a){super(t,n,o,s);this.methods=e;c(this,"incremental");this.incremental=a===!0}decorate(e){this.methods.decorate(e)}reset(e){this.methods.reset(e)}};function vI(i){return function(e,t,n,o){let s=new i(e,t,n,o);return new jh(s,e,t,n,o,s.incremental)}}var Rg={get:(i,r,e,t,n)=>{let o=zy[i];if(o)return new o(r,e,t,n);throw{message:"VisuallyJs: unknown decorator type '"+i+"'"}},register:(i,r)=>{Zb(r,Og)?zy[i]=r:zy[i]=vI(r)}};function m_(i,r,e){if(i==null)return[];let t=[],n=o=>{let s,a,l,h,d=o;if(typeof d=="string"?(s=d,a={},h=$()):d.type!=null&&(s=d.type,a=d.options||{},h=d.id||$()),s!=null&&a!=null)l=Rg.get(s,a,r,e,h);else{let u=o;h=u.id||$(),u.reset!=null&&typeof u.reset=="function"&&u.decorate!=null&&typeof u.decorate=="function"?l=new jh(u,{},r,e,h,u.incremental):U('Cannot register decorator. Ensure both "reset" and "decorate" methods are provided.')}return l||(U("Decorator ["+s+"] nor registered VisuallyJs. Not fatal."),null)};for(let o=0;o<i.length;o++){let s=n(i[o]);s&&t.push(s)}return t}var Lg=class{constructor(r,e){this.path=r;this.ui=e}getVertexCount(){return this.path.getVertexCount()}getEdgeCount(){return this.path.getEdgeCount()}setVisible(r){this.ui.setVisible(this.path,r)}addVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.addClass(t,r)})}removeVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.removeClass(t,r)})}addEdgeClass(r){this.path.eachEdge((e,t)=>{Zr(this.ui.$_connMap[t.getId()],r)})}removeEdgeClass(r){this.path.eachEdge((e,t)=>{_r(this.ui.$_connMap[t.getId()],r)})}addClass(r){this.addVertexClass(r),this.addEdgeClass(r)}removeClass(r){this.removeVertexClass(r),this.removeEdgeClass(r)}};var E_="default",Gve="center",CI="perimeter",wg=fi(Rv,Pt),PI=fi(qo,Pt);function _I(i){return OI(i,PI)}function OI(i,r){let e=Array.from(i.getContainer().querySelectorAll(r)),t=Array.from(i.getContainer().querySelectorAll(".vjs-surface")),n=[];return t.forEach(o=>{let s=Array.from(o.querySelectorAll(r));n.push(...s)}),e.filter(o=>n.indexOf(o)===-1)}function Dg(i,r,e){return i.$getModelInfoForDragElement(r,e,!0)}function Ng(i,r,e,t,n){let o=null,s=i.getEffectiveVisibleZoom(),a={x:e.x-s*((n==null?void 0:n.x)||0),y:e.y-s*((n==null?void 0:n.y)||0),width:e.width,height:e.height};for(let l=0;l<r.length;l++)if(tt(a,r[l].r)){o=r[l];let h=r[l].modelInfo.typeDef,d=r[l].modelInfo.objEl,u=tg(t,d,s);r[l].positionOnElement=u,h.anchorPositionFinder!=null?r[l].anchor=h.anchorPositionFinder(d,u,o.modelInfo.vertex,h):r[l].anchor=null;break}return o}function RI(i,r,e,t,n,o){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections!==-1&&e.obj.getEdges().length>=e.typeDef.maxConnections)return!1;if(r){let s=o?e.obj:t,a=o?t:e.obj;if(i.model.beforeConnect(s,a,n,!0)===!1)return!1}return!0}function Hh(i,r,e,t,n,o){return f_(i,r,e,!1,t,n,o)}function y_(i,r,e,t,n,o){return f_(i,r,e,!0,t,n,o)}function f_(i,r,e,t,n,o,s){let a=[],l=[];return _I(i).forEach(d=>{if(d.getAttribute(yr)!==ct){if(s!=null&&d.getAttribute(os)!==s)return;let u=Dg(i,d,!1);if(!n&&u.obj===e)return;if(RI(i,r,u,e,o,t)){let p=d.getBoundingClientRect();a.push({modelInfo:u,isGroup:Y(u.obj),r:p,targetEl:d,targetPortType:d.getAttribute(kr)||d.getAttribute(Qi),magnet:d.getAttribute(sp)===Pt}),L(d,xr)}else r&&(d.setAttribute(yr,ct),l.push(d))}}),a.sort((d,u)=>{if(d.isGroup&&!u.isGroup)return 1;if(!d.isGroup&&u.isGroup)return-1;if(d.isGroup&&u.isGroup){if(We(d.modelInfo.vertex,u.modelInfo.obj))return-1;if(We(u.modelInfo.vertex,d.modelInfo.obj))return-1}else return 0}),{dropTargets:a,disabledDropTargets:l}}var Na=class{constructor(r){c(this,"surface");c(this,"container");c(this,"edgeSnap");c(this,"edgeSnapRequiresMagnets");c(this,"edgeSnapSizeThreshold");c(this,"edgeSnapThreshold");c(this,"edgeSnapType");c(this,"allowLoopbackEdges");c(this,"activeFiltering");c(this,"$active",!1);c(this,"rtree");c(this,"disabledDropTargets",[]);c(this,"dropTargets",[]);c(this,"currentDropTarget");this.surface=r.instance,this.container=this.surface.getContainer(),this.activeFiltering=r.activeFiltering===!0,this.allowLoopbackEdges=r.allowLoopbackEdges===!0;let e=r.edgeSnap||{enabled:!1};this.edgeSnap=e.enabled===!0,this.edgeSnapThreshold=e.threshold||50,this.edgeSnapSizeThreshold=e.sizeThreshold||30,this.edgeSnapType=e.type||E_,this.edgeSnapRequiresMagnets=e.requireMagnets===!0,this.surface.bind($r,t=>{this.$active&&requestAnimationFrame(()=>this.$refreshTree(!0))}),this.surface.bind(iu,t=>{this.$active&&this.rtree.has(t.id)&&requestAnimationFrame(()=>this.$refreshTree(!0,t.id))}),this.rtree=new Ho}$refreshTree(r,...e){this.rtree.clear(),this.dropTargets.forEach(t=>{(!this.edgeSnapRequiresMagnets||t.magnet)&&(r&&(e.length===0||e.indexOf(t.modelInfo.obj.id)!==-1)&&(t.r=t.targetEl.getBoundingClientRect()),this.rtree.insert({x:t.r.x,y:t.r.y,width:t.r.width,height:t.r.height,children:[],id:t.modelInfo.obj.id}))})}cp(r,e,t,n){let o=this.rtree.search({x:r.x-e,y:r.y-e,width:e*2,height:e*2});return o.length>0?(o.sort((s,a)=>{let l=Pe(r,{x:s.x+s.width/2,y:s.y+s.height/2}),h=Pe(r,{x:a.x+a.width/2,y:a.y+a.height/2});return Math.sign(l-h)}),Ms(o[0],r,!0)?r:n===CI||n===E_&&(o[0].width>t||o[0].height>t)?Kb(r,o[0]):{x:o[0].x+o[0].width/2,y:o[0].y+o[0].height/2}):r}};function Ig(i){let r=[{x:.5,y:0,ox:0,oy:-1},{x:1,y:.5,ox:1,oy:0},{x:.5,y:1,ox:0,oy:1},{x:0,y:.5,ox:-1,oy:0}].map((e,t)=>[e,Pe(e,i)]);return r.sort((e,t)=>e[1]<t[1]?-1:e[1]>t[1]?1:0),{ox:r[0][0].ox,oy:r[0][0].oy}}var Yn=class{constructor(r,e){this.draggableInstance=r;this.options=e;c(this,"In");c(this,"O",{x:0,y:0});c(this,"Cs",{x:0,y:0});c(this,"Ps",!1);c(this,"ae",null);c(this,"dp");this.dp=e.boundsStrategy||"contained",typeof IntersectionObserver!="undefined"&&(this.In=new IntersectionObserver(t=>{this.options.shouldHandle()&&t.forEach(n=>{this.ae=n.rootBounds,n.isIntersecting?this.qr():this.Ps||this.pp(n.boundingClientRect)})},{root:this.draggableInstance.$getDragViewportContainer(),threshold:.99}))}updateDragElementPosition(r){this.options.shouldHandle()&&(this.ae&&!this.ky(r)?this.pp(r):this.qr())}$updateRootBounds(){this.ae=this.draggableInstance.$getDragViewportContainer().getBoundingClientRect()}Hy(r){return this.ae?!(r.right<this.ae.left||r.left>this.ae.right||r.bottom<this.ae.top||r.top>this.ae.bottom):!0}Wy(r){return this.ae?this.ae.left<r.left&&this.ae.right>r.right&&this.ae.top<r.top&&this.ae.bottom>r.bottom:!0}ky(r){return this.dp==="contained"?this.Wy(r):this.Hy(r)}pp(r){if(!this.ae)return;let e=0,t=0;if(r.x<this.ae.x?e=1:r.x+r.width>this.ae.x+this.ae.width&&(e=-1),r.y<this.ae.y?t=1:r.y+r.height>this.ae.y+this.ae.height&&(t=-1),e===0&&t===0){this.qr();return}(!this.Ps||this.Cs.x!==e||this.Cs.y!==t)&&(this.qr(),this.Cs={x:e,y:t},this.Ps=!0,this.draggableInstance.$startPanRepeat(e,t,this.options.autoPanDelta,this.options.autoPanDelta,this.options.autoPanRepeat,n=>{let o=this.draggableInstance.getEffectiveVisibleZoom();this.O.x+=n.x/o,this.O.y+=n.y/o,this.options.onPan(this.O)}))}qr(){this.draggableInstance.$stopPanRepeat(),this.Ps=!1,this.Cs={x:0,y:0}}reset(){this.O.x=0,this.O.y=0,this.qr()}observe(r){this.In!=null&&this.In.observe(r)}unobserve(r){this.In!=null&&(this.In.unobserve(r),this.qr())}disconnect(){var r;(r=this.In)==null||r.disconnect(),this.qr()}};var Xn="keyup",zn="drag",kh="click",Wh="idle",PCe="dragging",Mg="awaitingClick",Xy="locked",Vg=class extends Na{constructor(e){super(e);c(this,"pageDownAt");c(this,"canvasPositionAtDown");c(this,"currentPagePosition");c(this,"scrollAtPageDown");c(this,"currentSource");c(this,"currentPoints",[]);c(this,"mousemoveHandler");c(this,"tapHandler");c(this,"canvasTapHandler");c(this,"documentKeypressHandler");c(this,"currentMethod",zn);c(this,"currentState",Wh);c(this,"Ul");c(this,"zl");c(this,"Yl");c(this,"Xl");c(this,"transientInfo");c(this,"transientEdge");c(this,"transientConnection");c(this,"transientTargetAnchor");c(this,"u");c(this,"method");c(this,"R");c(this,"O",{x:0,y:0});this.currentMethod=e.method||zn,this.Ul=e.Ul,this.zl=e.zl,this.Yl=e.Yl,this.Xl=e.Xl,this.tapHandler=this.Zy.bind(this),this.mousemoveHandler=this.$i.bind(this),this.canvasTapHandler=this.Jy.bind(this),this.documentKeypressHandler=this.jl.bind(this),this.surface.addDragHandler({selector:wg,start:t=>this.Ky(t),drag:t=>this.qy(t),stop:t=>{this.Qy(t)},usesPageCoordinates:!0,constrainFunction:(t,n,o,s,a,l)=>{if(this.edgeSnap){let h=this.surface.getEffectiveVisibleZoom(),d=h*this.O.x,u=h*this.O.y,p={x:t.x-this.scrollAtPageDown.x-d,y:t.y-this.scrollAtPageDown.y-u},g=this.cp(p,this.edgeSnapThreshold*h,this.edgeSnapSizeThreshold*h,this.edgeSnapType);return{x:g.x+this.scrollAtPageDown.x+d,y:g.y+this.scrollAtPageDown.y+u}}else return t}}),this.surface.on(this.container,W,wg,this.tapHandler),this.surface.addDragSelectorFilter(wg),this.currentMethod===zn&&this.surface.dragOptions.autoPan!==!1&&(this.R=new Yn(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:t=>{this.O.x=t.x,this.O.y=t.y,this.mp()},shouldHandle:()=>!0}))}Q(){this.rtree.clear(),this.dropTargets.forEach(e=>{F(e.targetEl,xr),H(e.modelInfo.obj)&&e.modelInfo.obj.edges.length===0&&e.modelInfo.missingPortCreated&&e.modelInfo.obj.getParent().$removePort(e.modelInfo.obj.id)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(e=>{e.removeAttribute(yr)}),this.disabledDropTargets.length=0,F(document.body,mt),F(document.body,Vy),F(this.surface.rootElement,Fn),this.surface.off(document,ae,this.mousemoveHandler),this.surface.off(this.surface.getContainer(),W,this.canvasTapHandler),document.removeEventListener(Xn,this.documentKeypressHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.targetEl,br),this.currentDropTarget=null),this.transientInfo!=null&&(this.O={x:0,y:0},this.R&&this.R.reset(),this.surface.$removeTransientVertex(this.transientInfo.el)),this.transientConnection=null,this.currentPoints.length=0,this.currentSource=null,this.currentState=Wh}gp(e,t,n,o){var h;let s=n.getAttribute(ip)||((h=e.typeDef)==null?void 0:h.edgeType),a=Ee(t);this.canvasPositionAtDown=this.surface.fromPageLocation(a.x,a.y),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientInfo=this.surface.$addTransientVertex(this.canvasPositionAtDown,{width:10,height:10},{},{position:qe,left:`${this.canvasPositionAtDown.x}px`,top:`${this.canvasPositionAtDown.y}px`},XP);let l=Object.assign({},o||{});if(s!=null&&(l.type=s),this.transientEdge=this.surface.$addTransientEdge(e.obj,this.transientInfo.vertex,l,{targetAnchor:{x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}}),L(this.surface.rootElement,Fn),this.R!=null){this.R.$updateRootBounds();let d=this.transientInfo.el.el.getBoundingClientRect();this.R.updateDragElementPosition(d)}}Ep(e){return this.currentPagePosition={x:e.x,y:e.y},this.mp()}mp(){if(this.currentPagePosition!=null){let e=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),t=this.transientInfo.el.id;this.surface.viewport.$_updatePosition(t,e.x,e.y),this.surface.$repaintUIElement(this.surface.$getManagedElement(t));let n=this.transientInfo.el.el.getBoundingClientRect();return this.surface.fire(KA,this.transientEdge),{x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:n.width,height:n.height}}}fp(e){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections>=0&&e.obj.getEdges().length>=e.typeDef.maxConnections)return{canStart:!1,payload:null};let t=this.surface.model.beforeStartConnect(e.obj,e.obj.type);return t===!1?{canStart:!1,payload:null}:{canStart:!0,payload:Po(t)?{}:t}}Ky(e){if(e.e.which===3||e.e.button===2)return!1;if(this.currentMethod===zn){this.$active=!0;let t=e.el;if(t.getAttribute(yr)!==ct){this.pageDownAt=Object.assign({},e.pagePosition),this.scrollAtPageDown={x:window.scrollX,y:window.scrollY},this.u={};let n=Dg(this.surface,t,!0);if(n!=null){let o=this.fp(n);if(o.canStart){this.currentSource=n.obj,this.u.sourcePortType=t.getAttribute(kr)||t.getAttribute(qi),this.u.edgeType=t.getAttribute(ip)||"";let s=t.getAttribute(os);this.u.scope=s,this.gp(n,e.e,t,o.payload),L(document.body,mt);let a=n.typeDef.allowLoopback===!0||t.getAttribute(wf)===Pt||this.allowLoopbackEdges,l=Hh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);return this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.$refreshTree(),this.surface.$startMotion(),this.surface.fire(JA,this.transientEdge),!0}}}}return!1}kl(){this.surface.$stopPanRepeat()}Hl(e){if(this.transientEdge!=null){oe(e);let t=this.transientEdge.source,n,o;if(this.currentDropTarget!=null)n=this.currentDropTarget.modelInfo.obj,o=tg(e,this.currentDropTarget.targetEl,this.surface.currentZoom),this.u.targetPortType=this.currentDropTarget.targetPortType,this.u.targetAnchor=this.currentDropTarget.anchor,this.u.positionOnTarget=o,this.u.targetAnchor!=null&&this.u.targetAnchor.portId!=null?H(n)?this.u.targetAnchor.portId!==n.id&&(n=n.getParent().$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||be})):(Y(n)||K(n))&&(n=n.$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||be})):this.currentDropTarget.modelInfo.missingPortCreated=!1;else if(this.surface.$isUnattachedEdgeAllowed(this.transientEdge)){let s=Ee(e);n=this.surface.fromPageLocation(s.x,s.y)}else this.surface.fire(QA);this.$_exitTapMode(),n!=null&&this.surface.model.edgeFactory(this.surface.model,this.transientEdge.type,this.transientEdge.data||{},s=>{let a=this.surface.model.$_addEdge({source:t,target:n,data:s,addedByMouse:!0,context:Object.assign({positionOnTarget:o},this.u)},Ro,null);this.surface.fire(qA,a)},()=>{})}}Qy(e){this.kl(),this.surface.$stopMotion(),this.Hl(e.e),this.$active=!1}yp(e,t){this.ex();let n=e();if(this.currentMethod===kh&&this.currentState==Mg){let s=Ee(t);this.Ep(s)}let o=Ng(this.surface,this.dropTargets,n,t,this.O);if(o!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,br),o!=null){if(L(o.targetEl,br),o.anchor!=null)this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0},o.anchor),this.transientConnection.anchors.target.isFixed=!0;else if(o.positionOnElement!=null){let s=Ig(o.positionOnElement);this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},s),this.transientConnection.anchors.target.isFixed=!0}}else delete this.transientConnection.anchors.target.fixedLocation,this.transientConnection.anchors.target.isFixed=!1;this.currentDropTarget=o}$i(e){let t=Ee(e);this.yp(()=>({x:t.x,y:t.y,width:5,height:5}),e)}qy(e){this.yp(()=>{let t=Object.assign({},e.pagePosition),n;if(this.transientInfo!=null)n=this.Ep(t),this.R!=null&&this.transientInfo!=null&&this.R.updateDragElementPosition({left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height,width:n.width,height:n.height,x:n.x,y:n.y});else{let o=this.surface.mapEventLocation(e.e);n={x:o.x,y:o.y,width:5,height:5}}return n},e.e)}ex(){this.transientEdge!=null&&(this.transientConnection=this.transientConnection||this.surface.getRenderedConnection(this.transientEdge.id),this.transientTargetAnchor=this.transientTargetAnchor||this.transientConnection.anchors.target)}Zy(e){if(this.currentMethod===kh&&this.currentState!==Xy){let t=e.target||e.srcElement;if(t.getAttribute(yr)!==ct){let n=Dg(this.surface,t,!0);if(n!=null){if(this.currentState===Wh){oe(e),this.$active=!0,this.pageDownAt=Ee(e),this.u={};let o=this.fp(n);if(o.canStart){this.u.sourcePortType=t.getAttribute(kr)||t.getAttribute(qi),this.u.edgeType=t.getAttribute(ip);let s=t.getAttribute(os);this.u.scope=s,this.currentSource=n.obj,L(document.body,Vy),this.gp(n,e,t,o.payload);let a=n.typeDef.allowLoopback===!0||t.getAttribute(wf)===Pt||this.allowLoopbackEdges,l=Hh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.currentState=Mg,this.surface.on(this.surface.$getCanvasElement(),W,this.canvasTapHandler),this.surface.on(document,ae,this.mousemoveHandler),document.addEventListener(Xn,this.documentKeypressHandler),this.surface.$disableVertexDrag(),this.surface.$startMotion()}}else if(this.currentState===Mg){for(let o=0;o<this.dropTargets.length;o++)if(this.dropTargets[o].modelInfo.obj===n.obj){this.currentDropTarget=this.dropTargets[o];break}this.currentDropTarget!=null&&this.Hl(e),this.$active=!1}}}}}$_exitTapMode(){this.surface.$enableVertexDrag(),this.surface.$stopMotion(),this.Q()}Jy(e){if(!e.defaultPrevented&&this.currentMethod===kh)if(e.which===3||e.button===2)this.$_exitTapMode();else{let t=Ee(e);for(let n=0;n<this.dropTargets.length;n++)Ms(this.dropTargets[n].r,t,!0)&&(this.currentDropTarget=this.dropTargets[n],this.Hl(e),this.$_exitTapMode())}}jl(e){this.currentState===Mg&&(e.keyCode===27||e.key==="Escape")&&this.$_exitTapMode()}};var jy="primed",Hy="idle",ky="active",Gg=class extends Na{constructor(e){super(e);c(this,"Wl");c(this,"Os");c(this,"zt");c(this,"transientVertex");c(this,"currentEdge");c(this,"currentConnection");c(this,"currentIndex");c(this,"R");c(this,"O",{x:0,y:0});c(this,"mouseMoveHandler");c(this,"mouseUpHandler");c(this,"documentKeypressHandler");c(this,"currentPosition");c(this,"currentPagePosition");c(this,"_s",!1);c(this,"Qr");c(this,"Vn");this.Wl=e.inputHandler,this.Os=e.method||zn,this.zt=Hy,this.documentKeypressHandler=this.jl.bind(this),this.mouseMoveHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex){if(this.zt===jy){this.Qr=St({x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.surface.$_proxyEdge(this.currentEdge,this.currentIndex,this.transientVertex.el,this.Qr),this.Vn=this.currentEdge[this.currentIndex];let a=this.currentConnection.connector.canvas;L(this.surface.rootElement,Fn),Xt(a,[Ry],[sg]),this._s=!0,this.zt=ky,this.Wl.currentState=Xy}if(oe(n),this.currentPagePosition=Ee(n),this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),this.edgeSnap){let a=this.surface.getEffectiveVisibleZoom(),l=a*this.O.x,h=a*this.O.y,d={x:this.currentPagePosition.x-l,y:this.currentPagePosition.y-h},u=this.cp(d,this.edgeSnapThreshold*a,this.edgeSnapSizeThreshold*a,this.edgeSnapType);this.currentPagePosition={x:u.x+l,y:u.y+h},this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y,!0)}this.xp();let o={x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:5,height:5},s=Ng(this.surface,this.dropTargets,o,n,this.O);if(s!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,br),s!=null){if(L(s.targetEl,br),s.anchor!=null)this.Qr.fixedLocation=Object.assign({offsetX:0,offsetY:0},s.anchor),this.Qr.isFixed=!0;else if(s.positionOnElement!=null){let a=Ig(s.positionOnElement);this.Qr.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},a),this.Qr.isFixed=!0}}this.currentDropTarget=s,this.R!=null&&this.R.updateDragElementPosition(this.transientVertex.el.el.getBoundingClientRect())}},this.mouseUpHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex)if(oe(n),this._s)if(this.currentPosition=this.surface.fromPageLocation(n.pageX,n.pageY,!0),this.currentDropTarget!=null){let o=this.currentEdge,s=this.currentDropTarget.modelInfo.obj,a=this.currentIndex;this.surface.model.beforeMoveConnection(a===it?s:o.source,a===it?o.target:s,o)===!1?this.Zl():(this.Q(this.currentDropTarget.anchor),a===it?this.surface.model.setSource(o,s):this.surface.model.setTarget(o,s))}else this.Vn.dummy===!0?(this.surface.model.updateVertex(this.Vn,{[this.surface.$modelLeftAttribute]:this.currentPosition.x,[this.surface.$modelTopAttribute]:this.currentPosition.y}),this.Q()):this.Zl();else(this.Os===zn||this.zt===ky)&&this.Q();else this.Q();this.$active=!1};let t=n=>o=>{if(!o.defaultPrevented){let s=Bt(o.target,Ae(Qe),this.container,!1);if(s!=null){if(this.currentEdge=this.surface.model.getEdge(s.getAttribute(Qe)),this.currentEdge.transient)this.$active=!1,this.currentEdge=null,this.zt=Hy;else if(this.Vn=this.currentEdge[n],this.currentConnection=this.surface.getRenderedConnection(this.currentEdge.id),this.currentConnection.detachable||this.Vn.dummy===!0){if(this.$active=!0,this._s=!1,this.currentIndex=n,oe(o),this.O={x:0,y:0},this.currentPagePosition=Ee(o),this.currentPosition=this.surface.fromPageLocation(o.pageX,o.pageY,!0),this.surface.on(document,ae,this.mouseMoveHandler),this.surface.on(document,le,this.mouseUpHandler),this.zt=jy,this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex=this.surface.$addTransientVertex(this.currentPosition,{width:1,height:1},{},{},BP),this.nx(),L(this.currentConnection.connector.canvas,sg),this.Os===kh)document.addEventListener(Xn,this.documentKeypressHandler);else if(this.R!=null){this.R.$updateRootBounds();let a=this.transientVertex.el.el.getBoundingClientRect();this.R.updateDragElementPosition(a)}this.surface.$startMotion(),this.surface.fireUnchecked("edge:relocate:start",this.currentEdge)}}}};this.surface.on(this.container,ge,z(so),t(it)),this.surface.on(this.container,ge,z(ao),t(Pn)),this.Os===zn&&this.surface.dragOptions.autoPan!==!1&&(this.R=new Yn(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:n=>{this.O.x=n.x,this.O.y=n.y,this.xp()},shouldHandle:()=>!0}))}xp(){let e={x:this.currentPosition.x,y:this.currentPosition.y},t={[this.transientVertex.vertex.id]:e};this.surface.$_updateVertexPositions({positions:t,sizes:null,offset:{x:0,y:0},repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.surface.fire(uu,this.currentEdge)}Zl(e){if(e===!0||this.surface.model.beforeDetach(this.currentEdge.source,this.currentEdge.target,this.currentEdge)===!1||this.currentConnection.reattach)this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex),this.surface.$repaintUIElementById(this.currentEdge.source.id),this.Q();else{let n=this.currentEdge.id;this.Q(),this.surface.$isUnattachedEdgeAllowed(this.currentEdge)?this.surface.model.$setEdgeDetached(this.currentEdge,{x:this.currentPosition.x+this.O.x,y:this.currentPosition.y+this.O.y},this.currentIndex):this.surface.model.removeEdge(n)}}Q(e){if(this.rtree.clear(),this.Qr=null,this.dropTargets.forEach(t=>{F(t.targetEl,xr)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(t=>{t.removeAttribute(yr)}),this.disabledDropTargets.length=0,F(document.body,mt),F(this.surface.rootElement,Fn),Xt(this.currentConnection.connector.canvas,[],[Ry,sg]),document.removeEventListener(Xn,this.documentKeypressHandler),this.surface.off(document,ae,this.mouseMoveHandler),this.surface.off(document,le,this.mouseUpHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.modelInfo.objEl,br),this.currentDropTarget=null),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex!=null&&this.surface.$removeTransientVertex(this.transientVertex.el),this.surface.$stopMotion(),this.currentEdge!=null){let t=this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex,e);t&&this.surface.$repaintUIElement(t),this.surface.fireUnchecked("edge:relocate:end",this.currentEdge)}this._s=!1,this.zt=Hy,this.Wl.currentState=Wh,this.Vn=null}nx(){if(this.currentIndex===it){let e=y_(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}else{let e=Hh(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}this.$refreshTree()}jl(e){(this.zt===ky||this.zt===jy)&&(e.keyCode===27||e.key==="Escape")&&this.Zl(!0)}};var Sr="pan",bi="select",ps="disabled",jn="vertexDrawing";var Ia="vjs-anchor-placeholder",_Pe="vjs-anchor-candidate",Wy="vjs-connection-edit",$g="vjs-edge-guideline",Hn="vjs-edge-handle";var Zy=z(Ia),x_=12,b_=15;function Jy(i,r,e,t){let n=V(Q,e||{});L(n,r),t||(n.style.display=pt);let o=V(Fe,Object.assign({cx:`${i/2}`,cy:`${i/2}`,r:`${i/2}`},e||{}));return n.appendChild(o),n}function LI(i,r,e,t,n,o,s){let a=V(Q);L(a,n),s||(a.style.display=pt);let l=V(Z,Object.assign({width:i,height:r,x:"0",y:"0",rx:e,ry:t},o||{}));return a.appendChild(l),a}function A_(i,r,e,t,n,o,s){let a=Jy(t,n,o,s);return i.$appendElementToToolsLayer(a),Ie(a,{x:r,y:e}),a}function S_(i,r,e,t,n,o,s,a,l,h){let d=LI(t,n,o,s,a,l,h);return i.$appendElementToToolsLayer(d),Ie(d,{x:r,y:e}),d}function v_(i,r,e){let t=i.faces,n=[{face:Ze,dist:Math.abs(r.x-e.x),midx:e.x,midy:e.y+e.height/2,x:0,y:.5,ox:-1,oy:0},{face:yt,dist:Math.abs(e.x+e.width-r.x),midx:e.x+e.width,midy:e.y+e.height/2,x:1,y:.5,ox:1,oy:0},{face:Te,dist:Math.abs(r.y-e.y),midx:e.x+e.width/2,midy:e.y,x:.5,y:0,ox:0,oy:-1},{face:ht,dist:Math.abs(e.y+e.height-r.y),midx:e.x+e.width/2,midy:e.y+e.height,x:.5,y:1,ox:0,oy:1}],o=new Map;o.set(Te,[0,-1]),o.set(ht,[0,1]),o.set(Ze,[-1,0]),o.set(yt,[1,0]),n.sort(function(l,h){return l.dist<h.dist?-1:1});let s=null,a=null;for(let l=0;l<n.length;l++)if(t.indexOf(n[l].face)!=-1){s=n[l].face,r={x:n[l].midx,y:n[l].midy},a={x:n[l].x,y:n[l].y,offsetX:0,offsetY:0,ox:n[l].ox,oy:n[l].oy};break}return[a,s]}function C_(i,r,e){let t=kc(r,e,i.locations);return T_(t.p,e)}function P_(i,r,e,t,n,o,s,a){let l=a.getVertexDefinition(n),h=r(e,t,n,l);if(h!=null){let d={x:h.x,y:h.y,ox:h.ox,oy:h.oy,offx:h.offsetX||0,offy:h.offsetY||0,cls:""};return T_(d,o)}}function T_(i,r){let e=i.offsetX==null?0:i.offsetX,t=i.offsetY==null?0:i.offsetY;return Object.assign({curX:r.x+i.x*r.width+e,curY:r.y+i.y*r.height+t,offsetX:e,offsetY:t},i)}var uo=class{constructor(r,e){this.ui=r;c(this,"current");c(this,"currentConnector");c(this,"currentEdge");c(this,"bp");c(this,"ix");c(this,"$generatedGeometry");c(this,"$hasEdits",!1);c(this,"Ap",[]);c(this,"currentOverlays",[]);c(this,"sourceDimensions");c(this,"targetDimensions");c(this,"gr");c(this,"Er");c(this,"Jl");c(this,"fr");c(this,"Rs");c(this,"buttonSize");c(this,"Sp");c(this,"sourceAnchorPositionFinder");c(this,"targetAnchorPositionFinder");c(this,"eventManager");c(this,"Kl");c(this,"yr");c(this,"lx",{});c(this,"xr",{rotation:0,center:{x:0,y:0}});e=e||{},this.buttonSize=e.buttonSize||x_,this.Sp=e.anchorPlaceholderSize||b_,this.fr=!1,this.ui.model.bind(_n,()=>{this.deactivate()}),this.ui.bind(ai,l=>{l.edge==this.currentEdge&&this.Yt()}),this.eventManager=new xe,this.$addDragHandler({selector:Zy+" *",target:Zy,constrainFunction:(l,h,d,u,p,g)=>{let m=h.Ls.anchor,E={x:l.x,y:l.y},y=!1,x=this.yr.managedElement,f={x:x.x,y:x.y,width:x.width,height:x.height};this.xr.rotation!==0&&(y=!0,E=Me(l,this.xr.center,-this.xr.rotation));let b={x:(E.x-f.x)/f.width,y:(E.y-f.y)/f.height},A;if(this.Kl!=null)A=P_(m,this.Kl,x.el,b,this.yr.obj,f,this.current,this.ui),this.$hasEdits=!0;else if(m.isContinuous){let[T,S]=v_(m,E,f);A=T,S!=null&&(m.currentFace=S),this.$hasEdits=!0}else A=C_(m,l,f),this.$hasEdits=!0;return m.fixedLocation=A,m.isFixed=!0,l={x:A.x*f.width,y:A.y*f.height},this.ui.$repaintUIElement(x,null,null,!0),y&&(l=Me(l,this.xr.center,this.xr.rotation)),l},start:l=>{let d=l.el.Ls.vertex;if(this.yr=this.ui.getObjectInfo(d,!1),this.Ap.length=0,this.yr.obj!=null)this.Jl=this.$cloneCurrentGeometry(),this.Kl=this.currentEdge.source.id===this.yr.id?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder,this.xr.rotation=this.ui.$getRotation(d.id),this.xr.rotation!==0&&(this.xr.center={x:this.yr.managedElement.t.c.x,y:this.yr.managedElement.t.c.y});else return!1},stop:l=>{this.Ap.forEach(d=>d.parentNode.removeChild(d));let h=this.$cloneCurrentGeometry();this.$updateModel(h,this.Jl),this.Jl=null,this.yr=null},drag:l=>{this.Yt()}});let t=(l,h)=>{this.hx(l)?h(l):Y(l)&&(We(this.currentEdge.source,l)?h(this.currentEdge.source):We(this.currentEdge.target,l)&&h(this.currentEdge.target))},n=l=>{this.fr&&this.currentEdge&&(l.dragGroup.forEach(h=>{t(h.vertex,d=>{this.ux(d)})}),this.Yt())},o=l=>{this.fr&&this.currentEdge&&l.dragGroup.forEach(h=>{t(h.vertex,d=>this.px(d))})};this.ui.bind(Vt,l=>{o(l)}),this.ui.bind(Mt,l=>{n(l)}),this.ui.bind(Gr,l=>{o(l)}),this.ui.bind(Io,l=>{n(l)});let s=l=>{this.fr&&this.currentEdge&&t(l.vertex,h=>this.Yt())};this.ui.model.bind(Le,s),this.ui.model.bind(ve,s);let a=l=>{this.fr&&this.currentEdge&&l.id===this.currentEdge.id&&this.Yt()};this.ui.bind(uu,l=>{a(l)}),this.ui.model.bind(ln,l=>{a(l.edge)}),this.ui.model.bind(an,l=>{a(l.edge)})}isBusy(){return this.Rs}$cloneCurrentGeometry(){return lt(this.currentConnector.geometry)}Tp(r){return this.ui.view.getTypeDefinition(r).anchorPositions}vp(r,e){let t={type:e.type,options:Object.assign(e.options,{id:$()})};this.currentOverlays.push(this.ui.$addOverlay(r,t)),this.$repaintConnection()}mx(r,e){this.Cp(),e.forEach(t=>{this.vp(r,t)})}Cp(){this.currentOverlays.forEach(r=>{rs(this.current,r.id)})}gx(r){let e=r.deleteButtonClass||ga,t=r.deleteButtonLocation||.1,n=()=>this.ui.model.removeEdge(this.currentEdge),o=()=>{r.onMaybeDelete?r.onMaybeDelete(this.currentEdge,this.current,n):n()};(Array.isArray(t)?t:[t]).forEach(a=>{this.vp(this.current,{type:fr.type,options:{label:"\u2716",location:a,cssClass:e,events:{click:o}}})})}$repaintConnection(r){if(this.current){let e=Object.assign(r||{},{fireEvent:!0});this.ui.$paintConnection(this.current,e),this.Yt(r)}}$updateModel(r,e){this.ui.model.setEdgeGeometry(this.currentEdge,r,e,this.ui)}Yt(r){this.current&&(this.ql(),this.$repaint(r))}ql(){if(this.current){let r=(e,t)=>{let n=e===0?this.current.anchors.source:this.current.anchors.target,o=this.ui.getElement(e===0?this.current.sourceId:this.current.targetId);if((e===0?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder)!=null||n.isDynamic||n.isContinuous){let a=Object.assign({},n.computedPosition),[l,h]=[a.curX-o.x,a.curY-o.y],d;t!=null?d=t:(d=Jy(this.Sp,Ia,{[Qe]:this.currentEdge.id},!0),d.Ls={anchor:n,idx:e,edge:this.currentEdge,vertex:e===0?this.currentEdge.source:this.currentEdge.target}),this.ui.$appendElementToToolsLayer(d);let u=this.ui.$getSize(d),p={x:o.x+(l-u.width/2),y:o.y+(h-u.height/2)};return Ie(d,p),[[o.x,o.y],d]}else return[[0,0],null]};this.ui.$removeElement(this.gr),this.currentEdge.source.dummy||([this.sourceDimensions,this.gr]=r(0,this.gr)),this.ui.$removeElement(this.Er),this.currentEdge.target.dummy||([this.targetDimensions,this.Er]=r(1,this.Er))}}Ex(){this.current&&(this.gr&&(this.gr.parentNode.removeChild(this.gr),delete this.gr.Ls),this.Er&&(this.Er.parentNode.removeChild(this.Er),delete this.Er.Ls)),this.gr=null,this.Er=null,this.sourceDimensions=null,this.targetDimensions=null}fx(){this.current&&ji(this.current)}reset(){this.$hasEdits=!1,this.$generatedGeometry=null,this.deactivate(),this.fx(),this.$clearHandles(),this.ui.$repaintUIElementById(this.current.sourceId),this.ui.$repaintUIElementById(this.current.targetId)}isActive(){return this.fr}$setElementPosition(r,e,t){let n=this.ui.$getSize(r),o=e-n.width/2,s=t-n.height/2;Ie(r,{x:o,y:s})}activate(r,e,t){if(!(this.current!=null&&this.current===e)){if(this.deactivate(),this.current=e,this.currentConnector=this.current.connector,this.currentEdge=r,this.bp=this.ui.model.getEdgeType(r.data),this.ix=this.ui.view.getEdgeDefinition(this.bp),r.geometry==null&&(this.$generatedGeometry=this.ui.$exportEdgeGeometry(r)),t=t||{},this.sourceAnchorPositionFinder=t.anchorPositionFinder,this.targetAnchorPositionFinder=t.anchorPositionFinder,t.anchorPositions!=null)this.sourceAnchorPositionFinder=ma(t.anchorPositions),this.targetAnchorPositionFinder=ma(t.anchorPositions);else{let n=this.Tp(this.currentEdge.source);n!=null&&(this.sourceAnchorPositionFinder=ma(n));let o=this.Tp(this.currentEdge.target);o!=null&&(this.targetAnchorPositionFinder=ma(o))}this.$activate(e,t),t.overlays&&this.mx(e,t.overlays),t.deleteButton===!0&&this.gx(t),this.ql(),Zr(this.current,Wy),this.fr=!0}}deactivate(r){this.current!=null&&(this.Cp(),_r(this.current,Wy),this.Ex()),this.$clearHandles(),this.$hasEdits=!1,this.$generatedGeometry=null,this.fr=!1,this.current=null,this.currentEdge=null,this.sourceAnchorPositionFinder=null,this.targetAnchorPositionFinder=null,this.Rs=!1}$makeAndAppendCircularHandle(r,e,t,n,o,s){let a=A_(this.ui,r,e,t,o,{[Qe]:this.currentEdge.id},s);return this.$setElementPosition(a,r,e),a}$makeAndAppendRectangularHandle(r,e,t,n,o,s,a,l){let h=S_(this.ui,r,e,t,n,o,s,a,{[Qe]:this.currentEdge.id},l);return this.$setElementPosition(h,r,e),h}$makeAndAppendDeleteHandle(r,e,t,n,o,s){let a=this.$makeAndAppendCircularHandle(r,e,t,n,o,s),l=V(et,{x:`${t/2}`,y:`${n/2}`,[Qe]:this.currentEdge.id});return l.innerHTML="\u2716",a.appendChild(l),a}$addDragHandler(r){this.ui.addDragHandler({selector:r.selector,target:r.target,start:e=>{let t=r.start(e);return t!==!1&&(this.Rs=!0),t},drag:e=>r.drag(e),stop:e=>{this.Rs=!1,r.stop(e)},constrainFunction:r.constrainFunction,usesPageCoordinates:r.usesPageCoordinates}),this.lx[r.selector]=r}ux(r){this.ql(),this.$elementDragging(r)}px(r){this.$elementDragged(r)}hx(r){return this.currentEdge==null?!1:r.id===_l(this.currentEdge.source)||r.id===_l(this.currentEdge.target)}};var Lr=new Map;function wI(i,r,e){let t=Lr.get(i);return new t(r,e)}function DI(i){return i.type===jr&&i.constrain===sn?Hi:i.type}var Ma=class{constructor(r,e){this.ui=r;this.ws=e;c(this,"Ql",new Map);c(this,"Pp");c(this,"Xe",!1);c(this,"Mn");c(this,"at");r.bind($i,()=>(this.destroy(),!0)),this.ws=this.ws||{},this.Pp=this.ws.hoverMode===!0,this.ui.model.bind(bt,t=>{this.Mn&&this.Mn.id===t.edge.id&&this.stopEditing()}),this.Pp&&(this.ui.bindUnchecked("edge:relocate:start",t=>{this.Mn&&this.Mn.id===t.id&&(this.Xe=!0,this.stopEditing())}),this.ui.bindUnchecked("edge:relocate:end",t=>{this.Xe=!1}),Ei()&&(this.ui.bind(du,t=>{t.obj.transient||(!this.at||!this.at.isBusy()&&this.at.$supportsHoverMode)&&this.startEditing(t.obj)}),this.ui.bind(cu,t=>{}))),this.ui.$_attachEdgePathEditor(this)}startEditing(r,e){if(!this.Xe){let t=this.Op(r);if(t!=null){let n=t.edge;e=Object.assign({},e||{});let o=DI(t.connector);if(Lr.has(o)){if(this.at=this.Ql.get(o),this.at==null){let s=Object.assign({},this.ws||{});this.at=wI(o,this.ui,s),this.Ql.set(o,this.at)}this.Mn=n,this.at.activate(n,t,e)}else throw new Error("No editor available for connector type ["+o+"]")}}}stopEditing(){this.at&&this.at.deactivate(),this.Mn=null,this.at=null}clearEdits(r){let e=this.Op(r);return e!=null?(ji(e),!0):!1}Op(r){return r==null?null:typeof r=="string"?this.ui.getRenderedConnection(r):Ea(r)?r:this.ui.getRenderedConnection(r.getId())}destroy(){this.stopEditing(),this.Ql.clear()}};function Ky(){}function Zh(i,r){let e=document.createElement("div");return L(e,r.join(" ")),i.appendChild(e),e}var Va=class{constructor(r){c(this,"visibleOrigin",{x:0,y:0});c(this,"size",{width:0,height:0});c(this,"Ds");c(this,"el");c(this,"lt");c(this,"masks",{});c(this,"origin",{x:0,y:0});c(this,"canvasOrigin",{x:0,y:0});c(this,"canvasExtent",{x:0,y:0});c(this,"O",{x:0,y:0});c(this,"Xt");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"onClick");c(this,"hasMoved",!1);c(this,"down",!1);c(this,"moving",!1);c(this,"invert");c(this,"surface");c(this,"mt");c(this,"eventManager");c(this,"eh");c(this,"downListener");c(this,"upListener");c(this,"moveListener");c(this,"downEvent",ge);c(this,"upEvent",le);c(this,"moveEvent",ae);c(this,"enabled",!1);c(this,"th");c(this,"_p");c(this,"xt");c(this,"bx",[".vjs-connector-path",".vjs-connector-outline"]);this.surface=r.surface,this.onStart=r.onStart||Ky,this.onEnd=r.onEnd||Ky,this.onSelect=r.onSelect||Ky,this.onClick=r.onClick||null,this.Ds=r.generateLassoContent,this.eh=r.mapToGrid,this.invert=r.invert===!0,this.downListener=this.en.bind(this),this.upListener=this.Ar.bind(this),this.moveListener=this.rn.bind(this),this.eventManager=new xe,this.th=r.enableInGroups===null?!0:r.enableInGroups,this.yx(r.filter),this.invert?this.xx():this.el=Zh(this.surface.getContainer(),[_P,r.cssClass||""]),this.lt=V(Z,{width:1,height:1,x:0,y:0,fill:"transparent"}),this.eventManager.on(this.surface.$getCanvasElement().parentNode,this.downEvent,this.downListener),this.surface.bind(Rn,e=>{this.down&&this.onClick&&this.onClick(this.visibleOrigin,e)}),this.surface.addVertexDragFilter(e=>this.enabled&&this.th!==!1?e.vertex.objectType===ce.objectType?!0:!(this.th==="metaKey"?e.e.metaKey:!0):!0),r.autoPan!==!1&&(this.Xt=new Yn(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:e=>{this.O.x=e.x,this.O.y=e.y,this.Rp()},shouldHandle:()=>!0}))}Ax(r){let e=r.srcElement||r.target;return this.bx.find(t=>$t(e,t))!=null}yx(r){r==null?this.mt=function(){return!1}:j(r)?this.mt=e=>{let t=e.srcElement||e.target;return $t(t,r)}:this.mt=r}Lp(r,e,t){this.visibleOrigin=r,this.size=e;let n=this.surface.fromPageLocation(r.x,r.y);if(this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+e.width,this.origin.y+e.height),this.invert){let o=window.innerWidth,s=window.innerHeight,a=window.pageXOffset,l=window.pageYOffset,h=s-r.y+l,d=s-h+e.height,u=o-r.x+a,p=o-u+e.width;this.masks.top.style.bottom=h+"px",this.masks.bottom.style.top=d+"px",this.masks.left.style.right=u+"px",this.masks.right.style.left=p+"px",this.masks.top.style.left=o-u+"px",this.masks.top.style.right=o-p+"px",this.masks.bottom.style.left=o-u+"px",this.masks.bottom.style.right=o-p+"px"}else{let o=this.surface.getEffectiveVisibleZoom();tr(this.el,{x:n.x,y:n.y}),Rr(this.el,e.width/o,e.height/o)}if(this.lt.setAttribute("x",`${t.x}`),this.lt.setAttribute("y",`${t.y}`),this.Xt!=null&&this.lt.parentElement!=null){let o=this.lt.getBoundingClientRect();this.Xt.updateDragElementPosition(o)}}Ut(r){let e=r?Pr:pt;this.invert?(this.masks.top.style.display=e,this.masks.left.style.display=e,this.masks.right.style.display=e,this.masks.bottom.style.display=e):this.el.style.display=e,r?this.surface.addClass(document.body,mt):this.surface.removeClass(document.body,mt)}wp(r){return this.eh==null?r:this.eh(r)}en(r){if(this.enabled&&!this.Ax(r)&&!this.mt(r)){oe(r),this.down=!0,this.eventManager.on(document,this.upEvent,this.upListener),this.eventManager.on(document,this.moveEvent,this.moveListener),this.O.x=0,this.O.y=0,this.hasMoved=!1;let e={width:1,height:1};this.origin=this.wp(Ee(r)),this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+e.width,this.origin.y+e.height);let t=this.surface.getElementFromEvent(r);if(!this.invert&&this.Ds){let n=this.Ds(this.origin,r);n!=null?(this._p=n,this.el.replaceChildren(n)):this.el.innerHTML=""}this.Lp(this.origin,e,this.canvasOrigin),this.onStart(this.origin,this.canvasOrigin,r.shiftKey,r,t),this.Xt!=null&&(this.Xt.reset(),this.surface.$appendElementToToolsLayer(this.lt),this.Xt.observe(this.lt))}}Rp(r){if(this.xt!=null){let e=this.surface.fromPageLocation(this.xt.x,this.xt.y),t={x:this.canvasOrigin.x+this.O.x,y:this.canvasOrigin.y+this.O.y},n=this.surface.toPageLocation(t.x,t.y),o={width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)},s={width:Math.abs(this.xt.x-n.x),height:Math.abs(this.xt.y-n.y)},a={x:Math.min(n.x,this.xt.x),y:Math.min(n.y,this.xt.y)},l={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)};o.width>0&&o.height>0&&(this.hasMoved=!0,this.Lp(a,s,e),this.onSelect(a,s,l,o,[n.x<this.xt.x,n.y<this.xt.y],r,this._p))}}rn(r){this.down&&(this.moving||(this.Ut(!0),this.moving=!0),oe(r),this.xt=this.wp(Ee(r)),this.Rp(r.shiftKey))}Ar(r){if(this.down){this.lt.parentElement&&this.lt.parentElement.removeChild(this.lt),this.Xt!=null&&(this.Xt.unobserve(this.lt),this.Xt.reset());let e=this.moving;this.down=!1,this.moving=!1,oe(r),this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener),this.Ut(!1),e&&this.hasMoved&&this.onEnd(this.visibleOrigin,this.size),this.Ds&&(this.el.innerHTML="")}}xx(){this.masks.top=Zh(document.body,[Lh,RP]),this.masks.bottom=Zh(document.body,[Lh,wP]),this.masks.left=Zh(document.body,[Lh,OP]),this.masks.right=Zh(document.body,[Lh,LP])}isActive(){return this.down}setEnabled(r){this.enabled=r}};var Se=class{constructor(){c(this,"tracksEdgeRedraws",!1)}$groupMemberAdded(r){}$groupMemberRemoved(r){}$nodeRemoved(r){}$groupRemoved(r){}$groupResized(r){}$groupCollapsed(r){}$groupExpanded(r){}$vertexRotated(r,e){}$vertexResized(r,e,t){}$vertexRerendered(r){}$vertexUpdated(r,e){}$vertexSynced(r){}$edgeRemoved(r){}$edgeUpdated(r){}$edgeRendered(r){}};var __="logarithmic",O_="absolute";var R_={},po={get:i=>{let r=R_[i];if(r)return r;throw{message:`VisuallyJs: unknown background [${i}]`}},register:(i,r)=>{R_[i]=r}};var Fg=class Fg{constructor(r){c(this,"type",Fg.type);c(this,"canvas");c(this,"onBackgroundReady");c(this,"imagePlaceholder");c(this,"ui");c(this,"image");c(this,"url");this.ui=r.ui,this.canvas=r.canvas,this.onBackgroundReady=r.options.onBackgroundReady||((e,t)=>{}),this.image=r.options.img,this.url=r.options.url,this.imagePlaceholder=new Image,this.imagePlaceholder.onload=()=>{this.canvas.style.backgroundImage="url('"+this.imagePlaceholder.src+"')",this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.width=this.imagePlaceholder.width+"px",this.canvas.style.height=this.imagePlaceholder.height+"px",this.onBackgroundReady(this,r.ui)},this.Gn(r.options)}Gn(r){this.imagePlaceholder.src=this.image?this.image.src:this.url}setUrl(r){this.imagePlaceholder&&(this.imagePlaceholder.src=r)}owns(r){return r===this.canvas}getWidth(){return this.imagePlaceholder&&this.imagePlaceholder.width||0}getHeight(){return this.imagePlaceholder&&this.imagePlaceholder.height||0}setZoom(r,e){}pan(){}destroy(){this.imagePlaceholder=null}Ut(r){}};c(Fg,"type","simple");var Bg=Fg;po.register(Bg.type,Bg);var NI="vjs-background-tile",qy=class{constructor(r,e,t){c(this,"scaledImageSize");c(this,"scaledImageSizeH");c(this,"container");c(this,"zoom");c(this,"specs");c(this,"url");c(this,"urlGenerator");c(this,"apparentZoom");c(this,"xTiles");c(this,"yTiles");c(this,"jt",[]);let n=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.width,o=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.height;this.scaledImageSize=n,this.scaledImageSizeH=o,this.container=document.createElement("div"),this.container.style.position="relative",this.container.style.height="100%",this.container.style.width="100%",this.container.style.display="none",e.canvas.insertBefore(this.container,e.canvas.firstElementChild),this.zoom=t,this.specs=r.getTileSpecs(t),this.url=e.options.url,this.urlGenerator=r.urlGenerator,this.apparentZoom=Math.min(this.specs.xSize,this.specs.ySize),this.xTiles=this.specs.xCount,this.yTiles=this.specs.yCount;for(let s=0;s<this.xTiles;s++){this.jt[s]=this.jt[s]||[];for(let a=0;a<this.yTiles;a++){let l=document.createElement("img");l.Sx=!0,l.className=NI,l.ondragstart=function(){return!1},this.container.appendChild(l),l.style.position="absolute",l.style.opacity=0,this.jt[s][a]=[l,new Image,!1]}}}Tx(r,e,t){return this.url.replace("{z}",r+"").replace("{x}",e+"").replace("{y}",t+"")}vx(r,e,t){return this.urlGenerator==null?this.Tx(r,e,t):this.urlGenerator(r,e,t)}setActive(r){this.container.style.display=r?"block":"none"}Cx(r,e,t,n){r.style.left=t*this.scaledImageSize+"px",r.style.top=n*this.scaledImageSizeH+"px",r.style.width=this.scaledImageSize+"px",r.style.height=this.scaledImageSizeH+"px",e.onload=function(){r.setAttribute("src",e.src),r.style.opacity=1},e.src=this.vx(this.zoom,t,n)}ensureLoaded(r,e,t,n){for(let o=r;o<=t;o++)for(let s=e;s<=n;s++)this.jt[o]!=null&&this.jt[o][s]!=null&&(this.jt[o][s][2]||(this.Cx(this.jt[o][s][0],this.jt[o][s][1],o,s),this.jt[o][s][2]=!0))}},Yg=class Yg{constructor(r){c(this,"type",Yg.type);c(this,"canvas");c(this,"viewport");c(this,"layers",[]);c(this,"currentLayer");c(this,"widgetZoom");c(this,"width");c(this,"height");c(this,"tileSize");c(this,"panDebounceTimeout");c(this,"zoomDebounceTimeout");c(this,"maxZoom");c(this,"ui");c(this,"tiling");c(this,"urlGenerator");c(this,"Dp");c(this,"Np");if(r.options.maxZoom==null)throw new Error("Parameter `maxZoom` not set; cannot initialize TiledBackground");if(!r.options.tileSize)throw new Error("Parameter `tileSize not set; cannot initialize TiledBackground. It should be in the form {w:width, h:height}.");if(!r.options.width||!r.options.height)throw new Error("Parameters `width` and `height` must be set");this.canvas=r.canvas,this.viewport=r.viewport,this.urlGenerator=r.options.urlGenerator,this.ui=r.ui,this.tiling=r.options.tiling||__,this.width=r.options.width,this.height=r.options.height,this.maxZoom=r.options.maxZoom,this.tileSize=r.options.tileSize,this.panDebounceTimeout=r.options.panDebounceTimeout||50,this.zoomDebounceTimeout=r.options.zoomDebounceTimeout||120,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.Dp=this.debounce(this.Ip,this.zoomDebounceTimeout),this.Np=this.debounce(this.Vp,this.panDebounceTimeout);for(let e=0;e<=r.options.maxZoom;e++)this.layers.push(new qy(this,r,e));this.setZoom(r.ui.getZoom(),!0),r.options.onBackgroundReady!=null&&setTimeout(r.options.onBackgroundReady,0)}Px(){if(this.widgetZoom<=this.layers[0].apparentZoom)return 0;if(this.widgetZoom>=this.layers[this.layers.length-1].apparentZoom)return this.layers.length-1;for(let r=this.layers.length-1;r>0;r--)if(this.layers[r].apparentZoom>=this.widgetZoom&&this.widgetZoom>=this.layers[r-1].apparentZoom)return r}Ox(r){let e=this.layers[r];this.currentLayer!=null&&this.currentLayer!==e&&this.currentLayer.setActive(!1),e.setActive(!0),this.currentLayer=e}Vp(){let r=this.ui.getApparentCanvasLocation(),e=this.ui.$getSize(this.viewport),t=e.width,n=e.height,o=this.currentLayer.scaledImageSize*this.widgetZoom,s=this.currentLayer.scaledImageSizeH*this.widgetZoom,a=r.x<0?Math.floor(-r.x/o):r.x<t?0:null,l=r.y<0?Math.floor(-r.y/s):r.y<n?0:null,h=Math.min(this.currentLayer.xTiles,Math.floor((t-r.x)/o)),d=Math.min(this.currentLayer.yTiles,Math.floor((n-r.y)/s));a==null||l==null||this.currentLayer.ensureLoaded(a,l,h,d)}getCurrentLayer(){return this.currentLayer}debounce(r,e){e=e||150;let t=null;return()=>{window.clearTimeout(t),t=window.setTimeout(r.bind(this),e)}}Ip(){this.Ox(this.Px()),this.Vp()}setZoom(r,e){this.widgetZoom=r,e?this.Ip():this.Dp()}pan(){this.Np()}owns(r){return r===this.canvas||r.Sx===!0}getHeight(){return this.height}getWidth(){return this.width}destroy(){}setUrl(r){U("WARN: setUrl not implemented for Tiled backgrounds.")}getTileSpecs(r){return this.tiling===O_?this._x(r):this.Rx(r)}_x(r){let e=Math.pow(2,this.maxZoom-r),t=Math.ceil(this.width/e/this.tileSize.width),n=Math.ceil(this.height/e/this.tileSize.height),o=t*this.tileSize.width/this.width,s=n*this.tileSize.height/this.height;return{xCount:t,yCount:n,xSize:o,ySize:s}}Rx(r){let e=this.width>this.height?1:this.width/this.height,t=this.height>this.width?1:this.height/this.width,n=Math.pow(2,r+1)*this.tileSize.width*e,o=Math.pow(2,r+1)*this.tileSize.height*t,s=Math.ceil(n/this.tileSize.width),a=Math.ceil(o/this.tileSize.height),l=n/this.width,h=o/this.height;return{xCount:s,yCount:a,xSize:l,ySize:h}}Ut(r){}};c(Yg,"type","tiled");var Ug=Yg;po.register(Ug.type,Ug);var II=(e=>(e.dotted="dotted",e.lines="lines",e))(II||{}),ELe="dotted",fLe="lines",MI={width:50,height:50},VI=2,L_="#ddd",Jh="#ddd",GI=2,$I=1,BI="vjs-background",FI="vjs-background-border",gs="vjs-background-grid",UI="vjs-background-grid-minor",YI="vjs-background-grid-major",zg="vjs-background-grid-dotted-major",zI="vjs-background-grid-dotted-minor",Xg=class Xg{constructor(r){c(this,"Xe",!1);c(this,"type",Xg.type);c(this,"grid");c(this,"ui");c(this,"showBorder",!0);c(this,"minWidth");c(this,"minHeight");c(this,"maxWidth");c(this,"maxHeight");c(this,"showTickMarks");c(this,"tickMarksPerCell");c(this,"autoShrink",!0);c(this,"dotRadius");c(this,"tickDotRadius");c(this,"gridType");c(this,"currentBounds");c(this,"We",{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});c(this,"backgroundContainer");c(this,"Ns");c(this,"ki");this.ui=r.ui,this.showBorder=r.options.showBorder===!0,this.Ns=`p${$().substring(0,8)}`,this.ki=`p${$().substring(0,8)}`,this.gridType=r.options.gridType||"lines",this.backgroundContainer=V(we),this.backgroundContainer.style.position=qe,L(this.backgroundContainer,BI),this.Ut(r.visible),r.canvas.insertBefore(this.backgroundContainer,r.canvas.firstElementChild),this.ui.bind(Vt,e=>{this.Sr()}),this.ui.bind(Mt,e=>{this.Sr()}),this.ui.bind(au,()=>{this.Xe=!0}),this.ui.bind(Br,()=>{this.Xe=!1,this.Sr()}),this.ui.bind(Ur,e=>{this.Sr()}),this.ui.bind(Fr,e=>{this.Sr()}),this.ui.model.bind(Ce,e=>{this.Sr()}),this.ui.model.bind(Re,e=>{this.Sr()}),this.grid=r.options.grid||this.ui.getGrid()||MI,this.showTickMarks=r.options.showTickMarks===!0,this.tickMarksPerCell=r.options.tickMarksPerCell||VI,this.dotRadius=r.options.dotRadius||GI,this.tickDotRadius=r.options.tickDotRadius||$I,this.minWidth=r.options.minWidth||2e4,this.minHeight=r.options.minHeight||2e4,this.maxWidth=r.options.maxWidth,this.maxHeight=r.options.maxHeight,this.autoShrink=r.options.autoShrink!=!1,this.Sr()}owns(r){return r===this.backgroundContainer||r.parentNode===this.backgroundContainer}getWidth(){return this.currentBounds!=null?this.currentBounds.width+(this.currentBounds.x<0?this.currentBounds.x:0):0}getHeight(){return this.currentBounds!=null?this.currentBounds.height+(this.currentBounds.y<0?this.currentBounds.y:0):0}setZoom(r,e){}pan(){}destroy(){this.backgroundContainer.parentNode&&this.backgroundContainer.parentNode.removeChild(this.backgroundContainer),this.backgroundContainer=null}Sr(){this.Xe||requestAnimationFrame(()=>{this.currentBounds=Object.assign({},this.ui.getViewportBoundsInfo());let r=this.grid.width*(Math.floor(this.currentBounds.x/this.grid.width)-1),e=this.grid.height*(Math.floor(this.currentBounds.y/this.grid.height)-1),t=this.grid.width*(Math.floor(this.currentBounds.width/this.grid.width)+3),n=this.grid.height*(Math.floor(this.currentBounds.height/this.grid.height)+3);if(!isNaN(r)&&!isNaN(e)&&!isNaN(t)&&!isNaN(n)){if(this.minWidth!=null){let s=-this.minWidth/2;s<r&&(t+=r-s,r=s);let a=this.minWidth/2;a>r+t&&(t+=a-(r+t))}if(this.minHeight!=null){let s=-this.minHeight/2;s<e&&(n+=e-s,e=s);let a=this.minHeight/2;a>e+n&&(n+=a-(e+n))}if(this.maxWidth!=null){let s=-this.maxWidth/2;s>r&&(t-=s-r,r=s);let a=this.maxWidth/2;a<r+t&&(t-=r+t-a)}if(this.maxHeight!=null){let s=-this.maxHeight/2;s>e&&(n-=s-e,e=s);let a=this.maxHeight/2;a<e+n&&(n-=e+n-a)}this.autoShrink!==!0&&(r=Math.min(r,this.We.minX),e=Math.min(e,this.We.minY),t=Math.max(r+t,this.We.maxX)-r,n=Math.max(e+n,this.We.maxY)-e);let o=this.ui.$getFixedViewportBoundsInfo();o!=null&&(r=o.x,e=o.y,t=o.width,n=o.height),Ie(this.backgroundContainer,{x:r,y:e}),this.backgroundContainer.setAttribute("width",`${t}`),this.backgroundContainer.setAttribute("height",`${n}`),this.backgroundContainer.setAttribute("viewBox",`0 0 ${t} ${n}`),this.backgroundContainer.innerHTML=this.generateGrid(),this.We.minX=Math.min(this.We.minX,r),this.We.minY=Math.min(this.We.minY,e),this.We.maxX=Math.max(this.We.maxX,r+t),this.We.maxY=Math.max(this.We.maxY,e+n)}else this.backgroundContainer.innerHTML=""})}Lx(r,e){return`<pattern id="${this.ki}" width="${r}" height="${e}" patternUnits="userSpaceOnUse">
44
+ <path d="M ${r} 0 L 0 0 0 ${e}" class="${gs} ${UI}" fill="none" stroke="${L_}" stroke-width="1"/>
45
+ </pattern>`}wx(){return`<pattern id="${this.Ns}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.ki})"/>`:"")+`<path d="M ${this.grid.width} 0 L 0 0 0 ${this.grid.height}" class="${gs} ${YI}" fill="none" stroke="${Jh}" stroke-width="1.5"/></pattern>`}Dx(r,e){let t=`<pattern id="${this.ki}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`;for(let n=0;n<this.tickMarksPerCell+2;n++){let o=n*r;for(let s=0;s<this.tickMarksPerCell+2;s++){let a=s*e;t+=`<circle cx="${o}" cy="${a}" r="${this.tickDotRadius}" class="${gs} ${zI}" fill="${L_}" stroke="none"/>`}}return t+"</pattern>`"}Nx(){return`<pattern id="${this.Ns}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.ki})"/>`:"")+`<circle cx="0" cy="0" r="${this.dotRadius}" class="${gs} ${zg}" fill="${Jh}" stroke="none"/>
46
+ <circle cx="${this.grid.width}" cy="0" r="${this.dotRadius}" class="${gs} ${zg}" fill="${Jh}" stroke="none"/>
47
+ <circle cx="${this.grid.width}" cy="${this.grid.height}" r="${this.dotRadius}" class="${gs} ${zg}" fill="${Jh}" stroke="none"/>
48
+ <circle cx="0" cy="${this.grid.height}" r="${this.dotRadius}" class="${gs} ${zg}" fill="${Jh}" stroke="none"/></pattern>`}Ix(){let r=this.grid.width/(this.tickMarksPerCell+1),e=this.grid.height/(this.tickMarksPerCell+1),t=()=>this.gridType==="lines"?this.Lx(r,e):this.Dx(r,e),n=()=>this.gridType==="lines"?this.wx():this.Nx();return"<defs>"+(this.showTickMarks?t():"")+n()+"</defs>"}generateGrid(){let r=this.Ix(),e=this.showBorder?`<rect class="${FI}" x="0" y="0" width="100%" height="100%" fill="${pt}"/>`:"",t=`<rect x="0" y="0" width="100%" height="100%" fill="url(#${this.Ns})" stroke="${pt}"/>`;return r+e+t}Ut(r){this.backgroundContainer.style.display=r?Pr:pt}};c(Xg,"type","grid");var Ga=Xg;po.register(Ga.type,Ga);var ms=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"background");c(this,"Is",!0);c(this,"ui")}initialise(e,t){this.ui=e;let n=t.type,o=po.get(n);return this.Is=t.options!=null?t.visible!==!1:!0,this.background=new o({type:n,ui:this.ui,canvas:e.$getCanvasElement(),viewport:e.rootElement,options:t,visible:this.Is}),e.addBackground(this.background),!0}destroy(){this.ui.removeBackground(this.background),this.background.destroy()}reset(){}setUrl(e){this.background.setUrl!=null?this.background.setUrl(e):U("The current background does not support the `setUrl` method")}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}toggle(){this.setVisible(!this.Is)}setVisible(e){this.Is=e,this.background.Ut(e)}};c(ms,"type","background"),un.register(ms.type,ms);var $a="c-state",jg=class{constructor(r,e,t){this.id=r;this.state=e;this.ui=t;for(let n in e)if(e.hasOwnProperty(n)){let o=n===Er?`${$a}-${r}`:`${$a}-${r}-${n}`;t.$registerConnectionType(o,e[n])}}activate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${$a}-${this.id}-${a}`:null;l&&Ne.addType(s,l,o.data),this.state[Er]&&Ne.addType(s,`${$a}-${this.id}`,o.data),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state["*"]&&L(l,this.state["*"].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state[Er]&&L(l,this.state[Er].cssClass)})}deactivate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${$a}-${this.id}-${a}`:null;l&&Ne.removeType(s,l,o.data),this.state[Er]&&Ne.removeType(s,`${$a}-${this.id}`),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state["*"]&&F(l,this.state[Er].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state[Er]&&F(l,this.state[Er].cssClass)})}};var Qy=class{constructor(r){this.ui=r;c(this,"Mp",{});c(this,"model");c(this,"currentStates",[]);c(this,"viewOptions");if(this.model=r.view,this.viewOptions=this.model.viewOptions,this.viewOptions.states)for(let e in this.viewOptions.states)this.Mp[e]=new jg(e,this.viewOptions.states[e],r)}getState(r){return this.Mp[r]}activateState(r,e){let t=this.getState(r);if(t){let n=this.Gp(e);t.activate(n,this.ui,this.ui.dataSource),this.currentStates.push(t)}}deactivateState(r,e){let t=this.getState(r);t&&(e=this.Gp(e),t.deactivate(e,this.ui,this.ui.dataSource),Nt(this.currentStates,function(n){return n==t}))}resetState(){for(let r=0;r<this.currentStates.length;r++)this.currentStates[r].deactivate(this.ui.dataSource,this.ui,this.ui.dataSource);this.currentStates.length=0}Gp(r){if(r==null)return this.ui.dataSource;if(typeof r=="string")return this.ui.model.select(r,!0);if(r.jtk){let e=r.jtk;return this.ui.model.select(e.port||e.node,!0)}else return r}},Kh=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"model")}destroy(){}initialise(e,t){return this.model=new Qy(e),!0}reset(){}activateState(e,t){this.model.activateState(e,t)}deactivateState(e,t){this.model.deactivateState(e,t)}resetState(){this.model.resetState()}};c(Kh,"type","ui-states"),un.register(Kh.type,Kh);var w_="direct",L0e="orthogonal",qh=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"instance");c(this,"mode");c(this,"orthogonalMode");c(this,"orthogonalPadding");c(this,"layoutListener");c(this,"$p");c(this,"de");c(this,"_t")}destroy(){}Vx(){let e=this.ui.getLayout();if(e.type!==Do.type){U(`INFO: cannot run edge routing; layout is of type ${e.type}. You must use the HierarchyLayout with the edge routing plugin`);return}if(!this.ui.$_hasUnrenderedEdges()){let t=e.axis;this.$p.forEach(n=>{let o=this.mode===w_?PT(n):CT(n);for(let s in o){let a=this.ui.getRenderedConnection(s),l=a.connector,h=n.edgeMap[s],d=h.pathDirection;if(l.type!==jr){U(`Cannot process edge routing for edge ${s} - connector must be Straight type`);continue}let u=o[s],p=this.instance.getEdge(s),g=this.de[p.source.id],m=this.de[p.target.id],E=this._t[p.source.id],y=this._t[p.target.id],x=[],f=u[0].x,b=u[0].y;for(let A=1;A<u.length-1;A++)x.push({x1:f,y1:b,x2:u[A].x,y2:u[A].y}),f=u[A].x,b=u[A].y;x.push({x1:f,y1:b,x2:u[u.length-1].x,y2:u[u.length-1].y}),je.importGeometry(a,{source:{curX:u[0].x,curY:u[0].y,ox:t===0?d:0,oy:t===1?d:0,x:(u[0].x-g.x)/E.width,y:(u[0].y-g.y)/E.height},target:{curX:u[u.length-1].x,curY:u[u.length-1].y,ox:t===0?-d:0,oy:t===1?-d:0,x:(u[u.length-1].x-m.x)/y.width,y:(u[u.length-1].y-m.y)/y.height},segments:x})}}),this.ui.repaintEverything()}}initialise(e,t){return this.mode=t.mode||w_,this.ui=e,this.instance=e.model,this.orthogonalMode=t.orthogonalMode||Mu,this.orthogonalPadding=t.orthogonalPadding|10,this.layoutListener=(n,o)=>{try{let s=n.layout.getRoutingInformation();this.$p=s.map(a=>Object.assign({mode:this.orthogonalMode,pad:this.orthogonalPadding,axis:n.layout.axis},a)),this.de=Object.assign({},n.positions),this._t=Object.assign({},n.sizes),this.Vx()}catch(s){U("Cannot retrieve edge routing. Make sure you're using a Hierarchy layout and you have generateRouting:true in its options`")}},this.ui.bind(On,(n,o)=>this.layoutListener(n,o)),!0}reset(){this.ui.unbind(On,this.layoutListener)}};c(qh,"type","edgeRouting"),un.register(qh.type,qh);var D_="vjs-selected-edge-highlight",Hg=class Hg extends Se{constructor(){super(...arguments);c(this,"id",Hg.type);c(this,"Tr",new Map);c(this,"Bp",D_);c(this,"Hi");c(this,"S");c(this,"Fp",e=>{rt(e.obj)&&(this.Mx(e.obj),this.Gx())});c(this,"zp",e=>{rt(e.obj)&&(this.nh(e.obj.getId()),this.Up())});c(this,"Yp",e=>{this.reset()});c(this,"Vs",e=>{e.edge&&this.Wi(e.edge)});c(this,"Xp",e=>{e.edge&&this.Wi(e.edge)});c(this,"jp",e=>{e.dragGroup.forEach(t=>this.kp(t.vertex))})}initialise(e,t){return this.S=e,this.Bp=t&&t.className||D_,this.Hi=t&&t.paintStyle||{fill:"none",stroke:"var(--vjs-color-edit)",strokeWidth:2},this.S.model.bind(qt,this.Fp),!0}destroy(){this.reset(),this.S.model.unbind(qt,this.Fp)}reset(){this.Tr.forEach(e=>{this.S.$removeElement(e)}),this.Tr.clear(),this.Up()}Gx(){this.S.model.bind(Qt,this.zp),this.S.model.bind(ir,this.Yp),this.S.model.bind(ai,this.Vs),this.S.model.bind(li,this.Xp),this.S.bind(Mt,this.jp),this.S.bind(ai,this.Vs)}Up(){this.S.model.unbind(Qt,this.zp),this.S.model.unbind(ir,this.Yp),this.S.model.unbind(ai,this.Vs),this.S.model.unbind(li,this.Xp),this.S.unbind(Mt,this.jp),this.S.unbind(ai,this.Vs)}$edgeRemoved(e){this.nh(e.getId())}$edgeUpdated(e){this.Wi(e)}$vertexUpdated(e,t){this.kp(e.modelObject)}kp(e){this.Tr.forEach((t,n)=>{let o=this.S.model.getEdge(n);o&&(o.source===e||o.target===e)&&this.Wi(o)})}Mx(e){var s;let t=e.getId();if(this.Tr.has(t)){this.Wi(e);return}let n=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!n)return;let o=V(Z,{fill:this.Hi.fill||"none",stroke:this.Hi.stroke||"var(--vjs-color-edit)","stroke-width":this.Hi.strokeWidth||2,"stroke-dasharray":this.Hi.dashArray,"pointer-events":"none",rx:2},{},this.Bp);this.Hp(o,n),this.S.$appendElementToToolsLayer(o),this.Tr.set(t,o)}Wi(e){var s;let t=e.getId(),n=this.Tr.get(t);if(!n)return;let o=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!o){this.nh(t);return}this.Hp(n,o)}nh(e){let t=this.Tr.get(e);t&&(this.S.$removeElement(t),this.Tr.delete(e))}Hp(e,t){let o=t.canvas.getBBox(),s=t.x+o.x,a=t.y+o.y;ie(e,{x:s,y:a,width:o.width,height:o.height})}};c(Hg,"type","selected-edge-highlight");var Ba=Hg;un.register(Ba.type,Ba);var kn=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surfaceMode",bi);c(this,"surface");c(this,"lasso");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"selectionFilter");c(this,"autoExit");c(this,"lassoSelections",[]);c(this,"Zi")}destroy(){}initialise(e,t){return e.bind(Ln,n=>{this.lasso.enabled=n===bi}),this.autoExit=t.autoExit!==!1,this.selectionFilter=t.selectionFilter,this.onStart=t.onStart,this.onSelect=t.onSelect,this.onEnd=t.onEnd,this.lasso=new Va({surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:t.cssClass,generateLassoContent:t.generateLassoContent,enableInGroups:t.enableInGroups,onStart:(n,o,s,a,l)=>{e.hoverSuspended=!0,this.lassoSelections.length=0,l!=null&&Y(l.modelObject)?this.Zi=l:this.Zi=null,this.onStart&&this.onStart(),e.fireUnchecked(pu,{canvasPosition:o})},onSelect:(n,o,s,a,l,h)=>{e.model.clearSelection(),h&&this.lassoSelections.length>0&&e.model.removeFromSelection(this.lassoSelections);let d=[],u,p=e.findIntersectingVertices({origin:s,dimensions:a,enclosed:!l[0],dontIncludeNodesInsideGroups:this.Zi==null,filter:E=>this.Zi==null||We(E,this.Zi.modelObject)}),g=p.length,m={};for(u=0;u<g;u++)(this.selectionFilter==null||this.selectionFilter(p[u].v)!==!1)&&(d.push(p[u].v),m[p[u].id]=!0,e.model.addToSelection(p[u].v));if(this.lassoSelections=d,g=d.length,t.includeEdges){let E={};for(u=0;u<g;u++){let y=[],x;Array.prototype.push.apply(y,d[u].getAllEdges());for(let f=0;f<y.length;f++)if(x=y[f].getId(),!E[x]){let b=y[f].source.objectType===de.objectType?y[f].source.getParent().id:y[f].source.id,A=y[f].target.objectType===de.objectType?y[f].target.getParent().id:y[f].target.id;m[b]&&m[A]&&d.push(y[f]),E[x]=!0}}}e.model.addToSelection(d),this.onSelect&&this.onSelect(d),e.fireUnchecked(gu,{canvasPosition:s,canvasSize:a})},onEnd:(n,o)=>{e.hoverSuspended=!1,this.autoExit&&e.mode!==ps&&e.setMode(Sr),e.fireUnchecked(mu),this.onEnd&&this.onEnd()},filter:t.filter}),!1}reset(){}};c(kn,"type","lasso"),kn=Ye([He("lasso")],kn);var XI="vjs-surface-elastic-group-resize",ex="elasticGroupFrame:resize",tx="elasticGroupFrame:remove",Fa=class i{constructor(r,e,t,n){this.surface=r;this.focusVertex=e;this.group=t;this.groupDef=n;c(this,"groupEntry");c(this,"focusPosition");c(this,"siblingEntries",[]);c(this,"xMinEntries",[]);c(this,"xMaxEntries",[]);c(this,"yMinEntries",[]);c(this,"yMaxEntries",[]);c(this,"managedElement");c(this,"uiGroup");c(this,"frame");c(this,"layout");c(this,"uiGroupContentArea");c(this,"$x");c(this,"layoutShiftX",0);c(this,"layoutShiftY",0);c(this,"width",0);c(this,"height",0);c(this,"minSize");c(this,"x",0);c(this,"y",0);c(this,"parent");this.managedElement=r.viewport.getGroupElement(t.id),this.uiGroup=r.getGroupElement(t.id),this.uiGroupContentArea=this.surface.$getGroupContentAreaElement(this.uiGroup.el),wt(this.uiGroupContentArea)?this.frame=V(Z):(this.frame=V(we),this.frame.appendChild(V(Z,{x:0,y:0,width:"100%",height:"100%"}))),this.layout=r.layoutMap.get(t.id),this.frame.style.visibility="hidden",r.$appendElement(this.frame,this.uiGroupContentArea,!0),L(this.frame,XI),this.groupEntry=r.viewport.getElementBounds(t.id),this.surface.$_useModelForSizes?this.minSize={width:t.data[this.surface.$modelWidthAttribute],height:t.data[this.surface.$modelHeightAttribute]}:this.minSize={width:this.groupEntry.width,height:this.groupEntry.height};let o=Object.assign({},r.viewport.getElement(e.id));if(this.focusPosition=xE(o,this.groupEntry,-1),t.members.filter(a=>a.id!==e.id).forEach(a=>{let l=r.viewport.getElement(a.id),h=xE(l,this.groupEntry,-1);this.siblingEntries.push(l),this.xMinEntries.push(h),this.xMaxEntries.push(h),this.yMinEntries.push(h),this.yMaxEntries.push(h)}),this.Bx(),this.$x=this.getCurrentExtents(),t.group){let a=this.surface.getGroupElement(t.group.id);a.elastic&&(this.parent=new i(r,t,t.group,a))}}Bx(){this.xMinEntries.sort((r,e)=>r.x<e.x?-1:1),this.yMinEntries.sort((r,e)=>r.y<e.y?-1:1),this.xMaxEntries.sort((r,e)=>r.x+r.width>e.x+e.width?-1:1),this.yMaxEntries.sort((r,e)=>r.y+r.height>e.y+e.height?-1:1)}setFocusPosition(r,e,t,n,o){let s=(n==null?void 0:n.width)||this.focusPosition.width,a=(n==null?void 0:n.height)||this.focusPosition.height,l={x:r.x-(o?this.groupEntry.x:0),y:r.y-(o?this.groupEntry.y:0)};this.focusPosition.x=l.x,this.focusPosition.y=l.y,this.focusPosition.width=s,this.focusPosition.height=a,this.Fx(e,t)}Fx(r,e){let t=e==null?!1:e.metaKey||e.ctrlKey,n=this.getCurrentExtents(),o=wp(n,this.groupDef,r,!0,!0,this.surface.gridProfile,t?null:this.minSize);this.width=o.width,this.height=o.height,this.layoutShiftX=o.layoutShiftX,this.layoutShiftY=o.layoutShiftY,Rr(this.frame,this.width,this.height),Ie(this.frame,{x:-this.layoutShiftX,y:-this.layoutShiftY}),this.parent&&this.parent.setFocusPosition({x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},!1,e,{width:this.width,height:this.height},!0),this.frame.style.visibility="visible",this.surface.fireUnchecked(ex,{groupId:this.group.id,width:this.width,height:this.height,x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY})}getCurrentExtents(){let r=this.xMaxEntries[0]||{x:-1/0,width:0},e=this.yMaxEntries[0]||{y:-1/0,height:0};return{xmin:Math.min(this.focusPosition.x,(this.xMinEntries[0]||{x:1/0}).x),ymin:Math.min(this.focusPosition.y,(this.yMinEntries[0]||{y:1/0}).y),xmax:Math.max(this.focusPosition.x+this.focusPosition.width,r.x+r.width),ymax:Math.max(this.focusPosition.y+this.focusPosition.height,e.y+e.height)}}cleanup(){this.frame&&this.frame.parentNode&&this.frame.parentNode.removeChild(this.frame),this.parent&&this.parent.cleanup(),this.surface.fireUnchecked(tx,{groupId:this.group.id})}getValues(r){return r==this.group.id?{layoutShiftX:this.layoutShiftX,layoutShiftY:this.layoutShiftY,width:this.width,height:this.height}:this.parent?this.parent.getValues(r):null}ih(r,e){r=r||{},e=e||{};let t=(s,a,l)=>{r[s]=r[s]||{original:a,current:l},r[s].current=l},n={x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},o=Object.assign({},n);if(this.group.group){let s=this.surface.viewport.getElementPosition(this.group.group.id);o.x-=s.x,o.y-=s.y}return(this.layoutShiftX!==0||this.layoutShiftY!==0)&&(this.group.members.forEach(s=>{let a=this.surface.viewport.getElement(s.id),l={x:a.x+this.layoutShiftX-this.groupEntry.x,y:a.y+this.layoutShiftY-this.groupEntry.y};t(s.id,{x:a.x,y:a.y},l)}),t(this.group.id,{x:this.groupEntry.x,y:this.groupEntry.y},o)),(this.width!==this.groupEntry.width||this.height!==this.groupEntry.height)&&(e[this.group.id]={element:this.managedElement,originalGroupSize:{width:this.groupEntry.width,height:this.groupEntry.height},newGroupSize:{width:this.width,height:this.height}}),this.surface.viewport.updateElement(this.group.id,n.x,n.y,this.width,this.height,null,this.group,!1),this.surface.$setGroupElementSize(this.managedElement.modelObject,{width:this.width,height:this.height}),this.surface.$setViewportElementPosition(this.managedElement,o),this.surface.$repaintUIElement(this.managedElement),this.parent&&this.parent.ih(r,e),{movedElements:r,resizedGroups:e}}};var N_="resize";function Qh(i,r,e){let t={width:i.width,height:i.height,position:i.position||qe},n=i.atts||{};i.display!=null&&(t.display=i.display),i.id!=null&&(n.id=i.id),i.top!=null&&(t.top=i.top+"px"),i.left!=null&&(t.left=i.left+"px"),i.right!=null&&(t.right=i.right+"px"),i.bottom!=null&&(t.bottom=i.bottom+"px");let o=xa(i.ns,i.type||Ke,t,i.clazz,n);return r!=null&&(e?r.insertBefore(o,r.lastChild):r.appendChild(o)),o}var rx="vjs-node-id",I_="vjs-miniview-type",M_="miniview",Wn=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"panzoom");c(this,"containerElement");c(this,"canvasElement");c(this,"pannerElement");c(this,"lassoElement");c(this,"uiBounds");c(this,"suspended");c(this,"oh");c(this,"typeFunction");c(this,"vr");c(this,"Ms");c(this,"wheelSensitivity");c(this,"wheelReverse");c(this,"panning",!1);c(this,"downAt",null);c(this,"pannerAtMouseDown",null);c(this,"zoomingWithWheel",!1);c(this,"elementFilter");c(this,"visible",!0);c(this,"pannerPos");c(this,"activeTracking");c(this,"Wp");c(this,"Zp");c(this,"Jp");c(this,"vertexMap",{});c(this,"enableWheelZoom");c(this,"eventManager");c(this,"sh");c(this,"uiBindings",[]);c(this,"ah");c(this,"viewport");c(this,"Ft");c(this,"en");c(this,"rn");c(this,"Ar");c(this,"lh")}destroy(){this.panzoom.destroy(),this.eventManager.off(this.pannerElement,ge,this.en),this.canvasElement.parentNode.removeChild(this.canvasElement),this.pannerElement.parentNode.removeChild(this.pannerElement),this.lassoElement.parentNode&&this.lassoElement.parentNode.removeChild(this.lassoElement),this.eventManager.off(window,N_,this.lh),F(this.containerElement,ag),F(this.containerElement,lg),this.oh&&(this.eventManager.off(this.vr,Xe,this.ah),this.vr.parentNode.removeChild(this.vr)),this.uiBindings.forEach(e=>this.ui.unbind(e[0],e[1])),this.ui.model.unbind(Mr,this.sh),this.Ft&&Sh(this.containerElement,this.Ft),this.panzoom=null}Ux(e){}zx(e){}le(e,t){let n=t.bind(this);this.uiBindings.push([e,n]),this.ui.bindUnchecked(e,n)}initialise(e,t){this.ui=e,this.activeTracking=t.activeTracking!==!1,this.Wp=t.clickToCenter!==!1,this.wheelReverse=this.wheelReverse||this.ui.$wheelReverse===!0,this.Zp=t.showLasso!==!1,this.Jp=t.trackSelection!==!1,this.en=this.downListener.bind(this),this.rn=this.moveListener.bind(this),this.Ar=this.upListener.bind(this),this.containerElement=t.container,this.pannerElement=Qh({position:qe,width:Hr,height:Hr,left:0,top:0,clazz:NP},this.containerElement),this.canvasElement=Qh({position:Pv,width:Hr,height:Hr,left:0,top:0,clazz:DP},this.containerElement),this.lassoElement=Qh({position:qe,width:Hr,height:Hr,left:0,top:0,clazz:IP}),this.suspended=t.suspended===!0,this.oh=t.collapsible!==!1,this.typeFunction=t.typeFunction,this.vr=null,this.Ms=!1,this.enableWheelZoom=t.enableWheelZoom!==!1,this.wheelSensitivity=t.wheelSensitivity||10,this.elementFilter=t.elementFilter||(o=>!0),this.visible=t.visible!==!1,this.eventManager=new xe,L(this.containerElement,ag),this.ah=this.toggleCollapsed.bind(this),this.oh&&(this.vr=Qh({type:"div"}),this.vr.className=GP,this.containerElement.appendChild(this.vr),this.ui.on(this.vr,Xe,this.ah)),this.viewport=this.ui.viewport,this.panzoom=new Da({viewport:this.viewport,viewportElement:this.containerElement,canvasElement:this.canvasElement,elementPositionSetter:(o,s)=>Ie(o,s),wheel:{zoom:!1},enablePan:!1,enableAnimation:!1,idFunction:o=>o.viewportEntry?o.viewportEntry.id:this.ui.W(o),events:{pan:()=>{this.Kp()},mousedown:()=>{L(this.pannerElement,Ly)},mouseup:()=>{F(this.pannerElement,Ly)}},zoomRange:[-1/0,1/0]}),this.lh=ba(()=>{this.$e()},100),this.eventManager.on(window,N_,this.lh),this.enableWheelZoom!==!1&&(this.Ft=this.wheelZoom.bind(this),Ah(this.containerElement,this.Ft)),this.pannerElement.style.transformOrigin="0 0",L(this.containerElement,ag),this.eventManager.on(this.pannerElement,ge,this.en),this.sh=()=>{this.$e(),this.ht(!0),setTimeout(()=>{this.$e(),this.ht(!0)},0)},this.le(Br,this.sh),this.setVisible(this.visible),this.le(Fi,this.$e),this.le($r,this.$e),this.le(Vt,this.Gs),this.le(Mt,o=>{this.activeTracking&&this.Gs(o)}),this.le(Ur,this.hh),this.le(Yl,this.Yx),this.le(On,this.Xx),this.le(Fr,this.qp),this.le(Gr,this.Gs),this.le(Io,o=>{this.activeTracking&&this.Gs(o)}),this.Zp&&(this.le(pu,o=>{this.canvasElement.appendChild(this.lassoElement),this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width="1px",this.lassoElement.style.height="1px"}),this.le(gu,o=>{this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width=`${o.canvasSize.width}px`,this.lassoElement.style.height=`${o.canvasSize.height}px`}),this.le(mu,()=>{this.lassoElement.parentElement&&this.lassoElement.parentElement.removeChild(this.lassoElement)})),this.Jp&&(this.ui.model.bind(qt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&L(s,wh)}),this.ui.model.bind(Qt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&F(s,wh)}),this.ui.model.bind(ir,o=>{Array.from(this.canvasElement.querySelectorAll(`.${wh}`)).forEach(s=>F(s,wh))}));let n=o=>{this.uiBounds=o.bounds;for(let s in o.positions){let a=o.positions[s],l=this.vertexMap[s];l&&tr(l,a)}this.ht(!0)};return this.le(On,n),this.le(qs,n),this.le(mS,this.$n),this.le(lu,this.jx),this.le(ex,this.Ux),this.le(tx,this.zx),this.kx(),this.Wp&&(L(this.containerElement,$P),this.eventManager.on(this.canvasElement,W,Ae(rx),o=>{let s=o.target.getAttribute(rx);s&&this.vertexMap[s]&&this.ui.centerOn(s)})),!0}reset(){this.Hx(),this.panzoom.setZoom(1),this.panzoom.reset(),this.$e()}Qp(e){let t=this.ui.viewport.getElement(e.id);if(t!=null){let n=ft(t);if(e.group){let o=this.ui.viewport.getElement(e.group.id);o!=null&&(n.x-=o.x,n.y-=o.y)}return n}return{x:0,y:0}}kx(){let e=this.ui.model,t=e.getNodes(),n=e.getGroups();for(let o=0;o<n.length;o++){let s=this.ui.getRenderedElement(n[o]);s!=null&&this.qp({el:s,id:n[o].id,vertex:n[o],pos:this.Qp(n[o])})}for(let o=0;o<t.length;o++){let s=this.ui.getRenderedElement(t[o]);s!=null&&this.hh({el:s,id:t[o].id,vertex:t[o],pos:this.Qp(t[o])})}(n.length>0||t.length>0)&&this.ht(!0)}qp(e){this.hh(e,VP)}$groupCollapsed(e){this.em(e.modelObject,!1),this.$n({id:e.id})}$groupExpanded(e){this.em(e.modelObject,!0),this.$n({id:e.id})}$vertexRotated(e,t){let n=this.vertexMap[e.id];n!=null&&(n.style.transform="rotate("+t+"deg)",n.style.transformOrigin="50% 50%")}$vertexResized(e,t,n){let o=this.vertexMap[e.id];o!=null&&Rr(o,t,n)}$vertexUpdated(e,t){this.vertexMap[e.id]&&(this.$s(e),this.ht(!0))}downListener(e){this.panning=!0,this.downAt=Ee(e),this.pannerAtMouseDown=En(this.pannerElement),this.eventManager.on(document,le,this.Ar),this.eventManager.on(document,ae,this.rn),oe(e)}moveListener(e){if(this.zoomingWithWheel=!1,this.panning){let t=Ee(e),n=t.x-this.downAt.x,o=t.y-this.downAt.y,s={x:this.pannerAtMouseDown.x+n,y:this.pannerAtMouseDown.y+o};this.Kp(s),tr(this.pannerElement,s)}}upListener(e){this.panning=!1,this.downAt=null,this.eventManager.off(document,le,this.Ar),this.eventManager.off(document,ae,this.rn)}wheelZoom(e){oe(e);let t=this.panzoom.mapEventLocation(e);this.ui.panZoom.$setTransformOriginToCanvasPoint(t.x,t.y),this.ui.nudgeWheelZoom(e.normalizedWheelDelta*this.wheelSensitivity*(this.wheelReverse?-1:1),e)}toggleCollapsed(){this.Ms=!this.Ms,this.Ms?L(this.containerElement,lg):F(this.containerElement,lg),this.ht(!0)}ht(e){this.panzoom&&this.panzoom.zoomToFit({onComplete:this.$e,doNotFirePanEvent:e})}Gs(e){e.dragGroup.forEach(t=>{let n=t.vertex;n&&this.elementFilter(n)===!1||this.$s(t.element)}),this.ht(!0)}Yx(e){let t=this.vertexMap[e.element.id];e.element.modelObject.members.forEach(o=>{let s=this.vertexMap[o.id];if(s!=null){let a=this.ui.getElement(o.id);tr(s,{x:a.x-e.element.x,y:a.y-e.element.y}),Rr(s,a.width,a.height)}});let n=ft(e.element);if(e.element.modelObject.group){let o=this.ui.viewport.getGroupElement(e.element.modelObject.group.id);o&&(n.x-=o.x,n.y-=o.y)}tr(t,n),Rr(t,e.element.width,e.element.height),this.$e()}Xx(e){this.uiBounds=this.ui.getViewportBoundsInfo();for(let t in e.positions){let n=e.positions[t],o=this.vertexMap[t];o&&tr(o,n)}this.ht(!0)}Wx(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++){let s=this.vertexMap[n[o].id];s&&t.appendChild(s)}}hh(e,t){if(this.elementFilter(e.vertex)===!1)return;let n=e.vertex,o=n.id;if(this.vertexMap[o]!=null)return;let s=e.pos||{x:0,y:0},a=e.size||this.$__getSize(e.id),l=Qh({position:qe,width:a.width+Mn,height:a.height+Mn,left:s.x,top:s.y,clazz:MP+(t?" "+t:"")});if(l.vertex=n,l.viewportEntry=this.ui.getElement(o),this.typeFunction&&l.setAttribute(I_,this.typeFunction(e.vertex)),this.uiBounds=this.ui.getViewportBoundsInfo(),l.setAttribute(rx,o),this.canvasElement.appendChild(l),this.panzoom.add(l),this.vertexMap[o]=l,n.data.rotation!=null&&(l.style.transform="rotate("+n.data.rotation+"deg)",l.style.transformOrigin="50% 50%"),e.vertex.group){let h=this.vertexMap[e.vertex.group.id];h&&(h.appendChild(l),this.panzoom.suspend(e.el))}Y(e.vertex)&&this.Wx(e.vertex,l),this.ui.$_dataLoading||(this.ht(!0),this.$e())}setVisible(e){this.visible=e,this.containerElement.style.display=e?Pr:pt}getPan(){return this.panzoom.getPan()}em(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++)this.vertexMap[n[o].id].style.display=t?"block":"none"}$__getSize(e){return this.ui.viewport.getElementSize(e)}$n(e){let t=this.vertexMap[e.id];if(t){let n=e.size||this.$__getSize(e.id);if(t.style.width=n.width+Mn,t.style.height=n.height+Mn,this.$e(),this.typeFunction){let o=e.obj||this.ui.model.getVertex(e.id);o&&t.setAttribute(I_,this.typeFunction(o))}}}invalidate(e){if(e)this.$n({id:e});else for(let t in this.vertexMap)this.$n({id:t})}setSuspended(e,t){this.suspended=e,t&&this.$e()}tm(e,t){let n=this.vertexMap[e.id];n&&(this.panzoom.remove(n),delete this.vertexMap[e.id],n.parentNode.removeChild(n),t||this.ht(!0)),t||this.$e()}$nodeRemoved(e){this.tm(e,!1)}$groupRemoved(e){let t=e.id;this.vertexMap[t]&&this.tm(e,!1)}$groupResized(e){this.$n({id:e.element.id,size:e.newGroupSize}),this.ht(!0)}$s(e){let t=this.vertexMap[e.id];if(t){let n=e.modelObject.group,o=n==null?{x:0,y:0}:this.ui.getGroupElement(n.id);tr(t,{x:e.x-o.x,y:e.y-o.y})}}$groupMemberRemoved(e){let t=this.vertexMap[e.id];t&&(this.canvasElement.appendChild(t),this.$s(e))}$groupMemberAdded(e){let t=e.modelObject.group;if(t){let n=this.vertexMap[t.id],o=this.vertexMap[e.id];n&&o&&(n.appendChild(o),this.$s(e))}}Hx(){let e;for(let t in this.vertexMap)e=this.vertexMap[t],this.panzoom.remove(e),delete this.vertexMap[t],e.parentNode.removeChild(e);this.$e()}jx(e){let t=(e.node||e.group).id,n=this.vertexMap[t];n&&(n.style.display=e.state?"block":"none")}$e(){if(this.ui&&this.panzoom&&!this.suspended){this.uiBounds=this.ui.getViewportBoundsInfo();let e=this.ui.panZoom.getApparentCanvasLocation(),t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom;this.pannerElement.style.width=this.uiBounds.vw+Mn,this.pannerElement.style.height=this.uiBounds.vh+Mn,this.pannerElement.style.transform="scale("+o+")";let s={x:e.x*o,y:e.y*o};this.pannerPos={x:t.x-s.x,y:t.y-s.y},tr(this.pannerElement,this.pannerPos)}}Kp(e){if(this.panzoom!=null){this.uiBounds=this.ui.getViewportBoundsInfo(),e=e||En(this.pannerElement);let t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom,s=(t.x-e.x)/o,a=(t.y-e.y)/o,l=this.ui.setApparentCanvasLocation(s,a);return{x:t.x-l.x*o,y:t.y-l.y*o}}}getRenderedVertex(e){return this.getRenderedElement(e)}getRenderedElement(e){return this.vertexMap[e]}};c(Wn,"type",M_),Wn=Ye([He(M_)],Wn);var V_="vjs-pan-mode",G_="vjs-zoom-to-fit",$_="vjs-zoom-in",B_="vjs-zoom-out",nx="vjs-select-mode",F_="vjs-undo",U_="vjs-redo",Y_="vjs-clear-dataset",wDe="vjs-selected-mode",kg="vjs-controls",z_="vjs-export-controls",X_="vjs-controls-reset-selection",DDe="vjs-copy-paste-controls";var j_=class{constructor(r){c(this,"ui");this.ui=r.ui}};var jI="Clear dataset?",ix="vjs-selected-mode",H_="vjs-controls-has-selection",k_="can-undo",W_="can-redo",Z_="data-undo",J_="data-redo",Es="data-mode",K_="data-reset",q_="data-clear",Q_="data-zoom-in",eO="data-zoom-out",tO="data-reset-selection",HI="data-vjs-orientation",kI="0 0 32 30",WI="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",ZI="0 0 24 24",JI="M18.2848192,17.5777124 L20.8535534,20.1464466 C21.0488155,20.3417088 21.0488155,20.6582912 20.8535534,20.8535534 C20.6582912,21.0488155 20.3417088,21.0488155 20.1464466,20.8535534 L17.5777124,18.2848192 L15.9160251,20.7773501 C15.6899572,21.116452 15.1749357,21.0571624 15.0318354,20.6755617 L12.0318354,12.6755617 C11.8811067,12.2736185 12.2736185,11.8811067 12.6755617,12.0318354 L20.6755617,15.0318354 C21.0571624,15.1749357 21.116452,15.6899572 20.7773501,15.9160251 L18.2848192,17.5777124 L18.2848192,17.5777124 Z M17.2312404,17.0782479 L19.4104716,15.6254271 L13.3544004,13.3544004 L15.6254271,19.4104716 L17.0782479,17.2312404 C17.0974475,17.2011742 17.1201804,17.1727128 17.1464466,17.1464466 C17.1727128,17.1201804 17.2011742,17.0974475 17.2312404,17.0782479 L17.2312404,17.0782479 Z M5.5,3 C5.77614237,3 6,3.22385763 6,3.5 C6,3.77614237 5.77614237,4 5.5,4 C4.67157288,4 4,4.67157288 4,5.5 C4,5.77614237 3.77614237,6 3.5,6 C3.22385763,6 3,5.77614237 3,5.5 C3,4.11928813 4.11928813,3 5.5,3 Z M8.5,4 C8.22385763,4 8,3.77614237 8,3.5 C8,3.22385763 8.22385763,3 8.5,3 L10.5,3 C10.7761424,3 11,3.22385763 11,3.5 C11,3.77614237 10.7761424,4 10.5,4 L8.5,4 Z M13.5,4 C13.2238576,4 13,3.77614237 13,3.5 C13,3.22385763 13.2238576,3 13.5,3 L15.5,3 C15.7761424,3 16,3.22385763 16,3.5 C16,3.77614237 15.7761424,4 15.5,4 L13.5,4 Z M8.5,21 C8.22385763,21 8,20.7761424 8,20.5 C8,20.2238576 8.22385763,20 8.5,20 L10.5,20 C10.7761424,20 11,20.2238576 11,20.5 C11,20.7761424 10.7761424,21 10.5,21 L8.5,21 Z M3,8.5 C3,8.22385763 3.22385763,8 3.5,8 C3.77614237,8 4,8.22385763 4,8.5 L4,10.5 C4,10.7761424 3.77614237,11 3.5,11 C3.22385763,11 3,10.7761424 3,10.5 L3,8.5 Z M3,13.5 C3,13.2238576 3.22385763,13 3.5,13 C3.77614237,13 4,13.2238576 4,13.5 L4,15.5 C4,15.7761424 3.77614237,16 3.5,16 C3.22385763,16 3,15.7761424 3,15.5 L3,13.5 Z M3,18.5 C3,18.2238576 3.22385763,18 3.5,18 C3.77614237,18 4,18.2238576 4,18.5 C4,19.3284271 4.67157288,20 5.5,20 C5.77614237,20 6,20.2238576 6,20.5 C6,20.7761424 5.77614237,21 5.5,21 C4.11928813,21 3,19.8807119 3,18.5 Z M21,10.5 C21,10.7761424 20.7761424,11 20.5,11 C20.2238576,11 20,10.7761424 20,10.5 L20,8.5 C20,8.22385763 20.2238576,8 20.5,8 C20.7761424,8 21,8.22385763 21,8.5 L21,10.5 Z M21,5.5 C21,5.77614237 20.7761424,6 20.5,6 C20.2238576,6 20,5.77614237 20,5.5 C20,4.67157288 19.3284271,4 18.5,4 C18.2238576,4 18,3.77614237 18,3.5 C18,3.22385763 18.2238576,3 18.5,3 C19.8807119,3 21,4.11928813 21,5.5 Z",KI="0 0 24 24",qI="M 3.88,20.08 L 3.58,15.46 M 3.58,15.46 L 14.48,0.78 M 14.48,0.78 L 18.25,3.76 M 18.25,3.76 L 7.78,18.2 M 7.7,18.2 L 3.88,20.08 M 3.58,15.46 L 7.76,18.20 M 2,5 V 20.6 M 22,5 V 20.6 M 22,20.6 H 3.94 M 2,5 H 11.2 M 17.6,5 H 22",QI="0 0 24 24",eM="M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5 M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5 M14 5.5a1.5 1.5 0 0 1 3 0v6.5 M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47",tM="0 0 24 24",rM="M2,5 V2 H5 M9,2 H11 M13,2 H15 M19,2 H22 V5 M22,9 V11 M22,13 V15 M22,19 V22 H19 M15,22 H13 M11,22 H9 M5,22 H2 V19 M2,15 V13 M2,11 V9 M9,9 L15,15 M15,9 L9,15",nM="0 0 24 24",iM="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",rO="0 0 32 32",oM="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",sM="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0";function aM(){return`<i class="${V_}" ${ix} ${Es}="${Sr}" title="Pan Mode">
49
+ <svg:svg viewBox="${QI}" stroke="currentColor" fill="none"><svg:path d="${eM}"/></svg:svg>
50
+ </i>`}function lM(){return`<i class="${G_}" ${K_} title="Zoom To Fit">
51
+ <svg:svg viewBox="${kI}" stroke="currentColor" fill="currentColor"><svg:path d="${WI}"/></svg:svg>
52
+ </i>`}function hM(){return`<i class="${$_}" ${Q_} title="Zoom In">
53
+ <svg:svg viewBox="${rO}" stroke="currentColor" fill="currentColor">
54
+ <svg:path d="${oM}" fill="none" stroke-width="2"/>
55
55
  </svg:svg>
56
- </i>`}function qI(){return`<i class="${MO}" ${JO} title="Zoom Out">
57
- <svg:svg viewBox="${qO}" stroke="currentColor" fill="currentColor">
58
- <svg:path d="${WI}" fill="none" stroke-width="2"/>
56
+ </i>`}function cM(){return`<i class="${B_}" ${eO} title="Zoom Out">
57
+ <svg:svg viewBox="${rO}" stroke="currentColor" fill="currentColor">
58
+ <svg:path d="${sM}" fill="none" stroke-width="2"/>
59
59
  </svg:svg>
60
- </i>`}function QI(){return`<i class="${FO}" ${KO} title="Clear Selection">
61
- <svg:svg viewBox="${zI}" stroke="currentColor" fill="currentColor"><svg:path d="${XI}"/></svg:svg>
62
- </i>`}function eM(i){return`<i class="${$O}" ${WO} title="${i}">
63
- <svg:svg viewBox="${jI}" stroke="currentColor" fill="currentColor"><svg:path d="${HI}"/></svg:svg>
64
- </i>`}function tM(){return`<i class="${Qy}" ${us}="${bi}" title="Select Mode">
65
- <svg:svg fill="currentColor" viewBox="${GI}" stroke="currentColor"><svg:path d="${$I}"/></svg:svg>
66
- </i>`}function rM(){return`<i class="${Qy}" ${us}="${jn}" title="Vertex Drawing Mode">
67
- <svg:svg fill="currentColor" viewBox="${BI}" stroke="currentColor"><svg:path d="${FI}"/></svg:svg>
68
- </i>`}var nM=(i,r,e)=>{let t=`<div ${II}="${r.orientation}" class="${zm}" ${zO}="false" ${XO}="false">`,n=e.filter(u=>u.mode!=null),o=n.map(u=>`<i data-mode="${u.mode}" class="${u.class}" title="${u.title}"></i>`).join(""),s=r.hasLasso||r.hasVertexDrawing||n.length>0?ZI():"",a=(r.hasLasso?tM():"")+(r.hasVertexDrawing?rM():""),l=(r.showZoomToExtentsButton?JI():"")+(r.showZoomButtons?KI()+qI():"")+(r.showUndoRedoButtons?`<i class="${VO}" ${jO} title="Undo last action"></i><i class="${GO}" ${HO} title="Redo last action"></i>`:"")+QI()+(r.showClearButton?eM(i):""),h="</div>",d=e.filter(u=>u.mode==null).map(u=>`<i class="${u.class}" title="${u.title}"></i>`).join("");return t+s+a+o+l+d+h},Xm=class{constructor(r,e,t){this.container=r;c(this,"M");c(this,"Ze");c(this,"nh");c(this,"S");c(this,"ih");c(this,"me");c(this,"kp");c(this,"Wp");c(this,"Zp");c(this,"Jp");this.S=e,this.ih=(t==null?void 0:t.clearMessage)||NI,this.kp=(t==null?void 0:t.clear)!==!1,this.Wp=(t==null?void 0:t.undoRedo)!==!1,this.Zp=(t==null?void 0:t.zoomToExtents)!==!1,this.Jp=(t==null?void 0:t.zoom)===!0,this.me=(t==null?void 0:t.orientation)||"row",this.nh=(t==null?void 0:t.buttons)||[],this.M=Ar({}),this.oh(),this.Nx()}oh(){let r=this.S.getPlugin(kn.type)!=null,e=this.S.getPlugin(Ai.type)!=null,t=nM(this.ih,{orientation:this.me,showClearButton:this.kp,showUndoRedoButtons:this.Wp,hasLasso:r,hasVertexDrawing:e,showZoomToExtentsButton:this.Zp,showZoomButtons:this.Jp},this.nh);this.Ze=this.M.template(B(),{},()=>t).childNodes[0],this.container.replaceChildren(this.Ze)}Nx(){this.S.bind(su,e=>{this.oh()}),this.S.bind(cS,e=>{this.oh()}),this.S.model.bind(js,e=>{this.Ze.setAttribute(zO,e.undoCount>0?Pt:ct),this.Ze.setAttribute(XO,e.redoCount>0?Pt:ct)});let r=()=>{this.S.model.getSelection().isEmpty()?this.Ze.removeAttribute(YO):this.Ze.setAttribute(YO,"true")};this.S.model.bind(qt,r),this.S.model.bind(Qt,r),this.S.model.bind(ir,r),this.S.on(this.container,W,Ae(jO),()=>{this.S.model.undo()}),this.S.on(this.container,W,Ae(HO),()=>{this.S.model.redo()}),this.S.bind(Rn,e=>{Array.from(this.Ze.querySelectorAll(Ae(us))).forEach(t=>{this.S.removeClass(t,ex)}),this.S.addClass(this.S.$getSelector(this.Ze,`[${us}='${e}']`),ex)}),this.S.on(this.container,W,Ae(us),(e,t)=>{this.S.setMode(t.getAttribute(us))}),this.S.on(this.container,W,Ae(kO),(e,t)=>{this.S.model.clearSelection(),this.S.zoomToFit()}),this.S.on(this.container,W,Ae(ZO),(e,t)=>{this.S.zoomIn()}),this.S.on(this.container,W,Ae(JO),(e,t)=>{this.S.zoomOut()}),this.S.on(this.container,W,Ae(KO),()=>{this.S.model.clearSelection(),tP(this.S)&&this.S.stopEditingPath()}),this.S.on(this.container,W,Ae(WO),(e,t)=>{(this.S.model.getNodeCount()+this.S.model.getGroupCount()===0||confirm(this.ih))&&this.S.model.clear()}),this.nh.forEach(e=>{this.S.on(this.container,W,z(e.class),(t,n)=>{e.handler&&e.handler(t,e.id)})})}};var jm="vjs-export-underlay",Hm="vjs-export-overlay",km="vjs-export-cancel",QO="vjs-export-dimensions",e_="vjs-export-download-tools",Wm="visuallyjs-export",Zm="Download",Ba={png:"image/png",svg:"image/svg+xml",jpeg:"image/jpeg"},tx="svg",Kh="png",ps="jpg";function iM(i){if(i!=null){if(j(i))return i;{let r=i,e="";for(let t in r){e+=`${t} {
60
+ </i>`}function dM(){return`<i class="${X_}" ${tO} title="Clear Selection">
61
+ <svg:svg viewBox="${tM}" stroke="currentColor" fill="currentColor"><svg:path d="${rM}"/></svg:svg>
62
+ </i>`}function uM(i){return`<i class="${Y_}" ${q_} title="${i}">
63
+ <svg:svg viewBox="${nM}" stroke="currentColor" fill="currentColor"><svg:path d="${iM}"/></svg:svg>
64
+ </i>`}function pM(){return`<i class="${nx}" ${Es}="${bi}" title="Select Mode">
65
+ <svg:svg fill="currentColor" viewBox="${ZI}" stroke="currentColor"><svg:path d="${JI}"/></svg:svg>
66
+ </i>`}function gM(){return`<i class="${nx}" ${Es}="${jn}" title="Vertex Drawing Mode">
67
+ <svg:svg fill="currentColor" viewBox="${KI}" stroke="currentColor"><svg:path d="${qI}"/></svg:svg>
68
+ </i>`}var mM=(i,r,e)=>{let t=`<div ${HI}="${r.orientation}" class="${kg}" ${k_}="false" ${W_}="false">`,n=e.filter(u=>u.mode!=null),o=n.map(u=>`<i data-mode="${u.mode}" class="${u.class}" title="${u.title}"></i>`).join(""),s=r.hasLasso||r.hasVertexDrawing||n.length>0?aM():"",a=(r.hasLasso?pM():"")+(r.hasVertexDrawing?gM():""),l=(r.showZoomToExtentsButton?lM():"")+(r.showZoomButtons?hM()+cM():"")+(r.showUndoRedoButtons?`<i class="${F_}" ${Z_} title="Undo last action"></i><i class="${U_}" ${J_} title="Redo last action"></i>`:"")+dM()+(r.showClearButton?uM(i):""),h="</div>",d=e.filter(u=>u.mode==null).map(u=>`<i class="${u.class}" title="${u.title}"></i>`).join("");return t+s+a+o+l+d+h},Wg=class{constructor(r,e,t){this.container=r;c(this,"M");c(this,"Ze");c(this,"ch");c(this,"S");c(this,"dh");c(this,"H");c(this,"rm");c(this,"nm");c(this,"im");c(this,"om");this.S=e,this.dh=(t==null?void 0:t.clearMessage)||jI,this.rm=(t==null?void 0:t.clear)!==!1,this.nm=(t==null?void 0:t.undoRedo)!==!1,this.im=(t==null?void 0:t.zoomToExtents)!==!1,this.om=(t==null?void 0:t.zoom)===!0,this.H=(t==null?void 0:t.orientation)||"row",this.ch=(t==null?void 0:t.buttons)||[],this.M=Ar({}),this.uh(),this.Zx()}uh(){let r=this.S.getPlugin(kn.type)!=null,e=this.S.getPlugin(Ai.type)!=null,t=mM(this.dh,{orientation:this.H,showClearButton:this.rm,showUndoRedoButtons:this.nm,hasLasso:r,hasVertexDrawing:e,showZoomToExtentsButton:this.im,showZoomButtons:this.om},this.ch);this.Ze=this.M.template($(),{},()=>t).childNodes[0],this.container.replaceChildren(this.Ze)}Zx(){this.S.bind(hu,e=>{this.uh()}),this.S.bind(gS,e=>{this.uh()}),this.S.model.bind(Zs,e=>{this.Ze.setAttribute(k_,e.undoCount>0?Pt:ct),this.Ze.setAttribute(W_,e.redoCount>0?Pt:ct)});let r=()=>{this.S.model.getSelection().isEmpty()?this.Ze.removeAttribute(H_):this.Ze.setAttribute(H_,"true")};this.S.model.bind(qt,r),this.S.model.bind(Qt,r),this.S.model.bind(ir,r),this.S.on(this.container,W,Ae(Z_),()=>{this.S.model.undo()}),this.S.on(this.container,W,Ae(J_),()=>{this.S.model.redo()}),this.S.bind(Ln,e=>{Array.from(this.Ze.querySelectorAll(Ae(Es))).forEach(t=>{this.S.removeClass(t,ix)}),this.S.addClass(this.S.$getSelector(this.Ze,`[${Es}='${e}']`),ix)}),this.S.on(this.container,W,Ae(Es),(e,t)=>{this.S.setMode(t.getAttribute(Es))}),this.S.on(this.container,W,Ae(K_),(e,t)=>{this.S.model.clearSelection(),this.S.zoomToFit()}),this.S.on(this.container,W,Ae(Q_),(e,t)=>{this.S.zoomIn()}),this.S.on(this.container,W,Ae(eO),(e,t)=>{this.S.zoomOut()}),this.S.on(this.container,W,Ae(tO),()=>{this.S.model.clearSelection(),oP(this.S)&&this.S.stopEditingPath()}),this.S.on(this.container,W,Ae(q_),(e,t)=>{(this.S.model.getNodeCount()+this.S.model.getGroupCount()===0||confirm(this.dh))&&this.S.model.clear()}),this.ch.forEach(e=>{this.S.on(this.container,W,z(e.class),(t,n)=>{e.handler&&e.handler(t,e.id)})})}};var Zg="vjs-export-underlay",Jg="vjs-export-overlay",Kg="vjs-export-cancel",nO="vjs-export-dimensions",iO="vjs-export-download-tools",qg="visuallyjs-export",Qg="Download",Ua={png:"image/png",svg:"image/svg+xml",jpeg:"image/jpeg"},ox="svg",ec="png",fs="jpg";function EM(i){if(i!=null){if(j(i))return i;{let r=i,e="";for(let t in r){e+=`${t} {
69
69
  `;for(let n in r[t])e+=`${n}:${r[t][n]};
70
70
  `;e+=`}
71
- `}return e}}else return null}function Fa(i,r){r=r||{};let e=r.margins||{x:50,y:50},t=r.showGrid!==!1,o=i.getContainer().cloneNode(!0);Array.from(o.attributes).forEach(f=>o.removeAttribute(f.name)),o.setAttribute("xmlns",Gt),o.removeAttribute("class"),Array.from(o.querySelectorAll("[data-vjs-noexport]")).forEach(f=>f.parentNode.removeChild(f)),i.model.getGroups().map(f=>i.viewport.getGroupElement(f.id)).forEach(f=>{if(f.collapsed===!0){Ms(f.modelObject).forEach(T=>{let S=o.querySelector(`[data-vjs-vertex='${T.id}']`);S&&S.parentNode.removeChild(S)});let b=f.el.querySelector(iy);b&&b.parentNode.removeChild(b);let A=f.el.querySelector(kp);A&&A.parentNode.removeChild(A)}else{let b=f.el.querySelector(Wp);b&&b.parentNode.removeChild(b)}});let a=o.querySelector(".vjs-vertex-group");Array.from(a.childNodes).forEach(f=>{o.appendChild(f)});let l=o.querySelector(".vjs-edge-group");Array.from(l.childNodes).forEach(f=>{let b=f.getAttribute(Qe);i.getRenderedConnection(b).visible!==!1?o.appendChild(f):f.parentNode.removeChild(f)});let h=i.viewport.getExtents(),d=h.xmax-h.xmin,u=h.ymax-h.ymin,p={x:h.xmin-e.x,width:d+2*e.x,y:h.ymin-e.y,height:u+2*e.y},m=o.querySelector(".vjs-background");if(m!=null)if(t===!1)m.parentNode.removeChild(m);else{let f=i.getGrid();if(f!=null){let b=le(p,f);p.x=b.x,p.y=b.y;let A=le({x:p.x+p.width,y:p.y+p.height},f);p.width=A.x-p.x,p.height=A.y-p.y}m.setAttribute(Q,`${p.x}`),m.setAttribute(ye,`${p.y}`),m.setAttribute(Pe,`${p.width}`),m.setAttribute(Me,`${p.height}`),m.removeAttribute("transform"),m.removeAttribute("viewBox")}o.setAttribute("viewBox",`${p.x} ${p.y} ${p.width} ${p.height}`);let g=o.querySelector(".vjs-vertex-layer");o.removeChild(g);let E=o.querySelector(".vjs-tools-layer");if(E!=null&&o.removeChild(E),Array.from(o.querySelectorAll([z(oo),z(so)].join(","))).forEach(f=>f.parentNode.removeChild(f)),Array.from(o.querySelectorAll("*")).forEach(f=>{Object.values(f.attributes).filter(b=>b.name.indexOf("data-vjs")===0).forEach(b=>f.removeAttribute(b.name)),f.removeAttribute("class"),f.removeAttribute("style"),f.removeAttribute("pointer-events")}),r.width&&o.setAttribute(Pe,`${r.width}`),r.height&&o.setAttribute(Me,`${r.height}`),r.style!=null){let f=G("style");o.insertBefore(f,o.childNodes[0]),f.innerHTML=iM(r.style)}return{element:o,extents:p,svg:o.outerHTML.replace(/\n/g,"")}}function oM(i){let e=0,t="",n,o=i.length;for(;e<o;)n=i.subarray(e,Math.min(e+32768,o)),t+=String.fromCodePoint.apply(null,n),e+=32768;return btoa(t)}function sM(i){let r=new TextEncoder().encode(i);return oM(r)}function aM(i){return sM(i.outerHTML)}function t_(i){let r=aM(i);return lM(r)}function lM(i){return`data:image/svg+xml;base64,${i}`}function Jm(i,r,e){let t=Fa(i,r);rx(t,r,e)}function rx(i,r,e){r=r||{};let t=r.type||"image/png",n=r.quality,o=document.createElement("canvas");o.style.left="-50000px",o.style.top="-50000px",o.style.opacity="0",document.body.appendChild(o);let s=o.getContext("2d"),a=i.extents.width/i.extents.height,l=i.extents.width,h=i.extents.height;r.width?(l=r.width,h=l/a):r.height&&(h=r.height,l=h*a),o.width=l,o.height=h,s.fillStyle="white",s.fillRect(0,0,l,h);let d=new Image;d.onload=()=>{s.drawImage(d,0,0,l,h);let u=o.toDataURL(t,n);o.parentElement.removeChild(o),e({url:u,width:l,height:h,contentType:t,element:i.element})},d.onerror=u=>{U(`VisuallyJs: image export failed to load ${u}`)},i.element.setAttribute(Pe,`${l}`),i.element.setAttribute(Me,`${h}`),d.src=t_(i.element)}var Km=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement("div"),this.underlay.className=jm,this.underlay.addEventListener(ze,e=>{e.target===this.underlay&&this.Wi()}),this.overlay=document.createElement("div"),this.overlay.className=Hm,this.closeButton=document.createElement("div"),this.closeButton.className=km,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(ze,()=>{this.Wi()})}Wi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}export(r){r=r||{};let e=Fa(this.ui,r);this.overlay.appendChild(e.element);let t=new Blob([e.svg],{type:Ba.svg}),n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=r.filename||Wm,o.innerHTML=r.downloadButtonLabel||Zm,this.overlay.appendChild(o),document.body.appendChild(this.underlay),document.body.appendChild(this.overlay)}};var qh=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement(Ke),this.underlay.className=jm,this.underlay.addEventListener(ze,e=>{e.target===this.underlay&&this.Wi()}),this.overlay=document.createElement(Ke),this.overlay.className=Hm,this.closeButton=document.createElement(Ke),this.closeButton.className=km,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(ze,()=>{this.Wi()})}Wi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}Ix(r){r=Object.assign({},r||{}),r.dimensions&&Object.assign(r,r.dimensions[0]),this.Kp(r,e=>{this.overlay.appendChild(e.element);let t=e.width/e.height,n=document.createElement("div");n.className=e_,this.overlay.appendChild(n);let o=document.createElement("a");if(o.href=e.url,o.download=r.filename||Wm,o.innerHTML=r.downloadButtonLabel||Zm,n.appendChild(o),r.dimensions){let s=document.createElement("select");s.className=QO,r.dimensions.forEach(a=>{let l=document.createElement("option"),h=a.width?Math.floor(a.width/t):a.height,d=a.width?a.width:Math.floor(a.height*t);l.innerHTML=`${d}x${h}`,l.setAttribute(Pe,`${d}`),l.value=`${d}`,s.appendChild(l)}),s.addEventListener("change",()=>{let a=s.options[s.selectedIndex],l=parseInt(a.getAttribute(Pe),10);this.Kp(r,h=>{r.onDimensionsChanged&&r.onDimensionsChanged(h.width,h.height,h.url),o.href=h.url},l)}),n.appendChild(s)}document.body.appendChild(this.underlay),document.body.appendChild(this.overlay),r.onShow&&r.onShow(this.overlay,e.width,e.height,e.url)})}export(r){this.Ix(r)}Kp(r,e,t){t&&(r.width=t,delete r.height),Jm(this.ui,r,e)}};var hM=(i,r,e,t,n)=>{let o=`<div class="${zm} ${BO}">`,s=i?`<span>${r}</span>`:"",a=e?`<i><a href="#" data-type="${tx}">SVG</a></i>`:"",l=t?`<i><a href="#" data-type="${Kh}">PNG</a></i>`:"",h=n?`<i><a href="#" data-type="${ps}">JPG</a></i>`:"";return o+s+a+l+h+"</div>"},Ua=class{constructor(r,e,t){this.ui=e;c(this,"M");c(this,"Ze");t=t||{};let n=t.showLabel!==!1,o=t.label||"Export :",s=t.allowSvgExport!==!1,a=t.allowPngExport!==!1,l=t.allowJpgExport!==!1,h=hM(n,o,s,a,l);this.M=Ar({templates:{component:h}}),this.Ze=this.M.template("component",{}).childNodes[0],r.replaceChildren(this.Ze),this.ui.on(this.Ze,W,"a",d=>{let u=d.target.dataset.type,p,m,g,E,y,x;switch(u){case tx:p=t.svgOptions||{},t.margins!=null&&p.margins==null&&Object.assign(p,t.margins),m=new Km(this.ui),m.export(p);break;case Kh:g=t.imageOptions||{},t.margins!=null&&g.margins==null&&Object.assign(g,t.margins),y=new qh(this.ui),y.export(g);break;case ps:E=t.imageOptions||{},t.margins!=null&&E.margins==null&&Object.assign(E,t.margins),E.type="image/jpeg",x=new qh(this.ui),x.export(E);break}})}};var Qh="recentColors";var ue={Attributes:{POSITION:"data-position",AXIS:"data-axis",VJS_CANCEL:"vjs-cancel",VJS_COMMIT:"vjs-commit",MULTIPLE:"multiple",VJS:"vjs-att",VJS_PORT:"vjs-port",DATATYPE:"vjs-datatype",TITLE:"title",FOCUS:"vjs-focus",TYPE:"type",CANCEL:"cancel",ID:"id"},Values:{BLOCK:"block",VISIBLE:"visible",HIDDEN:"hidden",FIXED:"fixed",ABSOLUTE:"absolute",TOP:Se,BOTTOM:ht,X:"x",Y:"y",TRUE:"true",FALSE:"false",NONE:"none",PX:"px"},Events:{RESIZE:"resize",CLICK:"click",KEYUP:"keyup",SCROLL:"scroll"},Elements:{BUTTON:"button",DIV:"div",TEXT:"TEXT",RADIO:"RADIO",CHECKBOX:"CHECKBOX",SELECT:"SELECT",TEXTAREA:"TEXTAREA",COLOR:"COLOR",HIDDEN:"HIDDEN",INPUT:"INPUT",NUMBER:"NUMBER",RANGE:"RANGE"}};var qr=ue.Attributes,r_=ue.Events,Oe=ue.Elements,cM={[Oe.TEXT]:i=>i.value,[Oe.NUMBER]:i=>i.value,[Oe.RADIO]:i=>{if(i.checked)return i.value},[Oe.CHECKBOX]:i=>{if(i.checked)return!0},[Oe.SELECT]:i=>{let r=i.selectedOptions;if(i.getAttribute(qr.MULTIPLE)){let t=[];for(let n=0;n<r.length;n++)t.push(r[n].value);return t}else return i.selectedIndex!==-1?i.options[i.selectedIndex].value:null},[Oe.TEXTAREA]:i=>i.value,[Oe.COLOR]:i=>i.value,[Oe.HIDDEN]:i=>i.value};function cIe(i,r){let e=i.querySelectorAll(Ae(qr.VJS)),t={};for(let n=0;n<e.length;n++){let o=uM(e[n],r);if(o!=null){let s=e[n].getAttribute(qr.VJS),a=we(t,s);a!=null?(Array.isArray(a)||(a=[a],we(t,s,a)),a.push(o)):we(t,s,o)}}return t}var dM={integer:i=>parseInt(i,10),float:i=>parseFloat(i)};function qm(i,r){if(r==null)return i;try{return dM[r](i)}catch(e){return i}}function uM(i,r){let e=i.tagName.toUpperCase(),t=e===Oe.INPUT?(i.getAttribute(qr.TYPE)||Oe.TEXT).toUpperCase():e,n=cM[t],o;if(n!=null){if(o=n(i),o!=null){let s=i.getAttribute(qr.DATATYPE);s!=null&&(o=qm(o,s))}}else r!=null&&(o=r(i));return o}function ms(i,r,e){return e==null||e.length===0?i:`${e}${r}${i}`}function n_(i,r,e,t){let n=r.querySelectorAll(Ae(qr.VJS));for(let o=0;o<n.length;o++){let s=n[o].tagName.toUpperCase(),a=n[o].getAttribute(qr.VJS_PORT),l=s===Oe.INPUT?(n[o].getAttribute(qr.TYPE)||Oe.TEXT).toUpperCase():s,h=n[o].getAttribute(qr.VJS),d=ms(h,e,a),u=i[d],p=pM[l];if(p!=null)p(n[o],u);else continue;t!=null&&n[o].getAttribute(qr.VJS_COMMIT)&&(s===Oe.INPUT?n[o].addEventListener(r_.KEYUP,m=>{(m.keyCode===10||m.keyCode===13)&&t(n[o])}):s===Oe.TEXTAREA&&n[o].addEventListener(r_.KEYUP,m=>{m.ctrlKey&&(m.keyCode===10||m.keyCode===13)&&t(n[o])}))}}function dIe(i,r){for(let e=0;e<i.length;e++){if(i[e]===r)continue;let t=i[e].tagName.toUpperCase(),n=t===Oe.INPUT?(i[e].getAttribute(qr.TYPE)||Oe.TEXT).toUpperCase():t,o=mM[n];o&&o(i[e])}}var pM={[Oe.TEXT]:(i,r)=>{i.value=r||""},[Oe.NUMBER]:(i,r)=>{i.value=r||""},[Oe.RADIO]:(i,r)=>{i.checked=i.value==r},[Oe.CHECKBOX]:(i,r)=>{Array.isArray(r)?i.checked=r.indexOf(i.value)!==-1:i.checked=r===!0||r==="true"},[Oe.SELECT]:(i,r)=>{if(r==null){i.selectedIndex=-1;for(let e=0;e<i.options.length;e++)i.options[e].selected=!1}else{let e=i.getAttribute(qr.MULTIPLE);for(let t=0;t<i.options.length;t++)if(e)r.indexOf(i.options[t].value)>-1&&(i.options[t].selected=!0);else if(i.options[t].value==r){i.selectedIndex=t;return}}},[Oe.TEXTAREA]:(i,r)=>{i.value=r||""},[Oe.COLOR]:(i,r)=>{i.value=r||""},[Oe.HIDDEN]:(i,r)=>{i.value=r||""}},mM={[Oe.TEXT]:i=>{i.value=""},[Oe.RADIO]:i=>{i.checked=!1},[Oe.CHECKBOX]:i=>{i.checked=!1},[Oe.SELECT]:i=>{i.selectedIndex=-1},[Oe.TEXTAREA]:i=>{i.value=""},[Oe.COLOR]:i=>{i.value=""},[Oe.HIDDEN]:i=>{i.value=""}};var i_="input",o_="blur",s_="keypress",a_="vjs-inspector-active",Qm="vjs-inspector-inactive",gM="vjs-inspector",l_="vjs-inspector-close",eg="change",tg=class extends ep{constructor(e){super(e.context);c(this,"container");c(this,"$ui");c(this,"model");c(this,"eventManager");c(this,"qp");c(this,"Qp",[]);c(this,"vr",[]);c(this,"sh");c(this,"ah");c(this,"em");c(this,"zt");c(this,"lh");c(this,"Cr",!1);c(this,"xt",new Map);c(this,"current",[]);c(this,"bt",{});c(this,"pt");c(this,"$getDefaultValue");c(this,"hh");c(this,"$eventManager");c(this,"nm",()=>{this.$_recomputeCommonData(),n_(this.bt,this.container,this.model.portSeparator);let e=this.container.querySelectorAll(Ae(ue.Attributes.FOCUS))[0];e!=null&&e.focus(),this.hh&&this.rm(),this.fire(eg,this.bt)});this.$eventManager=new xe,this.container=e.container,this.$ui=e.ui,this.model=this.$ui.model,this.eventManager=new xe,this.qp=e.multipleSelections!==!1,this.lh=e.afterUpdate,this.em=e.renderEmptyContainer,this.zt=e.refresh,this.sh=e.autoCommit!==!1,this.ah=e.doNotWriteBlankNewValues!==!1,this.pt=e.filter||(t=>!0),this.$getDefaultValue=e.getDefaultValue||((t,n)=>null),this.hh=e.showCloseButton===!0,this.ensureContext(Qh,()=>[]),this.container.classList.add(gM),this.container.classList.add(Qm),this.Vx(),this.$ui.registerDataHook({load:t=>{let n=we(t,"inspectorContext");n!=null&&n.recentColors!=null&&this.updateContext(Qh,n.recentColors.slice())},save:t=>{we(t,"inspectorContext",this.$context)}})}Vx(){this.model.bind(qt,h=>{this.isSuspendEvents()||this.ch(h.obj)}),this.model.bind(Qt,h=>{this.tt(h.obj)}),this.model.bind(ve,h=>{this.tt(h.node)}),this.model.bind(_e,h=>{this.tt(h.group)}),this.model.bind(Vr,h=>{this.tt(h.port)}),this.model.bind(bt,h=>{this.tt(h.edge)}),this.model.bind(ir,()=>{this.sh&&Array.from(this.xt.entries()).filter(d=>d[1].edited&&d[1].editedValue!=null).forEach(d=>{this.setValue(d[0],d[1].editedValue,d[1].portId),delete d[1].editedValue}),this.reset(!1)}),this.model.bind(js,h=>{this.isSuspendEvents()||(this.Cr=!0,this.ch(),this.Cr=!1)});let e=h=>{this.$updateObject(h.vertex)},t=h=>{this.$updateObject(h.port)},n=h=>{this.$updateObject(h.edge)};this.model.bind(Re,e),this.model.bind(Te,e),this.model.bind(dr,t),this.model.bind(xt,n);let o=h=>{this.Cr||setTimeout(()=>{let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),m=ms(u,this.model.portSeparator,p);if(u!=null&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)&&(d.checkValidity==null||d.checkValidity())){let g=this.xt.get(m);if(g!=null&&(!g.common||g.edited)){let E=d.value;this.setValue(u,E,p),g.edited=!1,delete g.editedValue}}},0)};this.container.addEventListener(o_,o,!0);let s=h=>{if(!this.Cr){let d=h.target,u=d.type.toUpperCase(),p=d.getAttribute(ue.Attributes.VJS),m=d.getAttribute(ue.Attributes.VJS_PORT),g=ms(p,this.model.portSeparator,m);if(p!=null)if(u===ue.Elements.CHECKBOX){let E=this.bt[g],y=m==null?this.container.querySelectorAll(`input[type='checkbox'][${ue.Attributes.VJS}='${p}']`):this.container.querySelectorAll(`input[type='checkbox'][${ue.Attributes.VJS}='${p}'][${ue.Attributes.VJS_PORT}='${m}']`);if(Array.isArray(E)||E==null&&y.length>1){let f=[];y.forEach(b=>{b.checked&&f.push(b.value)}),this.setValue(p,f,m)}else this.setValue(p,d.checked===!0,m)}else if(u===ue.Elements.RADIO)d.checked&&this.setValue(p,qm(d.value,d.getAttribute(ue.Attributes.DATATYPE)),m);else if(u===ue.Elements.COLOR||u===ue.Elements.NUMBER||u===ue.Elements.RANGE)this.setValue(p,d.value,m);else if(u===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA){let E=this.xt.get(g);E.edited=!0,E.editedValue=d.value}else d.tagName.toUpperCase()===ue.Elements.SELECT&&this.setValue(p,qm(d.value,d.getAttribute(ue.Attributes.DATATYPE)),m)}};this.container.addEventListener(eg,s,!0);let a=h=>{if(!this.Cr){let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),m=ms(u,this.model.portSeparator,p);if(u!=null&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)){let g=this.xt.get(m);g.edited=!0,g.editedValue=d.value}}};this.container.addEventListener(i_,a,!0);let l=h=>{if(!this.Cr){let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),m=ms(u,this.model.portSeparator,p);if(u!=null&&(h.keyCode===13||h.key==="13")&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)){let g=this.xt.get(m);g.edited=!0,this.setValue(u,d.value,p)}}};this.container.addEventListener(s_,l,!0),this.$ui.bind($i,()=>{this.container.removeEventListener(s_,l),this.container.removeEventListener(eg,s),this.container.removeEventListener(o_,o),this.container.removeEventListener(i_,a),this.model.unbind(Re,e),this.model.unbind(Te,e),this.model.unbind(dr,e),this.model.unbind(xt,n),this.Mx()})}$updateObject(e){if(!this.isSuspendEvents()){let t=this.current.findIndex(n=>n===e);t!==-1&&(this.current.splice(t,1),this.ch(e))}}$_recomputeCommonData(){this.bt={};let e={},t=new Set;this.current.forEach(n=>{Object.keys(n.data).forEach(o=>t.add(o)),(Y(n)||K(n))&&n.getPorts().forEach(o=>{Object.keys(o.data).forEach(s=>t.add(`${o.id}${this.model.portSeparator}${s}`))})}),this.xt.forEach((n,o)=>t.add(o));for(let n=0;n<this.current.length;n++){let o=this.current[n],s=Y(o)||K(o);t.forEach(a=>{var l;if(!e[a]){let h=o.data,d=a;if(s){let p=a.split(this.model.portSeparator);d=p[p.length-1],p.length===2&&(h=((l=o.getPort(p[0]))==null?void 0:l.data)||{})}let u=h[d];u==null&&this.$getDefaultValue!=null&&(u=this.$getDefaultValue(h,d)),this.bt[a]==null?this.bt[a]=u:this.bt[a]!==u&&(e[a]=!0,this.bt[a]="")}})}for(let n in e){let o=this.xt.get(n);o!=null&&(o.common=!0,o.commonValue=this.bt[n])}}Gx(e,t,n){let o={};for(let s in e)n.has(s)?t[s]!=null&&(o[s]=""):o[s]=e[s];return o}tm(e){this.setSuspendEvents(!0);let t=0;try{this.model.openTransaction();try{e.forEach(n=>{let o=this.ah?new Map(Object.entries(n.updates).filter(s=>typeof s[1]=="string"&&s[1].length===0)):null;this.current.forEach((s,a)=>{let l=n.portId==null?s:s.getPort(n.portId);if(this.ah){let h=this.Gx(n.updates,l.data,o);Object.keys(h).length>0&&(this.model.update(l,h),t++)}else this.model.update(l,n.updates),t++})})}catch(n){U("WARN: error occurred updating item from inspector")}t>0?this.model.commitTransaction():this.model.rollbackTransaction(),this.lh&&this.lh()}finally{this.setSuspendEvents(!1)}}$x(e){this.sh?this.tm([e]):this.vr.push(e)}reset(e){try{this.Cr=!0,this.vr.length=0,this.container.classList.remove(a_),this.container.classList.add(Qm),e||(this.em(),this.current.length=0,this.hh&&this.rm())}finally{this.Cr=!1}}Mx(){this.current.length=0,this.vr.length=0,this.xt.clear(),this.container.innerHTML=""}tt(e){let t=this.current.indexOf(e);t!==-1?this.current.splice(t,1):(K(e)||Y(e))&&(t=this.current.findIndex(n=>H(n)&&n.getParent().id===e.id),t!==-1&&this.current.splice(t,1)),this.current.length===0?this.reset(!1):this.$_recomputeCommonData()}rm(){if(!this.container.querySelector(z(l_))){let e=document.createElement(Ke);e.classList.add(l_),this.container.insertBefore(e,null),this.$eventManager.on(e,W,()=>this.model.clearSelection())}}ch(e){if(e!=null&&!this.pt(e))return;let t=!this.qp||this.current.length===0;t&&this.reset(!0),e!=null?(this.container.classList.remove(Qm),this.container.classList.add(a_),this.vr.length=0,this.current.push(e),t?this.zt(e,()=>this.$refresh()):this.nm()):this.container.classList.add(Qm)}$refresh(){this.xt.clear(),this.container.querySelectorAll(Ae(ue.Attributes.VJS)).forEach(t=>{let n=t.getAttribute(ue.Attributes.VJS),o=t.getAttribute(ue.Attributes.VJS_PORT),s=ms(n,this.model.portSeparator,o);this.xt.set(s,{field:t,edited:!1,common:!1,commonValue:null,attribute:n,portId:o})}),this.nm()}addValueListener(e){this.Qp.push(e)}setValue(e,t,n,o){this.$x({portId:n,updates:{[e]:t}}),this.Qp.forEach(s=>s(e,t)),o&&this.redraw()}Bx(e,t){return this.$getDefaultValue(e,t)}getValue(e){return this.bt[e]}onChange(e){this.bind(eg,e)}persist(){let e=this.vr.length;return e>0&&(this.tm(this.vr),this.vr.length=0),e}hasPendingChanges(){return this.vr.length!==0}redraw(){this.current.forEach(e=>this.$updateObject(e))}};var EM="vjs-color-picker",h_="vjs-color-picker-swatches",c_="vjs-color-picker-swatch",fM="vjs-color",yM="vjs-max-colors";function d_(i,r=Qh){i.registerTag(fM,{template:`<div class="${EM}">
71
+ `}return e}}else return null}function Ya(i,r){r=r||{};let e=r.margins||{x:50,y:50},t=r.showGrid!==!1,o=i.getContainer().cloneNode(!0);Array.from(o.attributes).forEach(f=>o.removeAttribute(f.name)),o.setAttribute("xmlns",Gt),o.removeAttribute("class"),Array.from(o.querySelectorAll("[data-vjs-noexport]")).forEach(f=>f.parentNode.removeChild(f)),i.model.getGroups().map(f=>i.viewport.getGroupElement(f.id)).forEach(f=>{if(f.collapsed===!0){Bs(f.modelObject).forEach(T=>{let S=o.querySelector(`[data-vjs-vertex='${T.id}']`);S&&S.parentNode.removeChild(S)});let b=f.el.querySelector(ly);b&&b.parentNode.removeChild(b);let A=f.el.querySelector(Kp);A&&A.parentNode.removeChild(A)}else{let b=f.el.querySelector(qp);b&&b.parentNode.removeChild(b)}});let a=o.querySelector(".vjs-vertex-group");Array.from(a.childNodes).forEach(f=>{o.appendChild(f)});let l=o.querySelector(".vjs-edge-group");Array.from(l.childNodes).forEach(f=>{let b=f.getAttribute(Qe);i.getRenderedConnection(b).visible!==!1?o.appendChild(f):f.parentNode.removeChild(f)});let h=i.viewport.getExtents(),d=h.xmax-h.xmin,u=h.ymax-h.ymin,p={x:h.xmin-e.x,width:d+2*e.x,y:h.ymin-e.y,height:u+2*e.y},g=o.querySelector(".vjs-background");if(g!=null)if(t===!1)g.parentNode.removeChild(g);else{let f=i.getGrid();if(f!=null){let b=he(p,f);p.x=b.x,p.y=b.y;let A=he({x:p.x+p.width,y:p.y+p.height},f);p.width=A.x-p.x,p.height=A.y-p.y}g.setAttribute(ee,`${p.x}`),g.setAttribute(ye,`${p.y}`),g.setAttribute(_e,`${p.width}`),g.setAttribute(Ve,`${p.height}`),g.removeAttribute("transform"),g.removeAttribute("viewBox")}o.setAttribute("viewBox",`${p.x} ${p.y} ${p.width} ${p.height}`);let m=o.querySelector(".vjs-vertex-layer");o.removeChild(m);let E=o.querySelector(".vjs-tools-layer");if(E!=null&&o.removeChild(E),Array.from(o.querySelectorAll([z(so),z(ao)].join(","))).forEach(f=>f.parentNode.removeChild(f)),Array.from(o.querySelectorAll("*")).forEach(f=>{Object.values(f.attributes).filter(b=>b.name.indexOf("data-vjs")===0).forEach(b=>f.removeAttribute(b.name)),f.removeAttribute("class"),f.removeAttribute("style"),f.removeAttribute("pointer-events")}),r.width&&o.setAttribute(_e,`${r.width}`),r.height&&o.setAttribute(Ve,`${r.height}`),r.style!=null){let f=V("style");o.insertBefore(f,o.childNodes[0]),f.innerHTML=EM(r.style)}return{element:o,extents:p,svg:o.outerHTML.replace(/\n/g,"")}}function fM(i){let e=0,t="",n,o=i.length;for(;e<o;)n=i.subarray(e,Math.min(e+32768,o)),t+=String.fromCodePoint.apply(null,n),e+=32768;return btoa(t)}function yM(i){let r=new TextEncoder().encode(i);return fM(r)}function xM(i){return yM(i.outerHTML)}function oO(i){let r=xM(i);return bM(r)}function bM(i){return`data:image/svg+xml;base64,${i}`}function em(i,r,e){let t=Ya(i,r);sx(t,r,e)}function sx(i,r,e){r=r||{};let t=r.type||"image/png",n=r.quality,o=document.createElement("canvas");o.style.left="-50000px",o.style.top="-50000px",o.style.opacity="0",document.body.appendChild(o);let s=o.getContext("2d"),a=i.extents.width/i.extents.height,l=i.extents.width,h=i.extents.height;r.width?(l=r.width,h=l/a):r.height&&(h=r.height,l=h*a),o.width=l,o.height=h,s.fillStyle="white",s.fillRect(0,0,l,h);let d=new Image;d.onload=()=>{s.drawImage(d,0,0,l,h);let u=o.toDataURL(t,n);o.parentElement.removeChild(o),e({url:u,width:l,height:h,contentType:t,element:i.element})},d.onerror=u=>{U(`VisuallyJs: image export failed to load ${u}`)},i.element.setAttribute(_e,`${l}`),i.element.setAttribute(Ve,`${h}`),d.src=oO(i.element)}var tm=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement("div"),this.underlay.className=Zg,this.underlay.addEventListener(Xe,e=>{e.target===this.underlay&&this.Ji()}),this.overlay=document.createElement("div"),this.overlay.className=Jg,this.closeButton=document.createElement("div"),this.closeButton.className=Kg,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Xe,()=>{this.Ji()})}Ji(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}export(r){r=r||{};let e=Ya(this.ui,r);this.overlay.appendChild(e.element);let t=new Blob([e.svg],{type:Ua.svg}),n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=r.filename||qg,o.innerHTML=r.downloadButtonLabel||Qg,this.overlay.appendChild(o),document.body.appendChild(this.underlay),document.body.appendChild(this.overlay)}};var tc=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement(Ke),this.underlay.className=Zg,this.underlay.addEventListener(Xe,e=>{e.target===this.underlay&&this.Ji()}),this.overlay=document.createElement(Ke),this.overlay.className=Jg,this.closeButton=document.createElement(Ke),this.closeButton.className=Kg,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Xe,()=>{this.Ji()})}Ji(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}Jx(r){r=Object.assign({},r||{}),r.dimensions&&Object.assign(r,r.dimensions[0]),this.sm(r,e=>{this.overlay.appendChild(e.element);let t=e.width/e.height,n=document.createElement("div");n.className=iO,this.overlay.appendChild(n);let o=document.createElement("a");if(o.href=e.url,o.download=r.filename||qg,o.innerHTML=r.downloadButtonLabel||Qg,n.appendChild(o),r.dimensions){let s=document.createElement("select");s.className=nO,r.dimensions.forEach(a=>{let l=document.createElement("option"),h=a.width?Math.floor(a.width/t):a.height,d=a.width?a.width:Math.floor(a.height*t);l.innerHTML=`${d}x${h}`,l.setAttribute(_e,`${d}`),l.value=`${d}`,s.appendChild(l)}),s.addEventListener("change",()=>{let a=s.options[s.selectedIndex],l=parseInt(a.getAttribute(_e),10);this.sm(r,h=>{r.onDimensionsChanged&&r.onDimensionsChanged(h.width,h.height,h.url),o.href=h.url},l)}),n.appendChild(s)}document.body.appendChild(this.underlay),document.body.appendChild(this.overlay),r.onShow&&r.onShow(this.overlay,e.width,e.height,e.url)})}export(r){this.Jx(r)}sm(r,e,t){t&&(r.width=t,delete r.height),em(this.ui,r,e)}};var AM=(i,r,e,t,n)=>{let o=`<div class="${kg} ${z_}">`,s=i?`<span>${r}</span>`:"",a=e?`<i><a href="#" data-type="${ox}">SVG</a></i>`:"",l=t?`<i><a href="#" data-type="${ec}">PNG</a></i>`:"",h=n?`<i><a href="#" data-type="${fs}">JPG</a></i>`:"";return o+s+a+l+h+"</div>"},za=class{constructor(r,e,t){this.ui=e;c(this,"M");c(this,"Ze");t=t||{};let n=t.showLabel!==!1,o=t.label||"Export :",s=t.allowSvgExport!==!1,a=t.allowPngExport!==!1,l=t.allowJpgExport!==!1,h=AM(n,o,s,a,l);this.M=Ar({templates:{component:h}}),this.Ze=this.M.template("component",{}).childNodes[0],r.replaceChildren(this.Ze),this.ui.on(this.Ze,W,"a",d=>{let u=d.target.dataset.type,p,g,m,E,y,x;switch(u){case ox:p=t.svgOptions||{},t.margins!=null&&p.margins==null&&Object.assign(p,t.margins),g=new tm(this.ui),g.export(p);break;case ec:m=t.imageOptions||{},t.margins!=null&&m.margins==null&&Object.assign(m,t.margins),y=new tc(this.ui),y.export(m);break;case fs:E=t.imageOptions||{},t.margins!=null&&E.margins==null&&Object.assign(E,t.margins),E.type="image/jpeg",x=new tc(this.ui),x.export(E);break}})}};var rc="recentColors";var ue={Attributes:{POSITION:"data-position",AXIS:"data-axis",VJS_CANCEL:"vjs-cancel",VJS_COMMIT:"vjs-commit",MULTIPLE:"multiple",VJS:"vjs-att",VJS_PORT:"vjs-port",DATATYPE:"vjs-datatype",TITLE:"title",FOCUS:"vjs-focus",TYPE:"type",CANCEL:"cancel",ID:"id"},Values:{BLOCK:"block",VISIBLE:"visible",HIDDEN:"hidden",FIXED:"fixed",ABSOLUTE:"absolute",TOP:Te,BOTTOM:ht,X:"x",Y:"y",TRUE:"true",FALSE:"false",NONE:"none",PX:"px"},Events:{RESIZE:"resize",CLICK:"click",KEYUP:"keyup",SCROLL:"scroll"},Elements:{BUTTON:"button",DIV:"div",TEXT:"TEXT",RADIO:"RADIO",CHECKBOX:"CHECKBOX",SELECT:"SELECT",TEXTAREA:"TEXTAREA",COLOR:"COLOR",HIDDEN:"HIDDEN",INPUT:"INPUT",NUMBER:"NUMBER",RANGE:"RANGE"}};var Qr=ue.Attributes,sO=ue.Events,Oe=ue.Elements,SM={[Oe.TEXT]:i=>i.value,[Oe.NUMBER]:i=>i.value,[Oe.RADIO]:i=>{if(i.checked)return i.value},[Oe.CHECKBOX]:i=>{if(i.checked)return!0},[Oe.SELECT]:i=>{let r=i.selectedOptions;if(i.getAttribute(Qr.MULTIPLE)){let t=[];for(let n=0;n<r.length;n++)t.push(r[n].value);return t}else return i.selectedIndex!==-1?i.options[i.selectedIndex].value:null},[Oe.TEXTAREA]:i=>i.value,[Oe.COLOR]:i=>i.value,[Oe.HIDDEN]:i=>i.value};function TIe(i,r){let e=i.querySelectorAll(Ae(Qr.VJS)),t={};for(let n=0;n<e.length;n++){let o=vM(e[n],r);if(o!=null){let s=e[n].getAttribute(Qr.VJS),a=De(t,s);a!=null?(Array.isArray(a)||(a=[a],De(t,s,a)),a.push(o)):De(t,s,o)}}return t}var TM={integer:i=>parseInt(i,10),float:i=>parseFloat(i)};function rm(i,r){if(r==null)return i;try{return TM[r](i)}catch(e){return i}}function vM(i,r){let e=i.tagName.toUpperCase(),t=e===Oe.INPUT?(i.getAttribute(Qr.TYPE)||Oe.TEXT).toUpperCase():e,n=SM[t],o;if(n!=null){if(o=n(i),o!=null){let s=i.getAttribute(Qr.DATATYPE);s!=null&&(o=rm(o,s))}}else r!=null&&(o=r(i));return o}function ys(i,r,e){return e==null||e.length===0?i:`${e}${r}${i}`}function aO(i,r,e,t){let n=r.querySelectorAll(Ae(Qr.VJS));for(let o=0;o<n.length;o++){let s=n[o].tagName.toUpperCase(),a=n[o].getAttribute(Qr.VJS_PORT),l=s===Oe.INPUT?(n[o].getAttribute(Qr.TYPE)||Oe.TEXT).toUpperCase():s,h=n[o].getAttribute(Qr.VJS),d=ys(h,e,a),u=i[d],p=CM[l];if(p!=null)p(n[o],u);else continue;t!=null&&n[o].getAttribute(Qr.VJS_COMMIT)&&(s===Oe.INPUT?n[o].addEventListener(sO.KEYUP,g=>{(g.keyCode===10||g.keyCode===13)&&t(n[o])}):s===Oe.TEXTAREA&&n[o].addEventListener(sO.KEYUP,g=>{g.ctrlKey&&(g.keyCode===10||g.keyCode===13)&&t(n[o])}))}}function vIe(i,r){for(let e=0;e<i.length;e++){if(i[e]===r)continue;let t=i[e].tagName.toUpperCase(),n=t===Oe.INPUT?(i[e].getAttribute(Qr.TYPE)||Oe.TEXT).toUpperCase():t,o=PM[n];o&&o(i[e])}}var CM={[Oe.TEXT]:(i,r)=>{i.value=r||""},[Oe.NUMBER]:(i,r)=>{i.value=r||""},[Oe.RADIO]:(i,r)=>{i.checked=i.value==r},[Oe.CHECKBOX]:(i,r)=>{Array.isArray(r)?i.checked=r.indexOf(i.value)!==-1:i.checked=r===!0||r==="true"},[Oe.SELECT]:(i,r)=>{if(r==null){i.selectedIndex=-1;for(let e=0;e<i.options.length;e++)i.options[e].selected=!1}else{let e=i.getAttribute(Qr.MULTIPLE);for(let t=0;t<i.options.length;t++)if(e)r.indexOf(i.options[t].value)>-1&&(i.options[t].selected=!0);else if(i.options[t].value==r){i.selectedIndex=t;return}}},[Oe.TEXTAREA]:(i,r)=>{i.value=r||""},[Oe.COLOR]:(i,r)=>{i.value=r||""},[Oe.HIDDEN]:(i,r)=>{i.value=r||""}},PM={[Oe.TEXT]:i=>{i.value=""},[Oe.RADIO]:i=>{i.checked=!1},[Oe.CHECKBOX]:i=>{i.checked=!1},[Oe.SELECT]:i=>{i.selectedIndex=-1},[Oe.TEXTAREA]:i=>{i.value=""},[Oe.COLOR]:i=>{i.value=""},[Oe.HIDDEN]:i=>{i.value=""}};var lO="input",hO="blur",cO="keypress",dO="vjs-inspector-active",nm="vjs-inspector-inactive",_M="vjs-inspector",uO="vjs-inspector-close",im="change",om=class extends np{constructor(e){super(e.context);c(this,"container");c(this,"$ui");c(this,"model");c(this,"eventManager");c(this,"am");c(this,"lm",[]);c(this,"Cr",[]);c(this,"ph");c(this,"mh");c(this,"hm");c(this,"Yt");c(this,"gh");c(this,"Pr",!1);c(this,"bt",new Map);c(this,"current",[]);c(this,"At",{});c(this,"mt");c(this,"$getDefaultValue");c(this,"Eh");c(this,"$eventManager");c(this,"um",()=>{this.$_recomputeCommonData(),aO(this.At,this.container,this.model.portSeparator);let e=this.container.querySelectorAll(Ae(ue.Attributes.FOCUS))[0];e!=null&&e.focus(),this.Eh&&this.dm(),this.fire(im,this.At)});this.$eventManager=new xe,this.container=e.container,this.$ui=e.ui,this.model=this.$ui.model,this.eventManager=new xe,this.am=e.multipleSelections!==!1,this.gh=e.afterUpdate,this.hm=e.renderEmptyContainer,this.Yt=e.refresh,this.ph=e.autoCommit!==!1,this.mh=e.doNotWriteBlankNewValues!==!1,this.mt=e.filter||(t=>!0),this.$getDefaultValue=e.getDefaultValue||((t,n)=>null),this.Eh=e.showCloseButton===!0,this.ensureContext(rc,()=>[]),this.container.classList.add(_M),this.container.classList.add(nm),this.Kx(),this.$ui.registerDataHook({load:t=>{let n=De(t,"inspectorContext");n!=null&&n.recentColors!=null&&this.updateContext(rc,n.recentColors.slice())},save:t=>{De(t,"inspectorContext",this.$context)}})}Kx(){this.model.bind(qt,h=>{this.isSuspendEvents()||this.fh(h.obj)}),this.model.bind(Qt,h=>{this.rt(h.obj)}),this.model.bind(Ce,h=>{this.rt(h.node)}),this.model.bind(Re,h=>{this.rt(h.group)}),this.model.bind(Vr,h=>{this.rt(h.port)}),this.model.bind(bt,h=>{this.rt(h.edge)}),this.model.bind(ir,()=>{this.ph&&Array.from(this.bt.entries()).filter(d=>d[1].edited&&d[1].editedValue!=null).forEach(d=>{this.setValue(d[0],d[1].editedValue,d[1].portId),delete d[1].editedValue}),this.reset(!1)}),this.model.bind(Zs,h=>{this.isSuspendEvents()||(this.Pr=!0,this.fh(),this.Pr=!1)});let e=h=>{this.$updateObject(h.vertex)},t=h=>{this.$updateObject(h.port)},n=h=>{this.$updateObject(h.edge)};this.model.bind(Le,e),this.model.bind(ve,e),this.model.bind(dr,t),this.model.bind(xt,n);let o=h=>{this.Pr||setTimeout(()=>{let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),g=ys(u,this.model.portSeparator,p);if(u!=null&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)&&(d.checkValidity==null||d.checkValidity())){let m=this.bt.get(g);if(m!=null&&(!m.common||m.edited)){let E=d.value;this.setValue(u,E,p),m.edited=!1,delete m.editedValue}}},0)};this.container.addEventListener(hO,o,!0);let s=h=>{if(!this.Pr){let d=h.target,u=d.type.toUpperCase(),p=d.getAttribute(ue.Attributes.VJS),g=d.getAttribute(ue.Attributes.VJS_PORT),m=ys(p,this.model.portSeparator,g);if(p!=null)if(u===ue.Elements.CHECKBOX){let E=this.At[m],y=g==null?this.container.querySelectorAll(`input[type='checkbox'][${ue.Attributes.VJS}='${p}']`):this.container.querySelectorAll(`input[type='checkbox'][${ue.Attributes.VJS}='${p}'][${ue.Attributes.VJS_PORT}='${g}']`);if(Array.isArray(E)||E==null&&y.length>1){let f=[];y.forEach(b=>{b.checked&&f.push(b.value)}),this.setValue(p,f,g)}else this.setValue(p,d.checked===!0,g)}else if(u===ue.Elements.RADIO)d.checked&&this.setValue(p,rm(d.value,d.getAttribute(ue.Attributes.DATATYPE)),g);else if(u===ue.Elements.COLOR||u===ue.Elements.NUMBER||u===ue.Elements.RANGE)this.setValue(p,d.value,g);else if(u===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA){let E=this.bt.get(m);E.edited=!0,E.editedValue=d.value}else d.tagName.toUpperCase()===ue.Elements.SELECT&&this.setValue(p,rm(d.value,d.getAttribute(ue.Attributes.DATATYPE)),g)}};this.container.addEventListener(im,s,!0);let a=h=>{if(!this.Pr){let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),g=ys(u,this.model.portSeparator,p);if(u!=null&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)){let m=this.bt.get(g);m.edited=!0,m.editedValue=d.value}}};this.container.addEventListener(lO,a,!0);let l=h=>{if(!this.Pr){let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),g=ys(u,this.model.portSeparator,p);if(u!=null&&(h.keyCode===13||h.key==="13")&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)){let m=this.bt.get(g);m.edited=!0,this.setValue(u,d.value,p)}}};this.container.addEventListener(cO,l,!0),this.$ui.bind($i,()=>{this.container.removeEventListener(cO,l),this.container.removeEventListener(im,s),this.container.removeEventListener(hO,o),this.container.removeEventListener(lO,a),this.model.unbind(Le,e),this.model.unbind(ve,e),this.model.unbind(dr,e),this.model.unbind(xt,n),this.qx()})}$updateObject(e){if(!this.isSuspendEvents()){let t=this.current.findIndex(n=>n===e);t!==-1&&(this.current.splice(t,1),this.fh(e))}}$_recomputeCommonData(){this.At={};let e={},t=new Set;this.current.forEach(n=>{Object.keys(n.data).forEach(o=>t.add(o)),(Y(n)||K(n))&&n.getPorts().forEach(o=>{Object.keys(o.data).forEach(s=>t.add(`${o.id}${this.model.portSeparator}${s}`))})}),this.bt.forEach((n,o)=>t.add(o));for(let n=0;n<this.current.length;n++){let o=this.current[n],s=Y(o)||K(o);t.forEach(a=>{var l;if(!e[a]){let h=o.data,d=a;if(s){let p=a.split(this.model.portSeparator);d=p[p.length-1],p.length===2&&(h=((l=o.getPort(p[0]))==null?void 0:l.data)||{})}let u=h[d];u==null&&this.$getDefaultValue!=null&&(u=this.$getDefaultValue(h,d)),this.At[a]==null?this.At[a]=u:this.At[a]!==u&&(e[a]=!0,this.At[a]="")}})}for(let n in e){let o=this.bt.get(n);o!=null&&(o.common=!0,o.commonValue=this.At[n])}}Qx(e,t,n){let o={};for(let s in e)n.has(s)?t[s]!=null&&(o[s]=""):o[s]=e[s];return o}cm(e){this.setSuspendEvents(!0);let t=0;try{this.model.openTransaction();try{e.forEach(n=>{let o=this.mh?new Map(Object.entries(n.updates).filter(s=>typeof s[1]=="string"&&s[1].length===0)):null;this.current.forEach((s,a)=>{let l=n.portId==null?s:s.getPort(n.portId);if(this.mh){let h=this.Qx(n.updates,l.data,o);Object.keys(h).length>0&&(this.model.update(l,h),t++)}else this.model.update(l,n.updates),t++})})}catch(n){U("WARN: error occurred updating item from inspector")}t>0?this.model.commitTransaction():this.model.rollbackTransaction(),this.gh&&this.gh()}finally{this.setSuspendEvents(!1)}}eb(e){this.ph?this.cm([e]):this.Cr.push(e)}reset(e){try{this.Pr=!0,this.Cr.length=0,this.container.classList.remove(dO),this.container.classList.add(nm),e||(this.hm(),this.current.length=0,this.Eh&&this.dm())}finally{this.Pr=!1}}qx(){this.current.length=0,this.Cr.length=0,this.bt.clear(),this.container.innerHTML=""}rt(e){let t=this.current.indexOf(e);t!==-1?this.current.splice(t,1):(K(e)||Y(e))&&(t=this.current.findIndex(n=>H(n)&&n.getParent().id===e.id),t!==-1&&this.current.splice(t,1)),this.current.length===0?this.reset(!1):this.$_recomputeCommonData()}dm(){if(!this.container.querySelector(z(uO))){let e=document.createElement(Ke);e.classList.add(uO),this.container.insertBefore(e,null),this.$eventManager.on(e,W,()=>this.model.clearSelection())}}fh(e){if(e!=null&&!this.mt(e))return;let t=!this.am||this.current.length===0;t&&this.reset(!0),e!=null?(this.container.classList.remove(nm),this.container.classList.add(dO),this.Cr.length=0,this.current.push(e),t?this.Yt(e,()=>this.$refresh()):this.um()):this.container.classList.add(nm)}$refresh(){this.bt.clear(),this.container.querySelectorAll(Ae(ue.Attributes.VJS)).forEach(t=>{let n=t.getAttribute(ue.Attributes.VJS),o=t.getAttribute(ue.Attributes.VJS_PORT),s=ys(n,this.model.portSeparator,o);this.bt.set(s,{field:t,edited:!1,common:!1,commonValue:null,attribute:n,portId:o})}),this.um()}addValueListener(e){this.lm.push(e)}setValue(e,t,n,o){this.eb({portId:n,updates:{[e]:t}}),this.lm.forEach(s=>s(e,t)),o&&this.redraw()}tb(e,t){return this.$getDefaultValue(e,t)}getValue(e){return this.At[e]}onChange(e){this.bind(im,e)}persist(){let e=this.Cr.length;return e>0&&(this.cm(this.Cr),this.Cr.length=0),e}hasPendingChanges(){return this.Cr.length!==0}redraw(){this.current.forEach(e=>this.$updateObject(e))}};var OM="vjs-color-picker",pO="vjs-color-picker-swatches",gO="vjs-color-picker-swatch",RM="vjs-color",LM="vjs-max-colors";function mO(i,r=rc){i.registerTag(RM,{template:`<div class="${OM}">
72
72
  <input type="color"/>
73
- <div class="${h_}">
73
+ <div class="${pO}">
74
74
  <r-each in="$context.${r}">
75
- <div class="${c_}" style="background-color:{{$value}};" data-color="{{$value}}"/>
75
+ <div class="${gO}" style="background-color:{{$value}};" data-color="{{$value}}"/>
76
76
  </r-each>
77
77
  </div>
78
- </div>`,rendered:(e,t,n,o,s)=>{function a(m){let g=s[r];if(g!=null&&g.find(E=>E===m)==null){let E=g.slice();return E.unshift(m),E.length>=u&&(E.length=u),i.updateContext(r,E),!0}return!1}let l=e.getAttribute(ue.Attributes.VJS),h=new xe,d=e.querySelector("[type='color']"),u=e.getAttribute(yM)||10;i.bind($l,m=>{let g=e.querySelector(z(h_));g.innerHTML="",m.value.forEach(E=>{let y=document.createElement(Ke);y.className=c_,y.style.backgroundColor=E,y.setAttribute("data-color",E),g.appendChild(y)})});let p=t[l];p==null&&(p=i.Bx(t,l)),p&&(d.value=p,a(p)),d.onchange=m=>{let g=d.value;a(g),i.setValue(l,g,null,!0)},h.on(e,W,"[data-color]",m=>{let g=m.target.getAttribute("data-color");i.setValue(l,g,null),d.value=g}),i.addValueListener((m,g)=>{m===l&&(a(g),d.value=g)})}})}var u_="data-value",xM="vjs-edge-type-picker",rg="vjs-edge-type-picker-selected",ng=class{constructor(r,e,t,n,o){this.ui=r;this.fe=e;this.Fx=t;this.im=n;this.om=o;c(this,"entryMap",new Map);this.fe.classList.add(xM)}render(r,e){this.fe.innerHTML="";let t=this.Fx.find(n=>n.property===r);if(t!=null)for(let n in t.mappings){let o=t.mappings[n],s=document.createElement(Ke);s.setAttribute(u_,n),n===this.im&&s.classList.add(rg);let a=this.ui.$drawAdHocEdge(o,{x:0,y:0},{x:200,y:0},o.overlays||[],o.sourceMarker,o.targetMarker,e);s.appendChild(a),this.entryMap.set(n,s),this.fe.appendChild(s),this.ui.on(s,W,l=>{this.select(r,n)})}}select(r,e){let t=this.entryMap.get(e);if(t){this.im=e,this.fe.setAttribute(u_,e);let n=this.fe.querySelector(z(rg));n&&n.classList.remove(rg),t.classList.add(rg),this.om&&this.om(r,e)}}};var bM="vjs-edge-type",AM="edgeMappings";function SM(i){return i.getFromContext(AM)||i.$ui.$getEdgePropertyMappings()}function p_(i){i.registerTag(bM,{template:"<div/>",rendered:(r,e)=>{let t=r.getAttribute(ue.Attributes.VJS),n=e[t]||"";new ng(i.$ui,r,SM(i),n,(o,s)=>{i.setValue(o,s,null)}).render(t,e)}})}var TM="<div/>",ig=class extends tg{constructor(e){super(Object.assign(e,{refresh:(t,n)=>{this.container.replaceChildren(this.Ux(t,this.$context)),n()},renderEmptyContainer:()=>{let t=this.M.render(this.Zi).fragment;this.container.replaceChildren(t)}}));c(this,"T");c(this,"M",Ar());c(this,"Zi");c(this,"Gs");c(this,"sm",new Map);c(this,"am",new Map);c(this,"lm",new Map);c(this,"$s");this.T=e.ui.model,this.$s=e.cacheTemplates!==!1,this.Gs=e.templateResolver,this.Zi=this.M.parse(e.emptyTemplate||TM),d_(this),p_(this)}registerTag(e,t){this.M.registerTag(e,t)}zx(e){let t=this.T.getPortType(e.data),n=this.lm.get(t);if(n==null){let o=this.Gs(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for port of type ${t}`),this.Zi;n=this.M.parse(o),this.$s&&this.lm.set(t,n)}return n}hm(e){let t=this.T.getNodeType(e.data),n=this.sm.get(t);if(n==null){let o=this.Gs(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for vertex of type ${t}`),this.Zi;n=this.M.parse(o),this.$s&&this.sm.set(t,n)}return n}Yx(e){return this.hm(e)}Xx(e){let t=this.T.getEdgeType(e.data),n=this.am.get(t);if(n==null){let o=this.Gs(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for edge of type ${t}`),this.Zi;n=this.M.parse(o),this.$s&&this.am.set(t,n)}return n}Ux(e,t){let n;return K(e)?n=this.hm(e):Y(e)?n=this.Yx(e):H(e)?n=this.zx(e):rt(e)&&(n=this.Xx(e)),this.M.render(n,e.data,null,t).fragment}};function vM(i,r){if(!i||i.length===0)return`<div class="vjs-inspector-controls">
78
+ </div>`,rendered:(e,t,n,o,s)=>{function a(g){let m=s[r];if(m!=null&&m.find(E=>E===g)==null){let E=m.slice();return E.unshift(g),E.length>=u&&(E.length=u),i.updateContext(r,E),!0}return!1}let l=e.getAttribute(ue.Attributes.VJS),h=new xe,d=e.querySelector("[type='color']"),u=e.getAttribute(LM)||10;i.bind(Ul,g=>{let m=e.querySelector(z(pO));m.innerHTML="",g.value.forEach(E=>{let y=document.createElement(Ke);y.className=gO,y.style.backgroundColor=E,y.setAttribute("data-color",E),m.appendChild(y)})});let p=t[l];p==null&&(p=i.tb(t,l)),p&&(d.value=p,a(p)),d.onchange=g=>{let m=d.value;a(m),i.setValue(l,m,null,!0)},h.on(e,W,"[data-color]",g=>{let m=g.target.getAttribute("data-color");i.setValue(l,m,null),d.value=m}),i.addValueListener((g,m)=>{g===l&&(a(m),d.value=m)})}})}var EO="data-value",wM="vjs-edge-type-picker",sm="vjs-edge-type-picker-selected",am=class{constructor(r,e,t,n,o){this.ui=r;this.fe=e;this.rb=t;this.pm=n;this.mm=o;c(this,"entryMap",new Map);this.fe.classList.add(wM)}render(r,e){this.fe.innerHTML="";let t=this.rb.find(n=>n.property===r);if(t!=null)for(let n in t.mappings){let o=t.mappings[n],s=document.createElement(Ke);s.setAttribute(EO,n),n===this.pm&&s.classList.add(sm);let a=this.ui.$drawAdHocEdge(o,{x:0,y:0},{x:200,y:0},o.overlays||[],o.sourceMarker,o.targetMarker,e);s.appendChild(a),this.entryMap.set(n,s),this.fe.appendChild(s),this.ui.on(s,W,l=>{this.select(r,n)})}}select(r,e){let t=this.entryMap.get(e);if(t){this.pm=e,this.fe.setAttribute(EO,e);let n=this.fe.querySelector(z(sm));n&&n.classList.remove(sm),t.classList.add(sm),this.mm&&this.mm(r,e)}}};var DM="vjs-edge-type",NM="edgeMappings";function IM(i){return i.getFromContext(NM)||i.$ui.$getEdgePropertyMappings()}function fO(i){i.registerTag(DM,{template:"<div/>",rendered:(r,e)=>{let t=r.getAttribute(ue.Attributes.VJS),n=e[t]||"";new am(i.$ui,r,IM(i),n,(o,s)=>{i.setValue(o,s,null)}).render(t,e)}})}var MM="<div/>",lm=class extends om{constructor(e){super(Object.assign(e,{refresh:(t,n)=>{this.container.replaceChildren(this.nb(t,this.$context)),n()},renderEmptyContainer:()=>{let t=this.M.render(this.Ki).fragment;this.container.replaceChildren(t)}}));c(this,"T");c(this,"M",Ar());c(this,"Ki");c(this,"Bs");c(this,"gm",new Map);c(this,"Em",new Map);c(this,"fm",new Map);c(this,"Fs");this.T=e.ui.model,this.Fs=e.cacheTemplates!==!1,this.Bs=e.templateResolver,this.Ki=this.M.parse(e.emptyTemplate||MM),mO(this),fO(this)}registerTag(e,t){this.M.registerTag(e,t)}ib(e){let t=this.T.getPortType(e.data),n=this.fm.get(t);if(n==null){let o=this.Bs(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for port of type ${t}`),this.Ki;n=this.M.parse(o),this.Fs&&this.fm.set(t,n)}return n}ym(e){let t=this.T.getNodeType(e.data),n=this.gm.get(t);if(n==null){let o=this.Bs(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for vertex of type ${t}`),this.Ki;n=this.M.parse(o),this.Fs&&this.gm.set(t,n)}return n}ob(e){return this.ym(e)}sb(e){let t=this.T.getEdgeType(e.data),n=this.Em.get(t);if(n==null){let o=this.Bs(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for edge of type ${t}`),this.Ki;n=this.M.parse(o),this.Fs&&this.Em.set(t,n)}return n}nb(e,t){let n;return K(e)?n=this.ym(e):Y(e)?n=this.ob(e):H(e)?n=this.ib(e):rt(e)&&(n=this.sb(e)),this.M.render(n,e.data,null,t).fragment}};function VM(i,r){if(!i||i.length===0)return`<div class="vjs-inspector-controls">
79
79
  <div>${r}</div>
80
80
  </div>`;let e=`<div class="vjs-inspector-controls">
81
81
  `;for(let t of i)e+=` <div class="vjs-inspector-control-group" style="margin-bottom: 10px;">
82
82
  `,e+=` <label style="display:block; font-weight:bold;">${t.label}</label>
83
83
  `,t.description&&(e+=` <small style="display:block; color:#666; margin-bottom:4px;">${t.description}</small>
84
- `),e+=` ${CM(t)}
84
+ `),e+=` ${GM(t)}
85
85
  `,e+=` </div>
86
- `;return e+="</div>",e}function CM(i){switch(i.type){case"string":return`<input type="text" vjs-att="${i.id}" class="vjs-input"/>`;case"number":{let r=i.min!==void 0?` min="${i.min}"`:"",e=i.max!==void 0?` max="${i.max}"`:"";return`<input type="number" vjs-att="${i.id}"${r}${e} class="vjs-input"/>`}case"boolean":return`<input type="checkbox" vjs-att="${i.id}"/>`;case"color":return`<vjs-color vjs-att="${i.id}"></vjs-color>`;case"font":return`<div style="display:flex; gap:5px; margin-top:5px;">
86
+ `;return e+="</div>",e}function GM(i){switch(i.type){case"string":return`<input type="text" vjs-att="${i.id}" class="vjs-input"/>`;case"number":{let r=i.min!==void 0?` min="${i.min}"`:"",e=i.max!==void 0?` max="${i.max}"`:"";return`<input type="number" vjs-att="${i.id}"${r}${e} class="vjs-input"/>`}case"boolean":return`<input type="checkbox" vjs-att="${i.id}"/>`;case"color":return`<vjs-color vjs-att="${i.id}"></vjs-color>`;case"font":return`<div style="display:flex; gap:5px; margin-top:5px;">
87
87
  <input type="number" placeholder="Size" style="width:60px;" vjs-att="${i.id}.size" class="vjs-input"/>
88
88
  <input type="text" placeholder="Family" style="flex-grow:1;" vjs-att="${i.id}.family" class="vjs-input"/>
89
89
  <select vjs-att="${i.id}.weight" class="vjs-select">
@@ -99,45 +99,45 @@ var _b=Object.defineProperty,Q0=Object.defineProperties,eL=Object.getOwnProperty
99
99
  <option value="italic">Italic</option>
100
100
  <option value="oblique">Oblique</option>
101
101
  </select>
102
- </div>`;default:return`<span>Unsupported type: ${i.type}</span>`}}var m_=class extends ig{constructor(e){super(Object.assign(e,{templateResolver:t=>this.jx(t),getDefaultValue:(t,n)=>{let o=this.um(t);if(o){let s=o.find(a=>a.id===n);return s?s.defaultValue:null}return null},cacheTemplates:!1}));c(this,"$n");c(this,"Bs");c(this,"cm");c(this,"dm");this.$n=e.ui.getShapeLibrary(),this.Bs=e.properties,this.cm=e.propertyMode||"override",this.dm=e.noPropertiesMessage||"No configurable properties for this shape."}um(e){if(this.cm==="override"&&this.Bs!=null)return this.Bs;let t=this.$n.getShapeDefinition(e.type,e.category);if(t==null)return null;let n=t.properties;if(t.mergeProperties){let o=this.$n.getShapeSet(e.category||this.$n.defaultCategoryId);o&&o.properties&&(n=[...n||[],...o.properties])}else if(n==null||n.length===0){let o=this.$n.getShapeSet(e.category||this.$n.defaultCategoryId);n=o?o.properties:null}return n==null?this.Bs||[]:n}jx(e){if(K(e)||Y(e)){let t=this.um(e.data);return t?vM(t,this.dm):null}else return null}};var nx="drag",g_="tap",ix="draw";var og=class{constructor(r,e){this.container=r;c(this,"templateRenderer");this.Mn(e)}Mn(r){this.templateRenderer=new os({templates:{tp:r}})}setData(r,e){e&&this.Mn(e);let t=this.templateRenderer.template("tp",r).childNodes;this.container.replaceChildren(...t)}};function PM(i){let r={type:null};for(let e=0;e<i.attributes.length;e++){let t=i.attributes.item(e);if(t.name.indexOf("data-vjs")===0){let n=t.name.split("-")[2];r[n]=t.value}}return r.type==null&&(r.type=be),r}var OM="[data-vjs-type]";function _M(i,r,e){let t=(e.x-r.x)/r.width,n=(e.y-r.y)/r.height,o=e.width/r.width,s=e.height/r.height;return{x:Math.round(i.x+t*i.width),y:Math.round(i.y+n*i.height),width:Math.round(o*i.width),height:Math.round(s*i.height)}}var Ya=class{constructor(r,e){this.ui=r;c(this,"Ji");c(this,"source");c(this,"Bn");c(this,"pm");c(this,"jt");c(this,"Ht");c(this,"mm");c(this,"rn");c(this,"dh");c(this,"Ki");c(this,"uh");c(this,"ph");c(this,"mh");c(this,"onDrag");c(this,"Pr");c(this,"gh");c(this,"ar");c(this,"Eh");c(this,"Fs");c(this,"fh");c(this,"qi");c(this,"yh");c(this,"xh");c(this,"Qi");c(this,"Us");c(this,"gm");c(this,"Je");c(this,"eo",[]);c(this,"no",[]);c(this,"Fn",[]);c(this,"Be");c(this,"G");c(this,"Un");c(this,"Or");c(this,"Z");c(this,"zn");c(this,"Em");c(this,"bh");c(this,"fm");c(this,"zs");c(this,"ym");c(this,"Ah");c(this,"xm");c(this,"nn");c(this,"Sh");c(this,"ve");c(this,"Th");c(this,"Ch");c(this,"io");this.Ji=e.mode||nx,this.Je=new xe,this.Pr=e.ignoreZoom===!0,this.pm=e.ignoreGrid===!0,this.nn=e.canDrop||((t,n,o)=>this.ui.$canDrop(t,n,o)),this.mh=e.canvasDropFilter||(t=>!0),this.gh=e.elementGenerator,this.dh=e.dataGenerator||PM,this.uh=e.typeGenerator||(t=>t.type),this.ph=e.groupIdentifier||((t,n)=>n.getAttribute(gh)===Pt),this.Ki=e.dragSizeGenerator,this.ar=e.enabled!==!1,this.source=e.source,this.Bn=e.selector||OM,this.Ch=new og(this.source,e.contentTemplate||"<div/>"),e.data!=null&&this.Ch.setData(e.data),this.jt=e.dragActiveClass||VP,this.Ht=e.dragHoverClass||GP,this.mm=e.dragElementClass||BP,this.rn=e.dragHoverCannotDropClass||$P,this.Sh=e.dragSize,this.zs=e.allowDropOnNode===!0,this.ym=e.ignoreDropOnNode===!0,this.Ah=e.allowDropOnGroup!==!1,this.xm=e.allowDropOnEdge===!0,this.fm=e.allowDropOnCanvas!==!1,this.Eh=e.onVertexAdded,this.onDrag=e.onDrag,this.Fs=e.selectAfterAdd===!0,this.io=function(t){t.key==="Escape"&&(this.Ji===ix?this.ve!=null&&this.ui.setMode(Sr):(this.Ph(),this.dn()))}.bind(this),this.ui.bind(Rn,t=>{t===jn&&this.ve==null?this.Th!=null&&this.bm(this.Th.el):t!==jn&&this.ve!=null&&(F(this.ve.el,gn),F(this.ui.rootElement,Rh),this.Th=this.ve,this.ve=null,document.removeEventListener(Xn,this.io))}),this.Ji===nx?this.Hx():this.Ji===ix?this.kx(e):this.Ji===g_&&this.Wx()}setEnabled(r){this.ar=r}setData(r,e){this.Ch.setData(r,e)}bm(r){let e=Bt(r,this.Bn,this.source,!0);if(this.ve!=null){if(F(this.ve.el,gn),this.ve.el===e){this.ui.setMode(Sr);return}}else document.addEventListener(Xn,this.io);let t=this.dh(e);this.zn=this.Ki?this.Ki(this.Be,e):this.Sh,this.ve={el:e,data:t,objectType:e.getAttribute(gh)===Pt?oe.objectType:he.objectType,type:this.uh(t)},L(this.ve.el,gn),L(this.ui.rootElement,Rh),this.ui.setMode(jn)}Am(r,e,t){this.fh=n=>{if(this.ar){let o=n.target,s=Bt(o,this.Bn,this.source,!0);if(!r(s)||(this.bh=this.Pr?1:this.ui.getEffectiveVisibleZoom(),this.Be=this.dh(s),this.mh&&!this.mh(this.Be)))return;if(this.zn=this.Ki?this.Ki(this.Be,s):this.Sh,this.Z=this.gh?this.gh(s,n,this.Be):e(s),this.Z.removeAttribute("id"),L(this.Z,this.mm),this.Z.style.position=qe,this.Z.style.margin="0",this.Em=this.ph(this.Be,s)?oe.objectType:he.objectType,this.Un=this.Em===oe.objectType?new oe(this.ui.model.graph,this.Be):new he(this.ui.model.graph,this.Be),tr(this.Z,{x:n.pageX,y:n.pageY}),!this.Pr){let a=-50/this.bh;this.Z.style.transform=`scale(${this.bh}) translate(${a}%,${a}%)`}t(s,this.Z),document.body.appendChild(this.Z),this.Qi=!1,this.Us=this.fm===!1?!1:this.nn!=null?this.nn(this.Un,null,!0):!0,this.gm=this.ui.getVisibleCanvasBounds(),this.xh=this.ui.$getElementPositionInWindow(this.ui.rootElement),L(document.body,gt),L(this.ui.rootElement,this.jt),this.Je.on(document,se,this.yh),this.eo.length=0,this.Fn.length=0,!this.ym&&this.zs&&this.ui.$getNodesInViewport().forEach(a=>{let l=a.el.el;this.eo.push({element:a.el.el,cssElement:l,r:a.el,managedElement:a.el,canDrop:this.nn?this.nn(this.Un,a.el.modelObject,!1):this.zs,vertex:a.el.modelObject,id:a.el.id,objectType:he.objectType,modelObject:a.el.modelObject}),this.zs&&L(l,this.jt)}),this.ui.$getGroupsInViewport().forEach(a=>{let l=this.ui.getGroupDefinition(a.el.modelObject);if(l.canDrop==null||l.canDrop(this.Un)){let h=this.ui.$_getGroupContentAreaInfo(a.el.id),d=this.ui.containerType==="SVG"?a.el.el:h.contentArea;this.no.push({element:h.contentArea,canDrop:this.Ah===!1?!1:this.nn?this.nn(this.Un,a.el.modelObject,!1):!0,vertex:a.el.modelObject,managedElement:a.el,cssElement:d,id:a.el.id,objectType:oe.objectType,modelObject:a.el.modelObject,depth:Kc(a.el.modelObject),r:{x:a.el.x+h.internalOffset.x,y:a.el.y+h.internalOffset.y,width:a.el.width-h.internalOffset.x,height:a.el.height-h.internalOffset.y}}),this.Ah&&L(d,this.jt)}}),this.no.sort((a,l)=>l.depth-a.depth),this.xm&&this.ui.model.getAllEdges().forEach(a=>{let l=this.ui.getRenderedConnection(a.id),h=l.connector.canvas,d=h;this.Fn.push({edge:a,connection:l,connector:l.connector,element:h,cssElement:d,id:a.id,canDrop:!0,r:this.ui.$getElementPositionInWindow(h),objectType:Ye.objectType,modelObject:a}),L(d,this.jt)}),this.Je.on(document,Xn,this.io)}}}Ph(){this.Je.off(document,se,this.yh),this.Je.off(document,W,this.qi),this.Je.off(document,ae,this.qi),F(document.body,gt),F(this.ui.rootElement,this.rn),F(this.ui.rootElement,this.jt),F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,Rh),this.Je.off(document,Xn,this.io),this.eo.forEach(r=>{F(r.cssElement,this.jt)}),this.no.forEach(r=>{F(r.cssElement,this.jt)}),this.Fn.forEach(r=>{F(r.cssElement,this.jt)}),this.G!=null&&(F(this.G.cssElement,this.Ht),F(this.G.cssElement,this.rn))}Sm(r){this.qi=e=>{this.Ph(),this.Qi&&(this.G!=null?this.G.objectType===he.objectType&&this.G.canDrop?this.Tm(e,this.G.vertex):this.G.objectType===oe.objectType&&this.G.canDrop?this.Zx(e):this.G.objectType===Ye.objectType&&this.G.canDrop&&this.Jx(e):this.Us&&this.Tm(e,null)),this.dn()}}vm(){this.yh=r=>{tr(this.Z,{x:r.pageX,y:r.pageY}),this.zn&&Rr(this.Z,this.zn.width,this.zn.height);let e=this.ui.$getElementPositionInWindow(this.Z);if(tt(this.xh,e)){if(!this.pm&&this.ui.gridProfile.grid!=null){let o=this.ui.gridProfile.grid,s=this.ui.snapPageLocationToGrid(e.x+window.scrollX,e.y+window.scrollY,o);this.Z.style.left=`${s.x+e.width/2}px`,this.Z.style.top=`${s.y+e.height/2}px`,e=this.ui.$getElementPositionInWindow(this.Z)}this.G!=null&&(F(this.G.cssElement,this.Ht),F(this.G.cssElement,this.rn),this.G=null),this.Or=_M(this.gm,this.xh,e);let t=[],n=!1;if(this.eo.forEach(o=>{tt(this.Or,o.r)&&(t.push(o),n=o.canDrop)}),this.no.forEach(o=>{tt(this.Or,o.r)&&(t.push(o),n=o.canDrop)}),t.sort((o,s)=>{if(Y(o.vertex)&&Y(s.vertex)){if(je(o.vertex,s.vertex))return-1;if(je(s.vertex,o.vertex))return 1}return 0}),t.length>0&&(F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,this.rn),this.G=t[0],this.G.canDrop&&L(this.G.cssElement,this.Ht)),!n){for(let o=0;o<this.Fn.length;o++){let s=this.Fn[o],a=s.r,l=s.connector;if(tt(e,a)){let h=this.ui.fromPageLocation(e.x+window.scrollX,e.y+window.scrollY),d=this.ui.fromPageLocation(e.x+e.width+window.scrollX,e.y+e.height+window.scrollY),u={x:h.x,y:h.y,width:d.x-h.x,height:d.y-h.y};if(WT(l,u).length>0){this.G=s,L(this.G.cssElement,this.Ht);break}}}this.G==null&&(this.Us?L(this.ui.rootElement,this.Ht):L(this.ui.rootElement,this.rn))}this.Qi=!0}else F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,this.rn),this.Qi=!1;this.onDrag&&this.onDrag(this.Be,this.Z,r)}}Hx(){this.vm(),this.Sm(ae),this.Am(r=>!0,r=>r.cloneNode(!0),(r,e)=>{this.Je.on(document,ae,this.qi)}),this.Je.on(this.source,me,this.Bn,this.fh)}Wx(){this.vm(),this.Sm(W),this.Am(r=>{let e=this.source.querySelector(`.${gn}`);return e===r?(F(e,gn),requestAnimationFrame(()=>{this.Ph(),this.dn()}),!1):!0},r=>{let e=r.cloneNode(!0);return this.Je.on(e,W,this.qi),e},(r,e)=>{let t=this.source.querySelector(`.${gn}`);t!=null&&F(t,gn),L(e,"vjs-palette-tap-mode-placeholder"),L(r,gn),L(this.ui.rootElement,Rh)}),this.Je.on(this.source,W,this.Bn,this.fh)}Jx(r){if(this.G.objectType===Ye.objectType){let e=this.G.edge;this.ui.model.transaction(()=>{this.Oh(this.Be,this.Or,this.Z,r,this.G.vertex,(t,n,o)=>{let s=e.source,a=e.target,l=e.data||{};delete l.id,this.ui.model.removeEdge(e),this.ui.model.$_addEdge({source:s,target:t,data:l},Oo,null),this.ui.model.$_addEdge({source:t,target:a,data:l},Oo,null)})},ut)}}Zx(r){this.G.objectType===oe.objectType&&(this.Or.x-=this.G.r.x,this.Or.y-=this.G.r.y,this.Oh(this.Be,this.Or,this.Z,r,this.G.vertex),this.ui.relayoutGroup(this.G.id))}Tm(r,e){this.Oh(this.Be,this.Or,this.Z,r,e)}Kx(r,e){let t={},n=this.ui.getModelPositionAttributes();for(let o in r)o===He?t[n.x]=r[o]:o===Se?t[n.y]=r[o]:t[o]=r[o];return Object.assign(t,e),t}Oh(r,e,t,n,o,s){let a=this.uh(r),l=this.ph(r,t),h=t.getAttribute("data-vjs-group-template"),d=this.Kx({left:e.x,top:e.y,type:a},r);o&&Y(o)&&(d.group=o.id);let u=null;if(o!=null){let m=this.ui.viewport.getElementBounds(o.id);m!=null&&(u={vertex:o,pos:{x:m.x,y:m.y},size:{width:m.width,height:m.height}})}let p=this.ui.getModelPositionAttributes();if(l){let m=g=>{let E=g.data[p.x]==null?e.x:g.data[p.x],y=g.data[p.y]==null?e.y:g.data[p.y];this.ui.setPosition(g,E,y),s&&s(g,E,y),this._h(this.ui.model.getGroup(g.id),u),this.Fs&&this.ui.model.setSelection(this.ui.model.getGroup(g.id))};h==null?this.ui.model.addFactoryGroup(a,d,m,null,!1):this.ui.model.addFactoryGroupWithTemplate(a,h,d,m,null,!1)}else this.ui.model.addFactoryNode(a,d,m=>{let g=m.data[p.x]==null?e.x:m.data[p.x],E=m.data[p.y]==null?e.y:m.data[p.y];this.ui.setPosition(m,g,E),s&&s(m,g,E),this._h(this.ui.model.getNode(m.id),u),this.Fs&&this.ui.model.setSelection(this.ui.model.getNode(m.id))},null,!1)}_h(r,e){this.Eh&&this.Eh({vertex:r,dropTarget:e,doModelUpdate:(t,n)=>{setTimeout(()=>{this.ui.model.mergeTransaction(()=>{try{t(this.ui,this.ui.model,n)}catch(o){U("WARN: could not invoke model update callback after vertex added from palette")}})})}})}dn(){Array.from(this.source.querySelectorAll(`.${gn}`)).forEach(r=>{F(r,gn)}),this.Un=null,this.Be=null,this.eo.length=0,this.no.length=0,this.Fn.length=0,this.Z&&this.Z.parentElement.removeChild(this.Z),this.Z=null,this.zn=null,this.Qi=!1,this.Us=!1}kx(r){this.Je.on(this.source,W,this.Bn,n=>{let o=n.target;this.bm(o)});let e=this.ui.$_useModelForSizes,t={allowClickToAdd:r.allowClickToAdd,clickToAddOnly:e===!1||r.clickToAddOnly===!0,typeGenerator:(n,o)=>Object.assign({},this.ve),autoExit:!0,lassoClass:r.lassoClass,onVertexAdded:n=>{this._h(n),this.Fs&&this.ui.model.setSelection(n)}};r.vertexPreviewGenerator!=null&&(t.vertexPreviewGenerator=(n,o)=>r.vertexPreviewGenerator(this.ve.objectType,this.ve.type,this.ve.data,n,o)),r.vertexPreviewUpdater!=null&&(t.vertexPreviewUpdater=(n,o,s)=>{r.vertexPreviewUpdater(s,n,o,this.ve.data)}),this.ui.addPlugin({type:Ai.type,options:t})}};var ec=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"$component")}initialise(e,t){return this.$component=new Xm(t.container,e,t),!0}destroy(){}reset(){}};c(ec,"type","controls"),ec=Ze([Je("controls")],ec);var sg=class extends Ce{constructor(){super(...arguments);c(this,"$component");c(this,"id")}initialise(e,t){return this.$component=new Ua(t.container,e,t),!0}destroy(){}reset(){}};sg=Ze([Je("exportControls")],sg);var gs=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"oo",[]);c(this,"dragGroupAssigner")}initialise(e,t){return this.surface=e,this.oo=[],this.dragGroupAssigner=t.assignDragGroup,e.bind(Fr,n=>{this.ao(n.el,n.vertex)}),e.bind(Br,n=>{this.ao(n.el,n.vertex)}),e.bind(Pn,n=>{this.qx()}),e.bind(Zs,n=>{this.ao(n.el,n.modelObject)}),!0}destroy(){}reset(){this.oo.length=0}assignToDragGroup(...e){e.forEach(t=>{let n=this.surface.getObjectInfo(t,!1);n.el&&this.ao(n.el,n.obj)})}removeFromDragGroup(...e){this.surface.removeFromDragGroup(...e.map(t=>this.surface.getObjectInfo(t,!1).el).filter(t=>t!=null))}addToDragGroup(e,...t){this.surface.addToDragGroup(e,...t.map(n=>this.surface.getObjectInfo(n,!1).el).filter(n=>n!=null))}ao(e,t){if(this.dragGroupAssigner!=null)if(this.surface.isSuspendRendering())this.oo.push([e,t]);else{let n=this.dragGroupAssigner(t);if(n!=null){let o=typeof n=="string"?{id:n,active:!0}:n;this.surface.$addToDragGroup(Object.assign(o,{membership:E_}),e)}else this.surface.$_assignRemoveFromDragGroup(e)}}qx(){if(this.dragGroupAssigner!=null)for(let e=0;e<this.oo.length;e++)this.ao.apply(this,this.oo[e])}};c(gs,"type","dragGroups"),gs=Ze([Je("dragGroups")],gs);var ag="vjs-snapline",f_="vjs-snapline-vertical",y_="vjs-snapline-horizontal",ox="vjs-snapline-exact",x_="vjs-snapline-active",b_="vjs-snapline-active-exact",Es=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"panZoom");c(this,"tolerance",5);c(this,"showCenters");c(this,"showEdges");c(this,"verticalRanges",[]);c(this,"horizontalRanges",[]);c(this,"selectedRanges",[]);c(this,"focus",null);c(this,"enabled",!0)}setEnabled(e){let t=this.enabled;this.enabled=e,t&&this.reset()}initialise(e,t){this.surface=e,this.panZoom=e.panZoom,this.tolerance=t.tolerance||5,this.showCenters=t.showCenters!==!1,this.showEdges=t.showEdges!==!1,this.enabled=t.enabled!==!1,this.surface.bind(Xs,o=>{if(this.enabled&&o.dragGroup.length>0){let s=o.dragGroup[0],a=this.surface.viewport.getElements();this.focus=s.element,this.verticalRanges.length=0,this.horizontalRanges.length=0,this.selectedRanges.length=0;for(let l in a)if(l!==this.focus.id){let h=a[l].t,d=h.width,u=h.height;this.showEdges&&(this.horizontalRanges.push({position:He,start:h.x-this.tolerance,end:h.x+this.tolerance,objId:l,line:this.Rh(h.x),el:a[l].el,orientation:"v"}),this.horizontalRanges.push({position:yt,start:h.x+d-this.tolerance,end:h.x+d+this.tolerance,objId:l,line:this.Rh(h.x+d),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:Se,start:h.y-this.tolerance,end:h.y+this.tolerance,objId:l,line:this.Lh(h.y),el:a[l].el,orientation:"h"}),this.verticalRanges.push({position:ht,start:h.y+h.height-this.tolerance,end:h.y+h.height+this.tolerance,objId:l,line:this.Lh(h.y+u),el:a[l].el,orientation:"h"})),this.showCenters&&(this.horizontalRanges.push({position:It,start:h.x+d/2-this.tolerance,end:h.x+d/2+this.tolerance,objId:l,line:this.Rh(h.x+d/2),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:It,start:h.y+u/2-this.tolerance,end:h.y+u/2+this.tolerance,objId:l,line:this.Lh(h.y+u/2),el:a[l].el,orientation:"h"}))}}}),this.surface.bind(Mt,o=>{if(this.enabled&&o.dragGroup.length>0){this.Ys();let s=o.dragGroup[0],a=s.pos.x,l=a+this.focus.width/2,h=a+this.focus.width,d=s.pos.y,u=d+this.focus.height/2,p=d+this.focus.height,m={};for(let g=0;g<this.horizontalRanges.length;g++){let E=this.horizontalRanges[g];m[E.objId]||(E.start<=l&&E.end>=l?(m[E.objId]=!0,this.Yn(E,l)):E.start<=a&&E.end>=a?(m[E.objId]=!0,this.Yn(E,a)):E.start<=h&&E.end>=h&&(m[E.objId]=!0,this.Yn(E,h)))}for(let g=0;g<this.verticalRanges.length;g++){let E=this.verticalRanges[g];m[E.objId]||(E.start<=u&&E.end>=u?(m[E.objId]=!0,this.Yn(E,u)):E.start<=d&&E.end>=d?(m[E.objId]=!0,this.Yn(E,d)):E.start<=p&&E.end>=p&&(m[E.objId]=!0,this.Yn(E,p)))}}});let n=()=>{this.enabled&&(this.Ys(),this.verticalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.horizontalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.verticalRanges.length=0,this.horizontalRanges.length=0)};return this.surface.bind(Vt,o=>n()),this.surface.bind(Vd,o=>n()),!0}Yn(e,t){this.selectedRanges.push(e);let n=(e.start+e.end)/2,o=Math.round(t)===Math.round(n);o?e.line.classList.add(`${ox}`):e.line.classList.remove(`${ox}`);let s={x:e.orientation===EA?-5e4:n,y:e.orientation===sd?-5e4:n};this.surface.fixElement(e.line,s,null,null,!0),L(e.el,`${x_}`),o&&L(e.el,`${b_}`)}Ys(){this.selectedRanges.forEach(e=>{e.line.classList.remove(`${ox}`),this.surface.unfixElement(e.line),F(e.el,`${x_}`),F(e.el,`${b_}`)})}Lh(e){if(this.surface.containerType==="SVG")return Kr(Gt,Z,{y:`${e}px`},`${ag} ${y_}`,{x:"-50000",width:"100000",height:"1"});{let t=document.createElement(Ke);return t.className=`${ag} ${y_}`,t.style.left="-50000px",t.style.right="-50000px",t.style.top=`${e}px`,t}}Rh(e){if(this.surface.containerType==="SVG")return Kr(Gt,Z,{x:`${e}px`},`${ag} ${f_}`,{y:"-50000",height:"100000",width:"1"});{let t=document.createElement(Ke);return t.className=`${ag} ${f_}`,t.style.top="-50000px",t.style.bottom="-50000px",t.style.left=`${e}px`,t}}destroy(){this.Ys()}reset(){this.Ys()}};c(Es,"type","snaplines"),Es=Ze([Je("snaplines")],Es);var tc=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"$palette")}destroy(){}initialise(e,t){return this.$palette=new Ya(e,t),!0}reset(){}};c(tc,"type","palette"),tc=Ze([Je("palette")],tc);var fs=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"startPanTimeout");c(this,"panRepeatInterval");c(this,"panRepeatDistance");c(this,"lo",[]);c(this,"Cm",null);c(this,"currentPanButton",null);c(this,"surface");c(this,"panZoom");c(this,"panDistance");c(this,"eventManager");c(this,"Pm",!1);c(this,"Dh");c(this,"Om")}initialise(e,t){return this.eventManager=new xe,this.surface=e,this.panZoom=e.panZoom,this.startPanTimeout=t.startPanTimeout||150,this.panRepeatInterval=t.panRepeatInterval||60,this.panRepeatDistance=t.panRepeatDistance||10,this.panDistance=t.panDistance||50,this.Dh=()=>{this.panZoom.stopPanRepeat(),window.clearTimeout(this.Cm),this.currentPanButton&&this.surface.removeClass(this.currentPanButton,by),this.currentPanButton=null,this.eventManager.off(document,ae,this.Dh)},this.Om=()=>{this.panZoom.stopPanRepeat()},this.makePanButton(Se,{left:"0px",top:"0px"},0,-1,"&#8593;"),this.makePanButton(ht,{left:"0px",bottom:"0px"},0,1,"&#8595;"),this.makePanButton(He,{left:"0px",top:"0px"},-1,0,"&#8592;"),this.makePanButton(yt,{right:"0px",top:"0px"},1,0,"&#8594;"),!0}curryPanButton(e,t){return n=>{this.Pm||this.panZoom.pan(e*this.panDistance,t*this.panDistance,!0),this.Pm=!1}}startPanTimer(e,t,n){return()=>{this.currentPanButton=n,this.surface.addClass(this.currentPanButton,by),this.eventManager.on(document,ae,this.Dh),this.Cm=window.setTimeout(()=>{this.eventManager.on(document,ae,this.Om),this.panZoom.startPanRepeat(e,t,this.panRepeatDistance,this.panRepeatDistance,this.panRepeatInterval)},this.startPanTimeout)}}makePanButton(e,t,n,o,s){let a=document.createElement(Ke);return a.innerHTML=s||"",a.style.position=qe,Object.assign(a.style,t),a.className=`${xy} ${xy}-${e}`,this.panZoom.viewportElement.appendChild(a),this.eventManager.on(a,ze,this.curryPanButton(n,o)),this.eventManager.on(a,me,this.startPanTimer(n,o,a)),this.lo.push(a),a}destroy(){for(let e=0;e<this.lo.length;e++)this.lo[e].parentNode.removeChild(this.lo[e]);this.lo.length=0}reset(){}};c(fs,"type","panButtons"),fs=Ze([Je("panButtons")],fs);var lg="[data-vjs-list='true']",RM="data-vjs-list-behavior",rc=class extends Ce{constructor(){super(...arguments);c(this,"id","list-manager");c(this,"surface");c(this,"options");c(this,"Xn",null)}initialise(e,t){this.surface=e,this.options=t,e.addWheelSelectorFilter(`${lg}, ${lg} *`);let n=e.getContainer();return e.on(n,"wheel",lg,(o,s)=>{this.Xn||(this.Xn=window.requestAnimationFrame(()=>{this.wheelHandler(o,s),this.Xn=null}))}),!0}_m(e){[e.source,e.target].forEach(t=>{let n=this.surface.getRenderedElement(t);if(n){let o=n.closest(lg);o&&this.wheelHandler(null,o)}})}$edgeRendered(e){this._m(e.edge)}$edgeUpdated(e){this._m(e)}wheelHandler(e,t){let n=this.surface.$getAttribute(t,RM)||this.options.behavior||"proxy",o=this.surface.getObjectInfo(t,!1);if(o.obj){let{vertices:s,contentEl:a}=Y(o.obj)?{vertices:o.obj.members,contentEl:this.surface.$getGroupContentAreaElement(o.el)}:{vertices:o.obj.getPorts(),contentEl:o.el},l=a.getBoundingClientRect(),h=o.el.getBoundingClientRect(),d=Math.max(l.top,h.top),u=Math.min(l.bottom,h.bottom);s.forEach(p=>{this.surface.$revalidateElementById(p.id);let m=this.surface.getElement(p.id),E=m.el.getBoundingClientRect(),y=E.bottom<=d||E.top>=u||E.right<=l.left||E.left>=l.right;p.getAllEdges().forEach(f=>{let b=f.source.id===p.id?"source":"target";if(n==="proxy"){let A=this.surface.getRenderedConnection(f.id);if(A!=null)if(y){let T=A.anchors[b],R=T.locations[T.currentLocation].x<.5?"Left":"Right",O=`${E.bottom<=d?"Top":"Bottom"}${R}`,P=St(O);this.surface.$_proxyEdge(f,b,this.surface.getElement(o.id),P)}else this.surface.$_unproxyEdge(f,b)}else f.Xs=f.Xs||new Set,y?f.Xs.add(b):f.Xs.delete(b),this.surface.setVisible(f,f.Xs.size===0)}),this.surface.$repaintUIElement(m,null,!1,!0)})}}destroy(){this.Xn&&(window.cancelAnimationFrame(this.Xn),this.Xn=null)}reset(){}};c(rc,"type","listManager"),rc=Ze([Je("listManager")],rc);var A_="vjs-vertex-drawing-lasso",sx="vjs-group-candidate-child";var Ai=class extends Ce{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"lasso");c(this,"autoExit");c(this,"typeGenerator");c(this,"groupType");c(this,"nodeType");c(this,"defaultGroupSize");c(this,"defaultNodeSize");c(this,"Rm");c(this,"Nh");c(this,"jn");c(this,"Hn");c(this,"js");c(this,"Hs");c(this,"$onVertexAdded");c(this,"Ih");c(this,"vertexSelection");c(this,"selectedElements",[])}destroy(){}Qx(e,t){if(this.typeGenerator!=null){let o=this.typeGenerator(e,t);this.Hn=o.objectType,this.js=o.type,this.Hs=o.data||{}}else this.nodeType!=null?(this.Hn=he.objectType,this.js=this.nodeType,this.Hs={}):(this.Hn=oe.objectType,this.js=this.groupType||be,this.Hs={});let n=this.surface.getModelObjectFromElement(t.target,!0,!1);n!=null&&Y(n.obj)?this.jn=n.obj:this.jn=null}initialise(e,t){this.surface=e,this.Ih=t.minSize||{width:50,height:50},this.nodeType=t.nodeType,this.groupType=t.groupType,this.typeGenerator=t.typeGenerator,this.Nh=e.$_useModelForSizes===!1||t.clickToAddOnly===!0,this.Rm=this.Nh||t.allowClickToAdd===!0,this.defaultGroupSize=t.defaultGroupSize||{width:250,height:250},this.defaultNodeSize=t.defaultNodeSize||{width:80,height:80},this.$onVertexAdded=t.onVertexAdded||(s=>{});let n=`${A_} ${t.lassoClass||""}`;e.bind(Rn,s=>{this.lasso.enabled=s===jn}),this.vertexSelection=new pr(e.model),this.autoExit=t.autoExit===!0;let o={surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:n,mapToGrid:s=>{if(this.surface.gridProfile.grid){let a=this.surface.fromPageLocation(s.x,s.y),l=le(a,this.surface.gridProfile.grid);return this.surface.toPageLocation(l.x,l.y)}else return s},onStart:(s,a,l,h)=>{e.hoverSuspended=!0,this.Qx(a,h)},onSelect:(s,a,l,h,d,u,p)=>{if(p!=null&&t.vertexPreviewUpdater&&t.vertexPreviewUpdater(s,a,p),this.Hn===oe.objectType){this.vertexSelection.clear(),this.Lm();let m=[],g,E=e.findIntersectingVertices({origin:l,dimensions:h,dontIncludeGroups:!1,dontIncludeNodes:!1,dontIncludeNodesInsideGroups:!1,enclosed:!0,dontIncludeNestedGroups:!1}),y=E.length,x={};for(g=0;g<y;g++)m.push(E[g].v),x[E[g].id]=!0,this.vertexSelection.append(E[g].v),L(E[g].el,sx),this.selectedElements.push(E[g].el)}},onEnd:(s,a)=>{e.hoverSuspended=!1,this.Lm(),this.autoExit&&e.mode!==hs&&e.setMode(Sr);let l=e.getEffectiveVisibleZoom(),h={width:Math.round(a.width/l),height:Math.round(a.height/l)};this.wm(s,h)},filter:s=>{let a=s.srcElement||s.target;return a===e.vertexLayer||a===e.$getCanvasElement()},onClick:(s,a)=>{if(this.autoExit&&e.mode!==hs&&e.setMode(Sr),this.Rm){let l=this.Hn===oe.objectType?this.defaultGroupSize:this.defaultNodeSize;this.wm(s,l)}}};return t.vertexPreviewGenerator!=null&&(o.generateLassoContent=(s,a)=>t.vertexPreviewGenerator(s,a)),this.lasso=new Ia(o),this.Nh&&this.lasso.setEnabled(!1),!0}wm(e,t){let n=this.surface.fromPageLocation(e.x,e.y);(t.width>=this.Ih.width||t.height>=this.Ih.height)&&(this.Hn===oe.objectType?this.eb(this.surface,n,t):this.tb(this.surface,n,t))}Dm(e,t){return Object.assign(this.Hs,{id:B(),[this.surface.$modelLeftAttribute]:e.x,[this.surface.$modelTopAttribute]:e.y,width:t.width,height:t.height,type:this.js})}rb(){let e=this.vertexSelection.getNodes(),t=this.vertexSelection.getGroups(),n={nodes:[],groups:[]};return e.forEach(o=>{t.find(s=>je(o,s))==null&&n.nodes.push(o)}),t.forEach(o=>{t.find(s=>je(o,s))==null&&n.groups.push(o)}),n}eb(e,t,n){let o;e.model.transaction(()=>{let s=this.Dm(t,n),a=s[this.surface.$modelLeftAttribute],l=s[this.surface.$modelTopAttribute];o=e.model.addGroup(s);let h=[{v:o,x:a,y:l}];e.setSuspendRendering(!0);let d=this.rb();d.nodes.forEach(u=>{let p=e.viewport.getPosition(u.id),m=p.x-t.x,g=p.y-t.y;e.model.addToGroup(u,o),e.model.updateNode(u,{[e.$modelLeftAttribute]:m,[e.$modelTopAttribute]:g}),h.push({v:u,x:m,y:g})}),d.groups.forEach(u=>{let p=e.viewport.getPosition(u.id),m=p.x-t.x,g=p.y-t.y;e.model.addToGroup(u,o),e.model.updateGroup(u,{[e.$modelLeftAttribute]:m,[e.$modelTopAttribute]:g}),h.push({v:u,x:m,y:g})}),h.forEach(u=>{e.setPosition(u.v,u.x,u.y)}),this.jn!=null&&e.model.addToGroup(o,this.jn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}tb(e,t,n){let o;e.setSuspendRendering(!0);let s=this.Dm(t,n);e.model.transaction(()=>{o=e.model.addNode(s);let a={x:s[this.surface.$modelLeftAttribute],y:s[this.surface.$modelTopAttribute]};e.setPosition(o,a.x,a.y),this.jn!=null&&e.model.addToGroup(o,this.jn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Lm(){this.selectedElements.forEach(e=>F(e,sx)),this.selectedElements.length=0}reset(){}};c(Ai,"type","vertexDrawing"),Ai=Ze([Je("vertexDrawing")],Ai);var hg=12,S_=40,T_=16,v_=6,C_=30,P_=30,O_=5,__="borders",nc="handles",R_="vjs-resize-skeleton",L_="vjs-resize-skeleton-borders",w_="vjs-resize-skeleton-borders-visible",D_="vjs-resize-frame",Tt="vjs-resize-handle",ax="vjs-resize-handle-active",lx="vjs-resize-handle-tl",hx="vjs-resize-handle-bl",cx="vjs-resize-handle-tr",dx="vjs-resize-handle-br",ux="vjs-resize-handle-t",px="vjs-resize-handle-b",mx="vjs-resize-handle-l",gx="vjs-resize-handle-r",ys="vjs-resize-border",N_="vjs-resize-border-b",I_="vjs-resize-border-t",M_="vjs-resize-border-l",V_="vjs-resize-border-r",ic="vjs-rotate-handle",cg="vjs-rotate-leader",Ex="data-vjs-x-resize",fx="data-vjs-y-resize",yx="data-vjs-resizable",xx="data-vjs-rotatable",za="data-dir";function Ve(i,r,e,t){let n=G(i,t),o=r.join(" ");return L(n,o),e&&e.appendChild(n),n}function bx(i,r){Ne(i,r.ro),r.r!=null&&xi(i,r.r)}var po=(i,r)=>`translate(${-(i/2)-r/2}, ${-(i/2)-r/2})`;function G_(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ve(Z,[Tt,lx],n,{"data-dir":"tl",[te]:e.id,width:i,height:i,x:l-o,y:h-o,transform:po(i,t)}),p.tr=Ve(Z,[Tt,cx],n,{"data-dir":"tr",[te]:e.id,width:i,height:i,x:d+o,y:h-o,transform:po(i,t)}),p.bl=Ve(Z,[Tt,hx],n,{"data-dir":"bl",[te]:e.id,width:i,height:i,x:l-o,y:u+o,transform:po(i,t)}),p.br=Ve(Z,[Tt,dx],n,{"data-dir":"br",[te]:e.id,width:i,height:i,x:d+o,y:u+o,transform:po(i,t)})),a&&(p.t=Ve(Z,[Tt,ux],n,{"data-dir":"t",[te]:e.id,x:(l+d)/2,y:h-o,width:i,height:i,transform:po(i,t)}),p.b=Ve(Z,[Tt,px],n,{"data-dir":"b",[te]:e.id,x:(l+d)/2,y:u+o,width:i,height:i,transform:po(i,t)})),s&&(p.l=Ve(Z,[Tt,mx],n,{"data-dir":"l",[te]:e.id,x:l-o,y:(h+u)/2,width:i,height:i,transform:po(i,t)}),p.r=Ve(Z,[Tt,gx],n,{"data-dir":"r",[te]:e.id,x:d+o,y:(h+u)/2,width:i,height:i,transform:po(i,t)})),p}function $_(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ve(ke,[Tt,lx],n,{"data-dir":"tl",[te]:e.id,cx:l-o,cy:h-o,r:i/2}),p.tr=Ve(ke,[Tt,cx],n,{"data-dir":"tr",[te]:e.id,r:i/2,cx:d+o,cy:h-o}),p.bl=Ve(ke,[Tt,hx],n,{"data-dir":"bl",[te]:e.id,r:i/2,cx:l-o,cy:u+o}),p.br=Ve(ke,[Tt,dx],n,{"data-dir":"br",[te]:e.id,r:i/2,cx:d+o,cy:u+o})),a&&(p.t=Ve(ke,[Tt,ux],n,{"data-dir":"t",[te]:e.id,cx:(l+d)/2,cy:h-o,r:i/2}),p.b=Ve(ke,[Tt,px],n,{"data-dir":"b",[te]:e.id,cx:(l+d)/2,cy:u+o,r:i/2})),s&&(p.l=Ve(ke,[Tt,mx],n,{"data-dir":"l",[te]:e.id,cx:l-o,cy:(h+u)/2,r:i/2}),p.r=Ve(ke,[Tt,gx],n,{"data-dir":"r",[te]:e.id,cx:d+o,cy:(h+u)/2,r:i/2})),p}function B_(i){return{tl:{anchor:[1,1],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=le({x:t,y:n},i.grid);t=h.x,n=h.y;let d=le({x:i.$x2,y:i.$y2},i.grid);o=d.x-t,s=d.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),n>i.$y2-l&&(n=i.$y2-l,s=l),{x:t,y:n,width:o,height:s}},id:"tl"},tr:{anchor:[0,1],id:"tr",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1+e,o=i.$y2-n,s=i.$x1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=le({x:s+t,y:n},i.grid);t=h.x-s,n=h.y,o=le({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),n>i.$y2-l&&(n=i.$y2-l,o=l),{x:s,y:n,width:t,height:o}}},bl:{anchor:[1,0],id:"bl",resize:(r,e)=>{let t=i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x2-t,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=le({x:t,y:s+n},i.grid);t=h.x,n=h.y-s,o=le({x:i.$x2,y:h.y},i.grid).x-t}return t>i.$x2-a&&(t=i.$x2-a,o=a),n<l&&(n=l),{x:t,y:s,width:o,height:n}}},br:{anchor:[0,0],id:"br",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=le({x:o+t,y:s+n},i.grid);t=h.x-o,n=h.y-s}return t<a&&(t=a),n<l&&(n=l),{x:o,y:s,width:t,height:n}}},t:{anchor:[.5,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(n=le({x:t,y:n},i.grid).y,s=le({x:i.$x2,y:i.$y2},i.grid).y-n),n>i.$y2-a&&(n=i.$y2-a,s=a),{x:t,y:n,width:o,height:s}},id:"t"},b:{anchor:[.5,0],resize:(r,e)=>{let t=i.$x1,n=i.$y1,o=i.$x2-i.$x1,s=i.$y2-i.$y1+e,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(s=le({x:t,y:n+s},i.grid).y-n),s<a&&(s=a),{x:t,y:n,width:o,height:s}},id:"b"},l:{anchor:[1,.5],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=le({x:t,y:n},i.grid).x,o=le({x:i.$x2,y:i.$y2},i.grid).x-t),t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}},id:"l"},r:{anchor:[0,.5],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1,o=i.$x1,s=i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=le({x:o+t,y:s+n},i.grid).x-o),t<a&&(t=a),{x:o,y:s,width:t,height:n}}}}}function F_(i){return{l:{anchor:[1,0],id:"l",resize:(r,e)=>{let t=i.$x1+r,n=i.$y1,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=le({x:t,y:n},i.grid);t=l.x,n=l.y;let h=le({x:i.$x2,y:i.$y2},i.grid);o=h.x-t,s=h.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}}},r:{anchor:[0,1],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1,o=i.$y2-n,s=i.$x1,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=le({x:s+t,y:n},i.grid);t=l.x-s,n=l.y,o=le({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),{x:s,y:n,width:t,height:o}}},t:{id:"t",anchor:[0,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$y2-n,s=i.$x2-t,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=le({x:t,y:n+o},i.grid);t=l.x,o=l.y-n,s=le({x:i.$x2,y:l.y},i.grid).x-t}return n>i.$y2-a&&(n=i.$y2-a,o=a),{x:t,y:n,width:s,height:o}}},b:{id:"b",anchor:[0,0],resize:(r,e)=>{let t=i.$x2-i.$x1,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=le({x:o+t,y:s+n},i.grid);t=l.x-o,n=l.y-s}return n<a&&(n=a),{x:o,y:s,width:t,height:n}}}}}function Ax(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)-o*Math.sin(e),y:n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}function Sx(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)+o*Math.sin(e),y:-n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}var xs=class extends Ce{constructor(){super(...arguments);c(this,"id","resizingTools");c(this,"surface");c(this,"instance");c(this,"widthAtt");c(this,"heightAtt");c(this,"leftAtt");c(this,"topAtt");c(this,"xAxis");c(this,"yAxis");c(this,"resizeX");c(this,"resizeY");c(this,"canResizeFilter");c(this,"canRotateFilter");c(this,"onEdit");c(this,"onDemand");c(this,"sn");c(this,"_r");c(this,"ho");c(this,"Vh");c(this,"Mh");c(this,"Nm");c(this,"Gh");c(this,"skeletons");c(this,"ht");c(this,"Rr");c(this,"ks");c(this,"co");c(this,"Ws");c(this,"le");c(this,"Lr");c(this,"downAt");c(this,"$h");c(this,"handler");c(this,"toolkitDragObject");c(this,"Zs");c(this,"$x1");c(this,"$x2");c(this,"$y1");c(this,"$y2");c(this,"Bh");c(this,"minimumHeight");c(this,"minimumWidth");c(this,"currentMinimumWidth");c(this,"currentMinimumHeight");c(this,"ignoreGrid");c(this,"grid");c(this,"Im");c(this,"Vm");c(this,"Fh");c(this,"At",!1);c(this,"Uh",!1);c(this,"Js",!1);c(this,"$handleOffset");c(this,"zh");c(this,"Yh");c(this,"St");c(this,"Xh");c(this,"an");c(this,"Ce");c(this,"ct");c(this,"Gm");c(this,"resizeMethod");c(this,"bordersVisible");c(this,"$m");c(this,"Bm")}Mm(e){this.toolkitDragObject&&this.skeletons[this.toolkitDragObject.id]&&(e?L(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"):F(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"))}set $moving(e){this.At=e,this.Mm(e)}set $rotating(e){this.Uh=e,this.Mm(e)}get $busy(){return this.At||this.Uh}destroy(){}initialise(e,t){this.surface=e,this.$handleOffset=t.handleOffset||O_,this.zh=t.modelUpdater,this.Yh=t.handlerFactory,this.$m=B_(this),this.Bm=F_(this),e.$addTransferrableVertexAttributes([yx,fx,Ex,xx]),this.instance=e.model,this.skeletons={},this.widthAtt=t.widthAttribute||this.instance.modelWidthAttribute,this.heightAtt=t.heightAttribute||this.instance.modelHeightAttribute,this.leftAtt=t.leftAttribute||this.instance.modelLeftAttribute,this.topAtt=t.topAttribute||this.instance.modelTopAttribute,this.onEdit=t.onEdit||function(){},this.onDemand=t.onDemand===!0,this.minimumWidth=t.minimumWidth!=null&&t.minimumWidth>0?t.minimumWidth:C_,this.minimumHeight=t.minimumHeight!=null&&t.minimumHeight>0?t.minimumHeight:P_,this.grid=this.surface.getGrid(),this.ignoreGrid=t.ignoreGrid===!0,this.Vm=t.constrainGroups!==!1,this.canResizeFilter=t.canResizeFilter,this.canRotateFilter=t.canRotateFilter,this.St=t.handleSize||hg,this.Xh=t.handleShape||"circle",this.an=t.rotateLeaderLength||S_,this.Ce=t.rotateHandleSize||T_,this.ct=t.borderHandleSize||v_,this.resizeMethod=t.resizeMethod||nc,this.bordersVisible=this.resizeMethod===__&&t.bordersVisible!==!1,this.Im=t.rotatable===!0,this.Fh=t.rotationStops,this.resizeX=t.resizeX!==!1,this.resizeY=t.resizeY!==!1,[Tt,ic,cg,ys].forEach(a=>{this.surface.addDragClassnameFilter(a)}),this.Gm=t.payloadGenerator||((a,l)=>l),this.instance.bind(ir,()=>{this.reset()}),this.instance.bind(qt,a=>{this.onDemand!==!0&&this.jh(a.obj)}),this.instance.bind(Qt,a=>{this.onDemand!==!0&&this.kn(a.obj)});let n=a=>{this.$_setSkeletonPositionById(a.id),Y(a)&&a.getMembers().forEach(l=>n(l))};this.surface.bind(Mt,a=>{a.dragGroup.forEach(l=>{n(l.vertex)})}),this.instance.bind(Re,a=>{this.$_setSkeletonPositionById(a.vertex.id)}),this.instance.bind(Te,a=>{n(a.vertex)}),this.instance.bind(ve,a=>{this.kn(a.node)}),this.instance.bind(_e,a=>{this.kn(a.group),a.group.getMembers().forEach(l=>this.kn(l))});let o=a=>{this.At||this.instance.openTransaction(),this.$moving=!0,ie(a);let l=this.surface.mapEventLocation(a);this.Uh?this.nb(l):this.ib(l)},s=a=>{if(this.$busy){if(ie(a),this.Js&&this.ht!=null){let l=new Set;if(this.le!=null){let h={},d={},u={},{movedElements:p,resizedGroups:m}=this.le.Jl();Object.assign(u,m);for(let g in p)h[g]=p[g].current,d[g]=p[g].current;for(let g in h){let E={[this.surface.$modelLeftAttribute]:h[g].x,[this.surface.$modelTopAttribute]:h[g].y};u[g]!=null&&(E[this.surface.$modelWidthAttribute]=u[g].newGroupSize.width,E[this.surface.$modelHeightAttribute]=u[g].newGroupSize.height),this.surface.model.$_updateVertex(g,E,qs,!1)}this.surface.$_sizeGroupsToFit(l,null,null,!1),this.surface.$trackGroupSizeChanges(u);for(let g in u){let E=u[g].newGroupSize;this.surface.viewport.updateElement(g,null,null,E.width,E.height,null,null,!1)}}else l.add(this.ht);this.surface.$_sizeGroupsToFit(l,null,null,!1)}this.Zs&&F(this.Zs,ax),this.surface.$removeClassFromElement(document.body,gt),this.surface.off(document,se,o),this.surface.off(document,ae,s),this.le&&this.le.cleanup(),this.le=null,this.ht=null,this.ks=!1,this.co=null,this.Ws=null,this.Rr=null,this.onEdit(this.toolkitDragObject,this.surface,this.instance),this.instance.commitTransaction(),this.$moving=!1,this.$rotating=!1,this.Js=!1}};return this.surface.on(this.surface.getContainer(),me,z(Tt),a=>{this.Fm(a,this.$m,o,s)}),this.surface.on(this.surface.getContainer(),me,z(ys),a=>{this.Fm(a,this.Bm,o,s)}),this.surface.on(this.surface.getContainer(),me,z(ic),a=>{ie(a),this._r=0,this.toolkitDragObject=this.surface.model.getVertex(a.target.getAttribute(te)),this.toolkitDragObject!=null&&(this.Lr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this._r=this.Lr.r,this.downAt=this.surface.mapEventLocation(a),this.$rotating=!0,this.Bh={x:this.Lr.c.x,y:this.Lr.c.y},this.Um(a),this.surface.$addClassToElement(document.body,gt),this.surface.on(document,se,o),this.surface.on(document,ae,s))}),!1}Um(e){this.toolkitDragObject!=null&&(this.ht=this.toolkitDragObject.group,this.ks=!1,this.ht!=null&&(this.co=this.surface.getGroupDefinition(this.ht),this.Ws=this.surface.$_getGroupContentAreaInfo(this.ht.id),this.Rr=this.surface.viewport.getGroupElement(this.ht.id),this.ks=this.co.elastic===!0&&e.shiftKey!==!0,this.ks&&(this.le=new $a(this.surface,this.toolkitDragObject,this.ht,this.co))))}Fm(e,t,n,o){ie(e);let s=e.target,a=s.getAttribute(te);this.sn=s.getAttribute(za),this.Zs=s,this.toolkitDragObject=this.instance.getNode(a)||this.instance.getGroup(a),this.Lr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Um(e),this.xAxis=this.skeletons[a].canResizeX,this.yAxis=this.skeletons[a].canResizeY,this.downAt=this.surface.mapEventLocation(e);let l=this.ob(this.toolkitDragObject);if(this.$x1=l.x,this.$y1=l.y,this.$x2=this.$x1+l.width,this.$y2=this.$y1+l.height,this._r=this.zm(),this.ho={x:l.x,y:l.y},this.Gh={width:l.width,height:l.height},this.Vh=this.$x2-this.$x1,this.Mh=this.$y2-this.$y1,this.Nm={x:this.$x1+this.Vh/2,y:this.$y1+this.Mh/2},this.$h=Sx(this.downAt.x,this.downAt.y,this._r,{x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2}),Y(this.toolkitDragObject)){if(this.surface.getGroupElement(this.toolkitDragObject.id).collapsed)return;{let d=this.surface.getGroupDefinition(this.toolkitDragObject);if(this.Vm&&d.constrain!==!1){let u=this.surface.$_getGroupContentAreaInfo(this.toolkitDragObject.id),p=this.surface.viewport.$computeGroupContentExtents(this.toolkitDragObject,!1,null,null,u),m=p.xmax+u.internalOffset.x,g=p.ymax+u.internalOffset.y;this.currentMinimumWidth=Math.max(this.minimumWidth,m),this.currentMinimumHeight=Math.max(this.minimumHeight,g)}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight}}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight;if(this.grid&&!this.ignoreGrid){let h=le({x:this.currentMinimumWidth,y:this.currentMinimumHeight},this.grid);this.currentMinimumWidth=h.x,this.currentMinimumHeight=h.y}if(this.handler=Object.assign({},t[this.sn]),this.Yh!=null){let h=this.Yh(this.surface,this.toolkitDragObject,this.sn,this.handler.resize);h!=null&&(this.handler.resize=h)}L(this.Zs,ax),this.surface.$addClassToElement(document.body,gt),this.surface.on(document,se,n),this.surface.on(document,ae,o)}zm(){if(this.Lr==null)return 0;{let t=(this.Lr.r==null?0:this.Lr.r)%360;return t<0&&(t+=360),2*Math.PI/360*t}}sb(e,t){let n={x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2},o=this.zm();return t?Ax(e.x,e.y,o,n):Sx(e.x,e.y,o,n)}ob(e){let t=this.surface.viewport.getElementBounds(e.id),n=this.ab();return{x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}reset(){for(let e in this.skeletons){let t=this.skeletons[e];t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}}$minWidth(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumWidth,this.grid.width):this.currentMinimumWidth}$minHeight(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumHeight,this.grid.height):this.currentMinimumHeight}Ks(e){let t=this.skeletons[e];t&&t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}kn(e){this.Ks(e.id)}jh(e){let t=this.surface.$getManagedElement(e.id);if(t!=null){if(this.kn(e),Y(t.modelObject)&&t.collapsed||An(t.modelObject).find(l=>this.surface.viewport.getGroupElement(l.id).collapsed===!0))return;let o=t.el.getAttribute(Ex)!==ct&&this.resizeX!==!1,s=t.el.getAttribute(fx)!==ct&&this.resizeY!==!1;if(t.el.getAttribute(yx)===ct||!o&&!s)return;this.Hh(t,e,o,s)}}Hh(e,t,n,o){let s=e,a=this.resizeMethod==nc?[R_]:[L_];this.bordersVisible&&a.push(w_);let l=Ve(q,a,null,{transform:`translate(${e.x}, ${e.y})`,[te]:e.id});this.surface.$appendElementToToolsLayer(l);let h=Ve(Z,[D_],l,{x:-this.$handleOffset,y:-this.$handleOffset,width:e.width+2*this.$handleOffset,height:e.height+2*this.$handleOffset}),d=parseInt(window.getComputedStyle(e.el).strokeWidth,10),u=this.canResizeFilter?this.canResizeFilter(e.modelObject,e.el):n||o,p=e.el.getAttribute(xx)===ct?!1:this.canRotateFilter?this.canRotateFilter(e.modelObject,e.el):this.Im,m=this.skeletons[t.id]={mel:e,el:l,canResizeX:n,canResizeY:o,handles:null,borders:null,rh:null,rl:null,rotatable:p,resizable:u,frame:h};if(this.resizeMethod===nc){if(p){m.rl=Ve(ee,[cg],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.an+this.$handleOffset}`,"stroke-width":2}),m.rh=G(q,{transform:`translate(${s.width/2-this.Ce/2}, ${-this.an-this.$handleOffset-this.Ce/2})`}),l.appendChild(m.rh),Ve(ke,[ic],m.rh,{[te]:t.id,cx:this.Ce/2,cy:this.Ce/2,r:this.Ce/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"});let g=G(et,{x:`${this.Ce/2}`,y:`${this.Ce/2}`,"font-size":Math.floor(this.Ce*.75)});g.innerHTML="\u21BA",m.rh.appendChild(g)}u&&(m.handles=this.Xh==="rectangle"?G_(this.St,s,t,d,l,this.$handleOffset,n,o):$_(this.St,s,t,d,l,this.$handleOffset,n,o))}else p&&(m.rl=Ve(ee,[cg],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.an+this.$handleOffset}`,"stroke-width":2}),m.rh=G(q,{transform:`translate(${s.width/2-this.Ce/2}, ${-this.an-this.$handleOffset-this.Ce/2})`}),l.appendChild(m.rh),Ve(ke,[ic],m.rh,{[te]:t.id,cx:this.Ce/2,cy:this.Ce/2,r:this.Ce/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"})),m.borders={t:null,b:null,l:null,r:null},u&&(o&&(m.borders.t=Ve(Z,[ys,I_],l,{[za]:"t",[te]:t.id,width:s.width,height:this.ct,x:0,y:-this.ct/2}),m.borders.b=Ve(Z,[ys,N_],l,{[za]:"b",[te]:t.id,width:s.width,height:this.ct,x:0,y:s.height-this.ct/2})),n&&(m.borders.r=Ve(Z,[ys,V_],l,{[za]:"r",[te]:t.id,width:this.ct,height:s.height,x:s.width-this.ct/2,y:0}),m.borders.l=Ve(Z,[ys,M_],l,{[za]:"l",[te]:t.id,width:this.ct,height:s.height,x:-(this.ct/2),y:0})));return bx(l,e),l}$_setSkeletonPositionById(e){if(this.skeletons[e]){let t=this.surface.$getManagedElement(e);return bx(this.skeletons[e].el,t),this.skeletons[e].rh&&this.skeletons[e].rh.setAttribute("transform",`translate(${t.width/2-this.Ce/2}, ${-this.an-this.$handleOffset-this.Ce/2})`),this.skeletons[e].rl&&this.skeletons[e].rl.setAttribute("d",`M ${t.width/2}, ${-this.$handleOffset} L ${t.width/2}, -${this.an+this.$handleOffset}`),!0}return!1}lb(e,t,n,o){let s={},a=this.xAxis&&this.resizeX,l=this.yAxis&&this.resizeY;return s[this.widthAtt]=a?n:this.$x2-this.$x1,s[this.heightAtt]=l?o:this.$y2-this.$y1,s[this.leftAtt]=a?e:this.$x1,s[this.topAtt]=l?t:this.$y1,s[this.widthAtt]<0&&(s[this.widthAtt]=this.$minWidth()),s[this.heightAtt]<0&&(s[this.heightAtt]=this.$minHeight()),s}nb(e){let t=e.x-this.Bh.x,n=e.y-this.Bh.y,o=90+Math.atan2(n,t)*180/Math.PI;if(this.Fh!=null){let s=360/this.Fh;o=Math.floor(o/s)*s}this.instance.$_updateVertex(this.toolkitDragObject,{[this.surface.$modelRotationAttribute]:o},Ks,!1),this._r=o}ib(e){let t,n,o=this.sb(e);if(t=o.x-this.$h.x,n=o.y-this.$h.y,this.grid&&!this.ignoreGrid&&(t=(t<0?Math.ceil(t/this.grid.width):Math.floor(t/this.grid.width))*this.grid.width,n=(n<0?Math.ceil(n/this.grid.height):Math.floor(n/this.grid.height))*this.grid.height),(this.resizeY===!1||this.yAxis===!1||this.sn==="l"||this.sn==="r")&&(n=0),(this.resizeX===!1||this.xAxis===!1||this.sn==="t"||this.sn==="b")&&(t=0),this.Js||t!=0||n!=0){this.Js=!0;let{x:s,y:a,width:l,height:h,updates:d}=this.handler.resize(t,n);this.ht!=null&&(this.le!=null?this.le.setFocusPosition({x:s,y:a},!0,null,{width:l,height:h}):(a<0&&(h+=a,a=0),s<0&&(l+=s,s=0),this.co.constrain&&(s+l>this.Rr.width&&(l=this.Rr.width-s),a+h>this.Rr.height&&(h=this.Rr.height-a)))),this.Ym(l,h);let u={x:this.$x1+this.handler.anchor[0]*this.Vh,y:this.$y1+this.handler.anchor[1]*this.Mh},p=Ax(u.x,u.y,this._r,this.Nm),m={x:s+l/2,y:a+h/2},g={x:s+this.handler.anchor[0]*l,y:a+this.handler.anchor[1]*h},E=Ax(g.x,g.y,this._r,m),y=E.x-p.x,x=E.y-p.y,f={x:m.x-y,y:m.y-x},b=Sx(p.x,p.y,this._r,f);this.ho={x:b.x-this.handler.anchor[0]*l,y:b.y-this.handler.anchor[1]*h},this.Gh={width:l,height:h};let A=this.lb(this.ho.x,this.ho.y,l,h),T=this.Gm(this.toolkitDragObject,A)||{},S=Object.assign(T,A),R;if(this.zh!=null&&(R=this.zh(this.toolkitDragObject,this.ho,this.Gh)),this.instance.$_updateVertex(this.toolkitDragObject,S,Ul,!1),d!=null)for(let v in d)this.instance.$_updateVertex(v,d[v],Ul,!1);if(R!=null)for(let v in R)this.instance.$_updateVertex(v,R[v],Ul,!1)}}ab(){return this.ht==null?{x:0,y:0}:{x:this.Rr.x+this.Ws.internalOffset.x,y:this.Rr.y+this.Ws.internalOffset.y}}$vertexRerendered(e){this.skeletons[e.id]!=null&&(this.Ks(e.id),setTimeout(()=>{this.jh(e.vertex)}))}$vertexRotated(e,t){this.skeletons[e.id]&&this.$_setSkeletonPositionById(e.id)}$vertexUpdated(e,t){!this.$busy&&t==Ul&&this.skeletons[e.id]!=null&&(this.Ks(e.id),setTimeout(()=>{this.jh(e.modelObject)}))}Ym(e,t,n){n=n||this.toolkitDragObject.id;let o=this.skeletons[n];o&&(de(o.frame,{width:e+2*this.$handleOffset,height:t+2*this.$handleOffset}),this.resizeMethod===nc?this.Xh==="rectangle"?(o.handles.tr&&de(o.handles.tr,{x:e+this.$handleOffset}),o.handles.bl&&de(o.handles.bl,{y:t+this.$handleOffset}),o.handles.br&&de(o.handles.br,{x:e+this.$handleOffset,y:t+this.$handleOffset}),o.handles.t&&de(o.handles.t,{x:e/2}),o.handles.b&&de(o.handles.b,{x:e/2,y:t+this.$handleOffset}),o.handles.l&&de(o.handles.l,{y:t/2}),o.handles.r&&de(o.handles.r,{x:e+this.$handleOffset,y:t/2})):(o.handles.tr&&de(o.handles.tr,{cx:e+this.$handleOffset}),o.handles.bl&&de(o.handles.bl,{cy:t+this.$handleOffset}),o.handles.br&&de(o.handles.br,{cx:e+this.$handleOffset,cy:t+this.$handleOffset}),o.handles.t&&de(o.handles.t,{cx:e/2}),o.handles.b&&de(o.handles.b,{cx:e/2,cy:t+this.$handleOffset}),o.handles.l&&de(o.handles.l,{cy:t/2}),o.handles.r&&de(o.handles.r,{cx:e+this.$handleOffset,cy:t/2})):(o.borders.t&&de(o.borders.t,{width:e}),o.borders.b&&de(o.borders.b,{width:e,y:t-this.ct/2}),o.borders.r&&de(o.borders.r,{height:t,x:e-this.ct/2}),o.borders.l&&de(o.borders.l,{height:t})))}$vertexSynced(e){this.$_setSkeletonPositionById(e.id)}$groupResized(e){this.$_setSkeletonPositionById(e.element.id),this.Ym(e.newGroupSize.width,e.newGroupSize.height,e.element.id)}$groupCollapsed(e){this.kn(e.modelObject),Object.values(this.skeletons).slice().forEach(n=>{je(n.mel.modelObject,e.modelObject)&&this.Ks(n.mel.id)})}};c(xs,"type","resizingTools"),xs=Ze([Je("resizingTools")],xs);var U_=(n=>(n.STOPPED="stopped",n.FINISHED="finished",n.PAUSED="paused",n.PLAYING="playing",n))(U_||{}),ug="state",dg=class extends zt{constructor(e,t){super();this.components=e;this.params=t;c(this,"state");c(this,"currentlyAnimatingConnection");this.state=t.paused===Pt?"paused":"playing"}setState(e){this.state=e,this.fire(ug,e)}pause(){this.state!=="paused"&&(this.currentlyAnimatingConnection?(this.currentlyAnimatingConnection.pause(),this.setState("paused")):this.setState("stopped"))}play(){this.state!=="playing"&&(this.currentlyAnimatingConnection?this.currentlyAnimatingConnection.play():this.components[0].handler.play(),this.setState("playing"))}cancel(){this.state!=="stopped"&&(this.currentlyAnimatingConnection&&this.currentlyAnimatingConnection.cancel(),this.params.cleanup(),this.setState("stopped"))}};var oc="startOverlayAnimation",mo="endOverlayAnimation",Tx="startNodeTraversal",Y_="endNodeTraversal",vx="vjs-animate-source",Cx="vjs-animate-target",Zn="vjs-animate-node-traversing",sc="vjs-animate-edge-traversing",bFe="vjs-animate-node-traversable",pg="vjs-animate-edge-traversable",AFe="vjs-animate-node-traversed",Px="vjs-animate-edge-traversed";var z_="INITIALIZED",Ox="TRAVERSING_START",X_="TRAVERSING_EDGE",_x="TRAVERSING_END",Xa="CANCELLED",ja="FINISHED";function j_(i,r,e,t){let n=new zt,o=r.connector.totalLength;t=t||{};let s=B(),a=t.events||{};for(let V in a)n.bind(V,a[V]);let l=null,h=t.forwards!==!1,d=t.rate||30,u=t.dwell||350,p=t.speed||100,m=o/p*1e3,g=m/d,E=1/g*(h?1:-1),y=t.isFinal!==!1,x=h?0:1,f=x,b,A,T=()=>h?f>=1:f<=0,S=h?r.sourceElement:r.targetElement,R=h?r.targetElement:r.sourceElement,v,O=t.paused===!0,P=!1,I=!1,C=z_;typeof e=="string"?v={type:e,options:{location:x,id:s}}:(v={type:e.type,options:Object.assign({},e.options)},v.options.location=x,v.options.id=s);let _=V=>{I=!1,qo(r,s),window.clearInterval(b),y?V?(C=Xa,i.surface.removeClass(S,Zn),i.surface.removeClass(R,Zn),Or(r,sc)):(C=_x,i.surface.addClass(R,Zn),window.setTimeout(function(){M()},u)):(i.surface.removeClass(S,Zn),i.surface.removeClass(R,Zn),Or(r,sc),V?C=Xa:(C=ja,Wr(r,Px),n.fire(mo,{connection:r,harness:l})))},w=()=>{f+=E,T()?_(!1):(A.location=f,r.instance.$repaintUIElementById(r.sourceId))},$=()=>{C=X_,n.fire(oc,{connection:r,harness:l}),A=ch(r,v),b=window.setInterval(w,d)},N=()=>{!I&&C!==ja&&C!==Xa&&(i.surface.removeClass(S,Zn),n.fire(Y_,{connection:r,element:S,harness:l}),$())},M=()=>{!I&&C!==ja&&C!==Xa&&(C=ja,i.surface.removeClass(S,Zn),i.surface.removeClass(R,Zn),Or(r,sc),n.fire(mo,{connection:r,harness:l}))},D=()=>{P=!0,I=!1,n.fire(Tx,{connection:r,element:S,harness:l}),i.surface.addClass(S,Zn),Wr(r,sc),C=Ox,window.setTimeout(()=>{N()},u)};return l={eventGenerator:n,play:()=>{P?I&&(I=!1,C===Ox?N():C===_x?M():b=window.setInterval(w,d)):D()},pause:()=>{I=!0,window.clearInterval(b)},cancel:()=>{C!==ja&&C!==Xa&&(window.clearInterval(b),_(!0))},connection:r},t.previous?t.previous.eventGenerator.bind(mo,D):O||D(),l}var mg=class extends zt{constructor(e){super();this.surface=e}animateToPosition(e,t,n,o){let s=this.surface.getObjectInfo(e,!1);if(s){o=o||{},o.start=Hd(o.start,()=>{this.surface.model.openTransaction(ut)}),o.step=Hd(o.step,()=>{}),o.complete=Hd(o.complete,()=>{this.surface.model.commitTransaction()}),o.start();let a=s.el.getBoundingClientRect(),l=t-a.x,h=n-a.y,d=o.duration||250,u=15,p=d/u,m=u/d*l,g=u/d*h,E=0,y=window.setInterval(()=>{this.surface.setPosition(s.obj,a.x+m*(E+1),a.y+g*(E+1)),o.step(E,Math.ceil(p)),E++,E>=p&&(window.clearInterval(y),o.complete())},u)}}traceEdge(e){let t=j(e.edge)?this.surface.model.getEdge(e.edge):e.edge,n=this.surface.$_connMap[t.id];Wr(n,pg),j_(this,n,e.overlay,Object.assign(e.options||{},{isFinal:!0,forwards:!0,events:{[mo]:()=>e.complete&&e.complete(),[oc]:()=>e.start&&e.start()}}))}tracePath(e){let t=e.path||this.surface.model.getPath({source:e.source,target:e.target});if(t.exists()){let n=(m,g)=>{this.fire(m,{edge:g.edge,connection:g,options:e.options})},o=[],s=null,a=null,l=t.result.path.length,h,d=this.surface.getRenderedElement(t.result.path[0].vertex),u=this.surface.getRenderedElement(t.result.path[t.result.path.length-1].vertex);this.surface.addClass(d,vx),this.surface.addClass(u,Cx),t.eachEdge((m,g)=>{Wr(this.surface.$_connMap[g.id],pg)});for(let m=1;m<l;m++){let g=t.result.path[m].vertex.id,E=t.result.previous[g],y=!0,x=t.result.path[m].edge;E!=null&&(y=E===x.source),s=this.surface.$_connMap[x.id],a=j_(this,s,e.overlay,Object.assign(e.options||{},{previous:a,isFinal:m===l-1,forwards:y,paused:!0,events:{[Tx]:f=>{h.currentlyAnimatingConnection=f.harness},[mo]:f=>{h.currentlyAnimatingConnection=null}}})),o.push({handler:a,connection:s})}let p=()=>{t.eachEdge((m,g)=>{let E=this.surface.$_connMap[g.id];Or(E,[Px,pg].join(" "))}),this.surface.removeClass(d,vx),this.surface.removeClass(u,Cx),n(mo,o[o.length-1].connection),h.setState("stopped"),h&&h.setState("finished")};return o.length>0?(o[0].handler.eventGenerator.bind(oc,()=>{n(oc,o[0].connection)}),o[o.length-1].handler.eventGenerator.bind(mo,p),h=new dg(o,{paused:e.paused,cleanup:p}),e.paused!==!0&&o[0].handler.play(),e.listener&&(h.bind(ug,e.listener),h.fire(ug,h.state)),h):null}else return U("Cannot trace non existent path"),null}};var gg="vjs-shape-library-palette-set",Rx="vjs-shape-library-palette",ac="vjs-shape-library-palette-filter",lc="vjs-shape-library-palette-shape",Lx="vjs-shape-library-palette-label",H_="vjs-shape-library-palette-set-title",wx="vjs-shape-library-palette-set-shapes",k_="vjs-shape-library-palette-lasso";var LM=150,wM=100,DM="data-visible",Si="data-category",Eg="data-shape-id",Dx="data-show-all",Nx="data-vjs-type",NM="shape-icon",W_="mainTemplate",Z_="preparedTemplate",Ix="setTemplate",bs="__vjsALL";function IM(i="Show all"){return{[Ix]:`<div class="${gg}" data-category="{{id}}">
103
- <div class="${H_}" data-category="{{id}}">{{name}}</div>
104
- <div class="${wx}" data-category="{{id}}">
102
+ </div>`;default:return`<span>Unsupported type: ${i.type}</span>`}}var yO=class extends lm{constructor(e){super(Object.assign(e,{templateResolver:t=>this.ab(t),getDefaultValue:(t,n)=>{let o=this.Am(t);if(o){let s=o.find(a=>a.id===n);return s?s.defaultValue:null}return null},cacheTemplates:!1}));c(this,"Bn");c(this,"Us");c(this,"xm");c(this,"bm");this.Bn=e.ui.getShapeLibrary(),this.Us=e.properties,this.xm=e.propertyMode||"override",this.bm=e.noPropertiesMessage||"No configurable properties for this shape."}Am(e){if(this.xm==="override"&&this.Us!=null)return this.Us;let t=this.Bn.getShapeDefinition(e.type,e.category);if(t==null)return null;let n=t.properties;if(t.mergeProperties){let o=this.Bn.getShapeSet(e.category||this.Bn.defaultCategoryId);o&&o.properties&&(n=[...n||[],...o.properties])}else if(n==null||n.length===0){let o=this.Bn.getShapeSet(e.category||this.Bn.defaultCategoryId);n=o?o.properties:null}return n==null?this.Us||[]:n}ab(e){if(K(e)||Y(e)){let t=this.Am(e.data);return t?VM(t,this.bm):null}else return null}};var ax="drag",xO="tap",lx="draw";var hm=class{constructor(r,e){this.container=r;c(this,"templateRenderer");this.Gn(e)}Gn(r){this.templateRenderer=new hs({templates:{tp:r}})}setData(r,e){e&&this.Gn(e);let t=this.templateRenderer.template("tp",r).childNodes;this.container.replaceChildren(...t)}};function $M(i){let r={type:null};for(let e=0;e<i.attributes.length;e++){let t=i.attributes.item(e);if(t.name.indexOf("data-vjs")===0){let n=t.name.split("-")[2];r[n]=t.value}}return r.type==null&&(r.type=be),r}var BM="[data-vjs-type]";function FM(i,r,e){let t=(e.x-r.x)/r.width,n=(e.y-r.y)/r.height,o=e.width/r.width,s=e.height/r.height;return{x:Math.round(i.x+t*i.width),y:Math.round(i.y+n*i.height),width:Math.round(o*i.width),height:Math.round(s*i.height)}}var Xa=class{constructor(r,e){this.ui=r;c(this,"qi");c(this,"source");c(this,"Fn");c(this,"Sm");c(this,"kt");c(this,"Ht");c(this,"Tm");c(this,"nn");c(this,"yh");c(this,"Qi");c(this,"xh");c(this,"bh");c(this,"Ah");c(this,"onDrag");c(this,"Or");c(this,"Sh");c(this,"lr");c(this,"Th");c(this,"zs");c(this,"Ch");c(this,"eo");c(this,"Ph");c(this,"Oh");c(this,"no");c(this,"Ys");c(this,"vm");c(this,"Je");c(this,"io",[]);c(this,"oo",[]);c(this,"Un",[]);c(this,"Be");c(this,"G");c(this,"zn");c(this,"_r");c(this,"J");c(this,"Yn");c(this,"Cm");c(this,"_h");c(this,"Pm");c(this,"Xs");c(this,"Om");c(this,"Rh");c(this,"_m");c(this,"sn");c(this,"Lh");c(this,"ve");c(this,"Dh");c(this,"Nh");c(this,"ao");this.qi=e.mode||ax,this.Je=new xe,this.Or=e.ignoreZoom===!0,this.Sm=e.ignoreGrid===!0,this.sn=e.canDrop||((t,n,o)=>this.ui.$canDrop(t,n,o)),this.Ah=e.canvasDropFilter||(t=>!0),this.Sh=e.elementGenerator,this.yh=e.dataGenerator||$M,this.xh=e.typeGenerator||(t=>t.type),this.bh=e.groupIdentifier||((t,n)=>n.getAttribute(yh)===Pt),this.Qi=e.dragSizeGenerator,this.lr=e.enabled!==!1,this.source=e.source,this.Fn=e.selector||BM,this.Nh=new hm(this.source,e.contentTemplate||"<div/>"),e.data!=null&&this.Nh.setData(e.data),this.kt=e.dragActiveClass||FP,this.Ht=e.dragHoverClass||UP,this.Tm=e.dragElementClass||zP,this.nn=e.dragHoverCannotDropClass||YP,this.Lh=e.dragSize,this.Xs=e.allowDropOnNode===!0,this.Om=e.ignoreDropOnNode===!0,this.Rh=e.allowDropOnGroup!==!1,this._m=e.allowDropOnEdge===!0,this.Pm=e.allowDropOnCanvas!==!1,this.Th=e.onVertexAdded,this.onDrag=e.onDrag,this.zs=e.selectAfterAdd===!0,this.ao=function(t){t.key==="Escape"&&(this.qi===lx?this.ve!=null&&this.ui.setMode(Sr):(this.Ih(),this.un()))}.bind(this),this.ui.bind(Ln,t=>{t===jn&&this.ve==null?this.Dh!=null&&this.Rm(this.Dh.el):t!==jn&&this.ve!=null&&(F(this.ve.el,fn),F(this.ui.rootElement,Dh),this.Dh=this.ve,this.ve=null,document.removeEventListener(Xn,this.ao))}),this.qi===ax?this.lb():this.qi===lx?this.hb(e):this.qi===xO&&this.cb()}setEnabled(r){this.lr=r}setData(r,e){this.Nh.setData(r,e)}Rm(r){let e=Bt(r,this.Fn,this.source,!0);if(this.ve!=null){if(F(this.ve.el,fn),this.ve.el===e){this.ui.setMode(Sr);return}}else document.addEventListener(Xn,this.ao);let t=this.yh(e);this.Yn=this.Qi?this.Qi(this.Be,e):this.Lh,this.ve={el:e,data:t,objectType:e.getAttribute(yh)===Pt?se.objectType:ce.objectType,type:this.xh(t)},L(this.ve.el,fn),L(this.ui.rootElement,Dh),this.ui.setMode(jn)}Lm(r,e,t){this.Ch=n=>{if(this.lr){let o=n.target,s=Bt(o,this.Fn,this.source,!0);if(!r(s)||(this._h=this.Or?1:this.ui.getEffectiveVisibleZoom(),this.Be=this.yh(s),this.Ah&&!this.Ah(this.Be)))return;if(this.Yn=this.Qi?this.Qi(this.Be,s):this.Lh,this.J=this.Sh?this.Sh(s,n,this.Be):e(s),this.J.removeAttribute("id"),L(this.J,this.Tm),this.J.style.position=qe,this.J.style.margin="0",this.Cm=this.bh(this.Be,s)?se.objectType:ce.objectType,this.zn=this.Cm===se.objectType?new se(this.ui.model.graph,this.Be):new ce(this.ui.model.graph,this.Be),tr(this.J,{x:n.pageX,y:n.pageY}),!this.Or){let a=-50/this._h;this.J.style.transform=`scale(${this._h}) translate(${a}%,${a}%)`}t(s,this.J),document.body.appendChild(this.J),this.no=!1,this.Ys=this.Pm===!1?!1:this.sn!=null?this.sn(this.zn,null,!0):!0,this.vm=this.ui.getVisibleCanvasBounds(),this.Oh=this.ui.$getElementPositionInWindow(this.ui.rootElement),L(document.body,mt),L(this.ui.rootElement,this.kt),this.Je.on(document,ae,this.Ph),this.io.length=0,this.Un.length=0,!this.Om&&this.Xs&&this.ui.$getNodesInViewport().forEach(a=>{let l=a.el.el;this.io.push({element:a.el.el,cssElement:l,r:a.el,managedElement:a.el,canDrop:this.sn?this.sn(this.zn,a.el.modelObject,!1):this.Xs,vertex:a.el.modelObject,id:a.el.id,objectType:ce.objectType,modelObject:a.el.modelObject}),this.Xs&&L(l,this.kt)}),this.ui.$getGroupsInViewport().forEach(a=>{let l=this.ui.getGroupDefinition(a.el.modelObject);if(l.canDrop==null||l.canDrop(this.zn)){let h=this.ui.$_getGroupContentAreaInfo(a.el.id),d=this.ui.containerType==="SVG"?a.el.el:h.contentArea;this.oo.push({element:h.contentArea,canDrop:this.Rh===!1?!1:this.sn?this.sn(this.zn,a.el.modelObject,!1):!0,vertex:a.el.modelObject,managedElement:a.el,cssElement:d,id:a.el.id,objectType:se.objectType,modelObject:a.el.modelObject,depth:ed(a.el.modelObject),r:{x:a.el.x+h.internalOffset.x,y:a.el.y+h.internalOffset.y,width:a.el.width-h.internalOffset.x,height:a.el.height-h.internalOffset.y}}),this.Rh&&L(d,this.kt)}}),this.oo.sort((a,l)=>l.depth-a.depth),this._m&&this.ui.model.getAllEdges().forEach(a=>{let l=this.ui.getRenderedConnection(a.id),h=l.connector.canvas,d=h;this.Un.push({edge:a,connection:l,connector:l.connector,element:h,cssElement:d,id:a.id,canDrop:!0,r:this.ui.$getElementPositionInWindow(h),objectType:ze.objectType,modelObject:a}),L(d,this.kt)}),this.Je.on(document,Xn,this.ao)}}}Ih(){this.Je.off(document,ae,this.Ph),this.Je.off(document,W,this.eo),this.Je.off(document,le,this.eo),F(document.body,mt),F(this.ui.rootElement,this.nn),F(this.ui.rootElement,this.kt),F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,Dh),this.Je.off(document,Xn,this.ao),this.io.forEach(r=>{F(r.cssElement,this.kt)}),this.oo.forEach(r=>{F(r.cssElement,this.kt)}),this.Un.forEach(r=>{F(r.cssElement,this.kt)}),this.G!=null&&(F(this.G.cssElement,this.Ht),F(this.G.cssElement,this.nn))}wm(r){this.eo=e=>{this.Ih(),this.no&&(this.G!=null?this.G.objectType===ce.objectType&&this.G.canDrop?this.Dm(e,this.G.vertex):this.G.objectType===se.objectType&&this.G.canDrop?this.db(e):this.G.objectType===ze.objectType&&this.G.canDrop&&this.ub(e):this.Ys&&this.Dm(e,null)),this.un()}}Nm(){this.Ph=r=>{tr(this.J,{x:r.pageX,y:r.pageY}),this.Yn&&Rr(this.J,this.Yn.width,this.Yn.height);let e=this.ui.$getElementPositionInWindow(this.J);if(tt(this.Oh,e)){if(!this.Sm&&this.ui.gridProfile.grid!=null){let o=this.ui.gridProfile.grid,s=this.ui.snapPageLocationToGrid(e.x+window.scrollX,e.y+window.scrollY,o);this.J.style.left=`${s.x+e.width/2}px`,this.J.style.top=`${s.y+e.height/2}px`,e=this.ui.$getElementPositionInWindow(this.J)}this.G!=null&&(F(this.G.cssElement,this.Ht),F(this.G.cssElement,this.nn),this.G=null),this._r=FM(this.vm,this.Oh,e);let t=[],n=!1;if(this.io.forEach(o=>{tt(this._r,o.r)&&(t.push(o),n=o.canDrop)}),this.oo.forEach(o=>{tt(this._r,o.r)&&(t.push(o),n=o.canDrop)}),t.sort((o,s)=>{if(Y(o.vertex)&&Y(s.vertex)){if(We(o.vertex,s.vertex))return-1;if(We(s.vertex,o.vertex))return 1}return 0}),t.length>0&&(F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,this.nn),this.G=t[0],this.G.canDrop&&L(this.G.cssElement,this.Ht)),!n){for(let o=0;o<this.Un.length;o++){let s=this.Un[o],a=s.r,l=s.connector;if(tt(e,a)){let h=this.ui.fromPageLocation(e.x+window.scrollX,e.y+window.scrollY),d=this.ui.fromPageLocation(e.x+e.width+window.scrollX,e.y+e.height+window.scrollY),u={x:h.x,y:h.y,width:d.x-h.x,height:d.y-h.y};if(qT(l,u).length>0){this.G=s,L(this.G.cssElement,this.Ht);break}}}this.G==null&&(this.Ys?L(this.ui.rootElement,this.Ht):L(this.ui.rootElement,this.nn))}this.no=!0}else F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,this.nn),this.no=!1;this.onDrag&&this.onDrag(this.Be,this.J,r)}}lb(){this.Nm(),this.wm(le),this.Lm(r=>!0,r=>r.cloneNode(!0),(r,e)=>{this.Je.on(document,le,this.eo)}),this.Je.on(this.source,ge,this.Fn,this.Ch)}cb(){this.Nm(),this.wm(W),this.Lm(r=>{let e=this.source.querySelector(`.${fn}`);return e===r?(F(e,fn),requestAnimationFrame(()=>{this.Ih(),this.un()}),!1):!0},r=>{let e=r.cloneNode(!0);return this.Je.on(e,W,this.eo),e},(r,e)=>{let t=this.source.querySelector(`.${fn}`);t!=null&&F(t,fn),L(e,"vjs-palette-tap-mode-placeholder"),L(r,fn),L(this.ui.rootElement,Dh)}),this.Je.on(this.source,W,this.Fn,this.Ch)}ub(r){if(this.G.objectType===ze.objectType){let e=this.G.edge;this.ui.model.transaction(()=>{this.Vh(this.Be,this._r,this.J,r,this.G.vertex,(t,n,o)=>{let s=e.source,a=e.target,l=e.data||{};delete l.id,this.ui.model.removeEdge(e),this.ui.model.$_addEdge({source:s,target:t,data:l},Ro,null),this.ui.model.$_addEdge({source:t,target:a,data:l},Ro,null)})},ut)}}db(r){this.G.objectType===se.objectType&&(this._r.x-=this.G.r.x,this._r.y-=this.G.r.y,this.Vh(this.Be,this._r,this.J,r,this.G.vertex),this.ui.relayoutGroup(this.G.id))}Dm(r,e){this.Vh(this.Be,this._r,this.J,r,e)}pb(r,e){let t={},n=this.ui.getModelPositionAttributes();for(let o in r)o===Ze?t[n.x]=r[o]:o===Te?t[n.y]=r[o]:t[o]=r[o];return Object.assign(t,e),t}Vh(r,e,t,n,o,s){let a=this.xh(r),l=this.bh(r,t),h=t.getAttribute("data-vjs-group-template"),d=this.pb({left:e.x,top:e.y,type:a},r);o&&Y(o)&&(d.group=o.id);let u=null;if(o!=null){let g=this.ui.viewport.getElementBounds(o.id);g!=null&&(u={vertex:o,pos:{x:g.x,y:g.y},size:{width:g.width,height:g.height}})}let p=this.ui.getModelPositionAttributes();if(l){let g=m=>{let E=m.data[p.x]==null?e.x:m.data[p.x],y=m.data[p.y]==null?e.y:m.data[p.y];this.ui.setPosition(m,E,y),s&&s(m,E,y),this.Mh(this.ui.model.getGroup(m.id),u),this.zs&&this.ui.model.setSelection(this.ui.model.getGroup(m.id))};h==null?this.ui.model.addFactoryGroup(a,d,g,null,!1):this.ui.model.addFactoryGroupWithTemplate(a,h,d,g,null,!1)}else this.ui.model.addFactoryNode(a,d,g=>{let m=g.data[p.x]==null?e.x:g.data[p.x],E=g.data[p.y]==null?e.y:g.data[p.y];this.ui.setPosition(g,m,E),s&&s(g,m,E),this.Mh(this.ui.model.getNode(g.id),u),this.zs&&this.ui.model.setSelection(this.ui.model.getNode(g.id))},null,!1)}Mh(r,e){this.Th&&this.Th({vertex:r,dropTarget:e,doModelUpdate:(t,n)=>{setTimeout(()=>{this.ui.model.mergeTransaction(()=>{try{t(this.ui,this.ui.model,n)}catch(o){U("WARN: could not invoke model update callback after vertex added from palette")}})})}})}un(){Array.from(this.source.querySelectorAll(`.${fn}`)).forEach(r=>{F(r,fn)}),this.zn=null,this.Be=null,this.io.length=0,this.oo.length=0,this.Un.length=0,this.J&&this.J.parentElement.removeChild(this.J),this.J=null,this.Yn=null,this.no=!1,this.Ys=!1}hb(r){this.Je.on(this.source,W,this.Fn,n=>{let o=n.target;this.Rm(o)});let e=this.ui.$_useModelForSizes,t={allowClickToAdd:r.allowClickToAdd,clickToAddOnly:e===!1||r.clickToAddOnly===!0,typeGenerator:(n,o)=>Object.assign({},this.ve),autoExit:!0,lassoClass:r.lassoClass,onVertexAdded:n=>{this.Mh(n),this.zs&&this.ui.model.setSelection(n)}};r.vertexPreviewGenerator!=null&&(t.vertexPreviewGenerator=(n,o)=>r.vertexPreviewGenerator(this.ve.objectType,this.ve.type,this.ve.data,n,o)),r.vertexPreviewUpdater!=null&&(t.vertexPreviewUpdater=(n,o,s)=>{r.vertexPreviewUpdater(s,n,o,this.ve.data)}),this.ui.addPlugin({type:Ai.type,options:t})}};var nc=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"$component")}initialise(e,t){return this.$component=new Wg(t.container,e,t),!0}destroy(){}reset(){}};c(nc,"type","controls"),nc=Ye([He("controls")],nc);var cm=class extends Se{constructor(){super(...arguments);c(this,"$component");c(this,"id")}initialise(e,t){return this.$component=new za(t.container,e,t),!0}destroy(){}reset(){}};cm=Ye([He("exportControls")],cm);var xs=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"lo",[]);c(this,"dragGroupAssigner")}initialise(e,t){return this.surface=e,this.lo=[],this.dragGroupAssigner=t.assignDragGroup,e.bind(Ur,n=>{this.ho(n.el,n.vertex)}),e.bind(Fr,n=>{this.ho(n.el,n.vertex)}),e.bind(Br,n=>{this.mb()}),e.bind(Qs,n=>{this.ho(n.el,n.modelObject)}),!0}destroy(){}reset(){this.lo.length=0}assignToDragGroup(...e){e.forEach(t=>{let n=this.surface.getObjectInfo(t,!1);n.el&&this.ho(n.el,n.obj)})}removeFromDragGroup(...e){this.surface.removeFromDragGroup(...e.map(t=>this.surface.getObjectInfo(t,!1).el).filter(t=>t!=null))}addToDragGroup(e,...t){this.surface.addToDragGroup(e,...t.map(n=>this.surface.getObjectInfo(n,!1).el).filter(n=>n!=null))}ho(e,t){if(this.dragGroupAssigner!=null)if(this.surface.isSuspendRendering())this.lo.push([e,t]);else{let n=this.dragGroupAssigner(t);if(n!=null){let o=typeof n=="string"?{id:n,active:!0}:n;this.surface.$addToDragGroup(Object.assign(o,{membership:bO}),e)}else this.surface.$_assignRemoveFromDragGroup(e)}}mb(){if(this.dragGroupAssigner!=null)for(let e=0;e<this.lo.length;e++)this.ho.apply(this,this.lo[e])}};c(xs,"type","dragGroups"),xs=Ye([He("dragGroups")],xs);var dm="vjs-snapline",AO="vjs-snapline-vertical",SO="vjs-snapline-horizontal",hx="vjs-snapline-exact",TO="vjs-snapline-active",vO="vjs-snapline-active-exact",bs=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"panZoom");c(this,"tolerance",5);c(this,"showCenters");c(this,"showEdges");c(this,"verticalRanges",[]);c(this,"horizontalRanges",[]);c(this,"selectedRanges",[]);c(this,"focus",null);c(this,"enabled",!0)}setEnabled(e){let t=this.enabled;this.enabled=e,t&&this.reset()}initialise(e,t){this.surface=e,this.panZoom=e.panZoom,this.tolerance=t.tolerance||5,this.showCenters=t.showCenters!==!1,this.showEdges=t.showEdges!==!1,this.enabled=t.enabled!==!1,this.surface.bind(Ws,o=>{if(this.enabled&&o.dragGroup.length>0){let s=o.dragGroup[0],a=this.surface.viewport.getElements();this.focus=s.element,this.verticalRanges.length=0,this.horizontalRanges.length=0,this.selectedRanges.length=0;for(let l in a)if(l!==this.focus.id){let h=a[l].t,d=h.width,u=h.height;this.showEdges&&(this.horizontalRanges.push({position:Ze,start:h.x-this.tolerance,end:h.x+this.tolerance,objId:l,line:this.Gh(h.x),el:a[l].el,orientation:"v"}),this.horizontalRanges.push({position:yt,start:h.x+d-this.tolerance,end:h.x+d+this.tolerance,objId:l,line:this.Gh(h.x+d),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:Te,start:h.y-this.tolerance,end:h.y+this.tolerance,objId:l,line:this.$h(h.y),el:a[l].el,orientation:"h"}),this.verticalRanges.push({position:ht,start:h.y+h.height-this.tolerance,end:h.y+h.height+this.tolerance,objId:l,line:this.$h(h.y+u),el:a[l].el,orientation:"h"})),this.showCenters&&(this.horizontalRanges.push({position:It,start:h.x+d/2-this.tolerance,end:h.x+d/2+this.tolerance,objId:l,line:this.Gh(h.x+d/2),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:It,start:h.y+u/2-this.tolerance,end:h.y+u/2+this.tolerance,objId:l,line:this.$h(h.y+u/2),el:a[l].el,orientation:"h"}))}}}),this.surface.bind(Mt,o=>{if(this.enabled&&o.dragGroup.length>0){this.js();let s=o.dragGroup[0],a=s.pos.x,l=a+this.focus.width/2,h=a+this.focus.width,d=s.pos.y,u=d+this.focus.height/2,p=d+this.focus.height,g={};for(let m=0;m<this.horizontalRanges.length;m++){let E=this.horizontalRanges[m];g[E.objId]||(E.start<=l&&E.end>=l?(g[E.objId]=!0,this.Xn(E,l)):E.start<=a&&E.end>=a?(g[E.objId]=!0,this.Xn(E,a)):E.start<=h&&E.end>=h&&(g[E.objId]=!0,this.Xn(E,h)))}for(let m=0;m<this.verticalRanges.length;m++){let E=this.verticalRanges[m];g[E.objId]||(E.start<=u&&E.end>=u?(g[E.objId]=!0,this.Xn(E,u)):E.start<=d&&E.end>=d?(g[E.objId]=!0,this.Xn(E,d)):E.start<=p&&E.end>=p&&(g[E.objId]=!0,this.Xn(E,p)))}}});let n=()=>{this.enabled&&(this.js(),this.verticalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.horizontalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.verticalRanges.length=0,this.horizontalRanges.length=0)};return this.surface.bind(Vt,o=>n()),this.surface.bind(Bd,o=>n()),!0}Xn(e,t){this.selectedRanges.push(e);let n=(e.start+e.end)/2,o=Math.round(t)===Math.round(n);o?e.line.classList.add(`${hx}`):e.line.classList.remove(`${hx}`);let s={x:e.orientation===bA?-5e4:n,y:e.orientation===hd?-5e4:n};this.surface.fixElement(e.line,s,null,null,!0),L(e.el,`${TO}`),o&&L(e.el,`${vO}`)}js(){this.selectedRanges.forEach(e=>{e.line.classList.remove(`${hx}`),this.surface.unfixElement(e.line),F(e.el,`${TO}`),F(e.el,`${vO}`)})}$h(e){if(this.surface.containerType==="SVG")return qr(Gt,Z,{y:`${e}px`},`${dm} ${SO}`,{x:"-50000",width:"100000",height:"1"});{let t=document.createElement(Ke);return t.className=`${dm} ${SO}`,t.style.left="-50000px",t.style.right="-50000px",t.style.top=`${e}px`,t}}Gh(e){if(this.surface.containerType==="SVG")return qr(Gt,Z,{x:`${e}px`},`${dm} ${AO}`,{y:"-50000",height:"100000",width:"1"});{let t=document.createElement(Ke);return t.className=`${dm} ${AO}`,t.style.top="-50000px",t.style.bottom="-50000px",t.style.left=`${e}px`,t}}destroy(){this.js()}reset(){this.js()}};c(bs,"type","snaplines"),bs=Ye([He("snaplines")],bs);var ic=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"$palette")}destroy(){}initialise(e,t){return this.$palette=new Xa(e,t),!0}reset(){}};c(ic,"type","palette"),ic=Ye([He("palette")],ic);var As=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"startPanTimeout");c(this,"panRepeatInterval");c(this,"panRepeatDistance");c(this,"co",[]);c(this,"Im",null);c(this,"currentPanButton",null);c(this,"surface");c(this,"panZoom");c(this,"panDistance");c(this,"eventManager");c(this,"Vm",!1);c(this,"Bh");c(this,"Mm")}initialise(e,t){return this.eventManager=new xe,this.surface=e,this.panZoom=e.panZoom,this.startPanTimeout=t.startPanTimeout||150,this.panRepeatInterval=t.panRepeatInterval||60,this.panRepeatDistance=t.panRepeatDistance||10,this.panDistance=t.panDistance||50,this.Bh=()=>{this.panZoom.stopPanRepeat(),window.clearTimeout(this.Im),this.currentPanButton&&this.surface.removeClass(this.currentPanButton,vy),this.currentPanButton=null,this.eventManager.off(document,le,this.Bh)},this.Mm=()=>{this.panZoom.stopPanRepeat()},this.makePanButton(Te,{left:"0px",top:"0px"},0,-1,"&#8593;"),this.makePanButton(ht,{left:"0px",bottom:"0px"},0,1,"&#8595;"),this.makePanButton(Ze,{left:"0px",top:"0px"},-1,0,"&#8592;"),this.makePanButton(yt,{right:"0px",top:"0px"},1,0,"&#8594;"),!0}curryPanButton(e,t){return n=>{this.Vm||this.panZoom.pan(e*this.panDistance,t*this.panDistance,!0),this.Vm=!1}}startPanTimer(e,t,n){return()=>{this.currentPanButton=n,this.surface.addClass(this.currentPanButton,vy),this.eventManager.on(document,le,this.Bh),this.Im=window.setTimeout(()=>{this.eventManager.on(document,le,this.Mm),this.panZoom.startPanRepeat(e,t,this.panRepeatDistance,this.panRepeatDistance,this.panRepeatInterval)},this.startPanTimeout)}}makePanButton(e,t,n,o,s){let a=document.createElement(Ke);return a.innerHTML=s||"",a.style.position=qe,Object.assign(a.style,t),a.className=`${Ty} ${Ty}-${e}`,this.panZoom.viewportElement.appendChild(a),this.eventManager.on(a,Xe,this.curryPanButton(n,o)),this.eventManager.on(a,ge,this.startPanTimer(n,o,a)),this.co.push(a),a}destroy(){for(let e=0;e<this.co.length;e++)this.co[e].parentNode.removeChild(this.co[e]);this.co.length=0}reset(){}};c(As,"type","panButtons"),As=Ye([He("panButtons")],As);var um="[data-vjs-list='true']",UM="data-vjs-list-behavior",oc=class extends Se{constructor(){super(...arguments);c(this,"id","list-manager");c(this,"surface");c(this,"options");c(this,"jn",null)}initialise(e,t){this.surface=e,this.options=t,e.addWheelSelectorFilter(`${um}, ${um} *`);let n=e.getContainer();return e.on(n,"wheel",um,(o,s)=>{this.jn||(this.jn=window.requestAnimationFrame(()=>{this.wheelHandler(o,s),this.jn=null}))}),!0}Gm(e){[e.source,e.target].forEach(t=>{let n=this.surface.getRenderedElement(t);if(n){let o=n.closest(um);o&&this.wheelHandler(null,o)}})}$edgeRendered(e){this.Gm(e.edge)}$edgeUpdated(e){this.Gm(e)}wheelHandler(e,t){let n=this.surface.$getAttribute(t,UM)||this.options.behavior||"proxy",o=this.surface.getObjectInfo(t,!1);if(o.obj){let{vertices:s,contentEl:a}=Y(o.obj)?{vertices:o.obj.members,contentEl:this.surface.$getGroupContentAreaElement(o.el)}:{vertices:o.obj.getPorts(),contentEl:o.el},l=a.getBoundingClientRect(),h=o.el.getBoundingClientRect(),d=Math.max(l.top,h.top),u=Math.min(l.bottom,h.bottom);s.forEach(p=>{this.surface.$revalidateElementById(p.id);let g=this.surface.getElement(p.id),E=g.el.getBoundingClientRect(),y=E.bottom<=d||E.top>=u||E.right<=l.left||E.left>=l.right;p.getAllEdges().forEach(f=>{let b=f.source.id===p.id?"source":"target";if(n==="proxy"){let A=this.surface.getRenderedConnection(f.id);if(A!=null)if(y){let T=A.anchors[b],O=T.locations[T.currentLocation].x<.5?"Left":"Right",_=`${E.bottom<=d?"Top":"Bottom"}${O}`,P=St(_);this.surface.$_proxyEdge(f,b,this.surface.getElement(o.id),P)}else this.surface.$_unproxyEdge(f,b)}else f.ks=f.ks||new Set,y?f.ks.add(b):f.ks.delete(b),this.surface.setVisible(f,f.ks.size===0)}),this.surface.$repaintUIElement(g,null,!1,!0)})}}destroy(){this.jn&&(window.cancelAnimationFrame(this.jn),this.jn=null)}reset(){}};c(oc,"type","listManager"),oc=Ye([He("listManager")],oc);var CO="vjs-vertex-drawing-lasso",cx="vjs-group-candidate-child";var Ai=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"lasso");c(this,"autoExit");c(this,"typeGenerator");c(this,"groupType");c(this,"nodeType");c(this,"defaultGroupSize");c(this,"defaultNodeSize");c(this,"$m");c(this,"Fh");c(this,"kn");c(this,"Hn");c(this,"Hs");c(this,"Ws");c(this,"$onVertexAdded");c(this,"Uh");c(this,"vertexSelection");c(this,"selectedElements",[])}destroy(){}gb(e,t){if(this.typeGenerator!=null){let o=this.typeGenerator(e,t);this.Hn=o.objectType,this.Hs=o.type,this.Ws=o.data||{}}else this.nodeType!=null?(this.Hn=ce.objectType,this.Hs=this.nodeType,this.Ws={}):(this.Hn=se.objectType,this.Hs=this.groupType||be,this.Ws={});let n=this.surface.getModelObjectFromElement(t.target,!0,!1);n!=null&&Y(n.obj)?this.kn=n.obj:this.kn=null}initialise(e,t){this.surface=e,this.Uh=t.minSize||{width:50,height:50},this.nodeType=t.nodeType,this.groupType=t.groupType,this.typeGenerator=t.typeGenerator,this.Fh=e.$_useModelForSizes===!1||t.clickToAddOnly===!0,this.$m=this.Fh||t.allowClickToAdd===!0,this.defaultGroupSize=t.defaultGroupSize||{width:250,height:250},this.defaultNodeSize=t.defaultNodeSize||{width:80,height:80},this.$onVertexAdded=t.onVertexAdded||(s=>{});let n=`${CO} ${t.lassoClass||""}`;e.bind(Ln,s=>{this.lasso.enabled=s===jn}),this.vertexSelection=new pr(e.model),this.autoExit=t.autoExit===!0;let o={surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:n,mapToGrid:s=>{if(this.surface.gridProfile.grid){let a=this.surface.fromPageLocation(s.x,s.y),l=he(a,this.surface.gridProfile.grid);return this.surface.toPageLocation(l.x,l.y)}else return s},onStart:(s,a,l,h)=>{e.hoverSuspended=!0,this.gb(a,h)},onSelect:(s,a,l,h,d,u,p)=>{if(p!=null&&t.vertexPreviewUpdater&&t.vertexPreviewUpdater(s,a,p),this.Hn===se.objectType){this.vertexSelection.clear(),this.Bm();let g=[],m,E=e.findIntersectingVertices({origin:l,dimensions:h,dontIncludeGroups:!1,dontIncludeNodes:!1,dontIncludeNodesInsideGroups:!1,enclosed:!0,dontIncludeNestedGroups:!1}),y=E.length,x={};for(m=0;m<y;m++)g.push(E[m].v),x[E[m].id]=!0,this.vertexSelection.append(E[m].v),L(E[m].el,cx),this.selectedElements.push(E[m].el)}},onEnd:(s,a)=>{e.hoverSuspended=!1,this.Bm(),this.autoExit&&e.mode!==ps&&e.setMode(Sr);let l=e.getEffectiveVisibleZoom(),h={width:Math.round(a.width/l),height:Math.round(a.height/l)};this.Fm(s,h)},filter:s=>{let a=s.srcElement||s.target;return a===e.vertexLayer||a===e.$getCanvasElement()},onClick:(s,a)=>{if(this.autoExit&&e.mode!==ps&&e.setMode(Sr),this.$m){let l=this.Hn===se.objectType?this.defaultGroupSize:this.defaultNodeSize;this.Fm(s,l)}}};return t.vertexPreviewGenerator!=null&&(o.generateLassoContent=(s,a)=>t.vertexPreviewGenerator(s,a)),this.lasso=new Va(o),this.Fh&&this.lasso.setEnabled(!1),!0}Fm(e,t){let n=this.surface.fromPageLocation(e.x,e.y);(t.width>=this.Uh.width||t.height>=this.Uh.height)&&(this.Hn===se.objectType?this.Eb(this.surface,n,t):this.fb(this.surface,n,t))}Um(e,t){return Object.assign(this.Ws,{id:$(),[this.surface.$modelLeftAttribute]:e.x,[this.surface.$modelTopAttribute]:e.y,width:t.width,height:t.height,type:this.Hs})}yb(){let e=this.vertexSelection.getNodes(),t=this.vertexSelection.getGroups(),n={nodes:[],groups:[]};return e.forEach(o=>{t.find(s=>We(o,s))==null&&n.nodes.push(o)}),t.forEach(o=>{t.find(s=>We(o,s))==null&&n.groups.push(o)}),n}Eb(e,t,n){let o;e.model.transaction(()=>{let s=this.Um(t,n),a=s[this.surface.$modelLeftAttribute],l=s[this.surface.$modelTopAttribute];o=e.model.addGroup(s);let h=[{v:o,x:a,y:l}];e.setSuspendRendering(!0);let d=this.yb();d.nodes.forEach(u=>{let p=e.viewport.getPosition(u.id),g=p.x-t.x,m=p.y-t.y;e.model.addToGroup(u,o),e.model.updateNode(u,{[e.$modelLeftAttribute]:g,[e.$modelTopAttribute]:m}),h.push({v:u,x:g,y:m})}),d.groups.forEach(u=>{let p=e.viewport.getPosition(u.id),g=p.x-t.x,m=p.y-t.y;e.model.addToGroup(u,o),e.model.updateGroup(u,{[e.$modelLeftAttribute]:g,[e.$modelTopAttribute]:m}),h.push({v:u,x:g,y:m})}),h.forEach(u=>{e.setPosition(u.v,u.x,u.y)}),this.kn!=null&&e.model.addToGroup(o,this.kn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}fb(e,t,n){let o;e.setSuspendRendering(!0);let s=this.Um(t,n);e.model.transaction(()=>{o=e.model.addNode(s);let a={x:s[this.surface.$modelLeftAttribute],y:s[this.surface.$modelTopAttribute]};e.setPosition(o,a.x,a.y),this.kn!=null&&e.model.addToGroup(o,this.kn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Bm(){this.selectedElements.forEach(e=>F(e,cx)),this.selectedElements.length=0}reset(){}};c(Ai,"type","vertexDrawing"),Ai=Ye([He("vertexDrawing")],Ai);var pm=12,PO=40,_O=16,OO=6,RO=30,LO=30,wO=5,DO="borders",sc="handles",NO="vjs-resize-skeleton",IO="vjs-resize-skeleton-borders",MO="vjs-resize-skeleton-borders-visible",VO="vjs-resize-frame",Tt="vjs-resize-handle",dx="vjs-resize-handle-active",ux="vjs-resize-handle-tl",px="vjs-resize-handle-bl",gx="vjs-resize-handle-tr",mx="vjs-resize-handle-br",Ex="vjs-resize-handle-t",fx="vjs-resize-handle-b",yx="vjs-resize-handle-l",xx="vjs-resize-handle-r",Ss="vjs-resize-border",GO="vjs-resize-border-b",$O="vjs-resize-border-t",BO="vjs-resize-border-l",FO="vjs-resize-border-r",ac="vjs-rotate-handle",gm="vjs-rotate-leader",bx="data-vjs-x-resize",Ax="data-vjs-y-resize",Sx="data-vjs-resizable",Tx="data-vjs-rotatable",ja="data-dir";function Ge(i,r,e,t){let n=V(i,t),o=r.join(" ");return L(n,o),e&&e.appendChild(n),n}function vx(i,r){Ie(i,r.ro),r.r!=null&&xi(i,r.r)}var go=(i,r)=>`translate(${-(i/2)-r/2}, ${-(i/2)-r/2})`;function UO(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ge(Z,[Tt,ux],n,{"data-dir":"tl",[te]:e.id,width:i,height:i,x:l-o,y:h-o,transform:go(i,t)}),p.tr=Ge(Z,[Tt,gx],n,{"data-dir":"tr",[te]:e.id,width:i,height:i,x:d+o,y:h-o,transform:go(i,t)}),p.bl=Ge(Z,[Tt,px],n,{"data-dir":"bl",[te]:e.id,width:i,height:i,x:l-o,y:u+o,transform:go(i,t)}),p.br=Ge(Z,[Tt,mx],n,{"data-dir":"br",[te]:e.id,width:i,height:i,x:d+o,y:u+o,transform:go(i,t)})),a&&(p.t=Ge(Z,[Tt,Ex],n,{"data-dir":"t",[te]:e.id,x:(l+d)/2,y:h-o,width:i,height:i,transform:go(i,t)}),p.b=Ge(Z,[Tt,fx],n,{"data-dir":"b",[te]:e.id,x:(l+d)/2,y:u+o,width:i,height:i,transform:go(i,t)})),s&&(p.l=Ge(Z,[Tt,yx],n,{"data-dir":"l",[te]:e.id,x:l-o,y:(h+u)/2,width:i,height:i,transform:go(i,t)}),p.r=Ge(Z,[Tt,xx],n,{"data-dir":"r",[te]:e.id,x:d+o,y:(h+u)/2,width:i,height:i,transform:go(i,t)})),p}function YO(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ge(Fe,[Tt,ux],n,{"data-dir":"tl",[te]:e.id,cx:l-o,cy:h-o,r:i/2}),p.tr=Ge(Fe,[Tt,gx],n,{"data-dir":"tr",[te]:e.id,r:i/2,cx:d+o,cy:h-o}),p.bl=Ge(Fe,[Tt,px],n,{"data-dir":"bl",[te]:e.id,r:i/2,cx:l-o,cy:u+o}),p.br=Ge(Fe,[Tt,mx],n,{"data-dir":"br",[te]:e.id,r:i/2,cx:d+o,cy:u+o})),a&&(p.t=Ge(Fe,[Tt,Ex],n,{"data-dir":"t",[te]:e.id,cx:(l+d)/2,cy:h-o,r:i/2}),p.b=Ge(Fe,[Tt,fx],n,{"data-dir":"b",[te]:e.id,cx:(l+d)/2,cy:u+o,r:i/2})),s&&(p.l=Ge(Fe,[Tt,yx],n,{"data-dir":"l",[te]:e.id,cx:l-o,cy:(h+u)/2,r:i/2}),p.r=Ge(Fe,[Tt,xx],n,{"data-dir":"r",[te]:e.id,cx:d+o,cy:(h+u)/2,r:i/2})),p}function zO(i){return{tl:{anchor:[1,1],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:t,y:n},i.grid);t=h.x,n=h.y;let d=he({x:i.$x2,y:i.$y2},i.grid);o=d.x-t,s=d.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),n>i.$y2-l&&(n=i.$y2-l,s=l),{x:t,y:n,width:o,height:s}},id:"tl"},tr:{anchor:[0,1],id:"tr",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1+e,o=i.$y2-n,s=i.$x1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:s+t,y:n},i.grid);t=h.x-s,n=h.y,o=he({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),n>i.$y2-l&&(n=i.$y2-l,o=l),{x:s,y:n,width:t,height:o}}},bl:{anchor:[1,0],id:"bl",resize:(r,e)=>{let t=i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x2-t,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:t,y:s+n},i.grid);t=h.x,n=h.y-s,o=he({x:i.$x2,y:h.y},i.grid).x-t}return t>i.$x2-a&&(t=i.$x2-a,o=a),n<l&&(n=l),{x:t,y:s,width:o,height:n}}},br:{anchor:[0,0],id:"br",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:o+t,y:s+n},i.grid);t=h.x-o,n=h.y-s}return t<a&&(t=a),n<l&&(n=l),{x:o,y:s,width:t,height:n}}},t:{anchor:[.5,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(n=he({x:t,y:n},i.grid).y,s=he({x:i.$x2,y:i.$y2},i.grid).y-n),n>i.$y2-a&&(n=i.$y2-a,s=a),{x:t,y:n,width:o,height:s}},id:"t"},b:{anchor:[.5,0],resize:(r,e)=>{let t=i.$x1,n=i.$y1,o=i.$x2-i.$x1,s=i.$y2-i.$y1+e,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(s=he({x:t,y:n+s},i.grid).y-n),s<a&&(s=a),{x:t,y:n,width:o,height:s}},id:"b"},l:{anchor:[1,.5],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=he({x:t,y:n},i.grid).x,o=he({x:i.$x2,y:i.$y2},i.grid).x-t),t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}},id:"l"},r:{anchor:[0,.5],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1,o=i.$x1,s=i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=he({x:o+t,y:s+n},i.grid).x-o),t<a&&(t=a),{x:o,y:s,width:t,height:n}}}}}function XO(i){return{l:{anchor:[1,0],id:"l",resize:(r,e)=>{let t=i.$x1+r,n=i.$y1,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=he({x:t,y:n},i.grid);t=l.x,n=l.y;let h=he({x:i.$x2,y:i.$y2},i.grid);o=h.x-t,s=h.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}}},r:{anchor:[0,1],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1,o=i.$y2-n,s=i.$x1,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=he({x:s+t,y:n},i.grid);t=l.x-s,n=l.y,o=he({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),{x:s,y:n,width:t,height:o}}},t:{id:"t",anchor:[0,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$y2-n,s=i.$x2-t,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=he({x:t,y:n+o},i.grid);t=l.x,o=l.y-n,s=he({x:i.$x2,y:l.y},i.grid).x-t}return n>i.$y2-a&&(n=i.$y2-a,o=a),{x:t,y:n,width:s,height:o}}},b:{id:"b",anchor:[0,0],resize:(r,e)=>{let t=i.$x2-i.$x1,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=he({x:o+t,y:s+n},i.grid);t=l.x-o,n=l.y-s}return n<a&&(n=a),{x:o,y:s,width:t,height:n}}}}}function Cx(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)-o*Math.sin(e),y:n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}function Px(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)+o*Math.sin(e),y:-n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}var Ts=class extends Se{constructor(){super(...arguments);c(this,"id","resizingTools");c(this,"surface");c(this,"instance");c(this,"widthAtt");c(this,"heightAtt");c(this,"leftAtt");c(this,"topAtt");c(this,"xAxis");c(this,"yAxis");c(this,"resizeX");c(this,"resizeY");c(this,"canResizeFilter");c(this,"canRotateFilter");c(this,"onEdit");c(this,"onDemand");c(this,"an");c(this,"Rr");c(this,"uo");c(this,"zh");c(this,"Yh");c(this,"zm");c(this,"Xh");c(this,"skeletons");c(this,"ct");c(this,"Lr");c(this,"Zs");c(this,"po");c(this,"Js");c(this,"he");c(this,"wr");c(this,"downAt");c(this,"jh");c(this,"handler");c(this,"toolkitDragObject");c(this,"Ks");c(this,"$x1");c(this,"$x2");c(this,"$y1");c(this,"$y2");c(this,"kh");c(this,"minimumHeight");c(this,"minimumWidth");c(this,"currentMinimumWidth");c(this,"currentMinimumHeight");c(this,"ignoreGrid");c(this,"grid");c(this,"Ym");c(this,"Xm");c(this,"Hh");c(this,"St",!1);c(this,"Wh",!1);c(this,"qs",!1);c(this,"$handleOffset");c(this,"Zh");c(this,"Jh");c(this,"Tt");c(this,"Kh");c(this,"ln");c(this,"Ce");c(this,"dt");c(this,"km");c(this,"resizeMethod");c(this,"bordersVisible");c(this,"Hm");c(this,"Wm")}jm(e){this.toolkitDragObject&&this.skeletons[this.toolkitDragObject.id]&&(e?L(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"):F(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"))}set $moving(e){this.St=e,this.jm(e)}set $rotating(e){this.Wh=e,this.jm(e)}get $busy(){return this.St||this.Wh}destroy(){}initialise(e,t){this.surface=e,this.$handleOffset=t.handleOffset||wO,this.Zh=t.modelUpdater,this.Jh=t.handlerFactory,this.Hm=zO(this),this.Wm=XO(this),e.$addTransferrableVertexAttributes([Sx,Ax,bx,Tx]),this.instance=e.model,this.skeletons={},this.widthAtt=t.widthAttribute||this.instance.modelWidthAttribute,this.heightAtt=t.heightAttribute||this.instance.modelHeightAttribute,this.leftAtt=t.leftAttribute||this.instance.modelLeftAttribute,this.topAtt=t.topAttribute||this.instance.modelTopAttribute,this.onEdit=t.onEdit||function(){},this.onDemand=t.onDemand===!0,this.minimumWidth=t.minimumWidth!=null&&t.minimumWidth>0?t.minimumWidth:RO,this.minimumHeight=t.minimumHeight!=null&&t.minimumHeight>0?t.minimumHeight:LO,this.grid=this.surface.getGrid(),this.ignoreGrid=t.ignoreGrid===!0,this.Xm=t.constrainGroups!==!1,this.canResizeFilter=t.canResizeFilter,this.canRotateFilter=t.canRotateFilter,this.Tt=t.handleSize||pm,this.Kh=t.handleShape||"circle",this.ln=t.rotateLeaderLength||PO,this.Ce=t.rotateHandleSize||_O,this.dt=t.borderHandleSize||OO,this.resizeMethod=t.resizeMethod||sc,this.bordersVisible=this.resizeMethod===DO&&t.bordersVisible!==!1,this.Ym=t.rotatable===!0,this.Hh=t.rotationStops,this.resizeX=t.resizeX!==!1,this.resizeY=t.resizeY!==!1,[Tt,ac,gm,Ss].forEach(a=>{this.surface.addDragClassnameFilter(a)}),this.km=t.payloadGenerator||((a,l)=>l),this.instance.bind(ir,()=>{this.reset()}),this.instance.bind(qt,a=>{this.onDemand!==!0&&this.qh(a.obj)}),this.instance.bind(Qt,a=>{this.onDemand!==!0&&this.Wn(a.obj)});let n=a=>{this.$_setSkeletonPositionById(a.id),Y(a)&&a.getMembers().forEach(l=>n(l))};this.surface.bind(Mt,a=>{a.dragGroup.forEach(l=>{n(l.vertex)})}),this.instance.bind(Le,a=>{this.$_setSkeletonPositionById(a.vertex.id)}),this.instance.bind(ve,a=>{n(a.vertex)}),this.instance.bind(Ce,a=>{this.Wn(a.node)}),this.instance.bind(Re,a=>{this.Wn(a.group),a.group.getMembers().forEach(l=>this.Wn(l))});let o=a=>{this.St||this.instance.openTransaction(),this.$moving=!0,oe(a);let l=this.surface.mapEventLocation(a);this.Wh?this.xb(l):this.Ab(l)},s=a=>{if(this.$busy){if(oe(a),this.qs&&this.ct!=null){let l=new Set;if(this.he!=null){let h={},d={},u={},{movedElements:p,resizedGroups:g}=this.he.ih();Object.assign(u,g);for(let m in p)h[m]=p[m].current,d[m]=p[m].current;for(let m in h){let E={[this.surface.$modelLeftAttribute]:h[m].x,[this.surface.$modelTopAttribute]:h[m].y};u[m]!=null&&(E[this.surface.$modelWidthAttribute]=u[m].newGroupSize.width,E[this.surface.$modelHeightAttribute]=u[m].newGroupSize.height),this.surface.model.$_updateVertex(m,E,ra,!1)}this.surface.$_sizeGroupsToFit(l,null,null,!1),this.surface.$trackGroupSizeChanges(u);for(let m in u){let E=u[m].newGroupSize;this.surface.viewport.updateElement(m,null,null,E.width,E.height,null,null,!1)}}else l.add(this.ct);this.surface.$_sizeGroupsToFit(l,null,null,!1)}this.Ks&&F(this.Ks,dx),this.surface.$removeClassFromElement(document.body,mt),this.surface.off(document,ae,o),this.surface.off(document,le,s),this.he&&this.he.cleanup(),this.he=null,this.ct=null,this.Zs=!1,this.po=null,this.Js=null,this.Lr=null,this.onEdit(this.toolkitDragObject,this.surface,this.instance),this.instance.commitTransaction(),this.$moving=!1,this.$rotating=!1,this.qs=!1}};return this.surface.on(this.surface.getContainer(),ge,z(Tt),a=>{this.Zm(a,this.Hm,o,s)}),this.surface.on(this.surface.getContainer(),ge,z(Ss),a=>{this.Zm(a,this.Wm,o,s)}),this.surface.on(this.surface.getContainer(),ge,z(ac),a=>{oe(a),this.Rr=0,this.toolkitDragObject=this.surface.model.getVertex(a.target.getAttribute(te)),this.toolkitDragObject!=null&&(this.wr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Rr=this.wr.r,this.downAt=this.surface.mapEventLocation(a),this.$rotating=!0,this.kh={x:this.wr.c.x,y:this.wr.c.y},this.Jm(a),this.surface.$addClassToElement(document.body,mt),this.surface.on(document,ae,o),this.surface.on(document,le,s))}),!1}Jm(e){this.toolkitDragObject!=null&&(this.ct=this.toolkitDragObject.group,this.Zs=!1,this.ct!=null&&(this.po=this.surface.getGroupDefinition(this.ct),this.Js=this.surface.$_getGroupContentAreaInfo(this.ct.id),this.Lr=this.surface.viewport.getGroupElement(this.ct.id),this.Zs=this.po.elastic===!0&&e.shiftKey!==!0,this.Zs&&(this.he=new Fa(this.surface,this.toolkitDragObject,this.ct,this.po))))}Zm(e,t,n,o){oe(e);let s=e.target,a=s.getAttribute(te);this.an=s.getAttribute(ja),this.Ks=s,this.toolkitDragObject=this.instance.getNode(a)||this.instance.getGroup(a),this.wr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Jm(e),this.xAxis=this.skeletons[a].canResizeX,this.yAxis=this.skeletons[a].canResizeY,this.downAt=this.surface.mapEventLocation(e);let l=this.Sb(this.toolkitDragObject);if(this.$x1=l.x,this.$y1=l.y,this.$x2=this.$x1+l.width,this.$y2=this.$y1+l.height,this.Rr=this.Km(),this.uo={x:l.x,y:l.y},this.Xh={width:l.width,height:l.height},this.zh=this.$x2-this.$x1,this.Yh=this.$y2-this.$y1,this.zm={x:this.$x1+this.zh/2,y:this.$y1+this.Yh/2},this.jh=Px(this.downAt.x,this.downAt.y,this.Rr,{x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2}),Y(this.toolkitDragObject)){if(this.surface.getGroupElement(this.toolkitDragObject.id).collapsed)return;{let d=this.surface.getGroupDefinition(this.toolkitDragObject);if(this.Xm&&d.constrain!==!1){let u=this.surface.$_getGroupContentAreaInfo(this.toolkitDragObject.id),p=this.surface.viewport.$computeGroupContentExtents(this.toolkitDragObject,!1,null,null,u),g=p.xmax+u.internalOffset.x,m=p.ymax+u.internalOffset.y;this.currentMinimumWidth=Math.max(this.minimumWidth,g),this.currentMinimumHeight=Math.max(this.minimumHeight,m)}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight}}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight;if(this.grid&&!this.ignoreGrid){let h=he({x:this.currentMinimumWidth,y:this.currentMinimumHeight},this.grid);this.currentMinimumWidth=h.x,this.currentMinimumHeight=h.y}if(this.handler=Object.assign({},t[this.an]),this.Jh!=null){let h=this.Jh(this.surface,this.toolkitDragObject,this.an,this.handler.resize);h!=null&&(this.handler.resize=h)}L(this.Ks,dx),this.surface.$addClassToElement(document.body,mt),this.surface.on(document,ae,n),this.surface.on(document,le,o)}Km(){if(this.wr==null)return 0;{let t=(this.wr.r==null?0:this.wr.r)%360;return t<0&&(t+=360),2*Math.PI/360*t}}Tb(e,t){let n={x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2},o=this.Km();return t?Cx(e.x,e.y,o,n):Px(e.x,e.y,o,n)}Sb(e){let t=this.surface.viewport.getElementBounds(e.id),n=this.vb();return{x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}reset(){for(let e in this.skeletons){let t=this.skeletons[e];t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}}$minWidth(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumWidth,this.grid.width):this.currentMinimumWidth}$minHeight(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumHeight,this.grid.height):this.currentMinimumHeight}Qs(e){let t=this.skeletons[e];t&&t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}Wn(e){this.Qs(e.id)}qh(e){let t=this.surface.$getManagedElement(e.id);if(t!=null){if(this.Wn(e),Y(t.modelObject)&&t.collapsed||Tn(t.modelObject).find(l=>this.surface.viewport.getGroupElement(l.id).collapsed===!0))return;let o=t.el.getAttribute(bx)!==ct&&this.resizeX!==!1,s=t.el.getAttribute(Ax)!==ct&&this.resizeY!==!1;if(t.el.getAttribute(Sx)===ct||!o&&!s)return;this.Qh(t,e,o,s)}}Qh(e,t,n,o){let s=e,a=this.resizeMethod==sc?[NO]:[IO];this.bordersVisible&&a.push(MO);let l=Ge(Q,a,null,{transform:`translate(${e.x}, ${e.y})`,[te]:e.id});this.surface.$appendElementToToolsLayer(l);let h=Ge(Z,[VO],l,{x:-this.$handleOffset,y:-this.$handleOffset,width:e.width+2*this.$handleOffset,height:e.height+2*this.$handleOffset}),d=parseInt(window.getComputedStyle(e.el).strokeWidth,10),u=this.canResizeFilter?this.canResizeFilter(e.modelObject,e.el):n||o,p=e.el.getAttribute(Tx)===ct?!1:this.canRotateFilter?this.canRotateFilter(e.modelObject,e.el):this.Ym,g=this.skeletons[t.id]={mel:e,el:l,canResizeX:n,canResizeY:o,handles:null,borders:null,rh:null,rl:null,rotatable:p,resizable:u,frame:h};if(this.resizeMethod===sc){if(p){g.rl=Ge(q,[gm],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.ln+this.$handleOffset}`,"stroke-width":2}),g.rh=V(Q,{transform:`translate(${s.width/2-this.Ce/2}, ${-this.ln-this.$handleOffset-this.Ce/2})`}),l.appendChild(g.rh),Ge(Fe,[ac],g.rh,{[te]:t.id,cx:this.Ce/2,cy:this.Ce/2,r:this.Ce/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"});let m=V(et,{x:`${this.Ce/2}`,y:`${this.Ce/2}`,"font-size":Math.floor(this.Ce*.75)});m.innerHTML="\u21BA",g.rh.appendChild(m)}u&&(g.handles=this.Kh==="rectangle"?UO(this.Tt,s,t,d,l,this.$handleOffset,n,o):YO(this.Tt,s,t,d,l,this.$handleOffset,n,o))}else p&&(g.rl=Ge(q,[gm],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.ln+this.$handleOffset}`,"stroke-width":2}),g.rh=V(Q,{transform:`translate(${s.width/2-this.Ce/2}, ${-this.ln-this.$handleOffset-this.Ce/2})`}),l.appendChild(g.rh),Ge(Fe,[ac],g.rh,{[te]:t.id,cx:this.Ce/2,cy:this.Ce/2,r:this.Ce/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"})),g.borders={t:null,b:null,l:null,r:null},u&&(o&&(g.borders.t=Ge(Z,[Ss,$O],l,{[ja]:"t",[te]:t.id,width:s.width,height:this.dt,x:0,y:-this.dt/2}),g.borders.b=Ge(Z,[Ss,GO],l,{[ja]:"b",[te]:t.id,width:s.width,height:this.dt,x:0,y:s.height-this.dt/2})),n&&(g.borders.r=Ge(Z,[Ss,FO],l,{[ja]:"r",[te]:t.id,width:this.dt,height:s.height,x:s.width-this.dt/2,y:0}),g.borders.l=Ge(Z,[Ss,BO],l,{[ja]:"l",[te]:t.id,width:this.dt,height:s.height,x:-(this.dt/2),y:0})));return vx(l,e),l}$_setSkeletonPositionById(e){if(this.skeletons[e]){let t=this.surface.$getManagedElement(e);return vx(this.skeletons[e].el,t),this.skeletons[e].rh&&this.skeletons[e].rh.setAttribute("transform",`translate(${t.width/2-this.Ce/2}, ${-this.ln-this.$handleOffset-this.Ce/2})`),this.skeletons[e].rl&&this.skeletons[e].rl.setAttribute("d",`M ${t.width/2}, ${-this.$handleOffset} L ${t.width/2}, -${this.ln+this.$handleOffset}`),!0}return!1}Cb(e,t,n,o){let s={},a=this.xAxis&&this.resizeX,l=this.yAxis&&this.resizeY;return s[this.widthAtt]=a?n:this.$x2-this.$x1,s[this.heightAtt]=l?o:this.$y2-this.$y1,s[this.leftAtt]=a?e:this.$x1,s[this.topAtt]=l?t:this.$y1,s[this.widthAtt]<0&&(s[this.widthAtt]=this.$minWidth()),s[this.heightAtt]<0&&(s[this.heightAtt]=this.$minHeight()),s}xb(e){let t=e.x-this.kh.x,n=e.y-this.kh.y,o=90+Math.atan2(n,t)*180/Math.PI;if(this.Hh!=null){let s=360/this.Hh;o=Math.floor(o/s)*s}this.instance.$_updateVertex(this.toolkitDragObject,{[this.surface.$modelRotationAttribute]:o},ta,!1),this.Rr=o}Ab(e){let t,n,o=this.Tb(e);if(t=o.x-this.jh.x,n=o.y-this.jh.y,this.grid&&!this.ignoreGrid&&(t=(t<0?Math.ceil(t/this.grid.width):Math.floor(t/this.grid.width))*this.grid.width,n=(n<0?Math.ceil(n/this.grid.height):Math.floor(n/this.grid.height))*this.grid.height),(this.resizeY===!1||this.yAxis===!1||this.an==="l"||this.an==="r")&&(n=0),(this.resizeX===!1||this.xAxis===!1||this.an==="t"||this.an==="b")&&(t=0),this.qs||t!=0||n!=0){this.qs=!0;let{x:s,y:a,width:l,height:h,updates:d}=this.handler.resize(t,n);this.ct!=null&&(this.he!=null?this.he.setFocusPosition({x:s,y:a},!0,null,{width:l,height:h}):(a<0&&(h+=a,a=0),s<0&&(l+=s,s=0),this.po.constrain&&(s+l>this.Lr.width&&(l=this.Lr.width-s),a+h>this.Lr.height&&(h=this.Lr.height-a)))),this.qm(l,h);let u={x:this.$x1+this.handler.anchor[0]*this.zh,y:this.$y1+this.handler.anchor[1]*this.Yh},p=Cx(u.x,u.y,this.Rr,this.zm),g={x:s+l/2,y:a+h/2},m={x:s+this.handler.anchor[0]*l,y:a+this.handler.anchor[1]*h},E=Cx(m.x,m.y,this.Rr,g),y=E.x-p.x,x=E.y-p.y,f={x:g.x-y,y:g.y-x},b=Px(p.x,p.y,this.Rr,f);this.uo={x:b.x-this.handler.anchor[0]*l,y:b.y-this.handler.anchor[1]*h},this.Xh={width:l,height:h};let A=this.Cb(this.uo.x,this.uo.y,l,h),T=this.km(this.toolkitDragObject,A)||{},S=Object.assign(T,A),O;if(this.Zh!=null&&(O=this.Zh(this.toolkitDragObject,this.uo,this.Xh)),this.instance.$_updateVertex(this.toolkitDragObject,S,Xl,!1),d!=null)for(let v in d)this.instance.$_updateVertex(v,d[v],Xl,!1);if(O!=null)for(let v in O)this.instance.$_updateVertex(v,O[v],Xl,!1)}}vb(){return this.ct==null?{x:0,y:0}:{x:this.Lr.x+this.Js.internalOffset.x,y:this.Lr.y+this.Js.internalOffset.y}}$vertexRerendered(e){this.skeletons[e.id]!=null&&(this.Qs(e.id),setTimeout(()=>{this.qh(e.vertex)}))}$vertexRotated(e,t){this.skeletons[e.id]&&this.$_setSkeletonPositionById(e.id)}$vertexUpdated(e,t){!this.$busy&&t==Xl&&this.skeletons[e.id]!=null&&(this.Qs(e.id),setTimeout(()=>{this.qh(e.modelObject)}))}qm(e,t,n){n=n||this.toolkitDragObject.id;let o=this.skeletons[n];o&&(ie(o.frame,{width:e+2*this.$handleOffset,height:t+2*this.$handleOffset}),this.resizeMethod===sc?this.Kh==="rectangle"?(o.handles.tr&&ie(o.handles.tr,{x:e+this.$handleOffset}),o.handles.bl&&ie(o.handles.bl,{y:t+this.$handleOffset}),o.handles.br&&ie(o.handles.br,{x:e+this.$handleOffset,y:t+this.$handleOffset}),o.handles.t&&ie(o.handles.t,{x:e/2}),o.handles.b&&ie(o.handles.b,{x:e/2,y:t+this.$handleOffset}),o.handles.l&&ie(o.handles.l,{y:t/2}),o.handles.r&&ie(o.handles.r,{x:e+this.$handleOffset,y:t/2})):(o.handles.tr&&ie(o.handles.tr,{cx:e+this.$handleOffset}),o.handles.bl&&ie(o.handles.bl,{cy:t+this.$handleOffset}),o.handles.br&&ie(o.handles.br,{cx:e+this.$handleOffset,cy:t+this.$handleOffset}),o.handles.t&&ie(o.handles.t,{cx:e/2}),o.handles.b&&ie(o.handles.b,{cx:e/2,cy:t+this.$handleOffset}),o.handles.l&&ie(o.handles.l,{cy:t/2}),o.handles.r&&ie(o.handles.r,{cx:e+this.$handleOffset,cy:t/2})):(o.borders.t&&ie(o.borders.t,{width:e}),o.borders.b&&ie(o.borders.b,{width:e,y:t-this.dt/2}),o.borders.r&&ie(o.borders.r,{height:t,x:e-this.dt/2}),o.borders.l&&ie(o.borders.l,{height:t})))}$vertexSynced(e){this.$_setSkeletonPositionById(e.id)}$groupResized(e){this.$_setSkeletonPositionById(e.element.id),this.qm(e.newGroupSize.width,e.newGroupSize.height,e.element.id)}$groupCollapsed(e){this.Wn(e.modelObject),Object.values(this.skeletons).slice().forEach(n=>{We(n.mel.modelObject,e.modelObject)&&this.Qs(n.mel.id)})}};c(Ts,"type","resizingTools"),Ts=Ye([He("resizingTools")],Ts);var mm="lineCrossings",jO="vjs-bridge",HO="vjs-bridge-vertical",kO="vjs-bridge-horizontal",WO="vjs-bridge-dot",ZO="vjs-bridge-arch",G2e="vjs-bridge-gap";function JO(i,r){let e=i.strokeWidth.other,t=i.stroke.other,n=e*5,o=r==="h"?i.point.x-n/2:i.point.x,s=r==="h"?i.point.x+n/2:i.point.x,a=r==="v"?i.point.y-n/2:i.point.y,l=r==="v"?i.point.y+n/2:i.point.y,h=V(q,{d:`M ${o} ${a} L ${s} ${l}`,stroke:"#000000","stroke-width":i.strokeWidth.ref+2}),d=V(q);d.setAttribute(LC,"none"),d.setAttribute("stroke-width",e),d.setAttribute("stroke",t),d.setAttribute("stroke-linecap","round"),d.classList.add(ZO);let u=r==="h"?`M ${o} ${a} A ${n/2} ${n/2} 0 0 1 ${s} ${l}`:`M ${o} ${a} A ${n/2} ${n/2} 0 0 0 ${s} ${l} `;return d.setAttribute("d",u),[[d],n,[h]]}function KO(i,r,e,t){let n=e*2,o=V(Fe);return t=t||i.stroke.ref,o.setAttribute("fill",t),o.setAttribute("stroke","none"),o.setAttribute("cx",`${i.point.x}`),o.setAttribute("cy",`${i.point.y}`),o.setAttribute("r",`${e}`),o.classList.add(WO),[[o],n,[]]}function qO(i,r){let e=i.strokeWidth.other*5,t=r==="h"?i.point.x-e/2:i.point.x,n=r==="h"?i.point.x+e/2:i.point.x,o=r==="v"?i.point.y-e/2:i.point.y,s=r==="v"?i.point.y+e/2:i.point.y,a=V(q,{d:`M ${t} ${o} L ${n} ${s}`,stroke:"#000000","stroke-width":i.strokeWidth.ref+2});return[[],e,[a]]}var Em=class extends Se{constructor(){super(...arguments);c(this,"Zn");c(this,"H");c(this,"Qm");c(this,"eg");c(this,"ec");c(this,"tg");c(this,"Pb");c(this,"ea",new Map);c(this,"ta");c(this,"rg");c(this,"tracksEdgeRedraws",!0);c(this,"Ke",new Map);c(this,"tc",new Map)}initialise(e,t){return this.rg=_o(),this.Zn=e,this.H=t.orientation||"h",this.Qm=this.H==="h"?"v":"h",this.ta=t.bridgeType||"arch",this.ec=t.dotRadius||5,this.tg=t.dotColor,this.Pb=t.onTap,this.eg=this.H==="h"?kO:HO,e.bind(Br,()=>{this.Ob()}),!0}$edgeRedraw(e){this.Zn.$_dataLoading||requestAnimationFrame(()=>{this.Ke.get(e.edge.id)!=null&&(this.ng(e.edge),this.ra(e.edge.id),this.ig(e.edge,!0))})}_b(e){let t=this.Zn.getRenderedConnection(e);if(t!=null)if(t.connector.type===Hi||t.connector.type===jr&&t.connector.constrain==="orthogonal"){let n=t.connector.internalSegments.map((d,u)=>({o:d.o,index:u,line:[{x:d.x1,y:d.y1},{x:d.x2,y:d.y2}],strokeWidth:t.paintStyle.strokeWidth||2})),o=t.connector.canvas,s=o.querySelector(".vjs-connector-path"),a=window.getComputedStyle(s),l=a.stroke,h=parseInt(a.strokeWidth,10);return{segments:n,connection:t,connector:t.connector,intersectingPoints:[],stroke:l,strokeWidth:h,canvasElement:o,pathElement:s,id:e}}else U(`WARN: unsupported connector type ${t.connector.type} in LineCrossingsPlugin`)}Rb(){this.ea.clear(),this.Zn.model.getAllEdges().forEach(t=>{this.ra(t.id)})}ra(e){let t=this._b(e);return t!=null?(this.ea.set(e,t),t):null}na(e){let t=this.ea.get(e);return t!=null?t:this.ra(e)}Lb(e){return e.filter(t=>t.o===this.H)}wb(e){return e.filter(t=>t.o===this.Qm)}Db(e){switch(this.ta){case"dot":return this.ec;case"arch":case"gap":return e.strokeWidth.other*5;default:return 0}}ng(e){this.Nb(this.Ke.get(e.id)||[]);let t=this.na(e.id);t!=null&&this.og(t,e.id)}Nb(e){e.forEach(t=>{t.canvasElements.forEach(s=>{s.parentElement&&s.parentElement.removeChild(s)}),t.masks.forEach(s=>{s.parentElement&&s.parentElement.removeChild(s)});let n=this.Ke.get(t.edge.id)||[],o=this.Ke.get(t.otherEdge.id)||[];this.Ke.set(t.edge.id,n.filter(s=>s.id!==t.id)),this.Ke.set(t.otherEdge.id,o.filter(s=>s.id!==t.id)),this.tc.delete(t.id)})}ig(e,t){var o;let n=this.na(e.id);if(n!=null){let s=this.Zn.viewport.findConnectorBoundsIntersectingWithRect(n.connector,0,!1,[],!0).filter(h=>h.id!==n.id),a=(h,d)=>{let u=this.Lb(h.segments),p=[];for(let g=0;g<d.length;g++)if(d[g].id!==h.id){let m=t?this.ra(d[g].id):this.na(d[g].id),E=this.wb(m.segments);for(let y=0;y<u.length;y++)for(let x=0;x<E.length;x++){let f=xl(u[y].line,E[x].line);if(f!=null){let b=this.Db({strokeWidth:{other:m.strokeWidth}}),A=Pe(f,u[y].line[0]),T=Pe(f,u[y].line[1]),S=!1;if(A<b){let O=h.segments[u[y].index-1];(O==null||O.o!==u[y].o)&&(S=!0)}if(!S&&T<b){let O=h.segments[u[y].index+1];(O==null||O.o!==u[y].o)&&(S=!0)}if(!S){let O=Pe(f,E[x].line[0]),v=Pe(f,E[x].line[1]);if(O<b){let _=m.segments[E[x].index-1];(_==null||_.o!==E[x].o)&&(S=!0)}if(!S&&v<b){let _=m.segments[E[x].index+1];(_==null||_.o!==E[x].o)&&(S=!0)}}if(S)continue;p.push({index:u[y].index,point:f,o:{ref:u[y].o,other:E[x].o},strokeWidth:{ref:h.strokeWidth,other:m.strokeWidth},stroke:{ref:h.stroke,other:m.stroke},refConnector:h,otherConnector:m})}}}p.forEach(g=>{let m=this.Ib(g,h.connection.edge,h,g.otherConnector);this.Ke.get(h.connection.edge.id).push(m),this.Ke.get(g.otherConnector.connection.edge.id).push(m),this.tc.set(m.id,m)})};if(a(n,s),t)for(let h=0;h<s.length;h++){let d=this.na(s[h].id),u=s.slice();u.splice(h,1,n),a(d,u)}((o=this.Ke.get(e.id))==null?void 0:o.length)>0||this.og(n,e.id)}}Ob(){this.Rb();let e=this.Zn.model.getAllEdges();for(let t=0;t<e.length;t++)this.ig(e[t],!1)}Ib(e,t,n,o){let[s,a,l]=this.ta==="dot"?KO(e,this.H,this.ec,this.tg):this.ta==="arch"?JO(e,this.H):qO(e,this.H);if(s.forEach(h=>{h.classList.add(this.eg),h.classList.add(jO),h.classList.add(lp),h.setAttribute("transform",`translate(${-n.connector.x}, ${-n.connector.y})`),h.setAttribute("data-vjs-edge",n.connection.edge.id),h.setAttribute("data-vjs-other-edge",o.connection.edge.id),h.setAttribute("data-x",e.point.x),h.setAttribute("data-y",e.point.y),h.setAttribute("x",`${e.point.x-a/2}`),h.setAttribute("y",`${e.point.y-a/2}`),n.canvasElement.appendChild(h)}),l!=null&&l.length>0){let h=this.Vb(n,t.id),d=h.getAttribute("id");n.pathElement.setAttribute("mask",`url(#${d})`),l.forEach(u=>h.appendChild(u))}return{canvasElements:s,bgSize:a,masks:l,edge:t,otherEdge:o.connection.edge,id:$()}}destroy(){this.ea.clear(),this.tc.clear(),this.Ke.clear()}reset(){}Mb(e){return`vjs-lcp-${this.rg}-${e}`.replace(/\s/g,"_")}Vb(e,t){let n=e.connector.bounds.xmin,o=e.connector.bounds.ymin,s=e.connector.bounds.xmax-n,a=e.connector.bounds.ymax-o,l=50,h=e.canvasElement.querySelector("defs");h==null&&(h=V("defs"),e.canvasElement.appendChild(h));let d=h.querySelector("mask[data-type='vjs-lcp']");if(d==null){let p=this.Mb(t);d=V("mask",{id:p,"data-type":"vjs-lcp","data-vjs-edge-id":t,maskContentUnits:"userSpaceOnUse",maskUnits:"userSpaceOnUse",x:n-l,y:o-l,width:s+2*l,height:a+2*l}),h.appendChild(d)}else ie(d,{x:n-l,y:o-l,width:s+2*l,height:a+2*l});let u=d.querySelector("[vjs-lcp-white-mask]");return u==null?(u=V("rect",{x:n-l,y:o-l,width:s+2*l,height:a+2*l,fill:"#FFFFFF","vjs-lcp-white-mask":"true"}),d.appendChild(u)):ie(u,{x:n-l,y:o-l,width:s+2*l,height:a+2*l}),d}og(e,t){let n=e.canvasElement.querySelector("mask[data-type='vjs-lcp']");n&&(e.pathElement.removeAttribute("mask"),n.parentElement&&n.parentElement.removeChild(n))}$edgeRemoved(e){this.ng(e),this.Ke.delete(e.id)}$edgeRendered(e){this.Ke.set(e.edge.id,[])}};Em=Ye([He(mm)],Em);var QO=(n=>(n.STOPPED="stopped",n.FINISHED="finished",n.PAUSED="paused",n.PLAYING="playing",n))(QO||{}),ym="state",fm=class extends zt{constructor(e,t){super();this.components=e;this.params=t;c(this,"state");c(this,"currentlyAnimatingConnection");this.state=t.paused===Pt?"paused":"playing"}setState(e){this.state=e,this.fire(ym,e)}pause(){this.state!=="paused"&&(this.currentlyAnimatingConnection?(this.currentlyAnimatingConnection.pause(),this.setState("paused")):this.setState("stopped"))}play(){this.state!=="playing"&&(this.currentlyAnimatingConnection?this.currentlyAnimatingConnection.play():this.components[0].handler.play(),this.setState("playing"))}cancel(){this.state!=="stopped"&&(this.currentlyAnimatingConnection&&this.currentlyAnimatingConnection.cancel(),this.params.cleanup(),this.setState("stopped"))}};var lc="startOverlayAnimation",mo="endOverlayAnimation",_x="startNodeTraversal",eR="endNodeTraversal",Ox="vjs-animate-source",Rx="vjs-animate-target",Zn="vjs-animate-node-traversing",hc="vjs-animate-edge-traversing",NFe="vjs-animate-node-traversable",xm="vjs-animate-edge-traversable",IFe="vjs-animate-node-traversed",Lx="vjs-animate-edge-traversed";var tR="INITIALIZED",wx="TRAVERSING_START",rR="TRAVERSING_EDGE",Dx="TRAVERSING_END",Ha="CANCELLED",ka="FINISHED";function nR(i,r,e,t){let n=new zt,o=r.connector.totalLength;t=t||{};let s=$(),a=t.events||{};for(let G in a)n.bind(G,a[G]);let l=null,h=t.forwards!==!1,d=t.rate||30,u=t.dwell||350,p=t.speed||100,g=o/p*1e3,m=g/d,E=1/m*(h?1:-1),y=t.isFinal!==!1,x=h?0:1,f=x,b,A,T=()=>h?f>=1:f<=0,S=h?r.sourceElement:r.targetElement,O=h?r.targetElement:r.sourceElement,v,_=t.paused===!0,P=!1,I=!1,C=tR;typeof e=="string"?v={type:e,options:{location:x,id:s}}:(v={type:e.type,options:Object.assign({},e.options)},v.options.location=x,v.options.id=s);let R=G=>{I=!1,rs(r,s),window.clearInterval(b),y?G?(C=Ha,i.surface.removeClass(S,Zn),i.surface.removeClass(O,Zn),_r(r,hc)):(C=Dx,i.surface.addClass(O,Zn),window.setTimeout(function(){M()},u)):(i.surface.removeClass(S,Zn),i.surface.removeClass(O,Zn),_r(r,hc),G?C=Ha:(C=ka,Zr(r,Lx),n.fire(mo,{connection:r,harness:l})))},w=()=>{f+=E,T()?R(!1):(A.location=f,r.instance.$repaintUIElementById(r.sourceId))},B=()=>{C=rR,n.fire(lc,{connection:r,harness:l}),A=ph(r,v),b=window.setInterval(w,d)},N=()=>{!I&&C!==ka&&C!==Ha&&(i.surface.removeClass(S,Zn),n.fire(eR,{connection:r,element:S,harness:l}),B())},M=()=>{!I&&C!==ka&&C!==Ha&&(C=ka,i.surface.removeClass(S,Zn),i.surface.removeClass(O,Zn),_r(r,hc),n.fire(mo,{connection:r,harness:l}))},D=()=>{P=!0,I=!1,n.fire(_x,{connection:r,element:S,harness:l}),i.surface.addClass(S,Zn),Zr(r,hc),C=wx,window.setTimeout(()=>{N()},u)};return l={eventGenerator:n,play:()=>{P?I&&(I=!1,C===wx?N():C===Dx?M():b=window.setInterval(w,d)):D()},pause:()=>{I=!0,window.clearInterval(b)},cancel:()=>{C!==ka&&C!==Ha&&(window.clearInterval(b),R(!0))},connection:r},t.previous?t.previous.eventGenerator.bind(mo,D):_||D(),l}var bm=class extends zt{constructor(e){super();this.surface=e}animateToPosition(e,t,n,o){let s=this.surface.getObjectInfo(e,!1);if(s){o=o||{},o.start=Zd(o.start,()=>{this.surface.model.openTransaction(ut)}),o.step=Zd(o.step,()=>{}),o.complete=Zd(o.complete,()=>{this.surface.model.commitTransaction()}),o.start();let a=s.el.getBoundingClientRect(),l=t-a.x,h=n-a.y,d=o.duration||250,u=15,p=d/u,g=u/d*l,m=u/d*h,E=0,y=window.setInterval(()=>{this.surface.setPosition(s.obj,a.x+g*(E+1),a.y+m*(E+1)),o.step(E,Math.ceil(p)),E++,E>=p&&(window.clearInterval(y),o.complete())},u)}}traceEdge(e){let t=j(e.edge)?this.surface.model.getEdge(e.edge):e.edge,n=this.surface.$_connMap[t.id];Zr(n,xm),nR(this,n,e.overlay,Object.assign(e.options||{},{isFinal:!0,forwards:!0,events:{[mo]:()=>e.complete&&e.complete(),[lc]:()=>e.start&&e.start()}}))}tracePath(e){let t=e.path||this.surface.model.getPath({source:e.source,target:e.target});if(t.exists()){let n=(g,m)=>{this.fire(g,{edge:m.edge,connection:m,options:e.options})},o=[],s=null,a=null,l=t.result.path.length,h,d=this.surface.getRenderedElement(t.result.path[0].vertex),u=this.surface.getRenderedElement(t.result.path[t.result.path.length-1].vertex);this.surface.addClass(d,Ox),this.surface.addClass(u,Rx),t.eachEdge((g,m)=>{Zr(this.surface.$_connMap[m.id],xm)});for(let g=1;g<l;g++){let m=t.result.path[g].vertex.id,E=t.result.previous[m],y=!0,x=t.result.path[g].edge;E!=null&&(y=E===x.source),s=this.surface.$_connMap[x.id],a=nR(this,s,e.overlay,Object.assign(e.options||{},{previous:a,isFinal:g===l-1,forwards:y,paused:!0,events:{[_x]:f=>{h.currentlyAnimatingConnection=f.harness},[mo]:f=>{h.currentlyAnimatingConnection=null}}})),o.push({handler:a,connection:s})}let p=()=>{t.eachEdge((g,m)=>{let E=this.surface.$_connMap[m.id];_r(E,[Lx,xm].join(" "))}),this.surface.removeClass(d,Ox),this.surface.removeClass(u,Rx),n(mo,o[o.length-1].connection),h.setState("stopped"),h&&h.setState("finished")};return o.length>0?(o[0].handler.eventGenerator.bind(lc,()=>{n(lc,o[0].connection)}),o[o.length-1].handler.eventGenerator.bind(mo,p),h=new fm(o,{paused:e.paused,cleanup:p}),e.paused!==!0&&o[0].handler.play(),e.listener&&(h.bind(ym,e.listener),h.fire(ym,h.state)),h):null}else return U("Cannot trace non existent path"),null}};var Am="vjs-shape-library-palette-set",Nx="vjs-shape-library-palette",cc="vjs-shape-library-palette-filter",dc="vjs-shape-library-palette-shape",Ix="vjs-shape-library-palette-label",iR="vjs-shape-library-palette-set-title",Mx="vjs-shape-library-palette-set-shapes",oR="vjs-shape-library-palette-lasso";var YM=150,zM=100,XM="data-visible",Si="data-category",Sm="data-shape-id",Vx="data-show-all",Gx="data-vjs-type",jM="shape-icon",sR="mainTemplate",aR="preparedTemplate",$x="setTemplate",vs="__vjsALL";function HM(i="Show all"){return{[$x]:`<div class="${Am}" data-category="{{id}}">
103
+ <div class="${iR}" data-category="{{id}}">{{name}}</div>
104
+ <div class="${Mx}" data-category="{{id}}">
105
105
  <r-each in="shapes"><shape-icon/></r-each>
106
106
  </div>
107
107
  <r-if test="children.length > 0">
108
- <select class="${ac}" data-category="{{id}}" data-show-all="true">
109
- <option value="${bs}">${i}</option>
108
+ <select class="${cc}" data-category="{{id}}" data-show-all="true">
109
+ <option value="${vs}">${i}</option>
110
110
  <r-each in="children">
111
111
  <option value="{{id}}">{{name}}</option>
112
112
  </r-each>
113
113
  </select>
114
114
  <r-each in="children">
115
- <r-tmpl id="${Ix}"/>
115
+ <r-tmpl id="${$x}"/>
116
116
  </r-each>
117
117
  </r-if>
118
- </div>`,[Z_]:`<div class="${Rx}">
119
- <div class="${wx}">
118
+ </div>`,[aR]:`<div class="${Nx}">
119
+ <div class="${Mx}">
120
120
  <r-each in="shapes"><shape-icon/></r-each>
121
121
  </div>
122
- </div>`,[W_]:`<div class="${Rx}" data-show-all="{{showAll}}">
122
+ </div>`,[sR]:`<div class="${Nx}" data-show-all="{{showAll}}">
123
123
  <r-if test="sets.length > 1">
124
- <select class="${ac}" data-category="${lo}" data-show-all="{{showAll}}">
125
- <option value="${bs}">${i}</option>
124
+ <select class="${cc}" data-category="${ho}" data-show-all="{{showAll}}">
125
+ <option value="${vs}">${i}</option>
126
126
  <r-each in="sets">
127
127
  <option value="{{id}}">{{name}}</option>
128
128
  </r-each>
129
129
  </select>
130
130
  </r-if>
131
131
  <r-each in="sets">
132
- <r-tmpl id="${Ix}"/>
132
+ <r-tmpl id="${$x}"/>
133
133
  </r-each>
134
- </div>`}}var MM=1.25,fg=class{constructor(r,e){this.ui=r;c(this,"Wn");c(this,"hb");c(this,"kh");c(this,"$preparedShapes");c(this,"onVertexAdded");c(this,"palette");c(this,"$shapeLibrary");if(this.$shapeLibrary=r.getShapeLibrary()||e.shapeLibrary,this.$shapeLibrary==null){U("WARN: no ShapeLibrary set : ShapePalette cannot initialize.");return}let t=e.container,n=e.paletteStrokeWidth||MM,o=e.iconSize||{width:LM,height:wM};this.onVertexAdded=e.onVertexAdded,this.kh=e.dataGenerator,e.dragSize=e.dragSize||Object.assign({},o);let s=e.fill||am.FILL,a=e.outline||am.STROKE,l=e.outlineWidth||am.STROKE_WIDTH;this.Wn=Ar({templates:IM(e.showAllMessage)});let h=`<div class="${lc}" data-vjs-type="{{type}}"><svg:svg viewBox="0 0 ${o.width} ${o.height}" stroke-width="${n}"/>`+(e.showLabels?`<div class="${Lx}">{{label}}</div>`:"")+"</div>";this.Wn.registerTag(NM,{template:h,rendered:(p,m,g,E)=>{var T,S,R;let y=m.type,x=null,f=E.getAttribute(Si)||m.category;f!=null&&p.setAttribute(Si,f);let b=m.shapeId;b!=null&&(p.setAttribute(Eg,b),x=(T=this.$preparedShapes)==null?void 0:T.find(v=>v.shapeId===b)),p.setAttribute("title",m.label||""),m.objectType===oe.objectType&&p.setAttribute(gh,Pt);let A=this.$shapeLibrary.getShapeDefinition(y,f);if(A!=null){A.members&&A.objectType===oe.objectType&&p.setAttribute("data-vjs-group-template",`${f}:${y}`);let v=A.previewData||{},O=((S=A.initialSize)==null?void 0:S.width)||o.width,P=((R=A.initialSize)==null?void 0:R.height)||o.height,I=p.querySelector("svg");if(I.setAttribute("viewBox",`0 0 ${O} ${P}`),A.icon){let C=this.Wn.parse(A.icon),_=this.Wn.render(C,v).fragment;I.appendChild(_)}else{let C=Bc(tn({},v),{type:y,category:f,width:O,height:P}),_=this.$shapeLibrary.renderCompiledShape(C,n);if(this.$shapeLibrary.$getShapeDefinitionForObject(C).square){let N=Math.min(O,P),M=(O-N)/2,D=(P-N)/2;_.setAttribute("transform",`translate(${M}, ${D})`)}I.appendChild(_);let $={fill:s,stroke:a,"stroke-width":n};if(x!=null){let N=x.properties||{};for(let M in N){let D=M===Gh?"stroke":M===$h?"stroke-width":M;I.setAttribute(D,N[M]),delete $[D]}}for(let N in $)I.setAttribute(N,$[N])}}},updated:(p,m,g)=>{}});let d;if(e.preparedShapes!=null){let p=e.preparedShapes.map(m=>Object.assign({},this.$shapeLibrary.getShapeDefinition(m.type,m.category),{shapeId:m.shapeId,properties:m.properties,category:m.category,label:m.label,size:m.size}));this.$preparedShapes=p,d=this.Wn.template(Z_,{shapes:p})}else d=this.Wn.template(W_,{sets:this.$shapeLibrary.rootSet.children,showAll:e.initialSet==null});if(this.palette=d.childNodes[0],t.appendChild(this.palette),this.hb=new Ya(r,{source:this.palette,selector:z(lc),dragSize:e.dragSize,dragSizeGenerator:(p,m)=>p&&p.width&&p.height?{width:p.width,height:p.height}:e.dragSize,canDrop:e.canDrop,mode:e.mode,allowClickToAdd:e.allowClickToAdd,lassoClass:k_,elementGenerator:(p,m)=>{let g=p.cloneNode(!0),E=g.querySelector(z(Lx));return E&&E.parentNode.removeChild(E),g},vertexPreviewGenerator:(p,m,g,E,y)=>{let x=Object.assign(g,{[r.$modelWidthAttribute]:5,[r.$modelHeightAttribute]:5,outlineWidth:g.outlineWidth||1}),f=G(Le,{preserveAspectRatio:"none",viewBox:"0 0 5 5"});f.classList.add(Mh);let b=this.$shapeLibrary.renderCompiledShape(x);return f.appendChild(b),f},vertexPreviewUpdater:(p,m,g,E)=>{let y=this.$shapeLibrary.renderCompiledShape(Object.assign(E,{[r.$modelWidthAttribute]:g.width,[r.$modelHeightAttribute]:g.height}));p.replaceChildren(y),p.setAttribute("viewBox",`0 0 ${g.width} ${g.height}`)},dataGenerator:p=>{var C,_,w,$,N;let m=this.kh?this.kh(p)||{}:{},g=p.getAttribute(Nx),E=p.getAttribute(Si),y=p.getAttribute(Eg),x=this.$shapeLibrary.getShapeDefinition(g,E),f=m.fill,b=m.outline,A=m.outlineWidth,T=m.color,S=(C=this.$preparedShapes)==null?void 0:C.find(M=>M.shapeId===y),R=(S==null?void 0:S.properties)||{},v=(_=S==null?void 0:S.size)==null?void 0:_.width,O=(w=S==null?void 0:S.size)==null?void 0:w.height,P=v||m.width||(($=x.initialSize)==null?void 0:$.width)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.width),I=O||m.height||((N=x.initialSize)==null?void 0:N.height)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.height);return Object.assign(m,{type:g,category:E,width:P,height:I,fill:s,outline:a,outlineWidth:l},R),f!=null&&(m.fill=f),b!=null&&(m.outline=b),A!=null&&(m.outlineWidth=A),T!=null&&(m.color=T),x.payload&&Object.assign(m,x.payload),m},allowDropOnEdge:!1,allowDropOnNode:!1,onVertexAdded:p=>{e.selectAfterDrop!==!1&&setTimeout(()=>r.model.setSelection(p.vertex)),this.onVertexAdded&&this.onVertexAdded(p)}}),Array.from(this.palette.querySelectorAll(z(ac))).forEach(p=>{p.addEventListener("change",m=>{let g=p.options[p.selectedIndex].value,E=p.getAttribute(Si);p.setAttribute(Dx,`${g===bs}`),this.Xm(g,E)})}),e.inspector!==!1){r.model.bind(qt,g=>{m()}),r.model.bind(Qt,g=>{m()});let p=()=>{Array.from(this.palette.querySelectorAll(z(om))).forEach(E=>{F(E,om)})},m=()=>{p();let g=new Set;if(this.ui.model.getSelection().eachVertex((E,y)=>g.add(`${y.type}|${y.data.category||this.$shapeLibrary.defaultCategoryId}`)),g.size===1){let[E,y]=Array.from(g)[0].split("|");if(this.$shapeLibrary.getShapeDefinition(E,y)!=null){let f=this.palette.querySelector(`[${Si}='${y}'][${Nx}='${E}']`);f!=null&&L(f,om)}}};r.model.bind(ir,()=>{p()}),r.on(this.palette,W,z(lc),g=>{let E=g.target.closest(z(lc)),y=E.getAttribute(Si),x=E.getAttribute(Nx),b=this.$shapeLibrary.getShapeDefinition(x,y).objectType||he.objectType,A=this.jm();A.isEmpty()||r.model.transaction(()=>{A.eachVertex((T,S)=>{S.objectType===b&&r.model.updateVertex(S,{[this.$shapeLibrary.categoryParameter]:y,[this.$shapeLibrary.typeParameter]:x})})})}),r.model.bindAll([Re,Te],g=>{this.jm().containsVertex(g.vertex.id)&&m()})}e.initialSet!=null&&this.setCurrentSet(e.initialSet)}jm(){return this.ui.model.getSelection().filter(r=>K(r)||Y(r))}cb(r){return this.palette.querySelector(`${z(ac)}[${Si}='${r}']`)}Xm(r,e){let t=e==lo?this.palette:this.palette.querySelector(`${z(gg)}[${Si}='${e}']`);t.setAttribute(Dx,`${r==bs}`),Array.from(t.querySelectorAll(z(gg))).filter(o=>o.parentElement===t).forEach(o=>{o.setAttribute(DM,`${r===bs||r===o.getAttribute(Si)}`)})}Hm(r,e){this.Xm(r,e);let t=this.cb(e);t!=null&&(t.value=r,t.setAttribute(Dx,`${r===bs}`))}setCurrentSet(r){if(r!=null){let e=this.$shapeLibrary.getShapeSet(r);if(e!=null){let t=[[e.id,e.parent]],n=e.parent;for(;n!=null&&n!==lo;){let o=this.$shapeLibrary.getShapeSet(n);t.unshift([n,o.parent]),n=o.parent}t.forEach(o=>{this.Hm(o[0],o[1])})}}else this.Hm(bs,lo)}};var Mx="vjs-diagram-node",Vx="vjs-diagram-group",J_=100,K_=80,q_=[nO];var Jn=class{constructor(r,e){this.diagram=r;this.vertex=e;c(this,"el");c(this,"$destroyed",!1)}get id(){return this.vertex.getFullId()}get zIndex(){return this.vertex.data.z==null?0:this.vertex.data.z}update(r){this.diagram.model.updateVertex(this.vertex,r)}setSize(r){this.diagram.$ui.setSize(this.vertex,r.width,r.height)}setPosition(r){this.diagram.$ui.setPosition(this.vertex,r.x,r.y)}setLabel(r){this.diagram.model.updateVertex(this.vertex,{[this.diagram.labelAttribute]:r})}setFill(r){this.diagram.model.updateVertex(this.vertex,{[Vy]:r})}setOutline(r){this.diagram.model.updateVertex(this.vertex,{[Gh]:r})}setOutlineWidth(r){this.diagram.model.updateVertex(this.vertex,{[$h]:r})}setColor(r){this.diagram.model.updateVertex(this.vertex,{[Gy]:r})}get label(){return this.vertex.data[ao]}get fill(){return this.vertex.data[Vy]||Bh}get outline(){return this.vertex.data[Gh]||ss}get outlineWidth(){return this.vertex.data[$h]||Fh}get color(){return this.vertex.data[Gy]||rO}get size(){return{width:this.vertex.data[this.diagram.cellWidthAttribute],height:this.vertex.data[this.diagram.cellHeightAttribute]}}get width(){var r;return((r=this.size)==null?void 0:r.width)||0}get height(){var r;return((r=this.size)==null?void 0:r.height)||0}get position(){return{x:this.vertex.data[this.diagram.cellLeftAttribute],y:this.vertex.data[this.diagram.cellTopAttribute]}}remove(){this.diagram.removeCell(this)}destroy(){this.diagram=null,this.vertex=null,this.$destroyed=!0}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}};var Ti=class{constructor(r,e){this.diagram=r;this.edge=e;c(this,"$destroyed",!1)}get id(){return this.edge.id}get connection(){return this.diagram.$ui.getRenderedConnection(this.edge.id)}update(r){this.diagram.model.updateEdge(this.edge,r)}remove(){this.diagram.model.remove(this.edge)}setLabel(r){this.update({label:r})}get label(){return this.edge.data.label}setColor(r){this.update({color:r})}get color(){return this.edge.data.color}setLineWidth(r){this.update({lineWidth:r})}get lineWidth(){return this.edge.data.lineWidth}setOutlineColor(r){this.update({outlineColor:r})}get outlineColor(){return this.edge.data.outlineColor}setOutlineWidth(r){this.update({outlineWidth:r})}get outlineWidth(){return this.edge.data.outlineWidth}setDashArray(r){this.update({dashArray:r})}get dashArray(){return this.edge.data.dashArray}setLabelLocation(r){this.update({labelLocation:r})}get labelLocation(){return this.edge.data.labelLocation}setSource(r){this.diagram.model.setSource(this.edge,r instanceof Jn?r.id:r)}get source(){return this.edge.source}setTarget(r){this.diagram.model.setTarget(this.edge,r instanceof Jn?r.id:r)}get target(){return this.edge.target}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}destroy(){this.diagram=null,this.edge=null,this.$destroyed=!0}};function Q_(){return{dragOnGrid:!0,showGrid:!0,showBorder:!1,autoShrink:!0,minWidth:1e4,maxWidth:null,minHeight:1e4,maxHeight:null,showTickMarks:!1,type:Ma.type}}var VM=15,Gx="vjs-cell-tool",eR="vjs-clone-cell",tR="vjs-delete-cell",GM="vjs-link-cell",As=class extends xs{constructor(){super(...arguments);c(this,"id","diagramTools");c(this,"$buttonSize");c(this,"$allowClone");c(this,"$allowDelete");c(this,"$allowLink");c(this,"$canShowLinkButton");c(this,"$canDelete");c(this,"$canClone");c(this,"$shouldDeleteGroupMembers");c(this,"$buttonY")}initialise(e,t){return super.initialise(e,t),this.$buttonSize=t.buttonSize||VM,this.$allowClone=t.allowClone!==!1,this.$allowDelete=t.allowDelete!==!1,this.$allowLink=t.allowLink!==!1,this.$canShowLinkButton=t.canShowLinkButton,this.$canDelete=t.canDelete,this.$canClone=t.canClone,this.$shouldDeleteGroupMembers=t.shouldDeleteGroupMembers,this.$buttonY=-1*(this.St/2+this.$buttonSize),this.surface.on(this.surface.getContainer(),W,z(eR),n=>{let s=n.target.closest(`[${te}]`).getAttribute(te);s!=null&&(ie(n),this.surface.cloneVertex(s,{selectAfterCreate:!0}))}),this.surface.on(this.surface.getContainer(),W,z(tR),n=>{let o=n.target.closest(`[${te}]`),s=o.getAttribute(te);if(s!=null){ie(n);let a=this.surface.model.getVertex(s);Y(a)?this.surface.model.removeGroup(s,this.$shouldDeleteGroupMembers==null?!1:this.$shouldDeleteGroupMembers(a,o)===!0):this.surface.model.removeNode(a)}}),!1}Hh(e,t,n,o){let s=super.Hh(e,t,n,o);if(this.$canClone?this.$canClone(e.modelObject,e.el):this.$allowClone){let d=G(q,{transform:`translate(${this.$getCloneButtonX(e)}, ${this.$getCloneButtonY(e)})`});s.appendChild(d),pm(cm,this.$buttonSize,this.$buttonSize,[eR,Gx],{title:"Click to clone"},d),this.skeletons[e.id].cloneButton=d}if(this.$canDelete?this.$canDelete(e.modelObject,e.el):this.$allowDelete){let d=G(q,{transform:`translate(${this.$getDeleteButtonX(e)}, ${this.$getDeleteButtonY(e)})`});s.appendChild(d),pm(dm,this.$buttonSize,this.$buttonSize,[tR,Gx],{title:"Click to delete"},d),this.skeletons[e.id].deleteButton=d}if(this.$canShowLinkButton?this.$canShowLinkButton(e.modelObject,e.el):this.$allowLink){let d=G(q,{transform:`translate(${this.$getLinkButtonX(e)}, ${this.$getLinkButtonY(e)})`});s.appendChild(d),pm(hm,this.$buttonSize,this.$buttonSize,[GM,Gx],{title:"Click and drag to link","data-vjs-source":!0,[te]:e.id},d,{"data-vjs-source":!0}),this.skeletons[e.id].linkButton=d}return s}$getCloneButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getCloneButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getDeleteButtonX(e){return-(this.$buttonSize/2+this.$handleOffset)}$getDeleteButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getLinkButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getLinkButtonY(e){return e.height+this.$buttonSize/2+this.$handleOffset}$_setSkeletonPositionById(e){if(this.skeletons[e]&&super.$_setSkeletonPositionById(e)){let t=this.surface.$getManagedElement(e),n=this.skeletons[t.id].cloneButton;n&&n.setAttribute(yi,`translate(${this.$getCloneButtonX(t)}, ${this.$getCloneButtonY(t)})`);let o=this.skeletons[t.id].deleteButton;o&&o.setAttribute(yi,`translate(${this.$getDeleteButtonX(t)}, ${this.$getDeleteButtonY(t)})`);let s=this.skeletons[t.id].linkButton;return s&&s.setAttribute(yi,`translate(${this.$getLinkButtonX(t)}, ${this.$getLinkButtonY(t)})`),!0}return!1}};c(As,"type","diagramTools"),As=Ze([Je("diagramTools")],As);var hc=class extends fg{constructor(r,e,t){let n=t==null?void 0:t.onVertexAdded,o=t==null?void 0:t.onCellAdded;super(e.$ui,Object.assign(t||{},{container:r,inspector:(t==null?void 0:t.inspector)!==!1,selectAfterDrop:t==null?void 0:t.selectAfterAdd,onVertexAdded:s=>{o&&o(e.getCell(s.vertex.id)),n&&n(s)},dataGenerator:s=>{let a=Object.assign({},e.$propertyTracker.getValues()),l=s.getAttribute(Eg);if(l){let h=this.$preparedShapes.find(d=>d.shapeId===l);h&&Object.assign(a,h.properties||{})}return a}}))}};function $x(i){return i.startEditingPath!==void 0}function rR(i){return i.isEmpty()?0:i.head().zIndex}function $M(i){return i.isEmpty()?0:i.peek().zIndex}var yg=class{constructor(r,e,t){this.model=r;c(this,"$shapeLibrary");c(this,"$ui");c(this,"defaultCellWidth");c(this,"defaultCellHeight");c(this,"labelAttribute");c(this,"$_cellMap");c(this,"$editable");c(this,"$_cellList");c(this,"$propertyTracker");c(this,"F");var a,l,h,d,u,p,m,g,E,y,x,f,b,A,T,S,R,v,O,P,I,C,_,w,$,N,M,D,V,J,fe,X,ge,Ge,Xe,Ut,nr,Ht,vr,Ri,Cs,Ps,Os,_s,Rs,Vc,Gc,ml,$c,gl,vo;t=t||{},this.F=t.mediator,this.$_cellList=new Ds((re,Fe)=>re.zIndex<Fe.zIndex?-1:re.zIndex>Fe.zIndex?1:0),this.$_cellMap=new Map,this.labelAttribute=((a=t.cells)==null?void 0:a.labelProperty)||ao,this.$shapeLibrary=new va(t.shapes||q_,{labelFillRatio:(l=t.cells)==null?void 0:l.labelFillRatio,multilineLabels:(h=t.cells)==null?void 0:h.multilineLabels,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,labelPosition:(d=t.cells)==null?void 0:d.labelPosition}),this.$propertyTracker=new Cp(this.model,{fill:t.defaultFillColor||Bh,outline:t.defaultOutlineColor||ss,outlineWidth:t.defaultOutlineWidth||Fh,color:t.defaultColor||ss}),this.defaultCellWidth=((u=t.cells)==null?void 0:u.defaultWidth)||J_,this.defaultCellHeight=((p=t.cells)==null?void 0:p.defaultHeight)||K_,this.$editable=t.editable!==!1;let n=[];if(t.editable!==!1){if(n.push({type:As.type,options:{rotationStops:(m=t.cells)==null?void 0:m.rotationStops,canResizeFilter:(re,Fe)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.resizable)!==!1&&this.db(re,Fe)!==!1},canRotateFilter:(re,Fe)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.rotatable)!==!1&&this.ub(re,Fe)!==!1},canShowLinkButton:(re,Fe)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.linkable)!==!1&&this.pb(re,Fe)!==!1},canDelete:(re,Fe)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.deletable)!==!1&&this.mb(re,Fe)!==!1},canClone:(re,Fe)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.clonable)!==!1&&this.gb(re,Fe)!==!1},handleShape:(E=(g=t.cells)==null?void 0:g.resize)==null?void 0:E.handleShape,handleSize:(x=(y=t.cells)==null?void 0:y.resize)==null?void 0:x.handleSize,modelUpdater:(b=(f=t.cells)==null?void 0:f.resize)==null?void 0:b.modelUpdater,shouldDeleteGroupMembers:(A=t.cells)==null?void 0:A.shouldDeleteGroupMembers,handlerFactory:(S=(T=t.cells)==null?void 0:T.resize)==null?void 0:S.handlerFactory,resizeMethod:(v=(R=t.cells)==null?void 0:R.resize)==null?void 0:v.method,bordersVisible:(P=(O=t.cells)==null?void 0:O.resize)==null?void 0:P.bordersVisible,ignoreGrid:((C=(I=t.cells)==null?void 0:I.resize)==null?void 0:C.ignoreGrid)===!0,resizeX:(w=(_=t.cells)==null?void 0:_.resize)==null?void 0:w.resizeX,resizeY:(N=($=t.cells)==null?void 0:$.resize)==null?void 0:N.resizeY}}),t.snapLines!=null){let re=t.snapLines===!0?{}:t.snapLines;n.push({type:Es.type,options:re})}if(t.panButtons!=null){let re=t.panButtons===!0?{}:t.panButtons;n.push({type:fs.type,options:re})}}t.grid!=null&&t.grid.visible!==!1&&n.push({type:ds.type,options:Q_()}),t.lasso!=null&&(Co(t.lasso)?n.push(kn.type):n.push({type:kn.type,options:t.lasso})),t.miniview!=null&&n.push({type:Wn.type,options:t.miniview}),t.dragGroups!=null&&n.push({type:gs.type,options:t.dragGroups}),((M=t.edges)==null?void 0:M.highlightSelected)===!0&&n.push({type:Ga.type,options:{paintStyle:(D=t.edges)==null?void 0:D.highlightStyle}});let o=t.defaults||{},s={zoom:t.zoom,pan:t.pan,activeFiltering:(V=t.edges)==null?void 0:V.activeFiltering,grid:t.grid,zoomToFit:t.zoomToFit,zoomToFitIfNecessary:t.zoomToFitIfNecessary,useModelForSizes:!0,writeSizeToElements:!1,useSvgContainer:!0,wheel:t.wheel,magnetizer:(J=t.cells)==null?void 0:J.magnetizer,getCollapsedGroupSize:(fe=t.cells)==null?void 0:fe.getCollapsedGroupSize,canCollapseGroup:(re,Fe)=>this.F!=null&&this.F.canCollapse!=null?this.F.canCollapse(re,Fe):!0,canExpandGroup:(re,Fe)=>this.F!=null&&this.F.canExpand!=null?this.F.canExpand(re,Fe):!0,elementsDraggable:this.$editable!==!1&&((X=t.cells)==null?void 0:X.draggable)!==!1,defaults:o,view:this.Eb(t),shapes:{library:this.$shapeLibrary,showLabels:((ge=t.cells)==null?void 0:ge.showLabels)!==!1,strokeWidth:(Ge=t.cells)==null?void 0:Ge.outlineWidth,labelAttribute:(Xe=t.cells)==null?void 0:Xe.labelProperty,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,font:(Ut=t.cells)==null?void 0:Ut.font},edges:{editable:t.editable!==!1&&((nr=t.edges)==null?void 0:nr.editable)!==!1,editOnTap:t.editable!==!1,propertyMappings:(Ht=t.edges)==null?void 0:Ht.propertyMappings,avoidVertices:(vr=t.edges)==null?void 0:vr.avoidVertices,allowUnattached:((Ri=t.edges)==null?void 0:Ri.allowUnattached)!==!1,connector:(Cs=t.edges)==null?void 0:Cs.connector,layerIndex:(Ps=t.edges)==null?void 0:Ps.layerIndex,sourceMarker:(Os=t.edges)==null?void 0:Os.sourceMarker,targetMarker:(_s=t.edges)==null?void 0:_s.targetMarker,overlays:(Rs=t.edges)==null?void 0:Rs.overlays,anchor:(Vc=t.edges)==null?void 0:Vc.anchor,anchors:(Gc=t.edges)==null?void 0:Gc.anchors,inputMethod:(ml=t.edges)==null?void 0:ml.inputMethod,reattach:(($c=t.edges)==null?void 0:$c.reattach)===!0,detachable:(gl=t.edges)==null?void 0:gl.detachable},edgeSnap:(vo=t.edges)==null?void 0:vo.snap,plugins:n,events:{[_n]:()=>{t.deselectOnCanvasTap!==!1&&this.model.clearSelection()},[Xs]:re=>{if(this.$editable){let Fe=this.$_cellMap.get(re.dragGroup[0].vertex.id);Fe!=null&&this.toFront(Fe)}},[JA]:re=>{if(this.$editable){let Fe=this.$_cellMap.get(re.dragGroup[0].vertex.id);Fe!=null&&this.toFront(Fe)}}},dragOptions:{filter:re=>this.F&&this.F.canDrag?this.F.canDrag(re.vertex,this.wr(re.vertex),re.el):!0,canDrop:(re,Fe,vt)=>this.F&&this.F.canDrop?this.F.canDrop(re,Fe,vt):!0,autoPan:t.autoPan!==!1},templates:{nodeDefault:`<svg:g ${Wo}="${this.$editable}" class="${Mx}"><vjs-shape/></svg:g>`,groupDefault:`<svg:g ${Wo}="${this.$editable}" class="${Vx}"><vjs-shape/></svg:g>`,groupNoTarget:`<svg:g class="${Vx}"><vjs-shape/></svg:g>`,nodeNoTarget:`<svg:g class="${Mx}"><vjs-shape/></svg:g>`}};this.$editable?this.$ui=this.model.render(e,s):this.$ui=this.model.renderPaper(e,s),this.$ui.bind(Fr,re=>{this.km(re.vertex,re.el)}),this.$ui.bind(Br,re=>{this.km(re.vertex,re.el)}),this.model.bind(ve,re=>{this.Wm(re.node)}),this.model.bind(_e,re=>{this.Wm(re.group)}),this.model.bind(Jt,()=>{this.$_cellMap.clear(),this.$_cellList.clear()})}get cellWidthAttribute(){return this.model.modelWidthAttribute}get cellHeightAttribute(){return this.model.modelHeightAttribute}get cellLeftAttribute(){return this.model.modelLeftAttribute}get cellTopAttribute(){return this.model.modelTopAttribute}Eb(r){var h,d,u,p,m,g,E,y,x,f,b,A,T,S,R;let e=(h=r.edges)!=null&&h.events?r.edges.events[ze]:null,t={events:{[ze]:v=>{let O=v.e.srcElement||v.e.target;if(un(O,ua)){ie(v.e),v.model.removeEdge(v.connection.edge);return}r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||v.model.getSelection().te.length<1||v.e.shiftKey!==!0?v.model.setSelection(v.obj):v.model.addToSelection(v.obj)),e&&e(v)}},overlays:((d=r.edges)==null?void 0:d.overlays)||[],sourceMarker:(u=r.edges)==null?void 0:u.sourceMarker,targetMarker:(p=r.edges)==null?void 0:p.targetMarker,label:null,labelLocation:.5,labelLocationAttribute:null,deleteButton:(m=r.edges)==null?void 0:m.deleteButton,deleteButtonClass:(g=r.edges)==null?void 0:g.deleteButtonClass,deleteButtonLocation:(E=r.edges)==null?void 0:E.deleteButtonLocation,deleteConfirm:(y=r.edges)==null?void 0:y.deleteConfirm};if(r.edges){if(r.edges.showLabels){let v=r.edges.labelProperty||"label";t.label=`{{${v}}}`,r.edges.labelLocation!=null&&(t.labelLocation=r.edges.labelLocation),r.edges.labelLocationProperty!=null&&(t.labelLocationAttribute=r.edges.labelLocationProperty),r.edges.labelFont!=null&&(t.labelFont=r.edges.labelFont),r.edges.labelsRotatable!=null&&(t.labelsRotatable=r.edges.labelsRotatable)}if(r.edges.events)for(let v in r.edges.events)v!==ze&&(t.events[v]=r.edges.events[v])}let n=Object.assign({},((x=r.cells)==null?void 0:x.events)||{}),o=v=>O=>{this.$editable&&this.toFront(this.$_cellMap.get(O.obj.id)),r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||O.model.getSelection().ue.length<1||O.e.shiftKey!==!0?O.model.setSelection(O.obj):O.model.addToSelection(O.obj)),v&&v(O)};n.tap=o((b=(f=r.cells)==null?void 0:f.events)==null?void 0:b.tap);let s={events:n,templateIdResolver:(v,O,P,I)=>{let C=this.wr(I);return C!=null&&C.defaultTarget===!1?"groupNoTarget":"groupDefault"}};if((A=r.cells)!=null&&A.groups){let v=(T=r.cells)==null?void 0:T.groups,O=v.events||{};O.tap&&(O.tap=o(O.tap)),delete v.template,Object.assign(s,v)}let a={events:n,templateIdResolver:(v,O,P,I)=>{let C=this.wr(I);return C!=null&&C.defaultTarget===!1?"nodeNoTarget":"nodeDefault"}};if((S=r.cells)!=null&&S.nodes){let v=(R=r.cells)==null?void 0:R.nodes,O=v.events||{};O.tap&&(O.tap=o(O.tap)),delete v.template,Object.assign(a,v)}return{nodes:{default:a},edges:{default:t},groups:{default:s}}}km(r,e){r.data.z==null&&(r.data.z=rR(this.$_cellList)+1);let t=new Jn(this,r);t.el=e,this.$_cellMap.set(r.id,t),this.$_cellList.add(t)}Wm(r){let e=this.$_cellMap.get(r.id);e!=null&&(this.$_cellList.delete(e),e.destroy(),this.$_cellMap.delete(r.id))}ub(r,e){let t=this.wr(r);return t==null?!0:this.F&&this.F.canRotate?this.F.canRotate(r,t,e):!0}pb(r,e){let t=this.wr(r);return t==null?!0:this.F&&this.F.canLink?this.F.canLink(r,t,e):!0}gb(r,e){let t=this.wr(r);return t==null?!0:this.F&&this.F.canClone?this.F.canClone(r,t,e):!0}db(r,e){let t=this.wr(r);return t==null?!0:this.F&&this.F.canResize?this.F.canResize(r,t,e):!0}mb(r,e){let t=this.wr(r);return t==null?!0:this.F&&this.F.canDelete?this.F.canDelete(r,t,e):!0}wr(r){let e=r.data.type,t=r.data.category;return this.$shapeLibrary.getShapeDefinition(e,t)}destroy(){this.$ui.destroy()}fb(r){return j(r)?r:r.id}Wh(r){return j(r)?this.$_cellMap.get(r):r}getCell(r){let e=this.$_cellMap.get(r);return e&&e.el==null&&(e.el=this.$ui.getRenderedElement(r)),e}addCell(r){if(r.type==null)return U("WARN: cannot add a cell with no `type` to the diagram"),null;let e=this.$shapeLibrary.getShapeDefinition(r.type,r.category);if(e==null)return U(`WARN: cannot add cell with type ${r.type} and category ${r.category}; not found in shape library`),null;Object.assign(r,e.payload||{}),r[this.cellWidthAttribute]==null&&(r[this.cellWidthAttribute]=this.defaultCellWidth),r[this.cellHeightAttribute]==null&&(r[this.cellHeightAttribute]=this.defaultCellHeight),r[this.cellLeftAttribute]==null&&(r[this.cellLeftAttribute]=0),r[this.cellTopAttribute]==null&&(r[this.cellTopAttribute]=0);let t=this.$ui.model.addNode(r),n=new Jn(this,t);return this.$_cellMap.set(t.id,n),n.el=this.$ui.getRenderedElement(t),n}getLink(r){let e=this.model.getEdge(r);return e==null?null:new Ti(this,e)}addLink(r){let e=Object.assign({},r);e.source instanceof Jn&&(e.source=e.source.id),e.target instanceof Jn&&(e.target=e.target.id);let t=this.model.addEdge(e);return new Ti(this,t)}load(r){this.clear(),this.model.load(r)}exportData(){return this.model.exportData()}exportSvg(r){return Fa(this.$ui,r).svg}exportImage(r,e){Jm(this.$ui,r,e)}save(r){return this.$ui.save(r)}saveToUrl(r){this.model.save(Object.assign(r,{data:this.save(r)}))}getCellCount(){return this.model.getNodeCount()}getLinkCount(){return this.model.getEdgeCount()}clear(){this.model.clear()}removeCell(r){this.model.remove(this.fb(r))}toFront(r){if(!(r instanceof Ti)){let e=this.Wh(r);if(e!=null){let t=rR(this.$_cellList);e.vertex.data.z<t&&(e.vertex.data.z=t+1,this.$_cellList.update(e),this.$ui.toFront(e.vertex))}}}toBack(r){if(!(r instanceof Ti)){let e=this.Wh(r);if(e!=null){let t=$M(this.$_cellList);e.vertex.data.z>t&&(e.vertex.data.z=t-1,this.$_cellList.update(e),this.$ui.toBack(e.vertex))}}}selectCell(r){let e=this.Wh(r);e!=null&&this.model.setSelection(e.vertex.id)}selectLink(r){let e=this.model.getEdge(j(r)?r:r.id);e!=null&&this.model.setSelection(e)}selectEdge(r){this.selectLink(r)}startEditingPath(r,e){let t=r instanceof Ti?r.edge:r;$x(this.$ui)&&this.$ui.startEditingPath(t,e)}stopEditingPath(){$x(this.$ui)&&this.$ui.stopEditingPath()}clearPathEdits(r){if($x(this.$ui)){let e=r instanceof Ti?r.edge:r;this.$ui.clearPathEdits(e)}}getZoom(){return this.$ui.getZoom()}attachMiniview(r){this.$ui.addPlugin({type:Wn.type,options:r})}attachPalette(r,e){return new hc(r,this,e)}setZoom(r){this.$ui.setZoom(r)}zoomToFit(r){this.$ui.zoomToFit(r)}zoomToFitIfNecessary(r){this.$ui.zoomToFitIfNecessary(r)}};function oze(i,r,e){return new hc(r,i,e)}function sze(i,r,e,t){var s,a,l,h;r=r||{},e=e||{},e.beforeStartConnect==null&&(e.beforeStartConnect=r.beforeStartConnect),e.beforeConnect==null&&(e.beforeConnect=r.beforeConnect),Object.assign(e,{modelWidthAttribute:((s=r==null?void 0:r.cells)==null?void 0:s.widthProperty)||Pe,modelHeightAttribute:((a=r==null?void 0:r.cells)==null?void 0:a.heightProperty)||Me,modelLeftAttribute:((l=r==null?void 0:r.cells)==null?void 0:l.leftProperty)||Q,modelTopAttribute:((h=r==null?void 0:r.cells)==null?void 0:h.topProperty)||ye,selectionMode:$d});let o=En(e).renderDiagram(i,r);return t&&o.load({data:t}),o}var nR=class extends Ua{constructor(r,e,t){super(r,e.$ui,t)}};var iR="data-vjs-popup-position",Cze="vjs-surface-popup";function oR(i,r,e,t){let n=ft(r),o=t.getEffectiveVisibleZoom(),s=e.width/o,a=e.height/o;switch(i){case"bottom":{n.x=r.x+r.width/2-s/2,n.y=r.y+r.height;break}case"top":{n.x=r.x+r.width/2-s/2,n.y=r.y-a;break}case"left":{n.x=r.x-s,n.y=r.y+r.height/2-a/2;break}case"right":{n.x=r.x+r.width,n.y=r.y+r.height/2-a/2;break}case"center":{n.x=r.x+r.width/2-s/2,n.y=r.y+r.height/2-a/2;break}}return t.toViewportLocation(n.x,n.y)}var sR=class{constructor(r,e,t,n,o){c(this,"dt",null);c(this,"Zm","bottom");c(this,"Jm","bottom");c(this,"setCurrent");c(this,"container");c(this,"surface");c(this,"q");this.container=e,this.surface=t,this.setCurrent=n,this.Jm=o||"bottom",this.surface.addDragSelectorFilter(r),this.surface.addElementEventFilter(r);let s=p=>{let m=t.getElementFromEvent(p);if(m!=null){ie(p);let g=p.target.getAttribute(iR)||this.Jm;this.uo(m.modelObject,g)}else this.uo(null)},a=p=>{this.uo(null)},l=p=>{this.dt&&this.dt.modelObject===p.vertex&&(this.$positionPopup(),this.setCurrent(this.dt.modelObject))},h=p=>{this.dt&&this.dt.modelObject===p.vertex&&this.uo(null)},d=p=>{this.dt!=null&&p.dragGroup.forEach(m=>{var g;m.vertex===((g=this.dt)==null?void 0:g.modelObject)&&this.$positionPopup()})},u=()=>this.$positionPopup();t.on(t.getContainer(),W,r,s),t.bind(_n,a),t.model.bind(Re,l),t.model.bind(Te,l),t.model.bind(ve,h),t.model.bind(_e,h),t.bind(Mt,d),t.bind(Do,d),t.bind($r,u),t.bind(Fi,u),this.q=()=>{t.off(t.getContainer(),W,s),t.unbind(_n,a),t.model.unbind(Re,l),t.model.unbind(Te,l),t.model.unbind(ve,h),t.model.unbind(_e,h),t.unbind(Mt,d),t.unbind(Do,d),t.unbind($r,u),t.unbind(Fi,u)}}uo(r,e){var t;r==null?this.dt=null:(this.dt=(t=this.surface)==null?void 0:t.getElement(r.getFullId()),this.Zm=e||"bottom"),this.setCurrent(r),r!=null&&requestAnimationFrame(()=>this.$positionPopup())}$destroy(){this.q()}$hide(){this.uo(null)}$positionPopup(){if(this.dt!=null&&this.container!=null){let r=We(this.container),e=oR(this.Zm,this.dt,r,this.surface);this.surface.floatElement(this.container,e)}}};function hXe(i,r){Cm.register(i,r)}function cXe(i,r,e){return En(e||{}).render(i,r)}var BM=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e||aR,r)},FM=(e=>(e.idle="idle",e.dragging="dragging",e))(FM||{}),E_="assigned",Ha="added";function UM(i){return j(i)?{id:i,active:!0,membership:Ha}:{id:i.id,active:i.active,membership:i.membership}}var YM=z(Ph);function zM(i,r){let e=uE(i.members,t=>t.el.id===r);return e!==null?e.active===!0:!1}var XM=["input","textarea","select","button","option"],aR=XM.join(","),xg=class{constructor(r){c(this,"inputFilterSelector");c(this,"Dr",{});c(this,"Zh",[]);c(this,"activeGrid");c(this,"downAt");c(this,"viewportPositionAtDown");c(this,"relativePositionAtDown");c(this,"newPosition");c(this,"Jh");c(this,"O");c(this,"Kh");c(this,"po");c(this,"u");c(this,"_");c(this,"xe");c(this,"Nr");c(this,"qs");c(this,"qh");c(this,"le");c(this,"Qs",[]);c(this,"Qh");c(this,"mo");c(this,"ea",null);c(this,"Tt",[]);c(this,"currentState","idle");c(this,"R");c(this,"ln",{});c(this,"ec",{});c(this,"kt",null);c(this,"be",new Map);c(this,"go",new Map);c(this,"ui");c(this,"draggableInstance");c(this,"resolveGrid");this.ui=r.ui,this.draggableInstance=r.draggableInstance,this.resolveGrid=r.resolveGrid,this.inputFilterSelector=r.inputFilterSelector||aR;let e=`${Ae(te)}, ${Ae(te)} *`;this.draggableInstance.addDragHandler({selector:e,start:t=>this.yb(t),drag:t=>this.xb(t),stop:t=>{this.Ab(t)},constrainFunction:(t,n,o,s,a,l)=>t,destroy:()=>this.$destroy()}),this.ui.bind($r,t=>{this.currentState==="dragging"&&(this.po=this.po*(t.zoom/this.Kh),this.Kh=t.zoom)}),this.draggableInstance.dragOptions.autoPan!==!1&&(this.R=new Yn(this.draggableInstance,{autoPanDelta:this.draggableInstance.dragOptions.autoPanDelta||5,autoPanRepeat:this.draggableInstance.dragOptions.autoPanRepeat||15,boundsStrategy:this.draggableInstance.dragOptions.autoPanBoundsStrategy,onPan:t=>{this.O=Object.assign({},t),this.Km(!1)},shouldHandle:()=>this.Jh!==!0}))}tc(r){for(let e in this.Dr){let t=this.Dr[e],n=t[0](r);if(t[1]&&(n=!n),!n)return!1}return!0}addDragFilter(r,e,t){if(r&&rn(r)){r.Eo=e||B();let n=r.Eo;this.Dr[n]=[r,t!==!1]}}removeFilter(r){let e=typeof r=="function"?r.Eo:r;delete this.Dr[e]}addSelectorFilter(r,e){this.addDragFilter(t=>{let n=t.srcElement||t.target;return $t(n,r,this.ui.getContainer())},r,e)}addClassnameFilter(r,e){r&&(r=Array.isArray(r)?r:[r],r.forEach(t=>{t.split(",").map(Ct).forEach(o=>{let s=a=>{let l=a.srcElement||a.target;return un(l,o)};s.Sb=o,this.addDragFilter(s,t,e)})}))}Tb(r){for(let e in this.Dr)if(this.Dr[e].Sb===r){delete this.Dr[r];return}}removeClassnameFilter(r){r&&(r=Array.isArray(r)?r:[r],r.forEach(e=>{e.split(",").map(Ct).forEach(n=>{this.Tb(n)})}))}clearAllFilters(){this.Dr={}}q(){this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer(),this.le&&this.le.cleanup(),this.le=null,this.qh=!1,this.activeGrid=null,this.downAt=null,this.newPosition=null,this.viewportPositionAtDown=null,F(document.body,gt),F(this.ui.rootElement,Ty),this.mo||(F(this.ui.rootElement,Lh),F(this.ui.rootElement,xr),F(this.ui.rootElement,br)),this._!=null&&F(this._.el,vy),this.u!=null&&(Array.from(this.draggableInstance.getContainer().querySelectorAll(YM)).forEach(r=>{F(r,Ph)}),L(this.u.el,Ph),F(this.u.el,Ch),this.be.forEach(r=>{F(r.managedElement.el,Ch),L(r.managedElement.el,Ph)})),this.currentState="idle",this.u=null,this._=null,this.qm(),this.Qs.forEach(r=>{this.Qm(r.managedElement,xr,Ry,Lh)}),this.Qs.length=0,this.go.clear(),this.be.clear(),this.kt=null}qm(){this.Tt.forEach(r=>{this.Qm(r.managedElement,br)}),this.Tt.length=0}vb(r,e){let t=this.ui.$getManagedElement(r.id);for(;t!=null;){if(this.eg(t,e))return t;t.modelObject.group?t=this.ui.$getManagedElement(r.group.id):t=null}return null}Cb(r){r=r||0;let e=-r*Math.PI/180;return{cos:Math.cos(e),sin:Math.sin(e)}}yb(r){if(r.e.Pb==!0||r.e.which===3||r.e.button===2)return!1;if(this.currentState==="idle"){if(this.R&&this.R.reset(),this.ea=null,!this.draggableInstance.$canStartElementDrag())return!1;if(r.el.getAttribute(yr)!==ct)if(this.tc(r.e)&&BM(r.e,this.ui.getContainer(),this.inputFilterSelector)){let t=null,n=Bt(r.el,Ae(mt),this.ui.getContainer(),!0);if(n!=null&&(t=this.ui.getModelObjectFromElement(n,!1,!1)),t!=null&&!rt(t.obj)&&!H(t.obj))if(this.draggableInstance.isDraggable(n)){if(this.be.clear(),this.Qh=!0,r.e.Pb=!0,this.u=this.vb(t.obj,r.e),this.u==null)return r.e.Ry=!0,!1;this.qs=!1,this.xe={isGroupElement:!1,contentArea:null,pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0}},this.O={x:0,y:0},this.Jh=r.e.shiftKey;let o=this.u.modelObject.group==null,s=!1;if(o)this._=null,this.Nr=null;else{if(this._=this.ui.$getManagedElement(this.u.modelObject.group.id),this.Nr=this.ui.getGroupDefinition(this._.modelObject),this.Nr.elementsDraggable===!1)return!1;s=this.Nr.elastic===!0&&r.e.shiftKey!==!0,this.qh=r.e.shiftKey===!0,this.xe=this.ui.$_getGroupContentAreaInfo(this._.id),L(this._.el,vy),this.Qh=this.ui.$canDrop(this.u.modelObject,null,!0),s||(F(this.ui.rootElement,xr),L(this.ui.rootElement,Lh)),this.ea=this.Cb(this._.r)}this.mo=o||s,this.mo||L(this.ui.rootElement,xr),o||!s?this.ui.model.getGroups().forEach(l=>{if(l.id!==this.u.id&&!je(l,this.u.modelObject)){let h=this.ui.getGroupDefinition(l),d=l===this.u.modelObject.group,u=d||(this.ui.$canDrop(this.u.modelObject,l,!1)==!1?!1:h.canDrop?h.canDrop(this.u.modelObject):!0),p=this.ui.viewport.getGroupElement(l.id),m=this.ui.$_getGroupContentAreaInfo(l.id),E=-(p.r||0)*Math.PI/180,y={droppable:u,managedElement:p,depth:Kc(l),contentAreaInfo:m,contentArea:p.contentArea,contentBox:{x:p.x+m.internalOffset.x,y:p.y+m.internalOffset.y,width:p.width-m.internalOffset.x,height:p.height-m.internalOffset.y,r:p.r},isCurrentGroup:d,group:l,id:l.id,rotation:p.r||0,rotationMatrix:{cos:Math.cos(E),sin:Math.sin(E)}};this.Qs.push(y),u?(d||this.Zn(p,xr),d&&this.Zn(p,Ry)):this.Zn(p,Lh)}}):s&&(this.le=new $a(this.ui,this.u.modelObject,this.u.modelObject.group,this.Nr)),this.viewportPositionAtDown={x:Math.floor(this.u.x*100)/100,y:Math.floor(this.u.y*100)/100},this.Ob(),this.activeGrid=this.resolveGrid(),this.downAt=Object.assign({},r.pagePosition),this.Kh=this.draggableInstance.getZoom(),this.po=this.draggableInstance.getEffectiveVisibleZoom(),L(document.body,gt),L(this.ui.rootElement,Ty),L(this.u.el,Ch),this.currentState="dragging",this.R&&this.R.observe(this.u.el),this.kt=this.ln[this.u.modelObject.id],this.kt&&!zM(this.kt,this.u.modelObject.id)&&(this.kt=null);let a={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,pos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},element:this.u}],ui:this.ui};if(this.go.clear(),this.be.set(this.u.modelObject.id,{modelObject:this.u.modelObject,managedElement:this.u,offset:{x:0,y:0},size:ei(this.u),originalPosition:ft(this.u),position:ft(this.u),parentGroup:this.u.modelObject.group?this.ui.viewport.getGroupElement(this.u.modelObject.group.id):null}),this.kt!=null){let l=(Y(this.u.modelObject)?Ms(this.u.modelObject):[]).map(d=>d.id),h=An(this.u.modelObject).map(d=>d.id);Array.from(this.kt.members).filter(d=>l.indexOf(d.el.id)===-1&&h.indexOf(d.el.id)===-1).forEach(d=>{let u={x:d.el.x,y:d.el.y},p=d.el.modelObject;this.be.set(d.el.id,{modelObject:p,managedElement:d.el,offset:{x:d.el.x-this.u.x,y:d.el.y-this.u.y},size:ei(d.el),originalPosition:ft(d.el),position:ft(d.el),parentGroup:p.group?this.ui.viewport.getGroupElement(p.group.id):null}),this.R&&this.R.observe(d.el.el),a.dragGroup.push({el:d.el.el,vertex:d.el.modelObject,pos:{x:u.x,y:u.y},element:d.el}),L(d.el.el,Ch),this.ui.toFront(d.el.el,!0)})}return this.ui.toFront(this.u.el,!0),this.ui.magnetizerProfile.constant&&this.ui.$startMagnetizer(),this.ui.$startMotion(),this.ui.fire(Xs,a),!0}else return!1;else return!1}else return!1;else return!1}}Bl(){this.draggableInstance.$stopPanRepeat(),this.u!=null&&this.R!=null&&(this.R.unobserve(this.u.el),this.be&&this.be.forEach(r=>{this.R.unobserve(r.managedElement.el)}))}Zn(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>L(t,n))}Qm(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>F(t,n))}Ab(r){var e;if(this.Bl(),this.u!=null&&this.newPosition!=null){this._b(),this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer();let t=new Set,n={},o=null,s=this._!=null,a=!1,l=[],h={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y},d=Object.assign({},h);if(this.Tt.length>0&&(o=this.Tt[0],t.add(o.group),s&&(this._.id!==o.id?t.add(this._.modelObject):this.qh&&t.delete(o.group))),o==null){if(!this.Qh)return this.tg();this._!=null&&this.le==null&&(d.x+=this._.x+this.xe.internalOffset.x,d.y+=this._.y+this.xe.internalOffset.y,d=Ie(d,this._.c,this._.r)),n[this.u.id]={x:d.x,y:d.y},Array.from(this.be.values()).forEach(p=>{n[p.managedElement.id]={x:p.offset.x+d.x,y:p.offset.y+d.y}})}else{if(!o.droppable)return this.tg();let p=this.ui.$_getGroupContentAreaInfo(o.id);if(this._!=null)if(this._.id===o.id)n[this.u.id]={x:d.x,y:d.y};else{let m=d.x+(this._.x+this.xe.internalOffset.x),g=d.y+(this._.y+this.xe.internalOffset.y);d.x=m-(o.managedElement.x+p.internalOffset.x),d.y=g-(o.managedElement.y+p.internalOffset.y),n[this.u.id]={x:d.x,y:d.y}}else d=this.Rb(this.u,o.managedElement,p),n[this.u.id]={x:d.x,y:d.y};if(l.push({vertex:this.u.modelObject,originalParent:(e=this._)==null?void 0:e.modelObject,originalPosition:this.relativePositionAtDown,positionInGroup:d}),this.kt!=null){let m=this.Lb(d,o.managedElement,p);for(let g in m.current){let E={x:Math.floor(m.current[g].x),y:Math.floor(m.current[g].y)};n[g]=E;let y=this.be.get(g),x=y.managedElement.modelObject;l.push({vertex:x,originalPosition:y.originalPosition,positionInGroup:E,originalParent:x.group})}}}if(a||this.go.forEach((p,m)=>{n[m]=p.current}),this.ui.magnetizerProfile.afterDrag&&!a){let p=this.ui.$provisionallyMagnetize(this.u.modelObject,this.ui.magnetizerProfile.repositionDraggedElement===!0,n,null,!1,!1);for(let m in p.current)n[m]=p.current[m]}this.ui.model.transaction(()=>{if(a)this.be.forEach((p,m)=>{this.ui.$setViewportElementPosition(p.managedElement,p.originalPosition)});else{let p={},m={};if(o==null)if(this.le==null)Array.from(this.be.values()).forEach(g=>{g.parentGroup!=null&&(t.add(g.parentGroup.modelObject),this.ui.model.$removeFromGroup(g.modelObject,null,{x:this.relativePositionAtDown.x+g.offset.x,y:this.relativePositionAtDown.y+g.offset.y},g.position,this.ui))});else{let{movedElements:g,resizedGroups:E}=this.le.Jl();Object.assign(m,E);for(let y in g)n[y]=g[y].current,p[y]=g[y].current}else l.forEach(g=>{this.ui.model.$addToGroup(g.vertex,o.group,g.originalParent,g.originalPosition,g.positionInGroup,this.ui)});for(let g in n){let E={[this.ui.$modelLeftAttribute]:n[g].x,[this.ui.$modelTopAttribute]:n[g].y};m[g]!=null&&(E[this.ui.$modelWidthAttribute]=m[g].newGroupSize.width,E[this.ui.$modelHeightAttribute]=m[g].newGroupSize.height),this.ui.model.$_updateVertex(g,E,qs,!1)}this.ui.$_sizeGroupsToFit(t,null,null,!1),this.ui.$trackGroupSizeChanges(m)}});let u={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:d.x,y:d.y},element:this.u}],ui:this.ui};Array.from(this.be.values()).forEach(p=>{if(p.managedElement.id!==this.u.id){let m=p.managedElement;u.dragGroup.push({pos:p.position,originalPos:p.originalPosition,el:m.el,vertex:p.modelObject,element:m})}}),this.ui.$stopMotion(),this.ui.fire(Vt,u)}this.q()}Rb(r,e,t){let n=Ie(Ie(r,r.c,r.r+e.r),e.c,-e.r);return{x:n.x-(e.x+t.internalOffset.x),y:n.y-(e.y+t.internalOffset.y)}}Lb(r,e,t){let n=[this.u.modelObject],o={[this.u.id]:r};this.kt.members.forEach(h=>{h.el.id!==this.u.id&&(o[h.el.id]=this.be.get(h.el.id).position,n.push(h.el.modelObject))});let s=h=>o[h.id],a=h=>this.be.get(h.id).size;return new Mi({positionSetter:(h,d)=>o[h.id]=d,positionGetter:s,getId:h=>h.id,elements:n,getSize:a}).executeWithFocus(this.u.id,{gather:!0})}tg(){this.ui.$stopMotion(),Array.from(this.be.values()).forEach(r=>{this.ui.viewport.updateElement(r.managedElement.id,r.originalPosition.x,r.originalPosition.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(r.managedElement,!0)}),this.go.forEach((r,e)=>{let t=this.ui.$getManagedElement(e);this.ui.viewport.updateElement(e,r.original.x,r.original.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(t,!0)}),this.ui.fire(Vd),this.q()}wb(r){return this._==null||r.id===this._.id}Km(r){if(this.newPosition!=null){let e={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y};this.qm();let t={x:e.x+this.xe.pageOrigin.x,y:e.y+this.xe.pageOrigin.y,width:this.u.width,height:this.u.height,r:this.u.r};if(this.Qs.forEach(l=>{zb(l.contentBox,t)&&this.Tt.push(l)}),this.Tt.length>0){this.Tt.sort((h,d)=>h.depth>d.depth?-1:1),this.rc(this.Tt[0].managedElement,!0);let l=!this.wb(this.Tt[0].managedElement);(this._==null||this.qs||l)&&this.Zn(this.Tt[0].managedElement,br),this._!=null&&!l&&(this.qs=!0,this.Zn(this._,xr)),this.mo||F(this.ui.rootElement,br)}else this.rc(this._,!1),this._!=null&&!this.Nr.elastic&&(this.qs=!0,this.Zn(this._,xr)),this.mo||L(this.ui.rootElement,br);let n={},o=[{id:this.u.id,x:e.x,y:e.y}];n[this.u.id]=e;let s={dragGroup:[{vertex:this.u.modelObject,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:e.x,y:e.y},element:this.u}],positions:n,ui:this.ui};if(Array.from(this.be.values()).forEach(l=>{if(l.managedElement.id!==this.u.id){let h=l.originalPosition,d={x:e.x+l.offset.x,y:e.y+l.offset.y};this.activeGrid!=null&&(d=le(d,this.activeGrid)),l.position=d,o.push({id:l.managedElement.id,x:d.x,y:d.y}),n[l.managedElement.id]=d,s.dragGroup.push({pos:{x:d.x,y:d.y},originalPos:{x:h.x,y:h.y},vertex:l.managedElement.modelObject,element:l.managedElement})}else l.position={x:e.x,y:e.y}}),this.ui.magnetizerProfile.constant){let l=this.ui.$provisionallyMagnetize(this.u.modelObject,!1,{[this.u.id]:{x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y}},null,!0,r);for(let h in l.current)n[h]=l.current[h],this.go.set(h,{current:l.current[h],original:l.original[h]}),s.dragGroup.push({vertex:this.ui.model.getVertex(h),originalPos:l.original[h],pos:l.current[h],element:this.ui.getElement(h)})}let a=this.ui.$_updateVertexPositions({positions:n,sizes:null,offset:this.xe.pageOrigin,repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1});return this.ui.fire(Mt,s),{redrawResult:a,positions:n}}}rg(r,e,t){if(e==null)this.ui.$setVisibleElementRotation(r,r.r);else{let n=0;t?n=r.modelObject.group===e.modelObject?0:e.r:n=r.modelObject.group===e.modelObject?-e.r:0,this.ui.$setVisibleElementRotation(r,r.r+n)}}rc(r,e){this.u!=null&&(this.rg(this.u,r,e),Array.from(this.be.values()).forEach(t=>{t.managedElement.id!==this.u.id&&this.rg(t.managedElement,r,e)}))}_b(){this.rc(null,!0)}Db(r,e){if(this.ea==null)return{x:r,y:e};let{cos:t,sin:n}=this.ea;return{x:r*t-e*n,y:r*n+e*t}}xb(r){if(this.currentState==="dragging"){ie(r.e),this.Jh=r.e.shiftKey;let e=Object.assign({},r.pagePosition),t=(e.x-this.downAt.x)/this.po,n=(e.y-this.downAt.y)/this.po,o=this.Db(t,n);t=o.x,n=o.y;let s={x:this.viewportPositionAtDown.x+t,y:this.viewportPositionAtDown.y+n};this._!=null&&(s.x-=this.xe.pageOrigin.x,s.y-=this.xe.pageOrigin.y,!this.Nr.elastic&&this.Nr.constrain&&(s.x+this.u.width>this._.width-this.xe.internalOffset.x&&(s.x=this._.width-this.u.width-this.xe.internalOffset.x),s.y+this.u.height>this._.height-this.xe.internalOffset.y&&(s.y=this._.height-this.u.height-this.xe.internalOffset.y),s.x<0&&(s.x=0),s.y<0&&(s.y=0))),this.activeGrid!=null&&(s=le(s,this.activeGrid)),this.draggableInstance.dragOptions.constrainFunction&&(s=this.draggableInstance.dragOptions.constrainFunction(s,r.el,this.u.modelObject,r.size,this.newPosition||this.viewportPositionAtDown,r.e)),this.newPosition=s;let a=this.Km(r.e.shiftKey);if(this.R!=null&&this.u!=null){let l=this.u.el.getBoundingClientRect();this.R.updateDragElementPosition(l)}return this.le!=null&&this.le.focusVertex.id===this.u.id&&this.Nb(r.e,a.positions[this.u.id]),a.redrawResult}else return null}Ob(){let r=this._?this._.x+this.xe.internalOffset.x:0,e=this._?this._.y+this.xe.internalOffset.y:0;this.relativePositionAtDown={x:this.viewportPositionAtDown.x-r,y:this.viewportPositionAtDown.y-e}}ng(r,...e){let t=[],n=UM(r),o=this.ec[n.id];if(o==null)o={id:n.id,members:new Set},this.ec[n.id]=o,t.push(...e);else{let s=Array.from(o.members.values());e.forEach(a=>{let l=s.find(h=>h.el.id===a.id);(l==null||l.membership!==Ha)&&t.push(a)})}this.removeFromDragGroup(...t),t.forEach(s=>{this.eg(s,null)&&(o.members.add({el:s,active:n.active!==!1,membership:n.membership}),this.ln[s.id]=o)})}removeFromDragGroup(...r){r.forEach(e=>{let t=this.ln[e.id];if(t!=null){let n=new Set;t.members.forEach(o=>{o.el!==e&&n.add(o)}),t.members=n,delete this.ln[e.id]}})}$setDragGroupState(r,...e){e.forEach(t=>{let n=this.ln[t.id];if(n!=null){let o=uE(n.members,s=>s.el.id===t.id);o!=null&&(o.active=r)}})}$clearDragGroup(r){let e=this.ec[r];e!=null&&(e.members.forEach(t=>{delete this.ln[t.el.id]}),e.members.clear())}$resolveDragGroup(r){return this.ln[r]}Nb(r,e){this.le!=null&&e!=null&&this.le.setFocusPosition(e,!0,r)}eg(r,e){for(let t=0;t<this.Zh.length;t++)if(!this.Zh[t]({el:r.el,vertex:r.modelObject,e}))return!1;return!0}$addVertexDragFilter(r){this.Zh.push(r)}$destroy(){this.R&&this.R.disconnect()}};var or=i=>i.map(r=>String.fromCharCode(r)).join(""),jM=new Date().getFullYear(),HM=or([67,111,112,121,114,105,103,104,116,32])+jM+or([32,74,83,80,76,85,77,66,32,80,84,89,32,76,84,68]),Bx=or([104,116,116,112,115,58,47,47,118,105,115,117,97,108,108,121,106,115,46,99,111,109]),lR=new Array(50).fill("-").join(""),kM=or([86,105,115,117,97,108,108,121,74,115,32])+mu,WM=or([86,105,115,117,97,108,108,121,74,115,32,105,115,32,102,114,101,101,32,116,111,32,117,115,101,32,102,111,114,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,112,117,114,112,111,115,101,115,46,32,65,108,108,32,99,111,109,109,101,114,99,105,97,108,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,32,114,101,113,117,105,114,101,32,116,104,101,32,112,117,114,99,104,97,115,101,32,111,102,32,97,32,108,105,99,101,110,115,101,46]),ZM=or([70,111,114,32,97,32,100,101,102,105,110,105,116,105,111,110,32,111,102,32,34,99,111,109,109,101,114,99,105,97,108,34,44,32,34,110,111,110,45,99,111,109,109,101,114,99,105,97,108,34,32,97,110,100,32,34,101,118,97,108,117,97,116,105,111,110,34,32,112,108,101,97,115,101,32,115,101,101,32,116,104,101,32,108,105,99,101,110,115,101,32,97,103,114,101,101,109,101,110,116,32,111,110,32,111,117,114,32,115,105,116,101,46]),JM=or([84,104,105,115,32,99,111,110,115,111,108,101,32,98,97,110,110,101,114,32,97,110,100,32,116,104,101,32,86,105,115,117,97,108,108,121,74,115,32,119,97,116,101,114,109,97,114,107,32,97,114,101,32,114,101,113,117,105,114,101,100,32,116,111,32,98,101,32,105,110,99,108,117,100,101,100,32,111,110,32,97,108,108,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,46]),Ss=or([10,10]),hR=lR+Ss+kM+Ss+HM+Ss+Bx+Ss+WM+Ss+ZM+Ss+JM+Ss+lR,cR=or([86,105,115,117,97,108,108,121,74,115,32,45,32,98,117,105,108,100,32,112,114,111,102,101,115,115,105,111,110,97,108,32,102,108,111,119,99,104,97,114,116,115,44,32,100,105,97,103,114,97,109,115,44,32,99,104,97,114,116,115,32,97,110,100,32,114,105,99,104,32,110,111,100,101,32,98,97,115,101,100,32,85,73,115,32,119,105,116,104,32,65,110,103,117,108,97,114,44,32,82,101,97,99,116,44,32,86,117,101,44,32,83,118,101,108,116,101,44,32,74,97,118,97,115,99,114,105,112,116,32,97,110,100,32,84,121,112,101,115,99,114,105,112,116,32,105,110,32,114,101,99,111,114,100,32,116,105,109,101,46]),KM=or([60,115,118,103,32,118,105,101,119,66,111,120,61,34,51,48,32,50,48,32,49,53,48,32,52,53,34,32,119,105,100,116,104,61,34,56,48,34,32,104,101,105,103,104,116,61,34,51,48,34,62]),dR=or([60,103,32,102,105,108,108,61,34,35,98,55,98,55,98,55,34,62]),qM=["m 43.96,33.76 q 0.12,-0.32 0.48,-0.32 h 2.24 q 0.44,0 0.32,0.44 l -5.88,17.8 Q 41,52 40.6,52 H 37.52 Q 37.12,52 37,51.68 l -5.88,-17.8 -0.04,-0.16 q 0,-0.28 0.36,-0.28 h 2.24 q 0.36,0 0.48,0.32 l 4.76,14.76 q 0.04,0.12 0.12,0.12 0.12,0 0.16,-0.12 z","m 52.606875,29.12 q -0.88,0 -1.56,-0.64 -0.64,-0.68 -0.64,-1.56 0,-0.88 0.64,-1.52 0.68,-0.64 1.56,-0.64 0.84,0 1.48,0.64 0.64,0.64 0.64,1.52 0,0.88 -0.64,1.56 -0.64,0.64 -1.48,0.64 z m -1.12,22.88 q -0.4,0 -0.4,-0.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 z","m 65.03125,52.44 q -2.36,0 -4,-1.2 -1.6,-1.2 -2.24,-3.2 l -0.04,-0.16 q 0,-0.24 0.28,-0.32 l 1.92,-0.68 0.16,-0.04 q 0.24,0 0.36,0.32 0.36,1.28 1.36,2 1.04,0.72 2.2,0.72 1.68,0 2.56,-0.8 0.88,-0.84 0.88,-2.12 0,-1.28 -0.88,-2 -0.84,-0.72 -2.36,-1 l -1.6,-0.32 q -2.04,-0.4 -3.24,-1.8 -1.2,-1.44 -1.2,-3.44 0,-1.48 0.76,-2.72 0.76,-1.24 2.12,-1.92 1.4,-0.72 3.12,-0.72 2.2,0 3.72,1.16 1.56,1.12 2.16,3.24 l 0.04,0.16 q 0,0.24 -0.32,0.36 l -1.88,0.48 -0.16,0.04 q -0.24,0 -0.32,-0.32 -0.32,-1.2 -1.16,-1.88 -0.8,-0.68 -2.08,-0.68 -1.4,0 -2.28,0.76 -0.84,0.76 -0.84,1.92 0,1.2 0.68,1.84 0.68,0.64 2.04,0.92 l 1.56,0.32 q 2.24,0.44 3.6,1.88 1.4,1.4 1.4,3.72 0,2.4 -1.72,3.96 -1.68,1.52 -4.6,1.52 z","m 87.125,33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 h -1.92 q -0.4,0 -0.4,-0.4 v -1.32 q 0,-0.16 -0.12,-0.2 -0.08,-0.04 -0.24,0.12 -1.88,2.2 -4.84,2.2 -2.96,0 -4.6,-1.72 -1.6,-1.72 -1.6,-4.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 45.8 q 0,1.96 1,3 1,1 2.88,1 1.32,0 2.4,-0.68 1.08,-0.68 1.8,-1.96 0.2,-0.4 0.2,-0.84 z","m 103.88688,52.4 q -2.56,0 -4.640005,-1.2 -2.08,-1.24 -3.28,-3.44 -1.2,-2.2 -1.2,-5.04 0,-2.84 1.2,-5.04 1.2,-2.2 3.28,-3.4 2.080005,-1.24 4.640005,-1.24 3.92,0 6.03999,2.48 0.08,0.08 0.16,0.04 0.08,-0.04 0.08,-0.16 v -1.56 q 0,-0.4 0.39999,-0.4 h 1.96001 q 0.39999,0 0.39999,0.4 V 51.6 q 0,0.4 -0.39999,0.4 h -1.96001 q -0.39999,0 -0.39999,-0.4 v -1.56 q 0,-0.12 -0.08,-0.16 -0.08,-0.04 -0.16,0.04 -2.47999,2.48 -6.03999,2.48 z m 0.44,-2.64 q 1.87999,0 3.36,-0.8 1.48,-0.8 2.15999,-2.16 0.16001,-0.32 0.16001,-0.72 v -6.72 q 0,-0.4 -0.16001,-0.72 -0.76,-1.36 -2.23999,-2.16 -1.44,-0.8 -3.28,-0.8 -2.96001,0 -4.800005,1.96 -1.8,1.92 -1.8,5.08 0,3.16 1.8,5.12 1.839995,1.92 4.800005,1.92 z","m 123.61562,49.56 q 0.40001,0 0.40001,0.4 v 1.8 q 0,0.4 -0.40001,0.4 h -0.72 q -1.87999,0 -2.92,-0.88 -1.03999,-0.92 -1.03999,-2.8 V 23.44 q 0,-0.4 0.39999,-0.4 h 2.12 q 0.40001,0 0.40001,0.4 v 24.68 q 0,1.44 1.19999,1.44 z","m 133.14687,49.56 q 0.4,0 0.4,0.4 v 1.8 q 0,0.4 -0.4,0.4 h -0.72 q -1.88,0 -2.92,-0.88 -1.04,-0.92 -1.04,-2.8 V 23.44 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 v 24.68 q 0,1.44 1.2,1.44 z","m 148.72562,33.76 q 0.12,-0.32 0.52,-0.32 h 2.2 q 0.48,0 0.36,0.44 l -9.32,25.68 q -0.12,0.32 -0.48,0.32 h -2.16 q -0.52,0 -0.36,-0.52 l 2.64001,-7.32 q 0.08,-0.16 0.08,-0.44 0,-0.24 -0.08,-0.4 l -6.40001,-17.28 -0.04,-0.16 q 0,-0.32 0.36,-0.32 h 2.28 q 0.36,0 0.48,0.32 l 4.72,13.56 q 0.12,0.24 0.24,0.24 0.2,0 0.24,-0.24 z"],QM=dR+'<path d="'+qM.join('"/><path d="')+'"/></g>',eV=["m 159.312,61.368 c -0.448,0 -0.88533,-0.04267 -1.312,-0.128 -0.29867,-0.064 -0.43733,-0.213333 -0.416,-0.448 l 0.192,-1.44 c 0.0213,-0.213333 0.13867,-0.288 0.352,-0.224 0.384,0.106667 0.69333,0.16 0.928,0.16 0.46933,0 0.81067,-0.16 1.024,-0.48 0.23467,-0.32 0.352,-0.736 0.352,-1.248 V 40.472 c 0,-0.213333 0.10667,-0.32 0.32,-0.32 h 1.696 c 0.21333,0 0.32,0.106667 0.32,0.32 v 17.056 c 0,1.216 -0.32,2.154667 -0.96,2.816 -0.61867,0.682667 -1.45067,1.024 -2.496,1.024 z","m 171.5875,55.352 q -1.888,0 -3.2,-0.96 -1.28,-0.96 -1.792,-2.56 l -0.032,-0.128 q 0,-0.192 0.224,-0.256 l 1.536,-0.544 0.128,-0.032 q 0.192,0 0.288,0.256 0.288,1.024 1.088,1.6 0.832,0.576 1.76,0.576 1.344,0 2.048,-0.64 0.704,-0.672 0.704,-1.696 0,-1.024 -0.704,-1.6 -0.672,-0.576 -1.888,-0.8 l -1.28,-0.256 q -1.632,-0.32 -2.592,-1.44 -0.96,-1.152 -0.96,-2.752 0,-1.184 0.608,-2.176 0.608,-0.992 1.696,-1.536 1.12,-0.576 2.496,-0.576 1.76,0 2.976,0.928 1.248,0.896 1.728,2.592 l 0.032,0.128 q 0,0.192 -0.256,0.288 l -1.504,0.384 -0.128,0.032 q -0.192,0 -0.256,-0.256 -0.256,-0.96 -0.928,-1.504 -0.64,-0.544 -1.664,-0.544 -1.12,0 -1.824,0.608 -0.672,0.608 -0.672,1.536 0,0.96 0.544,1.472 0.544,0.512 1.632,0.736 l 1.248,0.256 q 1.792,0.352 2.88,1.504 1.12,1.12 1.12,2.976 0,1.92 -1.376,3.168 -1.344,1.216 -3.68,1.216 z"],tV=dR+'<path d="'+eV.join('"/><path d="')+'"/></g>',uR=KM+QM+"<g>"+or([60,99,105,114,99,108,101,32,99,120,61,34,49,53,52,34,32,99,121,61,34,54,48,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,114,61,34,49,46,53,34,32,102,105,108,108,61,34,119,104,105,116,101,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,47,62])+tV+or([60,99,105,114,99,108,101,32,99,120,61,34,49,54,49,46,53,48,49,53,55,34,32,99,121,61,34,51,54,46,50,53,56,53,52,57,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,102,105,108,108,61,34,35,102,102,102,102,102,102,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,32,114,61,34,49,46,53,34,32,47,62,60,47,103,62,60,47,115,118,103,62]),rV=or([60,97,32,104,114,101,102,61,34])+Bx+or([34,32,116,97,114,103,101,116,61,34,95,98,108,97,110,107,34,32,116,105,116,108,101,61,34])+cR+'">'+uR+"</a>",Fx=null;function cc(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let a=function(){l.disconnect(),cc(i,!0,s)};r||console.log(hR),Fx&&window.clearInterval(Fx),e&&e.parentNode&&e.parentNode.removeChild(e);let t=["right","left"][Math.floor(Math.random()*2)],n=["top","bottom"][Math.floor(Math.random()*2)],s=new DOMParser().parseFromString(rV,"text/html").body.childNodes[0];s.style.position="absolute",s.style[t]="1rem",s.style[n]="1rem",s.style.zIndex="0",s.style.opacity="0.8",s.setAttribute("href",Bx),s.setAttribute("target","_blank"),s.setAttribute("title",cR),i.appendChild(s);let l=new MutationObserver((h,d)=>{a()});l.observe(s,{attributes:!0,subtree:!0,childList:!0}),Fx=window.setInterval(()=>a(),25e3)}}var Ux=null;function Yx(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let u=function(){p.disconnect(),Yx(i,!0,n)};r||console.log(hR),Ux&&window.clearInterval(Ux),e&&e.parentNode&&e.parentNode.removeChild(e);let n=new DOMParser().parseFromString(uR,"text/html").body.childNodes[0];i.appendChild(n);let o=parseInt(i.getAttribute("width"),10),s=parseInt(i.getAttribute("height"),10),a=n.getBBox(),l=a.height/a.width,h=parseInt(n.getAttribute("width"),10),d=l*h;n.setAttribute("transform",`translate(${o-h-10}, ${s-d-10})`);let p=new MutationObserver((m,g)=>{u()});p.observe(n,{attributes:!0,subtree:!0,childList:!0}),Ux=window.setInterval(()=>u(),25e3)}}var pR="vjs-orthogonal-handle",bg="vjs-orthogonal-segment-drag",mR="vjs-orthogonal-segment-drag-ns",gR="vjs-orthogonal-segment-drag-ew";var nV=10,iV=20,go=class extends co{constructor(e,t){super(e,t);c(this,"segments");c(this,"segmentHandles");c(this,"geometry");c(this,"$supportsHoverMode",!0);this.segments=[],this.segmentHandles=[],this.$addDragHandler({selector:"."+bg+" *",target:"."+bg,drag:n=>{let o=n.el.Wt,s={x:Math.floor(n.translatedPosition.x),y:Math.floor(n.translatedPosition.y)},a=xv(this.current,this.currentConnector,o.segment,s);a!=null&&(o.connection.connector.geometry.segments=a.segments,o.connection.connector.edited=!0,this.$hasEdits=!0,this.segments.length=0,this.geometry.segments=a.segments,Array.prototype.push.apply(this.segments,this.geometry.segments),o.segment=this.geometry.segments[a.index],this.$repaintConnection({segmentInfo:o,segmentIndex:a.index}))},constrainFunction:function(n,o,s,a,l,h){let d=o.Wt,u=d.segment.x1===d.segment.x2,p={x:n.x,y:n.y};return u?p.y=(d.segment.y1+d.segment.y2)/2-a.height/2:p.x=(d.segment.x1+d.segment.x2)/2-a.width/2,p},stop:n=>{this.ig(!0),this.$updateModel(zr(n.el.Wt.connection.connector),this.$generatedGeometry)},start:n=>{this.$generatedGeometry=zr(n.el.Wt.connection.connector)}})}og(e,t){e.el.style.visibility="visible";let n=this.ui.$getSize(e.el.childNodes[0]),o=t[0]-n.width/2,s=t[1]-n.height/2;Ne(e.el,{x:o,y:s})}$repaint(e){this.bn(e);for(let t=0;t<this.segmentHandles.length;t++)if(this.segmentHandles[t].segment=this.geometry.segments[t+1],la(this.segmentHandles[t].segment)>0){let n=[(this.segmentHandles[t].segment.x1+this.segmentHandles[t].segment.x2)/2,(this.segmentHandles[t].segment.y1+this.segmentHandles[t].segment.y2)/2];this.og(this.segmentHandles[t],n)}else this.segmentHandles[t].el.style.visibility="hidden"}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].el!==e&&this.ui.$removeElement(this.segmentHandles[t].el)}$activate(e,t){this.$hasEdits=!1,this.bn(),this.currentConnector.edited=!0}$elementDragged(e){this.ig(!0)}$elementDragging(e){this.$repaint()}bn(e){e=e||{};let t=e.segmentInfo,n=e.segmentIndex;if(this.geometry=lt(this.current.connector.geometry),this.geometry&&this.geometry.segments){this.$clearHandles(t?t.el:null),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let o=1;o<this.segments.length-1;o++)if(t==null||o!==n){let s=[(this.segments[o].x1+this.segments[o].x2)/2,(this.segments[o].y1+this.segments[o].y2)/2],a=s[0],l=s[1],h=this.segments[o].o===sd,d=this.$makeOrthogonalHandle(h,a,l,iV,nV,[Hn,pR,bg,h?gR:mR].join(" "),!0),u={el:d,segment:this.segments[o],vertical:h,edge:this.currentEdge,connection:this.current};d.Wt=u,this.segmentHandles.push(u),this.og(u,s)}else o===n&&this.segmentHandles.push(t)}}ig(e){this.current&&this.$hasEdits&&(bv(this.currentConnector),e&&this.$repaintConnection())}$makeOrthogonalHandle(e,t,n,o,s,a,l){let h=e?s:o,d=e?o:s;return this.$makeAndAppendRectangularHandle(t,n,h,d,3,3,a,l)}};c(go,"type",aa);Lr.set(go.type,go);function ER(){Lr.set(go.type,go)}var dc="vjs-straight-handle",Ts="vjs-straight-segment-drag",Ag="vjs-straight-segment-split",Sg="vjs-straight-segment-delete",fR="vjs-straight-editor-guideline";var Tg=class{constructor(r){this.editor=r;c(this,"splitListener");c(this,"deleteListener");this.splitListener=(e=>{let t=e.target.closest(z(Ag)).Wt;this.editor.$split(t.index,t.midPoint)}).bind(this),this.deleteListener=(e=>{let t=e.target.closest(z(Sg)).Wt;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){this.editor.ui.on(this.editor.ui.getContainer(),W,z(Ag),this.splitListener),this.editor.ui.on(this.editor.ui.getContainer(),W,z(Sg),this.deleteListener)}$deactivate(r){this.editor.ui.off(this.editor.ui.getContainer(),W,this.splitListener),this.editor.ui.off(this.editor.ui.getContainer(),W,this.deleteListener)}$appendHandles(r){let e=r.segment,t={x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2},n={x:(e.x2+t.x)/2,y:(e.y2+t.y)/2},o=t,s=this.editor.$makeAndAppendCircularHandle(o.x,o.y,this.editor.buttonSize,this.editor.buttonSize,[Hn,dc,Ag].join(" "),!0);s!=null&&r.buttons.push(s);let a=this.editor.segments.length>1?this.editor.$makeAndAppendDeleteHandle(n.x,n.y,this.editor.buttonSize,this.editor.buttonSize,[Hn,dc,Sg].join(" "),!0):null;a!=null&&r.buttons.push(a)}$repaintEnded(){}$repaintStarted(){}};var zx="vjs-straight-connector-edit",yR="click",bHe="auto";var vg=class{constructor(r){this.editor=r;c(this,"nc");c(this,"ic");c(this,"$segmentToDrag");c(this,"$pageEvent");this.nc=(e=>{if(this.editor.current&&this.editor.current.id===e.obj.id){this.$pageEvent=e.e;let t=Ee(e.e),n=this.editor.ui.fromPageLocation(t.x,t.y);ie(e.e);let o=kT(e.connection.connector,n.x,n.y);this.$segmentToDrag=o.index+1,this.editor.$split(o.index,{x:o.x,y:o.y})}}).bind(this),this.ic=(e=>{let t=e.target.closest(z(Ts)).Wt;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){Wr(r,zx),this.editor.ui.bind(Fl,this.nc),this.editor.ui.on(this.editor.ui.getContainer(),W,`${z(Ts)} *`,this.ic)}$appendHandles(r){}$deactivate(r){this.editor.ui.unbind(Fl,this.nc),this.editor.ui.off(this.editor.ui.getContainer(),W,this.ic),this.editor.current!=null&&Or(this.editor.current,zx)}$repaintEnded(){if(this.$segmentToDrag!=null){let r=this.editor.segmentHandles[this.$segmentToDrag];this.editor.ui.trigger(r.el.childNodes[0],me,this.$pageEvent)}this.$segmentToDrag=null,this.$pageEvent=null}$repaintStarted(){}};var Eo=class extends co{constructor(e,t){super(e,t);c(this,"$mode");c(this,"$showGuidelines");c(this,"geometry");c(this,"segments",[]);c(this,"segmentHandles",[]);c(this,"guideLine");c(this,"$supportsHoverMode",!0);this.segments=[],this.$mode=t.splitMode===yR?new Tg(this):new vg(this),this.$showGuidelines=t.showGuidelines!==!1,this.$addDragHandler({selector:"."+Ts+" *",target:"."+Ts,drag:n=>{let o=n.el.Wt,s=n.translatedPosition.x-n.originalTranslatedPosition.x,a=n.translatedPosition.y-n.originalTranslatedPosition.y;o.focus.x1=o.originalLocation.x+s,o.focus.y1=o.originalLocation.y+a,this.currentConnector.geometry.segments[o.index]=o.focus,o.previous&&(o.previous.x2=o.focus.x1,o.previous.y2=o.focus.y1,this.currentConnector.geometry.segments[o.index-1]=o.previous),this.currentConnector.edited=!0,this.$repaintConnection()},constrainFunction:function(n,o,s,a,l,h){return n},stop:n=>{this.$updateModel(zr(this.currentConnector),this.$generatedGeometry)},start:n=>(this.$generatedGeometry=zr(this.currentConnector),!0)})}$split(e,t){let n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments,s=o[e],a={x1:s.x1,y1:s.y1,x2:t.x,y2:t.y};o[e].x1=t.x,o[e].y1=t.y,o.splice(e,0,a),this.currentConnector.edited=!0,this.$updateModel(zr(this.currentConnector),n)}$deleteSegment(e){let t=e.index,n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments;t===0?(o[1].x1=e.focus.x1,o[1].y1=e.focus.y1):t<o.length-1?(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2,o[t+1].x1=e.focus.x2,o[t+1].y1=e.focus.y2):t===o.length-1&&(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2),o.splice(t,1),this.currentConnector.edited=!0,this.$updateModel(zr(this.currentConnector),n)}$activate(e,t){this.$mode.$activate(e,t),this.$repaint()}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].index!==e&&this.segmentHandles[t].buttons.forEach(n=>this.ui.$removeElement(n));this.guideLine&&this.guideLine.parentNode&&this.guideLine.parentNode.removeChild(this.guideLine)}$elementDragged(e){}$elementDragging(e){this.$repaint()}$repaint(e){e=e||{};let t=e.segmentInfo;if(this.$mode.$repaintStarted(),this.geometry=this.current.connector.geometry,this.geometry&&this.geometry.segments){this.$clearHandles(),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let n=0;n<this.segments.length;n++)if(t==null||n!==t.index){let o=this.segments[n],s={x:(o.x1+o.x2)/2,y:(o.y1+o.y2)/2},a=null;n>0&&(a=this.$makeAndAppendCircularHandle(this.segments[n].x1,this.segments[n].y1,this.buttonSize,this.buttonSize,[Hn,dc,Ts].join(" "),!0));let l={buttons:[],focus:o,previous:n>=0?this.segments[n-1]:null,index:n,originalLocation:{x:o.x1,y:o.y1},midPoint:s,el:a,edge:this.currentEdge,segment:this.segments[n],connection:this.current};this.$mode.$appendHandles(l),a!=null&&l.buttons.push(a),l.buttons.forEach(h=>h.Wt=l),this.segmentHandles.push(l)}this.Ib()}this.$mode.$repaintEnded()}Ib(){if(this.$showGuidelines&&this.currentConnector.smooth&&this.segments.length>1){this.guideLine=G(Le,{width:10,height:10}),this.guideLine.style.overflow="visible",this.ui.$addClassToElement(this.guideLine,[fR,Im].join(" "));let e=this.segments[this.segments.length-1],t=`M ${this.segments[0].x1}, ${this.segments[0].y1} `;for(let o=0;o<this.segments.length;o++)t+=`L ${this.segments[o].x2}, ${this.segments[o].y2} `;t+=`L ${e.x2}, ${e.y2}`;let n=G(ee,{d:t});this.guideLine.appendChild(n),this.ui.$appendElementToToolsLayer(this.guideLine,!0)}}deactivate(e){this.$mode.$deactivate(e),super.deactivate(e)}};c(Eo,"type",In);Lr.set(Eo.type,Eo);function xR(){Lr.set(Eo.type,Eo)}var uc="vjs-bezier-handle",Xx="vjs-bezier-handle-control-point",bR="vjs-bezier-handle-control-point-1",AR="vjs-bezier-handle-control-point-2",SR="vjs-bezier-guideline";var vi=class extends co{constructor(e,t){super(e,t);c(this,"$supportsHoverMode",!1);c(this,"h1");c(this,"h2");c(this,"l1");c(this,"l2");c(this,"lockHandles");c(this,"St");c(this,"Fe");c(this,"Zt");c(this,"oc");c(this,"sc");c(this,"sg",{x:0,y:0});c(this,"ag",{x:0,y:0});this.St=t.handleSize||hg,this.$addDragHandler({selector:"."+uc+" *",target:"."+uc,constrainFunction:function(n,o,s,a,l,h){return n},drag:n=>{let o=n.translatedPosition.x-n.originalTranslatedPosition.x,s=n.translatedPosition.y-n.originalTranslatedPosition.y,a=n.el.idx;if(o!==0||s!==0){this.$hasEdits=!0;let l=a===0?this.Fe:this.Zt,h=a===0?this.sg:this.ag;l.x=h.x+o,l.y=h.y+s,this.$repaint(),this.$repaintConnection()}},stop:n=>{this.$hasEdits&&this.$updateModel(this.$cloneCurrentGeometry(),this.$generatedGeometry)},start:n=>(this.$hasEdits=!1,this.$generatedGeometry=this.$cloneCurrentGeometry(),this.sg=Object.assign({},this.Fe),this.ag=Object.assign({},this.Zt),!0)})}$activate(e,t){this.lg(),this.hg(),this.Vb((t==null?void 0:t.guidelines)!==!1),this.$hasEdits=!1,this.currentConnector.edited=!0}$clearHandles(){this.h1&&this.h1.parentNode.removeChild(this.h1),this.h2&&this.h2.parentNode.removeChild(this.h2),this.l1&&this.l1.parentNode.removeChild(this.l1),this.l2&&this.l2.parentNode.removeChild(this.l2),this.h1=null,this.h2=null,this.l1=null,this.l2=null}$elementDragged(e){this.$repaint()}$elementDragging(e){this.$repaint()}$repaint(e){this.lg(),this.hg(),this.cg(),this.Mb()}Vb(e){this.h1=this.$makeAndAppendCircularHandle(this.Fe.x,this.Fe.y,this.St,this.St,[Hn,uc,Xx,bR].join(" ")),this.h2=this.$makeAndAppendCircularHandle(this.Zt.x,this.Zt.y,this.St,this.St,[Hn,uc,Xx,AR].join(" ")),this.h1.idx=0,this.h2.idx=1,this.h1.style.display=Pr,this.lockHandles||(this.h2.style.display=Pr),this.l1=this.dg(this.oc,this.Fe.x,this.Fe.y),this.l2=this.dg(this.sc,this.Zt.x,this.Zt.y),this.ui.$appendElementToToolsLayer(this.l1,!0),this.ui.$appendElementToToolsLayer(this.l2,!0),this.l1.style.display=e?Pr:pt,this.l2.style.display=e?Pr:pt,this.cg()}cg(){this.$setElementPosition(this.h1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.Zt;this.$setElementPosition(this.h2,e.x,e.y)}dg(e,t,n){let o=G(Le,{width:5,height:5}),s=G(ee,{d:"M 0 0 L 1 1"});return o.appendChild(s),this.ui.$addClassToElement(o,SR),this.ui.$addClassToElement(o,Im),this.lc(e,o,t,n),o}Mb(){this.lc(this.oc,this.l1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.Zt;this.lc(this.sc,this.l2,e.x,e.y)}lc(e,t,n,o){pn(t,e);let s=n-e.x,a=o-e.y;de(t.childNodes[0],{d:`M 0 0 L ${s} ${a}`})}hg(){this.currentConnector&&(this.Fe=this.currentConnector.geometry.segments[0].cp1,this.Zt=this.currentConnector.geometry.segments[0].cp2)}lg(){this.current&&(this.oc={x:this.current.anchors.source.computedPosition.curX,y:this.current.anchors.source.computedPosition.curY},this.sc={x:this.current.anchors.target.computedPosition.curX,y:this.current.anchors.target.computedPosition.curY})}};c(vi,"type",jo);var fo=class extends vi{constructor(r,e){super(r,e),this.lockHandles=!0}};c(fo,"type",zu);Lr.set(vi.type,vi),Lr.set(fo.type,fo);function TR(){Lr.set(vi.type,vi),Lr.set(fo.type,fo)}var vR="selected-vertices",pc=class extends Oa{constructor(e,t,n,o,s){var h,d,u,p,m,g,E,y,x;super(e,t,n,o,s,bn(o.defaults||{},{managedElementsSelector:Ae(mt,hn)}));this.model=e;c(this,"canvasElement");c(this,"vertexLayer");c(this,"toolsLayer");c(this,"vertexGroup");c(this,"edgeGroup");c(this,"labelGroup");c(this,"Jn");c(this,"zoomOptions");c(this,"panOptions");c(this,"panZoom");c(this,"$wheelReverse");c(this,"$edgePathEditor");c(this,"$edgeInputMethod");c(this,"$editEdgesOnTap");c(this,"hc");c(this,"dragOptions");c(this,"elementDragHandler");c(this,"ug");c(this,"mode",Sr);if(this.Jn=dO(o.decorators,this,n),this.$suspendRendering=!1,this.zoomOptions=o.zoom,this.panOptions=o.pan,n.vA=this,o.events)for(let f in o.events)this.bindUnchecked(f,o.events[f]);o.useSvgContainer?(this.canvasElement=Kr(Gt,Le,{position:"absolute",left:"0",top:"0"},yy,{width:5,height:5,x:0,y:0},this.rootElement,!0),this.vertexLayer=Kr(Gt,Le,{overflow:"visible"},"vjs-vertex-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.vertexGroup=Kr(Gt,q,{},"vjs-vertex-group",{},this.vertexLayer),this.edgeGroup=Kr(Gt,q,{},"vjs-edge-group",{},this.vertexLayer,((h=o.edges)==null?void 0:h.layerIndex)===0),this.labelGroup=Kr(Gt,q,{},"vjs-label-group",{},this.vertexLayer)):(this.canvasElement=Kr(null,Ke,{position:"relative",width:jr,height:jr},yy,{},this.rootElement,!0),this.vertexLayer=Kr(null,Ke,{left:0,top:0,position:"absolute",width:jr,height:jr},"vjs-vertex-layer",{},this.canvasElement)),this.toolsLayer=Kr(Gt,Le,{overflow:"visible",left:0,top:0},"vjs-tools-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.setContainer(this.canvasElement),cc(this.rootElement,!1),this.hc=o.elementsDraggable!==!1,this.hc===!1&&this.canvasElement.setAttribute(vv,ct),this.dragOptions=o.dragOptions||{},this.elementDragHandler=new xg({ui:this,draggableInstance:this,resolveGrid:()=>this.getGrid()}),o.edges!=null&&(o.edges.editable===!0&&(this.$edgePathEditor=new Na(this,{activeMode:o.edges.activeEdit!==!1}),this.addDragClassnameFilter(Da),this.$editEdgesOnTap=o.edges.editOnTap!==!1),this.$edgeInputMethod=o.edges.inputMethod||zn),this.ug=new Dm({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,method:this.$edgeInputMethod,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,Il:f=>{L(this.rootElement,Fn)},Gl:f=>{F(this.rootElement,Fn)},Vl:f=>{},Ml:f=>{F(this.rootElement,Fn)}}),new Nm({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,method:this.$edgeInputMethod,inputHandler:this.ug}),this.dragOptions.filter!=null&&this.elementDragHandler.$addVertexDragFilter(this.dragOptions.filter),this.dragOptions.cssFilter!=null&&this.elementDragHandler.addSelectorFilter(this.dragOptions.cssFilter),this.elementDragHandler.addClassnameFilter(op),this.$wheelReverse=o.wheel&&o.wheel.reverse===!0,L(this.rootElement,Ey),Gn()&&L(this.rootElement,bP),Ei()&&L(this.rootElement,AP),((d=o.pan)==null?void 0:d.enabled)===!1&&L(this.rootElement,fy);let a=(f,b,A)=>{let T=S=>{let R=S.srcElement||S.target;if(R===this.rootElement||R===this.canvasElement||this.panZoom!=null&&this.panZoom.isBackgroundElement(R)){let v=S.button===2&&A!=null?A:b;this.fireUnchecked(v,this,S),b===_n&&this.$editEdgesOnTap&&this.stopEditingPath()}};this.on(this.rootElement,f,T)};a(W,_n,At),a(Ur,wS),this.panZoom=new La({viewport:this.viewport,viewportElement:this.rootElement,canvasElement:this.canvasElement,elementPositionSetter:(f,b)=>Ne(f,b),consumeRightClick:o.consumeRightClick,idFunction:f=>this.k(f),fixedTransformOrigin:(u=this.zoomOptions)==null?void 0:u.fixedTransformOrigin,enablePan:((p=o.pan)==null?void 0:p.enabled)!==!1,panWithMetaKey:(m=o.pan)==null?void 0:m.useMetaKey,wheel:this.Gb(o),enableAnimation:o.enableAnimation,clamp:o.clamp,clampToBackground:o.clampToBackground,clampToBackgroundExtents:o.clampToBackgroundExtents,panFilter:(g=o.pan)==null?void 0:g.filter,events:{panStart:()=>{L(this.rootElement,Sy),L(document.body,gt)},[Fi]:(f,b,A,T,S)=>{this.fire(Fi,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[$r]:(f,b,A,T,S)=>{A=super.setZoom(A),this.fire($r,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[ae]:()=>{F(this.rootElement,Sy),F(document.body,gt)}},zoom:(E=o.zoom)==null?void 0:E.initialValue,zoomRange:(y=o.zoom)==null?void 0:y.range,zoomStep:(x=o.zoom)==null?void 0:x.step}),o.modelEvents&&o.modelEvents.forEach(f=>{this.bindModelEvent(f.event,f.selector,b=>{setTimeout(()=>f.callback(b),0)})}),this.bindModelEvent(W,z(sp),f=>{if(!f.event.defaultPrevented){let b=f.objectInfo.obj;if(b!=null){let A=this.view.getEdgeDefinition(this.model.getEdgeType(b));A.deleteConfirm?A.deleteConfirm({edge:f.objectInfo.obj,e:f.event},()=>this.model.removeEdge(b)):this.model.removeEdge(b)}}}),this.Pu(o),this.$dataLoadStart();let l=this.cu();this.$dataLoadEnd(!l)}$getCanvasElement(){return this.canvasElement}$getDragViewportContainer(){return this.rootElement}$isDraggingSupported(){return!0}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el)),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el),e.removeChildren===!1))for(let n=0;n<e.children.length;n++){let o=this.$getManagedElement(e.children[n].id);o&&this.panZoom.restore(o)}return t}$afterRefresh(e){this.$afterRelayout(e)}$b(e,t){e.decorate({surface:this,adapter:this.$_layout.adapter,layout:this.$_layout,setAbsolutePosition:(n,o)=>{Ne(n,o)},model:this.model,bounds:t.bounds,positions:t.positions,fixElement:(n,o,s,a)=>{if(a!=null){let h=Array.from(e.fixedElements).find(d=>d.id===a);h!=null&&this.unfixElement(h.el)}let l=Array.from(e.fixedElements).find(h=>h.el===n);return l==null&&(l=this.fixElement(n,o,s,a),e.fixedElements.add(l)),l},floatElement:(n,o)=>{let s=Array.from(e.floatedElements).find(a=>a.el===n);return s==null&&(s={el:n,pos:o,constraints:{}},this.floatElement(n,o),e.floatedElements.add(s)),s},appendElement:(n,o,s)=>{let a=Array.from(e.appendedElements).find(l=>l.el===n);if(a==null){a={el:n,pos:o,constraints:s};let l=o.x,h=o.y,d=null;this.canvasElement.appendChild(n),this.panZoom.add(n,!0),s&&s.alignX&&s.alignX===yt&&(d=d||We(n),l-=d.width),s&&s.alignY&&s.alignY===ht&&(d=d||We(n),h-=d.height),Ne(n,{x:l,y:h}),e.appendedElements.add(a)}return a}})}$afterRelayout(e){for(let t=0;t<this.Jn.length;t++)this.$b(this.Jn[t],e);super.$afterRelayout(e)}$zoomToFit(e){this.panZoom.zoomToFit(e)}$zoomToFitIfNecessary(e){this.panZoom.zoomToFitIfNecessary(e)}zu(e){this.panZoom.$computeCompoundZoom()}$startPanRepeat(e,t,n,o,s,a){this.panZoom.startPanRepeat(e,t,n,o,s,a)}$stopPanRepeat(){this.panZoom.stopPanRepeat()}$canStartElementDrag(){return this.hc!==!1&&(this.mode===Sr||this.mode===bi)}$zoomToElements(e){this.panZoom.zoomToElements(e)}$getNodesInViewport(){return this.As(he.objectType,this.panZoom.viewportElement)}$getGroupsInViewport(){return this.As(oe.objectType,this.panZoom.viewportElement,e=>this.$getGroupContentAreaElement(e))}$edgeTap(e){this.$editEdgesOnTap===!0&&this.startEditingPath(e.obj)}Gb(e){var a,l,h,d,u;let t=((a=e.zoom)==null?void 0:a.wheel)!==!1,n=((l=e.pan)==null?void 0:l.wheel)===!0,o=((h=e.pan)==null?void 0:h.axis)||"both",s=(d=e.wheel)==null?void 0:d.cssFilter;return{filter:(u=e.wheel)==null?void 0:u.filter,cssFilter:s,reverse:e.wheel!=null?e.wheel.reverse===!0:!1,pan:n,zoom:t,useMetaKey:e.wheel!=null?e.wheel.useMetaKey===!0:!1,axis:o}}$graphClearStart(){super.$graphClearStart();for(let e=0;e<this.Jn.length;e++)this.Jn[e].reset({remove:t=>t.parentNode&&t.parentNode.removeChild(t)});this.panZoom.reset(),this.oe(e=>e.reset())}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.toolsLayer,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.vertexLayer,t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.vertexGroup:this.vertexLayer,t)}$appendEdgeElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.edgeGroup:this.vertexLayer,t)}$_attachEdgePathEditor(e){this.$edgePathEditor=e,ER(),xR(),TR()}$addToDragGroup(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.ng(e,...n)}$_assignRemoveFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}$select(e){if(super.$select(e),K(e.obj)||Y(e.obj)){let t=this.$getManagedElement(e.obj.id);t&&this.elementDragHandler.ng({id:vR,active:!0,membership:Ha},t)}}$deselect(e){if(super.$deselect(e),K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.removeFromDragGroup(t)}}$selectionCleared(e){super.$selectionCleared(e),this.clearDragGroup(vR)}save(e){let t=super.save(e);return Object.assign(t,{pan:Object.assign({},this.getPan()),transformOrigin:Object.assign({},this.panZoom.transformOrigin)})}load(e,t){let n=()=>{e.pan&&this.setPan(e.pan.x,e.pan.y),e.transformOrigin&&this.panZoom.setTransformOrigin(e.transformOrigin.x,e.transformOrigin.y),t&&t()};super.load(e,n)}startEditingPath(e,t){this.$edgePathEditor!=null?this.$edgePathEditor.startEditing(e,t):U("ERROR: cannot start path edit - surface not created with 'edges:{editable:true}'")}stopEditingPath(){this.$edgePathEditor!=null?this.$edgePathEditor.stopEditing():U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'")}clearPathEdits(e){return this.$edgePathEditor!=null?this.$edgePathEditor.clearEdits(e):(U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'"),!1)}getVisibleCanvasBounds(){return this.panZoom.getVisibleContentArea()}addDragFilter(e,t){this.elementDragHandler.addDragFilter(e,null,t)}addDragClassnameFilter(e){this.elementDragHandler.addClassnameFilter(e)}addDragSelectorFilter(e){this.elementDragHandler.addSelectorFilter(e)}addVertexDragFilter(e){this.elementDragHandler.$addVertexDragFilter(e)}removeDragClassnameFilter(e){this.elementDragHandler.removeClassnameFilter(e)}addWheelSelectorFilter(e){this.panZoom.$addWheelSelectorFilter(e)}addToDragGroup(e,...t){let n=j(e)?{id:e,active:!0,membership:Ha}:Object.assign(e,{membership:Ha});this.$addToDragGroup(n,...t)}removeFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}setDragGroupState(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.$setDragGroupState(e,...n)}clearDragGroup(e){this.elementDragHandler.$clearDragGroup(e)}attachMiniview(e){this.addPlugin({type:Wn.type,options:e})}magnetizeAtEvent(e){let t=this.fromPageLocation(e.pageX,e.pageY);this.magnetizeAtPoint(t)}destroy(){let e;for(let t=0;t<this.Ka.length;t++)try{e=this.Ka[t],this.dataSource.unbind(e.event,e.fn)}catch(n){U("WARN: Could not unbind event "+e.event+" during destroy operation.")}this.canvasElement.parentNode.removeChild(this.canvasElement),F(this.rootElement,Ey),F(this.rootElement,xP),F(this.rootElement,fy),this.oe(t=>{t.destroy()}),this.panZoom.destroy(),this.panZoom=null,this.$edgePathEditor!=null&&this.$edgePathEditor.destroy(),this.fire($i,this),super.destroy()}zoomToBackground(e){this.panZoom.zoomToBackground(e)}zoomToDecorator(e){let t=j(e.decorator)?this.getDecorator(e.decorator):e.decorator;if(t!=null){let n=this.getViewportBoundsInfo(),o=t.getBounds();this.panZoom.zoomToExtents(Object.assign(e,{extents:[n,o]}))}}zoomToExtents(e){this.panZoom.zoomToExtents(e)}mapEventLocation(e){return this.panZoom.mapEventLocation(e)}centerContent(e){this.panZoom.centerContent(e)}centerContentHorizontally(e){this.panZoom.centerContentHorizontally(e)}centerContentVertically(e){this.panZoom.centerContentVertically(e)}centerBackground(e){this.panZoom.centerBackground(e)}alignBackground(e,t){this.panZoom.alignBackground(e,t)}zoomToSelection(e){e=e||{};let t=()=>e.filter?this.model.filter(e.filter):this.model.getSelection(),n=e.selection||t(),o=[];n.eachNode((s,a)=>{o.push(this.getRenderedElement(a.id))}),n.eachGroup((s,a)=>{o.push(this.getRenderedElement(a.id))}),o.length>0&&this.panZoom.zoomToElements({elements:o,fill:e.fill,doNotZoomIfVisible:e.doNotZoomIfVisible,doNotAnimate:e.doNotAnimate})}getPath(e){return new Pm(this.model.getPath(e),this)}setApparentCanvasLocation(e,t){return this.panZoom.setApparentCanvasLocation(e,t)}getViewportBoundsInfo(){return this.panZoom.getBoundsInfo()}$getFixedViewportBoundsInfo(){return null}getApparentCanvasLocation(){return this.panZoom.getApparentCanvasLocation()}addBackground(e){this.panZoom.addBackground(e)}removeBackground(e){this.panZoom.removeBackground(e)}setZoom(e,t){let n=this.panZoom.setZoom(e,t);return super.setZoom(n,t)}getDecorator(e){return this.Jn.find(t=>t.id===e)}setZoomRange(e,t){return this.panZoom.setZoomRange(e,t)}getZoomRange(){return this.panZoom.getZoomRange()}getZoom(){return this.panZoom.getZoom()}nudgeZoom(e,t){return this.panZoom.nudgeZoom(e,t)}nudgeWheelZoom(e,t){this.panZoom.nudgeWheelZoom(e,t)}zoomOut(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomOut(e)}zoomIn(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomIn(e)}getPan(){return this.panZoom.getPan()}pan(e,t,n){this.panZoom.pan(e,t,!n)}setPan(e,t,n,o){this.panZoom.setPan(e,t,n,o)}setPanAndZoom(e,t,n,o){this.setPan(e,t,o),this.setZoom(n,o)}pg(e){let t=null;return(Array.isArray(e)?e:[e]).forEach(o=>{let s=this.getObjectInfo(o,!1);if(s.el!=null){let a=this.viewport.getElementBounds(s.id);t=t==null?a:Fb(t,a)}}),t}centerOnAndZoom(e,t,n){let o=this.pg(e);o!=null&&this.panZoom.centerOnAndZoom({bounds:o,fillRatio:t,doNotAnimate:n})}centerOn(e,t){let n=this.pg(e);n!=null&&this.panZoom.centerOn({bounds:n,doNotAnimate:t})}centerOnHorizontally(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnHorizontally({bounds:this.viewport.getElementBounds(t.id)})}centerOnVertically(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnVertically({bounds:this.viewport.getElementBounds(t.id)})}setClamping(e){this.panZoom.setClamping(e)}setViewportCenter(e){this.panZoom.setViewportCenter(e)}isPageLocationInViewport(e,t){return this.panZoom.isInViewport(e,t)}fromPageLocation(e,t,n){return this.panZoom.fromPageLocation(e,t,n)}fromWindowLocation(e,t,n){return this.panZoom.fromWindowLocation(e,t,n)}toPageLocation(e,t){return this.panZoom.toPageLocation(e,t)}toViewportLocation(e,t){return this.panZoom.toViewportLocation(e,t)}bindModelEvent(e,t,n){let o=(s,a)=>{let l=this.getObjectInfo(a,!0);l.obj!=null&&setTimeout(()=>n({event:s,eventTarget:a,objectInfo:l,model:this.model,ui:this}),0)};n.mg=o,this.on(this.vertexLayer,e,t,o)}unbindModelEvent(e,t){t.mg!=null&&this.off(this.vertexLayer,e,t.mg)}cloneVertex(e,t){let n=super.cloneVertex(e,t);return n!=null&&(t==null?void 0:t.flash)===!0&&setTimeout(()=>{this.flashVertex(n)}),n}getEffectiveVisibleZoom(){let e=this.panZoom.getCompoundZoom();return this.currentZoom*e}isInViewport(e,t){return this.panZoom.isInViewport(e,t)}fixElement(e,t,n,o,s){return e.style.position=qe,this.panZoom.fixElement(e,t,n,o,s)}unfixElement(e){this.panZoom.unfixElement(e)}floatElement(e,t){this.panZoom.floatElement(e,t)}setMode(e,t){let n={[Sr]:()=>{this.panZoom.setEnabled(!0)},[bi]:()=>{this.panZoom.setEnabled(!1)},[hs]:()=>{this.panZoom.setEnabled(!1)},[jn]:()=>{this.panZoom.setEnabled(!1)}};n[e]?(this.mode=e,n[e](),e===bi&&!t&&this.model.clearSelection(),this.fire(Rn,e)):U("Surface: unknown mode '"+e+"'")}alignContent(e){this.panZoom.alignContent(e)}alignContentTop(e){this.panZoom.alignContentTop(e)}alignContentBottom(e){this.panZoom.alignContentBottom(e)}alignContentLeft(e){this.panZoom.alignContentLeft(e)}alignContentRight(e){this.panZoom.alignContentRight(e)}};c(pc,"type","Surface");var jx=class extends Eu{fetchUrl(r){xa(r)}render(r,e,t){let n=e!=null&&e.useSvgContainer?Ra:_a,o=t||Uh(n,e==null?void 0:e.useSvgContainer,e);return sV(this,r,o,e)}renderDiagram(r,e){return new yg(this,r,e)}renderPaper(r,e,t,n){let o=e!=null&&e.useSvgContainer?Ra:_a,s=n||Uh(o,e==null?void 0:e.useSvgContainer,{});return aV(this,r,s,e,t)}};function En(i){return i=i||{},new jx(i)}function oV(i,r){i.bind(Kt,e=>{r.$nodeAdded(e)}),i.bind(Zt,e=>{r.$groupAdded(e)}),i.bind(ve,e=>{r.$nodeRemoved(e)}),i.bind(_e,e=>{r.$groupRemoved(e)}),i.bind(ur,e=>{r.$edgeAdded(e)}),i.bind(bt,e=>{r.$edgeRemoved(e)}),i.bind(Cn,()=>{r.$graphClearStart(),r.$graphClearEnd()})}function sV(i,r,e,t){return CR(i,r,e,(n,o,s,a,l)=>new pc(n,s||n,a,o,l),t)}function CR(i,r,e,t,n){let o,s=Object.assign({dataSource:i},n||{});s.selection!=null&&(typeof s.selection!="function"?o=s.selection:o=new pr(i,{generator:s.selection}));let a=s.id||B(),l=t(i,s,o,r,e);return o!=null&&oV(o,l),i.$addRenderer(l,a),l}function aV(i,r,e,t,n){return CR(i,r,e,(o,s,a,l,h)=>new mc(o,a||o,l,s,h,n),t)}var lV=i=>i.map(r=>String.fromCodePoint(r)).join(""),hV=[99,114,101,97,116,101,69,108,101,109,101,110,116];function cV(){return document}var PR=i=>cV()[lV(hV)](i);var mc=class extends Oa{constructor(e,t,n,o,s,a){super(e,t,n,o,s,a);this.model=e;c(this,"$canvas");c(this,"$margin");c(this,"$horizontalAlign");c(this,"$verticalAlign");c(this,"$scale");this.id=o.id||B(),this.$margin=o.margin||oP,this.$horizontalAlign=o.horizontalAlign||o.align||ns,this.$verticalAlign=o.verticalAlign||o.align||ns,this.$scale=o.scale!==!1,o.useSvgContainer?this.$canvas=G(Le,{width:"100%",height:"100%"}):(this.$canvas=PR("div"),this.$canvas.style.transformOrigin="0 0"),new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.syncView()})}).observe(this.rootElement),L(this.rootElement,rP),L(this.$canvas,iP),n.appendChild(this.$canvas),this.$scale||L(this.rootElement,nP),this.setContainer(this.$canvas),cc(this.rootElement,!1),this.bindAll([Pn,Zs,Vt,Gr,ve,_e,Fr,Br,On,hS,Ws],()=>{this.syncView()}),this.Pu(o),this.$dataLoadStart();let h=this.cu();this.$dataLoadEnd(!h)}$getCanvasElement(){return this.$canvas}syncView(){let e=this.viewport.je,t=We(this.rootElement),n=e.xmax-e.xmin,o=e.ymax-e.ymin,s=t.width-2*this.$margin,a=t.height-2*this.$margin,l=s/n,h=a/o,d=Math.min(l,h),u=n*d,p=o*d;if(wt(this.$canvas))if(this.$scale){let m=0,g=0;switch(this.$horizontalAlign){case ns:break;case bh:m-=(s-d*n)/2;break;case Ah:m+=(s-d*n)/2;break}switch(this.$verticalAlign){case ns:break;case bh:g-=(a-d*o)/2;break;case Ah:g+=(a-d*o)/2;break}this.$canvas.setAttribute("transform",`translate(${m}, ${g})`),this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`)}else{let m=e.xmax-e.xmin,g=e.ymax-e.ymin;this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`),this.$canvas.style.width=`${m}px`,this.$canvas.style.height=`${g}px`}else if(this.$scale){let m=(-e.xmin+this.$margin)*d,g=(-e.ymin+this.$margin)*d;switch(this.$horizontalAlign){case bh:break;case ns:m+=(s-u)/2;break;case Ah:m+=s-u;break}switch(this.$verticalAlign){case bh:break;case ns:g+=(a-p)/2;break;case Ah:g+=a-p;break}this.$canvas.style.transform=`translateX(${m}px) translateY(${g}px) scale(${d})`}else{let m=-e.xmin+this.$margin,g=-e.ymin+this.$margin,E=e.xmax-e.xmin+2*this.$margin,y=e.ymax-e.ymin+2*this.$margin;this.$canvas.style.transform=`translateX(${m}px) translateY(${g}px) scale(1)`,this.$canvas.style.width=`${E}px`,this.$canvas.style.height=`${y}px`}}setMargin(e){this.$margin=e,this.syncView()}toPageLocation(e,t){return{x:e,y:t}}fromPageLocation(e,t,n){return{x:e,y:t}}fromWindowLocation(e,t,n){return{x:e,y:t}}mapEventLocation(e){return this.fromPageLocation(e.pageX,e.pageY)}getViewportBoundsInfo(){let e=We(this.getContainer()),t=this.viewport.getBoundsWidth(),n=this.viewport.getBoundsHeight(),o=e.width/t,s=e.height/n,a=Math.min(o,s);return{width:t,height:n,x:this.viewport.getX(),y:this.viewport.getY(),vw:e.width,vh:e.height,minimumFill:a,zoom:1}}$getFixedViewportBoundsInfo(){if(this.$scale)return null;{let e=this.getViewportBoundsInfo();return{x:e.x-this.$margin,y:e.y-this.$margin,width:e.width+2*this.$margin,height:e.height+2*this.$margin,vw:e.vw,vh:e.vh,zoom:e.zoom,minimumFill:e.minimumFill}}}getApparentCanvasLocation(){return{x:0,y:0}}addBackground(e){console.log("add background to paper - not implemented")}removeBackground(e){console.log("remove background from paper - not implemented")}zoomOut(e){}zoomIn(e){}getVisibleCanvasBounds(){return{x:0,y:0,width:100,height:100}}};function H4e(i,r,e,t){let n=En(e||{}),o=r!=null&&r.useSvgContainer?Ra:_a,s=Uh(o,r==null?void 0:r.useSvgContainer,{}),a=new mc(n,n,i,r,s,null);return n.$addRenderer(a,a.id),t&&a.model.load({data:t}),a}function dV(i,r,e){if($t(r,e,i))return r;{let t=r.parentNode;for(;t!=null&&t!==i;){if($t(t,e,i))return t;t=t.parentNode}}}function uV(i){return typeof i=="function"?(i.Eo=B(),i.Eo):i}function pV(i,r,e){let t=null,n=r.getAttribute("katavorio-draggable"),o=n!=null?"[katavorio-draggable='"+n+"'] ":"";for(let s=0;s<i.length;s++)if(i[s].selector==="."?t=r:t=dV(r,e,o+i[s].selector),t!=null){if(i[s].filter){let a=$t(e,i[s].filter,t);if(i[s].filterExclude===!0&&!a||a)return null}return[i[s],t]}return null}var OR="start",_R="beforeStart",RR="drag",mV="drop",gV="over",EV="out",LR="stop",wR="katavorio-draggable",fV=wR,yV=10,xV=10,Hx=function(){return!0},bV=function(){return!1},kx={delegatedDraggable:"katavorio-delegated-draggable",draggable:fV,drag:"katavorio-drag",selected:"katavorio-drag-selected",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},DR=[LR,OR,RR,mV,gV,EV,_R],AV=function(){},ka=function(i,r){if(i!=null){i=!j(i)&&i.tagName==null&&i.length!=null?i:[i];for(let e=0;e<i.length;e++)r.apply(i[e],[i[e]])}},SV=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e.getInputFilterSelector(),r)},Wx=class{constructor(r,e){this.el=r;this.manager=e;c(this,"uuid",B());c(this,"enabled",!0);c(this,"scopes",[]);c(this,"eventManager");this.eventManager=e.eventManager}setEnabled(r){this.enabled=r}isEnabled(){return this.enabled}toggleEnabled(){this.enabled=!this.enabled}addScope(r){let e={};ka(this.scopes,t=>{e[t]=!0}),ka(r?r.split(/\s+/):[],t=>{e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}removeScope(r){let e={};ka(this.scopes,t=>{e[t]=!0}),ka(r?r.split(/\s+/):[],t=>{delete e[t]}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}toggleScope(r){let e={};ka(this.scopes,t=>{e[t]=!0}),ka(r?r.split(/\s+/):[],t=>{e[t]?delete e[t]:e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}},TV="notNegative",vV="parent",CV="parentEnclosed";function NR(i,r){let e=null;switch(i){case TV:{e=(t,n,o,s)=>({x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))});break}case vV:{let t=r||5;e=(n,o,s,a)=>{let l=n.x<0?0:n.x>s.width-t?s.width-t:n.x,h=n.y<0?0:n.y>s.height-t?s.height-t:n.y;return{x:l,y:h}};break}case CV:{e=(t,n,o,s)=>{let a=t.x<0?0:t.x+s.width>o.width?o.width-s.width:t.x,l=t.y<0?0:t.y+s.height>o.height?o.height-s.height:t.y;return{x:a,y:l}};break}}return e}var Zx=class extends Wx{constructor(e,t,n){super(e,n);c(this,"gg");c(this,"rightButtonCanDrag");c(this,"consumeStartEvent");c(this,"clone");c(this,"scroll");c(this,"trackScroll");c(this,"cloneSize");c(this,"K");c(this,"_e");c(this,"At");c(this,"ta");c(this,"ra",{x:0,y:0});c(this,"fo",{x:0,y:0});c(this,"Ke");c(this,"na");c(this,"ia");c(this,"E");c(this,"dc");c(this,"yo");c(this,"xo");c(this,"Kn",!1);c(this,"oa");c(this,"qn");c(this,"uc");c(this,"$");c(this,"bo",[]);c(this,"Eg");c(this,"fg");c(this,"_n");c(this,"Pr");c(this,"pc");c(this,"Ao",{});c(this,"sa");c(this,"Ae");c(this,"downListener");c(this,"moveListener");c(this,"upListener");c(this,"scrollTracker");c(this,"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]});if(this.gg=this.manager.css.draggable,L(this.el,this.gg),this.downListener=this.Qr.bind(this),this.upListener=this.xr.bind(this),this.moveListener=this.en.bind(this),this.rightButtonCanDrag=t.rightButtonCanDrag===!0,this.consumeStartEvent=t.consumeStartEvent!==!1,this.E=this.el,this.clone=t.clone===!0,this.cloneSize=t.cloneSize,this.scroll=t.scroll===!0,this.trackScroll=t.trackScroll!==!1,this.Eg=t.canDrag||Hx,this.fg=t.consumeFilteredEvents,this._n=t.parent,this.Pr=t.ignoreZoom===!0,this.oa=t.ghostProxyParent,this.pc=t.getTargetScale,this.trackScroll&&(this.scrollTracker=this.Bb.bind(this),document.addEventListener("scroll",this.scrollTracker)),t.ghostProxy===!0?this.qn=Hx:t.ghostProxy&&typeof t.ghostProxy=="function"?this.qn=t.ghostProxy:this.qn=(o,s)=>this.$&&this.$.useGhostProxy?this.$.useGhostProxy(o,s):!1,t.makeGhostProxy?this.uc=t.makeGhostProxy:this.uc=o=>this.$&&this.$.makeGhostProxy?this.$.makeGhostProxy(o):o.cloneNode(!0),t.selector){let o=this.el.getAttribute(wR);o==null&&(o=""+new Date().getTime(),this.el.setAttribute("katavorio-draggable",o)),this.bo.push(t)}this.eventManager.on(this.el,me,this.downListener)}Bb(e){if(this.At){let t={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},n=t.x-this.ra.x,o=t.y-this.ra.y,s={x:n+this.ta.x,y:o+this.ta.y},a=s.x-this.K.x,l=s.y-this.K.y,h=this.Pr?1:this.manager.zoom;this.E&&this.E.parentNode&&(a+=this.E.parentNode.scrollLeft-this.fo.x,l+=this.E.parentNode.scrollTop-this.fo.y),a/=h,l/=h,this.moveBy(a,l,e),this.ta=s,this.ra=t}}on(e,t){this.listeners[e]&&this.listeners[e].push(t)}off(e,t){if(this.listeners[e]){let n=[];for(let o=0;o<this.listeners[e].length;o++)this.listeners[e][o]!==t&&n.push(this.listeners[e][o]);this.listeners[e]=n}}xr(e){this.K&&(this.K=null,this.eventManager.off(document,se,this.moveListener),this.eventManager.off(document,ae,this.upListener),this.unmark(e),this.stop(e),this.At=!1,this.clone?(this.E&&this.E.parentNode&&this.E.parentNode.removeChild(this.E),this.E=null):this.$&&this.$.revertFunction&&this.$.revertFunction(this.E,this.manager.positionGetter(this.E))===!0&&this.manager.positionSetter(this.E,this._e))}Qr(e){if(e.defaultPrevented)return;if((this.rightButtonCanDrag||e.which!==3&&e.button!==2)&&this.isEnabled()&&this.Eg())if(this.tc(e)&&SV(e,this.el,this.manager)){this.$=null,this.Ae=null,this.bo.length===0&&U("VisuallyJs - WARN: no available drag selectors");let o=e.target||e.srcElement,s=pV(this.bo,this.el,o);if(s!=null&&(this.$=s[0],this.Ae=s[1]),this.$==null||this.Ae==null)return;let a=this.$.dragInit?this.$.dragInit(this.Ae,e):null;a!=null&&(this.Ae=a);let l=1;if(this.clone)if(this.E=this.Ae.cloneNode(!0),L(this.E,kx.clonedDrag),this.E.setAttribute("id",null),this.E.style.position="absolute",this._n!=null){let h=this.manager.positionGetter(this.el);this.E.style.left=h.x+"px",this.E.style.top=h.y+"px",this._n.appendChild(this.E)}else{let h=no(this.Ae,!0),d=this.Ae.getBoundingClientRect();this.E.style.left=`${h.x}px`,this.E.style.top=`${h.y}px`;let u=this.cloneSize==null?d.width:this.cloneSize.width,p=this.cloneSize==null?d.height:this.cloneSize.height;this.E.style.width=`${u}px`,this.E.style.height=`${p}px`,document.body.appendChild(this.E),this.pc&&!this.Pr&&(l=this.pc(),l!==1&&(this.E.style.transform=`scale(${l})`,this.E.style.transformOrigin="0 0"))}else this.E=this.Ae;this.consumeStartEvent&&ie(e),this.K=Ee(e),this.E&&this.E.parentNode&&(this.fo={x:this.E.parentNode.scrollLeft,y:this.E.parentNode.scrollTop}),this._e=this.manager.positionGetter(this.E),this.Ke=this.manager.getSize(this.E),this.Ke.width=this.Ke.width*l,this.Ke.height=this.Ke.height*l,this.eventManager.on(document,se,this.moveListener),this.eventManager.on(document,ae,this.upListener),this.aa(_R,{el:this.el,pos:this._e,e,drag:this,size:this.Ke})}else this.fg&&ie(e)}en(e){if(this.K){if(!this.At){let t=this.aa(OR,{el:this.el,pos:this._e,e,drag:this,size:this.Ke});if(t!==!1){if(!this.K)return;this.mark(t),this.At=!0}else this.abort()}if(this.K){let t=Ee(e),n=t.x-this.K.x,o=t.y-this.K.y,s=this.Pr?1:this.manager.zoom;this.ta={x:t.x,y:t.y},this.ra={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this.E&&this.E.parentNode&&(n+=this.E.parentNode.scrollLeft-this.fo.x,o+=this.E.parentNode.scrollTop-this.fo.y),n/=s,o/=s,this.moveBy(n,o,e)}}}getDragDelta(){return this._e!=null&&this.K!=null?{x:this.K.x-this._e.x,y:this.K.y-this._e.y}:{x:0,y:0}}mark(e){this._e=this.manager.positionGetter(this.E),this.Ke=this.manager.getSize(this.E),L(this.E,this.manager.css.drag),this.sa=this.manager.getParentConstrainingRectangle(this.E),this.yo=0,this.xo=0}unmark(e){this.Kn&&this.qn(this.Ae,this.E)?(this.dc={x:this.E.offsetLeft-this.yo,y:this.E.offsetTop-this.xo},this.E.parentNode.removeChild(this.E),this.E=this.Ae):this.dc=null,F(this.E,this.manager.css.drag),this.Kn=!1}moveBy(e,t,n){let o=this.toGrid({x:this._e.x+e,y:this._e.y+t}),s=this.Fb(o,this.E,this.sa,this.Ke,{x:this._e.x,y:this._e.y},n);if(s!=null){if(this.qn(this.el,this.E))if(o.x!==s.x||o.y!==s.y){if(!this.Kn){let a=this.uc(this.Ae);L(a,kx.ghostProxy),this.oa?(this.oa.appendChild(a),this.na=no(this.Ae.parentNode),this.ia=no(this.oa),this.yo=this.na.x-this.ia.x,this.xo=this.na.y-this.ia.y):this.Ae.parentNode.appendChild(a),this.E=a,this.Kn=!0}s=o}else this.Kn&&(this.E.parentNode.removeChild(this.E),this.E=this.Ae,this.Kn=!1,this.na=null,this.ia=null,this.yo=0,this.xo=0);this.manager.positionSetter(this.E,{x:s.x+this.yo,y:s.y+this.xo}),this.aa(RR,{el:this.el,pos:s,e:n,drag:this,size:this.Ke,originalPos:this._e,viewport:this.sa})}}abort(){this.K!=null&&this.xr()}getDragElement(e){return e?this.Ae||this.el:this.E||this.el}stop(e,t){if(t||this.At){let n=[],o=this.manager.positionGetter(this.E);n.push([this.E,o,this,this.Ke]),this.aa(LR,{el:this.E,pos:this.dc||o,finalPos:o,e,drag:this,selection:n,size:this.Ke,originalPos:{x:this._e.x,y:this._e.y},viewport:this.sa})}else this.At||this.$.dragAbort&&this.$.dragAbort(this.Ae)}aa(e,t){let n=null;if(this.$&&this.$[e])n=this.$[e](t);else if(this.listeners[e])for(let o=0;o<this.listeners[e].length;o++)try{let s=this.listeners[e][o](t);s!=null&&(n=s)}catch(s){}return n}resolveGrid(){let e={grid:null,thresholdX:yV/2,thresholdY:xV/2};return this.$!=null&&this.$.grid!=null&&(e.grid=this.$.grid,this.$.snapThreshold!=null&&(e.thresholdX=this.$.snapThreshold,e.thresholdY=this.$.snapThreshold)),e}toGrid(e){let{grid:t,thresholdX:n,thresholdY:o}=this.resolveGrid();if(t==null)return e;{let s=t?t.width/2:n,a=t?t.height/2:o;return le(e,t,s,a)}}setUseGhostProxy(e){this.qn=e?Hx:bV}Fb(e,t,n,o,s,a){return this.$!=null&&this.$.constrainFunction&&typeof this.$.constrainFunction=="function"?this.$.constrainFunction(e,t,n,o,s,a):e}tc(e){for(let t in this.Ao){let n=this.Ao[t],o=n[0](e);if(n[1]&&(o=!o),!o)return!1}return!0}addFilter(e,t){if(e){let n=uV(e);this.Ao[n]=[o=>{let s=o.srcElement||o.target,a;return j(e)?a=$t(s,e,this.el):typeof e=="function"&&(a=e(o,this.el)),a},t!==!1]}}removeFilter(e){let t=typeof e=="function"?e.Eo:e;delete this.Ao[t]}clearAllFilters(){this.Ao={}}addSelector(e,t){e.selector&&(t?this.bo.unshift(e):this.bo.push(e))}destroy(){this.eventManager.off(this.el,me,this.downListener),this.eventManager.off(document,se,this.moveListener),this.eventManager.off(document,ae,this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null,this.scrollTracker!=null&&document.removeEventListener("scroll",this.scrollTracker)}},PV=["input","textarea","select","button","option"],OV=PV.join(","),Cg=class{constructor(r){c(this,"eventManager");c(this,"zoom",1);c(this,"css",{});c(this,"inputFilterSelector");c(this,"positionGetter");c(this,"getSize");c(this,"positionSetter");this.inputFilterSelector=r.inputFilterSelector||OV,this.eventManager=new xe,this.zoom=r.zoom||1,this.positionGetter=r.positionGetter,this.getSize=r.getSize,this.positionSetter=r.positionSetter;let e=r.css||{};Object.assign(this.css,e)}getParentConstrainingRectangle(r){let e=r.parentNode;if(e==null)return{width:0,height:0};{let t=e.scrollLeft!=null?e.scrollLeft:0,n=e.scrollTop!=null?e.scrollTop:0,o=this.getSize(e);return{width:o.width+t,height:o.height+n}}}Ub(r){r=r||{};let e={events:{}},t;for(Object.assign(e,r),t=0;t<DR.length;t++){let n=DR[t];e.events[n]=r[n]||AV}return e}getInputFilterSelector(){return this.inputFilterSelector}setInputFilterSelector(r){return this.inputFilterSelector=r,this}draggable(r,e){if(r.So==null){let t=this.Ub(e),n=new Zx(r,t,this);return L(r,kx.delegatedDraggable),r.So=n,n}else return r.So}destroyDraggable(r){r.So&&(r.So.destroy(),delete r.So)}};var _V=15,RV=10,LV="markers",wV="lineStyle",DV="sourceArrow",NV="targetArrow",IV="bothArrows",MV="plain",VV="dashed";function u6e(i){let r=(i==null?void 0:i.arrowWidth)||_V,e=(i==null?void 0:i.arrowLength)||RV,t=(i==null?void 0:i.lineStyleProperty)||wV,n=(i==null?void 0:i.markersProperty)||LV;return[{property:t,mappings:{[MV]:{},[VV]:{dashArray:"2"}}},{property:n,mappings:{noArrows:{overlays:[]},[DV]:{overlays:[{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]},[NV]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}}]},[IV]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}},{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]}}}]}var IR={set:function(i,r){localStorage.setItem(i,r)},get:function(i){return localStorage.getItem(i)},clear:function(i){localStorage.removeItem(i)},clearAll:function(){for(;localStorage.length>0;){let i=localStorage.key(0);localStorage.removeItem(i)}},setJSON:function(i,r){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot store value.");IR.set(i,JSON.stringify(r))},getJSON:function(i){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot retrieve value.");return JSON.parse(IR.get(i))}};var MR=class{constructor(r,e){c(this,"collicat");c(this,"drags",[]);this.collicat=new Cg({positionGetter:o=>mn(o),positionSetter:(o,s)=>tr(o,s),getSize:o=>We(o)}),e=e||{};let t={selector:"."};t.filter=e.filter,t.constrainFunction=e.constrain,t.constrainFunction==null&&e.containment!=null&&(t.constrainFunction=NR(e.containment,e.containmentPadding)),(Array.isArray(r)?r:[r]).forEach(o=>{let s=this.collicat.draggable(o,{});s.addSelector(t),this.drags.push([s,o])})}destroy(){this.drags.forEach(r=>this.collicat.destroyDraggable(r[1])),this.collicat=null,this.drags.length=0}};function _6e(i){VR?i():Jx.push(i)}var Jx=[],VR=!1,Pg=()=>{VR=!0;for(let i=0;i<Jx.length;i++)Jx[i]()},Kx=class{constructor(r){this.templateHolder=r;c(this,"c",0)}yg(){this.c--,this.c<=0&&Pg()}add(r){this.c++,xa({url:r,success:e=>{let t=this.templateHolder.innerHTML;t+=e,this.templateHolder.innerHTML=t,this.yg()},error:e=>{this.yg()}})}ensureNotEmpty(){this.c<=0&&Pg()}},GR="_vjs_templates",GV=()=>{let i=function(){if(typeof document!="undefined")if(/complete|loaded|interactive/.test(document.readyState)&&typeof document.body!="undefined"&&document.body!=null){let r=document.getElementById(GR);if(r)Pg();else{r=document.createElement("div"),r.style.display="none",r.id=GR,document.body.appendChild(r);let e=new Kx(r),t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++){let o=t[n].getAttribute("type"),s=t[n].getAttribute("src");o=="text/x-vjs-templates"&&e.add(s)}e.ensureNotEmpty()}}else setTimeout(i,9);else Pg()};i()};GV();var $R="vjs-test-support-container",$V=1e-11;function BR(){let i=document.getElementById($R);return i==null&&(i=document.createElement("div"),i.id=$R,document.body.appendChild(i)),i}var gc=[],BV=[];function Og(i,r,e,t){let n=document.createElement("div");n.style.position="absolute",r?r.appendChild(n):BR().appendChild(n),n.setAttribute("id",i),e&&(n.className=e),n.style.left=Math.floor(Math.random()*1e3)+"px",n.style.top=Math.floor(Math.random()*1e3)+"px",gc.push({id:i,el:n}),t=t||{};for(let o in t)n.style[o]=t[o];return n}function FV(i,r){for(let e=0;e<i.length;e++)Og(i[e],r)}function UV(i){i=i.length==null&&typeof i!="string"?[i]:i;for(let r=0;r<i.length;r++){let e=typeof i[r]=="string"?document.getElementById(i[r]):i[r];e.parentNode&&e.parentNode.removeChild(e)}}function Ec(i){UV(document.querySelectorAll(i))}function YV(){for(let i=0;i<gc.length;i++)gc[i].el.parentNode.removeChild(gc[i].el);gc.length=0,Ec("circle"),Ec(".vjs-node"),Ec(".vjs-surface-canvas"),Ec("svg"),Ec(".vjs-lasso"),BR().innerHTML=""}function zV(i,r,e){return i=typeof i=="string"?parseFloat(i.substring(0,i.length-2)):i,r=typeof r=="string"?parseFloat(r.substring(0,r.length-2)):r,Math.abs(r-i)<(e||5e-4)}function yo(i){return i.connector.canvas}function Ft(i,r,e){let t=e==null?.5:e.x,n=e==null?.5:e.y,o=i===document?i.documentElement.getBoundingClientRect():i.getBoundingClientRect(),s=o.x+o.width*t,a=o.y+o.height*n;return sr(s,a,r)}function qx(i,r,e,t){let n=i===document?{x:0,y:0,width:document.body.clientWidth,height:document.body.clientHeight}:i.getBoundingClientRect();return sr(n.x+r,n.y+e,t)}function FR(i,r,e,t){let n={clientX:i.clientX+r,clientY:i.clientY+e,screenX:i.screenX+r,screenY:i.screenY+e,pageX:i.pageX+r,pageY:i.pageY+e};return Object.assign(n,t||{}),n}var _g={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4};function XV(){let i=parseInt(""+Math.random()*2e3),r=parseInt(""+Math.random()*2e3);return sr(i,r)}function UR(i,r,e){let t=i;e=e||{},e.start&&e.start(),wr(i,r),e.down&&e.down();let n=Math.random()*50;for(let o=0;o<n;o++){let s=XV();r.style.left=s.screenX+"px",r.style.top=s.screenY+"px",t.trigger(document,"mousemove",s)}e.move&&e.move(),t.trigger(document,"mouseup",_g),e.up&&e.up()}function YR(i,r,e=!0,t){let n=i.getRenderedConnection(r.id),o=e?".vjs-connector-source-drag":".vjs-connector-target-drag",s=n.connector.canvas.querySelector(o);wr(i,s);let a=_g;if(t!=null){let l=i.toPageLocation(t.x,t.y);a=sr(l.x,l.y)}return i.trigger(document,"mousemove",a),i.trigger(document,"mouseup",a),i.fromPageLocation(a.pageX,a.pageY)}function zR(i,r,e,t){let n=Og("div");return n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=(e&&e.width?e.width:1500)+"px",n.style.height=(e&&e.height?e.height:1500)+"px",{surface:i.render(n,r,t),container:n}}function jV(i,r,e,t){let n=En(i),o,s;if(r!=null){let l=zR(n,r,e,t);s=l.container,o=l.surface}let a={model:n,surface:o,container:s};return BV.push(a),a}function HV(i,r){let e=i.surface.getRenderedConnection(r),t=yo(e),n=Ft(t);i.surface.trigger(t.querySelector("path"),"click",n)}function kV(i,r){let e=i.surface.getRenderedConnection(r),t=yo(e),n=Ft(t);i.surface.trigger(t.querySelector("path"),"dblclick",n)}function WV(i,r){let e=i.surface.getRenderedConnection(r),t=yo(e),n=Ft(t);var o=t.querySelector("path");i.surface.trigger(o,me,n),i.surface.trigger(o,"mouseup",n)}function ZV(i,r){let e=i.surface.getRenderedConnection(r),t=yo(e),n=Ft(t);var o=t.querySelector("path");i.surface.trigger(o,me,n),i.surface.trigger(o,"mouseup",n),i.surface.trigger(o,me,n),i.surface.trigger(o,"mouseup",n)}function fc(i,r,e){let t=i.surface.getRenderedConnection(r),n=yo(t),o=Ft(n);i.surface.trigger(n.querySelector("path"),e,o)}function Qx(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Wa(i.surface,t,1,1)}function yc(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);wr(i.surface,t,1),Za(i.surface,t,1)}function JV(i,r,e){Rg(i,r,Qr,1,e)}function KV(i,r,e){Rg(i,r,"mouseover",1,e)}function qV(i,r,e){Rg(i,r,"mouseout",1,e)}function Rg(i,r,e,t=1,n){let o=i.model.getVertex(r),s=i.surface.getRenderedElement(o);Ja(i.surface,s,e,t,n)}function Wa(i,r,e=1,t=1){let n=Ft(r),o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,t,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(o)}function XR(i,r,e=1){let t=Ft(r),n=document.createEvent("MouseEvents");n.initMouseEvent("dblclick",!0,!0,window,2,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(n)}function wr(i,r,e=1,t){Ja(i,r,xo,e,t)}function Za(i,r,e=1,t){Ja(i,r,fn,e,t)}function Ja(i,r,e,t=1,n){let o=Ft(r,null,n),s=document.createEvent("MouseEvents");s.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,t||1,null),r.dispatchEvent(s)}function Lg(i,r,e,t,n,o=1){let s=sr(t.x,t.y);n=n||{};let a=document.createEvent("MouseEvents");a.initMouseEvent(e,!0,!0,window,1,s.screenX,s.screenY,s.clientX,s.clientY,n.ctrlKey,n.altKey,n.shiftKey,n.metaKey,o||1,null),r.dispatchEvent(a)}function QV(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Wa(i.surface,t,2,1)}function e1(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);XR(i.surface,t,1)}function t1(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");Wa(i.surface,o,1,1)}function r1(i,r){Wa(i.surface,r,1,1)}function n1(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");XR(i.surface,o,1)}function jR(i,r){wr(i.surface,r),Za(i.surface,r)}function i1(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");jR(i,o)}function o1(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");wr(i.surface,o),Za(i.surface,o),wr(i.surface,o),Za(i.surface,o)}function s1(i,r,e){let t=i.surface.getRenderedConnection(r),n=Ff(t,e||"lbl");Wa(i.surface,n.contentElements[0],1,1)}function a1(i,r,e){let t=i.model.getNode(r),o=i.surface.getRenderedElement(t).querySelector(fi(hn,e));o&&Wa(i.surface,o,1,1)}function eb(i,r,e,t,n,o){t=t||{};let s=i,a;io(e)?a=Ft(e,null,n):a=qx(i.$getCanvasElement(),e.x,e.y);let l=i.model.getAllEdges().length;t.start&&t.start(),wr(i,r),t.down&&t.down();let h=Object.values(i.$_connMap).find(u=>u.edge.transient);if(h!=null&&s.trigger(yo(h).childNodes[0],st,a),s.trigger(document,Qr,a),t.move){let u=i.model.getAllEdges().filter(m=>m.transient)[0],p=u?i.getRenderedConnection(u.id):null;t.move(p)}let d=()=>{s.trigger(document,fn,a);let u=i.model.getAllEdges()[l],p=u?i.getRenderedConnection(u.id):null;return t.up&&t.up(p),p};if(o)o(d);else return d()}function l1(i,r,e){e=e||{};let t=i;e.start&&e.start(),wr(i,r),e.down&&e.down(),t.trigger(document,Qr,_g),t.trigger(document,fn,_g)}function HR(i,r,e,t,n,o,s){let a=i.getObjectInfo(t,!1);if(a.el){n=n||{};let l=i.getRenderedConnection(r.id),h=e?".vjs-connector-source-drag":".vjs-connector-target-drag",d=l.connector.canvas.querySelector(h);n.start&&n.start(),wr(i,d),n.down&&n.down();let u=Ft(a.el,null,o);i.trigger(document,"mousemove",u),n.move&&n.move(),s!=null?s(()=>{i.trigger(document,"mouseup",u),n.up&&n.up(l)}):(i.trigger(document,"mouseup",u),n.up&&n.up(l))}else throw`Cannot resolve drag element ${t}`}function tb(i,r,e,t,n){n=n||{},r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let o=i,s=Ft(r);o.trigger(r,xo,s),n.afterDown&&n.afterDown();let a=r.getBoundingClientRect(),l=sr(e+a.width/2,t+a.height/2);o.trigger(document,Qr,l),n.afterMove&&n.afterMove(),o.trigger(document,ae,l),n.afterUp&&n.afterUp()}function rb(i,r,e,t,n,o){r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let s=i.jsplumb?i.jsplumb:i,a=Ft(r,o);s.trigger(r,xo,a),n&&n.afterDown&&n.afterDown(),s.trigger(document,Qr,FR(a,e,t,o)),n&&n.afterMove&&n.afterMove(),s.trigger(document,fn,null),n&&n.afterUp&&n.afterUp()}function kR(i,r,e,t,n,o,s){let a=i;r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild),n=n||3;let l=e/n,h=t/n,d=l,u=h,p=Ft(r,s);a.trigger(r,xo,p),o&&o.afterDown&&o.afterDown();for(let m=0;m<n;m++)a.trigger(document,Qr,FR(p,d,u,s)),o&&o.afterMove&&o.afterMove(m),d+=l,u+=h;a.trigger(document,fn),o&&o.afterUp&&o.afterUp()}var h1=typeof document!="undefined",wg=h1?"ontouchstart"in document.documentElement:!1,xo=wg?"touchstart":"mousedown",Qr=wg?"touchmove":"mousemove",fn=wg?"touchend":"mouseup";function sr(i,r,e){return Object.assign({clientX:i,clientY:r,screenX:i,screenY:r,pageX:i,pageY:r},e||{})}function WR(i,r,e){return i.clientX+=r,i.clientY+=e,i.screenX+=r,i.screenY+=e,i.pageX+=r,i.pageY+=e,i}function ZR(i,r,e,t,n,o,s){let l=i.vertexLayer.parentElement.parentElement;n!=null&&(l=i.getRenderedElement(n)),nb(i,l,r,e,t,o,s)}function nb(i,r,e,t,n,o,s){n&&n.start&&n.start();let a=i.toPageLocation(e.x,e.y),l=i.toPageLocation(t.x,t.y);a.x-=window.scrollX,l.x-=window.scrollX,a.y-=window.scrollY,l.y-=window.scrollY,Lg(i,r,xo,a,o),n&&n.down&&n.down(),Lg(i,document,Qr,l,o),n&&n.move&&n.move(),s?s(()=>{Lg(i,document,fn,l,o),n&&n.up&&n.up()}):(Lg(i,document,fn,l,o),n&&n.up&&n.up())}var Ci={addDiv:Og,addDivs:FV,cleanup:YV,delta:zV,DOWN_EVENT:xo,UP_EVENT:fn,MOVE_EVENT:Qr,isTouchDevice:wg,makeEvent:Ft,makeEventAt:sr,nudgeEvent:WR,getEdgeCanvas:yo,defaultEventManager:new xe,dragElementBy:(i,r,e,t)=>{rb(Ci.defaultEventManager,i,r,e,t)},attachToSurface:i=>new Dg(i.model,i),create:(i,r,e,t)=>{let n=jV(i,r,e,t);return new Dg(n.model,n.surface)},trigger:(i,r,e,t,n)=>{i.trigger(r,e,{pageX:t,pageY:n,screenX:t,screenY:n,clientX:t,clientY:n})},getTransform:i=>{let r=parseFloat(i.style.transform.match(/translateX\(([0-9\.]+)px/)[1]),e=parseFloat(i.style.transform.match(/translateY\(([0-9\.]+)px/)[1]),t=parseFloat(i.style.transform.match(/scale\(([0-9\.]+)/)[1]);return{translateX:r,translateY:e,scale:t}},lasso:ZR,lassoOnElement:nb,withinTolerance:(i,r,e)=>Math.abs(i-r)<=e};typeof window!="undefined"&&(window.VisuallyJsTestSupport=Ci);function JR(i,r,e,t,n,o){let s=i.getEffectiveVisibleZoom();o=o||{};let a=e.getBoundingClientRect(),l=sr(a.x+a.width+s*t,a.y+a.height+s*n),h=i.model.getAllEdges().length;o.start&&o.start(),wr(i,r),o.down&&o.down(),i.trigger(document,Qr,l),o.move&&o.move(),i.trigger(document,fn,l),o.up&&o.up();let d=i.model.getAllEdges()[h];return d?i.getRenderedConnection(d.id):null}var Dg=class{constructor(r,e){this.model=r;c(this,"eventManager");c(this,"surface");c(this,"undoManager");c(this,"mc");c(this,"consoleOutput","");this.eventManager=new xe,this.surface=e}get container(){return this.surface!=null?this.surface.getContainer():null}get canvas(){return this.surface!=null?this.surface.$getCanvasElement():null}get edgePathEditor(){return this.mc==null&&(this.mc=new Na(this.surface)),this.mc}destroy(){this.surface.destroy()}startEditing(r,e){this.edgePathEditor.startEditing(r,e)}stopEditing(){this.edgePathEditor.stopEditing()}render(r,e){let t=zR(this.model,r,e);return this.surface=t.surface,this.surface}querySelectorAll(r){return this.container.querySelectorAll(r)}querySelector(r){return this.container.querySelector(r)}dragANodeAround(r,e){UR(this.surface,this.surface.getObjectInfo(r,!1).el,e)}dragAnElementAround(r){UR(this.surface,r)}load(r){return this.model.load(r)}getEdgeCanvas(r){let e=this.surface.getRenderedConnection(r.id);return yo(e)}withConsole(r){let e=console.log;console.log=function(t){this.consoleOutput=t}.bind(this);try{r()}catch(t){e("An exception was thrown while running a function with the console log captured",t)}console.log=e}clear(){return this.model.clear()}getRenderedElement(r){return this.surface.getObjectInfo(r,!1).el}getRenderedConnection(r){return this.surface.getRenderedConnection(r)}dragVertexIntoGroup(r,e){let t=this.surface.getObjectInfo(r,!1),n=this.surface.getObjectInfo(e,!1);if(t.el&&n.el){let o=this.surface.$getGroupContentAreaElement(n.el).getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x+o.width/2-s.width/2,l=o.y+o.height/2-s.height/2;tb(this.surface,t.el,a,l)}}dragVertexOutOfGroup(r,e){let t=this.surface.getObjectInfo(r,!1);if(t.el&&t.managedElement.modelObject.group!=null){let n=this.surface.getObjectInfo(t.managedElement.modelObject.group,!1);if(n.el){let o=n.el.getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x-50-s.width,l=o.y-50-s.height;tb(this.surface,t.el,a,l)}}}getGroup(r){return this.getModelObject(r)}getNode(r){return this.getModelObject(r)}getModelObject(r){return this.surface.getObjectInfo(r,!1).obj}dragVertexTo(r,e,t,n){let o=this.surface.toPageLocation(e,t);this.dragVertexToPageLocation(r,o.x,o.y,n)}dragVertexToPageLocation(r,e,t,n){let o=this.surface.getObjectInfo(r,!1);if(o.el)tb(this.surface,o.el,e,t,n);else throw new Error("Cannot drag node: cannot resolve "+r)}dragVertexBy(r,e,t,n,o){let s=this.surface.panZoom.getCompoundZoom();this.dragVertexByPageDelta(r,e*s,t*s,n,o)}dragVertexByPageDelta(r,e,t,n,o){let s=this.surface.getObjectInfo(r,!1);if(s.el)rb(this.surface,s.el,e,t,n,o);else throw new Error("Cannot drag vertex: cannot resolve "+r)}dragElementBy(r,e,t,n,o){rb(this.surface,r,e,t,n,o)}dragElementByInStages(r,e,t,n,o,s){kR(this.surface,r,e,t,n,o,s)}dragVertexByInStages(r,e,t,n,o,s){let a=this.surface.getObjectInfo(r,!1);if(a.el)kR(this.surface,a.el,e,t,n,o,s);else throw new Error("Cannot drag vertex: cannot resolve "+r)}connect(r,e,t,n){let o=this.surface.getObjectInfo(r,!1),s=this.surface.getObjectInfo(e,!1);return this.model.$_addEdge({source:o.obj,target:s.obj,data:t||{}},n||Oo,null)}Qn(r){let e;if(kC(r))e=r;else{let t=Array.isArray(r)?r[0]:r;e=this.surface.getRenderedElement(t),Array.isArray(r)&&(e=e.querySelector(r[1]))}return e}xg(r,e){return{sourceEl:this.Qn(r),targetEl:this.Qn(e)}}dragConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.xg(r,e);return eb(this.surface,s,a,t,n,o)}dragAndAbortConnection(r){l1(this.surface,this.Qn(r))}dragSnapConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.xg(r,e);return JR(this.surface,s,a,t,n,o)}dragDetachedConnection(r,e,t){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let n=this.Qn(r);return eb(this.surface,n,e,t)}dragDiagramConnection(r,e,t){this.surface.model.setSelection(r);let n=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),o=this.Qn(e);return eb(this.surface,n,o,t,null)}dragDiagramSnapConnection(r,e,t,n,o){this.surface.model.setSelection(r);let s=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),a=this.Qn(e);return JR(this.surface,s,a,t,n,o)}detachEdge(r,e){return this.detachEdgeBySource(r,e)}detachEdgeBySource(r,e){return YR(this.surface,r,!0,e)}detachEdgeByTarget(r,e){return YR(this.surface,r,!1,e)}relocateEdgeTarget(r,e,t,n,o){HR(this.surface,r,!1,e,t,n,o)}relocateEdgeSource(r,e,t,n,o){HR(this.surface,r,!0,e,t,n,o)}trigger(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el)t=t||Ft(n.el),this.surface.trigger(n.el,e,t);else throw new Error("Trigger: Cannot resolve "+r)}triggerEventOnElement(r,e,t,n,o){this.triggerEvent(r,e,t,n,o)}triggerEvent(r,e,t,n,o){let s=n!=null&&o!=null?qx(r,n,o,t):Ft(r,t);this.surface.trigger(r,e,s)}triggerEventAt(r,e,t,n,o){let s=qx(r,t,n,o);this.surface.trigger(r,e,s)}makeEvent(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el){let o=Ft(n.el);return e||t?WR(o,e==null?0:e,t==null?0:t):o}else throw new Error("Trigger: Cannot resolve "+r)}makeEventAt(r,e){return sr(r,e)}getEdge(r){return this.model.getEdge(r)}updateEdge(r,e){this.model.updateEdge(r,e)}getAllEdges(){return this.model.getAllEdges()}getRenderedPort(r){return this.surface.getRenderedPort(r)}addNode(r){return this.model.addNode(r)}updateNode(r,e){return this.model.updateNode(r,e)}addGroup(r){return this.model.addGroup(r)}updateGroup(r,e){this.model.updateGroup(r,e)}updateVertex(r,e){this.model.updateVertex(r,e)}clickOnGroup(r){Qx(this,r)}clickOnNode(r){Qx(this,r)}clickOnVertex(r){Qx(this,r)}dblClickOnVertex(r){e1(this,r)}rightClickOnVertex(r){QV(this,r)}tapOnVertex(r){yc(this,r)}tapOnNode(r){yc(this,r)}tapOnGroup(r){yc(this,r)}dblTapOnVertex(r){yc(this,r),yc(this,r)}dblTapOnNode(r){this.dblTapOnVertex(r)}dblTapOnGroup(r){this.dblTapOnVertex(r)}mousemoveOnVertex(r,e){JV(this,r,e)}mouseoverOnVertex(r,e){KV(this,r,e)}mouseoutOnVertex(r,e){qV(this,r,e)}contextmenuOnVertex(r,e){Rg(this,r,At,3,e)}clickOnCanvas(r=1,e=1){for(let t=0;t<r;t++)wr(this.surface,this.canvas,e),Za(this.surface,this.canvas,e)}clickOnCanvasAt(r,e,t=1){wr(this.surface,this.canvas,t,{x:r,y:e}),Za(this.surface,this.canvas,t,{x:r,y:e})}mousemoveOnCanvasAt(r,e){Ja(this.surface,this.canvas,Qr,1,{x:r,y:e})}mousedownOnCanvasAt(r,e){Ja(this.surface,this.canvas.parentNode,xo,1,{x:r,y:e})}mouseupOnCanvasAt(r,e){Ja(this.surface,this.canvas,fn,1,{x:r,y:e})}lasso(r,e,t){ZR(this.surface,r,e,t)}lassoOnElement(r,e,t,n){nb(this.surface,r,e,t,n)}rightClickOnCanvas(r=1){this.clickOnCanvas(r,2)}clickOnElement(r){r1(this,r)}clickOnElementInsideVertex(r,e){t1(this,r,e)}dblClickOnElementInsideVertex(r,e){n1(this,r,e)}tapOnElement(r){jR(this,r)}tapOnElementInsideVertex(r,e){i1(this,r,e)}dblTapOnElementInsideVertex(r,e){o1(this,r,e)}mousedownOnElement(r){wr(this.surface,r)}clickOnEdge(r){HV(this,r)}dblClickOnEdge(r){kV(this,r)}tapOnEdge(r){let e=rt(r)?r.id:r;WV(this,e)}dblTapOnEdge(r){let e=rt(r)?r.id:r;ZV(this,e)}Ag(r,e,t,n){n=n||{};let o=n.events||{},s=n.zoom==null?1:n.zoom,a=n.x||90,l=n.y||90,h=r.source.querySelector(e),d=n.targetElement||this.surface.getContainer();var u=h.getBoundingClientRect(),p=d.getBoundingClientRect(),m=p.x,g=p.y,E=u.x+u.width/2,y=u.y+u.height/2,x=(m+13)*s,f=(g+13)*s,b=m+a*s+u.width/2,A=g+l*s+u.height/2;o.beforeDown&&o.beforeDown();let T=sr(E,y);this.surface.trigger(h,Ci.DOWN_EVENT,T),t&&this.surface.trigger(h,Ci.UP_EVENT,T),o.beforeMove&&o.beforeMove(),this.surface.trigger(d,Ci.MOVE_EVENT,sr(x,f));let S=sr(b,A);if(this.surface.trigger(d,Ci.MOVE_EVENT,S),o.beforeUp&&o.beforeUp(),t){let R=document.querySelector(".vjs-palette-tap-mode-placeholder");this.surface.trigger(R,Ci.DOWN_EVENT,S),this.surface.trigger(R,Ci.UP_EVENT,S)}else this.surface.trigger(d,Ci.UP_EVENT,S);o.after&&o.after()}dragFromPalette(r,e,t){this.Ag(r,e,!1,t)}tapFromPalette(r,e,t){this.Ag(r,e,!0,t)}mousedownOnEdge(r){fc(this,r,me)}mouseupOnEdge(r){fc(this,r,ae)}mouseoverOnEdge(r){fc(this,r,st)}mouseoutOnEdge(r){fc(this,r,ot)}contextmenuOnEdge(r){fc(this,r,At)}clickOnOverlay(r,e){s1(this,r,e)}clickOnPort(r,e){a1(this,r,e)}getEdgeCount(){return this.model.getEdgeCount()}dragElementToCanvas(r,e,t){e=e||250,t=t||250;let n=this.surface.panZoom.getApparentCanvasLocation(),o=this.surface.getContainer().parentNode.getBoundingClientRect(),s=o.x+n.x,a=o.y+n.y,l=Ft(r);this.eventManager.trigger(r,xo,l);let h=this.surface.$getSize(r),d=this.surface.getContainer().parentNode,u=r.getBoundingClientRect();this.eventManager.trigger(d,Qr,sr(u.x+1,u.y+1)),this.eventManager.trigger(d,Qr,sr(e+s+h.width/2,t+a+h.height/2)),this.eventManager.trigger(d,fn,sr(e+s+h.width/2,t+a+h.height/2))}addMiniview(r){let e=r||{},t=Og("div");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=(e.width?e.width:250)+"px",t.style.height=(e.height?e.height:250)+"px",e.container=t,this.surface.addPlugin({type:"miniview",options:e})}getDOMPosition(r){let e=this.surface.getRenderedElement(r);return{x:parseInt(e.style.left,10),y:parseInt(e.style.top,10)}}isAtPosition(r,e,t){let n=this.surface.getRenderedElement(r),o={x:parseInt(n.style.left,10),y:parseInt(n.style.top,10)};return e===o.x&&t===o.y}attachAnimator(){return new mg(this.surface)}within(r,e,t,n){t(Math.abs(r-e)<$V,n+"[expected: "+e+" got "+r+"] [diff:"+Math.abs(r-e)+"]")}};var KR="vjs-chart-background",Ka="vjs-chart-plot-background",xc="vjs-chart-body",qR="vjs-chart-series",QR="vjs-chart-legend",Ng="vjs-chart-legend-item",e0="vjs-chart-legend-label",t0="vjs-chart-legend-dot",qa="vjs-chart-axis",Ig="vjs-chart-x-axis",Mg="vjs-chart-y-axis",ib="vjs-chart-axis-labels",ob="vjs-chart-axis-line",sb="vjs-chart-axis-title",r0="vjs-chart-y-axis-title",n0="vjs-chart-x-axis-title",i0="vjs-column-chart",o0="vjs-column-chart-column",s0="vjs-bar-chart",a0="vjs-bar-chart-bar",yn="vjs-chart-point",Vg="vjs-chart-point-hit-area",l0="vjs-bubble-chart",h0="vjs-bubble-chart-point",c0="vjs-scatter-chart",d0="vjs-scatter-chart-point",Gg="vjs-area-chart-area",u0="vjs-chart-title",p0="vjs-chart-subtitle",bc="vjs-chart-crosshair",Ac="vjs-chart-crosshair-label",m0="vjs-chart-crosshair-value-axis",g0="vjs-chart-crosshair-category-axis",ab="vjs-chart-empty",E0="vjs-chart-axis-scale-label",lb="vjs-chart-gridlines",hb="vjs-chart-gridline",f0="vjs-line-chart",y0="vjs-area-chart";var c1=6;function cb(i,r,e,t,n){let o=(Math.floor(Math.abs(r)/e)*e+e)*Math.sign(r),s=i===0?0:(Math.floor(Math.abs(i)/e)*e+e)*Math.sign(i);o<r&&(o+=e),s>i&&(s-=e),n!=null&&o>n&&(o=n),t!=null&&s<t&&(s=t);let a=(o-s)/e;return{maxScale:o,minScale:s,stepCount:a,step:e}}function d1(i){return Math.log10(i)%1===0||i.toExponential().split("e")[0]==="5"?i*2:i*2.5}function u1(i){return Math.log10(i)%1===0?i/2:i.toExponential().split("e")[0]==="5"?i/2.5:i/2}function p1(i,r,e,t,n,o){let s=cb(i,r,e,n,o),a=s.stepCount-t,l=Math.abs(a);if(a>0){let d=d1(s.step),u=cb(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}else if(a<0){let d=u1(s.step),u=cb(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}let h=[];for(let d=s.minScale;d<=s.maxScale;d+=s.step)h.push(d);return Object.assign(s,{steps:h,range:s.maxScale-s.minScale,dataMin:i,dataMax:r})}function Sc(i,r,e=c1,t,n){let o=r-i,s=m1(o);return p1(i,r,s,e,t,n)}function b0(i,r,e){let t=[],n=r-i,o=n/e;for(let s=i;s<=r;s+=o)t.push(s);return{dataMin:i,dataMax:r,range:n,steps:t,step:o,stepCount:e,minScale:i,maxScale:r}}function Tc(i,r,e){let t=[];for(let n=i;n<=r;n+=e)t.push(n);return{dataMin:i,dataMax:r,range:r-i,steps:t,step:e,stepCount:t.length-1,minScale:i,maxScale:t[t.length-1]}}function m1(i){return Math.pow(10,parseInt(i.toExponential().split("e")[1],10))}function Pi(i,r,e,t,n){return{size:(n==null?void 0:n.size)||i,style:(n==null?void 0:n.style)||r,weight:(n==null?void 0:n.weight)||e,family:(n==null?void 0:n.family)||t}}function k(i,r,e,t){let n=G(i,r||{});return e&&L(n,e),t&&t.appendChild(n),n}function vs(i,r,e,t){let n=k(et,r,e,t);return n.innerHTML=i,n}function p8e(i,r){let e=vh(i);jt(i,r,e.y)}function vc(i,r){let e=vh(i);jt(i,e.x,r)}function jt(i,r,e){i.setAttribute("transform",`translate(${r}, ${e})`)}function xn(i){return i.type==="value"}function A0(i){return i.type==="category"}function Cc(){return{x:0,y:0,width:0,height:0}}function db(i,r){return r==null||r==="int"?Math.round(i).toString():typeof r=="number"?i.toFixed(r):i.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2})}function S0(i,r,e,t){let n=()=>{if(i.length===0)return!1;let s=i[0].getBBox();for(let a=1;a<i.length;a++){let l=i[a].getBBox();if(tt(s,l))return!0;s=l}},o=s=>{i.forEach(a=>{a.setAttribute("text-anchor","end"),a.setAttribute("dominant-baseline","middle");let l=a.getBBox(),h={x:l.x+l.width,y:l.y-l.height};a.setAttribute("transform",`rotate(${s}, ${h.x}, ${h.y})`);let d=a.getBBox();if(d[t]>r){let u=r/d[t];a.textContent=a.textContent.substring(0,Math.floor(u*a.textContent.length))+"..."}})};if(n())return o(-45),!0}function x0(i){return`color(from color(from ${i} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1)) srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`}function $g(i,r,e,t,n,o){let s=G(et,{x:r,y:e,"text-anchor":"middle","dominant-baseline":"central","font-size":n.size||"0.7rem","font-weight":n.weight||"bold","font-style":n.style||"normal"},{fill:`color(from ${t} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`},"vjs-text-outline");o&&o.appendChild(s);let a=G("tspan",{fill:x0(t),stroke:x0(t),"stroke-width":2,"stroke-linejoin":"round"},{});a.innerHTML=i;let l=G("tspan",{x:`${r}`,dy:"0"});return l.innerHTML="&ZeroWidthSpace;",a.appendChild(l),s.appendChild(a),s.insertAdjacentText("beforeend",i),s}function ub(i,r,e){let t=i.container.querySelector("svg"),n=window.getComputedStyle(t),o=Array.from(t.querySelectorAll(".vjs-text-outline"));o.forEach(E=>{let y=window.getComputedStyle(E),x=E.querySelector("tspan"),f=window.getComputedStyle(x);E.setAttribute("data-vjs-export-fill",y.fill),E.setAttribute("data-vjs-export-stroke",y.stroke),x.setAttribute("data-vjs-export-fill",f.fill),x.setAttribute("data-vjs-export-stroke",f.stroke)});let s=t.cloneNode(!0),a=s.getAttribute("viewBox"),l;if(a){let E=a.split(" ").map(y=>parseFloat(y));l={x:E[0],y:E[1],width:E[2],height:E[3]}}else l={x:0,y:0,width:parseFloat(s.getAttribute("width")||"0"),height:parseFloat(s.getAttribute("height")||"0")};Array.from(s.attributes).forEach(E=>s.removeAttribute(E.name)),s.setAttribute("xmlns",Gt),s.removeAttribute("class"),s.setAttribute("font-family",n.fontFamily||"sans-serif"),s.setAttribute("font-size",n.fontSize||"12"),r&&s.setAttribute("width",`${r}`),e&&s.setAttribute("height",`${e}`),g1(s,i.dim.viewBox||{x:0,y:0,width:i.dim.width,height:i.dim.height}),s.querySelectorAll(`.${bc}, .${Ac}`).forEach(E=>E.parentNode.removeChild(E));let d=s.querySelector("filter#vjs-tooltip-shadow");if(d){let E=d.parentElement;E.removeChild(d),E.tagName.toLowerCase()==="defs"&&E.children.length===0&&E.parentElement.removeChild(E)}Array.from(s.querySelectorAll(".vjs-text-outline")).forEach(E=>{let y=E.querySelector("tspan");E.setAttribute("fill",E.getAttribute("data-vjs-export-fill")),E.setAttribute("stroke",E.getAttribute("data-vjs-export-stroke")),y.setAttribute("fill",y.getAttribute("data-vjs-export-fill")),y.setAttribute("stroke",y.getAttribute("data-vjs-export-stroke"))}),o.forEach(E=>{E.removeAttribute("data-vjs-export-fill"),E.removeAttribute("data-vjs-export-stroke");let y=E.querySelector("tspan");y.removeAttribute("data-vjs-export-fill"),y.removeAttribute("data-vjs-export-stroke")});let p=Array.from(s.querySelectorAll("*")),m=E=>{Array.from(E.attributes).forEach(x=>{x.name.indexOf("data-vjs-")===0&&E.removeAttribute(x.name)}),E.removeAttribute("class"),E.removeAttribute("style"),E.removeAttribute("pointer-events")};return p.forEach(m),Array.from(s.querySelectorAll("g")).forEach(E=>{E.children.length===0&&E.parentNode.removeChild(E)}),{element:s,extents:l,svg:s.outerHTML.replace(/\n/g,"")}}function g1(i,r){i.setAttribute("viewBox",`${r.x}, ${r.y} ${r.width} ${r.height}`)}var f8e="vertical",pb="horizontal",E1=10,mb="left",gb="center",T0="right",Pc="top",Oc="middle",Eb="bottom",Bg=class{constructor(r){c(this,"floating");c(this,"visible");c(this,"hover");c(this,"padding");c(this,"orientation");c(this,"align");c(this,"valign");c(this,"font");c(this,"$hideForSingleSeries");r=r||{},this.floating=r.floating===!0,this.visible=r.hide!==!0,this.hover=r.hover!==!1,this.padding=r.padding||E1,this.orientation=r.orientation||pb,this.align=r.align||gb,this.valign=r.valign||Eb,this.$hideForSingleSeries=r.hideForSingleSeries!==!1,this.font=Pi(12,"normal","normal","sans-serif",r.font)}};var Fg="chart:load",v0="No data",C0="Could not draw chart";var P0="vjs-chart-exporter-hamburger",f1="vjs-chart-exporter-menu",y1="vjs-chart-exporter-menu-item",O0="vjs-chart-exporter-hamburger-open",Ug=class{constructor(r,e={}){this.chart=r;this.options=e;c(this,"hamburger");c(this,"menu");c(this,"eventManager");c(this,"hideTimeout");c(this,"To",!1);this.eventManager=new xe,this.eventManager.on(r.container,W,z(P0),t=>{t.stopPropagation(),this.To?this.gc():this.zb()})}Yb(r){let e=this.chart.container;getComputedStyle(e).position==="static"&&(e.style.position="relative"),this.hamburger=Jr("div",{width:"30px",height:"30px",cursor:"pointer",display:"flex",flexDirection:"column",justifyContent:"space-around",padding:"5px",boxSizing:"border-box",background:"rgba(255,255,255,0.8)",borderRadius:"4px"},P0),r==null&&(this.hamburger.style.position="absolute",this.hamburger.style.right=this.options.right||"1rem",this.hamburger.style.top=this.options.top||"1rem",this.hamburger.style.zIndex="100");for(let s=0;s<3;s++){let a=Jr("div",{width:"100%",height:"2px",backgroundColor:"#333"});this.hamburger.appendChild(a)}this.menu=Jr("div",{position:"absolute",display:"none",backgroundColor:"white",border:"1px solid #ccc",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",zIndex:"101",minWidth:"120px",borderRadius:"4px",padding:"5px 0"},f1),[{label:"Download JPG",type:ps},{label:"Download PNG",type:Kh},{label:"Download SVG",type:"svg"}].forEach(s=>{let a=Jr("div",{padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#333"},y1);a.innerText=s.label,this.eventManager.on(a,ze,()=>{this.Xb(s.type),this.gc()}),this.eventManager.on(a,"mouseenter",()=>{a.style.backgroundColor="#f0f0f0"}),this.eventManager.on(a,"mouseleave",()=>{a.style.backgroundColor="transparent"}),this.menu.appendChild(a)}),r!=null?r.appendChild(this.hamburger):e.appendChild(this.hamburger),e.appendChild(this.menu);let n=()=>{this.To&&this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)},o=()=>{this.To&&(n(),this.hideTimeout=setTimeout(()=>{this.gc(),this.hideTimeout=null},500))};this.eventManager.on(this.hamburger,"mouseenter",()=>{n()}),this.eventManager.on(this.hamburger,"mouseleave",()=>{o()}),this.eventManager.on(this.menu,"mouseenter",()=>{n()}),this.eventManager.on(this.menu,"mouseleave",()=>{o()})}zb(){this.menu.style.display="block",this.To=!0,L(this.hamburger,O0);let r=this.chart.container.getBoundingClientRect(),e=this.hamburger.getBoundingClientRect(),t=e.left-r.left+e.width-this.menu.offsetWidth,n=e.top-r.top+e.height+5;t<0&&(t=0),t+this.menu.offsetWidth>r.width&&(t=r.width-this.menu.offsetWidth),n+this.menu.offsetHeight>r.height&&(n=e.top-r.top-this.menu.offsetHeight-5,n<0&&(n=Math.max(0,r.height-this.menu.offsetHeight))),this.menu.style.left=`${t}px`,this.menu.style.top=`${n}px`}gc(){this.menu.style.display="none",this.To=!1,F(this.hamburger,O0)}Xb(r,e){if(e==null&&(e=(this.chart.getTitle()||"chart-export").toString().toLowerCase().replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").substring(0,30)),r==="svg"){let t=this.chart.exportSVG(),n=new Blob([t],{type:Ba.svg});this.Sg(n,`${e}.svg`)}else{let t=r===ps?Ba.jpeg:Ba.png;this.chart.exportImage({type:t,width:1200},n=>{let o=r===ps?"jpg":"png";this.Sg(n.url,`${e}.${o}`,!0)})}}Sg(r,e,t=!1){let n=document.createElement("a");n.download=e,t?n.href=r:n.href=URL.createObjectURL(r),document.body.appendChild(n),n.click(),document.body.removeChild(n),t||URL.revokeObjectURL(n.href)}destroy(){this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.hamburger.parentElement&&this.hamburger.parentElement.removeChild(this.hamburger),this.menu.parentElement&&this.menu.parentElement.removeChild(this.menu)}};var x1="0 0 32 30",b1="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",_0="0 0 32 32",A1="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",S1="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",T1="vjs-chart-zoom-controls",v1="vjs-chart-zoom-button",Yg=class{constructor(r){this.chart=r;c(this,"container");c(this,"eventManager");this.eventManager=new xe}render(r,e){let t=this.chart.container;getComputedStyle(t).position==="static"&&(t.style.position="relative"),e=e||"row",this.container=Jr("div",{display:"flex",flexDirection:e},T1),r==null&&(this.container.style.position="absolute",this.container.style.left="1rem",this.container.style.top="1rem",this.container.style.zIndex="100"),[{title:"Zoom In",path:A1,viewBox:_0,onClick:()=>this.chart.setZoom(this.chart.getZoom()+.1)},{title:"Zoom Out",path:S1,viewBox:_0,onClick:()=>this.chart.setZoom(this.chart.getZoom()-.1)},{title:"Zoom to Extents",path:b1,viewBox:x1,onClick:()=>{this.chart.setZoom(1),this.chart.container.scrollLeft=0,this.chart.container.scrollTop=0}}].forEach(o=>{let s=Jr("div",{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"3px",boxSizing:"border-box"},v1);s.title=o.title,s.innerHTML=`<svg viewBox="${o.viewBox}" width="100%" height="100%" stroke="currentColor" fill="currentColor">
134
+ </div>`}}var kM=1.25,Tm=class{constructor(r,e){this.ui=r;c(this,"Jn");c(this,"Gb");c(this,"rc");c(this,"$preparedShapes");c(this,"onVertexAdded");c(this,"palette");c(this,"$shapeLibrary");if(this.$shapeLibrary=r.getShapeLibrary()||e.shapeLibrary,this.$shapeLibrary==null){U("WARN: no ShapeLibrary set : ShapePalette cannot initialize.");return}let t=e.container,n=e.paletteStrokeWidth||kM,o=e.iconSize||{width:YM,height:zM};this.onVertexAdded=e.onVertexAdded,this.rc=e.dataGenerator,e.dragSize=e.dragSize||Object.assign({},o);let s=e.fill||dg.FILL,a=e.outline||dg.STROKE,l=e.outlineWidth||dg.STROKE_WIDTH;this.Jn=Ar({templates:HM(e.showAllMessage)});let h=`<div class="${dc}" data-vjs-type="{{type}}"><svg:svg viewBox="0 0 ${o.width} ${o.height}" stroke-width="${n}"/>`+(e.showLabels?`<div class="${Ix}">{{label}}</div>`:"")+"</div>";this.Jn.registerTag(jM,{template:h,rendered:(p,g,m,E)=>{var T,S,O;let y=g.type,x=null,f=E.getAttribute(Si)||g.category;f!=null&&p.setAttribute(Si,f);let b=g.shapeId;b!=null&&(p.setAttribute(Sm,b),x=(T=this.$preparedShapes)==null?void 0:T.find(v=>v.shapeId===b)),p.setAttribute("title",g.label||""),g.objectType===se.objectType&&p.setAttribute(yh,Pt);let A=this.$shapeLibrary.getShapeDefinition(y,f);if(A!=null){A.members&&A.objectType===se.objectType&&p.setAttribute("data-vjs-group-template",`${f}:${y}`);let v=A.previewData||{},_=((S=A.initialSize)==null?void 0:S.width)||o.width,P=((O=A.initialSize)==null?void 0:O.height)||o.height,I=p.querySelector("svg");if(I.setAttribute("viewBox",`0 0 ${_} ${P}`),A.icon){let C=this.Jn.parse(A.icon),R=this.Jn.render(C,v).fragment;I.appendChild(R)}else{let C=Yc(rn({},v),{type:y,category:f,width:_,height:P}),R=this.$shapeLibrary.renderCompiledShape(C,n);if(this.$shapeLibrary.$getShapeDefinitionForObject(C).square){let N=Math.min(_,P),M=(_-N)/2,D=(P-N)/2;R.setAttribute("transform",`translate(${M}, ${D})`)}I.appendChild(R);let B={fill:s,stroke:a,"stroke-width":n};if(x!=null){let N=x.properties||{};for(let M in N){let D=M===Fh?"stroke":M===Uh?"stroke-width":M;I.setAttribute(D,N[M]),delete B[D]}}for(let N in B)I.setAttribute(N,B[N])}}},updated:(p,g,m)=>{}});let d;if(e.preparedShapes!=null){let p=e.preparedShapes.map(g=>Object.assign({},this.$shapeLibrary.getShapeDefinition(g.type,g.category),{shapeId:g.shapeId,properties:g.properties,category:g.category,label:g.label,size:g.size}));this.$preparedShapes=p,d=this.Jn.template(aR,{shapes:p})}else d=this.Jn.template(sR,{sets:this.$shapeLibrary.rootSet.children,showAll:e.initialSet==null});if(this.palette=d.childNodes[0],t.appendChild(this.palette),this.Gb=new Xa(r,{source:this.palette,selector:z(dc),dragSize:e.dragSize,dragSizeGenerator:(p,g)=>p&&p.width&&p.height?{width:p.width,height:p.height}:e.dragSize,canDrop:e.canDrop,mode:e.mode,allowClickToAdd:e.allowClickToAdd,lassoClass:oR,elementGenerator:(p,g)=>{let m=p.cloneNode(!0),E=m.querySelector(z(Ix));return E&&E.parentNode.removeChild(E),m},vertexPreviewGenerator:(p,g,m,E,y)=>{let x=Object.assign(m,{[r.$modelWidthAttribute]:5,[r.$modelHeightAttribute]:5,outlineWidth:m.outlineWidth||1}),f=V(we,{preserveAspectRatio:"none",viewBox:"0 0 5 5"});f.classList.add($h);let b=this.$shapeLibrary.renderCompiledShape(x);return f.appendChild(b),f},vertexPreviewUpdater:(p,g,m,E)=>{let y=this.$shapeLibrary.renderCompiledShape(Object.assign(E,{[r.$modelWidthAttribute]:m.width,[r.$modelHeightAttribute]:m.height}));p.replaceChildren(y),p.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`)},dataGenerator:p=>{var C,R,w,B,N;let g=this.rc?this.rc(p)||{}:{},m=p.getAttribute(Gx),E=p.getAttribute(Si),y=p.getAttribute(Sm),x=this.$shapeLibrary.getShapeDefinition(m,E),f=g.fill,b=g.outline,A=g.outlineWidth,T=g.color,S=(C=this.$preparedShapes)==null?void 0:C.find(M=>M.shapeId===y),O=(S==null?void 0:S.properties)||{},v=(R=S==null?void 0:S.size)==null?void 0:R.width,_=(w=S==null?void 0:S.size)==null?void 0:w.height,P=v||g.width||((B=x.initialSize)==null?void 0:B.width)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.width),I=_||g.height||((N=x.initialSize)==null?void 0:N.height)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.height);return Object.assign(g,{type:m,category:E,width:P,height:I,fill:s,outline:a,outlineWidth:l},O),f!=null&&(g.fill=f),b!=null&&(g.outline=b),A!=null&&(g.outlineWidth=A),T!=null&&(g.color=T),x.payload&&Object.assign(g,x.payload),g},allowDropOnEdge:!1,allowDropOnNode:!1,onVertexAdded:p=>{e.selectAfterDrop!==!1&&setTimeout(()=>r.model.setSelection(p.vertex)),this.onVertexAdded&&this.onVertexAdded(p)}}),Array.from(this.palette.querySelectorAll(z(cc))).forEach(p=>{p.addEventListener("change",g=>{let m=p.options[p.selectedIndex].value,E=p.getAttribute(Si);p.setAttribute(Vx,`${m===vs}`),this.sg(m,E)})}),e.inspector!==!1){r.model.bind(qt,m=>{g()}),r.model.bind(Qt,m=>{g()});let p=()=>{Array.from(this.palette.querySelectorAll(z(hg))).forEach(E=>{F(E,hg)})},g=()=>{p();let m=new Set;if(this.ui.model.getSelection().eachVertex((E,y)=>m.add(`${y.type}|${y.data.category||this.$shapeLibrary.defaultCategoryId}`)),m.size===1){let[E,y]=Array.from(m)[0].split("|");if(this.$shapeLibrary.getShapeDefinition(E,y)!=null){let f=this.palette.querySelector(`[${Si}='${y}'][${Gx}='${E}']`);f!=null&&L(f,hg)}}};r.model.bind(ir,()=>{p()}),r.on(this.palette,W,z(dc),m=>{let E=m.target.closest(z(dc)),y=E.getAttribute(Si),x=E.getAttribute(Gx),b=this.$shapeLibrary.getShapeDefinition(x,y).objectType||ce.objectType,A=this.ag();A.isEmpty()||r.model.transaction(()=>{A.eachVertex((T,S)=>{S.objectType===b&&r.model.updateVertex(S,{[this.$shapeLibrary.categoryParameter]:y,[this.$shapeLibrary.typeParameter]:x})})})}),r.model.bindAll([Le,ve],m=>{this.ag().containsVertex(m.vertex.id)&&g()})}e.initialSet!=null&&this.setCurrentSet(e.initialSet)}ag(){return this.ui.model.getSelection().filter(r=>K(r)||Y(r))}$b(r){return this.palette.querySelector(`${z(cc)}[${Si}='${r}']`)}sg(r,e){let t=e==ho?this.palette:this.palette.querySelector(`${z(Am)}[${Si}='${e}']`);t.setAttribute(Vx,`${r==vs}`),Array.from(t.querySelectorAll(z(Am))).filter(o=>o.parentElement===t).forEach(o=>{o.setAttribute(XM,`${r===vs||r===o.getAttribute(Si)}`)})}lg(r,e){this.sg(r,e);let t=this.$b(e);t!=null&&(t.value=r,t.setAttribute(Vx,`${r===vs}`))}setCurrentSet(r){if(r!=null){let e=this.$shapeLibrary.getShapeSet(r);if(e!=null){let t=[[e.id,e.parent]],n=e.parent;for(;n!=null&&n!==ho;){let o=this.$shapeLibrary.getShapeSet(n);t.unshift([n,o.parent]),n=o.parent}t.forEach(o=>{this.lg(o[0],o[1])})}}else this.lg(vs,ho)}};var Bx="vjs-diagram-node",Fx="vjs-diagram-group",lR=100,hR=80,cR=[a_];var Jn=class{constructor(r,e){this.diagram=r;this.vertex=e;c(this,"el");c(this,"$destroyed",!1)}get id(){return this.vertex.getFullId()}get zIndex(){return this.vertex.data.z==null?0:this.vertex.data.z}update(r){this.diagram.model.updateVertex(this.vertex,r)}setSize(r){this.diagram.$ui.setSize(this.vertex,r.width,r.height)}setPosition(r){this.diagram.$ui.setPosition(this.vertex,r.x,r.y)}setLabel(r){this.diagram.model.updateVertex(this.vertex,{[this.diagram.labelAttribute]:r})}setFill(r){this.diagram.model.updateVertex(this.vertex,{[Fy]:r})}setOutline(r){this.diagram.model.updateVertex(this.vertex,{[Fh]:r})}setOutlineWidth(r){this.diagram.model.updateVertex(this.vertex,{[Uh]:r})}setColor(r){this.diagram.model.updateVertex(this.vertex,{[Uy]:r})}get label(){return this.vertex.data[lo]}get fill(){return this.vertex.data[Fy]||Yh}get outline(){return this.vertex.data[Fh]||cs}get outlineWidth(){return this.vertex.data[Uh]||zh}get color(){return this.vertex.data[Uy]||s_}get size(){return{width:this.vertex.data[this.diagram.cellWidthAttribute],height:this.vertex.data[this.diagram.cellHeightAttribute]}}get width(){var r;return((r=this.size)==null?void 0:r.width)||0}get height(){var r;return((r=this.size)==null?void 0:r.height)||0}get position(){return{x:this.vertex.data[this.diagram.cellLeftAttribute],y:this.vertex.data[this.diagram.cellTopAttribute]}}remove(){this.diagram.removeCell(this)}destroy(){this.diagram=null,this.vertex=null,this.$destroyed=!0}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}};var Ti=class{constructor(r,e){this.diagram=r;this.edge=e;c(this,"$destroyed",!1)}get id(){return this.edge.id}get connection(){return this.diagram.$ui.getRenderedConnection(this.edge.id)}update(r){this.diagram.model.updateEdge(this.edge,r)}remove(){this.diagram.model.remove(this.edge)}setLabel(r){this.update({label:r})}get label(){return this.edge.data.label}setColor(r){this.update({color:r})}get color(){return this.edge.data.color}setLineWidth(r){this.update({lineWidth:r})}get lineWidth(){return this.edge.data.lineWidth}setOutlineColor(r){this.update({outlineColor:r})}get outlineColor(){return this.edge.data.outlineColor}setOutlineWidth(r){this.update({outlineWidth:r})}get outlineWidth(){return this.edge.data.outlineWidth}setDashArray(r){this.update({dashArray:r})}get dashArray(){return this.edge.data.dashArray}setLabelLocation(r){this.update({labelLocation:r})}get labelLocation(){return this.edge.data.labelLocation}setSource(r){this.diagram.model.setSource(this.edge,r instanceof Jn?r.id:r)}get source(){return this.edge.source}setTarget(r){this.diagram.model.setTarget(this.edge,r instanceof Jn?r.id:r)}get target(){return this.edge.target}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}destroy(){this.diagram=null,this.edge=null,this.$destroyed=!0}};function dR(){return{dragOnGrid:!0,showGrid:!0,showBorder:!1,autoShrink:!0,minWidth:1e4,maxWidth:null,minHeight:1e4,maxHeight:null,showTickMarks:!1,type:Ga.type}}var WM=15,Ux="vjs-cell-tool",uR="vjs-clone-cell",pR="vjs-delete-cell",ZM="vjs-link-cell",Cs=class extends Ts{constructor(){super(...arguments);c(this,"id","diagramTools");c(this,"$buttonSize");c(this,"$allowClone");c(this,"$allowDelete");c(this,"$allowLink");c(this,"$canShowLinkButton");c(this,"$canDelete");c(this,"$canClone");c(this,"$shouldDeleteGroupMembers");c(this,"$buttonY")}initialise(e,t){return super.initialise(e,t),this.$buttonSize=t.buttonSize||WM,this.$allowClone=t.allowClone!==!1,this.$allowDelete=t.allowDelete!==!1,this.$allowLink=t.allowLink!==!1,this.$canShowLinkButton=t.canShowLinkButton,this.$canDelete=t.canDelete,this.$canClone=t.canClone,this.$shouldDeleteGroupMembers=t.shouldDeleteGroupMembers,this.$buttonY=-1*(this.Tt/2+this.$buttonSize),this.surface.on(this.surface.getContainer(),W,z(uR),n=>{let s=n.target.closest(`[${te}]`).getAttribute(te);s!=null&&(oe(n),this.surface.cloneVertex(s,{selectAfterCreate:!0}))}),this.surface.on(this.surface.getContainer(),W,z(pR),n=>{let o=n.target.closest(`[${te}]`),s=o.getAttribute(te);if(s!=null){oe(n);let a=this.surface.model.getVertex(s);Y(a)?this.surface.model.removeGroup(s,this.$shouldDeleteGroupMembers==null?!1:this.$shouldDeleteGroupMembers(a,o)===!0):this.surface.model.removeNode(a)}}),!1}Qh(e,t,n,o){let s=super.Qh(e,t,n,o);if(this.$canClone?this.$canClone(e.modelObject,e.el):this.$allowClone){let d=V(Q,{transform:`translate(${this.$getCloneButtonX(e)}, ${this.$getCloneButtonY(e)})`});s.appendChild(d),fg(gg,this.$buttonSize,this.$buttonSize,[uR,Ux],{title:"Click to clone"},d),this.skeletons[e.id].cloneButton=d}if(this.$canDelete?this.$canDelete(e.modelObject,e.el):this.$allowDelete){let d=V(Q,{transform:`translate(${this.$getDeleteButtonX(e)}, ${this.$getDeleteButtonY(e)})`});s.appendChild(d),fg(mg,this.$buttonSize,this.$buttonSize,[pR,Ux],{title:"Click to delete"},d),this.skeletons[e.id].deleteButton=d}if(this.$canShowLinkButton?this.$canShowLinkButton(e.modelObject,e.el):this.$allowLink){let d=V(Q,{transform:`translate(${this.$getLinkButtonX(e)}, ${this.$getLinkButtonY(e)})`});s.appendChild(d),fg(pg,this.$buttonSize,this.$buttonSize,[ZM,Ux],{title:"Click and drag to link","data-vjs-source":!0,[te]:e.id},d,{"data-vjs-source":!0}),this.skeletons[e.id].linkButton=d}return s}$getCloneButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getCloneButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getDeleteButtonX(e){return-(this.$buttonSize/2+this.$handleOffset)}$getDeleteButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getLinkButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getLinkButtonY(e){return e.height+this.$buttonSize/2+this.$handleOffset}$_setSkeletonPositionById(e){if(this.skeletons[e]&&super.$_setSkeletonPositionById(e)){let t=this.surface.$getManagedElement(e),n=this.skeletons[t.id].cloneButton;n&&n.setAttribute(yi,`translate(${this.$getCloneButtonX(t)}, ${this.$getCloneButtonY(t)})`);let o=this.skeletons[t.id].deleteButton;o&&o.setAttribute(yi,`translate(${this.$getDeleteButtonX(t)}, ${this.$getDeleteButtonY(t)})`);let s=this.skeletons[t.id].linkButton;return s&&s.setAttribute(yi,`translate(${this.$getLinkButtonX(t)}, ${this.$getLinkButtonY(t)})`),!0}return!1}};c(Cs,"type","diagramTools"),Cs=Ye([He("diagramTools")],Cs);var uc=class extends Tm{constructor(r,e,t){let n=t==null?void 0:t.onVertexAdded,o=t==null?void 0:t.onCellAdded;super(e.$ui,Object.assign(t||{},{container:r,inspector:(t==null?void 0:t.inspector)!==!1,selectAfterDrop:t==null?void 0:t.selectAfterAdd,onVertexAdded:s=>{o&&o(e.getCell(s.vertex.id)),n&&n(s)},dataGenerator:s=>{let a=Object.assign({},e.$propertyTracker.getValues()),l=s.getAttribute(Sm);if(l){let h=this.$preparedShapes.find(d=>d.shapeId===l);h&&Object.assign(a,h.properties||{})}return a}}))}};function Yx(i){return i.startEditingPath!==void 0}function gR(i){return i.isEmpty()?0:i.head().zIndex}function JM(i){return i.isEmpty()?0:i.peek().zIndex}var vm=class{constructor(r,e,t){this.model=r;c(this,"$shapeLibrary");c(this,"$ui");c(this,"defaultCellWidth");c(this,"defaultCellHeight");c(this,"labelAttribute");c(this,"$_cellMap");c(this,"$editable");c(this,"$_cellList");c(this,"$propertyTracker");c(this,"F");var a,l,h,d,u,p,g,m,E,y,x,f,b,A,T,S,O,v,_,P,I,C,R,w,B,N,M,D,G,J,fe,X,me,$e,ke,Ut,nr,Ht,vr,Ri,Rs,Ls,ws,Ds,Ns,Bc,Fc,El,Uc,fl,Co;t=t||{},this.F=t.mediator,this.$_cellList=new Vs((re,Ue)=>re.zIndex<Ue.zIndex?-1:re.zIndex>Ue.zIndex?1:0),this.$_cellMap=new Map,this.labelAttribute=((a=t.cells)==null?void 0:a.labelProperty)||lo,this.$shapeLibrary=new Pa(t.shapes||cR,{labelFillRatio:(l=t.cells)==null?void 0:l.labelFillRatio,multilineLabels:(h=t.cells)==null?void 0:h.multilineLabels,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,labelPosition:(d=t.cells)==null?void 0:d.labelPosition}),this.$propertyTracker=new Rp(this.model,{fill:t.defaultFillColor||Yh,outline:t.defaultOutlineColor||cs,outlineWidth:t.defaultOutlineWidth||zh,color:t.defaultColor||cs}),this.defaultCellWidth=((u=t.cells)==null?void 0:u.defaultWidth)||lR,this.defaultCellHeight=((p=t.cells)==null?void 0:p.defaultHeight)||hR,this.$editable=t.editable!==!1;let n=[];if(t.editable!==!1){if(n.push({type:Cs.type,options:{rotationStops:(g=t.cells)==null?void 0:g.rotationStops,canResizeFilter:(re,Ue)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.resizable)!==!1&&this.Bb(re,Ue)!==!1},canRotateFilter:(re,Ue)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.rotatable)!==!1&&this.Fb(re,Ue)!==!1},canShowLinkButton:(re,Ue)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.linkable)!==!1&&this.Ub(re,Ue)!==!1},canDelete:(re,Ue)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.deletable)!==!1&&this.zb(re,Ue)!==!1},canClone:(re,Ue)=>{var vt,lr;return((vt=t.cells)==null?void 0:vt.editable)!==!1&&((lr=t.cells)==null?void 0:lr.clonable)!==!1&&this.Yb(re,Ue)!==!1},handleShape:(E=(m=t.cells)==null?void 0:m.resize)==null?void 0:E.handleShape,handleSize:(x=(y=t.cells)==null?void 0:y.resize)==null?void 0:x.handleSize,modelUpdater:(b=(f=t.cells)==null?void 0:f.resize)==null?void 0:b.modelUpdater,shouldDeleteGroupMembers:(A=t.cells)==null?void 0:A.shouldDeleteGroupMembers,handlerFactory:(S=(T=t.cells)==null?void 0:T.resize)==null?void 0:S.handlerFactory,resizeMethod:(v=(O=t.cells)==null?void 0:O.resize)==null?void 0:v.method,bordersVisible:(P=(_=t.cells)==null?void 0:_.resize)==null?void 0:P.bordersVisible,ignoreGrid:((C=(I=t.cells)==null?void 0:I.resize)==null?void 0:C.ignoreGrid)===!0,resizeX:(w=(R=t.cells)==null?void 0:R.resize)==null?void 0:w.resizeX,resizeY:(N=(B=t.cells)==null?void 0:B.resize)==null?void 0:N.resizeY}}),t.snapLines!=null){let re=t.snapLines===!0?{}:t.snapLines;n.push({type:bs.type,options:re})}if(t.panButtons!=null){let re=t.panButtons===!0?{}:t.panButtons;n.push({type:As.type,options:re})}if(t.lineCrossings!=null){let re=t.lineCrossings===!0?{}:t.lineCrossings;n.push({type:mm,options:re})}}t.grid!=null&&t.grid.visible!==!1&&n.push({type:ms.type,options:dR()}),t.lasso!=null&&(Po(t.lasso)?n.push(kn.type):n.push({type:kn.type,options:t.lasso})),t.miniview!=null&&n.push({type:Wn.type,options:t.miniview}),t.dragGroups!=null&&n.push({type:xs.type,options:t.dragGroups}),((M=t.edges)==null?void 0:M.highlightSelected)===!0&&n.push({type:Ba.type,options:{paintStyle:(D=t.edges)==null?void 0:D.highlightStyle}});let o=t.defaults||{},s={zoom:t.zoom,pan:t.pan,activeFiltering:(G=t.edges)==null?void 0:G.activeFiltering,grid:t.grid,zoomToFit:t.zoomToFit,zoomToFitIfNecessary:t.zoomToFitIfNecessary,useModelForSizes:!0,writeSizeToElements:!1,useSvgContainer:!0,wheel:t.wheel,magnetizer:(J=t.cells)==null?void 0:J.magnetizer,getCollapsedGroupSize:(fe=t.cells)==null?void 0:fe.getCollapsedGroupSize,canCollapseGroup:(re,Ue)=>this.F!=null&&this.F.canCollapse!=null?this.F.canCollapse(re,Ue):!0,canExpandGroup:(re,Ue)=>this.F!=null&&this.F.canExpand!=null?this.F.canExpand(re,Ue):!0,elementsDraggable:this.$editable!==!1&&((X=t.cells)==null?void 0:X.draggable)!==!1,defaults:o,view:this.Xb(t),shapes:{library:this.$shapeLibrary,showLabels:((me=t.cells)==null?void 0:me.showLabels)!==!1,strokeWidth:($e=t.cells)==null?void 0:$e.outlineWidth,labelAttribute:(ke=t.cells)==null?void 0:ke.labelProperty,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,font:(Ut=t.cells)==null?void 0:Ut.font},edges:{editable:t.editable!==!1&&((nr=t.edges)==null?void 0:nr.editable)!==!1,editOnTap:t.editable!==!1,propertyMappings:(Ht=t.edges)==null?void 0:Ht.propertyMappings,avoidVertices:(vr=t.edges)==null?void 0:vr.avoidVertices,allowUnattached:((Ri=t.edges)==null?void 0:Ri.allowUnattached)!==!1,connector:(Rs=t.edges)==null?void 0:Rs.connector,layerIndex:(Ls=t.edges)==null?void 0:Ls.layerIndex,sourceMarker:(ws=t.edges)==null?void 0:ws.sourceMarker,targetMarker:(Ds=t.edges)==null?void 0:Ds.targetMarker,overlays:(Ns=t.edges)==null?void 0:Ns.overlays,anchor:(Bc=t.edges)==null?void 0:Bc.anchor,anchors:(Fc=t.edges)==null?void 0:Fc.anchors,inputMethod:(El=t.edges)==null?void 0:El.inputMethod,reattach:((Uc=t.edges)==null?void 0:Uc.reattach)===!0,detachable:(fl=t.edges)==null?void 0:fl.detachable},edgeSnap:(Co=t.edges)==null?void 0:Co.snap,plugins:n,events:{[Rn]:()=>{t.deselectOnCanvasTap!==!1&&this.model.clearSelection()},[Ws]:re=>{if(this.$editable){let Ue=this.$_cellMap.get(re.dragGroup[0].vertex.id);Ue!=null&&this.toFront(Ue)}},[eS]:re=>{if(this.$editable){let Ue=this.$_cellMap.get(re.dragGroup[0].vertex.id);Ue!=null&&this.toFront(Ue)}}},dragOptions:{filter:re=>this.F&&this.F.canDrag?this.F.canDrag(re.vertex,this.Dr(re.vertex),re.el):!0,canDrop:(re,Ue,vt)=>this.F&&this.F.canDrop?this.F.canDrop(re,Ue,vt):!0,autoPan:t.autoPan!==!1},templates:{nodeDefault:`<svg:g ${qo}="${this.$editable}" class="${Bx}"><vjs-shape/></svg:g>`,groupDefault:`<svg:g ${qo}="${this.$editable}" class="${Fx}"><vjs-shape/></svg:g>`,groupNoTarget:`<svg:g class="${Fx}"><vjs-shape/></svg:g>`,nodeNoTarget:`<svg:g class="${Bx}"><vjs-shape/></svg:g>`}};this.$editable?this.$ui=this.model.render(e,s):this.$ui=this.model.renderPaper(e,s),this.$ui.bind(Ur,re=>{this.hg(re.vertex,re.el)}),this.$ui.bind(Fr,re=>{this.hg(re.vertex,re.el)}),this.model.bind(Ce,re=>{this.cg(re.node)}),this.model.bind(Re,re=>{this.cg(re.group)}),this.model.bind(Jt,()=>{this.$_cellMap.clear(),this.$_cellList.clear()})}get cellWidthAttribute(){return this.model.modelWidthAttribute}get cellHeightAttribute(){return this.model.modelHeightAttribute}get cellLeftAttribute(){return this.model.modelLeftAttribute}get cellTopAttribute(){return this.model.modelTopAttribute}Xb(r){var h,d,u,p,g,m,E,y,x,f,b,A,T,S,O;let e=(h=r.edges)!=null&&h.events?r.edges.events[Xe]:null,t={events:{[Xe]:v=>{let _=v.e.srcElement||v.e.target;if(gn(_,ga)){oe(v.e),v.model.removeEdge(v.connection.edge);return}r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||v.model.getSelection().ne.length<1||v.e.shiftKey!==!0?v.model.setSelection(v.obj):v.model.addToSelection(v.obj)),e&&e(v)}},overlays:((d=r.edges)==null?void 0:d.overlays)||[],sourceMarker:(u=r.edges)==null?void 0:u.sourceMarker,targetMarker:(p=r.edges)==null?void 0:p.targetMarker,label:null,labelLocation:.5,labelLocationAttribute:null,deleteButton:(g=r.edges)==null?void 0:g.deleteButton,deleteButtonClass:(m=r.edges)==null?void 0:m.deleteButtonClass,deleteButtonLocation:(E=r.edges)==null?void 0:E.deleteButtonLocation,deleteConfirm:(y=r.edges)==null?void 0:y.deleteConfirm};if(r.edges){if(r.edges.showLabels){let v=r.edges.labelProperty||"label";t.label=`{{${v}}}`,r.edges.labelLocation!=null&&(t.labelLocation=r.edges.labelLocation),r.edges.labelLocationProperty!=null&&(t.labelLocationAttribute=r.edges.labelLocationProperty),r.edges.labelFont!=null&&(t.labelFont=r.edges.labelFont),r.edges.labelsRotatable!=null&&(t.labelsRotatable=r.edges.labelsRotatable)}if(r.edges.events)for(let v in r.edges.events)v!==Xe&&(t.events[v]=r.edges.events[v])}let n=Object.assign({},((x=r.cells)==null?void 0:x.events)||{}),o=v=>_=>{this.$editable&&this.toFront(this.$_cellMap.get(_.obj.id)),r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||_.model.getSelection().pe.length<1||_.e.shiftKey!==!0?_.model.setSelection(_.obj):_.model.addToSelection(_.obj)),v&&v(_)};n.tap=o((b=(f=r.cells)==null?void 0:f.events)==null?void 0:b.tap);let s={events:n,templateIdResolver:(v,_,P,I)=>{let C=this.Dr(I);return C!=null&&C.defaultTarget===!1?"groupNoTarget":"groupDefault"}};if((A=r.cells)!=null&&A.groups){let v=(T=r.cells)==null?void 0:T.groups,_=v.events||{};_.tap&&(_.tap=o(_.tap)),delete v.template,Object.assign(s,v)}let a={events:n,templateIdResolver:(v,_,P,I)=>{let C=this.Dr(I);return C!=null&&C.defaultTarget===!1?"nodeNoTarget":"nodeDefault"}};if((S=r.cells)!=null&&S.nodes){let v=(O=r.cells)==null?void 0:O.nodes,_=v.events||{};_.tap&&(_.tap=o(_.tap)),delete v.template,Object.assign(a,v)}return{nodes:{default:a},edges:{default:t},groups:{default:s}}}hg(r,e){r.data.z==null&&(r.data.z=gR(this.$_cellList)+1);let t=new Jn(this,r);t.el=e,this.$_cellMap.set(r.id,t),this.$_cellList.add(t)}cg(r){let e=this.$_cellMap.get(r.id);e!=null&&(this.$_cellList.delete(e),e.destroy(),this.$_cellMap.delete(r.id))}Fb(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canRotate?this.F.canRotate(r,t,e):!0}Ub(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canLink?this.F.canLink(r,t,e):!0}Yb(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canClone?this.F.canClone(r,t,e):!0}Bb(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canResize?this.F.canResize(r,t,e):!0}zb(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canDelete?this.F.canDelete(r,t,e):!0}Dr(r){let e=r.data.type,t=r.data.category;return this.$shapeLibrary.getShapeDefinition(e,t)}destroy(){this.$ui.destroy()}jb(r){return j(r)?r:r.id}nc(r){return j(r)?this.$_cellMap.get(r):r}getCell(r){let e=this.$_cellMap.get(r);return e&&e.el==null&&(e.el=this.$ui.getRenderedElement(r)),e}addCell(r){if(r.type==null)return U("WARN: cannot add a cell with no `type` to the diagram"),null;let e=this.$shapeLibrary.getShapeDefinition(r.type,r.category);if(e==null)return U(`WARN: cannot add cell with type ${r.type} and category ${r.category}; not found in shape library`),null;Object.assign(r,e.payload||{}),r[this.cellWidthAttribute]==null&&(r[this.cellWidthAttribute]=this.defaultCellWidth),r[this.cellHeightAttribute]==null&&(r[this.cellHeightAttribute]=this.defaultCellHeight),r[this.cellLeftAttribute]==null&&(r[this.cellLeftAttribute]=0),r[this.cellTopAttribute]==null&&(r[this.cellTopAttribute]=0);let t=this.$ui.model.addNode(r),n=new Jn(this,t);return this.$_cellMap.set(t.id,n),n.el=this.$ui.getRenderedElement(t),n}getLink(r){let e=this.model.getEdge(r);return e==null?null:new Ti(this,e)}addLink(r){let e=Object.assign({},r);e.source instanceof Jn&&(e.source=e.source.id),e.target instanceof Jn&&(e.target=e.target.id);let t=this.model.addEdge(e);return new Ti(this,t)}load(r){this.clear(),this.model.load(r)}exportData(){return this.model.exportData()}exportSvg(r){return Ya(this.$ui,r).svg}exportImage(r,e){em(this.$ui,r,e)}save(r){return this.$ui.save(r)}saveToUrl(r){this.model.save(Object.assign(r,{data:this.save(r)}))}getCellCount(){return this.model.getNodeCount()}getLinkCount(){return this.model.getEdgeCount()}clear(){this.model.clear()}removeCell(r){this.model.remove(this.jb(r))}toFront(r){if(!(r instanceof Ti)){let e=this.nc(r);if(e!=null){let t=gR(this.$_cellList);e.vertex.data.z<t&&(e.vertex.data.z=t+1,this.$_cellList.update(e),this.$ui.toFront(e.vertex))}}}toBack(r){if(!(r instanceof Ti)){let e=this.nc(r);if(e!=null){let t=JM(this.$_cellList);e.vertex.data.z>t&&(e.vertex.data.z=t-1,this.$_cellList.update(e),this.$ui.toBack(e.vertex))}}}selectCell(r){let e=this.nc(r);e!=null&&this.model.setSelection(e.vertex.id)}selectLink(r){let e=this.model.getEdge(j(r)?r:r.id);e!=null&&this.model.setSelection(e)}selectEdge(r){this.selectLink(r)}startEditingPath(r,e){let t=r instanceof Ti?r.edge:r;Yx(this.$ui)&&this.$ui.startEditingPath(t,e)}stopEditingPath(){Yx(this.$ui)&&this.$ui.stopEditingPath()}clearPathEdits(r){if(Yx(this.$ui)){let e=r instanceof Ti?r.edge:r;this.$ui.clearPathEdits(e)}}getZoom(){return this.$ui.getZoom()}attachMiniview(r){this.$ui.addPlugin({type:Wn.type,options:r})}attachPalette(r,e){return new uc(r,this,e)}setZoom(r){this.$ui.setZoom(r)}zoomToFit(r){this.$ui.zoomToFit(r)}zoomToFitIfNecessary(r){this.$ui.zoomToFitIfNecessary(r)}};function xXe(i,r,e){return new uc(r,i,e)}function bXe(i,r,e,t){var s,a,l,h;r=r||{},e=e||{},e.beforeStartConnect==null&&(e.beforeStartConnect=r.beforeStartConnect),e.beforeConnect==null&&(e.beforeConnect=r.beforeConnect),Object.assign(e,{modelWidthAttribute:((s=r==null?void 0:r.cells)==null?void 0:s.widthProperty)||_e,modelHeightAttribute:((a=r==null?void 0:r.cells)==null?void 0:a.heightProperty)||Ve,modelLeftAttribute:((l=r==null?void 0:r.cells)==null?void 0:l.leftProperty)||ee,modelTopAttribute:((h=r==null?void 0:r.cells)==null?void 0:h.topProperty)||ye,selectionMode:Ud});let o=yn(e).renderDiagram(i,r);return t&&o.load({data:t}),o}var mR=class extends za{constructor(r,e,t){super(r,e.$ui,t)}};var ER="data-vjs-popup-position",BXe="vjs-surface-popup";function fR(i,r,e,t){let n=ft(r),o=t.getEffectiveVisibleZoom(),s=e.width/o,a=e.height/o;switch(i){case"bottom":{n.x=r.x+r.width/2-s/2,n.y=r.y+r.height;break}case"top":{n.x=r.x+r.width/2-s/2,n.y=r.y-a;break}case"left":{n.x=r.x-s,n.y=r.y+r.height/2-a/2;break}case"right":{n.x=r.x+r.width,n.y=r.y+r.height/2-a/2;break}case"center":{n.x=r.x+r.width/2-s/2,n.y=r.y+r.height/2-a/2;break}}return t.toViewportLocation(n.x,n.y)}var yR=class{constructor(r,e,t,n,o){c(this,"ut",null);c(this,"dg","bottom");c(this,"ug","bottom");c(this,"setCurrent");c(this,"container");c(this,"surface");c(this,"Q");this.container=e,this.surface=t,this.setCurrent=n,this.ug=o||"bottom",this.surface.addDragSelectorFilter(r),this.surface.addElementEventFilter(r);let s=p=>{let g=t.getElementFromEvent(p);if(g!=null){oe(p);let m=p.target.getAttribute(ER)||this.ug;this.mo(g.modelObject,m)}else this.mo(null)},a=p=>{this.mo(null)},l=p=>{this.ut&&this.ut.modelObject===p.vertex&&(this.$positionPopup(),this.setCurrent(this.ut.modelObject))},h=p=>{this.ut&&this.ut.modelObject===p.vertex&&this.mo(null)},d=p=>{this.ut!=null&&p.dragGroup.forEach(g=>{var m;g.vertex===((m=this.ut)==null?void 0:m.modelObject)&&this.$positionPopup()})},u=()=>this.$positionPopup();t.on(t.getContainer(),W,r,s),t.bind(Rn,a),t.model.bind(Le,l),t.model.bind(ve,l),t.model.bind(Ce,h),t.model.bind(Re,h),t.bind(Mt,d),t.bind(Io,d),t.bind($r,u),t.bind(Fi,u),this.Q=()=>{t.off(t.getContainer(),W,s),t.unbind(Rn,a),t.model.unbind(Le,l),t.model.unbind(ve,l),t.model.unbind(Ce,h),t.model.unbind(Re,h),t.unbind(Mt,d),t.unbind(Io,d),t.unbind($r,u),t.unbind(Fi,u)}}mo(r,e){var t;r==null?this.ut=null:(this.ut=(t=this.surface)==null?void 0:t.getElement(r.getFullId()),this.dg=e||"bottom"),this.setCurrent(r),r!=null&&requestAnimationFrame(()=>this.$positionPopup())}$destroy(){this.Q()}$hide(){this.mo(null)}$positionPopup(){if(this.ut!=null&&this.container!=null){let r=Je(this.container),e=fR(this.dg,this.ut,r,this.surface);this.surface.floatElement(this.container,e)}}};function Tje(i,r){Rg.register(i,r)}function vje(i,r,e){return yn(e||{}).render(i,r)}var KM=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e||xR,r)},qM=(e=>(e.idle="idle",e.dragging="dragging",e))(qM||{}),bO="assigned",Wa="added";function QM(i){return j(i)?{id:i,active:!0,membership:Wa}:{id:i.id,active:i.active,membership:i.membership}}var eV=z(Rh);function tV(i,r){let e=fE(i.members,t=>t.el.id===r);return e!==null?e.active===!0:!1}var rV=["input","textarea","select","button","option"],xR=rV.join(","),Cm=class{constructor(r){c(this,"inputFilterSelector");c(this,"Nr",{});c(this,"ic",[]);c(this,"activeGrid");c(this,"downAt");c(this,"viewportPositionAtDown");c(this,"relativePositionAtDown");c(this,"newPosition");c(this,"oc");c(this,"O");c(this,"sc");c(this,"go");c(this,"u");c(this,"_");c(this,"xe");c(this,"Ir");c(this,"ia");c(this,"lc");c(this,"he");c(this,"oa",[]);c(this,"hc");c(this,"Eo");c(this,"sa",null);c(this,"vt",[]);c(this,"currentState","idle");c(this,"R");c(this,"hn",{});c(this,"dc",{});c(this,"Wt",null);c(this,"be",new Map);c(this,"fo",new Map);c(this,"ui");c(this,"draggableInstance");c(this,"resolveGrid");this.ui=r.ui,this.draggableInstance=r.draggableInstance,this.resolveGrid=r.resolveGrid,this.inputFilterSelector=r.inputFilterSelector||xR;let e=`${Ae(te)}, ${Ae(te)} *`;this.draggableInstance.addDragHandler({selector:e,start:t=>this.kb(t),drag:t=>this.Hb(t),stop:t=>{this.Wb(t)},constrainFunction:(t,n,o,s,a,l)=>t,destroy:()=>this.$destroy()}),this.ui.bind($r,t=>{this.currentState==="dragging"&&(this.go=this.go*(t.zoom/this.sc),this.sc=t.zoom)}),this.draggableInstance.dragOptions.autoPan!==!1&&(this.R=new Yn(this.draggableInstance,{autoPanDelta:this.draggableInstance.dragOptions.autoPanDelta||5,autoPanRepeat:this.draggableInstance.dragOptions.autoPanRepeat||15,boundsStrategy:this.draggableInstance.dragOptions.autoPanBoundsStrategy,onPan:t=>{this.O=Object.assign({},t),this.pg(!1)},shouldHandle:()=>this.oc!==!0}))}uc(r){for(let e in this.Nr){let t=this.Nr[e],n=t[0](r);if(t[1]&&(n=!n),!n)return!1}return!0}addDragFilter(r,e,t){if(r&&nn(r)){r.yo=e||$();let n=r.yo;this.Nr[n]=[r,t!==!1]}}removeFilter(r){let e=typeof r=="function"?r.yo:r;delete this.Nr[e]}addSelectorFilter(r,e){this.addDragFilter(t=>{let n=t.srcElement||t.target;return $t(n,r,this.ui.getContainer())},r,e)}addClassnameFilter(r,e){r&&(r=Array.isArray(r)?r:[r],r.forEach(t=>{t.split(",").map(Ct).forEach(o=>{let s=a=>{let l=a.srcElement||a.target;return gn(l,o)};s.Zb=o,this.addDragFilter(s,t,e)})}))}Jb(r){for(let e in this.Nr)if(this.Nr[e].Zb===r){delete this.Nr[r];return}}removeClassnameFilter(r){r&&(r=Array.isArray(r)?r:[r],r.forEach(e=>{e.split(",").map(Ct).forEach(n=>{this.Jb(n)})}))}clearAllFilters(){this.Nr={}}Q(){this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer(),this.he&&this.he.cleanup(),this.he=null,this.lc=!1,this.activeGrid=null,this.downAt=null,this.newPosition=null,this.viewportPositionAtDown=null,F(document.body,mt),F(this.ui.rootElement,_y),this.Eo||(F(this.ui.rootElement,Nh),F(this.ui.rootElement,xr),F(this.ui.rootElement,br)),this._!=null&&F(this._.el,Oy),this.u!=null&&(Array.from(this.draggableInstance.getContainer().querySelectorAll(eV)).forEach(r=>{F(r,Rh)}),L(this.u.el,Rh),F(this.u.el,Oh),this.be.forEach(r=>{F(r.managedElement.el,Oh),L(r.managedElement.el,Rh)})),this.currentState="idle",this.u=null,this._=null,this.mg(),this.oa.forEach(r=>{this.gg(r.managedElement,xr,Ny,Nh)}),this.oa.length=0,this.fo.clear(),this.be.clear(),this.Wt=null}mg(){this.vt.forEach(r=>{this.gg(r.managedElement,br)}),this.vt.length=0}Kb(r,e){let t=this.ui.$getManagedElement(r.id);for(;t!=null;){if(this.Eg(t,e))return t;t.modelObject.group?t=this.ui.$getManagedElement(r.group.id):t=null}return null}qb(r){r=r||0;let e=-r*Math.PI/180;return{cos:Math.cos(e),sin:Math.sin(e)}}kb(r){if(r.e.Qb==!0||r.e.which===3||r.e.button===2)return!1;if(this.currentState==="idle"){if(this.R&&this.R.reset(),this.sa=null,!this.draggableInstance.$canStartElementDrag())return!1;if(r.el.getAttribute(yr)!==ct)if(this.uc(r.e)&&KM(r.e,this.ui.getContainer(),this.inputFilterSelector)){let t=null,n=Bt(r.el,Ae(gt),this.ui.getContainer(),!0);if(n!=null&&(t=this.ui.getModelObjectFromElement(n,!1,!1)),t!=null&&!rt(t.obj)&&!H(t.obj))if(this.draggableInstance.isDraggable(n)){if(this.be.clear(),this.hc=!0,r.e.Qb=!0,this.u=this.Kb(t.obj,r.e),this.u==null)return r.e.jy=!0,!1;this.ia=!1,this.xe={isGroupElement:!1,contentArea:null,pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0}},this.O={x:0,y:0},this.oc=r.e.shiftKey;let o=this.u.modelObject.group==null,s=!1;if(o)this._=null,this.Ir=null;else{if(this._=this.ui.$getManagedElement(this.u.modelObject.group.id),this.Ir=this.ui.getGroupDefinition(this._.modelObject),this.Ir.elementsDraggable===!1)return!1;s=this.Ir.elastic===!0&&r.e.shiftKey!==!0,this.lc=r.e.shiftKey===!0,this.xe=this.ui.$_getGroupContentAreaInfo(this._.id),L(this._.el,Oy),this.hc=this.ui.$canDrop(this.u.modelObject,null,!0),s||(F(this.ui.rootElement,xr),L(this.ui.rootElement,Nh)),this.sa=this.qb(this._.r)}this.Eo=o||s,this.Eo||L(this.ui.rootElement,xr),o||!s?this.ui.model.getGroups().forEach(l=>{if(l.id!==this.u.id&&!We(l,this.u.modelObject)){let h=this.ui.getGroupDefinition(l),d=l===this.u.modelObject.group,u=d||(this.ui.$canDrop(this.u.modelObject,l,!1)==!1?!1:h.canDrop?h.canDrop(this.u.modelObject):!0),p=this.ui.viewport.getGroupElement(l.id),g=this.ui.$_getGroupContentAreaInfo(l.id),E=-(p.r||0)*Math.PI/180,y={droppable:u,managedElement:p,depth:ed(l),contentAreaInfo:g,contentArea:p.contentArea,contentBox:{x:p.x+g.internalOffset.x,y:p.y+g.internalOffset.y,width:p.width-g.internalOffset.x,height:p.height-g.internalOffset.y,r:p.r},isCurrentGroup:d,group:l,id:l.id,rotation:p.r||0,rotationMatrix:{cos:Math.cos(E),sin:Math.sin(E)}};this.oa.push(y),u?(d||this.Kn(p,xr),d&&this.Kn(p,Ny)):this.Kn(p,Nh)}}):s&&(this.he=new Fa(this.ui,this.u.modelObject,this.u.modelObject.group,this.Ir)),this.viewportPositionAtDown={x:Math.floor(this.u.x*100)/100,y:Math.floor(this.u.y*100)/100},this.eA(),this.activeGrid=this.resolveGrid(),this.downAt=Object.assign({},r.pagePosition),this.sc=this.draggableInstance.getZoom(),this.go=this.draggableInstance.getEffectiveVisibleZoom(),L(document.body,mt),L(this.ui.rootElement,_y),L(this.u.el,Oh),this.currentState="dragging",this.R&&this.R.observe(this.u.el),this.Wt=this.hn[this.u.modelObject.id],this.Wt&&!tV(this.Wt,this.u.modelObject.id)&&(this.Wt=null);let a={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,pos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},element:this.u}],ui:this.ui};if(this.fo.clear(),this.be.set(this.u.modelObject.id,{modelObject:this.u.modelObject,managedElement:this.u,offset:{x:0,y:0},size:ei(this.u),originalPosition:ft(this.u),position:ft(this.u),parentGroup:this.u.modelObject.group?this.ui.viewport.getGroupElement(this.u.modelObject.group.id):null}),this.Wt!=null){let l=(Y(this.u.modelObject)?Bs(this.u.modelObject):[]).map(d=>d.id),h=Tn(this.u.modelObject).map(d=>d.id);Array.from(this.Wt.members).filter(d=>l.indexOf(d.el.id)===-1&&h.indexOf(d.el.id)===-1).forEach(d=>{let u={x:d.el.x,y:d.el.y},p=d.el.modelObject;this.be.set(d.el.id,{modelObject:p,managedElement:d.el,offset:{x:d.el.x-this.u.x,y:d.el.y-this.u.y},size:ei(d.el),originalPosition:ft(d.el),position:ft(d.el),parentGroup:p.group?this.ui.viewport.getGroupElement(p.group.id):null}),this.R&&this.R.observe(d.el.el),a.dragGroup.push({el:d.el.el,vertex:d.el.modelObject,pos:{x:u.x,y:u.y},element:d.el}),L(d.el.el,Oh),this.ui.toFront(d.el.el,!0)})}return this.ui.toFront(this.u.el,!0),this.ui.magnetizerProfile.constant&&this.ui.$startMagnetizer(),this.ui.$startMotion(),this.ui.fire(Ws,a),!0}else return!1;else return!1}else return!1;else return!1}}kl(){this.draggableInstance.$stopPanRepeat(),this.u!=null&&this.R!=null&&(this.R.unobserve(this.u.el),this.be&&this.be.forEach(r=>{this.R.unobserve(r.managedElement.el)}))}Kn(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>L(t,n))}gg(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>F(t,n))}Wb(r){var e;if(this.kl(),this.u!=null&&this.newPosition!=null){this.tA(),this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer();let t=new Set,n={},o=null,s=this._!=null,a=!1,l=[],h={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y},d=Object.assign({},h);if(this.vt.length>0&&(o=this.vt[0],t.add(o.group),s&&(this._.id!==o.id?t.add(this._.modelObject):this.lc&&t.delete(o.group))),o==null){if(!this.hc)return this.fg();this._!=null&&this.he==null&&(d.x+=this._.x+this.xe.internalOffset.x,d.y+=this._.y+this.xe.internalOffset.y,d=Me(d,this._.c,this._.r)),n[this.u.id]={x:d.x,y:d.y},Array.from(this.be.values()).forEach(p=>{n[p.managedElement.id]={x:p.offset.x+d.x,y:p.offset.y+d.y}})}else{if(!o.droppable)return this.fg();let p=this.ui.$_getGroupContentAreaInfo(o.id);if(this._!=null)if(this._.id===o.id)n[this.u.id]={x:d.x,y:d.y};else{let g=d.x+(this._.x+this.xe.internalOffset.x),m=d.y+(this._.y+this.xe.internalOffset.y);d.x=g-(o.managedElement.x+p.internalOffset.x),d.y=m-(o.managedElement.y+p.internalOffset.y),n[this.u.id]={x:d.x,y:d.y}}else d=this.rA(this.u,o.managedElement,p),n[this.u.id]={x:d.x,y:d.y};if(l.push({vertex:this.u.modelObject,originalParent:(e=this._)==null?void 0:e.modelObject,originalPosition:this.relativePositionAtDown,positionInGroup:d}),this.Wt!=null){let g=this.nA(d,o.managedElement,p);for(let m in g.current){let E={x:Math.floor(g.current[m].x),y:Math.floor(g.current[m].y)};n[m]=E;let y=this.be.get(m),x=y.managedElement.modelObject;l.push({vertex:x,originalPosition:y.originalPosition,positionInGroup:E,originalParent:x.group})}}}if(a||this.fo.forEach((p,g)=>{n[g]=p.current}),this.ui.magnetizerProfile.afterDrag&&!a){let p=this.ui.$provisionallyMagnetize(this.u.modelObject,this.ui.magnetizerProfile.repositionDraggedElement===!0,n,null,!1,!1);for(let g in p.current)n[g]=p.current[g]}this.ui.model.transaction(()=>{if(a)this.be.forEach((p,g)=>{this.ui.$setViewportElementPosition(p.managedElement,p.originalPosition)});else{let p={},g={};if(o==null)if(this.he==null)Array.from(this.be.values()).forEach(m=>{m.parentGroup!=null&&(t.add(m.parentGroup.modelObject),this.ui.model.$removeFromGroup(m.modelObject,null,{x:this.relativePositionAtDown.x+m.offset.x,y:this.relativePositionAtDown.y+m.offset.y},m.position,this.ui))});else{let{movedElements:m,resizedGroups:E}=this.he.ih();Object.assign(g,E);for(let y in m)n[y]=m[y].current,p[y]=m[y].current}else l.forEach(m=>{this.ui.model.$addToGroup(m.vertex,o.group,m.originalParent,m.originalPosition,m.positionInGroup,this.ui)});for(let m in n){let E={[this.ui.$modelLeftAttribute]:n[m].x,[this.ui.$modelTopAttribute]:n[m].y};g[m]!=null&&(E[this.ui.$modelWidthAttribute]=g[m].newGroupSize.width,E[this.ui.$modelHeightAttribute]=g[m].newGroupSize.height),this.ui.model.$_updateVertex(m,E,ra,!1)}this.ui.$_sizeGroupsToFit(t,null,null,!1),this.ui.$trackGroupSizeChanges(g)}});let u={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:d.x,y:d.y},element:this.u}],ui:this.ui};Array.from(this.be.values()).forEach(p=>{if(p.managedElement.id!==this.u.id){let g=p.managedElement;u.dragGroup.push({pos:p.position,originalPos:p.originalPosition,el:g.el,vertex:p.modelObject,element:g})}}),this.ui.$stopMotion(),this.ui.fire(Vt,u)}this.Q()}rA(r,e,t){let n=Me(Me(r,r.c,r.r+e.r),e.c,-e.r);return{x:n.x-(e.x+t.internalOffset.x),y:n.y-(e.y+t.internalOffset.y)}}nA(r,e,t){let n=[this.u.modelObject],o={[this.u.id]:r};this.Wt.members.forEach(h=>{h.el.id!==this.u.id&&(o[h.el.id]=this.be.get(h.el.id).position,n.push(h.el.modelObject))});let s=h=>o[h.id],a=h=>this.be.get(h.id).size;return new Mi({positionSetter:(h,d)=>o[h.id]=d,positionGetter:s,getId:h=>h.id,elements:n,getSize:a}).executeWithFocus(this.u.id,{gather:!0})}fg(){this.ui.$stopMotion(),Array.from(this.be.values()).forEach(r=>{this.ui.viewport.updateElement(r.managedElement.id,r.originalPosition.x,r.originalPosition.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(r.managedElement,!0)}),this.fo.forEach((r,e)=>{let t=this.ui.$getManagedElement(e);this.ui.viewport.updateElement(e,r.original.x,r.original.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(t,!0)}),this.ui.fire(Bd),this.Q()}iA(r){return this._==null||r.id===this._.id}pg(r){if(this.newPosition!=null){let e={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y};this.mg();let t={x:e.x+this.xe.pageOrigin.x,y:e.y+this.xe.pageOrigin.y,width:this.u.width,height:this.u.height,r:this.u.r};if(this.oa.forEach(l=>{kb(l.contentBox,t)&&this.vt.push(l)}),this.vt.length>0){this.vt.sort((h,d)=>h.depth>d.depth?-1:1),this.pc(this.vt[0].managedElement,!0);let l=!this.iA(this.vt[0].managedElement);(this._==null||this.ia||l)&&this.Kn(this.vt[0].managedElement,br),this._!=null&&!l&&(this.ia=!0,this.Kn(this._,xr)),this.Eo||F(this.ui.rootElement,br)}else this.pc(this._,!1),this._!=null&&!this.Ir.elastic&&(this.ia=!0,this.Kn(this._,xr)),this.Eo||L(this.ui.rootElement,br);let n={},o=[{id:this.u.id,x:e.x,y:e.y}];n[this.u.id]=e;let s={dragGroup:[{vertex:this.u.modelObject,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:e.x,y:e.y},element:this.u}],positions:n,ui:this.ui};if(Array.from(this.be.values()).forEach(l=>{if(l.managedElement.id!==this.u.id){let h=l.originalPosition,d={x:e.x+l.offset.x,y:e.y+l.offset.y};this.activeGrid!=null&&(d=he(d,this.activeGrid)),l.position=d,o.push({id:l.managedElement.id,x:d.x,y:d.y}),n[l.managedElement.id]=d,s.dragGroup.push({pos:{x:d.x,y:d.y},originalPos:{x:h.x,y:h.y},vertex:l.managedElement.modelObject,element:l.managedElement})}else l.position={x:e.x,y:e.y}}),this.ui.magnetizerProfile.constant){let l=this.ui.$provisionallyMagnetize(this.u.modelObject,!1,{[this.u.id]:{x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y}},null,!0,r);for(let h in l.current)n[h]=l.current[h],this.fo.set(h,{current:l.current[h],original:l.original[h]}),s.dragGroup.push({vertex:this.ui.model.getVertex(h),originalPos:l.original[h],pos:l.current[h],element:this.ui.getElement(h)})}let a=this.ui.$_updateVertexPositions({positions:n,sizes:null,offset:this.xe.pageOrigin,repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1});return this.ui.fire(Mt,s),{redrawResult:a,positions:n}}}yg(r,e,t){if(e==null)this.ui.$setVisibleElementRotation(r,r.r);else{let n=0;t?n=r.modelObject.group===e.modelObject?0:e.r:n=r.modelObject.group===e.modelObject?-e.r:0,this.ui.$setVisibleElementRotation(r,r.r+n)}}pc(r,e){this.u!=null&&(this.yg(this.u,r,e),Array.from(this.be.values()).forEach(t=>{t.managedElement.id!==this.u.id&&this.yg(t.managedElement,r,e)}))}tA(){this.pc(null,!0)}oA(r,e){if(this.sa==null)return{x:r,y:e};let{cos:t,sin:n}=this.sa;return{x:r*t-e*n,y:r*n+e*t}}Hb(r){if(this.currentState==="dragging"){oe(r.e),this.oc=r.e.shiftKey;let e=Object.assign({},r.pagePosition),t=(e.x-this.downAt.x)/this.go,n=(e.y-this.downAt.y)/this.go,o=this.oA(t,n);t=o.x,n=o.y;let s={x:this.viewportPositionAtDown.x+t,y:this.viewportPositionAtDown.y+n};this._!=null&&(s.x-=this.xe.pageOrigin.x,s.y-=this.xe.pageOrigin.y,!this.Ir.elastic&&this.Ir.constrain&&(s.x+this.u.width>this._.width-this.xe.internalOffset.x&&(s.x=this._.width-this.u.width-this.xe.internalOffset.x),s.y+this.u.height>this._.height-this.xe.internalOffset.y&&(s.y=this._.height-this.u.height-this.xe.internalOffset.y),s.x<0&&(s.x=0),s.y<0&&(s.y=0))),this.activeGrid!=null&&(s=he(s,this.activeGrid)),this.draggableInstance.dragOptions.constrainFunction&&(s=this.draggableInstance.dragOptions.constrainFunction(s,r.el,this.u.modelObject,r.size,this.newPosition||this.viewportPositionAtDown,r.e)),this.newPosition=s;let a=this.pg(r.e.shiftKey);if(this.R!=null&&this.u!=null){let l=this.u.el.getBoundingClientRect();this.R.updateDragElementPosition(l)}return this.he!=null&&this.he.focusVertex.id===this.u.id&&this.sA(r.e,a.positions[this.u.id]),a.redrawResult}else return null}eA(){let r=this._?this._.x+this.xe.internalOffset.x:0,e=this._?this._.y+this.xe.internalOffset.y:0;this.relativePositionAtDown={x:this.viewportPositionAtDown.x-r,y:this.viewportPositionAtDown.y-e}}xg(r,...e){let t=[],n=QM(r),o=this.dc[n.id];if(o==null)o={id:n.id,members:new Set},this.dc[n.id]=o,t.push(...e);else{let s=Array.from(o.members.values());e.forEach(a=>{let l=s.find(h=>h.el.id===a.id);(l==null||l.membership!==Wa)&&t.push(a)})}this.removeFromDragGroup(...t),t.forEach(s=>{this.Eg(s,null)&&(o.members.add({el:s,active:n.active!==!1,membership:n.membership}),this.hn[s.id]=o)})}removeFromDragGroup(...r){r.forEach(e=>{let t=this.hn[e.id];if(t!=null){let n=new Set;t.members.forEach(o=>{o.el!==e&&n.add(o)}),t.members=n,delete this.hn[e.id]}})}$setDragGroupState(r,...e){e.forEach(t=>{let n=this.hn[t.id];if(n!=null){let o=fE(n.members,s=>s.el.id===t.id);o!=null&&(o.active=r)}})}$clearDragGroup(r){let e=this.dc[r];e!=null&&(e.members.forEach(t=>{delete this.hn[t.el.id]}),e.members.clear())}$resolveDragGroup(r){return this.hn[r]}sA(r,e){this.he!=null&&e!=null&&this.he.setFocusPosition(e,!0,r)}Eg(r,e){for(let t=0;t<this.ic.length;t++)if(!this.ic[t]({el:r.el,vertex:r.modelObject,e}))return!1;return!0}$addVertexDragFilter(r){this.ic.push(r)}$destroy(){this.R&&this.R.disconnect()}};var or=i=>i.map(r=>String.fromCharCode(r)).join(""),nV=new Date().getFullYear(),iV=or([67,111,112,121,114,105,103,104,116,32])+nV+or([32,74,83,80,76,85,77,66,32,80,84,89,32,76,84,68]),zx=or([104,116,116,112,115,58,47,47,118,105,115,117,97,108,108,121,106,115,46,99,111,109]),bR=new Array(50).fill("-").join(""),oV=or([86,105,115,117,97,108,108,121,74,115,32])+fu,sV=or([86,105,115,117,97,108,108,121,74,115,32,105,115,32,102,114,101,101,32,116,111,32,117,115,101,32,102,111,114,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,112,117,114,112,111,115,101,115,46,32,65,108,108,32,99,111,109,109,101,114,99,105,97,108,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,32,114,101,113,117,105,114,101,32,116,104,101,32,112,117,114,99,104,97,115,101,32,111,102,32,97,32,108,105,99,101,110,115,101,46]),aV=or([70,111,114,32,97,32,100,101,102,105,110,105,116,105,111,110,32,111,102,32,34,99,111,109,109,101,114,99,105,97,108,34,44,32,34,110,111,110,45,99,111,109,109,101,114,99,105,97,108,34,32,97,110,100,32,34,101,118,97,108,117,97,116,105,111,110,34,32,112,108,101,97,115,101,32,115,101,101,32,116,104,101,32,108,105,99,101,110,115,101,32,97,103,114,101,101,109,101,110,116,32,111,110,32,111,117,114,32,115,105,116,101,46]),lV=or([84,104,105,115,32,99,111,110,115,111,108,101,32,98,97,110,110,101,114,32,97,110,100,32,116,104,101,32,86,105,115,117,97,108,108,121,74,115,32,119,97,116,101,114,109,97,114,107,32,97,114,101,32,114,101,113,117,105,114,101,100,32,116,111,32,98,101,32,105,110,99,108,117,100,101,100,32,111,110,32,97,108,108,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,46]),Ps=or([10,10]),AR=bR+Ps+oV+Ps+iV+Ps+zx+Ps+sV+Ps+aV+Ps+lV+Ps+bR,SR=or([86,105,115,117,97,108,108,121,74,115,32,45,32,98,117,105,108,100,32,112,114,111,102,101,115,115,105,111,110,97,108,32,102,108,111,119,99,104,97,114,116,115,44,32,100,105,97,103,114,97,109,115,44,32,99,104,97,114,116,115,32,97,110,100,32,114,105,99,104,32,110,111,100,101,32,98,97,115,101,100,32,85,73,115,32,119,105,116,104,32,65,110,103,117,108,97,114,44,32,82,101,97,99,116,44,32,86,117,101,44,32,83,118,101,108,116,101,44,32,74,97,118,97,115,99,114,105,112,116,32,97,110,100,32,84,121,112,101,115,99,114,105,112,116,32,105,110,32,114,101,99,111,114,100,32,116,105,109,101,46]),hV=or([60,115,118,103,32,118,105,101,119,66,111,120,61,34,51,48,32,50,48,32,49,53,48,32,52,53,34,32,119,105,100,116,104,61,34,56,48,34,32,104,101,105,103,104,116,61,34,51,48,34,62]),TR=or([60,103,32,102,105,108,108,61,34,35,98,55,98,55,98,55,34,62]),cV=["m 43.96,33.76 q 0.12,-0.32 0.48,-0.32 h 2.24 q 0.44,0 0.32,0.44 l -5.88,17.8 Q 41,52 40.6,52 H 37.52 Q 37.12,52 37,51.68 l -5.88,-17.8 -0.04,-0.16 q 0,-0.28 0.36,-0.28 h 2.24 q 0.36,0 0.48,0.32 l 4.76,14.76 q 0.04,0.12 0.12,0.12 0.12,0 0.16,-0.12 z","m 52.606875,29.12 q -0.88,0 -1.56,-0.64 -0.64,-0.68 -0.64,-1.56 0,-0.88 0.64,-1.52 0.68,-0.64 1.56,-0.64 0.84,0 1.48,0.64 0.64,0.64 0.64,1.52 0,0.88 -0.64,1.56 -0.64,0.64 -1.48,0.64 z m -1.12,22.88 q -0.4,0 -0.4,-0.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 z","m 65.03125,52.44 q -2.36,0 -4,-1.2 -1.6,-1.2 -2.24,-3.2 l -0.04,-0.16 q 0,-0.24 0.28,-0.32 l 1.92,-0.68 0.16,-0.04 q 0.24,0 0.36,0.32 0.36,1.28 1.36,2 1.04,0.72 2.2,0.72 1.68,0 2.56,-0.8 0.88,-0.84 0.88,-2.12 0,-1.28 -0.88,-2 -0.84,-0.72 -2.36,-1 l -1.6,-0.32 q -2.04,-0.4 -3.24,-1.8 -1.2,-1.44 -1.2,-3.44 0,-1.48 0.76,-2.72 0.76,-1.24 2.12,-1.92 1.4,-0.72 3.12,-0.72 2.2,0 3.72,1.16 1.56,1.12 2.16,3.24 l 0.04,0.16 q 0,0.24 -0.32,0.36 l -1.88,0.48 -0.16,0.04 q -0.24,0 -0.32,-0.32 -0.32,-1.2 -1.16,-1.88 -0.8,-0.68 -2.08,-0.68 -1.4,0 -2.28,0.76 -0.84,0.76 -0.84,1.92 0,1.2 0.68,1.84 0.68,0.64 2.04,0.92 l 1.56,0.32 q 2.24,0.44 3.6,1.88 1.4,1.4 1.4,3.72 0,2.4 -1.72,3.96 -1.68,1.52 -4.6,1.52 z","m 87.125,33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 h -1.92 q -0.4,0 -0.4,-0.4 v -1.32 q 0,-0.16 -0.12,-0.2 -0.08,-0.04 -0.24,0.12 -1.88,2.2 -4.84,2.2 -2.96,0 -4.6,-1.72 -1.6,-1.72 -1.6,-4.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 45.8 q 0,1.96 1,3 1,1 2.88,1 1.32,0 2.4,-0.68 1.08,-0.68 1.8,-1.96 0.2,-0.4 0.2,-0.84 z","m 103.88688,52.4 q -2.56,0 -4.640005,-1.2 -2.08,-1.24 -3.28,-3.44 -1.2,-2.2 -1.2,-5.04 0,-2.84 1.2,-5.04 1.2,-2.2 3.28,-3.4 2.080005,-1.24 4.640005,-1.24 3.92,0 6.03999,2.48 0.08,0.08 0.16,0.04 0.08,-0.04 0.08,-0.16 v -1.56 q 0,-0.4 0.39999,-0.4 h 1.96001 q 0.39999,0 0.39999,0.4 V 51.6 q 0,0.4 -0.39999,0.4 h -1.96001 q -0.39999,0 -0.39999,-0.4 v -1.56 q 0,-0.12 -0.08,-0.16 -0.08,-0.04 -0.16,0.04 -2.47999,2.48 -6.03999,2.48 z m 0.44,-2.64 q 1.87999,0 3.36,-0.8 1.48,-0.8 2.15999,-2.16 0.16001,-0.32 0.16001,-0.72 v -6.72 q 0,-0.4 -0.16001,-0.72 -0.76,-1.36 -2.23999,-2.16 -1.44,-0.8 -3.28,-0.8 -2.96001,0 -4.800005,1.96 -1.8,1.92 -1.8,5.08 0,3.16 1.8,5.12 1.839995,1.92 4.800005,1.92 z","m 123.61562,49.56 q 0.40001,0 0.40001,0.4 v 1.8 q 0,0.4 -0.40001,0.4 h -0.72 q -1.87999,0 -2.92,-0.88 -1.03999,-0.92 -1.03999,-2.8 V 23.44 q 0,-0.4 0.39999,-0.4 h 2.12 q 0.40001,0 0.40001,0.4 v 24.68 q 0,1.44 1.19999,1.44 z","m 133.14687,49.56 q 0.4,0 0.4,0.4 v 1.8 q 0,0.4 -0.4,0.4 h -0.72 q -1.88,0 -2.92,-0.88 -1.04,-0.92 -1.04,-2.8 V 23.44 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 v 24.68 q 0,1.44 1.2,1.44 z","m 148.72562,33.76 q 0.12,-0.32 0.52,-0.32 h 2.2 q 0.48,0 0.36,0.44 l -9.32,25.68 q -0.12,0.32 -0.48,0.32 h -2.16 q -0.52,0 -0.36,-0.52 l 2.64001,-7.32 q 0.08,-0.16 0.08,-0.44 0,-0.24 -0.08,-0.4 l -6.40001,-17.28 -0.04,-0.16 q 0,-0.32 0.36,-0.32 h 2.28 q 0.36,0 0.48,0.32 l 4.72,13.56 q 0.12,0.24 0.24,0.24 0.2,0 0.24,-0.24 z"],dV=TR+'<path d="'+cV.join('"/><path d="')+'"/></g>',uV=["m 159.312,61.368 c -0.448,0 -0.88533,-0.04267 -1.312,-0.128 -0.29867,-0.064 -0.43733,-0.213333 -0.416,-0.448 l 0.192,-1.44 c 0.0213,-0.213333 0.13867,-0.288 0.352,-0.224 0.384,0.106667 0.69333,0.16 0.928,0.16 0.46933,0 0.81067,-0.16 1.024,-0.48 0.23467,-0.32 0.352,-0.736 0.352,-1.248 V 40.472 c 0,-0.213333 0.10667,-0.32 0.32,-0.32 h 1.696 c 0.21333,0 0.32,0.106667 0.32,0.32 v 17.056 c 0,1.216 -0.32,2.154667 -0.96,2.816 -0.61867,0.682667 -1.45067,1.024 -2.496,1.024 z","m 171.5875,55.352 q -1.888,0 -3.2,-0.96 -1.28,-0.96 -1.792,-2.56 l -0.032,-0.128 q 0,-0.192 0.224,-0.256 l 1.536,-0.544 0.128,-0.032 q 0.192,0 0.288,0.256 0.288,1.024 1.088,1.6 0.832,0.576 1.76,0.576 1.344,0 2.048,-0.64 0.704,-0.672 0.704,-1.696 0,-1.024 -0.704,-1.6 -0.672,-0.576 -1.888,-0.8 l -1.28,-0.256 q -1.632,-0.32 -2.592,-1.44 -0.96,-1.152 -0.96,-2.752 0,-1.184 0.608,-2.176 0.608,-0.992 1.696,-1.536 1.12,-0.576 2.496,-0.576 1.76,0 2.976,0.928 1.248,0.896 1.728,2.592 l 0.032,0.128 q 0,0.192 -0.256,0.288 l -1.504,0.384 -0.128,0.032 q -0.192,0 -0.256,-0.256 -0.256,-0.96 -0.928,-1.504 -0.64,-0.544 -1.664,-0.544 -1.12,0 -1.824,0.608 -0.672,0.608 -0.672,1.536 0,0.96 0.544,1.472 0.544,0.512 1.632,0.736 l 1.248,0.256 q 1.792,0.352 2.88,1.504 1.12,1.12 1.12,2.976 0,1.92 -1.376,3.168 -1.344,1.216 -3.68,1.216 z"],pV=TR+'<path d="'+uV.join('"/><path d="')+'"/></g>',vR=hV+dV+"<g>"+or([60,99,105,114,99,108,101,32,99,120,61,34,49,53,52,34,32,99,121,61,34,54,48,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,114,61,34,49,46,53,34,32,102,105,108,108,61,34,119,104,105,116,101,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,47,62])+pV+or([60,99,105,114,99,108,101,32,99,120,61,34,49,54,49,46,53,48,49,53,55,34,32,99,121,61,34,51,54,46,50,53,56,53,52,57,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,102,105,108,108,61,34,35,102,102,102,102,102,102,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,32,114,61,34,49,46,53,34,32,47,62,60,47,103,62,60,47,115,118,103,62]),gV=or([60,97,32,104,114,101,102,61,34])+zx+or([34,32,116,97,114,103,101,116,61,34,95,98,108,97,110,107,34,32,116,105,116,108,101,61,34])+SR+'">'+vR+"</a>",Xx=null;function pc(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let a=function(){l.disconnect(),pc(i,!0,s)};r||console.log(AR),Xx&&window.clearInterval(Xx),e&&e.parentNode&&e.parentNode.removeChild(e);let t=["right","left"][Math.floor(Math.random()*2)],n=["top","bottom"][Math.floor(Math.random()*2)],s=new DOMParser().parseFromString(gV,"text/html").body.childNodes[0];s.style.position="absolute",s.style[t]="1rem",s.style[n]="1rem",s.style.zIndex="0",s.style.opacity="0.8",s.setAttribute("href",zx),s.setAttribute("target","_blank"),s.setAttribute("title",SR),i.appendChild(s);let l=new MutationObserver((h,d)=>{a()});l.observe(s,{attributes:!0,subtree:!0,childList:!0}),Xx=window.setInterval(()=>a(),25e3)}}var jx=null;function Hx(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let u=function(){p.disconnect(),Hx(i,!0,n)};r||console.log(AR),jx&&window.clearInterval(jx),e&&e.parentNode&&e.parentNode.removeChild(e);let n=new DOMParser().parseFromString(vR,"text/html").body.childNodes[0];i.appendChild(n);let o=parseInt(i.getAttribute("width"),10),s=parseInt(i.getAttribute("height"),10),a=n.getBBox(),l=a.height/a.width,h=parseInt(n.getAttribute("width"),10),d=l*h;n.setAttribute("transform",`translate(${o-h-10}, ${s-d-10})`);let p=new MutationObserver((g,m)=>{u()});p.observe(n,{attributes:!0,subtree:!0,childList:!0}),jx=window.setInterval(()=>u(),25e3)}}var CR="vjs-orthogonal-handle",Pm="vjs-orthogonal-segment-drag",PR="vjs-orthogonal-segment-drag-ns",_R="vjs-orthogonal-segment-drag-ew";var mV=10,EV=20,Eo=class extends uo{constructor(e,t){super(e,t);c(this,"segments");c(this,"segmentHandles");c(this,"geometry");c(this,"$supportsHoverMode",!0);this.segments=[],this.segmentHandles=[],this.$addDragHandler({selector:"."+Pm+" *",target:"."+Pm,drag:n=>{let o=n.el.Zt,s={x:Math.floor(n.translatedPosition.x),y:Math.floor(n.translatedPosition.y)},a=Tv(this.current,this.currentConnector,o.segment,s);a!=null&&(o.connection.connector.geometry.segments=a.segments,o.connection.connector.edited=!0,this.$hasEdits=!0,this.segments.length=0,this.geometry.segments=a.segments,Array.prototype.push.apply(this.segments,this.geometry.segments),o.segment=this.geometry.segments[a.index],this.$repaintConnection({segmentInfo:o,segmentIndex:a.index}))},constrainFunction:function(n,o,s,a,l,h){let d=o.Zt,u=d.segment.x1===d.segment.x2,p={x:n.x,y:n.y};return u?p.y=(d.segment.y1+d.segment.y2)/2-a.height/2:p.x=(d.segment.x1+d.segment.x2)/2-a.width/2,p},stop:n=>{this.Ag(!0),this.$updateModel(cn(n.el.Zt.connection.connector),this.$generatedGeometry)},start:n=>{this.$generatedGeometry=cn(n.el.Zt.connection.connector)}})}Sg(e,t){e.el.style.visibility="visible";let n=this.ui.$getSize(e.el.childNodes[0]),o=t[0]-n.width/2,s=t[1]-n.height/2;Ie(e.el,{x:o,y:s})}$repaint(e){this.An(e);for(let t=0;t<this.segmentHandles.length;t++)if(this.segmentHandles[t].segment=this.geometry.segments[t+1],ca(this.segmentHandles[t].segment)>0){let n=[(this.segmentHandles[t].segment.x1+this.segmentHandles[t].segment.x2)/2,(this.segmentHandles[t].segment.y1+this.segmentHandles[t].segment.y2)/2];this.Sg(this.segmentHandles[t],n)}else this.segmentHandles[t].el.style.visibility="hidden"}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].el!==e&&this.ui.$removeElement(this.segmentHandles[t].el)}$activate(e,t){this.$hasEdits=!1,this.An(),this.currentConnector.edited=!0}$elementDragged(e){this.Ag(!0)}$elementDragging(e){this.$repaint()}An(e){e=e||{};let t=e.segmentInfo,n=e.segmentIndex;if(this.geometry=lt(this.current.connector.geometry),this.geometry&&this.geometry.segments){this.$clearHandles(t?t.el:null),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let o=1;o<this.segments.length-1;o++)if(t==null||o!==n){let s=[(this.segments[o].x1+this.segments[o].x2)/2,(this.segments[o].y1+this.segments[o].y2)/2],a=s[0],l=s[1],h=this.segments[o].o===hd,d=this.$makeOrthogonalHandle(h,a,l,EV,mV,[Hn,CR,Pm,h?_R:PR].join(" "),!0),u={el:d,segment:this.segments[o],vertical:h,edge:this.currentEdge,connection:this.current};d.Zt=u,this.segmentHandles.push(u),this.Sg(u,s)}else o===n&&this.segmentHandles.push(t)}}Ag(e){this.current&&this.$hasEdits&&(vv(this.currentConnector),e&&this.$repaintConnection())}$makeOrthogonalHandle(e,t,n,o,s,a,l){let h=e?s:o,d=e?o:s;return this.$makeAndAppendRectangularHandle(t,n,h,d,3,3,a,l)}};c(Eo,"type",Hi);Lr.set(Eo.type,Eo);function OR(){Lr.set(Eo.type,Eo)}var gc="vjs-straight-handle",_s="vjs-straight-segment-drag",_m="vjs-straight-segment-split",Om="vjs-straight-segment-delete",RR="vjs-straight-editor-guideline";var Rm=class{constructor(r){this.editor=r;c(this,"splitListener");c(this,"deleteListener");this.splitListener=(e=>{let t=e.target.closest(z(_m)).Zt;this.editor.$split(t.index,t.midPoint)}).bind(this),this.deleteListener=(e=>{let t=e.target.closest(z(Om)).Zt;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){this.editor.ui.on(this.editor.ui.getContainer(),W,z(_m),this.splitListener),this.editor.ui.on(this.editor.ui.getContainer(),W,z(Om),this.deleteListener)}$deactivate(r){this.editor.ui.off(this.editor.ui.getContainer(),W,this.splitListener),this.editor.ui.off(this.editor.ui.getContainer(),W,this.deleteListener)}$appendHandles(r){let e=r.segment,t={x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2},n={x:(e.x2+t.x)/2,y:(e.y2+t.y)/2},o=t,s=this.editor.$makeAndAppendCircularHandle(o.x,o.y,this.editor.buttonSize,this.editor.buttonSize,[Hn,gc,_m].join(" "),!0);s!=null&&r.buttons.push(s);let a=this.editor.segments.length>1?this.editor.$makeAndAppendDeleteHandle(n.x,n.y,this.editor.buttonSize,this.editor.buttonSize,[Hn,gc,Om].join(" "),!0):null;a!=null&&r.buttons.push(a)}$repaintEnded(){}$repaintStarted(){}};var kx="vjs-straight-connector-edit",LR="click",Ike="auto";var Lm=class{constructor(r){this.editor=r;c(this,"mc");c(this,"gc");c(this,"$segmentToDrag");c(this,"$pageEvent");this.mc=(e=>{if(this.editor.current&&this.editor.current.id===e.obj.id){this.$pageEvent=e.e;let t=Ee(e.e),n=this.editor.ui.fromPageLocation(t.x,t.y);oe(e.e);let o=KT(e.connection.connector,n.x,n.y);this.$segmentToDrag=o.index+1,this.editor.$split(o.index,{x:o.x,y:o.y})}}).bind(this),this.gc=(e=>{let t=e.target.closest(z(_s)).Zt;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){Zr(r,kx),this.editor.ui.bind(zl,this.mc),this.editor.ui.on(this.editor.ui.getContainer(),W,`${z(_s)} *`,this.gc)}$appendHandles(r){}$deactivate(r){this.editor.ui.unbind(zl,this.mc),this.editor.ui.off(this.editor.ui.getContainer(),W,this.gc),this.editor.current!=null&&_r(this.editor.current,kx)}$repaintEnded(){if(this.$segmentToDrag!=null){let r=this.editor.segmentHandles[this.$segmentToDrag];this.editor.ui.trigger(r.el.childNodes[0],ge,this.$pageEvent)}this.$segmentToDrag=null,this.$pageEvent=null}$repaintStarted(){}};var fo=class extends uo{constructor(e,t){super(e,t);c(this,"$mode");c(this,"$showGuidelines");c(this,"geometry");c(this,"segments",[]);c(this,"segmentHandles",[]);c(this,"guideLine");c(this,"$supportsHoverMode",!0);this.segments=[],this.$mode=t.splitMode===LR?new Rm(this):new Lm(this),this.$showGuidelines=t.showGuidelines!==!1,this.$addDragHandler({selector:"."+_s+" *",target:"."+_s,drag:n=>{let o=n.el.Zt,s=n.translatedPosition.x-n.originalTranslatedPosition.x,a=n.translatedPosition.y-n.originalTranslatedPosition.y;o.focus.x1=o.originalLocation.x+s,o.focus.y1=o.originalLocation.y+a,this.currentConnector.geometry.segments[o.index]=o.focus,o.previous&&(o.previous.x2=o.focus.x1,o.previous.y2=o.focus.y1,this.currentConnector.geometry.segments[o.index-1]=o.previous),this.currentConnector.edited=!0,this.$repaintConnection()},constrainFunction:function(n,o,s,a,l,h){return n},stop:n=>{this.$updateModel(cn(this.currentConnector),this.$generatedGeometry)},start:n=>(this.$generatedGeometry=cn(this.currentConnector),!0)})}$split(e,t){let n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments,s=o[e],a={x1:s.x1,y1:s.y1,x2:t.x,y2:t.y};o[e].x1=t.x,o[e].y1=t.y,o.splice(e,0,a),this.currentConnector.edited=!0,this.$updateModel(cn(this.currentConnector),n)}$deleteSegment(e){let t=e.index,n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments;t===0?(o[1].x1=e.focus.x1,o[1].y1=e.focus.y1):t<o.length-1?(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2,o[t+1].x1=e.focus.x2,o[t+1].y1=e.focus.y2):t===o.length-1&&(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2),o.splice(t,1),this.currentConnector.edited=!0,this.$updateModel(cn(this.currentConnector),n)}$activate(e,t){this.$mode.$activate(e,t),this.$repaint()}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].index!==e&&this.segmentHandles[t].buttons.forEach(n=>this.ui.$removeElement(n));this.guideLine&&this.guideLine.parentNode&&this.guideLine.parentNode.removeChild(this.guideLine)}$elementDragged(e){}$elementDragging(e){this.$repaint()}$repaint(e){e=e||{};let t=e.segmentInfo;if(this.$mode.$repaintStarted(),this.geometry=this.current.connector.geometry,this.geometry&&this.geometry.segments){this.$clearHandles(),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let n=0;n<this.segments.length;n++)if(t==null||n!==t.index){let o=this.segments[n],s={x:(o.x1+o.x2)/2,y:(o.y1+o.y2)/2},a=null;n>0&&(a=this.$makeAndAppendCircularHandle(this.segments[n].x1,this.segments[n].y1,this.buttonSize,this.buttonSize,[Hn,gc,_s].join(" "),!0));let l={buttons:[],focus:o,previous:n>=0?this.segments[n-1]:null,index:n,originalLocation:{x:o.x1,y:o.y1},midPoint:s,el:a,edge:this.currentEdge,segment:this.segments[n],connection:this.current};this.$mode.$appendHandles(l),a!=null&&l.buttons.push(a),l.buttons.forEach(h=>h.Zt=l),this.segmentHandles.push(l)}this.aA()}this.$mode.$repaintEnded()}aA(){if(this.$showGuidelines&&this.currentConnector.smooth&&this.segments.length>1){this.guideLine=V(we,{width:10,height:10}),this.guideLine.style.overflow="visible",this.ui.$addClassToElement(this.guideLine,[RR,$g].join(" "));let e=this.segments[this.segments.length-1],t=`M ${this.segments[0].x1}, ${this.segments[0].y1} `;for(let o=0;o<this.segments.length;o++)t+=`L ${this.segments[o].x2}, ${this.segments[o].y2} `;t+=`L ${e.x2}, ${e.y2}`;let n=V(q,{d:t});this.guideLine.appendChild(n),this.ui.$appendElementToToolsLayer(this.guideLine,!0)}}deactivate(e){this.$mode.$deactivate(e),super.deactivate(e)}};c(fo,"type",jr);Lr.set(fo.type,fo);function wR(){Lr.set(fo.type,fo)}var mc="vjs-bezier-handle",Wx="vjs-bezier-handle-control-point",DR="vjs-bezier-handle-control-point-1",NR="vjs-bezier-handle-control-point-2",IR="vjs-bezier-guideline";var vi=class extends uo{constructor(e,t){super(e,t);c(this,"$supportsHoverMode",!1);c(this,"h1");c(this,"h2");c(this,"l1");c(this,"l2");c(this,"lockHandles");c(this,"Tt");c(this,"Fe");c(this,"Jt");c(this,"Ec");c(this,"fc");c(this,"Tg",{x:0,y:0});c(this,"vg",{x:0,y:0});this.Tt=t.handleSize||pm,this.$addDragHandler({selector:"."+mc+" *",target:"."+mc,constrainFunction:function(n,o,s,a,l,h){return n},drag:n=>{let o=n.translatedPosition.x-n.originalTranslatedPosition.x,s=n.translatedPosition.y-n.originalTranslatedPosition.y,a=n.el.idx;if(o!==0||s!==0){this.$hasEdits=!0;let l=a===0?this.Fe:this.Jt,h=a===0?this.Tg:this.vg;l.x=h.x+o,l.y=h.y+s,this.$repaint(),this.$repaintConnection()}},stop:n=>{this.$hasEdits&&this.$updateModel(this.$cloneCurrentGeometry(),this.$generatedGeometry)},start:n=>(this.$hasEdits=!1,this.$generatedGeometry=this.$cloneCurrentGeometry(),this.Tg=Object.assign({},this.Fe),this.vg=Object.assign({},this.Jt),!0)})}$activate(e,t){this.Cg(),this.Pg(),this.lA((t==null?void 0:t.guidelines)!==!1),this.$hasEdits=!1,this.currentConnector.edited=!0}$clearHandles(){this.h1&&this.h1.parentNode.removeChild(this.h1),this.h2&&this.h2.parentNode.removeChild(this.h2),this.l1&&this.l1.parentNode.removeChild(this.l1),this.l2&&this.l2.parentNode.removeChild(this.l2),this.h1=null,this.h2=null,this.l1=null,this.l2=null}$elementDragged(e){this.$repaint()}$elementDragging(e){this.$repaint()}$repaint(e){this.Cg(),this.Pg(),this.Og(),this.hA()}lA(e){this.h1=this.$makeAndAppendCircularHandle(this.Fe.x,this.Fe.y,this.Tt,this.Tt,[Hn,mc,Wx,DR].join(" ")),this.h2=this.$makeAndAppendCircularHandle(this.Jt.x,this.Jt.y,this.Tt,this.Tt,[Hn,mc,Wx,NR].join(" ")),this.h1.idx=0,this.h2.idx=1,this.h1.style.display=Pr,this.lockHandles||(this.h2.style.display=Pr),this.l1=this._g(this.Ec,this.Fe.x,this.Fe.y),this.l2=this._g(this.fc,this.Jt.x,this.Jt.y),this.ui.$appendElementToToolsLayer(this.l1,!0),this.ui.$appendElementToToolsLayer(this.l2,!0),this.l1.style.display=e?Pr:pt,this.l2.style.display=e?Pr:pt,this.Og()}Og(){this.$setElementPosition(this.h1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.Jt;this.$setElementPosition(this.h2,e.x,e.y)}_g(e,t,n){let o=V(we,{width:5,height:5}),s=V(q,{d:"M 0 0 L 1 1"});return o.appendChild(s),this.ui.$addClassToElement(o,IR),this.ui.$addClassToElement(o,$g),this.yc(e,o,t,n),o}hA(){this.yc(this.Ec,this.l1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.Jt;this.yc(this.fc,this.l2,e.x,e.y)}yc(e,t,n,o){mn(t,e);let s=n-e.x,a=o-e.y;ie(t.childNodes[0],{d:`M 0 0 L ${s} ${a}`})}Pg(){this.currentConnector&&(this.Fe=this.currentConnector.geometry.segments[0].cp1,this.Jt=this.currentConnector.geometry.segments[0].cp2)}Cg(){this.current&&(this.Ec={x:this.current.anchors.source.computedPosition.curX,y:this.current.anchors.source.computedPosition.curY},this.fc={x:this.current.anchors.target.computedPosition.curX,y:this.current.anchors.target.computedPosition.curY})}};c(vi,"type",Zo);var yo=class extends vi{constructor(r,e){super(r,e),this.lockHandles=!0}};c(yo,"type",Hu);Lr.set(vi.type,vi),Lr.set(yo.type,yo);function MR(){Lr.set(vi.type,vi),Lr.set(yo.type,yo)}var VR="selected-vertices",Ec=class extends Ra{constructor(e,t,n,o,s){var h,d,u,p,g,m,E,y,x;super(e,t,n,o,s,Sn(o.defaults||{},{managedElementsSelector:Ae(gt,dn)}));this.model=e;c(this,"canvasElement");c(this,"vertexLayer");c(this,"toolsLayer");c(this,"vertexGroup");c(this,"edgeGroup");c(this,"labelGroup");c(this,"qn");c(this,"zoomOptions");c(this,"panOptions");c(this,"panZoom");c(this,"$wheelReverse");c(this,"$edgePathEditor");c(this,"$edgeInputMethod");c(this,"$editEdgesOnTap");c(this,"xc");c(this,"dragOptions");c(this,"elementDragHandler");c(this,"Rg");c(this,"mode",Sr);if(this.qn=m_(o.decorators,this,n),this.$suspendRendering=!1,this.zoomOptions=o.zoom,this.panOptions=o.pan,n.KA=this,o.events)for(let f in o.events)this.bindUnchecked(f,o.events[f]);o.useSvgContainer?(this.canvasElement=qr(Gt,we,{position:"absolute",left:"0",top:"0"},Sy,{width:5,height:5,x:0,y:0},this.rootElement,!0),this.vertexLayer=qr(Gt,we,{overflow:"visible"},"vjs-vertex-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.vertexGroup=qr(Gt,Q,{},"vjs-vertex-group",{},this.vertexLayer),this.edgeGroup=qr(Gt,Q,{},"vjs-edge-group",{},this.vertexLayer,((h=o.edges)==null?void 0:h.layerIndex)===0),this.labelGroup=qr(Gt,Q,{},"vjs-label-group",{},this.vertexLayer)):(this.canvasElement=qr(null,Ke,{position:"relative",width:Hr,height:Hr},Sy,{},this.rootElement,!0),this.vertexLayer=qr(null,Ke,{left:0,top:0,position:"absolute",width:Hr,height:Hr},"vjs-vertex-layer",{},this.canvasElement)),this.toolsLayer=qr(Gt,we,{overflow:"visible",left:0,top:0},"vjs-tools-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.setContainer(this.canvasElement),pc(this.rootElement,!1),this.xc=o.elementsDraggable!==!1,this.xc===!1&&this.canvasElement.setAttribute(Ov,ct),this.dragOptions=o.dragOptions||{},this.elementDragHandler=new Cm({ui:this,draggableInstance:this,resolveGrid:()=>this.getGrid()}),o.edges!=null&&(o.edges.editable===!0&&(this.$edgePathEditor=new Ma(this,{activeMode:o.edges.activeEdit!==!1}),this.addDragClassnameFilter(Ia),this.$editEdgesOnTap=o.edges.editOnTap!==!1),this.$edgeInputMethod=o.edges.inputMethod||zn),this.Rg=new Vg({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,method:this.$edgeInputMethod,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,Ul:f=>{L(this.rootElement,Fn)},Xl:f=>{F(this.rootElement,Fn)},zl:f=>{},Yl:f=>{F(this.rootElement,Fn)}}),new Gg({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,method:this.$edgeInputMethod,inputHandler:this.Rg}),this.dragOptions.filter!=null&&this.elementDragHandler.$addVertexDragFilter(this.dragOptions.filter),this.dragOptions.cssFilter!=null&&this.elementDragHandler.addSelectorFilter(this.dragOptions.cssFilter),this.elementDragHandler.addClassnameFilter(hp),this.$wheelReverse=o.wheel&&o.wheel.reverse===!0,L(this.rootElement,by),Gn()&&L(this.rootElement,vP),Ei()&&L(this.rootElement,CP),((d=o.pan)==null?void 0:d.enabled)===!1&&L(this.rootElement,Ay);let a=(f,b,A)=>{let T=S=>{let O=S.srcElement||S.target;if(O===this.rootElement||O===this.canvasElement||this.panZoom!=null&&this.panZoom.isBackgroundElement(O)){let v=S.button===2&&A!=null?A:b;this.fireUnchecked(v,this,S),b===Rn&&this.$editEdgesOnTap&&this.stopEditingPath()}};this.on(this.rootElement,f,T)};a(W,Rn,At),a(Yr,MS),this.panZoom=new Da({viewport:this.viewport,viewportElement:this.rootElement,canvasElement:this.canvasElement,elementPositionSetter:(f,b)=>Ie(f,b),consumeRightClick:o.consumeRightClick,idFunction:f=>this.W(f),fixedTransformOrigin:(u=this.zoomOptions)==null?void 0:u.fixedTransformOrigin,enablePan:((p=o.pan)==null?void 0:p.enabled)!==!1,panWithMetaKey:(g=o.pan)==null?void 0:g.useMetaKey,wheel:this.cA(o),enableAnimation:o.enableAnimation,clamp:o.clamp,clampToBackground:o.clampToBackground,clampToBackgroundExtents:o.clampToBackgroundExtents,panFilter:(m=o.pan)==null?void 0:m.filter,events:{panStart:()=>{L(this.rootElement,Py),L(document.body,mt)},[Fi]:(f,b,A,T,S)=>{this.fire(Fi,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[$r]:(f,b,A,T,S)=>{A=super.setZoom(A),this.fire($r,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[le]:()=>{F(this.rootElement,Py),F(document.body,mt)}},zoom:(E=o.zoom)==null?void 0:E.initialValue,zoomRange:(y=o.zoom)==null?void 0:y.range,zoomStep:(x=o.zoom)==null?void 0:x.step}),o.modelEvents&&o.modelEvents.forEach(f=>{this.bindModelEvent(f.event,f.selector,b=>{setTimeout(()=>f.callback(b),0)})}),this.bindModelEvent(W,z(cp),f=>{if(!f.event.defaultPrevented){let b=f.objectInfo.obj;if(b!=null){let A=this.view.getEdgeDefinition(this.model.getEdgeType(b));A.deleteConfirm?A.deleteConfirm({edge:f.objectInfo.obj,e:f.event},()=>this.model.removeEdge(b)):this.model.removeEdge(b)}}}),this.Vu(o),this.$dataLoadStart();let l=this.xu();this.$dataLoadEnd(!l)}$getCanvasElement(){return this.canvasElement}$getDragViewportContainer(){return this.rootElement}$isDraggingSupported(){return!0}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el)),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el),e.removeChildren===!1))for(let n=0;n<e.children.length;n++){let o=this.$getManagedElement(e.children[n].id);o&&this.panZoom.restore(o)}return t}$afterRefresh(e){this.$afterRelayout(e)}dA(e,t){e.decorate({surface:this,adapter:this.$_layout.adapter,layout:this.$_layout,setAbsolutePosition:(n,o)=>{Ie(n,o)},model:this.model,bounds:t.bounds,positions:t.positions,fixElement:(n,o,s,a)=>{if(a!=null){let h=Array.from(e.fixedElements).find(d=>d.id===a);h!=null&&this.unfixElement(h.el)}let l=Array.from(e.fixedElements).find(h=>h.el===n);return l==null&&(l=this.fixElement(n,o,s,a),e.fixedElements.add(l)),l},floatElement:(n,o)=>{let s=Array.from(e.floatedElements).find(a=>a.el===n);return s==null&&(s={el:n,pos:o,constraints:{}},this.floatElement(n,o),e.floatedElements.add(s)),s},appendElement:(n,o,s)=>{let a=Array.from(e.appendedElements).find(l=>l.el===n);if(a==null){a={el:n,pos:o,constraints:s};let l=o.x,h=o.y,d=null;this.canvasElement.appendChild(n),this.panZoom.add(n,!0),s&&s.alignX&&s.alignX===yt&&(d=d||Je(n),l-=d.width),s&&s.alignY&&s.alignY===ht&&(d=d||Je(n),h-=d.height),Ie(n,{x:l,y:h}),e.appendedElements.add(a)}return a}})}$afterRelayout(e){for(let t=0;t<this.qn.length;t++)this.dA(this.qn[t],e);super.$afterRelayout(e)}$zoomToFit(e){this.panZoom.zoomToFit(e)}$zoomToFitIfNecessary(e){this.panZoom.zoomToFitIfNecessary(e)}Ku(e){this.panZoom.$computeCompoundZoom()}$startPanRepeat(e,t,n,o,s,a){this.panZoom.startPanRepeat(e,t,n,o,s,a)}$stopPanRepeat(){this.panZoom.stopPanRepeat()}$canStartElementDrag(){return this.xc!==!1&&(this.mode===Sr||this.mode===bi)}$zoomToElements(e){this.panZoom.zoomToElements(e)}$getNodesInViewport(){return this.Ts(ce.objectType,this.panZoom.viewportElement)}$getGroupsInViewport(){return this.Ts(se.objectType,this.panZoom.viewportElement,e=>this.$getGroupContentAreaElement(e))}$edgeTap(e){this.$editEdgesOnTap===!0&&this.startEditingPath(e.obj)}cA(e){var a,l,h,d,u;let t=((a=e.zoom)==null?void 0:a.wheel)!==!1,n=((l=e.pan)==null?void 0:l.wheel)===!0,o=((h=e.pan)==null?void 0:h.axis)||"both",s=(d=e.wheel)==null?void 0:d.cssFilter;return{filter:(u=e.wheel)==null?void 0:u.filter,cssFilter:s,reverse:e.wheel!=null?e.wheel.reverse===!0:!1,pan:n,zoom:t,useMetaKey:e.wheel!=null?e.wheel.useMetaKey===!0:!1,axis:o}}$graphClearStart(){super.$graphClearStart();for(let e=0;e<this.qn.length;e++)this.qn[e].reset({remove:t=>t.parentNode&&t.parentNode.removeChild(t)});this.panZoom.reset(),this.se(e=>e.reset())}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.toolsLayer,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.vertexLayer,t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.vertexGroup:this.vertexLayer,t)}$appendEdgeElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.edgeGroup:this.vertexLayer,t)}$_attachEdgePathEditor(e){this.$edgePathEditor=e,OR(),wR(),MR()}$addToDragGroup(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.xg(e,...n)}$_assignRemoveFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}$select(e){if(super.$select(e),K(e.obj)||Y(e.obj)){let t=this.$getManagedElement(e.obj.id);t&&this.elementDragHandler.xg({id:VR,active:!0,membership:Wa},t)}}$deselect(e){if(super.$deselect(e),K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.removeFromDragGroup(t)}}$selectionCleared(e){super.$selectionCleared(e),this.clearDragGroup(VR)}save(e){let t=super.save(e);return Object.assign(t,{pan:Object.assign({},this.getPan()),transformOrigin:Object.assign({},this.panZoom.transformOrigin)})}load(e,t){let n=()=>{e.pan&&this.setPan(e.pan.x,e.pan.y),e.transformOrigin&&this.panZoom.setTransformOrigin(e.transformOrigin.x,e.transformOrigin.y),t&&t()};super.load(e,n)}startEditingPath(e,t){this.$edgePathEditor!=null?this.$edgePathEditor.startEditing(e,t):U("ERROR: cannot start path edit - surface not created with 'edges:{editable:true}'")}stopEditingPath(){this.$edgePathEditor!=null?this.$edgePathEditor.stopEditing():U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'")}clearPathEdits(e){return this.$edgePathEditor!=null?this.$edgePathEditor.clearEdits(e):(U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'"),!1)}getVisibleCanvasBounds(){return this.panZoom.getVisibleContentArea()}addDragFilter(e,t){this.elementDragHandler.addDragFilter(e,null,t)}addDragClassnameFilter(e){this.elementDragHandler.addClassnameFilter(e)}addDragSelectorFilter(e){this.elementDragHandler.addSelectorFilter(e)}addVertexDragFilter(e){this.elementDragHandler.$addVertexDragFilter(e)}removeDragClassnameFilter(e){this.elementDragHandler.removeClassnameFilter(e)}addWheelSelectorFilter(e){this.panZoom.$addWheelSelectorFilter(e)}addToDragGroup(e,...t){let n=j(e)?{id:e,active:!0,membership:Wa}:Object.assign(e,{membership:Wa});this.$addToDragGroup(n,...t)}removeFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}setDragGroupState(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.$setDragGroupState(e,...n)}clearDragGroup(e){this.elementDragHandler.$clearDragGroup(e)}attachMiniview(e){this.addPlugin({type:Wn.type,options:e})}magnetizeAtEvent(e){let t=this.fromPageLocation(e.pageX,e.pageY);this.magnetizeAtPoint(t)}destroy(){let e;for(let t=0;t<this.sl.length;t++)try{e=this.sl[t],this.dataSource.unbind(e.event,e.fn)}catch(n){U("WARN: Could not unbind event "+e.event+" during destroy operation.")}this.canvasElement.parentNode.removeChild(this.canvasElement),F(this.rootElement,by),F(this.rootElement,TP),F(this.rootElement,Ay),this.se(t=>{t.destroy()}),this.panZoom.destroy(),this.panZoom=null,this.$edgePathEditor!=null&&this.$edgePathEditor.destroy(),this.fire($i,this),super.destroy()}zoomToBackground(e){this.panZoom.zoomToBackground(e)}zoomToDecorator(e){let t=j(e.decorator)?this.getDecorator(e.decorator):e.decorator;if(t!=null){let n=this.getViewportBoundsInfo(),o=t.getBounds();this.panZoom.zoomToExtents(Object.assign(e,{extents:[n,o]}))}}zoomToExtents(e){this.panZoom.zoomToExtents(e)}mapEventLocation(e){return this.panZoom.mapEventLocation(e)}centerContent(e){this.panZoom.centerContent(e)}centerContentHorizontally(e){this.panZoom.centerContentHorizontally(e)}centerContentVertically(e){this.panZoom.centerContentVertically(e)}centerBackground(e){this.panZoom.centerBackground(e)}alignBackground(e,t){this.panZoom.alignBackground(e,t)}zoomToSelection(e){e=e||{};let t=()=>e.filter?this.model.filter(e.filter):this.model.getSelection(),n=e.selection||t(),o=[];n.eachNode((s,a)=>{o.push(this.getRenderedElement(a.id))}),n.eachGroup((s,a)=>{o.push(this.getRenderedElement(a.id))}),o.length>0&&this.panZoom.zoomToElements({elements:o,fill:e.fill,doNotZoomIfVisible:e.doNotZoomIfVisible,doNotAnimate:e.doNotAnimate})}getPath(e){return new Lg(this.model.getPath(e),this)}setApparentCanvasLocation(e,t){return this.panZoom.setApparentCanvasLocation(e,t)}getViewportBoundsInfo(){return this.panZoom.getBoundsInfo()}$getFixedViewportBoundsInfo(){return null}getApparentCanvasLocation(){return this.panZoom.getApparentCanvasLocation()}addBackground(e){this.panZoom.addBackground(e)}removeBackground(e){this.panZoom.removeBackground(e)}setZoom(e,t){let n=this.panZoom.setZoom(e,t);return super.setZoom(n,t)}getDecorator(e){return this.qn.find(t=>t.id===e)}setZoomRange(e,t){return this.panZoom.setZoomRange(e,t)}getZoomRange(){return this.panZoom.getZoomRange()}getZoom(){return this.panZoom.getZoom()}nudgeZoom(e,t){return this.panZoom.nudgeZoom(e,t)}nudgeWheelZoom(e,t){this.panZoom.nudgeWheelZoom(e,t)}zoomOut(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomOut(e)}zoomIn(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomIn(e)}getPan(){return this.panZoom.getPan()}pan(e,t,n){this.panZoom.pan(e,t,!n)}setPan(e,t,n,o){this.panZoom.setPan(e,t,n,o)}setPanAndZoom(e,t,n,o){this.setPan(e,t,o),this.setZoom(n,o)}Lg(e){let t=null;return(Array.isArray(e)?e:[e]).forEach(o=>{let s=this.getObjectInfo(o,!1);if(s.el!=null){let a=this.viewport.getElementBounds(s.id);t=t==null?a:Xb(t,a)}}),t}centerOnAndZoom(e,t,n){let o=this.Lg(e);o!=null&&this.panZoom.centerOnAndZoom({bounds:o,fillRatio:t,doNotAnimate:n})}centerOn(e,t){let n=this.Lg(e);n!=null&&this.panZoom.centerOn({bounds:n,doNotAnimate:t})}centerOnHorizontally(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnHorizontally({bounds:this.viewport.getElementBounds(t.id)})}centerOnVertically(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnVertically({bounds:this.viewport.getElementBounds(t.id)})}setClamping(e){this.panZoom.setClamping(e)}setViewportCenter(e){this.panZoom.setViewportCenter(e)}isPageLocationInViewport(e,t){return this.panZoom.isInViewport(e,t)}fromPageLocation(e,t,n){return this.panZoom.fromPageLocation(e,t,n)}fromWindowLocation(e,t,n){return this.panZoom.fromWindowLocation(e,t,n)}toPageLocation(e,t){return this.panZoom.toPageLocation(e,t)}toViewportLocation(e,t){return this.panZoom.toViewportLocation(e,t)}bindModelEvent(e,t,n){let o=(s,a)=>{let l=this.getObjectInfo(a,!0);l.obj!=null&&setTimeout(()=>n({event:s,eventTarget:a,objectInfo:l,model:this.model,ui:this}),0)};n.wg=o,this.on(this.vertexLayer,e,t,o)}unbindModelEvent(e,t){t.wg!=null&&this.off(this.vertexLayer,e,t.wg)}cloneVertex(e,t){let n=super.cloneVertex(e,t);return n!=null&&(t==null?void 0:t.flash)===!0&&setTimeout(()=>{this.flashVertex(n)}),n}getEffectiveVisibleZoom(){let e=this.panZoom.getCompoundZoom();return this.currentZoom*e}isInViewport(e,t){return this.panZoom.isInViewport(e,t)}fixElement(e,t,n,o,s){return e.style.position=qe,this.panZoom.fixElement(e,t,n,o,s)}unfixElement(e){this.panZoom.unfixElement(e)}floatElement(e,t){this.panZoom.floatElement(e,t)}setMode(e,t){let n={[Sr]:()=>{this.panZoom.setEnabled(!0)},[bi]:()=>{this.panZoom.setEnabled(!1)},[ps]:()=>{this.panZoom.setEnabled(!1)},[jn]:()=>{this.panZoom.setEnabled(!1)}};n[e]?(this.mode=e,n[e](),e===bi&&!t&&this.model.clearSelection(),this.fire(Ln,e)):U("Surface: unknown mode '"+e+"'")}alignContent(e){this.panZoom.alignContent(e)}alignContentTop(e){this.panZoom.alignContentTop(e)}alignContentBottom(e){this.panZoom.alignContentBottom(e)}alignContentLeft(e){this.panZoom.alignContentLeft(e)}alignContentRight(e){this.panZoom.alignContentRight(e)}};c(Ec,"type","Surface");var Zx=class extends xu{fetchUrl(r){Aa(r)}render(r,e,t){let n=e!=null&&e.useSvgContainer?wa:La,o=t||Xh(n,e==null?void 0:e.useSvgContainer,e);return yV(this,r,o,e)}renderDiagram(r,e){return new vm(this,r,e)}renderPaper(r,e,t,n){let o=e!=null&&e.useSvgContainer?wa:La,s=n||Xh(o,e==null?void 0:e.useSvgContainer,{});return xV(this,r,s,e,t)}};function yn(i){return i=i||{},new Zx(i)}function fV(i,r){i.bind(Kt,e=>{r.$nodeAdded(e)}),i.bind(Zt,e=>{r.$groupAdded(e)}),i.bind(Ce,e=>{r.$nodeRemoved(e)}),i.bind(Re,e=>{r.$groupRemoved(e)}),i.bind(ur,e=>{r.$edgeAdded(e)}),i.bind(bt,e=>{r.$edgeRemoved(e)}),i.bind(_n,()=>{r.$graphClearStart(),r.$graphClearEnd()})}function yV(i,r,e,t){return GR(i,r,e,(n,o,s,a,l)=>new Ec(n,s||n,a,o,l),t)}function GR(i,r,e,t,n){let o,s=Object.assign({dataSource:i},n||{});s.selection!=null&&(typeof s.selection!="function"?o=s.selection:o=new pr(i,{generator:s.selection}));let a=s.id||$(),l=t(i,s,o,r,e);return o!=null&&fV(o,l),i.$addRenderer(l,a),l}function xV(i,r,e,t,n){return GR(i,r,e,(o,s,a,l,h)=>new fc(o,a||o,l,s,h,n),t)}var bV=i=>i.map(r=>String.fromCodePoint(r)).join(""),AV=[99,114,101,97,116,101,69,108,101,109,101,110,116];function SV(){return document}var $R=i=>SV()[bV(AV)](i);var fc=class extends Ra{constructor(e,t,n,o,s,a){super(e,t,n,o,s,a);this.model=e;c(this,"$canvas");c(this,"$margin");c(this,"$horizontalAlign");c(this,"$verticalAlign");c(this,"$scale");this.id=o.id||$(),this.$margin=o.margin||hP,this.$horizontalAlign=o.horizontalAlign||o.align||as,this.$verticalAlign=o.verticalAlign||o.align||as,this.$scale=o.scale!==!1,o.useSvgContainer?this.$canvas=V(we,{width:"100%",height:"100%"}):(this.$canvas=$R("div"),this.$canvas.style.transformOrigin="0 0"),new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.syncView()})}).observe(this.rootElement),L(this.rootElement,sP),L(this.$canvas,lP),n.appendChild(this.$canvas),this.$scale||L(this.rootElement,aP),this.setContainer(this.$canvas),pc(this.rootElement,!1),this.bindAll([Br,Qs,Vt,Gr,Ce,Re,Ur,Fr,On,pS,qs],()=>{this.syncView()}),this.Vu(o),this.$dataLoadStart();let h=this.xu();this.$dataLoadEnd(!h)}$getCanvasElement(){return this.$canvas}syncView(){let e=this.viewport.je,t=Je(this.rootElement),n=e.xmax-e.xmin,o=e.ymax-e.ymin,s=t.width-2*this.$margin,a=t.height-2*this.$margin,l=s/n,h=a/o,d=Math.min(l,h),u=n*d,p=o*d;if(wt(this.$canvas))if(this.$scale){let g=0,m=0;switch(this.$horizontalAlign){case as:break;case Th:g-=(s-d*n)/2;break;case vh:g+=(s-d*n)/2;break}switch(this.$verticalAlign){case as:break;case Th:m-=(a-d*o)/2;break;case vh:m+=(a-d*o)/2;break}this.$canvas.setAttribute("transform",`translate(${g}, ${m})`),this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`)}else{let g=e.xmax-e.xmin,m=e.ymax-e.ymin;this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`),this.$canvas.style.width=`${g}px`,this.$canvas.style.height=`${m}px`}else if(this.$scale){let g=(-e.xmin+this.$margin)*d,m=(-e.ymin+this.$margin)*d;switch(this.$horizontalAlign){case Th:break;case as:g+=(s-u)/2;break;case vh:g+=s-u;break}switch(this.$verticalAlign){case Th:break;case as:m+=(a-p)/2;break;case vh:m+=a-p;break}this.$canvas.style.transform=`translateX(${g}px) translateY(${m}px) scale(${d})`}else{let g=-e.xmin+this.$margin,m=-e.ymin+this.$margin,E=e.xmax-e.xmin+2*this.$margin,y=e.ymax-e.ymin+2*this.$margin;this.$canvas.style.transform=`translateX(${g}px) translateY(${m}px) scale(1)`,this.$canvas.style.width=`${E}px`,this.$canvas.style.height=`${y}px`}}setMargin(e){this.$margin=e,this.syncView()}toPageLocation(e,t){return{x:e,y:t}}fromPageLocation(e,t,n){return{x:e,y:t}}fromWindowLocation(e,t,n){return{x:e,y:t}}mapEventLocation(e){return this.fromPageLocation(e.pageX,e.pageY)}getViewportBoundsInfo(){let e=Je(this.getContainer()),t=this.viewport.getBoundsWidth(),n=this.viewport.getBoundsHeight(),o=e.width/t,s=e.height/n,a=Math.min(o,s);return{width:t,height:n,x:this.viewport.getX(),y:this.viewport.getY(),vw:e.width,vh:e.height,minimumFill:a,zoom:1}}$getFixedViewportBoundsInfo(){if(this.$scale)return null;{let e=this.getViewportBoundsInfo();return{x:e.x-this.$margin,y:e.y-this.$margin,width:e.width+2*this.$margin,height:e.height+2*this.$margin,vw:e.vw,vh:e.vh,zoom:e.zoom,minimumFill:e.minimumFill}}}getApparentCanvasLocation(){return{x:0,y:0}}addBackground(e){console.log("add background to paper - not implemented")}removeBackground(e){console.log("remove background from paper - not implemented")}zoomOut(e){}zoomIn(e){}getVisibleCanvasBounds(){return{x:0,y:0,width:100,height:100}}};function s6e(i,r,e,t){let n=yn(e||{}),o=r!=null&&r.useSvgContainer?wa:La,s=Xh(o,r==null?void 0:r.useSvgContainer,{}),a=new fc(n,n,i,r,s,null);return n.$addRenderer(a,a.id),t&&a.model.load({data:t}),a}function TV(i,r,e){if($t(r,e,i))return r;{let t=r.parentNode;for(;t!=null&&t!==i;){if($t(t,e,i))return t;t=t.parentNode}}}function vV(i){return typeof i=="function"?(i.yo=$(),i.yo):i}function CV(i,r,e){let t=null,n=r.getAttribute("katavorio-draggable"),o=n!=null?"[katavorio-draggable='"+n+"'] ":"";for(let s=0;s<i.length;s++)if(i[s].selector==="."?t=r:t=TV(r,e,o+i[s].selector),t!=null){if(i[s].filter){let a=$t(e,i[s].filter,t);if(i[s].filterExclude===!0&&!a||a)return null}return[i[s],t]}return null}var BR="start",FR="beforeStart",UR="drag",PV="drop",_V="over",OV="out",YR="stop",zR="katavorio-draggable",RV=zR,LV=10,wV=10,Jx=function(){return!0},DV=function(){return!1},Kx={delegatedDraggable:"katavorio-delegated-draggable",draggable:RV,drag:"katavorio-drag",selected:"katavorio-drag-selected",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},XR=[YR,BR,UR,PV,_V,OV,FR],NV=function(){},Za=function(i,r){if(i!=null){i=!j(i)&&i.tagName==null&&i.length!=null?i:[i];for(let e=0;e<i.length;e++)r.apply(i[e],[i[e]])}},IV=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e.getInputFilterSelector(),r)},qx=class{constructor(r,e){this.el=r;this.manager=e;c(this,"uuid",$());c(this,"enabled",!0);c(this,"scopes",[]);c(this,"eventManager");this.eventManager=e.eventManager}setEnabled(r){this.enabled=r}isEnabled(){return this.enabled}toggleEnabled(){this.enabled=!this.enabled}addScope(r){let e={};Za(this.scopes,t=>{e[t]=!0}),Za(r?r.split(/\s+/):[],t=>{e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}removeScope(r){let e={};Za(this.scopes,t=>{e[t]=!0}),Za(r?r.split(/\s+/):[],t=>{delete e[t]}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}toggleScope(r){let e={};Za(this.scopes,t=>{e[t]=!0}),Za(r?r.split(/\s+/):[],t=>{e[t]?delete e[t]:e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}},MV="notNegative",VV="parent",GV="parentEnclosed";function jR(i,r){let e=null;switch(i){case MV:{e=(t,n,o,s)=>({x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))});break}case VV:{let t=r||5;e=(n,o,s,a)=>{let l=n.x<0?0:n.x>s.width-t?s.width-t:n.x,h=n.y<0?0:n.y>s.height-t?s.height-t:n.y;return{x:l,y:h}};break}case GV:{e=(t,n,o,s)=>{let a=t.x<0?0:t.x+s.width>o.width?o.width-s.width:t.x,l=t.y<0?0:t.y+s.height>o.height?o.height-s.height:t.y;return{x:a,y:l}};break}}return e}var Qx=class extends qx{constructor(e,t,n){super(e,n);c(this,"Dg");c(this,"rightButtonCanDrag");c(this,"consumeStartEvent");c(this,"clone");c(this,"scroll");c(this,"trackScroll");c(this,"cloneSize");c(this,"q");c(this,"_e");c(this,"St");c(this,"aa");c(this,"la",{x:0,y:0});c(this,"xo",{x:0,y:0});c(this,"qe");c(this,"ha");c(this,"ca");c(this,"E");c(this,"bc");c(this,"bo");c(this,"Ao");c(this,"Qn",!1);c(this,"da");c(this,"ei");c(this,"Ac");c(this,"$");c(this,"So",[]);c(this,"Ng");c(this,"Ig");c(this,"Rn");c(this,"Or");c(this,"Sc");c(this,"To",{});c(this,"ua");c(this,"Ae");c(this,"downListener");c(this,"moveListener");c(this,"upListener");c(this,"scrollTracker");c(this,"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]});if(this.Dg=this.manager.css.draggable,L(this.el,this.Dg),this.downListener=this.en.bind(this),this.upListener=this.Ar.bind(this),this.moveListener=this.rn.bind(this),this.rightButtonCanDrag=t.rightButtonCanDrag===!0,this.consumeStartEvent=t.consumeStartEvent!==!1,this.E=this.el,this.clone=t.clone===!0,this.cloneSize=t.cloneSize,this.scroll=t.scroll===!0,this.trackScroll=t.trackScroll!==!1,this.Ng=t.canDrag||Jx,this.Ig=t.consumeFilteredEvents,this.Rn=t.parent,this.Or=t.ignoreZoom===!0,this.da=t.ghostProxyParent,this.Sc=t.getTargetScale,this.trackScroll&&(this.scrollTracker=this.uA.bind(this),document.addEventListener("scroll",this.scrollTracker)),t.ghostProxy===!0?this.ei=Jx:t.ghostProxy&&typeof t.ghostProxy=="function"?this.ei=t.ghostProxy:this.ei=(o,s)=>this.$&&this.$.useGhostProxy?this.$.useGhostProxy(o,s):!1,t.makeGhostProxy?this.Ac=t.makeGhostProxy:this.Ac=o=>this.$&&this.$.makeGhostProxy?this.$.makeGhostProxy(o):o.cloneNode(!0),t.selector){let o=this.el.getAttribute(zR);o==null&&(o=""+new Date().getTime(),this.el.setAttribute("katavorio-draggable",o)),this.So.push(t)}this.eventManager.on(this.el,ge,this.downListener)}uA(e){if(this.St){let t={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},n=t.x-this.la.x,o=t.y-this.la.y,s={x:n+this.aa.x,y:o+this.aa.y},a=s.x-this.q.x,l=s.y-this.q.y,h=this.Or?1:this.manager.zoom;this.E&&this.E.parentNode&&(a+=this.E.parentNode.scrollLeft-this.xo.x,l+=this.E.parentNode.scrollTop-this.xo.y),a/=h,l/=h,this.moveBy(a,l,e),this.aa=s,this.la=t}}on(e,t){this.listeners[e]&&this.listeners[e].push(t)}off(e,t){if(this.listeners[e]){let n=[];for(let o=0;o<this.listeners[e].length;o++)this.listeners[e][o]!==t&&n.push(this.listeners[e][o]);this.listeners[e]=n}}Ar(e){this.q&&(this.q=null,this.eventManager.off(document,ae,this.moveListener),this.eventManager.off(document,le,this.upListener),this.unmark(e),this.stop(e),this.St=!1,this.clone?(this.E&&this.E.parentNode&&this.E.parentNode.removeChild(this.E),this.E=null):this.$&&this.$.revertFunction&&this.$.revertFunction(this.E,this.manager.positionGetter(this.E))===!0&&this.manager.positionSetter(this.E,this._e))}en(e){if(e.defaultPrevented)return;if((this.rightButtonCanDrag||e.which!==3&&e.button!==2)&&this.isEnabled()&&this.Ng())if(this.uc(e)&&IV(e,this.el,this.manager)){this.$=null,this.Ae=null,this.So.length===0&&U("VisuallyJs - WARN: no available drag selectors");let o=e.target||e.srcElement,s=CV(this.So,this.el,o);if(s!=null&&(this.$=s[0],this.Ae=s[1]),this.$==null||this.Ae==null)return;let a=this.$.dragInit?this.$.dragInit(this.Ae,e):null;a!=null&&(this.Ae=a);let l=1;if(this.clone)if(this.E=this.Ae.cloneNode(!0),L(this.E,Kx.clonedDrag),this.E.setAttribute("id",null),this.E.style.position="absolute",this.Rn!=null){let h=this.manager.positionGetter(this.el);this.E.style.left=h.x+"px",this.E.style.top=h.y+"px",this.Rn.appendChild(this.E)}else{let h=io(this.Ae,!0),d=this.Ae.getBoundingClientRect();this.E.style.left=`${h.x}px`,this.E.style.top=`${h.y}px`;let u=this.cloneSize==null?d.width:this.cloneSize.width,p=this.cloneSize==null?d.height:this.cloneSize.height;this.E.style.width=`${u}px`,this.E.style.height=`${p}px`,document.body.appendChild(this.E),this.Sc&&!this.Or&&(l=this.Sc(),l!==1&&(this.E.style.transform=`scale(${l})`,this.E.style.transformOrigin="0 0"))}else this.E=this.Ae;this.consumeStartEvent&&oe(e),this.q=Ee(e),this.E&&this.E.parentNode&&(this.xo={x:this.E.parentNode.scrollLeft,y:this.E.parentNode.scrollTop}),this._e=this.manager.positionGetter(this.E),this.qe=this.manager.getSize(this.E),this.qe.width=this.qe.width*l,this.qe.height=this.qe.height*l,this.eventManager.on(document,ae,this.moveListener),this.eventManager.on(document,le,this.upListener),this.pa(FR,{el:this.el,pos:this._e,e,drag:this,size:this.qe})}else this.Ig&&oe(e)}rn(e){if(this.q){if(!this.St){let t=this.pa(BR,{el:this.el,pos:this._e,e,drag:this,size:this.qe});if(t!==!1){if(!this.q)return;this.mark(t),this.St=!0}else this.abort()}if(this.q){let t=Ee(e),n=t.x-this.q.x,o=t.y-this.q.y,s=this.Or?1:this.manager.zoom;this.aa={x:t.x,y:t.y},this.la={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this.E&&this.E.parentNode&&(n+=this.E.parentNode.scrollLeft-this.xo.x,o+=this.E.parentNode.scrollTop-this.xo.y),n/=s,o/=s,this.moveBy(n,o,e)}}}getDragDelta(){return this._e!=null&&this.q!=null?{x:this.q.x-this._e.x,y:this.q.y-this._e.y}:{x:0,y:0}}mark(e){this._e=this.manager.positionGetter(this.E),this.qe=this.manager.getSize(this.E),L(this.E,this.manager.css.drag),this.ua=this.manager.getParentConstrainingRectangle(this.E),this.bo=0,this.Ao=0}unmark(e){this.Qn&&this.ei(this.Ae,this.E)?(this.bc={x:this.E.offsetLeft-this.bo,y:this.E.offsetTop-this.Ao},this.E.parentNode.removeChild(this.E),this.E=this.Ae):this.bc=null,F(this.E,this.manager.css.drag),this.Qn=!1}moveBy(e,t,n){let o=this.toGrid({x:this._e.x+e,y:this._e.y+t}),s=this.pA(o,this.E,this.ua,this.qe,{x:this._e.x,y:this._e.y},n);if(s!=null){if(this.ei(this.el,this.E))if(o.x!==s.x||o.y!==s.y){if(!this.Qn){let a=this.Ac(this.Ae);L(a,Kx.ghostProxy),this.da?(this.da.appendChild(a),this.ha=io(this.Ae.parentNode),this.ca=io(this.da),this.bo=this.ha.x-this.ca.x,this.Ao=this.ha.y-this.ca.y):this.Ae.parentNode.appendChild(a),this.E=a,this.Qn=!0}s=o}else this.Qn&&(this.E.parentNode.removeChild(this.E),this.E=this.Ae,this.Qn=!1,this.ha=null,this.ca=null,this.bo=0,this.Ao=0);this.manager.positionSetter(this.E,{x:s.x+this.bo,y:s.y+this.Ao}),this.pa(UR,{el:this.el,pos:s,e:n,drag:this,size:this.qe,originalPos:this._e,viewport:this.ua})}}abort(){this.q!=null&&this.Ar()}getDragElement(e){return e?this.Ae||this.el:this.E||this.el}stop(e,t){if(t||this.St){let n=[],o=this.manager.positionGetter(this.E);n.push([this.E,o,this,this.qe]),this.pa(YR,{el:this.E,pos:this.bc||o,finalPos:o,e,drag:this,selection:n,size:this.qe,originalPos:{x:this._e.x,y:this._e.y},viewport:this.ua})}else this.St||this.$.dragAbort&&this.$.dragAbort(this.Ae)}pa(e,t){let n=null;if(this.$&&this.$[e])n=this.$[e](t);else if(this.listeners[e])for(let o=0;o<this.listeners[e].length;o++)try{let s=this.listeners[e][o](t);s!=null&&(n=s)}catch(s){}return n}resolveGrid(){let e={grid:null,thresholdX:LV/2,thresholdY:wV/2};return this.$!=null&&this.$.grid!=null&&(e.grid=this.$.grid,this.$.snapThreshold!=null&&(e.thresholdX=this.$.snapThreshold,e.thresholdY=this.$.snapThreshold)),e}toGrid(e){let{grid:t,thresholdX:n,thresholdY:o}=this.resolveGrid();if(t==null)return e;{let s=t?t.width/2:n,a=t?t.height/2:o;return he(e,t,s,a)}}setUseGhostProxy(e){this.ei=e?Jx:DV}pA(e,t,n,o,s,a){return this.$!=null&&this.$.constrainFunction&&typeof this.$.constrainFunction=="function"?this.$.constrainFunction(e,t,n,o,s,a):e}uc(e){for(let t in this.To){let n=this.To[t],o=n[0](e);if(n[1]&&(o=!o),!o)return!1}return!0}addFilter(e,t){if(e){let n=vV(e);this.To[n]=[o=>{let s=o.srcElement||o.target,a;return j(e)?a=$t(s,e,this.el):typeof e=="function"&&(a=e(o,this.el)),a},t!==!1]}}removeFilter(e){let t=typeof e=="function"?e.yo:e;delete this.To[t]}clearAllFilters(){this.To={}}addSelector(e,t){e.selector&&(t?this.So.unshift(e):this.So.push(e))}destroy(){this.eventManager.off(this.el,ge,this.downListener),this.eventManager.off(document,ae,this.moveListener),this.eventManager.off(document,le,this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null,this.scrollTracker!=null&&document.removeEventListener("scroll",this.scrollTracker)}},$V=["input","textarea","select","button","option"],BV=$V.join(","),wm=class{constructor(r){c(this,"eventManager");c(this,"zoom",1);c(this,"css",{});c(this,"inputFilterSelector");c(this,"positionGetter");c(this,"getSize");c(this,"positionSetter");this.inputFilterSelector=r.inputFilterSelector||BV,this.eventManager=new xe,this.zoom=r.zoom||1,this.positionGetter=r.positionGetter,this.getSize=r.getSize,this.positionSetter=r.positionSetter;let e=r.css||{};Object.assign(this.css,e)}getParentConstrainingRectangle(r){let e=r.parentNode;if(e==null)return{width:0,height:0};{let t=e.scrollLeft!=null?e.scrollLeft:0,n=e.scrollTop!=null?e.scrollTop:0,o=this.getSize(e);return{width:o.width+t,height:o.height+n}}}mA(r){r=r||{};let e={events:{}},t;for(Object.assign(e,r),t=0;t<XR.length;t++){let n=XR[t];e.events[n]=r[n]||NV}return e}getInputFilterSelector(){return this.inputFilterSelector}setInputFilterSelector(r){return this.inputFilterSelector=r,this}draggable(r,e){if(r.vo==null){let t=this.mA(e),n=new Qx(r,t,this);return L(r,Kx.delegatedDraggable),r.vo=n,n}else return r.vo}destroyDraggable(r){r.vo&&(r.vo.destroy(),delete r.vo)}};var FV=15,UV=10,YV="markers",zV="lineStyle",XV="sourceArrow",jV="targetArrow",HV="bothArrows",kV="plain",WV="dashed";function P6e(i){let r=(i==null?void 0:i.arrowWidth)||FV,e=(i==null?void 0:i.arrowLength)||UV,t=(i==null?void 0:i.lineStyleProperty)||zV,n=(i==null?void 0:i.markersProperty)||YV;return[{property:t,mappings:{[kV]:{},[WV]:{dashArray:"2"}}},{property:n,mappings:{noArrows:{overlays:[]},[XV]:{overlays:[{type:Or.type,options:{location:0,direction:-1,width:r,length:e}}]},[jV]:{overlays:[{type:Or.type,options:{location:1,width:r,length:e}}]},[HV]:{overlays:[{type:Or.type,options:{location:1,width:r,length:e}},{type:Or.type,options:{location:0,direction:-1,width:r,length:e}}]}}}]}var HR={set:function(i,r){localStorage.setItem(i,r)},get:function(i){return localStorage.getItem(i)},clear:function(i){localStorage.removeItem(i)},clearAll:function(){for(;localStorage.length>0;){let i=localStorage.key(0);localStorage.removeItem(i)}},setJSON:function(i,r){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot store value.");HR.set(i,JSON.stringify(r))},getJSON:function(i){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot retrieve value.");return JSON.parse(HR.get(i))}};var kR=class{constructor(r,e){c(this,"collicat");c(this,"drags",[]);this.collicat=new wm({positionGetter:o=>En(o),positionSetter:(o,s)=>tr(o,s),getSize:o=>Je(o)}),e=e||{};let t={selector:"."};t.filter=e.filter,t.constrainFunction=e.constrain,t.constrainFunction==null&&e.containment!=null&&(t.constrainFunction=jR(e.containment,e.containmentPadding)),(Array.isArray(r)?r:[r]).forEach(o=>{let s=this.collicat.draggable(o,{});s.addSelector(t),this.drags.push([s,o])})}destroy(){this.drags.forEach(r=>this.collicat.destroyDraggable(r[1])),this.collicat=null,this.drags.length=0}};function Y6e(i){WR?i():eb.push(i)}var eb=[],WR=!1,Dm=()=>{WR=!0;for(let i=0;i<eb.length;i++)eb[i]()},tb=class{constructor(r){this.templateHolder=r;c(this,"c",0)}Vg(){this.c--,this.c<=0&&Dm()}add(r){this.c++,Aa({url:r,success:e=>{let t=this.templateHolder.innerHTML;t+=e,this.templateHolder.innerHTML=t,this.Vg()},error:e=>{this.Vg()}})}ensureNotEmpty(){this.c<=0&&Dm()}},ZR="_vjs_templates",ZV=()=>{let i=function(){if(typeof document!="undefined")if(/complete|loaded|interactive/.test(document.readyState)&&typeof document.body!="undefined"&&document.body!=null){let r=document.getElementById(ZR);if(r)Dm();else{r=document.createElement("div"),r.style.display="none",r.id=ZR,document.body.appendChild(r);let e=new tb(r),t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++){let o=t[n].getAttribute("type"),s=t[n].getAttribute("src");o=="text/x-vjs-templates"&&e.add(s)}e.ensureNotEmpty()}}else setTimeout(i,9);else Dm()};i()};ZV();var JR="vjs-test-support-container",JV=1e-11;function KR(){let i=document.getElementById(JR);return i==null&&(i=document.createElement("div"),i.id=JR,document.body.appendChild(i)),i}var yc=[],KV=[];function Nm(i,r,e,t){let n=document.createElement("div");n.style.position="absolute",r?r.appendChild(n):KR().appendChild(n),n.setAttribute("id",i),e&&(n.className=e),n.style.left=Math.floor(Math.random()*1e3)+"px",n.style.top=Math.floor(Math.random()*1e3)+"px",yc.push({id:i,el:n}),t=t||{};for(let o in t)n.style[o]=t[o];return n}function qV(i,r){for(let e=0;e<i.length;e++)Nm(i[e],r)}function QV(i){i=i.length==null&&typeof i!="string"?[i]:i;for(let r=0;r<i.length;r++){let e=typeof i[r]=="string"?document.getElementById(i[r]):i[r];e.parentNode&&e.parentNode.removeChild(e)}}function xc(i){QV(document.querySelectorAll(i))}function e1(){for(let i=0;i<yc.length;i++)yc[i].el.parentNode.removeChild(yc[i].el);yc.length=0,xc("circle"),xc(".vjs-node"),xc(".vjs-surface-canvas"),xc("svg"),xc(".vjs-lasso"),KR().innerHTML=""}function t1(i,r,e){return i=typeof i=="string"?parseFloat(i.substring(0,i.length-2)):i,r=typeof r=="string"?parseFloat(r.substring(0,r.length-2)):r,Math.abs(r-i)<(e||5e-4)}function xo(i){return i.connector.canvas}function Ft(i,r,e){let t=e==null?.5:e.x,n=e==null?.5:e.y,o=i===document?i.documentElement.getBoundingClientRect():i.getBoundingClientRect(),s=o.x+o.width*t,a=o.y+o.height*n;return sr(s,a,r)}function rb(i,r,e,t){let n=i===document?{x:0,y:0,width:document.body.clientWidth,height:document.body.clientHeight}:i.getBoundingClientRect();return sr(n.x+r,n.y+e,t)}function qR(i,r,e,t){let n={clientX:i.clientX+r,clientY:i.clientY+e,screenX:i.screenX+r,screenY:i.screenY+e,pageX:i.pageX+r,pageY:i.pageY+e};return Object.assign(n,t||{}),n}var Im={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4};function r1(){let i=parseInt(""+Math.random()*2e3),r=parseInt(""+Math.random()*2e3);return sr(i,r)}function QR(i,r,e){let t=i;e=e||{},e.start&&e.start(),wr(i,r),e.down&&e.down();let n=Math.random()*50;for(let o=0;o<n;o++){let s=r1();r.style.left=s.screenX+"px",r.style.top=s.screenY+"px",t.trigger(document,"mousemove",s)}e.move&&e.move(),t.trigger(document,"mouseup",Im),e.up&&e.up()}function eL(i,r,e=!0,t){let n=i.getRenderedConnection(r.id),o=e?".vjs-connector-source-drag":".vjs-connector-target-drag",s=n.connector.canvas.querySelector(o);wr(i,s);let a=Im;if(t!=null){let l=i.toPageLocation(t.x,t.y);a=sr(l.x,l.y)}return i.trigger(document,"mousemove",a),i.trigger(document,"mouseup",a),i.fromPageLocation(a.pageX,a.pageY)}function tL(i,r,e,t){let n=Nm("div");return n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=(e&&e.width?e.width:1500)+"px",n.style.height=(e&&e.height?e.height:1500)+"px",{surface:i.render(n,r,t),container:n}}function n1(i,r,e,t){let n=yn(i),o,s;if(r!=null){let l=tL(n,r,e,t);s=l.container,o=l.surface}let a={model:n,surface:o,container:s};return KV.push(a),a}function i1(i,r){let e=i.surface.getRenderedConnection(r),t=xo(e),n=Ft(t);i.surface.trigger(t.querySelector("path"),"click",n)}function o1(i,r){let e=i.surface.getRenderedConnection(r),t=xo(e),n=Ft(t);i.surface.trigger(t.querySelector("path"),"dblclick",n)}function s1(i,r){let e=i.surface.getRenderedConnection(r),t=xo(e),n=Ft(t);var o=t.querySelector("path");i.surface.trigger(o,ge,n),i.surface.trigger(o,"mouseup",n)}function a1(i,r){let e=i.surface.getRenderedConnection(r),t=xo(e),n=Ft(t);var o=t.querySelector("path");i.surface.trigger(o,ge,n),i.surface.trigger(o,"mouseup",n),i.surface.trigger(o,ge,n),i.surface.trigger(o,"mouseup",n)}function bc(i,r,e){let t=i.surface.getRenderedConnection(r),n=xo(t),o=Ft(n);i.surface.trigger(n.querySelector("path"),e,o)}function nb(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Ja(i.surface,t,1,1)}function Ac(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);wr(i.surface,t,1),Ka(i.surface,t,1)}function l1(i,r,e){Mm(i,r,en,1,e)}function h1(i,r,e){Mm(i,r,"mouseover",1,e)}function c1(i,r,e){Mm(i,r,"mouseout",1,e)}function Mm(i,r,e,t=1,n){let o=i.model.getVertex(r),s=i.surface.getRenderedElement(o);qa(i.surface,s,e,t,n)}function Ja(i,r,e=1,t=1){let n=Ft(r),o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,t,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(o)}function rL(i,r,e=1){let t=Ft(r),n=document.createEvent("MouseEvents");n.initMouseEvent("dblclick",!0,!0,window,2,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(n)}function wr(i,r,e=1,t){qa(i,r,bo,e,t)}function Ka(i,r,e=1,t){qa(i,r,xn,e,t)}function qa(i,r,e,t=1,n){let o=Ft(r,null,n),s=document.createEvent("MouseEvents");s.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,t||1,null),r.dispatchEvent(s)}function Vm(i,r,e,t,n,o=1){let s=sr(t.x,t.y);n=n||{};let a=document.createEvent("MouseEvents");a.initMouseEvent(e,!0,!0,window,1,s.screenX,s.screenY,s.clientX,s.clientY,n.ctrlKey,n.altKey,n.shiftKey,n.metaKey,o||1,null),r.dispatchEvent(a)}function d1(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Ja(i.surface,t,2,1)}function u1(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);rL(i.surface,t,1)}function p1(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");Ja(i.surface,o,1,1)}function g1(i,r){Ja(i.surface,r,1,1)}function m1(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");rL(i.surface,o,1)}function nL(i,r){wr(i.surface,r),Ka(i.surface,r)}function E1(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");nL(i,o)}function f1(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");wr(i.surface,o),Ka(i.surface,o),wr(i.surface,o),Ka(i.surface,o)}function y1(i,r,e){let t=i.surface.getRenderedConnection(r),n=Xf(t,e||"lbl");Ja(i.surface,n.contentElements[0],1,1)}function x1(i,r,e){let t=i.model.getNode(r),o=i.surface.getRenderedElement(t).querySelector(fi(dn,e));o&&Ja(i.surface,o,1,1)}function ib(i,r,e,t,n,o){t=t||{};let s=i,a;oo(e)?a=Ft(e,null,n):a=rb(i.$getCanvasElement(),e.x,e.y);let l=i.model.getAllEdges().length;t.start&&t.start(),wr(i,r),t.down&&t.down();let h=Object.values(i.$_connMap).find(u=>u.edge.transient);if(h!=null&&s.trigger(xo(h).childNodes[0],st,a),s.trigger(document,en,a),t.move){let u=i.model.getAllEdges().filter(g=>g.transient)[0],p=u?i.getRenderedConnection(u.id):null;t.move(p)}let d=()=>{s.trigger(document,xn,a);let u=i.model.getAllEdges()[l],p=u?i.getRenderedConnection(u.id):null;return t.up&&t.up(p),p};if(o)o(d);else return d()}function b1(i,r,e){e=e||{};let t=i;e.start&&e.start(),wr(i,r),e.down&&e.down(),t.trigger(document,en,Im),t.trigger(document,xn,Im)}function iL(i,r,e,t,n,o,s){let a=i.getObjectInfo(t,!1);if(a.el){n=n||{};let l=i.getRenderedConnection(r.id),h=e?".vjs-connector-source-drag":".vjs-connector-target-drag",d=l.connector.canvas.querySelector(h);n.start&&n.start(),wr(i,d),n.down&&n.down();let u=Ft(a.el,null,o);i.trigger(document,"mousemove",u),n.move&&n.move(),s!=null?s(()=>{i.trigger(document,"mouseup",u),n.up&&n.up(l)}):(i.trigger(document,"mouseup",u),n.up&&n.up(l))}else throw`Cannot resolve drag element ${t}`}function ob(i,r,e,t,n){n=n||{},r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let o=i,s=Ft(r);o.trigger(r,bo,s),n.afterDown&&n.afterDown();let a=r.getBoundingClientRect(),l=sr(e+a.width/2,t+a.height/2);o.trigger(document,en,l),n.afterMove&&n.afterMove(),o.trigger(document,le,l),n.afterUp&&n.afterUp()}function sb(i,r,e,t,n,o){r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let s=i.jsplumb?i.jsplumb:i,a=Ft(r,o);s.trigger(r,bo,a),n&&n.afterDown&&n.afterDown(),s.trigger(document,en,qR(a,e,t,o)),n&&n.afterMove&&n.afterMove(),s.trigger(document,xn,null),n&&n.afterUp&&n.afterUp()}function oL(i,r,e,t,n,o,s){let a=i;r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild),n=n||3;let l=e/n,h=t/n,d=l,u=h,p=Ft(r,s);a.trigger(r,bo,p),o&&o.afterDown&&o.afterDown();for(let g=0;g<n;g++)a.trigger(document,en,qR(p,d,u,s)),o&&o.afterMove&&o.afterMove(g),d+=l,u+=h;a.trigger(document,xn),o&&o.afterUp&&o.afterUp()}var A1=typeof document!="undefined",Gm=A1?"ontouchstart"in document.documentElement:!1,bo=Gm?"touchstart":"mousedown",en=Gm?"touchmove":"mousemove",xn=Gm?"touchend":"mouseup";function sr(i,r,e){return Object.assign({clientX:i,clientY:r,screenX:i,screenY:r,pageX:i,pageY:r},e||{})}function sL(i,r,e){return i.clientX+=r,i.clientY+=e,i.screenX+=r,i.screenY+=e,i.pageX+=r,i.pageY+=e,i}function aL(i,r,e,t,n,o,s){let l=i.vertexLayer.parentElement.parentElement;n!=null&&(l=i.getRenderedElement(n)),ab(i,l,r,e,t,o,s)}function ab(i,r,e,t,n,o,s){n&&n.start&&n.start();let a=i.toPageLocation(e.x,e.y),l=i.toPageLocation(t.x,t.y);a.x-=window.scrollX,l.x-=window.scrollX,a.y-=window.scrollY,l.y-=window.scrollY,Vm(i,r,bo,a,o),n&&n.down&&n.down(),Vm(i,document,en,l,o),n&&n.move&&n.move(),s?s(()=>{Vm(i,document,xn,l,o),n&&n.up&&n.up()}):(Vm(i,document,xn,l,o),n&&n.up&&n.up())}var Ci={addDiv:Nm,addDivs:qV,cleanup:e1,delta:t1,DOWN_EVENT:bo,UP_EVENT:xn,MOVE_EVENT:en,isTouchDevice:Gm,makeEvent:Ft,makeEventAt:sr,nudgeEvent:sL,getEdgeCanvas:xo,defaultEventManager:new xe,dragElementBy:(i,r,e,t)=>{sb(Ci.defaultEventManager,i,r,e,t)},attachToSurface:i=>new $m(i.model,i),create:(i,r,e,t)=>{let n=n1(i,r,e,t);return new $m(n.model,n.surface)},trigger:(i,r,e,t,n)=>{i.trigger(r,e,{pageX:t,pageY:n,screenX:t,screenY:n,clientX:t,clientY:n})},getTransform:i=>{let r=parseFloat(i.style.transform.match(/translateX\(([0-9\.]+)px/)[1]),e=parseFloat(i.style.transform.match(/translateY\(([0-9\.]+)px/)[1]),t=parseFloat(i.style.transform.match(/scale\(([0-9\.]+)/)[1]);return{translateX:r,translateY:e,scale:t}},lasso:aL,lassoOnElement:ab,withinTolerance:(i,r,e)=>Math.abs(i-r)<=e};typeof window!="undefined"&&(window.VisuallyJsTestSupport=Ci);function lL(i,r,e,t,n,o){let s=i.getEffectiveVisibleZoom();o=o||{};let a=e.getBoundingClientRect(),l=sr(a.x+a.width+s*t,a.y+a.height+s*n),h=i.model.getAllEdges().length;o.start&&o.start(),wr(i,r),o.down&&o.down(),i.trigger(document,en,l),o.move&&o.move(),i.trigger(document,xn,l),o.up&&o.up();let d=i.model.getAllEdges()[h];return d?i.getRenderedConnection(d.id):null}var $m=class{constructor(r,e){this.model=r;c(this,"eventManager");c(this,"surface");c(this,"undoManager");c(this,"Tc");c(this,"consoleOutput","");this.eventManager=new xe,this.surface=e}get container(){return this.surface!=null?this.surface.getContainer():null}get canvas(){return this.surface!=null?this.surface.$getCanvasElement():null}get edgePathEditor(){return this.Tc==null&&(this.Tc=new Ma(this.surface)),this.Tc}destroy(){this.surface.destroy()}startEditing(r,e){this.edgePathEditor.startEditing(r,e)}stopEditing(){this.edgePathEditor.stopEditing()}render(r,e){let t=tL(this.model,r,e);return this.surface=t.surface,this.surface}querySelectorAll(r){return this.container.querySelectorAll(r)}querySelector(r){return this.container.querySelector(r)}dragANodeAround(r,e){QR(this.surface,this.surface.getObjectInfo(r,!1).el,e)}dragAnElementAround(r){QR(this.surface,r)}load(r){return this.model.load(r)}getEdgeCanvas(r){let e=this.surface.getRenderedConnection(r.id);return xo(e)}withConsole(r){let e=console.log;console.log=function(t){this.consoleOutput=t}.bind(this);try{r()}catch(t){e("An exception was thrown while running a function with the console log captured",t)}console.log=e}clear(){return this.model.clear()}getRenderedElement(r){return this.surface.getObjectInfo(r,!1).el}getRenderedConnection(r){return this.surface.getRenderedConnection(r)}dragVertexIntoGroup(r,e){let t=this.surface.getObjectInfo(r,!1),n=this.surface.getObjectInfo(e,!1);if(t.el&&n.el){let o=this.surface.$getGroupContentAreaElement(n.el).getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x+o.width/2-s.width/2,l=o.y+o.height/2-s.height/2;ob(this.surface,t.el,a,l)}}dragVertexOutOfGroup(r,e){let t=this.surface.getObjectInfo(r,!1);if(t.el&&t.managedElement.modelObject.group!=null){let n=this.surface.getObjectInfo(t.managedElement.modelObject.group,!1);if(n.el){let o=n.el.getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x-50-s.width,l=o.y-50-s.height;ob(this.surface,t.el,a,l)}}}getGroup(r){return this.getModelObject(r)}getNode(r){return this.getModelObject(r)}getModelObject(r){return this.surface.getObjectInfo(r,!1).obj}dragVertexTo(r,e,t,n){let o=this.surface.toPageLocation(e,t);this.dragVertexToPageLocation(r,o.x,o.y,n)}dragVertexToPageLocation(r,e,t,n){let o=this.surface.getObjectInfo(r,!1);if(o.el)ob(this.surface,o.el,e,t,n);else throw new Error("Cannot drag node: cannot resolve "+r)}dragVertexBy(r,e,t,n,o){let s=this.surface.panZoom.getCompoundZoom();this.dragVertexByPageDelta(r,e*s,t*s,n,o)}dragVertexByPageDelta(r,e,t,n,o){let s=this.surface.getObjectInfo(r,!1);if(s.el)sb(this.surface,s.el,e,t,n,o);else throw new Error("Cannot drag vertex: cannot resolve "+r)}dragElementBy(r,e,t,n,o){sb(this.surface,r,e,t,n,o)}dragElementByInStages(r,e,t,n,o,s){oL(this.surface,r,e,t,n,o,s)}dragVertexByInStages(r,e,t,n,o,s){let a=this.surface.getObjectInfo(r,!1);if(a.el)oL(this.surface,a.el,e,t,n,o,s);else throw new Error("Cannot drag vertex: cannot resolve "+r)}connect(r,e,t,n){let o=this.surface.getObjectInfo(r,!1),s=this.surface.getObjectInfo(e,!1);return this.model.$_addEdge({source:o.obj,target:s.obj,data:t||{}},n||Ro,null)}ti(r){let e;if(KC(r))e=r;else{let t=Array.isArray(r)?r[0]:r;e=this.surface.getRenderedElement(t),Array.isArray(r)&&(e=e.querySelector(r[1]))}return e}Mg(r,e){return{sourceEl:this.ti(r),targetEl:this.ti(e)}}dragConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.Mg(r,e);return ib(this.surface,s,a,t,n,o)}dragAndAbortConnection(r){b1(this.surface,this.ti(r))}dragSnapConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.Mg(r,e);return lL(this.surface,s,a,t,n,o)}dragDetachedConnection(r,e,t){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let n=this.ti(r);return ib(this.surface,n,e,t)}dragDiagramConnection(r,e,t){this.surface.model.setSelection(r);let n=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),o=this.ti(e);return ib(this.surface,n,o,t,null)}dragDiagramSnapConnection(r,e,t,n,o){this.surface.model.setSelection(r);let s=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),a=this.ti(e);return lL(this.surface,s,a,t,n,o)}detachEdge(r,e){return this.detachEdgeBySource(r,e)}detachEdgeBySource(r,e){return eL(this.surface,r,!0,e)}detachEdgeByTarget(r,e){return eL(this.surface,r,!1,e)}relocateEdgeTarget(r,e,t,n,o){iL(this.surface,r,!1,e,t,n,o)}relocateEdgeSource(r,e,t,n,o){iL(this.surface,r,!0,e,t,n,o)}trigger(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el)t=t||Ft(n.el),this.surface.trigger(n.el,e,t);else throw new Error("Trigger: Cannot resolve "+r)}triggerEventOnElement(r,e,t,n,o){this.triggerEvent(r,e,t,n,o)}triggerEvent(r,e,t,n,o){let s=n!=null&&o!=null?rb(r,n,o,t):Ft(r,t);this.surface.trigger(r,e,s)}triggerEventAt(r,e,t,n,o){let s=rb(r,t,n,o);this.surface.trigger(r,e,s)}makeEvent(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el){let o=Ft(n.el);return e||t?sL(o,e==null?0:e,t==null?0:t):o}else throw new Error("Trigger: Cannot resolve "+r)}makeEventAt(r,e){return sr(r,e)}getEdge(r){return this.model.getEdge(r)}updateEdge(r,e){this.model.updateEdge(r,e)}getAllEdges(){return this.model.getAllEdges()}getRenderedPort(r){return this.surface.getRenderedPort(r)}addNode(r){return this.model.addNode(r)}updateNode(r,e){return this.model.updateNode(r,e)}addGroup(r){return this.model.addGroup(r)}updateGroup(r,e){this.model.updateGroup(r,e)}updateVertex(r,e){this.model.updateVertex(r,e)}clickOnGroup(r){nb(this,r)}clickOnNode(r){nb(this,r)}clickOnVertex(r){nb(this,r)}dblClickOnVertex(r){u1(this,r)}rightClickOnVertex(r){d1(this,r)}tapOnVertex(r){Ac(this,r)}tapOnNode(r){Ac(this,r)}tapOnGroup(r){Ac(this,r)}dblTapOnVertex(r){Ac(this,r),Ac(this,r)}dblTapOnNode(r){this.dblTapOnVertex(r)}dblTapOnGroup(r){this.dblTapOnVertex(r)}mousemoveOnVertex(r,e){l1(this,r,e)}mouseoverOnVertex(r,e){h1(this,r,e)}mouseoutOnVertex(r,e){c1(this,r,e)}contextmenuOnVertex(r,e){Mm(this,r,At,3,e)}clickOnCanvas(r=1,e=1){for(let t=0;t<r;t++)wr(this.surface,this.canvas,e),Ka(this.surface,this.canvas,e)}clickOnCanvasAt(r,e,t=1){wr(this.surface,this.canvas,t,{x:r,y:e}),Ka(this.surface,this.canvas,t,{x:r,y:e})}mousemoveOnCanvasAt(r,e){qa(this.surface,this.canvas,en,1,{x:r,y:e})}mousedownOnCanvasAt(r,e){qa(this.surface,this.canvas.parentNode,bo,1,{x:r,y:e})}mouseupOnCanvasAt(r,e){qa(this.surface,this.canvas,xn,1,{x:r,y:e})}lasso(r,e,t){aL(this.surface,r,e,t)}lassoOnElement(r,e,t,n){ab(this.surface,r,e,t,n)}rightClickOnCanvas(r=1){this.clickOnCanvas(r,2)}clickOnElement(r){g1(this,r)}clickOnElementInsideVertex(r,e){p1(this,r,e)}dblClickOnElementInsideVertex(r,e){m1(this,r,e)}tapOnElement(r){nL(this,r)}tapOnElementInsideVertex(r,e){E1(this,r,e)}dblTapOnElementInsideVertex(r,e){f1(this,r,e)}mousedownOnElement(r){wr(this.surface,r)}clickOnEdge(r){i1(this,r)}dblClickOnEdge(r){o1(this,r)}tapOnEdge(r){let e=rt(r)?r.id:r;s1(this,e)}dblTapOnEdge(r){let e=rt(r)?r.id:r;a1(this,e)}Gg(r,e,t,n){n=n||{};let o=n.events||{},s=n.zoom==null?1:n.zoom,a=n.x||90,l=n.y||90,h=r.source.querySelector(e),d=n.targetElement||this.surface.getContainer();var u=h.getBoundingClientRect(),p=d.getBoundingClientRect(),g=p.x,m=p.y,E=u.x+u.width/2,y=u.y+u.height/2,x=(g+13)*s,f=(m+13)*s,b=g+a*s+u.width/2,A=m+l*s+u.height/2;o.beforeDown&&o.beforeDown();let T=sr(E,y);this.surface.trigger(h,Ci.DOWN_EVENT,T),t&&this.surface.trigger(h,Ci.UP_EVENT,T),o.beforeMove&&o.beforeMove(),this.surface.trigger(d,Ci.MOVE_EVENT,sr(x,f));let S=sr(b,A);if(this.surface.trigger(d,Ci.MOVE_EVENT,S),o.beforeUp&&o.beforeUp(),t){let O=document.querySelector(".vjs-palette-tap-mode-placeholder");this.surface.trigger(O,Ci.DOWN_EVENT,S),this.surface.trigger(O,Ci.UP_EVENT,S)}else this.surface.trigger(d,Ci.UP_EVENT,S);o.after&&o.after()}dragFromPalette(r,e,t){this.Gg(r,e,!1,t)}tapFromPalette(r,e,t){this.Gg(r,e,!0,t)}mousedownOnEdge(r){bc(this,r,ge)}mouseupOnEdge(r){bc(this,r,le)}mouseoverOnEdge(r){bc(this,r,st)}mouseoutOnEdge(r){bc(this,r,ot)}contextmenuOnEdge(r){bc(this,r,At)}clickOnOverlay(r,e){y1(this,r,e)}clickOnPort(r,e){x1(this,r,e)}getEdgeCount(){return this.model.getEdgeCount()}dragElementToCanvas(r,e,t){e=e||250,t=t||250;let n=this.surface.panZoom.getApparentCanvasLocation(),o=this.surface.getContainer().parentNode.getBoundingClientRect(),s=o.x+n.x,a=o.y+n.y,l=Ft(r);this.eventManager.trigger(r,bo,l);let h=this.surface.$getSize(r),d=this.surface.getContainer().parentNode,u=r.getBoundingClientRect();this.eventManager.trigger(d,en,sr(u.x+1,u.y+1)),this.eventManager.trigger(d,en,sr(e+s+h.width/2,t+a+h.height/2)),this.eventManager.trigger(d,xn,sr(e+s+h.width/2,t+a+h.height/2))}addMiniview(r){let e=r||{},t=Nm("div");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=(e.width?e.width:250)+"px",t.style.height=(e.height?e.height:250)+"px",e.container=t,this.surface.addPlugin({type:"miniview",options:e})}getDOMPosition(r){let e=this.surface.getRenderedElement(r);return{x:parseInt(e.style.left,10),y:parseInt(e.style.top,10)}}isAtPosition(r,e,t){let n=this.surface.getRenderedElement(r),o={x:parseInt(n.style.left,10),y:parseInt(n.style.top,10)};return e===o.x&&t===o.y}attachAnimator(){return new bm(this.surface)}within(r,e,t,n){t(Math.abs(r-e)<JV,n+"[expected: "+e+" got "+r+"] [diff:"+Math.abs(r-e)+"]")}};var hL="vjs-chart-background",Qa="vjs-chart-plot-background",Sc="vjs-chart-body",cL="vjs-chart-series",dL="vjs-chart-legend",Bm="vjs-chart-legend-item",uL="vjs-chart-legend-label",pL="vjs-chart-legend-dot",el="vjs-chart-axis",Fm="vjs-chart-x-axis",Um="vjs-chart-y-axis",lb="vjs-chart-axis-labels",hb="vjs-chart-axis-line",cb="vjs-chart-axis-title",gL="vjs-chart-y-axis-title",mL="vjs-chart-x-axis-title",EL="vjs-column-chart",fL="vjs-column-chart-column",yL="vjs-bar-chart",xL="vjs-bar-chart-bar",bn="vjs-chart-point",Ym="vjs-chart-point-hit-area",bL="vjs-bubble-chart",AL="vjs-bubble-chart-point",SL="vjs-scatter-chart",TL="vjs-scatter-chart-point",zm="vjs-area-chart-area",vL="vjs-chart-title",CL="vjs-chart-subtitle",Tc="vjs-chart-crosshair",vc="vjs-chart-crosshair-label",PL="vjs-chart-crosshair-value-axis",_L="vjs-chart-crosshair-category-axis",db="vjs-chart-empty",OL="vjs-chart-axis-scale-label",ub="vjs-chart-gridlines",pb="vjs-chart-gridline",RL="vjs-line-chart",LL="vjs-area-chart";var S1=6;function gb(i,r,e,t,n){let o=(Math.floor(Math.abs(r)/e)*e+e)*Math.sign(r),s=i===0?0:(Math.floor(Math.abs(i)/e)*e+e)*Math.sign(i);o<r&&(o+=e),s>i&&(s-=e),n!=null&&o>n&&(o=n),t!=null&&s<t&&(s=t);let a=(o-s)/e;return{maxScale:o,minScale:s,stepCount:a,step:e}}function T1(i){return Math.log10(i)%1===0||i.toExponential().split("e")[0]==="5"?i*2:i*2.5}function v1(i){return Math.log10(i)%1===0?i/2:i.toExponential().split("e")[0]==="5"?i/2.5:i/2}function C1(i,r,e,t,n,o){let s=gb(i,r,e,n,o),a=s.stepCount-t,l=Math.abs(a);if(a>0){let d=T1(s.step),u=gb(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}else if(a<0){let d=v1(s.step),u=gb(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}let h=[];for(let d=s.minScale;d<=s.maxScale;d+=s.step)h.push(d);return Object.assign(s,{steps:h,range:s.maxScale-s.minScale,dataMin:i,dataMax:r})}function Cc(i,r,e=S1,t,n){let o=r-i,s=P1(o);return C1(i,r,s,e,t,n)}function DL(i,r,e){let t=[],n=r-i,o=n/e;for(let s=i;s<=r;s+=o)t.push(s);return{dataMin:i,dataMax:r,range:n,steps:t,step:o,stepCount:e,minScale:i,maxScale:r}}function Pc(i,r,e){let t=[];for(let n=i;n<=r;n+=e)t.push(n);return{dataMin:i,dataMax:r,range:r-i,steps:t,step:e,stepCount:t.length-1,minScale:i,maxScale:t[t.length-1]}}function P1(i){return Math.pow(10,parseInt(i.toExponential().split("e")[1],10))}function Pi(i,r,e,t,n){return{size:(n==null?void 0:n.size)||i,style:(n==null?void 0:n.style)||r,weight:(n==null?void 0:n.weight)||e,family:(n==null?void 0:n.family)||t}}function k(i,r,e,t){let n=V(i,r||{});return e&&L(n,e),t&&t.appendChild(n),n}function Os(i,r,e,t){let n=k(et,r,e,t);return n.innerHTML=i,n}function _Ze(i,r){let e=_h(i);jt(i,r,e.y)}function _c(i,r){let e=_h(i);jt(i,e.x,r)}function jt(i,r,e){i.setAttribute("transform",`translate(${r}, ${e})`)}function An(i){return i.type==="value"}function NL(i){return i.type==="category"}function Oc(){return{x:0,y:0,width:0,height:0}}function mb(i,r){return r==null||r==="int"?Math.round(i).toString():typeof r=="number"?i.toFixed(r):i.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2})}function IL(i,r,e,t){let n=()=>{if(i.length===0)return!1;let s=i[0].getBBox();for(let a=1;a<i.length;a++){let l=i[a].getBBox();if(tt(s,l))return!0;s=l}},o=s=>{i.forEach(a=>{a.setAttribute("text-anchor","end"),a.setAttribute("dominant-baseline","middle");let l=a.getBBox(),h={x:l.x+l.width,y:l.y-l.height};a.setAttribute("transform",`rotate(${s}, ${h.x}, ${h.y})`);let d=a.getBBox();if(d[t]>r){let u=r/d[t];a.textContent=a.textContent.substring(0,Math.floor(u*a.textContent.length))+"..."}})};if(n())return o(-45),!0}function wL(i){return`color(from color(from ${i} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1)) srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`}function Xm(i,r,e,t,n,o){let s=V(et,{x:r,y:e,"text-anchor":"middle","dominant-baseline":"central","font-size":n.size||"0.7rem","font-weight":n.weight||"bold","font-style":n.style||"normal"},{fill:`color(from ${t} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`},"vjs-text-outline");o&&o.appendChild(s);let a=V("tspan",{fill:wL(t),stroke:wL(t),"stroke-width":2,"stroke-linejoin":"round"},{});a.innerHTML=i;let l=V("tspan",{x:`${r}`,dy:"0"});return l.innerHTML="&ZeroWidthSpace;",a.appendChild(l),s.appendChild(a),s.insertAdjacentText("beforeend",i),s}function Eb(i,r,e){let t=i.container.querySelector("svg"),n=window.getComputedStyle(t),o=Array.from(t.querySelectorAll(".vjs-text-outline"));o.forEach(E=>{let y=window.getComputedStyle(E),x=E.querySelector("tspan"),f=window.getComputedStyle(x);E.setAttribute("data-vjs-export-fill",y.fill),E.setAttribute("data-vjs-export-stroke",y.stroke),x.setAttribute("data-vjs-export-fill",f.fill),x.setAttribute("data-vjs-export-stroke",f.stroke)});let s=t.cloneNode(!0),a=s.getAttribute("viewBox"),l;if(a){let E=a.split(" ").map(y=>parseFloat(y));l={x:E[0],y:E[1],width:E[2],height:E[3]}}else l={x:0,y:0,width:parseFloat(s.getAttribute("width")||"0"),height:parseFloat(s.getAttribute("height")||"0")};Array.from(s.attributes).forEach(E=>s.removeAttribute(E.name)),s.setAttribute("xmlns",Gt),s.removeAttribute("class"),s.setAttribute("font-family",n.fontFamily||"sans-serif"),s.setAttribute("font-size",n.fontSize||"12"),r&&s.setAttribute("width",`${r}`),e&&s.setAttribute("height",`${e}`),_1(s,i.dim.viewBox||{x:0,y:0,width:i.dim.width,height:i.dim.height}),s.querySelectorAll(`.${Tc}, .${vc}`).forEach(E=>E.parentNode.removeChild(E));let d=s.querySelector("filter#vjs-tooltip-shadow");if(d){let E=d.parentElement;E.removeChild(d),E.tagName.toLowerCase()==="defs"&&E.children.length===0&&E.parentElement.removeChild(E)}Array.from(s.querySelectorAll(".vjs-text-outline")).forEach(E=>{let y=E.querySelector("tspan");E.setAttribute("fill",E.getAttribute("data-vjs-export-fill")),E.setAttribute("stroke",E.getAttribute("data-vjs-export-stroke")),y.setAttribute("fill",y.getAttribute("data-vjs-export-fill")),y.setAttribute("stroke",y.getAttribute("data-vjs-export-stroke"))}),o.forEach(E=>{E.removeAttribute("data-vjs-export-fill"),E.removeAttribute("data-vjs-export-stroke");let y=E.querySelector("tspan");y.removeAttribute("data-vjs-export-fill"),y.removeAttribute("data-vjs-export-stroke")});let p=Array.from(s.querySelectorAll("*")),g=E=>{Array.from(E.attributes).forEach(x=>{x.name.indexOf("data-vjs-")===0&&E.removeAttribute(x.name)}),E.removeAttribute("class"),E.removeAttribute("style"),E.removeAttribute("pointer-events")};return p.forEach(g),Array.from(s.querySelectorAll("g")).forEach(E=>{E.children.length===0&&E.parentNode.removeChild(E)}),{element:s,extents:l,svg:s.outerHTML.replace(/\n/g,"")}}function _1(i,r){i.setAttribute("viewBox",`${r.x}, ${r.y} ${r.width} ${r.height}`)}var wZe="vertical",fb="horizontal",O1=10,yb="left",xb="center",ML="right",Rc="top",Lc="middle",bb="bottom",jm=class{constructor(r){c(this,"floating");c(this,"visible");c(this,"hover");c(this,"padding");c(this,"orientation");c(this,"align");c(this,"valign");c(this,"font");c(this,"$hideForSingleSeries");r=r||{},this.floating=r.floating===!0,this.visible=r.hide!==!0,this.hover=r.hover!==!1,this.padding=r.padding||O1,this.orientation=r.orientation||fb,this.align=r.align||xb,this.valign=r.valign||bb,this.$hideForSingleSeries=r.hideForSingleSeries!==!1,this.font=Pi(12,"normal","normal","sans-serif",r.font)}};var Hm="chart:load",VL="No data",GL="Could not draw chart";var $L="vjs-chart-exporter-hamburger",R1="vjs-chart-exporter-menu",L1="vjs-chart-exporter-menu-item",BL="vjs-chart-exporter-hamburger-open",km=class{constructor(r,e={}){this.chart=r;this.options=e;c(this,"hamburger");c(this,"menu");c(this,"eventManager");c(this,"hideTimeout");c(this,"Co",!1);this.eventManager=new xe,this.eventManager.on(r.container,W,z($L),t=>{t.stopPropagation(),this.Co?this.vc():this.gA()})}EA(r){let e=this.chart.container;getComputedStyle(e).position==="static"&&(e.style.position="relative"),this.hamburger=Kr("div",{width:"30px",height:"30px",cursor:"pointer",display:"flex",flexDirection:"column",justifyContent:"space-around",padding:"5px",boxSizing:"border-box",background:"rgba(255,255,255,0.8)",borderRadius:"4px"},$L),r==null&&(this.hamburger.style.position="absolute",this.hamburger.style.right=this.options.right||"1rem",this.hamburger.style.top=this.options.top||"1rem",this.hamburger.style.zIndex="100");for(let s=0;s<3;s++){let a=Kr("div",{width:"100%",height:"2px",backgroundColor:"#333"});this.hamburger.appendChild(a)}this.menu=Kr("div",{position:"absolute",display:"none",backgroundColor:"white",border:"1px solid #ccc",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",zIndex:"101",minWidth:"120px",borderRadius:"4px",padding:"5px 0"},R1),[{label:"Download JPG",type:fs},{label:"Download PNG",type:ec},{label:"Download SVG",type:"svg"}].forEach(s=>{let a=Kr("div",{padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#333"},L1);a.innerText=s.label,this.eventManager.on(a,Xe,()=>{this.fA(s.type),this.vc()}),this.eventManager.on(a,"mouseenter",()=>{a.style.backgroundColor="#f0f0f0"}),this.eventManager.on(a,"mouseleave",()=>{a.style.backgroundColor="transparent"}),this.menu.appendChild(a)}),r!=null?r.appendChild(this.hamburger):e.appendChild(this.hamburger),e.appendChild(this.menu);let n=()=>{this.Co&&this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)},o=()=>{this.Co&&(n(),this.hideTimeout=setTimeout(()=>{this.vc(),this.hideTimeout=null},500))};this.eventManager.on(this.hamburger,"mouseenter",()=>{n()}),this.eventManager.on(this.hamburger,"mouseleave",()=>{o()}),this.eventManager.on(this.menu,"mouseenter",()=>{n()}),this.eventManager.on(this.menu,"mouseleave",()=>{o()})}gA(){this.menu.style.display="block",this.Co=!0,L(this.hamburger,BL);let r=this.chart.container.getBoundingClientRect(),e=this.hamburger.getBoundingClientRect(),t=e.left-r.left+e.width-this.menu.offsetWidth,n=e.top-r.top+e.height+5;t<0&&(t=0),t+this.menu.offsetWidth>r.width&&(t=r.width-this.menu.offsetWidth),n+this.menu.offsetHeight>r.height&&(n=e.top-r.top-this.menu.offsetHeight-5,n<0&&(n=Math.max(0,r.height-this.menu.offsetHeight))),this.menu.style.left=`${t}px`,this.menu.style.top=`${n}px`}vc(){this.menu.style.display="none",this.Co=!1,F(this.hamburger,BL)}fA(r,e){if(e==null&&(e=(this.chart.getTitle()||"chart-export").toString().toLowerCase().replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").substring(0,30)),r==="svg"){let t=this.chart.exportSVG(),n=new Blob([t],{type:Ua.svg});this.$g(n,`${e}.svg`)}else{let t=r===fs?Ua.jpeg:Ua.png;this.chart.exportImage({type:t,width:1200},n=>{let o=r===fs?"jpg":"png";this.$g(n.url,`${e}.${o}`,!0)})}}$g(r,e,t=!1){let n=document.createElement("a");n.download=e,t?n.href=r:n.href=URL.createObjectURL(r),document.body.appendChild(n),n.click(),document.body.removeChild(n),t||URL.revokeObjectURL(n.href)}destroy(){this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.hamburger.parentElement&&this.hamburger.parentElement.removeChild(this.hamburger),this.menu.parentElement&&this.menu.parentElement.removeChild(this.menu)}};var w1="0 0 32 30",D1="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",FL="0 0 32 32",N1="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",I1="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",M1="vjs-chart-zoom-controls",V1="vjs-chart-zoom-button",Wm=class{constructor(r){this.chart=r;c(this,"container");c(this,"eventManager");this.eventManager=new xe}render(r,e){let t=this.chart.container;getComputedStyle(t).position==="static"&&(t.style.position="relative"),e=e||"row",this.container=Kr("div",{display:"flex",flexDirection:e},M1),r==null&&(this.container.style.position="absolute",this.container.style.left="1rem",this.container.style.top="1rem",this.container.style.zIndex="100"),[{title:"Zoom In",path:N1,viewBox:FL,onClick:()=>this.chart.setZoom(this.chart.getZoom()+.1)},{title:"Zoom Out",path:I1,viewBox:FL,onClick:()=>this.chart.setZoom(this.chart.getZoom()-.1)},{title:"Zoom to Extents",path:D1,viewBox:w1,onClick:()=>{this.chart.setZoom(1),this.chart.container.scrollLeft=0,this.chart.container.scrollTop=0}}].forEach(o=>{let s=Kr("div",{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"3px",boxSizing:"border-box"},V1);s.title=o.title,s.innerHTML=`<svg viewBox="${o.viewBox}" width="100%" height="100%" stroke="currentColor" fill="currentColor">
135
135
  <path d="${o.path}" ${o.title!=="Zoom to Extents"?'fill="none" stroke-width="2"':""}/>
136
- </svg>`,this.eventManager.on(s,ze,a=>{a.stopPropagation(),o.onClick()}),this.eventManager.on(s,"mouseenter",()=>{s.style.backgroundColor="#f0f0f0"}),this.eventManager.on(s,"mouseleave",()=>{s.style.backgroundColor="transparent"}),this.container.appendChild(s)}),r!=null?r.appendChild(this.container):t.appendChild(this.container)}destroy(){this.container&&this.container.parentElement&&this.container.parentElement.removeChild(this.container)}};var C1="#FFFFFF",P1="#000000",O1=15,_1=15,cZe="middle",dZe="left",uZe="right",R1="top",_c="bottom",Qa="middle",L0="start",w0="end",R0="#AAAAAA",L1=1,w1="#FFFFFFCC";function D1(i){i=i||{};let r=i.backgroundColor||C1;return{gridLineColor:i.gridLineColor||R0,legendOutlineColor:i.legendOutlineColor||i.gridLineColor||R0,legendOutlineWidth:i.legendOutlineWidth||L1,legendBackgroundColor:i.legendBackgroundColor||w1,backgroundColor:r,plotBackgroundColor:i.plotBackgroundColor||r,labelColor:i.labelColor||P1,labelColorGenerator:i.labelColorGenerator}}var bo=class extends zt{constructor(e,t){var s,a,l,h;super();this.container=e;c(this,"style");c(this,"dim");c(this,"J",1);c(this,"Ec",[.5,3]);c(this,"Tg",!1);c(this,"$resizeObserver");c(this,"$eventManager");c(this,"colorGenerator");c(this,"$defaultColor");c(this,"$emptyMessage");c(this,"$errorMessage");c(this,"$showTitle");c(this,"$title");c(this,"$showSubtitle");c(this,"$subtitle");c(this,"$titleAlign");c(this,"$subtitleAlign");c(this,"$subtitleFontSize");c(this,"$titlePlacement");c(this,"$titleFillRatio");c(this,"$titleWrap");c(this,"$titleFontSize");c(this,"titlePadding");c(this,"margin");c(this,"legend");c(this,"fc");c(this,"yc");c(this,"vg",!1);c(this,"la");c(this,"ei");c(this,"vt");t=t||{},this.fc=t.width,this.yc=t.height,this.$defaultColor=t.defaultColor,this.colorGenerator=this.$defaultColor==null?t.colorGenerator||new Fs:new Pd(this.$defaultColor),this.style=D1(t.style);let n=(s=t.controls)==null?void 0:s.exporter;if(n!=null&&n!==!1){let d=cr(n)?n:{};this.la=new Ug(this,d)}if(this.dim={chartX:0,chartY:0,chartWidth:0,chartHeight:0,width:0,height:0,chartEndX:0,chartEndY:0},this.$emptyMessage=t.emptyMessage||v0,this.$errorMessage=C0,t.resizeObserver!==!1)try{this.$resizeObserver=new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.vg&&this.$draw()})}),this.$resizeObserver.observe(e)}catch(d){U("WARN: ResizeObserver could not be attached.")}this.margin=t.margin||_1,this.$eventManager=new xe,t.title&&t.title.text!=null?(this.$showTitle=!0,this.$title=t.title.text||"",this.$titleAlign=t.title.align||"middle",this.$titleWrap=t.title.wrap!==!1,this.$titleFillRatio=t.title.fillRatio||.9,this.$titleFontSize=((a=t.title.font)==null?void 0:a.size)||20,this.$titlePlacement=t.title.placement||R1):this.$showTitle=!1,t.subtitle&&t.subtitle.text!=null?(this.$showSubtitle=!0,this.$subtitle=t.subtitle.text||"",this.$subtitleAlign=t.subtitle.align||"middle",this.$subtitleFontSize=((l=t.subtitle.font)==null?void 0:l.size)||16):this.$showSubtitle=!1,this.titlePadding=t.titlePadding||O1;let o=t.legend==null||t.legend===!0?{}:t.legend===!1?{hide:!0}:t.legend;this.legend=new Bg(o),t.zoom&&t.zoom.enabled!==!1&&(this.Tg=!0,this.Ec=t.zoom.range||[.05,3],this.J=t.zoom.initialValue||1,this.container.style.overflow="auto",((h=t.controls)==null?void 0:h.zoom)!==!1&&(this.ei=new Yg(this)))}$bind(e,t,n){this.$eventManager.on(this.container,e,t,n)}getTitle(){return this.$title}exportSVG(e,t){return ub(this,e,t).svg}exportImage(e,t){let n=ub(this,e.width,e.height);rx(n,e,t)}destroy(){this.$resizeObserver&&(this.$resizeObserver.unobserve(this.container),this.$resizeObserver.disconnect()),this.container.innerHTML="",this.ei&&this.ei.destroy(),this.vt&&this.vt.parentElement&&this.vt.parentElement.removeChild(this.vt)}$draw(){this.vg=!0,this.container.innerHTML="";let e=this.fc,t=this.yc;if(e==null||t==null){let n=window.getComputedStyle(this.container);e=e||parseInt(n.width,10),t=t||parseInt(n.height,10)}if(!isNaN(e)&&!isNaN(t)){let n=G(Le,{height:t,width:e,viewBox:`0 0 ${e} ${t}`});this.container.appendChild(n);let o=k(Z,{x:0,y:0,width:e,height:t,"aria-hidden":!0,fill:this.$getBackgroundColor(),"data-z-index":"0"},KR,n);try{this.$drawChart(n,e,t,o)}catch(a){this.$drawErrorMessage(n,e,t,o)}this.hasData()||this.$drawEmptyMessage(n,e,t,o);let s=Array.from(n.childNodes);s.sort((a,l)=>{let h=a.getAttribute("data-z-index")||0,d=l.getAttribute("data-z-index")||0;return h>d?1:h<d?-1:0}),s.forEach(a=>{n.insertBefore(a,n.childNodes[n.childNodes.length])}),Yx(n,!0),this.jb()}}jb(){if(this.la||this.ei){let e="row";this.vt==null?this.vt=Jr("div",{position:"absolute",right:"1rem",top:"1rem",display:"flex",flexDirection:e,alignItems:"flex-end",zIndex:"100",background:"rgba(255,255,255,0.8)",borderRadius:"4px",padding:"2px",border:"1px solid #ccc"},"vjs-chart-controls-group"):this.vt.innerHTML="",getComputedStyle(this.container).position==="static"&&(this.container.style.position="relative"),this.container.appendChild(this.vt),this.ei&&this.ei.render(this.vt,e),this.la&&this.la.Yb(this.vt)}}$drawEmptyMessage(e,t,n,o){let s=k(et,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},ab,e);s.innerHTML=this.$emptyMessage}$drawErrorMessage(e,t,n,o){let s=k(et,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},ab,e);s.innerHTML=this.$errorMessage}$precomputeTitle(e,t){let n=k(q,{},null,e);if(this.$showTitle&&(this.$title!=null||this.$subtitle!=null)){let o=k(et,{y:0,x:0,"font-size":this.$titleFontSize,"font-weight":"bold","dominant-baseline":"hanging"},u0,n);o.innerHTML=this.$title;let s=o.getBBox(),a=!1;if(s.width>t&&this.$titleWrap){let u=this.$titleFillRatio*t;o=Hp(o,this.$title,u),s=o.getBBox(),s.y<0&&o.setAttribute("y",`${-s.y}`),a=!0}let l=this.$titleAlign==="left"?this.margin:this.$titleAlign==="middle"?(t-s.width)/2:t-s.width-this.margin;if(jt(o,l,this.margin),a){let u=Array.from(o.querySelectorAll("tspan")),p=u.map(g=>g.getBBox().width),m=Math.max(...p);u.forEach((g,E)=>{g.setAttribute("x",`${(m-p[E])/2}`)})}if(this.$showSubtitle){let u=k(et,{y:s.height+10,x:0,"dominant-baseline":"hanging"},p0,n);u.innerHTML=this.$subtitle;let p=u.getBBox(),m=this.$subtitleAlign==="left"?this.margin:this.$subtitleAlign==="middle"?(t-p.width)/2:t-p.width-this.margin;jt(u,m,this.margin)}let h=n.getBBox().height,d=k(Z,{fill:"transparent",height:10,width:t,y:h,x:0},"",n);jt(d,0,this.margin)}else k(Z,{fill:"transparent",width:t,height:0},"",n),this.titlePadding=0;return n}$getBackgroundColor(){return this.style.backgroundColor}$getPlotBackgroundColor(){return this.style.plotBackgroundColor}$getLabelColor(){return this.style.labelColor}$fromPageLocation(e){let t=this.container.getBoundingClientRect(),n=e.x-window.scrollX-t.x,o=e.y-window.scrollY-t.y;return{x:n-this.dim.chartX,y:o-this.dim.chartY}}$fromEventLocation(e){let t=Ee(e);return this.$fromPageLocation(t)}getZoom(){return this.J}setZoom(e){return this.Tg&&(this.J=Math.max(this.Ec[0],Math.min(this.Ec[1],e)),this.Hb()),this.J}Hb(){let e=this.container.firstElementChild;e!=null&&(e.setAttribute("transform-origin","0 0"),e.setAttribute("transform",`scale(${this.J})`))}};var el=class{load(r){r()}hasData(){return!1}},Rc=class{constructor(r){this.chart=r;c(this,"data")}hasData(){return this.data!=null&&this.data.length>0}load(r){this.data.forEach(e=>{this.chart.$__series.forEach(t=>{t.addValue(e)})}),r()}},zg=class extends Rc{constructor(e,t){super(e);this.chart=e;this.data=t}},Xg=class extends Rc{constructor(e,t){super(e);this.chart=e;this.url=t}load(e){xa({url:this.url,dataType:Wt,success:t=>{this.data=t,super.load(e)}})}},Lc=class extends Rc{constructor(e,t,n){super(e);this.chart=e;this.dataSource=t;this.filter=n;this.filter=n||(s=>!0),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data));let o=ya(()=>{t.reload&&t.reload(),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data)),this.chart.reload()},150);t.bind(Re,o),t.bind(ve,o),t.bind(Kt,o),t.bind(Te,o),t.bind(_e,o),t.bind(Zt,o),t.bind(xt,o),t.bind(bt,o),t.bind(ur,o),t.bind(Jt,o)}$setFilter(e){this.filter=e||(t=>!0),this.data=this.dataSource.getNodes().filter(this.filter).map(function(t){return t.data})}};var Tr=class{};var rr=class extends Tr{constructor(e,t,n){super();c(this,"color");c(this,"min");c(this,"max");c(this,"total");c(this,"label");c(this,"id");c(this,"visible");c(this,"categories",[]);c(this,"values",[]);c(this,"valueField");c(this,"minValueField");c(this,"maxValueField");c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"Cg");c(this,"ee");this.id=e.id||e.valueField,this.label=e.label,this.valueField=e.valueField,this.minValueField=e.minValueField,this.maxValueField=e.maxValueField,this.color=t,this.visible=!0,this.marker=e.marker,this.markerType=e.markerType,this.markerSize=e.markerSize,this.Cg=n,this.ee=new Map,this.reset()}isRangeSeries(){return this.minValueField!=null&&this.maxValueField!=null}reset(){this.min=0,this.max=0,this.total=0,this.values.length=0,this.categories.length=0}toggleVisible(){this.visible=!this.visible}addValue(e){let t=e[this.Cg];t!=null&&Ns(this.ee,t,()=>[]).push(e);let n,o;if(this.maxValueField!=null&&this.minValueField!=null)o=e[this.maxValueField],n=e[this.minValueField];else{let s=e[this.valueField],a=0;o=s<a?a:s,n=s<a?s:a}this.values.push({min:n,max:o}),n!=null&&(this.min=Math.min(this.min,n)),o!=null&&(this.max=Math.max(this.max,o)),this.total+=o,this.categories.push(e)}getCategories(){return this.categories}expand(){return[this]}};c(rr,"type","record");var N1=1,I1="rangeStart",M1="values",V1="minValues",G1="maxValues",$1="label",B1="id",tl=class extends Tr{constructor(e,t){super();this.chart=t;c(this,"startPoint");c(this,"step");c(this,"rangeStartField");c(this,"$valuesField");c(this,"$minValuesField");c(this,"$maxValuesField");c(this,"$labelField");c(this,"$idField");c(this,"$labels");c(this,"$labelGenerator");c(this,"$series",[]);c(this,"values");this.startPoint=e.startPoint==null?0:e.startPoint,this.step=e.step==null?N1:e.step,this.rangeStartField=e.rangeStartField||I1,this.$valuesField=e.valuesField||M1,this.$minValuesField=e.minValuesField||V1,this.$maxValuesField=e.maxValuesField||G1,this.$labelField=e.labelField||$1,this.$labelGenerator=e.labelGenerator,this.$idField=e.idField||B1,this.$labels=e.labels||[]}addValue(e){let t=e[this.$minValuesField],n=e[this.$maxValuesField],o=t!=null&&n!=null,s={id:e[this.$idField]||B(),valueField:"v",minValueField:o?"minV":null,maxValueField:o?"maxV":null,label:e[this.$labelField||""]},a=new rr(s,this.chart.colorGenerator.generate(s));if(a.reset(),o){let l=Math.max(t.length,n.length);for(let h=0;h<l;h++){let d=this.Pg(h);a.addValue({minV:t,maxV:n,id:d})}}else{let l=e[this.$valuesField];l!=null&&l.forEach((h,d)=>{let u=this.kb(d,e);a.addValue({v:h,id:u})})}a.values.length>0&&this.$series.push(a)}kb(e,t){return this.$labelGenerator!=null?this.$labelGenerator(e,t):this.$labels[e]!=null?this.$labels[e]:this.Pg(e)}Pg(e){return`${this.startPoint+e*this.step}`}expand(){return this.$series}reset(){this.$series.length=0}};c(tl,"type","array");var rl=class extends Tr{constructor(e){super();c(this,"counts",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"valueField");this.valueField=e.valueField||"value",this.color=e.color,this.label=e.label}addValue(e){let t=e[this.valueField];if(t!=null){let n=this.counts.get(t)||0;this.counts.set(t,n+1)}}reset(){this.counts.clear()}expand(){let e=new rr({valueField:"value",id:this.id,label:this.label},this.color);return this.counts.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(rl,"type","collation");var nl=class extends Tr{constructor(e){super();c(this,"fields");c(this,"sums",new Map);c(this,"labels");c(this,"colors");this.fields=e.fields,this.labels=e.labels||[],this.colors=new Map,(e.colors||[]).forEach((t,n)=>{this.colors.set(this.fields[n],t)})}addValue(e){this.fields.forEach(t=>{let n=parseFloat(e[t]);if(!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}})}reset(){this.sums.clear()}expand(){let e=new rr({valueField:"value",id:B(),label:"Sum"},"#556623");return this.sums.forEach((t,n)=>{e.addValue({id:n,label:n,value:t,color:this.colors.get(n)||"#556623"})}),[e]}};c(nl,"type","summing");var il=class extends Tr{constructor(e){super();c(this,"sums",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"categoryField");c(this,"sumField");this.categoryField=e.categoryField||"category",this.sumField=e.sumField||"value"}addValue(e){let t=e[this.categoryField],n=parseFloat(e[this.sumField]);if(t!=null&&!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}}reset(){this.sums.clear()}expand(){let e=new rr({valueField:"value",id:this.id,label:this.label},this.color);return this.sums.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(il,"type","summing-collation");var ol=class extends bo{constructor(e,t){super(e,t);c(this,"dataSource");c(this,"$__series",[]);c(this,"$focusedSeries");c(this,"seriesElements");c(this,"$model");c(this,"$modelFilter");c(this,"$grouped");c(this,"$groupField");c(this,"Og");this.dataSource=new el,this.Og=t.series||[],this.$grouped=t.grouped===!0,this.$groupField=t.groupField||"group",this.$model=t.dataSource,this.$modelFilter=t.dataSourceFilter}$init(){this.Og.forEach(e=>{if(e.type==null||e.type===rr.type){let t=new rr(e,e.color||this.colorGenerator.generate(e),this.$groupField);this.$__series.push(t)}else if(e.type===tl.type){let t=new tl(e,this);this.$__series.push(t)}else if(e.type===rl.type){let t=new rl(e);this.$__series.push(t)}else if(e.type===il.type){let t=new il(e);this.$__series.push(t)}else if(e.type===nl.type){let t=new nl(e);this.$__series.push(t)}})}load(e,t){e.data?this.dataSource=new zg(this,e.data):e.dataSource?this.dataSource=new Lc(this,e.dataSource,e.dataSourceFilter):e.url&&(this.dataSource=new Xg(this,e.url)),this.$load(t)}setDataSourceFilter(e){this.$modelFilter=e,this.dataSource instanceof Lc&&(this.dataSource.$setFilter(e),this.$load())}reload(){this.$load()}$reset(){this.$doReset()}$load(e){this.$reset(),this.dataSource.load(()=>{this.$doLoad(),this.$draw(),this.fire(Fg,this),e&&e(this)})}hasData(){return this.dataSource.hasData()}};var Kn="data-vjs-chart-category",Et="data-vjs-chart-series",jg="data-vjs-chart-stack",Hg="data-vjs-chart-stack-total",kg="data-vjs-chart-value",mJe="data-vjs-filter",ar="start",Oi="end",_i=2,Wg=5,D0=10,fb=20,Zg=14,N0=14,Jg="normal",I0="normal";var M0=["b","br","em","strong"],F1="vjs-tooltip",al=class extends os{constructor(e){super({formatter:(t,n)=>zc(t)?xT(t,n||"%d"):t});c(this,"$adt");this.parseAndValidate(e.format)}parseAndValidate(e){try{let t=o=>{if(o.type===Yr.type&&M0.indexOf(o.tag)===-1)throw U(`Unsupported element ${o.tag} in tooltip format. Supported elements are [${M0.join(" ")}]`),"error"},n=this.parse(e);n.filter(o=>o.type!==ea.type).forEach(t),this.$adt=n}catch(t){U(`VisuallyJs - WARN: Cannot parse tooltip format ${e}`)}}ce(e){switch(e){case"b":case"strong":let t=G("tspan");return L(t,"vjs-b"),t.style.fontWeight="bold",t;case"i":case"em":let n=G("tspan");return n.style.fontStyle="italic",n;case"br":let o=G("tspan");return L(o,"vjs-br"),o.textContent="\u200B",o}}renderTooltip(e){return this.render(this.$adt,e)}},sl=class{constructor(r,e){this.parentElement=r;c(this,"root");c(this,"g");c(this,"bg");c(this,"text");c(this,"$parser");c(this,"$paddingX",8);c(this,"$paddingY",10);c(this,"$valueSuffix");c(this,"xc");c(this,"_g");var n,o,s,a;if(this.$parser=new al(e),this.$valueSuffix=e.valueSuffix,this.xc=e.timeout==null?2500:e.timeout,this.g=G(q,{"pointer-events":"none"},{},F1),wt(r)){this.root=this.g;let l=r,h=l.querySelector("defs");h==null&&(h=G("defs"),l.insertBefore(h,l.childNodes[0]));let d=G("filter",{x:"-20%",y:"-20%",width:"140%",height:"140%",id:"vjs-tooltip-shadow"}),u=G("feDropShadow",{dx:2,dy:2,stdDeviation:3,"flood-color":"rgba(0,0,0,0.5)"});d.appendChild(u),h.appendChild(d),this.g.setAttribute("filter","url(#vjs-tooltip-shadow)")}else this.root=G(Le),this.root.appendChild(this.g);this.bg=G(Z,{fill:e.fill||"#FFFFFF",stroke:e.outline||"#999999","stroke-width":e.outlineWidth||1,"data-z-index":"1000",rx:e.cornerRadius==null?3:e.cornerRadius}),this.g.appendChild(this.bg);let t={"font-size":((n=e.font)==null?void 0:n.size)||"0.8rem","dominant-baseline":"hanging",x:`${this.$paddingX}`,y:`${this.$paddingY}`};(o=e.font)!=null&&o.family&&(t["font-family"]=e.font.family),(s=e.font)!=null&&s.style&&(t["font-style"]=e.font.style),(a=e.font)!=null&&a.weight&&(t["font-weight"]=e.font.weight),e.textColor&&(t.fill=e.textColor),this.text=G(et,t),this.g.appendChild(this.text),r.appendChild(this.root)}Wb(){this.xc!==-1&&(clearTimeout(this._g),this._g=setTimeout(()=>this.hide(),this.xc))}$renderTooltip(r){this.text.innerHTML="",this.parentElement.insertBefore(this.root,null);let e=this.$parser.renderTooltip(r),t=2;this.text.appendChild(e.fragment);let n=this.text.getBBox().height+t,o=n;Array.from(this.text.querySelectorAll("tspan.vjs-br")).forEach(h=>{h.setAttribute("dy",`${n}`),h.setAttribute("x",`${this.$paddingX}`),h.getBBox().height===0?n=o:n=h.getBBox().height+t});let s=this.text.getBBox(),a=s.width+2*this.$paddingX,l=s.height+2*this.$paddingY;this.bg.setAttribute("x","0"),this.bg.setAttribute("width",`${a}`),this.bg.setAttribute("y","0"),this.bg.setAttribute("height",`${l}`)}formatValue(r){return r==null?null:this.$valueSuffix==null?`${r}`:`${r} ${this.$valueSuffix}`}show(r,e,t){if(this.$parser.$adt!=null){this.$renderTooltip(t);let n=this.g.getBBox(),o=We(this.parentElement),s=r.x-n.width*e.x,a=r.y-n.height*e.y,l=5;s=Math.max(l,Math.min(s,o.width-n.width)-l),a=Math.max(l,Math.min(a,o.height-n.height)-l);let h={x:s,y:a};Ne(this.root,h),this.Wb()}}hide(){this.root&&this.root.parentElement&&this.parentElement.removeChild(this.root)}},ll=class extends sl{showTooltip(r,e,t,n,o){let s={series:t,category:n,point:{value:this.formatValue(o.value),rawValue:o.value,minValue:this.formatValue(o.minValue),rawMinValue:o.minValue,maxValue:this.formatValue(o.maxValue),rawMaxValue:o.maxValue,stackTotal:o.stackTotal},stack:o.stackId?{id:o.stackId,total:o.stackTotal}:null};super.show(r,e,s)}},Kg=class extends sl{showTooltip(r,e,t,n){super.show(r,e,{series:t,point:n})}};var wc=class{constructor(){c(this,"dataMax",0);c(this,"dataMin",0);c(this,"maxScale",0);c(this,"minScale",0);c(this,"range",0);c(this,"step",0);c(this,"stepCount",0);c(this,"steps",[])}},hl=class extends ol{constructor(e,t){super(e,t);c(this,"axisLineSize");c(this,"yAxisPadding");c(this,"yAxes");c(this,"xAxes");c(this,"$crosshairElements",{x:[],y:[]});c(this,"$roundCorners");c(this,"$cornerRadius");c(this,"$realisedSeries",[]);c(this,"hn");c(this,"$tooltip");c(this,"$maxLabelSize");this.hn=t.tooltip,this.axisLineSize=t.axisLineSize||_i,this.yAxisPadding=t.yAxisPadding||D0,this.$roundCorners=t.roundCorners!==!1,this.$cornerRadius=t.cornerRadius||Wg,this.dataSource=new el,this.$maxLabelSize=t.maxLabelSize||.2,this.$init(),this.$bind(st,z(yn),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s),this.$mouseOverChartPoint(o,s,n)}),this.$bind(ot,z(yn),n=>{this.setFocusedSeries(null),this.$mouseOutChartPoint(),this.$hideTooltip()}),this.legend.hover&&(this.$bind(st,z(Ng),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s)}),this.$bind(ot,z(Ng),n=>{this.setFocusedSeries(null)}))}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{e.expand().forEach(n=>{this.$realisedSeries.push(n)})})}getSeries(){return this.$realisedSeries}Zb(e,t){e.showLine!==!1&&(e.lineElement=k(Z,{height:this.axisLineSize,y:-this.yAxisPadding,x:-(this.axisLineSize/2+this.yAxisPadding)},ob,t)),e.titleElement=k(q,{},"",t),e.title!=null&&(jt(e.titleElement,0,e.titlePadding),k(Z,{height:this.legend.padding,fill:"transparent",width:10},"",e.titleElement),vs(e.title,{"text-anchor":this.Rg(e),"dominant-baseline":"hanging",y:this.legend.padding},[sb,n0].join(" "),e.titleElement))}Rg(e){return e.titleAlign===L0?"start":e.titleAlign===w0?"end":"middle"}Jb(e,t){e.titleElement=k(et,{y:0,x:0,"text-anchor":this.Rg(e)},[sb,r0].join(" "),e.element),e.title&&(e.titleElement.innerHTML=e.title);let n=e.titleElement.getBBox(),o=n.height/2;e.titleElement.setAttribute(Q,`${o}`);let s=[],a=0;if(e.labels.forEach(u=>{let p=u.getBBox().width;a=Math.max(a,p),s.push([u,p])}),e.position===ar)s.forEach(u=>u[0].setAttribute(Q,`${n.height+10+(a-u[1])}`));else{s.forEach(p=>p[0].setAttribute(Q,"0"));let u=o+a+this.yAxisPadding;e.titleElement.setAttribute(Q,`${u}`)}let l=e.titleAlign==="start"?t.height:e.titleAlign==="end"?0:t.height/2;e.titleElement.setAttribute(ye,`${l}`);let h=e.position===ar?270:90;e.titleElement.setAttribute("transform",`rotate(${h}, ${e.titleElement.getAttribute(Q)}, ${l})`),e.showLine!==!1&&(e.lineElement=k(Z,{width:this.axisLineSize,height:t.height+this.axisLineSize/2,y:0,x:n.height+a+10+10},ob,e.element))}$computeScaleLabel(e,t){if(t.labelFormatter)return t.labelFormatter(e);let n=`${e}`;return t.labelPrefix&&(n=t.labelPrefix+n),t.labelSuffix&&(n=n+t.labelSuffix),n}$precomputeLegend(e,t,n,o){let s=k(q,{"data-z-index":100},QR,e);if(this.legend.visible&&(this.$realisedSeries.length>1||this.legend.$hideForSingleSeries===!1)){let a=k(Z,{height:1,rx:2,fill:this.style.legendBackgroundColor,stroke:this.style.legendOutlineColor,"stroke-width":this.style.legendOutlineWidth,width:1},"",s),l=2,h=[],d=0;this.$realisedSeries.forEach((m,g)=>{let E=k(q,{[Et]:g},Ng,s),y=k(et,{y:d,"text-anchor":"start",x:l+19,"dominant-baseline":"hanging","font-size":this.legend.font.size,"font-weight":this.legend.font.weight||"normal","font-style":this.legend.font.style||"normal"},e0,E);y.innerHTML=m.label;let x=y.getBBox();k(Z,{rx:6,ry:6,width:12,height:12,fill:m.color,x:l,y:d},t0,E),s.appendChild(E),h.push([y,E,x]),this.legend.orientation===pb?l+=x.width+21+5:d+=x.height+5});let u=s.getBBox(),p=10;if(a.setAttribute(Pe,`${u.width+2*p}`),a.setAttribute(Me,`${u.height+2*p}`),a.setAttribute("transform",`translate(-${p}, -${p})`),!this.legend.floating){let m=this.legend.align===gb?t/2-u.width/2:this.legend.align===mb?this.margin:t-u.width-this.margin,g=this.legend.valign===Eb?n-u.height-this.margin:this.legend.valign===Pc?o:(n-u.height)/2;jt(s,m,g)}}return s}$getScaleGrid(e,t){let n=t.useSeriesTotal?t.stackedScale:t.scale,o=n.step/n.range;return n.steps.map((s,a)=>{let l=o*e*a;return e-l})}$getAxisLabels(e,t){return xn(e)?this.Kb(e,t):[]}$drawChart(e,t,n,o){this.$recalc(),this.hn&&(this.$tooltip=this.$createTooltip(e,this.hn)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Ka,e);e.insertBefore(s,o.nextElementSibling);let a=`vjs-plot-clip-${yl()}`,l=k("defs",{},null,e),h=k("clipPath",{id:a},null,l);k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight},null,h);let d=k(q,{"clip-path":`url(#${a})`},xc,e),u=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:"transparent","data-z-index":"0"},null,d);u.addEventListener(se,p=>{let m=this.$fromEventLocation(p);this.$onMouseMove(m)}),u.addEventListener(pS,()=>{this.$onMouseLeave()}),this.$drawCrosshairs(d,!0,g0,p=>!xn(p)),this.seriesElements=this.$realisedSeries.map((p,m)=>k(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,[Et]:`${m}`},qR,d)),this.$drawCrosshairs(d,!1,m0,p=>xn(p))}$drawCrosshairs(e,t,n,o){t&&(this.$crosshairElements={x:[],y:[]}),this.xAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:l.width||1,height:this.dim.chartHeight,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${bc} ${n}`,e),p;if(l.showLabel!==!1&&xn(s)){let m={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(m["font-style"]=l.labelFont.style),p=vs("",m,Ac,e)}this.$crosshairElements.x.push({line:u,label:p,options:l})}}),this.yAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:this.dim.chartWidth,height:l.width||1,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${bc} ${n}`,e),p;if(l.showLabel!==!1&&xn(s)){let m={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(m["font-style"]=l.labelFont.style),p=vs("",m,Ac,e)}this.$crosshairElements.y.push({line:u,label:p,options:l})}})}$drawDecoration(e,t,n){let o=k(q,{},null,e),s=k(q,{},null,e),a=k(q,{},null,e),l=k(q,{},null,e),{yAxes:h,yAxesAtStart:d,yAxesAtEnd:u}=this.$_generateYAxes(),{xAxes:p,xAxesAtStart:m,xAxesAtEnd:g}=this.$_generateXAxes();this.yAxes=h,this.xAxes=p;let E=this.$precomputeTitle(e,t),y=E.getBBox(),x=this.margin,f=this.$titlePlacement===_c?this.margin:x+y.height,b=this.$precomputeLegend(e,t,n,f),A=this.legend.floating?Cc():b.getBBox(),T=(D,V)=>{let J=0;for(let fe=0;fe<D.length;fe++){let X=D[fe];X.element=k(q,{"font-size":X.font.size,"font-face":X.font.style,fill:X.labelColor},[qa,Ig].join(" "),V),X.labelsElement=k(q,{},ib,X.element),X.labels=this.$getAxisLabels(X,!0),this.Zb(X,X.element);let ge=X.element.getBBox();X.dim=ge,J+=ge.height+this.yAxisPadding}};T(m,a),T(g,l);let S=this.$titlePlacement===_c?this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===Pc?A.height:0):x+y.height+this.titlePadding,R=()=>{let D=a.getBBox(),V=l.getBBox(),J=n-this.margin-y.height-this.titlePadding-D.height-this.yAxisPadding-this.yAxisPadding-V.height-(this.legend.visible&&!this.legend.floating?this.legend.padding:0)-(this.legend.valign===Oc?0:A.height)-this.margin,fe=(this.$titlePlacement===_c?this.margin:S)+D.height+this.yAxisPadding+(this.legend.valign===Pc?A.height:0);return{chartHeight:J,chartY:fe}},{chartHeight:v,chartY:O}=R(),P=(D,V)=>{let J=0;for(let fe=0;fe<D.length;fe++){let X=D[fe];X.element=k(q,{"font-size":X.font.size,"font-face":X.font.style,fill:X.labelColor},[qa,Mg].join(" "),V),X.labelsElement=k(q,{},ib,X.element),X.labels=this.$getAxisLabels(X,!1),this.Jb(X,{y:O,height:v});let ge=X.element.getBBox();jt(X.element,J-ge.x,0),X.dim=ge,J+=ge.width+this.yAxisPadding}};P(d,o),P(u,s);let I=o.getBBox(),C=this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===Oc&&this.legend.align===mb?this.legend.padding+A.width:0);jt(o,C,0);let _=C+I.width+this.yAxisPadding,w=t-_-(this.legend.visible&&!this.legend.floating&&this.legend.valign===Oc&&this.legend.align===T0?this.legend.padding+A.width:0)-this.margin;if(u.length>0){let D=s.getBBox();jt(s,_+w+this.yAxisPadding-D.width,0),w-=this.margin+this.yAxisPadding+D.width}p.forEach(D=>{D.lineElement!=null&&D.lineElement.setAttribute(Pe,`${w-this.axisLineSize+(this.axisLineSize/2+this.yAxisPadding)}`)});let $=_+w,N=O+v,M={chartWidth:w,chartHeight:v,chartX:_,chartY:O,chartEndX:$,chartEndY:N,width:t,height:n};if(this.$titlePlacement===_c){let D=l.getBBox(),V=this.legend.visible&&!this.legend.floating&&this.legend.valign!==Pc&&this.legend.valign!==Oc?A.height+this.legend.padding:0;if(V>0){let fe=M.chartY+M.chartHeight+this.yAxisPadding+D.height+this.legend.padding;vc(b,fe)}let J=M.chartY+M.chartHeight+this.yAxisPadding+D.height+V+this.titlePadding-this.margin;jt(E,0,J)}for(let D=0;D<p.length;D++){let V=p[D].titleAlign==="start"?0:p[D].titleAlign==="end"?w:w/2;jt(p[D].titleElement,V,p[D].title!=null?p[D].titlePadding:0),xn(p[D])?this.qb(M,p[D]):this.Qb(M,p[D].labels);let J=this.$maxLabelSize*M.height;if(S0(p[D].labels,J,"height","width")){let X=p[D].labelsElement.getBBox();p[D].titleElement&&vc(p[D].titleElement,X.y+X.height+this.yAxisPadding);let{chartHeight:ge,chartY:Ge}=R();M.chartHeight=ge,M.chartY=Ge,M.chartEndY=Ge+ge}}jt(a,M.chartX,S),jt(l,M.chartX,M.chartY+M.chartHeight+this.yAxisPadding),vc(o,M.chartY),vc(s,M.chartY);for(let D=0;D<h.length;D++)h[D].lineElement&&h[D].lineElement.setAttribute(Me,`${M.chartHeight}`),xn(h[D])?this.eA(M,h[D].labels,h[D]):this.tA(M,h[D].labels);if(this.hasData()){if(this.$getXAxisType()==="value")for(let D=0;D<p.length;D++){let V=p[D];V.showGrid&&this.rA(e,M,V)}if(this.$getYAxisType()==="value")for(let D=0;D<h.length;D++){let V=h[D];V.showGrid&&this.nA(e,M,V)}}if(this.legend.visible&&this.legend.floating){let D=M.chartX+M.chartWidth-b.getBBox().width,V=M.chartY;jt(b,D,V)}return M}setFocusedSeries(e){this.seriesElements.forEach((t,n)=>{e!=null&&n!=e?t.setAttribute("opacity","0.2"):t.setAttribute("opacity","1")}),this.$focusedSeries=e}Qb(e,t){let n=e.chartWidth/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(Q,`${o*n+n/2}`)}qb(e,t){let n=this.$getScaleGrid(e.chartWidth,t).reverse();t.inverted&&(n=n.reverse());for(let o=0;o<t.labels.length;o++)t.labels[o].setAttribute(Q,`${n[o]}`)}tA(e,t){let n=e.chartHeight/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(ye,`${o*n+n/2}`)}Kb(e,t){let n=[],o=e.useSeriesTotal?e.stackedScale:e.scale;return o.steps.forEach((s,a)=>{let l=t?{"text-anchor":a===o.stepCount?"end":"middle","dominant-baseline":"hanging",x:0,y:0}:{x:0,y:0,"dominant-baseline":"middle"},h=this.$computeScaleLabel(s,e),d=vs(h,l,E0,e.labelsElement);if(e.labelColorGenerator){let u=e.labelColorGenerator(s,a);u!=null&&d.setAttribute("fill",u)}n.push(d)}),n}eA(e,t,n){let o=this.$getScaleGrid(e.chartHeight,n);n.inverted&&(o=o.reverse());for(let s=0;s<t.length;s++)t[s].setAttribute(ye,`${o[s]}`)}rA(e,t,n){let o=this.$getScaleGrid(t.chartWidth,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},lb,e);for(let a=0;a<o.length;a++)k(Z,{height:t.chartHeight,x:o[a],y:0,width:1,fill:this.style.gridLineColor},hb,s)}nA(e,t,n){let o=this.$getScaleGrid(t.chartHeight,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},lb,e);for(let a=0;a<o.length;a++)k(Z,{width:t.chartWidth,y:o[a],x:0,height:1,fill:this.style.gridLineColor},hb,s)}$onMouseMove(e){this.xAxes.forEach((t,n)=>{let o=this.$crosshairElements.x[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.x,this.dim.chartWidth);if(h!=null){if(xn(t)){let d=this.dim.chartX+h*this.dim.chartWidth;if(s.setAttribute(Q,`${d}`),a){let u=t,p=u.scale.minScale+h*(u.scale.maxScale-u.scale.minScale),m=l.labelValueFormat!==void 0?db(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new al({format:l.labelFormat}).renderTooltip({value:m,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=m;let g=a.getBBox(),E=d+g.width+5<this.dim.chartX+this.dim.chartWidth?d+5:d-g.width-5,y;l.labelPosition==="end"?y=this.dim.chartY+5+g.height/2:y=this.dim.chartY+this.dim.chartHeight-5-g.height/2,a.setAttribute(Q,`${E}`),a.setAttribute(ye,`${y}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartWidth/t.labels.length;s.setAttribute(Pe,`${d}`);let u=Math.floor(e.x/d);s.setAttribute(Q,`${this.dim.chartX+u*d}`)}s.setAttribute(ye,`${this.dim.chartY}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}}),this.yAxes.forEach((t,n)=>{let o=this.$crosshairElements.y[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.y,this.dim.chartHeight,!0);if(h!=null){if(xn(t)){let d=this.dim.chartY+h*this.dim.chartHeight;if(s.setAttribute(ye,`${d}`),a){let u=t,p=u.scale.maxScale-h*(u.scale.maxScale-u.scale.minScale),m=l.labelValueFormat!==void 0?db(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new al({format:l.labelFormat}).renderTooltip({value:m,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=m;let g=a.getBBox(),E=d-g.height-5>this.dim.chartY?d-5:d+g.height+5,y;l.labelPosition==="end"?y=this.dim.chartX+this.dim.chartWidth-5-g.width/2:y=this.dim.chartX+5+g.width/2,a.setAttribute(Q,`${y}`),a.setAttribute(ye,`${E}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartHeight/t.labels.length;s.setAttribute(Me,`${d}`);let u=Math.floor(e.y/d);s.setAttribute(ye,`${this.dim.chartY+u*d}`)}s.setAttribute(Q,`${this.dim.chartX}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}})}$onMouseLeave(){this.$crosshairElements.x.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")}),this.$crosshairElements.y.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")})}$getProportionalPos(e,t,n,o=!1){if(t<0||t>n)return null;if(xn(e))return t/n;{let s=e.labels.length;if(s===0)return null;let a=1/s;return Math.floor(t/(n/s))*a+a/2}}$hideTooltip(){this.$tooltip&&this.$tooltip.hide()}};function Dc(i){return typeof i=="number"&&Number.isFinite(i)}function V0(i,r){if(r==null)return null;let e=r.min,t=r.max;return!Dc(e)||!Dc(t)?null:e<=t?{min:e,max:t}:{min:t,max:e}}function U1(i){var e,t,n;let r={};for(let o of i)if(o!=null)for(let[s,a]of Object.entries(o)){let l=V0(s,a);if(l==null)continue;let h=r[s];h==null?r[s]={min:l.min,max:l.max,step:a.step,stepCount:a.stepCount,minLimit:a.minLimit,maxLimit:a.maxLimit}:r[s]={min:Math.min(h.min,l.min),max:Math.max(h.max,l.max),step:(e=h.step)!=null?e:a.step,stepCount:h.stepCount,minLimit:(t=h.minLimit)!=null?t:a.minLimit,maxLimit:(n=h.maxLimit)!=null?n:a.maxLimit}}return r}function Y1(i,r){if(r==null)return i;let e=tn({},i);for(let[t,n]of Object.entries(r)){if(n==null)continue;let o=e[t],s=Dc(n.min),a=Dc(n.max),l=Dc(n.step);if(!s&&!a&&!l)continue;let h=o!=null?tn({},o):{min:s?n.min:a?n.max:0,max:a?n.max:s?n.min:0};s&&(h.min=n.min,h.minLimit=n.min),a&&(h.max=n.max,h.maxLimit=n.max),l&&(h.step=n.step),e[t]=h.min<=h.max?h:Bc(tn({},h),{min:h.max,max:h.min,minLimit:h.maxLimit,maxLimit:h.minLimit})}return e}function z1(i){let r={};for(let[e,t]of Object.entries(i)){let n=V0(e,t);n!=null&&(t.step!=null?r[e]=Tc(n.min,n.max,t.step):t.stepCount!=null?r[e]=b0(n.min,n.max,t.stepCount):r[e]=Sc(n.min,n.max,6,t.minLimit,t.maxLimit))}return r}function G0(i){let r=U1(i.extentsList),e=Y1(r,i.overrides),t=z1(e);return{extents:e,scales:t}}var yb=class{constructor(r,e,t){this.chart=r;this.type=t;c(this,"$valueAxis");this.$valueAxis=(e==null?void 0:e.valueAxis)||be}getDomainExtents(){return{}}},Ao=class extends yb{get $inverted(){return this.chart.$getXAxisType()!=="value"}},xb=new Map;function cl(i,r){xb.set(i,r)}function $0(i,r,e){if(xb.has(i))return xb.get(i)(r,e)}function dl(i){return i.stacked===!0||i.stacked==="percent"||i.stacked==="default"}var ul=class extends Tr{constructor(e,t,n,o,s,a,l,h,d,u){super();this.xAxisField=e;this.yAxisField=t;c(this,"$data",[]);c(this,"$xAxis",{min:1/0,max:-1/0});c(this,"$yAxis",{min:1/0,max:-1/0});c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"color");c(this,"outline");c(this,"outlineWidth");c(this,"outlineColor");c(this,"resolveMarker");this.marker=n,this.markerType=o,this.markerSize=s,this.color=a,this.outline=l!==!1,this.outlineWidth=h||1,this.outlineColor=d,this.resolveMarker=u}reset(){this.$data=[],this.$xAxis={min:1/0,max:-1/0},this.$yAxis={min:1/0,max:-1/0}}addValue(e){let t=e[this.xAxisField],n=e[this.yAxisField];t!=null&&n!=null&&(this.$data.push(e),this.$xAxis.min=Math.min(this.$xAxis.min,t),this.$xAxis.max=Math.max(this.$xAxis.max,t),this.$yAxis.min=Math.min(this.$yAxis.min,n),this.$yAxis.max=Math.max(this.$yAxis.max,n))}expand(){return[]}};function X1(i){return{position:i,showLine:!1,showGrid:!0,id:be}}function j1(i){return{position:i,id:be}}var qn=class extends hl{constructor(e,t){super(e,t);c(this,"$valueAxes");c(this,"$valueAxesMin");c(this,"$valueAxesMax");c(this,"$categoryAxes");c(this,"$inverted");c(this,"vo");c(this,"Co");c(this,"$categories",[]);c(this,"$plots",[]);c(this,"Lg");this.vo=t.valueAxis,this.Co=t.categoryAxis,this.$inverted=t.inverted===!0,this.Lg=t.pivot===!0;let n=t.plots;n!=null&&(Array.isArray(n)?n:[n]).forEach(s=>{let a=$0(s.type,this,s.options||{});this.$plots.push(a)}),this.load(t)}iA(e,t,n){let o=[];return this.$categories.forEach((s,a)=>{let l=n?{x:0,y:0,"text-anchor":"middle","dominant-baseline":"hanging"}:{"dominant-baseline":"middle","text-anchor":"start",x:0,y:0},h=vs(s[t],l,"",e);o.push(h)}),o}$getAxisLabels(e,t){return A0(e)?this.iA(e.labelsElement,e.labelField,t):super.$getAxisLabels(e,t)}oA(){var t,n,o;this.$categoryAxes=[];let e=this.Co==null?[j1(this.$inverted?Oi:ar)]:Array.isArray(this.Co)?this.Co:[this.Co];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?be:B(),h={showLine:a.showLine===!0,lineSize:a.lineSize||_i,labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,id:l,labelField:a.labelField||"id",title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Qa,titlePadding:((o=a.title)==null?void 0:o.padding)||fb,position:a.position||(this.$inverted?Oi:ar),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,type:"category",titleElement:null,labelsElement:null,font:Pi(N0,I0,"normal","sans-serif",a.font),crosshair:a.crosshair};this.$categoryAxes.push(h)}}$doReset(){super.$doReset(),this.$categories.length=0}sA(){if(this.$realisedSeries.length>0){let e=new Fs,t=this.$realisedSeries.map(l=>[l.label,l.valueField,l.minValueField,l.maxValueField]),n=this.$realisedSeries[0],o=n.getCategories(),s=n.isRangeSeries(),a=[];o.forEach(l=>{let h=s?{id:l.id,label:l.id,minValueField:"min",maxValueField:"max"}:{id:l.id,label:l.id,valueField:"value"},d=new rr(h,e.generate(),this.$groupField),u=l[this.$groupField],p=n.ee.has(u);t.forEach(g=>{let E=o.find(y=>y.id===l.id);E&&(s?d.addValue({id:g[0],min:E[g[2]],max:E[g[3]]}):d.addValue({id:g[0],value:E[g[1]]}))});let m=d;p&&(m.stack=u),a.push(m)}),this.$realisedSeries=a}}$doLoad(){super.$doLoad(),(this.$grouped||this.Lg)&&this.sA(),this.$realisedSeries.length>0&&(this.$categories=this.$realisedSeries[0].getCategories().slice())}$recalc(){this.oA(),this.aA();let e=this.$plots.map(o=>o.getDomainExtents()),t={};this.$valueAxes.forEach(o=>{t[o.domain]={min:o.min,max:o.max,step:o.step},o.stackedDomain&&(t[o.stackedDomain]={min:o.min,max:o.max,step:o.step})});let{scales:n}=G0({extentsList:e,overrides:t});this.$valueAxes.forEach(o=>{o.scale=n[o.domain],o.stackedScale=o.stackedDomain!=null&&n[o.stackedDomain]!=null?n[o.stackedDomain]:o.scale})}aA(){var t,n,o;this.$valueAxes=[],this.$valueAxesMax=null,this.$valueAxesMin=null;let e=this.vo==null?[X1(this.$inverted?ar:Oi)]:Array.isArray(this.vo)?this.vo:[this.vo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?be:B(),h=this.$plots.find(p=>p.$valueAxis===l&&dl(p))!=null,d=this.$plots.find(p=>p.$valueAxis===l&&p.stacked==="percent")!=null,u={domain:this.$inverted?"y":"x",stackedDomain:this.$inverted?"yStacked":"xStacked",labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,min:a.min,max:a.max,showLine:a.showLine===!0,lineSize:a.lineSize||_i,showGrid:a.showGrid!==!1,gridLineSize:a.gridLineSize||_i,id:l,title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Qa,titlePadding:((o=a.title)==null?void 0:o.padding)||fb,position:a.position||(this.$inverted?ar:Oi),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,useSeriesTotal:h,type:"value",titleElement:null,labelsElement:null,font:Pi(Zg,Jg,"normal","sans-serif",a.font),scale:new wc,stackedScale:new wc,crosshair:a.crosshair,isPercent:d,step:a.step,labelPrefix:a.labelPrefix,labelSuffix:d&&a.labelSuffix==null&&a.labelFormatter==null?"%":a.labelSuffix,labelFormatter:a.labelFormatter};this.$valueAxes.push(u),a.min!=null&&(this.$valueAxesMin=this.$valueAxesMin==null?a.min:Math.min(a.min,this.$valueAxesMin)),a.max!=null&&(this.$valueAxesMax=this.$valueAxesMax==null?a.max:Math.max(a.max,this.$valueAxesMax))}}$_generateYAxes(){return this.$inverted?{yAxes:this.$valueAxes,yAxesAtStart:this.$valueAxes.filter(e=>e.position===ar),yAxesAtEnd:this.$valueAxes.filter(e=>e.position===Oi)}:{yAxes:this.$categoryAxes,yAxesAtStart:this.$categoryAxes.filter(e=>e.position===ar),yAxesAtEnd:this.$categoryAxes.filter(e=>e.position===Oi)}}$_generateXAxes(){return this.$inverted?{xAxes:this.$categoryAxes,xAxesAtStart:this.$categoryAxes.filter(e=>e.position===ar),xAxesAtEnd:this.$categoryAxes.filter(e=>e.position===Oi)}:{xAxes:this.$valueAxes,xAxesAtStart:this.$valueAxes.filter(e=>e.position===ar),xAxesAtEnd:this.$valueAxes.filter(e=>e.position===Oi)}}$drawChart(e,t,n,o){super.$drawChart(e,t,n,o),this.$plots.forEach(s=>s.$draw(e,this.dim,this.$valueAxesMin,this.$valueAxesMax))}lA(e,t){return(t?e.chartHeight:e.chartWidth)/this.$categories.length}$getCategoryCenter(e,t,n){let o=this.lA(t,n);return o*e+o/2}$mouseOverChartPoint(e,t,n){let o=this.$fromEventLocation(n),s=parseInt(e.getAttribute(Kn),10),a=e.getAttribute(jg),l=e.getAttribute(Hg),h=e.getAttribute(kg);this.$maybeShowTooltip(t,s,{x:o.x+this.dim.chartX,y:o.y+this.dim.chartY},{x:.5,y:1},a,l!=null?parseFloat(l):null,h!=null?parseFloat(h):null)}$mouseOutChartPoint(){}$maybeShowTooltip(e,t,n,o,s,a,l){if(this.$tooltip!=null){let h=this.$realisedSeries[e],d=this.$categories[t],u=d[h.valueField];l!=null&&(u=l);let p=d[h.minValueField],m=d[h.maxValueField];this.$tooltip.showTooltip(n,o,h,d.id,{value:u,minValue:p,maxValue:m,stackTotal:a,stackId:s})}}$getXAxisType(){return this.$inverted?"category":"value"}$getYAxisType(){return this.$inverted?"value":"category"}$createTooltip(e,t){return new ll(e,t)}};var H1=Ar(),B0={square:(i,r,e)=>G(Z,{x:r-i/2,y:e-i/2,width:i,height:i}),circle:(i,r,e)=>G(ke,{cx:r,cy:e,r:i/2}),cross:(i,r,e)=>G(ee,{d:`M ${r} ${e-i/2} v ${i} M ${r-i/2} ${e} h ${i}`,"stroke-width":2,stroke:"#000000",fill:"#000000"})};function qg(i,r,e,t,n,o){let s=i.markerType||"circle",l=(B0[s]||B0.circle)(t,r,e);if(n)for(let h in n)l.setAttribute(h,n[h]);return o&&L(l,o),l}function Nc(i,r,e,t){let o=H1.template(B(),r||{},s=>i).childNodes[0];if(e)for(let s in e)o.setAttribute(s,e[s]);return t&&L(o,t),o}var pl=class extends hl{constructor(e,t){super(e,t);this.options=t;c(this,"$xAxisDimensions",{min:1/0,max:-1/0});c(this,"$yAxisDimensions",{min:1/0,max:-1/0});c(this,"xAxis");c(this,"yAxis");c(this,"axisFont");c(this,"U");c(this,"j");c(this,"wg");c(this,"Dg");this.axisFont=Pi(Zg,Jg,"normal","sans-serif",t.axisFont),this.U=t.xAxis||{},this.j=t.yAxis||{},this.wg=t.minimumMarkerSize!=null?t.minimumMarkerSize:8,this.Dg=t.maximumMarkerSize!=null?t.maximumMarkerSize:50,this.$dualValueInit(t),this.load(t),this.$bind(st,z(Vg),n=>{if(this.$tooltip){let o=n.target,s=parseInt(o.getAttribute(Et)),a=this.$__series[s],l=parseInt(o.getAttribute("data-idx"),10),h=a.$data[l],d=o.getBBox(),u={x:d.x,y:d.y,width:d.width,height:d.height},p={x:.5,y:.5},m={x:u.x+u.width*p.x+this.dim.chartX,y:u.y+u.height*p.y+this.dim.chartY};this.$tooltip.showTooltip(m,{x:.5,y:1.1},a,h)}}),this.$bind(ot,z(Vg),n=>{this.$tooltip&&this.$tooltip.hide()})}$createTooltip(e,t){return new Kg(e,t)}$init(){}$dualValueInit(e){e.series.forEach(t=>{let n=new ul(t.xAxisField,t.yAxisField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$doLoad(){this.$xAxisDimensions={min:this.U.min!==void 0?this.U.min:1/0,max:this.U.max!==void 0?this.U.max:-1/0},this.$yAxisDimensions={min:this.j.min!==void 0?this.j.min:1/0,max:this.j.max!==void 0?this.j.max:-1/0},this.$__series.forEach(e=>{this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,e.$xAxis.min),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,e.$xAxis.max),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,e.$yAxis.min),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,e.$yAxis.max)}),this.$adjustDimensionsForMarkers()}$adjustDimensionsForMarkers(){let e=this.$xAxisDimensions.max-this.$xAxisDimensions.min,t=this.$yAxisDimensions.max-this.$yAxisDimensions.min,n=this.fc||500,o=this.yc||500,s=3;this.$__series.forEach(a=>{a.$data.forEach(l=>{let h=l[a.xAxisField],d=l[a.yAxisField];if(h!=null&&d!=null){let p=this.$getMarkerSize(a,l)/2+s,m=p/n*e,g=p/o*t;this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,h-m),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,h+m),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,d-g),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,d+g)}})})}$setupValueAxes(e){var t,n,o,s,a,l,h,d;this.yAxis={domain:"y",inverted:this.j.inverted===!0,labelColor:this.j.labelColor||this.style.labelColor,labelColorGenerator:this.j.labelColorGenerator||this.style.labelColorGenerator,min:this.j.min,max:this.j.max,showLine:this.j.showLine===!0,lineSize:this.j.lineSize||_i,dim:Cc(),element:k(q,{},[qa,Mg].join(" "),e),id:this.j.id||B(),position:this.j.position||ar,titleAlign:((t=this.j.title)==null?void 0:t.align)||Qa,title:(n=this.j.title)==null?void 0:n.text,titlePadding:((o=this.j.title)==null?void 0:o.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.j.showGrid!==!1,gridLineSize:this.j.lineSize||2,useSeriesTotal:!1,font:((s=this.j)==null?void 0:s.font)||this.axisFont,scale:this.j.step!=null?Tc(this.$yAxisDimensions.min,this.$yAxisDimensions.max,this.j.step):Sc(this.$yAxisDimensions.min,this.$yAxisDimensions.max),stackedScale:null,crosshair:this.j.crosshair,step:this.j.step,labelPrefix:this.j.labelPrefix,labelSuffix:this.j.labelSuffix,labelFormatter:this.j.labelFormatter},this.xAxis={domain:"x",inverted:this.U.inverted===!0,labelColor:this.U.labelColor||this.style.labelColor,labelColorGenerator:this.U.labelColorGenerator||this.style.labelColorGenerator,min:this.U.min,max:this.U.max,showLine:this.U.showLine===!0,lineSize:this.U.lineSize||_i,dim:Cc(),element:k(q,{},[qa,Ig].join(" "),e),id:this.U.id||B(),position:this.U.position||ar,titleAlign:((a=this.U.title)==null?void 0:a.align)||Qa,title:((l=this.U.title)==null?void 0:l.text)||"",titlePadding:((h=this.U.title)==null?void 0:h.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.U.showGrid!==!1,gridLineSize:this.U.lineSize||2,useSeriesTotal:!1,font:((d=this.U)==null?void 0:d.font)||this.axisFont,scale:this.U.step!=null?Tc(this.$xAxisDimensions.min,this.$xAxisDimensions.max,this.U.step):Sc(this.$xAxisDimensions.min,this.$xAxisDimensions.max),stackedScale:null,crosshair:this.U.crosshair,step:this.U.step,labelPrefix:this.U.labelPrefix,labelSuffix:this.U.labelSuffix,labelFormatter:this.U.labelFormatter}}$drawChart(e,t,n,o){this.$setupValueAxes(e),super.$drawChart(e,t,n,o),this.$plotPoints(e)}$doReset(){super.$doReset(),this.$xAxisDimensions.min=1/0,this.$yAxisDimensions.min=1/0,this.$xAxisDimensions.max=-1/0,this.$yAxisDimensions.max=-1/0}$plotPoints(e){let t=this.$getDataPointCssClass();this.$__series.forEach((n,o)=>{let s=[];n.$data.forEach((a,l)=>{let h=a[n.xAxisField],d=a[n.yAxisField],u;if(h&&d){let p=(h-this.xAxis.scale.minScale)/this.xAxis.scale.range,m=(d-this.yAxis.scale.minScale)/this.yAxis.scale.range;this.xAxis.inverted&&(p=1-p),this.yAxis.inverted||(m=1-m);let g=n.color||this.$defaultColor||"#000000",E=p*this.dim.chartWidth,y=m*this.dim.chartHeight,x;if(n.marker)x=Nc(n.marker,a,{transform:`translate(${this.dim.chartX+E}, ${this.dim.chartY+y})`,fill:g});else if(n.resolveMarker){u=this.$getMarkerSize(n,a);let b=n.resolveMarker(a);x=Nc(b,a,{transform:`translate(${this.dim.chartX+E-u/2}, ${this.dim.chartY+y-u/2})`,fill:g,width:u,height:u})}else u=this.$getMarkerSize(n,a),x=qg(n,E,y,u,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,fill:g});if(n.color&&x.setAttribute("fill",n.color),n.outline){let b=n.outlineColor||Od(g).toString();x.setAttribute("stroke",b),x.setAttribute("stroke-width",(n.outlineWidth||1).toString())}x.setAttribute("data-x",h.toString()),x.setAttribute("data-y",d.toString()),x.setAttribute(Et,o.toString()),x.setAttribute("data-idx",l.toString()),x.classList.add(yn),t!=null&&x.classList.add(t),e.appendChild(x);let f=u==null?10:Math.max(10,u/2);s.push(G(ke,{cx:E,cy:y,r:f,fill:"transparent",stroke:"none",transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,"data-x":h.toString(),"data-y":d.toString(),[Et]:o.toString(),"data-idx":l.toString()},null,Vg))}}),s.forEach(a=>e.appendChild(a))})}$getBaseMarkerSize(){let e=0;this.$__series.forEach(l=>e+=l.$data.length);let t=10,n=this.dim.chartWidth*this.dim.chartHeight,o=Math.sqrt(n)/500,s=Math.max(1,Math.sqrt(e/100)),a=t*o/s;return Math.min(this.Dg,Math.max(this.wg,a))}$getXAxisType(){return"value"}$getYAxisType(){return"value"}$mouseOutChartPoint(){}$mouseOverChartPoint(e,t){}$_generateYAxes(){return{yAxes:[this.yAxis],yAxesAtStart:[this.yAxis],yAxesAtEnd:[]}}$_generateXAxes(){return{xAxes:[this.xAxis],xAxesAtEnd:[this.xAxis],xAxesAtStart:[]}}$recalc(){}};var k1=.8,W1=50,Z1=10;function aqe(i){return i.type===Dr.type}var Qg=class Qg extends Ao{constructor(e,t){super(e,t,Qg.type);this.chart=e;this.options=t;c(this,"stacked");c(this,"$distinctStacks",[]);this.stacked=t==null?void 0:t.stacked}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(h=>{typeof h.min=="number"&&Number.isFinite(h.min)&&(s=Math.min(s,h.min)),typeof h.max=="number"&&Number.isFinite(h.max)&&(a=Math.max(a,h.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),dl(this)&&this.chart.$categories.length>0)if(this.$distinctStacks=Array.from(new Set(o.map(h=>h.stack||"default"))),this.stacked==="percent")n[t]={min:0,max:100,stepCount:4};else{let h=0;for(let d=0;d<this.chart.$categories.length;d++){let u={};this.$distinctStacks.forEach(p=>u[p]=0),o.forEach(p=>{var E,y;let m=p.stack||"default",g=(y=(E=p.values)==null?void 0:E[d])==null?void 0:y.max;typeof g=="number"&&Number.isFinite(g)&&(u[m]+=g)}),this.$distinctStacks.forEach(p=>{h=Math.max(h,u[p])})}n[t]={min:0,max:h}}return n}computeBarSize(e){let t=dl(this)?Math.max(1,this.$distinctStacks.length):this.chart.seriesElements.length,n=this.options.barGap==null?Z1:this.options.barGap,o=n*(t-1),s=e/this.chart.$categories.length,a=this.options.barSize!=null?this.options.barSize:(()=>{let h=(this.options.fillRatio==null?k1:this.options.fillRatio)*s,d=this.options.maxBarSize==null?W1:this.options.maxBarSize;return Math.min(d,(h-o)/t)})();return{barSize:a,gapBetweenBars:n,spaceUsedPerCategory:a*t+o,spacePerCategory:s,barsPerCategory:t}}$getBarCenter(e,t,n){let o=this.computeBarSize(this.$inverted?n.chartWidth:n.chartHeight);return this.chart.$getCategoryCenter(e,n,!this.$inverted)-o.spaceUsedPerCategory/2+o.barSize/2+t*(o.barSize+o.gapBetweenBars)}$computeBarPlacements(e,t,n,o){return dl(this)?this.stacked==="percent"?this.$computeBarPlacementsStackedPercent(e,t):this.$computeBarPlacementsStacked(e,t):this.$computeBarPlacementsDefault(e,t,n,o)}$computeBarPlacementsStackedPercent(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(E=>(E.stack||"default")===h),p=[],m=0;u.forEach(E=>{let y=E.values[s].max;p.push([o.indexOf(E),y]),m+=y});let g=0;p.forEach((E,y)=>{if(this.$inverted){let x=(E[1]+g)/m,f=g/m,b=Math.abs((x-f)*e.chartHeight);f=e.chartHeight-f*e.chartHeight-b,n.push({x:l,y:f,height:b,width:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:m,value:E[1]})}else{let x=(E[1]+g)/m,f=g/m,b=(x-f)*e.chartWidth;f*=e.chartWidth,n.push({x:f,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,width:b,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:m,value:E[1]})}g+=E[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsStacked(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(y=>(y.stack||"default")===h),p=[],m=0;u.forEach(y=>{let x=y.values[s].max;p.push([o.indexOf(y),x]),m+=x});let g=0,E=this.chart.$valueAxes[0].stackedScale;p.forEach((y,x)=>{if(this.$inverted){let f=(y[1]+g)/E.range,b=g/E.range,A=Math.abs((f-b)*e.chartHeight);b=e.chartHeight-b*e.chartHeight-A,n.push({x:l,y:b,height:A,width:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:m,value:y[1]})}else{let f=(y[1]+g)/E.range,b=g/E.range,A=(f-b)*e.chartWidth;b*=e.chartWidth,n.push({x:b,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,width:A,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:m,value:y[1]})}g+=y[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsDefault(e,t,n,o){let s=this.chart.getSeries(),a=[],l=this.chart.$valueAxes[0].scale;for(let h=0;h<this.chart.$categories.length;h++){let u=this.chart.$getCategoryCenter(h,e,!this.$inverted)-t.spaceUsedPerCategory/2;for(let p=0;p<s.length;p++){let m=s[p],g=n==null?m.values[h].min:Math.max(n,m.values[h].min),E=o==null?m.values[h].max:Math.min(m.values[h].max,o);if(this.$inverted){let y=(E-l.minScale)/l.range,x=(g-l.minScale)/l.range,f=x!==0,b=Math.abs((y-x)*e.chartHeight);x=e.chartHeight-x*e.chartHeight-b,a.push({x:u,y:x,canRoundStart:f,canRoundEnd:!0,height:b,width:t.barSize,category:h,series:p,rounded:!0,value:m.values[h].max})}else{let y=(E-l.minScale)/l.range,x=(g-l.minScale)/l.range,f=Math.abs((y-x)*e.chartWidth);x*=e.chartWidth,a.push({x,canRoundStart:x!==0,canRoundEnd:!0,y:u,height:t.barSize,width:f,category:h,series:p,rounded:!0,value:m.values[h].max})}u+=t.barSize+t.gapBetweenBars}}return a}$draw(e,t,n,o){let s=this.computeBarSize(this.$inverted?t.chartWidth:t.chartHeight),a=this.$computeBarPlacements(t,s,n,o),l=this.$inverted?[o0,yn].join(" "):[a0,yn].join(" "),h=this.chart.getSeries();a.forEach(d=>{let u={fill:h[d.series].color,[Kn]:`${d.category}`,[Et]:`${d.series}`};d.stackId!=null&&(u[jg]=d.stackId),d.stackTotal!=null&&(u[Hg]=`${d.stackTotal}`),d.value!=null&&(u[kg]=`${d.value}`),J1(d,!this.$inverted,u,l,this.chart.seriesElements[d.series],this.chart.$roundCorners&&d.canRoundStart,this.chart.$roundCorners&&d.canRoundEnd,this.chart.$cornerRadius),this.options.dataLabels&&this.$drawDataLabel(d,e)})}$drawDataLabel(e,t){let n=this.chart.getSeries()[e.series],o=this.chart.$categories[e.category],s=e.value,a="";if(this.options.dataLabels===!0?a=this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`:typeof this.options.dataLabels=="string"&&(a=this.options.dataLabels.replace("{series}",n.id).replace("{category}",o.id).replace("{value}",this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`),e.stackId!=null&&(a=a.replace("{stack}",e.stackId))),a.length>0){let l=this.chart.dim.chartX+e.x+e.width/2,h=this.chart.dim.chartY+e.y+e.height/2;$g(a,l,h,n.color,{size:11},t)}}};c(Qg,"type","bar");var Dr=Qg;cl(Dr.type,(i,r)=>new Dr(i,r));function J1(i,r,e,t,n,o,s,a){let l,h=a||Wg;return r?o&&s&&i.width>h?l=`M ${i.x}, ${i.y+h} q0,-${h}, ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-2*h} q-${h},0 -${h},-${h} z`:s&&i.width>h?l=`M ${i.x},${i.y} h${i.width-h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-h} z`:o&&i.width>h?l=`M ${i.x},${i.y+h} q0, -${h} ${h},-${h} h${i.width-h} v${i.height} h${-(i.width-h)} q-${h},0 -${h},-${h} z`:l=`M ${i.x},${i.y} h${i.width} v${i.height} h-${i.width} Z`:o&&s&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-2*h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} z`:s&&i.height>h?l=`M ${i.x},${i.y+i.height} v-${i.height-h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-h} z`:o&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-h} h${i.width} v${i.height-h} q0,${h} -${h},${h} z`:l=`M ${i.x},${i.y+i.height} v-${i.height} h${i.width} v${i.height} Z`,k(ee,Object.assign({d:l},e),t,n)}var F0=class extends qn{constructor(r,e){super(r,Object.assign({},e,{inverted:!(e!=null&&e.inverted),plots:{type:Ic.type,options:e.plotOptions||{}}})),L(r,y0),this.$bind(se,z(xc),t=>{let{x:n,y:o}=this.$fromEventLocation(t),s=null;if(this.$getXAxisType()==="category"){let a=this.dim.chartWidth/this.$categories.length;s=Math.floor(n/a)}else{let a=this.dim.chartHeight/this.$categories.length;s=Math.floor(o/a)}if(s!=null){let a=this.$plots[0],{loc:l,seriesIndex:h}=a.showMarker(s,this.dim,this.$focusedSeries);l!=null&&this.$tooltip!=null&&this.$maybeShowTooltip(h,s,{x:l.x+this.dim.chartX,y:l.y+this.dim.chartY},{x:.5,y:1.1})}}),this.$bind(se,z(Gg),t=>{let n=t.target,o=parseInt(n.getAttribute(Et),10);this.setFocusedSeries(o)}),this.$bind(ot,z(Gg,xc),t=>{this.$plots[0].hideMarker(),this.setFocusedSeries(null),this.$hideTooltip()})}},eE=class eE extends Ao{constructor(e,t){var n,o;super(e,t,eE.type);this.chart=e;c(this,"stacked");c(this,"bc");c(this,"Ng");c(this,"Ac");c(this,"Ct",[]);this.stacked=(t==null?void 0:t.stacked)===!0,this.bc=((n=t.marker)==null?void 0:n.enabled)!==!1,this.Ng=((o=t.marker)==null?void 0:o.size)||10}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.stacked&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var m,g;let p=(g=(m=u.values)==null?void 0:m[h])==null?void 0:g.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Dr.type);return s==null?o:s.$getBarCenter(e,t,n)}}$draw(e,t,n,o){this.Ct.length=0;let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale;for(let l=0;l<this.chart.$categories.length;l++)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.Ct[h]=this.Ct[h]||[],this.$inverted){let p=t.chartHeight-(u.values[l].max-a.minScale)/a.range*t.chartHeight;this.Ct[h].push({x:d,y:p})}else{let p=(u.values[l].max-a.minScale)/a.range;this.Ct[h].push({x:p*t.chartWidth,y:d})}}for(let l=this.chart.$categories.length-1;l>-1;l--)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.$inverted){let p=t.chartHeight-(u.values[l].min-a.minScale)/a.range*t.chartHeight;this.Ct[h].push({x:d,y:p})}else{let p=(u.values[l].min-a.minScale)/a.range;this.Ct[h].push({x:p*t.chartWidth,y:d})}}for(let l=0;l<this.Ct.length;l++){let h=s[l].color,d=`M ${this.Ct[l].map(u=>`${u.x} ${u.y}`).join(" L ")}`;k(ee,{stroke:h,"stroke-width":"1",d,fill:h,opacity:.8,[Et]:`${l}`},Gg,this.chart.seriesElements[l])}this.Ac=k(ke,{cx:"0",cy:"0",r:this.Ng/2,visibility:"hidden","stroke-width":"1"},"vjs-area-marker",e)}showMarker(e,t,n){if(this.bc!==!1){let o=this.chart.getSeries(),s=n==null?0:n,a=o[s],l=this.Ct[s][e];return de(this.Ac,{visibility:"visible",cx:l.x+t.chartX,cy:l.y+t.chartY,fill:a.color,stroke:Od(a.color).toString()}),{series:a,loc:l,seriesIndex:s}}}hideMarker(){this.bc!==!1&&de(this.Ac,{visibility:"hidden"})}};c(eE,"type","area");var Ic=eE;cl(Ic.type,(i,r)=>new Ic(i,r));var U0=class extends qn{constructor(r,e){super(r,Object.assign({},e,{inverted:!0,plots:{type:Dr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,i0)}};var Y0=class extends qn{constructor(r,e){super(r,Object.assign({},e,{inverted:!1,plots:{type:Dr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,s0)}};var bb=class extends ul{constructor(e,t,n,o,s,a,l,h,d,u,p){super(e,t,o,s,a,l,h,d,u,p);this.xAxisField=e;this.yAxisField=t;this.valueField=n;c(this,"$valueAxis",{min:1/0,max:-1/0})}addValue(e){super.addValue(e);let t=e[this.valueField];t!=null&&(this.$valueAxis.min=Math.min(this.$valueAxis.min,t),this.$valueAxis.max=Math.max(this.$valueAxis.max,t))}},z0=class extends pl{constructor(e,t){super(e,t);this.options=t;L(e,l0)}$dualValueInit(e){e.series.forEach(t=>{let n=new bb(t.xAxisField,t.yAxisField,t.valueField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$getMarkerSize(e,t){let n=this.options.minPointSize||10,o=this.options.maxPointSize,s=t[e.valueField];if(s==null)return null;let a=this.$getBaseMarkerSize(),l=Math.min(this.dim.chartWidth,this.dim.chartHeight),h=Math.min(a*7,l*.2),d=o||h,u=e.$valueAxis.max-e.$valueAxis.min,p=u===0?.5:(s-e.$valueAxis.min)/u,m=n+Math.sqrt(p)*(d-n);return Math.max(n,m)}$getDataPointCssClass(){return h0}};var K1="vjs-gauge-chart",q1="vjs-gauge-track",X0="vjs-gauge-zone",Q1="vjs-gauge-tick",eG="vjs-gauge-label",tG="vjs-gauge-needle",rG="vjs-gauge-needle-pivot",j0=class extends bo{constructor(e,t){var n,o,s,a,l,h;super(e,t);this.options=t;c(this,"Pt");c(this,"Po");c(this,"Re");c(this,"Te");c(this,"It");c(this,"Sc");this.Pt=(n=t.startAngle)!=null?n:-135,this.Po=(o=t.endAngle)!=null?o:135,this.Re=(s=t.innerRadius)!=null?s:.8,this.Te=(a=t.min)!=null?a:0,this.It=(l=t.max)!=null?l:100,this.Sc=(h=t.value)!=null?h:this.Te,L(e,K1),this.$draw()}getValue(){return this.Sc}setValue(e){this.Sc=e,this.$draw()}hasData(){return this.getValue()!=null}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){var fe;this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Ka,e);e.insertBefore(s,o.nextElementSibling);let a=X=>(X-90)*Math.PI/180,l=a(this.Pt),h=a(this.Po),d=Math.cos(l),u=Math.cos(l),p=Math.sin(l),m=Math.sin(l),g=[h];for(let X=-180;X<=270;X+=90){let ge=a(X);X>=this.Pt&&X<=this.Po&&g.push(ge)}g.forEach(X=>{d=Math.min(d,Math.cos(X)),u=Math.max(u,Math.cos(X)),p=Math.min(p,Math.sin(X)),m=Math.max(m,Math.sin(X))});let E=.9,y=u-d,x=m-p,f=Math.min(this.dim.chartWidth*E/y,this.dim.chartHeight*E/x),b=this.dim.chartX+this.dim.chartWidth/2-f*(u+d)/2,A=this.dim.chartY+this.dim.chartHeight/2-f*(m+p)/2,T=f*this.Re,S=b+f*Math.cos(l),R=A+f*Math.sin(l),v=b+f*Math.cos(h),O=A+f*Math.sin(h),P=b+T*Math.cos(h),I=A+T*Math.sin(h),C=b+T*Math.cos(l),_=A+T*Math.sin(l),w=this.Po-this.Pt<=180?0:1,$=[`M ${S} ${R}`,`A ${f} ${f} 0 ${w} 1 ${v} ${O}`,`L ${P} ${I}`,`A ${T} ${T} 0 ${w} 0 ${C} ${_}`,"Z"].join(" ");k(ee,{d:$,fill:"#EEE",stroke:"#CCC","stroke-width":1},q1,e);let N=(fe=this.getValue())!=null?fe:this.Te,M=Math.max(this.Te,Math.min(this.It,N)),D=this.It-this.Te,V=this.Po-this.Pt,J=this.options.showNeedle!==!1;if(this.options.zones&&this.options.zones.forEach((X,ge)=>{let Ge=X.from,Xe=X.to;if(!J){if(M<=Ge)return;Xe=Math.min(Xe,M)}let Ut=this.Pt+(Ge-this.Te)/D*V,nr=this.Pt+(Xe-this.Te)/D*V,Ht=a(Ut),vr=a(nr),Ri=b+f*Math.cos(Ht),Cs=A+f*Math.sin(Ht),Ps=b+f*Math.cos(vr),Os=A+f*Math.sin(vr),_s=b+T*Math.cos(vr),Rs=A+T*Math.sin(vr),Vc=b+T*Math.cos(Ht),Gc=A+T*Math.sin(Ht),ml=nr-Ut<=180?0:1,$c=[`M ${Ri} ${Cs}`,`A ${f} ${f} 0 ${ml} 1 ${Ps} ${Os}`,`L ${_s} ${Rs}`,`A ${T} ${T} 0 ${ml} 0 ${Vc} ${Gc}`,"Z"].join(" "),gl=X.color;if(X.gradient){let vo=e.querySelector("defs");vo||(vo=k("defs",{},"",e),e.insertBefore(vo,e.firstChild));let re=`vjs-gauge-gradient-${ge}-${Math.round(Math.random()*1e6)}`,Fe=k("linearGradient",{id:re,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},"",vo);X.gradient.stops.forEach(vt=>{k("stop",{offset:`${vt.offset}%`,"stop-color":vt.color},"",Fe)}),gl=`url(#${re})`}k(ee,{d:$c,fill:gl,stroke:"none"},`${X0} ${X0}-${ge}`,e)}),this.options.ticks){let X=[];if(this.options.ticks.values)X=this.options.ticks.values;else if(this.options.ticks.interval!=null)for(let ge=this.Te;ge<=this.It;ge+=this.options.ticks.interval)X.push(ge);X.forEach(ge=>{let Ge=this.Pt+(ge-this.Te)/D*V,Xe=a(Ge),Ut=f*.95,nr=b+f*Math.cos(Xe),Ht=A+f*Math.sin(Xe),vr=b+Ut*Math.cos(Xe),Ri=A+Ut*Math.sin(Xe);k(ee,{d:`M ${nr} ${Ht} L ${vr} ${Ri}`,stroke:this.options.ticks.color||"#666","stroke-width":this.options.ticks.width||1},Q1,e)})}if(this.options.labels){let X=[];if(this.options.labels.values)X=this.options.labels.values;else if(this.options.labels.interval!=null)for(let Ge=this.Te;Ge<=this.It;Ge+=this.options.labels.interval)X.push(Ge);let ge=f+(this.options.labels.distance||0);X.forEach(Ge=>{let Xe=this.Pt+(Ge-this.Te)/D*V,Ut=a(Xe),nr=b+ge*Math.cos(Ut),Ht=A+ge*Math.sin(Ut);k("text",{x:nr,y:Ht,"text-anchor":"middle","dominant-baseline":"central","font-size":"12px",fill:"#333"},eG,e).textContent=Ge.toString()})}if(J){let X=this.Pt+(M-this.Te)/D*V,ge=a(X),Ge=f*.9,Xe=f*.05,Ut=ge-Math.PI/2,nr=ge+Math.PI/2,Ht=b+Ge*Math.cos(ge),vr=A+Ge*Math.sin(ge),Ri=b+Xe*Math.cos(Ut),Cs=A+Xe*Math.sin(Ut),Ps=b+Xe*Math.cos(nr),Os=A+Xe*Math.sin(nr),_s=`M ${Ri} ${Cs} L ${Ht} ${vr} L ${Ps} ${Os} Z`;k(ee,{d:_s,fill:"#333",stroke:"#000","stroke-width":1},tG,e);let Rs=Xe*1.5;k("circle",{cx:b,cy:A,r:Rs,fill:"#333",stroke:"#666","stroke-width":1},rG,e)}}};var H0=class extends qn{constructor(e,t){super(e,Object.assign({},t,{inverted:!(t!=null&&t.inverted),plots:{type:Mc.type,options:t.plotOptions||{}}}));this.options=t;L(e,f0)}},tE=class tE extends Ao{constructor(e,t){super(e,t,tE.type);this.chart=e;c(this,"Ig");c(this,"Vg");this.Ig=t.stacked===!0,this.Vg=t.spline===!0}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.Ig&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var m,g;let p=(g=(m=u.values)==null?void 0:m[h])==null?void 0:g.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Dr.type);return s==null?o:s.$getBarCenter(e,t,n)}}hA(e,t){function n(a){return`C ${a.cp1.x} ${a.cp1.y}, ${a.cp2.x} ${a.cp2.y}, ${a.x2} ${a.y2} `}let o=Af(e.slice(t),.15),s=`M ${o[0].segment.x1} ${o[0].segment.y1}`;return s+=o.map(a=>n(a.segment)).join(""),s}cA(e,t){return`M ${e.slice(t).map(n=>`${n.x} ${n.y}`).join(" L ")}`}$draw(e,t,n,o){let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale,l=[],h=[],d=(u,p)=>{let m,g;return this.$inverted?(g=t.chartHeight-(p-a.minScale)/a.range*t.chartHeight,m=u):(m=t.chartWidth*((p-a.minScale)/a.range),g=u),{cx:m,cy:g}};for(let u=0;u<this.chart.$categories.length;u++)for(let p=0;p<s.length;p++){let m=this.$getValueLocation(u,p,t);l[p]=l[p]||[],h[p]=h[p]||[];let g=s[p],E=g.values[u].max,{cx:y,cy:x}=d(m,E);if(E!=null&&this.Mg(s[p],y,x,g.markerSize||10,g.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),l[p].push({x:y,y:x,hasValue:E!=null}),g.isRangeSeries()){let{cx:f,cy:b}=d(m,g.values[u].min);g.values[u].min!=null&&this.Mg(s[p],f,b,g.markerSize||10,g.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),h[p].push({x:f,y:b,hasValue:g.values[u].min!=null})}}for(let u=0;u<l.length;u++){let p=s[u].color,m=l[u].findIndex(E=>E.hasValue),g=this.Vg?this.hA(l[u],m):this.cA(l[u],m);k(ee,{stroke:p,"stroke-width":"1",d:g,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}for(let u=0;u<h.length;u++){let p=s[u].color;if(h[u].length>0){let m=h[u].findIndex(E=>E.hasValue),g=`M ${h[u].slice(m).map(E=>`${E.x} ${E.y}`).join(" L ")}`;k(ee,{stroke:p,"stroke-width":"1",d:g,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}}}Mg(e,t,n,o,s,a,l,h,d){if(e.marker){let u=Nc(e.marker,null,{[Kn]:`${l}`,[Et]:`${h}`},[yn].join(" "));d.appendChild(u);let p=u.getBBox();return u.setAttribute("transform",`translate(${t-p.width/2}, ${n-p.height/2})`),u}else{let u=qg(e,t,n,o,{fill:s,"stroke-width":"1",stroke:a,[Kn]:`${l}`,[Et]:`${h}`},[yn].join(" "));return d.appendChild(u),u}}};c(tE,"type","line");var Mc=tE;cl(Mc.type,(i,r)=>new Mc(i,r));var nG="vjs-pie-chart",rE="vjs-pie-slice",k0="vjs-pie-slice-selected",W0=class extends ol{constructor(e,t){super(e,t);this.options=t;c(this,"$dataPoints",[]);c(this,"$tooltip");c(this,"Oo");c(this,"_o");c(this,"Tc");c(this,"ti");c(this,"Re");c(this,"$realisedSeries",[]);c(this,"hn");this.Oo=t.selectedCategory,this.Tc=t.selectedSliceOffset||10,this.ti=t.interactive===!0,this.Re=t.innerRadius,this.hn=t.tooltip,this.$init(),this.load(t),this.$bind(st,z(rE),n=>{if(this.$tooltip){let o=n.target,s=o.getBBox(),a={x:s.x,y:s.y,width:s.width,height:s.height},l={x:.5,y:.5},h={x:a.x+a.width*l.x,y:a.y+a.height*l.y},{category:d,series:u}=this.Gg(o),p=this.$dataPoints[d],m=this.$realisedSeries[u];this.$tooltip.showTooltip(h,{x:.5,y:.5},m,p.label,{value:p.value})}}),this.$bind(ot,z(rE),n=>{this.$tooltip&&this.$tooltip.hide()}),this.$bind(W,z(rE),n=>{if(this.ti){let o=n.target,{category:s,series:a}=this.Gg(o);this.dA(s,a,o)}}),L(e,nG)}Gg(e){let t=parseInt(e.getAttribute(Kn),10),n=parseInt(e.parentNode.getAttribute(Et),10);return{category:t,series:n}}$recalc(){if(this.$realisedSeries.length>0){this.$dataPoints.length=0;let e=0,t=this.$realisedSeries[0],n=t.getCategories();t.values.forEach((o,s)=>{let a=o.max/t.total,l=a*2*Math.PI,h={p:a,arc:l,arcStart:e,data:n[s],label:n[s].id,value:o.max};this.$dataPoints.push(h),e+=l})}}hasData(){return this.dataSource.hasData()}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{let t=e.expand();this.$realisedSeries.push(...t)}),this.$recalc()}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){this.hn&&(this.$tooltip=new ll(e,this.hn)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Ka,e);e.insertBefore(s,o.nextElementSibling);let a={x:this.dim.chartX+this.dim.chartWidth/2,y:this.dim.chartY+this.dim.chartHeight/2},h=.35*Math.min(this.dim.chartWidth,this.dim.chartHeight),d=this.options.colors,u=this.options.color;this.$dataPoints.forEach((p,m)=>{let g=G(q,{"data-name":p.label,"data-category":m});e.appendChild(g);let E=p.arcStart,y=p.arc+p.arcStart,x=p.arcStart+p.arc/2,f=a.x+h*Math.cos(E),b=a.y+h*Math.sin(E),A=a.x+h*Math.cos(y),T=a.y+h*Math.sin(y),S=p.p>.5?1:0,R="";if(p.p>=1)if(this.Re!=null){let V=this.Re*h;R=`M ${a.x+h} ${a.y}
136
+ </svg>`,this.eventManager.on(s,Xe,a=>{a.stopPropagation(),o.onClick()}),this.eventManager.on(s,"mouseenter",()=>{s.style.backgroundColor="#f0f0f0"}),this.eventManager.on(s,"mouseleave",()=>{s.style.backgroundColor="transparent"}),this.container.appendChild(s)}),r!=null?r.appendChild(this.container):t.appendChild(this.container)}destroy(){this.container&&this.container.parentElement&&this.container.parentElement.removeChild(this.container)}};var G1="#FFFFFF",$1="#000000",B1=15,F1=15,v7e="middle",C7e="left",P7e="right",U1="top",wc="bottom",tl="middle",YL="start",zL="end",UL="#AAAAAA",Y1=1,z1="#FFFFFFCC";function X1(i){i=i||{};let r=i.backgroundColor||G1;return{gridLineColor:i.gridLineColor||UL,legendOutlineColor:i.legendOutlineColor||i.gridLineColor||UL,legendOutlineWidth:i.legendOutlineWidth||Y1,legendBackgroundColor:i.legendBackgroundColor||z1,backgroundColor:r,plotBackgroundColor:i.plotBackgroundColor||r,labelColor:i.labelColor||$1,labelColorGenerator:i.labelColorGenerator}}var Ao=class extends zt{constructor(e,t){var s,a,l,h;super();this.container=e;c(this,"style");c(this,"dim");c(this,"K",1);c(this,"Cc",[.5,3]);c(this,"Bg",!1);c(this,"$resizeObserver");c(this,"$eventManager");c(this,"colorGenerator");c(this,"$defaultColor");c(this,"$emptyMessage");c(this,"$errorMessage");c(this,"$showTitle");c(this,"$title");c(this,"$showSubtitle");c(this,"$subtitle");c(this,"$titleAlign");c(this,"$subtitleAlign");c(this,"$subtitleFontSize");c(this,"$titlePlacement");c(this,"$titleFillRatio");c(this,"$titleWrap");c(this,"$titleFontSize");c(this,"titlePadding");c(this,"margin");c(this,"legend");c(this,"Pc");c(this,"Oc");c(this,"Fg",!1);c(this,"ma");c(this,"ri");c(this,"Ct");t=t||{},this.Pc=t.width,this.Oc=t.height,this.$defaultColor=t.defaultColor,this.colorGenerator=this.$defaultColor==null?t.colorGenerator||new Xs:new Rd(this.$defaultColor),this.style=X1(t.style);let n=(s=t.controls)==null?void 0:s.exporter;if(n!=null&&n!==!1){let d=cr(n)?n:{};this.ma=new km(this,d)}if(this.dim={chartX:0,chartY:0,chartWidth:0,chartHeight:0,width:0,height:0,chartEndX:0,chartEndY:0},this.$emptyMessage=t.emptyMessage||VL,this.$errorMessage=GL,t.resizeObserver!==!1)try{this.$resizeObserver=new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.Fg&&this.$draw()})}),this.$resizeObserver.observe(e)}catch(d){U("WARN: ResizeObserver could not be attached.")}this.margin=t.margin||F1,this.$eventManager=new xe,t.title&&t.title.text!=null?(this.$showTitle=!0,this.$title=t.title.text||"",this.$titleAlign=t.title.align||"middle",this.$titleWrap=t.title.wrap!==!1,this.$titleFillRatio=t.title.fillRatio||.9,this.$titleFontSize=((a=t.title.font)==null?void 0:a.size)||20,this.$titlePlacement=t.title.placement||U1):this.$showTitle=!1,t.subtitle&&t.subtitle.text!=null?(this.$showSubtitle=!0,this.$subtitle=t.subtitle.text||"",this.$subtitleAlign=t.subtitle.align||"middle",this.$subtitleFontSize=((l=t.subtitle.font)==null?void 0:l.size)||16):this.$showSubtitle=!1,this.titlePadding=t.titlePadding||B1;let o=t.legend==null||t.legend===!0?{}:t.legend===!1?{hide:!0}:t.legend;this.legend=new jm(o),t.zoom&&t.zoom.enabled!==!1&&(this.Bg=!0,this.Cc=t.zoom.range||[.05,3],this.K=t.zoom.initialValue||1,this.container.style.overflow="auto",((h=t.controls)==null?void 0:h.zoom)!==!1&&(this.ri=new Wm(this)))}$bind(e,t,n){this.$eventManager.on(this.container,e,t,n)}getTitle(){return this.$title}exportSVG(e,t){return Eb(this,e,t).svg}exportImage(e,t){let n=Eb(this,e.width,e.height);sx(n,e,t)}destroy(){this.$resizeObserver&&(this.$resizeObserver.unobserve(this.container),this.$resizeObserver.disconnect()),this.container.innerHTML="",this.ri&&this.ri.destroy(),this.Ct&&this.Ct.parentElement&&this.Ct.parentElement.removeChild(this.Ct)}$draw(){this.Fg=!0,this.container.innerHTML="";let e=this.Pc,t=this.Oc;if(e==null||t==null){let n=window.getComputedStyle(this.container);e=e||parseInt(n.width,10),t=t||parseInt(n.height,10)}if(!isNaN(e)&&!isNaN(t)){let n=V(we,{height:t,width:e,viewBox:`0 0 ${e} ${t}`});this.container.appendChild(n);let o=k(Z,{x:0,y:0,width:e,height:t,"aria-hidden":!0,fill:this.$getBackgroundColor(),"data-z-index":"0"},hL,n);try{this.$drawChart(n,e,t,o)}catch(a){this.$drawErrorMessage(n,e,t,o)}this.hasData()||this.$drawEmptyMessage(n,e,t,o);let s=Array.from(n.childNodes);s.sort((a,l)=>{let h=a.getAttribute("data-z-index")||0,d=l.getAttribute("data-z-index")||0;return h>d?1:h<d?-1:0}),s.forEach(a=>{n.insertBefore(a,n.childNodes[n.childNodes.length])}),Hx(n,!0),this.yA()}}yA(){if(this.ma||this.ri){let e="row";this.Ct==null?this.Ct=Kr("div",{position:"absolute",right:"1rem",top:"1rem",display:"flex",flexDirection:e,alignItems:"flex-end",zIndex:"100",background:"rgba(255,255,255,0.8)",borderRadius:"4px",padding:"2px",border:"1px solid #ccc"},"vjs-chart-controls-group"):this.Ct.innerHTML="",getComputedStyle(this.container).position==="static"&&(this.container.style.position="relative"),this.container.appendChild(this.Ct),this.ri&&this.ri.render(this.Ct,e),this.ma&&this.ma.EA(this.Ct)}}$drawEmptyMessage(e,t,n,o){let s=k(et,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},db,e);s.innerHTML=this.$emptyMessage}$drawErrorMessage(e,t,n,o){let s=k(et,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},db,e);s.innerHTML=this.$errorMessage}$precomputeTitle(e,t){let n=k(Q,{},null,e);if(this.$showTitle&&(this.$title!=null||this.$subtitle!=null)){let o=k(et,{y:0,x:0,"font-size":this.$titleFontSize,"font-weight":"bold","dominant-baseline":"hanging"},vL,n);o.innerHTML=this.$title;let s=o.getBBox(),a=!1;if(s.width>t&&this.$titleWrap){let u=this.$titleFillRatio*t;o=Jp(o,this.$title,u),s=o.getBBox(),s.y<0&&o.setAttribute("y",`${-s.y}`),a=!0}let l=this.$titleAlign==="left"?this.margin:this.$titleAlign==="middle"?(t-s.width)/2:t-s.width-this.margin;if(jt(o,l,this.margin),a){let u=Array.from(o.querySelectorAll("tspan")),p=u.map(m=>m.getBBox().width),g=Math.max(...p);u.forEach((m,E)=>{m.setAttribute("x",`${(g-p[E])/2}`)})}if(this.$showSubtitle){let u=k(et,{y:s.height+10,x:0,"dominant-baseline":"hanging"},CL,n);u.innerHTML=this.$subtitle;let p=u.getBBox(),g=this.$subtitleAlign==="left"?this.margin:this.$subtitleAlign==="middle"?(t-p.width)/2:t-p.width-this.margin;jt(u,g,this.margin)}let h=n.getBBox().height,d=k(Z,{fill:"transparent",height:10,width:t,y:h,x:0},"",n);jt(d,0,this.margin)}else k(Z,{fill:"transparent",width:t,height:0},"",n),this.titlePadding=0;return n}$getBackgroundColor(){return this.style.backgroundColor}$getPlotBackgroundColor(){return this.style.plotBackgroundColor}$getLabelColor(){return this.style.labelColor}$fromPageLocation(e){let t=this.container.getBoundingClientRect(),n=e.x-window.scrollX-t.x,o=e.y-window.scrollY-t.y;return{x:n-this.dim.chartX,y:o-this.dim.chartY}}$fromEventLocation(e){let t=Ee(e);return this.$fromPageLocation(t)}getZoom(){return this.K}setZoom(e){return this.Bg&&(this.K=Math.max(this.Cc[0],Math.min(this.Cc[1],e)),this.xA()),this.K}xA(){let e=this.container.firstElementChild;e!=null&&(e.setAttribute("transform-origin","0 0"),e.setAttribute("transform",`scale(${this.K})`))}};var rl=class{load(r){r()}hasData(){return!1}},Dc=class{constructor(r){this.chart=r;c(this,"data")}hasData(){return this.data!=null&&this.data.length>0}load(r){this.data.forEach(e=>{this.chart.$__series.forEach(t=>{t.addValue(e)})}),r()}},Zm=class extends Dc{constructor(e,t){super(e);this.chart=e;this.data=t}},Jm=class extends Dc{constructor(e,t){super(e);this.chart=e;this.url=t}load(e){Aa({url:this.url,dataType:Wt,success:t=>{this.data=t,super.load(e)}})}},Nc=class extends Dc{constructor(e,t,n){super(e);this.chart=e;this.dataSource=t;this.filter=n;this.filter=n||(s=>!0),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data));let o=ba(()=>{t.reload&&t.reload(),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data)),this.chart.reload()},150);t.bind(Le,o),t.bind(Ce,o),t.bind(Kt,o),t.bind(ve,o),t.bind(Re,o),t.bind(Zt,o),t.bind(xt,o),t.bind(bt,o),t.bind(ur,o),t.bind(Jt,o)}$setFilter(e){this.filter=e||(t=>!0),this.data=this.dataSource.getNodes().filter(this.filter).map(function(t){return t.data})}};var Tr=class{};var rr=class extends Tr{constructor(e,t,n){super();c(this,"color");c(this,"min");c(this,"max");c(this,"total");c(this,"label");c(this,"id");c(this,"visible");c(this,"categories",[]);c(this,"values",[]);c(this,"valueField");c(this,"minValueField");c(this,"maxValueField");c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"Ug");c(this,"te");this.id=e.id||e.valueField,this.label=e.label,this.valueField=e.valueField,this.minValueField=e.minValueField,this.maxValueField=e.maxValueField,this.color=t,this.visible=!0,this.marker=e.marker,this.markerType=e.markerType,this.markerSize=e.markerSize,this.Ug=n,this.te=new Map,this.reset()}isRangeSeries(){return this.minValueField!=null&&this.maxValueField!=null}reset(){this.min=0,this.max=0,this.total=0,this.values.length=0,this.categories.length=0}toggleVisible(){this.visible=!this.visible}addValue(e){let t=e[this.Ug];t!=null&&Gs(this.te,t,()=>[]).push(e);let n,o;if(this.maxValueField!=null&&this.minValueField!=null)o=e[this.maxValueField],n=e[this.minValueField];else{let s=e[this.valueField],a=0;o=s<a?a:s,n=s<a?s:a}this.values.push({min:n,max:o}),n!=null&&(this.min=Math.min(this.min,n)),o!=null&&(this.max=Math.max(this.max,o)),this.total+=o,this.categories.push(e)}getCategories(){return this.categories}expand(){return[this]}};c(rr,"type","record");var j1=1,H1="rangeStart",k1="values",W1="minValues",Z1="maxValues",J1="label",K1="id",nl=class extends Tr{constructor(e,t){super();this.chart=t;c(this,"startPoint");c(this,"step");c(this,"rangeStartField");c(this,"$valuesField");c(this,"$minValuesField");c(this,"$maxValuesField");c(this,"$labelField");c(this,"$idField");c(this,"$labels");c(this,"$labelGenerator");c(this,"$series",[]);c(this,"values");this.startPoint=e.startPoint==null?0:e.startPoint,this.step=e.step==null?j1:e.step,this.rangeStartField=e.rangeStartField||H1,this.$valuesField=e.valuesField||k1,this.$minValuesField=e.minValuesField||W1,this.$maxValuesField=e.maxValuesField||Z1,this.$labelField=e.labelField||J1,this.$labelGenerator=e.labelGenerator,this.$idField=e.idField||K1,this.$labels=e.labels||[]}addValue(e){let t=e[this.$minValuesField],n=e[this.$maxValuesField],o=t!=null&&n!=null,s={id:e[this.$idField]||$(),valueField:"v",minValueField:o?"minV":null,maxValueField:o?"maxV":null,label:e[this.$labelField||""]},a=new rr(s,this.chart.colorGenerator.generate(s));if(a.reset(),o){let l=Math.max(t.length,n.length);for(let h=0;h<l;h++){let d=this.zg(h);a.addValue({minV:t,maxV:n,id:d})}}else{let l=e[this.$valuesField];l!=null&&l.forEach((h,d)=>{let u=this.bA(d,e);a.addValue({v:h,id:u})})}a.values.length>0&&this.$series.push(a)}bA(e,t){return this.$labelGenerator!=null?this.$labelGenerator(e,t):this.$labels[e]!=null?this.$labels[e]:this.zg(e)}zg(e){return`${this.startPoint+e*this.step}`}expand(){return this.$series}reset(){this.$series.length=0}};c(nl,"type","array");var il=class extends Tr{constructor(e){super();c(this,"counts",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"valueField");this.valueField=e.valueField||"value",this.color=e.color,this.label=e.label}addValue(e){let t=e[this.valueField];if(t!=null){let n=this.counts.get(t)||0;this.counts.set(t,n+1)}}reset(){this.counts.clear()}expand(){let e=new rr({valueField:"value",id:this.id,label:this.label},this.color);return this.counts.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(il,"type","collation");var ol=class extends Tr{constructor(e){super();c(this,"fields");c(this,"sums",new Map);c(this,"labels");c(this,"colors");this.fields=e.fields,this.labels=e.labels||[],this.colors=new Map,(e.colors||[]).forEach((t,n)=>{this.colors.set(this.fields[n],t)})}addValue(e){this.fields.forEach(t=>{let n=parseFloat(e[t]);if(!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}})}reset(){this.sums.clear()}expand(){let e=new rr({valueField:"value",id:$(),label:"Sum"},"#556623");return this.sums.forEach((t,n)=>{e.addValue({id:n,label:n,value:t,color:this.colors.get(n)||"#556623"})}),[e]}};c(ol,"type","summing");var sl=class extends Tr{constructor(e){super();c(this,"sums",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"categoryField");c(this,"sumField");this.categoryField=e.categoryField||"category",this.sumField=e.sumField||"value"}addValue(e){let t=e[this.categoryField],n=parseFloat(e[this.sumField]);if(t!=null&&!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}}reset(){this.sums.clear()}expand(){let e=new rr({valueField:"value",id:this.id,label:this.label},this.color);return this.sums.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(sl,"type","summing-collation");var al=class extends Ao{constructor(e,t){super(e,t);c(this,"dataSource");c(this,"$__series",[]);c(this,"$focusedSeries");c(this,"seriesElements");c(this,"$model");c(this,"$modelFilter");c(this,"$grouped");c(this,"$groupField");c(this,"Yg");this.dataSource=new rl,this.Yg=t.series||[],this.$grouped=t.grouped===!0,this.$groupField=t.groupField||"group",this.$model=t.dataSource,this.$modelFilter=t.dataSourceFilter}$init(){this.Yg.forEach(e=>{if(e.type==null||e.type===rr.type){let t=new rr(e,e.color||this.colorGenerator.generate(e),this.$groupField);this.$__series.push(t)}else if(e.type===nl.type){let t=new nl(e,this);this.$__series.push(t)}else if(e.type===il.type){let t=new il(e);this.$__series.push(t)}else if(e.type===sl.type){let t=new sl(e);this.$__series.push(t)}else if(e.type===ol.type){let t=new ol(e);this.$__series.push(t)}})}load(e,t){e.data?this.dataSource=new Zm(this,e.data):e.dataSource?this.dataSource=new Nc(this,e.dataSource,e.dataSourceFilter):e.url&&(this.dataSource=new Jm(this,e.url)),this.$load(t)}setDataSourceFilter(e){this.$modelFilter=e,this.dataSource instanceof Nc&&(this.dataSource.$setFilter(e),this.$load())}reload(){this.$load()}$reset(){this.$doReset()}$load(e){this.$reset(),this.dataSource.load(()=>{this.$doLoad(),this.$draw(),this.fire(Hm,this),e&&e(this)})}hasData(){return this.dataSource.hasData()}};var Kn="data-vjs-chart-category",Et="data-vjs-chart-series",Km="data-vjs-chart-stack",qm="data-vjs-chart-stack-total",Qm="data-vjs-chart-value",O9e="data-vjs-filter",ar="start",_i="end",Oi=2,eE=5,XL=10,Ab=20,tE=14,jL=14,rE="normal",HL="normal";var kL=["b","br","em","strong"],q1="vjs-tooltip",hl=class extends hs{constructor(e){super({formatter:(t,n)=>Hc(t)?TT(t,n||"%d"):t});c(this,"$adt");this.parseAndValidate(e.format)}parseAndValidate(e){try{let t=o=>{if(o.type===zr.type&&kL.indexOf(o.tag)===-1)throw U(`Unsupported element ${o.tag} in tooltip format. Supported elements are [${kL.join(" ")}]`),"error"},n=this.parse(e);n.filter(o=>o.type!==ia.type).forEach(t),this.$adt=n}catch(t){U(`VisuallyJs - WARN: Cannot parse tooltip format ${e}`)}}ce(e){switch(e){case"b":case"strong":let t=V("tspan");return L(t,"vjs-b"),t.style.fontWeight="bold",t;case"i":case"em":let n=V("tspan");return n.style.fontStyle="italic",n;case"br":let o=V("tspan");return L(o,"vjs-br"),o.textContent="\u200B",o}}renderTooltip(e){return this.render(this.$adt,e)}},ll=class{constructor(r,e){this.parentElement=r;c(this,"root");c(this,"g");c(this,"bg");c(this,"text");c(this,"$parser");c(this,"$paddingX",8);c(this,"$paddingY",10);c(this,"$valueSuffix");c(this,"_c");c(this,"Xg");var n,o,s,a;if(this.$parser=new hl(e),this.$valueSuffix=e.valueSuffix,this._c=e.timeout==null?2500:e.timeout,this.g=V(Q,{"pointer-events":"none"},{},q1),wt(r)){this.root=this.g;let l=r,h=l.querySelector("defs");h==null&&(h=V("defs"),l.insertBefore(h,l.childNodes[0]));let d=V("filter",{x:"-20%",y:"-20%",width:"140%",height:"140%",id:"vjs-tooltip-shadow"}),u=V("feDropShadow",{dx:2,dy:2,stdDeviation:3,"flood-color":"rgba(0,0,0,0.5)"});d.appendChild(u),h.appendChild(d),this.g.setAttribute("filter","url(#vjs-tooltip-shadow)")}else this.root=V(we),this.root.appendChild(this.g);this.bg=V(Z,{fill:e.fill||"#FFFFFF",stroke:e.outline||"#999999","stroke-width":e.outlineWidth||1,"data-z-index":"1000",rx:e.cornerRadius==null?3:e.cornerRadius}),this.g.appendChild(this.bg);let t={"font-size":((n=e.font)==null?void 0:n.size)||"0.8rem","dominant-baseline":"hanging",x:`${this.$paddingX}`,y:`${this.$paddingY}`};(o=e.font)!=null&&o.family&&(t["font-family"]=e.font.family),(s=e.font)!=null&&s.style&&(t["font-style"]=e.font.style),(a=e.font)!=null&&a.weight&&(t["font-weight"]=e.font.weight),e.textColor&&(t.fill=e.textColor),this.text=V(et,t),this.g.appendChild(this.text),r.appendChild(this.root)}AA(){this._c!==-1&&(clearTimeout(this.Xg),this.Xg=setTimeout(()=>this.hide(),this._c))}$renderTooltip(r){this.text.innerHTML="",this.parentElement.insertBefore(this.root,null);let e=this.$parser.renderTooltip(r),t=2;this.text.appendChild(e.fragment);let n=this.text.getBBox().height+t,o=n;Array.from(this.text.querySelectorAll("tspan.vjs-br")).forEach(h=>{h.setAttribute("dy",`${n}`),h.setAttribute("x",`${this.$paddingX}`),h.getBBox().height===0?n=o:n=h.getBBox().height+t});let s=this.text.getBBox(),a=s.width+2*this.$paddingX,l=s.height+2*this.$paddingY;this.bg.setAttribute("x","0"),this.bg.setAttribute("width",`${a}`),this.bg.setAttribute("y","0"),this.bg.setAttribute("height",`${l}`)}formatValue(r){return r==null?null:this.$valueSuffix==null?`${r}`:`${r} ${this.$valueSuffix}`}show(r,e,t){if(this.$parser.$adt!=null){this.$renderTooltip(t);let n=this.g.getBBox(),o=Je(this.parentElement),s=r.x-n.width*e.x,a=r.y-n.height*e.y,l=5;s=Math.max(l,Math.min(s,o.width-n.width)-l),a=Math.max(l,Math.min(a,o.height-n.height)-l);let h={x:s,y:a};Ie(this.root,h),this.AA()}}hide(){this.root&&this.root.parentElement&&this.parentElement.removeChild(this.root)}},cl=class extends ll{showTooltip(r,e,t,n,o){let s={series:t,category:n,point:{value:this.formatValue(o.value),rawValue:o.value,minValue:this.formatValue(o.minValue),rawMinValue:o.minValue,maxValue:this.formatValue(o.maxValue),rawMaxValue:o.maxValue,stackTotal:o.stackTotal},stack:o.stackId?{id:o.stackId,total:o.stackTotal}:null};super.show(r,e,s)}},nE=class extends ll{showTooltip(r,e,t,n){super.show(r,e,{series:t,point:n})}};var Ic=class{constructor(){c(this,"dataMax",0);c(this,"dataMin",0);c(this,"maxScale",0);c(this,"minScale",0);c(this,"range",0);c(this,"step",0);c(this,"stepCount",0);c(this,"steps",[])}},dl=class extends al{constructor(e,t){super(e,t);c(this,"axisLineSize");c(this,"yAxisPadding");c(this,"yAxes");c(this,"xAxes");c(this,"$crosshairElements",{x:[],y:[]});c(this,"$roundCorners");c(this,"$cornerRadius");c(this,"$realisedSeries",[]);c(this,"cn");c(this,"$tooltip");c(this,"$maxLabelSize");this.cn=t.tooltip,this.axisLineSize=t.axisLineSize||Oi,this.yAxisPadding=t.yAxisPadding||XL,this.$roundCorners=t.roundCorners!==!1,this.$cornerRadius=t.cornerRadius||eE,this.dataSource=new rl,this.$maxLabelSize=t.maxLabelSize||.2,this.$init(),this.$bind(st,z(bn),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s),this.$mouseOverChartPoint(o,s,n)}),this.$bind(ot,z(bn),n=>{this.setFocusedSeries(null),this.$mouseOutChartPoint(),this.$hideTooltip()}),this.legend.hover&&(this.$bind(st,z(Bm),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s)}),this.$bind(ot,z(Bm),n=>{this.setFocusedSeries(null)}))}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{e.expand().forEach(n=>{this.$realisedSeries.push(n)})})}getSeries(){return this.$realisedSeries}SA(e,t){e.showLine!==!1&&(e.lineElement=k(Z,{height:this.axisLineSize,y:-this.yAxisPadding,x:-(this.axisLineSize/2+this.yAxisPadding)},hb,t)),e.titleElement=k(Q,{},"",t),e.title!=null&&(jt(e.titleElement,0,e.titlePadding),k(Z,{height:this.legend.padding,fill:"transparent",width:10},"",e.titleElement),Os(e.title,{"text-anchor":this.jg(e),"dominant-baseline":"hanging",y:this.legend.padding},[cb,mL].join(" "),e.titleElement))}jg(e){return e.titleAlign===YL?"start":e.titleAlign===zL?"end":"middle"}TA(e,t){e.titleElement=k(et,{y:0,x:0,"text-anchor":this.jg(e)},[cb,gL].join(" "),e.element),e.title&&(e.titleElement.innerHTML=e.title);let n=e.titleElement.getBBox(),o=n.height/2;e.titleElement.setAttribute(ee,`${o}`);let s=[],a=0;if(e.labels.forEach(u=>{let p=u.getBBox().width;a=Math.max(a,p),s.push([u,p])}),e.position===ar)s.forEach(u=>u[0].setAttribute(ee,`${n.height+10+(a-u[1])}`));else{s.forEach(p=>p[0].setAttribute(ee,"0"));let u=o+a+this.yAxisPadding;e.titleElement.setAttribute(ee,`${u}`)}let l=e.titleAlign==="start"?t.height:e.titleAlign==="end"?0:t.height/2;e.titleElement.setAttribute(ye,`${l}`);let h=e.position===ar?270:90;e.titleElement.setAttribute("transform",`rotate(${h}, ${e.titleElement.getAttribute(ee)}, ${l})`),e.showLine!==!1&&(e.lineElement=k(Z,{width:this.axisLineSize,height:t.height+this.axisLineSize/2,y:0,x:n.height+a+10+10},hb,e.element))}$computeScaleLabel(e,t){if(t.labelFormatter)return t.labelFormatter(e);let n=`${e}`;return t.labelPrefix&&(n=t.labelPrefix+n),t.labelSuffix&&(n=n+t.labelSuffix),n}$precomputeLegend(e,t,n,o){let s=k(Q,{"data-z-index":100},dL,e);if(this.legend.visible&&(this.$realisedSeries.length>1||this.legend.$hideForSingleSeries===!1)){let a=k(Z,{height:1,rx:2,fill:this.style.legendBackgroundColor,stroke:this.style.legendOutlineColor,"stroke-width":this.style.legendOutlineWidth,width:1},"",s),l=2,h=[],d=0;this.$realisedSeries.forEach((g,m)=>{let E=k(Q,{[Et]:m},Bm,s),y=k(et,{y:d,"text-anchor":"start",x:l+19,"dominant-baseline":"hanging","font-size":this.legend.font.size,"font-weight":this.legend.font.weight||"normal","font-style":this.legend.font.style||"normal"},uL,E);y.innerHTML=g.label;let x=y.getBBox();k(Z,{rx:6,ry:6,width:12,height:12,fill:g.color,x:l,y:d},pL,E),s.appendChild(E),h.push([y,E,x]),this.legend.orientation===fb?l+=x.width+21+5:d+=x.height+5});let u=s.getBBox(),p=10;if(a.setAttribute(_e,`${u.width+2*p}`),a.setAttribute(Ve,`${u.height+2*p}`),a.setAttribute("transform",`translate(-${p}, -${p})`),!this.legend.floating){let g=this.legend.align===xb?t/2-u.width/2:this.legend.align===yb?this.margin:t-u.width-this.margin,m=this.legend.valign===bb?n-u.height-this.margin:this.legend.valign===Rc?o:(n-u.height)/2;jt(s,g,m)}}return s}$getScaleGrid(e,t){let n=t.useSeriesTotal?t.stackedScale:t.scale,o=n.step/n.range;return n.steps.map((s,a)=>{let l=o*e*a;return e-l})}$getAxisLabels(e,t){return An(e)?this.vA(e,t):[]}$drawChart(e,t,n,o){this.$recalc(),this.cn&&(this.$tooltip=this.$createTooltip(e,this.cn)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Qa,e);e.insertBefore(s,o.nextElementSibling);let a=`vjs-plot-clip-${_o()}`,l=k("defs",{},null,e),h=k("clipPath",{id:a},null,l);k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight},null,h);let d=k(Q,{"clip-path":`url(#${a})`},Sc,e),u=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:"transparent","data-z-index":"0"},null,d);u.addEventListener(ae,p=>{let g=this.$fromEventLocation(p);this.$onMouseMove(g)}),u.addEventListener(fS,()=>{this.$onMouseLeave()}),this.$drawCrosshairs(d,!0,_L,p=>!An(p)),this.seriesElements=this.$realisedSeries.map((p,g)=>k(Q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,[Et]:`${g}`},cL,d)),this.$drawCrosshairs(d,!1,PL,p=>An(p))}$drawCrosshairs(e,t,n,o){t&&(this.$crosshairElements={x:[],y:[]}),this.xAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:l.width||1,height:this.dim.chartHeight,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${Tc} ${n}`,e),p;if(l.showLabel!==!1&&An(s)){let g={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(g["font-style"]=l.labelFont.style),p=Os("",g,vc,e)}this.$crosshairElements.x.push({line:u,label:p,options:l})}}),this.yAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:this.dim.chartWidth,height:l.width||1,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${Tc} ${n}`,e),p;if(l.showLabel!==!1&&An(s)){let g={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(g["font-style"]=l.labelFont.style),p=Os("",g,vc,e)}this.$crosshairElements.y.push({line:u,label:p,options:l})}})}$drawDecoration(e,t,n){let o=k(Q,{},null,e),s=k(Q,{},null,e),a=k(Q,{},null,e),l=k(Q,{},null,e),{yAxes:h,yAxesAtStart:d,yAxesAtEnd:u}=this.$_generateYAxes(),{xAxes:p,xAxesAtStart:g,xAxesAtEnd:m}=this.$_generateXAxes();this.yAxes=h,this.xAxes=p;let E=this.$precomputeTitle(e,t),y=E.getBBox(),x=this.margin,f=this.$titlePlacement===wc?this.margin:x+y.height,b=this.$precomputeLegend(e,t,n,f),A=this.legend.floating?Oc():b.getBBox(),T=(D,G)=>{let J=0;for(let fe=0;fe<D.length;fe++){let X=D[fe];X.element=k(Q,{"font-size":X.font.size,"font-face":X.font.style,fill:X.labelColor},[el,Fm].join(" "),G),X.labelsElement=k(Q,{},lb,X.element),X.labels=this.$getAxisLabels(X,!0),this.SA(X,X.element);let me=X.element.getBBox();X.dim=me,J+=me.height+this.yAxisPadding}};T(g,a),T(m,l);let S=this.$titlePlacement===wc?this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===Rc?A.height:0):x+y.height+this.titlePadding,O=()=>{let D=a.getBBox(),G=l.getBBox(),J=n-this.margin-y.height-this.titlePadding-D.height-this.yAxisPadding-this.yAxisPadding-G.height-(this.legend.visible&&!this.legend.floating?this.legend.padding:0)-(this.legend.valign===Lc?0:A.height)-this.margin,fe=(this.$titlePlacement===wc?this.margin:S)+D.height+this.yAxisPadding+(this.legend.valign===Rc?A.height:0);return{chartHeight:J,chartY:fe}},{chartHeight:v,chartY:_}=O(),P=(D,G)=>{let J=0;for(let fe=0;fe<D.length;fe++){let X=D[fe];X.element=k(Q,{"font-size":X.font.size,"font-face":X.font.style,fill:X.labelColor},[el,Um].join(" "),G),X.labelsElement=k(Q,{},lb,X.element),X.labels=this.$getAxisLabels(X,!1),this.TA(X,{y:_,height:v});let me=X.element.getBBox();jt(X.element,J-me.x,0),X.dim=me,J+=me.width+this.yAxisPadding}};P(d,o),P(u,s);let I=o.getBBox(),C=this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===Lc&&this.legend.align===yb?this.legend.padding+A.width:0);jt(o,C,0);let R=C+I.width+this.yAxisPadding,w=t-R-(this.legend.visible&&!this.legend.floating&&this.legend.valign===Lc&&this.legend.align===ML?this.legend.padding+A.width:0)-this.margin;if(u.length>0){let D=s.getBBox();jt(s,R+w+this.yAxisPadding-D.width,0),w-=this.margin+this.yAxisPadding+D.width}p.forEach(D=>{D.lineElement!=null&&D.lineElement.setAttribute(_e,`${w-this.axisLineSize+(this.axisLineSize/2+this.yAxisPadding)}`)});let B=R+w,N=_+v,M={chartWidth:w,chartHeight:v,chartX:R,chartY:_,chartEndX:B,chartEndY:N,width:t,height:n};if(this.$titlePlacement===wc){let D=l.getBBox(),G=this.legend.visible&&!this.legend.floating&&this.legend.valign!==Rc&&this.legend.valign!==Lc?A.height+this.legend.padding:0;if(G>0){let fe=M.chartY+M.chartHeight+this.yAxisPadding+D.height+this.legend.padding;_c(b,fe)}let J=M.chartY+M.chartHeight+this.yAxisPadding+D.height+G+this.titlePadding-this.margin;jt(E,0,J)}for(let D=0;D<p.length;D++){let G=p[D].titleAlign==="start"?0:p[D].titleAlign==="end"?w:w/2;jt(p[D].titleElement,G,p[D].title!=null?p[D].titlePadding:0),An(p[D])?this.CA(M,p[D]):this.PA(M,p[D].labels);let J=this.$maxLabelSize*M.height;if(IL(p[D].labels,J,"height","width")){let X=p[D].labelsElement.getBBox();p[D].titleElement&&_c(p[D].titleElement,X.y+X.height+this.yAxisPadding);let{chartHeight:me,chartY:$e}=O();M.chartHeight=me,M.chartY=$e,M.chartEndY=$e+me}}jt(a,M.chartX,S),jt(l,M.chartX,M.chartY+M.chartHeight+this.yAxisPadding),_c(o,M.chartY),_c(s,M.chartY);for(let D=0;D<h.length;D++)h[D].lineElement&&h[D].lineElement.setAttribute(Ve,`${M.chartHeight}`),An(h[D])?this.OA(M,h[D].labels,h[D]):this._A(M,h[D].labels);if(this.hasData()){if(this.$getXAxisType()==="value")for(let D=0;D<p.length;D++){let G=p[D];G.showGrid&&this.RA(e,M,G)}if(this.$getYAxisType()==="value")for(let D=0;D<h.length;D++){let G=h[D];G.showGrid&&this.LA(e,M,G)}}if(this.legend.visible&&this.legend.floating){let D=M.chartX+M.chartWidth-b.getBBox().width,G=M.chartY;jt(b,D,G)}return M}setFocusedSeries(e){this.seriesElements.forEach((t,n)=>{e!=null&&n!=e?t.setAttribute("opacity","0.2"):t.setAttribute("opacity","1")}),this.$focusedSeries=e}PA(e,t){let n=e.chartWidth/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(ee,`${o*n+n/2}`)}CA(e,t){let n=this.$getScaleGrid(e.chartWidth,t).reverse();t.inverted&&(n=n.reverse());for(let o=0;o<t.labels.length;o++)t.labels[o].setAttribute(ee,`${n[o]}`)}_A(e,t){let n=e.chartHeight/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(ye,`${o*n+n/2}`)}vA(e,t){let n=[],o=e.useSeriesTotal?e.stackedScale:e.scale;return o.steps.forEach((s,a)=>{let l=t?{"text-anchor":a===o.stepCount?"end":"middle","dominant-baseline":"hanging",x:0,y:0}:{x:0,y:0,"dominant-baseline":"middle"},h=this.$computeScaleLabel(s,e),d=Os(h,l,OL,e.labelsElement);if(e.labelColorGenerator){let u=e.labelColorGenerator(s,a);u!=null&&d.setAttribute("fill",u)}n.push(d)}),n}OA(e,t,n){let o=this.$getScaleGrid(e.chartHeight,n);n.inverted&&(o=o.reverse());for(let s=0;s<t.length;s++)t[s].setAttribute(ye,`${o[s]}`)}RA(e,t,n){let o=this.$getScaleGrid(t.chartWidth,n),s=k(Q,{transform:`translate(${t.chartX}, ${t.chartY})`},ub,e);for(let a=0;a<o.length;a++)k(Z,{height:t.chartHeight,x:o[a],y:0,width:1,fill:this.style.gridLineColor},pb,s)}LA(e,t,n){let o=this.$getScaleGrid(t.chartHeight,n),s=k(Q,{transform:`translate(${t.chartX}, ${t.chartY})`},ub,e);for(let a=0;a<o.length;a++)k(Z,{width:t.chartWidth,y:o[a],x:0,height:1,fill:this.style.gridLineColor},pb,s)}$onMouseMove(e){this.xAxes.forEach((t,n)=>{let o=this.$crosshairElements.x[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.x,this.dim.chartWidth);if(h!=null){if(An(t)){let d=this.dim.chartX+h*this.dim.chartWidth;if(s.setAttribute(ee,`${d}`),a){let u=t,p=u.scale.minScale+h*(u.scale.maxScale-u.scale.minScale),g=l.labelValueFormat!==void 0?mb(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new hl({format:l.labelFormat}).renderTooltip({value:g,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=g;let m=a.getBBox(),E=d+m.width+5<this.dim.chartX+this.dim.chartWidth?d+5:d-m.width-5,y;l.labelPosition==="end"?y=this.dim.chartY+5+m.height/2:y=this.dim.chartY+this.dim.chartHeight-5-m.height/2,a.setAttribute(ee,`${E}`),a.setAttribute(ye,`${y}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartWidth/t.labels.length;s.setAttribute(_e,`${d}`);let u=Math.floor(e.x/d);s.setAttribute(ee,`${this.dim.chartX+u*d}`)}s.setAttribute(ye,`${this.dim.chartY}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}}),this.yAxes.forEach((t,n)=>{let o=this.$crosshairElements.y[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.y,this.dim.chartHeight,!0);if(h!=null){if(An(t)){let d=this.dim.chartY+h*this.dim.chartHeight;if(s.setAttribute(ye,`${d}`),a){let u=t,p=u.scale.maxScale-h*(u.scale.maxScale-u.scale.minScale),g=l.labelValueFormat!==void 0?mb(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new hl({format:l.labelFormat}).renderTooltip({value:g,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=g;let m=a.getBBox(),E=d-m.height-5>this.dim.chartY?d-5:d+m.height+5,y;l.labelPosition==="end"?y=this.dim.chartX+this.dim.chartWidth-5-m.width/2:y=this.dim.chartX+5+m.width/2,a.setAttribute(ee,`${y}`),a.setAttribute(ye,`${E}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartHeight/t.labels.length;s.setAttribute(Ve,`${d}`);let u=Math.floor(e.y/d);s.setAttribute(ye,`${this.dim.chartY+u*d}`)}s.setAttribute(ee,`${this.dim.chartX}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}})}$onMouseLeave(){this.$crosshairElements.x.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")}),this.$crosshairElements.y.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")})}$getProportionalPos(e,t,n,o=!1){if(t<0||t>n)return null;if(An(e))return t/n;{let s=e.labels.length;if(s===0)return null;let a=1/s;return Math.floor(t/(n/s))*a+a/2}}$hideTooltip(){this.$tooltip&&this.$tooltip.hide()}};function Mc(i){return typeof i=="number"&&Number.isFinite(i)}function WL(i,r){if(r==null)return null;let e=r.min,t=r.max;return!Mc(e)||!Mc(t)?null:e<=t?{min:e,max:t}:{min:t,max:e}}function Q1(i){var e,t,n;let r={};for(let o of i)if(o!=null)for(let[s,a]of Object.entries(o)){let l=WL(s,a);if(l==null)continue;let h=r[s];h==null?r[s]={min:l.min,max:l.max,step:a.step,stepCount:a.stepCount,minLimit:a.minLimit,maxLimit:a.maxLimit}:r[s]={min:Math.min(h.min,l.min),max:Math.max(h.max,l.max),step:(e=h.step)!=null?e:a.step,stepCount:h.stepCount,minLimit:(t=h.minLimit)!=null?t:a.minLimit,maxLimit:(n=h.maxLimit)!=null?n:a.maxLimit}}return r}function eG(i,r){if(r==null)return i;let e=rn({},i);for(let[t,n]of Object.entries(r)){if(n==null)continue;let o=e[t],s=Mc(n.min),a=Mc(n.max),l=Mc(n.step);if(!s&&!a&&!l)continue;let h=o!=null?rn({},o):{min:s?n.min:a?n.max:0,max:a?n.max:s?n.min:0};s&&(h.min=n.min,h.minLimit=n.min),a&&(h.max=n.max,h.maxLimit=n.max),l&&(h.step=n.step),e[t]=h.min<=h.max?h:Yc(rn({},h),{min:h.max,max:h.min,minLimit:h.maxLimit,maxLimit:h.minLimit})}return e}function tG(i){let r={};for(let[e,t]of Object.entries(i)){let n=WL(e,t);n!=null&&(t.step!=null?r[e]=Pc(n.min,n.max,t.step):t.stepCount!=null?r[e]=DL(n.min,n.max,t.stepCount):r[e]=Cc(n.min,n.max,6,t.minLimit,t.maxLimit))}return r}function ZL(i){let r=Q1(i.extentsList),e=eG(r,i.overrides),t=tG(e);return{extents:e,scales:t}}var Sb=class{constructor(r,e,t){this.chart=r;this.type=t;c(this,"$valueAxis");this.$valueAxis=(e==null?void 0:e.valueAxis)||be}getDomainExtents(){return{}}},So=class extends Sb{get $inverted(){return this.chart.$getXAxisType()!=="value"}},Tb=new Map;function ul(i,r){Tb.set(i,r)}function JL(i,r,e){if(Tb.has(i))return Tb.get(i)(r,e)}function pl(i){return i.stacked===!0||i.stacked==="percent"||i.stacked==="default"}var gl=class extends Tr{constructor(e,t,n,o,s,a,l,h,d,u){super();this.xAxisField=e;this.yAxisField=t;c(this,"$data",[]);c(this,"$xAxis",{min:1/0,max:-1/0});c(this,"$yAxis",{min:1/0,max:-1/0});c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"color");c(this,"outline");c(this,"outlineWidth");c(this,"outlineColor");c(this,"resolveMarker");this.marker=n,this.markerType=o,this.markerSize=s,this.color=a,this.outline=l!==!1,this.outlineWidth=h||1,this.outlineColor=d,this.resolveMarker=u}reset(){this.$data=[],this.$xAxis={min:1/0,max:-1/0},this.$yAxis={min:1/0,max:-1/0}}addValue(e){let t=e[this.xAxisField],n=e[this.yAxisField];t!=null&&n!=null&&(this.$data.push(e),this.$xAxis.min=Math.min(this.$xAxis.min,t),this.$xAxis.max=Math.max(this.$xAxis.max,t),this.$yAxis.min=Math.min(this.$yAxis.min,n),this.$yAxis.max=Math.max(this.$yAxis.max,n))}expand(){return[]}};function rG(i){return{position:i,showLine:!1,showGrid:!0,id:be}}function nG(i){return{position:i,id:be}}var qn=class extends dl{constructor(e,t){super(e,t);c(this,"$valueAxes");c(this,"$valueAxesMin");c(this,"$valueAxesMax");c(this,"$categoryAxes");c(this,"$inverted");c(this,"Po");c(this,"Oo");c(this,"$categories",[]);c(this,"$plots",[]);c(this,"kg");this.Po=t.valueAxis,this.Oo=t.categoryAxis,this.$inverted=t.inverted===!0,this.kg=t.pivot===!0;let n=t.plots;n!=null&&(Array.isArray(n)?n:[n]).forEach(s=>{let a=JL(s.type,this,s.options||{});this.$plots.push(a)}),this.load(t)}wA(e,t,n){let o=[];return this.$categories.forEach((s,a)=>{let l=n?{x:0,y:0,"text-anchor":"middle","dominant-baseline":"hanging"}:{"dominant-baseline":"middle","text-anchor":"start",x:0,y:0},h=Os(s[t],l,"",e);o.push(h)}),o}$getAxisLabels(e,t){return NL(e)?this.wA(e.labelsElement,e.labelField,t):super.$getAxisLabels(e,t)}DA(){var t,n,o;this.$categoryAxes=[];let e=this.Oo==null?[nG(this.$inverted?_i:ar)]:Array.isArray(this.Oo)?this.Oo:[this.Oo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?be:$(),h={showLine:a.showLine===!0,lineSize:a.lineSize||Oi,labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,id:l,labelField:a.labelField||"id",title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||tl,titlePadding:((o=a.title)==null?void 0:o.padding)||Ab,position:a.position||(this.$inverted?_i:ar),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,type:"category",titleElement:null,labelsElement:null,font:Pi(jL,HL,"normal","sans-serif",a.font),crosshair:a.crosshair};this.$categoryAxes.push(h)}}$doReset(){super.$doReset(),this.$categories.length=0}NA(){if(this.$realisedSeries.length>0){let e=new Xs,t=this.$realisedSeries.map(l=>[l.label,l.valueField,l.minValueField,l.maxValueField]),n=this.$realisedSeries[0],o=n.getCategories(),s=n.isRangeSeries(),a=[];o.forEach(l=>{let h=s?{id:l.id,label:l.id,minValueField:"min",maxValueField:"max"}:{id:l.id,label:l.id,valueField:"value"},d=new rr(h,e.generate(),this.$groupField),u=l[this.$groupField],p=n.te.has(u);t.forEach(m=>{let E=o.find(y=>y.id===l.id);E&&(s?d.addValue({id:m[0],min:E[m[2]],max:E[m[3]]}):d.addValue({id:m[0],value:E[m[1]]}))});let g=d;p&&(g.stack=u),a.push(g)}),this.$realisedSeries=a}}$doLoad(){super.$doLoad(),(this.$grouped||this.kg)&&this.NA(),this.$realisedSeries.length>0&&(this.$categories=this.$realisedSeries[0].getCategories().slice())}$recalc(){this.DA(),this.IA();let e=this.$plots.map(o=>o.getDomainExtents()),t={};this.$valueAxes.forEach(o=>{t[o.domain]={min:o.min,max:o.max,step:o.step},o.stackedDomain&&(t[o.stackedDomain]={min:o.min,max:o.max,step:o.step})});let{scales:n}=ZL({extentsList:e,overrides:t});this.$valueAxes.forEach(o=>{o.scale=n[o.domain],o.stackedScale=o.stackedDomain!=null&&n[o.stackedDomain]!=null?n[o.stackedDomain]:o.scale})}IA(){var t,n,o;this.$valueAxes=[],this.$valueAxesMax=null,this.$valueAxesMin=null;let e=this.Po==null?[rG(this.$inverted?ar:_i)]:Array.isArray(this.Po)?this.Po:[this.Po];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?be:$(),h=this.$plots.find(p=>p.$valueAxis===l&&pl(p))!=null,d=this.$plots.find(p=>p.$valueAxis===l&&p.stacked==="percent")!=null,u={domain:this.$inverted?"y":"x",stackedDomain:this.$inverted?"yStacked":"xStacked",labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,min:a.min,max:a.max,showLine:a.showLine===!0,lineSize:a.lineSize||Oi,showGrid:a.showGrid!==!1,gridLineSize:a.gridLineSize||Oi,id:l,title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||tl,titlePadding:((o=a.title)==null?void 0:o.padding)||Ab,position:a.position||(this.$inverted?ar:_i),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,useSeriesTotal:h,type:"value",titleElement:null,labelsElement:null,font:Pi(tE,rE,"normal","sans-serif",a.font),scale:new Ic,stackedScale:new Ic,crosshair:a.crosshair,isPercent:d,step:a.step,labelPrefix:a.labelPrefix,labelSuffix:d&&a.labelSuffix==null&&a.labelFormatter==null?"%":a.labelSuffix,labelFormatter:a.labelFormatter};this.$valueAxes.push(u),a.min!=null&&(this.$valueAxesMin=this.$valueAxesMin==null?a.min:Math.min(a.min,this.$valueAxesMin)),a.max!=null&&(this.$valueAxesMax=this.$valueAxesMax==null?a.max:Math.max(a.max,this.$valueAxesMax))}}$_generateYAxes(){return this.$inverted?{yAxes:this.$valueAxes,yAxesAtStart:this.$valueAxes.filter(e=>e.position===ar),yAxesAtEnd:this.$valueAxes.filter(e=>e.position===_i)}:{yAxes:this.$categoryAxes,yAxesAtStart:this.$categoryAxes.filter(e=>e.position===ar),yAxesAtEnd:this.$categoryAxes.filter(e=>e.position===_i)}}$_generateXAxes(){return this.$inverted?{xAxes:this.$categoryAxes,xAxesAtStart:this.$categoryAxes.filter(e=>e.position===ar),xAxesAtEnd:this.$categoryAxes.filter(e=>e.position===_i)}:{xAxes:this.$valueAxes,xAxesAtStart:this.$valueAxes.filter(e=>e.position===ar),xAxesAtEnd:this.$valueAxes.filter(e=>e.position===_i)}}$drawChart(e,t,n,o){super.$drawChart(e,t,n,o),this.$plots.forEach(s=>s.$draw(e,this.dim,this.$valueAxesMin,this.$valueAxesMax))}VA(e,t){return(t?e.chartHeight:e.chartWidth)/this.$categories.length}$getCategoryCenter(e,t,n){let o=this.VA(t,n);return o*e+o/2}$mouseOverChartPoint(e,t,n){let o=this.$fromEventLocation(n),s=parseInt(e.getAttribute(Kn),10),a=e.getAttribute(Km),l=e.getAttribute(qm),h=e.getAttribute(Qm);this.$maybeShowTooltip(t,s,{x:o.x+this.dim.chartX,y:o.y+this.dim.chartY},{x:.5,y:1},a,l!=null?parseFloat(l):null,h!=null?parseFloat(h):null)}$mouseOutChartPoint(){}$maybeShowTooltip(e,t,n,o,s,a,l){if(this.$tooltip!=null){let h=this.$realisedSeries[e],d=this.$categories[t],u=d[h.valueField];l!=null&&(u=l);let p=d[h.minValueField],g=d[h.maxValueField];this.$tooltip.showTooltip(n,o,h,d.id,{value:u,minValue:p,maxValue:g,stackTotal:a,stackId:s})}}$getXAxisType(){return this.$inverted?"category":"value"}$getYAxisType(){return this.$inverted?"value":"category"}$createTooltip(e,t){return new cl(e,t)}};var iG=Ar(),KL={square:(i,r,e)=>V(Z,{x:r-i/2,y:e-i/2,width:i,height:i}),circle:(i,r,e)=>V(Fe,{cx:r,cy:e,r:i/2}),cross:(i,r,e)=>V(q,{d:`M ${r} ${e-i/2} v ${i} M ${r-i/2} ${e} h ${i}`,"stroke-width":2,stroke:"#000000",fill:"#000000"})};function iE(i,r,e,t,n,o){let s=i.markerType||"circle",l=(KL[s]||KL.circle)(t,r,e);if(n)for(let h in n)l.setAttribute(h,n[h]);return o&&L(l,o),l}function Vc(i,r,e,t){let o=iG.template($(),r||{},s=>i).childNodes[0];if(e)for(let s in e)o.setAttribute(s,e[s]);return t&&L(o,t),o}var ml=class extends dl{constructor(e,t){super(e,t);this.options=t;c(this,"$xAxisDimensions",{min:1/0,max:-1/0});c(this,"$yAxisDimensions",{min:1/0,max:-1/0});c(this,"xAxis");c(this,"yAxis");c(this,"axisFont");c(this,"U");c(this,"j");c(this,"Hg");c(this,"Wg");this.axisFont=Pi(tE,rE,"normal","sans-serif",t.axisFont),this.U=t.xAxis||{},this.j=t.yAxis||{},this.Hg=t.minimumMarkerSize!=null?t.minimumMarkerSize:8,this.Wg=t.maximumMarkerSize!=null?t.maximumMarkerSize:50,this.$dualValueInit(t),this.load(t),this.$bind(st,z(Ym),n=>{if(this.$tooltip){let o=n.target,s=parseInt(o.getAttribute(Et)),a=this.$__series[s],l=parseInt(o.getAttribute("data-idx"),10),h=a.$data[l],d=o.getBBox(),u={x:d.x,y:d.y,width:d.width,height:d.height},p={x:.5,y:.5},g={x:u.x+u.width*p.x+this.dim.chartX,y:u.y+u.height*p.y+this.dim.chartY};this.$tooltip.showTooltip(g,{x:.5,y:1.1},a,h)}}),this.$bind(ot,z(Ym),n=>{this.$tooltip&&this.$tooltip.hide()})}$createTooltip(e,t){return new nE(e,t)}$init(){}$dualValueInit(e){e.series.forEach(t=>{let n=new gl(t.xAxisField,t.yAxisField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$doLoad(){this.$xAxisDimensions={min:this.U.min!==void 0?this.U.min:1/0,max:this.U.max!==void 0?this.U.max:-1/0},this.$yAxisDimensions={min:this.j.min!==void 0?this.j.min:1/0,max:this.j.max!==void 0?this.j.max:-1/0},this.$__series.forEach(e=>{this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,e.$xAxis.min),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,e.$xAxis.max),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,e.$yAxis.min),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,e.$yAxis.max)}),this.$adjustDimensionsForMarkers()}$adjustDimensionsForMarkers(){let e=this.$xAxisDimensions.max-this.$xAxisDimensions.min,t=this.$yAxisDimensions.max-this.$yAxisDimensions.min,n=this.Pc||500,o=this.Oc||500,s=3;this.$__series.forEach(a=>{a.$data.forEach(l=>{let h=l[a.xAxisField],d=l[a.yAxisField];if(h!=null&&d!=null){let p=this.$getMarkerSize(a,l)/2+s,g=p/n*e,m=p/o*t;this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,h-g),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,h+g),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,d-m),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,d+m)}})})}$setupValueAxes(e){var t,n,o,s,a,l,h,d;this.yAxis={domain:"y",inverted:this.j.inverted===!0,labelColor:this.j.labelColor||this.style.labelColor,labelColorGenerator:this.j.labelColorGenerator||this.style.labelColorGenerator,min:this.j.min,max:this.j.max,showLine:this.j.showLine===!0,lineSize:this.j.lineSize||Oi,dim:Oc(),element:k(Q,{},[el,Um].join(" "),e),id:this.j.id||$(),position:this.j.position||ar,titleAlign:((t=this.j.title)==null?void 0:t.align)||tl,title:(n=this.j.title)==null?void 0:n.text,titlePadding:((o=this.j.title)==null?void 0:o.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.j.showGrid!==!1,gridLineSize:this.j.lineSize||2,useSeriesTotal:!1,font:((s=this.j)==null?void 0:s.font)||this.axisFont,scale:this.j.step!=null?Pc(this.$yAxisDimensions.min,this.$yAxisDimensions.max,this.j.step):Cc(this.$yAxisDimensions.min,this.$yAxisDimensions.max),stackedScale:null,crosshair:this.j.crosshair,step:this.j.step,labelPrefix:this.j.labelPrefix,labelSuffix:this.j.labelSuffix,labelFormatter:this.j.labelFormatter},this.xAxis={domain:"x",inverted:this.U.inverted===!0,labelColor:this.U.labelColor||this.style.labelColor,labelColorGenerator:this.U.labelColorGenerator||this.style.labelColorGenerator,min:this.U.min,max:this.U.max,showLine:this.U.showLine===!0,lineSize:this.U.lineSize||Oi,dim:Oc(),element:k(Q,{},[el,Fm].join(" "),e),id:this.U.id||$(),position:this.U.position||ar,titleAlign:((a=this.U.title)==null?void 0:a.align)||tl,title:((l=this.U.title)==null?void 0:l.text)||"",titlePadding:((h=this.U.title)==null?void 0:h.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.U.showGrid!==!1,gridLineSize:this.U.lineSize||2,useSeriesTotal:!1,font:((d=this.U)==null?void 0:d.font)||this.axisFont,scale:this.U.step!=null?Pc(this.$xAxisDimensions.min,this.$xAxisDimensions.max,this.U.step):Cc(this.$xAxisDimensions.min,this.$xAxisDimensions.max),stackedScale:null,crosshair:this.U.crosshair,step:this.U.step,labelPrefix:this.U.labelPrefix,labelSuffix:this.U.labelSuffix,labelFormatter:this.U.labelFormatter}}$drawChart(e,t,n,o){this.$setupValueAxes(e),super.$drawChart(e,t,n,o),this.$plotPoints(e)}$doReset(){super.$doReset(),this.$xAxisDimensions.min=1/0,this.$yAxisDimensions.min=1/0,this.$xAxisDimensions.max=-1/0,this.$yAxisDimensions.max=-1/0}$plotPoints(e){let t=this.$getDataPointCssClass();this.$__series.forEach((n,o)=>{let s=[];n.$data.forEach((a,l)=>{let h=a[n.xAxisField],d=a[n.yAxisField],u;if(h&&d){let p=(h-this.xAxis.scale.minScale)/this.xAxis.scale.range,g=(d-this.yAxis.scale.minScale)/this.yAxis.scale.range;this.xAxis.inverted&&(p=1-p),this.yAxis.inverted||(g=1-g);let m=n.color||this.$defaultColor||"#000000",E=p*this.dim.chartWidth,y=g*this.dim.chartHeight,x;if(n.marker)x=Vc(n.marker,a,{transform:`translate(${this.dim.chartX+E}, ${this.dim.chartY+y})`,fill:m});else if(n.resolveMarker){u=this.$getMarkerSize(n,a);let b=n.resolveMarker(a);x=Vc(b,a,{transform:`translate(${this.dim.chartX+E-u/2}, ${this.dim.chartY+y-u/2})`,fill:m,width:u,height:u})}else u=this.$getMarkerSize(n,a),x=iE(n,E,y,u,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,fill:m});if(n.color&&x.setAttribute("fill",n.color),n.outline){let b=n.outlineColor||Ld(m).toString();x.setAttribute("stroke",b),x.setAttribute("stroke-width",(n.outlineWidth||1).toString())}x.setAttribute("data-x",h.toString()),x.setAttribute("data-y",d.toString()),x.setAttribute(Et,o.toString()),x.setAttribute("data-idx",l.toString()),x.classList.add(bn),t!=null&&x.classList.add(t),e.appendChild(x);let f=u==null?10:Math.max(10,u/2);s.push(V(Fe,{cx:E,cy:y,r:f,fill:"transparent",stroke:"none",transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,"data-x":h.toString(),"data-y":d.toString(),[Et]:o.toString(),"data-idx":l.toString()},null,Ym))}}),s.forEach(a=>e.appendChild(a))})}$getBaseMarkerSize(){let e=0;this.$__series.forEach(l=>e+=l.$data.length);let t=10,n=this.dim.chartWidth*this.dim.chartHeight,o=Math.sqrt(n)/500,s=Math.max(1,Math.sqrt(e/100)),a=t*o/s;return Math.min(this.Wg,Math.max(this.Hg,a))}$getXAxisType(){return"value"}$getYAxisType(){return"value"}$mouseOutChartPoint(){}$mouseOverChartPoint(e,t){}$_generateYAxes(){return{yAxes:[this.yAxis],yAxesAtStart:[this.yAxis],yAxesAtEnd:[]}}$_generateXAxes(){return{xAxes:[this.xAxis],xAxesAtEnd:[this.xAxis],xAxesAtStart:[]}}$recalc(){}};var oG=.8,sG=50,aG=10;function AQe(i){return i.type===Dr.type}var oE=class oE extends So{constructor(e,t){super(e,t,oE.type);this.chart=e;this.options=t;c(this,"stacked");c(this,"$distinctStacks",[]);this.stacked=t==null?void 0:t.stacked}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(h=>{typeof h.min=="number"&&Number.isFinite(h.min)&&(s=Math.min(s,h.min)),typeof h.max=="number"&&Number.isFinite(h.max)&&(a=Math.max(a,h.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),pl(this)&&this.chart.$categories.length>0)if(this.$distinctStacks=Array.from(new Set(o.map(h=>h.stack||"default"))),this.stacked==="percent")n[t]={min:0,max:100,stepCount:4};else{let h=0;for(let d=0;d<this.chart.$categories.length;d++){let u={};this.$distinctStacks.forEach(p=>u[p]=0),o.forEach(p=>{var E,y;let g=p.stack||"default",m=(y=(E=p.values)==null?void 0:E[d])==null?void 0:y.max;typeof m=="number"&&Number.isFinite(m)&&(u[g]+=m)}),this.$distinctStacks.forEach(p=>{h=Math.max(h,u[p])})}n[t]={min:0,max:h}}return n}computeBarSize(e){let t=pl(this)?Math.max(1,this.$distinctStacks.length):this.chart.seriesElements.length,n=this.options.barGap==null?aG:this.options.barGap,o=n*(t-1),s=e/this.chart.$categories.length,a=this.options.barSize!=null?this.options.barSize:(()=>{let h=(this.options.fillRatio==null?oG:this.options.fillRatio)*s,d=this.options.maxBarSize==null?sG:this.options.maxBarSize;return Math.min(d,(h-o)/t)})();return{barSize:a,gapBetweenBars:n,spaceUsedPerCategory:a*t+o,spacePerCategory:s,barsPerCategory:t}}$getBarCenter(e,t,n){let o=this.computeBarSize(this.$inverted?n.chartWidth:n.chartHeight);return this.chart.$getCategoryCenter(e,n,!this.$inverted)-o.spaceUsedPerCategory/2+o.barSize/2+t*(o.barSize+o.gapBetweenBars)}$computeBarPlacements(e,t,n,o){return pl(this)?this.stacked==="percent"?this.$computeBarPlacementsStackedPercent(e,t):this.$computeBarPlacementsStacked(e,t):this.$computeBarPlacementsDefault(e,t,n,o)}$computeBarPlacementsStackedPercent(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(E=>(E.stack||"default")===h),p=[],g=0;u.forEach(E=>{let y=E.values[s].max;p.push([o.indexOf(E),y]),g+=y});let m=0;p.forEach((E,y)=>{if(this.$inverted){let x=(E[1]+m)/g,f=m/g,b=Math.abs((x-f)*e.chartHeight);f=e.chartHeight-f*e.chartHeight-b,n.push({x:l,y:f,height:b,width:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:g,value:E[1]})}else{let x=(E[1]+m)/g,f=m/g,b=(x-f)*e.chartWidth;f*=e.chartWidth,n.push({x:f,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,width:b,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:g,value:E[1]})}m+=E[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsStacked(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(y=>(y.stack||"default")===h),p=[],g=0;u.forEach(y=>{let x=y.values[s].max;p.push([o.indexOf(y),x]),g+=x});let m=0,E=this.chart.$valueAxes[0].stackedScale;p.forEach((y,x)=>{if(this.$inverted){let f=(y[1]+m)/E.range,b=m/E.range,A=Math.abs((f-b)*e.chartHeight);b=e.chartHeight-b*e.chartHeight-A,n.push({x:l,y:b,height:A,width:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:g,value:y[1]})}else{let f=(y[1]+m)/E.range,b=m/E.range,A=(f-b)*e.chartWidth;b*=e.chartWidth,n.push({x:b,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,width:A,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:g,value:y[1]})}m+=y[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsDefault(e,t,n,o){let s=this.chart.getSeries(),a=[],l=this.chart.$valueAxes[0].scale;for(let h=0;h<this.chart.$categories.length;h++){let u=this.chart.$getCategoryCenter(h,e,!this.$inverted)-t.spaceUsedPerCategory/2;for(let p=0;p<s.length;p++){let g=s[p],m=n==null?g.values[h].min:Math.max(n,g.values[h].min),E=o==null?g.values[h].max:Math.min(g.values[h].max,o);if(this.$inverted){let y=(E-l.minScale)/l.range,x=(m-l.minScale)/l.range,f=x!==0,b=Math.abs((y-x)*e.chartHeight);x=e.chartHeight-x*e.chartHeight-b,a.push({x:u,y:x,canRoundStart:f,canRoundEnd:!0,height:b,width:t.barSize,category:h,series:p,rounded:!0,value:g.values[h].max})}else{let y=(E-l.minScale)/l.range,x=(m-l.minScale)/l.range,f=Math.abs((y-x)*e.chartWidth);x*=e.chartWidth,a.push({x,canRoundStart:x!==0,canRoundEnd:!0,y:u,height:t.barSize,width:f,category:h,series:p,rounded:!0,value:g.values[h].max})}u+=t.barSize+t.gapBetweenBars}}return a}$draw(e,t,n,o){let s=this.computeBarSize(this.$inverted?t.chartWidth:t.chartHeight),a=this.$computeBarPlacements(t,s,n,o),l=this.$inverted?[fL,bn].join(" "):[xL,bn].join(" "),h=this.chart.getSeries();a.forEach(d=>{let u={fill:h[d.series].color,[Kn]:`${d.category}`,[Et]:`${d.series}`};d.stackId!=null&&(u[Km]=d.stackId),d.stackTotal!=null&&(u[qm]=`${d.stackTotal}`),d.value!=null&&(u[Qm]=`${d.value}`),lG(d,!this.$inverted,u,l,this.chart.seriesElements[d.series],this.chart.$roundCorners&&d.canRoundStart,this.chart.$roundCorners&&d.canRoundEnd,this.chart.$cornerRadius),this.options.dataLabels&&this.$drawDataLabel(d,e)})}$drawDataLabel(e,t){let n=this.chart.getSeries()[e.series],o=this.chart.$categories[e.category],s=e.value,a="";if(this.options.dataLabels===!0?a=this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`:typeof this.options.dataLabels=="string"&&(a=this.options.dataLabels.replace("{series}",n.id).replace("{category}",o.id).replace("{value}",this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`),e.stackId!=null&&(a=a.replace("{stack}",e.stackId))),a.length>0){let l=this.chart.dim.chartX+e.x+e.width/2,h=this.chart.dim.chartY+e.y+e.height/2;Xm(a,l,h,n.color,{size:11},t)}}};c(oE,"type","bar");var Dr=oE;ul(Dr.type,(i,r)=>new Dr(i,r));function lG(i,r,e,t,n,o,s,a){let l,h=a||eE;return r?o&&s&&i.width>h?l=`M ${i.x}, ${i.y+h} q0,-${h}, ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-2*h} q-${h},0 -${h},-${h} z`:s&&i.width>h?l=`M ${i.x},${i.y} h${i.width-h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-h} z`:o&&i.width>h?l=`M ${i.x},${i.y+h} q0, -${h} ${h},-${h} h${i.width-h} v${i.height} h${-(i.width-h)} q-${h},0 -${h},-${h} z`:l=`M ${i.x},${i.y} h${i.width} v${i.height} h-${i.width} Z`:o&&s&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-2*h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} z`:s&&i.height>h?l=`M ${i.x},${i.y+i.height} v-${i.height-h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-h} z`:o&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-h} h${i.width} v${i.height-h} q0,${h} -${h},${h} z`:l=`M ${i.x},${i.y+i.height} v-${i.height} h${i.width} v${i.height} Z`,k(q,Object.assign({d:l},e),t,n)}var qL=class extends qn{constructor(r,e){super(r,Object.assign({},e,{inverted:!(e!=null&&e.inverted),plots:{type:Gc.type,options:e.plotOptions||{}}})),L(r,LL),this.$bind(ae,z(Sc),t=>{let{x:n,y:o}=this.$fromEventLocation(t),s=null;if(this.$getXAxisType()==="category"){let a=this.dim.chartWidth/this.$categories.length;s=Math.floor(n/a)}else{let a=this.dim.chartHeight/this.$categories.length;s=Math.floor(o/a)}if(s!=null){let a=this.$plots[0],{loc:l,seriesIndex:h}=a.showMarker(s,this.dim,this.$focusedSeries);l!=null&&this.$tooltip!=null&&this.$maybeShowTooltip(h,s,{x:l.x+this.dim.chartX,y:l.y+this.dim.chartY},{x:.5,y:1.1})}}),this.$bind(ae,z(zm),t=>{let n=t.target,o=parseInt(n.getAttribute(Et),10);this.setFocusedSeries(o)}),this.$bind(ot,z(zm,Sc),t=>{this.$plots[0].hideMarker(),this.setFocusedSeries(null),this.$hideTooltip()})}},sE=class sE extends So{constructor(e,t){var n,o;super(e,t,sE.type);this.chart=e;c(this,"stacked");c(this,"Rc");c(this,"Zg");c(this,"Lc");c(this,"Pt",[]);this.stacked=(t==null?void 0:t.stacked)===!0,this.Rc=((n=t.marker)==null?void 0:n.enabled)!==!1,this.Zg=((o=t.marker)==null?void 0:o.size)||10}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.stacked&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var g,m;let p=(m=(g=u.values)==null?void 0:g[h])==null?void 0:m.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Dr.type);return s==null?o:s.$getBarCenter(e,t,n)}}$draw(e,t,n,o){this.Pt.length=0;let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale;for(let l=0;l<this.chart.$categories.length;l++)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.Pt[h]=this.Pt[h]||[],this.$inverted){let p=t.chartHeight-(u.values[l].max-a.minScale)/a.range*t.chartHeight;this.Pt[h].push({x:d,y:p})}else{let p=(u.values[l].max-a.minScale)/a.range;this.Pt[h].push({x:p*t.chartWidth,y:d})}}for(let l=this.chart.$categories.length-1;l>-1;l--)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.$inverted){let p=t.chartHeight-(u.values[l].min-a.minScale)/a.range*t.chartHeight;this.Pt[h].push({x:d,y:p})}else{let p=(u.values[l].min-a.minScale)/a.range;this.Pt[h].push({x:p*t.chartWidth,y:d})}}for(let l=0;l<this.Pt.length;l++){let h=s[l].color,d=`M ${this.Pt[l].map(u=>`${u.x} ${u.y}`).join(" L ")}`;k(q,{stroke:h,"stroke-width":"1",d,fill:h,opacity:.8,[Et]:`${l}`},zm,this.chart.seriesElements[l])}this.Lc=k(Fe,{cx:"0",cy:"0",r:this.Zg/2,visibility:"hidden","stroke-width":"1"},"vjs-area-marker",e)}showMarker(e,t,n){if(this.Rc!==!1){let o=this.chart.getSeries(),s=n==null?0:n,a=o[s],l=this.Pt[s][e];return ie(this.Lc,{visibility:"visible",cx:l.x+t.chartX,cy:l.y+t.chartY,fill:a.color,stroke:Ld(a.color).toString()}),{series:a,loc:l,seriesIndex:s}}}hideMarker(){this.Rc!==!1&&ie(this.Lc,{visibility:"hidden"})}};c(sE,"type","area");var Gc=sE;ul(Gc.type,(i,r)=>new Gc(i,r));var QL=class extends qn{constructor(r,e){super(r,Object.assign({},e,{inverted:!0,plots:{type:Dr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,EL)}};var e0=class extends qn{constructor(r,e){super(r,Object.assign({},e,{inverted:!1,plots:{type:Dr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,yL)}};var vb=class extends gl{constructor(e,t,n,o,s,a,l,h,d,u,p){super(e,t,o,s,a,l,h,d,u,p);this.xAxisField=e;this.yAxisField=t;this.valueField=n;c(this,"$valueAxis",{min:1/0,max:-1/0})}addValue(e){super.addValue(e);let t=e[this.valueField];t!=null&&(this.$valueAxis.min=Math.min(this.$valueAxis.min,t),this.$valueAxis.max=Math.max(this.$valueAxis.max,t))}},t0=class extends ml{constructor(e,t){super(e,t);this.options=t;L(e,bL)}$dualValueInit(e){e.series.forEach(t=>{let n=new vb(t.xAxisField,t.yAxisField,t.valueField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$getMarkerSize(e,t){let n=this.options.minPointSize||10,o=this.options.maxPointSize,s=t[e.valueField];if(s==null)return null;let a=this.$getBaseMarkerSize(),l=Math.min(this.dim.chartWidth,this.dim.chartHeight),h=Math.min(a*7,l*.2),d=o||h,u=e.$valueAxis.max-e.$valueAxis.min,p=u===0?.5:(s-e.$valueAxis.min)/u,g=n+Math.sqrt(p)*(d-n);return Math.max(n,g)}$getDataPointCssClass(){return AL}};var hG="vjs-gauge-chart",cG="vjs-gauge-track",r0="vjs-gauge-zone",dG="vjs-gauge-tick",uG="vjs-gauge-label",pG="vjs-gauge-needle",gG="vjs-gauge-needle-pivot",n0=class extends Ao{constructor(e,t){var n,o,s,a,l,h;super(e,t);this.options=t;c(this,"Ot");c(this,"_o");c(this,"Re");c(this,"Te");c(this,"Vt");c(this,"wc");this.Ot=(n=t.startAngle)!=null?n:-135,this._o=(o=t.endAngle)!=null?o:135,this.Re=(s=t.innerRadius)!=null?s:.8,this.Te=(a=t.min)!=null?a:0,this.Vt=(l=t.max)!=null?l:100,this.wc=(h=t.value)!=null?h:this.Te,L(e,hG),this.$draw()}getValue(){return this.wc}setValue(e){this.wc=e,this.$draw()}hasData(){return this.getValue()!=null}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){var fe;this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Qa,e);e.insertBefore(s,o.nextElementSibling);let a=X=>(X-90)*Math.PI/180,l=a(this.Ot),h=a(this._o),d=Math.cos(l),u=Math.cos(l),p=Math.sin(l),g=Math.sin(l),m=[h];for(let X=-180;X<=270;X+=90){let me=a(X);X>=this.Ot&&X<=this._o&&m.push(me)}m.forEach(X=>{d=Math.min(d,Math.cos(X)),u=Math.max(u,Math.cos(X)),p=Math.min(p,Math.sin(X)),g=Math.max(g,Math.sin(X))});let E=.9,y=u-d,x=g-p,f=Math.min(this.dim.chartWidth*E/y,this.dim.chartHeight*E/x),b=this.dim.chartX+this.dim.chartWidth/2-f*(u+d)/2,A=this.dim.chartY+this.dim.chartHeight/2-f*(g+p)/2,T=f*this.Re,S=b+f*Math.cos(l),O=A+f*Math.sin(l),v=b+f*Math.cos(h),_=A+f*Math.sin(h),P=b+T*Math.cos(h),I=A+T*Math.sin(h),C=b+T*Math.cos(l),R=A+T*Math.sin(l),w=this._o-this.Ot<=180?0:1,B=[`M ${S} ${O}`,`A ${f} ${f} 0 ${w} 1 ${v} ${_}`,`L ${P} ${I}`,`A ${T} ${T} 0 ${w} 0 ${C} ${R}`,"Z"].join(" ");k(q,{d:B,fill:"#EEE",stroke:"#CCC","stroke-width":1},cG,e);let N=(fe=this.getValue())!=null?fe:this.Te,M=Math.max(this.Te,Math.min(this.Vt,N)),D=this.Vt-this.Te,G=this._o-this.Ot,J=this.options.showNeedle!==!1;if(this.options.zones&&this.options.zones.forEach((X,me)=>{let $e=X.from,ke=X.to;if(!J){if(M<=$e)return;ke=Math.min(ke,M)}let Ut=this.Ot+($e-this.Te)/D*G,nr=this.Ot+(ke-this.Te)/D*G,Ht=a(Ut),vr=a(nr),Ri=b+f*Math.cos(Ht),Rs=A+f*Math.sin(Ht),Ls=b+f*Math.cos(vr),ws=A+f*Math.sin(vr),Ds=b+T*Math.cos(vr),Ns=A+T*Math.sin(vr),Bc=b+T*Math.cos(Ht),Fc=A+T*Math.sin(Ht),El=nr-Ut<=180?0:1,Uc=[`M ${Ri} ${Rs}`,`A ${f} ${f} 0 ${El} 1 ${Ls} ${ws}`,`L ${Ds} ${Ns}`,`A ${T} ${T} 0 ${El} 0 ${Bc} ${Fc}`,"Z"].join(" "),fl=X.color;if(X.gradient){let Co=e.querySelector("defs");Co||(Co=k("defs",{},"",e),e.insertBefore(Co,e.firstChild));let re=`vjs-gauge-gradient-${me}-${Math.round(Math.random()*1e6)}`,Ue=k("linearGradient",{id:re,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},"",Co);X.gradient.stops.forEach(vt=>{k("stop",{offset:`${vt.offset}%`,"stop-color":vt.color},"",Ue)}),fl=`url(#${re})`}k(q,{d:Uc,fill:fl,stroke:"none"},`${r0} ${r0}-${me}`,e)}),this.options.ticks){let X=[];if(this.options.ticks.values)X=this.options.ticks.values;else if(this.options.ticks.interval!=null)for(let me=this.Te;me<=this.Vt;me+=this.options.ticks.interval)X.push(me);X.forEach(me=>{let $e=this.Ot+(me-this.Te)/D*G,ke=a($e),Ut=f*.95,nr=b+f*Math.cos(ke),Ht=A+f*Math.sin(ke),vr=b+Ut*Math.cos(ke),Ri=A+Ut*Math.sin(ke);k(q,{d:`M ${nr} ${Ht} L ${vr} ${Ri}`,stroke:this.options.ticks.color||"#666","stroke-width":this.options.ticks.width||1},dG,e)})}if(this.options.labels){let X=[];if(this.options.labels.values)X=this.options.labels.values;else if(this.options.labels.interval!=null)for(let $e=this.Te;$e<=this.Vt;$e+=this.options.labels.interval)X.push($e);let me=f+(this.options.labels.distance||0);X.forEach($e=>{let ke=this.Ot+($e-this.Te)/D*G,Ut=a(ke),nr=b+me*Math.cos(Ut),Ht=A+me*Math.sin(Ut);k("text",{x:nr,y:Ht,"text-anchor":"middle","dominant-baseline":"central","font-size":"12px",fill:"#333"},uG,e).textContent=$e.toString()})}if(J){let X=this.Ot+(M-this.Te)/D*G,me=a(X),$e=f*.9,ke=f*.05,Ut=me-Math.PI/2,nr=me+Math.PI/2,Ht=b+$e*Math.cos(me),vr=A+$e*Math.sin(me),Ri=b+ke*Math.cos(Ut),Rs=A+ke*Math.sin(Ut),Ls=b+ke*Math.cos(nr),ws=A+ke*Math.sin(nr),Ds=`M ${Ri} ${Rs} L ${Ht} ${vr} L ${Ls} ${ws} Z`;k(q,{d:Ds,fill:"#333",stroke:"#000","stroke-width":1},pG,e);let Ns=ke*1.5;k("circle",{cx:b,cy:A,r:Ns,fill:"#333",stroke:"#666","stroke-width":1},gG,e)}}};var i0=class extends qn{constructor(e,t){super(e,Object.assign({},t,{inverted:!(t!=null&&t.inverted),plots:{type:$c.type,options:t.plotOptions||{}}}));this.options=t;L(e,RL)}},aE=class aE extends So{constructor(e,t){super(e,t,aE.type);this.chart=e;c(this,"Jg");c(this,"Kg");this.Jg=t.stacked===!0,this.Kg=t.spline===!0}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.Jg&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var g,m;let p=(m=(g=u.values)==null?void 0:g[h])==null?void 0:m.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Dr.type);return s==null?o:s.$getBarCenter(e,t,n)}}MA(e,t){function n(a){return`C ${a.cp1.x} ${a.cp1.y}, ${a.cp2.x} ${a.cp2.y}, ${a.x2} ${a.y2} `}let o=Cf(e.slice(t),.15),s=`M ${o[0].segment.x1} ${o[0].segment.y1}`;return s+=o.map(a=>n(a.segment)).join(""),s}GA(e,t){return`M ${e.slice(t).map(n=>`${n.x} ${n.y}`).join(" L ")}`}$draw(e,t,n,o){let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale,l=[],h=[],d=(u,p)=>{let g,m;return this.$inverted?(m=t.chartHeight-(p-a.minScale)/a.range*t.chartHeight,g=u):(g=t.chartWidth*((p-a.minScale)/a.range),m=u),{cx:g,cy:m}};for(let u=0;u<this.chart.$categories.length;u++)for(let p=0;p<s.length;p++){let g=this.$getValueLocation(u,p,t);l[p]=l[p]||[],h[p]=h[p]||[];let m=s[p],E=m.values[u].max,{cx:y,cy:x}=d(g,E);if(E!=null&&this.qg(s[p],y,x,m.markerSize||10,m.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),l[p].push({x:y,y:x,hasValue:E!=null}),m.isRangeSeries()){let{cx:f,cy:b}=d(g,m.values[u].min);m.values[u].min!=null&&this.qg(s[p],f,b,m.markerSize||10,m.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),h[p].push({x:f,y:b,hasValue:m.values[u].min!=null})}}for(let u=0;u<l.length;u++){let p=s[u].color,g=l[u].findIndex(E=>E.hasValue),m=this.Kg?this.MA(l[u],g):this.GA(l[u],g);k(q,{stroke:p,"stroke-width":"1",d:m,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}for(let u=0;u<h.length;u++){let p=s[u].color;if(h[u].length>0){let g=h[u].findIndex(E=>E.hasValue),m=`M ${h[u].slice(g).map(E=>`${E.x} ${E.y}`).join(" L ")}`;k(q,{stroke:p,"stroke-width":"1",d:m,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}}}qg(e,t,n,o,s,a,l,h,d){if(e.marker){let u=Vc(e.marker,null,{[Kn]:`${l}`,[Et]:`${h}`},[bn].join(" "));d.appendChild(u);let p=u.getBBox();return u.setAttribute("transform",`translate(${t-p.width/2}, ${n-p.height/2})`),u}else{let u=iE(e,t,n,o,{fill:s,"stroke-width":"1",stroke:a,[Kn]:`${l}`,[Et]:`${h}`},[bn].join(" "));return d.appendChild(u),u}}};c(aE,"type","line");var $c=aE;ul($c.type,(i,r)=>new $c(i,r));var mG="vjs-pie-chart",lE="vjs-pie-slice",o0="vjs-pie-slice-selected",s0=class extends al{constructor(e,t){super(e,t);this.options=t;c(this,"$dataPoints",[]);c(this,"$tooltip");c(this,"Ro");c(this,"Lo");c(this,"Dc");c(this,"ni");c(this,"Re");c(this,"$realisedSeries",[]);c(this,"cn");this.Ro=t.selectedCategory,this.Dc=t.selectedSliceOffset||10,this.ni=t.interactive===!0,this.Re=t.innerRadius,this.cn=t.tooltip,this.$init(),this.load(t),this.$bind(st,z(lE),n=>{if(this.$tooltip){let o=n.target,s=o.getBBox(),a={x:s.x,y:s.y,width:s.width,height:s.height},l={x:.5,y:.5},h={x:a.x+a.width*l.x,y:a.y+a.height*l.y},{category:d,series:u}=this.Qg(o),p=this.$dataPoints[d],g=this.$realisedSeries[u];this.$tooltip.showTooltip(h,{x:.5,y:.5},g,p.label,{value:p.value})}}),this.$bind(ot,z(lE),n=>{this.$tooltip&&this.$tooltip.hide()}),this.$bind(W,z(lE),n=>{if(this.ni){let o=n.target,{category:s,series:a}=this.Qg(o);this.$A(s,a,o)}}),L(e,mG)}Qg(e){let t=parseInt(e.getAttribute(Kn),10),n=parseInt(e.parentNode.getAttribute(Et),10);return{category:t,series:n}}$recalc(){if(this.$realisedSeries.length>0){this.$dataPoints.length=0;let e=0,t=this.$realisedSeries[0],n=t.getCategories();t.values.forEach((o,s)=>{let a=o.max/t.total,l=a*2*Math.PI,h={p:a,arc:l,arcStart:e,data:n[s],label:n[s].id,value:o.max};this.$dataPoints.push(h),e+=l})}}hasData(){return this.dataSource.hasData()}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{let t=e.expand();this.$realisedSeries.push(...t)}),this.$recalc()}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){this.cn&&(this.$tooltip=new cl(e,this.cn)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Qa,e);e.insertBefore(s,o.nextElementSibling);let a={x:this.dim.chartX+this.dim.chartWidth/2,y:this.dim.chartY+this.dim.chartHeight/2},h=.35*Math.min(this.dim.chartWidth,this.dim.chartHeight),d=this.options.colors,u=this.options.color;this.$dataPoints.forEach((p,g)=>{let m=V(Q,{"data-name":p.label,"data-category":g});e.appendChild(m);let E=p.arcStart,y=p.arc+p.arcStart,x=p.arcStart+p.arc/2,f=a.x+h*Math.cos(E),b=a.y+h*Math.sin(E),A=a.x+h*Math.cos(y),T=a.y+h*Math.sin(y),S=p.p>.5?1:0,O="";if(p.p>=1)if(this.Re!=null){let G=this.Re*h;O=`M ${a.x+h} ${a.y}
137
137
  A ${h} ${h} 0 1 1 ${a.x-h} ${a.y}
138
138
  A ${h} ${h} 0 1 1 ${a.x+h} ${a.y}
139
- M ${a.x+V} ${a.y}
140
- A ${V} ${V} 0 1 0 ${a.x-V} ${a.y}
141
- A ${V} ${V} 0 1 0 ${a.x+V} ${a.y} Z`}else R=`M ${a.x+h} ${a.y}
139
+ M ${a.x+G} ${a.y}
140
+ A ${G} ${G} 0 1 0 ${a.x-G} ${a.y}
141
+ A ${G} ${G} 0 1 0 ${a.x+G} ${a.y} Z`}else O=`M ${a.x+h} ${a.y}
142
142
  A ${h} ${h} 0 1 1 ${a.x-h} ${a.y}
143
- A ${h} ${h} 0 1 1 ${a.x+h} ${a.y} Z`;else if(R=`M ${a.x} ${a.y} L ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} Z`,this.Re!=null){let V=a.x+this.Re*h*Math.cos(E),J=a.y+this.Re*h*Math.sin(E),fe=a.x+this.Re*h*Math.cos(y),X=a.y+this.Re*h*Math.sin(y);R=`M ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} L ${fe} ${X} A ${this.Re*h} ${this.Re*h} 0 ${S} 0 ${V} ${J} Z `}let v={x:this.Tc*Math.cos(x),y:this.Tc*Math.sin(x)},O=G(ee,{fill:u||(d?d[m%d.length]:this.colorGenerator.generate(p)),opacity:"0.6",stroke:"white",d:R,"data-t":`translate(${v.x}, ${v.y})`,[Kn]:`${m}`});L(O,rE),m===this.Oo&&this.$g(O),g.appendChild(O);let P=20,I=this.options.labelPosition==="inside",C=I?h*.7:h+P,_,w,$;if(p.p>=1)if(I&&this.Re!=null)_=a.x,w=a.y,$="middle";else{let V=-Math.PI/2;_=a.x+C*Math.cos(V),w=a.y+C*Math.sin(V),$="middle"}else _=a.x+C*Math.cos(x),w=a.y+C*Math.sin(x),$=_<a.x?"end":"start";let N=G("text",{"text-anchor":$,"dominant-baseline":"central",x:_,y:w});this.options.labelFont&&(this.options.labelFont.size&&N.setAttribute("font-size",`${this.options.labelFont.size}px`),this.options.labelFont.family&&N.setAttribute("font-family",this.options.labelFont.family),this.options.labelFont.weight&&N.setAttribute("font-weight",`${this.options.labelFont.weight}`),this.options.labelFont.style&&N.setAttribute("font-style",this.options.labelFont.style));let M=p.label,D=this.options.showLabels||"label";if(D==="value"?M=`${p.value}`:D==="percentage"?M=`${Math.round(p.p*100)}%`:D==="label-value"?M=`${p.label}: ${p.value}`:D==="label-percentage"&&(M=`${p.label}: ${Math.round(p.p*100)}%`),N.innerHTML=M,g.appendChild(N),this.options.dataLabels!=null&&this.options.dataLabels!==!1){let J=p.p<3&&m%2===0?h*.4:h*.5,fe=a.x+J*Math.cos(x),X=a.y+J*Math.sin(x),ge=u||(d?d[m%d.length]:this.colorGenerator.generate(p)),Ge=this.options.labelFont||{size:12,weight:"bold"},Xe="";this.options.dataLabels==="percentage"?Xe=`${Math.round(p.p*100)}%`:Xe=`${p.value}`,$g(Xe,fe,X,ge,Ge,g)}})}uA(){this._o!=null&&(this.pA(this._o),this._o=null)}$g(e){this._o=e,this.mA(this._o)}dA(e,t,n){this.uA(),this.Oo===e?this.Oo=null:(this.Oo=e,this.$g(n))}mA(e){e.setAttribute("transform",e.getAttribute("data-t")),L(e,k0)}pA(e){e.removeAttribute("transform"),F(e,k0)}};function So(i,r){try{return parseFloat(i.data[r])}catch(e){return 0}}function Z0(i,r,e){return r.reduce((t,n)=>t+So(n,e),0)}function iG(i){let r={};return i.getSourceEdges().forEach(e=>{r[e.target.id]=e.target}),Object.values(r)}function oG(i){let r={};return i.getTargetEdges().forEach(e=>{r[e.source.id]=e.source}),Object.values(r)}function sG(i,r){return i.reduce((e,t)=>t.size.height+e,0)+r*(i.length-1)}function aG(i,r,e,t,n,o){lG(i,r,e,t,n,s=>s.getTargetEdges(),s=>s.getSourceEdges(),s=>iG(s),s=>oG(s),o)}function lG(i,r,e,t,n,o,s,a,l,h){let d=t.filter(u=>o(u).length===0).map(u=>{let p=s(u),m=Z0(u,p,h);return u.data.height=m,u.data.width=n,e.set(u.id,!0),{offset:0,obj:u,size:{width:n,height:m},layer:0,id:u.id,type:"root",vertexSet:null,edges:p,leaf:p.length===0}});for(d.sort((u,p)=>p.edges.length-u.edges.length),r(d);e.size<t.length;){let u=new Set,p=[];d.forEach(m=>{a(m.obj).forEach(E=>{e.has(E.id)||l(E).find(x=>!e.has(x.id))||u.add(E)})}),Array.from(u).forEach(m=>{let g=Z0(m,o(m),h);m.data.height=g,m.data.width=n,p.push({offset:0,obj:m,size:{width:n,height:g},id:m.id,vertexSet:null,layer:i.length,type:"",edges:[],leaf:!1}),e.set(m.id,!0)}),r(p),d=p}}function Ab(i,r,e,t,n,o){let s=new Map,a=i.getNodes(),l=-1/0,h=-1,d=[];function u(T){let S=sG(T,e),R=d.length;S>l&&(l=S,h=d.length),d.push({entries:T,size:S,offset:0,layer:R})}aG(d,u,s,a,r,o),new Bs({layers:d},(T,S,R)=>{let v=[];for(let O=0;O<d[S].entries.length;O++)nA(d[S].entries[O].obj,R.obj)&&v.push([d[S].entries[O],O]);return v},null).execute();let m=d[h],E=e*(m.entries.length-1)+l,y=n===-1?1:n/E,x=(t-r)/(d.length-1),f=0;for(let T=0;T<d.length;T++){let S=d[T],R=S.size*y,v=E*y-R,O=S.entries.length-1,P=O>0?Math.max(e,v/(O+2)):e,C=(E*y-(R+P*O))/2;S.entries.forEach(_=>{let w=_.obj.getSourceEdges().length===0;_.size.height*=y,_.obj.data.height*=y,_.obj.data.left=f,_.obj.data.top=C,_.obj.data.layer=T,_.obj.data.isTerminus=w,_.obj.data.isSource=T===0,_.obj.data.labelAlign=T===0?"end":T===d.length-1?"start":"middle",C+=_.size.height+P}),f+=x}let b=E*y,A=e;for(let T=0;T<20;T++){for(let S=1;S<d.length;S++)J0(d[S],o,A,b,!0);for(let S=d.length-2;S>=1;S--)J0(d[S],o,A,b,!1)}for(let T=0;T<d.length;T++)d[T].entries.forEach(R=>{let v=R.size.height/y,O=0,P=Array.from(R.obj.getSourceEdges());P.sort((C,_)=>{let w=C.target.data.top+C.target.data.height/2,$=_.target.data.top+_.target.data.height/2;return w<$?-1:w>$?1:0});for(let C=0;C<P.length;C++){let _=So(P[C],o);P[C].data.lineWidth=_*y;let w=O+_/2;P[C].anchors=P[C].anchors||{},P[C].anchors.source={y:w/v,x:1,ox:1,oy:0},O+=_}O=0;let I=Array.from(R.obj.getTargetEdges());I.sort((C,_)=>{let w=C.source.data.top+C.source.data.height/2,$=_.source.data.top+_.source.data.height/2;return w<$?-1:w>$?1:0});for(let C=0;C<I.length;C++){let _=So(I[C],o),w=O+_/2;I[C].anchors=I[C].anchors||{},I[C].anchors.target={y:w/v,x:0,ox:-1,oy:0},O+=_}});return{layers:d,scale:y}}function J0(i,r,e,t,n){i.entries.forEach(a=>{let l=n?a.obj.getTargetEdges():a.obj.getSourceEdges();if(l.length>0){let h=0,d=0;l.forEach(u=>{let p=n?u.source:u.target,m=So(u,r);d+=(p.data.top+p.data.height/2)*m,h+=m}),a.obj.data.top=d/h-a.obj.data.height/2}}),i.entries.sort((a,l)=>a.obj.data.top-l.obj.data.top);for(let a=0;a<i.entries.length-1;a++){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data,d=l.top+l.height+e-h.top;d>0&&(l.top-=d/2,h.top+=d/2)}let o=i.entries[0].obj.data;o.top<0&&(o.top=0);for(let a=1;a<i.entries.length;a++){let l=i.entries[a-1].obj.data,h=i.entries[a].obj.data;h.top<l.top+l.height+e&&(h.top=l.top+l.height+e)}let s=i.entries[i.entries.length-1].obj.data;if(s.top+s.height>t){s.top=t-s.height;for(let a=i.entries.length-2;a>=0;a--){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data;l.top+l.height+e>h.top&&(l.top=h.top-e-l.height)}}}var Sb="sankey-csv",Tb="vjs-sankey-edge",en="vjs-sankey-unselected",To="vjs-sankey-selected",hG="vjs-sankey",vb="vjs-sankey-node",Cb="vjs-sankey-label",K0=class extends bo{constructor(e,t){super(e,t);c(this,"linkColorStrategy");c(this,"linkColor");c(this,"vc");c(this,"Cc");c(this,"Bg");c(this,"D");c(this,"qe");c(this,"ti");c(this,"Le");c(this,"Lo");c(this,"ha");c(this,"wo");c(this,"Do",[]);c(this,"ri");c(this,"No",{});c(this,"ni",{});c(this,"Io",{});c(this,"Vo",{});c(this,"Mo",[]);c(this,"Ro",null);c(this,"ut");c(this,"$tooltip");L(e,hG),hA("sankey-csv",zS),this.Ro=t.pivot!=null&&t.pivot.length>0?t.pivot:null,this.ha=t.labelProperty||"label",this.Lo=t.valueProperty||"value",this.Bg=t.tooltipSuffix||"",this.linkColorStrategy=t.linkColorStrategy||"static",this.linkColor=t.linkColor||"#444444",this.vc=t.nodeWidth||15,this.Cc=t.nodePadding||10,this.ti=t.interactive!==!1;let n=t.labels||{};this.ut={font:Pi(12,"normal","normal","sans-serif",n.font),padding:n.padding==null?5:n.padding,backgroundColor:n.backgroundColor||"#FFFFFF56"},this.EA(),this.Mn(t)}get currentModel(){return this.Ro!=null?this.qe:this.D}gA(e,t){switch(this.linkColorStrategy){case"source-target":return{gradient:[[0,e.color],[100,t.color]]};case"target":return{color:t.color};case"static":return{color:this.linkColor};case"source":default:return{color:e.color}}}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){if(this.D==null)return;this.dim=this.$drawDecoration(e,t,n),t=this.dim.chartWidth,n=this.dim.chartHeight;let s=G(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`});e.appendChild(s);let{layers:a}=Ab(this.D,this.vc,this.Cc,t,n,this.Lo);if(this.Ro){if(this.qe.getNodes().length===0){let b=cG(a,this.Ro,this.Lo,this.ha);this.fA(b)}a=Ab(this.qe,this.vc,this.Cc,t,n,this.Lo).layers}this.Mo=a;let l=G(q);s.appendChild(l);let h=G(q);s.appendChild(h);let d=G(q);if(s.appendChild(d),this.Mo.length===0||this.Mo[0].entries.length===0)return;this.ti&&(this.$tooltip=new Pb(e,{format:"{{content}}",valueSuffix:this.Bg||""},this.Lo,this.ha));let u=0,p=0,m=1/0,g=1/0;function E(b){let A=b.getBBox();u=Math.max(u,Math.round(A.x+A.width)),m=Math.min(m,Math.round(A.x)),p=Math.max(p,Math.round(A.y+A.height)),g=Math.min(g,Math.round(A.y))}let y=this.currentModel;y.getNodes().forEach(b=>{if(b.data.height>0){let A=G(Z,{x:b.data.left,y:b.data.top,width:b.data.width,height:b.data.height,fill:b.data.color,[te]:b.id},{},vb);this.ni[b.id]=A,h.appendChild(A),E(A);let T=G(q),S=b.data[this.ha]||b.getFullId(),R=G(et,{"dominant-baseline":"center","text-anchor":b.data.labelAlign,x:b.data.labelAlign==="end"&&b.data.layer===0?b.data.left-this.ut.padding:b.data.labelAlign==="start"&&b.data.layer===this.Mo.length-1?b.data.left+b.data.width+this.ut.padding:b.data.left+b.data.width/2,y:b.data.top+b.data.height/2,"font-size":this.ut.font.size,"font-style":this.ut.font.style,[te]:b.id},{},Cb);if(R.innerHTML=S,this.Io[b.id]=R,T.appendChild(R),d.appendChild(T),this.ut.backgroundColor!=="transparent"){let v=R.getBBox(),O=G(Z,{rx:"3",x:v.x-this.ut.padding,y:v.y-this.ut.padding,width:v.width+this.ut.padding*2,height:v.height+this.ut.padding*2,fill:this.ut.backgroundColor,[te]:b.id});this.Vo[b.id]=O,T.insertBefore(O,R)}E(R)}});let x=y.getAllEdges().slice();x.sort((b,A)=>A.data.lineWidth-b.data.lineWidth),x.forEach(b=>{let A=b.anchors.source,T=b.anchors.target,S=b.source.data,R=b.target.data,v={x:S.left+S.width,y:S.top+A.y*S.height},O={x:R.left,y:R.top+T.y*R.height},P=.25*(O.x-v.x),I=b.data.lineWidth/2,C=v.y-I,_=v.y+I,w=O.y-I,$=O.y+I,M={d:[`M ${v.x} ${C}`,`C ${v.x+P} ${C}, ${O.x-P} ${w}, ${O.x} ${w}`,`L ${O.x} ${$}`,`C ${O.x-P} ${$}, ${v.x+P} ${_}, ${v.x} ${_}`,"Z"].join(" "),opacity:.3,stroke:"none",[Qe]:b.id};if(b.data.color)M.fill=b.data.color;else if(b.data.gradient){let{id:V,g:J}=$C(v.x,O.x,b.data.gradient);l.appendChild(J),M.fill=`url(#${V})`}let D=G(ee,M,{},Tb);this.No[b.id]=D,l.appendChild(D),E(D)}),t=u+this.dim.chartX-m,n=p+this.dim.chartY,e.setAttribute("viewBox",`${m} 0 ${t} ${n}`);let f=this.container.querySelector(".vjs-chart-background");f.setAttribute("x",`${m}`),f.setAttribute("width",`${t}`),f.setAttribute("y",`${g}`),f.setAttribute("height",`${n}`),this.dim.chartWidth=u-m,this.dim.chartHeight=p,this.dim.chartEndX=t,this.dim.chartEndY=n,this.dim.width=t,this.dim.height=n,this.dim.viewBox={x:m,y:0,width:t,height:n},this.fire(Fg)}nodeDecorator(e,t){return Object.assign(e,{color:this.colorGenerator.generate(e),width:50,height:50})}edgeDecorator(e,t,n){return Object.assign(e,this.gA(t,n))}Mn(e){if(this.D=En(),this.qe=En(),e.dataSource==null)(e.url!=null||e.csvData!=null||e.jsonData!=null)&&this.load({url:e.url,csvData:e.csvData,jsonData:e.jsonData});else{this.Le=e.dataSource;let t=ya(()=>{this.Fg()},150);this.Le.bind(Re,t),this.Le.bind(ve,t),this.Le.bind(Kt,t),this.Le.bind(Te,t),this.Le.bind(_e,t),this.Le.bind(Zt,t),this.Le.bind(xt,t),this.Le.bind(bt,t),this.Le.bind(ur,t),this.Le.bind(Jt,t),this.Le.bind(Mr,t),this.Fg()}}fA(e){this.qe.clear(),e.nodes.forEach(t=>{this.qe.addNode(this.nodeDecorator(Object.assign({},t),!1))}),e.edges.forEach(t=>{let n=this.qe.getVertex(t.source),o=this.qe.getVertex(t.target);this.qe.addEdge({source:n,target:o,data:this.edgeDecorator(Object.assign({},t.data||{}),n.data,o.data)})})}Fg(){this.D.clear(),this.qe.clear(),this.Le.getNodes().forEach(e=>{this.D.addNode(this.nodeDecorator(Object.assign({},e.data),!1))}),this.Le.getAllEdges().forEach(e=>{let t=this.D.getVertex(e.source.id),n=this.D.getVertex(e.target.id);this.D.addEdge({source:t,target:n,data:this.edgeDecorator(Object.assign({},e.data||{}),t.data,n.data)})}),this.$draw()}load(e,t){this.qe.clear(),this.D.clear();function n(){return e.dataType!=null?e.dataType:e.csvData!=null?Sb:e.jsonData!=null?Wt:e.url!=null&&e.url.indexOf(".json")!==-1?Wt:Sb}this.D.load({type:n(),url:e.url,data:e.csvData||e.jsonData,incremental:!1,onload:()=>{this.$draw(),t&&t()},parameters:{nodeDecorator:this.nodeDecorator.bind(this),edgeDecorator:this.edgeDecorator.bind(this)}})}hasData(){return this.D!=null&&this.D.getNodes().length>0}destroy(){super.destroy()}yA(){this.wo!=null&&(this.ri.vertices.forEach(e=>{F(this.ni[e.id],To),F(this.Io[e.id],To);let t=this.Vo[e.id];t&&F(t,To)}),this.Do.forEach(e=>F(e[1],To)),Object.values(this.No).forEach(e=>F(e,en)),Object.values(this.ni).forEach(e=>F(e,en)),Object.values(this.Io).forEach(e=>F(e,en)),Object.values(this.Vo).forEach(e=>F(e,en))),this.wo=null,this.ri=null,this.Do.length=0}Ug(e){return this.Mo.findIndex(t=>t.entries.find(n=>n.id===e.id)!=null)}xA(e){let t=new Map;return e.getAllEdges().forEach(n=>{let o=n.source===e?n.target:n.source,s=`${o.getFullId()}-${n.id}`;t.has(s)||t.set(s,[o,n])}),Array.from(t.values())}bA(e){let t=new Set,n=new Set;t.add(e);let o=(s,a)=>{let l=this.Ug(s);this.xA(s).forEach(d=>{t.has(d[0])||this.Ug(d[0])>l===a&&(n.add(d[1]),t.add(d[0]),o(d[0],a))})};return o(e,!0),o(e,!1),{vertices:Array.from(t),edges:Array.from(n)}}Pc(e){this.yA(),e!=null&&(this.wo=this.currentModel.getNode(e),Object.values(this.ni).forEach(n=>L(n,en)),Object.values(this.Io).forEach(n=>L(n,en)),Object.values(this.Vo).forEach(n=>L(n,en)),Object.values(this.No).forEach(n=>L(n,en)),this.ri=this.bA(this.wo),this.ri.edges.slice().sort((n,o)=>n.data.lineWidth-o.data.lineWidth),this.Do=this.ri.edges.map(n=>[n,this.No[n.id]]),this.ri.vertices.forEach(n=>{Xt(this.ni[n.id],[To],[en]),Xt(this.Io[n.id],[To],[en]);let o=this.Vo[n.id];o&&Xt(o,[To],[en])}),this.Do.forEach(n=>{Xt(n[1],[To],[en])}),this.fire("sankey:hover",{vertex:this.wo,edges:this.Do}))}EA(){this.ti&&(this.$eventManager.on(this.container,st,z(vb,Cb),e=>{let n=e.target.getAttribute(te);this.Pc(n),this.$tooltip.showNodeTooltip(this.currentModel.getNode(n),e,this.ni[n])}),this.$eventManager.on(this.container,ot,z(vb,Cb,Tb),e=>{this.Pc(null)}),this.$eventManager.on(this.container,st,z(Tb),e=>{let n=e.target.getAttribute(Qe);this.Pc(this.currentModel.getEdge(n).source.id),this.$tooltip.showEdgeTooltip(this.currentModel.getEdge(n),e,this.No[n])}))}pivot(e){this.Ro=e!=null&&e.length>0?e:null,this.qe.clear(),this.$draw()}clearPivot(){this.pivot(null)}},Pb=class extends sl{constructor(e,t,n,o){super(e,t);this.valueProperty=n;this.labelProperty=o}showEdgeTooltip(e,t,n){let o=[e.source,e.target];o.sort((d,u)=>d.data.layer-u.data.layer);let s=o[0].data[this.labelProperty]||o[0].id,a=o[1].data[this.labelProperty]||o[1].id,l=`${s} \u2192 ${a}: ${parseInt(e.data[this.valueProperty])} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}showNodeTooltip(e,t,n){let o=0,s=e.getSourceEdges();s.length>0?o=s.map(d=>So(d,this.valueProperty)).reduce((d,u)=>d+u):o=e.getTargetEdges().map(u=>So(u,this.valueProperty)).reduce((u,p)=>u+p);let l=`${e.data[this.labelProperty]||e.id} : ${o.toFixed(2)} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}};function cG(i,r,e,t){let n=[],o=[],s=new Set;i.forEach(a=>{a.entries.forEach(l=>{n.push(tn({id:l.id},l.obj.data))})});for(let a=0;a<i.length-1;a++){let l=i[a],h=new Map,d=new Map;l.entries.forEach(u=>{let p=u.id;u.obj.getSourceEdges().forEach(m=>{let g=m.target.id,E=m.data[r]||"Unspecified",y=So(m,e),x=`v_${a}_${E}`;s.has(x)||(n.push({id:x,[t]:E,isVirtual:!0,type:"pivot-metadata"}),s.add(x)),h.has(p)||h.set(p,new Map);let f=h.get(p);f.set(E,(f.get(E)||0)+y),d.has(x)||d.set(x,new Map);let b=d.get(x);b.set(g,(b.get(g)||0)+y)})}),h.forEach((u,p)=>{u.forEach((m,g)=>{o.push({source:p,target:`v_${a}_${g}`,data:{[r]:g,[e]:m}})})}),d.forEach((u,p)=>{u.forEach((m,g)=>{o.push({source:p,target:g,data:{[r]:p.split("_").pop(),[e]:m}})})})}return{nodes:n,edges:o}}var q0=class extends pl{constructor(e,t){super(e,t);this.options=t;L(e,c0)}$getMarkerSize(e,t){return e.markerSize!=null?e.markerSize:this.$getBaseMarkerSize()}$getDataPointCssClass(){return d0}};export{LC as $__proxyEdge,RC as $__unproxyEdge,$_ as $_createCircularSvgHandles,G_ as $_createRectangularSvgHandles,Ve as $_createSvg,bx as $_setSkeletonPosition,ch as $addOverlay,Ea as $appendAtIndex,de as $attr,Sc as $autoCalculateChartScale,Tc as $calculateChartScaleWithStep,b0 as $calculateChartScaleWithSteps,OC as $createConnection,$C as $createGradient,Nc as $createMarker,uv as $defaultOrthogonalPathCompute,qw as $defaultStraightPathCompute,rx as $doImageExport,ZT as $getConnectorPathData,qg as $getMarker,Ff as $getOverlay,CD as $getOverlays,HL as $isCompoundAction,aS as $isGroupSizeChangedAction,sS as $isMoveAction,oS as $isUpdateAction,fO as $makeAndAppendCircularHandle,yO as $makeAndAppendRectangularHandle,Hy as $makeCircularHandle,ms as $makeFieldKey,yI as $makeRectangularHandle,Pi as $prepareFontSpec,yv as $rewriteOrthogonalConnector,S0 as $spaceLabels,G as $svgNode,If as $updateLabelOverlayFont,qe as ABSOLUTE,rC as ACTION_ADD,nC as ACTION_REMOVE,Hoe as ADD_CLASS_ACTION,p3 as ALL_GROUPS_RELAYOUT,jy as ANCHOR_PLACEHOLDER_SELECTOR,Xa as ANIMATION_PHASE_CANCELLED,ja as ANIMATION_PHASE_FINISHED,z_ as ANIMATION_PHASE_INITIALIZED,X_ as ANIMATION_PHASE_TRAVERSING_EDGE,_x as ANIMATION_PHASE_TRAVERSING_END,Ox as ANIMATION_PHASE_TRAVERSING_START,SP as ANIM_SURFACE_ELEMENT_FLASH,ut as APPEND_TO_CURRENT,Ys as AStarGrid,Kn as ATTRIBUTE_CHART_CATEGORY,mJe as ATTRIBUTE_CHART_FILTERED_SERIES,Et as ATTRIBUTE_CHART_SERIES,jg as ATTRIBUTE_CHART_STACK,Hg as ATTRIBUTE_CHART_STACK_TOTAL,kg as ATTRIBUTE_CHART_VALUE,JS as ATTRIBUTE_CLASS,yM as ATTRIBUTE_COLOR_PICKER_MAX_COLORS,ny as ATTRIBUTE_CONTAINER,kS as ATTRIBUTE_CONTEXT,II as ATTRIBUTE_CONTROLS_ORIENTATION,Eg as ATTRIBUTE_DATA_SHAPE_ID,WS as ATTRIBUTE_DEFAULT,vv as ATTRIBUTE_ELEMENTS_DRAGGABLE,ule as ATTRIBUTE_FILL,xre as ATTRIBUTE_GROUP,Wp as ATTRIBUTE_GROUP_COLLAPSED_CONTENT,iy as ATTRIBUTE_GROUP_CONTENT,kp as ATTRIBUTE_GROUP_EXPANDED_CONTENT,YN as ATTRIBUTE_ICON_ID,eO as ATTRIBUTE_ICON_KEY,QP as ATTRIBUTE_ICON_SIZE,gh as ATTRIBUTE_IS_GROUP,jE as ATTRIBUTE_LOOKUP,mt as ATTRIBUTE_MANAGED,rh as ATTRIBUTE_NOT_DRAGGABLE,UN as ATTRIBUTE_ORIENTATION,mm as ATTRIBUTE_ORIGIN,KP as ATTRIBUTE_ORIGIN_X,qP as ATTRIBUTE_ORIGIN_Y,iR as ATTRIBUTE_POPUP_POSITION,KO as ATTRIBUTE_RESET_SELECTION,yle as ATTRIBUTE_STROKE,kf as ATTRIBUTE_STROKE_DASHARRAY,Ele as ATTRIBUTE_STROKE_DASHOFFSET,mle as ATTRIBUTE_STROKE_LINECAP,ple as ATTRIBUTE_STROKE_LINEJOIN,gle as ATTRIBUTE_STROKE_MITERLIMIT,fle as ATTRIBUTE_STROKE_OPACITY,xle as ATTRIBUTE_STROKE_WIDTH,KS as ATTRIBUTE_STYLE,Tv as ATTRIBUTE_SUPPRESS_VERTEX_EVENTS,Pf as ATTRIBUTE_TABINDEX,ble as ATTRIBUTE_TEXT_ANCHOR,yi as ATTRIBUTE_TRANSFORM,vp as ATTRIBUTE_VALUE_NON_SCALING_STROKE,Tp as ATTRIBUTE_VECTOR_EFFECT,cle as ATTRIBUTE_VERSION,Of as ATTRIBUTE_VJS_ALLOW_LOOPBACK,Qe as ATTRIBUTE_VJS_EDGE,tp as ATTRIBUTE_VJS_EDGE_TYPE,yr as ATTRIBUTE_VJS_ENABLED,np as ATTRIBUTE_VJS_MAGNET,LO as ATTRIBUTE_VJS_MINIVIEW_TYPE,qy as ATTRIBUTE_VJS_NODE_ID,ip as ATTRIBUTE_VJS_OVERLAY_ID,hn as ATTRIBUTE_VJS_PORT,nh as ATTRIBUTE_VJS_PORT_ID,Hr as ATTRIBUTE_VJS_PORT_TYPE,ts as ATTRIBUTE_VJS_SCOPE,Cv as ATTRIBUTE_VJS_SOURCE,ha as ATTRIBUTE_VJS_SOURCE_PORT,_f as ATTRIBUTE_VJS_SOURCE_PORT_ID,Ki as ATTRIBUTE_VJS_SOURCE_PORT_TYPE,Wo as ATTRIBUTE_VJS_TARGET,Zo as ATTRIBUTE_VJS_TARGET_PORT,rp as ATTRIBUTE_VJS_TARGET_PORT_ID,qi as ATTRIBUTE_VJS_TARGET_PORT_TYPE,te as ATTRIBUTE_VJS_VERTEX,dle as ATTRIBUTE_XMLNS,za as ATT_DATA_DIR,yx as ATT_VJS_RESIZABLE,xx as ATT_VJS_ROTATABLE,Ex as ATT_VJS_X_RESIZE,fx as ATT_VJS_Y_RESIZE,Oi as AXIS_POSITION_END,ar as AXIS_POSITION_START,ri as AbsoluteBackedLayout,_o as AbsoluteLayout,zi as AbstractEntry,Gs as AbstractHierarchicalLayout,Sn as AbstractLayout,Qc as AbstractLayoutAdapter,Kd as AddGroupMemberAction,Wl as AnchorLocations,Zu as ArcSegmentHandler,F0 as AreaChart,Ic as AreaPlot,tl as ArrayBasedSeries,_r as ArrowOverlay,fd as AssignLayersStage,Nl as AutoSaver,uo as AvailableBackgrounds,nO as BASIC_SHAPES,Pr as BLOCK,ht as BOTTOM,ds as BackgroundPlugin,md as BalloonLayout,Y0 as BarChart,Dr as BarPlot,jc as Base,Ce as BaseBrowserUIPlugin,bo as BaseChart,Ca as BaseDomUiLayoutAdapter,Rc as BaseSeriesBasedChartDataSource,vi as BezierEditor,$w as BezierSegmentHandler,el as BlankDataSource,wc as BlankScale,Oa as BrowserUI,bm as BrowserUIClipboard,jx as BrowserUIModel,os as BrowserUiRecado,z0 as BubbleChart,bb as BubbleChartSeries,It as CENTER,w0 as CHART_AXIS_TITLE_ALIGN_END,Qa as CHART_AXIS_TITLE_ALIGN_MIDDLE,L0 as CHART_AXIS_TITLE_ALIGN_START,dZe as CHART_TITLE_ALIGN_LEFT,cZe as CHART_TITLE_ALIGN_MIDDLE,uZe as CHART_TITLE_ALIGN_RIGHT,_c as CHART_TITLE_PLACEMENT_BOTTOM,R1 as CHART_TITLE_PLACEMENT_TOP,gPe as CLASS_ANCHOR_CANDIDATE,Da as CLASS_ANCHOR_PLACEHOLDER,y0 as CLASS_AREA_CHART,Gg as CLASS_AREA_CHART_AREA,OI as CLASS_BACKGROUND,_I as CLASS_BACKGROUND_BORDER,cs as CLASS_BACKGROUND_GRID,Bm as CLASS_BACKGROUND_GRID_DOT_MAJOR,wI as CLASS_BACKGROUND_GRID_DOT_MINOR,LI as CLASS_BACKGROUND_GRID_MAJOR,RI as CLASS_BACKGROUND_GRID_MINOR,AI as CLASS_BACKGROUND_TILE,s0 as CLASS_BAR_CHART,a0 as CLASS_BAR_CHART_BAR,SR as CLASS_BEZIER_GUIDELINE,uc as CLASS_BEZIER_HANDLE,Xx as CLASS_BEZIER_HANDLE_CONTROL_POINT,bR as CLASS_BEZIER_HANDLE_CONTROL_POINT_1,AR as CLASS_BEZIER_HANDLE_CONTROL_POINT_2,l0 as CLASS_BUBBLE_CHART,h0 as CLASS_BUBBLE_CHART_DATA_POINT,qa as CLASS_CHART_AXIS,ib as CLASS_CHART_AXIS_LABELS,ob as CLASS_CHART_AXIS_LINE,sb as CLASS_CHART_AXIS_TITLE,KR as CLASS_CHART_BACKGROUND,xc as CLASS_CHART_BODY,bc as CLASS_CHART_CROSSHAIR,Ac as CLASS_CHART_CROSSHAIR_LABEL,ab as CLASS_CHART_EMPTY,hb as CLASS_CHART_GRIDLINE,lb as CLASS_CHART_GRIDLINES,QR as CLASS_CHART_LEGEND,t0 as CLASS_CHART_LEGEND_DOT,Ng as CLASS_CHART_LEGEND_ITEM,e0 as CLASS_CHART_LEGEND_LABEL,Ka as CLASS_CHART_PLOT_BACKGROUND,yn as CLASS_CHART_POINT,Vg as CLASS_CHART_POINT_HIT_AREA,E0 as CLASS_CHART_SCALE_LABEL,qR as CLASS_CHART_SERIES,p0 as CLASS_CHART_SUBTITLE,u0 as CLASS_CHART_TITLE,Ig as CLASS_CHART_X_AXIS,n0 as CLASS_CHART_X_AXIS_TITLE,Mg as CLASS_CHART_Y_AXIS,r0 as CLASS_CHART_Y_AXIS_TITLE,EM as CLASS_COLOR_PICKER,c_ as CLASS_COLOR_PICKER_SWATCH,h_ as CLASS_COLOR_PICKER_SWATCHES,i0 as CLASS_COLUMN_CHART,o0 as CLASS_COLUMN_CHART_COLUMN,ih as CLASS_CONNECTED,Xy as CLASS_CONNECTION_EDIT,ca as CLASS_CONNECTOR,Ov as CLASS_CONNECTOR_OUTLINE,Pv as CLASS_CONNECTOR_PATH,oo as CLASS_CONNECTOR_SOURCE_DRAG,so as CLASS_CONNECTOR_TARGET_DRAG,_v as CLASS_CONNECTOR_TRANSIENT,MP as CLASS_CONNECTOR_TRANSIENT_DRAG,zm as CLASS_CONTROLS,$O as CLASS_CONTROLS_CLEAR,DO as CLASS_CONTROLS_PAN_MODE,GO as CLASS_CONTROLS_REDO,FO as CLASS_CONTROLS_RESET_SELECTION,Qy as CLASS_CONTROLS_SELECT_MODE,VO as CLASS_CONTROLS_UNDO,IO as CLASS_CONTROLS_ZOOM_IN,MO as CLASS_CONTROLS_ZOOM_OUT,NO as CLASS_CONTROLS_ZOOM_TO_FIT,xDe as CLASS_COPY_PASTE_CONTROLS,g0 as CLASS_CROSSHAIR_CATEGORY_AXIS,m0 as CLASS_CROSSHAIR_VALUE_AXIS,_y as CLASS_DEFAULT_GROUP,Oy as CLASS_DEFAULT_NODE,Gx as CLASS_DIAGRAM_CELL_TOOL,eR as CLASS_DIAGRAM_CLONE_CELL,tR as CLASS_DIAGRAM_DELETE_CELL,Vx as CLASS_DIAGRAM_GROUP,GM as CLASS_DIAGRAM_LINK_CELL,Mx as CLASS_DIAGRAM_NODE,xr as CLASS_DRAG_ACTIVE,br as CLASS_DRAG_HOVER,Lh as CLASS_DRAG_HOVER_CANNOT_DROP,Ry as CLASS_DRAG_ORIGINAL_GROUP,wv as CLASS_DUMMY_VERTEX,Dy as CLASS_EDGE_CLICK_ENTRY,ua as CLASS_EDGE_DELETE_BUTTON,sp as CLASS_EDGE_DELETE_BUTTON_INTERNAL,Im as CLASS_EDGE_GUIDELINE,Cy as CLASS_EDGE_RELOCATING,xM as CLASS_EDGE_TYPE_PICKER,rg as CLASS_EDGE_TYPE_PICKER_SELECTED,rm as CLASS_EDGE_WILL_RELOCATE,DI as CLASS_ELASTIC_GROUP_RESIZE,Ch as CLASS_ELEMENT_DRAGGING,km as CLASS_EXPORT_CANCEL,BO as CLASS_EXPORT_CONTROLS,QO as CLASS_EXPORT_DIMENSIONS,e_ as CLASS_EXPORT_DOWNLOAD_TOOLS,Hm as CLASS_EXPORT_OVERLAY,jm as CLASS_EXPORT_UNDERLAY,K1 as CLASS_GAUGE_CHART,eG as CLASS_GAUGE_CHART_LABEL,tG as CLASS_GAUGE_CHART_NEEDLE,rG as CLASS_GAUGE_CHART_NEEDLE_PIVOT,Q1 as CLASS_GAUGE_CHART_TICK,q1 as CLASS_GAUGE_CHART_TRACK,X0 as CLASS_GAUGE_CHART_ZONE,Jo as CLASS_GROUP,vy as CLASS_GROUP_CHILD_ELEMENT_DRAGGING,Rf as CLASS_GROUP_COLLAPSED,Lf as CLASS_GROUP_EXPANDED,wh as CLASS_HOVER,gM as CLASS_INSPECTOR,a_ as CLASS_INSPECTOR_ACTIVE,l_ as CLASS_INSPECTOR_CLOSE,Qm as CLASS_INSPECTOR_INACTIVE,Rv as CLASS_LABEL_OVERLAY,TP as CLASS_LASSO,Oh as CLASS_LASSO_MASK,OP as CLASS_LASSO_MASK_BOTTOM,vP as CLASS_LASSO_MASK_LEFT,PP as CLASS_LASSO_MASK_RIGHT,CP as CLASS_LASSO_MASK_TOP,f0 as CLASS_LINE_CHART,nm as CLASS_MINIVIEW,_P as CLASS_MINIVIEW_CANVAS,IP as CLASS_MINIVIEW_CLICK_TO_CENTER,NP as CLASS_MINIVIEW_COLLAPSE,im as CLASS_MINIVIEW_COLLAPSED,wP as CLASS_MINIVIEW_ELEMENT,DP as CLASS_MINIVIEW_GROUP_ELEMENT,LP as CLASS_MINIVIEW_LASSO,RP as CLASS_MINIVIEW_PANNER,Py as CLASS_MINIVIEW_PANNING,_h as CLASS_MINIVIEW_SELECTED_ELEMENT,Ph as CLASS_MOST_RECENTLY_DRAGGED,Qi as CLASS_NODE,pR as CLASS_ORTHOGONAL_HANDLE,bg as CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE,gR as CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_HORIZONTAL,mR as CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_VERTICAL,da as CLASS_OVERLAY,oh as CLASS_OVERLAY_HIDE,Rx as CLASS_PALETTE,om as CLASS_PALETTE_CURRENT_SHAPE_TYPE,VP as CLASS_PALETTE_DRAG_ACTIVE,GP as CLASS_PALETTE_DRAG_HOVER,$P as CLASS_PALETTE_DRAG_HOVER_CANNOT_DROP,BP as CLASS_PALETTE_ELEMENT_CURRENT,gn as CLASS_PALETTE_SELECTED_ELEMENT,gg as CLASS_PALETTE_SET,ac as CLASS_PALETTE_SET_FILTER,wx as CLASS_PALETTE_SET_SHAPES,H_ as CLASS_PALETTE_SET_TITLE,lc as CLASS_PALETTE_SHAPE,Lx as CLASS_PALETTE_SHAPE_LABEL,Rh as CLASS_PALETTE_TAP_MODE_ACTIVE,k_ as CLASS_PALETTE_VERTEX_DRAWING_LASSO,dI as CLASS_PAN_ZOOM_CANVAS,cI as CLASS_PAN_ZOOM_VIEWPORT,rP as CLASS_PAPER,iP as CLASS_PAPER_CANVAS,iEe as CLASS_PAPER_NODE,nP as CLASS_PAPER_NO_SCALE,nG as CLASS_PIE_CHART,rE as CLASS_PIE_SLICE,k0 as CLASS_PIE_SLICE_SELECTED,Lv as CLASS_PORT,ys as CLASS_RESIZE_BORDER,N_ as CLASS_RESIZE_BORDER_BOTTOM,M_ as CLASS_RESIZE_BORDER_LEFT,V_ as CLASS_RESIZE_BORDER_RIGHT,I_ as CLASS_RESIZE_BORDER_TOP,D_ as CLASS_RESIZE_FRAME,Tt as CLASS_RESIZE_HANDLE,ax as CLASS_RESIZE_HANDLE_ACTIVE,px as CLASS_RESIZE_HANDLE_B,hx as CLASS_RESIZE_HANDLE_BL,dx as CLASS_RESIZE_HANDLE_BR,mx as CLASS_RESIZE_HANDLE_L,gx as CLASS_RESIZE_HANDLE_R,ux as CLASS_RESIZE_HANDLE_T,lx as CLASS_RESIZE_HANDLE_TL,cx as CLASS_RESIZE_HANDLE_TR,R_ as CLASS_RESIZE_SKELETON,L_ as CLASS_RESIZE_SKELETON_BORDERS,w_ as CLASS_RESIZE_SKELETON_BORDERS_VISIBLE,ic as CLASS_ROTATE_HANDLE,cg as CLASS_ROTATE_LEADER,hG as CLASS_SANKEY_CHART,Tb as CLASS_SANKEY_EDGE,Cb as CLASS_SANKEY_LABEL,vb as CLASS_SANKEY_NODE,To as CLASS_SANKEY_SELECTED,en as CLASS_SANKEY_UNSELECTED,c0 as CLASS_SCATTER_CHART,d0 as CLASS_SCATTER_CHART_DATA_POINT,yDe as CLASS_SELECTED_MODE,gt as CLASS_SELECT_DEFEAT,Mh as CLASS_SHAPE,Em as CLASS_SHAPE_ICON,lm as CLASS_SHAPE_LABEL,ag as CLASS_SNAPLINE,x_ as CLASS_SNAPLINE_ACTIVE,b_ as CLASS_SNAPLINE_ACTIVE_EXACT,ox as CLASS_SNAPLINE_EXACT,y_ as CLASS_SNAPLINE_HORIZONTAL,f_ as CLASS_SNAPLINE_VERTICAL,Ly as CLASS_SOURCE_HOVER,zx as CLASS_STRAIGHT_CONNECTOR_EDIT,Sg as CLASS_STRAIGHT_DELETE_HANDLE,Ts as CLASS_STRAIGHT_DRAG_HANDLE,fR as CLASS_STRAIGHT_EDITOR_GUIDELINE,dc as CLASS_STRAIGHT_HANDLE,Ag as CLASS_STRAIGHT_SPLIT_HANDLE,Ey as CLASS_SURFACE,yy as CLASS_SURFACE_CANVAS,xP as CLASS_SURFACE_DIRECT,Fn as CLASS_SURFACE_EDGE_DRAGGING,Ty as CLASS_SURFACE_ELEMENT_DRAGGING,Ay as CLASS_SURFACE_ELEMENT_FLASH,fy as CLASS_SURFACE_NO_PAN,xy as CLASS_SURFACE_PAN,Sy as CLASS_SURFACE_PANNING,by as CLASS_SURFACE_PAN_ACTIVE,afe as CLASS_SURFACE_PAN_BOTTOM,ife as CLASS_SURFACE_PAN_LEFT,sfe as CLASS_SURFACE_PAN_RIGHT,ofe as CLASS_SURFACE_PAN_TOP,AP as CLASS_SURFACE_POINTER_DEVICE,Cze as CLASS_SURFACE_POPUP,bP as CLASS_SURFACE_TOUCH_DEVICE,wy as CLASS_TARGET_HOVER,op as CLASS_TOGGLE_GROUP_COLLAPSE,FP as CLASS_TRANSIENT_VERTEX,sh as CLASS_UI_SELECTED_CONNECTION,eo as CLASS_UI_SELECTED_ELEMENT,sx as CLASS_VERTEX_DRAWING_GROUP_CHILD_CANDIDATE,A_ as CLASS_VERTEX_DRAWING_LASSO,pg as CLASS_VJS_ANIMATE_EDGE_TRAVERSABLE,Px as CLASS_VJS_ANIMATE_EDGE_TRAVERSED,sc as CLASS_VJS_ANIMATE_EDGE_TRAVERSING,vx as CLASS_VJS_ANIMATE_SOURCE,Cx as CLASS_VJS_ANIMATE_TARGET,bFe as CLASS_VJS_ANIMATE_VERTEX_TRAVERSABLE,AFe as CLASS_VJS_ANIMATE_VERTEX_TRAVERSED,Zn as CLASS_VJS_ANIMATE_VERTEX_TRAVERSING,F1 as CLASS_VJS_TOOLTIP,HI as CLEAR_PATH,jI as CLEAR_VIEW_BOX,fM as COLOR_PICKER_ELEMENT,XL as COMMIT_CURRENT,Yf as COMPONENT_TYPE_CONNECTION,kme as CONNECTION,jo as CONNECTOR_TYPE_CUBIC_BEZIER,aa as CONNECTOR_TYPE_ORTHOGONAL,zu as CONNECTOR_TYPE_QUADRATIC_BEZIER,qT as CONNECTOR_TYPE_SMOOTH,In as CONNECTOR_TYPE_STRAIGHT,Cl as CONNECT_REASON_API,sA as CONNECT_REASON_COPY_PASTE,Pl as CONNECT_REASON_DATA_LOAD,oA as CONNECT_REASON_TRANSIENT,iA as CONNECT_REASON_UNDO_REDO,Oo as CONNECT_REASON_USER_ACTIVITY,TV as CONTAINMENT_NOT_NEGATIVE,vV as CONTAINMENT_PARENT,CV as CONTAINMENT_PARENT_ENCLOSED,Ba as CONTENT_TYPES,aW as CSV,_d as CandidateSorter,fm as CanvasLayoutAdapter,Gd as CatchAllEventHandler,qn as CategoryValueChart,ll as CategoryValueTooltip,Ao as CategoryVsAxisPlot,Ug as ChartExporter,Bg as ChartLegend,Tr as ChartSeries,id as CircularLayout,Tg as ClickSplitMode,Mu as Clipboard,Uc as Cluster,rl as CollationSeries,Cg as Collicat,U0 as ColumnChart,_l as ColumnLayout,ea as CommentEntry,De as Components,Mo as CompoundAction,er as Connections,$e as Connectors,Xm as ControlsComponent,ec as ControlsPlugin,Iu as CopyData,UO as CopyPasteControlsComponent,Bs as CrossingStage,XE as CsvReader,Zf as CustomOverlayImpl,Tu as CustomTag,be as DEFAULT,EO as DEFAULT_ANCHOR_PLACEHOLDER_SIZE,B1 as DEFAULT_ARRAY_SERIES_ID_FIELD,$1 as DEFAULT_ARRAY_SERIES_LABEL_FIELD,G1 as DEFAULT_ARRAY_SERIES_MAX_VALUES_FIELD,V1 as DEFAULT_ARRAY_SERIES_MIN_VALUES_FIELD,I1 as DEFAULT_ARRAY_SERIES_RANGE_START_FIELD,N1 as DEFAULT_ARRAY_SERIES_STEP,M1 as DEFAULT_ARRAY_SERIES_VALUES_FIELD,_i as DEFAULT_AXIS_LINE_SIZE,C1 as DEFAULT_BACKGROUND_COLOR,Z1 as DEFAULT_BAR_GAP,IT as DEFAULT_BEZIER_CONTROL_POINT_SCALE,Pw as DEFAULT_BEZIER_LOOPBACK_DISTANCE,v_ as DEFAULT_BORDER_HANDLE_SIZE,N0 as DEFAULT_CATEGORY_AXIS_FONT_SIZE,I0 as DEFAULT_CATEGORY_AXIS_FONT_STYLE,k1 as DEFAULT_CATEGORY_FILL_RATIO,v0 as DEFAULT_CHART_EMPTY_MESSAGE,C0 as DEFAULT_CHART_ERROR_MESSAGE,rO as DEFAULT_COLOR,Gy as DEFAULT_COLOR_PROPERTY,gO as DEFAULT_CONNECTOR_EDITOR_BUTTON_SIZE,Wg as DEFAULT_CORNER_RADIUS,K_ as DEFAULT_DIAGRAM_CELL_HEIGHT,J_ as DEFAULT_DIAGRAM_CELL_WIDTH,VM as DEFAULT_DIAGRAM_TOOLS_BUTTON_SIZE,jD as DEFAULT_DOT_OVERLAY_RADIUS,Zm as DEFAULT_DOWNLOAD_BUTTON_LABEL,RE as DEFAULT_EDGE_NODE_SIZE,WD as DEFAULT_ELLIPSE_OVERLAY_RADIUS_X,ZD as DEFAULT_ELLIPSE_OVERLAY_RADIUS_Y,Wm as DEFAULT_EXPORT_FILENAME,Bh as DEFAULT_FILL_COLOR,Vy as DEFAULT_FILL_PROPERTY,RV as DEFAULT_FLOWCHART_ARROW_LENGTH,_V as DEFAULT_FLOWCHART_ARROW_WIDTH,wV as DEFAULT_FLOWCHART_PROPERTY_LINE_STYLE,LV as DEFAULT_FLOWCHART_PROPERTY_MARKERS,TI as DEFAULT_GRID,R0 as DEFAULT_GRID_LINE_COLOR,O_ as DEFAULT_HANDLE_OFFSET,CA as DEFAULT_HEIGHT_ATTRIBUTE,OA as DEFAULT_HIERARCHICAL_LAYOUT_ALIGN,LA as DEFAULT_HIERARCHICAL_LAYOUT_ALIGNMENT,_A as DEFAULT_HIERARCHICAL_LAYOUT_PADDING,RA as DEFAULT_HIERARCHICAL_LAYOUT_SPACING,Ed as DEFAULT_HIERARCHY_LAYOUT_ALIGNMENT,wf as DEFAULT_KEY_ALLOW_NESTED_GROUPS,ah as DEFAULT_KEY_ANCHOR,lh as DEFAULT_KEY_ANCHORS,Dv as DEFAULT_KEY_ASTAR_VERTEX_BORDER,Nv as DEFAULT_KEY_ASTAR_VERTEX_BUFFER,ap as DEFAULT_KEY_CONNECTOR,Iv as DEFAULT_KEY_CSS_CLASS,kre as DEFAULT_KEY_EDGES_DETACHABLE,Mv as DEFAULT_KEY_EDGE_RELOCATE_HANDLE_SIZE,Wre as DEFAULT_KEY_GROUP_SIZE,Vv as DEFAULT_KEY_HOVER_CLASS,lp as DEFAULT_KEY_HOVER_PAINT_STYLE,Gv as DEFAULT_KEY_MAX_CONNECTIONS,Zre as DEFAULT_KEY_NODE_SIZE,Ko as DEFAULT_KEY_PAINT_STYLE,Jre as DEFAULT_KEY_REATTACH_EDGES,Df as DEFAULT_KEY_SCOPE,P1 as DEFAULT_LABEL_COLOR,kN as DEFAULT_LABEL_FILL_RATIO,BD as DEFAULT_LABEL_LOCATION,Vf as DEFAULT_LABEL_LOCATION_ATTRIBUTE,ao as DEFAULT_LABEL_PROPERTY,AA as DEFAULT_LEFT_ATTRIBUTE,w1 as DEFAULT_LEGEND_BACKGROUND_COLOR,L1 as DEFAULT_LEGEND_OUTLINE_WIDTH,E1 as DEFAULT_LEGEND_PADDING,kh as DEFAULT_LINE_STROKE,_1 as DEFAULT_MARGIN,W1 as DEFAULT_MAXIMUM_BAR_WIDTH,P_ as DEFAULT_MINIMUM_HEIGHT,C_ as DEFAULT_MINIMUM_WIDTH,QT as DEFAULT_ORTHOGONAL_STUB,ss as DEFAULT_OUTLINE_COLOR,Gh as DEFAULT_OUTLINE_PROPERTY,Fh as DEFAULT_OUTLINE_WIDTH,$h as DEFAULT_OUTLINE_WIDTH_PROPERTY,OM as DEFAULT_PALETTE_SELECTOR,oP as DEFAULT_PAPER_MARGIN,kD as DEFAULT_RECTANGLE_OVERLAY_HEIGHT,HD as DEFAULT_RECTANGLE_OVERLAY_WIDTH,T_ as DEFAULT_ROTATE_HANDLE_SIZE,S_ as DEFAULT_ROTATE_LEADER_LENGTH,TA as DEFAULT_ROTATION_ATTRIBUTE,Kfe as DEFAULT_SET_DESCRIPTION,Jfe as DEFAULT_SET_NAME,q_ as DEFAULT_SHAPE_SETS,eD as DEFAULT_SMOOTHING,hg as DEFAULT_SVG_HANDLE_SIZE,PO as DEFAULT_TICK_LINE_STROKE,vI as DEFAULT_TICK_MARKS_PER_CELL,fb as DEFAULT_TITLE_PADDING,SA as DEFAULT_TOP_ATTRIBUTE,Zg as DEFAULT_VALUE_AXIS_FONT_SIZE,Jg as DEFAULT_VALUE_AXIS_FONT_STYLE,D0 as DEFAULT_VALUE_AXIS_PADDING,vA as DEFAULT_WIDTH_ATTRIBUTE,$v as DEFAULT_ZOOM_RANGE,Tn as DIAGONAL_AXIS_LR,ii as DIAGONAL_AXIS_RL,Ha as DRAG_GROUP_MEMBERSHIP_ADDED,E_ as DRAG_GROUP_MEMBERSHIP_ASSIGNED,qc as DataModel,zg as DataSeriesBasedDataSource,Qs as DatasetIndex,vm as Decorator,Cm as Decorators,dh as DefaultRouter,QL as DefaultSearchTokenizer,yg as Diagram,Jn as DiagramCell,nR as DiagramExportComponent,Ti as DiagramLink,hc as DiagramPalette,As as DiagramToolsPlugin,ue as DialogConstants,Ip as DiamondOverlay,Vp as DotOverlay,Zx as Drag,gs as DragGroupsPlugin,Kg as DualValueAxisTooltip,pl as DualValueChart,ul as DualValueChartSeries,Cr as EDGE,Hn as EDGE_DRAG_HANDLE,Xh as EDGE_INPUT_METHOD_CLICK,zn as EDGE_INPUT_METHOD_DRAG,jh as EDGE_INPUT_STATE_IDLE,Fy as EDGE_INPUT_STATE_LOCKED,OO as EDGE_ROUTING_PLUGIN_MODE_DIRECT,fLe as EDGE_ROUTING_PLUGIN_MODE_ORTHOGONAL,Cve as EDGE_SNAP_CENTER,uO as EDGE_SNAP_DEFAULT,pI as EDGE_SNAP_PERIMETER,bM as EDGE_TYPE_PICKER_ELEMENT,GS as EDGE_UPDATE_REASON_UPDATED,Hme as ELEMENT,ke as ELEMENT_CIRCLE,CC as ELEMENT_DEFS,Ke as ELEMENT_DIV,PC as ELEMENT_ELLIPSE,q as ELEMENT_G,zN as ELEMENT_INCLUDE_ICON,XN as ELEMENT_INCLUDE_ICONS,ee as ELEMENT_PATH,Z as ELEMENT_RECT,Le as ELEMENT_SVG,et as ELEMENT_TEXT,Hf as ELEMENT_TSPAN,wE as EMPTY_ASTAR_PATH,Di as EMPTY_BOUNDS,cD as EMPTY_ELEMENT,Qn as EPSILON,hS as EVENT_ADHOC_LAYOUT,Ws as EVENT_AFTER_LAYOUT_REFRESH,_R as EVENT_BEFORE_START,_n as EVENT_CANVAS_CLICK,wS as EVENT_CANVAS_DBLCLICK,eg as EVENT_CHANGE,Fg as EVENT_CHART_LOAD,ze as EVENT_CLICK,At as EVENT_CONTEXTMENU,$l as EVENT_CONTEXT_UPDATE,ME as EVENT_DATA_APPEND_END,IE as EVENT_DATA_APPEND_START,Mr as EVENT_DATA_LOAD_END,wo as EVENT_DATA_LOAD_START,VE as EVENT_DATA_UPDATED,Vo as EVENT_DBLCLICK,Ur as EVENT_DBLTAP,Qt as EVENT_DESELECT,$i as EVENT_DESTROY,RR as EVENT_DRAG,mV as EVENT_DROP,ur as EVENT_EDGE_ADDED,CS as EVENT_EDGE_CLICK,RS as EVENT_EDGE_CONTEXTMENU,PS as EVENT_EDGE_DBLCLICK,OS as EVENT_EDGE_DBLTAP,kA as EVENT_EDGE_DRAG,ZA as EVENT_EDGE_DRAG_ABORT,WA as EVENT_EDGE_DRAG_END,HA as EVENT_EDGE_DRAG_START,ai as EVENT_EDGE_GEOMETRY,Fl as EVENT_EDGE_MOUSEDOWN,au as EVENT_EDGE_MOUSEOUT,lu as EVENT_EDGE_MOUSEOVER,_S as EVENT_EDGE_MOUSEUP,li as EVENT_EDGE_PATH_EDITED,hu as EVENT_EDGE_REDRAW,bt as EVENT_EDGE_REMOVED,an as EVENT_EDGE_SOURCE_CHANGED,LS as EVENT_EDGE_TAP,sn as EVENT_EDGE_TARGET_CHANGED,Rd as EVENT_EDGE_TYPE_CHANGED,xt as EVENT_EDGE_UPDATED,Ky as EVENT_ELASTIC_GROUP_FRAME_REMOVE,Jy as EVENT_ELASTIC_GROUP_FRAME_RESIZE,Y_ as EVENT_END_NODE_TRAVERSAL,mo as EVENT_END_OVERLAY_ANIMATION,uS as EVENT_FOCUS,jA as EVENT_GRAPH_CHANGED,Jt as EVENT_GRAPH_CLEARED,Cn as EVENT_GRAPH_CLEAR_START,Zt as EVENT_GROUP_ADDED,ru as EVENT_GROUP_COLLAPSE,nu as EVENT_GROUP_EXPAND,Gi as EVENT_GROUP_MEMBER_ADDED,zs as EVENT_GROUP_MEMBER_REMOVED,Do as EVENT_GROUP_MOVE,Gr as EVENT_GROUP_MOVE_END,JA as EVENT_GROUP_MOVE_START,Bl as EVENT_GROUP_RELAYOUT,_e as EVENT_GROUP_REMOVED,Br as EVENT_GROUP_RENDERED,Dd as EVENT_GROUP_TYPE_CHANGED,Te as EVENT_GROUP_UPDATED,lS as EVENT_INTERNAL_CONNECTION,KA as EVENT_INTERNAL_EDGE_REDRAW,tu as EVENT_INTERNAL_ELEMENT_REPAINTED,Nd as EVENT_INTERNAL_GROUP_SIZE_CHANGED,Id as EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO,Md as EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO,Zs as EVENT_INTERNAL_VERTEX_UPDATED,Xn as EVENT_KEYUP,uu as EVENT_LASSO_END,cu as EVENT_LASSO_START,du as EVENT_LASSO_UPDATE,me as EVENT_MOUSEDOWN,GE as EVENT_MOUSEENTER,$E as EVENT_MOUSEEXIT,pS as EVENT_MOUSELEAVE,se as EVENT_MOUSEMOVE,ot as EVENT_MOUSEOUT,st as EVENT_MOUSEOVER,ae as EVENT_MOUSEUP,Kt as EVENT_NODE_ADDED,Mt as EVENT_NODE_MOVE,Vd as EVENT_NODE_MOVE_ABORT,Vt as EVENT_NODE_MOVE_END,Xs as EVENT_NODE_MOVE_START,ve as EVENT_NODE_REMOVED,Fr as EVENT_NODE_RENDERED,Ld as EVENT_NODE_TYPE_CHANGED,Re as EVENT_NODE_UPDATED,ou as EVENT_NODE_VISIBILITY,dS as EVENT_OBJECT_REPAINTED,EV as EVENT_OUT,gV as EVENT_OVER,Fi as EVENT_PAN,su as EVENT_PLUGIN_ADDED,cS as EVENT_PLUGIN_REMOVED,si as EVENT_PORT_ADDED,Vr as EVENT_PORT_REMOVED,wd as EVENT_PORT_TYPE_CHANGED,dr as EVENT_PORT_UPDATED,eS as EVENT_REDO,On as EVENT_RELAYOUT,qA as EVENT_RENDERER_ADDED,Pn as EVENT_RENDER_END,iu as EVENT_RENDER_START,qt as EVENT_SELECT,ir as EVENT_SELECTION_CLEARED,OR as EVENT_START,Tx as EVENT_START_NODE_TRAVERSAL,oc as EVENT_START_OVERLAY_ANIMATION,ug as EVENT_STATE,LR as EVENT_STOP,Rn as EVENT_SURFACE_MODE_CHANGED,W as EVENT_TAP,gS as EVENT_TOUCHEND,ES as EVENT_TOUCHMOVE,mS as EVENT_TOUCHSTART,QA as EVENT_UNDO,js as EVENT_UNDOREDO_UPDATE,fS as EVENT_VERTEX_CLICK,TS as EVENT_VERTEX_CONTEXTMENU,yS as EVENT_VERTEX_DBLCLICK,xS as EVENT_VERTEX_DBLTAP,u3 as EVENT_VERTEX_MOUSEDOWN,SS as EVENT_VERTEX_MOUSEMOVE,bS as EVENT_VERTEX_MOUSEOUT,AS as EVENT_VERTEX_MOUSEOVER,d3 as EVENT_VERTEX_MOUSEUP,vS as EVENT_VERTEX_TAP,$r as EVENT_ZOOM,Au as EachEntry,Ye as Edge,xm as EdgeGeometryTransformer,wa as EdgeHandlerBase,Dm as EdgeInputHandler,Na as EdgePathEditor,Nm as EdgeRelocateHandler,Zh as EdgeRoutingPlugin,bd as EdgeRoutingStage,ng as EdgeTypePicker,co as EditorBase,$a as ElasticGroupManager,_E as ElementCluster,xg as ElementDragHandler2,MR as ElementDragger,Yr as ElementEntry,Ji as ElementTypes,ui as Elements,Fp as EllipseOverlay,Vs as EmptyLayout,pp as EmptyRedrawResult,TE as EventGenerator,xe as EventManager,sg as ExportControlsPlugin,Lt as FACE_BOTTOM,_t as FACE_LEFT,Rt as FACE_RIGHT,Ot as FACE_TOP,ct as FALSE,TC as FILL,Cf as FIXED,IV as FLOWCHART_EDGE_TYPE_BOTH_ARROWS,VV as FLOWCHART_EDGE_TYPE_DASHED,MV as FLOWCHART_EDGE_TYPE_PLAIN,DV as FLOWCHART_EDGE_TYPE_SOURCE_ARROW,NV as FLOWCHART_EDGE_TYPE_TARGET_ARROW,Jye as FLOWCHART_SHAPES,Tm as FixedLayer,u6e as FlowchartBasicEdgeMappings,ld as ForceDirectedLayout,n0e as GRID_TYPE_DOTTED,i0e as GRID_TYPE_LINES,DS as GROUP_RELAYOUT_ADHOC,IS as GROUP_RELAYOUT_EXISTING_VERTEX_ADDED,m3 as GROUP_RELAYOUT_MEMBER_REMOVED,NS as GROUP_RELAYOUT_NEW_VERTEX_ADDED,j0 as GaugeChart,Ma as GeneratedGridBackground,vl as Graph,HS as GraphSearchIndex,Ro as GridLayout,uh as GridProfile,SI as GridTypes,oe as Group,Qd as GroupCollapseAction,eu as GroupExpandAction,ym as GroupLayoutAdapter,jd as GroupRemoveAction,Vl as GroupSizeChangedAction,EA as H,Me as HEIGHT,AE as HIERARCHICAL_JSON_DATATYPE,Sh as HTMLElementOverlay,QE as HeadlessRecado,ud as HierarchicalLayout,dd as HierarchicalParentRelativePlacementStrategy,Lo as HierarchyLayout,Ad as HierarchyLayoutModel,$s as HierarchyLayoutStage,ta as HilbertCurves,tO as ICONS_ORIENTATION_HORIZONTAL,jye as ICONS_ORIENTATION_VERTICAL,jP as ICON_CIRCLE,cm as ICON_CLONE,zP as ICON_CROSS,HP as ICON_GEAR,hm as ICON_LINK,Nh as ICON_ORIGIN_CENTER,Ih as ICON_ORIGIN_END,Dh as ICON_ORIGIN_START,XP as ICON_PLUS,dm as ICON_TRASH,AM as INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS,Qh as INSPECTOR_CONTEXT_RECENT_COLORS,Iy as IconElement,vu as IfEntry,qh as ImageExportUI,Ny as InBrowserTemplateResolver,tg as Inspector,Wt as JSON_DATATYPE,$I as LASSO_PATH,GI as LASSO_VIEW_BOX,bL as LAYOUT_TYPE_ABSOLUTE,CE as LAYOUT_TYPE_COLUMN,vE as LAYOUT_TYPE_GRID,RL as LAYOUT_TYPE_HIERARCHICAL,GA as LAYOUT_TYPE_HIERARCHY,PE as LAYOUT_TYPE_ROW,He as LEFT,gb as LEGEND_ALIGN_CENTER,mb as LEGEND_ALIGN_LEFT,T0 as LEGEND_ALIGN_RIGHT,pb as LEGEND_ORIENTATION_HORIZONTAL,f8e as LEGEND_ORIENTATION_VERTICAL,Eb as LEGEND_VERTICAL_ALIGN_BOTTOM,Oc as LEGEND_VERTICAL_ALIGN_MIDDLE,Pc as LEGEND_VERTICAL_ALIGN_TOP,hle as LINE_WIDTH,TD as LOCATION_ATTRIBUTE,fr as LabelOverlay,Ia as Lasso,kn as LassoPlugin,nt as Layouts,H0 as LineChart,Mc as LinePlot,rc as ListManagerPlugin,Pp as MagnetizeProfile,Mi as Magnetizer,Wn as MiniviewPlugin,Lc as ModelSeriesBasedDataSource,Hs as MoveAction,xA as NEGATIVE,jr as NOMINAL_SIZE,pt as NONE,he as Node,Xd as NodeGroupAction,sf as OBJECT_TYPE_ANCHOR,z9 as OPPOSITE_FACES,xf as ORIENTATION_OPPOSITE,yf as ORIENTATION_ORTHOGONAL,ff as ORIENTATION_PERPENDICULAR,ne as ORTHOGONAL_AXIS_HORIZONTAL,pe as ORTHOGONAL_AXIS_VERTICAL,Y9 as ORTHOGONAL_FACES,SJ as ORTHOGONAL_ROUTER_MODE_BUS,Du as ORTHOGONAL_ROUTER_MODE_SEPARATE,Wf as OVERLAY_TYPE_CUSTOM,hp as OVERLAY_VISIBILITY_ALWAYS,to as OVERLAY_VISIBILITY_HOVER,zt as OptimisticEventGenerator,go as OrthogonalEditor,pi as Overlay,at as OverlayFactory,nx as PALETTE_MODE_DRAG,ix as PALETTE_MODE_DRAW,g_ as PALETTE_MODE_TAP,YI as PAN_PATH,UI as PAN_VIEW_BOX,ns as PAPER_ALIGN_CENTER,Ah as PAPER_ALIGN_END,bh as PAPER_ALIGN_START,ad as PATH_CONSTRAIN_DIAGONAL,fA as PATH_CONSTRAIN_MANHATTAN,yA as PATH_CONSTRAIN_METRO,nn as PATH_CONSTRAIN_NONE,on as PATH_CONSTRAIN_ORTHOGONAL,zl as PLACEHOLDER_KEY,Bo as PLACEHOLDER_VALUE,Sv as POSITION_RELATIVE,oy as PROPERTY_POSITION,Mn as PX,Ya as Palette,tc as PalettePlugin,fs as PanButtonsPlugin,La as PanZoom,mc as Paper,Td as ParentRelativePlacementStrategy,Ol as PathImpl,dg as PathTransport,U_ as PathTransportState,Tw as PerimeterAnchorShapes,W0 as PieChart,Sm as PinchListener,vd as PlacementStage,Dp as PlainArrowOverlay,sR as PopupHandler,ce as Port,kd as PortAction,Wd as PortAddAction,Zd as PortRemoveAction,Ds as PriorityQueue,Yp as PropertyMapper,Cp as PropertyTracker,fo as QuadraticBezierEditor,koe as REMOVE_CLASS_ACTION,XI as RESET_SELECTION_PATH,zI as RESET_SELECTION_VIEW_BOX,__ as RESIZING_TOOLS_RESIZE_METHOD_BORDERS,nc as RESIZING_TOOLS_RESIZE_METHOD_HANDLES,yt as RIGHT,jL as ROLLBACK_CURRENT,lo as ROOT_SHAPE_SET,l2 as ROTATION,Vi as ROW,TT as RTREE_DEFAULT_MAX_CHILD_ENTRIES,ra as RTree,Fs as RandomColorGenerator,Uo as Recado,Am as RecadoTemplateRenderer,rr as RecordBasedSeries,$p as RectangleOverlay,qd as RemoveGroupMemberAction,xs as ResizingToolsPlugin,Rl as RowLayout,Ql as SEGMENT_TYPE_ARC,Xo as SEGMENT_TYPE_BEZIER,Nn as SEGMENT_TYPE_STRAIGHT,iS as SELECTION_MODE_EDGES_ONLY,nS as SELECTION_MODE_GROUPS_ONLY,$d as SELECTION_MODE_ISOLATED,tS as SELECTION_MODE_MIXED,rS as SELECTION_MODE_NODES_ONLY,Zr as SELECTOR_CONNECTOR,BC as SELECTOR_GROUP_CONTAINER,Eh as SELECTOR_MANAGED_ELEMENT,$n as SELECTOR_OVERLAY,FC as SELECTOR_TOGGLE_GROUP_COLLAPSE,it as SOURCE,Av as STATIC,bHe as STRAIGHT_CONNECTOR_AUTO_SPLIT,yR as STRAIGHT_CONNECTOR_CLICK_SPLIT,jf as STROKE,vC as STROKE_WIDTH,hs as SURFACE_MODE_DISABLED,Sr as SURFACE_MODE_PAN,bi as SURFACE_MODE_SELECT,jn as SURFACE_MODE_VERTEX_DRAWING,Qp as SVGElementOverlay,Gt as SVG_NAMESPACE,K0 as SankeyChart,q0 as ScatterChart,mr as Segments,Ga as SelectedEdgeHighlightPlugin,ol as SeriesBasedChart,am as ShapeLibraryDefaults,va as ShapeLibraryImpl,fg as ShapePalette,m_ as ShapeTypeInspector,Mm as SimpleBackground,Vn as SimpleShapeOverlay,Pd as SingleColorGenerator,Es as SnaplinesPlugin,zS as SourceValueTargetCsvParser,BA as StaticColorGenerator,IR as Storage,Eo as StraightEditor,ko as StraightSegmentHandler,nl as SummingSeries,pc as Surface,mg as SurfaceAnimator,tm as SvgComponent,Ua as SvgExportComponent,Km as SvgExportUI,Yh as SyntheticDecorator,YP as TAG_SHAPE,vn as TARGET,vO as TILING_STRATEGY_ABSOLUTE,TO as TILING_STRATEGY_LOGARITHMIC,Se as TOP,Pt as TRUE,Li as TWO_PI,qS as TYPE_ATTRIBUTE,di as TYPE_EACH,ci as TYPE_ELEMENT,Yl as TYPE_IF,yp as TYPE_ITEM_ANCHORS,Bf as TYPE_ITEM_CONNECTOR,tC as TYPE_ITEM_OVERLAY,ps as TYPE_JPG,Kh as TYPE_PNG,ZS as TYPE_ROOT,tx as TYPE_SVG,Ui as TYPE_TEXT,$o as TYPE_TMPL,Ml as TerminusAddAction,Il as TerminusRemoveAction,Dg as TestHarness,Xi as TextEntry,Gm as TiledBackground,Fo as TmplEntry,sl as Tooltip,al as TooltipRenderer,Lp as UICore,up as UIModel,cn as UIPlugins,Um as UIState,bA as UNDEFINED,Zy as UiStatesBrowserUIModel,Wh as UiStatesPlugin,pu as UndoRedoManager,Bi as UpdateAction,Xg as UrlSeriesBasedDataSource,sd as V,wl as VERTEX,FI as VERTEX_DRAWING_PATH,BI as VERTEX_DRAWING_VIEW_BOX,ZL as VERTEX_UPDATE_REASON_ADD_NEW_PORT,WL as VERTEX_UPDATE_REASON_ADD_PORT,Ul as VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE,$S as VERTEX_UPDATE_REASON_GROUP_RESIZED,J6 as VERTEX_UPDATE_REASON_LAYOUT,BS as VERTEX_UPDATE_REASON_MAGNETIZER,qs as VERTEX_UPDATE_REASON_MOVED,JL as VERTEX_UPDATE_REASON_REMOVE_PORT,US as VERTEX_UPDATE_REASON_RESIZED,Ks as VERTEX_UPDATE_REASON_ROTATION,fu as VERTEX_UPDATE_REASON_SET_POSITION,K6 as VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT,FS as VERTEX_UPDATE_REASON_SNAP_TO_GRID,VS as VERTEX_UPDATE_REASON_UPDATE_GROUP,MS as VERTEX_UPDATE_REASON_UPDATE_NODE,gu as VERTEX_UPDATE_REASON_UPDATE_PORT,zE as VERTEX_UPDATE_REASON_UPDATE_VERTEX,ig as VanillaInspector,Hc as Vertex,Ai as VertexDrawingPlugin,Cd as VertexSet,Ep as Viewport,Eu as VisuallyJsModel,Gl as VisuallyJsRendererVertexRemovedAction,pr as VisuallyJsSelection,Ci as VisuallyJsTestSupport,ep as VjsContext,Pe as WIDTH,Er as WILDCARD,NW as WhitespaceReplacingTokenizer,Q as X,Sle as XHTML_NAMESPACE,Ale as XLINK_NAMESPACE,hl as XYChart,yb as XYPlot,F9 as X_AXIS_FACES,ye as Y,U9 as Y_AXIS_FACES,qO as ZOOM_IN_OUT_VIEW_BOX,kI as ZOOM_IN_PATH,WI as ZOOM_OUT_PATH,VI as ZOOM_TO_FIT_PATH,MI as ZOOM_TO_FIT_VIEW_BOX,kE as _addBinding,Xr as _addConnectorSegment,SC as _adjustForGap,ry as _applyStyles,PT as _areaIfGrownBy,QS as _bindOneAtt,cb as _calculateSteps,mf as _clearConnectorSegments,bq as _computeConnector,Sp as _computeSingleLocation,WT as _connectorBoundingBoxIntersection,Sq as _connectorBoxIntersection,xq as _connectorGradientAtPoint,Aq as _connectorLineIntersection,Be as _connectorPointAlongPathFrom,gr as _connectorPointOnPath,$f as _createAnchor,ia as _createBaseSegment,Vu as _createConnectorBase,Hv as _createContinuousAnchor,Hw as _createCubicBezierConnector,kw as _createQuadraticBezierConnector,LT as _createSegment,qN as _defaultGroupHtmlTemplate,eI as _defaultGroupSvgTemplate,_a as _defaultNodeHtmlTemplate,Ra as _defaultNodeSvgTemplate,KN as _defaultPortHtmlTemplate,QN as _defaultPortSvgTemplate,NT as _defaultSegmentBoundingBoxIntersection,Zl as _defaultSegmentBoxIntersection,wT as _defaultSegmentFindClosestPointOnPath,DT as _defaultSegmentLineIntersection,Yo as _emptyRTreeRegion,Lm as _findAnchorOrientation,pf as _findConnectorSegmentForLocation,kT as _findConnectorSegmentForPoint,p1 as _findIdealSteps,ev as _findNextHorizontalSegment,Xu as _findNextSegmentOfType,rv as _findNextVerticalSegment,tv as _findPreviousHorizontalSegment,nv as _findPreviousVerticalSegment,gI as _findTargetZones,EI as _findZones,gC as _getCurrentAnchorLocation,iO as _getDefaultTemplate,Ioe as _getLabelOverlay,lf as _getSegmentLength,_m as _getVertexInfo,tf as _growToFit,OT as _hasLeafNodes,PD as _hideOverlays,dO as _initialiseDecorators,oC as _internalLabelOverlayClass,xp as _internalLabelOverlayId,Doe as _internalSourceMarkerOverlayId,Noe as _internalTargetMarkerOverlayId,Qo as _isContinuousAnchor,hh as _isFaceAvailable,Nu as _isLeaf,Af as _mapToSpline,use as _padPoint,mC as _placeAnchorsOnLine,mO as _populateSourceZones,zh as _populateTargetZones,pO as _populateZones,Ef as _prepareCompute,na as _registerSegmentHandler,qo as _removeOverlay,sD as _removeShortSegments,hC as _removeTypeCssHelper,HT as _resetConnectorBounds,ji as _resetConnectorGeometry,hf as _setAnchorLocation,xv as _setOrthogonalSegmentPosition,OD as _showOverlays,bv as _trimOrthogonalConnector,vf as _trimOrthogonalSegments,Sf as _trimSegments,Uw as _updateConnectorBounds,gf as _updateConnectorSegmentProportions,Ap as _updateHoverStyle,rf as _updateRTreeRegionBounds,Ju as _writeSegmentedConnectorSegments,Ho as aSegmentDirections,wi as add,L as addClass,Wr as addConnectionClass,KE as addEntryToEachExecution,pT as addNewExecutionToEachExecution,ql as addSegment,Hb as addToDictionary,QG as addToList,yh as addWheelListener,qG as addWithFunction,cl as addXYPlotType,xa as ajax,bf as anchorPlacementEquals,n_ as apply,sC as applyConnectionType,Y1 as applyDomainOverrides,Kb as applyRotations,qb as applyRotationsXY,nA as areVerticesConnected,pL as arraysEqual,AC as astarFromViewport,Ae as att,fi as attWithValue,oze as attachDiagramPalette,qm as attemptCoerce,sM as base64Encode,aM as base64EncodeSvgElement,wn as bezierLineIntersection,pge as bindDarkModeListener,BK as boundingBoxIntersection,$K as boxIntersection,z1 as buildDomainScales,Kc as calculateNestedDepth,m1 as calculatePowerOf10,Ii as calculateSpacingAdjustment,UG as chebyshevDistance,fl as clampAngle,mge as classList,dIe as clear,lt as clone,cye as cloneIcon,z as cls,FA as colourDistance,Uu as computeBezierConnector,UT as computeBezierLength,G0 as computeDomainScales,Op as computeGroupSize,oR as computeOrigin,sE as computeRectangleIntersection,qu as computeStraightConnector,RN as computeTranslationForRotation,mv as connectorSegmentLength,ie as consume,ws as containsPoint,mi as convertToFullOverlaySpec,Hp as convertToMultilineText,Gu as createAbstractBezierConnector,Kr as createAndAppendElementNS,k as createChartElement,vs as createChartTextElement,d_ as createColorPickerTag,cC as createComponent,$g as createContrastLabel,sze as createDiagram,Jr as createElement,fa as createElementNS,pa as createFinderFromAnchorPositions,Ru as createGateMap,H4e as createPaper,cXe as createSurface,$0 as createXYPlot,we as data,ya as debounce,UM as decodeDragGroupSpec,PM as defaultDataGenerator,fq as defaultExportGeometry,Vh as defaultIcons,xE as defaultIdFunction,yq as defaultImportGeometry,my as destroySVGOverlay,DE as diagonalAdjacentCellsFinder,ST as directRouter,GT as dist,_w as distanceFromCurve,Fc as djikstra,m5 as each,Zb as eachNotEmpty,pC as edgeSortFunctions,Lr as editors,Cc as emptyBox,Cw as emptyPaintGeometry,VG as encloses,lM as encodedSvgToDataUrl,Th as ensureSVGContentElements,is as ensureSVGLabelElements,FG as euclideanDistance,Yi as evaluateExpression,ZE as evaluateSingleExpression,Bb as expandRectangle,zr as exportConnectorGeometry,SE as exportData,Jm as exportImage,ub as exportSVG,Fa as exportSvg,ks as extend,cIe as extract,e$ as extractBounds,ft as extractPoint,ei as extractSize,uM as extractValueFromElement,af as faceOrientations,Ct as fastTrim,Wb as filterEmpty,r$ as filterNull,Hu as findAdjacentSegment,Xc as findClosestPoint,Bt as findParent,hge as findParents,ju as findSegment,aE as fixPrecision,Sw as flatten,Rb as floydWarshall,db as formatValue,$L as freeMovementAdjacencies,NR as generateConstrainFunctionFromContainmentType,vM as generateInspectorTemplate,HEe as getAbsolutePosition,gL as getAllEdges,u$ as getAllSourceEdges,p$ as getAllTargetEdges,An as getAncestors,jC as getClass,kb as getClosestMidpoint,E$ as getConnectedVertices,DN as getConnectorElement,Od as getContrastColor,bE as getDescendantEdges,Ms as getDescendants,m$ as getDownstreamVertices,Sl as getEdges,We as getElementSize,Jp as getElementType,rs as getEventSource,uE as getFromSetWithFunction,Yj as getOutlineColor,oN as getPageLocation,mn as getPosition,Kp as getPositionOnElement,cL as getRectangleMidpoints,HC as getSelector,Qb as getSourceEdges,em as getSvgPositionRelativeToSvgRoot,vh as getSvgTranslatePosition,eA as getTargetEdges,ty as getTouch,g$ as getUpstreamVertices,Ns as getsert,Nr as gradient,Bu as gradientAtPoint,VK as gradientAtPointAlongPathFrom,Q_ as gridBackgroundOptions,un as hasClass,Us as inferAxis,NE as inferAxisAndDirectionFromOrientation,zA as inferAxisFromSourceAndTargetLocation,YA as inferDirection,TR as initializeBezierConnectorEditors,ER as initializeOrthogonalConnectorEditors,xR as initializeStraightConnectorEditors,zo as insertRTreeChild,pE as insertSorted,Ub as intersectionOfProjectedLines,je as isAncestor,cge as isArrayLike,XC as isArrayOrNodeList,jb as isAssignableFrom,aqe as isBarPlot,Co as isBoolean,A0 as isCategoryAxis,uL as isClass,ma as isConnection,Tq as isConnector,dn as isCustomOverlay,io as isDOMElement,dL as isDate,rA as isDescendantGroup,rt as isEdge,dt as isEdgeNodeEntry,Gf as isEdgeSupported,kC as isElement,bl as isEmpty,XS as isFilterableDataset,Bv as isFullOverlaySpec,rn as isFunction,Y as isGroup,sP as isHTMLLabelOverlay,kr as isLabelOverlay,tT as isLoopPresent,Ei as isMouseDevice,t$ as isNamedFunction,yE as isNestedGroup,K as isNode,fE as isNodeInsideAGroup,Bn as isNodeList,tA as isNodeVertex,zc as isNumber,cr as isObject,$T as isPoint,H as isPort,wt as isSVGElement,dl as isStackedPlot,j as isString,dge as isTextNode,Gn as isTouchDevice,xn as isValueAxis,Ni as isVertex,xT as lightweightPrintfFormatter,th as lineCalculators,lE as lineIntersection,$b as lineIntersectsOrIsEnclosedByRectangle,Ue as lineLength,hr as lineRectangleIntersection,sL as linesIntersection,hE as linesOverlap,zT as locationAlongCurveFrom,U as log,hL as logEnabled,fp as makeLightweightAnchorFromArraySpec,St as makeLightweightAnchorFromSpec,Yc as manhattanDistance,MG as manhattanLineLength,$t as matchesSelector,bn as merge,U1 as mergeDomainExtents,dp as mergeWithParents,_T as minBy,kv as namedContinuousValues,FT as nearestPointOnCurve,En as newInstance,Ar as newRecadoInstance,Uh as newTemplates2Renderer,Gb as normal,Al as objectsEqual,YG as octileDistance,no as offsetRelativeToRoot,BL as orthogonalAdjacencies,UA as orthogonalAdjacentCellsFinder,AT as orthogonalRouter,Ee as pageLocation,lP as paintSVGLabelOverlay,aP as paintSimpleShapeOverlay,UP as paintSvgConnector,BG as parallelLineFromPoint,wb as parallelLineTo,Yb as parallelLinesTo,Ir as parentAxis,XA as parentDirection,cA as parse,HE as parseAttributes,rT as parseAtts,Ew as parseExpression,xl as partition,eT as peek,GG as perpendicularBisectingLine,Dt as perpendicularLineTo,GK as perpendicularToPathAt,YT as pointAlongCurveFrom,$u as pointAlongPath,sa as pointOnCurve,kt as pointOnLine,Jb as pointsEqual,Po as populate,wu as populateRegions,uge as prefersDarkMode,jl as processExpression,Ls as quadrant,_6e as ready,Is as recordGetsert,tt as rectanglesIntersect,hXe as registerDecorator,p_ as registerEdgeTypePickerTag,Z$ as registerExporter,hA as registerParser,Je as registerPlugin,bO as relocateContinuousAnchor,AO as relocateDynamicAnchor,SO as relocateWithPositionFinder,cE as remove,F as removeClass,Or as removeConnectionClass,of as removeRTreeChild,xh as removeWheelListener,Nt as removeWithFunction,um as renderIcon,pm as renderNamedIcon,aV as renderPaper,sV as renderSurface,gE as replace,qE as resolveIfExecution,ti as resolveNode,EE as resolveNodeId,Ie as rotatePoint,zb as rotatedRectanglesIntersect,bT as routerLineIntersects,ef as routerLineSgn,pv as segmentLineAngle,la as segmentedConnectorSegmentLength,tr as setAbsolutePosition,fP as setElementHeight,xi as setElementRotation,Rr as setElementSize,EP as setElementWidth,rN as setForceMouseEvents,tN as setForceTouchEvents,Nf as setOverlayLocation,Ne as setPosition,yP as setRotatedSvgElementPosition,pn as setSvgTranslatePosition,jt as setTranslatedPosition,p8e as setTranslatedX,vc as setTranslatedY,mP as setXPosition,gP as setYPosition,yl as shortUuid,le as snapToGrid,$G as snapToGridUpperBound,Lu as sortAndPlaceEdges,Om as sourceElementSelector,iv as sourceVertexAvoidance,nf as splitIntoSiblings,eh as stubCalculators,fv as stubRelocator,Vb as subtract,dE as suggest,tP as supportsPathEditing,t_ as svgElementToDataUrl,mI as targetElementSelector,ov as targetVertexAvoidance,Rm as testIntersectingDropTarget,El as theta,sy as toggleClass,VC as touchCount,es as touches,oa as transformAnchorPlacement,Yu as transformBezierGeometry,Qu as transformSegmentedGeometry,mE as translateRect,Fb as unionOfRectangles,Fu as updateBezierConnector,Xt as updateClasses,Ev as updateEditedOrthogonalConnector,Ku as updateStraightConnector,B as uuid,Kl as valueInRange,sv as vertexAvoidance,Hd as wrap,zC as xml};
143
+ A ${h} ${h} 0 1 1 ${a.x+h} ${a.y} Z`;else if(O=`M ${a.x} ${a.y} L ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} Z`,this.Re!=null){let G=a.x+this.Re*h*Math.cos(E),J=a.y+this.Re*h*Math.sin(E),fe=a.x+this.Re*h*Math.cos(y),X=a.y+this.Re*h*Math.sin(y);O=`M ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} L ${fe} ${X} A ${this.Re*h} ${this.Re*h} 0 ${S} 0 ${G} ${J} Z `}let v={x:this.Dc*Math.cos(x),y:this.Dc*Math.sin(x)},_=V(q,{fill:u||(d?d[g%d.length]:this.colorGenerator.generate(p)),opacity:"0.6",stroke:"white",d:O,"data-t":`translate(${v.x}, ${v.y})`,[Kn]:`${g}`});L(_,lE),g===this.Ro&&this.eE(_),m.appendChild(_);let P=20,I=this.options.labelPosition==="inside",C=I?h*.7:h+P,R,w,B;if(p.p>=1)if(I&&this.Re!=null)R=a.x,w=a.y,B="middle";else{let G=-Math.PI/2;R=a.x+C*Math.cos(G),w=a.y+C*Math.sin(G),B="middle"}else R=a.x+C*Math.cos(x),w=a.y+C*Math.sin(x),B=R<a.x?"end":"start";let N=V("text",{"text-anchor":B,"dominant-baseline":"central",x:R,y:w});this.options.labelFont&&(this.options.labelFont.size&&N.setAttribute("font-size",`${this.options.labelFont.size}px`),this.options.labelFont.family&&N.setAttribute("font-family",this.options.labelFont.family),this.options.labelFont.weight&&N.setAttribute("font-weight",`${this.options.labelFont.weight}`),this.options.labelFont.style&&N.setAttribute("font-style",this.options.labelFont.style));let M=p.label,D=this.options.showLabels||"label";if(D==="value"?M=`${p.value}`:D==="percentage"?M=`${Math.round(p.p*100)}%`:D==="label-value"?M=`${p.label}: ${p.value}`:D==="label-percentage"&&(M=`${p.label}: ${Math.round(p.p*100)}%`),N.innerHTML=M,m.appendChild(N),this.options.dataLabels!=null&&this.options.dataLabels!==!1){let J=p.p<3&&g%2===0?h*.4:h*.5,fe=a.x+J*Math.cos(x),X=a.y+J*Math.sin(x),me=u||(d?d[g%d.length]:this.colorGenerator.generate(p)),$e=this.options.labelFont||{size:12,weight:"bold"},ke="";this.options.dataLabels==="percentage"?ke=`${Math.round(p.p*100)}%`:ke=`${p.value}`,Xm(ke,fe,X,me,$e,m)}})}BA(){this.Lo!=null&&(this.FA(this.Lo),this.Lo=null)}eE(e){this.Lo=e,this.UA(this.Lo)}$A(e,t,n){this.BA(),this.Ro===e?this.Ro=null:(this.Ro=e,this.eE(n))}UA(e){e.setAttribute("transform",e.getAttribute("data-t")),L(e,o0)}FA(e){e.removeAttribute("transform"),F(e,o0)}};function To(i,r){try{return parseFloat(i.data[r])}catch(e){return 0}}function a0(i,r,e){return r.reduce((t,n)=>t+To(n,e),0)}function EG(i){let r={};return i.getSourceEdges().forEach(e=>{r[e.target.id]=e.target}),Object.values(r)}function fG(i){let r={};return i.getTargetEdges().forEach(e=>{r[e.source.id]=e.source}),Object.values(r)}function yG(i,r){return i.reduce((e,t)=>t.size.height+e,0)+r*(i.length-1)}function xG(i,r,e,t,n,o){bG(i,r,e,t,n,s=>s.getTargetEdges(),s=>s.getSourceEdges(),s=>EG(s),s=>fG(s),o)}function bG(i,r,e,t,n,o,s,a,l,h){let d=t.filter(u=>o(u).length===0).map(u=>{let p=s(u),g=a0(u,p,h);return u.data.height=g,u.data.width=n,e.set(u.id,!0),{offset:0,obj:u,size:{width:n,height:g},layer:0,id:u.id,type:"root",vertexSet:null,edges:p,leaf:p.length===0}});for(d.sort((u,p)=>p.edges.length-u.edges.length),r(d);e.size<t.length;){let u=new Set,p=[];d.forEach(g=>{a(g.obj).forEach(E=>{e.has(E.id)||l(E).find(x=>!e.has(x.id))||u.add(E)})}),Array.from(u).forEach(g=>{let m=a0(g,o(g),h);g.data.height=m,g.data.width=n,p.push({offset:0,obj:g,size:{width:n,height:m},id:g.id,vertexSet:null,layer:i.length,type:"",edges:[],leaf:!1}),e.set(g.id,!0)}),r(p),d=p}}function Cb(i,r,e,t,n,o){let s=new Map,a=i.getNodes(),l=-1/0,h=-1,d=[];function u(T){let S=yG(T,e),O=d.length;S>l&&(l=S,h=d.length),d.push({entries:T,size:S,offset:0,layer:O})}xG(d,u,s,a,r,o),new zs({layers:d},(T,S,O)=>{let v=[];for(let _=0;_<d[S].entries.length;_++)aA(d[S].entries[_].obj,O.obj)&&v.push([d[S].entries[_],_]);return v},null).execute();let g=d[h],E=e*(g.entries.length-1)+l,y=n===-1?1:n/E,x=(t-r)/(d.length-1),f=0;for(let T=0;T<d.length;T++){let S=d[T],O=S.size*y,v=E*y-O,_=S.entries.length-1,P=_>0?Math.max(e,v/(_+2)):e,C=(E*y-(O+P*_))/2;S.entries.forEach(R=>{let w=R.obj.getSourceEdges().length===0;R.size.height*=y,R.obj.data.height*=y,R.obj.data.left=f,R.obj.data.top=C,R.obj.data.layer=T,R.obj.data.isTerminus=w,R.obj.data.isSource=T===0,R.obj.data.labelAlign=T===0?"end":T===d.length-1?"start":"middle",C+=R.size.height+P}),f+=x}let b=E*y,A=e;for(let T=0;T<20;T++){for(let S=1;S<d.length;S++)l0(d[S],o,A,b,!0);for(let S=d.length-2;S>=1;S--)l0(d[S],o,A,b,!1)}for(let T=0;T<d.length;T++)d[T].entries.forEach(O=>{let v=O.size.height/y,_=0,P=Array.from(O.obj.getSourceEdges());P.sort((C,R)=>{let w=C.target.data.top+C.target.data.height/2,B=R.target.data.top+R.target.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<P.length;C++){let R=To(P[C],o);P[C].data.lineWidth=R*y;let w=_+R/2;P[C].anchors=P[C].anchors||{},P[C].anchors.source={y:w/v,x:1,ox:1,oy:0},_+=R}_=0;let I=Array.from(O.obj.getTargetEdges());I.sort((C,R)=>{let w=C.source.data.top+C.source.data.height/2,B=R.source.data.top+R.source.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<I.length;C++){let R=To(I[C],o),w=_+R/2;I[C].anchors=I[C].anchors||{},I[C].anchors.target={y:w/v,x:0,ox:-1,oy:0},_+=R}});return{layers:d,scale:y}}function l0(i,r,e,t,n){i.entries.forEach(a=>{let l=n?a.obj.getTargetEdges():a.obj.getSourceEdges();if(l.length>0){let h=0,d=0;l.forEach(u=>{let p=n?u.source:u.target,g=To(u,r);d+=(p.data.top+p.data.height/2)*g,h+=g}),a.obj.data.top=d/h-a.obj.data.height/2}}),i.entries.sort((a,l)=>a.obj.data.top-l.obj.data.top);for(let a=0;a<i.entries.length-1;a++){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data,d=l.top+l.height+e-h.top;d>0&&(l.top-=d/2,h.top+=d/2)}let o=i.entries[0].obj.data;o.top<0&&(o.top=0);for(let a=1;a<i.entries.length;a++){let l=i.entries[a-1].obj.data,h=i.entries[a].obj.data;h.top<l.top+l.height+e&&(h.top=l.top+l.height+e)}let s=i.entries[i.entries.length-1].obj.data;if(s.top+s.height>t){s.top=t-s.height;for(let a=i.entries.length-2;a>=0;a--){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data;l.top+l.height+e>h.top&&(l.top=h.top-e-l.height)}}}var Pb="sankey-csv",_b="vjs-sankey-edge",tn="vjs-sankey-unselected",vo="vjs-sankey-selected",AG="vjs-sankey",Ob="vjs-sankey-node",Rb="vjs-sankey-label",h0=class extends Ao{constructor(e,t){super(e,t);c(this,"linkColorStrategy");c(this,"linkColor");c(this,"Nc");c(this,"Ic");c(this,"tE");c(this,"D");c(this,"Qe");c(this,"ni");c(this,"Le");c(this,"Do");c(this,"ga");c(this,"No");c(this,"Io",[]);c(this,"ii");c(this,"Vo",{});c(this,"oi",{});c(this,"Mo",{});c(this,"Go",{});c(this,"$o",[]);c(this,"wo",null);c(this,"pt");c(this,"$tooltip");L(e,AG),pA("sankey-csv",kS),this.wo=t.pivot!=null&&t.pivot.length>0?t.pivot:null,this.ga=t.labelProperty||"label",this.Do=t.valueProperty||"value",this.tE=t.tooltipSuffix||"",this.linkColorStrategy=t.linkColorStrategy||"static",this.linkColor=t.linkColor||"#444444",this.Nc=t.nodeWidth||15,this.Ic=t.nodePadding||10,this.ni=t.interactive!==!1;let n=t.labels||{};this.pt={font:Pi(12,"normal","normal","sans-serif",n.font),padding:n.padding==null?5:n.padding,backgroundColor:n.backgroundColor||"#FFFFFF56"},this.YA(),this.Gn(t)}get currentModel(){return this.wo!=null?this.Qe:this.D}zA(e,t){switch(this.linkColorStrategy){case"source-target":return{gradient:[[0,e.color],[100,t.color]]};case"target":return{color:t.color};case"static":return{color:this.linkColor};case"source":default:return{color:e.color}}}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){if(this.D==null)return;this.dim=this.$drawDecoration(e,t,n),t=this.dim.chartWidth,n=this.dim.chartHeight;let s=V(Q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`});e.appendChild(s);let{layers:a}=Cb(this.D,this.Nc,this.Ic,t,n,this.Do);if(this.wo){if(this.Qe.getNodes().length===0){let b=SG(a,this.wo,this.Do,this.ga);this.XA(b)}a=Cb(this.Qe,this.Nc,this.Ic,t,n,this.Do).layers}this.$o=a;let l=V(Q);s.appendChild(l);let h=V(Q);s.appendChild(h);let d=V(Q);if(s.appendChild(d),this.$o.length===0||this.$o[0].entries.length===0)return;this.ni&&(this.$tooltip=new Lb(e,{format:"{{content}}",valueSuffix:this.tE||""},this.Do,this.ga));let u=0,p=0,g=1/0,m=1/0;function E(b){let A=b.getBBox();u=Math.max(u,Math.round(A.x+A.width)),g=Math.min(g,Math.round(A.x)),p=Math.max(p,Math.round(A.y+A.height)),m=Math.min(m,Math.round(A.y))}let y=this.currentModel;y.getNodes().forEach(b=>{if(b.data.height>0){let A=V(Z,{x:b.data.left,y:b.data.top,width:b.data.width,height:b.data.height,fill:b.data.color,[te]:b.id},{},Ob);this.oi[b.id]=A,h.appendChild(A),E(A);let T=V(Q),S=b.data[this.ga]||b.getFullId(),O=V(et,{"dominant-baseline":"center","text-anchor":b.data.labelAlign,x:b.data.labelAlign==="end"&&b.data.layer===0?b.data.left-this.pt.padding:b.data.labelAlign==="start"&&b.data.layer===this.$o.length-1?b.data.left+b.data.width+this.pt.padding:b.data.left+b.data.width/2,y:b.data.top+b.data.height/2,"font-size":this.pt.font.size,"font-style":this.pt.font.style,[te]:b.id},{},Rb);if(O.innerHTML=S,this.Mo[b.id]=O,T.appendChild(O),d.appendChild(T),this.pt.backgroundColor!=="transparent"){let v=O.getBBox(),_=V(Z,{rx:"3",x:v.x-this.pt.padding,y:v.y-this.pt.padding,width:v.width+this.pt.padding*2,height:v.height+this.pt.padding*2,fill:this.pt.backgroundColor,[te]:b.id});this.Go[b.id]=_,T.insertBefore(_,O)}E(O)}});let x=y.getAllEdges().slice();x.sort((b,A)=>A.data.lineWidth-b.data.lineWidth),x.forEach(b=>{let A=b.anchors.source,T=b.anchors.target,S=b.source.data,O=b.target.data,v={x:S.left+S.width,y:S.top+A.y*S.height},_={x:O.left,y:O.top+T.y*O.height},P=.25*(_.x-v.x),I=b.data.lineWidth/2,C=v.y-I,R=v.y+I,w=_.y-I,B=_.y+I,M={d:[`M ${v.x} ${C}`,`C ${v.x+P} ${C}, ${_.x-P} ${w}, ${_.x} ${w}`,`L ${_.x} ${B}`,`C ${_.x-P} ${B}, ${v.x+P} ${R}, ${v.x} ${R}`,"Z"].join(" "),opacity:.3,stroke:"none",[Qe]:b.id};if(b.data.color)M.fill=b.data.color;else if(b.data.gradient){let{id:G,g:J}=YC(v.x,_.x,b.data.gradient);l.appendChild(J),M.fill=`url(#${G})`}let D=V(q,M,{},_b);this.Vo[b.id]=D,l.appendChild(D),E(D)}),t=u+this.dim.chartX-g,n=p+this.dim.chartY,e.setAttribute("viewBox",`${g} 0 ${t} ${n}`);let f=this.container.querySelector(".vjs-chart-background");f.setAttribute("x",`${g}`),f.setAttribute("width",`${t}`),f.setAttribute("y",`${m}`),f.setAttribute("height",`${n}`),this.dim.chartWidth=u-g,this.dim.chartHeight=p,this.dim.chartEndX=t,this.dim.chartEndY=n,this.dim.width=t,this.dim.height=n,this.dim.viewBox={x:g,y:0,width:t,height:n},this.fire(Hm)}nodeDecorator(e,t){return Object.assign(e,{color:this.colorGenerator.generate(e),width:50,height:50})}edgeDecorator(e,t,n){return Object.assign(e,this.zA(t,n))}Gn(e){if(this.D=yn(),this.Qe=yn(),e.dataSource==null)(e.url!=null||e.csvData!=null||e.jsonData!=null)&&this.load({url:e.url,csvData:e.csvData,jsonData:e.jsonData});else{this.Le=e.dataSource;let t=ba(()=>{this.rE()},150);this.Le.bind(Le,t),this.Le.bind(Ce,t),this.Le.bind(Kt,t),this.Le.bind(ve,t),this.Le.bind(Re,t),this.Le.bind(Zt,t),this.Le.bind(xt,t),this.Le.bind(bt,t),this.Le.bind(ur,t),this.Le.bind(Jt,t),this.Le.bind(Mr,t),this.rE()}}XA(e){this.Qe.clear(),e.nodes.forEach(t=>{this.Qe.addNode(this.nodeDecorator(Object.assign({},t),!1))}),e.edges.forEach(t=>{let n=this.Qe.getVertex(t.source),o=this.Qe.getVertex(t.target);this.Qe.addEdge({source:n,target:o,data:this.edgeDecorator(Object.assign({},t.data||{}),n.data,o.data)})})}rE(){this.D.clear(),this.Qe.clear(),this.Le.getNodes().forEach(e=>{this.D.addNode(this.nodeDecorator(Object.assign({},e.data),!1))}),this.Le.getAllEdges().forEach(e=>{let t=this.D.getVertex(e.source.id),n=this.D.getVertex(e.target.id);this.D.addEdge({source:t,target:n,data:this.edgeDecorator(Object.assign({},e.data||{}),t.data,n.data)})}),this.$draw()}load(e,t){this.Qe.clear(),this.D.clear();function n(){return e.dataType!=null?e.dataType:e.csvData!=null?Pb:e.jsonData!=null?Wt:e.url!=null&&e.url.indexOf(".json")!==-1?Wt:Pb}this.D.load({type:n(),url:e.url,data:e.csvData||e.jsonData,incremental:!1,onload:()=>{this.$draw(),t&&t()},parameters:{nodeDecorator:this.nodeDecorator.bind(this),edgeDecorator:this.edgeDecorator.bind(this)}})}hasData(){return this.D!=null&&this.D.getNodes().length>0}destroy(){super.destroy()}jA(){this.No!=null&&(this.ii.vertices.forEach(e=>{F(this.oi[e.id],vo),F(this.Mo[e.id],vo);let t=this.Go[e.id];t&&F(t,vo)}),this.Io.forEach(e=>F(e[1],vo)),Object.values(this.Vo).forEach(e=>F(e,tn)),Object.values(this.oi).forEach(e=>F(e,tn)),Object.values(this.Mo).forEach(e=>F(e,tn)),Object.values(this.Go).forEach(e=>F(e,tn))),this.No=null,this.ii=null,this.Io.length=0}nE(e){return this.$o.findIndex(t=>t.entries.find(n=>n.id===e.id)!=null)}kA(e){let t=new Map;return e.getAllEdges().forEach(n=>{let o=n.source===e?n.target:n.source,s=`${o.getFullId()}-${n.id}`;t.has(s)||t.set(s,[o,n])}),Array.from(t.values())}HA(e){let t=new Set,n=new Set;t.add(e);let o=(s,a)=>{let l=this.nE(s);this.kA(s).forEach(d=>{t.has(d[0])||this.nE(d[0])>l===a&&(n.add(d[1]),t.add(d[0]),o(d[0],a))})};return o(e,!0),o(e,!1),{vertices:Array.from(t),edges:Array.from(n)}}Vc(e){this.jA(),e!=null&&(this.No=this.currentModel.getNode(e),Object.values(this.oi).forEach(n=>L(n,tn)),Object.values(this.Mo).forEach(n=>L(n,tn)),Object.values(this.Go).forEach(n=>L(n,tn)),Object.values(this.Vo).forEach(n=>L(n,tn)),this.ii=this.HA(this.No),this.ii.edges.slice().sort((n,o)=>n.data.lineWidth-o.data.lineWidth),this.Io=this.ii.edges.map(n=>[n,this.Vo[n.id]]),this.ii.vertices.forEach(n=>{Xt(this.oi[n.id],[vo],[tn]),Xt(this.Mo[n.id],[vo],[tn]);let o=this.Go[n.id];o&&Xt(o,[vo],[tn])}),this.Io.forEach(n=>{Xt(n[1],[vo],[tn])}),this.fire("sankey:hover",{vertex:this.No,edges:this.Io}))}YA(){this.ni&&(this.$eventManager.on(this.container,st,z(Ob,Rb),e=>{let n=e.target.getAttribute(te);this.Vc(n),this.$tooltip.showNodeTooltip(this.currentModel.getNode(n),e,this.oi[n])}),this.$eventManager.on(this.container,ot,z(Ob,Rb,_b),e=>{this.Vc(null)}),this.$eventManager.on(this.container,st,z(_b),e=>{let n=e.target.getAttribute(Qe);this.Vc(this.currentModel.getEdge(n).source.id),this.$tooltip.showEdgeTooltip(this.currentModel.getEdge(n),e,this.Vo[n])}))}pivot(e){this.wo=e!=null&&e.length>0?e:null,this.Qe.clear(),this.$draw()}clearPivot(){this.pivot(null)}},Lb=class extends ll{constructor(e,t,n,o){super(e,t);this.valueProperty=n;this.labelProperty=o}showEdgeTooltip(e,t,n){let o=[e.source,e.target];o.sort((d,u)=>d.data.layer-u.data.layer);let s=o[0].data[this.labelProperty]||o[0].id,a=o[1].data[this.labelProperty]||o[1].id,l=`${s} \u2192 ${a}: ${parseInt(e.data[this.valueProperty])} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}showNodeTooltip(e,t,n){let o=0,s=e.getSourceEdges();s.length>0?o=s.map(d=>To(d,this.valueProperty)).reduce((d,u)=>d+u):o=e.getTargetEdges().map(u=>To(u,this.valueProperty)).reduce((u,p)=>u+p);let l=`${e.data[this.labelProperty]||e.id} : ${o.toFixed(2)} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}};function SG(i,r,e,t){let n=[],o=[],s=new Set;i.forEach(a=>{a.entries.forEach(l=>{n.push(rn({id:l.id},l.obj.data))})});for(let a=0;a<i.length-1;a++){let l=i[a],h=new Map,d=new Map;l.entries.forEach(u=>{let p=u.id;u.obj.getSourceEdges().forEach(g=>{let m=g.target.id,E=g.data[r]||"Unspecified",y=To(g,e),x=`v_${a}_${E}`;s.has(x)||(n.push({id:x,[t]:E,isVirtual:!0,type:"pivot-metadata"}),s.add(x)),h.has(p)||h.set(p,new Map);let f=h.get(p);f.set(E,(f.get(E)||0)+y),d.has(x)||d.set(x,new Map);let b=d.get(x);b.set(m,(b.get(m)||0)+y)})}),h.forEach((u,p)=>{u.forEach((g,m)=>{o.push({source:p,target:`v_${a}_${m}`,data:{[r]:m,[e]:g}})})}),d.forEach((u,p)=>{u.forEach((g,m)=>{o.push({source:p,target:m,data:{[r]:p.split("_").pop(),[e]:g}})})})}return{nodes:n,edges:o}}var c0=class extends ml{constructor(e,t){super(e,t);this.options=t;L(e,SL)}$getMarkerSize(e,t){return e.markerSize!=null?e.markerSize:this.$getBaseMarkerSize()}$getDataPointCssClass(){return TL}};export{IC as $__proxyEdge,NC as $__unproxyEdge,YO as $_createCircularSvgHandles,UO as $_createRectangularSvgHandles,Ge as $_createSvg,vx as $_setSkeletonPosition,ph as $addOverlay,ya as $appendAtIndex,JO as $arcBridge,ie as $attr,Cc as $autoCalculateChartScale,Pc as $calculateChartScaleWithStep,DL as $calculateChartScaleWithSteps,wC as $createConnection,YC as $createGradient,Vc as $createMarker,Ev as $defaultOrthogonalPathCompute,cD as $defaultStraightPathCompute,sx as $doImageExport,KO as $dotBridge,qO as $gapBridge,QT as $getConnectorPathData,iE as $getMarker,Xf as $getOverlay,GD as $getOverlays,iw as $isCompoundAction,dS as $isGroupSizeChangedAction,cS as $isMoveAction,hS as $isUpdateAction,A_ as $makeAndAppendCircularHandle,S_ as $makeAndAppendRectangularHandle,Jy as $makeCircularHandle,ys as $makeFieldKey,LI as $makeRectangularHandle,Pi as $prepareFontSpec,Sv as $rewriteOrthogonalConnector,IL as $spaceLabels,V as $svgNode,$f as $updateLabelOverlayFont,qe as ABSOLUTE,oC as ACTION_ADD,sC as ACTION_REMOVE,ose as ADD_CLASS_ACTION,P3 as ALL_GROUPS_RELAYOUT,Zy as ANCHOR_PLACEHOLDER_SELECTOR,Ha as ANIMATION_PHASE_CANCELLED,ka as ANIMATION_PHASE_FINISHED,tR as ANIMATION_PHASE_INITIALIZED,rR as ANIMATION_PHASE_TRAVERSING_EDGE,Dx as ANIMATION_PHASE_TRAVERSING_END,wx as ANIMATION_PHASE_TRAVERSING_START,PP as ANIM_SURFACE_ELEMENT_FLASH,ut as APPEND_TO_CURRENT,Hs as AStarGrid,Kn as ATTRIBUTE_CHART_CATEGORY,O9e as ATTRIBUTE_CHART_FILTERED_SERIES,Et as ATTRIBUTE_CHART_SERIES,Km as ATTRIBUTE_CHART_STACK,qm as ATTRIBUTE_CHART_STACK_TOTAL,Qm as ATTRIBUTE_CHART_VALUE,eT as ATTRIBUTE_CLASS,LM as ATTRIBUTE_COLOR_PICKER_MAX_COLORS,ay as ATTRIBUTE_CONTAINER,KS as ATTRIBUTE_CONTEXT,HI as ATTRIBUTE_CONTROLS_ORIENTATION,Sm as ATTRIBUTE_DATA_SHAPE_ID,qS as ATTRIBUTE_DEFAULT,Ov as ATTRIBUTE_ELEMENTS_DRAGGABLE,LC as ATTRIBUTE_FILL,Dre as ATTRIBUTE_GROUP,qp as ATTRIBUTE_GROUP_COLLAPSED_CONTENT,ly as ATTRIBUTE_GROUP_CONTENT,Kp as ATTRIBUTE_GROUP_EXPANDED_CONTENT,eI as ATTRIBUTE_ICON_ID,i_ as ATTRIBUTE_ICON_KEY,n_ as ATTRIBUTE_ICON_SIZE,yh as ATTRIBUTE_IS_GROUP,ZE as ATTRIBUTE_LOOKUP,gt as ATTRIBUTE_MANAGED,oh as ATTRIBUTE_NOT_DRAGGABLE,QN as ATTRIBUTE_ORIENTATION,yg as ATTRIBUTE_ORIGIN,t_ as ATTRIBUTE_ORIGIN_X,r_ as ATTRIBUTE_ORIGIN_Y,ER as ATTRIBUTE_POPUP_POSITION,tO as ATTRIBUTE_RESET_SELECTION,Lle as ATTRIBUTE_STROKE,Kf as ATTRIBUTE_STROKE_DASHARRAY,Ole as ATTRIBUTE_STROKE_DASHOFFSET,Ple as ATTRIBUTE_STROKE_LINECAP,Cle as ATTRIBUTE_STROKE_LINEJOIN,_le as ATTRIBUTE_STROKE_MITERLIMIT,Rle as ATTRIBUTE_STROKE_OPACITY,wle as ATTRIBUTE_STROKE_WIDTH,tT as ATTRIBUTE_STYLE,_v as ATTRIBUTE_SUPPRESS_VERTEX_EVENTS,Lf as ATTRIBUTE_TABINDEX,Dle as ATTRIBUTE_TEXT_ANCHOR,yi as ATTRIBUTE_TRANSFORM,Op as ATTRIBUTE_VALUE_NON_SCALING_STROKE,_p as ATTRIBUTE_VECTOR_EFFECT,Tle as ATTRIBUTE_VERSION,wf as ATTRIBUTE_VJS_ALLOW_LOOPBACK,Qe as ATTRIBUTE_VJS_EDGE,ip as ATTRIBUTE_VJS_EDGE_TYPE,yr as ATTRIBUTE_VJS_ENABLED,sp as ATTRIBUTE_VJS_MAGNET,I_ as ATTRIBUTE_VJS_MINIVIEW_TYPE,rx as ATTRIBUTE_VJS_NODE_ID,ap as ATTRIBUTE_VJS_OVERLAY_ID,dn as ATTRIBUTE_VJS_PORT,sh as ATTRIBUTE_VJS_PORT_ID,kr as ATTRIBUTE_VJS_PORT_TYPE,os as ATTRIBUTE_VJS_SCOPE,Rv as ATTRIBUTE_VJS_SOURCE,da as ATTRIBUTE_VJS_SOURCE_PORT,Df as ATTRIBUTE_VJS_SOURCE_PORT_ID,qi as ATTRIBUTE_VJS_SOURCE_PORT_TYPE,qo as ATTRIBUTE_VJS_TARGET,Qo as ATTRIBUTE_VJS_TARGET_PORT,op as ATTRIBUTE_VJS_TARGET_PORT_ID,Qi as ATTRIBUTE_VJS_TARGET_PORT_TYPE,te as ATTRIBUTE_VJS_VERTEX,vle as ATTRIBUTE_XMLNS,ja as ATT_DATA_DIR,Sx as ATT_VJS_RESIZABLE,Tx as ATT_VJS_ROTATABLE,bx as ATT_VJS_X_RESIZE,Ax as ATT_VJS_Y_RESIZE,_i as AXIS_POSITION_END,ar as AXIS_POSITION_START,ri as AbsoluteBackedLayout,Lo as AbsoluteLayout,zi as AbstractEntry,Us as AbstractHierarchicalLayout,vn as AbstractLayout,rd as AbstractLayoutAdapter,eu as AddGroupMemberAction,Kl as AnchorLocations,qu as ArcSegmentHandler,qL as AreaChart,Gc as AreaPlot,nl as ArrayBasedSeries,Or as ArrowOverlay,bd as AssignLayersStage,Vl as AutoSaver,po as AvailableBackgrounds,a_ as BASIC_SHAPES,Pr as BLOCK,ht as BOTTOM,ms as BackgroundPlugin,fd as BalloonLayout,e0 as BarChart,Dr as BarPlot,Wc as Base,Se as BaseBrowserUIPlugin,Ao as BaseChart,_a as BaseDomUiLayoutAdapter,Dc as BaseSeriesBasedChartDataSource,vi as BezierEditor,Jw as BezierSegmentHandler,rl as BlankDataSource,Ic as BlankScale,Ra as BrowserUI,vg as BrowserUIClipboard,Zx as BrowserUIModel,hs as BrowserUiRecado,t0 as BubbleChart,vb as BubbleChartSeries,It as CENTER,zL as CHART_AXIS_TITLE_ALIGN_END,tl as CHART_AXIS_TITLE_ALIGN_MIDDLE,YL as CHART_AXIS_TITLE_ALIGN_START,C7e as CHART_TITLE_ALIGN_LEFT,v7e as CHART_TITLE_ALIGN_MIDDLE,P7e as CHART_TITLE_ALIGN_RIGHT,wc as CHART_TITLE_PLACEMENT_BOTTOM,U1 as CHART_TITLE_PLACEMENT_TOP,_Pe as CLASS_ANCHOR_CANDIDATE,Ia as CLASS_ANCHOR_PLACEHOLDER,LL as CLASS_AREA_CHART,zm as CLASS_AREA_CHART_AREA,BI as CLASS_BACKGROUND,FI as CLASS_BACKGROUND_BORDER,gs as CLASS_BACKGROUND_GRID,zg as CLASS_BACKGROUND_GRID_DOT_MAJOR,zI as CLASS_BACKGROUND_GRID_DOT_MINOR,YI as CLASS_BACKGROUND_GRID_MAJOR,UI as CLASS_BACKGROUND_GRID_MINOR,NI as CLASS_BACKGROUND_TILE,yL as CLASS_BAR_CHART,xL as CLASS_BAR_CHART_BAR,IR as CLASS_BEZIER_GUIDELINE,mc as CLASS_BEZIER_HANDLE,Wx as CLASS_BEZIER_HANDLE_CONTROL_POINT,DR as CLASS_BEZIER_HANDLE_CONTROL_POINT_1,NR as CLASS_BEZIER_HANDLE_CONTROL_POINT_2,bL as CLASS_BUBBLE_CHART,AL as CLASS_BUBBLE_CHART_DATA_POINT,el as CLASS_CHART_AXIS,lb as CLASS_CHART_AXIS_LABELS,hb as CLASS_CHART_AXIS_LINE,cb as CLASS_CHART_AXIS_TITLE,hL as CLASS_CHART_BACKGROUND,Sc as CLASS_CHART_BODY,Tc as CLASS_CHART_CROSSHAIR,vc as CLASS_CHART_CROSSHAIR_LABEL,db as CLASS_CHART_EMPTY,pb as CLASS_CHART_GRIDLINE,ub as CLASS_CHART_GRIDLINES,dL as CLASS_CHART_LEGEND,pL as CLASS_CHART_LEGEND_DOT,Bm as CLASS_CHART_LEGEND_ITEM,uL as CLASS_CHART_LEGEND_LABEL,Qa as CLASS_CHART_PLOT_BACKGROUND,bn as CLASS_CHART_POINT,Ym as CLASS_CHART_POINT_HIT_AREA,OL as CLASS_CHART_SCALE_LABEL,cL as CLASS_CHART_SERIES,CL as CLASS_CHART_SUBTITLE,vL as CLASS_CHART_TITLE,Fm as CLASS_CHART_X_AXIS,mL as CLASS_CHART_X_AXIS_TITLE,Um as CLASS_CHART_Y_AXIS,gL as CLASS_CHART_Y_AXIS_TITLE,OM as CLASS_COLOR_PICKER,gO as CLASS_COLOR_PICKER_SWATCH,pO as CLASS_COLOR_PICKER_SWATCHES,EL as CLASS_COLUMN_CHART,fL as CLASS_COLUMN_CHART_COLUMN,ah as CLASS_CONNECTED,Wy as CLASS_CONNECTION_EDIT,ua as CLASS_CONNECTOR,Lv as CLASS_CONNECTOR_OUTLINE,lp as CLASS_CONNECTOR_PATH,so as CLASS_CONNECTOR_SOURCE_DRAG,ao as CLASS_CONNECTOR_TARGET_DRAG,wv as CLASS_CONNECTOR_TRANSIENT,BP as CLASS_CONNECTOR_TRANSIENT_DRAG,kg as CLASS_CONTROLS,Y_ as CLASS_CONTROLS_CLEAR,V_ as CLASS_CONTROLS_PAN_MODE,U_ as CLASS_CONTROLS_REDO,X_ as CLASS_CONTROLS_RESET_SELECTION,nx as CLASS_CONTROLS_SELECT_MODE,F_ as CLASS_CONTROLS_UNDO,$_ as CLASS_CONTROLS_ZOOM_IN,B_ as CLASS_CONTROLS_ZOOM_OUT,G_ as CLASS_CONTROLS_ZOOM_TO_FIT,DDe as CLASS_COPY_PASTE_CONTROLS,_L as CLASS_CROSSHAIR_CATEGORY_AXIS,PL as CLASS_CROSSHAIR_VALUE_AXIS,Dy as CLASS_DEFAULT_GROUP,wy as CLASS_DEFAULT_NODE,Ux as CLASS_DIAGRAM_CELL_TOOL,uR as CLASS_DIAGRAM_CLONE_CELL,pR as CLASS_DIAGRAM_DELETE_CELL,Fx as CLASS_DIAGRAM_GROUP,ZM as CLASS_DIAGRAM_LINK_CELL,Bx as CLASS_DIAGRAM_NODE,xr as CLASS_DRAG_ACTIVE,br as CLASS_DRAG_HOVER,Nh as CLASS_DRAG_HOVER_CANNOT_DROP,Ny as CLASS_DRAG_ORIGINAL_GROUP,Iv as CLASS_DUMMY_VERTEX,Vy as CLASS_EDGE_CLICK_ENTRY,ga as CLASS_EDGE_DELETE_BUTTON,cp as CLASS_EDGE_DELETE_BUTTON_INTERNAL,$g as CLASS_EDGE_GUIDELINE,Ry as CLASS_EDGE_RELOCATING,wM as CLASS_EDGE_TYPE_PICKER,sm as CLASS_EDGE_TYPE_PICKER_SELECTED,sg as CLASS_EDGE_WILL_RELOCATE,XI as CLASS_ELASTIC_GROUP_RESIZE,Oh as CLASS_ELEMENT_DRAGGING,Kg as CLASS_EXPORT_CANCEL,z_ as CLASS_EXPORT_CONTROLS,nO as CLASS_EXPORT_DIMENSIONS,iO as CLASS_EXPORT_DOWNLOAD_TOOLS,Jg as CLASS_EXPORT_OVERLAY,Zg as CLASS_EXPORT_UNDERLAY,hG as CLASS_GAUGE_CHART,uG as CLASS_GAUGE_CHART_LABEL,pG as CLASS_GAUGE_CHART_NEEDLE,gG as CLASS_GAUGE_CHART_NEEDLE_PIVOT,dG as CLASS_GAUGE_CHART_TICK,cG as CLASS_GAUGE_CHART_TRACK,r0 as CLASS_GAUGE_CHART_ZONE,es as CLASS_GROUP,Oy as CLASS_GROUP_CHILD_ELEMENT_DRAGGING,Nf as CLASS_GROUP_COLLAPSED,If as CLASS_GROUP_EXPANDED,Ih as CLASS_HOVER,_M as CLASS_INSPECTOR,dO as CLASS_INSPECTOR_ACTIVE,uO as CLASS_INSPECTOR_CLOSE,nm as CLASS_INSPECTOR_INACTIVE,Dv as CLASS_LABEL_OVERLAY,_P as CLASS_LASSO,Lh as CLASS_LASSO_MASK,wP as CLASS_LASSO_MASK_BOTTOM,OP as CLASS_LASSO_MASK_LEFT,LP as CLASS_LASSO_MASK_RIGHT,RP as CLASS_LASSO_MASK_TOP,RL as CLASS_LINE_CHART,jO as CLASS_LINE_CROSSING_BRIDGE,ZO as CLASS_LINE_CROSSING_BRIDGE_ARCH,WO as CLASS_LINE_CROSSING_BRIDGE_DOT,G2e as CLASS_LINE_CROSSING_BRIDGE_GAP,kO as CLASS_LINE_CROSSING_BRIDGE_HORIZONTAL,HO as CLASS_LINE_CROSSING_BRIDGE_VERTICAL,ag as CLASS_MINIVIEW,DP as CLASS_MINIVIEW_CANVAS,$P as CLASS_MINIVIEW_CLICK_TO_CENTER,GP as CLASS_MINIVIEW_COLLAPSE,lg as CLASS_MINIVIEW_COLLAPSED,MP as CLASS_MINIVIEW_ELEMENT,VP as CLASS_MINIVIEW_GROUP_ELEMENT,IP as CLASS_MINIVIEW_LASSO,NP as CLASS_MINIVIEW_PANNER,Ly as CLASS_MINIVIEW_PANNING,wh as CLASS_MINIVIEW_SELECTED_ELEMENT,Rh as CLASS_MOST_RECENTLY_DRAGGED,eo as CLASS_NODE,CR as CLASS_ORTHOGONAL_HANDLE,Pm as CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE,_R as CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_HORIZONTAL,PR as CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_VERTICAL,pa as CLASS_OVERLAY,lh as CLASS_OVERLAY_HIDE,Nx as CLASS_PALETTE,hg as CLASS_PALETTE_CURRENT_SHAPE_TYPE,FP as CLASS_PALETTE_DRAG_ACTIVE,UP as CLASS_PALETTE_DRAG_HOVER,YP as CLASS_PALETTE_DRAG_HOVER_CANNOT_DROP,zP as CLASS_PALETTE_ELEMENT_CURRENT,fn as CLASS_PALETTE_SELECTED_ELEMENT,Am as CLASS_PALETTE_SET,cc as CLASS_PALETTE_SET_FILTER,Mx as CLASS_PALETTE_SET_SHAPES,iR as CLASS_PALETTE_SET_TITLE,dc as CLASS_PALETTE_SHAPE,Ix as CLASS_PALETTE_SHAPE_LABEL,Dh as CLASS_PALETTE_TAP_MODE_ACTIVE,oR as CLASS_PALETTE_VERTEX_DRAWING_LASSO,TI as CLASS_PAN_ZOOM_CANVAS,SI as CLASS_PAN_ZOOM_VIEWPORT,sP as CLASS_PAPER,lP as CLASS_PAPER_CANVAS,EEe as CLASS_PAPER_NODE,aP as CLASS_PAPER_NO_SCALE,mG as CLASS_PIE_CHART,lE as CLASS_PIE_SLICE,o0 as CLASS_PIE_SLICE_SELECTED,Nv as CLASS_PORT,Ss as CLASS_RESIZE_BORDER,GO as CLASS_RESIZE_BORDER_BOTTOM,BO as CLASS_RESIZE_BORDER_LEFT,FO as CLASS_RESIZE_BORDER_RIGHT,$O as CLASS_RESIZE_BORDER_TOP,VO as CLASS_RESIZE_FRAME,Tt as CLASS_RESIZE_HANDLE,dx as CLASS_RESIZE_HANDLE_ACTIVE,fx as CLASS_RESIZE_HANDLE_B,px as CLASS_RESIZE_HANDLE_BL,mx as CLASS_RESIZE_HANDLE_BR,yx as CLASS_RESIZE_HANDLE_L,xx as CLASS_RESIZE_HANDLE_R,Ex as CLASS_RESIZE_HANDLE_T,ux as CLASS_RESIZE_HANDLE_TL,gx as CLASS_RESIZE_HANDLE_TR,NO as CLASS_RESIZE_SKELETON,IO as CLASS_RESIZE_SKELETON_BORDERS,MO as CLASS_RESIZE_SKELETON_BORDERS_VISIBLE,ac as CLASS_ROTATE_HANDLE,gm as CLASS_ROTATE_LEADER,AG as CLASS_SANKEY_CHART,_b as CLASS_SANKEY_EDGE,Rb as CLASS_SANKEY_LABEL,Ob as CLASS_SANKEY_NODE,vo as CLASS_SANKEY_SELECTED,tn as CLASS_SANKEY_UNSELECTED,SL as CLASS_SCATTER_CHART,TL as CLASS_SCATTER_CHART_DATA_POINT,wDe as CLASS_SELECTED_MODE,mt as CLASS_SELECT_DEFEAT,$h as CLASS_SHAPE,bg as CLASS_SHAPE_ICON,ug as CLASS_SHAPE_LABEL,dm as CLASS_SNAPLINE,TO as CLASS_SNAPLINE_ACTIVE,vO as CLASS_SNAPLINE_ACTIVE_EXACT,hx as CLASS_SNAPLINE_EXACT,SO as CLASS_SNAPLINE_HORIZONTAL,AO as CLASS_SNAPLINE_VERTICAL,Iy as CLASS_SOURCE_HOVER,kx as CLASS_STRAIGHT_CONNECTOR_EDIT,Om as CLASS_STRAIGHT_DELETE_HANDLE,_s as CLASS_STRAIGHT_DRAG_HANDLE,RR as CLASS_STRAIGHT_EDITOR_GUIDELINE,gc as CLASS_STRAIGHT_HANDLE,_m as CLASS_STRAIGHT_SPLIT_HANDLE,by as CLASS_SURFACE,Sy as CLASS_SURFACE_CANVAS,TP as CLASS_SURFACE_DIRECT,Fn as CLASS_SURFACE_EDGE_DRAGGING,_y as CLASS_SURFACE_ELEMENT_DRAGGING,Cy as CLASS_SURFACE_ELEMENT_FLASH,Ay as CLASS_SURFACE_NO_PAN,Ty as CLASS_SURFACE_PAN,Py as CLASS_SURFACE_PANNING,vy as CLASS_SURFACE_PAN_ACTIVE,xfe as CLASS_SURFACE_PAN_BOTTOM,Efe as CLASS_SURFACE_PAN_LEFT,yfe as CLASS_SURFACE_PAN_RIGHT,ffe as CLASS_SURFACE_PAN_TOP,CP as CLASS_SURFACE_POINTER_DEVICE,BXe as CLASS_SURFACE_POPUP,vP as CLASS_SURFACE_TOUCH_DEVICE,My as CLASS_TARGET_HOVER,hp as CLASS_TOGGLE_GROUP_COLLAPSE,XP as CLASS_TRANSIENT_VERTEX,hh as CLASS_UI_SELECTED_CONNECTION,to as CLASS_UI_SELECTED_ELEMENT,cx as CLASS_VERTEX_DRAWING_GROUP_CHILD_CANDIDATE,CO as CLASS_VERTEX_DRAWING_LASSO,xm as CLASS_VJS_ANIMATE_EDGE_TRAVERSABLE,Lx as CLASS_VJS_ANIMATE_EDGE_TRAVERSED,hc as CLASS_VJS_ANIMATE_EDGE_TRAVERSING,Ox as CLASS_VJS_ANIMATE_SOURCE,Rx as CLASS_VJS_ANIMATE_TARGET,NFe as CLASS_VJS_ANIMATE_VERTEX_TRAVERSABLE,IFe as CLASS_VJS_ANIMATE_VERTEX_TRAVERSED,Zn as CLASS_VJS_ANIMATE_VERTEX_TRAVERSING,q1 as CLASS_VJS_TOOLTIP,iM as CLEAR_PATH,nM as CLEAR_VIEW_BOX,RM as COLOR_PICKER_ELEMENT,rw as COMMIT_CURRENT,Hf as COMPONENT_TYPE_CONNECTION,ome as CONNECTION,Zo as CONNECTOR_TYPE_CUBIC_BEZIER,Hi as CONNECTOR_TYPE_ORTHOGONAL,Hu as CONNECTOR_TYPE_QUADRATIC_BEZIER,rv as CONNECTOR_TYPE_SMOOTH,jr as CONNECTOR_TYPE_STRAIGHT,Ol as CONNECT_REASON_API,cA as CONNECT_REASON_COPY_PASTE,Rl as CONNECT_REASON_DATA_LOAD,hA as CONNECT_REASON_TRANSIENT,lA as CONNECT_REASON_UNDO_REDO,Ro as CONNECT_REASON_USER_ACTIVITY,MV as CONTAINMENT_NOT_NEGATIVE,VV as CONTAINMENT_PARENT,GV as CONTAINMENT_PARENT_ENCLOSED,Ua as CONTENT_TYPES,b6 as CSV,wd as CandidateSorter,Ag as CanvasLayoutAdapter,Fd as CatchAllEventHandler,qn as CategoryValueChart,cl as CategoryValueTooltip,So as CategoryVsAxisPlot,km as ChartExporter,jm as ChartLegend,Tr as ChartSeries,ad as CircularLayout,Rm as ClickSplitMode,$u as Clipboard,Xc as Cluster,il as CollationSeries,wm as Collicat,QL as ColumnChart,wl as ColumnLayout,ia as CommentEntry,Ne as Components,Go as CompoundAction,er as Connections,je as Connectors,Wg as ControlsComponent,nc as ControlsPlugin,Gu as CopyData,j_ as CopyPasteControlsComponent,zs as CrossingStage,WE as CsvReader,Qf as CustomOverlayImpl,Pu as CustomTag,be as DEFAULT,b_ as DEFAULT_ANCHOR_PLACEHOLDER_SIZE,K1 as DEFAULT_ARRAY_SERIES_ID_FIELD,J1 as DEFAULT_ARRAY_SERIES_LABEL_FIELD,Z1 as DEFAULT_ARRAY_SERIES_MAX_VALUES_FIELD,W1 as DEFAULT_ARRAY_SERIES_MIN_VALUES_FIELD,H1 as DEFAULT_ARRAY_SERIES_RANGE_START_FIELD,j1 as DEFAULT_ARRAY_SERIES_STEP,k1 as DEFAULT_ARRAY_SERIES_VALUES_FIELD,Oi as DEFAULT_AXIS_LINE_SIZE,G1 as DEFAULT_BACKGROUND_COLOR,aG as DEFAULT_BAR_GAP,$T as DEFAULT_BEZIER_CONTROL_POINT_SCALE,$w as DEFAULT_BEZIER_LOOPBACK_DISTANCE,OO as DEFAULT_BORDER_HANDLE_SIZE,jL as DEFAULT_CATEGORY_AXIS_FONT_SIZE,HL as DEFAULT_CATEGORY_AXIS_FONT_STYLE,oG as DEFAULT_CATEGORY_FILL_RATIO,VL as DEFAULT_CHART_EMPTY_MESSAGE,GL as DEFAULT_CHART_ERROR_MESSAGE,s_ as DEFAULT_COLOR,Uy as DEFAULT_COLOR_PROPERTY,x_ as DEFAULT_CONNECTOR_EDITOR_BUTTON_SIZE,eE as DEFAULT_CORNER_RADIUS,hR as DEFAULT_DIAGRAM_CELL_HEIGHT,lR as DEFAULT_DIAGRAM_CELL_WIDTH,WM as DEFAULT_DIAGRAM_TOOLS_BUTTON_SIZE,nN as DEFAULT_DOT_OVERLAY_RADIUS,Qg as DEFAULT_DOWNLOAD_BUTTON_LABEL,NE as DEFAULT_EDGE_NODE_SIZE,sN as DEFAULT_ELLIPSE_OVERLAY_RADIUS_X,aN as DEFAULT_ELLIPSE_OVERLAY_RADIUS_Y,qg as DEFAULT_EXPORT_FILENAME,Yh as DEFAULT_FILL_COLOR,Fy as DEFAULT_FILL_PROPERTY,UV as DEFAULT_FLOWCHART_ARROW_LENGTH,FV as DEFAULT_FLOWCHART_ARROW_WIDTH,zV as DEFAULT_FLOWCHART_PROPERTY_LINE_STYLE,YV as DEFAULT_FLOWCHART_PROPERTY_MARKERS,MI as DEFAULT_GRID,UL as DEFAULT_GRID_LINE_COLOR,wO as DEFAULT_HANDLE_OFFSET,RA as DEFAULT_HEIGHT_ATTRIBUTE,wA as DEFAULT_HIERARCHICAL_LAYOUT_ALIGN,IA as DEFAULT_HIERARCHICAL_LAYOUT_ALIGNMENT,DA as DEFAULT_HIERARCHICAL_LAYOUT_PADDING,NA as DEFAULT_HIERARCHICAL_LAYOUT_SPACING,xd as DEFAULT_HIERARCHY_LAYOUT_ALIGNMENT,Mf as DEFAULT_KEY_ALLOW_NESTED_GROUPS,ch as DEFAULT_KEY_ANCHOR,dh as DEFAULT_KEY_ANCHORS,Mv as DEFAULT_KEY_ASTAR_VERTEX_BORDER,Vv as DEFAULT_KEY_ASTAR_VERTEX_BUFFER,dp as DEFAULT_KEY_CONNECTOR,Gv as DEFAULT_KEY_CSS_CLASS,sne as DEFAULT_KEY_EDGES_DETACHABLE,$v as DEFAULT_KEY_EDGE_RELOCATE_HANDLE_SIZE,ane as DEFAULT_KEY_GROUP_SIZE,Bv as DEFAULT_KEY_HOVER_CLASS,up as DEFAULT_KEY_HOVER_PAINT_STYLE,Fv as DEFAULT_KEY_MAX_CONNECTIONS,lne as DEFAULT_KEY_NODE_SIZE,ts as DEFAULT_KEY_PAINT_STYLE,hne as DEFAULT_KEY_REATTACH_EDGES,Vf as DEFAULT_KEY_SCOPE,$1 as DEFAULT_LABEL_COLOR,oI as DEFAULT_LABEL_FILL_RATIO,KD as DEFAULT_LABEL_LOCATION,Ff as DEFAULT_LABEL_LOCATION_ATTRIBUTE,lo as DEFAULT_LABEL_PROPERTY,CA as DEFAULT_LEFT_ATTRIBUTE,z1 as DEFAULT_LEGEND_BACKGROUND_COLOR,Y1 as DEFAULT_LEGEND_OUTLINE_WIDTH,O1 as DEFAULT_LEGEND_PADDING,Jh as DEFAULT_LINE_STROKE,F1 as DEFAULT_MARGIN,sG as DEFAULT_MAXIMUM_BAR_WIDTH,LO as DEFAULT_MINIMUM_HEIGHT,RO as DEFAULT_MINIMUM_WIDTH,nv as DEFAULT_ORTHOGONAL_STUB,cs as DEFAULT_OUTLINE_COLOR,Fh as DEFAULT_OUTLINE_PROPERTY,zh as DEFAULT_OUTLINE_WIDTH,Uh as DEFAULT_OUTLINE_WIDTH_PROPERTY,BM as DEFAULT_PALETTE_SELECTOR,hP as DEFAULT_PAPER_MARGIN,oN as DEFAULT_RECTANGLE_OVERLAY_HEIGHT,iN as DEFAULT_RECTANGLE_OVERLAY_WIDTH,_O as DEFAULT_ROTATE_HANDLE_SIZE,PO as DEFAULT_ROTATE_LEADER_LENGTH,_A as DEFAULT_ROTATION_ATTRIBUTE,hye as DEFAULT_SET_DESCRIPTION,lye as DEFAULT_SET_NAME,cR as DEFAULT_SHAPE_SETS,uD as DEFAULT_SMOOTHING,pm as DEFAULT_SVG_HANDLE_SIZE,L_ as DEFAULT_TICK_LINE_STROKE,VI as DEFAULT_TICK_MARKS_PER_CELL,Ab as DEFAULT_TITLE_PADDING,PA as DEFAULT_TOP_ATTRIBUTE,tE as DEFAULT_VALUE_AXIS_FONT_SIZE,rE as DEFAULT_VALUE_AXIS_FONT_STYLE,XL as DEFAULT_VALUE_AXIS_PADDING,OA as DEFAULT_WIDTH_ATTRIBUTE,Uv as DEFAULT_ZOOM_RANGE,Cn as DIAGONAL_AXIS_LR,ii as DIAGONAL_AXIS_RL,Wa as DRAG_GROUP_MEMBERSHIP_ADDED,bO as DRAG_GROUP_MEMBERSHIP_ASSIGNED,td as DataModel,Zm as DataSeriesBasedDataSource,na as DatasetIndex,Og as Decorator,Rg as Decorators,gh as DefaultRouter,dw as DefaultSearchTokenizer,vm as Diagram,Jn as DiagramCell,mR as DiagramExportComponent,Ti as DiagramLink,uc as DiagramPalette,Cs as DiagramToolsPlugin,ue as DialogConstants,$p as DiamondOverlay,Fp as DotOverlay,Qx as Drag,xs as DragGroupsPlugin,nE as DualValueAxisTooltip,ml as DualValueChart,gl as DualValueChartSeries,Cr as EDGE,Hn as EDGE_DRAG_HANDLE,kh as EDGE_INPUT_METHOD_CLICK,zn as EDGE_INPUT_METHOD_DRAG,Wh as EDGE_INPUT_STATE_IDLE,Xy as EDGE_INPUT_STATE_LOCKED,w_ as EDGE_ROUTING_PLUGIN_MODE_DIRECT,L0e as EDGE_ROUTING_PLUGIN_MODE_ORTHOGONAL,Gve as EDGE_SNAP_CENTER,E_ as EDGE_SNAP_DEFAULT,CI as EDGE_SNAP_PERIMETER,DM as EDGE_TYPE_PICKER_ELEMENT,US as EDGE_UPDATE_REASON_UPDATED,ime as ELEMENT,Fe as ELEMENT_CIRCLE,OC as ELEMENT_DEFS,Ke as ELEMENT_DIV,RC as ELEMENT_ELLIPSE,Q as ELEMENT_G,tI as ELEMENT_INCLUDE_ICON,rI as ELEMENT_INCLUDE_ICONS,q as ELEMENT_PATH,Z as ELEMENT_RECT,we as ELEMENT_SVG,et as ELEMENT_TEXT,Jf as ELEMENT_TSPAN,ME as EMPTY_ASTAR_PATH,Di as EMPTY_BOUNDS,SD as EMPTY_ELEMENT,Qn as EPSILON,pS as EVENT_ADHOC_LAYOUT,qs as EVENT_AFTER_LAYOUT_REFRESH,FR as EVENT_BEFORE_START,Rn as EVENT_CANVAS_CLICK,MS as EVENT_CANVAS_DBLCLICK,im as EVENT_CHANGE,Hm as EVENT_CHART_LOAD,Xe as EVENT_CLICK,At as EVENT_CONTEXTMENU,Ul as EVENT_CONTEXT_UPDATE,BE as EVENT_DATA_APPEND_END,$E as EVENT_DATA_APPEND_START,Mr as EVENT_DATA_LOAD_END,No as EVENT_DATA_LOAD_START,FE as EVENT_DATA_UPDATED,$o as EVENT_DBLCLICK,Yr as EVENT_DBLTAP,Qt as EVENT_DESELECT,$i as EVENT_DESTROY,UR as EVENT_DRAG,PV as EVENT_DROP,ur as EVENT_EDGE_ADDED,RS as EVENT_EDGE_CLICK,NS as EVENT_EDGE_CONTEXTMENU,LS as EVENT_EDGE_DBLCLICK,wS as EVENT_EDGE_DBLTAP,KA as EVENT_EDGE_DRAG,QA as EVENT_EDGE_DRAG_ABORT,qA as EVENT_EDGE_DRAG_END,JA as EVENT_EDGE_DRAG_START,ai as EVENT_EDGE_GEOMETRY,zl as EVENT_EDGE_MOUSEDOWN,cu as EVENT_EDGE_MOUSEOUT,du as EVENT_EDGE_MOUSEOVER,DS as EVENT_EDGE_MOUSEUP,li as EVENT_EDGE_PATH_EDITED,uu as EVENT_EDGE_REDRAW,bt as EVENT_EDGE_REMOVED,ln as EVENT_EDGE_SOURCE_CHANGED,IS as EVENT_EDGE_TAP,an as EVENT_EDGE_TARGET_CHANGED,Dd as EVENT_EDGE_TYPE_CHANGED,xt as EVENT_EDGE_UPDATED,tx as EVENT_ELASTIC_GROUP_FRAME_REMOVE,ex as EVENT_ELASTIC_GROUP_FRAME_RESIZE,eR as EVENT_END_NODE_TRAVERSAL,mo as EVENT_END_OVERLAY_ANIMATION,ES as EVENT_FOCUS,ZA as EVENT_GRAPH_CHANGED,Jt as EVENT_GRAPH_CLEARED,_n as EVENT_GRAPH_CLEAR_START,Zt as EVENT_GROUP_ADDED,ou as EVENT_GROUP_COLLAPSE,su as EVENT_GROUP_EXPAND,Gi as EVENT_GROUP_MEMBER_ADDED,ks as EVENT_GROUP_MEMBER_REMOVED,Io as EVENT_GROUP_MOVE,Gr as EVENT_GROUP_MOVE_END,eS as EVENT_GROUP_MOVE_START,Yl as EVENT_GROUP_RELAYOUT,Re as EVENT_GROUP_REMOVED,Fr as EVENT_GROUP_RENDERED,Md as EVENT_GROUP_TYPE_CHANGED,ve as EVENT_GROUP_UPDATED,uS as EVENT_INTERNAL_CONNECTION,tS as EVENT_INTERNAL_EDGE_REDRAW,iu as EVENT_INTERNAL_ELEMENT_REPAINTED,Vd as EVENT_INTERNAL_GROUP_SIZE_CHANGED,Gd as EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO,$d as EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO,Qs as EVENT_INTERNAL_VERTEX_UPDATED,Xn as EVENT_KEYUP,mu as EVENT_LASSO_END,pu as EVENT_LASSO_START,gu as EVENT_LASSO_UPDATE,ge as EVENT_MOUSEDOWN,UE as EVENT_MOUSEENTER,YE as EVENT_MOUSEEXIT,fS as EVENT_MOUSELEAVE,ae as EVENT_MOUSEMOVE,ot as EVENT_MOUSEOUT,st as EVENT_MOUSEOVER,le as EVENT_MOUSEUP,Kt as EVENT_NODE_ADDED,Mt as EVENT_NODE_MOVE,Bd as EVENT_NODE_MOVE_ABORT,Vt as EVENT_NODE_MOVE_END,Ws as EVENT_NODE_MOVE_START,Ce as EVENT_NODE_REMOVED,Ur as EVENT_NODE_RENDERED,Nd as EVENT_NODE_TYPE_CHANGED,Le as EVENT_NODE_UPDATED,lu as EVENT_NODE_VISIBILITY,mS as EVENT_OBJECT_REPAINTED,OV as EVENT_OUT,_V as EVENT_OVER,Fi as EVENT_PAN,hu as EVENT_PLUGIN_ADDED,gS as EVENT_PLUGIN_REMOVED,si as EVENT_PORT_ADDED,Vr as EVENT_PORT_REMOVED,Id as EVENT_PORT_TYPE_CHANGED,dr as EVENT_PORT_UPDATED,iS as EVENT_REDO,On as EVENT_RELAYOUT,rS as EVENT_RENDERER_ADDED,Br as EVENT_RENDER_END,au as EVENT_RENDER_START,qt as EVENT_SELECT,ir as EVENT_SELECTION_CLEARED,BR as EVENT_START,_x as EVENT_START_NODE_TRAVERSAL,lc as EVENT_START_OVERLAY_ANIMATION,ym as EVENT_STATE,YR as EVENT_STOP,Ln as EVENT_SURFACE_MODE_CHANGED,W as EVENT_TAP,xS as EVENT_TOUCHEND,bS as EVENT_TOUCHMOVE,yS as EVENT_TOUCHSTART,nS as EVENT_UNDO,Zs as EVENT_UNDOREDO_UPDATE,AS as EVENT_VERTEX_CLICK,_S as EVENT_VERTEX_CONTEXTMENU,SS as EVENT_VERTEX_DBLCLICK,TS as EVENT_VERTEX_DBLTAP,C3 as EVENT_VERTEX_MOUSEDOWN,PS as EVENT_VERTEX_MOUSEMOVE,vS as EVENT_VERTEX_MOUSEOUT,CS as EVENT_VERTEX_MOUSEOVER,v3 as EVENT_VERTEX_MOUSEUP,OS as EVENT_VERTEX_TAP,$r as EVENT_ZOOM,vu as EachEntry,ze as Edge,Tg as EdgeGeometryTransformer,Na as EdgeHandlerBase,Vg as EdgeInputHandler,Ma as EdgePathEditor,Gg as EdgeRelocateHandler,qh as EdgeRoutingPlugin,Td as EdgeRoutingStage,am as EdgeTypePicker,uo as EditorBase,Fa as ElasticGroupManager,DE as ElementCluster,Cm as ElementDragHandler2,kR as ElementDragger,zr as ElementEntry,Ki as ElementTypes,ui as Elements,Xp as EllipseOverlay,Fs as EmptyLayout,fp as EmptyRedrawResult,_E as EventGenerator,xe as EventManager,cm as ExportControlsPlugin,Lt as FACE_BOTTOM,Ot as FACE_LEFT,Rt as FACE_RIGHT,_t as FACE_TOP,ct as FALSE,PC as FILL,Rf as FIXED,HV as FLOWCHART_EDGE_TYPE_BOTH_ARROWS,WV as FLOWCHART_EDGE_TYPE_DASHED,kV as FLOWCHART_EDGE_TYPE_PLAIN,XV as FLOWCHART_EDGE_TYPE_SOURCE_ARROW,jV as FLOWCHART_EDGE_TYPE_TARGET_ARROW,lxe as FLOWCHART_SHAPES,_g as FixedLayer,P6e as FlowchartBasicEdgeMappings,dd as ForceDirectedLayout,ELe as GRID_TYPE_DOTTED,fLe as GRID_TYPE_LINES,VS as GROUP_RELAYOUT_ADHOC,$S as GROUP_RELAYOUT_EXISTING_VERTEX_ADDED,_3 as GROUP_RELAYOUT_MEMBER_REMOVED,GS as GROUP_RELAYOUT_NEW_VERTEX_ADDED,n0 as GaugeChart,Ga as GeneratedGridBackground,Pl as Graph,JS as GraphSearchIndex,wo as GridLayout,mh as GridProfile,II as GridTypes,se as Group,ru as GroupCollapseAction,nu as GroupExpandAction,Sg as GroupLayoutAdapter,Wd as GroupRemoveAction,Bl as GroupSizeChangedAction,bA as H,Ve as HEIGHT,CE as HIERARCHICAL_JSON_DATATYPE,Ch as HTMLElementOverlay,nf as HeadlessRecado,md as HierarchicalLayout,gd as HierarchicalParentRelativePlacementStrategy,Do as HierarchyLayout,vd as HierarchyLayoutModel,Ys as HierarchyLayoutStage,oa as HilbertCurves,o_ as ICONS_ORIENTATION_HORIZONTAL,nxe as ICONS_ORIENTATION_VERTICAL,ZP as ICON_CIRCLE,gg as ICON_CLONE,kP as ICON_CROSS,JP as ICON_GEAR,pg as ICON_LINK,Vh as ICON_ORIGIN_CENTER,Gh as ICON_ORIGIN_END,Mh as ICON_ORIGIN_START,WP as ICON_PLUS,mg as ICON_TRASH,NM as INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS,rc as INSPECTOR_CONTEXT_RECENT_COLORS,$y as IconElement,_u as IfEntry,tc as ImageExportUI,Gy as InBrowserTemplateResolver,om as Inspector,Wt as JSON_DATATYPE,JI as LASSO_PATH,ZI as LASSO_VIEW_BOX,D0 as LAYOUT_TYPE_ABSOLUTE,RE as LAYOUT_TYPE_COLUMN,OE as LAYOUT_TYPE_GRID,U0 as LAYOUT_TYPE_HIERARCHICAL,UA as LAYOUT_TYPE_HIERARCHY,LE as LAYOUT_TYPE_ROW,Ze as LEFT,xb as LEGEND_ALIGN_CENTER,yb as LEGEND_ALIGN_LEFT,ML as LEGEND_ALIGN_RIGHT,fb as LEGEND_ORIENTATION_HORIZONTAL,wZe as LEGEND_ORIENTATION_VERTICAL,bb as LEGEND_VERTICAL_ALIGN_BOTTOM,Lc as LEGEND_VERTICAL_ALIGN_MIDDLE,Rc as LEGEND_VERTICAL_ALIGN_TOP,Sle as LINE_WIDTH,MD as LOCATION_ATTRIBUTE,fr as LabelOverlay,Va as Lasso,kn as LassoPlugin,nt as Layouts,i0 as LineChart,Em as LineCrossingsPlugin,$c as LinePlot,oc as ListManagerPlugin,Lp as MagnetizeProfile,Mi as Magnetizer,Wn as MiniviewPlugin,Nc as ModelSeriesBasedDataSource,Js as MoveAction,TA as NEGATIVE,Hr as NOMINAL_SIZE,pt as NONE,ce as Node,kd as NodeGroupAction,cf as OBJECT_TYPE_ANCHOR,rK as OPPOSITE_FACES,Tf as ORIENTATION_OPPOSITE,Sf as ORIENTATION_ORTHOGONAL,Af as ORIENTATION_PERPENDICULAR,ne as ORTHOGONAL_AXIS_HORIZONTAL,pe as ORTHOGONAL_AXIS_VERTICAL,tK as ORTHOGONAL_FACES,MJ as ORTHOGONAL_ROUTER_MODE_BUS,Mu as ORTHOGONAL_ROUTER_MODE_SEPARATE,qf as OVERLAY_TYPE_CUSTOM,pp as OVERLAY_VISIBILITY_ALWAYS,ro as OVERLAY_VISIBILITY_HOVER,zt as OptimisticEventGenerator,Eo as OrthogonalEditor,pi as Overlay,at as OverlayFactory,ax as PALETTE_MODE_DRAG,lx as PALETTE_MODE_DRAW,xO as PALETTE_MODE_TAP,eM as PAN_PATH,QI as PAN_VIEW_BOX,as as PAPER_ALIGN_CENTER,vh as PAPER_ALIGN_END,Th as PAPER_ALIGN_START,cd as PATH_CONSTRAIN_DIAGONAL,AA as PATH_CONSTRAIN_MANHATTAN,SA as PATH_CONSTRAIN_METRO,on as PATH_CONSTRAIN_NONE,sn as PATH_CONSTRAIN_ORTHOGONAL,Hl as PLACEHOLDER_KEY,Uo as PLACEHOLDER_VALUE,mm as PLUGIN_TYPE_LINE_CROSSINGS,Pv as POSITION_RELATIVE,hy as PROPERTY_POSITION,Mn as PX,Xa as Palette,ic as PalettePlugin,As as PanButtonsPlugin,Da as PanZoom,fc as Paper,Pd as ParentRelativePlacementStrategy,Ll as PathImpl,fm as PathTransport,QO as PathTransportState,Mw as PerimeterAnchorShapes,s0 as PieChart,Pg as PinchListener,_d as PlacementStage,Vp as PlainArrowOverlay,yR as PopupHandler,de as Port,Jd as PortAction,Kd as PortAddAction,qd as PortRemoveAction,Vs as PriorityQueue,Hp as PropertyMapper,Rp as PropertyTracker,yo as QuadraticBezierEditor,sse as REMOVE_CLASS_ACTION,rM as RESET_SELECTION_PATH,tM as RESET_SELECTION_VIEW_BOX,DO as RESIZING_TOOLS_RESIZE_METHOD_BORDERS,sc as RESIZING_TOOLS_RESIZE_METHOD_HANDLES,yt as RIGHT,nw as ROLLBACK_CURRENT,ho as ROOT_SHAPE_SET,AF as ROTATION,Vi as ROW,_T as RTREE_DEFAULT_MAX_CHILD_ENTRIES,Ho as RTree,Xs as RandomColorGenerator,zo as Recado,Cg as RecadoTemplateRenderer,rr as RecordBasedSeries,Yp as RectangleOverlay,tu as RemoveGroupMemberAction,Ts as ResizingToolsPlugin,Dl as RowLayout,rh as SEGMENT_TYPE_ARC,ko as SEGMENT_TYPE_BEZIER,In as SEGMENT_TYPE_STRAIGHT,lS as SELECTION_MODE_EDGES_ONLY,aS as SELECTION_MODE_GROUPS_ONLY,Ud as SELECTION_MODE_ISOLATED,oS as SELECTION_MODE_MIXED,sS as SELECTION_MODE_NODES_ONLY,Jr as SELECTOR_CONNECTOR,zC as SELECTOR_GROUP_CONTAINER,xh as SELECTOR_MANAGED_ELEMENT,$n as SELECTOR_OVERLAY,XC as SELECTOR_TOGGLE_GROUP_COLLAPSE,it as SOURCE,Cv as STATIC,Ike as STRAIGHT_CONNECTOR_AUTO_SPLIT,LR as STRAIGHT_CONNECTOR_CLICK_SPLIT,Zf as STROKE,_C as STROKE_WIDTH,ps as SURFACE_MODE_DISABLED,Sr as SURFACE_MODE_PAN,bi as SURFACE_MODE_SELECT,jn as SURFACE_MODE_VERTEX_DRAWING,ng as SVGElementOverlay,Gt as SVG_NAMESPACE,h0 as SankeyChart,c0 as ScatterChart,gr as Segments,Ba as SelectedEdgeHighlightPlugin,al as SeriesBasedChart,dg as ShapeLibraryDefaults,Pa as ShapeLibraryImpl,Tm as ShapePalette,yO as ShapeTypeInspector,Bg as SimpleBackground,Vn as SimpleShapeOverlay,Rd as SingleColorGenerator,bs as SnaplinesPlugin,kS as SourceValueTargetCsvParser,zA as StaticColorGenerator,HR as Storage,fo as StraightEditor,Ko as StraightSegmentHandler,ol as SummingSeries,Ec as Surface,bm as SurfaceAnimator,og as SvgComponent,za as SvgExportComponent,tm as SvgExportUI,jh as SyntheticDecorator,HP as TAG_SHAPE,Pn as TARGET,O_ as TILING_STRATEGY_ABSOLUTE,__ as TILING_STRATEGY_LOGARITHMIC,Te as TOP,Pt as TRUE,Li as TWO_PI,rT as TYPE_ATTRIBUTE,di as TYPE_EACH,ci as TYPE_ELEMENT,jl as TYPE_IF,Sp as TYPE_ITEM_ANCHORS,zf as TYPE_ITEM_CONNECTOR,iC as TYPE_ITEM_OVERLAY,fs as TYPE_JPG,ec as TYPE_PNG,QS as TYPE_ROOT,ox as TYPE_SVG,Ui as TYPE_TEXT,Fo as TYPE_TMPL,$l as TerminusAddAction,Gl as TerminusRemoveAction,$m as TestHarness,Xi as TextEntry,Ug as TiledBackground,Yo as TmplEntry,ll as Tooltip,hl as TooltipRenderer,Ip as UICore,Ep as UIModel,un as UIPlugins,jg as UIState,vA as UNDEFINED,Qy as UiStatesBrowserUIModel,Kh as UiStatesPlugin,Eu as UndoRedoManager,Bi as UpdateAction,Jm as UrlSeriesBasedDataSource,hd as V,Il as VERTEX,qI as VERTEX_DRAWING_PATH,KI as VERTEX_DRAWING_VIEW_BOX,aw as VERTEX_UPDATE_REASON_ADD_NEW_PORT,sw as VERTEX_UPDATE_REASON_ADD_PORT,Xl as VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE,YS as VERTEX_UPDATE_REASON_GROUP_RESIZED,h6 as VERTEX_UPDATE_REASON_LAYOUT,zS as VERTEX_UPDATE_REASON_MAGNETIZER,ra as VERTEX_UPDATE_REASON_MOVED,lw as VERTEX_UPDATE_REASON_REMOVE_PORT,jS as VERTEX_UPDATE_REASON_RESIZED,ta as VERTEX_UPDATE_REASON_ROTATION,bu as VERTEX_UPDATE_REASON_SET_POSITION,c6 as VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT,XS as VERTEX_UPDATE_REASON_SNAP_TO_GRID,FS as VERTEX_UPDATE_REASON_UPDATE_GROUP,BS as VERTEX_UPDATE_REASON_UPDATE_NODE,yu as VERTEX_UPDATE_REASON_UPDATE_PORT,kE as VERTEX_UPDATE_REASON_UPDATE_VERTEX,lm as VanillaInspector,Zc as Vertex,Ai as VertexDrawingPlugin,Od as VertexSet,bp as Viewport,xu as VisuallyJsModel,Fl as VisuallyJsRendererVertexRemovedAction,pr as VisuallyJsSelection,Ci as VisuallyJsTestSupport,np as VjsContext,_e as WIDTH,Er as WILDCARD,H6 as WhitespaceReplacingTokenizer,ee as X,Ile as XHTML_NAMESPACE,Nle as XLINK_NAMESPACE,dl as XYChart,Sb as XYPlot,Q9 as X_AXIS_FACES,ye as Y,eK as Y_AXIS_FACES,rO as ZOOM_IN_OUT_VIEW_BOX,oM as ZOOM_IN_PATH,sM as ZOOM_OUT_PATH,WI as ZOOM_TO_FIT_PATH,kI as ZOOM_TO_FIT_VIEW_BOX,KE as _addBinding,Xr as _addConnectorSegment,CC as _adjustForGap,sy as _applyStyles,LT as _areaIfGrownBy,nT as _bindOneAtt,gb as _calculateSteps,yf as _clearConnectorSegments,Nq as _computeConnector,Pp as _computeSingleLocation,qT as _connectorBoundingBoxIntersection,Mq as _connectorBoxIntersection,Dq as _connectorGradientAtPoint,Iq as _connectorLineIntersection,Be as _connectorPointAlongPathFrom,mr as _connectorPointOnPath,Yf as _createAnchor,aa as _createBaseSegment,Bu as _createConnectorBase,Zv as _createContinuousAnchor,iD as _createCubicBezierConnector,oD as _createQuadraticBezierConnector,IT as _createSegment,cI as _defaultGroupHtmlTemplate,uI as _defaultGroupSvgTemplate,La as _defaultNodeHtmlTemplate,wa as _defaultNodeSvgTemplate,hI as _defaultPortHtmlTemplate,dI as _defaultPortSvgTemplate,GT as _defaultSegmentBoundingBoxIntersection,ql as _defaultSegmentBoxIntersection,MT as _defaultSegmentFindClosestPointOnPath,VT as _defaultSegmentLineIntersection,Xo as _emptyRTreeRegion,Ig as _findAnchorOrientation,ff as _findConnectorSegmentForLocation,KT as _findConnectorSegmentForPoint,C1 as _findIdealSteps,iv as _findNextHorizontalSegment,ku as _findNextSegmentOfType,sv as _findNextVerticalSegment,ov as _findPreviousHorizontalSegment,av as _findPreviousVerticalSegment,_I as _findTargetZones,OI as _findZones,yC as _getCurrentAnchorLocation,l_ as _getDefaultTemplate,koe as _getLabelOverlay,uf as _getSegmentLength,Dg as _getVertexInfo,sf as _growToFit,wT as _hasLeafNodes,$D as _hideOverlays,m_ as _initialiseDecorators,lC as _internalLabelOverlayClass,Tp as _internalLabelOverlayId,joe as _internalSourceMarkerOverlayId,Hoe as _internalTargetMarkerOverlayId,ns as _isContinuousAnchor,uh as _isFaceAvailable,Vu as _isLeaf,Cf as _mapToSpline,Cse as _padPoint,fC as _placeAnchorsOnLine,y_ as _populateSourceZones,Hh as _populateTargetZones,f_ as _populateZones,bf as _prepareCompute,sa as _registerSegmentHandler,rs as _removeOverlay,yD as _removeShortSegments,uC as _removeTypeCssHelper,JT as _resetConnectorBounds,ji as _resetConnectorGeometry,pf as _setAnchorLocation,Tv as _setOrthogonalSegmentPosition,BD as _showOverlays,vv as _trimOrthogonalConnector,Of as _trimOrthogonalSegments,Pf as _trimSegments,Qw as _updateConnectorBounds,xf as _updateConnectorSegmentProportions,Cp as _updateHoverStyle,af as _updateRTreeRegionBounds,Qu as _writeSegmentedConnectorSegments,Jo as aSegmentDirections,wi as add,L as addClass,Zr as addConnectionClass,tf as addEntryToEachExecution,fT as addNewExecutionToEachExecution,th as addSegment,Jb as addToDictionary,d$ as addToList,Ah as addWheelListener,c$ as addWithFunction,ul as addXYPlotType,Aa as ajax,vf as anchorPlacementEquals,aO as apply,hC as applyConnectionType,eG as applyDomainOverrides,tA as applyRotations,rA as applyRotationsXY,aA as areVerticesConnected,C0 as arraysEqual,vC as astarFromViewport,Ae as att,fi as attWithValue,xXe as attachDiagramPalette,rm as attemptCoerce,yM as base64Encode,xM as base64EncodeSvgElement,Dn as bezierLineIntersection,Cme as bindDarkModeListener,qK as boundingBoxIntersection,KK as boxIntersection,tG as buildDomainScales,ed as calculateNestedDepth,P1 as calculatePowerOf10,Ii as calculateSpacingAdjustment,QG as chebyshevDistance,bl as clampAngle,Wo as clampToHalfPixel,Pme as classList,vIe as clear,lt as clone,Sye as cloneIcon,z as cls,XA as colourDistance,Xu as computeBezierConnector,jT as computeBezierLength,ZL as computeDomainScales,wp as computeGroupSize,fR as computeOrigin,uE as computeRectangleIntersection,tp as computeStraightConnector,UN as computeTranslationForRotation,yv as connectorSegmentLength,oe as consume,Ms as containsPoint,gi as convertToFullOverlaySpec,Jp as convertToMultilineText,Fu as createAbstractBezierConnector,qr as createAndAppendElementNS,k as createChartElement,Os as createChartTextElement,mO as createColorPickerTag,pC as createComponent,Xm as createContrastLabel,bXe as createDiagram,Kr as createElement,xa as createElementNS,ma as createFinderFromAnchorPositions,Du as createGateMap,s6e as createPaper,vje as createSurface,JL as createXYPlot,De as data,ba as debounce,QM as decodeDragGroupSpec,$M as defaultDataGenerator,Lq as defaultExportGeometry,Bh as defaultIcons,TE as defaultIdFunction,wq as defaultImportGeometry,yy as destroySVGOverlay,VE as diagonalAdjacentCellsFinder,PT as directRouter,UT as dist,Fw as distanceFromCurve,zc as djikstra,_5 as each,Qb as eachNotEmpty,EC as edgeSortFunctions,Lr as editors,Oc as emptyBox,Gw as emptyPaintGeometry,WG as encloses,bM as encodedSvgToDataUrl,Ph as ensureSVGContentElements,ls as ensureSVGLabelElements,qG as euclideanDistance,Yi as evaluateExpression,QE as evaluateSingleExpression,zb as expandRectangle,cn as exportConnectorGeometry,PE as exportData,em as exportImage,Eb as exportSVG,Ya as exportSvg,Ks as extend,TIe as extract,u$ as extractBounds,ft as extractPoint,ei as extractSize,vM as extractValueFromElement,df as faceOrientations,Ct as fastTrim,qb as filterEmpty,g$ as filterNull,Zu as findAdjacentSegment,kc as findClosestPoint,Bt as findParent,Ame as findParents,Wu as findSegment,pE as fixPrecision,Iw as flatten,Nb as floydWarshall,mb as formatValue,J0 as freeMovementAdjacencies,jR as generateConstrainFunctionFromContainmentType,VM as generateInspectorTemplate,ife as getAbsolutePosition,_0 as getAllEdges,C$ as getAllSourceEdges,P$ as getAllTargetEdges,Tn as getAncestors,ZC as getClass,Kb as getClosestMidpoint,R$ as getConnectedVertices,XN as getConnectorElement,Ld as getContrastColor,vE as getDescendantEdges,Bs as getDescendants,_$ as getDownstreamVertices,vl as getEdges,Je as getElementSize,eg as getElementType,ss as getEventSource,fE as getFromSetWithFunction,tH as getOutlineColor,fN as getPageLocation,En as getPosition,tg as getPositionOnElement,S0 as getRectangleMidpoints,JC as getSelector,nA as getSourceEdges,ig as getSvgPositionRelativeToSvgRoot,_h as getSvgTranslatePosition,iA as getTargetEdges,oy as getTouch,O$ as getUpstreamVertices,Gs as getsert,Nr as gradient,Yu as gradientAtPoint,ZK as gradientAtPointAlongPathFrom,dR as gridBackgroundOptions,gn as hasClass,js as inferAxis,GE as inferAxisAndDirectionFromOrientation,kA as inferAxisFromSourceAndTargetLocation,HA as inferDirection,MR as initializeBezierConnectorEditors,OR as initializeOrthogonalConnectorEditors,wR as initializeStraightConnectorEditors,jo as insertRTreeChild,yE as insertSorted,jb as intersectionOfProjectedLines,We as isAncestor,Sme as isArrayLike,WC as isArrayOrNodeList,Zb as isAssignableFrom,AQe as isBarPlot,Po as isBoolean,NL as isCategoryAxis,v0 as isClass,Ea as isConnection,Vq as isConnector,pn as isCustomOverlay,oo as isDOMElement,T0 as isDate,sA as isDescendantGroup,rt as isEdge,v$ as isEdgeConnectedTo,dt as isEdgeNodeEntry,Uf as isEdgeSupported,KC as isElement,Sl as isEmpty,WS as isFilterableDataset,Yv as isFullOverlaySpec,nn as isFunction,Y as isGroup,cP as isHTMLLabelOverlay,Wr as isLabelOverlay,oT as isLoopPresent,Ei as isMouseDevice,p$ as isNamedFunction,SE as isNestedGroup,K as isNode,AE as isNodeInsideAGroup,Bn as isNodeList,oA as isNodeVertex,Hc as isNumber,cr as isObject,YT as isPoint,H as isPort,wt as isSVGElement,pl as isStackedPlot,j as isString,Tme as isTextNode,Gn as isTouchDevice,An as isValueAxis,Ni as isVertex,TT as lightweightPrintfFormatter,ih as lineCalculators,xl as lineIntersection,Yb as lineIntersectsOrIsEnclosedByRectangle,Pe as lineLength,hr as lineRectangleIntersection,y0 as linesIntersection,gE as linesOverlap,kT as locationAlongCurveFrom,U as log,A0 as logEnabled,Ap as makeLightweightAnchorFromArraySpec,St as makeLightweightAnchorFromSpec,jc as manhattanDistance,kG as manhattanLineLength,$t as matchesSelector,Sn as merge,Q1 as mergeDomainExtents,mp as mergeWithParents,DT as minBy,Jv as namedContinuousValues,XT as nearestPointOnCurve,yn as newInstance,Ar as newRecadoInstance,Xh as newTemplates2Renderer,Ub as normal,Tl as objectsEqual,e$ as octileDistance,io as offsetRelativeToRoot,K0 as orthogonalAdjacencies,jA as orthogonalAdjacentCellsFinder,CT as orthogonalRouter,Ee as pageLocation,uP as paintSVGLabelOverlay,dP as paintSimpleShapeOverlay,jP as paintSvgConnector,KG as parallelLineFromPoint,Mb as parallelLineTo,Hb as parallelLinesTo,Ir as parentAxis,WA as parentDirection,gA as parse,JE as parseAttributes,sT as parseAtts,Ow as parseExpression,Al as partition,iT as peek,ZG as perpendicularBisectingLine,Dt as perpendicularLineTo,JK as perpendicularToPathAt,HT as pointAlongCurveFrom,Uu as pointAlongPath,ha as pointOnCurve,kt as pointOnLine,eA as pointsEqual,Oo as populate,Iu as populateRegions,vme as prefersDarkMode,Wl as processExpression,Is as quadrant,Y6e as ready,$s as recordGetsert,tt as rectanglesIntersect,Tje as registerDecorator,fO as registerEdgeTypePickerTag,lB as registerExporter,pA as registerParser,He as registerPlugin,v_ as relocateContinuousAnchor,C_ as relocateDynamicAnchor,P_ as relocateWithPositionFinder,mE as remove,F as removeClass,_r as removeConnectionClass,hf as removeRTreeChild,Sh as removeWheelListener,Nt as removeWithFunction,Eg as renderIcon,fg as renderNamedIcon,xV as renderPaper,yV as renderSurface,bE as replace,rf as resolveIfExecution,ti as resolveNode,_l as resolveNodeId,Me as rotatePoint,kb as rotatedRectanglesIntersect,vT as routerLineIntersects,of as routerLineSgn,fv as segmentLineAngle,ca as segmentedConnectorSegmentLength,tr as setAbsolutePosition,AP as setElementHeight,xi as setElementRotation,Rr as setElementSize,bP as setElementWidth,gN as setForceMouseEvents,pN as setForceTouchEvents,Gf as setOverlayLocation,Ie as setPosition,SP as setRotatedSvgElementPosition,mn as setSvgTranslatePosition,jt as setTranslatedPosition,_Ze as setTranslatedX,_c as setTranslatedY,yP as setXPosition,xP as setYPosition,_o as shortUuid,he as snapToGrid,JG as snapToGridUpperBound,Nu as sortAndPlaceEdges,wg as sourceElementSelector,lv as sourceVertexAvoidance,lf as splitIntoSiblings,nh as stubCalculators,Av as stubRelocator,Fb as subtract,EE as suggest,oP as supportsPathEditing,oO as svgElementToDataUrl,PI as targetElementSelector,hv as targetVertexAvoidance,Ng as testIntersectingDropTarget,yl as theta,cy as toggleClass,FC as touchCount,is as touches,la as transformAnchorPlacement,ju as transformBezierGeometry,rp as transformSegmentedGeometry,xE as translateRect,Xb as unionOfRectangles,zu as updateBezierConnector,Xt as updateClasses,bv as updateEditedOrthogonalConnector,ep as updateStraightConnector,$ as uuid,eh as valueInRange,cv as vertexAvoidance,Zd as wrap,kC as xml};