Socket
Socket
Sign inDemoInstall

vega-force

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-force - npm Package Compare versions

Comparing version 4.1.1 to 4.2.0

3

build/vega-force.js

@@ -1238,3 +1238,4 @@ (function (global, factory) {

'type': 'number',
'default': -30
'default': -30,
'expr': true
}, {

@@ -1241,0 +1242,0 @@ 'name': 'theta',

@@ -1,2 +0,2 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-dataflow"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util"],n):n(((t="undefined"!=typeof globalThis?globalThis:t||self).vega=t.vega||{},t.vega.transforms={}),t.vega,t.vega)}(this,(function(t,n,e){"use strict";function r(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,f,l,s,h,c,y=t._root,p={data:r},d=t._x0,v=t._y0,x=t._x1,g=t._y1;if(!y)return t._root=p,t;for(;y.length;)if((l=n>=(o=(d+x)/2))?d=o:x=o,(s=e>=(a=(v+g)/2))?v=a:g=a,i=y,!(y=y[h=s<<1|l]))return i[h]=p,t;if(u=+t._x.call(null,y.data),f=+t._y.call(null,y.data),n===u&&e===f)return p.next=y,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(l=n>=(o=(d+x)/2))?d=o:x=o,(s=e>=(a=(v+g)/2))?v=a:g=a}while((h=s<<1|l)==(c=(f>=a)<<1|u>=o));return i[c]=y,i[h]=p,t}function i(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function o(t){return t[0]}function a(t){return t[1]}function u(t,n,e){var r=new f(null==n?o:n,null==e?a:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function f(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function l(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var s=u.prototype=f.prototype;function h(t){return function(){return t}}function c(t){return 1e-6*(t()-.5)}function y(t){return t.x+t.vx}function p(t){return t.y+t.vy}function d(t){return t.index}function v(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}s.copy=function(){var t,n,e=new f(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=l(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=l(n));return e},s.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return r(this.cover(n,e),n,e,t)},s.addAll=function(t){var n,e,i,o,a=t.length,u=new Array(a),f=new Array(a),l=1/0,s=1/0,h=-1/0,c=-1/0;for(e=0;e<a;++e)isNaN(i=+this._x.call(null,n=t[e]))||isNaN(o=+this._y.call(null,n))||(u[e]=i,f[e]=o,i<l&&(l=i),i>h&&(h=i),o<s&&(s=o),o>c&&(c=o));if(l>h||s>c)return this;for(this.cover(l,s).cover(h,c),e=0;e<a;++e)r(this,u[e],f[e],t[e]);return this},s.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var a,u,f=i-e||1,l=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(a=new Array(4))[u]=l,l=a,f*=2,u){case 0:i=e+f,o=r+f;break;case 1:e=i-f,o=r+f;break;case 2:i=e+f,r=o-f;break;case 3:e=i-f,r=o-f}this._root&&this._root.length&&(this._root=l)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},s.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},s.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},s.find=function(t,n,e){var r,o,a,u,f,l,s,h=this._x0,c=this._y0,y=this._x1,p=this._y1,d=[],v=this._root;for(v&&d.push(new i(v,h,c,y,p)),null==e?e=1/0:(h=t-e,c=n-e,y=t+e,p=n+e,e*=e);l=d.pop();)if(!(!(v=l.node)||(o=l.x0)>y||(a=l.y0)>p||(u=l.x1)<h||(f=l.y1)<c))if(v.length){var x=(o+u)/2,g=(a+f)/2;d.push(new i(v[3],x,g,u,f),new i(v[2],o,g,x,f),new i(v[1],x,a,u,g),new i(v[0],o,a,x,g)),(s=(n>=g)<<1|t>=x)&&(l=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=l)}else{var _=t-+this._x.call(null,v.data),m=n-+this._y.call(null,v.data),w=_*_+m*m;if(w<e){var b=Math.sqrt(e=w);h=t-b,c=n-b,y=t+b,p=n+b,r=v.data}}return r},s.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,f,l,s,h,c,y=this._root,p=this._x0,d=this._y0,v=this._x1,x=this._y1;if(!y)return this;if(y.length)for(;;){if((l=o>=(u=(p+v)/2))?p=u:v=u,(s=a>=(f=(d+x)/2))?d=f:x=f,n=y,!(y=y[h=s<<1|l]))return this;if(!y.length)break;(n[h+1&3]||n[h+2&3]||n[h+3&3])&&(e=n,c=h)}for(;y.data!==t;)if(r=y,!(y=y.next))return this;return(i=y.next)&&delete y.next,r?(i?r.next=i:delete r.next,this):n?(i?n[h]=i:delete n[h],(y=n[0]||n[1]||n[2]||n[3])&&y===(n[3]||n[2]||n[1]||n[0])&&!y.length&&(e?e[c]=y:this._root=y),this):(this._root=i,this)},s.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},s.root=function(){return this._root},s.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},s.visit=function(t){var n,e,r,o,a,u,f=[],l=this._root;for(l&&f.push(new i(l,this._x0,this._y0,this._x1,this._y1));n=f.pop();)if(!t(l=n.node,r=n.x0,o=n.y0,a=n.x1,u=n.y1)&&l.length){var s=(r+a)/2,h=(o+u)/2;(e=l[3])&&f.push(new i(e,s,h,a,u)),(e=l[2])&&f.push(new i(e,r,h,s,u)),(e=l[1])&&f.push(new i(e,s,o,a,h)),(e=l[0])&&f.push(new i(e,r,o,s,h))}return this},s.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new i(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var o=n.node;if(o.length){var a,u=n.x0,f=n.y0,l=n.x1,s=n.y1,h=(u+l)/2,c=(f+s)/2;(a=o[0])&&e.push(new i(a,u,f,h,c)),(a=o[1])&&e.push(new i(a,h,f,l,c)),(a=o[2])&&e.push(new i(a,u,c,h,s)),(a=o[3])&&e.push(new i(a,h,c,l,s))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},s.x=function(t){return arguments.length?(this._x=t,this):this._x},s.y=function(t){return arguments.length?(this._y=t,this):this._y};var x={value:()=>{}};function g(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new _(r)}function _(t){this._=t}function m(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function w(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=x,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}_.prototype=g.prototype={constructor:_,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=w(i[e],t.name,n);else if(null==n)for(e in i)i[e]=w(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=m(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new _(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var b,N,M=0,k=0,A=0,q=1e3,E=0,T=0,z=0,D="object"==typeof performance&&performance.now?performance:Date,F="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function O(){return T||(F(P),T=D.now()+z)}function P(){T=0}function j(){this._call=this._time=this._next=null}function I(t,n,e){var r=new j;return r.restart(t,n,e),r}function S(){T=(E=D.now())+z,M=k=0;try{!function(){O(),++M;for(var t,n=b;n;)(t=T-n._time)>=0&&n._call.call(void 0,t),n=n._next;--M}()}finally{M=0,function(){var t,n,e=b,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:b=n);N=t,U(r)}(),T=0}}function R(){var t=D.now(),n=t-E;n>q&&(z-=n,E=t)}function U(t){M||(k&&(k=clearTimeout(k)),t-T>24?(t<1/0&&(k=setTimeout(S,t-D.now()-z)),A&&(A=clearInterval(A))):(A||(E=D.now(),A=setInterval(R,q)),M=1,F(S)))}j.prototype=I.prototype={constructor:j,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?O():+e)+(null==n?0:+n),this._next||N===this||(N?N._next=this:b=this,N=this),this._call=t,this._time=e,U()},stop:function(){this._call&&(this._call=null,this._time=1/0,U())}};const B=1664525,C=1013904223,G=4294967296;function H(t){return t.x}function J(t){return t.y}var K=10,L=Math.PI*(3-Math.sqrt(5));function Q(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,f=I(h),l=g("tick","end"),s=function(){let t=1;return()=>(t=(B*t+C)%G)/G}();function h(){c(),l.call("tick",n),e<r&&(f.stop(),l.call("end",n))}function c(r){var f,l,s=t.length;void 0===r&&(r=1);for(var h=0;h<r;++h)for(e+=(o-e)*i,u.forEach((function(t){t(e)})),f=0;f<s;++f)null==(l=t[f]).fx?l.x+=l.vx*=a:(l.x=l.fx,l.vx=0),null==l.fy?l.y+=l.vy*=a:(l.y=l.fy,l.vy=0);return n}function y(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=K*Math.sqrt(.5+e),o=e*L;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function p(n){return n.initialize&&n.initialize(t,s),n}return null==t&&(t=[]),y(),n={tick:c,restart:function(){return f.restart(h),n},stop:function(){return f.stop(),n},nodes:function(e){return arguments.length?(t=e,y(),u.forEach(p),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},randomSource:function(t){return arguments.length?(s=t,u.forEach(p),n):s},force:function(t,e){return arguments.length>1?(null==e?u.delete(t):u.set(t,p(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,f,l=0,s=t.length;for(null==r?r=1/0:r*=r,l=0;l<s;++l)(a=(i=n-(u=t[l]).x)*i+(o=e-u.y)*o)<r&&(f=u,r=a);return f},on:function(t,e){return arguments.length>1?(l.on(t,e),n):l.on(t)}}}const V={center:function(t,n){var e,r=1;function i(){var i,o,a=e.length,u=0,f=0;for(i=0;i<a;++i)u+=(o=e[i]).x,f+=o.y;for(u=(u/a-t)*r,f=(f/a-n)*r,i=0;i<a;++i)(o=e[i]).x-=u,o.y-=f}return null==t&&(t=0),null==n&&(n=0),i.initialize=function(t){e=t},i.x=function(n){return arguments.length?(t=+n,i):t},i.y=function(t){return arguments.length?(n=+t,i):n},i.strength=function(t){return arguments.length?(r=+t,i):r},i},collide:function(t){var n,e,r,i=1,o=1;function a(){for(var t,a,l,s,h,d,v,x=n.length,g=0;g<o;++g)for(a=u(n,y,p).visitAfter(f),t=0;t<x;++t)l=n[t],d=e[l.index],v=d*d,s=l.x+l.vx,h=l.y+l.vy,a.visit(_);function _(t,n,e,o,a){var u=t.data,f=t.r,y=d+f;if(!u)return n>s+y||o<s-y||e>h+y||a<h-y;if(u.index>l.index){var p=s-u.x-u.vx,x=h-u.y-u.vy,g=p*p+x*x;g<y*y&&(0===p&&(g+=(p=c(r))*p),0===x&&(g+=(x=c(r))*x),g=(y-(g=Math.sqrt(g)))/g*i,l.vx+=(p*=g)*(y=(f*=f)/(v+f)),l.vy+=(x*=g)*y,u.vx-=p*(y=1-y),u.vy-=x*y)}}}function f(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function l(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)i=n[r],e[i.index]=+t(i,r,n)}}return"function"!=typeof t&&(t=h(null==t?1:+t)),a.initialize=function(t,e){n=t,r=e,l()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),l(),a):t},a},nbody:function(){var t,n,e,r,i,o=h(-30),a=1,f=1/0,l=.81;function s(e){var i,o=t.length,a=u(t,H,J).visitAfter(p);for(r=e,i=0;i<o;++i)n=t[i],a.visit(d)}function y(){if(t){var n,e,r=t.length;for(i=new Array(r),n=0;n<r;++n)e=t[n],i[e.index]=+o(e,n,t)}}function p(t){var n,e,r,o,a,u=0,f=0;if(t.length){for(r=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,f+=e,r+=e*n.x,o+=e*n.y);t.x=r/f,t.y=o/f}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=i[n.data.index]}while(n=n.next)}t.value=u}function d(t,o,u,s){if(!t.value)return!0;var h=t.x-n.x,y=t.y-n.y,p=s-o,d=h*h+y*y;if(p*p/l<d)return d<f&&(0===h&&(d+=(h=c(e))*h),0===y&&(d+=(y=c(e))*y),d<a&&(d=Math.sqrt(a*d)),n.vx+=h*t.value*r/d,n.vy+=y*t.value*r/d),!0;if(!(t.length||d>=f)){(t.data!==n||t.next)&&(0===h&&(d+=(h=c(e))*h),0===y&&(d+=(y=c(e))*y),d<a&&(d=Math.sqrt(a*d)));do{t.data!==n&&(p=i[t.data.index]*r/d,n.vx+=h*p,n.vy+=y*p)}while(t=t.next)}}return s.initialize=function(n,r){t=n,e=r,y()},s.strength=function(t){return arguments.length?(o="function"==typeof t?t:h(+t),y(),s):o},s.distanceMin=function(t){return arguments.length?(a=t*t,s):Math.sqrt(a)},s.distanceMax=function(t){return arguments.length?(f=t*t,s):Math.sqrt(f)},s.theta=function(t){return arguments.length?(l=t*t,s):Math.sqrt(l)},s},link:function(t){var n,e,r,i,o,a,u=d,f=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},l=h(30),s=1;function y(r){for(var i=0,u=t.length;i<s;++i)for(var f,l,h,y,p,d,v,x=0;x<u;++x)l=(f=t[x]).source,y=(h=f.target).x+h.vx-l.x-l.vx||c(a),p=h.y+h.vy-l.y-l.vy||c(a),y*=d=((d=Math.sqrt(y*y+p*p))-e[x])/d*r*n[x],p*=d,h.vx-=y*(v=o[x]),h.vy-=p*v,l.vx+=y*(v=1-v),l.vy+=p*v}function p(){if(r){var a,f,l=r.length,s=t.length,h=new Map(r.map(((t,n)=>[u(t,n,r),t])));for(a=0,i=new Array(l);a<s;++a)(f=t[a]).index=a,"object"!=typeof f.source&&(f.source=v(h,f.source)),"object"!=typeof f.target&&(f.target=v(h,f.target)),i[f.source.index]=(i[f.source.index]||0)+1,i[f.target.index]=(i[f.target.index]||0)+1;for(a=0,o=new Array(s);a<s;++a)f=t[a],o[a]=i[f.source.index]/(i[f.source.index]+i[f.target.index]);n=new Array(s),x(),e=new Array(s),g()}}function x(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+f(t[e],e,t)}function g(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+l(t[n],n,t)}return null==t&&(t=[]),y.initialize=function(t,n){r=t,a=n,p()},y.links=function(n){return arguments.length?(t=n,p(),y):t},y.id=function(t){return arguments.length?(u=t,y):u},y.iterations=function(t){return arguments.length?(s=+t,y):s},y.strength=function(t){return arguments.length?(f="function"==typeof t?t:h(+t),x(),y):f},y.distance=function(t){return arguments.length?(l="function"==typeof t?t:h(+t),g(),y):l},y},x:function(t){var n,e,r,i=h(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=h(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:h(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),a(),o):t},o},y:function(t){var n,e,r,i=h(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=h(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:h(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),a(),o):t},o}},W="forces",X=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],Y=["static","iterations"],Z=["x","y","vx","vy"];function $(t){n.Transform.call(this,null,t)}function tt(t,n,r,i){var o,a,u,f,l=e.array(n.forces);for(o=0,a=X.length;o<a;++o)(u=X[o])!==W&&n.modified(u)&&t[u](n[u]);for(o=0,a=l.length;o<a;++o)f=W+o,(u=r||n.modified(W,o)?et(l[o]):i&&nt(l[o],i)?t.force(f):null)&&t.force(f,u);for(a=t.numForces||0;o<a;++o)t.force(W+o,null);return t.numForces=l.length,t}function nt(t,n){var r,i;for(r in t)if(e.isFunction(i=t[r])&&n.modified(e.accessorFields(i)))return 1;return 0}function et(t){var n,r;for(r in e.hasOwnProperty(V,t.force)||e.error("Unrecognized force: "+t.force),n=V[t.force](),t)e.isFunction(n[r])&&rt(n[r],t[r],t);return n}function rt(t,n,r){t(e.isFunction(n)?t=>n(t,r):n)}$.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:Z}]},e.inherits($,n.Transform,{transform(t,n){var e,r,i=this.value,o=n.changed(n.ADD_REM),a=t.modified(X),u=t.iterations||300;if(i?(o&&(n.modifies("index"),i.nodes(n.source)),(a||n.changed(n.MOD))&&tt(i,t,0,n)):(this.value=i=function(t,n){const e=Q(t),r=e.stop,i=e.restart;let o=!1;return e.stopped=()=>o,e.restart=()=>(o=!1,i()),e.stop=()=>(o=!0,r()),tt(e,n,!0).on("end",(()=>o=!0))}(n.source,t),i.on("tick",(e=n.dataflow,r=this,()=>e.touch(r).run())),t.static||(o=!0,i.tick()),n.modifies("index")),a||o||t.modified(Y)||n.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return n.StopPropagation;return this.finish(t,n)},finish(t,n){const e=n.dataflow;for(let t,n=this._argops,u=0,f=n.length;u<f;++u)if(t=n[u],t.name===W&&"link"===t.op._argval.force)for(var r,i=t.op._argops,o=0,a=i.length;o<a;++o)if("links"===i[o].name&&(r=i[o].op.source)){e.pulse(r,e.changeset().reflow());break}return n.reflow(t.modified()).modifies(Z)}}),t.force=$}));
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-dataflow"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util"],n):n(((t="undefined"!=typeof globalThis?globalThis:t||self).vega=t.vega||{},t.vega.transforms={}),t.vega,t.vega)}(this,(function(t,n,e){"use strict";function r(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,f,l,s,h,c,y=t._root,p={data:r},d=t._x0,v=t._y0,x=t._x1,g=t._y1;if(!y)return t._root=p,t;for(;y.length;)if((l=n>=(o=(d+x)/2))?d=o:x=o,(s=e>=(a=(v+g)/2))?v=a:g=a,i=y,!(y=y[h=s<<1|l]))return i[h]=p,t;if(u=+t._x.call(null,y.data),f=+t._y.call(null,y.data),n===u&&e===f)return p.next=y,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(l=n>=(o=(d+x)/2))?d=o:x=o,(s=e>=(a=(v+g)/2))?v=a:g=a}while((h=s<<1|l)==(c=(f>=a)<<1|u>=o));return i[c]=y,i[h]=p,t}function i(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function o(t){return t[0]}function a(t){return t[1]}function u(t,n,e){var r=new f(null==n?o:n,null==e?a:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function f(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function l(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var s=u.prototype=f.prototype;function h(t){return function(){return t}}function c(t){return 1e-6*(t()-.5)}function y(t){return t.x+t.vx}function p(t){return t.y+t.vy}function d(t){return t.index}function v(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}s.copy=function(){var t,n,e=new f(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=l(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=l(n));return e},s.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return r(this.cover(n,e),n,e,t)},s.addAll=function(t){var n,e,i,o,a=t.length,u=new Array(a),f=new Array(a),l=1/0,s=1/0,h=-1/0,c=-1/0;for(e=0;e<a;++e)isNaN(i=+this._x.call(null,n=t[e]))||isNaN(o=+this._y.call(null,n))||(u[e]=i,f[e]=o,i<l&&(l=i),i>h&&(h=i),o<s&&(s=o),o>c&&(c=o));if(l>h||s>c)return this;for(this.cover(l,s).cover(h,c),e=0;e<a;++e)r(this,u[e],f[e],t[e]);return this},s.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var a,u,f=i-e||1,l=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(a=new Array(4))[u]=l,l=a,f*=2,u){case 0:i=e+f,o=r+f;break;case 1:e=i-f,o=r+f;break;case 2:i=e+f,r=o-f;break;case 3:e=i-f,r=o-f}this._root&&this._root.length&&(this._root=l)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},s.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},s.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},s.find=function(t,n,e){var r,o,a,u,f,l,s,h=this._x0,c=this._y0,y=this._x1,p=this._y1,d=[],v=this._root;for(v&&d.push(new i(v,h,c,y,p)),null==e?e=1/0:(h=t-e,c=n-e,y=t+e,p=n+e,e*=e);l=d.pop();)if(!(!(v=l.node)||(o=l.x0)>y||(a=l.y0)>p||(u=l.x1)<h||(f=l.y1)<c))if(v.length){var x=(o+u)/2,g=(a+f)/2;d.push(new i(v[3],x,g,u,f),new i(v[2],o,g,x,f),new i(v[1],x,a,u,g),new i(v[0],o,a,x,g)),(s=(n>=g)<<1|t>=x)&&(l=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=l)}else{var _=t-+this._x.call(null,v.data),m=n-+this._y.call(null,v.data),w=_*_+m*m;if(w<e){var b=Math.sqrt(e=w);h=t-b,c=n-b,y=t+b,p=n+b,r=v.data}}return r},s.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,f,l,s,h,c,y=this._root,p=this._x0,d=this._y0,v=this._x1,x=this._y1;if(!y)return this;if(y.length)for(;;){if((l=o>=(u=(p+v)/2))?p=u:v=u,(s=a>=(f=(d+x)/2))?d=f:x=f,n=y,!(y=y[h=s<<1|l]))return this;if(!y.length)break;(n[h+1&3]||n[h+2&3]||n[h+3&3])&&(e=n,c=h)}for(;y.data!==t;)if(r=y,!(y=y.next))return this;return(i=y.next)&&delete y.next,r?(i?r.next=i:delete r.next,this):n?(i?n[h]=i:delete n[h],(y=n[0]||n[1]||n[2]||n[3])&&y===(n[3]||n[2]||n[1]||n[0])&&!y.length&&(e?e[c]=y:this._root=y),this):(this._root=i,this)},s.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},s.root=function(){return this._root},s.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},s.visit=function(t){var n,e,r,o,a,u,f=[],l=this._root;for(l&&f.push(new i(l,this._x0,this._y0,this._x1,this._y1));n=f.pop();)if(!t(l=n.node,r=n.x0,o=n.y0,a=n.x1,u=n.y1)&&l.length){var s=(r+a)/2,h=(o+u)/2;(e=l[3])&&f.push(new i(e,s,h,a,u)),(e=l[2])&&f.push(new i(e,r,h,s,u)),(e=l[1])&&f.push(new i(e,s,o,a,h)),(e=l[0])&&f.push(new i(e,r,o,s,h))}return this},s.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new i(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var o=n.node;if(o.length){var a,u=n.x0,f=n.y0,l=n.x1,s=n.y1,h=(u+l)/2,c=(f+s)/2;(a=o[0])&&e.push(new i(a,u,f,h,c)),(a=o[1])&&e.push(new i(a,h,f,l,c)),(a=o[2])&&e.push(new i(a,u,c,h,s)),(a=o[3])&&e.push(new i(a,h,c,l,s))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},s.x=function(t){return arguments.length?(this._x=t,this):this._x},s.y=function(t){return arguments.length?(this._y=t,this):this._y};var x={value:()=>{}};function g(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new _(r)}function _(t){this._=t}function m(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function w(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=x,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}_.prototype=g.prototype={constructor:_,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=w(i[e],t.name,n);else if(null==n)for(e in i)i[e]=w(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=m(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new _(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var b,N,M=0,k=0,A=0,q=1e3,E=0,T=0,z=0,D="object"==typeof performance&&performance.now?performance:Date,F="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function O(){return T||(F(P),T=D.now()+z)}function P(){T=0}function j(){this._call=this._time=this._next=null}function I(t,n,e){var r=new j;return r.restart(t,n,e),r}function S(){T=(E=D.now())+z,M=k=0;try{!function(){O(),++M;for(var t,n=b;n;)(t=T-n._time)>=0&&n._call.call(void 0,t),n=n._next;--M}()}finally{M=0,function(){var t,n,e=b,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:b=n);N=t,U(r)}(),T=0}}function R(){var t=D.now(),n=t-E;n>q&&(z-=n,E=t)}function U(t){M||(k&&(k=clearTimeout(k)),t-T>24?(t<1/0&&(k=setTimeout(S,t-D.now()-z)),A&&(A=clearInterval(A))):(A||(E=D.now(),A=setInterval(R,q)),M=1,F(S)))}j.prototype=I.prototype={constructor:j,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?O():+e)+(null==n?0:+n),this._next||N===this||(N?N._next=this:b=this,N=this),this._call=t,this._time=e,U()},stop:function(){this._call&&(this._call=null,this._time=1/0,U())}};const B=1664525,C=1013904223,G=4294967296;function H(t){return t.x}function J(t){return t.y}var K=10,L=Math.PI*(3-Math.sqrt(5));function Q(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,f=I(h),l=g("tick","end"),s=function(){let t=1;return()=>(t=(B*t+C)%G)/G}();function h(){c(),l.call("tick",n),e<r&&(f.stop(),l.call("end",n))}function c(r){var f,l,s=t.length;void 0===r&&(r=1);for(var h=0;h<r;++h)for(e+=(o-e)*i,u.forEach((function(t){t(e)})),f=0;f<s;++f)null==(l=t[f]).fx?l.x+=l.vx*=a:(l.x=l.fx,l.vx=0),null==l.fy?l.y+=l.vy*=a:(l.y=l.fy,l.vy=0);return n}function y(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=K*Math.sqrt(.5+e),o=e*L;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function p(n){return n.initialize&&n.initialize(t,s),n}return null==t&&(t=[]),y(),n={tick:c,restart:function(){return f.restart(h),n},stop:function(){return f.stop(),n},nodes:function(e){return arguments.length?(t=e,y(),u.forEach(p),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},randomSource:function(t){return arguments.length?(s=t,u.forEach(p),n):s},force:function(t,e){return arguments.length>1?(null==e?u.delete(t):u.set(t,p(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,f,l=0,s=t.length;for(null==r?r=1/0:r*=r,l=0;l<s;++l)(a=(i=n-(u=t[l]).x)*i+(o=e-u.y)*o)<r&&(f=u,r=a);return f},on:function(t,e){return arguments.length>1?(l.on(t,e),n):l.on(t)}}}const V={center:function(t,n){var e,r=1;function i(){var i,o,a=e.length,u=0,f=0;for(i=0;i<a;++i)u+=(o=e[i]).x,f+=o.y;for(u=(u/a-t)*r,f=(f/a-n)*r,i=0;i<a;++i)(o=e[i]).x-=u,o.y-=f}return null==t&&(t=0),null==n&&(n=0),i.initialize=function(t){e=t},i.x=function(n){return arguments.length?(t=+n,i):t},i.y=function(t){return arguments.length?(n=+t,i):n},i.strength=function(t){return arguments.length?(r=+t,i):r},i},collide:function(t){var n,e,r,i=1,o=1;function a(){for(var t,a,l,s,h,d,v,x=n.length,g=0;g<o;++g)for(a=u(n,y,p).visitAfter(f),t=0;t<x;++t)l=n[t],d=e[l.index],v=d*d,s=l.x+l.vx,h=l.y+l.vy,a.visit(_);function _(t,n,e,o,a){var u=t.data,f=t.r,y=d+f;if(!u)return n>s+y||o<s-y||e>h+y||a<h-y;if(u.index>l.index){var p=s-u.x-u.vx,x=h-u.y-u.vy,g=p*p+x*x;g<y*y&&(0===p&&(g+=(p=c(r))*p),0===x&&(g+=(x=c(r))*x),g=(y-(g=Math.sqrt(g)))/g*i,l.vx+=(p*=g)*(y=(f*=f)/(v+f)),l.vy+=(x*=g)*y,u.vx-=p*(y=1-y),u.vy-=x*y)}}}function f(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function l(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)i=n[r],e[i.index]=+t(i,r,n)}}return"function"!=typeof t&&(t=h(null==t?1:+t)),a.initialize=function(t,e){n=t,r=e,l()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),l(),a):t},a},nbody:function(){var t,n,e,r,i,o=h(-30),a=1,f=1/0,l=.81;function s(e){var i,o=t.length,a=u(t,H,J).visitAfter(p);for(r=e,i=0;i<o;++i)n=t[i],a.visit(d)}function y(){if(t){var n,e,r=t.length;for(i=new Array(r),n=0;n<r;++n)e=t[n],i[e.index]=+o(e,n,t)}}function p(t){var n,e,r,o,a,u=0,f=0;if(t.length){for(r=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,f+=e,r+=e*n.x,o+=e*n.y);t.x=r/f,t.y=o/f}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=i[n.data.index]}while(n=n.next)}t.value=u}function d(t,o,u,s){if(!t.value)return!0;var h=t.x-n.x,y=t.y-n.y,p=s-o,d=h*h+y*y;if(p*p/l<d)return d<f&&(0===h&&(d+=(h=c(e))*h),0===y&&(d+=(y=c(e))*y),d<a&&(d=Math.sqrt(a*d)),n.vx+=h*t.value*r/d,n.vy+=y*t.value*r/d),!0;if(!(t.length||d>=f)){(t.data!==n||t.next)&&(0===h&&(d+=(h=c(e))*h),0===y&&(d+=(y=c(e))*y),d<a&&(d=Math.sqrt(a*d)));do{t.data!==n&&(p=i[t.data.index]*r/d,n.vx+=h*p,n.vy+=y*p)}while(t=t.next)}}return s.initialize=function(n,r){t=n,e=r,y()},s.strength=function(t){return arguments.length?(o="function"==typeof t?t:h(+t),y(),s):o},s.distanceMin=function(t){return arguments.length?(a=t*t,s):Math.sqrt(a)},s.distanceMax=function(t){return arguments.length?(f=t*t,s):Math.sqrt(f)},s.theta=function(t){return arguments.length?(l=t*t,s):Math.sqrt(l)},s},link:function(t){var n,e,r,i,o,a,u=d,f=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},l=h(30),s=1;function y(r){for(var i=0,u=t.length;i<s;++i)for(var f,l,h,y,p,d,v,x=0;x<u;++x)l=(f=t[x]).source,y=(h=f.target).x+h.vx-l.x-l.vx||c(a),p=h.y+h.vy-l.y-l.vy||c(a),y*=d=((d=Math.sqrt(y*y+p*p))-e[x])/d*r*n[x],p*=d,h.vx-=y*(v=o[x]),h.vy-=p*v,l.vx+=y*(v=1-v),l.vy+=p*v}function p(){if(r){var a,f,l=r.length,s=t.length,h=new Map(r.map(((t,n)=>[u(t,n,r),t])));for(a=0,i=new Array(l);a<s;++a)(f=t[a]).index=a,"object"!=typeof f.source&&(f.source=v(h,f.source)),"object"!=typeof f.target&&(f.target=v(h,f.target)),i[f.source.index]=(i[f.source.index]||0)+1,i[f.target.index]=(i[f.target.index]||0)+1;for(a=0,o=new Array(s);a<s;++a)f=t[a],o[a]=i[f.source.index]/(i[f.source.index]+i[f.target.index]);n=new Array(s),x(),e=new Array(s),g()}}function x(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+f(t[e],e,t)}function g(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+l(t[n],n,t)}return null==t&&(t=[]),y.initialize=function(t,n){r=t,a=n,p()},y.links=function(n){return arguments.length?(t=n,p(),y):t},y.id=function(t){return arguments.length?(u=t,y):u},y.iterations=function(t){return arguments.length?(s=+t,y):s},y.strength=function(t){return arguments.length?(f="function"==typeof t?t:h(+t),x(),y):f},y.distance=function(t){return arguments.length?(l="function"==typeof t?t:h(+t),g(),y):l},y},x:function(t){var n,e,r,i=h(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=h(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:h(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),a(),o):t},o},y:function(t){var n,e,r,i=h(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=h(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:h(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),a(),o):t},o}},W="forces",X=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],Y=["static","iterations"],Z=["x","y","vx","vy"];function $(t){n.Transform.call(this,null,t)}function tt(t,n,r,i){var o,a,u,f,l=e.array(n.forces);for(o=0,a=X.length;o<a;++o)(u=X[o])!==W&&n.modified(u)&&t[u](n[u]);for(o=0,a=l.length;o<a;++o)f=W+o,(u=r||n.modified(W,o)?et(l[o]):i&&nt(l[o],i)?t.force(f):null)&&t.force(f,u);for(a=t.numForces||0;o<a;++o)t.force(W+o,null);return t.numForces=l.length,t}function nt(t,n){var r,i;for(r in t)if(e.isFunction(i=t[r])&&n.modified(e.accessorFields(i)))return 1;return 0}function et(t){var n,r;for(r in e.hasOwnProperty(V,t.force)||e.error("Unrecognized force: "+t.force),n=V[t.force](),t)e.isFunction(n[r])&&rt(n[r],t[r],t);return n}function rt(t,n,r){t(e.isFunction(n)?t=>n(t,r):n)}$.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:Z}]},e.inherits($,n.Transform,{transform(t,n){var e,r,i=this.value,o=n.changed(n.ADD_REM),a=t.modified(X),u=t.iterations||300;if(i?(o&&(n.modifies("index"),i.nodes(n.source)),(a||n.changed(n.MOD))&&tt(i,t,0,n)):(this.value=i=function(t,n){const e=Q(t),r=e.stop,i=e.restart;let o=!1;return e.stopped=()=>o,e.restart=()=>(o=!1,i()),e.stop=()=>(o=!0,r()),tt(e,n,!0).on("end",(()=>o=!0))}(n.source,t),i.on("tick",(e=n.dataflow,r=this,()=>e.touch(r).run())),t.static||(o=!0,i.tick()),n.modifies("index")),a||o||t.modified(Y)||n.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return n.StopPropagation;return this.finish(t,n)},finish(t,n){const e=n.dataflow;for(let t,n=this._argops,u=0,f=n.length;u<f;++u)if(t=n[u],t.name===W&&"link"===t.op._argval.force)for(var r,i=t.op._argops,o=0,a=i.length;o<a;++o)if("links"===i[o].name&&(r=i[o].op.source)){e.pulse(r,e.changeset().reflow());break}return n.reflow(t.modified()).modifies(Z)}}),t.force=$}));
//# sourceMappingURL=vega-force.min.js.map

@@ -101,3 +101,4 @@ import { Transform } from 'vega-dataflow';

'type': 'number',
'default': -30
'default': -30,
'expr': true
}, {

@@ -104,0 +105,0 @@ 'name': 'theta',

{
"name": "vega-force",
"version": "4.1.1",
"version": "4.2.0",
"description": "Force simulation transform for Vega dataflows.",

@@ -30,3 +30,3 @@ "keywords": [

},
"gitHead": "fb1092f6b931d450f9c210b67ae4752bd3dd461b"
"gitHead": "3290eaee7de69ad448a44349856107a461e67247"
}

@@ -69,3 +69,3 @@ import {Transform} from 'vega-dataflow';

'params': [
{ 'name': 'strength', 'type': 'number', 'default': -30 },
{ 'name': 'strength', 'type': 'number', 'default': -30, 'expr': true },
{ 'name': 'theta', 'type': 'number', 'default': 0.9 },

@@ -72,0 +72,0 @@ { 'name': 'distanceMin', 'type': 'number', 'default': 1 },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc