diff --git a/Scripts/JavaScript/apexsankey.js b/Scripts/JavaScript/apexsankey.js new file mode 100644 index 0000000..a7430f6 --- /dev/null +++ b/Scripts/JavaScript/apexsankey.js @@ -0,0 +1,9 @@ +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).ApexSankey=n()}(this,(function(){"use strict";const t={},n=[];function e(n,r){if(Array.isArray(n))for(const t of n)e(t,r);else if("object"!=typeof n)i(Object.getOwnPropertyNames(r)),t[n]=Object.assign(t[n]||{},r);else for(const t in n)e(t,n[t])}function r(n){return t[n]||{}}function i(t){n.push(...t)}function o(t,n){let e;const r=t.length,i=[];for(e=0;eh.has(t.nodeName),l=(t,n,e={})=>{const r={...n};for(const i in r)r[i].valueOf()===e[i]&&delete r[i];Object.keys(r).length?t.node.setAttribute("data-svgjs",JSON.stringify(r)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))},d="http://www.w3.org/2000/svg",p="http://www.w3.org/2000/xmlns/",v="http://www.w3.org/1999/xlink",g={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};class y{}const _={},m="___SYMBOL___ROOT___";function w(t,n=d){return g.document.createElementNS(n,t)}function b(t,n=!1){if(t instanceof y)return t;if("object"==typeof t)return j(t);if(null==t)return new _[m];if("string"==typeof t&&"<"!==t.charAt(0))return j(g.document.querySelector(t));const e=n?g.document.createElement("div"):w("svg");return e.innerHTML=t,t=j(e.firstChild),e.removeChild(e.firstChild),t}function x(t,n){return n&&(n instanceof g.window.Node||n.ownerDocument&&n instanceof n.ownerDocument.defaultView.Node)?n:w(t)}function E(t){if(!t)return null;if(t.instance instanceof y)return t.instance;if("#document-fragment"===t.nodeName)return new _.Fragment(t);let n=s(t.nodeName||"Dom");return"LinearGradient"===n||"RadialGradient"===n?n="Gradient":_[n]||(n="Dom"),new _[n](t)}let j=E;function A(t,n=t.name,e=!1){return _[n]=t,e&&(_[m]=t),i(Object.getOwnPropertyNames(t.prototype)),t}let O=1e3;function M(t){return"Svgjs"+s(t)+O++}function S(t){for(let n=t.children.length-1;n>=0;n--)S(t.children[n]);return t.id?(t.id=M(t.nodeName),t):t}function k(t,n){let e,r;for(r=(t=Array.isArray(t)?t:[t]).length-1;r>=0;r--)for(e in n)t[r].prototype[e]=n[e]}function C(t){return function(...n){const e=n[n.length-1];return!e||e.constructor!==Object||e instanceof Array?t.apply(this,n):t.apply(this,n.slice(0,-1)).attr(e)}}e("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=b(t)).remove();const n=this.position();return this.parent().add(t,n),this},after:function(t){(t=b(t)).remove();const n=this.position();return this.parent().add(t,n+1),this},insertBefore:function(t){return(t=b(t)).before(this),this},insertAfter:function(t){return(t=b(t)).after(this),this}});const T=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,I=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,N=/rgb\((\d+),(\d+),(\d+)\)/,R=/(#[a-z_][a-z0-9\-_]*)/i,z=/\)\s*,?\s*/,P=/\s/g,D=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,L=/^rgb\(/,F=/^(\s+)?$/,B=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,$=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,V=/[\s,]+/,X=/[MLHVCSQTAZ]/i;function Y(t){const n=Math.round(t),e=Math.max(0,Math.min(255,n)).toString(16);return 1===e.length?"0"+e:e}function U(t,n){for(let e=n.length;e--;)if(null==t[n[e]])return!1;return!0}function q(t,n,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(n-t)*e:e<.5?n:e<2/3?t+(n-t)*(2/3-e)*6:t}e("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(V)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const n=this.classes();n.push(t),this.attr("class",n.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(n){return n!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),e("Dom",{css:function(t,n){const e={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){const n=t.split(/\s*:\s*/);e[n[0]]=n[1]})),e;if(arguments.length<2){if(Array.isArray(t)){for(const n of t){const t=n;e[n]=this.node.style.getPropertyValue(t)}return e}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"==typeof t)for(const n in t)this.node.style.setProperty(n,null==t[n]||F.test(t[n])?"":t[n])}return 2===arguments.length&&this.node.style.setProperty(t,null==n||F.test(n)?"":n),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),e("Dom",{data:function(t,n,e){if(null==t)return this.data(o(function(t,n){let e;const r=t.length,i=[];for(e=0;e0===t.nodeName.indexOf("data-"))),(t=>t.nodeName.slice(5))));if(t instanceof Array){const n={};for(const e of t)n[e]=this.data(e);return n}if("object"==typeof t)for(n in t)this.data(n,t[n]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(r){return this.attr("data-"+t)}else this.attr("data-"+t,null===n?null:!0===e||"string"==typeof n||"number"==typeof n?n:JSON.stringify(n));return this}}),e("Dom",{remember:function(t,n){if("object"==typeof arguments[0])for(const e in t)this.remember(e,t[e]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=n}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});class W{constructor(...t){this.init(...t)}static isColor(t){return t&&(t instanceof W||this.isRgb(t)||this.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(t="vibrant",n){const{random:e,round:r,sin:i,PI:o}=Math;if("vibrant"===t){const t=24*e()+57,n=38*e()+45,r=360*e();return new W(t,n,r,"lch")}if("sine"===t){const t=r(80*i(2*o*(n=null==n?e():n)/.5+.01)+150),u=r(50*i(2*o*n/.5+4.6)+200),s=r(100*i(2*o*n/.5+2.3)+150);return new W(t,u,s)}if("pastel"===t){const t=8*e()+86,n=17*e()+9,r=360*e();return new W(t,n,r,"lch")}if("dark"===t){const t=10+10*e(),n=50*e()+86,r=360*e();return new W(t,n,r,"lch")}if("rgb"===t){const t=255*e(),n=255*e(),r=255*e();return new W(t,n,r)}if("lab"===t){const t=100*e(),n=256*e()-128,r=256*e()-128;return new W(t,n,r,"lab")}if("grey"===t){const t=255*e();return new W(t,t,t)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(D.test(t)||L.test(t))}cmyk(){const{_a:t,_b:n,_c:e}=this.rgb(),[r,i,o]=[t,n,e].map((t=>t/255)),u=Math.min(1-r,1-i,1-o);if(1===u)return new W(0,0,0,1,"cmyk");return new W((1-r-u)/(1-u),(1-i-u)/(1-u),(1-o-u)/(1-u),u,"cmyk")}hsl(){const{_a:t,_b:n,_c:e}=this.rgb(),[r,i,o]=[t,n,e].map((t=>t/255)),u=Math.max(r,i,o),s=Math.min(r,i,o),a=(u+s)/2,c=u===s,h=u-s;return new W(360*(c?0:u===r?((i-o)/h+(i.5?h/(2-u-s):h/(u+s)),100*a,"hsl")}init(t=0,n=0,e=0,r=0,i="rgb"){if(t=t||0,this.space)for(const f in this.space)delete this[this.space[f]];if("number"==typeof t)i="string"==typeof r?r:i,r="string"==typeof r?0:r,Object.assign(this,{_a:t,_b:n,_c:e,_d:r,space:i});else if(t instanceof Array)this.space=n||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const e=function(t,n){const e=U(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:U(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:U(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:U(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:U(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:U(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return e.space=n||e.space,e}(t,n);Object.assign(this,e)}else if("string"==typeof t)if(L.test(t)){const n=t.replace(P,""),[e,r,i]=N.exec(n).slice(1,4).map((t=>parseInt(t)));Object.assign(this,{_a:e,_b:r,_c:i,_d:0,space:"rgb"})}else{if(!D.test(t))throw Error("Unsupported string format, can't construct Color");{const n=t=>parseInt(t,16),[,e,r,i]=I.exec((o=t,4===o.length?["#",o.substring(1,2),o.substring(1,2),o.substring(2,3),o.substring(2,3),o.substring(3,4),o.substring(3,4)].join(""):o)).map(n);Object.assign(this,{_a:e,_b:r,_c:i,_d:0,space:"rgb"})}}var o;const{_a:u,_b:s,_c:a,_d:c}=this,h="rgb"===this.space?{r:u,g:s,b:a}:"xyz"===this.space?{x:u,y:s,z:a}:"hsl"===this.space?{h:u,s:s,l:a}:"lab"===this.space?{l:u,a:s,b:a}:"lch"===this.space?{l:u,c:s,h:a}:"cmyk"===this.space?{c:u,m:s,y:a,k:c}:{};Object.assign(this,h)}lab(){const{x:t,y:n,z:e}=this.xyz();return new W(116*n-16,500*(t-n),200*(n-e),"lab")}lch(){const{l:t,a:n,b:e}=this.lab(),r=Math.sqrt(n**2+e**2);let i=180*Math.atan2(e,n)/Math.PI;i<0&&(i*=-1,i=360-i);return new W(t,r,i,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:n,z:e}=this;if("lab"===this.space||"lch"===this.space){let{l:r,a:i,b:o}=this;if("lch"===this.space){const{c:t,h:n}=this,e=Math.PI/180;i=t*Math.cos(e*n),o=t*Math.sin(e*n)}const u=(r+16)/116,s=i/500+u,a=u-o/200,c=16/116,h=.008856,f=7.787;t=.95047*(s**3>h?s**3:(s-c)/f),n=1*(u**3>h?u**3:(u-c)/f),e=1.08883*(a**3>h?a**3:(a-c)/f)}const r=3.2406*t+-1.5372*n+-.4986*e,i=-.9689*t+1.8758*n+.0415*e,o=.0557*t+-.204*n+1.057*e,u=Math.pow,s=.0031308,a=r>s?1.055*u(r,1/2.4)-.055:12.92*r,c=i>s?1.055*u(i,1/2.4)-.055:12.92*i,h=o>s?1.055*u(o,1/2.4)-.055:12.92*o;return new W(255*a,255*c,255*h)}if("hsl"===this.space){let{h:t,s:n,l:e}=this;if(t/=360,n/=100,e/=100,0===n){e*=255;return new W(e,e,e)}const r=e<.5?e*(1+n):e+n-e*n,i=2*e-r,o=255*q(i,r,t+1/3),u=255*q(i,r,t),s=255*q(i,r,t-1/3);return new W(o,u,s)}if("cmyk"===this.space){const{c:t,m:n,y:e,k:r}=this,i=255*(1-Math.min(1,t*(1-r)+r)),o=255*(1-Math.min(1,n*(1-r)+r)),u=255*(1-Math.min(1,e*(1-r)+r));return new W(i,o,u)}return this;var t}toArray(){const{_a:t,_b:n,_c:e,_d:r,space:i}=this;return[t,n,e,r,i]}toHex(){const[t,n,e]=this._clamped().map(Y);return`#${t}${n}${e}`}toRgb(){const[t,n,e]=this._clamped();return`rgb(${t},${n},${e})`}toString(){return this.toHex()}xyz(){const{_a:t,_b:n,_c:e}=this.rgb(),[r,i,o]=[t,n,e].map((t=>t/255)),u=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,s=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,a=o>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92,c=(.4124*u+.3576*s+.1805*a)/.95047,h=(.2126*u+.7152*s+.0722*a)/1,f=(.0193*u+.1192*s+.9505*a)/1.08883,l=c>.008856?Math.pow(c,1/3):7.787*c+16/116,d=h>.008856?Math.pow(h,1/3):7.787*h+16/116,p=f>.008856?Math.pow(f,1/3):7.787*f+16/116;return new W(l,d,p,"xyz")}_clamped(){const{_a:t,_b:n,_c:e}=this.rgb(),{max:r,min:i,round:o}=Math;return[t,n,e].map((t=>r(0,i(o(t),255))))}}class G{constructor(...t){this.init(...t)}clone(){return new G(this)}init(t,n){const e=0,r=0,i=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:n};return this.x=null==i.x?e:i.x,this.y=null==i.y?r:i.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){H.isMatrixLike(t)||(t=new H(t));const{x:n,y:e}=this;return this.x=t.a*n+t.c*e+t.e,this.y=t.b*n+t.d*e+t.f,this}}function Z(t,n,e){return Math.abs(n-t)<1e-6}class H{constructor(...t){this.init(...t)}static formatTransforms(t){const n="both"===t.flip||!0===t.flip,e=t.flip&&(n||"x"===t.flip)?-1:1,r=t.flip&&(n||"y"===t.flip)?-1:1,i=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,o=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,u=t.scale&&t.scale.length?t.scale[0]*e:isFinite(t.scale)?t.scale*e:isFinite(t.scaleX)?t.scaleX*e:e,s=t.scale&&t.scale.length?t.scale[1]*r:isFinite(t.scale)?t.scale*r:isFinite(t.scaleY)?t.scaleY*r:r,a=t.shear||0,c=t.rotate||t.theta||0,h=new G(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),f=h.x,l=h.y,d=new G(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),p=d.x,v=d.y,g=new G(t.translate||t.tx||t.translateX,t.ty||t.translateY),y=g.x,_=g.y,m=new G(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:u,scaleY:s,skewX:i,skewY:o,shear:a,theta:c,rx:m.x,ry:m.y,tx:y,ty:_,ox:f,oy:l,px:p,py:v}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static matrixMultiply(t,n,e){const r=t.a*n.a+t.c*n.b,i=t.b*n.a+t.d*n.b,o=t.a*n.c+t.c*n.d,u=t.b*n.c+t.d*n.d,s=t.e+t.a*n.e+t.c*n.f,a=t.f+t.b*n.e+t.d*n.f;return e.a=r,e.b=i,e.c=o,e.d=u,e.e=s,e.f=a,e}around(t,n,e){return this.clone().aroundO(t,n,e)}aroundO(t,n,e){const r=t||0,i=n||0;return this.translateO(-r,-i).lmultiplyO(e).translateO(r,i)}clone(){return new H(this)}decompose(t=0,n=0){const e=this.a,r=this.b,i=this.c,o=this.d,u=this.e,s=this.f,a=e*o-r*i,c=a>0?1:-1,h=c*Math.sqrt(e*e+r*r),f=Math.atan2(c*r,c*e),l=180/Math.PI*f,d=Math.cos(f),p=Math.sin(f),v=(e*i+r*o)/a,g=i*h/(v*e-r)||o*h/(v*r+e);return{scaleX:h,scaleY:g,shear:v,rotate:l,translateX:u-t+t*d*h+n*(v*d*h-p*g),translateY:s-n+t*p*h+n*(v*p*h+d*g),originX:t,originY:n,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return!0;const n=new H(t);return Z(this.a,n.a)&&Z(this.b,n.b)&&Z(this.c,n.c)&&Z(this.d,n.d)&&Z(this.e,n.e)&&Z(this.f,n.f)}flip(t,n){return this.clone().flipO(t,n)}flipO(t,n){return"x"===t?this.scaleO(-1,1,n,0):"y"===t?this.scaleO(1,-1,0,n):this.scaleO(-1,-1,t,n||t)}init(t){const n=H.fromArray([1,0,0,1,0,0]);return t=t instanceof bt?t.matrixify():"string"==typeof t?H.fromArray(t.split(V).map(parseFloat)):Array.isArray(t)?H.fromArray(t):"object"==typeof t&&H.isMatrixLike(t)?t:"object"==typeof t?(new H).transform(t):6===arguments.length?H.fromArray([].slice.call(arguments)):n,this.a=null!=t.a?t.a:n.a,this.b=null!=t.b?t.b:n.b,this.c=null!=t.c?t.c:n.c,this.d=null!=t.d?t.d:n.d,this.e=null!=t.e?t.e:n.e,this.f=null!=t.f?t.f:n.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,n=this.b,e=this.c,r=this.d,i=this.e,o=this.f,u=t*r-n*e;if(!u)throw new Error("Cannot invert "+this);const s=r/u,a=-n/u,c=-e/u,h=t/u,f=-(s*i+c*o),l=-(a*i+h*o);return this.a=s,this.b=a,this.c=c,this.d=h,this.e=f,this.f=l,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){const n=t instanceof H?t:new H(t);return H.matrixMultiply(n,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){const n=t instanceof H?t:new H(t);return H.matrixMultiply(this,n,this)}rotate(t,n,e){return this.clone().rotateO(t,n,e)}rotateO(t,n=0,e=0){t=u(t);const r=Math.cos(t),i=Math.sin(t),{a:o,b:s,c:a,d:c,e:h,f:f}=this;return this.a=o*r-s*i,this.b=s*r+o*i,this.c=a*r-c*i,this.d=c*r+a*i,this.e=h*r-f*i+e*i-n*r+n,this.f=f*r+h*i-n*i-e*r+e,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,n=t,e=0,r=0){3===arguments.length&&(r=e,e=n,n=t);const{a:i,b:o,c:u,d:s,e:a,f:c}=this;return this.a=i*t,this.b=o*n,this.c=u*t,this.d=s*n,this.e=a*t-e*t+e,this.f=c*n-r*n+r,this}shear(t,n,e){return this.clone().shearO(t,n,e)}shearO(t,n=0,e=0){const{a:r,b:i,c:o,d:u,e:s,f:a}=this;return this.a=r+i*t,this.c=o+u*t,this.e=s+a*t-e*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,n=t,e=0,r=0){3===arguments.length&&(r=e,e=n,n=t),t=u(t),n=u(n);const i=Math.tan(t),o=Math.tan(n),{a:s,b:a,c:c,d:h,e:f,f:l}=this;return this.a=s+a*i,this.b=a+s*o,this.c=c+h*i,this.d=h+c*o,this.e=f+l*i-r*i,this.f=l+f*o-e*o,this}skewX(t,n,e){return this.skew(t,0,n,e)}skewY(t,n,e){return this.skew(0,t,n,e)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(t){if(H.isMatrixLike(t)){return new H(t).multiplyO(this)}const n=H.formatTransforms(t),{x:e,y:r}=new G(n.ox,n.oy).transform(this),i=(new H).translateO(n.rx,n.ry).lmultiplyO(this).translateO(-e,-r).scaleO(n.scaleX,n.scaleY).skewO(n.skewX,n.skewY).shearO(n.shear).rotateO(n.theta).translateO(e,r);if(isFinite(n.px)||isFinite(n.py)){const t=new G(e,r).transform(i),o=isFinite(n.px)?n.px-t.x:0,u=isFinite(n.py)?n.py-t.y:0;i.translateO(o,u)}return i.translateO(n.tx,n.ty),i}translate(t,n){return this.clone().translateO(t,n)}translateO(t,n){return this.e+=t||0,this.f+=n||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}function Q(){if(!Q.nodes){const t=b().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");const n=t.path().node;Q.nodes={svg:t,path:n}}if(!Q.nodes.svg.node.parentNode){const t=g.document.body||g.document.documentElement;Q.nodes.svg.addTo(t)}return Q.nodes}function J(t){return!(t.width||t.height||t.x||t.y)}A(H,"Matrix");class K{constructor(...t){this.init(...t)}addOffset(){return this.x+=g.window.pageXOffset,this.y+=g.window.pageYOffset,new K(this)}init(t){return t="string"==typeof t?t.split(V).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return J(this)}merge(t){const n=Math.min(this.x,t.x),e=Math.min(this.y,t.y),r=Math.max(this.x+this.width,t.x+t.width)-n,i=Math.max(this.y+this.height,t.y+t.height)-e;return new K(n,e,r,i)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(t){t instanceof H||(t=new H(t));let n=1/0,e=-1/0,r=1/0,i=-1/0;return[new G(this.x,this.y),new G(this.x2,this.y),new G(this.x,this.y2),new G(this.x2,this.y2)].forEach((function(o){o=o.transform(t),n=Math.min(n,o.x),e=Math.max(e,o.x),r=Math.min(r,o.y),i=Math.max(i,o.y)})),new K(n,r,e-n,i-r)}}function tt(t,n,e){let r;try{if(r=n(t.node),J(r)&&((i=t.node)!==g.document&&!(g.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===g.document}).call(g.document.documentElement,i)))throw new Error("Element not in the dom")}catch(o){r=e(t)}var i;return r}e({viewbox:{viewbox(t,n,e,r){return null==t?new K(this.attr("viewBox")):this.attr("viewBox",new K(t,n,e,r))},zoom(t,n){let{width:e,height:r}=this.attr(["width","height"]);if((e||r)&&"string"!=typeof e&&"string"!=typeof r||(e=this.node.clientWidth,r=this.node.clientHeight),!e||!r)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const i=this.viewbox(),o=e/i.width,u=r/i.height,s=Math.min(o,u);if(null==t)return s;let a=s/t;a===1/0&&(a=Number.MAX_SAFE_INTEGER/100),n=n||new G(e/2/o+i.x,r/2/u+i.y);const c=new K(i).transform(new H({scale:a,origin:n}));return this.viewbox(c)}}}),A(K,"Box");class nt extends Array{constructor(t=[],...n){if(super(t,...n),"number"==typeof t)return this;this.length=0,this.push(...t)}}k([nt],{each(t,...n){return"function"==typeof t?this.map(((n,e,r)=>t.call(n,n,e,r))):this.map((e=>e[t](...n)))},toArray(){return Array.prototype.concat.apply([],this)}});const et=["toArray","constructor","each"];function rt(t,n){return new nt(o((n||g.document).querySelectorAll(t),(function(t){return E(t)})))}nt.extend=function(t){t=t.reduce(((t,n)=>(et.includes(n)||"_"===n[0]||(n in Array.prototype&&(t["$"+n]=Array.prototype[n]),t[n]=function(...t){return this.each(n,...t)}),t)),{}),k([nt],t)};let it=0;const ot={};function ut(t){let n=t.getEventHolder();return n===g.window&&(n=ot),n.events||(n.events={}),n.events}function st(t){return t.getEventTarget()}function at(t,n,e,r,i){const o=e.bind(r||t),u=b(t),s=ut(u),a=st(u);n=Array.isArray(n)?n:n.split(V),e._svgjsListenerId||(e._svgjsListenerId=++it),n.forEach((function(t){const n=t.split(".")[0],r=t.split(".")[1]||"*";s[n]=s[n]||{},s[n][r]=s[n][r]||{},s[n][r][e._svgjsListenerId]=o,a.addEventListener(n,o,i||!1)}))}function ct(t,n,e,r){const i=b(t),o=ut(i),u=st(i);("function"!=typeof e||(e=e._svgjsListenerId))&&(n=Array.isArray(n)?n:(n||"").split(V)).forEach((function(t){const n=t&&t.split(".")[0],s=t&&t.split(".")[1];let a,c;if(e)o[n]&&o[n][s||"*"]&&(u.removeEventListener(n,o[n][s||"*"][e],r||!1),delete o[n][s||"*"][e]);else if(n&&s){if(o[n]&&o[n][s]){for(c in o[n][s])ct(u,[n,s].join("."),c);delete o[n][s]}}else if(s)for(t in o)for(a in o[t])s===a&&ct(u,[t,s].join("."));else if(n){if(o[n]){for(a in o[n])ct(u,[n,a].join("."));delete o[n]}}else{for(t in o)ct(u,t);!function(t){let n=t.getEventHolder();n===g.window&&(n=ot),n.events&&(n.events={})}(i)}}))}class ht extends y{addEventListener(){}dispatch(t,n,e){return function(t,n,e,r){const i=st(t);return n instanceof g.window.Event||(n=new g.window.CustomEvent(n,{detail:e,cancelable:!0,...r})),i.dispatchEvent(n),n}(this,t,n,e)}dispatchEvent(t){const n=this.getEventHolder().events;if(!n)return!0;const e=n[t.type];for(const r in e)for(const n in e[r])e[r][n](t);return!t.defaultPrevented}fire(t,n,e){return this.dispatch(t,n,e),this}getEventHolder(){return this}getEventTarget(){return this}off(t,n,e){return ct(this,t,n,e),this}on(t,n,e,r){return at(this,t,n,e,r),this}removeEventListener(){}}function ft(){}A(ht,"EventTarget");const lt=400,dt=">",pt=0,vt={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"};class gt extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(V).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}}class yt{constructor(...t){this.init(...t)}convert(t){return new yt(this.value,t)}divide(t){return t=new yt(t),new yt(this/t,this.unit||t.unit)}init(t,n){return n=Array.isArray(t)?t[1]:n,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=n||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(n=t.match(T))&&(this.value=parseFloat(n[1]),"%"===n[5]?this.value/=100:"s"===n[5]&&(this.value*=1e3),this.unit=n[5]):t instanceof yt&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new yt(t),new yt(this-t,this.unit||t.unit)}plus(t){return t=new yt(t),new yt(this+t,this.unit||t.unit)}times(t){return t=new yt(t),new yt(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}}const _t=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),mt=[];class wt extends ht{constructor(t,n){super(),this.node=t,this.type=t.nodeName,n&&t!==n&&this.attr(n)}add(t,n){return(t=b(t)).removeNamespace&&this.node instanceof g.window.SVGElement&&t.removeNamespace(),null==n?this.node.appendChild(t.node):t.node!==this.node.childNodes[n]&&this.node.insertBefore(t.node,this.node.childNodes[n]),this}addTo(t,n){return b(t).put(this,n)}children(){return new nt(o(this.node.children,(function(t){return E(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=!0,n=!0){this.writeDataToDom();let e=this.node.cloneNode(t);return n&&(e=S(e)),new this.constructor(e)}each(t,n){const e=this.children();let r,i;for(r=0,i=e.length;r=0}html(t,n){return this.xml(t,n,"http://www.w3.org/1999/xhtml")}id(t){return void 0!==t||this.node.id||(this.node.id=M(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return E(this.node.lastChild)}matches(t){const n=this.node,e=n.matches||n.matchesSelector||n.msMatchesSelector||n.mozMatchesSelector||n.webkitMatchesSelector||n.oMatchesSelector||null;return e&&e.call(n,t)}parent(t){let n=this;if(!n.node.parentNode)return null;if(n=E(n.node.parentNode),!t)return n;do{if("string"==typeof t?n.matches(t):n instanceof t)return n}while(n=E(n.node.parentNode));return n}put(t,n){return t=b(t),this.add(t,n),t}putIn(t,n){return b(t).add(this,n)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=b(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,n=null){const e=10**t,r=this.attr(n);for(const i in r)"number"==typeof r[i]&&(r[i]=Math.round(r[i]*e)/e);return this.attr(r),this}svg(t,n){return this.xml(t,n,d)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const n=this.parent();if(!n)return this.addTo(t);const e=n.index(this);return n.put(t,e).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(t,n,e){if("boolean"==typeof t&&(e=n,n=t,t=null),null==t||"function"==typeof t){n=null==n||n,this.writeDataToDom();let e=this;if(null!=t){if(e=E(e.node.cloneNode(!0)),n){const n=t(e);if(e=n||e,!1===n)return""}e.each((function(){const n=t(this),e=n||this;!1===n?this.remove():n&&this!==e&&this.replace(e)}),!0)}return n?e.node.outerHTML:e.node.innerHTML}n=null!=n&&n;const r=w("wrapper",e),i=g.document.createDocumentFragment();r.innerHTML=t;for(let u=r.children.length;u--;)i.appendChild(r.firstElementChild);const o=this.parent();return n?this.replace(i)&&o:this.add(i)}}k(wt,{attr:function(t,n,e){if(null==t){t={},n=this.node.attributes;for(const e of n)t[e.nodeName]=B.test(e.nodeValue)?parseFloat(e.nodeValue):e.nodeValue;return t}if(t instanceof Array)return t.reduce(((t,n)=>(t[n]=this.attr(n),t)),{});if("object"==typeof t&&t.constructor===Object)for(n in t)this.attr(n,t[n]);else if(null===n)this.node.removeAttribute(t);else{if(null==n)return null==(n=this.node.getAttribute(t))?vt[t]:B.test(n)?parseFloat(n):n;"number"==typeof(n=mt.reduce(((n,e)=>e(t,n,this)),n))?n=new yt(n):_t.has(t)&&W.isColor(n)?n=new W(n):n.constructor===Array&&(n=new gt(n)),"leading"===t?this.leading&&this.leading(n):"string"==typeof e?this.node.setAttributeNS(e,t,n.toString()):this.node.setAttribute(t,n.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return rt(t,this.node)},findOne:function(t){return E(this.node.querySelector(t))}}),A(wt,"Dom");class bt extends wt{constructor(t,n){super(t,n),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,n){return this.cx(t).cy(n)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){const t=this.root();return t&&t.defs()}dmove(t,n){return this.dx(t).dy(n)}dx(t=0){return this.x(new yt(t).plus(this.x()))}dy(t=0){return this.y(new yt(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,n){return this.x(t).y(n)}parents(t=this.root()){const n="string"==typeof t;n||(t=b(t));const e=new nt;let r=this;for(;(r=r.parent())&&r.node!==g.document&&"#document-fragment"!==r.nodeName&&(e.push(r),n||r.node!==t.node)&&(!n||!r.matches(t));)if(r.node===this.root().node)return null;return e}reference(t){if(!(t=this.attr(t)))return null;const n=(t+"").match(R);return n?b(n[1]):null}root(){const t=this.parent(_[m]);return t&&t.root()}setData(t){return this.dom=t,this}size(t,n){const e=a(this,t,n);return this.width(new yt(e.width)).height(new yt(e.height))}width(t){return this.attr("width",t)}writeDataToDom(){return l(this,this.dom),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}}k(bt,{bbox:function(){const t=tt(this,(t=>t.getBBox()),(t=>{try{const n=t.clone().addTo(Q().svg).show(),e=n.node.getBBox();return n.remove(),e}catch(n){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${n.toString()}`)}}));return new K(t)},rbox:function(t){const n=tt(this,(t=>t.getBoundingClientRect()),(t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)})),e=new K(n);return t?e.transform(t.screenCTM().inverseO()):e.addOffset()},inside:function(t,n){const e=this.bbox();return t>e.x&&n>e.y&&t=0;r--)null!=n[xt[t][r]]&&this.attr(xt.prefix(t,xt[t][r]),n[xt[t][r]]);return this},e(["Element","Runner"],n)})),e(["Element","Runner"],{matrix:function(t,n,e,r,i,o){return null==t?new H(this):this.attr("transform",new H(t,n,e,r,i,o))},rotate:function(t,n,e){return this.transform({rotate:t,ox:n,oy:e},!0)},skew:function(t,n,e,r){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:n,oy:e},!0):this.transform({skew:[t,n],ox:e,oy:r},!0)},shear:function(t,n,e){return this.transform({shear:t,ox:n,oy:e},!0)},scale:function(t,n,e,r){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:n,oy:e},!0):this.transform({scale:[t,n],ox:e,oy:r},!0)},translate:function(t,n){return this.transform({translate:[t,n]},!0)},relative:function(t,n){return this.transform({relative:[t,n]},!0)},flip:function(t="both",n="center"){return-1==="xybothtrue".indexOf(t)&&(n=t,t="both"),this.transform({flip:t,origin:n},!0)},opacity:function(t){return this.attr("opacity",t)}}),e("radius",{radius:function(t,n=t){return"radialGradient"===(this._element||this).type?this.attr("r",new yt(t)):this.rx(t).ry(n)}}),e("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new G(this.node.getPointAtLength(t))}}),e(["Element","Runner"],{font:function(t,n){if("object"==typeof t){for(n in t)this.font(n,t[n]);return this}return"leading"===t?this.leading(n):"anchor"===t?this.attr("text-anchor",n):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,n):this.attr(t,n)}});e("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,n){return t[n]=function(t){return null===t?this.off(n):this.on(n,t),this},t}),{})),e("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(z).slice(0,-1).map((function(t){const n=t.trim().split("(");return[n[0],n[1].split(V).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,n){return"matrix"===n[0]?t.lmultiply(H.fromArray(n[1])):t[n[0]].apply(t,n[1])}),new H)},toParent:function(t,n){if(this===t)return this;if(f(this.node))return this.addTo(t,n);const e=this.screenCTM(),r=t.screenCTM().inverse();return this.addTo(t,n).untransform().transform(r.multiply(e)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,n){if(null==t||"string"==typeof t){const n=new H(this).decompose();return null==t?n:n[t]}H.isMatrixLike(t)||(t={...t,origin:c(t,this)});const e=new H(!0===n?this:n||!1).transform(t);return this.attr("transform",e)}});class Et extends bt{flatten(){return this.each((function(){if(this instanceof Et)return this.flatten().ungroup()})),this}ungroup(t=this.parent(),n=t.index(this)){return n=-1===n?t.children().length:n,this.each((function(e,r){return r[r.length-e-1].toParent(t,n)})),this.remove()}}A(Et,"Container");class jt extends Et{constructor(t,n=t){super(x("defs",t),n)}flatten(){return this}ungroup(){return this}}A(jt,"Defs");class At extends bt{}function Ot(t){return this.attr("rx",t)}function Mt(t){return this.attr("ry",t)}function St(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function kt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Ct(t){return this.attr("cx",t)}function Tt(t){return this.attr("cy",t)}function It(t){return null==t?2*this.rx():this.rx(new yt(t).divide(2))}function Nt(t){return null==t?2*this.ry():this.ry(new yt(t).divide(2))}A(At,"Shape");const Rt=Object.freeze(Object.defineProperty({__proto__:null,cx:Ct,cy:Tt,height:Nt,rx:Ot,ry:Mt,width:It,x:St,y:kt},Symbol.toStringTag,{value:"Module"}));class zt extends At{constructor(t,n=t){super(x("ellipse",t),n)}size(t,n){const e=a(this,t,n);return this.rx(new yt(e.width).divide(2)).ry(new yt(e.height).divide(2))}}k(zt,Rt),e("Container",{ellipse:C((function(t=0,n=t){return this.put(new zt).size(t,n).move(0,0)}))}),A(zt,"Ellipse");class Pt extends wt{constructor(t=g.document.createDocumentFragment()){super(t)}xml(t,n,e){if("boolean"==typeof t&&(e=n,n=t,t=null),null==t||"function"==typeof t){const t=new wt(w("wrapper",e));return t.add(this.node.cloneNode(!0)),t.xml(!1,e)}return super.xml(t,!1,e)}}function Dt(t,n){return"radialGradient"===(this._element||this).type?this.attr({fx:new yt(t),fy:new yt(n)}):this.attr({x1:new yt(t),y1:new yt(n)})}function Lt(t,n){return"radialGradient"===(this._element||this).type?this.attr({cx:new yt(t),cy:new yt(n)}):this.attr({x2:new yt(t),y2:new yt(n)})}A(Pt,"Fragment");const Ft=Object.freeze(Object.defineProperty({__proto__:null,from:Dt,to:Lt},Symbol.toStringTag,{value:"Module"}));class Bt extends Et{constructor(t,n){super(x(t+"Gradient","string"==typeof t?null:t),n)}attr(t,n,e){return"transform"===t&&(t="gradientTransform"),super.attr(t,n,e)}bbox(){return new K}targets(){return rt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}k(Bt,Ft),e({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:C((function(t,n){return this.put(new Bt(t)).update(n)}))}}),A(Bt,"Gradient");class $t extends Et{constructor(t,n=t){super(x("pattern",t),n)}attr(t,n,e){return"transform"===t&&(t="patternTransform"),super.attr(t,n,e)}bbox(){return new K}targets(){return rt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}e({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:C((function(t,n,e){return this.put(new $t).update(e).attr({x:0,y:0,width:t,height:n,patternUnits:"userSpaceOnUse"})}))}}),A($t,"Pattern");class Vt extends At{constructor(t,n=t){super(x("image",t),n)}load(t,n){if(!t)return this;const e=new g.window.Image;return at(e,"load",(function(t){const r=this.parent($t);0===this.width()&&0===this.height()&&this.size(e.width,e.height),r instanceof $t&&0===r.width()&&0===r.height()&&r.size(this.width(),this.height()),"function"==typeof n&&n.call(this,t)}),this),at(e,"load error",(function(){ct(e)})),this.attr("href",e.src=t,v)}}var Xt;Xt=function(t,n,e){return"fill"!==t&&"stroke"!==t||$.test(n)&&(n=e.root().defs().image(n)),n instanceof Vt&&(n=e.root().defs().pattern(0,0,(t=>{t.add(n)}))),n},mt.push(Xt),e({Container:{image:C((function(t,n){return this.put(new Vt).size(0,0).load(t,n)}))}}),A(Vt,"Image");class Yt extends gt{bbox(){let t=-1/0,n=-1/0,e=1/0,r=1/0;return this.forEach((function(i){t=Math.max(i[0],t),n=Math.max(i[1],n),e=Math.min(i[0],e),r=Math.min(i[1],r)})),new K(e,r,t-e,n-r)}move(t,n){const e=this.bbox();if(t-=e.x,n-=e.y,!isNaN(t)&&!isNaN(n))for(let r=this.length-1;r>=0;r--)this[r]=[this[r][0]+t,this[r][1]+n];return this}parse(t=[0,0]){const n=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(V).map(parseFloat)).length%2!=0&&t.pop();for(let e=0,r=t.length;e=0;e--)r.width&&(this[e][0]=(this[e][0]-r.x)*t/r.width+r.x),r.height&&(this[e][1]=(this[e][1]-r.y)*n/r.height+r.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let n=0,e=this.length;n":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,n,e,r){return function(i){return i<0?t>0?n/t*i:e>0?r/e*i:0:i>1?e<1?(1-r)/(1-e)*i+(r-e)/(1-e):t<1?(1-n)/(1-t)*i+(n-t)/(1-t):1:3*i*(1-i)**2*n+3*i**2*(1-i)*r+i**3}},steps:function(t,n="end"){n=n.split("-").reverse()[0];let e=t;return"none"===n?--e:"both"===n&&++e,(r,i=!1)=>{let o=Math.floor(r*t);const u=r*o%1==0;return"start"!==n&&"both"!==n||++o,i&&u&&--o,r>=0&&o<0&&(o=0),r<=1&&o>e&&(o=e),o/e}}};class Qt{done(){return!1}}class Jt extends Qt{constructor(t=dt){super(),this.ease=Ht[t]||t}step(t,n,e){return"number"!=typeof t?e<1?t:n:t+(n-t)*this.ease(e)}}class Kt extends Qt{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,n,e,r){return this.stepper(t,n,e,r)}}function tn(){const t=(this._duration||500)/1e3,n=this._overshoot||0,e=Math.PI,r=Math.log(n/100+1e-10),i=-r/Math.sqrt(e*e+r*r),o=3.9/(i*t);this.d=2*i*o,this.k=o*o}k(class extends Kt{constructor(t=500,n=0){super(),this.duration(t).overshoot(n)}step(t,n,e,r){if("string"==typeof t)return t;if(r.done=e===1/0,e===1/0)return n;if(0===e)return t;e>100&&(e=16),e/=1e3;const i=r.velocity||0,o=-this.d*i-this.k*(t-n),u=t+i*e+o*e*e/2;return r.velocity=i+o*e,r.done=Math.abs(n-u)+Math.abs(i)<.002,r.done?n:u}},{duration:Zt("_duration",tn),overshoot:Zt("_overshoot",tn)});k(class extends Kt{constructor(t=.1,n=.01,e=0,r=1e3){super(),this.p(t).i(n).d(e).windup(r)}step(t,n,e,r){if("string"==typeof t)return t;if(r.done=e===1/0,e===1/0)return n;if(0===e)return t;const i=n-t;let o=(r.integral||0)+i*e;const u=(i-(r.error||0))/e,s=this._windup;return!1!==s&&(o=Math.max(-s,Math.min(o,s))),r.error=i,r.integral=o,r.done=Math.abs(i)<.001,r.done?n:t+(this.P*i+this.I*o+this.D*u)}},{windup:Zt("_windup"),p:Zt("P"),i:Zt("I"),d:Zt("D")});const nn={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},en={M:function(t,n,e){return n.x=e.x=t[0],n.y=e.y=t[1],["M",n.x,n.y]},L:function(t,n){return n.x=t[0],n.y=t[1],["L",t[0],t[1]]},H:function(t,n){return n.x=t[0],["H",t[0]]},V:function(t,n){return n.y=t[0],["V",t[0]]},C:function(t,n){return n.x=t[4],n.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,n){return n.x=t[2],n.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,n){return n.x=t[2],n.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,n){return n.x=t[0],n.y=t[1],["T",t[0],t[1]]},Z:function(t,n,e){return n.x=e.x,n.y=e.y,["Z"]},A:function(t,n){return n.x=t[5],n.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},rn="mlhvqtcsaz".split("");for(let $l=0,Vl=rn.length;$l=0;i--)r=this[i][0],"M"===r||"L"===r||"T"===r?(this[i][1]+=t,this[i][2]+=n):"H"===r?this[i][1]+=t:"V"===r?this[i][1]+=n:"C"===r||"S"===r||"Q"===r?(this[i][1]+=t,this[i][2]+=n,this[i][3]+=t,this[i][4]+=n,"C"===r&&(this[i][5]+=t,this[i][6]+=n)):"A"===r&&(this[i][6]+=t,this[i][7]+=n);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,n=!0){let e=0,r="";const i={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:n,p0:new G,p:new G};for(;i.lastToken=r,r=t.charAt(e++);)if(i.inSegment||!un(i,r))if("."!==r)if(isNaN(parseInt(r)))if(fn.has(r))i.inNumber&&sn(i,!1);else if("-"!==r&&"+"!==r)if("E"!==r.toUpperCase()){if(X.test(r)){if(i.inNumber)sn(i,!1);else{if(!on(i))throw new Error("parser Error");an(i)}--e}}else i.number+=r,i.hasExponent=!0;else{if(i.inNumber&&!hn(i)){sn(i,!1),--e;continue}i.number+=r,i.inNumber=!0}else{if("0"===i.number||cn(i)){i.inNumber=!0,i.number=r,sn(i,!0);continue}i.inNumber=!0,i.number+=r}else{if(i.pointSeen||i.hasExponent){sn(i,!1),--e;continue}i.inNumber=!0,i.pointSeen=!0,i.number+=r}return i.inNumber&&sn(i,!1),i.inSegment&&on(i)&&an(i),i.segments}(t)}size(t,n){const e=this.bbox();let r,i;for(e.width=0===e.width?1:e.width,e.height=0===e.height?1:e.height,r=this.length-1;r>=0;r--)i=this[r][0],"M"===i||"L"===i||"T"===i?(this[r][1]=(this[r][1]-e.x)*t/e.width+e.x,this[r][2]=(this[r][2]-e.y)*n/e.height+e.y):"H"===i?this[r][1]=(this[r][1]-e.x)*t/e.width+e.x:"V"===i?this[r][1]=(this[r][1]-e.y)*n/e.height+e.y:"C"===i||"S"===i||"Q"===i?(this[r][1]=(this[r][1]-e.x)*t/e.width+e.x,this[r][2]=(this[r][2]-e.y)*n/e.height+e.y,this[r][3]=(this[r][3]-e.x)*t/e.width+e.x,this[r][4]=(this[r][4]-e.y)*n/e.height+e.y,"C"===i&&(this[r][5]=(this[r][5]-e.x)*t/e.width+e.x,this[r][6]=(this[r][6]-e.y)*n/e.height+e.y)):"A"===i&&(this[r][1]=this[r][1]*t/e.width,this[r][2]=this[r][2]*n/e.height,this[r][6]=(this[r][6]-e.x)*t/e.width+e.x,this[r][7]=(this[r][7]-e.y)*n/e.height+e.y);return this}toString(){return function(t){let n="";for(let e=0,r=t.length;e{const n=typeof t;return"number"===n?yt:"string"===n?W.isColor(t)?W:V.test(t)?X.test(t)?ln:gt:T.test(t)?yt:vn:mn.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?gt:"object"===n?_n:vn};class pn{constructor(t){this._stepper=t||new Jt("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce((function(t,n){return t&&n}),!0)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){this._type||this.type(dn(t));let n=new this._type(t);return this._type===W&&(n=this._to?n[this._to[4]]():this._from?n[this._from[4]]():n),this._type===_n&&(n=this._to?n.align(this._to):this._from?n.align(this._from):n),n=n.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object).map((function(t){return t.done=!0,t})),n}}class vn{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}}class gn{constructor(...t){this.init(...t)}init(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,gn.defaults,t),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}gn.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const yn=(t,n)=>t[0]n[0]?1:0;class _n{constructor(...t){this.init(...t)}align(t){const n=this.values;for(let e=0,r=n.length;et.concat(n)),[]),this}toArray(){return this.values}valueOf(){const t={},n=this.values;for(;n.length;){const e=n.shift(),r=n.shift(),i=n.shift(),o=n.splice(0,i);t[e]=new r(o)}return t}}const mn=[vn,gn,_n];class wn extends At{constructor(t,n=t){super(x("path",t),n)}array(){return this._array||(this._array=new ln(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,n){return this.attr("d",this.array().move(t,n))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new ln(t))}size(t,n){const e=a(this,t,n);return this.attr("d",this.array().size(e.width,e.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}}wn.prototype.MorphArray=ln,e({Container:{path:C((function(t){return this.put(new wn).plot(t||new ln)}))}}),A(wn,"Path");const bn=Object.freeze(Object.defineProperty({__proto__:null,array:function(){return this._array||(this._array=new Yt(this.attr("points")))},clear:function(){return delete this._array,this},move:function(t,n){return this.attr("points",this.array().move(t,n))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new Yt(t))},size:function(t,n){const e=a(this,t,n);return this.attr("points",this.array().size(e.width,e.height))}},Symbol.toStringTag,{value:"Module"}));class xn extends At{constructor(t,n=t){super(x("polygon",t),n)}}e({Container:{polygon:C((function(t){return this.put(new xn).plot(t||new Yt)}))}}),k(xn,qt),k(xn,bn),A(xn,"Polygon");class En extends At{constructor(t,n=t){super(x("polyline",t),n)}}e({Container:{polyline:C((function(t){return this.put(new En).plot(t||new Yt)}))}}),k(En,qt),k(En,bn),A(En,"Polyline");class jn extends At{constructor(t,n=t){super(x("rect",t),n)}}k(jn,{rx:Ot,ry:Mt}),e({Container:{rect:C((function(t,n){return this.put(new jn).size(t,n)}))}}),A(jn,"Rect");class An{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const n=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(n.prev=this._last,this._last.next=n,this._last=n):(this._last=n,this._first=n),n}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}shift(){const t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}}const On={nextDraw:null,frames:new An,timeouts:new An,immediates:new An,timer:()=>g.window.performance||g.window.Date,transforms:[],frame(t){const n=On.frames.push({run:t});return null===On.nextDraw&&(On.nextDraw=g.window.requestAnimationFrame(On._draw)),n},timeout(t,n){n=n||0;const e=On.timer().now()+n,r=On.timeouts.push({run:t,time:e});return null===On.nextDraw&&(On.nextDraw=g.window.requestAnimationFrame(On._draw)),r},immediate(t){const n=On.immediates.push(t);return null===On.nextDraw&&(On.nextDraw=g.window.requestAnimationFrame(On._draw)),n},cancelFrame(t){null!=t&&On.frames.remove(t)},clearTimeout(t){null!=t&&On.timeouts.remove(t)},cancelImmediate(t){null!=t&&On.immediates.remove(t)},_draw(t){let n=null;const e=On.timeouts.last();for(;(n=On.timeouts.shift())&&(t>=n.time?n.run():On.timeouts.push(n),n!==e););let r=null;const i=On.frames.last();for(;r!==i&&(r=On.frames.shift());)r.run(t);let o=null;for(;o=On.immediates.shift();)o();On.nextDraw=On.timeouts.first()||On.frames.first()?g.window.requestAnimationFrame(On._draw):null}},Mn=function(t){const n=t.start,e=t.runner.duration();return{start:n,duration:e,end:n+e,runner:t.runner}},Sn=function(){const t=g.window;return(t.performance||t.Date).now()};class kn extends ht{constructor(t=Sn){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),n=t?t.runner.duration():0;return(t?t.start:this._time)+n}getEndTimeOfTimeline(){const t=this._runners.map((t=>t.start+t.runner.duration()));return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=!0,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=!1,this.updateTime()._continue()}reverse(t){const n=this.speed();if(null==t)return this.speed(-n);const e=Math.abs(n);return this.speed(t?-e:e)}schedule(t,n,e){if(null==t)return this._runners.map(Mn);let r=0;const i=this.getEndTime();if(n=n||0,null==e||"last"===e||"after"===e)r=i;else if("absolute"===e||"start"===e)r=n,n=0;else if("now"===e)r=this._time;else if("relative"===e){const e=this.getRunnerInfoById(t.id);e&&(r=e.start+n,n=0)}else{if("with-last"!==e)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();r=t?t.start:this._time}}t.unschedule(),t.timeline(this);const o=t.persist(),u={persist:null===o?this._persist:o,start:r+n,runner:t};return this._lastRunnerId=t.id,this._runners.push(u),this._runners.sort(((t,n)=>t.start-n.start)),this._runnerIds=this._runners.map((t=>t.runner.id)),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}unschedule(t){const n=this._runnerIds.indexOf(t.id);return n<0||(this._runners.splice(n,1),this._runnerIds.splice(n,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=!1){return On.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=On.frame(this._step)),this)}_stepFn(t=!1){const n=this._timeSource();let e=n-this._lastSourceTime;t&&(e=0);const r=this._speed*e+(this._time-this._lastStepTime);this._lastSourceTime=n,t||(this._time+=r,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let o=this._runners.length;o--;){const t=this._runners[o],n=t.runner;this._time-t.start<=0&&n.reset()}let i=!1;for(let o=0,u=this._runners.length;o0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}}e({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new kn,this._timeline):(this._timeline=t,this)}}});class Cn extends ht{constructor(t){super(),this.id=Cn.id++,t="function"==typeof(t=null==t?lt:t)?new Kt(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof Kt,this._stepper=this._isDeclarative?t:new Jt,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new H,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1,this._frameId=null,this._persist=!!this._isDeclarative||null}static sanitise(t,n,e){let r=1,i=!1,o=0;return n=n??pt,e=e||"last","object"!=typeof(t=t??lt)||t instanceof Qt||(n=t.delay??n,e=t.when??e,i=t.swing||i,r=t.times??r,o=t.wait??o,t=t.duration??lt),{duration:t,delay:n,swing:i,times:r,wait:o,when:e}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(t,n,e){const r=Cn.sanitise(t,n,e),i=new Cn(r.duration);return this._timeline&&i.timeline(this._timeline),this._element&&i.element(this._element),i.loop(r).schedule(r.delay,r.when)}clearTransform(){return this.transforms=new H,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter((t=>!t.isTransform)))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new Jt(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,n,e){return"object"==typeof t&&(n=t.swing,e=t.wait,t=t.times),this._times=t||1/0,this._swing=n||!1,this._wait=e||0,!0===this._times&&(this._times=1/0),this}loops(t){const n=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/n),e=(this._time-t*n)/this._duration;return Math.min(t+e,this._times)}const e=t%1,r=n*Math.floor(t)+this._duration*e;return this.time(r)}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const n=this._time,e=this._duration,r=this._wait,i=this._times,o=this._swing,u=this._reverse;let s;if(null==t){const t=function(t){const n=o*Math.floor(t%(2*(r+e))/(r+e)),i=n&&!u||!n&&u,s=Math.pow(-1,i)*(t%(r+e))/e+i;return Math.max(Math.min(s,1),0)},a=i*(r+e)-r;return s=n<=0?Math.round(t(1e-5)):n=0;this._lastPosition=n;const r=this.duration(),i=this._lastTime<=0&&this._time>0,o=this._lastTime=r;this._lastTime=this._time,i&&this.fire("start",this);const u=this._isDeclarative;this.done=!u&&!o&&this._time>=r,this._reseted=!1;let s=!1;return(e||u)&&(this._initialise(e),this.transforms=new H,s=this._run(u?t:n),this.fire("step",this)),this.done=this.done||s&&u,o&&this.fire("finished",this),this}time(t){if(null==t)return this._time;const n=t-this._time;return this.step(n),this}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let n=0,e=this._queue.length;nt.lmultiplyO(n),Nn=t=>t.transforms;function Rn(){const t=this._transformationRunners.runners.map(Nn).reduce(In,new H);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}class zn{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const n=t.id+1;return this.runners.push(t),this.ids.push(n),this}clearBefore(t){const n=this.ids.indexOf(t+1)||1;return this.ids.splice(0,n,0),this.runners.splice(0,n,new Tn).forEach((t=>t.clearTransformsFromQueue())),this}edit(t,n){const e=this.ids.indexOf(t+1);return this.ids.splice(e,1,t+1),this.runners.splice(e,1,n),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let n=0;nn.id<=t.id)).map(Nn).reduce(In,new H)},_addRunner(t){this._transformationRunners.add(t),On.cancelImmediate(this._frameId),this._frameId=On.immediate(Rn.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new zn).add(new Tn(new H(this))))}}});k(Cn,{attr(t,n){return this.styleAttr("attr",t,n)},css(t,n){return this.styleAttr("css",t,n)},styleAttr(t,n,e){if("string"==typeof n)return this.styleAttr(t,{[n]:e});let r=n;if(this._tryRetarget(t,r))return this;let i=new pn(this._stepper).to(r),o=Object.keys(r);return this.queue((function(){i=i.from(this.element()[t](o))}),(function(n){return this.element()[t](i.at(n).valueOf()),i.done()}),(function(n){const e=Object.keys(n),u=(s=o,e.filter((t=>!s.includes(t))));var s;if(u.length){const n=this.element()[t](u),e=new _n(i.from()).valueOf();Object.assign(e,n),i.from(e)}const a=new _n(i.to()).valueOf();Object.assign(a,n),i.to(a),o=e,r=n})),this._rememberMorpher(t,i),this},zoom(t,n){if(this._tryRetarget("zoom",t,n))return this;let e=new pn(this._stepper).to(new yt(t));return this.queue((function(){e=e.from(this.element().zoom())}),(function(t){return this.element().zoom(e.at(t),n),e.done()}),(function(t,r){n=r,e.to(t)})),this._rememberMorpher("zoom",e),this},transform(t,n,e){if(n=t.relative||n,this._isDeclarative&&!n&&this._tryRetarget("transform",t))return this;const r=H.isMatrixLike(t);e=null!=t.affine?t.affine:null!=e?e:!r;const i=new pn(this._stepper).type(e?gn:H);let o,u,s,a,h;return this.queue((function(){u=u||this.element(),o=o||c(t,u),h=new H(n?void 0:u),u._addRunner(this),n||u._clearTransformRunnersBefore(this)}),(function(c){n||this.clearTransform();const{x:f,y:l}=new G(o).transform(u._currentTransform(this));let d=new H({...t,origin:[f,l]}),p=this._isDeclarative&&s?s:h;if(e){d=d.decompose(f,l),p=p.decompose(f,l);const t=d.rotate,n=p.rotate,e=[t-360,t,t+360],r=e.map((t=>Math.abs(t-n))),i=Math.min(...r),o=r.indexOf(i);d.rotate=e[o]}n&&(r||(d.rotate=t.rotate||0),this._isDeclarative&&a&&(p.rotate=a)),i.from(p),i.to(d);const v=i.at(c);return a=v.rotate,s=new H(v),this.addTransform(s),u._addRunner(this),i.done()}),(function(n){(n.origin||"center").toString()!==(t.origin||"center").toString()&&(o=c(n,u)),t={...n,origin:o}}),!0),this._isDeclarative&&this._rememberMorpher("transform",i),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,n){return this.dx(t).dy(n)},_queueNumberDelta(t,n){if(n=new yt(n),this._tryRetarget(t,n))return this;const e=new pn(this._stepper).to(n);let r=null;return this.queue((function(){r=this.element()[t](),e.from(r),e.to(r+n)}),(function(n){return this.element()[t](e.at(n)),e.done()}),(function(t){e.to(r+new yt(t))})),this._rememberMorpher(t,e),this},_queueObject(t,n){if(this._tryRetarget(t,n))return this;const e=new pn(this._stepper).to(n);return this.queue((function(){e.from(this.element()[t]())}),(function(n){return this.element()[t](e.at(n)),e.done()})),this._rememberMorpher(t,e),this},_queueNumber(t,n){return this._queueObject(t,new yt(n))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,n){return this.x(t).y(n)},amove(t,n){return this.ax(t).ay(n)},center(t,n){return this.cx(t).cy(n)},size(t,n){let e;return t&&n||(e=this._element.bbox()),t||(t=e.width/e.height*n),n||(n=e.height/e.width*t),this.width(t).height(n)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,n,e,r){if(4===arguments.length)return this.plot([t,n,e,r]);if(this._tryRetarget("plot",t))return this;const i=new pn(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){i.from(this._element.array())}),(function(t){return this._element.plot(i.at(t)),i.done()})),this._rememberMorpher("plot",i),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,n,e,r){return this._queueObject("viewbox",new K(t,n,e,r))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),k(Cn,{rx:Ot,ry:Mt,from:Dt,to:Lt}),A(Cn,"Runner");class Pn extends Et{constructor(t,n=t){super(x("svg",t),n),this.namespace()}defs(){return this.isRoot()?E(this.node.querySelector("defs"))||this.put(new jt):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof g.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:d,version:"1.1"}).attr("xmlns:xlink",v,p):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,p).attr("xmlns:svgjs",null,p)}root(){return this.isRoot()?this:super.root()}}e({Container:{nested:C((function(){return this.put(new Pn)}))}}),A(Pn,"Svg",!0);let Dn=class extends Et{constructor(t,n=t){super(x("symbol",t),n)}};e({Container:{symbol:C((function(){return this.put(new Dn)}))}}),A(Dn,"Symbol");const Ln=Object.freeze(Object.defineProperty({__proto__:null,amove:function(t,n){return this.ax(t).ay(n)},ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},build:function(t){return this._build=!!t,this},center:function(t,n,e=this.bbox()){return this.cx(t,e).cy(n,e)},cx:function(t,n=this.bbox()){return null==t?n.cx:this.attr("x",this.attr("x")+t-n.cx)},cy:function(t,n=this.bbox()){return null==t?n.cy:this.attr("y",this.attr("y")+t-n.cy)},length:function(){return this.node.getComputedTextLength()},move:function(t,n,e=this.bbox()){return this.x(t,e).y(n,e)},plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(g.document.createTextNode(t)),this},x:function(t,n=this.bbox()){return null==t?n.x:this.attr("x",this.attr("x")+t-n.x)},y:function(t,n=this.bbox()){return null==t?n.y:this.attr("y",this.attr("y")+t-n.y)}},Symbol.toStringTag,{value:"Module"}));class Fn extends At{constructor(t,n=t){super(x("text",t),n),this.dom.leading=this.dom.leading??new yt(1.3),this._rebuild=!0,this._build=!1}leading(t){return null==t?this.dom.leading:(this.dom.leading=new yt(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let n=0;const e=this.dom.leading;this.each((function(r){if(f(this.node))return;const i=g.window.getComputedStyle(this.node).getPropertyValue("font-size"),o=e*new yt(i);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?n+=o:(this.attr("dy",r?o+n:0),n=0))})),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new yt(t.leading||1.3),this}writeDataToDom(){return l(this,this.dom,{leading:1.3}),this}text(t){if(void 0===t){const n=this.node.childNodes;let e=0;t="";for(let r=0,i=n.length;r{let r;try{r=e.node instanceof g.window.SVGSVGElement?new K(e.attr(["x","y","width","height"])):e.bbox()}catch(s){return}const i=new H(e),o=i.translate(t,n).transform(i.inverse()),u=new G(r.x,r.y).transform(o);e.move(u.x,u.y)})),this},dx:function(t){return this.dmove(t,0)},dy:function(t){return this.dmove(0,t)},height:function(t,n=this.bbox()){return null==t?n.height:this.size(n.width,t,n)},move:function(t=0,n=0,e=this.bbox()){const r=t-e.x,i=n-e.y;return this.dmove(r,i)},size:function(t,n,e=this.bbox()){const r=a(this,t,n,e),i=r.width/e.width,o=r.height/e.height;return this.children().forEach((t=>{const n=new G(e).transform(new H(t).inverse());t.scale(i,o,n.x,n.y)})),this},width:function(t,n=this.bbox()){return null==t?n.width:this.size(t,n.height,n)},x:function(t,n=this.bbox()){return null==t?n.x:this.move(t,n.y,n)},y:function(t,n=this.bbox()){return null==t?n.y:this.move(n.x,t,n)}},Symbol.toStringTag,{value:"Module"}));class Un extends Et{constructor(t,n=t){super(x("g",t),n)}}k(Un,Yn),e({Container:{group:C((function(){return this.put(new Un)}))}}),A(Un,"G");class qn extends Et{constructor(t,n=t){super(x("a",t),n)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,v)}}k(qn,Yn),e({Container:{link:C((function(t){return this.put(new qn).to(t)}))},Element:{unlink(){const t=this.linker();if(!t)return this;const n=t.parent();if(!n)return this.remove();const e=n.index(t);return n.add(this,e),t.remove(),this},linkTo(t){let n=this.linker();return n||(n=new qn,this.wrap(n)),"function"==typeof t?t.call(n,n):n.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),A(qn,"A");class Wn extends Et{constructor(t,n=t){super(x("mask",t),n)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return rt("svg [mask*="+this.id()+"]")}}e({Container:{mask:C((function(){return this.defs().put(new Wn)}))},Element:{masker(){return this.reference("mask")},maskWith(t){const n=t instanceof Wn?t:this.parent().mask().add(t);return this.attr("mask","url(#"+n.id()+")")},unmask(){return this.attr("mask",null)}}}),A(Wn,"Mask");class Gn extends bt{constructor(t,n=t){super(x("stop",t),n)}update(t){return("number"==typeof t||t instanceof yt)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new yt(t.offset)),this}}e({Gradient:{stop:function(t,n,e){return this.put(new Gn).update(t,n,e)}}}),A(Gn,"Stop");class Zn extends bt{constructor(t,n=t){super(x("style",t),n)}addText(t=""){return this.node.textContent+=t,this}font(t,n,e={}){return this.rule("@font-face",{fontFamily:t,src:n,...e})}rule(t,n){return this.addText(function(t,n){if(!t)return"";if(!n)return t;let e=t+"{";for(const r in n)e+=r.replace(/([A-Z])/g,(function(t,n){return"-"+n.toLowerCase()}))+":"+n[r]+";";return e+="}",e}(t,n))}}e("Dom",{style(t,n){return this.put(new Zn).rule(t,n)},fontface(t,n,e){return this.put(new Zn).font(t,n,e)}}),A(Zn,"Style");class Hn extends Fn{constructor(t,n=t){super(x("textPath",t),n)}array(){const t=this.track();return t?t.array():null}plot(t){const n=this.track();let e=null;return n&&(e=n.plot(t)),null==t?e:this}track(){return this.reference("href")}}e({Container:{textPath:C((function(t,n){return t instanceof Fn||(t=this.text(t)),t.path(n)}))},Text:{path:C((function(t,n=!0){const e=new Hn;let r;if(t instanceof wn||(t=this.defs().path(t)),e.attr("href","#"+t,v),n)for(;r=this.node.firstChild;)e.node.appendChild(r);return this.put(e)})),textPath(){return this.findOne("textPath")}},Path:{text:C((function(t){return t instanceof Fn||(t=(new Fn).addTo(this.parent()).text(t)),t.path(this)})),targets(){return rt("svg textPath").filter((t=>(t.attr("href")||"").includes(this.id())))}}}),Hn.prototype.MorphArray=ln,A(Hn,"TextPath");class Qn extends At{constructor(t,n=t){super(x("use",t),n)}use(t,n){return this.attr("href",(n||"")+"#"+t,v)}}e({Container:{use:C((function(t,n){return this.put(new Qn).use(t,n)}))}}),A(Qn,"Use");const Jn=b;k([Pn,Dn,Vt,$t,Gt],r("viewbox")),k([Wt,En,xn,wn],r("marker")),k(Fn,r("Text")),k(wn,r("Path")),k(jt,r("Defs")),k([Fn,Bn],r("Tspan")),k([jn,zt,Bt,Cn],r("radius")),k(ht,r("EventTarget")),k(wt,r("Dom")),k(bt,r("Element")),k(At,r("Shape")),k([Et,Pt],r("Container")),k(Bt,r("Gradient")),k(Cn,r("Runner")),nt.extend([...new Set(n)]),function(t=[]){mn.push(...[].concat(t))}([yt,W,K,H,gt,Yt,ln,G]),k(mn,{to(t){return(new pn).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,n,e,r,i){return this.fromArray(t.map((function(t,o){return r.step(t,n[o],e,i[o],i)})))}});var Kn=function(t){return t.touches||[{clientX:t.clientX,clientY:t.clientY}]};k(Pn,{panZoom:function(t){var n,e,r,i,o,u,s,a,c,h,f,l,d=this;if(this.off(".panZoom"),!1===t)return this;var p,v,g=null!=(e=(t=null!=(n=t)?n:{}).zoomFactor)?e:2,y=null!=(r=t.zoomMin)?r:Number.MIN_VALUE,_=null!=(i=t.zoomMax)?i:Number.MAX_VALUE,m=null==(o=t.wheelZoom)||o,w=null==(u=t.pinchZoom)||u,b=null==(s=t.panning)||s,x=null!=(a=t.panButton)?a:0,E=null!=(c=t.oneFingerPan)&&c,j=null!=(h=t.margins)&&h,A=null!=(f=t.wheelZoomDeltaModeLinePixels)?f:17,O=null!=(l=t.wheelZoomDeltaModeScreenPixels)?l:53,M=!1,S=this.viewbox(),k=function(t){if(!j)return t;var n=j.top,e=j.left,r=j.bottom,i=j.right,o=d.attr(["width","height"]),u=o.width,s=o.height,a=d.node.preserveAspectRatio.baseVal,c=0,h=0,f=0,l=0;if(a.align!==a.SVG_PRESERVEASPECTRATIO_NONE){var p=u/s,v=S.width/S.height;if(v!==p){var g=a.meetOrSlice!==a.SVG_MEETORSLICE_SLICE,y=p>v?"width":"height",_="width"===y,m=g&&_||!g&&!_,w=m?p/v:v/p,b=t[y]-t[y]*w;m?a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMIN||a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMID||a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMAX?(c=b/2,h=-b/2):a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMIN||a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMID||a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMAX?h=-b:a.align!==a.SVG_PRESERVEASPECTRATIO_XMAXYMIN&&a.align!==a.SVG_PRESERVEASPECTRATIO_XMAXYMID&&a.align!==a.SVG_PRESERVEASPECTRATIO_XMAXYMAX||(c=b):a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMID||a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMID||a.align===a.SVG_PRESERVEASPECTRATIO_XMAXYMID?(f=b/2,l=-b/2):a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMIN||a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMIN||a.align===a.SVG_PRESERVEASPECTRATIO_XMAXYMIN?l=-b:a.align!==a.SVG_PRESERVEASPECTRATIO_XMINYMAX&&a.align!==a.SVG_PRESERVEASPECTRATIO_XMIDYMAX&&a.align!==a.SVG_PRESERVEASPECTRATIO_XMAXYMAX||(f=b)}}var x=S.width+S.x-e-c,E=S.x+i-t.width-h,A=S.height+S.y-n-f,O=S.y+r-t.height-l;return t.x=Math.min(x,Math.max(E,t.x)),t.y=Math.min(A,Math.max(O,t.y)),t},C=function t(n){(v=Kn(n)).length<2?b&&E&&N.call(this,n):(b&&E&&R.call(this,n),n.preventDefault(),this.dispatch("pinchZoomStart",{event:n}).defaultPrevented||(this.off("touchstart.panZoom",t),M=!0,at(document,"touchmove.panZoom",I,this,{passive:!1}),at(document,"touchend.panZoom",T,this,{passive:!1})))},T=function t(n){n.preventDefault();var e=Kn(n);e.length>1||(M=!1,this.dispatch("pinchZoomEnd",{event:n}),ct(document,"touchmove.panZoom",I),ct(document,"touchend.panZoom",t),this.on("touchstart.panZoom",C),e.length&&b&&E&&N.call(this,n))},I=function(t){t.preventDefault();var n=Kn(t),e=this.zoom(),r=Math.sqrt(Math.pow(v[0].clientX-v[1].clientX,2)+Math.pow(v[0].clientY-v[1].clientY,2))/Math.sqrt(Math.pow(n[0].clientX-n[1].clientX,2)+Math.pow(n[0].clientY-n[1].clientY,2));(e1||e>_&&r<1)&&(r=1);var i={x:n[0].clientX+.5*(n[1].clientX-n[0].clientX),y:n[0].clientY+.5*(n[1].clientY-n[0].clientY)},o=v[0].clientX+.5*(v[1].clientX-v[0].clientX),u=v[0].clientY+.5*(v[1].clientY-v[0].clientY),s=this.point(i.x,i.y),a=this.point(2*i.x-o,2*i.y-u),c=new K(this.viewbox()).transform((new H).translate(-a.x,-a.y).scale(r,0,0).translate(s.x,s.y));k(c),this.viewbox(c),v=n,this.dispatch("zoom",{box:c,focus:a})},N=function t(n){n.type.indexOf("mouse")>-1&&n.button!==x&&n.which!==x+1||(n.preventDefault(),this.off("mousedown.panZoom",t),v=Kn(n),M||(this.dispatch("panStart",{event:n}),p={x:v[0].clientX,y:v[0].clientY},at(document,"touchmove.panZoom mousemove.panZoom",z,this,{passive:!1}),at(document,"touchend.panZoom mouseup.panZoom",R,this,{passive:!1})))},R=function t(n){n.preventDefault(),ct(document,"touchmove.panZoom mousemove.panZoom",z),ct(document,"touchend.panZoom mouseup.panZoom",t),this.on("mousedown.panZoom",N),this.dispatch("panEnd",{event:n})},z=function(t){t.preventDefault();var n=Kn(t),e={x:n[0].clientX,y:n[0].clientY},r=this.point(e.x,e.y),i=this.point(p.x,p.y),o=[i.x-r.x,i.y-r.y];if(o[0]||o[1]){var u=new K(this.viewbox()).transform((new H).translate(o[0],o[1]));p=e,k(u),this.dispatch("panning",{box:u,event:t}).defaultPrevented||this.viewbox(u)}};return m&&this.on("wheel.panZoom",(function(t){var n;switch(t.preventDefault(),t.deltaMode){case 1:n=t.deltaY*A;break;case 2:n=t.deltaY*O;break;default:n=t.deltaY}var e=Math.pow(1+g,-1*n/100)*this.zoom(),r=this.point(t.clientX,t.clientY);if(e>_&&(e=_),e=.1&&this.canvas.zoom(n)}clear(){this.canvas.clear().viewbox(`-${this.spacing} -${this.spacing} ${this.width+2*this.spacing} ${this.height+this.spacing}`)}}var ne,ee,re,ie,oe,ue,se,ae,ce,he,fe,le,de,pe,ve,ge,ye,_e,me,we,be,xe,Ee,je,Ae,Oe,Me,Se,ke,Ce,Te,Ie,Ne,Re,ze,Pe,De,Le,Fe,Be,$e,Ve,Xe,Ye,Ue,qe,We,Ge,Ze,He,Qe,Je,Ke,tr,nr,er,rr,ir,or,ur,sr,ar,cr,hr,fr,lr,dr,pr,vr,gr,yr,_r,mr,wr,br,xr,Er,jr,Ar,Or,Mr,Sr,kr,Cr,Tr,Ir,Nr,Rr,zr,Pr,Dr,Lr,Fr,Br,$r,Vr,Xr,Yr,Ur,qr,Wr,Gr,Zr,Hr,Qr,Jr,Kr,ti,ni="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ei(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ri(){if(ie)return re;return ie=1,re=function(t,n){return t===n||t!=t&&n!=n}}function ii(){if(ue)return oe;ue=1;var t=ri();return oe=function(n,e){for(var r=n.length;r--;)if(t(n[r][0],e))return r;return-1}}function oi(){if(ge)return ve;ge=1;var t=ee?ne:(ee=1,ne=function(){this.__data__=[],this.size=0}),n=function(){if(ae)return se;ae=1;var t=ii(),n=Array.prototype.splice;return se=function(e){var r=this.__data__,i=t(r,e);return!(i<0||(i==r.length-1?r.pop():n.call(r,i,1),--this.size,0))}}(),e=function(){if(he)return ce;he=1;var t=ii();return ce=function(n){var e=this.__data__,r=t(e,n);return r<0?void 0:e[r][1]}}(),r=function(){if(le)return fe;le=1;var t=ii();return fe=function(n){return t(this.__data__,n)>-1}}(),i=function(){if(pe)return de;pe=1;var t=ii();return de=function(n,e){var r=this.__data__,i=t(r,n);return i<0?(++this.size,r.push([n,e])):r[i][1]=e,this}}();function o(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n-1&&n%1==0&&n-1&&t%1==0&&t<=9007199254740991}}function Yi(){if(Fi)return Li;return Fi=1,Li=function(t){return function(n){return t(n)}}}Bi.exports;var Ui,qi,Wi,Gi,Zi,Hi,Qi,Ji,Ki,to,no,eo,ro,io,oo,uo,so,ao,co,ho,fo,lo,po,vo,go,yo,_o,mo={exports:{}};function wo(){return Ui||(Ui=1,t=mo,n=mo.exports,e=ui(),r=n&&!n.nodeType&&n,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r&&e.process,u=function(){try{var t=i&&i.require&&i.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(n){}}(),t.exports=u),mo.exports;var t,n,e,r,i,o,u}function bo(){if(Wi)return qi;Wi=1;var t=function(){if(Di)return Pi;Di=1;var t=ci(),n=Xi(),e=Oi(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Pi=function(i){return e(i)&&n(i.length)&&!!r[t(i)]}}(),n=Yi(),e=wo(),r=e&&e.isTypedArray,i=r?n(r):t;return qi=i}function xo(){if(Zi)return Gi;Zi=1;var t=qr?Ur:(qr=1,Ur=function(t,n){for(var e=-1,r=Array(t);++eh))return!1;var l=a.get(r),d=a.get(i);if(l&&d)return l==i&&d==r;var p=-1,v=!0,g=2&o?new t:void 0;for(a.set(r,i),a.set(i,r);++p0&&o(h)?i>1?e(h,i-1,o,u,s):t(s,h):u||(s[s.length]=h)}return s},dc}function Hh(){if(_c)return yc;_c=1;var t=gc?vc:(gc=1,vc=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}),n=Math.max;return yc=function(e,r,i){return r=n(void 0===r?e.length-1:r,0),function(){for(var o=arguments,u=-1,s=n(o.length-r,0),a=Array(s);++u0){if(++e>=800)return arguments[0]}else e=0;return n.apply(void 0,arguments)}},bc}(),e=n(t);return Ec=e}function Jh(){if(Rc)return Nc;Rc=1;var t=Sc?Mc:(Sc=1,Mc=function(t,n,e,r){for(var i=t.length,o=e+(r?1:-1);r?o--:++o-1}}(),e=Lc?Dc:(Lc=1,Dc=function(t,n,e){for(var r=-1,i=null==t?0:t.length;++r=200){var v=s?null:i(u);if(v)return o(v);l=!1,h=r,p=new t}else p=s?[]:d;t:for(;++co){var u=i;i=o,o=u}return i+sf+o+sf+(ef.isUndefined(r)?of:r)}function lf(t,n){return ff(t,n.v,n.w,n.name)}af.prototype._nodeCount=0,af.prototype._edgeCount=0,af.prototype.isDirected=function(){return this._isDirected},af.prototype.isMultigraph=function(){return this._isMultigraph},af.prototype.isCompound=function(){return this._isCompound},af.prototype.setGraph=function(t){return this._label=t,this},af.prototype.graph=function(){return this._label},af.prototype.setDefaultNodeLabel=function(t){return ef.isFunction(t)||(t=ef.constant(t)),this._defaultNodeLabelFn=t,this},af.prototype.nodeCount=function(){return this._nodeCount},af.prototype.nodes=function(){return ef.keys(this._nodes)},af.prototype.sources=function(){var t=this;return ef.filter(this.nodes(),(function(n){return ef.isEmpty(t._in[n])}))},af.prototype.sinks=function(){var t=this;return ef.filter(this.nodes(),(function(n){return ef.isEmpty(t._out[n])}))},af.prototype.setNodes=function(t,n){var e=arguments,r=this;return ef.each(t,(function(t){e.length>1?r.setNode(t,n):r.setNode(t)})),this},af.prototype.setNode=function(t,n){return ef.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=uf,this._children[t]={},this._children[uf][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},af.prototype.node=function(t){return this._nodes[t]},af.prototype.hasNode=function(t){return ef.has(this._nodes,t)},af.prototype.removeNode=function(t){var n=this;if(ef.has(this._nodes,t)){var e=function(t){n.removeEdge(n._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],ef.each(this.children(t),(function(t){n.setParent(t)})),delete this._children[t]),ef.each(ef.keys(this._in[t]),e),delete this._in[t],delete this._preds[t],ef.each(ef.keys(this._out[t]),e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},af.prototype.setParent=function(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ef.isUndefined(n))n=uf;else{for(var e=n+="";!ef.isUndefined(e);e=this.parent(e))if(e===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this},af.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},af.prototype.parent=function(t){if(this._isCompound){var n=this._parent[t];if(n!==uf)return n}},af.prototype.children=function(t){if(ef.isUndefined(t)&&(t=uf),this._isCompound){var n=this._children[t];if(n)return ef.keys(n)}else{if(t===uf)return this.nodes();if(this.hasNode(t))return[]}},af.prototype.predecessors=function(t){var n=this._preds[t];if(n)return ef.keys(n)},af.prototype.successors=function(t){var n=this._sucs[t];if(n)return ef.keys(n)},af.prototype.neighbors=function(t){var n=this.predecessors(t);if(n)return ef.union(n,this.successors(t))},af.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},af.prototype.filterNodes=function(t){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var e=this;ef.each(this._nodes,(function(e,r){t(r)&&n.setNode(r,e)})),ef.each(this._edgeObjs,(function(t){n.hasNode(t.v)&&n.hasNode(t.w)&&n.setEdge(t,e.edge(t))}));var r={};function i(t){var o=e.parent(t);return void 0===o||n.hasNode(o)?(r[t]=o,o):o in r?r[o]:i(o)}return this._isCompound&&ef.each(n.nodes(),(function(t){n.setParent(t,i(t))})),n},af.prototype.setDefaultEdgeLabel=function(t){return ef.isFunction(t)||(t=ef.constant(t)),this._defaultEdgeLabelFn=t,this},af.prototype.edgeCount=function(){return this._edgeCount},af.prototype.edges=function(){return ef.values(this._edgeObjs)},af.prototype.setPath=function(t,n){var e=this,r=arguments;return ef.reduce(t,(function(t,i){return r.length>1?e.setEdge(t,i,n):e.setEdge(t,i),i})),this},af.prototype.setEdge=function(){var t,n,e,r,i=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(t=o.v,n=o.w,e=o.name,2===arguments.length&&(r=arguments[1],i=!0)):(t=o,n=arguments[1],e=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),t=""+t,n=""+n,ef.isUndefined(e)||(e=""+e);var u=ff(this._isDirected,t,n,e);if(ef.has(this._edgeLabels,u))return i&&(this._edgeLabels[u]=r),this;if(!ef.isUndefined(e)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),this._edgeLabels[u]=i?r:this._defaultEdgeLabelFn(t,n,e);var s=function(t,n,e,r){var i=""+n,o=""+e;if(!t&&i>o){var u=i;i=o,o=u}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,t,n,e);return t=s.v,n=s.w,Object.freeze(s),this._edgeObjs[u]=s,cf(this._preds[n],t),cf(this._sucs[t],n),this._in[n][u]=s,this._out[t][u]=s,this._edgeCount++,this},af.prototype.edge=function(t,n,e){var r=1===arguments.length?lf(this._isDirected,arguments[0]):ff(this._isDirected,t,n,e);return this._edgeLabels[r]},af.prototype.hasEdge=function(t,n,e){var r=1===arguments.length?lf(this._isDirected,arguments[0]):ff(this._isDirected,t,n,e);return ef.has(this._edgeLabels,r)},af.prototype.removeEdge=function(t,n,e){var r=1===arguments.length?lf(this._isDirected,arguments[0]):ff(this._isDirected,t,n,e),i=this._edgeObjs[r];return i&&(t=i.v,n=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],hf(this._preds[n],t),hf(this._sucs[t],n),delete this._in[n][r],delete this._out[t][r],this._edgeCount--),this},af.prototype.inEdges=function(t,n){var e=this._in[t];if(e){var r=ef.values(e);return n?ef.filter(r,(function(t){return t.v===n})):r}},af.prototype.outEdges=function(t,n){var e=this._out[t];if(e){var r=ef.values(e);return n?ef.filter(r,(function(t){return t.w===n})):r}},af.prototype.nodeEdges=function(t,n){var e=this.inEdges(t,n);if(e)return e.concat(this.outEdges(t,n))};var df={Graph:rf,version:"2.1.8"},pf=nf,vf=rf,gf={write:function(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:yf(t),edges:_f(t)};pf.isUndefined(t.graph())||(n.value=pf.clone(t.graph()));return n},read:function(t){var n=new vf(t.options).setGraph(t.value);return pf.each(t.nodes,(function(t){n.setNode(t.v,t.value),t.parent&&n.setParent(t.v,t.parent)})),pf.each(t.edges,(function(t){n.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),n}};function yf(t){return pf.map(t.nodes(),(function(n){var e=t.node(n),r=t.parent(n),i={v:n};return pf.isUndefined(e)||(i.value=e),pf.isUndefined(r)||(i.parent=r),i}))}function _f(t){return pf.map(t.edges(),(function(n){var e=t.edge(n),r={v:n.v,w:n.w};return pf.isUndefined(n.name)||(r.name=n.name),pf.isUndefined(e)||(r.value=e),r}))}var mf=nf,wf=function(t){var n,e={},r=[];function i(r){mf.has(e,r)||(e[r]=!0,n.push(r),mf.each(t.successors(r),i),mf.each(t.predecessors(r),i))}return mf.each(t.nodes(),(function(t){n=[],i(t),n.length&&r.push(n)})),r};var bf=nf,xf=Ef;function Ef(){this._arr=[],this._keyIndices={}}Ef.prototype.size=function(){return this._arr.length},Ef.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},Ef.prototype.has=function(t){return bf.has(this._keyIndices,t)},Ef.prototype.priority=function(t){var n=this._keyIndices[t];if(void 0!==n)return this._arr[n].priority},Ef.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},Ef.prototype.add=function(t,n){var e=this._keyIndices;if(t=String(t),!bf.has(e,t)){var r=this._arr,i=r.length;return e[t]=i,r.push({key:t,priority:n}),this._decrease(i),!0}return!1},Ef.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},Ef.prototype.decrease=function(t,n){var e=this._keyIndices[t];if(n>this._arr[e].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[e].priority+" New: "+n);this._arr[e].priority=n,this._decrease(e)},Ef.prototype._heapify=function(t){var n=this._arr,e=2*t,r=e+1,i=t;e>1].priority0&&(i=s.removeMin(),(o=u[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(a);return u}(t,String(n),e||Of,r||function(n){return t.outEdges(n)})},Of=nf.constant(1);var Mf=Af,Sf=nf,kf=function(t,n,e){return Sf.transform(t.nodes(),(function(r,i){r[i]=Mf(t,i,n,e)}),{})};var Cf=nf,Tf=function(t){var n=0,e=[],r={},i=[];function o(u){var s=r[u]={onStack:!0,lowlink:n,index:n++};if(e.push(u),t.successors(u).forEach((function(t){Cf.has(r,t)?r[t].onStack&&(s.lowlink=Math.min(s.lowlink,r[t].index)):(o(t),s.lowlink=Math.min(s.lowlink,r[t].lowlink))})),s.lowlink===s.index){var a,c=[];do{a=e.pop(),r[a].onStack=!1,c.push(a)}while(u!==a);i.push(c)}}return t.nodes().forEach((function(t){Cf.has(r,t)||o(t)})),i};var If=nf,Nf=Tf,Rf=function(t){return If.filter(Nf(t),(function(n){return n.length>1||1===n.length&&t.hasEdge(n[0],n[0])}))};var zf=function(t,n,e){return function(t,n,e){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(n){t!==n&&(r[t][n]={distance:Number.POSITIVE_INFINITY})})),e(t).forEach((function(e){var i=e.v===t?e.w:e.v,o=n(e);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var n=r[t];i.forEach((function(e){var o=r[e];i.forEach((function(e){var r=o[t],i=n[e],u=o[e],s=r.distance+i.distance;s0;){if(e=o.removeMin(),Wf.has(i,e))r.setEdge(e,i[e]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(e).forEach(u)}return r},tarjan:Tf,topsort:Lf},version:df.version};var Qf,Jf,Kf={exports:{}}; +/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */Qf=Kf,Jf=Kf.exports,function(){var t,n="Expected a function",e="__lodash_hash_undefined__",r="__lodash_placeholder__",i=16,o=32,u=64,s=128,a=256,c=1/0,h=9007199254740991,f=NaN,l=4294967295,d=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",i],["flip",512],["partial",o],["partialRight",u],["rearg",a]],p="[object Arguments]",v="[object Array]",g="[object Boolean]",y="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",b="[object Map]",x="[object Number]",E="[object Object]",j="[object Promise]",A="[object RegExp]",O="[object Set]",M="[object String]",S="[object Symbol]",k="[object WeakMap]",C="[object ArrayBuffer]",T="[object DataView]",I="[object Float32Array]",N="[object Float64Array]",R="[object Int8Array]",z="[object Int16Array]",P="[object Int32Array]",D="[object Uint8Array]",L="[object Uint8ClampedArray]",F="[object Uint16Array]",B="[object Uint32Array]",$=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,X=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Y=/&(?:amp|lt|gt|quot|#39);/g,U=/[&<>"']/g,q=RegExp(Y.source),W=RegExp(U.source),G=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,K=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,nt=RegExp(tt.source),et=/^\s+/,rt=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ot=/\{\n\/\* \[wrapped with (.+)\] \*/,ut=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,at=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ft=/\w*$/,lt=/^[-+]0x[0-9a-f]+$/i,dt=/^0b[01]+$/i,pt=/^\[object .+?Constructor\]$/,vt=/^0o[0-7]+$/i,gt=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_t=/($^)/,mt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",bt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",xt="\\u2700-\\u27bf",Et="a-z\\xdf-\\xf6\\xf8-\\xff",jt="A-Z\\xc0-\\xd6\\xd8-\\xde",At="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Mt="['’]",St="["+wt+"]",kt="["+Ot+"]",Ct="["+bt+"]",Tt="\\d+",It="["+xt+"]",Nt="["+Et+"]",Rt="[^"+wt+Ot+Tt+xt+Et+jt+"]",zt="\\ud83c[\\udffb-\\udfff]",Pt="[^"+wt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Lt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ft="["+jt+"]",Bt="\\u200d",$t="(?:"+Nt+"|"+Rt+")",Vt="(?:"+Ft+"|"+Rt+")",Xt="(?:['’](?:d|ll|m|re|s|t|ve))?",Yt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ut="(?:"+Ct+"|"+zt+")?",qt="["+At+"]?",Wt=qt+Ut+"(?:"+Bt+"(?:"+[Pt,Dt,Lt].join("|")+")"+qt+Ut+")*",Gt="(?:"+[It,Dt,Lt].join("|")+")"+Wt,Zt="(?:"+[Pt+Ct+"?",Ct,Dt,Lt,St].join("|")+")",Ht=RegExp(Mt,"g"),Qt=RegExp(Ct,"g"),Jt=RegExp(zt+"(?="+zt+")|"+Zt+Wt,"g"),Kt=RegExp([Ft+"?"+Nt+"+"+Xt+"(?="+[kt,Ft,"$"].join("|")+")",Vt+"+"+Yt+"(?="+[kt,Ft+$t,"$"].join("|")+")",Ft+"?"+$t+"+"+Xt,Ft+"+"+Yt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Tt,Gt].join("|"),"g"),tn=RegExp("["+Bt+wt+bt+At+"]"),nn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,en=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rn=-1,on={};on[I]=on[N]=on[R]=on[z]=on[P]=on[D]=on[L]=on[F]=on[B]=!0,on[p]=on[v]=on[C]=on[g]=on[T]=on[y]=on[_]=on[m]=on[b]=on[x]=on[E]=on[A]=on[O]=on[M]=on[k]=!1;var un={};un[p]=un[v]=un[C]=un[T]=un[g]=un[y]=un[I]=un[N]=un[R]=un[z]=un[P]=un[b]=un[x]=un[E]=un[A]=un[O]=un[M]=un[S]=un[D]=un[L]=un[F]=un[B]=!0,un[_]=un[m]=un[k]=!1;var sn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},an=parseFloat,cn=parseInt,hn="object"==typeof ni&&ni&&ni.Object===Object&&ni,fn="object"==typeof self&&self&&self.Object===Object&&self,ln=hn||fn||Function("return this")(),dn=Jf&&!Jf.nodeType&&Jf,pn=dn&&Qf&&!Qf.nodeType&&Qf,vn=pn&&pn.exports===dn,gn=vn&&hn.process,yn=function(){try{var t=pn&&pn.require&&pn.require("util").types;return t||gn&&gn.binding&&gn.binding("util")}catch(Bl){}}(),_n=yn&&yn.isArrayBuffer,mn=yn&&yn.isDate,wn=yn&&yn.isMap,bn=yn&&yn.isRegExp,xn=yn&&yn.isSet,En=yn&&yn.isTypedArray;function jn(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}function An(t,n,e,r){for(var i=-1,o=null==t?0:t.length;++i-1}function Tn(t,n,e){for(var r=-1,i=null==t?0:t.length;++r-1;);return e}function te(t,n){for(var e=t.length;e--&&Bn(n,t[e],0)>-1;);return e}var ne=Un({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ee=Un({"&":"&","<":"<",">":">",'"':""","'":"'"});function re(t){return"\\"+sn[t]}function ie(t){return tn.test(t)}function oe(t){var n=-1,e=Array(t.size);return t.forEach((function(t,r){e[++n]=[r,t]})),e}function ue(t,n){return function(e){return t(n(e))}}function se(t,n){for(var e=-1,i=t.length,o=0,u=[];++e",""":'"',"'":"'"}),de=function rt(wt){var bt,xt=(wt=null==wt?ln:de.defaults(ln.Object(),wt,de.pick(ln,en))).Array,Et=wt.Date,jt=wt.Error,At=wt.Function,Ot=wt.Math,Mt=wt.Object,St=wt.RegExp,kt=wt.String,Ct=wt.TypeError,Tt=xt.prototype,It=At.prototype,Nt=Mt.prototype,Rt=wt["__core-js_shared__"],zt=It.toString,Pt=Nt.hasOwnProperty,Dt=0,Lt=(bt=/[^.]+$/.exec(Rt&&Rt.keys&&Rt.keys.IE_PROTO||""))?"Symbol(src)_1."+bt:"",Ft=Nt.toString,Bt=zt.call(Mt),$t=ln._,Vt=St("^"+zt.call(Pt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xt=vn?wt.Buffer:t,Yt=wt.Symbol,Ut=wt.Uint8Array,qt=Xt?Xt.allocUnsafe:t,Wt=ue(Mt.getPrototypeOf,Mt),Gt=Mt.create,Zt=Nt.propertyIsEnumerable,Jt=Tt.splice,tn=Yt?Yt.isConcatSpreadable:t,sn=Yt?Yt.iterator:t,hn=Yt?Yt.toStringTag:t,fn=function(){try{var t=fo(Mt,"defineProperty");return t({},"",{}),t}catch(Bl){}}(),dn=wt.clearTimeout!==ln.clearTimeout&&wt.clearTimeout,pn=Et&&Et.now!==ln.Date.now&&Et.now,gn=wt.setTimeout!==ln.setTimeout&&wt.setTimeout,yn=Ot.ceil,Dn=Ot.floor,Un=Mt.getOwnPropertySymbols,pe=Xt?Xt.isBuffer:t,ve=wt.isFinite,ge=Tt.join,ye=ue(Mt.keys,Mt),_e=Ot.max,me=Ot.min,we=Et.now,be=wt.parseInt,xe=Ot.random,Ee=Tt.reverse,je=fo(wt,"DataView"),Ae=fo(wt,"Map"),Oe=fo(wt,"Promise"),Me=fo(wt,"Set"),Se=fo(wt,"WeakMap"),ke=fo(Mt,"create"),Ce=Se&&new Se,Te={},Ie=$o(je),Ne=$o(Ae),Re=$o(Oe),ze=$o(Me),Pe=$o(Se),De=Yt?Yt.prototype:t,Le=De?De.valueOf:t,Fe=De?De.toString:t;function Be(t){if(is(t)&&!Wu(t)&&!(t instanceof Ye)){if(t instanceof Xe)return t;if(Pt.call(t,"__wrapped__"))return Vo(t)}return new Xe(t)}var $e=function(){function n(){}return function(e){if(!rs(e))return{};if(Gt)return Gt(e);n.prototype=e;var r=new n;return n.prototype=t,r}}();function Ve(){}function Xe(n,e){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=t}function Ye(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=l,this.__views__=[]}function Ue(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n=e?n:e)),n}function ar(n,e,r,i,o,u){var s,a=1&e,c=2&e,h=4&e;if(r&&(s=o?r(n,i,o,u):r(n)),s!==t)return s;if(!rs(n))return n;var f=Wu(n);if(f){if(s=function(t){var n=t.length,e=new t.constructor(n);return n&&"string"==typeof t[0]&&Pt.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(n),!a)return ki(n,s)}else{var l=vo(n),d=l==m||l==w;if(Qu(n))return Ei(n,a);if(l==E||l==p||d&&!o){if(s=c||d?{}:yo(n),!a)return c?function(t,n){return Ci(t,po(t),n)}(n,function(t,n){return t&&Ci(n,zs(n),t)}(s,n)):function(t,n){return Ci(t,lo(t),n)}(n,ir(s,n))}else{if(!un[l])return o?n:{};s=function(t,n,e){var r,i=t.constructor;switch(n){case C:return ji(t);case g:case y:return new i(+t);case T:return function(t,n){var e=n?ji(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}(t,e);case I:case N:case R:case z:case P:case D:case L:case F:case B:return Ai(t,e);case b:return new i;case x:case M:return new i(t);case A:return function(t){var n=new t.constructor(t.source,ft.exec(t));return n.lastIndex=t.lastIndex,n}(t);case O:return new i;case S:return r=t,Le?Mt(Le.call(r)):{}}}(n,l,a)}}u||(u=new Ze);var v=u.get(n);if(v)return v;u.set(n,s),cs(n)?n.forEach((function(t){s.add(ar(t,e,r,t,n,u))})):os(n)&&n.forEach((function(t,i){s.set(i,ar(t,e,r,i,n,u))}));var _=f?t:(h?c?io:ro:c?zs:Rs)(n);return On(_||n,(function(t,i){_&&(t=n[i=t]),nr(s,i,ar(t,e,r,i,n,u))})),s}function cr(n,e,r){var i=r.length;if(null==n)return!i;for(n=Mt(n);i--;){var o=r[i],u=e[o],s=n[o];if(s===t&&!(o in n)||!u(s))return!1}return!0}function hr(e,r,i){if("function"!=typeof e)throw new Ct(n);return To((function(){e.apply(t,i)}),r)}function fr(t,n,e,r){var i=-1,o=Cn,u=!0,s=t.length,a=[],c=n.length;if(!s)return a;e&&(n=In(n,Hn(e))),r?(o=Tn,u=!1):n.length>=200&&(o=Jn,u=!1,n=new Ge(n));t:for(;++i-1},qe.prototype.set=function(t,n){var e=this.__data__,r=er(e,t);return r<0?(++this.size,e.push([t,n])):e[r][1]=n,this},We.prototype.clear=function(){this.size=0,this.__data__={hash:new Ue,map:new(Ae||qe),string:new Ue}},We.prototype.delete=function(t){var n=co(this,t).delete(t);return this.size-=n?1:0,n},We.prototype.get=function(t){return co(this,t).get(t)},We.prototype.has=function(t){return co(this,t).has(t)},We.prototype.set=function(t,n){var e=co(this,t),r=e.size;return e.set(t,n),this.size+=e.size==r?0:1,this},Ge.prototype.add=Ge.prototype.push=function(t){return this.__data__.set(t,e),this},Ge.prototype.has=function(t){return this.__data__.has(t)},Ze.prototype.clear=function(){this.__data__=new qe,this.size=0},Ze.prototype.delete=function(t){var n=this.__data__,e=n.delete(t);return this.size=n.size,e},Ze.prototype.get=function(t){return this.__data__.get(t)},Ze.prototype.has=function(t){return this.__data__.has(t)},Ze.prototype.set=function(t,n){var e=this.__data__;if(e instanceof qe){var r=e.__data__;if(!Ae||r.length<199)return r.push([t,n]),this.size=++e.size,this;e=this.__data__=new We(r)}return e.set(t,n),this.size=e.size,this};var lr=Ni(wr),dr=Ni(br,!0);function pr(t,n){var e=!0;return lr(t,(function(t,r,i){return e=!!n(t,r,i)})),e}function vr(n,e,r){for(var i=-1,o=n.length;++i0&&e(s)?n>1?yr(s,n-1,e,r,i):Nn(i,s):r||(i[i.length]=s)}return i}var _r=Ri(),mr=Ri(!0);function wr(t,n){return t&&_r(t,n,Rs)}function br(t,n){return t&&mr(t,n,Rs)}function xr(t,n){return kn(n,(function(n){return ts(t[n])}))}function Er(n,e){for(var r=0,i=(e=mi(e,n)).length;null!=n&&rn}function Mr(t,n){return null!=t&&Pt.call(t,n)}function Sr(t,n){return null!=t&&n in Mt(t)}function kr(n,e,r){for(var i=r?Tn:Cn,o=n[0].length,u=n.length,s=u,a=xt(u),c=1/0,h=[];s--;){var f=n[s];s&&e&&(f=In(f,Hn(e))),c=me(f.length,c),a[s]=!r&&(e||o>=120&&f.length>=120)?new Ge(s&&f):t}f=n[0];var l=-1,d=a[0];t:for(;++l=s?a:a*("desc"==e[r]?-1:1)}return t.index-n.index}(t,n,e)}))}function Ur(t,n,e){for(var r=-1,i=n.length,o={};++r-1;)s!==t&&Jt.call(s,a,1),Jt.call(t,a,1);return t}function Wr(t,n){for(var e=t?n.length:0,r=e-1;e--;){var i=n[e];if(e==r||i!==o){var o=i;mo(i)?Jt.call(t,i,1):fi(t,i)}}return t}function Gr(t,n){return t+Dn(xe()*(n-t+1))}function Zr(t,n){var e="";if(!t||n<1||n>h)return e;do{n%2&&(e+=t),(n=Dn(n/2))&&(t+=t)}while(n);return e}function Hr(t,n){return Io(Mo(t,n,ua),t+"")}function Qr(t){return Qe(Xs(t))}function Jr(t,n){var e=Xs(t);return zo(e,sr(n,0,e.length))}function Kr(n,e,r,i){if(!rs(n))return n;for(var o=-1,u=(e=mi(e,n)).length,s=u-1,a=n;null!=a&&++oi?0:i+n),(e=e>i?i:e)<0&&(e+=i),i=n>e?0:e-n>>>0,n>>>=0;for(var o=xt(i);++r>>1,u=t[o];null!==u&&!fs(u)&&(e?u<=n:u=200){var c=n?null:Zi(t);if(c)return ae(c);u=!1,i=Jn,a=new Ge}else a=n?[]:s;t:for(;++r=i?n:ri(n,e,r)}var xi=dn||function(t){return ln.clearTimeout(t)};function Ei(t,n){if(n)return t.slice();var e=t.length,r=qt?qt(e):new t.constructor(e);return t.copy(r),r}function ji(t){var n=new t.constructor(t.byteLength);return new Ut(n).set(new Ut(t)),n}function Ai(t,n){var e=n?ji(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}function Oi(n,e){if(n!==e){var r=n!==t,i=null===n,o=n==n,u=fs(n),s=e!==t,a=null===e,c=e==e,h=fs(e);if(!a&&!h&&!u&&n>e||u&&s&&c&&!a&&!h||i&&s&&c||!r&&c||!o)return 1;if(!i&&!u&&!h&&n1?r[o-1]:t,s=o>2?r[2]:t;for(u=n.length>3&&"function"==typeof u?(o--,u):t,s&&wo(r[0],r[1],s)&&(u=o<3?t:u,o=1),e=Mt(e);++i-1?o[u?e[s]:s]:t}}function Fi(e){return eo((function(r){var i=r.length,o=i,u=Xe.prototype.thru;for(e&&r.reverse();o--;){var s=r[o];if("function"!=typeof s)throw new Ct(n);if(u&&!a&&"wrapper"==uo(s))var a=new Xe([],!0)}for(o=a?o:i;++o1&&m.reverse(),l&&h<_&&(m.length=h),this&&this!==ln&&this instanceof s&&(A=y||Di(A)),A.apply(j,m)}}function $i(t,n){return function(e,r){return function(t,n,e,r){return wr(t,(function(t,i,o){n(r,e(t),i,o)})),r}(e,t,n(r),{})}}function Vi(n,e){return function(r,i){var o;if(r===t&&i===t)return e;if(r!==t&&(o=r),i!==t){if(o===t)return i;"string"==typeof r||"string"==typeof i?(r=ci(r),i=ci(i)):(r=ai(r),i=ai(i)),o=n(r,i)}return o}}function Xi(t){return eo((function(n){return n=In(n,Hn(ao())),Hr((function(e){var r=this;return t(n,(function(t){return jn(t,r,e)}))}))}))}function Yi(n,e){var r=(e=e===t?" ":ci(e)).length;if(r<2)return r?Zr(e,n):e;var i=Zr(e,yn(n/ce(e)));return ie(e)?bi(he(i),0,n).join(""):i.slice(0,n)}function Ui(n){return function(e,r,i){return i&&"number"!=typeof i&&wo(e,r,i)&&(r=i=t),e=gs(e),r===t?(r=e,e=0):r=gs(r),function(t,n,e,r){for(var i=-1,o=_e(yn((n-t)/(e||1)),0),u=xt(o);o--;)u[r?o:++i]=t,t+=e;return u}(e,r,i=i===t?ea))return!1;var h=u.get(n),f=u.get(e);if(h&&f)return h==e&&f==n;var l=-1,d=!0,p=2&r?new Ge:t;for(u.set(n,e),u.set(e,n);++l-1&&t%1==0&&t1?"& ":"")+n[r],n=n.join(e>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+n+"] */\n")}(r,function(t,n){return On(d,(function(e){var r="_."+e[0];n&e[1]&&!Cn(t,r)&&t.push(r)})),t.sort()}(function(t){var n=t.match(ot);return n?n[1].split(ut):[]}(r),e)))}function Ro(n){var e=0,r=0;return function(){var i=we(),o=16-(i-r);if(r=i,o>0){if(++e>=800)return arguments[0]}else e=0;return n.apply(t,arguments)}}function zo(n,e){var r=-1,i=n.length,o=i-1;for(e=e===t?i:e;++r1?n[e-1]:t;return r="function"==typeof r?(n.pop(),r):t,au(n,r)}));function vu(t){var n=Be(t);return n.__chain__=!0,n}function gu(t,n){return n(t)}var yu=eo((function(n){var e=n.length,r=e?n[0]:0,i=this.__wrapped__,o=function(t){return ur(t,n)};return!(e>1||this.__actions__.length)&&i instanceof Ye&&mo(r)?((i=i.slice(r,+r+(e?1:0))).__actions__.push({func:gu,args:[o],thisArg:t}),new Xe(i,this.__chain__).thru((function(n){return e&&!n.length&&n.push(t),n}))):this.thru(o)})),_u=Ti((function(t,n,e){Pt.call(t,e)?++t[e]:or(t,e,1)})),mu=Li(qo),wu=Li(Wo);function bu(t,n){return(Wu(t)?On:lr)(t,ao(n,3))}function xu(t,n){return(Wu(t)?Mn:dr)(t,ao(n,3))}var Eu=Ti((function(t,n,e){Pt.call(t,e)?t[e].push(n):or(t,e,[n])})),ju=Hr((function(t,n,e){var r=-1,i="function"==typeof n,o=Zu(t)?xt(t.length):[];return lr(t,(function(t){o[++r]=i?jn(n,t,e):Cr(t,n,e)})),o})),Au=Ti((function(t,n,e){or(t,e,n)}));function Ou(t,n){return(Wu(t)?In:Fr)(t,ao(n,3))}var Mu=Ti((function(t,n,e){t[e?0:1].push(n)}),(function(){return[[],[]]})),Su=Hr((function(t,n){if(null==t)return[];var e=n.length;return e>1&&wo(t,n[0],n[1])?n=[]:e>2&&wo(n[0],n[1],n[2])&&(n=[n[0]]),Yr(t,yr(n,1),[])})),ku=pn||function(){return ln.Date.now()};function Cu(n,e,r){return e=r?t:e,e=n&&null==e?n.length:e,Qi(n,s,t,t,t,t,e)}function Tu(e,r){var i;if("function"!=typeof r)throw new Ct(n);return e=ys(e),function(){return--e>0&&(i=r.apply(this,arguments)),e<=1&&(r=t),i}}var Iu=Hr((function(t,n,e){var r=1;if(e.length){var i=se(e,so(Iu));r|=o}return Qi(t,r,n,e,i)})),Nu=Hr((function(t,n,e){var r=3;if(e.length){var i=se(e,so(Nu));r|=o}return Qi(n,r,t,e,i)}));function Ru(e,r,i){var o,u,s,a,c,h,f=0,l=!1,d=!1,p=!0;if("function"!=typeof e)throw new Ct(n);function v(n){var r=o,i=u;return o=u=t,f=n,a=e.apply(i,r)}function g(n){var e=n-h;return h===t||e>=r||e<0||d&&n-f>=s}function y(){var t=ku();if(g(t))return _(t);c=To(y,function(t){var n=r-(t-h);return d?me(n,s-(t-f)):n}(t))}function _(n){return c=t,p&&o?v(n):(o=u=t,a)}function m(){var n=ku(),e=g(n);if(o=arguments,u=this,h=n,e){if(c===t)return function(t){return f=t,c=To(y,r),l?v(t):a}(h);if(d)return xi(c),c=To(y,r),v(h)}return c===t&&(c=To(y,r)),a}return r=ms(r)||0,rs(i)&&(l=!!i.leading,s=(d="maxWait"in i)?_e(ms(i.maxWait)||0,r):s,p="trailing"in i?!!i.trailing:p),m.cancel=function(){c!==t&&xi(c),f=0,o=h=u=c=t},m.flush=function(){return c===t?a:_(ku())},m}var zu=Hr((function(t,n){return hr(t,1,n)})),Pu=Hr((function(t,n,e){return hr(t,ms(n)||0,e)}));function Du(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Ct(n);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var u=t.apply(this,n);return r.cache=o.set(i,u)||o,u};return r.cache=new(Du.Cache||We),r}function Lu(t){if("function"!=typeof t)throw new Ct(n);return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}Du.Cache=We;var Fu=wi((function(t,n){var e=(n=1==n.length&&Wu(n[0])?In(n[0],Hn(ao())):In(yr(n,1),Hn(ao()))).length;return Hr((function(r){for(var i=-1,o=me(r.length,e);++i=n})),qu=Tr(function(){return arguments}())?Tr:function(t){return is(t)&&Pt.call(t,"callee")&&!Zt.call(t,"callee")},Wu=xt.isArray,Gu=_n?Hn(_n):function(t){return is(t)&&Ar(t)==C};function Zu(t){return null!=t&&es(t.length)&&!ts(t)}function Hu(t){return is(t)&&Zu(t)}var Qu=pe||ma,Ju=mn?Hn(mn):function(t){return is(t)&&Ar(t)==y};function Ku(t){if(!is(t))return!1;var n=Ar(t);return n==_||"[object DOMException]"==n||"string"==typeof t.message&&"string"==typeof t.name&&!ss(t)}function ts(t){if(!rs(t))return!1;var n=Ar(t);return n==m||n==w||"[object AsyncFunction]"==n||"[object Proxy]"==n}function ns(t){return"number"==typeof t&&t==ys(t)}function es(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function rs(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}function is(t){return null!=t&&"object"==typeof t}var os=wn?Hn(wn):function(t){return is(t)&&vo(t)==b};function us(t){return"number"==typeof t||is(t)&&Ar(t)==x}function ss(t){if(!is(t)||Ar(t)!=E)return!1;var n=Wt(t);if(null===n)return!0;var e=Pt.call(n,"constructor")&&n.constructor;return"function"==typeof e&&e instanceof e&&zt.call(e)==Bt}var as=bn?Hn(bn):function(t){return is(t)&&Ar(t)==A},cs=xn?Hn(xn):function(t){return is(t)&&vo(t)==O};function hs(t){return"string"==typeof t||!Wu(t)&&is(t)&&Ar(t)==M}function fs(t){return"symbol"==typeof t||is(t)&&Ar(t)==S}var ls=En?Hn(En):function(t){return is(t)&&es(t.length)&&!!on[Ar(t)]},ds=qi(Lr),ps=qi((function(t,n){return t<=n}));function vs(t){if(!t)return[];if(Zu(t))return hs(t)?he(t):ki(t);if(sn&&t[sn])return function(t){for(var n,e=[];!(n=t.next()).done;)e.push(n.value);return e}(t[sn]());var n=vo(t);return(n==b?oe:n==O?ae:Xs)(t)}function gs(t){return t?(t=ms(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ys(t){var n=gs(t),e=n%1;return n==n?e?n-e:n:0}function _s(t){return t?sr(ys(t),0,l):0}function ms(t){if("number"==typeof t)return t;if(fs(t))return f;if(rs(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=rs(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=Zn(t);var e=dt.test(t);return e||vt.test(t)?cn(t.slice(2),e?2:8):lt.test(t)?f:+t}function ws(t){return Ci(t,zs(t))}function bs(t){return null==t?"":ci(t)}var xs=Ii((function(t,n){if(jo(n)||Zu(n))Ci(n,Rs(n),t);else for(var e in n)Pt.call(n,e)&&nr(t,e,n[e])})),Es=Ii((function(t,n){Ci(n,zs(n),t)})),js=Ii((function(t,n,e,r){Ci(n,zs(n),t,r)})),As=Ii((function(t,n,e,r){Ci(n,Rs(n),t,r)})),Os=eo(ur),Ms=Hr((function(n,e){n=Mt(n);var r=-1,i=e.length,o=i>2?e[2]:t;for(o&&wo(e[0],e[1],o)&&(i=1);++r1),n})),Ci(t,io(t),e),r&&(e=ar(e,7,to));for(var i=n.length;i--;)fi(e,n[i]);return e})),Fs=eo((function(t,n){return null==t?{}:function(t,n){return Ur(t,n,(function(n,e){return Cs(t,e)}))}(t,n)}));function Bs(t,n){if(null==t)return{};var e=In(io(t),(function(t){return[t]}));return n=ao(n),Ur(t,e,(function(t,e){return n(t,e[0])}))}var $s=Hi(Rs),Vs=Hi(zs);function Xs(t){return null==t?[]:Qn(t,Rs(t))}var Ys=Pi((function(t,n,e){return n=n.toLowerCase(),t+(e?Us(n):n)}));function Us(t){return Ks(bs(t).toLowerCase())}function qs(t){return(t=bs(t))&&t.replace(yt,ne).replace(Qt,"")}var Ws=Pi((function(t,n,e){return t+(e?"-":"")+n.toLowerCase()})),Gs=Pi((function(t,n,e){return t+(e?" ":"")+n.toLowerCase()})),Zs=zi("toLowerCase"),Hs=Pi((function(t,n,e){return t+(e?"_":"")+n.toLowerCase()})),Qs=Pi((function(t,n,e){return t+(e?" ":"")+Ks(n)})),Js=Pi((function(t,n,e){return t+(e?" ":"")+n.toUpperCase()})),Ks=zi("toUpperCase");function ta(n,e,r){return n=bs(n),(e=r?t:e)===t?function(t){return nn.test(t)}(n)?function(t){return t.match(Kt)||[]}(n):function(t){return t.match(st)||[]}(n):n.match(e)||[]}var na=Hr((function(n,e){try{return jn(n,t,e)}catch(Bl){return Ku(Bl)?Bl:new jt(Bl)}})),ea=eo((function(t,n){return On(n,(function(n){n=Bo(n),or(t,n,Iu(t[n],t))})),t}));function ra(t){return function(){return t}}var ia=Fi(),oa=Fi(!0);function ua(t){return t}function sa(t){return zr("function"==typeof t?t:ar(t,1))}var aa=Hr((function(t,n){return function(e){return Cr(e,t,n)}})),ca=Hr((function(t,n){return function(e){return Cr(t,e,n)}}));function ha(t,n,e){var r=Rs(n),i=xr(n,r);null!=e||rs(n)&&(i.length||!r.length)||(e=n,n=t,t=this,i=xr(n,Rs(n)));var o=!(rs(e)&&"chain"in e&&!e.chain),u=ts(t);return On(i,(function(e){var r=n[e];t[e]=r,u&&(t.prototype[e]=function(){var n=this.__chain__;if(o||n){var e=t(this.__wrapped__);return(e.__actions__=ki(this.__actions__)).push({func:r,args:arguments,thisArg:t}),e.__chain__=n,e}return r.apply(t,Nn([this.value()],arguments))})})),t}function fa(){}var la=Xi(In),da=Xi(Sn),pa=Xi(Pn);function va(t){return bo(t)?Yn(Bo(t)):function(t){return function(n){return Er(n,t)}}(t)}var ga=Ui(),ya=Ui(!0);function _a(){return[]}function ma(){return!1}var wa,ba=Vi((function(t,n){return t+n}),0),xa=Gi("ceil"),Ea=Vi((function(t,n){return t/n}),1),ja=Gi("floor"),Aa=Vi((function(t,n){return t*n}),1),Oa=Gi("round"),Ma=Vi((function(t,n){return t-n}),0);return Be.after=function(t,e){if("function"!=typeof e)throw new Ct(n);return t=ys(t),function(){if(--t<1)return e.apply(this,arguments)}},Be.ary=Cu,Be.assign=xs,Be.assignIn=Es,Be.assignInWith=js,Be.assignWith=As,Be.at=Os,Be.before=Tu,Be.bind=Iu,Be.bindAll=ea,Be.bindKey=Nu,Be.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Wu(t)?t:[t]},Be.chain=vu,Be.chunk=function(n,e,r){e=(r?wo(n,e,r):e===t)?1:_e(ys(e),0);var i=null==n?0:n.length;if(!i||e<1)return[];for(var o=0,u=0,s=xt(yn(i/e));oo?0:o+r),(i=i===t||i>o?o:ys(i))<0&&(i+=o),i=r>i?0:_s(i);r>>0)?(n=bs(n))&&("string"==typeof e||null!=e&&!as(e))&&!(e=ci(e))&&ie(n)?bi(he(n),0,r):n.split(e,r):[]},Be.spread=function(t,e){if("function"!=typeof t)throw new Ct(n);return e=null==e?0:_e(ys(e),0),Hr((function(n){var r=n[e],i=bi(n,0,e);return r&&Nn(i,r),jn(t,this,i)}))},Be.tail=function(t){var n=null==t?0:t.length;return n?ri(t,1,n):[]},Be.take=function(n,e,r){return n&&n.length?ri(n,0,(e=r||e===t?1:ys(e))<0?0:e):[]},Be.takeRight=function(n,e,r){var i=null==n?0:n.length;return i?ri(n,(e=i-(e=r||e===t?1:ys(e)))<0?0:e,i):[]},Be.takeRightWhile=function(t,n){return t&&t.length?di(t,ao(n,3),!1,!0):[]},Be.takeWhile=function(t,n){return t&&t.length?di(t,ao(n,3)):[]},Be.tap=function(t,n){return n(t),t},Be.throttle=function(t,e,r){var i=!0,o=!0;if("function"!=typeof t)throw new Ct(n);return rs(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Ru(t,e,{leading:i,maxWait:e,trailing:o})},Be.thru=gu,Be.toArray=vs,Be.toPairs=$s,Be.toPairsIn=Vs,Be.toPath=function(t){return Wu(t)?In(t,Bo):fs(t)?[t]:ki(Fo(bs(t)))},Be.toPlainObject=ws,Be.transform=function(t,n,e){var r=Wu(t),i=r||Qu(t)||ls(t);if(n=ao(n,4),null==e){var o=t&&t.constructor;e=i?r?new o:[]:rs(t)&&ts(o)?$e(Wt(t)):{}}return(i?On:wr)(t,(function(t,r,i){return n(e,t,r,i)})),e},Be.unary=function(t){return Cu(t,1)},Be.union=iu,Be.unionBy=ou,Be.unionWith=uu,Be.uniq=function(t){return t&&t.length?hi(t):[]},Be.uniqBy=function(t,n){return t&&t.length?hi(t,ao(n,2)):[]},Be.uniqWith=function(n,e){return e="function"==typeof e?e:t,n&&n.length?hi(n,t,e):[]},Be.unset=function(t,n){return null==t||fi(t,n)},Be.unzip=su,Be.unzipWith=au,Be.update=function(t,n,e){return null==t?t:li(t,n,_i(e))},Be.updateWith=function(n,e,r,i){return i="function"==typeof i?i:t,null==n?n:li(n,e,_i(r),i)},Be.values=Xs,Be.valuesIn=function(t){return null==t?[]:Qn(t,zs(t))},Be.without=cu,Be.words=ta,Be.wrap=function(t,n){return Bu(_i(n),t)},Be.xor=hu,Be.xorBy=fu,Be.xorWith=lu,Be.zip=du,Be.zipObject=function(t,n){return gi(t||[],n||[],nr)},Be.zipObjectDeep=function(t,n){return gi(t||[],n||[],Kr)},Be.zipWith=pu,Be.entries=$s,Be.entriesIn=Vs,Be.extend=Es,Be.extendWith=js,ha(Be,Be),Be.add=ba,Be.attempt=na,Be.camelCase=Ys,Be.capitalize=Us,Be.ceil=xa,Be.clamp=function(n,e,r){return r===t&&(r=e,e=t),r!==t&&(r=(r=ms(r))==r?r:0),e!==t&&(e=(e=ms(e))==e?e:0),sr(ms(n),e,r)},Be.clone=function(t){return ar(t,4)},Be.cloneDeep=function(t){return ar(t,5)},Be.cloneDeepWith=function(n,e){return ar(n,5,e="function"==typeof e?e:t)},Be.cloneWith=function(n,e){return ar(n,4,e="function"==typeof e?e:t)},Be.conformsTo=function(t,n){return null==n||cr(t,n,Rs(n))},Be.deburr=qs,Be.defaultTo=function(t,n){return null==t||t!=t?n:t},Be.divide=Ea,Be.endsWith=function(n,e,r){n=bs(n),e=ci(e);var i=n.length,o=r=r===t?i:sr(ys(r),0,i);return(r-=e.length)>=0&&n.slice(r,o)==e},Be.eq=Xu,Be.escape=function(t){return(t=bs(t))&&W.test(t)?t.replace(U,ee):t},Be.escapeRegExp=function(t){return(t=bs(t))&&nt.test(t)?t.replace(tt,"\\$&"):t},Be.every=function(n,e,r){var i=Wu(n)?Sn:pr;return r&&wo(n,e,r)&&(e=t),i(n,ao(e,3))},Be.find=mu,Be.findIndex=qo,Be.findKey=function(t,n){return Ln(t,ao(n,3),wr)},Be.findLast=wu,Be.findLastIndex=Wo,Be.findLastKey=function(t,n){return Ln(t,ao(n,3),br)},Be.floor=ja,Be.forEach=bu,Be.forEachRight=xu,Be.forIn=function(t,n){return null==t?t:_r(t,ao(n,3),zs)},Be.forInRight=function(t,n){return null==t?t:mr(t,ao(n,3),zs)},Be.forOwn=function(t,n){return t&&wr(t,ao(n,3))},Be.forOwnRight=function(t,n){return t&&br(t,ao(n,3))},Be.get=ks,Be.gt=Yu,Be.gte=Uu,Be.has=function(t,n){return null!=t&&go(t,n,Mr)},Be.hasIn=Cs,Be.head=Zo,Be.identity=ua,Be.includes=function(t,n,e,r){t=Zu(t)?t:Xs(t),e=e&&!r?ys(e):0;var i=t.length;return e<0&&(e=_e(i+e,0)),hs(t)?e<=i&&t.indexOf(n,e)>-1:!!i&&Bn(t,n,e)>-1},Be.indexOf=function(t,n,e){var r=null==t?0:t.length;if(!r)return-1;var i=null==e?0:ys(e);return i<0&&(i=_e(r+i,0)),Bn(t,n,i)},Be.inRange=function(n,e,r){return e=gs(e),r===t?(r=e,e=0):r=gs(r),function(t,n,e){return t>=me(n,e)&&t<_e(n,e)}(n=ms(n),e,r)},Be.invoke=Ns,Be.isArguments=qu,Be.isArray=Wu,Be.isArrayBuffer=Gu,Be.isArrayLike=Zu,Be.isArrayLikeObject=Hu,Be.isBoolean=function(t){return!0===t||!1===t||is(t)&&Ar(t)==g},Be.isBuffer=Qu,Be.isDate=Ju,Be.isElement=function(t){return is(t)&&1===t.nodeType&&!ss(t)},Be.isEmpty=function(t){if(null==t)return!0;if(Zu(t)&&(Wu(t)||"string"==typeof t||"function"==typeof t.splice||Qu(t)||ls(t)||qu(t)))return!t.length;var n=vo(t);if(n==b||n==O)return!t.size;if(jo(t))return!Pr(t).length;for(var e in t)if(Pt.call(t,e))return!1;return!0},Be.isEqual=function(t,n){return Ir(t,n)},Be.isEqualWith=function(n,e,r){var i=(r="function"==typeof r?r:t)?r(n,e):t;return i===t?Ir(n,e,t,r):!!i},Be.isError=Ku,Be.isFinite=function(t){return"number"==typeof t&&ve(t)},Be.isFunction=ts,Be.isInteger=ns,Be.isLength=es,Be.isMap=os,Be.isMatch=function(t,n){return t===n||Nr(t,n,ho(n))},Be.isMatchWith=function(n,e,r){return r="function"==typeof r?r:t,Nr(n,e,ho(e),r)},Be.isNaN=function(t){return us(t)&&t!=+t},Be.isNative=function(t){if(Eo(t))throw new jt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Rr(t)},Be.isNil=function(t){return null==t},Be.isNull=function(t){return null===t},Be.isNumber=us,Be.isObject=rs,Be.isObjectLike=is,Be.isPlainObject=ss,Be.isRegExp=as,Be.isSafeInteger=function(t){return ns(t)&&t>=-9007199254740991&&t<=h},Be.isSet=cs,Be.isString=hs,Be.isSymbol=fs,Be.isTypedArray=ls,Be.isUndefined=function(n){return n===t},Be.isWeakMap=function(t){return is(t)&&vo(t)==k},Be.isWeakSet=function(t){return is(t)&&"[object WeakSet]"==Ar(t)},Be.join=function(t,n){return null==t?"":ge.call(t,n)},Be.kebabCase=Ws,Be.last=Ko,Be.lastIndexOf=function(n,e,r){var i=null==n?0:n.length;if(!i)return-1;var o=i;return r!==t&&(o=(o=ys(r))<0?_e(i+o,0):me(o,i-1)),e==e?function(t,n,e){for(var r=e+1;r--;)if(t[r]===n)return r;return r}(n,e,o):Fn(n,Vn,o,!0)},Be.lowerCase=Gs,Be.lowerFirst=Zs,Be.lt=ds,Be.lte=ps,Be.max=function(n){return n&&n.length?vr(n,ua,Or):t},Be.maxBy=function(n,e){return n&&n.length?vr(n,ao(e,2),Or):t},Be.mean=function(t){return Xn(t,ua)},Be.meanBy=function(t,n){return Xn(t,ao(n,2))},Be.min=function(n){return n&&n.length?vr(n,ua,Lr):t},Be.minBy=function(n,e){return n&&n.length?vr(n,ao(e,2),Lr):t},Be.stubArray=_a,Be.stubFalse=ma,Be.stubObject=function(){return{}},Be.stubString=function(){return""},Be.stubTrue=function(){return!0},Be.multiply=Aa,Be.nth=function(n,e){return n&&n.length?Xr(n,ys(e)):t},Be.noConflict=function(){return ln._===this&&(ln._=$t),this},Be.noop=fa,Be.now=ku,Be.pad=function(t,n,e){t=bs(t);var r=(n=ys(n))?ce(t):0;if(!n||r>=n)return t;var i=(n-r)/2;return Yi(Dn(i),e)+t+Yi(yn(i),e)},Be.padEnd=function(t,n,e){t=bs(t);var r=(n=ys(n))?ce(t):0;return n&&re){var i=n;n=e,e=i}if(r||n%1||e%1){var o=xe();return me(n+o*(e-n+an("1e-"+((o+"").length-1))),e)}return Gr(n,e)},Be.reduce=function(t,n,e){var r=Wu(t)?Rn:qn,i=arguments.length<3;return r(t,ao(n,4),e,i,lr)},Be.reduceRight=function(t,n,e){var r=Wu(t)?zn:qn,i=arguments.length<3;return r(t,ao(n,4),e,i,dr)},Be.repeat=function(n,e,r){return e=(r?wo(n,e,r):e===t)?1:ys(e),Zr(bs(n),e)},Be.replace=function(){var t=arguments,n=bs(t[0]);return t.length<3?n:n.replace(t[1],t[2])},Be.result=function(n,e,r){var i=-1,o=(e=mi(e,n)).length;for(o||(o=1,n=t);++ih)return[];var e=l,r=me(t,l);n=ao(n),t-=l;for(var i=Gn(r,n);++e=u)return n;var a=r-ce(i);if(a<1)return i;var c=s?bi(s,0,a).join(""):n.slice(0,a);if(o===t)return c+i;if(s&&(a+=c.length-a),as(o)){if(n.slice(a).search(o)){var h,f=c;for(o.global||(o=St(o.source,bs(ft.exec(o))+"g")),o.lastIndex=0;h=o.exec(f);)var l=h.index;c=c.slice(0,l===t?a:l)}}else if(n.indexOf(ci(o),a)!=a){var d=c.lastIndexOf(o);d>-1&&(c=c.slice(0,d))}return c+i},Be.unescape=function(t){return(t=bs(t))&&q.test(t)?t.replace(Y,le):t},Be.uniqueId=function(t){var n=++Dt;return bs(t)+n},Be.upperCase=Js,Be.upperFirst=Ks,Be.each=bu,Be.eachRight=xu,Be.first=Zo,ha(Be,(wa={},wr(Be,(function(t,n){Pt.call(Be.prototype,n)||(wa[n]=t)})),wa),{chain:!1}),Be.VERSION="4.17.21",On(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Be[t].placeholder=Be})),On(["drop","take"],(function(n,e){Ye.prototype[n]=function(r){r=r===t?1:_e(ys(r),0);var i=this.__filtered__&&!e?new Ye(this):this.clone();return i.__filtered__?i.__takeCount__=me(r,i.__takeCount__):i.__views__.push({size:me(r,l),type:n+(i.__dir__<0?"Right":"")}),i},Ye.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}})),On(["filter","map","takeWhile"],(function(t,n){var e=n+1,r=1==e||3==e;Ye.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({iteratee:ao(t,3),type:e}),n.__filtered__=n.__filtered__||r,n}})),On(["head","last"],(function(t,n){var e="take"+(n?"Right":"");Ye.prototype[t]=function(){return this[e](1).value()[0]}})),On(["initial","tail"],(function(t,n){var e="drop"+(n?"":"Right");Ye.prototype[t]=function(){return this.__filtered__?new Ye(this):this[e](1)}})),Ye.prototype.compact=function(){return this.filter(ua)},Ye.prototype.find=function(t){return this.filter(t).head()},Ye.prototype.findLast=function(t){return this.reverse().find(t)},Ye.prototype.invokeMap=Hr((function(t,n){return"function"==typeof t?new Ye(this):this.map((function(e){return Cr(e,t,n)}))})),Ye.prototype.reject=function(t){return this.filter(Lu(ao(t)))},Ye.prototype.slice=function(n,e){n=ys(n);var r=this;return r.__filtered__&&(n>0||e<0)?new Ye(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),e!==t&&(r=(e=ys(e))<0?r.dropRight(-e):r.take(e-n)),r)},Ye.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Ye.prototype.toArray=function(){return this.take(l)},wr(Ye.prototype,(function(n,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Be[i?"take"+("last"==e?"Right":""):e],u=i||/^find/.test(e);o&&(Be.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,a=e instanceof Ye,c=s[0],h=a||Wu(e),f=function(t){var n=o.apply(Be,Nn([t],s));return i&&l?n[0]:n};h&&r&&"function"==typeof c&&1!=c.length&&(a=h=!1);var l=this.__chain__,d=!!this.__actions__.length,p=u&&!l,v=a&&!d;if(!u&&h){e=v?e:new Ye(this);var g=n.apply(e,s);return g.__actions__.push({func:gu,args:[f],thisArg:t}),new Xe(g,l)}return p&&v?n.apply(this,s):(g=this.thru(f),p?i?g.value()[0]:g.value():g)})})),On(["pop","push","shift","sort","splice","unshift"],(function(t){var n=Tt[t],e=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Be.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return n.apply(Wu(i)?i:[],t)}return this[e]((function(e){return n.apply(Wu(e)?e:[],t)}))}})),wr(Ye.prototype,(function(t,n){var e=Be[n];if(e){var r=e.name+"";Pt.call(Te,r)||(Te[r]=[]),Te[r].push({name:n,func:e})}})),Te[Bi(t,2).name]=[{name:"wrapper",func:t}],Ye.prototype.clone=function(){var t=new Ye(this.__wrapped__);return t.__actions__=ki(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ki(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ki(this.__views__),t},Ye.prototype.reverse=function(){if(this.__filtered__){var t=new Ye(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Ye.prototype.value=function(){var t=this.__wrapped__.value(),n=this.__dir__,e=Wu(t),r=n<0,i=e?t.length:0,o=function(t,n,e){for(var r=-1,i=e.length;++r=this.__values__.length;return{done:n,value:n?t:this.__values__[this.__index__++]}},Be.prototype.plant=function(n){for(var e,r=this;r instanceof Ve;){var i=Vo(r);i.__index__=0,i.__values__=t,e?o.__wrapped__=i:e=i;var o=i;r=r.__wrapped__}return o.__wrapped__=n,e},Be.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof Ye){var e=n;return this.__actions__.length&&(e=new Ye(this)),(e=e.reverse()).__actions__.push({func:gu,args:[ru],thisArg:t}),new Xe(e,this.__chain__)}return this.thru(ru)},Be.prototype.toJSON=Be.prototype.valueOf=Be.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Be.prototype.first=Be.prototype.head,sn&&(Be.prototype[sn]=function(){return this}),Be}();pn?((pn.exports=de)._=de,dn._=de):ln._=de}.call(ni);var tl=Kf.exports;function nl(t,n){const e=function(t,n){const e=new Set,r=new Hf.Graph({directed:!0}),i=[];if(!t.hasNode(n))throw Error("node not in graph");return el(t,n,e,r,i),t.nodes().forEach((n=>{e.has(n)||el(t,n,e,r,i)})),i.forEach(((t,n)=>{r.node(t).thread=n+1{const r=function(t,n,e){const r=t.node(n),i=t.node(e);if(r.depthr.depth;){if(n===e)return 1;n=t.node(n).thread}}else if(i.depthi.depth;){if(e===n)return-1;e=t.node(e).thread}}return 0}(e,n.v,n.w);if(r<0){const e=t.edge(n)||{};e.reversed=!0,t.removeEdge(n),t.setEdge(n.w,n.v,e)}})),t}function el(t,n,e,r,i,o=0){if(!e.has(n)){e.add(n),i.push(n),r.setNode(n,{depth:o});t.outEdges(n).map((t=>t.w)).forEach((u=>{e.has(u)||r.setEdge(n,u,{delta:1}),el(t,u,e,r,i,o+1)}))}}var rl=function(){for(var t=0;t0?[{type:"min",nodes:[e[0]]},...n]:[{type:"min",nodes:[t.nodes()[0]]},...n]}const i=new Map;let o=0;return n.forEach((t=>{if(!t.nodes||0===t.nodes.length)return;const n=""+o++;t.nodes.forEach((t=>{i.set(t,n)})),e.setNode(n,{type:t.type,nodes:t.nodes})})),t.nodes().forEach((t=>{if(!i.has(t)){const n=""+o++,r={type:"same",nodes:[t]};i.set(t,n),e.setNode(n,r)}})),t.edges().forEach((n=>{const r=i.has(n.v)?i.get(n.v):n.v,o=i.has(n.w)?i.get(n.w):n.w,u=t.node(n.v)||{},s=t.node(n.w)||{},a=e.edge(r,o)||{delta:0};r===o?(a.delta=0,e.setEdge(r,o,a)):"l"===u.direction?(a.delta=Math.max(a.delta,"l"===s.direction?1:0),e.setEdge(o,r,a)):(a.delta=Math.max(a.delta,"l"===s.direction?0:1),e.setEdge(r,o,a))})),e}(t,n);!function(t){t.sources().forEach((n=>{"0"!==n&&t.setEdge("0",n,{temp:!0,delta:0})}))}(e),nl(e,"0"),function(t){const n=t.sources(),e=new Set,r=new Set;for(t.edges().forEach((t=>{t.v===t.w&&r.add(t)}));n.length>0;){const i=n.shift();e.add(i);let o=t.node(i);o||t.setNode(i,o={}),o.rank=0;for(const n of t.inEdges(i)){const e=il((t.edge(n)||{}).delta,1);o.rank=Math.max(o.rank,t.node(n.v).rank+e)}for(const n of t.outEdges(i))r.add(n);for(const u of t.nodes())n.indexOf(u)<0&&!e.has(u)&&!t.inEdges(u).some((t=>!r.has(t)))&&n.push(u)}}(e),function(t){function n(n){const e=t.node(n),r=tl.min(t.outEdges(n).map((n=>t.node(n.w).rank-t.edge(n).delta)));void 0!==r&&(e.rank=r)}t.edges().forEach((e=>{t.edge(e).temp&&n(e.w)}))}(e),t.nodes().forEach((n=>{t.node(n)||t.setNode(n,{})})),e.nodes().forEach((n=>{const r=e.node(n);r.nodes.forEach((n=>{t.node(n).rank=r.rank}))}))}function ul(t,n,e){return function(t,n,e){let r,i,o;n.length>e.length?(r=n,i=e):(r=e,i=n);const u=[];r.forEach((n=>{i.forEach(((e,r)=>{(t.hasEdge(n,e)||t.hasEdge(e,n))&&u.push(r)}))}));let s=1;for(;s{let n=t+s;for(c[n]++;n>0;)n%2&&(h+=c[n+1]),n=Math.floor((n-1)/2),c[n]++})),h}(t,n,e)}function sl(t,n){let e=!0;for(;e;){e=!1;for(let r=0;r0&&(r+=ul(t,n[e-1],n[e])),e+10)for(let i=1;i{const u=hl(ll(t,n,i,i-1,o,r));e.set(o,u)})),dl(n[i],e)}else for(let i=n.length-2;i>=0;--i){const e=new Map;n[i].forEach((o=>{const u=hl(ll(t,n,i,i+1,o,r));e.set(o,u)})),dl(n[i],e)}}function ll(t,n,e,r,i,o=!1){const u=n[e],s=n[r],a=[];return s.forEach(((n,e)=>{t.nodeEdges(n,i).length>0&&a.push(e)})),0===a.length&&o&&u.forEach(((n,e)=>{t.nodeEdges(n,i).length>0&&a.push(e+.5)})),a.sort(((t,n)=>t-n)),a}function dl(t,n){const e=new Map(t.map(((t,n)=>[t,n])));for(let r=1;r0;--i){let r=i-1,o=n.get(t[r]),u=n.get(t[i]);for(;-1===(o=n.get(t[r]))&&r>0;)r--;if(-1===u||-1===o)break;if(o===u&&(o=e.get(t[r]),u=e.get(t[i])),u>=o)break;[t[i],t[r]]=[t[r],t[i]]}}function pl(t,n=25){const e=function(t){const n=[];let e=t.nodes().filter((n=>0===t.node(n).rank)).concat(t.sources());return 0===e.length&&(e=t.nodes().slice(0,1)),Hf.alg.preorder(t,e).forEach((e=>{const r=t.node(e).rank;for(;r>=n.length;)n.push([]);n[r].push(e)})),n}(t);let r=e,i=0;for(;i++[t])),r}function vl(t,n){let e=0;for(let r=0;r{const i=`__${n.v}_${n.w}_${e}`;return t.setNode(i,{rank:e,dummy:!0,data:null,direction:r}),i})),o=[n.v,...i,n.w];o.forEach(((e,r)=>{r+1{const r=t.node(n);r.dy=r.value*e})),t.edges().forEach((r=>{const i=t.edge(r);i.value=n(i),i.dy=i.value*e}))}(s,i,n);const c=wl(s,a);a.forEach((n=>{let i=0;n.forEach(((n,o)=>{const u=c[o]/tl.sumBy(c)*t[1],a=0===i?0:e*u/5,h=u-2*a,f=tl.sumBy(n,(t=>s.node(t).dy)),l=n.map(((t,e)=>s.node(t).value&&n[e+1]?r(n[e],n[e+1],s):0)),d=Math.max(0,h-f),p=tl.sumBy(l)?d/tl.sumBy(l):0;let v=i+a;1===n.length&&(v+=(h-s.node(n[0]).dy)/2);let g=Number.MAX_VALUE;n.forEach(((t,n)=>{const e=s.node(t);e.y=v,e.spaceAbove=g,e.spaceBelow=l[n]*p,v+=e.dy+e.spaceBelow,g=e.spaceBelow,e.data&&void 0!==e.data.forceY&&(e.y=a+e.data.forceY*(h-e.dy))})),n.length>0&&(s.node(n[n.length-1]).spaceBelow=Number.MAX_VALUE),i+=u}))}));const h=function(t,n){const e=[];return n.forEach(((r,i)=>{if(i===n.length-1)return;let o=0;r.forEach((n=>{n.forEach((n=>{t.outEdges(n).forEach((n=>{const e=t.edge(n).dy,r=t.node(n.w).y-t.node(n.v).y,i=Math.abs(r)-e,u=e*e-i*i,s=u>=0?Math.sqrt(u):e;s>o&&(o=s)}))}))})),e.push(o)})),e}(s,a);!function(t,n,e,r){const i=tl.sumBy(r);let o;if(i>e)o=r.map((t=>e*t/i));else{const t=e-i;o=r.map((e=>e+t/(n.length-1)))}let u=0;n.forEach(((n,e)=>{n.forEach((n=>{n.forEach((n=>{t.node(n).x=u}))})),u+=o[e]}))}(s,a,t[0],h);const f=[];return s.nodes().forEach((t=>{const n=s.node(t);n.id=t,f.push(n)})),f}return u.scaleToFit=function(r,u){ml(r,i,o);const s=tl.sumBy(wl(r,u));s<=0?n=1:(n=t[1]/s,1!=e&&(n*=1-e))},u.size=function(n){return arguments.length?(t=n,u):t},u.separation=function(t){return arguments.length?(r=tl.isFunction(t)?t:()=>t,u):r},u.whitespace=function(t){return arguments.length?(e=t,u):e},u.scale=function(t){return arguments.length?(n=t,u):n},u}function ml(t,n,e){t.nodes().forEach((r=>{const i=tl.sumBy(t.inEdges(r),(e=>n(t.edge(e)))),o=tl.sumBy(t.outEdges(r),(e=>n(t.edge(e))));let u=t.node(r);u||t.setNode(r,u={}),u.value=Math.max(i,o),void 0===u.direction&&(u.direction=e(u)||"r")}))}function wl(t,n){if(0===n.length||0===n[0].length)return[];const e=n[0].length,r=new Array(e);for(let i=0;i{n.forEach(((n,e)=>{const i=tl.sumBy(n,(n=>t.node(n).value));r[e]=Math.max(r[e],i)}))})),r}function bl(t,n){const e=t.inEdges(n),r=t.outEdges(n),i=new Map;[...e,...r].forEach((t=>{i.has(t.name)||i.set(t.name,[]),i.get(t.name).push(t)}));const o=new Map(Array.from(i.entries()).map((([e,r])=>{const i=tl.sumBy(r,(n=>t.edge(n).value));return[e,tl.sumBy(r,(e=>t.edge(e).value*function(e){if(e.v===n)return t.node(e.w).y;if(e.w===n)return t.node(e.v).y;throw new Error}(e)))/i]}))),u=Array.from(o.keys());return u.sort(),u}function xl(t,n){if(null===n.w)return 0;if(null===n.v)return 0;if(n.w===n.v)return Math.PI/2;{const e=t.node(n.v),r=t.node(n.w);return Math.atan2(r.y-e.y,r.x-e.x)}}function El(t,n=!0){return function(e,r){const i=xl(t,e),o=xl(t,r),u=n?1:-1;return e.v===r.v&&e.w===r.w?"number"==typeof e.name&&"number"==typeof r.name?e.name-r.name:"string"==typeof e.name&&"string"==typeof r.name?e.name.localeCompare(r.name):0:Math.abs(i-o)<.001?e.v&&e.w&&r.v&&r.w?e.w===r.w?-1*(t.node(e.v).y-t.node(r.v).y):e.v===r.v?-1*(t.node(e.w).y-t.node(r.w).y):0:0:u*(i-o)}}function jl(t,n,e=!0){return function(r,i){if(r.name!==i.name)return n.indexOf(r.name)-n.indexOf(i.name);const o=xl(t,r),u=xl(t,i),s=e?1:-1;return Math.abs(o-u)<.001?r.v&&r.w&&i.v&&i.w?r.w===i.w?s*(o>0?-1:1)*(t.node(r.v).y-t.node(i.v).y):r.v===i.v?s*(o>0?-1:1)*(t.node(r.w).y-t.node(i.w).y):0:0:s*(o-u)}}function Al(t,n){let e=null;for(let r=0;r=0;--o)e=t[o].dy/2,t[o][n]-ei&&(t[o][n]=Math.max(e,i-e)),i=t[o][n]-e}function Ml(t){return function(n){!function(t,n){t.nodes().forEach((e=>{const r=t.node(e);let i=0,o=0;r.outgoing.forEach((e=>{const o=t.edge(e);o.x0=r.x+n.nodeWidth/2,o.y0=r.y+i+o.dy/2,o.d0=r.direction||"r",i+=o.dy})),r.incoming.forEach((e=>{const i=t.edge(e);i.x1=r.x-n.nodeWidth/2,i.y1=r.y+o+i.dy/2,i.d1=r.direction||"r",o+=i.dy}))}))}(n,t),function(t){t.nodes().forEach((n=>{const e=t.node(n),r=e.outgoing.map((n=>t.edge(n))),i=e.incoming.map((n=>t.edge(n)));r.sort(((t,n)=>t.y0-n.y0)),i.sort(((t,n)=>t.y1-n.y1)),Sl(r,"r0"),Sl(i,"r1")}))}(n);const e=[];return n.edges().forEach((t=>{const r=n.edge(t);r.id=`${t.v}-${t.w}-${t.name}`,e.push(r)})),e}}function Sl(t,n){t.forEach((t=>{t.Rmax=function(t){const n=t.x1-t.x0,e=t.y1-t.y0;return t.d0!==t.d1?Math.abs(e)/2.1:0!==e?(n*n+e*e)/Math.abs(4*e):1/0}(t),t[n]=Math.max(t.dy/2,t.d0===t.d1?.6*t.Rmax:5+t.dy/2)}));let e=Al(t,"r0"===n?t=>t.y1>t.y0:t=>t.y0>t.y1);if(null===e&&(e=t.length),Ol(t.slice(e),n),e>0){const r=[];for(let n=e-1;n>=0;n--)r.push(t[n]);Ol(r,n)}}function kl(t){const n=_l(),e=Ml(t);let r=[],i=[],o=null;function u(t=[],u=[],s={}){const a=function(t=[],n=[]){const e=new Hf.Graph({directed:!0,multigraph:!0});return n.forEach((t=>{e.setEdge(t.source,t.target,{data:t},t.type)})),e.nodes().forEach((t=>e.setNode(t,{data:{}}))),t.forEach((t=>{e.hasNode(t.id)&&(e.node(t.id).data=t,void 0!==t.direction&&(e.node(t.id).direction=t.direction))})),e.edges().forEach((t=>{e.edge(t).source=e.node(t.v),e.edge(t).target=e.node(t.w)})),e}(u,t);var c;return s.order?(ol(a,s.rankSets||[]),o=s.order,o.length>0&&o[0].length>0&&!tl.isArray(o[0][0])&&(o=o.map((t=>[t]))),o=o.map((t=>t.map((t=>t.filter((t=>void 0!==a.node(t)))))))):(ol(a,s.rankSets||[]),(c=a).edges().forEach((t=>{const n=c.node(t.v),e=c.node(t.w);let r=n.rank;const i=[];if(r+1<=e.rank){for("l"===n.direction&&i.push(r);++re.rank){for("l"!==n.direction&&i.push(r);r-- >e.rank+1;)i.push(r);"l"!==e.direction&&i.push(r),yl(c,t,i,"l")}})),o=pl(a)),r=n(a,o),function(t,{alignLinkTypes:n=!1}={}){t.nodes().forEach((e=>{const r=t.node(e);if(r.incoming=t.inEdges(e),r.outgoing=t.outEdges(e),n){const n=bl(t,e);r.incoming.sort(jl(t,n,!1)),r.outgoing.sort(jl(t,n,!0))}else r.incoming.sort(El(t,!1)),r.outgoing.sort(El(t,!0))}))}(a,{alignLinkTypes:s.alignLinkTypes||!1}),i=e(a),a}return u.nodes=function(){return r},u.links=function(){return i},u.order=function(){return o},u.size=function(t){return arguments.length?(n.size(t),u):n.size()},u.separation=function(t){return arguments.length?(n.separation(t),u):n.separation()},u.whitespace=function(t){return arguments.length?(n.whitespace(t),u):n.whitespace()},u.edgeValue=function(t){return u},u.scale=function(t){return arguments.length?(n.scale(t),u):n.scale()},u}function Cl(t){const n=Math.max(0===t.dy?0:2,t.dy)/2;let e=t.x0,r=t.x1,i=t.y0,o=t.y1;ri?1:-1,s=function(t){const n=t.x1-t.x0,e=t.y1-t.y0;return[t.dy/2,(n*n+e*e)/Math.abs(4*e)]}(t),a=Math.max(s[0],Math.min(s[1],(r-e)/3));let c=Math.max(s[0],Math.min(s[1],t.r0||a)),h=Math.max(s[0],Math.min(s[1],t.r1||a));const f=r-e,l=o-i-u*(c+h),d=Math.sqrt(f*f+l*l),p=-u*Math.acos(Math.min(1,(c+h)/d)),v=Math.atan2(l,f);let g=Math.PI/2+u*(v+p),y=n*u*Math.sin(g),_=n*Math.cos(g),m=e+1*c*Math.sin(Math.abs(g)),w=r-1*h*Math.sin(Math.abs(g)),b=i+c*u*(1-Math.cos(g)),x=o-h*u*(1-Math.cos(g));function E(t,e){const r=t*(o-i)>0?1:0;let u=1*t*(o-i)>0?e+n:e-n;return 0===g&&(u=e),"A"+u+" "+u+" "+Math.abs(g)+" 0 "+r+" "}(isNaN(g)||Math.abs(g)<.001)&&(g=c=h=0,m=e,w=r,b=i,x=o,y=0,_=n);const j="M"+[e,i-n]+" "+E(1,c)+[m+y,b-_]+" L"+[w+y,x-_]+" "+E(-1,h)+[r,o-n]+" L"+[r,o+n]+" "+E(1,h)+[w-y,x+_]+" L"+[m-y,b+_]+" "+E(-1,c)+[e,i+n]+" Z";return/NaN/.test(j)&&console.error("path NaN",t,j),j}function Tl(t,n,e,r){const i=new Un;return i.attr({transform:void 0!==t&&void 0!==n?`translate(${t}, ${n})`:void 0,"data-self":e,"data-parent":r}),i}const Il=(t,n)=>{const e=void 0!==t.title?t.title:t.id;return n&&e.length>n?`${e.substr(0,15)}...`:e};function Nl(t,{fontColor:n,nodeWidth:e,maxRank:r}){const{data:i}=t,o=function(t,n){let e=!1,r=!1;return t.rank{"function"==typeof f&&f(t)})),d.add(p),t.data){const e=Nl(t,{fontColor:l,nodeWidth:a,maxRank:n});d.add(e)}return d}const zl=["#ACD5FC","#E37816","#07CC80","#0871D4","#CB8E55","#9FAE29","#427565","#6D55A6","#FEF445","#E177C2","#F48B7B","#D74B05","#AA896F","#14A14D","#C5114D"],Pl=(t="",n,e="")=>{const r=document.getElementById(t);n?null==r||r.setAttribute("style",n):null==r||r.removeAttribute("style"),(null==r?void 0:r.innerHTML.replaceAll("'",'"'))!==e.replaceAll("'",'"')&&r&&(r.innerHTML=e)},Dl=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((t,n)=>(n?"-":"")+t.toLowerCase()));class Ll extends te{constructor(t,n){super(t,n.width,n.height,n.canvasStyle,n.spacing),this.element=t,this.options=n}construct(t){const{width:n,height:e,spacing:r,nodeWidth:i}=this.options,o=kl({nodeWidth:i});o.size([n-i,e-r]);const u=t.nodes.map(((t,n)=>{const e=n%zl.length;return{...t,color:t.color??zl[e],colorIndex:e}})),s=o(t.edges,u,t.options);this.maxRank=o.order().length-1,this.graph=s}renderEdge(t,n){const{enableTooltip:e,tooltipId:r,tooltipBGColor:i,tooltipBorderColor:o,edgeOpacity:u,edgeGradientFill:s,tooltipTemplate:a}=this.options,c=this.graph.edge(t.v,t.w,t.name),h=this.graph.node(t.v),f=this.graph.node(t.w),l=Cl(c),d=this.canvas.gradient("linear",(function(t){var n,e,r;t.stop(0,null==(n=h.data)?void 0:n.color),t.stop(1,s?null==(e=f.data)?void 0:e.color:null==(r=h.data)?void 0:r.color)})),p=function(t,{id:n="",edgeColor:e,opacity:r=1}={}){const i=new wn({d:t});return i.id(n),i.fill(e).opacity(r),i}(l,{id:`${t.v}-${t.w}`,edgeColor:d,opacity:u});if(e&&h.data&&f.data){const t=a?a({source:h.data,target:f.data,value:c.value}):null;p.on("mousemove",(function(n){var e;const u=(s=n.pageX,a=n.pageY,["position: absolute;",`left: ${s+20}px;`,`top: ${a+20}px;`,`border: 1px solid ${o};`,"border-radius: 5px;",`background-color: ${i};`,"padding: 10px"]);var s,a;null==(e=Jn(`[id="${n.target.id}"]`))||e.front().opacity(1),Pl(r,u.join(" "),t)})),p.on("mouseout",(function(t){var n;Pl(r),null==(n=Jn(`[id="${t.target.id}"]`))||n.front().opacity(u)}))}n.add(p)}render({keepOldPosition:t=!1}={}){var n,e;const{nodeWidth:r,nodeBorderWidth:i,nodeBorderColor:o,enableTooltip:u,tooltipId:s,onNodeClick:a,fontColor:c,fontFamily:h,fontSize:f,fontWeight:l}=this.options,d=this.canvas.viewbox();this.clear();const p=((t={})=>{const n=[];for(const e in t){const r=`${Dl(e)}: ${t[e]};`;n.push(r)}return n.join(" ")})({fontSize:f,fontWeight:l,fontFamily:h,color:c}),v=Tl(r/2,0);v.attr("style",p);const g=(null==(n=this.graph)?void 0:n.nodes())||[],y=(null==(e=this.graph)?void 0:e.edges())||[],_=Tl();y.forEach((t=>{this.renderEdge(t,_)})),v.add(_);const m=Tl();if(g.forEach((t=>{const n=Rl(this.graph.node(t),this.maxRank,{nodeWidth:r,nodeBorderWidth:i,nodeBorderColor:o,onNodeClick:a,fontColor:c});m.add(n)})),v.add(m),this.add(v),t&&this.updateViewBox(d.x,d.y,d.width,d.height),u){const t=((t="apexsankey-tooltip-container")=>{const n=document.getElementById(t)||document.createElement("div");return n.id=t,n})(s);(document.body||document.getElementsByTagName("body")[0]).append(t)}}}const Fl={width:800,height:650,canvasStyle:"border: 1px solid #caced0",spacing:20,nodeWidth:20,nodeBorderWidth:1,nodeBorderColor:null,onNodeClick:void 0,edgeOpacity:.4,edgeGradientFill:!0,fontSize:"14px",fontFamily:"",fontWeight:400,fontColor:"#212121",enableTooltip:!0,tooltipId:"sankey-tooltip-container",tooltipBorderColor:"#BCBCBC",tooltipBGColor:"#FFFFFF",tooltipTemplate:({source:t,target:n,value:e})=>`\n
\n
\n
${t.title}
\n
=>
\n
\n
${n.title}
\n
: ${e}
\n
\n `};return class{constructor(t,n){this.element=t,this.options={...Fl,...n};const e=document.createElement("div");e.id="apexSankeyWrapper",e.style.position="relative",this.graph=new Ll(e,this.options),this.element.append(e)}render(t){if(!this.element)throw new Error("Element not found");return this.graph.construct(t),this.graph.render(),this.graph}}})); diff --git a/Scripts/JavaScript/cytoscape-dagre.js b/Scripts/JavaScript/cytoscape-dagre.js new file mode 100644 index 0000000..8405c7f --- /dev/null +++ b/Scripts/JavaScript/cytoscape-dagre.js @@ -0,0 +1,397 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("dagre")); + else if(typeof define === 'function' && define.amd) + define(["dagre"], factory); + else if(typeof exports === 'object') + exports["cytoscapeDagre"] = factory(require("dagre")); + else + root["cytoscapeDagre"] = factory(root["dagre"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE__4__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +var impl = __webpack_require__(1); // registers the extension on a cytoscape lib ref + + +var register = function register(cytoscape) { + if (!cytoscape) { + return; + } // can't register if cytoscape unspecified + + + cytoscape('layout', 'dagre', impl); // register with cytoscape.js +}; + +if (typeof cytoscape !== 'undefined') { + // expose to global cytoscape (i.e. window.cytoscape) + register(cytoscape); +} + +module.exports = register; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var isFunction = function isFunction(o) { + return typeof o === 'function'; +}; + +var defaults = __webpack_require__(2); + +var assign = __webpack_require__(3); + +var dagre = __webpack_require__(4); // constructor +// options : object containing layout options + + +function DagreLayout(options) { + this.options = assign({}, defaults, options); +} // runs the layout + + +DagreLayout.prototype.run = function () { + var options = this.options; + var layout = this; + var cy = options.cy; // cy is automatically populated for us in the constructor + + var eles = options.eles; + + var getVal = function getVal(ele, val) { + return isFunction(val) ? val.apply(ele, [ele]) : val; + }; + + var bb = options.boundingBox || { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }; + + if (bb.x2 === undefined) { + bb.x2 = bb.x1 + bb.w; + } + + if (bb.w === undefined) { + bb.w = bb.x2 - bb.x1; + } + + if (bb.y2 === undefined) { + bb.y2 = bb.y1 + bb.h; + } + + if (bb.h === undefined) { + bb.h = bb.y2 - bb.y1; + } + + var g = new dagre.graphlib.Graph({ + multigraph: true, + compound: true + }); + var gObj = {}; + + var setGObj = function setGObj(name, val) { + if (val != null) { + gObj[name] = val; + } + }; + + setGObj('nodesep', options.nodeSep); + setGObj('edgesep', options.edgeSep); + setGObj('ranksep', options.rankSep); + setGObj('rankdir', options.rankDir); + setGObj('align', options.align); + setGObj('ranker', options.ranker); + setGObj('acyclicer', options.acyclicer); + g.setGraph(gObj); + g.setDefaultEdgeLabel(function () { + return {}; + }); + g.setDefaultNodeLabel(function () { + return {}; + }); // add nodes to dagre + + var nodes = eles.nodes(); + + if (isFunction(options.sort)) { + nodes = nodes.sort(options.sort); + } + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var nbb = node.layoutDimensions(options); + g.setNode(node.id(), { + width: nbb.w, + height: nbb.h, + name: node.id() + }); // console.log( g.node(node.id()) ); + } // set compound parents + + + for (var _i = 0; _i < nodes.length; _i++) { + var _node = nodes[_i]; + + if (_node.isChild()) { + g.setParent(_node.id(), _node.parent().id()); + } + } // add edges to dagre + + + var edges = eles.edges().stdFilter(function (edge) { + return !edge.source().isParent() && !edge.target().isParent(); // dagre can't handle edges on compound nodes + }); + + if (isFunction(options.sort)) { + edges = edges.sort(options.sort); + } + + for (var _i2 = 0; _i2 < edges.length; _i2++) { + var edge = edges[_i2]; + g.setEdge(edge.source().id(), edge.target().id(), { + minlen: getVal(edge, options.minLen), + weight: getVal(edge, options.edgeWeight), + name: edge.id() + }, edge.id()); // console.log( g.edge(edge.source().id(), edge.target().id(), edge.id()) ); + } + + dagre.layout(g); + var gNodeIds = g.nodes(); + + for (var _i3 = 0; _i3 < gNodeIds.length; _i3++) { + var id = gNodeIds[_i3]; + var n = g.node(id); + cy.getElementById(id).scratch().dagre = n; + } + + var dagreBB; + + if (options.boundingBox) { + dagreBB = { + x1: Infinity, + x2: -Infinity, + y1: Infinity, + y2: -Infinity + }; + nodes.forEach(function (node) { + var dModel = node.scratch().dagre; + dagreBB.x1 = Math.min(dagreBB.x1, dModel.x); + dagreBB.x2 = Math.max(dagreBB.x2, dModel.x); + dagreBB.y1 = Math.min(dagreBB.y1, dModel.y); + dagreBB.y2 = Math.max(dagreBB.y2, dModel.y); + }); + dagreBB.w = dagreBB.x2 - dagreBB.x1; + dagreBB.h = dagreBB.y2 - dagreBB.y1; + } else { + dagreBB = bb; + } + + var constrainPos = function constrainPos(p) { + if (options.boundingBox) { + var xPct = dagreBB.w === 0 ? 0 : (p.x - dagreBB.x1) / dagreBB.w; + var yPct = dagreBB.h === 0 ? 0 : (p.y - dagreBB.y1) / dagreBB.h; + return { + x: bb.x1 + xPct * bb.w, + y: bb.y1 + yPct * bb.h + }; + } else { + return p; + } + }; + + nodes.layoutPositions(layout, options, function (ele) { + ele = _typeof(ele) === "object" ? ele : this; + var dModel = ele.scratch().dagre; + return constrainPos({ + x: dModel.x, + y: dModel.y + }); + }); + return this; // chaining +}; + +module.exports = DagreLayout; + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +var defaults = { + // dagre algo options, uses default value on undefined + nodeSep: undefined, + // the separation between adjacent nodes in the same rank + edgeSep: undefined, + // the separation between adjacent edges in the same rank + rankSep: undefined, + // the separation between adjacent nodes in the same rank + rankDir: undefined, + // 'TB' for top to bottom flow, 'LR' for left to right, + align: undefined, + // alignment for rank nodes. Can be 'UL', 'UR', 'DL', or 'DR', where U = up, D = down, L = left, and R = right + acyclicer: undefined, + // If set to 'greedy', uses a greedy heuristic for finding a feedback arc set for a graph. + // A feedback arc set is a set of edges that can be removed to make a graph acyclic. + ranker: undefined, + // Type of algorithm to assigns a rank to each node in the input graph. + // Possible values: network-simplex, tight-tree or longest-path + minLen: function minLen(edge) { + return 1; + }, + // number of ranks to keep between the source and target of the edge + edgeWeight: function edgeWeight(edge) { + return 1; + }, + // higher weight edges are generally made shorter and straighter than lower weight edges + // general layout options + fit: true, + // whether to fit to viewport + padding: 30, + // fit padding + spacingFactor: undefined, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + nodeDimensionsIncludeLabels: false, + // whether labels should be included in determining the space used by a node + animate: false, + // whether to transition the node positions + animateFilter: function animateFilter(node, i) { + return true; + }, + // whether to animate specific nodes when animation is on; non-animated nodes immediately go to their final positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + transform: function transform(node, pos) { + return pos; + }, + // a function that applies a transform to the final node position + ready: function ready() {}, + // on layoutready + sort: undefined, + // a sorting function to order the nodes and edges; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + // because cytoscape dagre creates a directed graph, and directed graphs use the node order as a tie breaker when + // defining the topology of a graph, this sort function can help ensure the correct order of the nodes/edges. + // this feature is most useful when adding and removing the same nodes and edges multiple times in a graph. + stop: function stop() {} // on layoutstop + +}; +module.exports = defaults; + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + +// Simple, internal Object.assign() polyfill for options objects etc. +module.exports = Object.assign != null ? Object.assign.bind(Object) : function (tgt) { + for (var _len = arguments.length, srcs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + srcs[_key - 1] = arguments[_key]; + } + + srcs.forEach(function (src) { + Object.keys(src).forEach(function (k) { + return tgt[k] = src[k]; + }); + }); + return tgt; +}; + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__4__; + +/***/ }) +/******/ ]); +}); \ No newline at end of file diff --git a/Scripts/JavaScript/cytoscape-euler.js b/Scripts/JavaScript/cytoscape-euler.js new file mode 100644 index 0000000..13c2271 --- /dev/null +++ b/Scripts/JavaScript/cytoscape-euler.js @@ -0,0 +1,1429 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["cytoscapeEuler"] = factory(); + else + root["cytoscapeEuler"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 11); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = Object.assign != null ? Object.assign.bind(Object) : function (tgt) { + for (var _len = arguments.length, srcs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + srcs[_key - 1] = arguments[_key]; + } + + srcs.forEach(function (src) { + Object.keys(src).forEach(function (k) { + return tgt[k] = src[k]; + }); + }); + + return tgt; +}; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var assign = __webpack_require__(0); + +var defaults = Object.freeze({ + source: null, + target: null, + length: 80, + coeff: 0.0002, + weight: 1 +}); + +function makeSpring(spring) { + return assign({}, defaults, spring); +} + +function applySpring(spring) { + var body1 = spring.source, + body2 = spring.target, + length = spring.length < 0 ? defaults.length : spring.length, + dx = body2.pos.x - body1.pos.x, + dy = body2.pos.y - body1.pos.y, + r = Math.sqrt(dx * dx + dy * dy); + + if (r === 0) { + dx = (Math.random() - 0.5) / 50; + dy = (Math.random() - 0.5) / 50; + r = Math.sqrt(dx * dx + dy * dy); + } + + var d = r - length; + var coeff = (!spring.coeff || spring.coeff < 0 ? defaults.springCoeff : spring.coeff) * d / r * spring.weight; + + body1.force.x += coeff * dx; + body1.force.y += coeff * dy; + + body2.force.x -= coeff * dx; + body2.force.y -= coeff * dy; +} + +module.exports = { makeSpring: makeSpring, applySpring: applySpring }; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/** +The implementation of the Euler layout algorithm +*/ + +var Layout = __webpack_require__(13); +var assign = __webpack_require__(0); +var defaults = __webpack_require__(4); + +var _require = __webpack_require__(10), + _tick = _require.tick; + +var _require2 = __webpack_require__(7), + makeQuadtree = _require2.makeQuadtree; + +var _require3 = __webpack_require__(3), + makeBody = _require3.makeBody; + +var _require4 = __webpack_require__(1), + makeSpring = _require4.makeSpring; + +var isFn = function isFn(fn) { + return typeof fn === 'function'; +}; +var isParent = function isParent(n) { + return n.isParent(); +}; +var notIsParent = function notIsParent(n) { + return !isParent(n); +}; +var isLocked = function isLocked(n) { + return n.locked(); +}; +var notIsLocked = function notIsLocked(n) { + return !isLocked(n); +}; +var isParentEdge = function isParentEdge(e) { + return isParent(e.source()) || isParent(e.target()); +}; +var notIsParentEdge = function notIsParentEdge(e) { + return !isParentEdge(e); +}; +var getBody = function getBody(n) { + return n.scratch('euler').body; +}; +var getNonParentDescendants = function getNonParentDescendants(n) { + return isParent(n) ? n.descendants().filter(notIsParent) : n; +}; + +var getScratch = function getScratch(el) { + var scratch = el.scratch('euler'); + + if (!scratch) { + scratch = {}; + + el.scratch('euler', scratch); + } + + return scratch; +}; + +var optFn = function optFn(opt, ele) { + if (isFn(opt)) { + return opt(ele); + } else { + return opt; + } +}; + +var Euler = function (_Layout) { + _inherits(Euler, _Layout); + + function Euler(options) { + _classCallCheck(this, Euler); + + return _possibleConstructorReturn(this, (Euler.__proto__ || Object.getPrototypeOf(Euler)).call(this, assign({}, defaults, options))); + } + + _createClass(Euler, [{ + key: 'prerun', + value: function prerun(state) { + var s = state; + + s.quadtree = makeQuadtree(); + + var bodies = s.bodies = []; + + // regular nodes + s.nodes.filter(function (n) { + return notIsParent(n); + }).forEach(function (n) { + var scratch = getScratch(n); + + var body = makeBody({ + pos: { x: scratch.x, y: scratch.y }, + mass: optFn(s.mass, n), + locked: scratch.locked + }); + + body._cyNode = n; + + scratch.body = body; + + body._scratch = scratch; + + bodies.push(body); + }); + + var springs = s.springs = []; + + // regular edge springs + s.edges.filter(notIsParentEdge).forEach(function (e) { + var spring = makeSpring({ + source: getBody(e.source()), + target: getBody(e.target()), + length: optFn(s.springLength, e), + coeff: optFn(s.springCoeff, e) + }); + + spring._cyEdge = e; + + var scratch = getScratch(e); + + spring._scratch = scratch; + + scratch.spring = spring; + + springs.push(spring); + }); + + // compound edge springs + s.edges.filter(isParentEdge).forEach(function (e) { + var sources = getNonParentDescendants(e.source()); + var targets = getNonParentDescendants(e.target()); + + // just add one spring for perf + sources = [sources[0]]; + targets = [targets[0]]; + + sources.forEach(function (src) { + targets.forEach(function (tgt) { + springs.push(makeSpring({ + source: getBody(src), + target: getBody(tgt), + length: optFn(s.springLength, e), + coeff: optFn(s.springCoeff, e) + })); + }); + }); + }); + } + }, { + key: 'tick', + value: function tick(state) { + var movement = _tick(state); + + var isDone = movement <= state.movementThreshold; + + return isDone; + } + }]); + + return Euler; +}(Layout); + +module.exports = Euler; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var defaults = Object.freeze({ + pos: { x: 0, y: 0 }, + prevPos: { x: 0, y: 0 }, + force: { x: 0, y: 0 }, + velocity: { x: 0, y: 0 }, + mass: 1 +}); + +var copyVec = function copyVec(v) { + return { x: v.x, y: v.y }; +}; +var getValue = function getValue(val, def) { + return val != null ? val : def; +}; +var getVec = function getVec(vec, def) { + return copyVec(getValue(vec, def)); +}; + +function makeBody(opts) { + var b = {}; + + b.pos = getVec(opts.pos, defaults.pos); + b.prevPos = getVec(opts.prevPos, b.pos); + b.force = getVec(opts.force, defaults.force); + b.velocity = getVec(opts.velocity, defaults.velocity); + b.mass = opts.mass != null ? opts.mass : defaults.mass; + b.locked = opts.locked; + + return b; +} + +module.exports = { makeBody: makeBody }; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var defaults = Object.freeze({ + // The ideal legth of a spring + // - This acts as a hint for the edge length + // - The edge length can be longer or shorter if the forces are set to extreme values + springLength: function springLength(edge) { + return 80; + }, + + // Hooke's law coefficient + // - The value ranges on [0, 1] + // - Lower values give looser springs + // - Higher values give tighter springs + springCoeff: function springCoeff(edge) { + return 0.0008; + }, + + // The mass of the node in the physics simulation + // - The mass affects the gravity node repulsion/attraction + mass: function mass(node) { + return 4; + }, + + // Coulomb's law coefficient + // - Makes the nodes repel each other for negative values + // - Makes the nodes attract each other for positive values + gravity: -1.2, + + // A force that pulls nodes towards the origin (0, 0) + // Higher values keep the components less spread out + pull: 0.001, + + // Theta coefficient from Barnes-Hut simulation + // - Value ranges on [0, 1] + // - Performance is better with smaller values + // - Very small values may not create enough force to give a good result + theta: 0.666, + + // Friction / drag coefficient to make the system stabilise over time + dragCoeff: 0.02, + + // When the total of the squared position deltas is less than this value, the simulation ends + movementThreshold: 1, + + // The amount of time passed per tick + // - Larger values result in faster runtimes but might spread things out too far + // - Smaller values produce more accurate results + timeStep: 20 +}); + +module.exports = defaults; + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var defaultCoeff = 0.02; + +function applyDrag(body, manualDragCoeff) { + var dragCoeff = void 0; + + if (manualDragCoeff != null) { + dragCoeff = manualDragCoeff; + } else if (body.dragCoeff != null) { + dragCoeff = body.dragCoeff; + } else { + dragCoeff = defaultCoeff; + } + + body.force.x -= dragCoeff * body.velocity.x; + body.force.y -= dragCoeff * body.velocity.y; +} + +module.exports = { applyDrag: applyDrag }; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// use euler method for force integration http://en.wikipedia.org/wiki/Euler_method +// return sum of squared position deltas +function integrate(bodies, timeStep) { + var dx = 0, + tx = 0, + dy = 0, + ty = 0, + i, + max = bodies.length; + + if (max === 0) { + return 0; + } + + for (i = 0; i < max; ++i) { + var body = bodies[i], + coeff = timeStep / body.mass; + + if (body.grabbed) { + continue; + } + + if (body.locked) { + body.velocity.x = 0; + body.velocity.y = 0; + } else { + body.velocity.x += coeff * body.force.x; + body.velocity.y += coeff * body.force.y; + } + + var vx = body.velocity.x, + vy = body.velocity.y, + v = Math.sqrt(vx * vx + vy * vy); + + if (v > 1) { + body.velocity.x = vx / v; + body.velocity.y = vy / v; + } + + dx = timeStep * body.velocity.x; + dy = timeStep * body.velocity.y; + + body.pos.x += dx; + body.pos.y += dy; + + tx += Math.abs(dx);ty += Math.abs(dy); + } + + return (tx * tx + ty * ty) / max; +} + +module.exports = { integrate: integrate }; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// impl of barnes hut +// http://www.eecs.berkeley.edu/~demmel/cs267/lecture26/lecture26.html +// http://en.wikipedia.org/wiki/Barnes%E2%80%93Hut_simulation + +var Node = __webpack_require__(9); +var InsertStack = __webpack_require__(8); + +var resetVec = function resetVec(v) { + v.x = 0;v.y = 0; +}; + +var isSamePosition = function isSamePosition(p1, p2) { + var threshold = 1e-8; + var dx = Math.abs(p1.x - p2.x); + var dy = Math.abs(p1.y - p2.y); + + return dx < threshold && dy < threshold; +}; + +function makeQuadtree() { + var updateQueue = [], + insertStack = new InsertStack(), + nodesCache = [], + currentInCache = 0, + root = newNode(); + + function newNode() { + // To avoid pressure on GC we reuse nodes. + var node = nodesCache[currentInCache]; + if (node) { + node.quad0 = null; + node.quad1 = null; + node.quad2 = null; + node.quad3 = null; + node.body = null; + node.mass = node.massX = node.massY = 0; + node.left = node.right = node.top = node.bottom = 0; + } else { + node = new Node(); + nodesCache[currentInCache] = node; + } + + ++currentInCache; + return node; + } + + function update(sourceBody, gravity, theta, pull) { + var queue = updateQueue, + v = void 0, + dx = void 0, + dy = void 0, + r = void 0, + fx = 0, + fy = 0, + queueLength = 1, + shiftIdx = 0, + pushIdx = 1; + + queue[0] = root; + + resetVec(sourceBody.force); + + var px = -sourceBody.pos.x; + var py = -sourceBody.pos.y; + var pr = Math.sqrt(px * px + py * py); + var pv = sourceBody.mass * pull / pr; + + fx += pv * px; + fy += pv * py; + + while (queueLength) { + var node = queue[shiftIdx], + body = node.body; + + queueLength -= 1; + shiftIdx += 1; + var differentBody = body !== sourceBody; + if (body && differentBody) { + // If the current node is a leaf node (and it is not source body), + // calculate the force exerted by the current node on body, and add this + // amount to body's net force. + dx = body.pos.x - sourceBody.pos.x; + dy = body.pos.y - sourceBody.pos.y; + r = Math.sqrt(dx * dx + dy * dy); + + if (r === 0) { + // Poor man's protection against zero distance. + dx = (Math.random() - 0.5) / 50; + dy = (Math.random() - 0.5) / 50; + r = Math.sqrt(dx * dx + dy * dy); + } + + // This is standard gravition force calculation but we divide + // by r^3 to save two operations when normalizing force vector. + v = gravity * body.mass * sourceBody.mass / (r * r * r); + fx += v * dx; + fy += v * dy; + } else if (differentBody) { + // Otherwise, calculate the ratio s / r, where s is the width of the region + // represented by the internal node, and r is the distance between the body + // and the node's center-of-mass + dx = node.massX / node.mass - sourceBody.pos.x; + dy = node.massY / node.mass - sourceBody.pos.y; + r = Math.sqrt(dx * dx + dy * dy); + + if (r === 0) { + // Sorry about code duplucation. I don't want to create many functions + // right away. Just want to see performance first. + dx = (Math.random() - 0.5) / 50; + dy = (Math.random() - 0.5) / 50; + r = Math.sqrt(dx * dx + dy * dy); + } + // If s / r < θ, treat this internal node as a single body, and calculate the + // force it exerts on sourceBody, and add this amount to sourceBody's net force. + if ((node.right - node.left) / r < theta) { + // in the if statement above we consider node's width only + // because the region was squarified during tree creation. + // Thus there is no difference between using width or height. + v = gravity * node.mass * sourceBody.mass / (r * r * r); + fx += v * dx; + fy += v * dy; + } else { + // Otherwise, run the procedure recursively on each of the current node's children. + + // I intentionally unfolded this loop, to save several CPU cycles. + if (node.quad0) { + queue[pushIdx] = node.quad0; + queueLength += 1; + pushIdx += 1; + } + if (node.quad1) { + queue[pushIdx] = node.quad1; + queueLength += 1; + pushIdx += 1; + } + if (node.quad2) { + queue[pushIdx] = node.quad2; + queueLength += 1; + pushIdx += 1; + } + if (node.quad3) { + queue[pushIdx] = node.quad3; + queueLength += 1; + pushIdx += 1; + } + } + } + } + + sourceBody.force.x += fx; + sourceBody.force.y += fy; + } + + function insertBodies(bodies) { + if (bodies.length === 0) { + return; + } + + var x1 = Number.MAX_VALUE, + y1 = Number.MAX_VALUE, + x2 = Number.MIN_VALUE, + y2 = Number.MIN_VALUE, + i = void 0, + max = bodies.length; + + // To reduce quad tree depth we are looking for exact bounding box of all particles. + i = max; + while (i--) { + var x = bodies[i].pos.x; + var y = bodies[i].pos.y; + if (x < x1) { + x1 = x; + } + if (x > x2) { + x2 = x; + } + if (y < y1) { + y1 = y; + } + if (y > y2) { + y2 = y; + } + } + + // Squarify the bounds. + var dx = x2 - x1, + dy = y2 - y1; + if (dx > dy) { + y2 = y1 + dx; + } else { + x2 = x1 + dy; + } + + currentInCache = 0; + root = newNode(); + root.left = x1; + root.right = x2; + root.top = y1; + root.bottom = y2; + + i = max - 1; + if (i >= 0) { + root.body = bodies[i]; + } + while (i--) { + insert(bodies[i], root); + } + } + + function insert(newBody) { + insertStack.reset(); + insertStack.push(root, newBody); + + while (!insertStack.isEmpty()) { + var stackItem = insertStack.pop(), + node = stackItem.node, + body = stackItem.body; + + if (!node.body) { + // This is internal node. Update the total mass of the node and center-of-mass. + var x = body.pos.x; + var y = body.pos.y; + node.mass = node.mass + body.mass; + node.massX = node.massX + body.mass * x; + node.massY = node.massY + body.mass * y; + + // Recursively insert the body in the appropriate quadrant. + // But first find the appropriate quadrant. + var quadIdx = 0, + // Assume we are in the 0's quad. + left = node.left, + right = (node.right + left) / 2, + top = node.top, + bottom = (node.bottom + top) / 2; + + if (x > right) { + // somewhere in the eastern part. + quadIdx = quadIdx + 1; + left = right; + right = node.right; + } + if (y > bottom) { + // and in south. + quadIdx = quadIdx + 2; + top = bottom; + bottom = node.bottom; + } + + var child = getChild(node, quadIdx); + if (!child) { + // The node is internal but this quadrant is not taken. Add + // subnode to it. + child = newNode(); + child.left = left; + child.top = top; + child.right = right; + child.bottom = bottom; + child.body = body; + + setChild(node, quadIdx, child); + } else { + // continue searching in this quadrant. + insertStack.push(child, body); + } + } else { + // We are trying to add to the leaf node. + // We have to convert current leaf into internal node + // and continue adding two nodes. + var oldBody = node.body; + node.body = null; // internal nodes do not cary bodies + + if (isSamePosition(oldBody.pos, body.pos)) { + // Prevent infinite subdivision by bumping one node + // anywhere in this quadrant + var retriesCount = 3; + do { + var offset = Math.random(); + var dx = (node.right - node.left) * offset; + var dy = (node.bottom - node.top) * offset; + + oldBody.pos.x = node.left + dx; + oldBody.pos.y = node.top + dy; + retriesCount -= 1; + // Make sure we don't bump it out of the box. If we do, next iteration should fix it + } while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos)); + + if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) { + // This is very bad, we ran out of precision. + // if we do not return from the method we'll get into + // infinite loop here. So we sacrifice correctness of layout, and keep the app running + // Next layout iteration should get larger bounding box in the first step and fix this + return; + } + } + // Next iteration should subdivide node further. + insertStack.push(node, oldBody); + insertStack.push(node, body); + } + } + } + + return { + insertBodies: insertBodies, + updateBodyForce: update + }; +} + +function getChild(node, idx) { + if (idx === 0) return node.quad0; + if (idx === 1) return node.quad1; + if (idx === 2) return node.quad2; + if (idx === 3) return node.quad3; + return null; +} + +function setChild(node, idx, child) { + if (idx === 0) node.quad0 = child;else if (idx === 1) node.quad1 = child;else if (idx === 2) node.quad2 = child;else if (idx === 3) node.quad3 = child; +} + +module.exports = { makeQuadtree: makeQuadtree }; + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = InsertStack; + +/** + * Our implmentation of QuadTree is non-recursive to avoid GC hit + * This data structure represent stack of elements + * which we are trying to insert into quad tree. + */ +function InsertStack() { + this.stack = []; + this.popIdx = 0; +} + +InsertStack.prototype = { + isEmpty: function isEmpty() { + return this.popIdx === 0; + }, + push: function push(node, body) { + var item = this.stack[this.popIdx]; + if (!item) { + // we are trying to avoid memory pressue: create new element + // only when absolutely necessary + this.stack[this.popIdx] = new InsertStackElement(node, body); + } else { + item.node = node; + item.body = body; + } + ++this.popIdx; + }, + pop: function pop() { + if (this.popIdx > 0) { + return this.stack[--this.popIdx]; + } + }, + reset: function reset() { + this.popIdx = 0; + } +}; + +function InsertStackElement(node, body) { + this.node = node; // QuadTree node + this.body = body; // physical body which needs to be inserted to node +} + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Internal data structure to represent 2D QuadTree node + */ +module.exports = function Node() { + // body stored inside this node. In quad tree only leaf nodes (by construction) + // contain boides: + this.body = null; + + // Child nodes are stored in quads. Each quad is presented by number: + // 0 | 1 + // ----- + // 2 | 3 + this.quad0 = null; + this.quad1 = null; + this.quad2 = null; + this.quad3 = null; + + // Total mass of current node + this.mass = 0; + + // Center of mass coordinates + this.massX = 0; + this.massY = 0; + + // bounding box coordinates + this.left = 0; + this.top = 0; + this.bottom = 0; + this.right = 0; +}; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _require = __webpack_require__(6), + integrate = _require.integrate; + +var _require2 = __webpack_require__(5), + applyDrag = _require2.applyDrag; + +var _require3 = __webpack_require__(1), + applySpring = _require3.applySpring; + +function tick(_ref) { + var bodies = _ref.bodies, + springs = _ref.springs, + quadtree = _ref.quadtree, + timeStep = _ref.timeStep, + gravity = _ref.gravity, + theta = _ref.theta, + dragCoeff = _ref.dragCoeff, + pull = _ref.pull; + + // update body from scratch in case of any changes + bodies.forEach(function (body) { + var p = body._scratch; + + if (!p) { + return; + } + + body.locked = p.locked; + body.grabbed = p.grabbed; + body.pos.x = p.x; + body.pos.y = p.y; + }); + + quadtree.insertBodies(bodies); + + for (var i = 0; i < bodies.length; i++) { + var body = bodies[i]; + + quadtree.updateBodyForce(body, gravity, theta, pull); + applyDrag(body, dragCoeff); + } + + for (var _i = 0; _i < springs.length; _i++) { + var spring = springs[_i]; + + applySpring(spring); + } + + var movement = integrate(bodies, timeStep); + + // update scratch positions from body positions + bodies.forEach(function (body) { + var p = body._scratch; + + if (!p) { + return; + } + + p.x = body.pos.x; + p.y = body.pos.y; + }); + + return movement; +} + +module.exports = { tick: tick }; + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Euler = __webpack_require__(2); + +// registers the extension on a cytoscape lib ref +var register = function register(cytoscape) { + if (!cytoscape) { + return; + } // can't register if cytoscape unspecified + + cytoscape('layout', 'euler', Euler); // register with cytoscape.js +}; + +if (typeof cytoscape !== 'undefined') { + // expose to global cytoscape (i.e. window.cytoscape) + register(cytoscape); +} + +module.exports = register; + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// general default options for force-directed layout + +module.exports = Object.freeze({ + animate: true, // whether to show the layout as it's running; special 'end' value makes the layout animate like a discrete layout + refresh: 10, // number of ticks per frame; higher is faster but more jerky + maxIterations: 1000, // max iterations before the layout will bail out + maxSimulationTime: 4000, // max length in ms to run the layout + ungrabifyWhileSimulating: false, // so you can't drag nodes during layout + fit: true, // on every layout reposition of nodes, fit the viewport + padding: 30, // padding around the simulation + boundingBox: undefined, // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + + // layout event callbacks + ready: function ready() {}, // on layoutready + stop: function stop() {}, // on layoutstop + + // positioning options + randomize: false, // use random node positions at beginning of layout + + // infinite layout options + infinite: false // overrides all other options for a forces-all-the-time mode +}); + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** +A generic continuous layout class +*/ + +var assign = __webpack_require__(0); +var defaults = __webpack_require__(12); +var makeBoundingBox = __webpack_require__(14); + +var _require = __webpack_require__(15), + setInitialPositionState = _require.setInitialPositionState, + refreshPositions = _require.refreshPositions, + getNodePositionData = _require.getNodePositionData; + +var _require2 = __webpack_require__(16), + multitick = _require2.multitick; + +var Layout = function () { + function Layout(options) { + _classCallCheck(this, Layout); + + var o = this.options = assign({}, defaults, options); + + var nodes = o.eles.nodes(); + // prevent infinite loop and memory overflow when nodes occupy the same position + if (!o.randomize) { + nodes = nodes.sort(function (a, b) { + return a.position().x - b.position().x; + }); + var prev = { x: 0, y: 0 }; + var pos = {}; + nodes.forEach(function (n) { + Object.assign(pos, n.position()); + if (Math.abs(prev.x - pos.x) < o.theta && Math.abs(prev.y - pos.y) < o.theta) { + n.position({ x: Math.random() * 100, y: Math.random() * 100 }); + } + Object.assign(prev, pos); + }); + } + + var s = this.state = assign({}, o, { + layout: this, + nodes: nodes, + edges: o.eles.edges(), + tickIndex: 0, + firstUpdate: true + }); + + s.animateEnd = o.animate && o.animate === 'end'; + s.animateContinuously = o.animate && !s.animateEnd; + } + + _createClass(Layout, [{ + key: 'run', + value: function run() { + var l = this; + var s = this.state; + + s.tickIndex = 0; + s.firstUpdate = true; + s.startTime = Date.now(); + s.running = true; + + s.currentBoundingBox = makeBoundingBox(s.boundingBox, s.cy); + + if (s.ready) { + l.one('ready', s.ready); + } + if (s.stop) { + l.one('stop', s.stop); + } + + s.nodes.forEach(function (n) { + return setInitialPositionState(n, s); + }); + + l.prerun(s); + + if (s.animateContinuously) { + var ungrabify = function ungrabify(node) { + if (!s.ungrabifyWhileSimulating) { + return; + } + + var grabbable = getNodePositionData(node, s).grabbable = node.grabbable(); + + if (grabbable) { + node.ungrabify(); + } + }; + + var regrabify = function regrabify(node) { + if (!s.ungrabifyWhileSimulating) { + return; + } + + var grabbable = getNodePositionData(node, s).grabbable; + + if (grabbable) { + node.grabify(); + } + }; + + var updateGrabState = function updateGrabState(node) { + return getNodePositionData(node, s).grabbed = node.grabbed(); + }; + + var onGrab = function onGrab(_ref) { + var target = _ref.target; + + updateGrabState(target); + }; + + var onFree = onGrab; + + var onDrag = function onDrag(_ref2) { + var target = _ref2.target; + + var p = getNodePositionData(target, s); + var tp = target.position(); + + p.x = tp.x; + p.y = tp.y; + }; + + var listenToGrab = function listenToGrab(node) { + node.on('grab', onGrab); + node.on('free', onFree); + node.on('drag', onDrag); + }; + + var unlistenToGrab = function unlistenToGrab(node) { + node.removeListener('grab', onGrab); + node.removeListener('free', onFree); + node.removeListener('drag', onDrag); + }; + + var fit = function fit() { + if (s.fit && s.animateContinuously) { + s.cy.fit(s.padding); + } + }; + + var onNotDone = function onNotDone() { + refreshPositions(s.nodes, s); + fit(); + + requestAnimationFrame(_frame); + }; + + var _frame = function _frame() { + multitick(s, onNotDone, _onDone); + }; + + var _onDone = function _onDone() { + refreshPositions(s.nodes, s); + fit(); + + s.nodes.forEach(function (n) { + regrabify(n); + unlistenToGrab(n); + }); + + s.running = false; + + l.emit('layoutstop'); + }; + + l.emit('layoutstart'); + + s.nodes.forEach(function (n) { + ungrabify(n); + listenToGrab(n); + }); + + _frame(); // kick off + } else { + var done = false; + var _onNotDone = function _onNotDone() {}; + var _onDone2 = function _onDone2() { + return done = true; + }; + + while (!done) { + multitick(s, _onNotDone, _onDone2); + } + + s.eles.layoutPositions(this, s, function (node) { + var pd = getNodePositionData(node, s); + + return { x: pd.x, y: pd.y }; + }); + } + + l.postrun(s); + + return this; // chaining + } + }, { + key: 'prerun', + value: function prerun() {} + }, { + key: 'postrun', + value: function postrun() {} + }, { + key: 'tick', + value: function tick() {} + }, { + key: 'stop', + value: function stop() { + this.state.running = false; + + return this; // chaining + } + }, { + key: 'destroy', + value: function destroy() { + return this; // chaining + } + }]); + + return Layout; +}(); + +module.exports = Layout; + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = function (bb, cy) { + if (bb == null) { + bb = { x1: 0, y1: 0, w: cy.width(), h: cy.height() }; + } else { + // copy + bb = { x1: bb.x1, x2: bb.x2, y1: bb.y1, y2: bb.y2, w: bb.w, h: bb.h }; + } + + if (bb.x2 == null) { + bb.x2 = bb.x1 + bb.w; + } + if (bb.w == null) { + bb.w = bb.x2 - bb.x1; + } + if (bb.y2 == null) { + bb.y2 = bb.y1 + bb.h; + } + if (bb.h == null) { + bb.h = bb.y2 - bb.y1; + } + + return bb; +}; + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var assign = __webpack_require__(0); + +var setInitialPositionState = function setInitialPositionState(node, state) { + var p = node.position(); + var bb = state.currentBoundingBox; + var scratch = node.scratch(state.name); + + if (scratch == null) { + scratch = {}; + + node.scratch(state.name, scratch); + } + + assign(scratch, state.randomize ? { + x: bb.x1 + Math.random() * bb.w, + y: bb.y1 + Math.random() * bb.h + } : { + x: p.x, + y: p.y + }); + + scratch.locked = node.locked(); +}; + +var getNodePositionData = function getNodePositionData(node, state) { + return node.scratch(state.name); +}; + +var refreshPositions = function refreshPositions(nodes, state) { + nodes.positions(function (node) { + var scratch = node.scratch(state.name); + + return { + x: scratch.x, + y: scratch.y + }; + }); +}; + +module.exports = { setInitialPositionState: setInitialPositionState, getNodePositionData: getNodePositionData, refreshPositions: refreshPositions }; + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var nop = function nop() {}; + +var tick = function tick(state) { + var s = state; + var l = state.layout; + + var tickIndicatesDone = l.tick(s); + + if (s.firstUpdate) { + if (s.animateContinuously) { + // indicate the initial positions have been set + s.layout.emit('layoutready'); + } + s.firstUpdate = false; + } + + s.tickIndex++; + + var duration = Date.now() - s.startTime; + + return !s.infinite && (tickIndicatesDone || s.tickIndex >= s.maxIterations || duration >= s.maxSimulationTime); +}; + +var multitick = function multitick(state) { + var onNotDone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : nop; + var onDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : nop; + + var done = false; + var s = state; + + for (var i = 0; i < s.refresh; i++) { + done = !s.running || tick(s); + + if (done) { + break; + } + } + + if (!done) { + onNotDone(); + } else { + onDone(); + } +}; + +module.exports = { tick: tick, multitick: multitick }; + +/***/ }) +/******/ ]); +}); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCA1MGJjNjVjOTlhYjVjZjA4ZWUzZSIsIndlYnBhY2s6Ly8vLi9zcmMvYXNzaWduLmpzIiwid2VicGFjazovLy8uL3NyYy9ldWxlci9zcHJpbmcuanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL2V1bGVyL2luZGV4LmpzIiwid2VicGFjazovLy8uL3NyYy9ldWxlci9ib2R5LmpzIiwid2VicGFjazovLy8uL3NyYy9ldWxlci9kZWZhdWx0cy5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvZXVsZXIvZHJhZy5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvZXVsZXIvaW50ZWdyYXRlLmpzIiwid2VicGFjazovLy8uL3NyYy9ldWxlci9xdWFkdHJlZS9pbmRleC5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvZXVsZXIvcXVhZHRyZWUvaW5zZXJ0U3RhY2suanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL2V1bGVyL3F1YWR0cmVlL25vZGUuanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL2V1bGVyL3RpY2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AgIHYgPSBncmF2aXR5ICogbm9kZS5tYXNzICogc291cmNlQm9keS5tYXNzIC8gKHIgKiByICogcik7XG4gICAgICAgICAgZnggKz0gdiAqIGR4O1xuICAgICAgICAgIGZ5ICs9IHYgKiBkeTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAvLyBPdGhlcndpc2UsIHJ1biB0aGUgcHJvY2VkdXJlIHJlY3Vyc2l2ZWx5IG9uIGVhY2ggb2YgdGhlIGN1cnJlbnQgbm9kZSdzIGNoaWxkcmVuLlxuXG4gICAgICAgICAgLy8gSSBpbnRlbnRpb25hbGx5IHVuZm9sZGVkIHRoaXMgbG9vcCwgdG8gc2F2ZSBzZXZlcmFsIENQVSBjeWNsZXMuXG4gICAgICAgICAgaWYgKG5vZGUucXVhZDApIHtcbiAgICAgICAgICAgIHF1ZXVlW3B1c2hJZHhdID0gbm9kZS5xdWFkMDtcbiAgICAgICAgICAgIHF1ZXVlTGVuZ3RoICs9IDE7XG4gICAgICAgICAgICBwdXNoSWR4ICs9IDE7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChub2RlLnF1YWQxKSB7XG4gICAgICAgICAgICBxdWV1ZVtwdXNoSWR4XSA9IG5vZGUucXVhZDE7XG4gICAgICAgICAgICBxdWV1ZUxlbmd0aCArPSAxO1xuICAgICAgICAgICAgcHVzaElkeCArPSAxO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAobm9kZS5xdWFkMikge1xuICAgICAgICAgICAgcXVldWVbcHVzaElkeF0gPSBub2RlLnF1YWQyO1xuICAgICAgICAgICAgcXVldWVMZW5ndGggKz0gMTtcbiAgICAgICAgICAgIHB1c2hJZHggKz0gMTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKG5vZGUucXVhZDMpIHtcbiAgICAgICAgICAgIHF1ZXVlW3B1c2hJZHhdID0gbm9kZS5xdWFkMztcbiAgICAgICAgICAgIHF1ZXVlTGVuZ3RoICs9IDE7XG4gICAgICAgICAgICBwdXNoSWR4ICs9IDE7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgc291cmNlQm9keS5mb3JjZS54ICs9IGZ4O1xuICAgIHNvdXJjZUJvZHkuZm9yY2UueSArPSBmeTtcbiAgfVxuXG4gIGZ1bmN0aW9uIGluc2VydEJvZGllcyhib2RpZXMpIHtcbiAgICBpZiggYm9kaWVzLmxlbmd0aCA9PT0gMCApeyByZXR1cm47IH1cblxuICAgIGxldCB4MSA9IE51bWJlci5NQVhfVkFMVUUsXG4gICAgICB5MSA9IE51bWJlci5NQVhfVkFMVUUsXG4gICAgICB4MiA9IE51bWJlci5NSU5fVkFMVUUsXG4gICAgICB5MiA9IE51bWJlci5NSU5fVkFMVUUsXG4gICAgICBpLFxuICAgICAgbWF4ID0gYm9kaWVzLmxlbmd0aDtcblxuICAgIC8vIFRvIHJlZHVjZSBxdWFkIHRyZWUgZGVwdGggd2UgYXJlIGxvb2tpbmcgZm9yIGV4YWN0IGJvdW5kaW5nIGJveCBvZiBhbGwgcGFydGljbGVzLlxuICAgIGkgPSBtYXg7XG4gICAgd2hpbGUgKGktLSkge1xuICAgICAgbGV0IHggPSBib2RpZXNbaV0ucG9zLng7XG4gICAgICBsZXQgeSA9IGJvZGllc1tpXS5wb3MueTtcbiAgICAgIGlmICh4IDwgeDEpIHtcbiAgICAgICAgeDEgPSB4O1xuICAgICAgfVxuICAgICAgaWYgKHggPiB4Mikge1xuICAgICAgICB4MiA9IHg7XG4gICAgICB9XG4gICAgICBpZiAoeSA8IHkxKSB7XG4gICAgICAgIHkxID0geTtcbiAgICAgIH1cbiAgICAgIGlmICh5ID4geTIpIHtcbiAgICAgICAgeTIgPSB5O1xuICAgICAgfVxuICAgIH1cblxuICAgIC8vIFNxdWFyaWZ5IHRoZSBib3VuZHMuXG4gICAgbGV0IGR4ID0geDIgLSB4MSxcbiAgICAgIGR5ID0geTIgLSB5MTtcbiAgICBpZiAoZHggPiBkeSkge1xuICAgICA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cyAqIHg7XG4gICAgICAgIG5vZGUubWFzc1kgPSBub2RlLm1hc3NZICsgYm9keS5tYXNzICogeTtcblxuICAgICAgICAvLyBSZWN1cnNpdmVseSBpbnNlcnQgdGhlIGJvZHkgaW4gdGhlIGFwcHJvcHJpYXRlIHF1YWRyYW50LlxuICAgICAgICAvLyBCdXQgZmlyc3QgZmluZCB0aGUgYXBwcm9wcmlhdGUgcXVhZHJhbnQuXG4gICAgICAgIGxldCBxdWFkSWR4ID0gMCwgLy8gQXNzdW1lIHdlIGFyZSBpbiB0aGUgMCdzIHF1YWQuXG4gICAgICAgICAgbGVmdCA9IG5vZGUubGVmdCxcbiAgICAgICAgICByaWdodCA9IChub2RlLnJpZ2h0ICsgbGVmdCkgLyAyLFxuICAgICAgICAgIHRvcCA9IG5vZGUudG9wLFxuICAgICAgICAgIGJvdHRvbSA9IChub2RlLmJvdHRvbSArIHRvcCkgLyAyO1xuXG4gICAgICAgIGlmICh4ID4gcmlnaHQpIHsgLy8gc29tZXdoZXJlIGluIHRoZSBlYXN0ZXJuIHBhcnQuXG4gICAgICAgICAgcXVhZElkeCA9IHF1YWRJZHggKyAxO1xuICAgICAgICAgIGxlZnQgPSByaWdodDtcbiAgICAgICAgICByaWdodCA9IG5vZGUucmlnaHQ7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHkgPiBib3R0b20pIHsgLy8gYW5kIGluIHNvdXRoLlxuICAgICAgICAgIHF1YWRJZHggPSBxdWFkSWR4ICsgMjtcbiAgICAgICAgICB0b3AgPSBib3R0b207XG4gICAgICAgICAgYm90dG9tID0gbm9kZS5ib3R0b207XG4gICAgICAgIH1cblxuICAgICAgICBsZXQgY2hpbGQgPSBnZXRDaGlsZChub2RlLCBxdWFkSWR4KTtcbiAgICAgICAgaWYgKCFjaGlsZCkge1xuICAgICAgICAgIC8vIFRoZSBub2RlIGlzIGludGVybmFsIGJ1dCB0aGlzIHF1YWRyYW50IGlzIG5vdCB0YWtlbi4gQWRkXG4gICAgICAg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bi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyAuL3NyYy9sYXlvdXQvdGljay5qcyJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/Scripts/JavaScript/cytoscape-klay.js b/Scripts/JavaScript/cytoscape-klay.js new file mode 100644 index 0000000..7de5e56 --- /dev/null +++ b/Scripts/JavaScript/cytoscape-klay.js @@ -0,0 +1,470 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("klayjs")); + else if(typeof define === 'function' && define.amd) + define(["klayjs"], factory); + else if(typeof exports === 'object') + exports["cytoscapeKlay"] = factory(require("klayjs")); + else + root["cytoscapeKlay"] = factory(root["$klay"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE_4__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 3); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var klay = __webpack_require__(4); +var assign = __webpack_require__(1); +var defaults = __webpack_require__(2); + +var klayNSLookup = { + 'addUnnecessaryBendpoints': 'de.cau.cs.kieler.klay.layered.unnecessaryBendpoints', + 'alignment': 'de.cau.cs.kieler.alignment', + 'aspectRatio': 'de.cau.cs.kieler.aspectRatio', + 'borderSpacing': 'borderSpacing', + 'compactComponents': 'de.cau.cs.kieler.klay.layered.components.compact', + 'compactionStrategy': 'de.cau.cs.kieler.klay.layered.nodeplace.compactionStrategy', + 'contentAlignment': 'de.cau.cs.kieler.klay.layered.contentAlignment', + 'crossingMinimization': 'de.cau.cs.kieler.klay.layered.crossMin', + 'cycleBreaking': 'de.cau.cs.kieler.klay.layered.cycleBreaking', + 'debugMode': 'de.cau.cs.kieler.debugMode', + 'direction': 'de.cau.cs.kieler.direction', + 'edgeLabelSideSelection': 'de.cau.cs.kieler.klay.layered.edgeLabelSideSelection', + // 'de.cau.cs.kieler.klay.layered.edgeNodeSpacingFactor': options.edgeNodeSpacingFactor, + 'edgeRouting': 'de.cau.cs.kieler.edgeRouting', + 'edgeSpacingFactor': 'de.cau.cs.kieler.klay.layered.edgeSpacingFactor', + 'feedbackEdges': 'de.cau.cs.kieler.klay.layered.feedBackEdges', + 'fixedAlignment': 'de.cau.cs.kieler.klay.layered.fixedAlignment', + 'greedySwitchCrossingMinimization': 'de.cau.cs.kieler.klay.layered.greedySwitch', + 'hierarchyHandling': 'de.cau.cs.kieler.hierarchyHandling', + 'inLayerSpacingFactor': 'de.cau.cs.kieler.klay.layered.inLayerSpacingFactor', + 'interactiveReferencePoint': 'de.cau.cs.kieler.klay.layered.interactiveReferencePoint', + 'layerConstraint': 'de.cau.cs.kieler.klay.layered.layerConstraint', + 'layoutHierarchy': 'de.cau.cs.kieler.layoutHierarchy', + 'linearSegmentsDeflectionDampening': 'de.cau.cs.kieler.klay.layered.linearSegmentsDeflectionDampening', + 'mergeEdges': 'de.cau.cs.kieler.klay.layered.mergeEdges', + 'mergeHierarchyCrossingEdges': 'de.cau.cs.kieler.klay.layered.mergeHierarchyEdges', + 'noLayout': 'de.cau.cs.kieler.noLayout', + 'nodeLabelPlacement': 'de.cau.cs.kieler.nodeLabelPlacement', + 'nodeLayering': 'de.cau.cs.kieler.klay.layered.nodeLayering', + 'nodePlacement': 'de.cau.cs.kieler.klay.layered.nodePlace', + 'portAlignment': 'de.cau.cs.kieler.portAlignment', + 'portAlignmentEastern': 'de.cau.cs.kieler.portAlignment.east', + 'portAlignmentNorth': 'de.cau.cs.kieler.portAlignment.north', + 'portAlignmentSouth': 'de.cau.cs.kieler.portAlignment.south', + 'portAlignmentWest': 'de.cau.cs.kieler.portAlignment.west', + 'portConstraints': 'de.cau.cs.kieler.portConstraints', + 'portLabelPlacement': 'de.cau.cs.kieler.portLabelPlacement', + 'portOffset': 'de.cau.cs.kieler.offset', + 'portSide': 'de.cau.cs.kieler.portSide', + 'portSpacing': 'de.cau.cs.kieler.portSpacing', + 'postCompaction': 'de.cau.cs.kieler.klay.layered.postCompaction', + 'priority': 'de.cau.cs.kieler.priority', + 'randomizationSeed': 'de.cau.cs.kieler.randomSeed', + 'routeSelfLoopInside': 'de.cau.cs.kieler.selfLoopInside', + 'separateConnectedComponents': 'de.cau.cs.kieler.separateConnComp', + 'sizeConstraint': 'de.cau.cs.kieler.sizeConstraint', + 'sizeOptions': 'de.cau.cs.kieler.sizeOptions', + 'spacing': 'de.cau.cs.kieler.spacing', + 'splineSelfLoopPlacement': 'de.cau.cs.kieler.klay.layered.splines.selfLoopPlacement', + 'thoroughness': 'de.cau.cs.kieler.klay.layered.thoroughness', + 'wideNodesOnMultipleLayers': 'de.cau.cs.kieler.klay.layered.wideNodesOnMultipleLayers' +}; + +var mapToKlayNS = function mapToKlayNS(klayOpts) { + var keys = Object.keys(klayOpts); + var ret = {}; + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var nsKey = klayNSLookup[key]; + var val = klayOpts[key]; + + ret[nsKey] = val; + } + + return ret; +}; + +var klayOverrides = { + interactiveReferencePoint: 'CENTER' // Determines which point of a node is considered by interactive layout phases. +}; + +var getPos = function getPos(ele) { + var parent = ele.parent(); + var k = ele.scratch('klay'); + var p = { + x: k.x, + y: k.y + }; + + while (parent.nonempty()) { + var kp = parent.scratch('klay'); + p.x += kp.x; + p.y += kp.y; + parent = parent.parent(); + } + + return p; +}; + +var makeNode = function makeNode(node, options) { + var dims = node.layoutDimensions(options); + var padding = node.numericStyle('padding'); + + var k = { + _cyEle: node, + id: node.id(), + padding: { + top: padding, + left: padding, + bottom: padding, + right: padding + } + }; + + if (!node.isParent()) { + k.width = dims.w; + k.height = dims.h; + } + + node.scratch('klay', k); + + return k; +}; + +var makeEdge = function makeEdge(edge, options) { + var k = { + _cyEle: edge, + id: edge.id(), + source: edge.data('source'), + target: edge.data('target'), + properties: {} + }; + + var priority = options.priority(edge); + + if (priority != null) { + k.properties.priority = priority; + } + + edge.scratch('klay', k); + + return k; +}; + +var makeGraph = function makeGraph(nodes, edges, options) { + var klayNodes = []; + var klayEdges = []; + var klayEleLookup = {}; + var graph = { + id: 'root', + children: [], + edges: [] + }; + + // map all nodes + for (var i = 0; i < nodes.length; i++) { + var n = nodes[i]; + var k = makeNode(n, options); + + klayNodes.push(k); + + klayEleLookup[n.id()] = k; + } + + // map all edges + for (var _i = 0; _i < edges.length; _i++) { + var e = edges[_i]; + var _k = makeEdge(e, options); + + klayEdges.push(_k); + + klayEleLookup[e.id()] = _k; + } + + // make hierarchy + for (var _i2 = 0; _i2 < klayNodes.length; _i2++) { + var _k2 = klayNodes[_i2]; + var _n = _k2._cyEle; + + if (!_n.isChild()) { + graph.children.push(_k2); + } else { + var parent = _n.parent(); + var parentK = klayEleLookup[parent.id()]; + + var children = parentK.children = parentK.children || []; + + children.push(_k2); + } + } + + for (var _i3 = 0; _i3 < klayEdges.length; _i3++) { + var _k3 = klayEdges[_i3]; + var _e = _k3._cyEle; + var parentSrc = _e.source().parent(); + var parentTgt = _e.target().parent(); + + // put all edges in the top level for now + // TODO does this cause issues in certain edgecases? + if (false) { + var kp = klayEleLookup[parentSrc.id()]; + + kp.edges = kp.edges || []; + + kp.edges.push(_k3); + } else { + graph.edges.push(_k3); + } + } + + return graph; +}; + +function Layout(options) { + var klayOptions = options.klay; + + this.options = assign({}, defaults, options); + + this.options.klay = assign({}, defaults.klay, klayOptions, klayOverrides); +} + +Layout.prototype.run = function () { + var layout = this; + var options = this.options; + + var eles = options.eles; + var nodes = eles.nodes(); + var edges = eles.edges(); + + var graph = makeGraph(nodes, edges, options); + + klay.layout({ + graph: graph, + options: mapToKlayNS(options.klay), + success: function success() {}, + error: function error(_error) { + throw _error; + } + }); + + nodes.filter(function (n) { + return !n.isParent(); + }).layoutPositions(layout, options, getPos); + + return this; +}; + +Layout.prototype.stop = function () { + return this; // chaining +}; + +Layout.prototype.destroy = function () { + return this; // chaining +}; + +module.exports = Layout; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// Simple, internal Object.assign() polyfill for options objects etc. + +module.exports = Object.assign != null ? Object.assign.bind(Object) : function (tgt) { + for (var _len = arguments.length, srcs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + srcs[_key - 1] = arguments[_key]; + } + + srcs.filter(function (src) { + return src != null; + }).forEach(function (src) { + Object.keys(src).forEach(function (k) { + return tgt[k] = src[k]; + }); + }); + + return tgt; +}; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var defaults = { + nodeDimensionsIncludeLabels: false, // Boolean which changes whether label dimensions are included when calculating node dimensions + fit: true, // Whether to fit + padding: 20, // Padding on fit + animate: false, // Whether to transition the node positions + animateFilter: function animateFilter(node, i) { + return true; + }, // Whether to animate specific nodes when animation is on; non-animated nodes immediately go to their final positions + animationDuration: 500, // Duration of animation in ms if enabled + animationEasing: undefined, // Easing of animation if enabled + transform: function transform(node, pos) { + return pos; + }, // A function that applies a transform to the final node position + ready: undefined, // Callback on layoutready + stop: undefined, // Callback on layoutstop + klay: { + // Following descriptions taken from http://layout.rtsys.informatik.uni-kiel.de:9444/Providedlayout.html?algorithm=de.cau.cs.kieler.klay.layered + addUnnecessaryBendpoints: false, // Adds bend points even if an edge does not change direction. + aspectRatio: 1.6, // The aimed aspect ratio of the drawing, that is the quotient of width by height + borderSpacing: 20, // Minimal amount of space to be left to the border + compactComponents: false, // Tries to further compact components (disconnected sub-graphs). + crossingMinimization: 'LAYER_SWEEP', // Strategy for crossing minimization. + /* LAYER_SWEEP The layer sweep algorithm iterates multiple times over the layers, trying to find node orderings that minimize the number of crossings. The algorithm uses randomization to increase the odds of finding a good result. To improve its results, consider increasing the Thoroughness option, which influences the number of iterations done. The Randomization seed also influences results. + INTERACTIVE Orders the nodes of each layer by comparing their positions before the layout algorithm was started. The idea is that the relative order of nodes as it was before layout was applied is not changed. This of course requires valid positions for all nodes to have been set on the input graph before calling the layout algorithm. The interactive layer sweep algorithm uses the Interactive Reference Point option to determine which reference point of nodes are used to compare positions. */ + cycleBreaking: 'GREEDY', // Strategy for cycle breaking. Cycle breaking looks for cycles in the graph and determines which edges to reverse to break the cycles. Reversed edges will end up pointing to the opposite direction of regular edges (that is, reversed edges will point left if edges usually point right). + /* GREEDY This algorithm reverses edges greedily. The algorithm tries to avoid edges that have the Priority property set. + INTERACTIVE The interactive algorithm tries to reverse edges that already pointed leftwards in the input graph. This requires node and port coordinates to have been set to sensible values.*/ + direction: 'UNDEFINED', // Overall direction of edges: horizontal (right / left) or vertical (down / up) + /* UNDEFINED, RIGHT, LEFT, DOWN, UP */ + edgeRouting: 'ORTHOGONAL', // Defines how edges are routed (POLYLINE, ORTHOGONAL, SPLINES) + edgeSpacingFactor: 0.5, // Factor by which the object spacing is multiplied to arrive at the minimal spacing between edges. + feedbackEdges: false, // Whether feedback edges should be highlighted by routing around the nodes. + fixedAlignment: 'NONE', // Tells the BK node placer to use a certain alignment instead of taking the optimal result. This option should usually be left alone. + /* NONE Chooses the smallest layout from the four possible candidates. + LEFTUP Chooses the left-up candidate from the four possible candidates. + RIGHTUP Chooses the right-up candidate from the four possible candidates. + LEFTDOWN Chooses the left-down candidate from the four possible candidates. + RIGHTDOWN Chooses the right-down candidate from the four possible candidates. + BALANCED Creates a balanced layout from the four possible candidates. */ + inLayerSpacingFactor: 1.0, // Factor by which the usual spacing is multiplied to determine the in-layer spacing between objects. + layoutHierarchy: false, // Whether the selected layouter should consider the full hierarchy + linearSegmentsDeflectionDampening: 0.3, // Dampens the movement of nodes to keep the diagram from getting too large. + mergeEdges: false, // Edges that have no ports are merged so they touch the connected nodes at the same points. + mergeHierarchyCrossingEdges: true, // If hierarchical layout is active, hierarchy-crossing edges use as few hierarchical ports as possible. + nodeLayering: 'NETWORK_SIMPLEX', // Strategy for node layering. + /* NETWORK_SIMPLEX This algorithm tries to minimize the length of edges. This is the most computationally intensive algorithm. The number of iterations after which it aborts if it hasn't found a result yet can be set with the Maximal Iterations option. + LONGEST_PATH A very simple algorithm that distributes nodes along their longest path to a sink node. + INTERACTIVE Distributes the nodes into layers by comparing their positions before the layout algorithm was started. The idea is that the relative horizontal order of nodes as it was before layout was applied is not changed. This of course requires valid positions for all nodes to have been set on the input graph before calling the layout algorithm. The interactive node layering algorithm uses the Interactive Reference Point option to determine which reference point of nodes are used to compare positions. */ + nodePlacement: 'BRANDES_KOEPF', // Strategy for Node Placement + /* BRANDES_KOEPF Minimizes the number of edge bends at the expense of diagram size: diagrams drawn with this algorithm are usually higher than diagrams drawn with other algorithms. + LINEAR_SEGMENTS Computes a balanced placement. + INTERACTIVE Tries to keep the preset y coordinates of nodes from the original layout. For dummy nodes, a guess is made to infer their coordinates. Requires the other interactive phase implementations to have run as well. + SIMPLE Minimizes the area at the expense of... well, pretty much everything else. */ + randomizationSeed: 1, // Seed used for pseudo-random number generators to control the layout algorithm; 0 means a new seed is generated + routeSelfLoopInside: false, // Whether a self-loop is routed around or inside its node. + separateConnectedComponents: true, // Whether each connected component should be processed separately + spacing: 20, // Overall setting for the minimal amount of space to be left between objects + thoroughness: 7 // How much effort should be spent to produce a nice layout.. + }, + priority: function priority(edge) { + return null; + } // Edges with a non-nil value are skipped when geedy edge cycle breaking is enabled +}; + +module.exports = defaults; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var impl = __webpack_require__(0); + +// registers the extension on a cytoscape lib ref +var register = function register(cytoscape) { + if (!cytoscape) { + return; + } // can't register if cytoscape unspecified + + cytoscape('layout', 'klay', impl); // register with cytoscape.js +}; + +if (typeof cytoscape !== 'undefined') { + // expose to global cytoscape (i.e. window.cytoscape) + register(cytoscape); +} + +module.exports = register; + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE_4__; + +/***/ }) +/******/ ]); +}); \ No newline at end of file diff --git a/Scripts/JavaScript/cytoscape.min.js b/Scripts/JavaScript/cytoscape.min.js new file mode 100644 index 0000000..fc6c021 --- /dev/null +++ b/Scripts/JavaScript/cytoscape.min.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016-2022, The Cytoscape Consortium. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the “Software”), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).cytoscape=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;nt?1:0},I=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var d=i<.5?i*(1+r):i+r-i*r,h=2*i-d;o=Math.round(255*u(h,d,n+1/3)),s=Math.round(255*u(h,d,n)),l=Math.round(255*u(h,d,n-1/3))}t=[o,s,l,a]}return t}(e)},A={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},L=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=t||n<0||d&&e-u>=a}function v(){var e=U();if(g(e))return y(e);s=setTimeout(v,function(e){var n=t-(e-l);return d?Z(n,a-(e-u)):n}(e))}function y(e){return s=void 0,h&&r?p(e):(r=i=void 0,o)}function m(){var e=U(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return f(l);if(d)return s=setTimeout(v,t),p(l)}return void 0===s&&(s=setTimeout(v,t)),o}return t=Q(t)||0,$(n)&&(c=!!n.leading,a=(d="maxWait"in n)?G(Q(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},m.flush=function(){return void 0===s?o:y(U())},m},ee=o?o.performance:null,te=ee&&ee.now?function(){return ee.now()}:function(){return Date.now()},ne=function(){if(o){if(o.requestAnimationFrame)return function(e){o.requestAnimationFrame(e)};if(o.mozRequestAnimationFrame)return function(e){o.mozRequestAnimationFrame(e)};if(o.webkitRequestAnimationFrame)return function(e){o.webkitRequestAnimationFrame(e)};if(o.msRequestAnimationFrame)return function(e){o.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(te())}),1e3/60)}}(),re=function(e){return ne(e)},ie=te,ae=65599,oe=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=r*ae+t.value|0;return r},se=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return t*ae+e|0},le=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},ue=function(e){return 2097152*e[0]+e[1]},ce=function(e,t){return[se(e[0],t[0]),le(e[1],t[1])]},de=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return oe({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},Be=function(e){e.splice(0,e.length)},Ne=function(e,t,n){return n&&(t=T(n,t)),e[t]},Ie=function(e,t,n,r){n&&(t=T(n,t)),e[t]=r},ze="undefined"!=typeof Map?Map:function(){function e(){t(this,e),this._obj={}}return r(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Ae=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var i=0;i2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&E(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Le,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];g(t.classes)?l=t.classes:p(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);in;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;ag;0<=g?++h:--h)v.push(a(e,r));return v},f=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},g=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i0;){var k=b.pop(),_=y(k),C=k.id();if(d[C]=_,_!==1/0)for(var S=k.neighborhood().intersect(f),P=0;P0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},Ye={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0;){if(l=g.pop(),u=l.id(),v.delete(u),w++,u===d){for(var E=[],k=i,_=d,C=m[_];E.unshift(k),null!=C&&E.unshift(C),null!=(k=y[_]);)C=m[_=k.id()];return{found:!0,distance:h[u],path:this.spawn(E),steps:w}}f[u]=!0;for(var S=l._private.edges,P=0;PP&&(f[S]=P,m[S]=C,b[S]=w),!i){var D=C*u+_;!i&&f[D]>P&&(f[D]=P,m[D]=_,b[D]=w)}}}for(var T=0;T1&&void 0!==arguments[1]?arguments[1]:a,r=b(e),i=[],o=r;;){if(null==o)return t.spawn();var l=m(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},hasNegativeWeightCycle:g,negativeWeightCycles:v}}},Ue=Math.sqrt(2),$e=function(e,t,n){0===n.length&&Ee("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;pr;){var i=Math.floor(Math.random()*t.length);t=$e(i,e,t),n--}return t},Je={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/Ue);if(!(i<2)){for(var l=[],u=0;u0?1:e<0?-1:0},ot=function(e,t){return Math.sqrt(st(e,t))},st=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},lt=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},pt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},ft=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},gt=function(e){var t,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=r=i=o[0];else if(2===o.length)t=r=o[0],i=n=o[1];else if(4===o.length){var s=a(o,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},vt=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},yt=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},mt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},bt=function(e,t){return mt(e,t.x1,t.y1)&&mt(e,t.x2,t.y2)},xt=function(e,t,n,r,i,a,o){var s,l=Rt(i,a),u=i/2,c=a/2,d=r-c-o;if((s=Nt(e,t,n,r,n-u+l-o,d,n+u-l+o,d,!1)).length>0)return s;var h=n+u+o;if((s=Nt(e,t,n,r,h,r-c+l-o,h,r+c-l+o,!1)).length>0)return s;var p=r+c+o;if((s=Nt(e,t,n,r,n-u+l-o,p,n+u-l+o,p,!1)).length>0)return s;var f,g=n-u-o;if((s=Nt(e,t,n,r,g,r-c+l-o,g,r+c-l+o,!1)).length>0)return s;var v=n-u+l,y=r-c+l;if((f=Mt(e,t,n,r,v,y,l+o)).length>0&&f[0]<=v&&f[1]<=y)return[f[0],f[1]];var m=n+u-l,b=r-c+l;if((f=Mt(e,t,n,r,m,b,l+o)).length>0&&f[0]>=m&&f[1]<=b)return[f[0],f[1]];var x=n+u-l,w=r+c-l;if((f=Mt(e,t,n,r,x,w,l+o)).length>0&&f[0]>=x&&f[1]>=w)return[f[0],f[1]];var E=n-u+l,k=r+c-l;return(f=Mt(e,t,n,r,E,k,l+o)).length>0&&f[0]<=E&&f[1]>=k?[f[0],f[1]]:[]},wt=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Et=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,d=Math.min(r,s,a)-l,h=Math.max(r,s,a)+l;return!(ec||th)},kt=function(e,t,n,r,i,a,o,s){var l=[];!function(e,t,n,r,i){var a,o,s,l,u,c,d,h;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,d=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,i[4]=i[2]=-(h+d)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),i[4]=-d+h*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,p,f=-1,g=0;g=0?pl?(e-i)*(e-i)+(t-a)*(t-a):u-d},Ct=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},St=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),p=Math.sin(-u),f=0;f0){var g=Dt(c,-l);d=Pt(g)}else d=c;return Ct(e,t,d)},Pt=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},Bt=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Nt=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(0!==y){var m=g/y,b=v/y;return-.001<=m&&m<=1.001&&-.001<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return 0===g||0===v?Bt(e,n,o)===o?[o,s]:Bt(e,n,i)===i?[i,a]:Bt(i,o,n)===n?[n,r]:[]:[]},It=function(e,t,n,r,i,a,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0){var m=Dt(g,-s);u=Pt(m)}else u=g}else u=n;for(var b=0;bu&&(u=t)},d=function(e){return l[e]},h=0;h0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),h[m]>h[v]+w&&(h[m]=h[v]+w,p.nodes.indexOf(m)<0?p.push(m):p.updateItem(m),u[m]=0,l[m]=[]),h[m]==h[v]+w&&(u[m]=u[m]+u[v],l[m].push(v))}else for(var E=0;E0;){for(var S=n.pop(),P=0;P0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:on,o=r,s=0;s=2?hn(e,t,n,0,un,cn):hn(e,t,n,0,ln)},squaredEuclidean:function(e,t,n){return hn(e,t,n,0,un)},manhattan:function(e,t,n){return hn(e,t,n,0,ln)},max:function(e,t,n){return hn(e,t,n,-1/0,dn)}};function fn(e,t,n,r,i,a){var o;return o=f(e)?e:pn[e]||pn.euclidean,0===t&&f(e)?o(i,a):o(t,n,r,i,a)}pn["squared-euclidean"]=pn.squaredEuclidean,pn.squaredeuclidean=pn.squaredEuclidean;var gn=Te({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),vn=function(e){return gn(e)},yn=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return fn(e,r.length,a,(function(e){return r[e](t)}),o,s)},mn=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},En=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===i.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;vn[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[f.key][y.key],n[f.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u=P?(D=P,P=M,T=B):M>D&&(D=M);for(var N=0;N0?1:0;_[k%u.minIterations*t+R]=F,O+=F}if(O>0&&(k>=u.minIterations-1||k==u.maxIterations-1)){for(var V=0,j=0;j0&&r.push(i);return r}(t,a,o),X=function(e,t,n){for(var r=Rn(e,t,n),i=0;il&&(s=u,l=c)}n[i]=a[s]}return r=Rn(e,t,n)}(t,r,Y),W={},H=0;H1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},Yn=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e);return e.forEach((function(o){if(o.isNode()){var s=o.id();s in t||function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),a=a.difference(d)}}(s)}})),{cut:a,components:r}},Xn={};[Fe,qe,Ye,We,Ke,Ze,Je,qt,Xt,Ht,Gt,an,Dn,zn,Vn,{hierholzer:function(e){if(!v(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=jn(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=p(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(i&&r!=i)return h;i=r}else{if(i&&r!=i&&n!=i)return h;i||(i=r)}else i||(i=l[0].id());var f=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},g=[],y=[];for(y=f(i);1!=y.length;)0==c[y[0]].length?(g.unshift(l.getElementById(y.shift())),g.unshift(l.getElementById(y.shift()))):y=f(y.shift()).concat(y);for(var m in g.unshift(l.getElementById(y.shift())),c)if(c[m].length)return h;return h.found=!0,h.trail=this.spawn(g,!0),h}},{hopcroftTarjanBiconnected:qn,htbc:qn,htb:qn,hopcroftTarjanBiconnectedComponents:qn},{tarjanStronglyConnected:Yn,tsc:Yn,tscc:Yn,tarjanStronglyConnectedComponents:Yn}].forEach((function(e){I(Xn,e)})); +/*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + */ +var Wn=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Wn.prototype={fulfill:function(e){return Hn(this,1,"fulfillValue",e)},reject:function(e){return Hn(this,2,"rejectReason",e)},then:function(e,t){var n=new Wn;return this.onFulfilled.push(Zn(e,n,"fulfill")),this.onRejected.push(Zn(t,n,"reject")),Kn(this),n.proxy}};var Hn=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Kn(e)),e},Kn=function(e){1===e.state?Gn(e,"onFulfilled",e.fulfillValue):2===e.state&&Gn(e,"onRejected",e.rejectReason)},Gn=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t-1},Pr.prototype.set=function(e,t){var n=this.__data__,r=Tr(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Dr.prototype.clear=function(){this.__data__={hash:new Sr,map:new(Er||Pr),string:new Sr}},Dr.prototype.delete=function(e){return Nr(this,e).delete(e)},Dr.prototype.get=function(e){return Nr(this,e).get(e)},Dr.prototype.has=function(e){return Nr(this,e).has(e)},Dr.prototype.set=function(e,t){return Nr(this,e).set(e,t),this};var zr=Lr((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(Fr(e))return Cr?Cr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return rr.test(e)&&n.push(""),e.replace(ir,(function(e,t,r,i){n.push(r?i.replace(ar,"$1"):t||e)})),n}));function Ar(e){if("string"==typeof e||Fr(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Lr(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o),o};return n.cache=new(Lr.Cache||Dr),n}Lr.Cache=Dr;var Or=Array.isArray;function Rr(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Fr(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==mr.call(e)}var Vr=function(e,t,n){var r=null==e?void 0:Mr(e,t);return void 0===r?n:r},jr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qr=/^\w*$/,Yr=/^\./,Xr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wr=/\\(\\)?/g,Hr=/^\[object .+?Constructor\]$/,Kr=/^(?:0|[1-9]\d*)$/,Gr="object"==typeof R&&R&&R.Object===Object&&R,Zr="object"==typeof self&&self&&self.Object===Object&&self,Ur=Gr||Zr||Function("return this")();var $r=Array.prototype,Qr=Function.prototype,Jr=Object.prototype,ei=Ur["__core-js_shared__"],ti=function(){var e=/[^.]+$/.exec(ei&&ei.keys&&ei.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ni=Qr.toString,ri=Jr.hasOwnProperty,ii=Jr.toString,ai=RegExp("^"+ni.call(ri).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oi=Ur.Symbol,si=$r.splice,li=xi(Ur,"Map"),ui=xi(Object,"create"),ci=oi?oi.prototype:void 0,di=ci?ci.toString:void 0;function hi(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1},pi.prototype.set=function(e,t){var n=this.__data__,r=vi(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},fi.prototype.clear=function(){this.__data__={hash:new hi,map:new(li||pi),string:new hi}},fi.prototype.delete=function(e){return bi(this,e).delete(e)},fi.prototype.get=function(e){return bi(this,e).get(e)},fi.prototype.has=function(e){return bi(this,e).has(e)},fi.prototype.set=function(e,t){return bi(this,e).set(e,t),this};var Ei=_i((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(Di(e))return di?di.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return Yr.test(e)&&n.push(""),e.replace(Xr,(function(e,t,r,i){n.push(r?i.replace(Wr,"$1"):t||e)})),n}));function ki(e){if("string"==typeof e||Di(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function _i(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o),o};return n.cache=new(_i.Cache||fi),n}function Ci(e,t){return e===t||e!=e&&t!=t}_i.Cache=fi;var Si=Array.isArray;function Pi(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Di(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==ii.call(e)}var Ti=function(e,t,n){return null==e?e:mi(e,t,n)},Mi=/^\./,Bi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ni=/\\(\\)?/g,Ii=/^\[object .+?Constructor\]$/,zi="object"==typeof R&&R&&R.Object===Object&&R,Ai="object"==typeof self&&self&&self.Object===Object&&self,Li=zi||Ai||Function("return this")();var Oi=Array.prototype,Ri=Function.prototype,Fi=Object.prototype,Vi=Li["__core-js_shared__"],ji=function(){var e=/[^.]+$/.exec(Vi&&Vi.keys&&Vi.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),qi=Ri.toString,Yi=Fi.hasOwnProperty,Xi=Fi.toString,Wi=RegExp("^"+qi.call(Yi).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hi=Li.Symbol,Ki=Oi.splice,Gi=ia(Li,"Map"),Zi=ia(Object,"create"),Ui=Hi?Hi.prototype:void 0,$i=Ui?Ui.toString:void 0;function Qi(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1},Ji.prototype.set=function(e,t){var n=this.__data__,r=ta(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},ea.prototype.clear=function(){this.__data__={hash:new Qi,map:new(Gi||Ji),string:new Qi}},ea.prototype.delete=function(e){return ra(this,e).delete(e)},ea.prototype.get=function(e){return ra(this,e).get(e)},ea.prototype.has=function(e){return ra(this,e).has(e)},ea.prototype.set=function(e,t){return ra(this,e).set(e,t),this};var aa=sa((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(ca(e))return $i?$i.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return Mi.test(e)&&n.push(""),e.replace(Bi,(function(e,t,r,i){n.push(r?i.replace(Ni,"$1"):t||e)})),n}));function oa(e){if("string"==typeof e||ca(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function sa(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o),o};return n.cache=new(sa.Cache||ea),n}sa.Cache=ea;var la=Array.isArray;function ua(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ca(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==Xi.call(e)}var da=function(e){return la(e)?function(e,t){for(var n=-1,r=e?e.length:0,i=Array(r);++n0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){g(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};fa.className=fa.classNames=fa.classes;var ga={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:B,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};ga.variable="(?:[\\w-.]|(?:\\\\"+ga.metaChar+"))+",ga.value=ga.string+"|"+ga.number,ga.className=ga.variable,ga.id=ga.variable,function(){var e,t,n;for(e=ga.comparatorOp.split("|"),n=0;n=0||"="!==t&&(ga.comparatorOp+="|\\!"+t)}();var va=0,ya=1,ma=2,ba=3,xa=4,wa=5,Ea=6,ka=7,_a=8,Ca=9,Sa=10,Pa=11,Da=12,Ta=13,Ma=14,Ba=15,Na=16,Ia=17,za=18,Aa=19,La=20,Oa=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*N(e,t)}(e.selector,t.selector)})),Ra=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return _e("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return _e("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&_e("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return p(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case va:var l=e(s);return l.substring(0,l.length-1);case ba:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case wa:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case xa:return"["+r.field+"]";case Ea:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case ka:return s;case _a:return"#"+s;case Ca:return"."+s;case Ia:case Ba:return i(r.parent,a)+n(">")+i(r.child,a);case za:case Na:return i(r.ancestor,a)+" "+i(r.descendant,a);case Aa:var f=i(r.left,a),g=i(r.subject,a),v=i(r.right,a);return f+(f.length>0?" ":"")+g+v;case La:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function ro(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return no(this,e,t,ro)},to.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return no(this,e,t,io)},to.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return no(this,e,t,ao)},to.ancestors=to.parents,(Qa=Ja={data:ha.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:ha.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ha.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ha.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ha.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ha.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Qa.data,Qa.removeAttr=Qa.removeData;var oo,so,lo=Ja,uo={};function co(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;at})),minIndegree:ho("indegree",(function(e,t){return et})),minOutdegree:ho("outdegree",(function(e,t){return et}))}),I(uo,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var h=0;h0,m=y;y&&(g=g[0]);var b=m?g.position():{x:0,y:0};void 0!==t?f.position(e,t+b[e]):void 0!==i&&f.position({x:i.x+b.x,y:i.y+b.y})}}else if(!a)return;return this}}).modelPosition=oo.point=oo.position,oo.modelPositions=oo.points=oo.positions,oo.renderedPoint=oo.renderedPosition,oo.relativePoint=oo.relativePosition;var go,vo,yo=so;go=vo={},vo.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},vo.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},vo.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=y(i.width.val-a.w,s,l),h=d.biasDiff,p=d.biasComplementDiff,f=y(i.height.val-a.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},xo=function(e,t){return null==t?e:bo(e,t.x1,t.y1,t.x2,t.y2)},wo=function(e,t,n){return Ne(e,t,n)},Eo=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,ft(u,1),bo(e,u.x1,u.y1,u.x2,u.y2)}}},ko=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=wo(a,"labelWidth",n),p=wo(a,"labelHeight",n),f=wo(a,"labelX",n),g=wo(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=p,_=h,C=_/2,S=k/2;if(m)o=f-C,s=f+C,l=g-S,u=g+S;else{switch(c.value){case"left":o=f-_,s=f;break;case"center":o=f-C,s=f+C;break;case"right":o=f,s=f+_}switch(d.value){case"top":l=g-k,u=g;break;case"center":l=g-S,u=g+S;break;case"bottom":l=g,u=g+k}}o+=v-Math.max(x,w)-E-2,s+=v+Math.max(x,w)+E+2,l+=y-Math.max(x,w)-E-2,u+=y+Math.max(x,w)+E+2;var P=n||"main",D=i.labelBounds,T=D[P]=D[P]||{};T.x1=o,T.y1=l,T.x2=s,T.y2=u,T.w=s-o,T.h=u-l;var M=m&&"autorotate"===b.strValue,B=null!=b.pfValue&&0!==b.pfValue;if(M||B){var N=M?wo(i.rstyle,"labelAngle",n):b.pfValue,I=Math.cos(N),z=Math.sin(N),A=(o+s)/2,L=(l+u)/2;if(!m){switch(c.value){case"left":A=s;break;case"right":A=o}switch(d.value){case"top":L=u;break;case"bottom":L=l}}var O=function(e,t){return{x:(e-=A)*I-(t-=L)*z+A,y:e*z+t*I+L}},R=O(o,l),F=O(o,u),V=O(s,l),j=O(s,u);o=Math.min(R.x,F.x,V.x,j.x),s=Math.max(R.x,F.x,V.x,j.x),l=Math.min(R.y,F.y,V.y,j.y),u=Math.max(R.y,F.y,V.y,j.y)}var q=P+"Rot",Y=D[q]=D[q]||{};Y.x1=o,Y.y1=l,Y.x2=s,Y.y2=u,Y.w=s-o,Y.h=u-l,bo(e,o,l,s,u),bo(i.labelBounds.all,o,l,s,u)}return e}},_o=function(e){var t=0,n=function(e){return(e?1:0)<(r=S[1].x)){var P=n;n=r,r=P}if(i>(a=S[1].y)){var D=i;i=a,a=D}bo(h,n-w,i-w,r+w,a+w)}}else if("bezier"===C||"unbundled-bezier"===C||"segments"===C||"taxi"===C){var T;switch(C){case"bezier":case"unbundled-bezier":T=v.bezierPts;break;case"segments":case"taxi":T=v.linePts}if(null!=T)for(var M=0;M(r=I.x)){var z=n;n=r,r=z}if((i=N.y)>(a=I.y)){var A=i;i=a,a=A}bo(h,n-=w,i-=w,r+=w,a+=w)}if(c&&t.includeEdges&&g&&(Eo(h,e,"mid-source"),Eo(h,e,"mid-target"),Eo(h,e,"source"),Eo(h,e,"target")),c)if("yes"===e.pstyle("ghost").value){var L=e.pstyle("ghost-offset-x").pfValue,O=e.pstyle("ghost-offset-y").pfValue;bo(h,h.x1+L,h.y1+O,h.x2+L,h.y2+O)}var R=p.bodyBounds=p.bodyBounds||{};vt(R,h),gt(R,y),ft(R,1),c&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,bo(h,n-x,i-x,r+x,a+x));var F=p.overlayBounds=p.overlayBounds||{};vt(F,h),gt(F,y),ft(F,1);var V=p.labelBounds=p.labelBounds||{};null!=V.all?((l=V.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):V.all=ht(),c&&t.includeLabels&&(t.includeMainLabels&&ko(h,e,null),g&&(t.includeSourceLabels&&ko(h,e,"source"),t.includeTargetLabels&&ko(h,e,"target")))}return h.x1=mo(h.x1),h.y1=mo(h.y1),h.x2=mo(h.x2),h.y2=mo(h.y2),h.w=mo(h.x2-h.x1),h.h=mo(h.y2-h.y1),h.w>0&&h.h>0&&b&&(gt(h,y),ft(h,1)),h}(e,Po),r.bbCache=n,r.bbCachePosKey=o):n=r.bbCache,!a){var c=e.isNode();n=ht(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?xo(n,r.overlayBounds):xo(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?xo(n,r.labelBounds.all):(t.includeMainLabels&&xo(n,r.labelBounds.mainRot),t.includeSourceLabels&&xo(n,r.labelBounds.sourceRot),t.includeTargetLabels&&xo(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Po={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,useCache:!0},Do=_o(Po),To=Te(Po);vo.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=ht();var n=To(e=e||Po);if(this.cy().styleEnabled())for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:Xo,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},Ho.removeAllListeners=function(){return this.removeListener("*")},Ho.emit=Ho.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,g(t)||(t=[t]),Zo(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&p(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=0;rr&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(v(e)){var i=e;r.applyBypass(this,i,!1),this.emitAndNotify("style")}else if(p(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),bs.neighbourhood=bs.neighborhood,bs.closedNeighbourhood=bs.closedNeighborhood,bs.openNeighbourhood=bs.openNeighborhood,I(bs,{source:eo((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:eo((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:ks({attr:"source"}),targets:ks({attr:"target"})}),I(bs,{edgesWith:eo(_s(),"edgesWith"),edgesTo:eo(_s({thisIsSrc:!0}),"edgesTo")}),I(bs,{connectedEdges:eo((function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),bs.componentsOf=bs.components;var Ss=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(void 0!==e){var r=new ze,i=!1;if(t){if(t.length>0&&v(t[0])&&!x(t[0])){i=!0;for(var a=[],o=new Le,s=0,l=t.length;s0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u0){for(var R=e.length===i.length?i:new Ss(a,e),F=0;F0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?P.emitAndNotify("remove"):t&&P.emit("remove"));for(var D=0;D1e-4&&Math.abs(s.v)>1e-4;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),Ms=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!=typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function g(e){return 3*e}function v(e,t,n){return((p(t,n)*e+f(t,n))*e+g(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*f(t,n)*e+g(t)}function m(t,r){for(var a=0;a0?i=l:r=l}while(Math.abs(a)>o&&++u=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function k(){E=!0,e===t&&n===r||b()}var _=function(i){return E||k(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};_.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var C="generateBezier("+[e,t,n,r]+")";return _.toString=function(){return C},_}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},Bs={linear:function(e,t,n){return e+(t-e)*n},ease:Ms(.25,.1,.25,1),"ease-in":Ms(.42,0,1,1),"ease-out":Ms(0,0,.58,1),"ease-in-out":Ms(.42,0,.58,1),"ease-in-sine":Ms(.47,0,.745,.715),"ease-out-sine":Ms(.39,.575,.565,1),"ease-in-out-sine":Ms(.445,.05,.55,.95),"ease-in-quad":Ms(.55,.085,.68,.53),"ease-out-quad":Ms(.25,.46,.45,.94),"ease-in-out-quad":Ms(.455,.03,.515,.955),"ease-in-cubic":Ms(.55,.055,.675,.19),"ease-out-cubic":Ms(.215,.61,.355,1),"ease-in-out-cubic":Ms(.645,.045,.355,1),"ease-in-quart":Ms(.895,.03,.685,.22),"ease-out-quart":Ms(.165,.84,.44,1),"ease-in-out-quart":Ms(.77,0,.175,1),"ease-in-quint":Ms(.755,.05,.855,.06),"ease-out-quint":Ms(.23,1,.32,1),"ease-in-out-quint":Ms(.86,0,.07,1),"ease-in-expo":Ms(.95,.05,.795,.035),"ease-out-expo":Ms(.19,1,.22,1),"ease-in-out-expo":Ms(1,0,0,1),"ease-in-circ":Ms(.6,.04,.98,.335),"ease-out-circ":Ms(.075,.82,.165,1),"ease-in-out-circ":Ms(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Bs.linear;var r=Ts(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":Ms};function Ns(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function Is(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function zs(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=Is(e,i),s=Is(t,i);if(y(o)&&y(s))return Ns(a,o,s,n,r);if(g(o)&&g(s)){for(var l=[],u=0;u0?("spring"===d&&h.push(o.duration),o.easingImpl=Bs[d].apply(null,h)):o.easingImpl=Bs[d]}var f,g=o.easingImpl;if(f=0===o.duration?1:(n-l)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var v=o.startPosition,y=o.position;if(y&&i&&!e.locked()){var m={};Ls(v.x,y.x)&&(m.x=zs(v.x,y.x,f,g)),Ls(v.y,y.y)&&(m.y=zs(v.y,y.y,f,g)),e.position(m)}var b=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(Ls(b.x,x.x)&&(w.x=zs(b.x,x.x,f,g)),Ls(b.y,x.y)&&(w.y=zs(b.y,x.y,f,g)),e.emit("pan"));var k=o.startZoom,_=o.zoom,C=null!=_&&r;C&&(Ls(k,_)&&(a.zoom=dt(a.minZoom,zs(k,_,f,g),a.maxZoom)),e.emit("zoom")),(E||C)&&e.emit("viewport");var S=o.style;if(S&&S.length>0&&i){for(var P=0;P=0;t--){(0,e[t])()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var d=a[c],h=d._private;h.stopped?(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||Os(0,d,e),As(t,d,e,n),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Fs={animate:ha.animate(),animation:ha.animation(),animated:ha.animated(),clearQueue:ha.clearQueue(),delay:ha.delay(),delayAnimation:ha.delayAnimation(),stop:ha.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){Rs(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&re((function(n){Rs(n,e),t()}))}()}}},Vs={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&x(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},js=function(e){return p(e)?new Za(e):e},qs={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Wo(Vs,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,js(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,js(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,js(t),n),this},once:function(e,t,n){return this.emitter().one(e,js(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};ha.eventAliasesOn(qs);var Ys={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Ys.jpeg=Ys.jpg;var Xs={layout:function(e){if(null!=e)if(null!=e.name){var t=e.name,n=this.extension("layout",t);if(null!=n){var r;r=p(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$();var i=new n(I({},e,{cy:this,eles:r}));return i}Ee("No such layout `"+t+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ee("A `name` must be specified to make a layout");else Ee("Layout options must be specified to make a layout")}};Xs.createLayout=Xs.makeLayout=Xs.layout;var Ws={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ks.invalidateDimensions=Ks.resize;var Gs={collection:function(e,t){return p(e)?this.$(e):b(e)?e.collection():g(e)?new Ss(this,e,t):new Ss(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Gs.elements=Gs.filter=Gs.$;var Zs={};Zs.apply=function(e){for(var t=this._private.cy.collection(),n=0;n0;if(d||c&&h){var p=void 0;d&&h||d?p=l.properties:h&&(p=l.mappedProperties);for(var f=0;f1&&(g=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],k=i.valueMin[1],_=i.valueMax[1],C=i.valueMin[2],S=i.valueMax[2],P=null==i.valueMin[3]?1:i.valueMin[3],D=null==i.valueMax[3]?1:i.valueMax[3],T=[Math.round(w+(E-w)*g),Math.round(k+(_-k)*g),Math.round(C+(S-C)*g),Math.round(P+(D-P)*g)];n={bypass:i.bypass,name:i.name,value:T,strValue:"rgb("+T[0]+", "+T[1]+", "+T[2]+")"}}else{if(!s.number)return!1;var M=i.valueMin+(i.valueMax-i.valueMin)*g;n=this.parse(i.name,M,i.bypass,"mapping")}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var B=i.field.split("."),N=d.data,I=0;I0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Zs.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Zs.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Zs.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),"curve-style"!==t||"bezier"!==n&&"bezier"!==r||!i.triggersBoundsOfParallelBeziers||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},Zs.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Us={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){_e("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l)if(new Za(l).invalid){_e("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var d=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!h){_e("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=h[0];var p=h[1],f=h[2];if(this.properties[p])this.parse(p,f)?(d.push({name:p,val:f}),o()):(_e("Skipping property: Invalid property definition in: "+r),o());else _e("Skipping property: Invalid property name in: "+r),o()}if(c){a();break}this.selector(l);for(var g=0;g=7&&"d"===t[0]&&(l=new RegExp(o.data.regex).exec(t))){if(n)return!1;var d=o.data;return{name:e,value:l,strValue:""+t,mapped:d,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(u=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;var h=o.mapData;if(!c.color&&!c.number)return!1;var v=this.parse(e,u[4]);if(!v||v.mapped)return!1;var m=this.parse(e,u[5]);if(!m||m.mapped)return!1;if(v.pfValue===m.pfValue||v.strValue===m.strValue)return _e("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+v.strValue+"`"),this.parse(e,v.strValue);if(c.color){var b=v.value,x=m.value;if(!(b[0]!==x[0]||b[1]!==x[1]||b[2]!==x[2]||b[3]!==x[3]&&(null!=b[3]&&1!==b[3]||null!=x[3]&&1!==x[3])))return!1}return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],fieldMin:parseFloat(u[2]),fieldMax:parseFloat(u[3]),valueMin:v.value,valueMax:m.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var w;if(w=s?t.split(/\s+/):g(t)?t:[t],c.evenMultiple&&w.length%2!=0)return null;for(var E=[],k=[],_=[],C="",S=!1,D=0;D0?" ":"")+T.strValue}return c.validate&&!c.validate(E,k)?null:c.singleEnum&&S?1===E.length&&p(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:_,strValue:C,bypass:n,units:k}}var M,N,I=function(){for(var r=0;rc.max||c.strictMax&&t===c.max))return null;var F={name:e,value:t,strValue:""+t+(A||""),units:A,bypass:n};return c.unitless||"px"!==A&&"em"!==A?F.pfValue=t:F.pfValue="px"!==A&&A?this.getEmSizeInPixels()*t:t,"ms"!==A&&"s"!==A||(F.pfValue="ms"===A?t:1e3*t),"deg"!==A&&"rad"!==A||(F.pfValue="rad"===A?t:(M=t,Math.PI*M/180)),"%"===A&&(F.pfValue=t/100),F}if(c.propList){var V=[],j=""+t;if("none"===j);else{for(var q=j.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),y(e)?n=e:v(e)&&(n=e.level,null!=e.position?t=et(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;y(l.x)&&(t.pan.x=l.x,o=!1),y(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(p(e)){var n=e;e=this.mutableElements().filter(n)}else b(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=o.getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};ol.centre=ol.center,ol.autolockNodes=ol.autolock,ol.autoungrabifyNodes=ol.autoungrabify;var sl={data:ha.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ha.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ha.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ha.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};sl.attr=sl.data,sl.removeAttr=sl.removeData;var ll=function(e){var t=this,n=(e=I({},e)).container;n&&!m(n)&&m(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==o&&void 0!==n&&!e.headless,s=e;s.layout=I({name:a?"grid":"null"},s.layout),s.renderer=I({name:a?"canvas":"null"},s.renderer);var l=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},u=this._private={container:n,ready:!1,options:s,elements:new Ss(this),listeners:[],aniEles:new Ss(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,s.zoomingEnabled),userZoomingEnabled:l(!0,s.userZoomingEnabled),panningEnabled:l(!0,s.panningEnabled),userPanningEnabled:l(!0,s.userPanningEnabled),boxSelectionEnabled:l(!0,s.boxSelectionEnabled),autolock:l(!1,s.autolock,s.autolockNodes),autoungrabify:l(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:l(!1,s.autounselectify),styleEnabled:void 0===s.styleEnabled?a:s.styleEnabled,zoom:y(s.zoom)?s.zoom:1,pan:{x:v(s.pan)&&y(s.pan.x)?s.pan.x:0,y:v(s.pan)&&y(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});u.styleEnabled&&t.setStyle([]);var c=I({},s,s.renderer);t.initRenderer(c);!function(e,t){if(e.some(C))return $n.all(e).then(t);t(e)}([s.style,s.elements],(function(e){var n=e[0],a=e[1];u.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(v(e)||g(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=I({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),u.ready=!0,f(s.ready)&&t.on("ready",s.ready);for(var e=0;e0,u=ht(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(b(n.roots))e=n.roots;else if(g(n.roots)){for(var c=[],d=0;d0;){var I=T.shift(),z=D(I,M);if(z)I.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(B);else if(null===z){_e("Detected double maximal shift for node `"+I.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}P();var A=0;if(n.avoidOverlap)for(var L=0;L0&&x[0].length<=3?l/2:0),d=2*Math.PI/x[r].length*i;return 0===r&&1===x[0].length&&(c=1),{x:G+c*Math.cos(d),y:Z+c*Math.sin(d)}}return{x:G+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var fl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function gl(e){this.options=I({},fl,e)}gl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),m=Math.sin(c)-Math.sin(0),b=Math.sqrt(d*d/(v*v+m*m));o=Math.max(b,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}})),this};var vl,yl={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ml(e){this.options=I({},yl,e)}ml.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d0)Math.abs(m[0].value-x.value)>=v&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var _=0,C=0;C1&&t.avoidOverlap){var T=Math.cos(D)-Math.cos(0),M=Math.sin(D)-Math.sin(0),B=Math.sqrt(w*w/(T*T+M*M));_=Math.max(B,_)}S.r=_,_+=w}if(t.equidistant){for(var N=0,I=0,z=0;z=e.numIter)&&(Pl(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),re(t)):(Fl(r,e),s())}()}else{for(;u;)u=o(l),l++;Fl(r,e),s()}return this},xl.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},xl.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var wl=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:ht(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=n.eles.components(),s={},l=0;l0){a.graphSet.push(w);for(l=0;lr.count?0:r.graph},kl=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=(u=r.nodeOverlap*o)*i/(g=Math.sqrt(i*i+a*a)),l=u*a/g;else{var u,c=Nl(e,i,a),d=Nl(t,-1*i,-1*a),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*h/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},Bl=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},Nl=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},Il=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,g=t.gravity*h/p;c.offsetX+=f,c.offsetY+=g}}}}},Al=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},Rl=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopf&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},Vl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function jl(e){this.options=I({},Vl,e)}jl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=p)l=h,u=p;else if(null!=h&&null==p)l=h,u=Math.ceil(o/l);else if(null==h&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l=o?d(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(B=0,M++)},I={},z=0;z(r=_t(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=kt(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return Ne(e,t,n)}function x(n,r){var i,a=n._private,o=f;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),d=b(a.rscratch,"labelAngle",r),h=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,g=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-p,x=s.y2+o-p;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},_=k(g,m),C=k(g,x),S=k(y,m),P=k(y,x),D=[_.x+h,_.y+p,S.x+h,S.y+p,P.x+h,P.y+p,C.x+h,C.y+p];if(Ct(e,t,D))return v(n),!0}else if(mt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=ht({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),p=0;p0?Math.max(e-t,0):Math.min(e+t,0)},w=x(m,v),E=x(b,y),k=!1;"auto"===c?u=Math.abs(w)>Math.abs(E)?"horizontal":"vertical":"upward"===c||"downward"===c?(u="vertical",k=!0):"leftward"!==c&&"rightward"!==c||(u="horizontal",k=!0);var _,C="vertical"===u,S=C?E:w,P=C?b:m,D=at(P),T=!1;(k&&(h||f)||!("downward"===c&&P<0||"upward"===c&&P>0||"leftward"===c&&P>0||"rightward"===c&&P<0)||(S=(D*=-1)*Math.abs(S),T=!0),h)?_=(p<0?1+p:p)*S:_=(p<0?S:0)+p*D;var M=function(e){return Math.abs(e)=Math.abs(S)},B=M(_),N=M(Math.abs(S)-Math.abs(_));if((B||N)&&!T)if(C){var I=Math.abs(P)<=a/2,z=Math.abs(m)<=o/2;if(I){var A=(r.x1+r.x2)/2,L=r.y1,O=r.y2;n.segpts=[A,L,A,O]}else if(z){var R=(r.y1+r.y2)/2,F=r.x1,V=r.x2;n.segpts=[F,R,V,R]}else n.segpts=[r.x1,r.y2]}else{var j=Math.abs(P)<=i/2,q=Math.abs(b)<=s/2;if(j){var Y=(r.y1+r.y2)/2,X=r.x1,W=r.x2;n.segpts=[X,Y,W,Y]}else if(q){var H=(r.x1+r.x2)/2,K=r.y1,G=r.y2;n.segpts=[H,K,H,G]}else n.segpts=[r.x2,r.y1]}else if(C){var Z=r.y1+_+(l?a/2*D:0),U=r.x1,$=r.x2;n.segpts=[U,Z,$,Z]}else{var Q=r.x1+_+(l?i/2*D:0),J=r.y1,ee=r.y2;n.segpts=[Q,J,Q,ee]}},tu.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=!y(n.startX)||!y(n.startY),h=!y(n.arrowStartX)||!y(n.arrowStartY),p=!y(n.endX)||!y(n.endY),f=!y(n.arrowEndX)||!y(n.arrowEndY),g=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),v=ot({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),m=vh.poolIndex()){var p=d;d=h,h=p}var f=s.srcPos=d.position(),g=s.tgtPos=h.position(),v=s.srcW=d.outerWidth(),m=s.srcH=d.outerHeight(),b=s.tgtW=h.outerWidth(),x=s.tgtH=h.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(d)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(h)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var k=0;k0){var q=u,Y=st(q,nt(t)),X=st(q,nt(j)),W=Y;if(X2)st(q,{x:j[2],y:j[3]})0){var ie=c,ae=st(ie,nt(t)),oe=st(ie,nt(re)),se=ae;if(oe2)st(ie,{x:re[2],y:re[3]})=c||b){d={cp:v,segment:m};break}}if(d)break}var x=d.cp,w=d.segment,E=(c-p)/w.length,k=w.t1-w.t0,_=u?w.t0+k*E:w.t1-k*E;_=dt(0,_,1),t=ct(x.p0,x.p1,x.p2,_),l=function(e,t,n,r){var i=dt(0,r-.001,1),a=dt(0,r+.001,1),o=ct(e,t,n,i),s=ct(e,t,n,a);return lu(o,s)}(x.p0,x.p1,x.p2,_);break;case"straight":case"segments":case"haystack":for(var C,S,P,D,T=0,M=r.allpts.length,B=0;B+3=c));B+=2);var N=(c-S)/C;N=dt(0,N,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=ot(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(P,D,N),l=lu(P,D)}o("labelX",s,t.x),o("labelY",s,t.y),o("labelAutoAngle",s,l)}};l("source"),l("target"),this.applyLabelDimensions(e)}},ou.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},ou.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Ne(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,d=i.width,h=i.height+(l-1)*(a-1)*u;Ie(n.rstyle,"labelWidth",t,d),Ie(n.rscratch,"labelWidth",t,d),Ie(n.rstyle,"labelHeight",t,h),Ie(n.rscratch,"labelHeight",t,h),Ie(n.rscratch,"labelLineHeight",t,c)},ou.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Ie(n.rscratch,e,t,r),r):Ne(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=i.split("\n"),c=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,h=[],p=/[\s\u200b]+/,f=d?"":" ",g=0;gc){for(var b=v.split(p),x="",w=0;w_)break;C+=i[P],P===i.length-1&&(S=!0)}return S||(C+="…"),C}return i},ou.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},ou.calculateLabelDimensions=function(e,t){var n=de(t,e._private.labelDimsKey),r=this.labelDimCache||(this.labelDimCache=[]),i=r[n];if(null!=i)return i;var a=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,s=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,u=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!u){u=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=u.getContext("2d");var d=u.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}c.font="".concat(a," ").concat(l," ").concat(o,"px ").concat(s);for(var h=0,p=0,f=t.split("\n"),g=0;g1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var P=r(t);v&&(e.hoverData.tapholdCancelled=!0);a=!0,n(g,["mousemove","vmousemove","tapdrag"],t,{x:d[0],y:d[1]});var D=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:d[0],y:d[1]}}),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var T={originalEvent:t,type:"cxtdrag",position:{x:d[0],y:d[1]}};b?b.emit(T):o.emit(T),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:d[0],y:d[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:d[0],y:d[1]}}))}}else if(e.hoverData.dragging){if(a=!0,o.panningEnabled()&&o.userPanningEnabled()){var M;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;M={x:(d[0]-B[0])*s,y:(d[1]-B[1])*s},e.hoverData.justStartedPan=!1}else M={x:x[0]*s,y:x[1]*s};o.panBy(M),o.emit("dragpan"),e.hoverData.dragged=!0}d=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=f[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||g==m||(m&&n(m,["mouseout","tapdragout"],t,{x:d[0],y:d[1]}),g&&n(g,["mouseover","tapdragover"],t,{x:d[0],y:d[1]}),e.hoverData.last=g),b)if(v){if(o.boxSelectionEnabled()&&P)b&&b.grabbed()&&(c(E),b.emit("freeon"),E.emit("free"),e.dragData.didDrag&&(b.emit("dragfreeon"),E.emit("dragfree"))),D();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var N=!e.dragData.didDrag;N&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||l(E,{inDragLayer:!0});var I={x:0,y:0};if(y(x[0])&&y(x[1])&&(I.x+=x[0],I.y+=x[1],N)){var z=e.hoverData.dragDelta;z&&y(z[0])&&y(z[1])&&(I.x+=z[0],I.y+=z[1])}e.hoverData.draggingEles=!0,E.silentShift(I).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(x[0]),t.push(x[1])):(t[0]+=x[0],t[1]+=x[1])}();a=!0}else if(v){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!P&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){i(b,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=nt(h),e.redrawHint("select",!0),e.redraw())}}else D();b&&b.pannable()&&b.active()&&b.unactivate()}return f[2]=d[0],f[3]=d[1],a?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(window,"mouseup",(function(i){if(e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(i.clientX,i.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,d=e.hoverData.down,h=r(i);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,d&&d.unactivate(),3===e.hoverData.which){var p={originalEvent:i,type:"cxttapend",position:{x:o[0],y:o[1]}};if(d?d.emit(p):a.emit(p),!e.hoverData.cxtDragged){var f={originalEvent:i,type:"cxttap",position:{x:o[0],y:o[1]}};d?d.emit(f):a.emit(f)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(n(l,["mouseup","tapend","vmouseup"],i,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(n(d,["click","tap","vclick"],i,{x:o[0],y:o[1]}),b=!1,i.timeStamp-x<=a.multiClickDebounceTime()?(m&&clearTimeout(m),b=!0,x=null,n(d,["dblclick","dbltap","vdblclick"],i,{x:o[0],y:o[1]})):(m=setTimeout((function(){b||n(d,["oneclick","onetap","voneclick"],i,{x:o[0],y:o[1]})}),a.multiClickDebounceTime()),x=i.timeStamp)),null!=d||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||r(i)||(a.$(t).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=d||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(a.$(t).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:i,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||h||a.$(t).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=d&&d.grabbed();c(u),y&&(d.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(d.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null}}),!1);var E,k,_,C,S,P,D,T,M,B,N,I,z,A=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",A,!0),e.registerBinding(window,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||A(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var L,O,R,F,V,j,q,Y=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},X=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",L=function(t){if(e.hasTouchStarted=!0,w(t)){h(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var s=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=s[0],i[1]=s[1]}if(t.touches[1]){s=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=s[0],i[3]=s[1]}if(t.touches[2]){s=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=s[0],i[5]=s[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,c(e.dragData.touchDragEles);var d=e.findContainerClientCoords();M=d[0],B=d[1],N=d[2],I=d[3],E=t.touches[0].clientX-M,k=t.touches[0].clientY-B,_=t.touches[1].clientX-M,C=t.touches[1].clientY-B,z=0<=E&&E<=N&&0<=_&&_<=N&&0<=k&&k<=I&&0<=C&&C<=I;var p=r.pan(),f=r.zoom();S=Y(E,k,_,C),P=X(E,k,_,C),T=[((D=[(E+_)/2,(k+C)/2])[0]-p.x)/f,(D[1]-p.y)/f];if(P<4e4&&!t.touches[2]){var g=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):r.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])r.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(i[0],i[1],!0,!0),m=y[0];if(null!=m&&(m.activate(),e.touchData.start=m,e.touchData.starts=y,e.nodeIsGrabbable(m))){var b=e.dragData.touchDragEles=r.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),m.selected()?(x=r.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),l(x,{addToList:b})):u(m,{addToList:b}),o(m);var A=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};m.emit(A("grabon")),x?x.forEach((function(e){e.emit(A("grab"))})):m.emit(A("grab"))}n(m,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==m&&(e.data.bgActivePosistion={x:s[0],y:s[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||n(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var L=e.touchData.startPosition=[],O=0;O=e.touchTapThreshold2}if(r&&e.touchData.cxt){t.preventDefault();var D=t.touches[0].clientX-M,N=t.touches[0].clientY-B,I=t.touches[1].clientX-M,A=t.touches[1].clientY-B,L=X(D,N,I,A);if(L/P>=2.25||L>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(r&&e.touchData.cxt){O={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var R=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&R===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=R,R&&R.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(r&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,a[4]=1,a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(r&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var F=0;F0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(window,"touchcancel",R=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(window,"touchend",F=function(r){var i=e.touchData.start;if(e.touchData.capture){0===r.touches.length&&(e.touchData.capture=!1),r.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,d=e.touchData.earlier;if(r.touches[0]){var h=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(r.touches[1]){h=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);u[2]=h[0],u[3]=h[1]}if(r.touches[2]){h=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);u[4]=h[0],u[5]=h[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:r,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:r,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!r.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var f=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:r,position:{x:u[0],y:u[1]}});f.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),f.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),r.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(r.touches[1]);else if(r.touches[0]);else if(!r.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=i){var v=i._private.grabbed;c(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(i.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),g.emit("dragfree"))),n(i,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);n(y,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),n(i,["tap","vclick"],r,{x:u[0],y:u[1]}),V=!1,r.timeStamp-q<=s.multiClickDebounceTime()?(j&&clearTimeout(j),V=!0,q=null,n(i,["dbltap","vdblclick"],r,{x:u[0],y:u[1]})):(j=setTimeout((function(){V||n(i,["onetap","voneclick"],r,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),q=r.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w2){for(var D=[u[0],u[1]],T=Math.pow(D[0]-e,2)+Math.pow(D[1]-t,2),M=1;M0)return g[0]}return null},h=Object.keys(c),p=0;p0?l:xt(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=Rt(r,i),l=2*s;if(St(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(St(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Ct(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!Tt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!Tt(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},vu.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",At(3,0)),this.generateRoundPolygon("round-triangle",At(3,0)),this.generatePolygon("rectangle",At(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",At(5,0)),this.generateRoundPolygon("round-pentagon",At(5,0)),this.generatePolygon("hexagon",At(6,0)),this.generateRoundPolygon("round-hexagon",At(6,0)),this.generatePolygon("heptagon",At(7,0)),this.generateRoundPolygon("round-heptagon",At(7,0)),this.generatePolygon("octagon",At(8,0)),this.generateRoundPolygon("round-octagon",At(8,0));var r=new Array(20),i=Ot(5,0),a=Ot(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*g)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*(1e3/60))break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,d,c)&&r())}),i(t))}}},Eu=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:be;t(this,e),this.idsByKey=new ze,this.keyForId=new ze,this.cachesByLvl=new ze,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return r(e,[{key:"getIdsFor",value:function(e){null==e&&Ee("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Le,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new ze,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),ku={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},_u=Te({getKey:null,doesEleInvalidateKey:be,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:me,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Cu=function(e,t){this.renderer=e,this.onDequeues=[];var n=_u(t);I(this,n),this.lookup=new Eu(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},Su=Cu.prototype;Su.reasons=ku,Su.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},Su.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Su.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new Ve((function(e,t){return t.reqs-e.reqs}))},Su.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Su.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(it(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=a.getTextureQueue(p),v=g[g.length-2],y=function(){return a.recycleTexture(p,d)||a.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidthr;P--)C=a.getElement(e,t,n,P,ku.downscale);S()}else{var D;if(!x&&!w&&!E)for(var T=r-1;T>=-4;T--){var M=l.get(e,T);if(M){D=M;break}}if(b(D))return a.queueElement(e,r),D;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(f),l.set(e,r,f),a.checkTextureFullness(v),f},Su.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Su.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Me(t,e):e.fullnessChecks++},Su.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Me(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,Be(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Me(r,a),n.push(a),a}},Su.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},Su.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,!u){r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,ku.dequeue)}}return r},Su.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=ye,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Su.onDequeue=function(e){this.onDequeues.push(e)},Su.offDequeue=function(e){Me(this.onDequeues,e)},Su.setupDequeueing=wu({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Me(c,o)}}();var d=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=ht();for(var t=0;t16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var h=null,p=e.length/1,f=!a,g=0;g=p||!bt(h.bb,v.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||f?r.queueLayer(h,v):r.drawEleInLayer(h,v,n,t),h.eles.push(v),m[n]=h}}return s||(f?null:c)},Du.getEleLevelForLayerLevel=function(e,t){return e},Du.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},Du.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},Du.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Du.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=ie(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Du.invalidateLayer=function(e){if(this.lastInvalidationTime=ie(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Me(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=u*c,v=u*c,y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},m=function(){i&&o.drawEdgeOverlay(e,t)},b=function(){i&&o.drawEdgeUnderlay(e,t)},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;o.drawArrowheads(e,t,n)},w=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var E="yes"===t.pstyle("ghost").value;if(E){var k=t.pstyle("ghost-offset-x").pfValue,_=t.pstyle("ghost-offset-y").pfValue,C=t.pstyle("ghost-opacity").value,S=g*C;e.translate(k,_),y(S),x(S),e.translate(-k,-_)}b(),y(),x(),m(),w(),n&&e.translate(l.x1,l.y1)}}},Hu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Wu.drawEdgeOverlay=Hu("overlay"),Wu.drawEdgeUnderlay=Hu("underlay"),Wu.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$");a.pathCacheKey&&a.pathCacheKey===d?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=d,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+35&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill()}Gu.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(it(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,f,a),t.isEdge()&&(o.drawText(e,t,"source",f,a),o.drawText(e,t,"target",f,a))):o.drawText(e,t,i,f,a),n&&e.translate(p.x1,p.y1)},Gu.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Gu.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=Ne(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Gu.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=Ne(o,"labelX",n),d=Ne(o,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(c)&&!isNaN(d)){this.setupTextStyle(e,t,i);var p,f=n?n+"-":"",g=Ne(o,"labelWidth",n),v=Ne(o,"labelHeight",n),y=t.pstyle(f+"text-margin-x").pfValue,m=t.pstyle(f+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,d+=m,0!==(p=r?this.getTextAngle(t,n):0)&&(l=c,u=d,e.translate(l,u),e.rotate(p),c=0,d=0),w){case"top":break;case"center":d+=v/2;break;case"bottom":d+=v}var E=t.pstyle("text-background-opacity").value,k=t.pstyle("text-border-opacity").value,_=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue;if(E>0||_>0&&k>0){var S=c-C;switch(x){case"left":S-=g;break;case"center":S-=g/2}var P=d-v-C,D=g+2*C,T=v+2*C;if(E>0){var M=e.fillStyle,B=t.pstyle("text-background-color").value;e.fillStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+E*s+")";var N=t.pstyle("text-background-shape").strValue;0===N.indexOf("round")?Zu(e,S,P,D,T,2):e.fillRect(S,P,D,T),e.fillStyle=M}if(_>0&&k>0){var I=e.strokeStyle,z=e.lineWidth,A=t.pstyle("text-border-color").value,L=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+k*s+")",e.lineWidth=_,e.setLineDash)switch(L){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=_/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(S,P,D,T),"double"===L){var O=_/2;e.strokeRect(S+O,P+O,D-2*O,T-2*O)}e.setLineDash&&e.setLineDash([]),e.lineWidth=z,e.strokeStyle=I}}var R=2*t.pstyle("text-outline-width").pfValue;if(R>0&&(e.lineWidth=R),"wrap"===t.pstyle("text-wrap").value){var F=Ne(o,"labelWrapCachedLines",n),V=Ne(o,"labelLineHeight",n),j=g/2,q=this.getLabelJustification(t);switch("auto"===q||("left"===x?"left"===q?c+=-g:"center"===q&&(c+=-j):"center"===x?"left"===q?c+=-j:"right"===q&&(c+=j):"right"===x&&("center"===q?c+=j:"right"===q&&(c+=g))),w){case"top":d-=(F.length-1)*V;break;case"center":case"bottom":d-=(F.length-1)*V}for(var Y=0;Y0&&e.strokeText(F[Y],c,d),e.fillText(F[Y],c,d),d+=V}else R>0&&e.strokeText(h,c,d),e.fillText(h,c,d);0!==p&&(e.rotate(-p),e.translate(-l,-u))}}};var Uu={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(y(d.x)&&y(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,m=t.padding();r=t.width()+2*m,i=t.height()+2*m,n&&(p=n,e.translate(-p.x1,-p.y1));for(var b=t.pstyle("background-image"),x=b.value,w=new Array(x.length),E=new Array(x.length),k=0,_=0;_0&&void 0!==arguments[0]?arguments[0]:M;l.eleFillStyle(e,t,n)},A=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;l.colorStrokeStyle(e,B[0],B[1],B[2],t)},L=t.pstyle("shape").strValue,O=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var R=l.nodePathCache=l.nodePathCache||[],F=he("polygon"===L?L+","+O.join(","):L,""+i,""+r),V=R[F];null!=V?(h=V,v=!0,c.pathCache=h):(h=new Path2D,R[F]=c.pathCache=h)}var j=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,i)}g?e.fill(h):e.fill()},q=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,i)))},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,n=(D>0?D:-D)*t,r=D>0?0:255;0!==D&&(l.colorFillStyle(e,r,r,r,n),g?e.fill(h):e.fill())},W=function(){if(T>0){if(e.lineWidth=T,e.lineCap="butt",e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(g?e.stroke(h):e.stroke(),"double"===N){e.lineWidth=T/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},H=function(){o&&l.drawNodeOverlay(e,t,d,r,i)},K=function(){o&&l.drawNodeUnderlay(e,t,d,r,i)},G=function(){l.drawElementText(e,t,null,a)},Z="yes"===t.pstyle("ghost").value;if(Z){var U=t.pstyle("ghost-offset-x").pfValue,$=t.pstyle("ghost-offset-y").pfValue,Q=t.pstyle("ghost-opacity").value,J=Q*f;e.translate(U,$),z(Q*M),j(),q(J,!0),A(Q*I),W(),Y(0!==D||0!==T),q(J,!1),X(J),e.translate(-U,-$)}g&&e.translate(-d.x,-d.y),K(),g&&e.translate(d.x,d.y),z(),j(),q(f,!0),A(),W(),Y(0!==D||0!==T),q(f,!1),X(),g&&e.translate(-d.x,-d.y),G(),H(),n&&e.translate(p.x1,p.y1)}}},$u=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,i,a){if(n.visible()){var o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,l=n.pstyle("".concat(e,"-color")).value,u=n.pstyle("".concat(e,"-shape")).value;if(s>0){if(r=r||n.position(),null==i||null==a){var c=n.padding();i=n.width()+2*c,a=n.height()+2*c}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o),t.fill()}}}};Uu.drawNodeOverlay=$u("overlay"),Uu.drawNodeUnderlay=$u("underlay"),Uu.hasPie=function(e){return(e=e[0])._private.hasPie},Uu.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,g=t.pstyle("pie-"+h+"-background-opacity").value*n,v=p/100;v+d>1&&(v=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*v;0===p||d>=1||d+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),d+=v)}};var Qu={};Qu.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},Qu.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},_=o.prevViewport;void 0===_||k.zoom!==_.zoom||k.pan.x!==_.pan.x||k.pan.y!==_.pan.y||g&&!f||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var C=o.getCachedZSortedEles();function S(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function P(e,r){var s,l,c,d;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,d=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?S(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var D=o.data.bufferContexts[o.TEXTURE_BUFFER];D.setTransform(1,0,0,1,0,0),D.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:D,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var T=u.contexts[o.NODE],M=o.textureCache.texture;k=o.textureCache.viewport;T.setTransform(1,0,0,1,0,0),h?S(T,0,0,k.width,k.height):T.clearRect(0,0,k.width,k.height);var B=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(T,B[0],B[1],B[2],N),T.fillRect(0,0,k.width,k.height);b=l.zoom();P(T,!1),T.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),T.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var I=l.extent(),z=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),A=o.hideEdgesOnViewport&&z,L=[];if(L[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,L[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),L[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,L[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||L[o.NODE]){var O=h&&!L[o.NODE]&&1!==p;P(T=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(T,C.nondrag,s,I):o.drawLayeredElements(T,C.nondrag,s,I),o.debug&&o.drawDebugPoints(T,C.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||L[o.DRAG])){O=h&&!L[o.DRAG]&&1!==p;P(T=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(T,C.drag,s,I):o.drawCachedElements(T,C.drag,s,I),o.debug&&o.drawDebugPoints(T,C.drag),n||h||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(P(T=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;T.lineWidth=R,T.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",T.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(T.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",T.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var F=u.bgActivePosistion;T.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",T.beginPath(),T.arc(F.x,F.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),T.fill()}var V=o.lastRedrawTime;if(o.showFps&&V){V=Math.round(V);var j=Math.round(1e3/V);T.setTransform(1,0,0,1,0,0),T.fillStyle="rgba(255, 0, 0, 0.75)",T.strokeStyle="rgba(255, 0, 0, 0.75)",T.lineWidth=1,T.fillText("1 frame = "+V+" ms = "+j+" fps",0,20);T.strokeRect(0,30,250,20),T.fillRect(0,30,250*Math.min(j/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==p){var q=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):S(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||L[o.NODE])&&(H(q,Y,L[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||L[o.DRAG])&&(H(X,W,L[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")};for(var Ju={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},oc.png=function(e){return lc(e,this.bufferCanvasImage(e),"image/png")},oc.jpg=function(e){return lc(e,this.bufferCanvasImage(e),"image/jpeg")};var uc={nodeShapeImpl:function(e,t,n,r,i,a,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},cc=hc,dc=hc.prototype;function hc(e){var t=this;t.data={canvases:new Array(dc.CANVAS_LAYERS),contexts:new Array(dc.CANVAS_LAYERS),canvasNeedsRedraw:new Array(dc.CANVAS_LAYERS),bufferCanvases:new Array(dc.BUFFER_COUNT),bufferContexts:new Array(dc.CANVAS_LAYERS)};t.data.canvasContainer=document.createElement("div");var n=t.data.canvasContainer.style;t.data.canvasContainer.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",n.position="relative",n.zIndex="0",n.overflow="hidden";var r=e.cy.container();r.appendChild(t.data.canvasContainer),r.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";var i={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};s&&s.userAgent.match(/msie|trident|edge/i)&&(i["-ms-touch-action"]="none",i["touch-action"]="none");for(var a=0;a0;--i){entry=buckets[i].dequeue();if(entry){results=results.concat(removeNode(g,buckets,zeroIdx,entry,true));break}}}}return results}function removeNode(g,buckets,zeroIdx,entry,collectPredecessors){var results=collectPredecessors?[]:undefined;_.forEach(g.inEdges(entry.v),function(edge){var weight=g.edge(edge);var uEntry=g.node(edge.v);if(collectPredecessors){results.push({v:edge.v,w:edge.w})}uEntry.out-=weight;assignBucket(buckets,zeroIdx,uEntry)});_.forEach(g.outEdges(entry.v),function(edge){var weight=g.edge(edge);var w=edge.w;var wEntry=g.node(w);wEntry["in"]-=weight;assignBucket(buckets,zeroIdx,wEntry)});g.removeNode(entry.v);return results}function buildState(g,weightFn){var fasGraph=new Graph;var maxIn=0;var maxOut=0;_.forEach(g.nodes(),function(v){fasGraph.setNode(v,{v:v,in:0,out:0})}); +// Aggregate weights on nodes, but also sum the weights across multi-edges +// into a single edge for the fasGraph. +_.forEach(g.edges(),function(e){var prevWeight=fasGraph.edge(e.v,e.w)||0;var weight=weightFn(e);var edgeWeight=prevWeight+weight;fasGraph.setEdge(e.v,e.w,edgeWeight);maxOut=Math.max(maxOut,fasGraph.node(e.v).out+=weight);maxIn=Math.max(maxIn,fasGraph.node(e.w)["in"]+=weight)});var buckets=_.range(maxOut+maxIn+3).map(function(){return new List});var zeroIdx=maxIn+1;_.forEach(fasGraph.nodes(),function(v){assignBucket(buckets,zeroIdx,fasGraph.node(v))});return{graph:fasGraph,buckets:buckets,zeroIdx:zeroIdx}}function assignBucket(buckets,zeroIdx,entry){if(!entry.out){buckets[0].enqueue(entry)}else if(!entry["in"]){buckets[buckets.length-1].enqueue(entry)}else{buckets[entry.out-entry["in"]+zeroIdx].enqueue(entry)}}},{"./data/list":5,"./graphlib":7,"./lodash":10}],9:[function(require,module,exports){"use strict";var _=require("./lodash");var acyclic=require("./acyclic");var normalize=require("./normalize");var rank=require("./rank");var normalizeRanks=require("./util").normalizeRanks;var parentDummyChains=require("./parent-dummy-chains");var removeEmptyRanks=require("./util").removeEmptyRanks;var nestingGraph=require("./nesting-graph");var addBorderSegments=require("./add-border-segments");var coordinateSystem=require("./coordinate-system");var order=require("./order");var position=require("./position");var util=require("./util");var Graph=require("./graphlib").Graph;module.exports=layout;function layout(g,opts){var time=opts&&opts.debugTiming?util.time:util.notime;time("layout",function(){var layoutGraph=time(" buildLayoutGraph",function(){return buildLayoutGraph(g)});time(" runLayout",function(){runLayout(layoutGraph,time)});time(" updateInputGraph",function(){updateInputGraph(g,layoutGraph)})})}function runLayout(g,time){time(" makeSpaceForEdgeLabels",function(){makeSpaceForEdgeLabels(g)});time(" removeSelfEdges",function(){removeSelfEdges(g)});time(" acyclic",function(){acyclic.run(g)});time(" nestingGraph.run",function(){nestingGraph.run(g)});time(" rank",function(){rank(util.asNonCompoundGraph(g))});time(" injectEdgeLabelProxies",function(){injectEdgeLabelProxies(g)});time(" removeEmptyRanks",function(){removeEmptyRanks(g)});time(" nestingGraph.cleanup",function(){nestingGraph.cleanup(g)});time(" normalizeRanks",function(){normalizeRanks(g)});time(" assignRankMinMax",function(){assignRankMinMax(g)});time(" removeEdgeLabelProxies",function(){removeEdgeLabelProxies(g)});time(" normalize.run",function(){normalize.run(g)});time(" parentDummyChains",function(){parentDummyChains(g)});time(" addBorderSegments",function(){addBorderSegments(g)});time(" order",function(){order(g)});time(" insertSelfEdges",function(){insertSelfEdges(g)});time(" adjustCoordinateSystem",function(){coordinateSystem.adjust(g)});time(" position",function(){position(g)});time(" positionSelfEdges",function(){positionSelfEdges(g)});time(" removeBorderNodes",function(){removeBorderNodes(g)});time(" normalize.undo",function(){normalize.undo(g)});time(" fixupEdgeLabelCoords",function(){fixupEdgeLabelCoords(g)});time(" undoCoordinateSystem",function(){coordinateSystem.undo(g)});time(" translateGraph",function(){translateGraph(g)});time(" assignNodeIntersects",function(){assignNodeIntersects(g)});time(" reversePoints",function(){reversePointsForReversedEdges(g)});time(" acyclic.undo",function(){acyclic.undo(g)})} +/* + * Copies final layout information from the layout graph back to the input + * graph. This process only copies whitelisted attributes from the layout graph + * to the input graph, so it serves as a good place to determine what + * attributes can influence layout. + */function updateInputGraph(inputGraph,layoutGraph){_.forEach(inputGraph.nodes(),function(v){var inputLabel=inputGraph.node(v);var layoutLabel=layoutGraph.node(v);if(inputLabel){inputLabel.x=layoutLabel.x;inputLabel.y=layoutLabel.y;if(layoutGraph.children(v).length){inputLabel.width=layoutLabel.width;inputLabel.height=layoutLabel.height}}});_.forEach(inputGraph.edges(),function(e){var inputLabel=inputGraph.edge(e);var layoutLabel=layoutGraph.edge(e);inputLabel.points=layoutLabel.points;if(_.has(layoutLabel,"x")){inputLabel.x=layoutLabel.x;inputLabel.y=layoutLabel.y}});inputGraph.graph().width=layoutGraph.graph().width;inputGraph.graph().height=layoutGraph.graph().height}var graphNumAttrs=["nodesep","edgesep","ranksep","marginx","marginy"];var graphDefaults={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"};var graphAttrs=["acyclicer","ranker","rankdir","align"];var nodeNumAttrs=["width","height"];var nodeDefaults={width:0,height:0};var edgeNumAttrs=["minlen","weight","width","height","labeloffset"];var edgeDefaults={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"};var edgeAttrs=["labelpos"]; +/* + * Constructs a new graph from the input graph, which can be used for layout. + * This process copies only whitelisted attributes from the input graph to the + * layout graph. Thus this function serves as a good place to determine what + * attributes can influence layout. + */function buildLayoutGraph(inputGraph){var g=new Graph({multigraph:true,compound:true});var graph=canonicalize(inputGraph.graph());g.setGraph(_.merge({},graphDefaults,selectNumberAttrs(graph,graphNumAttrs),_.pick(graph,graphAttrs)));_.forEach(inputGraph.nodes(),function(v){var node=canonicalize(inputGraph.node(v));g.setNode(v,_.defaults(selectNumberAttrs(node,nodeNumAttrs),nodeDefaults));g.setParent(v,inputGraph.parent(v))});_.forEach(inputGraph.edges(),function(e){var edge=canonicalize(inputGraph.edge(e));g.setEdge(e,_.merge({},edgeDefaults,selectNumberAttrs(edge,edgeNumAttrs),_.pick(edge,edgeAttrs)))});return g} +/* + * This idea comes from the Gansner paper: to account for edge labels in our + * layout we split each rank in half by doubling minlen and halving ranksep. + * Then we can place labels at these mid-points between nodes. + * + * We also add some minimal padding to the width to push the label for the edge + * away from the edge itself a bit. + */function makeSpaceForEdgeLabels(g){var graph=g.graph();graph.ranksep/=2;_.forEach(g.edges(),function(e){var edge=g.edge(e);edge.minlen*=2;if(edge.labelpos.toLowerCase()!=="c"){if(graph.rankdir==="TB"||graph.rankdir==="BT"){edge.width+=edge.labeloffset}else{edge.height+=edge.labeloffset}}})} +/* + * Creates temporary dummy nodes that capture the rank in which each edge's + * label is going to, if it has one of non-zero width and height. We do this + * so that we can safely remove empty ranks while preserving balance for the + * label's position. + */function injectEdgeLabelProxies(g){_.forEach(g.edges(),function(e){var edge=g.edge(e);if(edge.width&&edge.height){var v=g.node(e.v);var w=g.node(e.w);var label={rank:(w.rank-v.rank)/2+v.rank,e:e};util.addDummyNode(g,"edge-proxy",label,"_ep")}})}function assignRankMinMax(g){var maxRank=0;_.forEach(g.nodes(),function(v){var node=g.node(v);if(node.borderTop){node.minRank=g.node(node.borderTop).rank;node.maxRank=g.node(node.borderBottom).rank;maxRank=_.max(maxRank,node.maxRank)}});g.graph().maxRank=maxRank}function removeEdgeLabelProxies(g){_.forEach(g.nodes(),function(v){var node=g.node(v);if(node.dummy==="edge-proxy"){g.edge(node.e).labelRank=node.rank;g.removeNode(v)}})}function translateGraph(g){var minX=Number.POSITIVE_INFINITY;var maxX=0;var minY=Number.POSITIVE_INFINITY;var maxY=0;var graphLabel=g.graph();var marginX=graphLabel.marginx||0;var marginY=graphLabel.marginy||0;function getExtremes(attrs){var x=attrs.x;var y=attrs.y;var w=attrs.width;var h=attrs.height;minX=Math.min(minX,x-w/2);maxX=Math.max(maxX,x+w/2);minY=Math.min(minY,y-h/2);maxY=Math.max(maxY,y+h/2)}_.forEach(g.nodes(),function(v){getExtremes(g.node(v))});_.forEach(g.edges(),function(e){var edge=g.edge(e);if(_.has(edge,"x")){getExtremes(edge)}});minX-=marginX;minY-=marginY;_.forEach(g.nodes(),function(v){var node=g.node(v);node.x-=minX;node.y-=minY});_.forEach(g.edges(),function(e){var edge=g.edge(e);_.forEach(edge.points,function(p){p.x-=minX;p.y-=minY});if(_.has(edge,"x")){edge.x-=minX}if(_.has(edge,"y")){edge.y-=minY}});graphLabel.width=maxX-minX+marginX;graphLabel.height=maxY-minY+marginY}function assignNodeIntersects(g){_.forEach(g.edges(),function(e){var edge=g.edge(e);var nodeV=g.node(e.v);var nodeW=g.node(e.w);var p1,p2;if(!edge.points){edge.points=[];p1=nodeW;p2=nodeV}else{p1=edge.points[0];p2=edge.points[edge.points.length-1]}edge.points.unshift(util.intersectRect(nodeV,p1));edge.points.push(util.intersectRect(nodeW,p2))})}function fixupEdgeLabelCoords(g){_.forEach(g.edges(),function(e){var edge=g.edge(e);if(_.has(edge,"x")){if(edge.labelpos==="l"||edge.labelpos==="r"){edge.width-=edge.labeloffset}switch(edge.labelpos){case"l":edge.x-=edge.width/2+edge.labeloffset;break;case"r":edge.x+=edge.width/2+edge.labeloffset;break}}})}function reversePointsForReversedEdges(g){_.forEach(g.edges(),function(e){var edge=g.edge(e);if(edge.reversed){edge.points.reverse()}})}function removeBorderNodes(g){_.forEach(g.nodes(),function(v){if(g.children(v).length){var node=g.node(v);var t=g.node(node.borderTop);var b=g.node(node.borderBottom);var l=g.node(_.last(node.borderLeft));var r=g.node(_.last(node.borderRight));node.width=Math.abs(r.x-l.x);node.height=Math.abs(b.y-t.y);node.x=l.x+node.width/2;node.y=t.y+node.height/2}});_.forEach(g.nodes(),function(v){if(g.node(v).dummy==="border"){g.removeNode(v)}})}function removeSelfEdges(g){_.forEach(g.edges(),function(e){if(e.v===e.w){var node=g.node(e.v);if(!node.selfEdges){node.selfEdges=[]}node.selfEdges.push({e:e,label:g.edge(e)});g.removeEdge(e)}})}function insertSelfEdges(g){var layers=util.buildLayerMatrix(g);_.forEach(layers,function(layer){var orderShift=0;_.forEach(layer,function(v,i){var node=g.node(v);node.order=i+orderShift;_.forEach(node.selfEdges,function(selfEdge){util.addDummyNode(g,"selfedge",{width:selfEdge.label.width,height:selfEdge.label.height,rank:node.rank,order:i+ ++orderShift,e:selfEdge.e,label:selfEdge.label},"_se")});delete node.selfEdges})})}function positionSelfEdges(g){_.forEach(g.nodes(),function(v){var node=g.node(v);if(node.dummy==="selfedge"){var selfNode=g.node(node.e.v);var x=selfNode.x+selfNode.width/2;var y=selfNode.y;var dx=node.x-x;var dy=selfNode.height/2;g.setEdge(node.e,node.label);g.removeNode(v);node.label.points=[{x:x+2*dx/3,y:y-dy},{x:x+5*dx/6,y:y-dy},{x:x+dx,y:y},{x:x+5*dx/6,y:y+dy},{x:x+2*dx/3,y:y+dy}];node.label.x=node.x;node.label.y=node.y}})}function selectNumberAttrs(obj,attrs){return _.mapValues(_.pick(obj,attrs),Number)}function canonicalize(attrs){var newAttrs={};_.forEach(attrs,function(v,k){newAttrs[k.toLowerCase()]=v});return newAttrs}},{"./acyclic":2,"./add-border-segments":3,"./coordinate-system":4,"./graphlib":7,"./lodash":10,"./nesting-graph":11,"./normalize":12,"./order":17,"./parent-dummy-chains":22,"./position":24,"./rank":26,"./util":29}],10:[function(require,module,exports){ +/* global window */ +var lodash;if(typeof require==="function"){try{lodash={cloneDeep:require("lodash/cloneDeep"),constant:require("lodash/constant"),defaults:require("lodash/defaults"),each:require("lodash/each"),filter:require("lodash/filter"),find:require("lodash/find"),flatten:require("lodash/flatten"),forEach:require("lodash/forEach"),forIn:require("lodash/forIn"),has:require("lodash/has"),isUndefined:require("lodash/isUndefined"),last:require("lodash/last"),map:require("lodash/map"),mapValues:require("lodash/mapValues"),max:require("lodash/max"),merge:require("lodash/merge"),min:require("lodash/min"),minBy:require("lodash/minBy"),now:require("lodash/now"),pick:require("lodash/pick"),range:require("lodash/range"),reduce:require("lodash/reduce"),sortBy:require("lodash/sortBy"),uniqueId:require("lodash/uniqueId"),values:require("lodash/values"),zipObject:require("lodash/zipObject")}}catch(e){ +// continue regardless of error +}}if(!lodash){lodash=window._}module.exports=lodash},{"lodash/cloneDeep":227,"lodash/constant":228,"lodash/defaults":229,"lodash/each":230,"lodash/filter":232,"lodash/find":233,"lodash/flatten":235,"lodash/forEach":236,"lodash/forIn":237,"lodash/has":239,"lodash/isUndefined":258,"lodash/last":261,"lodash/map":262,"lodash/mapValues":263,"lodash/max":264,"lodash/merge":266,"lodash/min":267,"lodash/minBy":268,"lodash/now":270,"lodash/pick":271,"lodash/range":273,"lodash/reduce":274,"lodash/sortBy":276,"lodash/uniqueId":286,"lodash/values":287,"lodash/zipObject":288}],11:[function(require,module,exports){var _=require("./lodash");var util=require("./util");module.exports={run:run,cleanup:cleanup}; +/* + * A nesting graph creates dummy nodes for the tops and bottoms of subgraphs, + * adds appropriate edges to ensure that all cluster nodes are placed between + * these boundries, and ensures that the graph is connected. + * + * In addition we ensure, through the use of the minlen property, that nodes + * and subgraph border nodes to not end up on the same rank. + * + * Preconditions: + * + * 1. Input graph is a DAG + * 2. Nodes in the input graph has a minlen attribute + * + * Postconditions: + * + * 1. Input graph is connected. + * 2. Dummy nodes are added for the tops and bottoms of subgraphs. + * 3. The minlen attribute for nodes is adjusted to ensure nodes do not + * get placed on the same rank as subgraph border nodes. + * + * The nesting graph idea comes from Sander, "Layout of Compound Directed + * Graphs." + */function run(g){var root=util.addDummyNode(g,"root",{},"_root");var depths=treeDepths(g);var height=_.max(_.values(depths))-1;// Note: depths is an Object not an array +var nodeSep=2*height+1;g.graph().nestingRoot=root; +// Multiply minlen by nodeSep to align nodes on non-border ranks. +_.forEach(g.edges(),function(e){g.edge(e).minlen*=nodeSep}); +// Calculate a weight that is sufficient to keep subgraphs vertically compact +var weight=sumWeights(g)+1; +// Create border nodes and link them up +_.forEach(g.children(),function(child){dfs(g,root,nodeSep,weight,height,depths,child)}); +// Save the multiplier for node layers for later removal of empty border +// layers. +g.graph().nodeRankFactor=nodeSep}function dfs(g,root,nodeSep,weight,height,depths,v){var children=g.children(v);if(!children.length){if(v!==root){g.setEdge(root,v,{weight:0,minlen:nodeSep})}return}var top=util.addBorderNode(g,"_bt");var bottom=util.addBorderNode(g,"_bb");var label=g.node(v);g.setParent(top,v);label.borderTop=top;g.setParent(bottom,v);label.borderBottom=bottom;_.forEach(children,function(child){dfs(g,root,nodeSep,weight,height,depths,child);var childNode=g.node(child);var childTop=childNode.borderTop?childNode.borderTop:child;var childBottom=childNode.borderBottom?childNode.borderBottom:child;var thisWeight=childNode.borderTop?weight:2*weight;var minlen=childTop!==childBottom?1:height-depths[v]+1;g.setEdge(top,childTop,{weight:thisWeight,minlen:minlen,nestingEdge:true});g.setEdge(childBottom,bottom,{weight:thisWeight,minlen:minlen,nestingEdge:true})});if(!g.parent(v)){g.setEdge(root,top,{weight:0,minlen:height+depths[v]})}}function treeDepths(g){var depths={};function dfs(v,depth){var children=g.children(v);if(children&&children.length){_.forEach(children,function(child){dfs(child,depth+1)})}depths[v]=depth}_.forEach(g.children(),function(v){dfs(v,1)});return depths}function sumWeights(g){return _.reduce(g.edges(),function(acc,e){return acc+g.edge(e).weight},0)}function cleanup(g){var graphLabel=g.graph();g.removeNode(graphLabel.nestingRoot);delete graphLabel.nestingRoot;_.forEach(g.edges(),function(e){var edge=g.edge(e);if(edge.nestingEdge){g.removeEdge(e)}})}},{"./lodash":10,"./util":29}],12:[function(require,module,exports){"use strict";var _=require("./lodash");var util=require("./util");module.exports={run:run,undo:undo}; +/* + * Breaks any long edges in the graph into short segments that span 1 layer + * each. This operation is undoable with the denormalize function. + * + * Pre-conditions: + * + * 1. The input graph is a DAG. + * 2. Each node in the graph has a "rank" property. + * + * Post-condition: + * + * 1. All edges in the graph have a length of 1. + * 2. Dummy nodes are added where edges have been split into segments. + * 3. The graph is augmented with a "dummyChains" attribute which contains + * the first dummy in each chain of dummy nodes produced. + */function run(g){g.graph().dummyChains=[];_.forEach(g.edges(),function(edge){normalizeEdge(g,edge)})}function normalizeEdge(g,e){var v=e.v;var vRank=g.node(v).rank;var w=e.w;var wRank=g.node(w).rank;var name=e.name;var edgeLabel=g.edge(e);var labelRank=edgeLabel.labelRank;if(wRank===vRank+1)return;g.removeEdge(e);var dummy,attrs,i;for(i=0,++vRank;vRank0){if(index%2){weightSum+=tree[index+1]}index=index-1>>1;tree[index]+=entry.weight}cc+=entry.weight*weightSum}));return cc}},{"../lodash":10}],17:[function(require,module,exports){"use strict";var _=require("../lodash");var initOrder=require("./init-order");var crossCount=require("./cross-count");var sortSubgraph=require("./sort-subgraph");var buildLayerGraph=require("./build-layer-graph");var addSubgraphConstraints=require("./add-subgraph-constraints");var Graph=require("../graphlib").Graph;var util=require("../util");module.exports=order; +/* + * Applies heuristics to minimize edge crossings in the graph and sets the best + * order solution as an order attribute on each node. + * + * Pre-conditions: + * + * 1. Graph must be DAG + * 2. Graph nodes must be objects with a "rank" attribute + * 3. Graph edges must have the "weight" attribute + * + * Post-conditions: + * + * 1. Graph nodes will have an "order" attribute based on the results of the + * algorithm. + */function order(g){var maxRank=util.maxRank(g),downLayerGraphs=buildLayerGraphs(g,_.range(1,maxRank+1),"inEdges"),upLayerGraphs=buildLayerGraphs(g,_.range(maxRank-1,-1,-1),"outEdges");var layering=initOrder(g);assignOrder(g,layering);var bestCC=Number.POSITIVE_INFINITY,best;for(var i=0,lastBest=0;lastBest<4;++i,++lastBest){sweepLayerGraphs(i%2?downLayerGraphs:upLayerGraphs,i%4>=2);layering=util.buildLayerMatrix(g);var cc=crossCount(g,layering);if(cc=vEntry.barycenter){mergeEntries(vEntry,uEntry)}}}function handleOut(vEntry){return function(wEntry){wEntry["in"].push(vEntry);if(--wEntry.indegree===0){sourceSet.push(wEntry)}}}while(sourceSet.length){var entry=sourceSet.pop();entries.push(entry);_.forEach(entry["in"].reverse(),handleIn(entry));_.forEach(entry.out,handleOut(entry))}return _.map(_.filter(entries,function(entry){return!entry.merged}),function(entry){return _.pick(entry,["vs","i","barycenter","weight"])})}function mergeEntries(target,source){var sum=0;var weight=0;if(target.weight){sum+=target.barycenter*target.weight;weight+=target.weight}if(source.weight){sum+=source.barycenter*source.weight;weight+=source.weight}target.vs=source.vs.concat(target.vs);target.barycenter=sum/weight;target.weight=weight;target.i=Math.min(source.i,target.i);source.merged=true}},{"../lodash":10}],20:[function(require,module,exports){var _=require("../lodash");var barycenter=require("./barycenter");var resolveConflicts=require("./resolve-conflicts");var sort=require("./sort");module.exports=sortSubgraph;function sortSubgraph(g,v,cg,biasRight){var movable=g.children(v);var node=g.node(v);var bl=node?node.borderLeft:undefined;var br=node?node.borderRight:undefined;var subgraphs={};if(bl){movable=_.filter(movable,function(w){return w!==bl&&w!==br})}var barycenters=barycenter(g,movable);_.forEach(barycenters,function(entry){if(g.children(entry.v).length){var subgraphResult=sortSubgraph(g,entry.v,cg,biasRight);subgraphs[entry.v]=subgraphResult;if(_.has(subgraphResult,"barycenter")){mergeBarycenters(entry,subgraphResult)}}});var entries=resolveConflicts(barycenters,cg);expandSubgraphs(entries,subgraphs);var result=sort(entries,biasRight);if(bl){result.vs=_.flatten([bl,result.vs,br],true);if(g.predecessors(bl).length){var blPred=g.node(g.predecessors(bl)[0]),brPred=g.node(g.predecessors(br)[0]);if(!_.has(result,"barycenter")){result.barycenter=0;result.weight=0}result.barycenter=(result.barycenter*result.weight+blPred.order+brPred.order)/(result.weight+2);result.weight+=2}}return result}function expandSubgraphs(entries,subgraphs){_.forEach(entries,function(entry){entry.vs=_.flatten(entry.vs.map(function(v){if(subgraphs[v]){return subgraphs[v].vs}return v}),true)})}function mergeBarycenters(target,other){if(!_.isUndefined(target.barycenter)){target.barycenter=(target.barycenter*target.weight+other.barycenter*other.weight)/(target.weight+other.weight);target.weight+=other.weight}else{target.barycenter=other.barycenter;target.weight=other.weight}}},{"../lodash":10,"./barycenter":14,"./resolve-conflicts":19,"./sort":21}],21:[function(require,module,exports){var _=require("../lodash");var util=require("../util");module.exports=sort;function sort(entries,biasRight){var parts=util.partition(entries,function(entry){return _.has(entry,"barycenter")});var sortable=parts.lhs,unsortable=_.sortBy(parts.rhs,function(entry){return-entry.i}),vs=[],sum=0,weight=0,vsIndex=0;sortable.sort(compareWithBias(!!biasRight));vsIndex=consumeUnsortable(vs,unsortable,vsIndex);_.forEach(sortable,function(entry){vsIndex+=entry.vs.length;vs.push(entry.vs);sum+=entry.barycenter*entry.weight;weight+=entry.weight;vsIndex=consumeUnsortable(vs,unsortable,vsIndex)});var result={vs:_.flatten(vs,true)};if(weight){result.barycenter=sum/weight;result.weight=weight}return result}function consumeUnsortable(vs,unsortable,index){var last;while(unsortable.length&&(last=_.last(unsortable)).i<=index){unsortable.pop();vs.push(last.vs);index++}return index}function compareWithBias(bias){return function(entryV,entryW){if(entryV.barycenterentryW.barycenter){return 1}return!bias?entryV.i-entryW.i:entryW.i-entryV.i}}},{"../lodash":10,"../util":29}],22:[function(require,module,exports){var _=require("./lodash");module.exports=parentDummyChains;function parentDummyChains(g){var postorderNums=postorder(g);_.forEach(g.graph().dummyChains,function(v){var node=g.node(v);var edgeObj=node.edgeObj;var pathData=findPath(g,postorderNums,edgeObj.v,edgeObj.w);var path=pathData.path;var lca=pathData.lca;var pathIdx=0;var pathV=path[pathIdx];var ascending=true;while(v!==edgeObj.w){node=g.node(v);if(ascending){while((pathV=path[pathIdx])!==lca&&g.node(pathV).maxRanklow||lim>postorderNums[parent].lim));lca=parent; +// Traverse from w to LCA +parent=w;while((parent=g.parent(parent))!==lca){wPath.push(parent)}return{path:vPath.concat(wPath.reverse()),lca:lca}}function postorder(g){var result={};var lim=0;function dfs(v){var low=lim;_.forEach(g.children(v),dfs);result[v]={low:low,lim:lim++}}_.forEach(g.children(),dfs);return result}},{"./lodash":10}],23:[function(require,module,exports){"use strict";var _=require("../lodash");var Graph=require("../graphlib").Graph;var util=require("../util"); +/* + * This module provides coordinate assignment based on Brandes and Köpf, "Fast + * and Simple Horizontal Coordinate Assignment." + */module.exports={positionX:positionX,findType1Conflicts:findType1Conflicts,findType2Conflicts:findType2Conflicts,addConflict:addConflict,hasConflict:hasConflict,verticalAlignment:verticalAlignment,horizontalCompaction:horizontalCompaction,alignCoordinates:alignCoordinates,findSmallestWidthAlignment:findSmallestWidthAlignment,balance:balance}; +/* + * Marks all edges in the graph with a type-1 conflict with the "type1Conflict" + * property. A type-1 conflict is one where a non-inner segment crosses an + * inner segment. An inner segment is an edge with both incident nodes marked + * with the "dummy" property. + * + * This algorithm scans layer by layer, starting with the second, for type-1 + * conflicts between the current layer and the previous layer. For each layer + * it scans the nodes from left to right until it reaches one that is incident + * on an inner segment. It then scans predecessors to determine if they have + * edges that cross that inner segment. At the end a final scan is done for all + * nodes on the current rank to see if they cross the last visited inner + * segment. + * + * This algorithm (safely) assumes that a dummy node will only be incident on a + * single node in the layers being scanned. + */function findType1Conflicts(g,layering){var conflicts={};function visitLayer(prevLayer,layer){var +// last visited node in the previous layer that is incident on an inner +// segment. +k0=0, +// Tracks the last node in this layer scanned for crossings with a type-1 +// segment. +scanPos=0,prevLayerLength=prevLayer.length,lastNode=_.last(layer);_.forEach(layer,function(v,i){var w=findOtherInnerSegmentNode(g,v),k1=w?g.node(w).order:prevLayerLength;if(w||v===lastNode){_.forEach(layer.slice(scanPos,i+1),function(scanNode){_.forEach(g.predecessors(scanNode),function(u){var uLabel=g.node(u),uPos=uLabel.order;if((uPosnextNorthBorder)){addConflict(conflicts,u,v)}})}})}function visitLayer(north,south){var prevNorthPos=-1,nextNorthPos,southPos=0;_.forEach(south,function(v,southLookahead){if(g.node(v).dummy==="border"){var predecessors=g.predecessors(v);if(predecessors.length){nextNorthPos=g.node(predecessors[0]).order;scan(south,southPos,southLookahead,prevNorthPos,nextNorthPos);southPos=southLookahead;prevNorthPos=nextNorthPos}}scan(south,southPos,south.length,nextNorthPos,north.length)});return south}_.reduce(layering,visitLayer);return conflicts}function findOtherInnerSegmentNode(g,v){if(g.node(v).dummy){return _.find(g.predecessors(v),function(u){return g.node(u).dummy})}}function addConflict(conflicts,v,w){if(v>w){var tmp=v;v=w;w=tmp}var conflictsV=conflicts[v];if(!conflictsV){conflicts[v]=conflictsV={}}conflictsV[w]=true}function hasConflict(conflicts,v,w){if(v>w){var tmp=v;v=w;w=tmp}return _.has(conflicts[v],w)} +/* + * Try to align nodes into vertical "blocks" where possible. This algorithm + * attempts to align a node with one of its median neighbors. If the edge + * connecting a neighbor is a type-1 conflict then we ignore that possibility. + * If a previous node has already formed a block with a node after the node + * we're trying to form a block with, we also ignore that possibility - our + * blocks would be split in that scenario. + */function verticalAlignment(g,layering,conflicts,neighborFn){var root={},align={},pos={}; +// We cache the position here based on the layering because the graph and +// layering may be out of sync. The layering matrix is manipulated to +// generate different extreme alignments. +_.forEach(layering,function(layer){_.forEach(layer,function(v,order){root[v]=v;align[v]=v;pos[v]=order})});_.forEach(layering,function(layer){var prevIdx=-1;_.forEach(layer,function(v){var ws=neighborFn(v);if(ws.length){ws=_.sortBy(ws,function(w){return pos[w]});var mp=(ws.length-1)/2;for(var i=Math.floor(mp),il=Math.ceil(mp);i<=il;++i){var w=ws[i];if(align[v]===v&&prevIdxwLabel.lim){tailLabel=wLabel;flip=true}var candidates=_.filter(g.edges(),function(edge){return flip===isDescendant(t,t.node(edge.v),tailLabel)&&flip!==isDescendant(t,t.node(edge.w),tailLabel)});return _.minBy(candidates,function(edge){return slack(g,edge)})}function exchangeEdges(t,g,e,f){var v=e.v;var w=e.w;t.removeEdge(v,w);t.setEdge(f.v,f.w,{});initLowLimValues(t);initCutValues(t,g);updateRanks(t,g)}function updateRanks(t,g){var root=_.find(t.nodes(),function(v){return!g.node(v).parent});var vs=preorder(t,root);vs=vs.slice(1);_.forEach(vs,function(v){var parent=t.node(v).parent,edge=g.edge(v,parent),flipped=false;if(!edge){edge=g.edge(parent,v);flipped=true}g.node(v).rank=g.node(parent).rank+(flipped?edge.minlen:-edge.minlen)})} +/* + * Returns true if the edge is in the tree. + */function isTreeEdge(tree,u,v){return tree.hasEdge(u,v)} +/* + * Returns true if the specified node is descendant of the root node per the + * assigned low and lim attributes in the tree. + */function isDescendant(tree,vLabel,rootLabel){return rootLabel.low<=vLabel.lim&&vLabel.lim<=rootLabel.lim}},{"../graphlib":7,"../lodash":10,"../util":29,"./feasible-tree":25,"./util":28}],28:[function(require,module,exports){"use strict";var _=require("../lodash");module.exports={longestPath:longestPath,slack:slack}; +/* + * Initializes ranks for the input graph using the longest path algorithm. This + * algorithm scales well and is fast in practice, it yields rather poor + * solutions. Nodes are pushed to the lowest layer possible, leaving the bottom + * ranks wide and leaving edges longer than necessary. However, due to its + * speed, this algorithm is good for getting an initial ranking that can be fed + * into other algorithms. + * + * This algorithm does not normalize layers because it will be used by other + * algorithms in most cases. If using this algorithm directly, be sure to + * run normalize at the end. + * + * Pre-conditions: + * + * 1. Input graph is a DAG. + * 2. Input graph node labels can be assigned properties. + * + * Post-conditions: + * + * 1. Each node will be assign an (unnormalized) "rank" property. + */function longestPath(g){var visited={};function dfs(v){var label=g.node(v);if(_.has(visited,v)){return label.rank}visited[v]=true;var rank=_.min(_.map(g.outEdges(v),function(e){return dfs(e.w)-g.edge(e).minlen}));if(rank===Number.POSITIVE_INFINITY||// return value of _.map([]) for Lodash 3 +rank===undefined||// return value of _.map([]) for Lodash 4 +rank===null){// return value of _.map([null]) +rank=0}return label.rank=rank}_.forEach(g.sources(),dfs)} +/* + * Returns the amount of slack for the given edge. The slack is defined as the + * difference between the length of the edge and its minimum length. + */function slack(g,e){return g.node(e.w).rank-g.node(e.v).rank-g.edge(e).minlen}},{"../lodash":10}],29:[function(require,module,exports){ +/* eslint "no-console": off */ +"use strict";var _=require("./lodash");var Graph=require("./graphlib").Graph;module.exports={addDummyNode:addDummyNode,simplify:simplify,asNonCompoundGraph:asNonCompoundGraph,successorWeights:successorWeights,predecessorWeights:predecessorWeights,intersectRect:intersectRect,buildLayerMatrix:buildLayerMatrix,normalizeRanks:normalizeRanks,removeEmptyRanks:removeEmptyRanks,addBorderNode:addBorderNode,maxRank:maxRank,partition:partition,time:time,notime:notime}; +/* + * Adds a dummy node to the graph and return v. + */function addDummyNode(g,type,attrs,name){var v;do{v=_.uniqueId(name)}while(g.hasNode(v));attrs.dummy=type;g.setNode(v,attrs);return v} +/* + * Returns a new graph with only simple edges. Handles aggregation of data + * associated with multi-edges. + */function simplify(g){var simplified=(new Graph).setGraph(g.graph());_.forEach(g.nodes(),function(v){simplified.setNode(v,g.node(v))});_.forEach(g.edges(),function(e){var simpleLabel=simplified.edge(e.v,e.w)||{weight:0,minlen:1};var label=g.edge(e);simplified.setEdge(e.v,e.w,{weight:simpleLabel.weight+label.weight,minlen:Math.max(simpleLabel.minlen,label.minlen)})});return simplified}function asNonCompoundGraph(g){var simplified=new Graph({multigraph:g.isMultigraph()}).setGraph(g.graph());_.forEach(g.nodes(),function(v){if(!g.children(v).length){simplified.setNode(v,g.node(v))}});_.forEach(g.edges(),function(e){simplified.setEdge(e,g.edge(e))});return simplified}function successorWeights(g){var weightMap=_.map(g.nodes(),function(v){var sucs={};_.forEach(g.outEdges(v),function(e){sucs[e.w]=(sucs[e.w]||0)+g.edge(e).weight});return sucs});return _.zipObject(g.nodes(),weightMap)}function predecessorWeights(g){var weightMap=_.map(g.nodes(),function(v){var preds={};_.forEach(g.inEdges(v),function(e){preds[e.v]=(preds[e.v]||0)+g.edge(e).weight});return preds});return _.zipObject(g.nodes(),weightMap)} +/* + * Finds where a line starting at point ({x, y}) would intersect a rectangle + * ({x, y, width, height}) if it were pointing at the rectangle's center. + */function intersectRect(rect,point){var x=rect.x;var y=rect.y; +// Rectangle intersection algorithm from: +// http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes +var dx=point.x-x;var dy=point.y-y;var w=rect.width/2;var h=rect.height/2;if(!dx&&!dy){throw new Error("Not possible to find intersection inside of the rectangle")}var sx,sy;if(Math.abs(dy)*w>Math.abs(dx)*h){ +// Intersection is top or bottom of rect. +if(dy<0){h=-h}sx=h*dx/dy;sy=h}else{ +// Intersection is left or right of rect. +if(dx<0){w=-w}sx=w;sy=w*dy/dx}return{x:x+sx,y:y+sy}} +/* + * Given a DAG with each node assigned "rank" and "order" properties, this + * function will produce a matrix with the ids of each node. + */function buildLayerMatrix(g){var layering=_.map(_.range(maxRank(g)+1),function(){return[]});_.forEach(g.nodes(),function(v){var node=g.node(v);var rank=node.rank;if(!_.isUndefined(rank)){layering[rank][node.order]=v}});return layering} +/* + * Adjusts the ranks for all nodes in the graph such that all nodes v have + * rank(v) >= 0 and at least one node w has rank(w) = 0. + */function normalizeRanks(g){var min=_.min(_.map(g.nodes(),function(v){return g.node(v).rank}));_.forEach(g.nodes(),function(v){var node=g.node(v);if(_.has(node,"rank")){node.rank-=min}})}function removeEmptyRanks(g){ +// Ranks may not start at 0, so we need to offset them +var offset=_.min(_.map(g.nodes(),function(v){return g.node(v).rank}));var layers=[];_.forEach(g.nodes(),function(v){var rank=g.node(v).rank-offset;if(!layers[rank]){layers[rank]=[]}layers[rank].push(v)});var delta=0;var nodeRankFactor=g.graph().nodeRankFactor;_.forEach(layers,function(vs,i){if(_.isUndefined(vs)&&i%nodeRankFactor!==0){--delta}else if(delta){_.forEach(vs,function(v){g.node(v).rank+=delta})}})}function addBorderNode(g,prefix,rank,order){var node={width:0,height:0};if(arguments.length>=4){node.rank=rank;node.order=order}return addDummyNode(g,"border",node,prefix)}function maxRank(g){return _.max(_.map(g.nodes(),function(v){var rank=g.node(v).rank;if(!_.isUndefined(rank)){return rank}}))} +/* + * Partition a collection into two groups: `lhs` and `rhs`. If the supplied + * function returns true for an entry it goes into `lhs`. Otherwise it goes + * into `rhs. + */function partition(collection,fn){var result={lhs:[],rhs:[]};_.forEach(collection,function(value){if(fn(value)){result.lhs.push(value)}else{result.rhs.push(value)}});return result} +/* + * Returns a new function that wraps `fn` with a timer. The wrapper logs the + * time it takes to execute the function. + */function time(name,fn){var start=_.now();try{return fn()}finally{console.log(name+" time: "+(_.now()-start)+"ms")}}function notime(name,fn){return fn()}},{"./graphlib":7,"./lodash":10}],30:[function(require,module,exports){module.exports="0.8.5"},{}],31:[function(require,module,exports){ +/** + * Copyright (c) 2014, Chris Pettitt + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +var lib=require("./lib");module.exports={Graph:lib.Graph,json:require("./lib/json"),alg:require("./lib/alg"),version:lib.version}},{"./lib":47,"./lib/alg":38,"./lib/json":48}],32:[function(require,module,exports){var _=require("../lodash");module.exports=components;function components(g){var visited={};var cmpts=[];var cmpt;function dfs(v){if(_.has(visited,v))return;visited[v]=true;cmpt.push(v);_.each(g.successors(v),dfs);_.each(g.predecessors(v),dfs)}_.each(g.nodes(),function(v){cmpt=[];dfs(v);if(cmpt.length){cmpts.push(cmpt)}});return cmpts}},{"../lodash":49}],33:[function(require,module,exports){var _=require("../lodash");module.exports=dfs; +/* + * A helper that preforms a pre- or post-order traversal on the input graph + * and returns the nodes in the order they were visited. If the graph is + * undirected then this algorithm will navigate using neighbors. If the graph + * is directed then this algorithm will navigate using successors. + * + * Order must be one of "pre" or "post". + */function dfs(g,vs,order){if(!_.isArray(vs)){vs=[vs]}var navigation=(g.isDirected()?g.successors:g.neighbors).bind(g);var acc=[];var visited={};_.each(vs,function(v){if(!g.hasNode(v)){throw new Error("Graph does not have node: "+v)}doDfs(g,v,order==="post",visited,navigation,acc)});return acc}function doDfs(g,v,postorder,visited,navigation,acc){if(!_.has(visited,v)){visited[v]=true;if(!postorder){acc.push(v)}_.each(navigation(v),function(w){doDfs(g,w,postorder,visited,navigation,acc)});if(postorder){acc.push(v)}}}},{"../lodash":49}],34:[function(require,module,exports){var dijkstra=require("./dijkstra");var _=require("../lodash");module.exports=dijkstraAll;function dijkstraAll(g,weightFunc,edgeFunc){return _.transform(g.nodes(),function(acc,v){acc[v]=dijkstra(g,v,weightFunc,edgeFunc)},{})}},{"../lodash":49,"./dijkstra":35}],35:[function(require,module,exports){var _=require("../lodash");var PriorityQueue=require("../data/priority-queue");module.exports=dijkstra;var DEFAULT_WEIGHT_FUNC=_.constant(1);function dijkstra(g,source,weightFn,edgeFn){return runDijkstra(g,String(source),weightFn||DEFAULT_WEIGHT_FUNC,edgeFn||function(v){return g.outEdges(v)})}function runDijkstra(g,source,weightFn,edgeFn){var results={};var pq=new PriorityQueue;var v,vEntry;var updateNeighbors=function(edge){var w=edge.v!==v?edge.v:edge.w;var wEntry=results[w];var weight=weightFn(edge);var distance=vEntry.distance+weight;if(weight<0){throw new Error("dijkstra does not allow negative edge weights. "+"Bad edge: "+edge+" Weight: "+weight)}if(distance0){v=pq.removeMin();vEntry=results[v];if(vEntry.distance===Number.POSITIVE_INFINITY){break}edgeFn(v).forEach(updateNeighbors)}return results}},{"../data/priority-queue":45,"../lodash":49}],36:[function(require,module,exports){var _=require("../lodash");var tarjan=require("./tarjan");module.exports=findCycles;function findCycles(g){return _.filter(tarjan(g),function(cmpt){return cmpt.length>1||cmpt.length===1&&g.hasEdge(cmpt[0],cmpt[0])})}},{"../lodash":49,"./tarjan":43}],37:[function(require,module,exports){var _=require("../lodash");module.exports=floydWarshall;var DEFAULT_WEIGHT_FUNC=_.constant(1);function floydWarshall(g,weightFn,edgeFn){return runFloydWarshall(g,weightFn||DEFAULT_WEIGHT_FUNC,edgeFn||function(v){return g.outEdges(v)})}function runFloydWarshall(g,weightFn,edgeFn){var results={};var nodes=g.nodes();nodes.forEach(function(v){results[v]={};results[v][v]={distance:0};nodes.forEach(function(w){if(v!==w){results[v][w]={distance:Number.POSITIVE_INFINITY}}});edgeFn(v).forEach(function(edge){var w=edge.v===v?edge.w:edge.v;var d=weightFn(edge);results[v][w]={distance:d,predecessor:v}})});nodes.forEach(function(k){var rowK=results[k];nodes.forEach(function(i){var rowI=results[i];nodes.forEach(function(j){var ik=rowI[k];var kj=rowK[j];var ij=rowI[j];var altDistance=ik.distance+kj.distance;if(altDistance0){v=pq.removeMin();if(_.has(parents,v)){result.setEdge(v,parents[v])}else if(init){throw new Error("Input graph is not connected: "+g)}else{init=true}g.nodeEdges(v).forEach(updateNeighbors)}return result}},{"../data/priority-queue":45,"../graph":46,"../lodash":49}],43:[function(require,module,exports){var _=require("../lodash");module.exports=tarjan;function tarjan(g){var index=0;var stack=[];var visited={};// node id -> { onStack, lowlink, index } +var results=[];function dfs(v){var entry=visited[v]={onStack:true,lowlink:index,index:index++};stack.push(v);g.successors(v).forEach(function(w){if(!_.has(visited,w)){dfs(w);entry.lowlink=Math.min(entry.lowlink,visited[w].lowlink)}else if(visited[w].onStack){entry.lowlink=Math.min(entry.lowlink,visited[w].index)}});if(entry.lowlink===entry.index){var cmpt=[];var w;do{w=stack.pop();visited[w].onStack=false;cmpt.push(w)}while(v!==w);results.push(cmpt)}}g.nodes().forEach(function(v){if(!_.has(visited,v)){dfs(v)}});return results}},{"../lodash":49}],44:[function(require,module,exports){var _=require("../lodash");module.exports=topsort;topsort.CycleException=CycleException;function topsort(g){var visited={};var stack={};var results=[];function visit(node){if(_.has(stack,node)){throw new CycleException}if(!_.has(visited,node)){stack[node]=true;visited[node]=true;_.each(g.predecessors(node),visit);delete stack[node];results.push(node)}}_.each(g.sinks(),visit);if(_.size(visited)!==g.nodeCount()){throw new CycleException}return results}function CycleException(){}CycleException.prototype=new Error;// must be an instance of Error to pass testing +},{"../lodash":49}],45:[function(require,module,exports){var _=require("../lodash");module.exports=PriorityQueue; +/** + * A min-priority queue data structure. This algorithm is derived from Cormen, + * et al., "Introduction to Algorithms". The basic idea of a min-priority + * queue is that you can efficiently (in O(1) time) get the smallest key in + * the queue. Adding and removing elements takes O(log n) time. A key can + * have its priority decreased in O(log n) time. + */function PriorityQueue(){this._arr=[];this._keyIndices={}} +/** + * Returns the number of elements in the queue. Takes `O(1)` time. + */PriorityQueue.prototype.size=function(){return this._arr.length}; +/** + * Returns the keys that are in the queue. Takes `O(n)` time. + */PriorityQueue.prototype.keys=function(){return this._arr.map(function(x){return x.key})}; +/** + * Returns `true` if **key** is in the queue and `false` if not. + */PriorityQueue.prototype.has=function(key){return _.has(this._keyIndices,key)}; +/** + * Returns the priority for **key**. If **key** is not present in the queue + * then this function returns `undefined`. Takes `O(1)` time. + * + * @param {Object} key + */PriorityQueue.prototype.priority=function(key){var index=this._keyIndices[key];if(index!==undefined){return this._arr[index].priority}}; +/** + * Returns the key for the minimum element in this queue. If the queue is + * empty this function throws an Error. Takes `O(1)` time. + */PriorityQueue.prototype.min=function(){if(this.size()===0){throw new Error("Queue underflow")}return this._arr[0].key}; +/** + * Inserts a new key into the priority queue. If the key already exists in + * the queue this function returns `false`; otherwise it will return `true`. + * Takes `O(n)` time. + * + * @param {Object} key the key to add + * @param {Number} priority the initial priority for the key + */PriorityQueue.prototype.add=function(key,priority){var keyIndices=this._keyIndices;key=String(key);if(!_.has(keyIndices,key)){var arr=this._arr;var index=arr.length;keyIndices[key]=index;arr.push({key:key,priority:priority});this._decrease(index);return true}return false}; +/** + * Removes and returns the smallest key in the queue. Takes `O(log n)` time. + */PriorityQueue.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var min=this._arr.pop();delete this._keyIndices[min.key];this._heapify(0);return min.key}; +/** + * Decreases the priority for **key** to **priority**. If the new priority is + * greater than the previous priority, this function will throw an Error. + * + * @param {Object} key the key for which to raise priority + * @param {Number} priority the new priority for the key + */PriorityQueue.prototype.decrease=function(key,priority){var index=this._keyIndices[key];if(priority>this._arr[index].priority){throw new Error("New priority is greater than current priority. "+"Key: "+key+" Old: "+this._arr[index].priority+" New: "+priority)}this._arr[index].priority=priority;this._decrease(index)};PriorityQueue.prototype._heapify=function(i){var arr=this._arr;var l=2*i;var r=l+1;var largest=i;if(l>1;if(arr[parent].priority label +this._nodes={};if(this._isCompound){ +// v -> parent +this._parent={}; +// v -> children +this._children={};this._children[GRAPH_NODE]={}} +// v -> edgeObj +this._in={}; +// u -> v -> Number +this._preds={}; +// v -> edgeObj +this._out={}; +// v -> w -> Number +this._sucs={}; +// e -> edgeObj +this._edgeObjs={}; +// e -> label +this._edgeLabels={}} +/* Number of nodes in the graph. Should only be changed by the implementation. */Graph.prototype._nodeCount=0; +/* Number of edges in the graph. Should only be changed by the implementation. */Graph.prototype._edgeCount=0; +/* === Graph functions ========= */Graph.prototype.isDirected=function(){return this._isDirected};Graph.prototype.isMultigraph=function(){return this._isMultigraph};Graph.prototype.isCompound=function(){return this._isCompound};Graph.prototype.setGraph=function(label){this._label=label;return this};Graph.prototype.graph=function(){return this._label}; +/* === Node functions ========== */Graph.prototype.setDefaultNodeLabel=function(newDefault){if(!_.isFunction(newDefault)){newDefault=_.constant(newDefault)}this._defaultNodeLabelFn=newDefault;return this};Graph.prototype.nodeCount=function(){return this._nodeCount};Graph.prototype.nodes=function(){return _.keys(this._nodes)};Graph.prototype.sources=function(){var self=this;return _.filter(this.nodes(),function(v){return _.isEmpty(self._in[v])})};Graph.prototype.sinks=function(){var self=this;return _.filter(this.nodes(),function(v){return _.isEmpty(self._out[v])})};Graph.prototype.setNodes=function(vs,value){var args=arguments;var self=this;_.each(vs,function(v){if(args.length>1){self.setNode(v,value)}else{self.setNode(v)}});return this};Graph.prototype.setNode=function(v,value){if(_.has(this._nodes,v)){if(arguments.length>1){this._nodes[v]=value}return this}this._nodes[v]=arguments.length>1?value:this._defaultNodeLabelFn(v);if(this._isCompound){this._parent[v]=GRAPH_NODE;this._children[v]={};this._children[GRAPH_NODE][v]=true}this._in[v]={};this._preds[v]={};this._out[v]={};this._sucs[v]={};++this._nodeCount;return this};Graph.prototype.node=function(v){return this._nodes[v]};Graph.prototype.hasNode=function(v){return _.has(this._nodes,v)};Graph.prototype.removeNode=function(v){var self=this;if(_.has(this._nodes,v)){var removeEdge=function(e){self.removeEdge(self._edgeObjs[e])};delete this._nodes[v];if(this._isCompound){this._removeFromParentsChildList(v);delete this._parent[v];_.each(this.children(v),function(child){self.setParent(child)});delete this._children[v]}_.each(_.keys(this._in[v]),removeEdge);delete this._in[v];delete this._preds[v];_.each(_.keys(this._out[v]),removeEdge);delete this._out[v];delete this._sucs[v];--this._nodeCount}return this};Graph.prototype.setParent=function(v,parent){if(!this._isCompound){throw new Error("Cannot set parent in a non-compound graph")}if(_.isUndefined(parent)){parent=GRAPH_NODE}else{ +// Coerce parent to string +parent+="";for(var ancestor=parent;!_.isUndefined(ancestor);ancestor=this.parent(ancestor)){if(ancestor===v){throw new Error("Setting "+parent+" as parent of "+v+" would create a cycle")}}this.setNode(parent)}this.setNode(v);this._removeFromParentsChildList(v);this._parent[v]=parent;this._children[parent][v]=true;return this};Graph.prototype._removeFromParentsChildList=function(v){delete this._children[this._parent[v]][v]};Graph.prototype.parent=function(v){if(this._isCompound){var parent=this._parent[v];if(parent!==GRAPH_NODE){return parent}}};Graph.prototype.children=function(v){if(_.isUndefined(v)){v=GRAPH_NODE}if(this._isCompound){var children=this._children[v];if(children){return _.keys(children)}}else if(v===GRAPH_NODE){return this.nodes()}else if(this.hasNode(v)){return[]}};Graph.prototype.predecessors=function(v){var predsV=this._preds[v];if(predsV){return _.keys(predsV)}};Graph.prototype.successors=function(v){var sucsV=this._sucs[v];if(sucsV){return _.keys(sucsV)}};Graph.prototype.neighbors=function(v){var preds=this.predecessors(v);if(preds){return _.union(preds,this.successors(v))}};Graph.prototype.isLeaf=function(v){var neighbors;if(this.isDirected()){neighbors=this.successors(v)}else{neighbors=this.neighbors(v)}return neighbors.length===0};Graph.prototype.filterNodes=function(filter){var copy=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});copy.setGraph(this.graph());var self=this;_.each(this._nodes,function(value,v){if(filter(v)){copy.setNode(v,value)}});_.each(this._edgeObjs,function(e){if(copy.hasNode(e.v)&©.hasNode(e.w)){copy.setEdge(e,self.edge(e))}});var parents={};function findParent(v){var parent=self.parent(v);if(parent===undefined||copy.hasNode(parent)){parents[v]=parent;return parent}else if(parent in parents){return parents[parent]}else{return findParent(parent)}}if(this._isCompound){_.each(copy.nodes(),function(v){copy.setParent(v,findParent(v))})}return copy}; +/* === Edge functions ========== */Graph.prototype.setDefaultEdgeLabel=function(newDefault){if(!_.isFunction(newDefault)){newDefault=_.constant(newDefault)}this._defaultEdgeLabelFn=newDefault;return this};Graph.prototype.edgeCount=function(){return this._edgeCount};Graph.prototype.edges=function(){return _.values(this._edgeObjs)};Graph.prototype.setPath=function(vs,value){var self=this;var args=arguments;_.reduce(vs,function(v,w){if(args.length>1){self.setEdge(v,w,value)}else{self.setEdge(v,w)}return w});return this}; +/* + * setEdge(v, w, [value, [name]]) + * setEdge({ v, w, [name] }, [value]) + */Graph.prototype.setEdge=function(){var v,w,name,value;var valueSpecified=false;var arg0=arguments[0];if(typeof arg0==="object"&&arg0!==null&&"v"in arg0){v=arg0.v;w=arg0.w;name=arg0.name;if(arguments.length===2){value=arguments[1];valueSpecified=true}}else{v=arg0;w=arguments[1];name=arguments[3];if(arguments.length>2){value=arguments[2];valueSpecified=true}}v=""+v;w=""+w;if(!_.isUndefined(name)){name=""+name}var e=edgeArgsToId(this._isDirected,v,w,name);if(_.has(this._edgeLabels,e)){if(valueSpecified){this._edgeLabels[e]=value}return this}if(!_.isUndefined(name)&&!this._isMultigraph){throw new Error("Cannot set a named edge when isMultigraph = false")} +// It didn't exist, so we need to create it. +// First ensure the nodes exist. +this.setNode(v);this.setNode(w);this._edgeLabels[e]=valueSpecified?value:this._defaultEdgeLabelFn(v,w,name);var edgeObj=edgeArgsToObj(this._isDirected,v,w,name); +// Ensure we add undirected edges in a consistent way. +v=edgeObj.v;w=edgeObj.w;Object.freeze(edgeObj);this._edgeObjs[e]=edgeObj;incrementOrInitEntry(this._preds[w],v);incrementOrInitEntry(this._sucs[v],w);this._in[w][e]=edgeObj;this._out[v][e]=edgeObj;this._edgeCount++;return this};Graph.prototype.edge=function(v,w,name){var e=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,v,w,name);return this._edgeLabels[e]};Graph.prototype.hasEdge=function(v,w,name){var e=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,v,w,name);return _.has(this._edgeLabels,e)};Graph.prototype.removeEdge=function(v,w,name){var e=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,v,w,name);var edge=this._edgeObjs[e];if(edge){v=edge.v;w=edge.w;delete this._edgeLabels[e];delete this._edgeObjs[e];decrementOrRemoveEntry(this._preds[w],v);decrementOrRemoveEntry(this._sucs[v],w);delete this._in[w][e];delete this._out[v][e];this._edgeCount--}return this};Graph.prototype.inEdges=function(v,u){var inV=this._in[v];if(inV){var edges=_.values(inV);if(!u){return edges}return _.filter(edges,function(edge){return edge.v===u})}};Graph.prototype.outEdges=function(v,w){var outV=this._out[v];if(outV){var edges=_.values(outV);if(!w){return edges}return _.filter(edges,function(edge){return edge.w===w})}};Graph.prototype.nodeEdges=function(v,w){var inEdges=this.inEdges(v,w);if(inEdges){return inEdges.concat(this.outEdges(v,w))}};function incrementOrInitEntry(map,k){if(map[k]){map[k]++}else{map[k]=1}}function decrementOrRemoveEntry(map,k){if(!--map[k]){delete map[k]}}function edgeArgsToId(isDirected,v_,w_,name){var v=""+v_;var w=""+w_;if(!isDirected&&v>w){var tmp=v;v=w;w=tmp}return v+EDGE_KEY_DELIM+w+EDGE_KEY_DELIM+(_.isUndefined(name)?DEFAULT_EDGE_NAME:name)}function edgeArgsToObj(isDirected,v_,w_,name){var v=""+v_;var w=""+w_;if(!isDirected&&v>w){var tmp=v;v=w;w=tmp}var edgeObj={v:v,w:w};if(name){edgeObj.name=name}return edgeObj}function edgeObjToId(isDirected,edgeObj){return edgeArgsToId(isDirected,edgeObj.v,edgeObj.w,edgeObj.name)}},{"./lodash":49}],47:[function(require,module,exports){ +// Includes only the "core" of graphlib +module.exports={Graph:require("./graph"),version:require("./version")}},{"./graph":46,"./version":50}],48:[function(require,module,exports){var _=require("./lodash");var Graph=require("./graph");module.exports={write:write,read:read};function write(g){var json={options:{directed:g.isDirected(),multigraph:g.isMultigraph(),compound:g.isCompound()},nodes:writeNodes(g),edges:writeEdges(g)};if(!_.isUndefined(g.graph())){json.value=_.clone(g.graph())}return json}function writeNodes(g){return _.map(g.nodes(),function(v){var nodeValue=g.node(v);var parent=g.parent(v);var node={v:v};if(!_.isUndefined(nodeValue)){node.value=nodeValue}if(!_.isUndefined(parent)){node.parent=parent}return node})}function writeEdges(g){return _.map(g.edges(),function(e){var edgeValue=g.edge(e);var edge={v:e.v,w:e.w};if(!_.isUndefined(e.name)){edge.name=e.name}if(!_.isUndefined(edgeValue)){edge.value=edgeValue}return edge})}function read(json){var g=new Graph(json.options).setGraph(json.value);_.each(json.nodes,function(entry){g.setNode(entry.v,entry.value);if(entry.parent){g.setParent(entry.v,entry.parent)}});_.each(json.edges,function(entry){g.setEdge({v:entry.v,w:entry.w,name:entry.name},entry.value)});return g}},{"./graph":46,"./lodash":49}],49:[function(require,module,exports){ +/* global window */ +var lodash;if(typeof require==="function"){try{lodash={clone:require("lodash/clone"),constant:require("lodash/constant"),each:require("lodash/each"),filter:require("lodash/filter"),has:require("lodash/has"),isArray:require("lodash/isArray"),isEmpty:require("lodash/isEmpty"),isFunction:require("lodash/isFunction"),isUndefined:require("lodash/isUndefined"),keys:require("lodash/keys"),map:require("lodash/map"),reduce:require("lodash/reduce"),size:require("lodash/size"),transform:require("lodash/transform"),union:require("lodash/union"),values:require("lodash/values")}}catch(e){ +// continue regardless of error +}}if(!lodash){lodash=window._}module.exports=lodash},{"lodash/clone":226,"lodash/constant":228,"lodash/each":230,"lodash/filter":232,"lodash/has":239,"lodash/isArray":243,"lodash/isEmpty":247,"lodash/isFunction":248,"lodash/isUndefined":258,"lodash/keys":259,"lodash/map":262,"lodash/reduce":274,"lodash/size":275,"lodash/transform":284,"lodash/union":285,"lodash/values":287}],50:[function(require,module,exports){module.exports="2.1.8"},{}],51:[function(require,module,exports){var getNative=require("./_getNative"),root=require("./_root"); +/* Built-in method references that are verified to be native. */var DataView=getNative(root,"DataView");module.exports=DataView},{"./_getNative":163,"./_root":208}],52:[function(require,module,exports){var hashClear=require("./_hashClear"),hashDelete=require("./_hashDelete"),hashGet=require("./_hashGet"),hashHas=require("./_hashHas"),hashSet=require("./_hashSet"); +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */function Hash(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index-1}module.exports=arrayIncludes},{"./_baseIndexOf":95}],67:[function(require,module,exports){ +/** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludesWith(array,value,comparator){var index=-1,length=array==null?0:array.length;while(++index0&&predicate(value)){if(depth>1){ +// Recursively flatten arrays (susceptible to call stack limits). +baseFlatten(value,depth-1,predicate,isStrict,result)}else{arrayPush(result,value)}}else if(!isStrict){result[result.length]=value}}return result}module.exports=baseFlatten},{"./_arrayPush":70,"./_isFlattenable":180}],87:[function(require,module,exports){var createBaseFor=require("./_createBaseFor"); +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */var baseFor=createBaseFor();module.exports=baseFor},{"./_createBaseFor":149}],88:[function(require,module,exports){var baseFor=require("./_baseFor"),keys=require("./keys"); +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}module.exports=baseForOwn},{"./_baseFor":87,"./keys":259}],89:[function(require,module,exports){var castPath=require("./_castPath"),toKey=require("./_toKey"); +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */function baseGet(object,path){path=castPath(path,object);var index=0,length=path.length;while(object!=null&&indexother}module.exports=baseGt},{}],93:[function(require,module,exports){ +/** Used for built-in method references. */ +var objectProto=Object.prototype; +/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty; +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */function baseHas(object,key){return object!=null&&hasOwnProperty.call(object,key)}module.exports=baseHas},{}],94:[function(require,module,exports){ +/** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHasIn(object,key){return object!=null&&key in Object(object)}module.exports=baseHasIn},{}],95:[function(require,module,exports){var baseFindIndex=require("./_baseFindIndex"),baseIsNaN=require("./_baseIsNaN"),strictIndexOf=require("./_strictIndexOf"); +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */function baseIndexOf(array,value,fromIndex){return value===value?strictIndexOf(array,value,fromIndex):baseFindIndex(array,baseIsNaN,fromIndex)}module.exports=baseIndexOf},{"./_baseFindIndex":85,"./_baseIsNaN":101,"./_strictIndexOf":220}],96:[function(require,module,exports){var baseGetTag=require("./_baseGetTag"),isObjectLike=require("./isObjectLike"); +/** `Object#toString` result references. */var argsTag="[object Arguments]"; +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */function baseIsArguments(value){return isObjectLike(value)&&baseGetTag(value)==argsTag}module.exports=baseIsArguments},{"./_baseGetTag":91,"./isObjectLike":252}],97:[function(require,module,exports){var baseIsEqualDeep=require("./_baseIsEqualDeep"),isObjectLike=require("./isObjectLike"); +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */function baseIsEqual(value,other,bitmask,customizer,stack){if(value===other){return true}if(value==null||other==null||!isObjectLike(value)&&!isObjectLike(other)){return value!==value&&other!==other}return baseIsEqualDeep(value,other,bitmask,customizer,baseIsEqual,stack)}module.exports=baseIsEqual},{"./_baseIsEqualDeep":98,"./isObjectLike":252}],98:[function(require,module,exports){var Stack=require("./_Stack"),equalArrays=require("./_equalArrays"),equalByTag=require("./_equalByTag"),equalObjects=require("./_equalObjects"),getTag=require("./_getTag"),isArray=require("./isArray"),isBuffer=require("./isBuffer"),isTypedArray=require("./isTypedArray"); +/** Used to compose bitmasks for value comparisons. */var COMPARE_PARTIAL_FLAG=1; +/** `Object#toString` result references. */var argsTag="[object Arguments]",arrayTag="[object Array]",objectTag="[object Object]"; +/** Used for built-in method references. */var objectProto=Object.prototype; +/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty; +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */function baseIsEqualDeep(object,other,bitmask,customizer,equalFunc,stack){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=objIsArr?arrayTag:getTag(object),othTag=othIsArr?arrayTag:getTag(other);objTag=objTag==argsTag?objectTag:objTag;othTag=othTag==argsTag?objectTag:othTag;var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&isBuffer(object)){if(!isBuffer(other)){return false}objIsArr=true;objIsObj=false}if(isSameTag&&!objIsObj){stack||(stack=new Stack);return objIsArr||isTypedArray(object)?equalArrays(object,other,bitmask,customizer,equalFunc,stack):equalByTag(object,other,objTag,bitmask,customizer,equalFunc,stack)}if(!(bitmask&COMPARE_PARTIAL_FLAG)){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value():other;stack||(stack=new Stack);return equalFunc(objUnwrapped,othUnwrapped,bitmask,customizer,stack)}}if(!isSameTag){return false}stack||(stack=new Stack);return equalObjects(object,other,bitmask,customizer,equalFunc,stack)}module.exports=baseIsEqualDeep},{"./_Stack":59,"./_equalArrays":154,"./_equalByTag":155,"./_equalObjects":156,"./_getTag":168,"./isArray":243,"./isBuffer":246,"./isTypedArray":257}],99:[function(require,module,exports){var getTag=require("./_getTag"),isObjectLike=require("./isObjectLike"); +/** `Object#toString` result references. */var mapTag="[object Map]"; +/** + * The base implementation of `_.isMap` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + */function baseIsMap(value){return isObjectLike(value)&&getTag(value)==mapTag}module.exports=baseIsMap},{"./_getTag":168,"./isObjectLike":252}],100:[function(require,module,exports){var Stack=require("./_Stack"),baseIsEqual=require("./_baseIsEqual"); +/** Used to compose bitmasks for value comparisons. */var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2; +/** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */function baseIsMatch(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(object==null){return!length}object=Object(object);while(index--){var data=matchData[index];if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object)){return false}}while(++index=LARGE_ARRAY_SIZE){var set=iteratee?null:createSet(array);if(set){return setToArray(set)}isCommon=false;includes=cacheHas;seen=new SetCache}else{seen=iteratee?[]:result}outer:while(++indexother||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive){return 1}if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value=ordersLength){return result}var order=orders[index];return result*(order=="desc"?-1:1)}} +// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications +// that causes it, under certain circumstances, to provide the same value for +// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 +// for more details. +// +// This also ensures a stable sort in V8 and other engines. +// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. +return object.index-other.index}module.exports=compareMultiple},{"./_compareAscending":140}],142:[function(require,module,exports){ +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;customizer=assigner.length>3&&typeof customizer=="function"?(length--,customizer):undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){customizer=length<3?undefined:customizer;length=1}object=Object(object);while(++index-1?iterable[iteratee?collection[index]:index]:undefined}}module.exports=createFind},{"./_baseIteratee":105,"./isArrayLike":244,"./keys":259}],151:[function(require,module,exports){var baseRange=require("./_baseRange"),isIterateeCall=require("./_isIterateeCall"),toFinite=require("./toFinite"); +/** + * Creates a `_.range` or `_.rangeRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new range function. + */function createRange(fromRight){return function(start,end,step){if(step&&typeof step!="number"&&isIterateeCall(start,end,step)){end=step=undefined} +// Ensure the sign of `-0` is preserved. +start=toFinite(start);if(end===undefined){end=start;start=0}else{end=toFinite(end)}step=step===undefined?startarrLength)){return false} +// Assume cyclic values are equal. +var stacked=stack.get(array);if(stacked&&stack.get(other)){return stacked==other}var index=-1,result=true,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache:undefined;stack.set(array,other);stack.set(other,array); +// Ignore non-index properties. +while(++index-1&&value%1==0&&value-1}module.exports=listCacheHas},{"./_assocIndexOf":76}],192:[function(require,module,exports){var assocIndexOf=require("./_assocIndexOf"); +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){++this.size;data.push([key,value])}else{data[index][1]=value}return this}module.exports=listCacheSet},{"./_assocIndexOf":76}],193:[function(require,module,exports){var Hash=require("./_Hash"),ListCache=require("./_ListCache"),Map=require("./_Map"); +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */function mapCacheClear(){this.size=0;this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}module.exports=mapCacheClear},{"./_Hash":52,"./_ListCache":53,"./_Map":54}],194:[function(require,module,exports){var getMapData=require("./_getMapData"); +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */function mapCacheDelete(key){var result=getMapData(this,key)["delete"](key);this.size-=result?1:0;return result}module.exports=mapCacheDelete},{"./_getMapData":161}],195:[function(require,module,exports){var getMapData=require("./_getMapData"); +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */function mapCacheGet(key){return getMapData(this,key).get(key)}module.exports=mapCacheGet},{"./_getMapData":161}],196:[function(require,module,exports){var getMapData=require("./_getMapData"); +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */function mapCacheHas(key){return getMapData(this,key).has(key)}module.exports=mapCacheHas},{"./_getMapData":161}],197:[function(require,module,exports){var getMapData=require("./_getMapData"); +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */function mapCacheSet(key,value){var data=getMapData(this,key),size=data.size;data.set(key,value);this.size+=data.size==size?0:1;return this}module.exports=mapCacheSet},{"./_getMapData":161}],198:[function(require,module,exports){ +/** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ +function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value]});return result}module.exports=mapToArray},{}],199:[function(require,module,exports){ +/** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function matchesStrictComparable(key,srcValue){return function(object){if(object==null){return false}return object[key]===srcValue&&(srcValue!==undefined||key in Object(object))}}module.exports=matchesStrictComparable},{}],200:[function(require,module,exports){var memoize=require("./memoize"); +/** Used as the maximum memoize cache size. */var MAX_MEMOIZE_SIZE=500; +/** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */function memoizeCapped(func){var result=memoize(func,function(key){if(cache.size===MAX_MEMOIZE_SIZE){cache.clear()}return key});var cache=result.cache;return result}module.exports=memoizeCapped},{"./memoize":265}],201:[function(require,module,exports){var getNative=require("./_getNative"); +/* Built-in method references that are verified to be native. */var nativeCreate=getNative(Object,"create");module.exports=nativeCreate},{"./_getNative":163}],202:[function(require,module,exports){var overArg=require("./_overArg"); +/* Built-in method references for those with the same name as other `lodash` methods. */var nativeKeys=overArg(Object.keys,Object);module.exports=nativeKeys},{"./_overArg":206}],203:[function(require,module,exports){ +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object){var result=[];if(object!=null){for(var key in Object(object)){result.push(key)}}return result}module.exports=nativeKeysIn},{}],204:[function(require,module,exports){var freeGlobal=require("./_freeGlobal"); +/** Detect free variable `exports`. */var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports; +/** Detect free variable `module`. */var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module; +/** Detect the popular CommonJS extension `module.exports`. */var moduleExports=freeModule&&freeModule.exports===freeExports; +/** Detect free variable `process` from Node.js. */var freeProcess=moduleExports&&freeGlobal.process; +/** Used to access faster Node.js helpers. */var nodeUtil=function(){try{ +// Use `util.types` for Node.js 10+. +var types=freeModule&&freeModule.require&&freeModule.require("util").types;if(types){return types} +// Legacy `process.binding('util')` for Node.js < 10. +return freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}();module.exports=nodeUtil},{"./_freeGlobal":158}],205:[function(require,module,exports){ +/** Used for built-in method references. */ +var objectProto=Object.prototype; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */var nativeObjectToString=objectProto.toString; +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */function objectToString(value){return nativeObjectToString.call(value)}module.exports=objectToString},{}],206:[function(require,module,exports){ +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func,transform){return function(arg){return func(transform(arg))}}module.exports=overArg},{}],207:[function(require,module,exports){var apply=require("./_apply"); +/* Built-in method references for those with the same name as other `lodash` methods. */var nativeMax=Math.max; +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */function overRest(func,start,transform){start=nativeMax(start===undefined?func.length-1:start,0);return function(){var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);while(++index0){if(++count>=HOT_COUNT){return arguments[0]}}else{count=0}return func.apply(undefined,arguments)}}module.exports=shortOut},{}],215:[function(require,module,exports){var ListCache=require("./_ListCache"); +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */function stackClear(){this.__data__=new ListCache;this.size=0}module.exports=stackClear},{"./_ListCache":53}],216:[function(require,module,exports){ +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key){var data=this.__data__,result=data["delete"](key);this.size=data.size;return result}module.exports=stackDelete},{}],217:[function(require,module,exports){ +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key){return this.__data__.get(key)}module.exports=stackGet},{}],218:[function(require,module,exports){ +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key){return this.__data__.has(key)}module.exports=stackHas},{}],219:[function(require,module,exports){var ListCache=require("./_ListCache"),Map=require("./_Map"),MapCache=require("./_MapCache"); +/** Used as the size to enable large array optimizations. */var LARGE_ARRAY_SIZE=200; +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */function stackSet(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map||pairs.length true + */function clone(value){return baseClone(value,CLONE_SYMBOLS_FLAG)}module.exports=clone},{"./_baseClone":80}],227:[function(require,module,exports){var baseClone=require("./_baseClone"); +/** Used to compose bitmasks for cloning. */var CLONE_DEEP_FLAG=1,CLONE_SYMBOLS_FLAG=4; +/** + * This method is like `_.clone` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @returns {*} Returns the deep cloned value. + * @see _.clone + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var deep = _.cloneDeep(objects); + * console.log(deep[0] === objects[0]); + * // => false + */function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}module.exports=cloneDeep},{"./_baseClone":80}],228:[function(require,module,exports){ +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value){return function(){return value}}module.exports=constant},{}],229:[function(require,module,exports){var baseRest=require("./_baseRest"),eq=require("./eq"),isIterateeCall=require("./_isIterateeCall"),keysIn=require("./keysIn"); +/** Used for built-in method references. */var objectProto=Object.prototype; +/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty; +/** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep + * @example + * + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */var defaults=baseRest(function(object,sources){object=Object(object);var index=-1;var length=sources.length;var guard=length>2?sources[2]:undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){length=1}while(++index true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value,other){return value===other||value!==value&&other!==other}module.exports=eq},{}],232:[function(require,module,exports){var arrayFilter=require("./_arrayFilter"),baseFilter=require("./_baseFilter"),baseIteratee=require("./_baseIteratee"),isArray=require("./isArray"); +/** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * **Note:** Unlike `_.remove`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.reject + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.filter(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, { 'age': 36, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.filter(users, 'active'); + * // => objects for ['barney'] + */function filter(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,baseIteratee(predicate,3))}module.exports=filter},{"./_arrayFilter":65,"./_baseFilter":84,"./_baseIteratee":105,"./isArray":243}],233:[function(require,module,exports){var createFind=require("./_createFind"),findIndex=require("./findIndex"); +/** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.find(users, function(o) { return o.age < 40; }); + * // => object for 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.find(users, { 'age': 1, 'active': true }); + * // => object for 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.find(users, ['active', false]); + * // => object for 'fred' + * + * // The `_.property` iteratee shorthand. + * _.find(users, 'active'); + * // => object for 'barney' + */var find=createFind(findIndex);module.exports=find},{"./_createFind":150,"./findIndex":234}],234:[function(require,module,exports){var baseFindIndex=require("./_baseFindIndex"),baseIteratee=require("./_baseIteratee"),toInteger=require("./toInteger"); +/* Built-in method references for those with the same name as other `lodash` methods. */var nativeMax=Math.max; +/** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */function findIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length){return-1}var index=fromIndex==null?0:toInteger(fromIndex);if(index<0){index=nativeMax(length+index,0)}return baseFindIndex(array,baseIteratee(predicate,3),index)}module.exports=findIndex},{"./_baseFindIndex":85,"./_baseIteratee":105,"./toInteger":280}],235:[function(require,module,exports){var baseFlatten=require("./_baseFlatten"); +/** + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */function flatten(array){var length=array==null?0:array.length;return length?baseFlatten(array,1):[]}module.exports=flatten},{"./_baseFlatten":86}],236:[function(require,module,exports){var arrayEach=require("./_arrayEach"),baseEach=require("./_baseEach"),castFunction=require("./_castFunction"),isArray=require("./isArray"); +/** + * Iterates over elements of `collection` and invokes `iteratee` for each element. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias each + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEachRight + * @example + * + * _.forEach([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `1` then `2`. + * + * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */function forEach(collection,iteratee){var func=isArray(collection)?arrayEach:baseEach;return func(collection,castFunction(iteratee))}module.exports=forEach},{"./_arrayEach":64,"./_baseEach":82,"./_castFunction":132,"./isArray":243}],237:[function(require,module,exports){var baseFor=require("./_baseFor"),castFunction=require("./_castFunction"),keysIn=require("./keysIn"); +/** + * Iterates over own and inherited enumerable string keyed properties of an + * object and invokes `iteratee` for each property. The iteratee is invoked + * with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forInRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forIn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). + */function forIn(object,iteratee){return object==null?object:baseFor(object,castFunction(iteratee),keysIn)}module.exports=forIn},{"./_baseFor":87,"./_castFunction":132,"./keysIn":260}],238:[function(require,module,exports){var baseGet=require("./_baseGet"); +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */function get(object,path,defaultValue){var result=object==null?undefined:baseGet(object,path);return result===undefined?defaultValue:result}module.exports=get},{"./_baseGet":89}],239:[function(require,module,exports){var baseHas=require("./_baseHas"),hasPath=require("./_hasPath"); +/** + * Checks if `path` is a direct property of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b'); + * // => true + * + * _.has(object, ['a', 'b']); + * // => true + * + * _.has(other, 'a'); + * // => false + */function has(object,path){return object!=null&&hasPath(object,path,baseHas)}module.exports=has},{"./_baseHas":93,"./_hasPath":170}],240:[function(require,module,exports){var baseHasIn=require("./_baseHasIn"),hasPath=require("./_hasPath"); +/** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */function hasIn(object,path){return object!=null&&hasPath(object,path,baseHasIn)}module.exports=hasIn},{"./_baseHasIn":94,"./_hasPath":170}],241:[function(require,module,exports){ +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value){return value}module.exports=identity},{}],242:[function(require,module,exports){var baseIsArguments=require("./_baseIsArguments"),isObjectLike=require("./isObjectLike"); +/** Used for built-in method references. */var objectProto=Object.prototype; +/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty; +/** Built-in value references. */var propertyIsEnumerable=objectProto.propertyIsEnumerable; +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */var isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")};module.exports=isArguments},{"./_baseIsArguments":96,"./isObjectLike":252}],243:[function(require,module,exports){ +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray=Array.isArray;module.exports=isArray},{}],244:[function(require,module,exports){var isFunction=require("./isFunction"),isLength=require("./isLength"); +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value)}module.exports=isArrayLike},{"./isFunction":248,"./isLength":249}],245:[function(require,module,exports){var isArrayLike=require("./isArrayLike"),isObjectLike=require("./isObjectLike"); +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}module.exports=isArrayLikeObject},{"./isArrayLike":244,"./isObjectLike":252}],246:[function(require,module,exports){var root=require("./_root"),stubFalse=require("./stubFalse"); +/** Detect free variable `exports`. */var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports; +/** Detect free variable `module`. */var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module; +/** Detect the popular CommonJS extension `module.exports`. */var moduleExports=freeModule&&freeModule.exports===freeExports; +/** Built-in value references. */var Buffer=moduleExports?root.Buffer:undefined; +/* Built-in method references for those with the same name as other `lodash` methods. */var nativeIsBuffer=Buffer?Buffer.isBuffer:undefined; +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */var isBuffer=nativeIsBuffer||stubFalse;module.exports=isBuffer},{"./_root":208,"./stubFalse":278}],247:[function(require,module,exports){var baseKeys=require("./_baseKeys"),getTag=require("./_getTag"),isArguments=require("./isArguments"),isArray=require("./isArray"),isArrayLike=require("./isArrayLike"),isBuffer=require("./isBuffer"),isPrototype=require("./_isPrototype"),isTypedArray=require("./isTypedArray"); +/** `Object#toString` result references. */var mapTag="[object Map]",setTag="[object Set]"; +/** Used for built-in method references. */var objectProto=Object.prototype; +/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty; +/** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */function isEmpty(value){if(value==null){return true}if(isArrayLike(value)&&(isArray(value)||typeof value=="string"||typeof value.splice=="function"||isBuffer(value)||isTypedArray(value)||isArguments(value))){return!value.length}var tag=getTag(value);if(tag==mapTag||tag==setTag){return!value.size}if(isPrototype(value)){return!baseKeys(value).length}for(var key in value){if(hasOwnProperty.call(value,key)){return false}}return true}module.exports=isEmpty},{"./_baseKeys":106,"./_getTag":168,"./_isPrototype":186,"./isArguments":242,"./isArray":243,"./isArrayLike":244,"./isBuffer":246,"./isTypedArray":257}],248:[function(require,module,exports){var baseGetTag=require("./_baseGetTag"),isObject=require("./isObject"); +/** `Object#toString` result references. */var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]"; +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */function isFunction(value){if(!isObject(value)){return false} +// The use of `Object#toString` avoids issues with the `typeof` operator +// in Safari 9 which returns 'object' for typed arrays and other constructors. +var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}module.exports=isFunction},{"./_baseGetTag":91,"./isObject":251}],249:[function(require,module,exports){ +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER=9007199254740991; +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}module.exports=isLength},{}],250:[function(require,module,exports){var baseIsMap=require("./_baseIsMap"),baseUnary=require("./_baseUnary"),nodeUtil=require("./_nodeUtil"); +/* Node.js helper references. */var nodeIsMap=nodeUtil&&nodeUtil.isMap; +/** + * Checks if `value` is classified as a `Map` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + * @example + * + * _.isMap(new Map); + * // => true + * + * _.isMap(new WeakMap); + * // => false + */var isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap;module.exports=isMap},{"./_baseIsMap":99,"./_baseUnary":127,"./_nodeUtil":204}],251:[function(require,module,exports){ +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}module.exports=isObject},{}],252:[function(require,module,exports){ +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value){return value!=null&&typeof value=="object"}module.exports=isObjectLike},{}],253:[function(require,module,exports){var baseGetTag=require("./_baseGetTag"),getPrototype=require("./_getPrototype"),isObjectLike=require("./isObjectLike"); +/** `Object#toString` result references. */var objectTag="[object Object]"; +/** Used for built-in method references. */var funcProto=Function.prototype,objectProto=Object.prototype; +/** Used to resolve the decompiled source of functions. */var funcToString=funcProto.toString; +/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty; +/** Used to infer the `Object` constructor. */var objectCtorString=funcToString.call(Object); +/** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag){return false}var proto=getPrototype(value);if(proto===null){return true}var Ctor=hasOwnProperty.call(proto,"constructor")&&proto.constructor;return typeof Ctor=="function"&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString}module.exports=isPlainObject},{"./_baseGetTag":91,"./_getPrototype":164,"./isObjectLike":252}],254:[function(require,module,exports){var baseIsSet=require("./_baseIsSet"),baseUnary=require("./_baseUnary"),nodeUtil=require("./_nodeUtil"); +/* Node.js helper references. */var nodeIsSet=nodeUtil&&nodeUtil.isSet; +/** + * Checks if `value` is classified as a `Set` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + * @example + * + * _.isSet(new Set); + * // => true + * + * _.isSet(new WeakSet); + * // => false + */var isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet;module.exports=isSet},{"./_baseIsSet":103,"./_baseUnary":127,"./_nodeUtil":204}],255:[function(require,module,exports){var baseGetTag=require("./_baseGetTag"),isArray=require("./isArray"),isObjectLike=require("./isObjectLike"); +/** `Object#toString` result references. */var stringTag="[object String]"; +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */function isString(value){return typeof value=="string"||!isArray(value)&&isObjectLike(value)&&baseGetTag(value)==stringTag}module.exports=isString},{"./_baseGetTag":91,"./isArray":243,"./isObjectLike":252}],256:[function(require,module,exports){var baseGetTag=require("./_baseGetTag"),isObjectLike=require("./isObjectLike"); +/** `Object#toString` result references. */var symbolTag="[object Symbol]"; +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&baseGetTag(value)==symbolTag}module.exports=isSymbol},{"./_baseGetTag":91,"./isObjectLike":252}],257:[function(require,module,exports){var baseIsTypedArray=require("./_baseIsTypedArray"),baseUnary=require("./_baseUnary"),nodeUtil=require("./_nodeUtil"); +/* Node.js helper references. */var nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray; +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;module.exports=isTypedArray},{"./_baseIsTypedArray":104,"./_baseUnary":127,"./_nodeUtil":204}],258:[function(require,module,exports){ +/** + * Checks if `value` is `undefined`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ +function isUndefined(value){return value===undefined}module.exports=isUndefined},{}],259:[function(require,module,exports){var arrayLikeKeys=require("./_arrayLikeKeys"),baseKeys=require("./_baseKeys"),isArrayLike=require("./isArrayLike"); +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}module.exports=keys},{"./_arrayLikeKeys":68,"./_baseKeys":106,"./isArrayLike":244}],260:[function(require,module,exports){var arrayLikeKeys=require("./_arrayLikeKeys"),baseKeysIn=require("./_baseKeysIn"),isArrayLike=require("./isArrayLike"); +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,true):baseKeysIn(object)}module.exports=keysIn},{"./_arrayLikeKeys":68,"./_baseKeysIn":107,"./isArrayLike":244}],261:[function(require,module,exports){ +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array){var length=array==null?0:array.length;return length?array[length-1]:undefined}module.exports=last},{}],262:[function(require,module,exports){var arrayMap=require("./_arrayMap"),baseIteratee=require("./_baseIteratee"),baseMap=require("./_baseMap"),isArray=require("./isArray"); +/** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */function map(collection,iteratee){var func=isArray(collection)?arrayMap:baseMap;return func(collection,baseIteratee(iteratee,3))}module.exports=map},{"./_arrayMap":69,"./_baseIteratee":105,"./_baseMap":109,"./isArray":243}],263:[function(require,module,exports){var baseAssignValue=require("./_baseAssignValue"),baseForOwn=require("./_baseForOwn"),baseIteratee=require("./_baseIteratee"); +/** + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapKeys + * @example + * + * var users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * + * _.mapValues(users, function(o) { return o.age; }); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + * + * // The `_.property` iteratee shorthand. + * _.mapValues(users, 'age'); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + */function mapValues(object,iteratee){var result={};iteratee=baseIteratee(iteratee,3);baseForOwn(object,function(value,key,object){baseAssignValue(result,key,iteratee(value,key,object))});return result}module.exports=mapValues},{"./_baseAssignValue":79,"./_baseForOwn":88,"./_baseIteratee":105}],264:[function(require,module,exports){var baseExtremum=require("./_baseExtremum"),baseGt=require("./_baseGt"),identity=require("./identity"); +/** + * Computes the maximum value of `array`. If `array` is empty or falsey, + * `undefined` is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {*} Returns the maximum value. + * @example + * + * _.max([4, 2, 8, 6]); + * // => 8 + * + * _.max([]); + * // => undefined + */function max(array){return array&&array.length?baseExtremum(array,identity,baseGt):undefined}module.exports=max},{"./_baseExtremum":83,"./_baseGt":92,"./identity":241}],265:[function(require,module,exports){var MapCache=require("./_MapCache"); +/** Error message constants. */var FUNC_ERROR_TEXT="Expected a function"; +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */function memoize(func,resolver){if(typeof func!="function"||resolver!=null&&typeof resolver!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key)}var result=func.apply(this,args);memoized.cache=cache.set(key,result)||cache;return result};memoized.cache=new(memoize.Cache||MapCache);return memoized} +// Expose `MapCache`. +memoize.Cache=MapCache;module.exports=memoize},{"./_MapCache":55}],266:[function(require,module,exports){var baseMerge=require("./_baseMerge"),createAssigner=require("./_createAssigner"); +/** + * This method is like `_.assign` except that it recursively merges own and + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively. Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * var object = { + * 'a': [{ 'b': 2 }, { 'd': 4 }] + * }; + * + * var other = { + * 'a': [{ 'c': 3 }, { 'e': 5 }] + * }; + * + * _.merge(object, other); + * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } + */var merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex)});module.exports=merge},{"./_baseMerge":112,"./_createAssigner":147}],267:[function(require,module,exports){var baseExtremum=require("./_baseExtremum"),baseLt=require("./_baseLt"),identity=require("./identity"); +/** + * Computes the minimum value of `array`. If `array` is empty or falsey, + * `undefined` is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {*} Returns the minimum value. + * @example + * + * _.min([4, 2, 8, 6]); + * // => 2 + * + * _.min([]); + * // => undefined + */function min(array){return array&&array.length?baseExtremum(array,identity,baseLt):undefined}module.exports=min},{"./_baseExtremum":83,"./_baseLt":108,"./identity":241}],268:[function(require,module,exports){var baseExtremum=require("./_baseExtremum"),baseIteratee=require("./_baseIteratee"),baseLt=require("./_baseLt"); +/** + * This method is like `_.min` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Math + * @param {Array} array The array to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {*} Returns the minimum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.minBy(objects, function(o) { return o.n; }); + * // => { 'n': 1 } + * + * // The `_.property` iteratee shorthand. + * _.minBy(objects, 'n'); + * // => { 'n': 1 } + */function minBy(array,iteratee){return array&&array.length?baseExtremum(array,baseIteratee(iteratee,2),baseLt):undefined}module.exports=minBy},{"./_baseExtremum":83,"./_baseIteratee":105,"./_baseLt":108}],269:[function(require,module,exports){ +/** + * This method returns `undefined`. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Util + * @example + * + * _.times(2, _.noop); + * // => [undefined, undefined] + */ +function noop(){ +// No operation performed. +}module.exports=noop},{}],270:[function(require,module,exports){var root=require("./_root"); +/** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */var now=function(){return root.Date.now()};module.exports=now},{"./_root":208}],271:[function(require,module,exports){var basePick=require("./_basePick"),flatRest=require("./_flatRest"); +/** + * Creates an object composed of the picked `object` properties. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */var pick=flatRest(function(object,paths){return object==null?{}:basePick(object,paths)});module.exports=pick},{"./_basePick":115,"./_flatRest":157}],272:[function(require,module,exports){var baseProperty=require("./_baseProperty"),basePropertyDeep=require("./_basePropertyDeep"),isKey=require("./_isKey"),toKey=require("./_toKey"); +/** + * Creates a function that returns the value at `path` of a given object. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + * @example + * + * var objects = [ + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } + * ]; + * + * _.map(objects, _.property('a.b')); + * // => [2, 1] + * + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); + * // => [1, 2] + */function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path)}module.exports=property},{"./_baseProperty":117,"./_basePropertyDeep":118,"./_isKey":183,"./_toKey":223}],273:[function(require,module,exports){var createRange=require("./_createRange"); +/** + * Creates an array of numbers (positive and/or negative) progressing from + * `start` up to, but not including, `end`. A step of `-1` is used if a negative + * `start` is specified without an `end` or `step`. If `end` is not specified, + * it's set to `start` with `start` then set to `0`. + * + * **Note:** JavaScript follows the IEEE-754 standard for resolving + * floating-point values which can produce unexpected results. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @param {number} [step=1] The value to increment or decrement by. + * @returns {Array} Returns the range of numbers. + * @see _.inRange, _.rangeRight + * @example + * + * _.range(4); + * // => [0, 1, 2, 3] + * + * _.range(-4); + * // => [0, -1, -2, -3] + * + * _.range(1, 5); + * // => [1, 2, 3, 4] + * + * _.range(0, 20, 5); + * // => [0, 5, 10, 15] + * + * _.range(0, -4, -1); + * // => [0, -1, -2, -3] + * + * _.range(1, 4, 0); + * // => [1, 1, 1] + * + * _.range(0); + * // => [] + */var range=createRange();module.exports=range},{"./_createRange":151}],274:[function(require,module,exports){var arrayReduce=require("./_arrayReduce"),baseEach=require("./_baseEach"),baseIteratee=require("./_baseIteratee"),baseReduce=require("./_baseReduce"),isArray=require("./isArray"); +/** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` thru `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not given, the first element of `collection` is used as the initial + * value. The iteratee is invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, + * and `sortBy` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduceRight + * @example + * + * _.reduce([1, 2], function(sum, n) { + * return sum + n; + * }, 0); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * return result; + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) + */function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,baseIteratee(iteratee,4),accumulator,initAccum,baseEach)}module.exports=reduce},{"./_arrayReduce":71,"./_baseEach":82,"./_baseIteratee":105,"./_baseReduce":120,"./isArray":243}],275:[function(require,module,exports){var baseKeys=require("./_baseKeys"),getTag=require("./_getTag"),isArrayLike=require("./isArrayLike"),isString=require("./isString"),stringSize=require("./_stringSize"); +/** `Object#toString` result references. */var mapTag="[object Map]",setTag="[object Set]"; +/** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable string keyed properties for objects. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the collection size. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */function size(collection){if(collection==null){return 0}if(isArrayLike(collection)){return isString(collection)?stringSize(collection):collection.length}var tag=getTag(collection);if(tag==mapTag||tag==setTag){return collection.size}return baseKeys(collection).length}module.exports=size},{"./_baseKeys":106,"./_getTag":168,"./_stringSize":221,"./isArrayLike":244,"./isString":255}],276:[function(require,module,exports){var baseFlatten=require("./_baseFlatten"),baseOrderBy=require("./_baseOrderBy"),baseRest=require("./_baseRest"),isIterateeCall=require("./_isIterateeCall"); +/** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection thru each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[])} [iteratees=[_.identity]] + * The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + */var sortBy=baseRest(function(collection,iteratees){if(collection==null){return[]}var length=iteratees.length;if(length>1&&isIterateeCall(collection,iteratees[0],iteratees[1])){iteratees=[]}else if(length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2])){iteratees=[iteratees[0]]}return baseOrderBy(collection,baseFlatten(iteratees,1),[])});module.exports=sortBy},{"./_baseFlatten":86,"./_baseOrderBy":114,"./_baseRest":121,"./_isIterateeCall":182}],277:[function(require,module,exports){ +/** + * This method returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ +function stubArray(){return[]}module.exports=stubArray},{}],278:[function(require,module,exports){ +/** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ +function stubFalse(){return false}module.exports=stubFalse},{}],279:[function(require,module,exports){var toNumber=require("./toNumber"); +/** Used as references for various `Number` constants. */var INFINITY=1/0,MAX_INTEGER=17976931348623157e292; +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */function toFinite(value){if(!value){return value===0?value:0}value=toNumber(value);if(value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}module.exports=toFinite},{"./toNumber":281}],280:[function(require,module,exports){var toFinite=require("./toFinite"); +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}module.exports=toInteger},{"./toFinite":279}],281:[function(require,module,exports){var isObject=require("./isObject"),isSymbol=require("./isSymbol"); +/** Used as references for various `Number` constants. */var NAN=0/0; +/** Used to match leading and trailing whitespace. */var reTrim=/^\s+|\s+$/g; +/** Used to detect bad signed hexadecimal string values. */var reIsBadHex=/^[-+]0x[0-9a-f]+$/i; +/** Used to detect binary string values. */var reIsBinary=/^0b[01]+$/i; +/** Used to detect octal string values. */var reIsOctal=/^0o[0-7]+$/i; +/** Built-in method references without a dependency on `root`. */var freeParseInt=parseInt; +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */function toNumber(value){if(typeof value=="number"){return value}if(isSymbol(value)){return NAN}if(isObject(value)){var other=typeof value.valueOf=="function"?value.valueOf():value;value=isObject(other)?other+"":other}if(typeof value!="string"){return value===0?value:+value}value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}module.exports=toNumber},{"./isObject":251,"./isSymbol":256}],282:[function(require,module,exports){var copyObject=require("./_copyObject"),keysIn=require("./keysIn"); +/** + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */function toPlainObject(value){return copyObject(value,keysIn(value))}module.exports=toPlainObject},{"./_copyObject":143,"./keysIn":260}],283:[function(require,module,exports){var baseToString=require("./_baseToString"); +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */function toString(value){return value==null?"":baseToString(value)}module.exports=toString},{"./_baseToString":126}],284:[function(require,module,exports){var arrayEach=require("./_arrayEach"),baseCreate=require("./_baseCreate"),baseForOwn=require("./_baseForOwn"),baseIteratee=require("./_baseIteratee"),getPrototype=require("./_getPrototype"),isArray=require("./isArray"),isBuffer=require("./isBuffer"),isFunction=require("./isFunction"),isObject=require("./isObject"),isTypedArray=require("./isTypedArray"); +/** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }, []); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */function transform(object,iteratee,accumulator){var isArr=isArray(object),isArrLike=isArr||isBuffer(object)||isTypedArray(object);iteratee=baseIteratee(iteratee,4);if(accumulator==null){var Ctor=object&&object.constructor;if(isArrLike){accumulator=isArr?new Ctor:[]}else if(isObject(object)){accumulator=isFunction(Ctor)?baseCreate(getPrototype(object)):{}}else{accumulator={}}}(isArrLike?arrayEach:baseForOwn)(object,function(value,index,object){return iteratee(accumulator,value,index,object)});return accumulator}module.exports=transform},{"./_arrayEach":64,"./_baseCreate":81,"./_baseForOwn":88,"./_baseIteratee":105,"./_getPrototype":164,"./isArray":243,"./isBuffer":246,"./isFunction":248,"./isObject":251,"./isTypedArray":257}],285:[function(require,module,exports){var baseFlatten=require("./_baseFlatten"),baseRest=require("./_baseRest"),baseUniq=require("./_baseUniq"),isArrayLikeObject=require("./isArrayLikeObject"); +/** + * Creates an array of unique values, in order, from all given arrays using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([2], [1, 2]); + * // => [2, 1] + */var union=baseRest(function(arrays){return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true))});module.exports=union},{"./_baseFlatten":86,"./_baseRest":121,"./_baseUniq":128,"./isArrayLikeObject":245}],286:[function(require,module,exports){var toString=require("./toString"); +/** Used to generate unique IDs. */var idCounter=0; +/** + * Generates a unique ID. If `prefix` is given, the ID is appended to it. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {string} [prefix=''] The value to prefix the ID with. + * @returns {string} Returns the unique ID. + * @example + * + * _.uniqueId('contact_'); + * // => 'contact_104' + * + * _.uniqueId(); + * // => '105' + */function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id}module.exports=uniqueId},{"./toString":283}],287:[function(require,module,exports){var baseValues=require("./_baseValues"),keys=require("./keys"); +/** + * Creates an array of the own enumerable string keyed property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */function values(object){return object==null?[]:baseValues(object,keys(object))}module.exports=values},{"./_baseValues":129,"./keys":259}],288:[function(require,module,exports){var assignValue=require("./_assignValue"),baseZipObject=require("./_baseZipObject"); +/** + * This method is like `_.fromPairs` except that it accepts two arrays, + * one of property identifiers and one of corresponding values. + * + * @static + * @memberOf _ + * @since 0.4.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject(['a', 'b'], [1, 2]); + * // => { 'a': 1, 'b': 2 } + */function zipObject(props,values){return baseZipObject(props||[],values||[],assignValue)}module.exports=zipObject},{"./_assignValue":75,"./_baseZipObject":130}]},{},[1])(1)});