!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-expression"),require("vega-dataflow"),require("vega-selections"),require("vega-statistics"),require("vega-time"),require("vega-util"),require("d3-array"),require("d3-color"),require("d3-format"),require("d3-time-format"),require("vega-scale"),require("d3-geo"),require("vega-scenegraph")):"function"==typeof define&&define.amd?define(["exports","vega-expression","vega-dataflow","vega-selections","vega-statistics","vega-time","vega-util","d3-array","d3-color","d3-format","d3-time-format","vega-scale","d3-geo","vega-scenegraph"],e):e((t=t||self).vega={},t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.d3,t.d3,t.d3,t.d3,t.vega,t.d3,t.vega)}(this,(function(t,e,n,r,o,i,a,c,u,s,l,f,m,d){"use strict";function g(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function p(t){const e=u.rgb(t);return.2126*g(e.r)+.7152*g(e.g)+.0722*g(e.b)}function h(t,e){const n=p(t),r=p(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function v(t){const e=this.context.data[t];return e?e.values.value:[]}function y(t,e,n){const r=this.context.data[t]["index:"+e],o=r?r.value.get(n):void 0;return o?o.count:o}function b(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(a.truthy).insert(e)),1}function x(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t}const w={};function S(t,e,n){let r=t+":"+n,o=w[r];return o&&o[0]===e||(w[r]=o=[e,e(n)]),o[1]}function q(t,e){return S("format",s.format,e)(t)}function P(t,e){return S("timeFormat",i.timeFormat,e)(t)}function L(t,e){return S("utcFormat",i.utcFormat,e)(t)}function F(t,e){return S("timeParse",l.timeParse,e)(t)}function N(t,e){return S("utcParse",l.utcParse,e)(t)}var A=new Date(2e3,0,1);function O(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(A.setYear(2e3),A.setMonth(t),A.setDate(e),P(A,n)):""}function k(t){return O(t,1,"%B")}function D(t){return O(t,1,"%b")}function z(t){return O(0,2+t,"%A")}function R(t){return O(0,2+t,"%a")}function U(t,e){let n;return a.isFunction(t)?t:a.isString(t)?(n=e.scales[t])&&n.value:void 0}function B(t,e){const n=U(t,(e||this).context);return n&&n.range?n.range():[]}function j(t,e){const n=U(t,(e||this).context);return n?n.domain():[]}function E(t,e){const n=U(t,(e||this).context);return n&&n.bandwidth?n.bandwidth():0}function M(t,e,n){return f.bandSpace(t||0,e||0,n||0)}function V(t,e){const n=U(t,(e||this).context);return n?n.copy():void 0}function I(t,e,n){const r=U(t,(n||this).context);return r&&void 0!==e?r(e):void 0}function T(t,e,n){const r=U(t,(n||this).context);return r?a.isArray(e)?(r.invertRange||r.invert)(e):(r.invert||r.invertExtent)(e):void 0}function X(t,e){return function(n,r,o){if(n){const e=U(n,(o||this).context);return e&&e.path[t](r)}return e(r)}}const Y=X("area",m.geoArea),_=X("bounds",m.geoBounds),C=X("centroid",m.geoCentroid);function G(t){let e=this.context.group,n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n}function H(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}function W(){return H(this.context.dataflow,"warn",arguments)}function $(){return H(this.context.dataflow,"info",arguments)}function J(){return H(this.context.dataflow,"debug",arguments)}function K(){var t=[].slice.call(arguments);return t.unshift({}),a.extend.apply(null,t)}function Q(t,e){return t===e||t!=t&&e!=e||(a.isArray(t)?!(!a.isArray(e)||t.length!==e.length)&&function(t,e){for(let n=0,r=t.length;nZ(t,e)}function et(t,e,r,o,i,c){let u,s,l=this.context.dataflow,f=this.context.data[t],m=f.input,d=f.changes,g=l.stamp();if(!1===l._trigger||!(m.value.length||e||o))return 0;if((!d||d.stampi.stop(l(e),t(e))),i}function it(t,e,n){const r=U(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}function at(t){let e=null;return function(n){return n?d.pathRender(n,e=e||d.pathParse(t)):t}}const ct={};function ut(t){return t.data}function st(t,e){const n=v.call(e,t);return n.root&&n.root.lookup||ct}function lt(t,e,n){const r=st(t,this),o=r[e],i=r[n];return o&&i?o.path(i).map(ut):void 0}function ft(t,e){const n=st(t,this)[e];return n?n.ancestors().map(ut):void 0}const mt="undefined"!=typeof window&&window||null;function dt(){return mt?mt.screen:{}}function gt(){return mt?[mt.innerWidth,mt.innerHeight]:[void 0,void 0]}function pt(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]}const ht=":",vt="@",yt="%";function bt(t,n,r,o){n[0].type!==e.Literal&&a.error("First argument to data functions must be a string literal.");const i=n[0].value,c=ht+i;if(!a.hasOwnProperty(c,o))try{o[c]=r.getData(i).tuplesRef()}catch(t){}}function xt(t,n,r,o){n[0].type!==e.Literal&&a.error("First argument to indata must be a string literal."),n[1].type!==e.Literal&&a.error("Second argument to indata must be a string literal.");const i=n[0].value,c=n[1].value,u=vt+c;a.hasOwnProperty(u,o)||(o[u]=r.getData(i).indataRef(r,c))}function wt(t,n,r,o){if(n[0].type===e.Literal)St(r,o,n[0].value);else if(n[0].type===e.Identifier)for(t in r.scales)St(r,o,t)}function St(t,e,n){const r=yt+n;if(!a.hasOwnProperty(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}const qt={random:function(){return o.random()},cumulativeNormal:o.cumulativeNormal,cumulativeLogNormal:o.cumulativeLogNormal,cumulativeUniform:o.cumulativeUniform,densityNormal:o.densityNormal,densityLogNormal:o.densityLogNormal,densityUniform:o.densityUniform,quantileNormal:o.quantileNormal,quantileLogNormal:o.quantileLogNormal,quantileUniform:o.quantileUniform,sampleNormal:o.sampleNormal,sampleLogNormal:o.sampleLogNormal,sampleUniform:o.sampleUniform,isArray:a.isArray,isBoolean:a.isBoolean,isDate:a.isDate,isDefined:function(t){return void 0!==t},isNumber:a.isNumber,isObject:a.isObject,isRegExp:a.isRegExp,isString:a.isString,isTuple:n.isTuple,isValid:function(t){return null!=t&&t==t},toBoolean:a.toBoolean,toDate:a.toDate,toNumber:a.toNumber,toString:a.toString,flush:a.flush,lerp:a.lerp,merge:K,pad:a.pad,peek:a.peek,span:a.span,inrange:a.inrange,truncate:a.truncate,rgb:u.rgb,lab:u.lab,hcl:u.hcl,hsl:u.hsl,luminance:p,contrast:h,sequence:c.range,format:q,utcFormat:L,utcParse:N,utcOffset:i.utcOffset,utcSequence:i.utcSequence,timeFormat:P,timeParse:F,timeOffset:i.timeOffset,timeSequence:i.timeSequence,timeUnitSpecifier:i.timeUnitSpecifier,monthFormat:k,monthAbbrevFormat:D,dayFormat:z,dayAbbrevFormat:R,quarter:a.quarter,utcquarter:a.utcquarter,warn:W,info:$,debug:J,extent:a.extent,inScope:G,intersect:function(t,e,n){if(!t)return[];const[r,o]=t,i=(new d.Bounds).set(r[0],r[1],o[0],o[1]),c=n||this.context.dataflow.scenegraph().root;return d.intersect(c,i,function(t){let e=null;if(t){const n=a.array(t.marktype),r=a.array(t.markname);e=t=>(!n.length||n.some(e=>t.marktype===e))&&(!r.length||r.some(e=>t.name===e))}return e}(e))},clampRange:a.clampRange,pinchDistance:nt,pinchAngle:rt,screen:dt,containerSize:pt,windowSize:gt,bandspace:M,setdata:b,pathShape:at,panLinear:a.panLinear,panLog:a.panLog,panPow:a.panPow,panSymlog:a.panSymlog,zoomLinear:a.zoomLinear,zoomLog:a.zoomLog,zoomPow:a.zoomPow,zoomSymlog:a.zoomSymlog,encode:x,modify:et},Pt=["view","item","group","xy","x","y"],Lt="event.vega.",Ft="this.",Nt={};function At(t,e,n){return 1===arguments.length?qt[t]:(qt[t]=e,n&&(Nt[t]=n),kt&&(kt.functions[t]=Ft+t),this)}At("bandwidth",E,wt),At("copy",V,wt),At("domain",j,wt),At("range",B,wt),At("invert",T,wt),At("scale",I,wt),At("gradient",ot,wt),At("geoArea",Y,wt),At("geoBounds",_,wt),At("geoCentroid",C,wt),At("geoShape",it,wt),At("indata",y,xt),At("data",v,bt),At("treePath",lt,bt),At("treeAncestors",ft,bt),At("vlSelectionTest",r.selectionTest,r.selectionVisitor),At("vlSelectionResolve",r.selectionResolve,r.selectionVisitor);const Ot={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(t){return"_["+a.stringValue("$"+t)+"]"},functions:function(t){const n=e.functions(t);Pt.forEach(t=>n[t]=Lt+t);for(let t in qt)n[t]=Ft+t;return n},constants:e.constants,visitors:Nt};var kt=e.codegen(Ot);Object.defineProperty(t,"formatLocale",{enumerable:!0,get:function(){return s.formatDefaultLocale}}),Object.defineProperty(t,"timeFormatLocale",{enumerable:!0,get:function(){return l.timeFormatDefaultLocale}}),t.DataPrefix=ht,t.IndexPrefix=vt,t.ScalePrefix=yt,t.SignalPrefix="$",t.bandspace=M,t.bandwidth=E,t.codeGenerator=kt,t.codegenParams=Ot,t.containerSize=pt,t.contrast=h,t.copy=V,t.data=v,t.dataVisitor=bt,t.dayAbbrevFormat=R,t.dayFormat=z,t.debug=J,t.domain=j,t.encode=x,t.expressionFunction=At,t.format=q,t.functionContext=qt,t.geoArea=Y,t.geoBounds=_,t.geoCentroid=C,t.geoShape=it,t.inScope=G,t.indata=y,t.indataVisitor=xt,t.info=$,t.invert=T,t.luminance=p,t.merge=K,t.modify=et,t.monthAbbrevFormat=D,t.monthFormat=k,t.pathShape=at,t.pinchAngle=rt,t.pinchDistance=nt,t.range=B,t.scale=I,t.scaleGradient=ot,t.scaleVisitor=wt,t.screen=dt,t.setdata=b,t.timeFormat=P,t.timeParse=F,t.treeAncestors=ft,t.treePath=lt,t.utcFormat=L,t.utcParse=N,t.warn=W,t.windowSize=gt,Object.defineProperty(t,"__esModule",{value:!0})}));