🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

vega-functions

Package Overview
Dependencies
Maintainers
0
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-functions - npm Package Compare versions

Comparing version

to
5.18.0

19

build/vega-functions.js

@@ -115,8 +115,11 @@ (function (global, factory) {

/**
* Name must be a string. Return undefined if the scale is not registered.
* nameOrFunction must be a string or function that was registered.
* Return undefined if scale is not recognized.
*/
function getScale(name, ctx) {
if (vegaUtil.isString(name)) {
const maybeScale = ctx.scales[name];
function getScale(nameOrFunction, ctx) {
if (vegaUtil.isString(nameOrFunction)) {
const maybeScale = ctx.scales[nameOrFunction];
return maybeScale && vegaScale.isRegisteredScale(maybeScale.value) ? maybeScale.value : undefined;
} else if (vegaUtil.isFunction(nameOrFunction)) {
return vegaScale.isRegisteredScale(nameOrFunction) ? nameOrFunction : undefined;
}

@@ -1347,8 +1350,4 @@ return undefined;

/**
* Passing a function is only used for for testing.
* Outside of tests, the first argument should be a string.
*/
function scaleGradient (scaleOrFunction, p0, p1, count, group) {
let scale = typeof scaleOrFunction === 'string' ? getScale(scaleOrFunction, (group || this).context) : scaleOrFunction;
function scaleGradient (scale, p0, p1, count, group) {
scale = getScale(scale, (group || this).context);
const gradient = vegaScenegraph.Gradient(p0, p1);

@@ -1355,0 +1354,0 @@ let stops = scale.domain(),

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-util"),require("vega-expression"),require("vega-scale"),require("vega-dataflow"),require("vega-scenegraph"),require("vega-selections"),require("vega-statistics"),require("vega-time")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","vega-scale","vega-dataflow","vega-scenegraph","vega-selections","vega-statistics","vega-time"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).vega={},t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.vega)}(this,(function(t,n,e,r,i,o,a,s,u){"use strict";function c(t){const n=this.context.data[t];return n?n.values.value:[]}function l(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i}function h(t,e){const r=this.context.dataflow,i=this.context.data[t].input;return r.pulse(i,r.changeset().remove(n.truthy).insert(e)),1}function f(t,n,e){if(t){const e=this.context.dataflow,r=t.mark.source;e.pulse(r,e.changeset().encode(t,n))}return void 0!==e?e:t}const g=t=>function(n,e){const r=this.context.dataflow.locale();return null===n?"null":r[t](e)(n)},d=g("format"),p=g("timeFormat"),m=g("utcFormat"),y=g("timeParse"),v=g("utcParse"),b=new Date(2e3,0,1);function w(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(b.setYear(2e3),b.setMonth(t),b.setDate(n),p.call(this,b,e)):""}function x(t){return w.call(this,t,1,"%B")}function N(t){return w.call(this,t,1,"%b")}function S(t){return w.call(this,0,2+t,"%A")}function $(t){return w.call(this,0,2+t,"%a")}const k="%";function E(t,r,i,o){r[0].type!==e.Literal&&n.error("First argument to data functions must be a string literal.");const a=r[0].value,s=":"+a;if(!n.hasOwnProperty(s,o))try{o[s]=i.getData(a).tuplesRef()}catch(t){}}function M(t,r,i,o){r[0].type!==e.Literal&&n.error("First argument to indata must be a string literal."),r[1].type!==e.Literal&&n.error("Second argument to indata must be a string literal.");const a=r[0].value,s=r[1].value,u="@"+s;n.hasOwnProperty(u,o)||(o[u]=i.getData(a).indataRef(i,s))}function q(t,n,r,i){if(n[0].type===e.Literal)P(r,i,n[0].value);else for(t in r.scales)P(r,i,t)}function P(t,e,r){const i=k+r;if(!n.hasOwnProperty(e,i))try{e[i]=t.scaleRef(r)}catch(t){}}function A(t,e){if(n.isString(t)){const n=e.scales[t];return n&&r.isRegisteredScale(n.value)?n.value:void 0}}function R(t,r,i){r.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,i._bandwidth=q,i._range=q,i._scale=q;const o=r=>"_["+(r.type===e.Literal?n.stringValue(k+r.value):n.stringValue(k)+"+"+t(r))+"]";return{_bandwidth:t=>`this.__bandwidth(${o(t[0])})`,_range:t=>`${o(t[0])}.range()`,_scale:n=>`${o(n[0])}(${t(n[1])})`}}class _{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}var F=1e-6,L=Math.PI,O=L/2,I=L/4,T=2*L,z=180/L,D=L/180,V=Math.abs,j=Math.atan2,H=Math.cos,B=Math.hypot,U=Math.sin,G=Math.sqrt;function C(t){return t>1?O:t<-1?-O:Math.asin(t)}function X(){}function Y(t,n){t&&Z.hasOwnProperty(t.type)&&Z[t.type](t,n)}var W={Feature:function(t,n){Y(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)Y(e[r].geometry,n)}},Z={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){J(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)J(e[r],n,0)},Polygon:function(t,n){K(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)K(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)Y(e[r],n)}};function J(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function K(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)J(t[e],n,1);n.polygonEnd()}function Q(t,n){t&&W.hasOwnProperty(t.type)?W[t.type](t,n):Y(t,n)}var tt,nt,et,rt,it,ot,at,st,ut,ct,lt,ht,ft,gt,dt,pt,mt=new _,yt=new _,vt={point:X,lineStart:X,lineEnd:X,polygonStart:function(){mt=new _,vt.lineStart=bt,vt.lineEnd=wt},polygonEnd:function(){var t=+mt;yt.add(t<0?T+t:t),this.lineStart=this.lineEnd=this.point=X},sphere:function(){yt.add(T)}};function bt(){vt.point=xt}function wt(){Nt(tt,nt)}function xt(t,n){vt.point=Nt,tt=t,nt=n,et=t*=D,rt=H(n=(n*=D)/2+I),it=U(n)}function Nt(t,n){var e=(t*=D)-et,r=e>=0?1:-1,i=r*e,o=H(n=(n*=D)/2+I),a=U(n),s=it*a,u=rt*o+s*H(i),c=s*r*U(i);mt.add(j(c,u)),et=t,rt=o,it=a}function St(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}var $t,kt,Et,Mt,qt,Pt,At,Rt,_t,Ft,Lt,Ot,It,Tt,zt,Dt,Vt={point:jt,lineStart:Bt,lineEnd:Ut,polygonStart:function(){Vt.point=Gt,Vt.lineStart=Ct,Vt.lineEnd=Xt,gt=new _,vt.polygonStart()},polygonEnd:function(){vt.polygonEnd(),Vt.point=jt,Vt.lineStart=Bt,Vt.lineEnd=Ut,mt<0?(ot=-(st=180),at=-(ut=90)):gt>F?ut=90:gt<-1e-6&&(at=-90),pt[0]=ot,pt[1]=st},sphere:function(){ot=-(st=180),at=-(ut=90)}};function jt(t,n){dt.push(pt=[ot=t,st=t]),n<at&&(at=n),n>ut&&(ut=n)}function Ht(t,n){var e,r,i=function(t){var n=t[0],e=t[1],r=H(e);return[r*H(n),r*U(n),U(e)]}([t*D,n*D]);if(ft){var o=St(ft,i),a=St([o[1],-o[0],0],o);r=G((e=a)[0]*e[0]+e[1]*e[1]+e[2]*e[2]),e[0]/=r,e[1]/=r,e[2]/=r,a=function(t){return[j(t[1],t[0]),C(t[2])]}(a);var s,u=t-ct,c=u>0?1:-1,l=a[0]*z*c,h=V(u)>180;h^(c*ct<l&&l<c*t)?(s=a[1]*z)>ut&&(ut=s):h^(c*ct<(l=(l+360)%360-180)&&l<c*t)?(s=-a[1]*z)<at&&(at=s):(n<at&&(at=n),n>ut&&(ut=n)),h?t<ct?Yt(ot,t)>Yt(ot,st)&&(st=t):Yt(t,st)>Yt(ot,st)&&(ot=t):st>=ot?(t<ot&&(ot=t),t>st&&(st=t)):t>ct?Yt(ot,t)>Yt(ot,st)&&(st=t):Yt(t,st)>Yt(ot,st)&&(ot=t)}else dt.push(pt=[ot=t,st=t]);n<at&&(at=n),n>ut&&(ut=n),ft=i,ct=t}function Bt(){Vt.point=Ht}function Ut(){pt[0]=ot,pt[1]=st,Vt.point=jt,ft=null}function Gt(t,n){if(ft){var e=t-ct;gt.add(V(e)>180?e+(e>0?360:-360):e)}else lt=t,ht=n;vt.point(t,n),Ht(t,n)}function Ct(){vt.lineStart()}function Xt(){Gt(lt,ht),vt.lineEnd(),V(gt)>F&&(ot=-(st=180)),pt[0]=ot,pt[1]=st,ft=null}function Yt(t,n){return(n-=t)<0?n+360:n}function Wt(t,n){return t[0]-n[0]}function Zt(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var Jt={sphere:X,point:Kt,lineStart:tn,lineEnd:rn,polygonStart:function(){Jt.lineStart=on,Jt.lineEnd=an},polygonEnd:function(){Jt.lineStart=tn,Jt.lineEnd=rn}};function Kt(t,n){t*=D;var e=H(n*=D);Qt(e*H(t),e*U(t),U(n))}function Qt(t,n,e){++$t,Et+=(t-Et)/$t,Mt+=(n-Mt)/$t,qt+=(e-qt)/$t}function tn(){Jt.point=nn}function nn(t,n){t*=D;var e=H(n*=D);Tt=e*H(t),zt=e*U(t),Dt=U(n),Jt.point=en,Qt(Tt,zt,Dt)}function en(t,n){t*=D;var e=H(n*=D),r=e*H(t),i=e*U(t),o=U(n),a=j(G((a=zt*o-Dt*i)*a+(a=Dt*r-Tt*o)*a+(a=Tt*i-zt*r)*a),Tt*r+zt*i+Dt*o);kt+=a,Pt+=a*(Tt+(Tt=r)),At+=a*(zt+(zt=i)),Rt+=a*(Dt+(Dt=o)),Qt(Tt,zt,Dt)}function rn(){Jt.point=Kt}function on(){Jt.point=sn}function an(){un(Ot,It),Jt.point=Kt}function sn(t,n){Ot=t,It=n,t*=D,n*=D,Jt.point=un;var e=H(n);Tt=e*H(t),zt=e*U(t),Dt=U(n),Qt(Tt,zt,Dt)}function un(t,n){t*=D;var e=H(n*=D),r=e*H(t),i=e*U(t),o=U(n),a=zt*o-Dt*i,s=Dt*r-Tt*o,u=Tt*i-zt*r,c=B(a,s,u),l=C(c),h=c&&-l/c;_t.add(h*a),Ft.add(h*s),Lt.add(h*u),kt+=l,Pt+=l*(Tt+(Tt=r)),At+=l*(zt+(zt=i)),Rt+=l*(Dt+(Dt=o)),Qt(Tt,zt,Dt)}function cn(t,n){return function(e,r,i){if(e){const n=A(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const ln=cn("area",(function(t){return yt=new _,Q(t,vt),2*yt})),hn=cn("bounds",(function(t){var n,e,r,i,o,a,s;if(ut=st=-(ot=at=1/0),dt=[],Q(t,Vt),e=dt.length){for(dt.sort(Wt),n=1,o=[r=dt[0]];n<e;++n)Zt(r,(i=dt[n])[0])||Zt(r,i[1])?(Yt(r[0],i[1])>Yt(r[0],r[1])&&(r[1]=i[1]),Yt(i[0],r[1])>Yt(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(s=Yt(r[1],i[0]))>a&&(a=s,ot=i[0],st=r[1])}return dt=pt=null,ot===1/0||at===1/0?[[NaN,NaN],[NaN,NaN]]:[[ot,at],[st,ut]]})),fn=cn("centroid",(function(t){$t=kt=Et=Mt=qt=Pt=At=Rt=0,_t=new _,Ft=new _,Lt=new _,Q(t,Jt);var n=+_t,e=+Ft,r=+Lt,i=B(n,e,r);return i<1e-12&&(n=Pt,e=At,r=Rt,kt<F&&(n=Et,e=Mt,r=qt),(i=B(n,e,r))<1e-12)?[NaN,NaN]:[j(e,n)*z,C(r/i)*z]}));function gn(t,n){const e=A(t,(n||this).context);return e&&e.scale()}function dn(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e}function pn(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function mn(){return pn(this.context.dataflow,"warn",arguments)}function yn(){return pn(this.context.dataflow,"info",arguments)}function vn(){return pn(this.context.dataflow,"debug",arguments)}function bn(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function wn(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function xn(){}var Nn=.7,Sn=1/Nn,$n="\\s*([+-]?\\d+)\\s*",kn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",En="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Mn=/^#([0-9a-f]{3,8})$/,qn=new RegExp(`^rgb\\(${$n},${$n},${$n}\\)$`),Pn=new RegExp(`^rgb\\(${En},${En},${En}\\)$`),An=new RegExp(`^rgba\\(${$n},${$n},${$n},${kn}\\)$`),Rn=new RegExp(`^rgba\\(${En},${En},${En},${kn}\\)$`),_n=new RegExp(`^hsl\\(${kn},${En},${En}\\)$`),Fn=new RegExp(`^hsla\\(${kn},${En},${En},${kn}\\)$`),Ln={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function On(){return this.rgb().formatHex()}function In(){return this.rgb().formatRgb()}function Tn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Mn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?zn(n):3===e?new Hn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Dn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Dn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=qn.exec(t))?new Hn(n[1],n[2],n[3],1):(n=Pn.exec(t))?new Hn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=An.exec(t))?Dn(n[1],n[2],n[3],n[4]):(n=Rn.exec(t))?Dn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=_n.exec(t))?Yn(n[1],n[2]/100,n[3]/100,1):(n=Fn.exec(t))?Yn(n[1],n[2]/100,n[3]/100,n[4]):Ln.hasOwnProperty(t)?zn(Ln[t]):"transparent"===t?new Hn(NaN,NaN,NaN,0):null}function zn(t){return new Hn(t>>16&255,t>>8&255,255&t,1)}function Dn(t,n,e,r){return r<=0&&(t=n=e=NaN),new Hn(t,n,e,r)}function Vn(t){return t instanceof xn||(t=Tn(t)),t?new Hn((t=t.rgb()).r,t.g,t.b,t.opacity):new Hn}function jn(t,n,e,r){return 1===arguments.length?Vn(t):new Hn(t,n,e,null==r?1:r)}function Hn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Bn(){return`#${Xn(this.r)}${Xn(this.g)}${Xn(this.b)}`}function Un(){const t=Gn(this.opacity);return`${1===t?"rgb(":"rgba("}${Cn(this.r)}, ${Cn(this.g)}, ${Cn(this.b)}${1===t?")":`, ${t})`}`}function Gn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Cn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Xn(t){return((t=Cn(t))<16?"0":"")+t.toString(16)}function Yn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Jn(t,n,e,r)}function Wn(t){if(t instanceof Jn)return new Jn(t.h,t.s,t.l,t.opacity);if(t instanceof xn||(t=Tn(t)),!t)return new Jn;if(t instanceof Jn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=n===o?(e-r)/s+6*(e<r):e===o?(r-n)/s+2:(n-e)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Jn(a,s,u,t.opacity)}function Zn(t,n,e,r){return 1===arguments.length?Wn(t):new Jn(t,n,e,null==r?1:r)}function Jn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Kn(t){return(t=(t||0)%360)<0?t+360:t}function Qn(t){return Math.max(0,Math.min(1,t||0))}function te(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}bn(xn,Tn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:On,formatHex:On,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Wn(this).formatHsl()},formatRgb:In,toString:In}),bn(Hn,jn,wn(xn,{brighter(t){return t=null==t?Sn:Math.pow(Sn,t),new Hn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Nn:Math.pow(Nn,t),new Hn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Hn(Cn(this.r),Cn(this.g),Cn(this.b),Gn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Bn,formatHex:Bn,formatHex8:function(){return`#${Xn(this.r)}${Xn(this.g)}${Xn(this.b)}${Xn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Un,toString:Un})),bn(Jn,Zn,wn(xn,{brighter(t){return t=null==t?Sn:Math.pow(Sn,t),new Jn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Nn:Math.pow(Nn,t),new Jn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Hn(te(t>=240?t-240:t+120,i,r),te(t,i,r),te(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Jn(Kn(this.h),Qn(this.s),Qn(this.l),Gn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Gn(this.opacity);return`${1===t?"hsl(":"hsla("}${Kn(this.h)}, ${100*Qn(this.s)}%, ${100*Qn(this.l)}%${1===t?")":`, ${t})`}`}}));const ne=Math.PI/180,ee=180/Math.PI,re=.96422,ie=1,oe=.82521,ae=4/29,se=6/29,ue=3*se*se,ce=se*se*se;function le(t){if(t instanceof fe)return new fe(t.l,t.a,t.b,t.opacity);if(t instanceof ve)return be(t);t instanceof Hn||(t=Vn(t));var n,e,r=me(t.r),i=me(t.g),o=me(t.b),a=ge((.2225045*r+.7168786*i+.0606169*o)/ie);return r===i&&i===o?n=e=a:(n=ge((.4360747*r+.3850649*i+.1430804*o)/re),e=ge((.0139322*r+.0971045*i+.7141733*o)/oe)),new fe(116*a-16,500*(n-a),200*(a-e),t.opacity)}function he(t,n,e,r){return 1===arguments.length?le(t):new fe(t,n,e,null==r?1:r)}function fe(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function ge(t){return t>ce?Math.pow(t,1/3):t/ue+ae}function de(t){return t>se?t*t*t:ue*(t-ae)}function pe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ye(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof ve)return new ve(t.h,t.c,t.l,t.opacity);if(t instanceof fe||(t=le(t)),0===t.a&&0===t.b)return new ve(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*ee;return new ve(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new ve(t,n,e,null==r?1:r)}function ve(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function be(t){if(isNaN(t.h))return new fe(t.l,0,0,t.opacity);var n=t.h*ne;return new fe(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}function we(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function xe(t){const n=jn(t);return.2126*we(n.r)+.7152*we(n.g)+.0722*we(n.b)}function Ne(t,n){const e=xe(t),r=xe(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)}function Se(){const t=[].slice.call(arguments);return t.unshift({}),n.extend(...t)}function $e(t,e){return t===e||t!=t&&e!=e||(n.isArray(t)?!(!n.isArray(e)||t.length!==e.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!$e(t[e],n[e]))return!1;return!0}(t,e):!(!n.isObject(t)||!n.isObject(e))&&ke(t,e))}function ke(t,n){for(const e in t)if(!$e(t[e],n[e]))return!1;return!0}function Ee(t){return n=>ke(t,n)}function Me(t,e,r,o,a,s){const u=this.context.dataflow,c=this.context.data[t],l=c.input,h=u.stamp();let f,g,d=c.changes;if(!1===u._trigger||!(l.value.length||e||o))return 0;if((!d||d.stamp<h)&&(c.changes=d=u.changeset(),d.stamp=h,u.runAfter((()=>{c.modified=!0,u.pulse(l,d).run()}),!0,1)),r&&(f=!0===r?n.truthy:n.isArray(r)||i.isTuple(r)?r:Ee(r),d.remove(f)),e&&d.insert(e),o&&(f=Ee(o),l.value.some(f)?d.remove(f):d.insert(o)),a)for(g in s)d.modify(a,g,s[g]);return 1}function qe(t){const n=t.touches,e=n[0].clientX-n[1].clientX,r=n[0].clientY-n[1].clientY;return Math.hypot(e,r)}function Pe(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)}bn(fe,he,wn(xn,{brighter(t){return new fe(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new fe(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Hn(pe(3.1338561*(n=re*de(n))-1.6168667*(t=ie*de(t))-.4906146*(e=oe*de(e))),pe(-.9787684*n+1.9161415*t+.033454*e),pe(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),bn(ve,ye,wn(xn,{brighter(t){return new ve(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new ve(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return be(this).rgb()}}));const Ae={};function Re(t,e){const r=Ae[e]||(Ae[e]=n.field(e));return n.isArray(t)?t.map(r):r(t)}function _e(t){return n.isArray(t)||ArrayBuffer.isView(t)?t:null}function Fe(t){return _e(t)||(n.isString(t)?t:null)}function Le(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return _e(t).join(...e)}function Oe(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Fe(t).indexOf(...e)}function Ie(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Fe(t).lastIndexOf(...e)}function Te(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Fe(t).slice(...e)}function ze(t,e,r){return n.isFunction(r)&&n.error("Function argument passed to replace."),n.isString(e)||n.isRegExp(e)||n.error("Please pass a string or RegExp argument to replace."),String(t).replace(e,r)}function De(t){return _e(t).slice().reverse()}function Ve(t){return _e(t).slice().sort(n.ascending)}function je(t,n,e){return r.bandSpace(t||0,n||0,e||0)}function He(t,n){const e=A(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0}function Be(t,n){const e=A(t,(n||this).context);return e?e.copy():void 0}function Ue(t,n){const e=A(t,(n||this).context);return e?e.domain():[]}function Ge(t,e,r){const i=A(t,(r||this).context);return i?n.isArray(e)?(i.invertRange||i.invert)(e):(i.invert||i.invertExtent)(e):void 0}function Ce(t,n){const e=A(t,(n||this).context);return e&&e.range?e.range():[]}function Xe(t,n,e){const r=A(t,(e||this).context);return r?r(n):void 0}function Ye(t,e,i,a,s){let u="string"==typeof t?A(t,(s||this).context):t;const c=o.Gradient(e,i);let l=u.domain(),h=l[0],f=n.peek(l),g=n.identity;return f-h?g=r.scaleFraction(u,h,f):u=(u.interpolator?r.scale("sequential")().interpolator(u.interpolator()):r.scale("linear")().interpolate(u.interpolate()).range(u.range())).domain([h=0,f=1]),u.ticks&&(l=u.ticks(+a||15),h!==l[0]&&l.unshift(h),f!==n.peek(l)&&l.push(f)),l.forEach((t=>c.stop(g(t),u(t)))),c}function We(t,n,e){const r=A(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}}function Ze(t){let n=null;return function(e){return e?o.pathRender(e,n=n||o.pathParse(t)):t}}const Je=t=>t.data;function Ke(t,n){const e=c.call(n,t);return e.root&&e.root.lookup||{}}function Qe(t,n,e){const r=Ke(t,this),i=r[n],o=r[e];return i&&o?i.path(o).map(Je):void 0}function tr(t,n){const e=Ke(t,this)[n];return e?e.ancestors().map(Je):void 0}const nr=()=>"undefined"!=typeof window&&window||null;function er(){const t=nr();return t?t.screen:{}}function rr(){const t=nr();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]}function ir(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]}function or(t,e,r){if(!t)return[];const[i,a]=t,s=(new o.Bounds).set(i[0],i[1],a[0],a[1]),u=r||this.context.dataflow.scenegraph().root;return o.intersect(u,s,function(t){let e=null;if(t){const r=n.array(t.marktype),i=n.array(t.markname);e=t=>(!r.length||r.some((n=>t.marktype===n)))&&(!i.length||i.some((n=>t.name===n)))}return e}(e))}const ar={random:()=>s.random(),cumulativeNormal:s.cumulativeNormal,cumulativeLogNormal:s.cumulativeLogNormal,cumulativeUniform:s.cumulativeUniform,densityNormal:s.densityNormal,densityLogNormal:s.densityLogNormal,densityUniform:s.densityUniform,quantileNormal:s.quantileNormal,quantileLogNormal:s.quantileLogNormal,quantileUniform:s.quantileUniform,sampleNormal:s.sampleNormal,sampleLogNormal:s.sampleLogNormal,sampleUniform:s.sampleUniform,isArray:n.isArray,isBoolean:n.isBoolean,isDate:n.isDate,isDefined:t=>void 0!==t,isNumber:n.isNumber,isObject:n.isObject,isRegExp:n.isRegExp,isString:n.isString,isTuple:i.isTuple,isValid:t=>null!=t&&t==t,toBoolean:n.toBoolean,toDate:t=>n.toDate(t),toNumber:n.toNumber,toString:n.toString,indexof:Oe,join:Le,lastindexof:Ie,replace:ze,reverse:De,sort:Ve,slice:Te,flush:n.flush,lerp:n.lerp,merge:Se,pad:n.pad,peek:n.peek,pluck:Re,span:n.span,inrange:n.inrange,truncate:n.truncate,rgb:jn,lab:he,hcl:ye,hsl:Zn,luminance:xe,contrast:Ne,sequence:function(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o},format:d,utcFormat:m,utcParse:v,utcOffset:u.utcOffset,utcSequence:u.utcSequence,timeFormat:p,timeParse:y,timeOffset:u.timeOffset,timeSequence:u.timeSequence,timeUnitSpecifier:u.timeUnitSpecifier,monthFormat:x,monthAbbrevFormat:N,dayFormat:S,dayAbbrevFormat:$,quarter:n.quarter,utcquarter:n.utcquarter,week:u.week,utcweek:u.utcweek,dayofyear:u.dayofyear,utcdayofyear:u.utcdayofyear,warn:mn,info:yn,debug:vn,extent:t=>n.extent(t),inScope:dn,intersect:or,clampRange:n.clampRange,pinchDistance:qe,pinchAngle:Pe,screen:er,containerSize:ir,windowSize:rr,bandspace:je,setdata:h,pathShape:Ze,panLinear:n.panLinear,panLog:n.panLog,panPow:n.panPow,panSymlog:n.panSymlog,zoomLinear:n.zoomLinear,zoomLog:n.zoomLog,zoomPow:n.zoomPow,zoomSymlog:n.zoomSymlog,encode:f,modify:Me,lassoAppend:function(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const o=(t=n.array(t))[t.length-1];return void 0===o||Math.hypot(o[0]-e,o[1]-r)>i?[...t,[e,r]]:t},lassoPath:function(t){return n.array(t).reduce(((n,e,r)=>{let[i,o]=e;return n+(0==r?`M ${i},${o} `:r===t.length-1?" Z":`L ${i},${o} `)}),"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:a}=e,s=(new o.Bounds).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,e]of n)t<s.x1&&(s.x1=t),t>s.x2&&(s.x2=t),e<s.y1&&(s.y1=e),e>s.y2&&(s.y2=e);return s.translate(r,i),or([[s.x1,s.y1],[s.x2,s.y2]],t,a).filter((t=>function(t,n,e){let r=0;for(let i=0,o=e.length-1;i<e.length;o=i++){const[a,s]=e[o],[u,c]=e[i];c>n!=s>n&&t<(a-u)*(n-c)/(s-c)+u&&r++}return 1&r}(t.x,t.y,n)))}},sr=["view","item","group","xy","x","y"],ur="this.",cr={},lr={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${n.stringValue("$"+t)}]`,functions:function(t){const r=e.functions(t);sr.forEach((t=>r[t]="event.vega."+t));for(const t in ar)r[t]=ur+t;return n.extend(r,R(t,ar,cr)),r},constants:e.constants,visitors:cr},hr=e.codegenExpression(lr);function fr(t,n,e){return 1===arguments.length?ar[t]:(ar[t]=n,e&&(cr[t]=e),hr&&(hr.functions[t]=ur+t),this)}fr("bandwidth",He,q),fr("copy",Be,q),fr("domain",Ue,q),fr("range",Ce,q),fr("invert",Ge,q),fr("scale",Xe,q),fr("gradient",Ye,q),fr("geoArea",ln,q),fr("geoBounds",hn,q),fr("geoCentroid",fn,q),fr("geoShape",We,q),fr("geoScale",gn,q),fr("indata",l,M),fr("data",c,E),fr("treePath",Qe,E),fr("treeAncestors",tr,E),fr("vlSelectionTest",a.selectionTest,a.selectionVisitor),fr("vlSelectionIdTest",a.selectionIdTest,a.selectionVisitor),fr("vlSelectionResolve",a.selectionResolve,a.selectionVisitor),fr("vlSelectionTuples",a.selectionTuples),t.DataPrefix=":",t.IndexPrefix="@",t.ScalePrefix=k,t.SignalPrefix="$",t.bandspace=je,t.bandwidth=He,t.codeGenerator=hr,t.codegenParams=lr,t.containerSize=ir,t.contrast=Ne,t.copy=Be,t.data=c,t.dataVisitor=E,t.dayAbbrevFormat=$,t.dayFormat=S,t.debug=vn,t.domain=Ue,t.encode=f,t.expressionFunction=fr,t.format=d,t.functionContext=ar,t.geoArea=ln,t.geoBounds=hn,t.geoCentroid=fn,t.geoScale=gn,t.geoShape=We,t.inScope=dn,t.indata=l,t.indataVisitor=M,t.indexof=Oe,t.info=yn,t.invert=Ge,t.join=Le,t.lastindexof=Ie,t.luminance=xe,t.merge=Se,t.modify=Me,t.monthAbbrevFormat=N,t.monthFormat=x,t.parseExpression=function(t,r){const i={};let o;try{t=n.isString(t)?t:n.stringValue(t)+"",o=e.parseExpression(t)}catch(e){n.error("Expression parse error: "+t)}o.visit((t=>{if(t.type!==e.CallExpression)return;const n=t.callee.name,o=lr.visitors[n];o&&o(n,t.arguments,r,i)}));const a=hr(o);return a.globals.forEach((t=>{const e="$"+t;!n.hasOwnProperty(i,e)&&r.getSignal(t)&&(i[e]=r.signalRef(t))})),{$expr:n.extend({code:a.code},r.options.ast?{ast:o}:null),$fields:a.fields,$params:i}},t.pathShape=Ze,t.pinchAngle=Pe,t.pinchDistance=qe,t.pluck=Re,t.range=Ce,t.replace=ze,t.reverse=De,t.scale=Xe,t.scaleGradient=Ye,t.scaleVisitor=q,t.screen=er,t.setdata=h,t.slice=Te,t.sort=Ve,t.timeFormat=p,t.timeParse=y,t.treeAncestors=tr,t.treePath=Qe,t.utcFormat=m,t.utcParse=v,t.warn=mn,t.windowSize=rr}));
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-util"),require("vega-expression"),require("vega-scale"),require("vega-dataflow"),require("vega-scenegraph"),require("vega-selections"),require("vega-statistics"),require("vega-time")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","vega-scale","vega-dataflow","vega-scenegraph","vega-selections","vega-statistics","vega-time"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).vega={},t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.vega)}(this,(function(t,n,e,r,i,o,a,s,u){"use strict";function c(t){const n=this.context.data[t];return n?n.values.value:[]}function l(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i}function h(t,e){const r=this.context.dataflow,i=this.context.data[t].input;return r.pulse(i,r.changeset().remove(n.truthy).insert(e)),1}function f(t,n,e){if(t){const e=this.context.dataflow,r=t.mark.source;e.pulse(r,e.changeset().encode(t,n))}return void 0!==e?e:t}const g=t=>function(n,e){const r=this.context.dataflow.locale();return null===n?"null":r[t](e)(n)},d=g("format"),p=g("timeFormat"),m=g("utcFormat"),y=g("timeParse"),v=g("utcParse"),b=new Date(2e3,0,1);function w(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(b.setYear(2e3),b.setMonth(t),b.setDate(n),p.call(this,b,e)):""}function x(t){return w.call(this,t,1,"%B")}function N(t){return w.call(this,t,1,"%b")}function S(t){return w.call(this,0,2+t,"%A")}function $(t){return w.call(this,0,2+t,"%a")}const k="%";function E(t,r,i,o){r[0].type!==e.Literal&&n.error("First argument to data functions must be a string literal.");const a=r[0].value,s=":"+a;if(!n.hasOwnProperty(s,o))try{o[s]=i.getData(a).tuplesRef()}catch(t){}}function M(t,r,i,o){r[0].type!==e.Literal&&n.error("First argument to indata must be a string literal."),r[1].type!==e.Literal&&n.error("Second argument to indata must be a string literal.");const a=r[0].value,s=r[1].value,u="@"+s;n.hasOwnProperty(u,o)||(o[u]=i.getData(a).indataRef(i,s))}function q(t,n,r,i){if(n[0].type===e.Literal)P(r,i,n[0].value);else for(t in r.scales)P(r,i,t)}function P(t,e,r){const i=k+r;if(!n.hasOwnProperty(e,i))try{e[i]=t.scaleRef(r)}catch(t){}}function A(t,e){if(n.isString(t)){const n=e.scales[t];return n&&r.isRegisteredScale(n.value)?n.value:void 0}if(n.isFunction(t))return r.isRegisteredScale(t)?t:void 0}function R(t,r,i){r.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,i._bandwidth=q,i._range=q,i._scale=q;const o=r=>"_["+(r.type===e.Literal?n.stringValue(k+r.value):n.stringValue(k)+"+"+t(r))+"]";return{_bandwidth:t=>`this.__bandwidth(${o(t[0])})`,_range:t=>`${o(t[0])}.range()`,_scale:n=>`${o(n[0])}(${t(n[1])})`}}class _{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}var F=1e-6,L=Math.PI,O=L/2,I=L/4,T=2*L,z=180/L,D=L/180,V=Math.abs,j=Math.atan2,H=Math.cos,B=Math.hypot,U=Math.sin,G=Math.sqrt;function C(t){return t>1?O:t<-1?-O:Math.asin(t)}function X(){}function Y(t,n){t&&Z.hasOwnProperty(t.type)&&Z[t.type](t,n)}var W={Feature:function(t,n){Y(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)Y(e[r].geometry,n)}},Z={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){J(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)J(e[r],n,0)},Polygon:function(t,n){K(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)K(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)Y(e[r],n)}};function J(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function K(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)J(t[e],n,1);n.polygonEnd()}function Q(t,n){t&&W.hasOwnProperty(t.type)?W[t.type](t,n):Y(t,n)}var tt,nt,et,rt,it,ot,at,st,ut,ct,lt,ht,ft,gt,dt,pt,mt=new _,yt=new _,vt={point:X,lineStart:X,lineEnd:X,polygonStart:function(){mt=new _,vt.lineStart=bt,vt.lineEnd=wt},polygonEnd:function(){var t=+mt;yt.add(t<0?T+t:t),this.lineStart=this.lineEnd=this.point=X},sphere:function(){yt.add(T)}};function bt(){vt.point=xt}function wt(){Nt(tt,nt)}function xt(t,n){vt.point=Nt,tt=t,nt=n,et=t*=D,rt=H(n=(n*=D)/2+I),it=U(n)}function Nt(t,n){var e=(t*=D)-et,r=e>=0?1:-1,i=r*e,o=H(n=(n*=D)/2+I),a=U(n),s=it*a,u=rt*o+s*H(i),c=s*r*U(i);mt.add(j(c,u)),et=t,rt=o,it=a}function St(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}var $t,kt,Et,Mt,qt,Pt,At,Rt,_t,Ft,Lt,Ot,It,Tt,zt,Dt,Vt={point:jt,lineStart:Bt,lineEnd:Ut,polygonStart:function(){Vt.point=Gt,Vt.lineStart=Ct,Vt.lineEnd=Xt,gt=new _,vt.polygonStart()},polygonEnd:function(){vt.polygonEnd(),Vt.point=jt,Vt.lineStart=Bt,Vt.lineEnd=Ut,mt<0?(ot=-(st=180),at=-(ut=90)):gt>F?ut=90:gt<-1e-6&&(at=-90),pt[0]=ot,pt[1]=st},sphere:function(){ot=-(st=180),at=-(ut=90)}};function jt(t,n){dt.push(pt=[ot=t,st=t]),n<at&&(at=n),n>ut&&(ut=n)}function Ht(t,n){var e,r,i=function(t){var n=t[0],e=t[1],r=H(e);return[r*H(n),r*U(n),U(e)]}([t*D,n*D]);if(ft){var o=St(ft,i),a=St([o[1],-o[0],0],o);r=G((e=a)[0]*e[0]+e[1]*e[1]+e[2]*e[2]),e[0]/=r,e[1]/=r,e[2]/=r,a=function(t){return[j(t[1],t[0]),C(t[2])]}(a);var s,u=t-ct,c=u>0?1:-1,l=a[0]*z*c,h=V(u)>180;h^(c*ct<l&&l<c*t)?(s=a[1]*z)>ut&&(ut=s):h^(c*ct<(l=(l+360)%360-180)&&l<c*t)?(s=-a[1]*z)<at&&(at=s):(n<at&&(at=n),n>ut&&(ut=n)),h?t<ct?Yt(ot,t)>Yt(ot,st)&&(st=t):Yt(t,st)>Yt(ot,st)&&(ot=t):st>=ot?(t<ot&&(ot=t),t>st&&(st=t)):t>ct?Yt(ot,t)>Yt(ot,st)&&(st=t):Yt(t,st)>Yt(ot,st)&&(ot=t)}else dt.push(pt=[ot=t,st=t]);n<at&&(at=n),n>ut&&(ut=n),ft=i,ct=t}function Bt(){Vt.point=Ht}function Ut(){pt[0]=ot,pt[1]=st,Vt.point=jt,ft=null}function Gt(t,n){if(ft){var e=t-ct;gt.add(V(e)>180?e+(e>0?360:-360):e)}else lt=t,ht=n;vt.point(t,n),Ht(t,n)}function Ct(){vt.lineStart()}function Xt(){Gt(lt,ht),vt.lineEnd(),V(gt)>F&&(ot=-(st=180)),pt[0]=ot,pt[1]=st,ft=null}function Yt(t,n){return(n-=t)<0?n+360:n}function Wt(t,n){return t[0]-n[0]}function Zt(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var Jt={sphere:X,point:Kt,lineStart:tn,lineEnd:rn,polygonStart:function(){Jt.lineStart=on,Jt.lineEnd=an},polygonEnd:function(){Jt.lineStart=tn,Jt.lineEnd=rn}};function Kt(t,n){t*=D;var e=H(n*=D);Qt(e*H(t),e*U(t),U(n))}function Qt(t,n,e){++$t,Et+=(t-Et)/$t,Mt+=(n-Mt)/$t,qt+=(e-qt)/$t}function tn(){Jt.point=nn}function nn(t,n){t*=D;var e=H(n*=D);Tt=e*H(t),zt=e*U(t),Dt=U(n),Jt.point=en,Qt(Tt,zt,Dt)}function en(t,n){t*=D;var e=H(n*=D),r=e*H(t),i=e*U(t),o=U(n),a=j(G((a=zt*o-Dt*i)*a+(a=Dt*r-Tt*o)*a+(a=Tt*i-zt*r)*a),Tt*r+zt*i+Dt*o);kt+=a,Pt+=a*(Tt+(Tt=r)),At+=a*(zt+(zt=i)),Rt+=a*(Dt+(Dt=o)),Qt(Tt,zt,Dt)}function rn(){Jt.point=Kt}function on(){Jt.point=sn}function an(){un(Ot,It),Jt.point=Kt}function sn(t,n){Ot=t,It=n,t*=D,n*=D,Jt.point=un;var e=H(n);Tt=e*H(t),zt=e*U(t),Dt=U(n),Qt(Tt,zt,Dt)}function un(t,n){t*=D;var e=H(n*=D),r=e*H(t),i=e*U(t),o=U(n),a=zt*o-Dt*i,s=Dt*r-Tt*o,u=Tt*i-zt*r,c=B(a,s,u),l=C(c),h=c&&-l/c;_t.add(h*a),Ft.add(h*s),Lt.add(h*u),kt+=l,Pt+=l*(Tt+(Tt=r)),At+=l*(zt+(zt=i)),Rt+=l*(Dt+(Dt=o)),Qt(Tt,zt,Dt)}function cn(t,n){return function(e,r,i){if(e){const n=A(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const ln=cn("area",(function(t){return yt=new _,Q(t,vt),2*yt})),hn=cn("bounds",(function(t){var n,e,r,i,o,a,s;if(ut=st=-(ot=at=1/0),dt=[],Q(t,Vt),e=dt.length){for(dt.sort(Wt),n=1,o=[r=dt[0]];n<e;++n)Zt(r,(i=dt[n])[0])||Zt(r,i[1])?(Yt(r[0],i[1])>Yt(r[0],r[1])&&(r[1]=i[1]),Yt(i[0],r[1])>Yt(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(s=Yt(r[1],i[0]))>a&&(a=s,ot=i[0],st=r[1])}return dt=pt=null,ot===1/0||at===1/0?[[NaN,NaN],[NaN,NaN]]:[[ot,at],[st,ut]]})),fn=cn("centroid",(function(t){$t=kt=Et=Mt=qt=Pt=At=Rt=0,_t=new _,Ft=new _,Lt=new _,Q(t,Jt);var n=+_t,e=+Ft,r=+Lt,i=B(n,e,r);return i<1e-12&&(n=Pt,e=At,r=Rt,kt<F&&(n=Et,e=Mt,r=qt),(i=B(n,e,r))<1e-12)?[NaN,NaN]:[j(e,n)*z,C(r/i)*z]}));function gn(t,n){const e=A(t,(n||this).context);return e&&e.scale()}function dn(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e}function pn(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function mn(){return pn(this.context.dataflow,"warn",arguments)}function yn(){return pn(this.context.dataflow,"info",arguments)}function vn(){return pn(this.context.dataflow,"debug",arguments)}function bn(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function wn(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function xn(){}var Nn=.7,Sn=1/Nn,$n="\\s*([+-]?\\d+)\\s*",kn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",En="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Mn=/^#([0-9a-f]{3,8})$/,qn=new RegExp(`^rgb\\(${$n},${$n},${$n}\\)$`),Pn=new RegExp(`^rgb\\(${En},${En},${En}\\)$`),An=new RegExp(`^rgba\\(${$n},${$n},${$n},${kn}\\)$`),Rn=new RegExp(`^rgba\\(${En},${En},${En},${kn}\\)$`),_n=new RegExp(`^hsl\\(${kn},${En},${En}\\)$`),Fn=new RegExp(`^hsla\\(${kn},${En},${En},${kn}\\)$`),Ln={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function On(){return this.rgb().formatHex()}function In(){return this.rgb().formatRgb()}function Tn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Mn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?zn(n):3===e?new Hn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Dn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Dn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=qn.exec(t))?new Hn(n[1],n[2],n[3],1):(n=Pn.exec(t))?new Hn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=An.exec(t))?Dn(n[1],n[2],n[3],n[4]):(n=Rn.exec(t))?Dn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=_n.exec(t))?Yn(n[1],n[2]/100,n[3]/100,1):(n=Fn.exec(t))?Yn(n[1],n[2]/100,n[3]/100,n[4]):Ln.hasOwnProperty(t)?zn(Ln[t]):"transparent"===t?new Hn(NaN,NaN,NaN,0):null}function zn(t){return new Hn(t>>16&255,t>>8&255,255&t,1)}function Dn(t,n,e,r){return r<=0&&(t=n=e=NaN),new Hn(t,n,e,r)}function Vn(t){return t instanceof xn||(t=Tn(t)),t?new Hn((t=t.rgb()).r,t.g,t.b,t.opacity):new Hn}function jn(t,n,e,r){return 1===arguments.length?Vn(t):new Hn(t,n,e,null==r?1:r)}function Hn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Bn(){return`#${Xn(this.r)}${Xn(this.g)}${Xn(this.b)}`}function Un(){const t=Gn(this.opacity);return`${1===t?"rgb(":"rgba("}${Cn(this.r)}, ${Cn(this.g)}, ${Cn(this.b)}${1===t?")":`, ${t})`}`}function Gn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Cn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Xn(t){return((t=Cn(t))<16?"0":"")+t.toString(16)}function Yn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Jn(t,n,e,r)}function Wn(t){if(t instanceof Jn)return new Jn(t.h,t.s,t.l,t.opacity);if(t instanceof xn||(t=Tn(t)),!t)return new Jn;if(t instanceof Jn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=n===o?(e-r)/s+6*(e<r):e===o?(r-n)/s+2:(n-e)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Jn(a,s,u,t.opacity)}function Zn(t,n,e,r){return 1===arguments.length?Wn(t):new Jn(t,n,e,null==r?1:r)}function Jn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Kn(t){return(t=(t||0)%360)<0?t+360:t}function Qn(t){return Math.max(0,Math.min(1,t||0))}function te(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}bn(xn,Tn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:On,formatHex:On,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Wn(this).formatHsl()},formatRgb:In,toString:In}),bn(Hn,jn,wn(xn,{brighter(t){return t=null==t?Sn:Math.pow(Sn,t),new Hn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Nn:Math.pow(Nn,t),new Hn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Hn(Cn(this.r),Cn(this.g),Cn(this.b),Gn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Bn,formatHex:Bn,formatHex8:function(){return`#${Xn(this.r)}${Xn(this.g)}${Xn(this.b)}${Xn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Un,toString:Un})),bn(Jn,Zn,wn(xn,{brighter(t){return t=null==t?Sn:Math.pow(Sn,t),new Jn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Nn:Math.pow(Nn,t),new Jn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Hn(te(t>=240?t-240:t+120,i,r),te(t,i,r),te(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Jn(Kn(this.h),Qn(this.s),Qn(this.l),Gn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Gn(this.opacity);return`${1===t?"hsl(":"hsla("}${Kn(this.h)}, ${100*Qn(this.s)}%, ${100*Qn(this.l)}%${1===t?")":`, ${t})`}`}}));const ne=Math.PI/180,ee=180/Math.PI,re=.96422,ie=1,oe=.82521,ae=4/29,se=6/29,ue=3*se*se,ce=se*se*se;function le(t){if(t instanceof fe)return new fe(t.l,t.a,t.b,t.opacity);if(t instanceof ve)return be(t);t instanceof Hn||(t=Vn(t));var n,e,r=me(t.r),i=me(t.g),o=me(t.b),a=ge((.2225045*r+.7168786*i+.0606169*o)/ie);return r===i&&i===o?n=e=a:(n=ge((.4360747*r+.3850649*i+.1430804*o)/re),e=ge((.0139322*r+.0971045*i+.7141733*o)/oe)),new fe(116*a-16,500*(n-a),200*(a-e),t.opacity)}function he(t,n,e,r){return 1===arguments.length?le(t):new fe(t,n,e,null==r?1:r)}function fe(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function ge(t){return t>ce?Math.pow(t,1/3):t/ue+ae}function de(t){return t>se?t*t*t:ue*(t-ae)}function pe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ye(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof ve)return new ve(t.h,t.c,t.l,t.opacity);if(t instanceof fe||(t=le(t)),0===t.a&&0===t.b)return new ve(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*ee;return new ve(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new ve(t,n,e,null==r?1:r)}function ve(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function be(t){if(isNaN(t.h))return new fe(t.l,0,0,t.opacity);var n=t.h*ne;return new fe(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}function we(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function xe(t){const n=jn(t);return.2126*we(n.r)+.7152*we(n.g)+.0722*we(n.b)}function Ne(t,n){const e=xe(t),r=xe(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)}function Se(){const t=[].slice.call(arguments);return t.unshift({}),n.extend(...t)}function $e(t,e){return t===e||t!=t&&e!=e||(n.isArray(t)?!(!n.isArray(e)||t.length!==e.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!$e(t[e],n[e]))return!1;return!0}(t,e):!(!n.isObject(t)||!n.isObject(e))&&ke(t,e))}function ke(t,n){for(const e in t)if(!$e(t[e],n[e]))return!1;return!0}function Ee(t){return n=>ke(t,n)}function Me(t,e,r,o,a,s){const u=this.context.dataflow,c=this.context.data[t],l=c.input,h=u.stamp();let f,g,d=c.changes;if(!1===u._trigger||!(l.value.length||e||o))return 0;if((!d||d.stamp<h)&&(c.changes=d=u.changeset(),d.stamp=h,u.runAfter((()=>{c.modified=!0,u.pulse(l,d).run()}),!0,1)),r&&(f=!0===r?n.truthy:n.isArray(r)||i.isTuple(r)?r:Ee(r),d.remove(f)),e&&d.insert(e),o&&(f=Ee(o),l.value.some(f)?d.remove(f):d.insert(o)),a)for(g in s)d.modify(a,g,s[g]);return 1}function qe(t){const n=t.touches,e=n[0].clientX-n[1].clientX,r=n[0].clientY-n[1].clientY;return Math.hypot(e,r)}function Pe(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)}bn(fe,he,wn(xn,{brighter(t){return new fe(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new fe(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Hn(pe(3.1338561*(n=re*de(n))-1.6168667*(t=ie*de(t))-.4906146*(e=oe*de(e))),pe(-.9787684*n+1.9161415*t+.033454*e),pe(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),bn(ve,ye,wn(xn,{brighter(t){return new ve(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new ve(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return be(this).rgb()}}));const Ae={};function Re(t,e){const r=Ae[e]||(Ae[e]=n.field(e));return n.isArray(t)?t.map(r):r(t)}function _e(t){return n.isArray(t)||ArrayBuffer.isView(t)?t:null}function Fe(t){return _e(t)||(n.isString(t)?t:null)}function Le(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return _e(t).join(...e)}function Oe(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Fe(t).indexOf(...e)}function Ie(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Fe(t).lastIndexOf(...e)}function Te(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Fe(t).slice(...e)}function ze(t,e,r){return n.isFunction(r)&&n.error("Function argument passed to replace."),n.isString(e)||n.isRegExp(e)||n.error("Please pass a string or RegExp argument to replace."),String(t).replace(e,r)}function De(t){return _e(t).slice().reverse()}function Ve(t){return _e(t).slice().sort(n.ascending)}function je(t,n,e){return r.bandSpace(t||0,n||0,e||0)}function He(t,n){const e=A(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0}function Be(t,n){const e=A(t,(n||this).context);return e?e.copy():void 0}function Ue(t,n){const e=A(t,(n||this).context);return e?e.domain():[]}function Ge(t,e,r){const i=A(t,(r||this).context);return i?n.isArray(e)?(i.invertRange||i.invert)(e):(i.invert||i.invertExtent)(e):void 0}function Ce(t,n){const e=A(t,(n||this).context);return e&&e.range?e.range():[]}function Xe(t,n,e){const r=A(t,(e||this).context);return r?r(n):void 0}function Ye(t,e,i,a,s){t=A(t,(s||this).context);const u=o.Gradient(e,i);let c=t.domain(),l=c[0],h=n.peek(c),f=n.identity;return h-l?f=r.scaleFraction(t,l,h):t=(t.interpolator?r.scale("sequential")().interpolator(t.interpolator()):r.scale("linear")().interpolate(t.interpolate()).range(t.range())).domain([l=0,h=1]),t.ticks&&(c=t.ticks(+a||15),l!==c[0]&&c.unshift(l),h!==n.peek(c)&&c.push(h)),c.forEach((n=>u.stop(f(n),t(n)))),u}function We(t,n,e){const r=A(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}}function Ze(t){let n=null;return function(e){return e?o.pathRender(e,n=n||o.pathParse(t)):t}}const Je=t=>t.data;function Ke(t,n){const e=c.call(n,t);return e.root&&e.root.lookup||{}}function Qe(t,n,e){const r=Ke(t,this),i=r[n],o=r[e];return i&&o?i.path(o).map(Je):void 0}function tr(t,n){const e=Ke(t,this)[n];return e?e.ancestors().map(Je):void 0}const nr=()=>"undefined"!=typeof window&&window||null;function er(){const t=nr();return t?t.screen:{}}function rr(){const t=nr();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]}function ir(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]}function or(t,e,r){if(!t)return[];const[i,a]=t,s=(new o.Bounds).set(i[0],i[1],a[0],a[1]),u=r||this.context.dataflow.scenegraph().root;return o.intersect(u,s,function(t){let e=null;if(t){const r=n.array(t.marktype),i=n.array(t.markname);e=t=>(!r.length||r.some((n=>t.marktype===n)))&&(!i.length||i.some((n=>t.name===n)))}return e}(e))}const ar={random:()=>s.random(),cumulativeNormal:s.cumulativeNormal,cumulativeLogNormal:s.cumulativeLogNormal,cumulativeUniform:s.cumulativeUniform,densityNormal:s.densityNormal,densityLogNormal:s.densityLogNormal,densityUniform:s.densityUniform,quantileNormal:s.quantileNormal,quantileLogNormal:s.quantileLogNormal,quantileUniform:s.quantileUniform,sampleNormal:s.sampleNormal,sampleLogNormal:s.sampleLogNormal,sampleUniform:s.sampleUniform,isArray:n.isArray,isBoolean:n.isBoolean,isDate:n.isDate,isDefined:t=>void 0!==t,isNumber:n.isNumber,isObject:n.isObject,isRegExp:n.isRegExp,isString:n.isString,isTuple:i.isTuple,isValid:t=>null!=t&&t==t,toBoolean:n.toBoolean,toDate:t=>n.toDate(t),toNumber:n.toNumber,toString:n.toString,indexof:Oe,join:Le,lastindexof:Ie,replace:ze,reverse:De,sort:Ve,slice:Te,flush:n.flush,lerp:n.lerp,merge:Se,pad:n.pad,peek:n.peek,pluck:Re,span:n.span,inrange:n.inrange,truncate:n.truncate,rgb:jn,lab:he,hcl:ye,hsl:Zn,luminance:xe,contrast:Ne,sequence:function(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o},format:d,utcFormat:m,utcParse:v,utcOffset:u.utcOffset,utcSequence:u.utcSequence,timeFormat:p,timeParse:y,timeOffset:u.timeOffset,timeSequence:u.timeSequence,timeUnitSpecifier:u.timeUnitSpecifier,monthFormat:x,monthAbbrevFormat:N,dayFormat:S,dayAbbrevFormat:$,quarter:n.quarter,utcquarter:n.utcquarter,week:u.week,utcweek:u.utcweek,dayofyear:u.dayofyear,utcdayofyear:u.utcdayofyear,warn:mn,info:yn,debug:vn,extent:t=>n.extent(t),inScope:dn,intersect:or,clampRange:n.clampRange,pinchDistance:qe,pinchAngle:Pe,screen:er,containerSize:ir,windowSize:rr,bandspace:je,setdata:h,pathShape:Ze,panLinear:n.panLinear,panLog:n.panLog,panPow:n.panPow,panSymlog:n.panSymlog,zoomLinear:n.zoomLinear,zoomLog:n.zoomLog,zoomPow:n.zoomPow,zoomSymlog:n.zoomSymlog,encode:f,modify:Me,lassoAppend:function(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const o=(t=n.array(t))[t.length-1];return void 0===o||Math.hypot(o[0]-e,o[1]-r)>i?[...t,[e,r]]:t},lassoPath:function(t){return n.array(t).reduce(((n,e,r)=>{let[i,o]=e;return n+(0==r?`M ${i},${o} `:r===t.length-1?" Z":`L ${i},${o} `)}),"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:a}=e,s=(new o.Bounds).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,e]of n)t<s.x1&&(s.x1=t),t>s.x2&&(s.x2=t),e<s.y1&&(s.y1=e),e>s.y2&&(s.y2=e);return s.translate(r,i),or([[s.x1,s.y1],[s.x2,s.y2]],t,a).filter((t=>function(t,n,e){let r=0;for(let i=0,o=e.length-1;i<e.length;o=i++){const[a,s]=e[o],[u,c]=e[i];c>n!=s>n&&t<(a-u)*(n-c)/(s-c)+u&&r++}return 1&r}(t.x,t.y,n)))}},sr=["view","item","group","xy","x","y"],ur="this.",cr={},lr={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${n.stringValue("$"+t)}]`,functions:function(t){const r=e.functions(t);sr.forEach((t=>r[t]="event.vega."+t));for(const t in ar)r[t]=ur+t;return n.extend(r,R(t,ar,cr)),r},constants:e.constants,visitors:cr},hr=e.codegenExpression(lr);function fr(t,n,e){return 1===arguments.length?ar[t]:(ar[t]=n,e&&(cr[t]=e),hr&&(hr.functions[t]=ur+t),this)}fr("bandwidth",He,q),fr("copy",Be,q),fr("domain",Ue,q),fr("range",Ce,q),fr("invert",Ge,q),fr("scale",Xe,q),fr("gradient",Ye,q),fr("geoArea",ln,q),fr("geoBounds",hn,q),fr("geoCentroid",fn,q),fr("geoShape",We,q),fr("geoScale",gn,q),fr("indata",l,M),fr("data",c,E),fr("treePath",Qe,E),fr("treeAncestors",tr,E),fr("vlSelectionTest",a.selectionTest,a.selectionVisitor),fr("vlSelectionIdTest",a.selectionIdTest,a.selectionVisitor),fr("vlSelectionResolve",a.selectionResolve,a.selectionVisitor),fr("vlSelectionTuples",a.selectionTuples),t.DataPrefix=":",t.IndexPrefix="@",t.ScalePrefix=k,t.SignalPrefix="$",t.bandspace=je,t.bandwidth=He,t.codeGenerator=hr,t.codegenParams=lr,t.containerSize=ir,t.contrast=Ne,t.copy=Be,t.data=c,t.dataVisitor=E,t.dayAbbrevFormat=$,t.dayFormat=S,t.debug=vn,t.domain=Ue,t.encode=f,t.expressionFunction=fr,t.format=d,t.functionContext=ar,t.geoArea=ln,t.geoBounds=hn,t.geoCentroid=fn,t.geoScale=gn,t.geoShape=We,t.inScope=dn,t.indata=l,t.indataVisitor=M,t.indexof=Oe,t.info=yn,t.invert=Ge,t.join=Le,t.lastindexof=Ie,t.luminance=xe,t.merge=Se,t.modify=Me,t.monthAbbrevFormat=N,t.monthFormat=x,t.parseExpression=function(t,r){const i={};let o;try{t=n.isString(t)?t:n.stringValue(t)+"",o=e.parseExpression(t)}catch(e){n.error("Expression parse error: "+t)}o.visit((t=>{if(t.type!==e.CallExpression)return;const n=t.callee.name,o=lr.visitors[n];o&&o(n,t.arguments,r,i)}));const a=hr(o);return a.globals.forEach((t=>{const e="$"+t;!n.hasOwnProperty(i,e)&&r.getSignal(t)&&(i[e]=r.signalRef(t))})),{$expr:n.extend({code:a.code},r.options.ast?{ast:o}:null),$fields:a.fields,$params:i}},t.pathShape=Ze,t.pinchAngle=Pe,t.pinchDistance=qe,t.pluck=Re,t.range=Ce,t.replace=ze,t.reverse=De,t.scale=Xe,t.scaleGradient=Ye,t.scaleVisitor=q,t.screen=er,t.setdata=h,t.slice=Te,t.sort=Ve,t.timeFormat=p,t.timeParse=y,t.treeAncestors=tr,t.treePath=Qe,t.utcFormat=m,t.utcParse=v,t.warn=mn,t.windowSize=rr}));
//# sourceMappingURL=vega-functions.min.js.map

@@ -1,11 +0,11 @@

import { truthy, error, hasOwnProperty, isString, stringValue, extend, isArray, isObject, field, isFunction, isRegExp, ascending, peek, identity, array as array$1, isBoolean, isDate, isNumber, toBoolean, toDate, toNumber, toString, flush, lerp, pad, span, inrange, truncate, quarter, utcquarter, extent, clampRange, panLinear, panLog, panPow, panSymlog, zoomLinear, zoomLog, zoomPow, zoomSymlog } from 'vega-util';
import { truthy, hasOwnProperty, error, stringValue, isString, isFunction, extend, isArray, isObject, field, ascending, isRegExp, peek, identity, array as array$1, zoomSymlog, zoomPow, zoomLog, zoomLinear, panSymlog, panPow, panLog, panLinear, clampRange, utcquarter, quarter, truncate, inrange, span, pad, lerp, flush, toString, toNumber, toBoolean, isNumber, isDate, isBoolean, extent, toDate } from 'vega-util';
import { Literal, codegenExpression, constants, functions, parseExpression, CallExpression } from 'vega-expression';
import { isRegisteredScale, bandSpace, scale as scale$1, scaleFraction } from 'vega-scale';
import { geoArea as geoArea$1, geoBounds as geoBounds$1, geoCentroid as geoCentroid$1 } from 'd3-geo';
import { rgb, lab, hcl, hsl } from 'd3-color';
import { geoBounds as geoBounds$1, geoCentroid as geoCentroid$1, geoArea as geoArea$1 } from 'd3-geo';
import { rgb, hsl, hcl, lab } from 'd3-color';
import { isTuple } from 'vega-dataflow';
import { Gradient, pathRender, pathParse, Bounds, intersect as intersect$1 } from 'vega-scenegraph';
import { selectionVisitor, selectionTest, selectionIdTest, selectionResolve, selectionTuples } from 'vega-selections';
import { random, cumulativeNormal, cumulativeLogNormal, cumulativeUniform, densityNormal, densityLogNormal, densityUniform, quantileNormal, quantileLogNormal, quantileUniform, sampleNormal, sampleLogNormal, sampleUniform } from 'vega-statistics';
import { utcOffset, utcSequence, timeOffset, timeSequence, timeUnitSpecifier, week, utcweek, dayofyear, utcdayofyear } from 'vega-time';
import { sampleUniform, sampleLogNormal, sampleNormal, quantileUniform, quantileLogNormal, quantileNormal, densityUniform, densityLogNormal, densityNormal, cumulativeUniform, cumulativeLogNormal, cumulativeNormal, random } from 'vega-statistics';
import { utcdayofyear, dayofyear, utcweek, week, timeUnitSpecifier, timeSequence, timeOffset, utcSequence, utcOffset } from 'vega-time';
import { range as range$1 } from 'd3-array';

@@ -121,8 +121,11 @@

/**
* Name must be a string. Return undefined if the scale is not registered.
* nameOrFunction must be a string or function that was registered.
* Return undefined if scale is not recognized.
*/
function getScale(name, ctx) {
if (isString(name)) {
const maybeScale = ctx.scales[name];
function getScale(nameOrFunction, ctx) {
if (isString(nameOrFunction)) {
const maybeScale = ctx.scales[nameOrFunction];
return maybeScale && isRegisteredScale(maybeScale.value) ? maybeScale.value : undefined;
} else if (isFunction(nameOrFunction)) {
return isRegisteredScale(nameOrFunction) ? nameOrFunction : undefined;
}

@@ -383,8 +386,4 @@ return undefined;

/**
* Passing a function is only used for for testing.
* Outside of tests, the first argument should be a string.
*/
function scaleGradient (scaleOrFunction, p0, p1, count, group) {
let scale = typeof scaleOrFunction === 'string' ? getScale(scaleOrFunction, (group || this).context) : scaleOrFunction;
function scaleGradient (scale, p0, p1, count, group) {
scale = getScale(scale, (group || this).context);
const gradient = Gradient(p0, p1);

@@ -391,0 +390,0 @@ let stops = scale.domain(),

{
"name": "vega-functions",
"version": "5.17.0",
"version": "5.18.0",
"description": "Custom functions for the Vega expression language.",

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

},
"gitHead": "2fe2e63de54821d858bdcbe2aa38e72a9f2e6234"
"gitHead": "57c2a12ad868bc25ab216753c60c5a2c961f6cc4"
}

@@ -6,10 +6,7 @@ import {getScale} from '../scales';

/**
* Passing a function is only used for for testing.
* Outside of tests, the first argument should be a string.
*/
export default function(scaleOrFunction, p0, p1, count, group) {
let scale = typeof scaleOrFunction === 'string' ? getScale(scaleOrFunction, (group || this).context) : scaleOrFunction;
export default function(scale, p0, p1, count, group) {
scale = getScale(scale, (group || this).context);
const gradient = Gradient(p0, p1);

@@ -16,0 +13,0 @@

import {ScalePrefix} from './constants';
import {scaleVisitor} from './visitors';
import {Literal} from 'vega-expression';
import {isString, stringValue} from 'vega-util';
import {isFunction, isString, stringValue} from 'vega-util';
import {isRegisteredScale} from 'vega-scale';
/**
* Name must be a string. Return undefined if the scale is not registered.
* nameOrFunction must be a string or function that was registered.
* Return undefined if scale is not recognized.
*/
export function getScale(name, ctx) {
export function getScale(nameOrFunction, ctx) {
if (isString(name)) {
const maybeScale = ctx.scales[name];
if (isString(nameOrFunction)) {
const maybeScale = ctx.scales[nameOrFunction];
return (maybeScale && isRegisteredScale(maybeScale.value)) ? maybeScale.value : undefined;
} else if (isFunction(nameOrFunction)) {
return isRegisteredScale(nameOrFunction) ? nameOrFunction : undefined;
}

@@ -16,0 +19,0 @@

Sorry, the diff of this file is not supported yet