Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vega-parser

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-parser - npm Package Compare versions

Comparing version 3.8.0 to 3.9.0

2

build/vega-parser.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("d3-format"),require("d3-time-format"),require("vega-scale"),require("vega-scenegraph"),require("d3-geo"),require("vega-dataflow"),require("vega-expression"),require("vega-statistics"),require("d3-color"),require("d3-array"),require("vega-event-selector")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-format","d3-time-format","vega-scale","vega-scenegraph","d3-geo","vega-dataflow","vega-expression","vega-statistics","d3-color","d3-array","vega-event-selector"],t):t(e.vega={},e.vega,e.d3,e.d3,e.vega,e.vega,e.d3,e.vega,e.vega,e.vega,e.d3,e.d3,e.vega)}(this,function(e,Ye,n,r,f,p,t,g,o,i,a,l,u){"use strict";function h(e){return+e||0}var s="outer",d=["value","update","react","bind"];function c(e,t){Ye.error(e+' for "outer" push: '+Ye.stringValue(t))}function m(t,e){var n=t.name;if(t.push===s)e.signals[n]||c("No prior signal definition",n),d.forEach(function(e){void 0!==t[e]&&c("Invalid property ",e)});else{var r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}var v={};function y(e,t,n){var r=e+":"+n,i=v[r];return i&&i[0]===t||(v[r]=i=[t,t(n)]),i[1]}function b(e,t){return y("timeFormat",r.timeFormat,t)(e)}var x=new Date(2e3,0,1);function k(e,t,n){return x.setMonth(e),x.setDate(t),b(x,n)}function S(e,t,n,r){var i,a=t[0],o=t[t.length-1];return o<a&&(i=a,a=o,o=i),r=void 0===r||r,((n=void 0===n||n)?a<=e:a<e)&&(r?e<=o:e<o)}function R(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}var O="undefined"!=typeof window&&window||null;var w="Literal",z="%",j=":";function P(e,t){var n;return Ye.isFunction(e)?e:Ye.isString(e)?(n=t.scales[e])&&n.value:void 0}function D(e,t,n){var r=z+n;if(!t.hasOwnProperty(r))try{t[r]=e.scaleRef(n)}catch(e){}}function $(e,t,n,r){if(t[0].type===w)D(n,r,t[0].value);else if("Identifier"===t[0].type)for(e in n.scales)D(n,r,e)}function _(i,a){return function(e,t,n){if(e){var r=P(e,(n||this).context);return r&&r.path[i](t)}return a(t)}}var E=_("area",t.geoArea),V=_("bounds",t.geoBounds),A=_("centroid",t.geoCentroid);function F(e){var t=this.context.data[e];return t?t.values.value:[]}function W(e,t,n,r){t[0].type!==w&&Ye.error("First argument to data functions must be a string literal.");var i=t[0].value,a=j+i;r.hasOwnProperty(a)||(r[a]=n.getData(i).tuplesRef())}var L={};function C(e){return e.data}function M(e,t){var n=F.call(t,e);return n.root&&n.root.lookup||L}function q(e,t){return e===t||e!=e&&t!=t||!(!Ye.isArray(e)||!Ye.isArray(t)||e.length!==t.length)&&function(e,t){for(var n=0,r=e.length;n<r;++n)if(!q(e[n],t[n]))return!1;return!0}(e,t)}function B(n){return function(e){for(var t in n)if(!q(e[t],n[t]))return!1;return!0}}var N="E",T="R",U="R-E",I="R-LE",X="R-RE",Y="intersect",G="index:unit";function H(e,t){for(var n,r,i=t.fields,a=t.values,o=i.length,l=0;l<o;++l)if((r=i[l]).getter=Ye.field.getter||Ye.field(r.field),n=r.getter(e),Ye.isDate(n)&&(n=Ye.toNumber(n)),Ye.isDate(a[l])&&(a[l]=Ye.toNumber(a[l])),Ye.isDate(a[l][0])&&(a[l]=a[l].map(Ye.toNumber)),r.type===N){if(Ye.isArray(a[l])?a[l].indexOf(n)<0:n!==a[l])return!1}else if(r.type===T){if(!S(n,a[l]))return!1}else if(r.type===X){if(!S(n,a[l],!0,!1))return!1}else if(r.type===U){if(!S(n,a[l],!1,!1))return!1}else if(r.type===I&&!S(n,a[l],!1,!0))return!1;return!0}function J(e,t,n,r){t[0].type!==w&&Ye.error("First argument to indata must be a string literal.");var i=t[0].value;(2<=t.length&&t[t.length-1].value)!==Y||r.hasOwnProperty("@unit")||(r["@unit"]=n.getData(i).indataRef(n,"unit")),W(0,t,n,r)}var K={E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;n<r;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter(function(e){return 0<=t.indexOf(e)}):t},R_union:function(e,t){var n=Ye.toNumber(t[0]),r=Ye.toNumber(t[1]);return r<n&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<r&&(e[1]=r),e):[n,r]},R_intersect:function(e,t){var n=Ye.toNumber(t[0]),r=Ye.toNumber(t[1]);return r<n&&(n=t[1],r=t[0]),e.length?r<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>r&&(e[1]=r),e):[n,r]}},Q="bin_",Z="intersect",ee="union",te="index:unit";function ne(e,t){for(var n,r=t.fields,i=t.values,a=t.getter||(t.getter=[]),o=r.length,l=0;l<o;++l)if(a[l]=a[l]||Ye.field(r[l]),n=a[l](e),Ye.isDate(n)&&(n=Ye.toNumber(n)),Ye.isDate(i[l])&&(i[l]=Ye.toNumber(i[l])),t[Q+r[l]]){if(Ye.isDate(i[l][0])&&(i[l]=i[l].map(Ye.toNumber)),!S(n,i[l],!0,!1))return!1}else if(n!==i[l])return!1;return!0}function re(e,t){for(var n,r,i=t.intervals,a=i.length,o=0;o<a;++o){if(n=i[o].extent,r=(i[o].getter||(i[o].getter=Ye.field(i[o].field)))(e),!n||n[0]===n[1])return!1;if(Ye.isDate(r)&&(r=Ye.toNumber(r)),Ye.isDate(n[0])&&(n=i[o].extent=n.map(Ye.toNumber)),Ye.isNumber(n[0])&&!S(r,n))return!1;if(Ye.isString(n[0])&&n.indexOf(r)<0)return!1}return!0}function ie(e,t,n,r){for(var i,a,o,l,s,u=this.context.data[e],d=u?u.values.value:[],c=u?u[te]&&u[te].value:void 0,f=n===Z,p=d.length,g=0;g<p;++g)if(i=d[g],c&&f){if(-1===(o=(a=a||{})[l=i.unit]||0))continue;if(s=r(t,i),a[l]=s?-1:++o,s&&1===c.size)return!0;if(!s&&o===c.get(l).count)return!1}else if(f^(s=r(t,i)))return s;return p&&f}function ae(e,t,n){return ie.call(this,e,t,n,ne)}function oe(e,t,n,r){t[0].type!==w&&Ye.error("First argument to indata must be a string literal.");var i=t[0].value;(2<=t.length&&t[t.length-1].value)!==Z||r.hasOwnProperty("@unit")||(r["@unit"]=n.getData(i).indataRef(n,"unit")),W(0,t,n,r)}function le(e,t,n,r){var i,a,o,l,s,u=this.context.data[e],d=u?u.values.value:[],c=u?u[te]&&u[te].value:void 0,f=d[0],p=0;if(f){for(i=t?f.encodings.length:f.fields.length;p<i;++p)if(t&&f.encodings[p]===t||n&&f.fields[p]===n){a=p,l=f[Q+f.fields[p]];break}return c&&1===c.size&&(r=ee),o=c&&r===Z?(s=d.reduce(function(e,t){return(e[t.unit]||(e[t.unit]=[])).push({unit:t.unit,value:t.values[a]}),e},{}),Object.keys(s).map(function(e){return{unit:e,value:l?ue(s[e],ee):se(s[e],ee)}})):d.map(function(e){return{unit:e.unit,value:e.values[a]}}),l?ue(o,r):se(o,r)}}function se(e,t){for(var n,r,i,a,o={},l=0,s={},u=[],d=0,c=e.length;d<c;++d)r=(n=e[d]).unit,a=n.value,o[r]||(o[r]=++l),(i=s[a])||(s[a]=i={value:a,units:{},count:0}),i.units[r]||(i.units[r]=++i.count);for(a in s)i=s[a],t===Z&&i.count!==l||u.push(i.value);return u.length?u:void 0}function ue(e,t){for(var n,r,i,a,o=t===Z?ce:de,l=0,s=e.length;l<s;++l)n=e[l].value,Ye.isDate(n[0])&&(n=n.map(Ye.toNumber)),i=n[0],(a=n[1])<i&&(a=n[0],i=n[1]),r=r?o(r,i,a):[i,a];return r&&r.length&&+r[0]!=+r[1]?r:void 0}function de(e,t,n){return e[0]>t&&(e[0]=t),e[1]<n&&(e[1]=n),e}function ce(e,t,n){return n<e[0]||e[1]<t?[]:(e[0]<t&&(e[0]=t),e[1]>n&&(e[1]=n),e)}var fe={random:function(){return i.random()},isArray:Ye.isArray,isBoolean:Ye.isBoolean,isDate:Ye.isDate,isNumber:Ye.isNumber,isObject:Ye.isObject,isRegExp:Ye.isRegExp,isString:Ye.isString,isTuple:g.isTuple,toBoolean:Ye.toBoolean,toDate:Ye.toDate,toNumber:Ye.toNumber,toString:Ye.toString,pad:Ye.pad,peek:Ye.peek,truncate:Ye.truncate,rgb:a.rgb,lab:a.lab,hcl:a.hcl,hsl:a.hsl,sequence:l.range,format:function(e,t){return y("format",n.format,t)(e)},utcFormat:function(e,t){return y("utcFormat",r.utcFormat,t)(e)},utcParse:function(e,t){return y("utcParse",r.utcParse,t)(e)},timeFormat:b,timeParse:function(e,t){return y("timeParse",r.timeParse,t)(e)},monthFormat:function(e){return k(e,1,"%B")},monthAbbrevFormat:function(e){return k(e,1,"%b")},dayFormat:function(e){return k(0,2+e,"%A")},dayAbbrevFormat:function(e){return k(0,2+e,"%a")},quarter:function(e){return 1+~~(new Date(e).getMonth()/3)},utcquarter:function(e){return 1+~~(new Date(e).getUTCMonth()/3)},warn:function(){return R(this.context.dataflow,"warn",arguments)},info:function(){return R(this.context.dataflow,"info",arguments)},debug:function(){return R(this.context.dataflow,"debug",arguments)},extent:function(e){var t,n,r,i,a=0;if(e&&(t=e.length)){for(n=e[a];null==n||n!=n;n=e[++a]);for(r=i=n;a<t;++a)null!=(n=e[a])&&(n<r&&(r=n),i<n&&(i=n))}return[r,i]},inScope:function(e){var t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},clampRange:function(e,t,n){var r,i=e[0],a=e[1];return a<i&&(r=a,a=i,i=r),n-t<=(r=a-i)?[t,n]:[i=Math.min(Math.max(i,t),n-r),i+r]},pinchDistance:function(e){var t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(e){var t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){return O?O.screen:{}},containerSize:function(){var e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){return O?[O.innerWidth,O.innerHeight]:[void 0,void 0]},span:function(e){return e[e.length-1]-e[0]||0},merge:function(){var e=[].slice.call(arguments);return e.unshift({}),Ye.extend.apply(null,e)},flush:function(e,t,n,r,i,a){if(!n&&0!==n)return a;var o,l,s=e[0],u=Ye.peek(e),d=+n;return u<s&&(o=s,s=u,u=o),(o=Math.abs(t-s))<(l=Math.abs(u-t))&&o<=d?r:l<=d?i:a},bandspace:function(e,t,n){return f.bandSpace(e||0,t||0,n||0)},inrange:S,setdata:function(e,t){var n=this.context.dataflow,r=this.context.data[e].input;return n.pulse(r,n.changeset().remove(Ye.truthy).insert(t)),1},pathShape:function(t){var n=null;return function(e){return e?p.pathRender(e,n=n||p.pathParse(t)):t}},panLinear:Ye.panLinear,panLog:Ye.panLog,panPow:Ye.panPow,zoomLinear:Ye.zoomLinear,zoomLog:Ye.zoomLog,zoomPow:Ye.zoomPow,encode:function(e,t,n){if(e){var r=this.context.dataflow,i=e.mark.source;r.pulse(i,r.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,r,i,a){var o,l,s=this.context.dataflow,u=this.context.data[e],d=u.input,c=u.changes,f=s.stamp();if(!1===s._trigger||!(d.value.length||t||r))return 0;if((!c||c.stamp<f)&&(u.changes=c=s.changeset(),c.stamp=f,s.runAfter(function(){u.modified=!0,s.pulse(d,c).run()},!0,1)),n&&(o=!0===n?Ye.truthy:Ye.isArray(n)||g.isTuple(n)?n:B(n),c.remove(o)),t&&c.insert(t),r&&(o=B(r),d.value.some(o)?c.remove(o):c.insert(r)),i)for(l in a)c.modify(i,l,a[l]);return 1}},pe=["view","item","group","xy","x","y"],ge={};function he(e,t,n){return 1===arguments.length?fe[e]:(fe[e]=t,n&&(ge[e]=n),ve&&(ve.functions[e]="this."+e),this)}he("bandwidth",function(e,t){var n=P(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0},$),he("copy",function(e,t){var n=P(e,(t||this).context);return n?n.copy():void 0},$),he("domain",function(e,t){var n=P(e,(t||this).context);return n?n.domain():[]},$),he("range",function(e,t){var n=P(e,(t||this).context);return n&&n.range?n.range():[]},$),he("invert",function(e,t,n){var r=P(e,(n||this).context);return r?Ye.isArray(t)?(r.invertRange||r.invert)(t):(r.invert||r.invertExtent)(t):void 0},$),he("scale",function(e,t,n){var r=P(e,(n||this).context);return r?r(t):void 0},$),he("gradient",function(e,t,n,r,i){e=P(e,(i||this).context);var a=p.Gradient(t,n),o=e.domain(),l=o[0],s=Ye.peek(o),u=f.scaleFraction(e,l,s);e.ticks&&(l!==(o=e.ticks(+r||15))[0]&&o.unshift(l),s!==Ye.peek(o)&&o.push(s));for(var d=0,c=o.length;d<c;++d)a.stop(u(o[d]),e(o[d]));return a},$),he("geoArea",E,$),he("geoBounds",V,$),he("geoCentroid",A,$),he("geoShape",function(e,t,n){var r=P(e,(n||this).context);return function(e){return r?r.path.context(e)(t):""}},$),he("indata",function(e,t,n){var r=this.context.data[e]["index:"+t],i=r?r.value.get(n):void 0;return i?i.count:i},function(e,t,n,r){t[0].type!==w&&Ye.error("First argument to indata must be a string literal."),t[1].type!==w&&Ye.error("Second argument to indata must be a string literal.");var i=t[0].value,a=t[1].value,o="@"+a;r.hasOwnProperty(o)||(r[o]=n.getData(i).indataRef(n,a))}),he("data",F,W),he("treePath",function(e,t,n){var r=M(e,this),i=r[t],a=r[n];return i&&a?i.path(a).map(C):void 0},W),he("treeAncestors",function(e,t){var n=M(e,this)[t];return n?n.ancestors().map(C):void 0},W),he("vlSelectionTest",function(e,t,n){for(var r,i,a,o,l,s=this.context.data[e],u=s?s.values.value:[],d=s?s[G]&&s[G].value:void 0,c=n===Y,f=u.length,p=0;p<f;++p)if(r=u[p],d&&c){if(-1===(a=(i=i||{})[o=r.unit]||0))continue;if(l=H(t,r),i[o]=l?-1:++a,l&&1===d.size)return!0;if(!l&&a===d.get(o).count)return!1}else if(c^(l=H(t,r)))return l;return f&&c},J),he("vlSelectionResolve",function(e,r){for(var t,n,i,a,o,l,s,u,d,c,f,p=this.context.data[e],g=p?p.values.value:[],h={},m={},v=g.length,y=0;y<v;++y)for(a=(t=g[y]).unit,n=t.fields,i=t.values,c=0,f=n.length;c<f;++c)o=n[c],s=(l=h[o.field]||(h[o.field]={}))[a]||(l[a]=[]),m[o.field]=u=o.type.charAt(0),d=K[u+"_union"],l[a]=d(s,Ye.array(i[c]));return r=r||"union",Object.keys(h).forEach(function(n){h[n]=Object.keys(h[n]).map(function(e){return h[n][e]}).reduce(function(e,t){return void 0===e?t:K[m[n]+"_"+r](e,t)})}),h},J),he("vlSingle",ae,W),he("vlSingleDomain",le,W),he("vlMulti",ae,oe),he("vlMultiDomain",le,oe),he("vlInterval",function(e,t,n){return ie.call(this,e,t,n,re)},W),he("vlIntervalDomain",function(e,t,n,r){var i,a,o,l,s,u=this.context.data[e],d=u?u.values.value:[],c=d[0],f=0;if(c){for(i=c.intervals.length;f<i;++f)if(a=c.intervals[f],t&&a.encoding===t||n&&a.field===n){if(!a.extent)return;o=f,s=2<a.extent.length;break}return l=d.reduce(function(e,t){var n=t.intervals[o].extent,r=s?n.map(function(e){return{unit:t.unit,value:e}}):{unit:t.unit,value:n};return s?e.push.apply(e,r):e.push(r),e},[]),s?se(l,r):ue(l,r)}},W);var me={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(e){return"_["+Ye.stringValue("$"+e)+"]"},functions:function(e){var t=o.functions(e);for(var n in pe.forEach(function(e){t[e]="event.vega."+e}),fe)t[n]="this."+n;return t},constants:o.constants,visitors:ge},ve=o.codegen(me),ye="$";function Me(t,r,e){var n,i,a={};try{t=Ye.isString(t)?t:Ye.stringValue(t)+"",n=o.parse(t)}catch(e){Ye.error("Expression parse error: "+t)}return n.visit(function(e){if("CallExpression"===e.type){var t=e.callee.name,n=me.visitors[t];n&&n(t,e.arguments,r,a)}}),(i=ve(n)).globals.forEach(function(e){var t=ye+e;!a.hasOwnProperty(t)&&r.getSignal(e)&&(a[t]=r.signalRef(e))}),{$expr:e?e+"return("+i.code+");":i.code,$fields:i.fields,$params:a}}function be(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function xe(e,t,n,r){return new be(e,t,n,r)}function ke(e,t){return xe("operator",e,t)}function Ge(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}var Se={$tupleid:1,toString:function(){return":_tupleid_:"}};function Re(e,t){return t?{$field:e,$name:t}:{$field:e}}var Oe=Re("key");function we(e,t){return{$compare:e,$order:t}}var ze="descending";function je(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}var Pe="scope",De="view";function $e(e){return e&&e.signal}function _e(e){if($e(e))return!0;if(Ye.isObject(e))for(var t in e)if(_e(e[t]))return!0;return!1}function He(e,t){return null!=e?e:t}function Je(e){return e&&e.signal||e}var Ee="timer";function Ve(e,t){return(e.merge?Ae:e.stream?Fe:e.type?We:Ye.error("Invalid stream specification: "+Ye.stringValue(e)))(e,t)}function Ae(e,t){var n=Le({merge:e.merge.map(function(e){return Ve(e,t)})},e,t);return t.addStream(n).id}function Fe(e,t){var n=Le({stream:Ve(e.stream,t)},e,t);return t.addStream(n).id}function We(e,t){var n,r,i;return e.type===Ee?(n=t.event(Ee,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===Pe?De:i||De,e.type),r=Le({stream:n},e,t),1===Object.keys(r).length?n:t.addStream(r).id}function Le(e,t,n){var r,i,a,o,l=t.between;return l&&(2!==l.length&&Ye.error('Stream "between" parameter must have 2 entries: '+Ye.stringValue(t)),e.between=[Ve(l[0],n),Ve(l[1],n)]),l=t.filter?Ye.array(t.filter):[],(t.marktype||t.markname||t.markrole)&&l.push((r=t.marktype,i=t.markname,a=t.markrole,(o="event.item")+(r&&"*"!==r?"&&"+o+".mark.marktype==='"+r+"'":"")+(a?"&&"+o+".mark.role==='"+a+"'":"")+(i?"&&"+o+".mark.name==='"+i+"'":""))),t.source===Pe&&l.push("inScope(event.item)"),l.length&&(e.filter=Me("("+l.join(")&&(")+")").$expr),null!=(l=t.throttle)&&(e.throttle=+l),null!=(l=t.debounce)&&(e.debounce=+l),t.consume&&(e.consume=!0),e}var Ce="var datum=event.item&&event.item.datum;";function qe(e,r,t){var n,i,a=e.events,o=e.update,l=e.encode,s=[];a||Ye.error("Signal update missing events specification."),Ye.isString(a)&&(a=u.selector(a,r.isSubscope()?Pe:De)),(a=Ye.array(a).filter(function(e){return e.signal||e.scale?(s.push(e),0):1})).length&&s.push(1<a.length?{merge:a}:a[0]),null!=l&&(o&&Ye.error("Signal encode and update are mutually exclusive."),o="encode(item(),"+Ye.stringValue(l)+")"),n=Ye.isString(o)?Me(o,r,Ce):null!=o.expr?Me(o.expr,r,Ce):null!=o.value?o.value:null!=o.signal?{$expr:"_.value",$params:{value:r.signalRef(o.signal)}}:Ye.error("Invalid signal update specification."),i={target:t,update:n},e.force&&(i.options={force:!0}),s.forEach(function(e){var t,n;r.addUpdate(Ye.extend((n=r,{source:(t=e).signal?n.signalRef(t.signal):t.scale?n.scaleRef(t.scale):Ve(t,n)}),i))})}function Be(e,t){var n=t.getSignal(e.name);if(e.update){var r=Me(e.update,t);n.update=r.$expr,n.params=r.$params}e.on&&e.on.forEach(function(e){qe(e,t,n.id)})}function Ne(r){return function(e,t,n){return xe(r,t,e||void 0,n)}}var Te=Ne("aggregate"),Ke=Ne("axisticks"),Ue=Ne("bound"),Qe=Ne("collect"),Ie=Ne("compare"),Xe=Ne("datajoin"),Ze=Ne("encode"),et=Ne("expression"),tt=Ne("facet"),nt=Ne("field"),rt=Ne("key"),it=Ne("legendentries"),at=Ne("load"),ot=Ne("mark"),lt=Ne("multiextent"),st=Ne("multivalues"),ut=Ne("overlap"),dt=Ne("params"),ct=Ne("prefacet"),ft=Ne("projection"),pt=Ne("proxy"),gt=Ne("relay"),ht=Ne("render"),mt=Ne("scale"),vt=Ne("sieve"),yt=Ne("sortitems"),bt=Ne("viewlayout"),xt=Ne("values"),kt=0,St=["identity","ordinal","band","point","bin-linear","bin-ordinal","quantize","quantile","threshold","linear","pow","sqrt","log","sequential","time","utc"],Rt=Ye.toSet(St),Ot=Ye.toSet(St.slice(4,9)),wt=Ye.toSet(St.slice(9)),zt=Ye.toSet(St.slice(1,6));function jt(e){return zt.hasOwnProperty(e)}function Pt(e){return Ot.hasOwnProperty(e)}function Dt(e){return"quantile"===e}function $t(e,t){var n,r,i,a,o=t.getScale(e.name).params;for(n in o.domain=Vt(e.domain,e,t),null!=e.range&&(o.range=function e(t,n,r){var i=t.range,a=n.config.range;{if(i.signal)return n.signalRef(i.signal);if(Ye.isString(i)){if(a&&a.hasOwnProperty(i))return t=Ye.extend({},t,{range:a[i]}),e(t,n,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=jt(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:Ye.error("Unrecognized scale range value: "+Ye.stringValue(i))}else{if(i.scheme)return r.scheme=_t(i.scheme,n),i.extent&&(r.schemeExtent=(o=i.extent,l=n,o.signal?l.signalRef(o.signal):o.map(function(e){return _t(e,l)}))),void(i.count&&(r.schemeCount=_t(i.count,n)));if(i.step)return void(r.rangeStep=_t(i.step,n));if(jt(t.type)&&!Ye.isArray(i))return Vt(i,t,n);Ye.isArray(i)||Ye.error("Unsupported range type: "+Ye.stringValue(i))}}var o,l;return i.map(function(e){return _t(e,n)})}(e,t,o)),null!=e.interpolate&&(r=e.interpolate,(i=o).interpolate=_t(r.type||r),null!=r.gamma&&(i.interpolateGamma=_t(r.gamma))),null!=e.nice&&(a=e.nice,o.nice=Ye.isObject(a)?{interval:_t(a.interval),step:_t(a.step)}:_t(a)),e)o.hasOwnProperty(n)||"name"===n||(o[n]=_t(e[n],t))}function _t(e,t){return Ye.isObject(e)?e.signal?t.signalRef(e.signal):Ye.error("Unsupported object: "+Ye.stringValue(e)):e}function Et(e){Ye.error("Can not find data set: "+Ye.stringValue(e))}function Vt(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(Ye.isArray(e)?function(e,t,n){return e.map(function(e){return _t(e,n)})}:e.fields?function(e,t,n){var r=e.data,i=e.fields.reduce(function(e,t){return t=Ye.isString(t)?{data:r,field:t}:Ye.isArray(t)||t.signal?function(e,t){var n="_:vega:_"+kt++,r=Qe({});if(Ye.isArray(e))r.value={$ingest:e};else if(e.signal){var i="setdata("+Ye.stringValue(n)+","+e.signal+")";r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,vt({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e},[]);return(jt(t.type)?function(e,n,t){var r,i,a;return r=t.map(function(e){var t=n.getData(e.data);return t||Et(e.data),t.countsRef(n,e.field)}),i=n.add(Te({groupby:Oe,ops:["sum"],fields:[n.fieldRef("count")],as:["count"],pulse:r})),a=n.add(Qe({pulse:Ge(i)})),Ge(n.add(xt({field:Oe,sort:n.sortRef(At(e.sort,!0)),pulse:Ge(a)})))}:Dt(t.type)?function(e,n,t){var r=t.map(function(e){var t=n.getData(e.data);return t||Et(e.data),t.domainRef(n,e.field)});return Ge(n.add(st({values:r})))}:function(e,n,t){var r=t.map(function(e){var t=n.getData(e.data);return t||Et(e.data),t.extentRef(n,e.field)});return Ge(n.add(lt({extents:r})))})(e,n,i)}:function(e,t,n){var r=n.getData(e.data);r||Et(e.data);return jt(t.type)?r.valuesRef(n,e.field,At(e.sort,!1)):Dt(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)})(e,t,n);null==t.domainMin&&null==t.domainMax||Ye.error("No scale domain defined for domainMin/domainMax to override.")}function At(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field?Ye.error("Multiple domain scales can not sort by field."):t&&e.op&&"count"!==e.op&&Ye.error("Multiple domain scales support op count only."):Ye.error("No field provided for sort aggregate op: "+e.op):Ye.isObject(e)?e.field="key":e={field:"key"}),e}function Ft(e,t,n){return Ye.isArray(e)?e.map(function(e){return Ft(e,t,n)}):Ye.isObject(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:Ye.error("Unsupported parameter object: "+Ye.stringValue(e)):e}var Wt="top",Lt="left",Ct="right",Mt="bottom",qt="vertical",Bt="index",Nt="label",Tt="offset",Ut="perc",It="perc2",Xt="size",Yt="value",Gt="guide-label",Ht="guide-title",Jt="group-title",Kt="symbol",Qt="gradient",Zt="discrete",en=["size","shape","fill","stroke","strokeDash","opacity"],tn={name:1,interactive:1},nn=Ye.toSet(["rule"]),rn=Ye.toSet(["group","image","rect"]);function an(e,t,n,r){var i=Me(e,t);return i.$fields.forEach(function(e){r[e]=1}),Ye.extend(n,i.$params),i.$expr}function on(e,t,n,r){return function e(t,n,r,i){var a,o,l;if(t.signal)a="datum",l=an(t.signal,n,r,i);else if(t.group||t.parent){for(o=Math.max(1,t.level||1),a="item";0<o--;)a+=".mark.group";t.parent?(l=t.parent,a+=".datum"):l=t.group}else t.datum?(a="datum",l=t.datum):Ye.error("Invalid field reference: "+Ye.stringValue(t));t.signal||(l=Ye.isString(l)?(i[l]=1,Ye.splitAccessPath(l).map(Ye.stringValue).join("][")):e(l,n,r,i));return a+"["+l+"]"}(Ye.isObject(e)?e:{datum:e},t,n,r)}function ln(e,t,n,r,i){var a,o,l,s=sn(e.scale,n,r,i);return null!=e.range?(o=s+".range()",t=0===(a=+e.range)?o+"[0]":"($="+o+","+(1===a?"$[$.length-1]":"$[0]+"+a+"*($[$.length-1]-$[0])")+")"):(void 0!==t&&(t=s+"("+t+")"),e.band&&(l=function(e,t){if(!Ye.isString(e))return-1;var n=t.scaleType(e);return"band"===n||"point"===n?1:0}(e.scale,n))&&(a=(o=s+".bandwidth")+"()"+(1===(a=+e.band)?"":"*"+a),l<0&&(a="("+o+"?"+a+":0)"),t=(t?t+"+":"")+a,e.extra&&(t="(datum.extra?"+s+"(datum.extra.value):"+t+")")),null==t&&(t="0")),t}function sn(e,t,n,r){var i;if(Ye.isString(e))i=z+e,n.hasOwnProperty(i)||(n[i]=t.scaleRef(e)),i=Ye.stringValue(i);else{for(i in t.scales)n[z+i]=t.scaleRef(i);i=Ye.stringValue(z)+"+"+(e.signal?"("+an(e.signal,t,n,r)+")":on(e,t,n,r))}return"_["+i+"]"}function un(e,t,n,r){return Ye.isObject(e)?"("+dn(null,e,t,n,r)+")":e}function dn(e,t,n,r,i){if(null!=t.gradient)return o=n,l=r,s=i,"this.gradient("+sn((a=t).gradient,o,l,s)+","+Ye.stringValue(a.start)+","+Ye.stringValue(a.stop)+","+Ye.stringValue(a.count)+")";var a,o,l,s,u=t.signal?an(t.signal,n,r,i):t.color?function(e,i,a,o){function t(e,t,n,r){return"this."+e+"("+[dn(null,t,i,a,o),dn(null,n,i,a,o),dn(null,r,i,a,o)].join(",")+").toString()"}return e.c?t("hcl",e.h,e.c,e.l):e.h||e.s?t("hsl",e.h,e.s,e.l):e.l||e.a?t("lab",e.l,e.a,e.b):e.r||e.g||e.b?t("rgb",e.r,e.g,e.b):null}(t.color,n,r,i):null!=t.field?on(t.field,n,r,i):void 0!==t.value?Ye.stringValue(t.value):void 0;return null!=t.scale&&(u=ln(t,u,n,r,i)),void 0===u&&(u=null),null!=t.exponent&&(u="Math.pow("+u+","+un(t.exponent,n,r,i)+")"),null!=t.mult&&(u+="*"+un(t.mult,n,r,i)),null!=t.offset&&(u+="+"+un(t.offset,n,r,i)),t.round&&(u="Math.round("+u+")"),u}function cn(e,t,n){return e+"["+Ye.stringValue(t)+"]="+n+";"}function fn(e,t,n,r,i){var a="";return t.forEach(function(e){var t=dn(0,e,n,r,i);a+=e.test?an(e.test,n,r,i)+"?"+t+":":t}),":"===Ye.peek(a)&&(a+="null"),cn("o",e,a)}function pn(e,t,n,r){var i,a,o,l,s,u={},d="var o=item,datum=o.datum,$;";for(i in e)a=e[i],Ye.isArray(a)?d+=fn(i,a,r,n,u):d+=cn("o",i,dn(0,a,r,n,u));return d+=(o=e,s="",nn[l=t]||(o.x2&&(o.x?(rn[l]&&(s+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),s+="o.width=o.x2-o.x;"):s+="o.x=o.x2-(o.width||0);"),o.xc&&(s+="o.x=o.xc-(o.width||0)/2;"),o.y2&&(o.y?(rn[l]&&(s+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),s+="o.height=o.y2-o.y;"):s+="o.y=o.y2-(o.height||0);"),o.yc&&(s+="o.y=o.yc-(o.height||0)/2;")),s),{$expr:d+="return 1;",$fields:Object.keys(u),$output:Object.keys(e)}}var gn="mark",hn="frame",mn="scope",vn="axis",yn="axis-domain",bn="axis-grid",xn="axis-label",kn="axis-tick",Sn="axis-title",Rn="legend",On="legend-band",wn="legend-entry",zn="legend-gradient",jn="legend-label",Pn="legend-symbol",Dn="legend-title",$n="title";function _n(e){return Ye.isObject(e)?Ye.extend({},e):{value:e}}function En(e,t,n,r){return null!=n?(Ye.isObject(n)&&!Ye.isArray(n)?e.update[t]=n:e[r||"enter"][t]={value:n},1):0}function Vn(e,t,n){for(var r in t)n&&n.hasOwnProperty(r)||(e[r]=Ye.extend(e[r]||{},t[r]));return e}function An(e,t,n,r,i,a){var o,l;for(l in(a=a||{}).encoders={$encode:o={}},e=function(r,e,t,n,i){var a,o,l={};"legend"!=t&&0!==String(t).indexOf("axis")||(t=null);for(a in o=t===hn?i.group:t===gn?Ye.extend({},i.mark,i[e]):null)Wn(a,r)||("fill"===a||"stroke"===a)&&(Wn("fill",r)||Wn("stroke",r))||(l[a]=Fn(o[a]));return Ye.array(n).forEach(function(e){var t=i.style&&i.style[e];for(var n in t)Wn(n,r)||(l[n]=Fn(t[n]))}),(r=Ye.extend({},r)).enter=Ye.extend(l,r.enter),r}(e,t,n,r,i.config))o[l]=pn(e[l],t,a,i);return a}function Fn(e){return e&&e.signal?{signal:e.signal}:{value:e}}function Wn(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function Ln(e,t,n,r,i,a,o){return{type:e,name:o?o.name:void 0,role:t,style:o&&o.style||n,key:r,from:i,interactive:!(!o||!o.interactive),encode:Vn(a,o,tn)}}function Cn(e,t,n){return He(t[e],n[e])}function Mn(e,t){return He(e.direction,t)===qt}function qn(e,t){return He(e.gradientLength,t.gradientLength||t.gradientWidth)}function Bn(e,t){return He(e.gradientThickness,t.gradientThickness||t.gradientHeight)}function Nn(e,t){var n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}var Tn="group",Un="rect",In="rule",Xn="symbol",Yn="text";var Gn="datum."+Ut+'<=0?"left":datum.'+Ut+'>=1?"right":"center"',Hn="datum."+Ut+'<=0?"bottom":datum.'+Ut+'>=1?"top":"middle"';function Jn(e,t,n,r){var i,a,o,l,s,u={value:0},d=Mn(e,t.gradientDirection),c=_n(Bn(e,t)),f=qn(e,t),p=Cn("labelOverlap",e,t),g="";return En(i={enter:a={opacity:u},update:o={opacity:{value:1},text:{field:Nt}},exit:{opacity:u}},"fill",Cn("labelColor",e,t)),En(i,"font",Cn("labelFont",e,t)),En(i,"fontSize",Cn("labelFontSize",e,t)),En(i,"fontWeight",Cn("labelFontWeight",e,t)),En(i,"fillOpacity",Cn("labelOpacity",e,t)),En(i,"limit",He(e.labelLimit,t.gradientLabelLimit)),d?(a.align={value:"left"},a.baseline=o.baseline={signal:Hn},l="y",s="x",g="1-"):(a.align=o.align={signal:Gn},a.baseline={value:"top"},l="x",s="y"),a[l]=o[l]={signal:g+"datum."+Ut,mult:f},a[s]=o[s]=c,c.offset=He(e.labelOffset,t.gradientLabelOffset)||0,e=Ln(Yn,jn,Gt,Yt,r,i,n),p&&(e.overlap={method:p,order:"datum."+Bt}),e}function Kn(e,t,n,r,i,a,o,l){return{type:Tn,name:n,role:e,style:t,from:r,interactive:i||!1,encode:a,marks:o,layout:l}}var Qn={value:0};function Zn(e,t){return{align:Cn("gridAlign",e,t),center:{row:!0,column:!1},columns:(n=e,r=t,He(n.columns,He(r.columns,+Mn(n,r.symbolDirection)))),padding:{row:Cn("rowPadding",e,t),column:Cn("columnPadding",e,t)}};var n,r}function er(e){return Ye.isObject(e)&&e.signal?e.signal:Ye.stringValue(e)}function tr(e){var t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")?e.type===Tn?mn:t||gn:t}function nr(e,t){var n=g.definition(e.type);n||Ye.error("Unrecognized transform type: "+Ye.stringValue(e.type));var r=xe(n.type.toLowerCase(),null,rr(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function rr(e,t,n){var r,i,a,o={};for(i=0,a=e.params.length;i<a;++i)o[(r=e.params[i]).name]=ir(r,t,n);return o}function ir(t,e,n){var r,i,a,o=t.type,l=e[t.name];if("index"===o)return function(e,t,n){Ye.isString(t.from)||Ye.error('Lookup "from" parameter must be a string literal.');return n.getData(t.from).lookupRef(n,t.key)}(0,e,n);{if(void 0!==l)return"param"===o?(i=n,a=e[(r=t).name],r.array?(Ye.isArray(a)||Ye.error("Expected an array of sub-parameters. Instead: "+Ye.stringValue(a)),a.map(function(e){return or(r,e,i)})):or(r,a,i)):"projection"===o?n.projectionRef(e[t.name]):t.array&&!$e(l)?l.map(function(e){return ar(t,e,n)}):ar(t,l,n);t.required&&Ye.error("Missing required "+Ye.stringValue(e.type)+" parameter: "+Ye.stringValue(t.name))}}function ar(e,t,n){var r=e.type;if($e(t))return lr(r)?Ye.error("Expression references can not be signals."):sr(r)?n.fieldRef(t):ur(r)?n.compareRef(t):n.signalRef(t.signal);var i,a,o=e.expr||sr(r);return o&&((a=t)&&a.expr)?n.exprRef(t.expr,t.as):o&&((i=t)&&i.field)?Re(t.field,t.as):lr(r)?Me(t,n):"data"===r?Ge(n.getData(t).values):sr(r)?Re(t):ur(r)?n.compareRef(t):t}function or(e,t,n){var r,i,a,o,l;for(o=0,l=e.params.length;o<l;++o){for(a in(i=e.params[o]).key)if(i.key[a]!==t[a]){i=null;break}if(i)break}return i||Ye.error("Unsupported parameter: "+Ye.stringValue(t)),r=Ye.extend(rr(i,t,n),i.key),Ge(n.add(dt(r)))}function lr(e){return"expr"===e}function sr(e){return"field"===e}function ur(e){return"compare"===e}function dr(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Ge(t.getData(e.data).output)}function cr(e,t,n,r,i){this.scope=e,this.input=t,this.output=n,this.values=r,this.aggregate=i,this.index={}}cr.fromEntries=function(e,t){var n=t.length,r=1,i=t[0],a=t[n-1],o=t[n-2],l=null;for(e.add(t[0]);r<n;++r)t[r].params.pulse=Ge(t[r-1]),e.add(t[r]),"aggregate"===t[r].type&&(l=t[r]);return new cr(e,i,o,a,l)};var fr=cr.prototype;function pr(e){return Ye.isString(e)?e:null}function gr(e,t,n){var r,i=je(n.op,n.field);if(t.ops){for(var a=0,o=t.as.length;a<o;++a)if(t.as[a]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function hr(e,t,n,r,i,a,o){var l,s,u,d=t[n]||(t[n]={}),c=(u=a,Ye.isObject(u)?(u.order===ze?"-":"+")+je(u.op,u.field):""),f=pr(i);if(null!=f&&(e=t.scope,l=d[f+=c?"|"+c:""]),!l){var p=a?{field:Oe,pulse:t.countsRef(e,i,a)}:{field:e.fieldRef(i),pulse:Ge(t.output)};c&&(p.sort=e.sortRef(a)),s=e.add(xe(r,void 0,p)),o&&(t.index[i]=s),l=Ge(s),null!=f&&(d[f]=l)}return l}function mr(e,t,n){var r,i=e.remove,a=e.insert,o=e.toggle,l=e.modify,s=e.values,u=t.add(ke());r=Me("if("+e.trigger+',modify("'+n+'",'+[a,i,o,l,s].map(function(e){return null==e?"null":e}).join(",")+"),0)",t),u.update=r.$expr,u.params=r.$params}function vr(e,n){var t,r,i,a,o,l,s,u,d,c,f,p,g,h,m,v,y,b,x,k,S,R,O,w,z,j,P,D,$,_,E,V,A,F,W,L,C,M,q,B,N,T,U=tr(e),I=e.type===Tn,X=e.from&&e.from.facet,Y=e.layout||U===mn||U===hn,G=U===gn||Y||X,H=e.overlap;h=e.from,m=I,v=n,h?(y=h.facet)&&(m||Ye.error("Only group marks can be faceted."),null!=y.field?k=S=dr(y,v):(h.data?S=Ge(v.getData(h.data).aggregate):((x=nr(Ye.extend({type:"aggregate",groupby:Ye.array(y.groupby)},y.aggregate),v)).params.key=v.keyRef(y.groupby),x.params.pulse=dr(y,v),k=S=Ge(v.add(x))),b=v.keyRef(y.groupby,!0))):k=Ge(v.add(Qe(null,[{}]))),k||(k=dr(h,v)),i={key:b,pulse:k,parent:S},d=Ge(r=n.add(Xe({key:i.key||(e.key?Re(e.key):void 0),pulse:i.pulse,clean:!I}))),r=a=n.add(Qe({pulse:d})),c=Ge(r=n.add(ot({markdef:(P=e,{marktype:P.type,name:P.name||void 0,role:P.role||tr(P),zindex:+P.zindex||void 0}),interactive:(z=e.interactive,j=n,z&&z.signal?j.signalRef(z.signal):!1!==z),clip:(R=e.clip,O=n,Ye.isObject(R)&&(R.signal?w=R.signal:R.path?w="pathShape("+er(R.path)+")":R.sphere&&(w="geoShape("+er(R.sphere)+', {type: "Sphere"})')),w?O.signalRef(w):!!R),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:Ge(r)}))),(r=n.add(Ze(An(e.encode,e.type,U,e.style,n,{pulse:c})))).params.parent=n.encode(),e.transform&&e.transform.forEach(function(e){var t=nr(e,n);(t.metadata.generates||t.metadata.changes)&&Ye.error("Mark transforms should not generate new data."),t.params.pulse=Ge(r),n.add(r=t)}),e.sort&&(r=n.add(yt({sort:n.compareRef(e.sort,!0),pulse:Ge(r)}))),f=Ge(r),(X||Y)&&(p=Ge(Y=n.add(bt({layout:n.objectProperty(e.layout),legendMargin:n.config.legendMargin,mark:c,pulse:f})))),g=Ge(o=n.add(Ue({mark:c,pulse:p||f}))),I&&(G&&((t=n.operators).pop(),Y&&t.pop()),n.pushState(f,p||g,d),X?(F=n,W=i,B=(A=e).from.facet,N=B.name,T=dr(B,F),B.name||Ye.error("Facet must have a name: "+Ye.stringValue(B)),B.data||Ye.error("Facet must reference a data set: "+Ye.stringValue(B)),B.field?q=F.add(ct({field:F.fieldRef(B.field),pulse:T})):B.groupby?q=F.add(tt({key:F.keyRef(B.groupby),group:Ge(F.proxy(W.parent)),pulse:T})):Ye.error("Facet must specify groupby or field: "+Ye.stringValue(B)),C=(L=F.fork()).add(Qe()),M=L.add(vt({pulse:Ge(C)})),L.addData(N,new cr(L,C,C,M)),L.addSignal("parent",null),q.params.subflow={$subflow:Pr(A,L).toRuntime()}):G?(D=e,_=i,E=($=n).add(ct({pulse:_.pulse})),(V=$.fork()).add(vt()),V.addSignal("parent",null),E.params.subflow={$subflow:Pr(D,V).toRuntime()}):Pr(e,n),n.popState(),G&&(Y&&t.push(Y),t.push(o))),H&&(g=function(e,t,n){var r,i=e.method,a=e.bound,o={method:$e(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(o.sort=n.compareRef({field:e.order}));a&&(r=a.tolerance,o.boundTolerance=$e(r)?n.signalRef(r.signal):+r,o.boundScale=n.scaleRef(a.scale),o.boundOrient=a.orient);return Ge(n.add(ut(o)))}(H,g,n)),l=n.add(ht({pulse:g})),s=n.add(vt({pulse:Ge(l)},void 0,n.parent())),null!=e.name&&(u=e.name,n.addData(u,new cr(n,a,l,s)),e.on&&e.on.forEach(function(e){(e.insert||e.remove||e.toggle)&&Ye.error("Marks only support modify triggers."),mr(e,n,u)}))}function yr(n,e){var t,r,i,a,o,l,s,u,d,c,f,p,g,h,m,v,y,b,x,k,S,R,O,w,z,j,P,D,$,_,E,V,A,F,W,L,C,M,q,B,N,T,U,I,X,Y,G,H,J,K,Q,Z,ee,te,ne,re,ie,ae,oe,le,se,ue,de,ce,fe,pe,ge,he,me,ve,ye,be,xe,ke,Se,Re,Oe,we,ze,je,Pe,De,$e,_e,Ee=e.config.legend,Ve=n.encode||{},Ae=Ve.legend||{},Fe=Ae.name||void 0,We=Ae.interactive,Le=Ae.style,Ce=en.reduce(function(e,t){return e||n[t]},0);return Ce||Ye.error("Missing valid scale for legend."),o=function(e,t){var n=e.type||Kt;e.type||1!==(i=e,en.reduce(function(e,t){return e+(i[t]?1:0)},0))||!e.fill&&!e.stroke||(r=t,n=wt.hasOwnProperty(r)?Qt:Pt(t)?Zt:Kt);var r;var i;return n!==Qt?n:Pt(t)?Zt:Qt}(n,e.scaleType(Ce)),l={orient:Cn("orient",n,Ee),title:null!=n.title,type:o},s=Ge(e.add(Qe(null,[l]))),Ae=Vn((En(p={enter:{},update:{}},"offset",Cn("offset",c=n,f=Ee)),En(p,"padding",Cn("padding",c,f)),En(p,"titlePadding",Cn("titlePadding",c,f)),En(p,"fill",Cn("fillColor",c,f)),En(p,"stroke",Cn("strokeColor",c,f)),En(p,"strokeWidth",Cn("strokeWidth",c,f)),En(p,"cornerRadius",Cn("cornerRadius",c,f)),En(p,"strokeDash",f.strokeDash),p),Ae,tn),t={enter:{x:{value:0},y:{value:0}}},u=Ge(e.add(it(i={type:o,scale:e.scaleRef(Ce),count:e.objectProperty(n.tickCount),values:e.objectProperty(n.values),formatSpecifier:e.property(n.format)}))),o===Qt?(a=[(ce=n,fe=Ce,pe=Ee,ge=Ve.gradient,ke={value:0},Se=Mn(ce,pe.gradientDirection),Re=Bn(ce,pe),Oe=qn(ce,pe),xe=Se?(ve=[0,1],ye=[0,0],be=Re,Oe):(ve=[0,0],ye=[1,0],be=Oe,Re),En(he={enter:me={opacity:ke,x:ke,y:ke,width:_n(be),height:_n(xe)},update:Ye.extend({},me,{opacity:{value:1},fill:{gradient:fe,start:ve,stop:ye}}),exit:{opacity:ke}},"stroke",Cn("gradientStrokeColor",ce,pe)),En(he,"strokeWidth",Cn("gradientStrokeWidth",ce,pe)),En(he,"opacity",Cn("gradientOpacity",ce,pe),"update"),Ln(Un,zn,null,void 0,void 0,he,ge)),Jn(n,Ee,Ve.labels,u)],i.count=i.count||e.signalRef("max(2,2*floor(("+Je(qn(n,Ee))+")/100))")):o===Zt?a=[(H=n,J=Ce,K=Ee,Q=Ve.gradient,Z=u,oe={value:0},le=Mn(H,K.gradientDirection),se=Bn(H,K),ue=qn(H,K),de="",le?(ne="y",ie="y2",re="x",ae="width",de="1-"):(ne="x",ie="x2",re="y",ae="height"),(te={opacity:oe,fill:{scale:J,field:Yt}})[ne]={signal:de+"datum."+Ut,mult:ue},te[re]=oe,te[ie]={signal:de+"datum."+It,mult:ue},te[ae]=_n(se),En(ee={enter:te,update:Ye.extend({},te,{opacity:{value:1}}),exit:{opacity:oe}},"stroke",Cn("gradientStrokeColor",H,K)),En(ee,"strokeWidth",Cn("gradientStrokeWidth",H,K)),En(ee,"opacity",Cn("gradientOpacity",H,K),"update"),Ln(Un,On,null,Yt,Z,ee,Q)),Jn(n,Ee,Ve.labels,u)]:(r=Zn(n,Ee),a=[(z=n,j=Ee,P=Ve,D=u,$=Je(r.columns),C=P.entries,M=!(!C||!C.interactive),q=C?C.name:void 0,B=Cn("clipHeight",z,j),N=Cn("symbolOffset",z,j),T={data:"value"},U={},I=$+"?datum."+Tt+":datum."+Xt,X=B?_n(B):{field:Xt},Y="datum."+Bt,G="max(1,"+$+")",X.mult=.5,U={enter:_={opacity:Qn,x:{signal:I,mult:.5,offset:N},y:X},update:E={opacity:{value:1},x:_.x,y:_.y},exit:{opacity:Qn}},z.fill||(En(U,"fill",j.symbolBaseFillColor),En(U,"stroke",j.symbolBaseStrokeColor)),En(U,"shape",Cn("symbolType",z,j)),En(U,"size",Cn("symbolSize",z,j)),En(U,"strokeWidth",Cn("symbolStrokeWidth",z,j)),En(U,"fill",Cn("symbolFillColor",z,j)),En(U,"stroke",Cn("symbolStrokeColor",z,j)),En(U,"opacity",Cn("symbolOpacity",z,j),"update"),en.forEach(function(e){z[e]&&(E[e]=_[e]={scale:z[e],field:Yt})}),A=Ln(Xn,Pn,null,Yt,T,U,P.symbols),B&&(A.clip=!0),(V=_n(N)).offset=Cn("labelOffset",z,j),En(U={enter:_={opacity:Qn,x:{signal:I,offset:V},y:X},update:E={opacity:{value:1},text:{field:Nt},x:_.x,y:_.y},exit:{opacity:Qn}},"align",Cn("labelAlign",z,j)),En(U,"baseline",Cn("labelBaseline",z,j)),En(U,"fill",Cn("labelColor",z,j)),En(U,"font",Cn("labelFont",z,j)),En(U,"fontSize",Cn("labelFontSize",z,j)),En(U,"fontWeight",Cn("labelFontWeight",z,j)),En(U,"limit",Cn("labelLimit",z,j)),En(U,"fillOpacity",Cn("labelOpacity",z,j)),F=Ln(Yn,jn,Gt,Yt,T,U,P.labels),U={enter:{noBound:{value:!0},width:Qn,height:B?_n(B):Qn,opacity:Qn},exit:{opacity:Qn},update:E={opacity:{value:1},row:{signal:null},column:{signal:null}}},L=Mn(z,j.symbolDirection)?(W="ceil(item.mark.items.length/"+G+")",E.row.signal=Y+"%"+W,E.column.signal="floor("+Y+"/"+W+")",{field:["row",Y]}):(E.row.signal="floor("+Y+"/"+G+")",E.column.signal=Y+"%"+G,{field:Y}),E.column.signal=$+"?"+E.column.signal+":"+Y,(z=Kn(mn,null,q,D={facet:{data:D,name:"value",groupby:Bt}},M,Vn(U,C,tn),[A,F])).sort=L,z)],i.size=(g=n,h=e,m=a[0].marks,b=Nn("strokeWidth",m[0].encode),y=g.size?'scale("'+g.size+'",datum)':Nn("size",m[0].encode),x=m[1].encode,k=h,S=Gt,v=Nn("fontSize",x)||(R="fontSize",O=S,(w=k.config.style[O])&&w[R]),Me("max(ceil(sqrt("+Je(y)+")+"+Je(b)+"),"+Je(v)+")",h))),a=[Kn(wn,null,null,s,We,t,a,r)],l.title&&a.push((we=n,ze=Ee,je=Ve.title,Pe=s,En(De={enter:$e={opacity:_e={value:0},x:{field:{group:"padding"}},y:{field:{group:"padding"}}},update:{opacity:{value:1},text:_n(we.title),x:$e.x,y:$e.y},exit:{opacity:_e}},"align",Cn("titleAlign",we,ze)),En(De,"baseline",Cn("titleBaseline",we,ze)),En(De,"fill",Cn("titleColor",we,ze)),En(De,"font",Cn("titleFont",we,ze)),En(De,"fontSize",Cn("titleFontSize",we,ze)),En(De,"fontWeight",Cn("titleFontWeight",we,ze)),En(De,"limit",Cn("titleLimit",we,ze)),En(De,"fillOpacity",Cn("titleOpacity",we,ze)),Ln(Yn,Dn,Ht,null,Pe,De,je))),d=Kn(Rn,Le,Fe,s,We,Ae,a),n.zindex&&(d.zindex=n.zindex),vr(d,e)}function br(e,t,n){return'item.anchor==="start"?'+e+':item.anchor==="end"?'+t+":"+n}fr.countsRef=function(e,t,n){var r,i,a,o=this.counts||(this.counts={}),l=pr(t);return null!=l&&(e=this.scope,r=o[l]),r?n&&n.field&&gr(e,r.agg.params,n):(a={groupby:e.fieldRef(t,"key"),pulse:Ge(this.output)},n&&n.field&&gr(e,a,n),r={agg:i=e.add(Te(a)),ref:Ge(r=e.add(Qe({pulse:Ge(i)})))},null!=l&&(o[l]=r)),r.ref},fr.tuplesRef=function(){return Ge(this.values)},fr.extentRef=function(e,t){return hr(e,this,"extent","extent",t,!1)},fr.domainRef=function(e,t){return hr(e,this,"domain","values",t,!1)},fr.valuesRef=function(e,t,n){return hr(e,this,"vals","values",t,n||!0)},fr.lookupRef=function(e,t){return hr(e,this,"lookup","tupleindex",t,!1)},fr.indataRef=function(e,t){return hr(e,this,"indata","tupleindex",t,!0,!0)};var xr=br(Ye.stringValue(Lt),Ye.stringValue(Ct),Ye.stringValue("center")),kr=br('+(item.orient==="'+Ct+'")','+(item.orient!=="'+Lt+'")',"0.5");function Sr(e,t){e=Ye.isString(e)?{text:e}:e;var n,r,i,a=t.config.title,o=Ye.extend({},e.encode);return n={orient:Cn("orient",e,a)},r=Ge(t.add(Qe(null,[n]))),o.name=e.name,o.interactive=e.interactive,i=function(e,t,n,r){var i,a,o,l,s,u={value:0},d=e.text,c=Cn("orient",e,t),f=Cn("anchor",e,t),p=c===Lt||c===Wt?-1:1,g=c===Wt||c===Mt,h={group:g?"width":"height"};l={field:h,mult:{signal:kr}},s=p<0?u:g?{field:{group:"height"}}:{field:{group:"width"}},i={enter:a={opacity:u},update:o={opacity:{value:1},text:_n(d),anchor:_n(f),orient:_n(c),extent:{field:h},align:{signal:xr}},exit:{opacity:u}},a.baseline=g?(o.x=l,o.y=s,a.angle=u,{value:c===Wt?Mt:Wt}):(o.x=s,o.y=l,a.angle={value:90*p},{value:Mt});return En(i,"align",Cn("align",e,t),"update"),En(i,"angle",Cn("angle",e,t)),En(i,"baseline",Cn("baseline",e,t)),En(i,"fill",Cn("color",e,t)),En(i,"font",Cn("font",e,t)),En(i,"fontSize",Cn("fontSize",e,t)),En(i,"fontWeight",Cn("fontWeight",e,t)),En(i,"frame",Cn("frame",e,t)),En(i,"limit",Cn("limit",e,t)),En(i,"offset",Cn("offset",e,t)||0),Ln(Yn,$n,e.style||Jt,null,r,i,n)}(e,a,o,r),e.zindex&&(i.zindex=e.zindex),vr(i,t)}function Rr(t,n){var r=[];t.transform&&t.transform.forEach(function(e){r.push(nr(e,n))}),t.on&&t.on.forEach(function(e){mr(e,n,t.name)}),n.addDataPipeline(t.name,function(e,t,n){var r,i,a,o,l,s=[],u=null,d=!1,c=!1;e.values?s.push(u=Or({$ingest:e.values,$format:e.format})):e.url?(u=_e(e.url)||_e(e.format)?{$load:Ge(t.add((f=t,p=e,at({url:f.property(p.url),format:f.objectProperty(p.format)}))))}:{$request:e.url,$format:e.format},s.push(u=Or(u))):e.source&&(u=r=Ye.array(e.source).map(function(e){return Ge(t.getData(e).output)}),s.push(null));var f,p;for(i=0,a=n.length;i<a;++i)o=n[i],l=o.metadata,u||l.source||s.push(u=Or()),s.push(o),l.generates&&(c=!0),l.modifies&&!c&&(d=!0),l.source?u=o:l.changes&&(u=null);r&&(a=r.length-1,s[0]=gt({derive:d,pulse:a?r:r[0]}),(d||a)&&s.splice(1,0,Or()));u||s.push(Or());return s.push(vt({})),s}(t,n,r))}function Or(e){var t=Qe({},e);return t.metadata={source:!0},t}function wr(e,t){return{scale:e.scale,range:t}}function zr(e,t,n,r,i){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+r+","+i+")"}}function jr(e,t){var n,r,i,a,o,l,s,u,d,c,f,p,g,h,m,v,y,b,x,k,S,R,O,w,z,j,P,D,$,_,E,V,A,F,W,L,C,M,q,B,N,T,U,I,X,Y,G,H,J,K,Q,Z,ee,te,ne,re,ie,ae,oe,le,se,ue,de,ce,fe,pe,ge,he,me,ve,ye,be,xe,ke,Se,Re,Oe,we,ze,je,Pe,De,$e,_e,Ee,Ve,Ae,Fe,We,Le,Ce,Me,qe,Be=(s=e,d=(u=t).config,c=s.orient,f=c===Wt||c===Mt?d.axisX:d.axisY,p=d["axis"+c[0].toUpperCase()+c.slice(1)],g="band"===u.scaleType(s.scale)&&d.axisBand,f||p||g?Ye.extend({},d.axis,f,p,g):d.axis),Ne=e.encode||{},Te=Ne.axis||{},Ue=Te.name||void 0,Ie=Te.interactive,Xe=Te.style;return n={orient:e.orient,ticks:!!Cn("ticks",e,Be),labels:!!Cn("labels",e,Be),grid:!!Cn("grid",e,Be),domain:!!Cn("domain",e,Be),title:!!He(e.title,!1)},r=Ge(t.add(Qe({},[n]))),Te=Vn({update:{range:{signal:'abs(span(range("'+e.scale+'")))'},offset:_n(He(e.offset,0)),position:_n(He(e.position,0)),titlePadding:_n(Cn("titlePadding",e,Be)),minExtent:_n(Cn("minExtent",e,Be)),maxExtent:_n(Cn("maxExtent",e,Be))}},Ne.axis,tn),i=Ge(t.add(Ke({scale:t.scaleRef(e.scale),extra:t.property(Cn("tickExtra",e,Be)),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),formatSpecifier:t.property(e.format)}))),l=[],n.grid&&l.push((h=e,m=Be,v=Ne.grid,y=i,P=h.orient,D=h.gridScale,_=($=P===Lt||P===Wt?1:-1)*h.offset||0,En(b={enter:x={opacity:E={value:0}},update:S={opacity:{value:1}},exit:k={opacity:E}},"stroke",Cn("gridColor",h,m)),En(b,"strokeDash",Cn("gridDash",h,m)),En(b,"strokeOpacity",Cn("gridOpacity",h,m)),En(b,"strokeWidth",Cn("gridWidth",h,m)),R={scale:h.scale,field:Yt,band:Cn("bandPosition",h,m),round:Cn("tickRound",h,m),extra:Cn("tickExtra",h,m),offset:Cn("tickOffset",h,m)},j=P===Wt||P===Mt?(O="x",w="y","height"):(O="y",w="x","width"),z=w+"2",S[O]=x[O]=k[O]=R,S[z]=x[z]=D?(x[w]={scale:D,range:0,mult:$,offset:_},{scale:D,range:1,mult:$,offset:_}):(x[w]={value:_},{signal:j,mult:$,offset:_}),Ln(In,bn,null,Yt,y,b,v))),n.ticks&&(a=Cn("tickSize",e,Be),l.push((V=e,A=Be,F=Ne.ticks,W=i,L=a,U=V.orient,I=U===Lt||U===Wt?-1:1,En(C={enter:M={opacity:X={value:0}},update:B={opacity:{value:1}},exit:q={opacity:X}},"stroke",Cn("tickColor",V,A)),En(C,"strokeOpacity",Cn("tickOpacity",V,A)),En(C,"strokeWidth",Cn("tickWidth",V,A)),(N=_n(L)).mult=I,T={scale:V.scale,field:Yt,band:Cn("bandPosition",V,A),round:Cn("tickRound",V,A),extra:Cn("tickExtra",V,A),offset:Cn("tickOffset",V,A)},U===Wt||U===Mt?(B.y=M.y=X,B.y2=M.y2=N,B.x=M.x=q.x=T):(B.x=M.x=X,B.x2=M.x2=N,B.y=M.y=q.y=T),Ln(In,kn,null,Yt,W,C,F)))),n.labels&&(a=n.ticks?a:0,l.push((Y=e,G=Be,H=Ne.labels,J=i,K=a,le=Y.orient,se=le===Lt||le===Wt?-1:1,ue=le===Wt||le===Mt,de=Y.scale,ce=Je(Cn("labelFlush",Y,G)),fe=Je(Cn("labelFlushOffset",Y,G)),pe=0===ce||!!ce,ge=Cn("labelAlign",Y,G),he=Cn("labelBaseline",Y,G),me={value:0},(ee=_n(K)).mult=se,ee.offset=_n(Cn("labelPadding",Y,G)||0),ee.offset.mult=se,te={scale:de,field:Yt,band:.5,offset:Cn("tickOffset",Y,G)},ie=(ie=ue?(ne=ge||(pe?zr(de,ce,'"left"','"right"','"center"'):"center"),re=he||(le===Wt?"bottom":"top"),!ge):(ne=ge||(le===Ct?"left":"right"),re=he||(pe?zr(de,ce,'"top"','"bottom"','"middle"'):"middle"),!he))&&pe&&fe?zr(de,ce,"-"+fe,fe,0):null,En(Q={enter:Z={opacity:me,x:ue?te:ee,y:ue?ee:te},update:{opacity:{value:1},text:{field:Nt},x:Z.x,y:Z.y},exit:{opacity:me,x:Z.x,y:Z.y}},ue?"dx":"dy",ie),En(Q,"align",ne),En(Q,"baseline",re),En(Q,"angle",Cn("labelAngle",Y,G)),En(Q,"fill",Cn("labelColor",Y,G)),En(Q,"font",Cn("labelFont",Y,G)),En(Q,"fontSize",Cn("labelFontSize",Y,G)),En(Q,"fontWeight",Cn("labelFontWeight",Y,G)),En(Q,"limit",Cn("labelLimit",Y,G)),En(Q,"fillOpacity",Cn("labelOpacity",Y,G)),ae=Cn("labelBound",Y,G),oe=Cn("labelOverlap",Y,G),Y=Ln(Yn,xn,Gt,Yt,J,Q,H),(oe||ae)&&(Y.overlap={method:oe,order:"datum.index",bound:ae?{scale:de,orient:le,tolerance:ae}:null}),Y))),n.domain&&l.push((ve=e,ye=Be,be=Ne.domain,xe=r,je=ve.orient,En(ke={enter:Se={opacity:Pe={value:0}},update:Re={opacity:{value:1}},exit:{opacity:Pe}},"stroke",Cn("domainColor",ve,ye)),En(ke,"strokeWidth",Cn("domainWidth",ve,ye)),En(ke,"strokeOpacity",Cn("domainOpacity",ve,ye)),ze=je===Wt||je===Mt?(Oe="x","y"):(Oe="y","x"),we=Oe+"2",Se[ze]=Pe,Re[Oe]=Se[Oe]=wr(ve,0),Re[we]=Se[we]=wr(ve,1),Ln(In,yn,null,null,xe,ke,be))),n.title&&l.push((De=e,$e=Be,_e=Ne.title,Ee=r,Le=De.orient,Ce=Le===Lt||Le===Wt?-1:1,Me=Le===Wt||Le===Mt,Ve={enter:Ae={opacity:qe={value:0}},update:Fe={opacity:{value:1},text:_n(De.title)},exit:{opacity:qe}},We={scale:De.scale,range:.5},Ae.baseline=Me?(Fe.x=We,Ae.angle={value:0},{value:Le===Wt?"bottom":"top"}):(Fe.y=We,Ae.angle={value:90*Ce},{value:"bottom"}),En(Ve,"align",Cn("titleAlign",De,$e)),En(Ve,"angle",Cn("titleAngle",De,$e)),En(Ve,"baseline",Cn("titleBaseline",De,$e)),En(Ve,"fill",Cn("titleColor",De,$e)),En(Ve,"font",Cn("titleFont",De,$e)),En(Ve,"fontSize",Cn("titleFontSize",De,$e)),En(Ve,"fontWeight",Cn("titleFontWeight",De,$e)),En(Ve,"limit",Cn("titleLimit",De,$e)),En(Ve,"fillOpacity",Cn("titleOpacity",De,$e)),!En(Ve,"x",Cn("titleX",De,$e),"update")&&Me&&!Wn("x",_e)&&(Ve.enter.auto={value:!0}),!En(Ve,"y",Cn("titleY",De,$e),"update")&&!Me&&!Wn("y",_e)&&(Ve.enter.auto={value:!0}),Ln(Yn,Sn,Ht,null,Ee,Ve,_e))),o=Kn(vn,Xe,Ue,r,Ie,Te,l),e.zindex&&(o.zindex=e.zindex),vr(o,t)}function Pr(e,i,t){var n=Ye.array(e.signals),r=Ye.array(e.scales);return t||n.forEach(function(e){m(e,i)}),Ye.array(e.projections).forEach(function(e){!function(e,t){var n={};for(var r in e)"name"!==r&&(n[r]=Ft(e[r],r,t));t.addProjection(e.name,n)}(e,i)}),r.forEach(function(e){var t,n,r;n=i,r=(t=e).type||"linear",Rt.hasOwnProperty(r)||Ye.error("Unrecognized scale type: "+Ye.stringValue(r)),n.addScale(t.name,{type:r,domain:void 0})}),Ye.array(e.data).forEach(function(e){Rr(e,i)}),r.forEach(function(e){$t(e,i)}),n.forEach(function(e){Be(e,i)}),Ye.array(e.axes).forEach(function(e){jr(e,i)}),Ye.array(e.marks).forEach(function(e){vr(e,i)}),Ye.array(e.legends).forEach(function(e){yr(e,i)}),e.title&&Sr(e.title,i),i.parseLambdas(),i}var Dr=Ye.toSet(["width","height","padding","autosize"]);function $r(e,t){var n,r,i,a,o,l,s,u,d,c,f=t.config;return t.background=e.background||f.background,t.eventConfig=f.events,o=Ge(t.root=t.add(ke())),t.addSignal("width",e.width||0),t.addSignal("height",e.height||0),t.addSignal("padding",(l=e.padding,s=f,l=l||s.padding,Ye.isObject(l)?{top:h(l.top),bottom:h(l.bottom),left:h(l.left),right:h(l.right)}:{top:u=h(l),bottom:u,left:u,right:u})),t.addSignal("autosize",(d=e.autosize,c=f,d=d||c.autosize,Ye.isObject(d)?d:{type:d=d||"pad"})),Ye.array(e.signals).forEach(function(e){Dr[e.name]||m(e,t)}),r=t.add(Qe()),i=Vn({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),i=t.add(Ze(An(i,Tn,hn,e.style,t,{pulse:Ge(r)}))),a=t.add(bt({layout:t.objectProperty(e.layout),legendMargin:f.legendMargin,autosize:t.signalRef("autosize"),mark:o,pulse:Ge(i)})),t.operators.pop(),t.pushState(Ge(i),Ge(a),null),Pr(e,t,!0),t.operators.push(a),n=t.add(Ue({mark:o,pulse:Ge(a)})),n=t.add(ht({pulse:Ge(n)})),n=t.add(vt({pulse:Ge(n)})),t.addData("root",new cr(t,r,r,n)),t}function _r(e){this.config=e,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function Er(e){this.config=e.config,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}var Vr=_r.prototype=Er.prototype;function Ar(e){return(Ye.isArray(e)?function(e){for(var t,n="[",r=0,i=e.length;r<i;++r)t=e[r],n+=(0<r?",":"")+(Ye.isObject(t)?t.signal||Ar(t):Ye.stringValue(t));return n+"]"}:function(e){var t,n,r="{",i=0;for(t in e)n=e[t],r+=(1<++i?",":"")+Ye.stringValue(t)+":"+(Ye.isObject(n)?n.signal||Ar(n):Ye.stringValue(n));return r+"}"})(e)}function Fr(e){var i={padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:Mr},area:{fill:Mr},image:null,line:{stroke:Mr,strokeWidth:Cr},path:{stroke:Mr},rect:{fill:Mr},rule:{stroke:qr},shape:{stroke:Mr},symbol:{fill:Mr,size:64},text:{fill:qr,font:Wr,fontSize:11},style:{"guide-label":{fill:qr,font:Wr,fontSize:10},"guide-title":{fill:qr,font:Wr,fontSize:11,fontWeight:"bold"},"group-title":{fill:qr,font:Wr,fontSize:13,fontWeight:"bold"},point:{size:Lr,strokeWidth:Cr,shape:"circle"},circle:{size:Lr,strokeWidth:Cr},square:{size:Lr,strokeWidth:Cr,shape:"square"},cell:{fill:"transparent",stroke:Nr}},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:Br,grid:!1,gridWidth:1,gridColor:Nr,labels:!0,labelAngle:0,labelLimit:180,labelPadding:2,ticks:!0,tickColor:Br,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titleAlign:"center",titlePadding:4},axisBand:{tickOffset:-1},legend:{orient:"right",offset:18,padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:Nr,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:Br,titleAlign:"left",titleBaseline:"top",titleLimit:180,titlePadding:5},title:{orient:"top",anchor:"middle",offset:4},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues",extent:[.2,1]},heatmap:{scheme:"viridis"},ramp:{scheme:"blues",extent:[.2,1]},diverging:{scheme:"blueorange"},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}};return(e||[]).forEach(function(e){var t,n,r;if(e)for(t in e)if("style"===t)for(t in r=i.style||(i.style={}),e.style)r[t]=Ye.extend(r[t]||{},e.style[t]);else n=e[t],i[t]=Ye.isObject(n)&&!Ye.isArray(n)?Ye.extend(Ye.isObject(i[t])?i[t]:{},n):n}),i}Vr.fork=function(){return new Er(this)},Vr.isSubscope=function(){return 0<this._subid},Vr.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},Vr.id=function(){return(this._subid?this._subid+":":0)+this._id++},Vr.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach(function(e){e.$ref=t.id}),t.refs=null),t},Vr.proxy=function(e){var t=e instanceof be?Ge(e):e;return this.add(pt({value:t}))},Vr.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},Vr.addUpdate=function(e){return this.updates.push(e),e},Vr.finish=function(){var e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){var r;e&&((r=e.data||(e.data={}))[t]||(r[t]=[])).push(n)}for(e in this.data)for(var r in n((t=this.data[e]).input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values"),t.index)n(t.index[r],e,"index:"+r);return this},Vr.pushState=function(e,t,n){this._encode.push(Ge(this.add(vt({pulse:e})))),this._parent.push(t),this._lookup.push(n?Ge(this.proxy(n)):null),this._markpath.push(-1)},Vr.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},Vr.parent=function(){return Ye.peek(this._parent)},Vr.encode=function(){return Ye.peek(this._encode)},Vr.lookup=function(){return Ye.peek(this._lookup)},Vr.markpath=function(){var e=this._markpath;return++e[e.length-1]},Vr.fieldRef=function(e,t){if(Ye.isString(e))return Re(e,t);e.signal||Ye.error("Unsupported field reference: "+Ye.stringValue(e));var n,r=e.signal,i=this.field[r];return i||(n={name:this.signalRef(r)},t&&(n.as=t),this.field[r]=i=Ge(this.add(nt(n)))),i},Vr.compareRef=function(e,t){function n(e){return $e(e)?(i=!0,Ge(r[e.signal])):e}var r=this.signals,i=!1,a=Ye.array(e.field).map(n),o=Ye.array(e.order).map(n);return t&&a.push(Se),i?Ge(this.add(Ie({fields:a,orders:o}))):we(a,o)},Vr.keyRef=function(e,t){var n,r=this.signals,i=!1;return e=Ye.array(e).map(function(e){return $e(e)?(i=!0,Ge(r[e.signal])):e}),i?Ge(this.add(rt({fields:e,flat:t}))):(n={$key:e},t&&(n.$flat=!0),n)},Vr.sortRef=function(e){if(!e)return e;var t=[je(e.op,e.field),Se],n=e.order||"ascending";return n.signal?Ge(this.add(Ie({fields:t,orders:[n=this.signalRef(n.signal),n]}))):we(t,[n,n])},Vr.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},Vr.addSignal=function(e,t){this.signals.hasOwnProperty(e)&&Ye.error("Duplicate signal name: "+Ye.stringValue(e));var n=t instanceof be?t:this.add(ke(t));return this.signals[e]=n},Vr.getSignal=function(e){return this.signals[e]||Ye.error("Unrecognized signal name: "+Ye.stringValue(e)),this.signals[e]},Vr.signalRef=function(e){return this.signals[e]?Ge(this.signals[e]):(this.lambdas.hasOwnProperty(e)||(this.lambdas[e]=this.add(ke(null))),Ge(this.lambdas[e]))},Vr.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,n=e.length;t<n;++t){var r=e[t],i=Me(r,this),a=this.lambdas[r];a.params=i.$params,a.update=i.$expr}},Vr.property=function(e){return e&&e.signal?this.signalRef(e.signal):e},Vr.objectProperty=function(e){return e&&Ye.isObject(e)?this.signalRef(e.signal||Ar(e)):e},Vr.exprRef=function(e,t){var n={expr:Me(e,this)};return t&&(n.expr.$name=t),Ge(this.add(et(n)))},Vr.addBinding=function(e,t){this.bindings||Ye.error("Nested signals do not support binding: "+Ye.stringValue(e)),this.bindings.push(Ye.extend({signal:e},t))},Vr.addScaleProj=function(e,t){this.scales.hasOwnProperty(e)&&Ye.error("Duplicate scale or projection name: "+Ye.stringValue(e)),this.scales[e]=this.add(t)},Vr.addScale=function(e,t){this.addScaleProj(e,mt(t))},Vr.addProjection=function(e,t){this.addScaleProj(e,ft(t))},Vr.getScale=function(e){return this.scales[e]||Ye.error("Unrecognized scale name: "+Ye.stringValue(e)),this.scales[e]},Vr.projectionRef=Vr.scaleRef=function(e){return Ge(this.getScale(e))},Vr.projectionType=Vr.scaleType=function(e){return this.getScale(e).params.type},Vr.addData=function(e,t){return this.data.hasOwnProperty(e)&&Ye.error("Duplicate data set name: "+Ye.stringValue(e)),this.data[e]=t},Vr.getData=function(e){return this.data[e]||Ye.error("Undefined data set name: "+Ye.stringValue(e)),this.data[e]},Vr.addDataPipeline=function(e,t){return this.data.hasOwnProperty(e)&&Ye.error("Duplicate data set name: "+Ye.stringValue(e)),this.addData(e,cr.fromEntries(this,t))};var Wr="sans-serif",Lr=30,Cr=2,Mr="#4c78a8",qr="#000",Br="#888",Nr="#ddd";e.formatLocale=n.formatDefaultLocale,e.timeFormatLocale=r.timeFormatDefaultLocale,e.parse=function(e,t){return Ye.isObject(e)||Ye.error("Input Vega specification must be an object."),$r(e,new _r(Fr([t,e.config]))).toRuntime()},e.config=Fr,e.signal=m,e.signalUpdates=Be,e.stream=Ve,e.codeGenerator=ve,e.functionContext=fe,e.expressionFunction=he,e.MarkRole=gn,e.FrameRole=hn,e.ScopeRole=mn,e.AxisRole=vn,e.AxisDomainRole=yn,e.AxisGridRole=bn,e.AxisLabelRole=xn,e.AxisTickRole=kn,e.AxisTitleRole=Sn,e.LegendRole=Rn,e.LegendEntryRole=wn,e.LegendLabelRole=jn,e.LegendSymbolRole=Pn,e.LegendTitleRole=Dn,e.Scope=_r,e.DataScope=cr,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-statistics"),require("d3-color"),require("d3-array"),require("vega-scale"),require("d3-geo"),require("vega-scenegraph"),require("vega-expression"),require("vega-event-selector"),require("vega-dataflow"),require("vega-util"),require("d3-format"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","vega-statistics","d3-color","d3-array","vega-scale","d3-geo","vega-scenegraph","vega-expression","vega-event-selector","vega-dataflow","vega-util","d3-format","d3-time-format"],t):t(e.vega={},e.vega,e.d3,e.d3,e.vega,e.d3,e.vega,e.vega,e.vega,e.vega,e.vega,e.d3,e.d3)}(this,function(e,t,n,r,f,i,p,o,u,g,Ye,a,l){"use strict";function h(e){return+e||0}var s="outer",d=["value","update","init","react","bind"];function c(e,t){Ye.error(e+' for "outer" push: '+Ye.stringValue(t))}function m(t,e){var n=t.name;if(t.push===s)e.signals[n]||c("No prior signal definition",n),d.forEach(function(e){void 0!==t[e]&&c("Invalid property ",e)});else{var r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}var v={};function y(e,t,n){var r=e+":"+n,i=v[r];return i&&i[0]===t||(v[r]=i=[t,t(n)]),i[1]}function b(e,t){return y("timeFormat",l.timeFormat,t)(e)}var x=new Date(2e3,0,1);function k(e,t,n){return x.setMonth(e),x.setDate(t),b(x,n)}function S(e,t,n,r){var i,a=t[0],o=t[t.length-1];return o<a&&(i=a,a=o,o=i),r=void 0===r||r,((n=void 0===n||n)?a<=e:a<e)&&(r?e<=o:e<o)}function R(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}var O="undefined"!=typeof window&&window||null;var w="Literal",z="%",j=":";function P(e,t){var n;return Ye.isFunction(e)?e:Ye.isString(e)?(n=t.scales[e])&&n.value:void 0}function D(e,t,n){var r=z+n;if(!t.hasOwnProperty(r))try{t[r]=e.scaleRef(n)}catch(e){}}function $(e,t,n,r){if(t[0].type===w)D(n,r,t[0].value);else if("Identifier"===t[0].type)for(e in n.scales)D(n,r,e)}function _(i,a){return function(e,t,n){if(e){var r=P(e,(n||this).context);return r&&r.path[i](t)}return a(t)}}var E=_("area",i.geoArea),V=_("bounds",i.geoBounds),A=_("centroid",i.geoCentroid);function F(e){var t=this.context.data[e];return t?t.values.value:[]}function W(e,t,n,r){t[0].type!==w&&Ye.error("First argument to data functions must be a string literal.");var i=t[0].value,a=j+i;r.hasOwnProperty(a)||(r[a]=n.getData(i).tuplesRef())}var L={};function C(e){return e.data}function M(e,t){var n=F.call(t,e);return n.root&&n.root.lookup||L}function q(e,t){return e===t||e!=e&&t!=t||!(!Ye.isArray(e)||!Ye.isArray(t)||e.length!==t.length)&&function(e,t){for(var n=0,r=e.length;n<r;++n)if(!q(e[n],t[n]))return!1;return!0}(e,t)}function B(n){return function(e){for(var t in n)if(!q(e[t],n[t]))return!1;return!0}}var N="E",T="R",U="R-E",I="R-LE",X="R-RE",Y="intersect",G="index:unit";function H(e,t){for(var n,r,i=t.fields,a=t.values,o=i.length,l=0;l<o;++l)if((r=i[l]).getter=Ye.field.getter||Ye.field(r.field),n=r.getter(e),Ye.isDate(n)&&(n=Ye.toNumber(n)),Ye.isDate(a[l])&&(a[l]=Ye.toNumber(a[l])),Ye.isDate(a[l][0])&&(a[l]=a[l].map(Ye.toNumber)),r.type===N){if(Ye.isArray(a[l])?a[l].indexOf(n)<0:n!==a[l])return!1}else if(r.type===T){if(!S(n,a[l]))return!1}else if(r.type===X){if(!S(n,a[l],!0,!1))return!1}else if(r.type===U){if(!S(n,a[l],!1,!1))return!1}else if(r.type===I&&!S(n,a[l],!1,!0))return!1;return!0}function J(e,t,n,r){t[0].type!==w&&Ye.error("First argument to indata must be a string literal.");var i=t[0].value;(2<=t.length&&t[t.length-1].value)!==Y||r.hasOwnProperty("@unit")||(r["@unit"]=n.getData(i).indataRef(n,"unit")),W(0,t,n,r)}var K={E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;n<r;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter(function(e){return 0<=t.indexOf(e)}):t},R_union:function(e,t){var n=Ye.toNumber(t[0]),r=Ye.toNumber(t[1]);return r<n&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<r&&(e[1]=r),e):[n,r]},R_intersect:function(e,t){var n=Ye.toNumber(t[0]),r=Ye.toNumber(t[1]);return r<n&&(n=t[1],r=t[0]),e.length?r<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>r&&(e[1]=r),e):[n,r]}},Q="bin_",Z="intersect",ee="union",te="index:unit";function ne(e,t){for(var n,r=t.fields,i=t.values,a=t.getter||(t.getter=[]),o=r.length,l=0;l<o;++l)if(a[l]=a[l]||Ye.field(r[l]),n=a[l](e),Ye.isDate(n)&&(n=Ye.toNumber(n)),Ye.isDate(i[l])&&(i[l]=Ye.toNumber(i[l])),t[Q+r[l]]){if(Ye.isDate(i[l][0])&&(i[l]=i[l].map(Ye.toNumber)),!S(n,i[l],!0,!1))return!1}else if(n!==i[l])return!1;return!0}function re(e,t){for(var n,r,i=t.intervals,a=i.length,o=0;o<a;++o){if(n=i[o].extent,r=(i[o].getter||(i[o].getter=Ye.field(i[o].field)))(e),!n||n[0]===n[1])return!1;if(Ye.isDate(r)&&(r=Ye.toNumber(r)),Ye.isDate(n[0])&&(n=i[o].extent=n.map(Ye.toNumber)),Ye.isNumber(n[0])&&!S(r,n))return!1;if(Ye.isString(n[0])&&n.indexOf(r)<0)return!1}return!0}function ie(e,t,n,r){for(var i,a,o,l,s,u=this.context.data[e],d=u?u.values.value:[],c=u?u[te]&&u[te].value:void 0,f=n===Z,p=d.length,g=0;g<p;++g)if(i=d[g],c&&f){if(-1===(o=(a=a||{})[l=i.unit]||0))continue;if(s=r(t,i),a[l]=s?-1:++o,s&&1===c.size)return!0;if(!s&&o===c.get(l).count)return!1}else if(f^(s=r(t,i)))return s;return p&&f}function ae(e,t,n){return ie.call(this,e,t,n,ne)}function oe(e,t,n,r){t[0].type!==w&&Ye.error("First argument to indata must be a string literal.");var i=t[0].value;(2<=t.length&&t[t.length-1].value)!==Z||r.hasOwnProperty("@unit")||(r["@unit"]=n.getData(i).indataRef(n,"unit")),W(0,t,n,r)}function le(e,t,n,r){var i,a,o,l,s,u=this.context.data[e],d=u?u.values.value:[],c=u?u[te]&&u[te].value:void 0,f=d[0],p=0;if(f){for(i=t?f.encodings.length:f.fields.length;p<i;++p)if(t&&f.encodings[p]===t||n&&f.fields[p]===n){a=p,l=f[Q+f.fields[p]];break}return c&&1===c.size&&(r=ee),o=c&&r===Z?(s=d.reduce(function(e,t){return(e[t.unit]||(e[t.unit]=[])).push({unit:t.unit,value:t.values[a]}),e},{}),Object.keys(s).map(function(e){return{unit:e,value:l?ue(s[e],ee):se(s[e],ee)}})):d.map(function(e){return{unit:e.unit,value:e.values[a]}}),l?ue(o,r):se(o,r)}}function se(e,t){for(var n,r,i,a,o={},l=0,s={},u=[],d=0,c=e.length;d<c;++d)r=(n=e[d]).unit,a=n.value,o[r]||(o[r]=++l),(i=s[a])||(s[a]=i={value:a,units:{},count:0}),i.units[r]||(i.units[r]=++i.count);for(a in s)i=s[a],t===Z&&i.count!==l||u.push(i.value);return u.length?u:void 0}function ue(e,t){for(var n,r,i,a,o=t===Z?ce:de,l=0,s=e.length;l<s;++l)n=e[l].value,Ye.isDate(n[0])&&(n=n.map(Ye.toNumber)),i=n[0],(a=n[1])<i&&(a=n[0],i=n[1]),r=r?o(r,i,a):[i,a];return r&&r.length&&+r[0]!=+r[1]?r:void 0}function de(e,t,n){return e[0]>t&&(e[0]=t),e[1]<n&&(e[1]=n),e}function ce(e,t,n){return n<e[0]||e[1]<t?[]:(e[0]<t&&(e[0]=t),e[1]>n&&(e[1]=n),e)}var fe={random:function(){return t.random()},isArray:Ye.isArray,isBoolean:Ye.isBoolean,isDate:Ye.isDate,isNumber:Ye.isNumber,isObject:Ye.isObject,isRegExp:Ye.isRegExp,isString:Ye.isString,isTuple:g.isTuple,toBoolean:Ye.toBoolean,toDate:Ye.toDate,toNumber:Ye.toNumber,toString:Ye.toString,pad:Ye.pad,peek:Ye.peek,truncate:Ye.truncate,rgb:n.rgb,lab:n.lab,hcl:n.hcl,hsl:n.hsl,sequence:r.range,format:function(e,t){return y("format",a.format,t)(e)},utcFormat:function(e,t){return y("utcFormat",l.utcFormat,t)(e)},utcParse:function(e,t){return y("utcParse",l.utcParse,t)(e)},timeFormat:b,timeParse:function(e,t){return y("timeParse",l.timeParse,t)(e)},monthFormat:function(e){return k(e,1,"%B")},monthAbbrevFormat:function(e){return k(e,1,"%b")},dayFormat:function(e){return k(0,2+e,"%A")},dayAbbrevFormat:function(e){return k(0,2+e,"%a")},quarter:function(e){return 1+~~(new Date(e).getMonth()/3)},utcquarter:function(e){return 1+~~(new Date(e).getUTCMonth()/3)},warn:function(){return R(this.context.dataflow,"warn",arguments)},info:function(){return R(this.context.dataflow,"info",arguments)},debug:function(){return R(this.context.dataflow,"debug",arguments)},extent:function(e){var t,n,r,i,a=0;if(e&&(t=e.length)){for(n=e[a];null==n||n!=n;n=e[++a]);for(r=i=n;a<t;++a)null!=(n=e[a])&&(n<r&&(r=n),i<n&&(i=n))}return[r,i]},inScope:function(e){var t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},clampRange:function(e,t,n){var r,i=e[0],a=e[1];return a<i&&(r=a,a=i,i=r),n-t<=(r=a-i)?[t,n]:[i=Math.min(Math.max(i,t),n-r),i+r]},pinchDistance:function(e){var t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(e){var t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){return O?O.screen:{}},containerSize:function(){var e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){return O?[O.innerWidth,O.innerHeight]:[void 0,void 0]},span:function(e){return e[e.length-1]-e[0]||0},merge:function(){var e=[].slice.call(arguments);return e.unshift({}),Ye.extend.apply(null,e)},flush:function(e,t,n,r,i,a){if(!n&&0!==n)return a;var o,l,s=e[0],u=Ye.peek(e),d=+n;return u<s&&(o=s,s=u,u=o),(o=Math.abs(t-s))<(l=Math.abs(u-t))&&o<=d?r:l<=d?i:a},bandspace:function(e,t,n){return f.bandSpace(e||0,t||0,n||0)},inrange:S,setdata:function(e,t){var n=this.context.dataflow,r=this.context.data[e].input;return n.pulse(r,n.changeset().remove(Ye.truthy).insert(t)),1},pathShape:function(t){var n=null;return function(e){return e?p.pathRender(e,n=n||p.pathParse(t)):t}},panLinear:Ye.panLinear,panLog:Ye.panLog,panPow:Ye.panPow,zoomLinear:Ye.zoomLinear,zoomLog:Ye.zoomLog,zoomPow:Ye.zoomPow,encode:function(e,t,n){if(e){var r=this.context.dataflow,i=e.mark.source;r.pulse(i,r.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,r,i,a){var o,l,s=this.context.dataflow,u=this.context.data[e],d=u.input,c=u.changes,f=s.stamp();if(!1===s._trigger||!(d.value.length||t||r))return 0;if((!c||c.stamp<f)&&(u.changes=c=s.changeset(),c.stamp=f,s.runAfter(function(){u.modified=!0,s.pulse(d,c).run()},!0,1)),n&&(o=!0===n?Ye.truthy:Ye.isArray(n)||g.isTuple(n)?n:B(n),c.remove(o)),t&&c.insert(t),r&&(o=B(r),d.value.some(o)?c.remove(o):c.insert(r)),i)for(l in a)c.modify(i,l,a[l]);return 1}},pe=["view","item","group","xy","x","y"],ge={};function he(e,t,n){return 1===arguments.length?fe[e]:(fe[e]=t,n&&(ge[e]=n),ve&&(ve.functions[e]="this."+e),this)}he("bandwidth",function(e,t){var n=P(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0},$),he("copy",function(e,t){var n=P(e,(t||this).context);return n?n.copy():void 0},$),he("domain",function(e,t){var n=P(e,(t||this).context);return n?n.domain():[]},$),he("range",function(e,t){var n=P(e,(t||this).context);return n&&n.range?n.range():[]},$),he("invert",function(e,t,n){var r=P(e,(n||this).context);return r?Ye.isArray(t)?(r.invertRange||r.invert)(t):(r.invert||r.invertExtent)(t):void 0},$),he("scale",function(e,t,n){var r=P(e,(n||this).context);return r?r(t):void 0},$),he("gradient",function(e,t,n,r,i){e=P(e,(i||this).context);var a=p.Gradient(t,n),o=e.domain(),l=o[0],s=Ye.peek(o),u=f.scaleFraction(e,l,s);e.ticks&&(l!==(o=e.ticks(+r||15))[0]&&o.unshift(l),s!==Ye.peek(o)&&o.push(s));for(var d=0,c=o.length;d<c;++d)a.stop(u(o[d]),e(o[d]));return a},$),he("geoArea",E,$),he("geoBounds",V,$),he("geoCentroid",A,$),he("geoShape",function(e,t,n){var r=P(e,(n||this).context);return function(e){return r?r.path.context(e)(t):""}},$),he("indata",function(e,t,n){var r=this.context.data[e]["index:"+t],i=r?r.value.get(n):void 0;return i?i.count:i},function(e,t,n,r){t[0].type!==w&&Ye.error("First argument to indata must be a string literal."),t[1].type!==w&&Ye.error("Second argument to indata must be a string literal.");var i=t[0].value,a=t[1].value,o="@"+a;r.hasOwnProperty(o)||(r[o]=n.getData(i).indataRef(n,a))}),he("data",F,W),he("treePath",function(e,t,n){var r=M(e,this),i=r[t],a=r[n];return i&&a?i.path(a).map(C):void 0},W),he("treeAncestors",function(e,t){var n=M(e,this)[t];return n?n.ancestors().map(C):void 0},W),he("vlSelectionTest",function(e,t,n){for(var r,i,a,o,l,s=this.context.data[e],u=s?s.values.value:[],d=s?s[G]&&s[G].value:void 0,c=n===Y,f=u.length,p=0;p<f;++p)if(r=u[p],d&&c){if(-1===(a=(i=i||{})[o=r.unit]||0))continue;if(l=H(t,r),i[o]=l?-1:++a,l&&1===d.size)return!0;if(!l&&a===d.get(o).count)return!1}else if(c^(l=H(t,r)))return l;return f&&c},J),he("vlSelectionResolve",function(e,r){for(var t,n,i,a,o,l,s,u,d,c,f,p=this.context.data[e],g=p?p.values.value:[],h={},m={},v=g.length,y=0;y<v;++y)for(a=(t=g[y]).unit,n=t.fields,i=t.values,c=0,f=n.length;c<f;++c)o=n[c],s=(l=h[o.field]||(h[o.field]={}))[a]||(l[a]=[]),m[o.field]=u=o.type.charAt(0),d=K[u+"_union"],l[a]=d(s,Ye.array(i[c]));return r=r||"union",Object.keys(h).forEach(function(n){h[n]=Object.keys(h[n]).map(function(e){return h[n][e]}).reduce(function(e,t){return void 0===e?t:K[m[n]+"_"+r](e,t)})}),h},J),he("vlSingle",ae,W),he("vlSingleDomain",le,W),he("vlMulti",ae,oe),he("vlMultiDomain",le,oe),he("vlInterval",function(e,t,n){return ie.call(this,e,t,n,re)},W),he("vlIntervalDomain",function(e,t,n,r){var i,a,o,l,s,u=this.context.data[e],d=u?u.values.value:[],c=d[0],f=0;if(c){for(i=c.intervals.length;f<i;++f)if(a=c.intervals[f],t&&a.encoding===t||n&&a.field===n){if(!a.extent)return;o=f,s=2<a.extent.length;break}return l=d.reduce(function(e,t){var n=t.intervals[o].extent,r=s?n.map(function(e){return{unit:t.unit,value:e}}):{unit:t.unit,value:n};return s?e.push.apply(e,r):e.push(r),e},[]),s?se(l,r):ue(l,r)}},W);var me={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(e){return"_["+Ye.stringValue("$"+e)+"]"},functions:function(e){var t=o.functions(e);for(var n in pe.forEach(function(e){t[e]="event.vega."+e}),fe)t[n]="this."+n;return t},constants:o.constants,visitors:ge},ve=o.codegen(me),ye="$";function Me(t,r,e){var n,i,a={};try{t=Ye.isString(t)?t:Ye.stringValue(t)+"",n=o.parse(t)}catch(e){Ye.error("Expression parse error: "+t)}return n.visit(function(e){if("CallExpression"===e.type){var t=e.callee.name,n=me.visitors[t];n&&n(t,e.arguments,r,a)}}),(i=ve(n)).globals.forEach(function(e){var t=ye+e;!a.hasOwnProperty(t)&&r.getSignal(e)&&(a[t]=r.signalRef(e))}),{$expr:e?e+"return("+i.code+");":i.code,$fields:i.fields,$params:a}}function be(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function xe(e,t,n,r){return new be(e,t,n,r)}function ke(e,t){return xe("operator",e,t)}function Ge(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}var Se={$tupleid:1,toString:function(){return":_tupleid_:"}};function Re(e,t){return t?{$field:e,$name:t}:{$field:e}}var Oe=Re("key");function we(e,t){return{$compare:e,$order:t}}var ze="descending";function je(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}var Pe="scope",De="view";function $e(e){return e&&e.signal}function _e(e){if($e(e))return!0;if(Ye.isObject(e))for(var t in e)if(_e(e[t]))return!0;return!1}function He(e,t){return null!=e?e:t}function Je(e){return e&&e.signal||e}var Ee="timer";function Ve(e,t){return(e.merge?Ae:e.stream?Fe:e.type?We:Ye.error("Invalid stream specification: "+Ye.stringValue(e)))(e,t)}function Ae(e,t){var n=Le({merge:e.merge.map(function(e){return Ve(e,t)})},e,t);return t.addStream(n).id}function Fe(e,t){var n=Le({stream:Ve(e.stream,t)},e,t);return t.addStream(n).id}function We(e,t){var n,r,i;return e.type===Ee?(n=t.event(Ee,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===Pe?De:i||De,e.type),r=Le({stream:n},e,t),1===Object.keys(r).length?n:t.addStream(r).id}function Le(e,t,n){var r,i,a,o,l=t.between;return l&&(2!==l.length&&Ye.error('Stream "between" parameter must have 2 entries: '+Ye.stringValue(t)),e.between=[Ve(l[0],n),Ve(l[1],n)]),l=t.filter?Ye.array(t.filter):[],(t.marktype||t.markname||t.markrole)&&l.push((r=t.marktype,i=t.markname,a=t.markrole,(o="event.item")+(r&&"*"!==r?"&&"+o+".mark.marktype==='"+r+"'":"")+(a?"&&"+o+".mark.role==='"+a+"'":"")+(i?"&&"+o+".mark.name==='"+i+"'":""))),t.source===Pe&&l.push("inScope(event.item)"),l.length&&(e.filter=Me("("+l.join(")&&(")+")").$expr),null!=(l=t.throttle)&&(e.throttle=+l),null!=(l=t.debounce)&&(e.debounce=+l),t.consume&&(e.consume=!0),e}var Ce="var datum=event.item&&event.item.datum;";function qe(e,r,t){var n,i,a=e.events,o=e.update,l=e.encode,s=[];a||Ye.error("Signal update missing events specification."),Ye.isString(a)&&(a=u.selector(a,r.isSubscope()?Pe:De)),(a=Ye.array(a).filter(function(e){return e.signal||e.scale?(s.push(e),0):1})).length&&s.push(1<a.length?{merge:a}:a[0]),null!=l&&(o&&Ye.error("Signal encode and update are mutually exclusive."),o="encode(item(),"+Ye.stringValue(l)+")"),n=Ye.isString(o)?Me(o,r,Ce):null!=o.expr?Me(o.expr,r,Ce):null!=o.value?o.value:null!=o.signal?{$expr:"_.value",$params:{value:r.signalRef(o.signal)}}:Ye.error("Invalid signal update specification."),i={target:t,update:n},e.force&&(i.options={force:!0}),s.forEach(function(e){var t,n;r.addUpdate(Ye.extend((n=r,{source:(t=e).signal?n.signalRef(t.signal):t.scale?n.scaleRef(t.scale):Ve(t,n)}),i))})}function Be(e,t){var n=t.getSignal(e.name),r=e.update;e.init&&(r?Ye.error("Signals can not include both init and update expressions."):(r=e.init,n.initonly=!0)),r&&(r=Me(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach(function(e){qe(e,t,n.id)})}function Ne(r){return function(e,t,n){return xe(r,t,e||void 0,n)}}var Te=Ne("aggregate"),Ke=Ne("axisticks"),Ue=Ne("bound"),Qe=Ne("collect"),Ie=Ne("compare"),Xe=Ne("datajoin"),Ze=Ne("encode"),et=Ne("expression"),tt=Ne("facet"),nt=Ne("field"),rt=Ne("key"),it=Ne("legendentries"),at=Ne("load"),ot=Ne("mark"),lt=Ne("multiextent"),st=Ne("multivalues"),ut=Ne("overlap"),dt=Ne("params"),ct=Ne("prefacet"),ft=Ne("projection"),pt=Ne("proxy"),gt=Ne("relay"),ht=Ne("render"),mt=Ne("scale"),vt=Ne("sieve"),yt=Ne("sortitems"),bt=Ne("viewlayout"),xt=Ne("values"),kt=0,St=["identity","ordinal","band","point","bin-linear","bin-ordinal","quantize","quantile","threshold","linear","pow","sqrt","log","sequential","time","utc"],Rt=Ye.toSet(St),Ot=Ye.toSet(St.slice(4,9)),wt=Ye.toSet(St.slice(9)),zt=Ye.toSet(St.slice(1,6));function jt(e){return zt.hasOwnProperty(e)}function Pt(e){return Ot.hasOwnProperty(e)}function Dt(e){return"quantile"===e}function $t(e,t){var n,r,i,a,o=t.getScale(e.name).params;for(n in o.domain=Vt(e.domain,e,t),null!=e.range&&(o.range=function e(t,n,r){var i=t.range,a=n.config.range;{if(i.signal)return n.signalRef(i.signal);if(Ye.isString(i)){if(a&&a.hasOwnProperty(i))return t=Ye.extend({},t,{range:a[i]}),e(t,n,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=jt(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:Ye.error("Unrecognized scale range value: "+Ye.stringValue(i))}else{if(i.scheme)return r.scheme=_t(i.scheme,n),i.extent&&(r.schemeExtent=(o=i.extent,l=n,o.signal?l.signalRef(o.signal):o.map(function(e){return _t(e,l)}))),void(i.count&&(r.schemeCount=_t(i.count,n)));if(i.step)return void(r.rangeStep=_t(i.step,n));if(jt(t.type)&&!Ye.isArray(i))return Vt(i,t,n);Ye.isArray(i)||Ye.error("Unsupported range type: "+Ye.stringValue(i))}}var o,l;return i.map(function(e){return _t(e,n)})}(e,t,o)),null!=e.interpolate&&(r=e.interpolate,(i=o).interpolate=_t(r.type||r),null!=r.gamma&&(i.interpolateGamma=_t(r.gamma))),null!=e.nice&&(a=e.nice,o.nice=Ye.isObject(a)?{interval:_t(a.interval),step:_t(a.step)}:_t(a)),e)o.hasOwnProperty(n)||"name"===n||(o[n]=_t(e[n],t))}function _t(e,t){return Ye.isObject(e)?e.signal?t.signalRef(e.signal):Ye.error("Unsupported object: "+Ye.stringValue(e)):e}function Et(e){Ye.error("Can not find data set: "+Ye.stringValue(e))}function Vt(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(Ye.isArray(e)?function(e,t,n){return e.map(function(e){return _t(e,n)})}:e.fields?function(e,t,n){var r=e.data,i=e.fields.reduce(function(e,t){return t=Ye.isString(t)?{data:r,field:t}:Ye.isArray(t)||t.signal?function(e,t){var n="_:vega:_"+kt++,r=Qe({});if(Ye.isArray(e))r.value={$ingest:e};else if(e.signal){var i="setdata("+Ye.stringValue(n)+","+e.signal+")";r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,vt({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e},[]);return(jt(t.type)?function(e,n,t){var r,i,a;return r=t.map(function(e){var t=n.getData(e.data);return t||Et(e.data),t.countsRef(n,e.field)}),i=n.add(Te({groupby:Oe,ops:["sum"],fields:[n.fieldRef("count")],as:["count"],pulse:r})),a=n.add(Qe({pulse:Ge(i)})),Ge(n.add(xt({field:Oe,sort:n.sortRef(At(e.sort,!0)),pulse:Ge(a)})))}:Dt(t.type)?function(e,n,t){var r=t.map(function(e){var t=n.getData(e.data);return t||Et(e.data),t.domainRef(n,e.field)});return Ge(n.add(st({values:r})))}:function(e,n,t){var r=t.map(function(e){var t=n.getData(e.data);return t||Et(e.data),t.extentRef(n,e.field)});return Ge(n.add(lt({extents:r})))})(e,n,i)}:function(e,t,n){var r=n.getData(e.data);r||Et(e.data);return jt(t.type)?r.valuesRef(n,e.field,At(e.sort,!1)):Dt(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)})(e,t,n);null==t.domainMin&&null==t.domainMax||Ye.error("No scale domain defined for domainMin/domainMax to override.")}function At(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field?Ye.error("Multiple domain scales can not sort by field."):t&&e.op&&"count"!==e.op&&Ye.error("Multiple domain scales support op count only."):Ye.error("No field provided for sort aggregate op: "+e.op):Ye.isObject(e)?e.field="key":e={field:"key"}),e}function Ft(e,t,n){return Ye.isArray(e)?e.map(function(e){return Ft(e,t,n)}):Ye.isObject(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:Ye.error("Unsupported parameter object: "+Ye.stringValue(e)):e}var Wt="top",Lt="left",Ct="right",Mt="bottom",qt="vertical",Bt="index",Nt="label",Tt="offset",Ut="perc",It="perc2",Xt="size",Yt="value",Gt="guide-label",Ht="guide-title",Jt="group-title",Kt="symbol",Qt="gradient",Zt="discrete",en=["size","shape","fill","stroke","strokeDash","opacity"],tn={name:1,interactive:1},nn=Ye.toSet(["rule"]),rn=Ye.toSet(["group","image","rect"]);function an(e,t,n,r){var i=Me(e,t);return i.$fields.forEach(function(e){r[e]=1}),Ye.extend(n,i.$params),i.$expr}function on(e,t,n,r){return function e(t,n,r,i){var a,o,l;if(t.signal)a="datum",l=an(t.signal,n,r,i);else if(t.group||t.parent){for(o=Math.max(1,t.level||1),a="item";0<o--;)a+=".mark.group";t.parent?(l=t.parent,a+=".datum"):l=t.group}else t.datum?(a="datum",l=t.datum):Ye.error("Invalid field reference: "+Ye.stringValue(t));t.signal||(l=Ye.isString(l)?(i[l]=1,Ye.splitAccessPath(l).map(Ye.stringValue).join("][")):e(l,n,r,i));return a+"["+l+"]"}(Ye.isObject(e)?e:{datum:e},t,n,r)}function ln(e,t,n,r,i){var a,o,l,s=sn(e.scale,n,r,i);return null!=e.range?(o=s+".range()",t=0===(a=+e.range)?o+"[0]":"($="+o+","+(1===a?"$[$.length-1]":"$[0]+"+a+"*($[$.length-1]-$[0])")+")"):(void 0!==t&&(t=s+"("+t+")"),e.band&&(l=function(e,t){if(!Ye.isString(e))return-1;var n=t.scaleType(e);return"band"===n||"point"===n?1:0}(e.scale,n))&&(a=(o=s+".bandwidth")+"()"+(1===(a=+e.band)?"":"*"+a),l<0&&(a="("+o+"?"+a+":0)"),t=(t?t+"+":"")+a,e.extra&&(t="(datum.extra?"+s+"(datum.extra.value):"+t+")")),null==t&&(t="0")),t}function sn(e,t,n,r){var i;if(Ye.isString(e))i=z+e,n.hasOwnProperty(i)||(n[i]=t.scaleRef(e)),i=Ye.stringValue(i);else{for(i in t.scales)n[z+i]=t.scaleRef(i);i=Ye.stringValue(z)+"+"+(e.signal?"("+an(e.signal,t,n,r)+")":on(e,t,n,r))}return"_["+i+"]"}function un(e,t,n,r){return Ye.isObject(e)?"("+dn(null,e,t,n,r)+")":e}function dn(e,t,n,r,i){if(null!=t.gradient)return o=n,l=r,s=i,"this.gradient("+sn((a=t).gradient,o,l,s)+","+Ye.stringValue(a.start)+","+Ye.stringValue(a.stop)+","+Ye.stringValue(a.count)+")";var a,o,l,s,u=t.signal?an(t.signal,n,r,i):t.color?function(e,i,a,o){function t(e,t,n,r){return"this."+e+"("+[dn(null,t,i,a,o),dn(null,n,i,a,o),dn(null,r,i,a,o)].join(",")+").toString()"}return e.c?t("hcl",e.h,e.c,e.l):e.h||e.s?t("hsl",e.h,e.s,e.l):e.l||e.a?t("lab",e.l,e.a,e.b):e.r||e.g||e.b?t("rgb",e.r,e.g,e.b):null}(t.color,n,r,i):null!=t.field?on(t.field,n,r,i):void 0!==t.value?Ye.stringValue(t.value):void 0;return null!=t.scale&&(u=ln(t,u,n,r,i)),void 0===u&&(u=null),null!=t.exponent&&(u="Math.pow("+u+","+un(t.exponent,n,r,i)+")"),null!=t.mult&&(u+="*"+un(t.mult,n,r,i)),null!=t.offset&&(u+="+"+un(t.offset,n,r,i)),t.round&&(u="Math.round("+u+")"),u}function cn(e,t,n){return e+"["+Ye.stringValue(t)+"]="+n+";"}function fn(e,t,n,r,i){var a="";return t.forEach(function(e){var t=dn(0,e,n,r,i);a+=e.test?an(e.test,n,r,i)+"?"+t+":":t}),":"===Ye.peek(a)&&(a+="null"),cn("o",e,a)}function pn(e,t,n,r){var i,a,o,l,s,u={},d="var o=item,datum=o.datum,$;";for(i in e)a=e[i],Ye.isArray(a)?d+=fn(i,a,r,n,u):d+=cn("o",i,dn(0,a,r,n,u));return d+=(o=e,s="",nn[l=t]||(o.x2&&(o.x?(rn[l]&&(s+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),s+="o.width=o.x2-o.x;"):s+="o.x=o.x2-(o.width||0);"),o.xc&&(s+="o.x=o.xc-(o.width||0)/2;"),o.y2&&(o.y?(rn[l]&&(s+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),s+="o.height=o.y2-o.y;"):s+="o.y=o.y2-(o.height||0);"),o.yc&&(s+="o.y=o.yc-(o.height||0)/2;")),s),{$expr:d+="return 1;",$fields:Object.keys(u),$output:Object.keys(e)}}var gn="mark",hn="frame",mn="scope",vn="axis",yn="axis-domain",bn="axis-grid",xn="axis-label",kn="axis-tick",Sn="axis-title",Rn="legend",On="legend-band",wn="legend-entry",zn="legend-gradient",jn="legend-label",Pn="legend-symbol",Dn="legend-title",$n="title";function _n(e){return Ye.isObject(e)?Ye.extend({},e):{value:e}}function En(e,t,n,r){return null!=n?(Ye.isObject(n)&&!Ye.isArray(n)?e.update[t]=n:e[r||"enter"][t]={value:n},1):0}function Vn(e,t,n){for(var r in t)n&&n.hasOwnProperty(r)||(e[r]=Ye.extend(e[r]||{},t[r]));return e}function An(e,t,n,r,i,a){var o,l;for(l in(a=a||{}).encoders={$encode:o={}},e=function(r,e,t,n,i){var a,o,l={};"legend"!=t&&0!==String(t).indexOf("axis")||(t=null);for(a in o=t===hn?i.group:t===gn?Ye.extend({},i.mark,i[e]):null)Wn(a,r)||("fill"===a||"stroke"===a)&&(Wn("fill",r)||Wn("stroke",r))||(l[a]=Fn(o[a]));return Ye.array(n).forEach(function(e){var t=i.style&&i.style[e];for(var n in t)Wn(n,r)||(l[n]=Fn(t[n]))}),(r=Ye.extend({},r)).enter=Ye.extend(l,r.enter),r}(e,t,n,r,i.config))o[l]=pn(e[l],t,a,i);return a}function Fn(e){return e&&e.signal?{signal:e.signal}:{value:e}}function Wn(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function Ln(e,t,n,r,i,a,o){return{type:e,name:o?o.name:void 0,role:t,style:o&&o.style||n,key:r,from:i,interactive:!(!o||!o.interactive),encode:Vn(a,o,tn)}}function Cn(e,t,n){return He(t[e],n[e])}function Mn(e,t){return He(e.direction,t)===qt}function qn(e,t){return He(e.gradientLength,t.gradientLength||t.gradientWidth)}function Bn(e,t){return He(e.gradientThickness,t.gradientThickness||t.gradientHeight)}function Nn(e,t){var n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}var Tn="group",Un="rect",In="rule",Xn="symbol",Yn="text";var Gn="datum."+Ut+'<=0?"left":datum.'+Ut+'>=1?"right":"center"',Hn="datum."+Ut+'<=0?"bottom":datum.'+Ut+'>=1?"top":"middle"';function Jn(e,t,n,r){var i,a,o,l,s,u={value:0},d=Mn(e,t.gradientDirection),c=_n(Bn(e,t)),f=qn(e,t),p=Cn("labelOverlap",e,t),g="";return En(i={enter:a={opacity:u},update:o={opacity:{value:1},text:{field:Nt}},exit:{opacity:u}},"fill",Cn("labelColor",e,t)),En(i,"font",Cn("labelFont",e,t)),En(i,"fontSize",Cn("labelFontSize",e,t)),En(i,"fontWeight",Cn("labelFontWeight",e,t)),En(i,"fillOpacity",Cn("labelOpacity",e,t)),En(i,"limit",He(e.labelLimit,t.gradientLabelLimit)),d?(a.align={value:"left"},a.baseline=o.baseline={signal:Hn},l="y",s="x",g="1-"):(a.align=o.align={signal:Gn},a.baseline={value:"top"},l="x",s="y"),a[l]=o[l]={signal:g+"datum."+Ut,mult:f},a[s]=o[s]=c,c.offset=He(e.labelOffset,t.gradientLabelOffset)||0,e=Ln(Yn,jn,Gt,Yt,r,i,n),p&&(e.overlap={method:p,order:"datum."+Bt}),e}function Kn(e,t,n,r,i,a,o,l){return{type:Tn,name:n,role:e,style:t,from:r,interactive:i||!1,encode:a,marks:o,layout:l}}var Qn={value:0};function Zn(e,t){return{align:Cn("gridAlign",e,t),center:{row:!0,column:!1},columns:(n=e,r=t,He(n.columns,He(r.columns,+Mn(n,r.symbolDirection)))),padding:{row:Cn("rowPadding",e,t),column:Cn("columnPadding",e,t)}};var n,r}function er(e){return Ye.isObject(e)&&e.signal?e.signal:Ye.stringValue(e)}function tr(e){var t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")?e.type===Tn?mn:t||gn:t}function nr(e,t){var n=g.definition(e.type);n||Ye.error("Unrecognized transform type: "+Ye.stringValue(e.type));var r=xe(n.type.toLowerCase(),null,rr(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function rr(e,t,n){var r,i,a,o={};for(i=0,a=e.params.length;i<a;++i)o[(r=e.params[i]).name]=ir(r,t,n);return o}function ir(t,e,n){var r,i,a,o=t.type,l=e[t.name];if("index"===o)return function(e,t,n){Ye.isString(t.from)||Ye.error('Lookup "from" parameter must be a string literal.');return n.getData(t.from).lookupRef(n,t.key)}(0,e,n);{if(void 0!==l)return"param"===o?(i=n,a=e[(r=t).name],r.array?(Ye.isArray(a)||Ye.error("Expected an array of sub-parameters. Instead: "+Ye.stringValue(a)),a.map(function(e){return or(r,e,i)})):or(r,a,i)):"projection"===o?n.projectionRef(e[t.name]):t.array&&!$e(l)?l.map(function(e){return ar(t,e,n)}):ar(t,l,n);t.required&&Ye.error("Missing required "+Ye.stringValue(e.type)+" parameter: "+Ye.stringValue(t.name))}}function ar(e,t,n){var r=e.type;if($e(t))return lr(r)?Ye.error("Expression references can not be signals."):sr(r)?n.fieldRef(t):ur(r)?n.compareRef(t):n.signalRef(t.signal);var i,a,o=e.expr||sr(r);return o&&((a=t)&&a.expr)?n.exprRef(t.expr,t.as):o&&((i=t)&&i.field)?Re(t.field,t.as):lr(r)?Me(t,n):"data"===r?Ge(n.getData(t).values):sr(r)?Re(t):ur(r)?n.compareRef(t):t}function or(e,t,n){var r,i,a,o,l;for(o=0,l=e.params.length;o<l;++o){for(a in(i=e.params[o]).key)if(i.key[a]!==t[a]){i=null;break}if(i)break}return i||Ye.error("Unsupported parameter: "+Ye.stringValue(t)),r=Ye.extend(rr(i,t,n),i.key),Ge(n.add(dt(r)))}function lr(e){return"expr"===e}function sr(e){return"field"===e}function ur(e){return"compare"===e}function dr(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Ge(t.getData(e.data).output)}function cr(e,t,n,r,i){this.scope=e,this.input=t,this.output=n,this.values=r,this.aggregate=i,this.index={}}cr.fromEntries=function(e,t){var n=t.length,r=1,i=t[0],a=t[n-1],o=t[n-2],l=null;for(e.add(t[0]);r<n;++r)t[r].params.pulse=Ge(t[r-1]),e.add(t[r]),"aggregate"===t[r].type&&(l=t[r]);return new cr(e,i,o,a,l)};var fr=cr.prototype;function pr(e){return Ye.isString(e)?e:null}function gr(e,t,n){var r,i=je(n.op,n.field);if(t.ops){for(var a=0,o=t.as.length;a<o;++a)if(t.as[a]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function hr(e,t,n,r,i,a,o){var l,s,u,d=t[n]||(t[n]={}),c=(u=a,Ye.isObject(u)?(u.order===ze?"-":"+")+je(u.op,u.field):""),f=pr(i);if(null!=f&&(e=t.scope,l=d[f+=c?"|"+c:""]),!l){var p=a?{field:Oe,pulse:t.countsRef(e,i,a)}:{field:e.fieldRef(i),pulse:Ge(t.output)};c&&(p.sort=e.sortRef(a)),s=e.add(xe(r,void 0,p)),o&&(t.index[i]=s),l=Ge(s),null!=f&&(d[f]=l)}return l}function mr(e,t,n){var r,i=e.remove,a=e.insert,o=e.toggle,l=e.modify,s=e.values,u=t.add(ke());r=Me("if("+e.trigger+',modify("'+n+'",'+[a,i,o,l,s].map(function(e){return null==e?"null":e}).join(",")+"),0)",t),u.update=r.$expr,u.params=r.$params}function vr(e,n){var t,r,i,a,o,l,s,u,d,c,f,p,g,h,m,v,y,b,x,k,S,R,O,w,z,j,P,D,$,_,E,V,A,F,W,L,C,M,q,B,N,T,U=tr(e),I=e.type===Tn,X=e.from&&e.from.facet,Y=e.layout||U===mn||U===hn,G=U===gn||Y||X,H=e.overlap;h=e.from,m=I,v=n,h?(y=h.facet)&&(m||Ye.error("Only group marks can be faceted."),null!=y.field?k=S=dr(y,v):(h.data?S=Ge(v.getData(h.data).aggregate):((x=nr(Ye.extend({type:"aggregate",groupby:Ye.array(y.groupby)},y.aggregate),v)).params.key=v.keyRef(y.groupby),x.params.pulse=dr(y,v),k=S=Ge(v.add(x))),b=v.keyRef(y.groupby,!0))):k=Ge(v.add(Qe(null,[{}]))),k||(k=dr(h,v)),i={key:b,pulse:k,parent:S},d=Ge(r=n.add(Xe({key:i.key||(e.key?Re(e.key):void 0),pulse:i.pulse,clean:!I}))),r=a=n.add(Qe({pulse:d})),c=Ge(r=n.add(ot({markdef:(P=e,{marktype:P.type,name:P.name||void 0,role:P.role||tr(P),zindex:+P.zindex||void 0}),interactive:(z=e.interactive,j=n,z&&z.signal?j.signalRef(z.signal):!1!==z),clip:(R=e.clip,O=n,Ye.isObject(R)&&(R.signal?w=R.signal:R.path?w="pathShape("+er(R.path)+")":R.sphere&&(w="geoShape("+er(R.sphere)+', {type: "Sphere"})')),w?O.signalRef(w):!!R),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:Ge(r)}))),(r=n.add(Ze(An(e.encode,e.type,U,e.style,n,{pulse:c})))).params.parent=n.encode(),e.transform&&e.transform.forEach(function(e){var t=nr(e,n);(t.metadata.generates||t.metadata.changes)&&Ye.error("Mark transforms should not generate new data."),t.params.pulse=Ge(r),n.add(r=t)}),e.sort&&(r=n.add(yt({sort:n.compareRef(e.sort,!0),pulse:Ge(r)}))),f=Ge(r),(X||Y)&&(p=Ge(Y=n.add(bt({layout:n.objectProperty(e.layout),legendMargin:n.config.legendMargin,mark:c,pulse:f})))),g=Ge(o=n.add(Ue({mark:c,pulse:p||f}))),I&&(G&&((t=n.operators).pop(),Y&&t.pop()),n.pushState(f,p||g,d),X?(F=n,W=i,B=(A=e).from.facet,N=B.name,T=dr(B,F),B.name||Ye.error("Facet must have a name: "+Ye.stringValue(B)),B.data||Ye.error("Facet must reference a data set: "+Ye.stringValue(B)),B.field?q=F.add(ct({field:F.fieldRef(B.field),pulse:T})):B.groupby?q=F.add(tt({key:F.keyRef(B.groupby),group:Ge(F.proxy(W.parent)),pulse:T})):Ye.error("Facet must specify groupby or field: "+Ye.stringValue(B)),C=(L=F.fork()).add(Qe()),M=L.add(vt({pulse:Ge(C)})),L.addData(N,new cr(L,C,C,M)),L.addSignal("parent",null),q.params.subflow={$subflow:Pr(A,L).toRuntime()}):G?(D=e,_=i,E=($=n).add(ct({pulse:_.pulse})),(V=$.fork()).add(vt()),V.addSignal("parent",null),E.params.subflow={$subflow:Pr(D,V).toRuntime()}):Pr(e,n),n.popState(),G&&(Y&&t.push(Y),t.push(o))),H&&(g=function(e,t,n){var r,i=e.method,a=e.bound,o={method:$e(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(o.sort=n.compareRef({field:e.order}));a&&(r=a.tolerance,o.boundTolerance=$e(r)?n.signalRef(r.signal):+r,o.boundScale=n.scaleRef(a.scale),o.boundOrient=a.orient);return Ge(n.add(ut(o)))}(H,g,n)),l=n.add(ht({pulse:g})),s=n.add(vt({pulse:Ge(l)},void 0,n.parent())),null!=e.name&&(u=e.name,n.addData(u,new cr(n,a,l,s)),e.on&&e.on.forEach(function(e){(e.insert||e.remove||e.toggle)&&Ye.error("Marks only support modify triggers."),mr(e,n,u)}))}function yr(n,e){var t,r,i,a,o,l,s,u,d,c,f,p,g,h,m,v,y,b,x,k,S,R,O,w,z,j,P,D,$,_,E,V,A,F,W,L,C,M,q,B,N,T,U,I,X,Y,G,H,J,K,Q,Z,ee,te,ne,re,ie,ae,oe,le,se,ue,de,ce,fe,pe,ge,he,me,ve,ye,be,xe,ke,Se,Re,Oe,we,ze,je,Pe,De,$e,_e,Ee=e.config.legend,Ve=n.encode||{},Ae=Ve.legend||{},Fe=Ae.name||void 0,We=Ae.interactive,Le=Ae.style,Ce=en.reduce(function(e,t){return e||n[t]},0);return Ce||Ye.error("Missing valid scale for legend."),o=function(e,t){var n=e.type||Kt;e.type||1!==(i=e,en.reduce(function(e,t){return e+(i[t]?1:0)},0))||!e.fill&&!e.stroke||(r=t,n=wt.hasOwnProperty(r)?Qt:Pt(t)?Zt:Kt);var r;var i;return n!==Qt?n:Pt(t)?Zt:Qt}(n,e.scaleType(Ce)),l={orient:Cn("orient",n,Ee),title:null!=n.title,type:o},s=Ge(e.add(Qe(null,[l]))),Ae=Vn((En(p={enter:{},update:{}},"offset",Cn("offset",c=n,f=Ee)),En(p,"padding",Cn("padding",c,f)),En(p,"titlePadding",Cn("titlePadding",c,f)),En(p,"fill",Cn("fillColor",c,f)),En(p,"stroke",Cn("strokeColor",c,f)),En(p,"strokeWidth",Cn("strokeWidth",c,f)),En(p,"cornerRadius",Cn("cornerRadius",c,f)),En(p,"strokeDash",f.strokeDash),p),Ae,tn),t={enter:{x:{value:0},y:{value:0}}},u=Ge(e.add(it(i={type:o,scale:e.scaleRef(Ce),count:e.objectProperty(n.tickCount),values:e.objectProperty(n.values),formatSpecifier:e.property(n.format)}))),o===Qt?(a=[(ce=n,fe=Ce,pe=Ee,ge=Ve.gradient,ke={value:0},Se=Mn(ce,pe.gradientDirection),Re=Bn(ce,pe),Oe=qn(ce,pe),xe=Se?(ve=[0,1],ye=[0,0],be=Re,Oe):(ve=[0,0],ye=[1,0],be=Oe,Re),En(he={enter:me={opacity:ke,x:ke,y:ke,width:_n(be),height:_n(xe)},update:Ye.extend({},me,{opacity:{value:1},fill:{gradient:fe,start:ve,stop:ye}}),exit:{opacity:ke}},"stroke",Cn("gradientStrokeColor",ce,pe)),En(he,"strokeWidth",Cn("gradientStrokeWidth",ce,pe)),En(he,"opacity",Cn("gradientOpacity",ce,pe),"update"),Ln(Un,zn,null,void 0,void 0,he,ge)),Jn(n,Ee,Ve.labels,u)],i.count=i.count||e.signalRef("max(2,2*floor(("+Je(qn(n,Ee))+")/100))")):o===Zt?a=[(H=n,J=Ce,K=Ee,Q=Ve.gradient,Z=u,oe={value:0},le=Mn(H,K.gradientDirection),se=Bn(H,K),ue=qn(H,K),de="",le?(ne="y",ie="y2",re="x",ae="width",de="1-"):(ne="x",ie="x2",re="y",ae="height"),(te={opacity:oe,fill:{scale:J,field:Yt}})[ne]={signal:de+"datum."+Ut,mult:ue},te[re]=oe,te[ie]={signal:de+"datum."+It,mult:ue},te[ae]=_n(se),En(ee={enter:te,update:Ye.extend({},te,{opacity:{value:1}}),exit:{opacity:oe}},"stroke",Cn("gradientStrokeColor",H,K)),En(ee,"strokeWidth",Cn("gradientStrokeWidth",H,K)),En(ee,"opacity",Cn("gradientOpacity",H,K),"update"),Ln(Un,On,null,Yt,Z,ee,Q)),Jn(n,Ee,Ve.labels,u)]:(r=Zn(n,Ee),a=[(z=n,j=Ee,P=Ve,D=u,$=Je(r.columns),C=P.entries,M=!(!C||!C.interactive),q=C?C.name:void 0,B=Cn("clipHeight",z,j),N=Cn("symbolOffset",z,j),T={data:"value"},U={},I=$+"?datum."+Tt+":datum."+Xt,X=B?_n(B):{field:Xt},Y="datum."+Bt,G="max(1,"+$+")",X.mult=.5,U={enter:_={opacity:Qn,x:{signal:I,mult:.5,offset:N},y:X},update:E={opacity:{value:1},x:_.x,y:_.y},exit:{opacity:Qn}},z.fill||(En(U,"fill",j.symbolBaseFillColor),En(U,"stroke",j.symbolBaseStrokeColor)),En(U,"shape",Cn("symbolType",z,j)),En(U,"size",Cn("symbolSize",z,j)),En(U,"strokeWidth",Cn("symbolStrokeWidth",z,j)),En(U,"fill",Cn("symbolFillColor",z,j)),En(U,"stroke",Cn("symbolStrokeColor",z,j)),En(U,"opacity",Cn("symbolOpacity",z,j),"update"),en.forEach(function(e){z[e]&&(E[e]=_[e]={scale:z[e],field:Yt})}),A=Ln(Xn,Pn,null,Yt,T,U,P.symbols),B&&(A.clip=!0),(V=_n(N)).offset=Cn("labelOffset",z,j),En(U={enter:_={opacity:Qn,x:{signal:I,offset:V},y:X},update:E={opacity:{value:1},text:{field:Nt},x:_.x,y:_.y},exit:{opacity:Qn}},"align",Cn("labelAlign",z,j)),En(U,"baseline",Cn("labelBaseline",z,j)),En(U,"fill",Cn("labelColor",z,j)),En(U,"font",Cn("labelFont",z,j)),En(U,"fontSize",Cn("labelFontSize",z,j)),En(U,"fontWeight",Cn("labelFontWeight",z,j)),En(U,"limit",Cn("labelLimit",z,j)),En(U,"fillOpacity",Cn("labelOpacity",z,j)),F=Ln(Yn,jn,Gt,Yt,T,U,P.labels),U={enter:{noBound:{value:!0},width:Qn,height:B?_n(B):Qn,opacity:Qn},exit:{opacity:Qn},update:E={opacity:{value:1},row:{signal:null},column:{signal:null}}},L=Mn(z,j.symbolDirection)?(W="ceil(item.mark.items.length/"+G+")",E.row.signal=Y+"%"+W,E.column.signal="floor("+Y+"/"+W+")",{field:["row",Y]}):(E.row.signal="floor("+Y+"/"+G+")",E.column.signal=Y+"%"+G,{field:Y}),E.column.signal=$+"?"+E.column.signal+":"+Y,(z=Kn(mn,null,q,D={facet:{data:D,name:"value",groupby:Bt}},M,Vn(U,C,tn),[A,F])).sort=L,z)],i.size=(g=n,h=e,m=a[0].marks,b=Nn("strokeWidth",m[0].encode),y=g.size?'scale("'+g.size+'",datum)':Nn("size",m[0].encode),x=m[1].encode,k=h,S=Gt,v=Nn("fontSize",x)||(R="fontSize",O=S,(w=k.config.style[O])&&w[R]),Me("max(ceil(sqrt("+Je(y)+")+"+Je(b)+"),"+Je(v)+")",h))),a=[Kn(wn,null,null,s,We,t,a,r)],l.title&&a.push((we=n,ze=Ee,je=Ve.title,Pe=s,En(De={enter:$e={opacity:_e={value:0},x:{field:{group:"padding"}},y:{field:{group:"padding"}}},update:{opacity:{value:1},text:_n(we.title),x:$e.x,y:$e.y},exit:{opacity:_e}},"align",Cn("titleAlign",we,ze)),En(De,"baseline",Cn("titleBaseline",we,ze)),En(De,"fill",Cn("titleColor",we,ze)),En(De,"font",Cn("titleFont",we,ze)),En(De,"fontSize",Cn("titleFontSize",we,ze)),En(De,"fontWeight",Cn("titleFontWeight",we,ze)),En(De,"limit",Cn("titleLimit",we,ze)),En(De,"fillOpacity",Cn("titleOpacity",we,ze)),Ln(Yn,Dn,Ht,null,Pe,De,je))),d=Kn(Rn,Le,Fe,s,We,Ae,a),n.zindex&&(d.zindex=n.zindex),vr(d,e)}function br(e,t,n){return'item.anchor==="start"?'+e+':item.anchor==="end"?'+t+":"+n}fr.countsRef=function(e,t,n){var r,i,a,o=this.counts||(this.counts={}),l=pr(t);return null!=l&&(e=this.scope,r=o[l]),r?n&&n.field&&gr(e,r.agg.params,n):(a={groupby:e.fieldRef(t,"key"),pulse:Ge(this.output)},n&&n.field&&gr(e,a,n),r={agg:i=e.add(Te(a)),ref:Ge(r=e.add(Qe({pulse:Ge(i)})))},null!=l&&(o[l]=r)),r.ref},fr.tuplesRef=function(){return Ge(this.values)},fr.extentRef=function(e,t){return hr(e,this,"extent","extent",t,!1)},fr.domainRef=function(e,t){return hr(e,this,"domain","values",t,!1)},fr.valuesRef=function(e,t,n){return hr(e,this,"vals","values",t,n||!0)},fr.lookupRef=function(e,t){return hr(e,this,"lookup","tupleindex",t,!1)},fr.indataRef=function(e,t){return hr(e,this,"indata","tupleindex",t,!0,!0)};var xr=br(Ye.stringValue(Lt),Ye.stringValue(Ct),Ye.stringValue("center")),kr=br('+(item.orient==="'+Ct+'")','+(item.orient!=="'+Lt+'")',"0.5");function Sr(e,t){e=Ye.isString(e)?{text:e}:e;var n,r,i,a=t.config.title,o=Ye.extend({},e.encode);return n={orient:Cn("orient",e,a)},r=Ge(t.add(Qe(null,[n]))),o.name=e.name,o.interactive=e.interactive,i=function(e,t,n,r){var i,a,o,l,s,u={value:0},d=e.text,c=Cn("orient",e,t),f=Cn("anchor",e,t),p=c===Lt||c===Wt?-1:1,g=c===Wt||c===Mt,h={group:g?"width":"height"};l={field:h,mult:{signal:kr}},s=p<0?u:g?{field:{group:"height"}}:{field:{group:"width"}},i={enter:a={opacity:u},update:o={opacity:{value:1},text:_n(d),anchor:_n(f),orient:_n(c),extent:{field:h},align:{signal:xr}},exit:{opacity:u}},a.baseline=g?(o.x=l,o.y=s,a.angle=u,{value:c===Wt?Mt:Wt}):(o.x=s,o.y=l,a.angle={value:90*p},{value:Mt});return En(i,"align",Cn("align",e,t),"update"),En(i,"angle",Cn("angle",e,t)),En(i,"baseline",Cn("baseline",e,t)),En(i,"fill",Cn("color",e,t)),En(i,"font",Cn("font",e,t)),En(i,"fontSize",Cn("fontSize",e,t)),En(i,"fontWeight",Cn("fontWeight",e,t)),En(i,"frame",Cn("frame",e,t)),En(i,"limit",Cn("limit",e,t)),En(i,"offset",Cn("offset",e,t)||0),Ln(Yn,$n,e.style||Jt,null,r,i,n)}(e,a,o,r),e.zindex&&(i.zindex=e.zindex),vr(i,t)}function Rr(t,n){var r=[];t.transform&&t.transform.forEach(function(e){r.push(nr(e,n))}),t.on&&t.on.forEach(function(e){mr(e,n,t.name)}),n.addDataPipeline(t.name,function(e,t,n){var r,i,a,o,l,s=[],u=null,d=!1,c=!1;e.values?s.push(u=Or({$ingest:e.values,$format:e.format})):e.url?(u=_e(e.url)||_e(e.format)?{$load:Ge(t.add((f=t,p=e,at({url:f.property(p.url),format:f.objectProperty(p.format)}))))}:{$request:e.url,$format:e.format},s.push(u=Or(u))):e.source&&(u=r=Ye.array(e.source).map(function(e){return Ge(t.getData(e).output)}),s.push(null));var f,p;for(i=0,a=n.length;i<a;++i)o=n[i],l=o.metadata,u||l.source||s.push(u=Or()),s.push(o),l.generates&&(c=!0),l.modifies&&!c&&(d=!0),l.source?u=o:l.changes&&(u=null);r&&(a=r.length-1,s[0]=gt({derive:d,pulse:a?r:r[0]}),(d||a)&&s.splice(1,0,Or()));u||s.push(Or());return s.push(vt({})),s}(t,n,r))}function Or(e){var t=Qe({},e);return t.metadata={source:!0},t}function wr(e,t){return{scale:e.scale,range:t}}function zr(e,t,n,r,i){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+r+","+i+")"}}function jr(e,t){var n,r,i,a,o,l,s,u,d,c,f,p,g,h,m,v,y,b,x,k,S,R,O,w,z,j,P,D,$,_,E,V,A,F,W,L,C,M,q,B,N,T,U,I,X,Y,G,H,J,K,Q,Z,ee,te,ne,re,ie,ae,oe,le,se,ue,de,ce,fe,pe,ge,he,me,ve,ye,be,xe,ke,Se,Re,Oe,we,ze,je,Pe,De,$e,_e,Ee,Ve,Ae,Fe,We,Le,Ce,Me,qe,Be=(s=e,d=(u=t).config,c=s.orient,f=c===Wt||c===Mt?d.axisX:d.axisY,p=d["axis"+c[0].toUpperCase()+c.slice(1)],g="band"===u.scaleType(s.scale)&&d.axisBand,f||p||g?Ye.extend({},d.axis,f,p,g):d.axis),Ne=e.encode||{},Te=Ne.axis||{},Ue=Te.name||void 0,Ie=Te.interactive,Xe=Te.style;return n={orient:e.orient,ticks:!!Cn("ticks",e,Be),labels:!!Cn("labels",e,Be),grid:!!Cn("grid",e,Be),domain:!!Cn("domain",e,Be),title:!!He(e.title,!1)},r=Ge(t.add(Qe({},[n]))),Te=Vn({update:{range:{signal:'abs(span(range("'+e.scale+'")))'},offset:_n(He(e.offset,0)),position:_n(He(e.position,0)),titlePadding:_n(Cn("titlePadding",e,Be)),minExtent:_n(Cn("minExtent",e,Be)),maxExtent:_n(Cn("maxExtent",e,Be))}},Ne.axis,tn),i=Ge(t.add(Ke({scale:t.scaleRef(e.scale),extra:t.property(Cn("tickExtra",e,Be)),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),formatSpecifier:t.property(e.format)}))),l=[],n.grid&&l.push((h=e,m=Be,v=Ne.grid,y=i,P=h.orient,D=h.gridScale,_=($=P===Lt||P===Wt?1:-1)*h.offset||0,En(b={enter:x={opacity:E={value:0}},update:S={opacity:{value:1}},exit:k={opacity:E}},"stroke",Cn("gridColor",h,m)),En(b,"strokeDash",Cn("gridDash",h,m)),En(b,"strokeOpacity",Cn("gridOpacity",h,m)),En(b,"strokeWidth",Cn("gridWidth",h,m)),R={scale:h.scale,field:Yt,band:Cn("bandPosition",h,m),round:Cn("tickRound",h,m),extra:Cn("tickExtra",h,m),offset:Cn("tickOffset",h,m)},j=P===Wt||P===Mt?(O="x",w="y","height"):(O="y",w="x","width"),z=w+"2",S[O]=x[O]=k[O]=R,S[z]=x[z]=D?(x[w]={scale:D,range:0,mult:$,offset:_},{scale:D,range:1,mult:$,offset:_}):(x[w]={value:_},{signal:j,mult:$,offset:_}),Ln(In,bn,null,Yt,y,b,v))),n.ticks&&(a=Cn("tickSize",e,Be),l.push((V=e,A=Be,F=Ne.ticks,W=i,L=a,U=V.orient,I=U===Lt||U===Wt?-1:1,En(C={enter:M={opacity:X={value:0}},update:B={opacity:{value:1}},exit:q={opacity:X}},"stroke",Cn("tickColor",V,A)),En(C,"strokeOpacity",Cn("tickOpacity",V,A)),En(C,"strokeWidth",Cn("tickWidth",V,A)),(N=_n(L)).mult=I,T={scale:V.scale,field:Yt,band:Cn("bandPosition",V,A),round:Cn("tickRound",V,A),extra:Cn("tickExtra",V,A),offset:Cn("tickOffset",V,A)},U===Wt||U===Mt?(B.y=M.y=X,B.y2=M.y2=N,B.x=M.x=q.x=T):(B.x=M.x=X,B.x2=M.x2=N,B.y=M.y=q.y=T),Ln(In,kn,null,Yt,W,C,F)))),n.labels&&(a=n.ticks?a:0,l.push((Y=e,G=Be,H=Ne.labels,J=i,K=a,le=Y.orient,se=le===Lt||le===Wt?-1:1,ue=le===Wt||le===Mt,de=Y.scale,ce=Je(Cn("labelFlush",Y,G)),fe=Je(Cn("labelFlushOffset",Y,G)),pe=0===ce||!!ce,ge=Cn("labelAlign",Y,G),he=Cn("labelBaseline",Y,G),me={value:0},(ee=_n(K)).mult=se,ee.offset=_n(Cn("labelPadding",Y,G)||0),ee.offset.mult=se,te={scale:de,field:Yt,band:.5,offset:Cn("tickOffset",Y,G)},ie=(ie=ue?(ne=ge||(pe?zr(de,ce,'"left"','"right"','"center"'):"center"),re=he||(le===Wt?"bottom":"top"),!ge):(ne=ge||(le===Ct?"left":"right"),re=he||(pe?zr(de,ce,'"top"','"bottom"','"middle"'):"middle"),!he))&&pe&&fe?zr(de,ce,"-"+fe,fe,0):null,En(Q={enter:Z={opacity:me,x:ue?te:ee,y:ue?ee:te},update:{opacity:{value:1},text:{field:Nt},x:Z.x,y:Z.y},exit:{opacity:me,x:Z.x,y:Z.y}},ue?"dx":"dy",ie),En(Q,"align",ne),En(Q,"baseline",re),En(Q,"angle",Cn("labelAngle",Y,G)),En(Q,"fill",Cn("labelColor",Y,G)),En(Q,"font",Cn("labelFont",Y,G)),En(Q,"fontSize",Cn("labelFontSize",Y,G)),En(Q,"fontWeight",Cn("labelFontWeight",Y,G)),En(Q,"limit",Cn("labelLimit",Y,G)),En(Q,"fillOpacity",Cn("labelOpacity",Y,G)),ae=Cn("labelBound",Y,G),oe=Cn("labelOverlap",Y,G),Y=Ln(Yn,xn,Gt,Yt,J,Q,H),(oe||ae)&&(Y.overlap={method:oe,order:"datum.index",bound:ae?{scale:de,orient:le,tolerance:ae}:null}),Y))),n.domain&&l.push((ve=e,ye=Be,be=Ne.domain,xe=r,je=ve.orient,En(ke={enter:Se={opacity:Pe={value:0}},update:Re={opacity:{value:1}},exit:{opacity:Pe}},"stroke",Cn("domainColor",ve,ye)),En(ke,"strokeWidth",Cn("domainWidth",ve,ye)),En(ke,"strokeOpacity",Cn("domainOpacity",ve,ye)),ze=je===Wt||je===Mt?(Oe="x","y"):(Oe="y","x"),we=Oe+"2",Se[ze]=Pe,Re[Oe]=Se[Oe]=wr(ve,0),Re[we]=Se[we]=wr(ve,1),Ln(In,yn,null,null,xe,ke,be))),n.title&&l.push((De=e,$e=Be,_e=Ne.title,Ee=r,Le=De.orient,Ce=Le===Lt||Le===Wt?-1:1,Me=Le===Wt||Le===Mt,Ve={enter:Ae={opacity:qe={value:0}},update:Fe={opacity:{value:1},text:_n(De.title)},exit:{opacity:qe}},We={scale:De.scale,range:.5},Ae.baseline=Me?(Fe.x=We,Ae.angle={value:0},{value:Le===Wt?"bottom":"top"}):(Fe.y=We,Ae.angle={value:90*Ce},{value:"bottom"}),En(Ve,"align",Cn("titleAlign",De,$e)),En(Ve,"angle",Cn("titleAngle",De,$e)),En(Ve,"baseline",Cn("titleBaseline",De,$e)),En(Ve,"fill",Cn("titleColor",De,$e)),En(Ve,"font",Cn("titleFont",De,$e)),En(Ve,"fontSize",Cn("titleFontSize",De,$e)),En(Ve,"fontWeight",Cn("titleFontWeight",De,$e)),En(Ve,"limit",Cn("titleLimit",De,$e)),En(Ve,"fillOpacity",Cn("titleOpacity",De,$e)),!En(Ve,"x",Cn("titleX",De,$e),"update")&&Me&&!Wn("x",_e)&&(Ve.enter.auto={value:!0}),!En(Ve,"y",Cn("titleY",De,$e),"update")&&!Me&&!Wn("y",_e)&&(Ve.enter.auto={value:!0}),Ln(Yn,Sn,Ht,null,Ee,Ve,_e))),o=Kn(vn,Xe,Ue,r,Ie,Te,l),e.zindex&&(o.zindex=e.zindex),vr(o,t)}function Pr(e,i,t){var n=Ye.array(e.signals),r=Ye.array(e.scales);return t||n.forEach(function(e){m(e,i)}),Ye.array(e.projections).forEach(function(e){!function(e,t){var n={};for(var r in e)"name"!==r&&(n[r]=Ft(e[r],r,t));t.addProjection(e.name,n)}(e,i)}),r.forEach(function(e){var t,n,r;n=i,r=(t=e).type||"linear",Rt.hasOwnProperty(r)||Ye.error("Unrecognized scale type: "+Ye.stringValue(r)),n.addScale(t.name,{type:r,domain:void 0})}),Ye.array(e.data).forEach(function(e){Rr(e,i)}),r.forEach(function(e){$t(e,i)}),n.forEach(function(e){Be(e,i)}),Ye.array(e.axes).forEach(function(e){jr(e,i)}),Ye.array(e.marks).forEach(function(e){vr(e,i)}),Ye.array(e.legends).forEach(function(e){yr(e,i)}),e.title&&Sr(e.title,i),i.parseLambdas(),i}var Dr=Ye.toSet(["width","height","padding","autosize"]);function $r(e,t){var n,r,i,a,o,l,s,u,d,c,f=t.config;return t.background=e.background||f.background,t.eventConfig=f.events,o=Ge(t.root=t.add(ke())),t.addSignal("width",e.width||0),t.addSignal("height",e.height||0),t.addSignal("padding",(l=e.padding,s=f,l=l||s.padding,Ye.isObject(l)?{top:h(l.top),bottom:h(l.bottom),left:h(l.left),right:h(l.right)}:{top:u=h(l),bottom:u,left:u,right:u})),t.addSignal("autosize",(d=e.autosize,c=f,d=d||c.autosize,Ye.isObject(d)?d:{type:d=d||"pad"})),Ye.array(e.signals).forEach(function(e){Dr[e.name]||m(e,t)}),r=t.add(Qe()),i=Vn({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),i=t.add(Ze(An(i,Tn,hn,e.style,t,{pulse:Ge(r)}))),a=t.add(bt({layout:t.objectProperty(e.layout),legendMargin:f.legendMargin,autosize:t.signalRef("autosize"),mark:o,pulse:Ge(i)})),t.operators.pop(),t.pushState(Ge(i),Ge(a),null),Pr(e,t,!0),t.operators.push(a),n=t.add(Ue({mark:o,pulse:Ge(a)})),n=t.add(ht({pulse:Ge(n)})),n=t.add(vt({pulse:Ge(n)})),t.addData("root",new cr(t,r,r,n)),t}function _r(e){this.config=e,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function Er(e){this.config=e.config,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}var Vr=_r.prototype=Er.prototype;function Ar(e){return(Ye.isArray(e)?function(e){for(var t,n="[",r=0,i=e.length;r<i;++r)t=e[r],n+=(0<r?",":"")+(Ye.isObject(t)?t.signal||Ar(t):Ye.stringValue(t));return n+"]"}:function(e){var t,n,r="{",i=0;for(t in e)n=e[t],r+=(1<++i?",":"")+Ye.stringValue(t)+":"+(Ye.isObject(n)?n.signal||Ar(n):Ye.stringValue(n));return r+"}"})(e)}function Fr(e){var i={padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:Mr},area:{fill:Mr},image:null,line:{stroke:Mr,strokeWidth:Cr},path:{stroke:Mr},rect:{fill:Mr},rule:{stroke:qr},shape:{stroke:Mr},symbol:{fill:Mr,size:64},text:{fill:qr,font:Wr,fontSize:11},style:{"guide-label":{fill:qr,font:Wr,fontSize:10},"guide-title":{fill:qr,font:Wr,fontSize:11,fontWeight:"bold"},"group-title":{fill:qr,font:Wr,fontSize:13,fontWeight:"bold"},point:{size:Lr,strokeWidth:Cr,shape:"circle"},circle:{size:Lr,strokeWidth:Cr},square:{size:Lr,strokeWidth:Cr,shape:"square"},cell:{fill:"transparent",stroke:Nr}},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:Br,grid:!1,gridWidth:1,gridColor:Nr,labels:!0,labelAngle:0,labelLimit:180,labelPadding:2,ticks:!0,tickColor:Br,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titleAlign:"center",titlePadding:4},axisBand:{tickOffset:-1},legend:{orient:"right",offset:18,padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:Nr,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:Br,titleAlign:"left",titleBaseline:"top",titleLimit:180,titlePadding:5},title:{orient:"top",anchor:"middle",offset:4},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues",extent:[.2,1]},heatmap:{scheme:"viridis"},ramp:{scheme:"blues",extent:[.2,1]},diverging:{scheme:"blueorange"},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}};return(e||[]).forEach(function(e){var t,n,r;if(e)for(t in e)if("style"===t)for(t in r=i.style||(i.style={}),e.style)r[t]=Ye.extend(r[t]||{},e.style[t]);else n=e[t],i[t]=Ye.isObject(n)&&!Ye.isArray(n)?Ye.extend(Ye.isObject(i[t])?i[t]:{},n):n}),i}Vr.fork=function(){return new Er(this)},Vr.isSubscope=function(){return 0<this._subid},Vr.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},Vr.id=function(){return(this._subid?this._subid+":":0)+this._id++},Vr.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach(function(e){e.$ref=t.id}),t.refs=null),t},Vr.proxy=function(e){var t=e instanceof be?Ge(e):e;return this.add(pt({value:t}))},Vr.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},Vr.addUpdate=function(e){return this.updates.push(e),e},Vr.finish=function(){var e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){var r;e&&((r=e.data||(e.data={}))[t]||(r[t]=[])).push(n)}for(e in this.data)for(var r in n((t=this.data[e]).input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values"),t.index)n(t.index[r],e,"index:"+r);return this},Vr.pushState=function(e,t,n){this._encode.push(Ge(this.add(vt({pulse:e})))),this._parent.push(t),this._lookup.push(n?Ge(this.proxy(n)):null),this._markpath.push(-1)},Vr.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},Vr.parent=function(){return Ye.peek(this._parent)},Vr.encode=function(){return Ye.peek(this._encode)},Vr.lookup=function(){return Ye.peek(this._lookup)},Vr.markpath=function(){var e=this._markpath;return++e[e.length-1]},Vr.fieldRef=function(e,t){if(Ye.isString(e))return Re(e,t);e.signal||Ye.error("Unsupported field reference: "+Ye.stringValue(e));var n,r=e.signal,i=this.field[r];return i||(n={name:this.signalRef(r)},t&&(n.as=t),this.field[r]=i=Ge(this.add(nt(n)))),i},Vr.compareRef=function(e,t){function n(e){return $e(e)?(i=!0,r.signalRef(e.signal)):e}var r=this,i=!1,a=Ye.array(e.field).map(n),o=Ye.array(e.order).map(n);return t&&a.push(Se),i?Ge(this.add(Ie({fields:a,orders:o}))):we(a,o)},Vr.keyRef=function(e,t){var n,r=this.signals,i=!1;return e=Ye.array(e).map(function(e){return $e(e)?(i=!0,Ge(r[e.signal])):e}),i?Ge(this.add(rt({fields:e,flat:t}))):(n={$key:e},t&&(n.$flat=!0),n)},Vr.sortRef=function(e){if(!e)return e;var t=[je(e.op,e.field),Se],n=e.order||"ascending";return n.signal?Ge(this.add(Ie({fields:t,orders:[n=this.signalRef(n.signal),n]}))):we(t,[n,n])},Vr.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},Vr.addSignal=function(e,t){this.signals.hasOwnProperty(e)&&Ye.error("Duplicate signal name: "+Ye.stringValue(e));var n=t instanceof be?t:this.add(ke(t));return this.signals[e]=n},Vr.getSignal=function(e){return this.signals[e]||Ye.error("Unrecognized signal name: "+Ye.stringValue(e)),this.signals[e]},Vr.signalRef=function(e){return this.signals[e]?Ge(this.signals[e]):(this.lambdas.hasOwnProperty(e)||(this.lambdas[e]=this.add(ke(null))),Ge(this.lambdas[e]))},Vr.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,n=e.length;t<n;++t){var r=e[t],i=Me(r,this),a=this.lambdas[r];a.params=i.$params,a.update=i.$expr}},Vr.property=function(e){return e&&e.signal?this.signalRef(e.signal):e},Vr.objectProperty=function(e){return e&&Ye.isObject(e)?this.signalRef(e.signal||Ar(e)):e},Vr.exprRef=function(e,t){var n={expr:Me(e,this)};return t&&(n.expr.$name=t),Ge(this.add(et(n)))},Vr.addBinding=function(e,t){this.bindings||Ye.error("Nested signals do not support binding: "+Ye.stringValue(e)),this.bindings.push(Ye.extend({signal:e},t))},Vr.addScaleProj=function(e,t){this.scales.hasOwnProperty(e)&&Ye.error("Duplicate scale or projection name: "+Ye.stringValue(e)),this.scales[e]=this.add(t)},Vr.addScale=function(e,t){this.addScaleProj(e,mt(t))},Vr.addProjection=function(e,t){this.addScaleProj(e,ft(t))},Vr.getScale=function(e){return this.scales[e]||Ye.error("Unrecognized scale name: "+Ye.stringValue(e)),this.scales[e]},Vr.projectionRef=Vr.scaleRef=function(e){return Ge(this.getScale(e))},Vr.projectionType=Vr.scaleType=function(e){return this.getScale(e).params.type},Vr.addData=function(e,t){return this.data.hasOwnProperty(e)&&Ye.error("Duplicate data set name: "+Ye.stringValue(e)),this.data[e]=t},Vr.getData=function(e){return this.data[e]||Ye.error("Undefined data set name: "+Ye.stringValue(e)),this.data[e]},Vr.addDataPipeline=function(e,t){return this.data.hasOwnProperty(e)&&Ye.error("Duplicate data set name: "+Ye.stringValue(e)),this.addData(e,cr.fromEntries(this,t))};var Wr="sans-serif",Lr=30,Cr=2,Mr="#4c78a8",qr="#000",Br="#888",Nr="#ddd";e.formatLocale=a.formatDefaultLocale,e.timeFormatLocale=l.timeFormatDefaultLocale,e.parse=function(e,t){return Ye.isObject(e)||Ye.error("Input Vega specification must be an object."),$r(e,new _r(Fr([t,e.config]))).toRuntime()},e.config=Fr,e.signal=m,e.signalUpdates=Be,e.stream=Ve,e.codeGenerator=ve,e.functionContext=fe,e.expressionFunction=he,e.MarkRole=gn,e.FrameRole=hn,e.ScopeRole=mn,e.AxisRole=vn,e.AxisDomainRole=yn,e.AxisGridRole=bn,e.AxisLabelRole=xn,e.AxisTickRole=kn,e.AxisTitleRole=Sn,e.LegendRole=Rn,e.LegendEntryRole=wn,e.LegendLabelRole=jn,e.LegendSymbolRole=Pn,e.LegendTitleRole=Dn,e.Scope=_r,e.DataScope=cr,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "vega-parser",
"version": "3.8.0",
"version": "3.9.0",
"description": "Parse Vega specifications to runtime dataflows.",

@@ -33,13 +33,13 @@ "keywords": [

"dependencies": {
"d3-array": "^1.2.4",
"d3-array": "^2.0.2",
"d3-color": "^1.2.3",
"d3-format": "^1.3.2",
"d3-geo": "^1.11.1",
"d3-geo": "^1.11.3",
"d3-time-format": "^2.1.3",
"vega-dataflow": "^4.0.4",
"vega-dataflow": "^4.1.0",
"vega-event-selector": "^2.0.0",
"vega-expression": "^2.4.0",
"vega-scale": "^2.5.0",
"vega-scale": "^2.5.1",
"vega-scenegraph": "^3.2.3",
"vega-statistics": "^1.2.2",
"vega-statistics": "^1.2.3",
"vega-util": "^1.7.0"

@@ -49,7 +49,7 @@ },

"eslint": "5",
"rollup": "0.66.6",
"rollup": "0.67.4",
"tape": "4",
"uglify-js": "3",
"vega-transforms": "^2.3.0"
"vega-transforms": "^2.3.1"
}
}

@@ -132,6 +132,8 @@ import {stringOrSignal} from './util';

"url": stringOrSignal,
"format": [
{"$ref": "#/defs/dataFormat"},
{"$ref": "#/refs/signal"}
]
"format": {
"oneOf": [
{"$ref": "#/defs/dataFormat"},
{"$ref": "#/refs/signal"}
]
}
},

@@ -138,0 +140,0 @@ "required": ["url"]

@@ -41,3 +41,4 @@ export default {

{"$ref": "#/defs/signalPush"},
{"$ref": "#/defs/signalNew"}
{"$ref": "#/defs/signalNew"},
{"$ref": "#/defs/signalInit"}
]

@@ -63,2 +64,15 @@ },

},
"signalInit": {
"type": "object",
"properties": {
"name": {"$ref": "#/defs/signalName"},
"description": {"type": "string"},
"value": {},
"init": {"$ref": "#/refs/exprString"},
"on": {"$ref": "#/defs/onEvents"},
"bind": {"$ref": "#/defs/bind"}
},
"additionalProperties": false,
"required": ["name", "init"]
},
"signalPush": {

@@ -65,0 +79,0 @@ "type": "object",

import parseExpression from './expression';
import parseUpdate from './update';
import {error} from 'vega-util';
export default function(signal, scope) {
var op = scope.getSignal(signal.name);
var op = scope.getSignal(signal.name),
expr = signal.update;
if (signal.update) {
var expr = parseExpression(signal.update, scope);
if (signal.init) {
if (expr) {
error('Signals can not include both init and update expressions.');
} else {
expr = signal.init;
op.initonly = true;
}
}
if (expr) {
expr = parseExpression(expr, scope);
op.update = expr.$expr;

@@ -10,0 +21,0 @@ op.params = expr.$params;

import {error, stringValue} from 'vega-util';
var OUTER = 'outer',
OUTER_INVALID = ['value', 'update', 'react', 'bind'];
OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind'];

@@ -6,0 +6,0 @@ function outerError(prefix, name) {

@@ -212,3 +212,3 @@ import DataScope from './DataScope';

signal = true;
return ref(sig[_.signal]);
return scope.signalRef(_.signal);
} else {

@@ -219,3 +219,3 @@ return _;

var sig = this.signals,
var scope = this,
signal = false,

@@ -222,0 +222,0 @@ fields = array(cmp.field).map(check),

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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