vega-parser
Advanced tools
Comparing version 1.0.0-beta.26 to 1.0.0-beta.27
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression"),require("d3-color"),require("d3-format"),require("d3-time-format"),require("vega-scale"),require("vega-scenegraph"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","d3-color","d3-format","d3-time-format","vega-scale","vega-scenegraph","vega-dataflow"],t):t(e.vega=e.vega||{},e.vega,e.vega,e.d3,e.d3,e.d3,e.vega,e.vega,e.vega)}(this,function(e,t,n,a,r,i,o,l,u){"use strict";function s(e,n){t.error(e+' for "outer" push: '+t.stringValue(n))}function d(e){var t={};return function(n,a){var r=t[a]||(t[a]=e(a));return r(n)}}function c(e,t,n){return Ot.setMonth(e),Ot.setDate(t),Et(Ot,n)}function f(e){return c(e,1,"%B")}function p(e){return c(e,1,"%b")}function g(e){return c(0,2+e,"%A")}function h(e){return c(0,2+e,"%a")}function m(e){return 1+~~(new Date(e).getMonth()/3)}function v(e){return 1+~~(new Date(e).getUTCMonth()/3)}function y(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function b(){return y(this.context.dataflow,"warn",arguments)}function x(){return y(this.context.dataflow,"info",arguments)}function k(){return y(this.context.dataflow,"debug",arguments)}function w(){return"Math.sqrt(Math.pow(event.touches[0].clientX - event.touches[1].clientX, 2) + Math.pow(event.touches[0].clientY - event.touches[1].clientY, 2))"}function S(){return"Math.atan2(event.touches[1].clientY - event.touches[0].clientY,event.touches[1].clientX - event.touches[0].clientX)"}function R(e,t){var n=this.context.dataflow;Dt&&Dt.open?n.loader().sanitize(e,{context:"open",name:t}).then(function(e){Dt.open(e,t)}).catch(function(e){n.warn("Open url failed: "+e)}):n.warn("Open function can only be invoked in a browser.")}function z(){return Dt?Dt.screen:{}}function P(){return Dt?[Dt.innerWidth,Dt.innerHeight]:[void 0,void 0]}function $(e,n){var a=t.isString(e)?n.scales[e]:t.isObject(e)&&e.signal?n.signals[e.signal]:void 0;return a&&a.value}function E(e,t,a,r){if(t[0].type===jt){e=t[0].value;var i=Ct+e;if(!r.hasOwnProperty(i))try{r[i]=a.scaleRef(e)}catch(e){}}else t[0].type===Mt&&(e=t[0].name,t[0]=new n.ASTNode(jt),t[0].raw='{signal:"'+e+'"}')}function O(e,t){var n=$(e,(t||this).context);return n&&n.range?n.range():[0,0]}function F(e,t){var n=$(e,(t||this).context);return n?n.domain():[]}function V(e,t){var n=$(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}function D(e,t,n){return o.bandSpace(e||0,t||0,n||0)}function _(e,t){var n=$(e,(t||this).context);return n?n.copy():void 0}function j(e,t,n){var a=$(e,(n||this).context);return a?a(t):void 0}function M(e,n,a){var r=$(e,(a||this).context);return r?t.isArray(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0}function A(e){return function(t,n,a){var r=$(t,(a||this).context);return r&&r.path[e](n)}}function C(e){var t=this.context.data[e];return t?t.values.value:[]}function W(e,n,a,r){n[0].type!==jt&&t.error("First argument to data functions must be a string literal.");var i=n[0].value,o=Wt+i;r.hasOwnProperty(o)||(r[o]=a.getData(i).tuplesRef())}function q(e,t,n){var a=this.context.data[e]["index:"+t],r=a?a.value.get(n):void 0;return r?r.count:r}function L(e,n,a,r){n[0].type!==jt&&t.error("First argument to indata must be a string literal."),n[1].type!==jt&&t.error("Second argument to indata must be a string literal.");var i=n[0].value,o=n[1].value,l=At+o;r.hasOwnProperty(l)||(r[l]=a.getData(i).indataRef(a,o))}function U(e){return e.data}function B(e,t){var n=C.call(t,e);return n.root&&n.root.lookup||Tt}function T(e,t,n){var a=B(e,this),r=a[t],i=a[n];return r&&i?r.path(i).map(U):void 0}function I(e,t){var n=B(e,this)[t];return n?n.ancestors().map(U):void 0}function X(e){return function(t){for(var n in e)if("_id"!==n&&t[n]!==e[n])return!1;return!0}}function N(e,n){for(var a=n.fields,r=n.values,i=n.getter||(n.getter=[]),o=a.length,l=0;l<o;++l)if(i[l]=i[l]||t.field(a[l]),i[l](e)!==r[l])return!1;return!0}function Y(e,n){for(var a,r=n.intervals,i=r.length,o=0;o<i;++o)if(a=r[o].getter||(r[o].getter=t.field(r[o].field)),!It(a(e),r[o].extent))return!1;return!0}function H(e,t,n,a,r,i){for(var o,l,u=this.context.data[e],s=u?u.values.value:[],d=a!==Yt,c=s.length,f=0;f<c;++f)if(o=s[f],l=t===o.unit,!(r===Gt&&l||r===Ht&&!l)&&(l=i(n,o),d^l))return l;return!c||d}function G(e,t,n,a,r){return H.call(this,e,t,n,a,r,N)}function J(e,t,n,a,r){return H.call(this,e,t,n,a,r,Y)}function K(e,t,n){return 1===arguments.length?Jt[e]:(Jt[e]=t,n&&(en[e]=n),an&&(an.functions[e]=Zt+e),this)}function Q(e){var t=n.functions(e);Kt.forEach(function(e){t[e]=Qt+e});for(var a in Jt)t[a]=Zt+a;return t}function Z(e){return fn.hasOwnProperty(e)}function ee(e,t,n,a,r){for(var i,o=0,l=e.length;t<l;++t){if(i=e[t],!o&&i===n)return t;r&&r.indexOf(i)>=0?--o:a&&a.indexOf(i)>=0&&++o}return t}function te(e){for(var t=[],n=0,a=e.length,r=0;r<a;)r=ee(e,r,xn,hn+vn,mn+yn),t.push(e.substring(n,r).trim()),n=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function ne(e){return"["===e[0]?ae(e):re(e)}function ae(e){var t,n,a=1,r=e.length,i=1;if(i=ee(e,i,mn,hn,mn),i===r)throw"Empty between selector: "+e;if(t=te(e.substring(a,i)),2!==t.length)throw"Between selector must have two elements: "+e;if(e=e.slice(i+1).trim(),e[0]!==wn)throw"Expected '>' after between selector: "+e;return t=t.map(ne),n=ne(e.slice(1).trim()),n.between?{between:t,stream:n}:(n.between=t,n)}function re(e){var t,n,a={source:tn},r=[],i=[0,0],o=0,l=0,u=e.length,s=0;if(e[u-1]===yn){if(s=e.lastIndexOf(vn),!(s>=0))throw"Unmatched right brace: "+e;try{i=ie(e.substring(s+1,u-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,s).trim(),u=e.length,s=0}if(!u)throw e;if(e[0]===kn&&(o=++s),t=ee(e,s,bn),t<u&&(r.push(e.substring(l,t).trim()),l=s=++t),s=ee(e,s,hn),s===u)r.push(e.substring(l,u).trim());else if(r.push(e.substring(l,s).trim()),n=[],l=++s,l===u)throw"Unmatched left bracket: "+e;for(;s<u;){if(s=ee(e,s,mn),s===u)throw"Unmatched left bracket: "+e;if(n.push(e.substring(l,s).trim()),s<u-1&&e[++s]!==hn)throw"Expected left bracket: "+e;l=++s}if(!(u=r.length)||Sn.test(r[u-1]))throw"Invalid event selector: "+e;return u>1?(a.type=r[1],o?a.markname=r[0].slice(1):Z(r[0])?a.marktype=r[0]:a.source=r[0]):a.type=r[0],"!"===a.type.slice(-1)&&(a.consume=!0,a.type=a.type.slice(0,-1)),null!=n&&(a.filter=n),i[0]&&(a.throttle=i[0]),i[1]&&(a.debounce=i[1]),a}function ie(e){var t=e.split(xn);if(!e.length||t.length>2)throw e;return t.map(function(t){var n=+t;if(n!==n)throw e;return n})}function oe(e){return e===zn?Rn:e||Rn}function le(e,n){var a=e.merge?ue:e.stream?se:e.type?de:t.error("Invalid stream specification: "+t.stringValue(e));return a(e,n)}function ue(e,t){var n=e.merge.map(function(e){return le(e,t)}),a=ce({merge:n},e,t);return t.addStream(a).id}function se(e,t){var n=le(e.stream,t),a=ce({stream:n},e,t);return t.addStream(a).id}function de(e,t){var n=t.event(oe(e.source),e.type),a=ce({stream:n},e,t);return 1===Object.keys(a).length?n:t.addStream(a).id}function ce(e,n,a){var r=n.between;return r&&(2!==r.length&&t.error('Stream "between" parameter must have 2 entries: '+t.stringValue(n)),e.between=[le(r[0],a),le(r[1],a)]),r=n.filter?t.array(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(fe(n.marktype,n.markname,n.markrole)),n.source===zn&&r.push("inScope(event.item)"),r.length&&(e.filter=on("("+r.join(")&&(")+")").$expr),null!=(r=n.throttle)&&(e.throttle=+r),null!=(r=n.debounce)&&(e.debounce=+r),n.consume&&(e.consume=!0),e}function fe(e,t,n){var a="event.item";return a+(e&&"*"!==e?"&&"+a+".mark.marktype==='"+e+"'":"")+(n?"&&"+a+".mark.role==='"+n+"'":"")+(t?"&&"+a+".mark.name==='"+t+"'":"")}function pe(e,n){return t.isArray(e)?e.map(function(e){return pe(e,n)}):t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported parameter object: "+t.stringValue(e)):e}function ge(e,n,a,r){var i,o,l;if(e.signal)i="datum",l=Mn(e.signal,n,a,r);else if(e.group||e.parent){for(o=Math.max(1,e.level||1),i="item";o-- >0;)i+=".mark.group";e.parent?(l=e.parent,i+=".datum"):l=e.group}else e.datum?(i="datum",l=e.datum):t.error("Invalid field reference: "+t.stringValue(e));return e.signal||(t.isString(l)?(r[l]=1,l=t.splitAccessPath(l).map(t.stringValue).join("][")):l=ge(l,n,a,r)),i+"["+l+"]"}function he(e,n){if(!t.isString(e))return-1;var a=n.scaleType(e);return"band"===a||"point"===a?1:0}function me(e,n,a,r){var i;if(t.isString(e))i=Ct+e,a.hasOwnProperty(i)||(a[i]=n.scaleRef(e)),i=t.stringValue(i);else{for(i in n.scales)a[Ct+i]=n.scaleRef(i);i=t.stringValue(Ct)+"+"+An(e,n,a,r)}return"_["+i+"]"}function ve(e,n,a,r){var i,o,l,u={},s="var o=item,datum=o.datum,$;";for(i in e)o=e[i],t.isArray(o)?s+=Bn(i,o,r,a,u):(l=Ln(i,o,r,a,u),s+=Un("o",i,l));return s+=_n(e,n),s+="return 1;",{$expr:s,$fields:Object.keys(u),$output:Object.keys(e)}}function ye(e){return t.isObject(e)?e:{value:e}}function be(e,n,a){for(var r in n)a&&a.hasOwnProperty(r)||(e[r]=t.extend(e[r]||{},n[r]));return e}function xe(e,t,n,a,r){var i,o;r=r||{},r.encoders={$encode:i={}},e=ke(e,t,n,a.config);for(o in e)i[o]=ve(e[o],t,r,a);return r}function ke(e,n,a,r){var i,o,l;if(r=a===In?r.group:a===Tn?t.extend({},r.mark,r[n]):null){i={};for(o in r)l=we(o,e)||("fill"===o||"stroke"===o)&&(we("fill",e)||we("stroke",e)),l||(i[o]={value:r[o]});e=t.extend({},e),e.enter=t.extend(i,e.enter)}return e}function we(e,t){return t.enter&&t.enter[e]||t.update&&t.update[e]}function Se(e,t,n,a){this.id=-1,this.type=e,this.value=t,this.params=n,a&&(this.parent=a)}function Re(e,t,n,a){return new Se(e,t,n,a)}function ze(e,t){return Re("Operator",e,t)}function Pe(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function $e(e,t){return t?{$field:e,$name:t}:{$field:e}}function Ee(e,t){return{$compare:e,$order:t}}function Oe(e){return{$key:e}}function Fe(e){return t.isObject(e)?(e.order===Fa?"-":"+")+Ve(e.op,e.field):""}function Ve(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function De(e){return e&&e.signal}function _e(e){return function(t,n,a){return Re(e,n,t||void 0,a)}}function je(e,t,n){var a,r,i,o={};for(r=0,i=e.params.length;r<i;++r)a=e.params[r],o[a.name]=Me(a,t,n);return o}function Me(e,n,a){var r,i=e.type;return"index"===i?Ce(e,n,a):"param"===i?We(e,n,a):"projection"===i?a.projectionRef(n[e.name]):(r=n[e.name],void 0===r?void(e.required&&t.error("Missing required "+t.stringValue(n.type)+" parameter: "+t.stringValue(e.name))):e.array&&!De(r)?r.map(function(t){return Ae(e,t,a)}):Ae(e,r,a))}function Ae(e,n,a){var r=e.type;if(De(n))return Te(r)?t.error("Expression references can not be signals."):Ie(r)?a.fieldRef(n):Xe(r)?a.compareRef(n):a.signalRef(n.signal);var i=e.expr||Ie(r);return i&&Le(n)?on(n.expr,a):i&&Ue(n)?$e(n.field):Te(r)?on(n,a):Be(r)?Pe(a.getData(n).values):Ie(r)?$e(n):Xe(r)?Ee(t.array(n.field),t.array(n.order)):n}function Ce(e,n,a){return t.isString(n.from)||t.error('Lookup "from" parameter must be a string literal.'),a.getData(n.from).lookupRef(a,n.key)}function We(e,n,a){var r=n[e.name];return e.array?(t.isArray(r)||t.error("Expected an array of sub-parameters. Instead: "+t.stringValue(r)),r.map(function(t){return qe(e,t,a)})):qe(e,r,a)}function qe(e,n,a){var r,i,o,l,u;for(l=0,u=e.params.length;l<u;++l){i=e.params[l];for(o in i.key)if(i.key[o]!==n[o]){i=null;break}if(i)break}return i||t.error("Unsupported parameter: "+t.stringValue(n)),r=t.extend(je(i,n,a),i.key),Pe(a.add(Xa(r)))}function Le(e){return e&&e.expr}function Ue(e){return e&&e.field}function Be(e){return"data"===e}function Te(e){return"expr"===e}function Ie(e){return"field"===e}function Xe(e){return"compare"===e}function Ne(e,t,n,a,r){this.scope=e,this.input=t,this.output=n,this.values=a,this.aggregate=r,this.index={}}function Ye(e){return t.isString(e)?e:null}function He(e,t,n){var a,r=Ve(n.op,n.field);if(t.ops){for(var i=0,o=t.as.length;i<o;++i)if(t.as[i]===r)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((a=n.op.signal)?e.signalRef(a):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(r))}function Ge(e,t,n,a,r,i,o){var l,u,s=t[n]||(t[n]={}),d=Fe(i),c=Ye(r);if(null!=c&&(e=t.scope,c+=d?"|"+d:"",l=s[c]),!l){var f=i?{field:Ea,pulse:t.countsRef(e,r,i)}:{field:e.fieldRef(r),pulse:Pe(t.output)};d&&(f.sort=e.sortRef(i)),u=e.add(Re(a,void 0,f)),o&&(t.index[r]=u),l=Pe(u),null!=c&&(s[c]=l)}return l}function Je(e,t){return null!=e?e:t}function Ke(e,t,n){var a,r=+t.symbolSize;return a=n&&n.update&&n.update.fontSize,a||(a=n&&n.enter&&n.enter.fontSize),a&&(a=a.value),a||(a=+t.labelFontSize),e.size?{$expr:"Math.max(Math.ceil(Math.sqrt(_.scale(datum))),"+a+")"}:Math.max(Math.ceil(Math.sqrt(r)),a)}function Qe(e){return fr.hasOwnProperty(e)}function Ze(e){return"quantile"===e}function et(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+t.stringValue(e)):e}function tt(e,t){return e.signal?t.signalRef(e.signal):e.map(function(e){return et(e,t)})}function nt(e){t.error("Can not find data set: "+t.stringValue(e))}function at(e,n,a){return e?e.signal?a.signalRef(e.signal):(t.isArray(e)?rt:e.fields?ot:it)(e,n,a):void(null==n.domainMin&&null==n.domainMax||t.error("No scale domain defined for domainMin/domainMax to override."))}function rt(e,t,n){return e.map(function(e){return et(e,n)})}function it(e,t,n){var a=n.getData(e.data);return a||nt(e.data),Qe(t.type)?a.valuesRef(n,e.field,st(e.sort,!1)):Ze(t.type)?a.domainRef(n,e.field):a.extentRef(n,e.field)}function ot(e,n,a){var r=e.data,i=e.fields.reduce(function(e,n){return n=t.isString(n)?{data:r,field:n}:t.isArray(n)||n.signal?lt(n,a):n,e.push(n),e},[]);return(Qe(n.type)?ut:Ze(n.type)?dt:ct)(e,a,i)}function lt(e,n){var a="_:vega:_"+sr++,r=ja({});return t.isArray(e)?r.value={$ingest:e}:e.signal&&n.signalRef("modify("+t.stringValue(a)+","+e.signal+", true)"),n.addDataPipeline(a,[r,Qa({})]),{data:a,field:"data"}}function ut(e,t,n){var a,r,i,o;return a=n.map(function(e){var n=t.getData(e.data);return n||nt(e.data),n.countsRef(t,e.field)}),r=t.add(Va({groupby:Ea,ops:["sum"],fields:[t.fieldRef("count")],as:["count"],pulse:a})),i=t.add(ja({pulse:Pe(r)})),o=t.add(er({field:Ea,sort:t.sortRef(st(e.sort,!0)),pulse:Pe(i)})),Pe(o)}function st(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field?t.error("Multiple domain scales can not sort by field."):n&&e.op&&"count"!==e.op&&t.error("Multiple domain scales support op count only."):t.error("No field provided for sort aggregate op: "+e.op):t.isObject(e)?e.field="key":e={field:"key"}),e}function dt(e,t,n){var a=n.map(function(e){var n=t.getData(e.data);return n||nt(e.data),n.domainRef(t,e.field)});return Pe(t.add(Ia({values:a})))}function ct(e,t,n){var a=n.map(function(e){var n=t.getData(e.data);return n||nt(e.data),n.extentRef(t,e.field)});return Pe(t.add(Ta({extents:a})))}function ft(e,t){t.interpolate=et(e.type||e),null!=e.gamma&&(t.interpolateGamma=et(e.gamma))}function pt(e,n,a){var r=e.range,i=n.config.range;if(r.signal)return n.signalRef(r.signal);if(t.isString(r)){if(i&&i.hasOwnProperty(r))return e=t.extend({},e,{range:i[r]}),pt(e,n,a);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=Qe(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+t.stringValue(r))}else{if(r.scheme)return a.scheme=et(r.scheme,n),r.extent&&(a.schemeExtent=tt(r.extent,n)),void(r.count&&(a.schemeCount=et(r.count,n)));if(r.step)return void(a.rangeStep=et(r.step,n));if(Qe(e.type)&&!t.isArray(r))return at(r,e,n);t.isArray(r)||t.error("Unsupported range type: "+t.stringValue(r))}return r.map(function(e){return et(e,n)})}function gt(e,t){var n=[];e.transform&&e.transform.forEach(function(e){n.push(tr(e,t))}),e.on&&e.on.forEach(function(n){or(n,t,e.name)}),t.addDataPipeline(e.name,ht(e,t,n))}function ht(e,t,n){var a,r,i,o,l,u=[],s=null,d=!1,c=!1;for(e.values?u.push(s=mt({$ingest:e.values,$format:e.format})):e.url?u.push(s=mt({$request:e.url,$format:e.format})):e.source&&(a=t.getData(e.source),s=a.output,u.push(null)),r=0,i=n.length;r<i;++r)o=n[r],l=o.metadata,s||l.source||u.push(s=mt()),u.push(o),l.generates&&(c=!0),l.modifies&&!c&&(d=!0),l.source?s=o:l.changes&&(s=null);return a&&(u[0]=Ga({derive:d,pulse:Pe(a.output)}),d&&u.splice(1,0,mt())),s||u.push(mt()),u.push(Qa({})),u}function mt(e){var t=ja({},e);return t.metadata={source:!0},t}function vt(e,t){return{scale:e.scale,range:t}}function yt(e,n){var a,r,i,o,l;return n.background=e.background||n.config.background,l=Pe(n.root=n.add(ze())),n.addSignal("width",e.width||-1),n.addSignal("height",e.height||-1),n.addSignal("padding",wt(e.padding)),t.array(e.signals).forEach(function(e){wr[e.name]||zt(e,n)}),r=n.add(ja()),i=be({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),i=n.add(Ca(xe(i,ln,In,n,{pulse:Pe(r)}))),o=n.add(Za({legendMargin:n.config.legendMargin,autosize:e.autosize||n.config.autosize,mark:l,pulse:Pe(i)})),n.pushState(Pe(i),Pe(o)),kr(e,n,!0),a=n.add(_a({mark:l,pulse:Pe(o)})),a=n.add(Ja({pulse:Pe(a)})),a=n.add(Qa({pulse:Pe(a)})),n.addData("root",new Ne(n,r,r,a)),n}function bt(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._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._markpath=[]}function xt(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._markpath=e._markpath}function kt(){return{autosize:"pad",background:null,group:null,mark:null,arc:{fill:"steelblue"},area:{fill:"steelblue"},image:null,line:{stroke:"steelblue"},path:{stroke:"steelblue"},rect:{fill:"steelblue"},rule:{stroke:"#000"},shape:{stroke:"steelblue"},symbol:{fill:"steelblue",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:"#000",grid:!1,gridWidth:1,gridColor:"#ddd",gridDash:[],gridOpacity:1,label:!0,labelColor:"#000",labelFont:"sans-serif",labelFontSize:10,labelPadding:2,tick:!0,tickRound:!0,tickSize:5,tickWidth:1,tickColor:"#000",titleAlign:"center",titlePadding:2,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold"},legend:{orient:"right",offset:18,padding:0,entryPadding:5,titlePadding:5,gradientWidth:100,gradientHeight:20,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelBaseline:"top",gradientLabelOffset:2,labelColor:"#000",labelFontSize:10,labelFont:"sans-serif",labelAlign:"left",labelBaseline:"middle",labelOffset:8,symbolType:"circle",symbolSize:100,symbolColor:"#888",symbolStrokeWidth:1.5,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold",titleAlign:"left",titleBaseline:"top"},range:{category:{scheme:"category10"},ordinal:{scheme:"blues",extent:[.2,1]},heatmap:{scheme:"plasma"},ramp:{scheme:"greens",extent:[.2,1]},diverging:{scheme:"purpleorange"},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}var wt=function(e){return t.isObject(e)?e:t.isNumber(e)?{top:e,bottom:e,left:e,right:e}:{top:0,left:0,bottom:0,right:0}},St="outer",Rt=["value","update","react","bind"],zt=function(e,t){var n=e.name;if(e.push===St)t.signals[n]||s("No prior signal definition",n),Rt.forEach(function(t){void 0!==e[t]&&s("Invalid property ",t)});else{var a=t.addSignal(n,e.value);e.react===!1&&(a.react=!1),e.bind&&t.addBinding(n,e.bind)}},Pt=d(r.format),$t=d(i.utcFormat),Et=d(i.timeFormat),Ot=new Date(2e3,0,1),Ft=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},Vt=function(e,t,n){var a,r=e[0],i=e[1];return i<r&&(a=i,i=r,r=a),a=i-r,a>=n-t?[t,n]:[Math.min(Math.max(r,t),n-a),Math.min(Math.max(i,a),n)]},Dt="undefined"!=typeof window&&window||null,_t=function(e){return e[e.length-1]-e[0]},jt="Literal",Mt="Identifier",At="@",Ct="%",Wt=":",qt=function(e,t,n,a){var r=l.Gradient(t,n),i=e.domain(),u=i[0],s=i[i.length-1],d=o.scaleFraction(e,u,s);e.ticks&&(i=e.ticks(+a||15),u!==i[0]&&i.unshift(u),s!==i[i.length-1]&&i.push(s));for(var c=0,f=i.length;c<f;++c)r.stop(d(i[c]),e(i[c]));return r},Lt=A("area"),Ut=A("bounds"),Bt=A("centroid"),Tt={},It=function(e,t){var n,a=t[0],r=t[t.length-1];return a>r&&(n=a,a=r,r=n),a<=e&&e<=r},Xt=function(e,t,n){if(e){var a=this.context.dataflow,r=e.mark.source;a.pulse(r,a.changeset().encode(e,t))}return void 0!==n?n:e},Nt=function(e,n,a,r,i,o){var l,u,s=this.context.dataflow,d=this.context.data[e],c=d.input,f=d.changes,p=s.stamp();if(s._trigger===!1||!(c.value.length||n||r))return 0;if((!f||f.stamp<p)&&(d.changes=f=s.changeset(),f.stamp=p,s.runAfter(function(){d.modified=!0,s.pulse(c,f).run()})),a&&(l=a===!0?t.truthy:t.isArray(a)||null!=a._id?a:X(a),f.remove(l)),n&&f.insert(n),r&&(l=X(r),c.value.some(l)?f.remove(l):f.insert(r)),i)for(u in o)f.modify(i,u,o[u]);return 1},Yt="union",Ht="unit",Gt="others",Jt={pad:t.pad,truncate:t.truncate,rgb:a.rgb,lab:a.lab,hcl:a.hcl,hsl:a.hsl,format:Pt,utcFormat:$t,timeFormat:Et,monthFormat:f,monthAbbrevFormat:p,dayFormat:g,dayAbbrevFormat:h,quarter:m,utcquarter:v,warn:b,info:x,debug:k,inScope:Ft,clampRange:Vt,pinchDistance:w,pinchAngle:S,open:R,screen:z,windowsize:P,span:_t,bandspace:D,inrange:It,encode:Xt,modify:Nt},Kt=["view","item","group","xy","x","y"],Qt="event.vega.",Zt="this.",en={};K("bandwidth",V,E),K("copy",_,E),K("domain",F,E),K("range",O,E),K("invert",M,E),K("scale",j,E),K("gradient",qt,E),K("geoArea",Lt,E),K("geoBounds",Ut,E),K("geoCentroid",Bt,E),K("indata",q,L),K("data",C,W),K("vlPoint",G,W),K("vlInterval",J,W),K("treePath",T,W),K("treeAncestors",I,W);var tn,nn={blacklist:["_"],whitelist:["datum","event"],fieldvar:"datum",globalvar:function(e){return"_["+t.stringValue("$"+e)+"]"},functions:Q,constants:n.constants,visitors:en},an=n.codegen(nn),rn="$",on=function(e,a,r){var i,o,l={};try{i=n.parse(e)}catch(n){t.error("Expression parse error: "+t.stringValue(e))}return i.visit(function(e){if("CallExpression"===e.type){var t=e.callee.name,n=nn.visitors[t];n&&n(t,e.arguments,a,l)}}),o=an(i),o.globals.forEach(function(e){var t=rn+e;!l.hasOwnProperty(t)&&a.getSignal(e)&&(l[t]=a.signalRef(e))}),{$expr:r?r+"return("+o.code+");":o.code,$fields:o.fields,$params:l}},ln="group",un="rect",sn="rule",dn="symbol",cn="text",fn=t.toSet(["*","arc","area","group","image","line","path","rect","rule","shape","symbol","text"]),pn=function(e,t){return tn=t||gn,te(e.trim()).map(ne)},gn="view",hn="[",mn="]",vn="{",yn="}",bn=":",xn=",",kn="@",wn=">",Sn=/[\[\]\{\}]/,Rn="view",zn="scope",Pn=function(e,t){return e.signal?t.getSignal(e.signal).id:le(e,t)},$n="var datum=event.item&&event.item.datum;",En=function(e,n,a){var r,i=e.events,o=e.update,l=e.encode,u=[],s="";i||t.error("Signal update missing events specification."),t.isString(i)&&(i=pn(i)),i=t.array(i).filter(function(e){return e.signal?(u.push(e),0):1}),i.length&&u.push(i.length>1?{merge:i}:i[0]),null!=l&&(o&&t.error("Signal encode and update are mutually exclusive."),o="encode(item(),"+t.stringValue(l)+")"),s=t.isString(o)?on(o,n,$n):null!=o.expr?on(o.expr,n,$n):null!=o.value?o.value:null!=o.signal?{$expr:"_.value",$params:{value:n.signalRef(o.signal)}}:t.error("Invalid signal update specification."),r={target:a,update:s},e.force&&(r.options={force:!0}),u.forEach(function(e){e={source:Pn(e,n)},n.addUpdate(t.extend(e,r))})},On=function(e,t){var n=t.getSignal(e.name);if(e.update){var a=on(e.update,t);n.update=a.$expr,n.params=a.$params}e.on&&e.on.forEach(function(e){En(e,t,n.id)})},Fn=function(e,t){var n={};for(var a in e)"name"!==a&&(n[a]=pe(e[a],t));t.addProjection(e.name,n)},Vn=t.toSet(["rule"]),Dn=t.toSet(["group","image","rect"]),_n=function(e,t){var n="";return Vn[t]?n:(e.x2&&(e.x?(Dn[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+=e.width?"o.x=o.x2-o.width;":"o.x=o.x2;"),e.xc&&(n+=e.width?"o.x=o.xc-o.width/2;":"o.x=o.xc;"),e.y2&&(e.y?(Dn[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+=e.height?"o.y=o.y2-o.height;":"o.y=o.y2;"),e.yc&&(n+=e.height?"o.y=o.yc-o.height/2;":"o.y=o.yc;"),n)},jn=function(e,t,n,a){function r(e,r,i,o){var l=Ln(null,r,t,n,a),u=Ln(null,i,t,n,a),s=Ln(null,o,t,n,a);return"this."+e+"("+[l,u,s].join(",")+").toString()"}return e.c?r("hcl",e.h,e.c,e.l):e.h||e.s?r("hsl",e.h,e.s,e.l):e.l||e.a?r("lab",e.l,e.a,e.b):e.r||e.g||e.b?r("rgb",e.r,e.g,e.b):null},Mn=function(e,n,a,r){var i=on(e,n);return i.$fields.forEach(function(e){r[e]=1}),t.extend(a,i.$params),i.$expr},An=function(e,n,a,r){return ge(t.isObject(e)?e:{datum:e},n,a,r)},Cn=function(e,t,n,a,r){var i,o,l,u=me(e.scale,n,a,r);return null!=e.range?(i=+e.range,o=u+".range()",t=0===i?o+"[0]":"($="+o+","+(1===i?"$[$.length-1]":"$[0]+"+i+"*($[$.length-1]-$[0])")+")"):(t=null!=t?u+"("+t+")":null,e.band&&(l=he(e.scale,n))&&(o=u+".bandwidth",i=+e.band,i=o+"()"+(1===i?"":"*"+i),l<0&&(i="("+o+"?"+i+":0)"),t=(t?t+"+":"")+i,e.extra&&(t="(datum.extra?"+u+"(datum.extra.value):"+t+")")),null==t&&(t="0")),t},Wn=function(e,n,a,r){return"this.gradient("+me(e.gradient,n,a,r)+","+t.stringValue(e.start)+","+t.stringValue(e.stop)+","+t.stringValue(e.count)+")"},qn=function(e,n,a,r){return t.isObject(e)?"("+Ln(null,e,n,a,r)+")":e},Ln=function(e,n,a,r,i){if(null!=n.gradient)return Wn(n,a,r,i);var o=null!=n.color?jn(n.color,a,r,i):null!=n.field?An(n.field,a,r,i):null!=n.signal?Mn(n.signal,a,r,i):null!=n.value?t.stringValue(n.value):null;return null!=n.scale&&(o=Cn(n,o,a,r,i)),null!=n.exponent&&(o="Math.pow("+o+","+qn(n.exponent,a,r,i)+")"),null!=n.mult&&(o+="*"+qn(n.mult,a,r,i)),null!=n.offset&&(o+="+"+qn(n.offset,a,r,i)),n.round&&(o="Math.round("+o+")"),o},Un=function(e,n,a){return e+"["+t.stringValue(n)+"]="+a+";"},Bn=function(e,t,n,a,r){var i="";return t.forEach(function(t){var o=Ln(e,t,n,a,r);i+=t.test?Mn(t.test,n,a,r)+"?"+o+":":o}),Un("o",e,i)},Tn="mark",In="frame",Xn="scope",Nn="axis",Yn="axis-domain",Hn="axis-grid",Gn="axis-label",Jn="axis-tick",Kn="axis-title",Qn="legend",Zn="legend-entry",ea="legend-gradient",ta="legend-label",na="legend-symbol",aa="legend-title",ra={name:1,interactive:1},ia=function(e,t,n,a,r,i){return{type:e,name:i?i.name:void 0,role:t,key:n,from:a,interactive:!(!i||!i.interactive),encode:be(r,i,ra)}},oa=function(e,t,n){var a={value:0},r={};return r.enter={opacity:a,x:a,y:a,width:{value:t.gradientWidth},height:{value:t.gradientHeight},stroke:{value:t.gradientStrokeColor},strokeWidth:{value:t.gradientStrokeWidth}},r.exit={opacity:a},r.update={x:a,y:a,width:{value:t.gradientWidth},height:{value:t.gradientHeight},fill:{gradient:e},opacity:{value:1}},ia(un,ea,void 0,void 0,r,n)},la="top",ua="left",sa="right",da="bottom",ca="index",fa="label",pa="offset",ga="perc",ha="size",ma="total",va="value",ya=["shape","size","fill","stroke","strokeDash","opacity"],ba="datum."+ga+'<=0?"left":datum.'+ga+'>=1?"right":"center"',xa=function(e,t,n,a){var r,i,o={value:0},l={};return l.enter=r={opacity:o,text:{field:fa},fill:{value:t.labelColor},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},baseline:{value:t.gradientLabelBaseline}},l.exit={opacity:o},l.update=i={opacity:{value:1}},r.x=i.x={field:ga,mult:t.gradientWidth},r.y=i.y={value:t.gradientHeight,offset:t.gradientLabelOffset},r.align=i.align={signal:ba},ia(cn,ta,fa,a,l,n)},ka=function(e,t,n,a){var r,i,o={value:0},l={};return l.enter=r={opacity:o,fill:{value:t.labelColor},text:{field:fa},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},align:{value:t.labelAlign},baseline:{value:t.labelBaseline}},l.exit={opacity:o},l.update=i={opacity:{value:1}},r.x=i.x={field:pa,offset:t.labelOffset},r.y=i.y={field:ha,mult:.5,offset:{field:ma,offset:{field:{group:"entryPadding"},mult:{field:ca}}}},ia(cn,ta,fa,a,l,n)},wa=function(e,t,n,a){var r,i,o={value:0},l={};return l.enter=r={opacity:o,shape:{value:t.symbolType},size:{value:t.symbolSize},strokeWidth:{value:t.symbolStrokeWidth}},e.fill||(r.stroke={value:t.symbolColor}),l.exit={opacity:o},l.update=i={opacity:{value:1}},r.x=i.x={field:pa,mult:.5},r.y=i.y={field:ha,mult:.5,offset:{field:ma,offset:{field:{group:"entryPadding"},mult:{field:ca}}}},ya.forEach(function(t){e[t]&&(i[t]=r[t]={scale:e[t],field:va})}),ia(dn,na,fa,a,l,n)},Sa=function(e,t,n,a){var r={value:0},i={};return i.enter={x:{field:{group:"padding"}},y:{field:{group:"padding"}},opacity:r,fill:{value:t.titleColor},font:{value:t.titleFont},fontSize:{value:t.titleFontSize},fontWeight:{value:t.titleFontWeight},align:{value:t.titleAlign},baseline:{value:t.titleBaseline}},i.exit={opacity:r},i.update={opacity:{value:1},text:{field:"title"}},ia(cn,aa,null,a,i,n)},Ra=function(e,t,n,a,r,i){return{type:ln,name:t,role:e,from:n,interactive:a,encode:r,marks:i}},za=function(e){return e.role||(e.type===ln&&(e.legends||e.axes)?Xn:Tn)},Pa=function(e){return{clip:e.clip||!1,interactive:e.interactive!==!1,marktype:e.type,name:e.name||void 0,role:za(e),zindex:+e.zindex||void 0}},$a=function(e){return e},Ea=$e("key"),Oa="ascending",Fa="descending",Va=_e("Aggregate"),Da=_e("AxisTicks"),_a=_e("Bound"),ja=_e("Collect"),Ma=_e("Compare"),Aa=_e("DataJoin"),Ca=_e("Encode"),Wa=_e("Facet"),qa=_e("Field"),La=_e("Key"),Ua=_e("LegendEntries"),Ba=_e("Mark"),Ta=_e("MultiExtent"),Ia=_e("MultiValues"),Xa=_e("Params"),Na=_e("PreFacet"),Ya=_e("Projection"),Ha=_e("Proxy"),Ga=_e("Relay"),Ja=_e("Render"),Ka=_e("Scale"),Qa=_e("Sieve"),Za=_e("ViewLayout"),er=_e("Values"),tr=function(e,n){var a=u.definition(e.type);a||t.error("Unrecognized transform type: "+t.stringValue(e.type));var r=Re(a.type,null,je(a,e,n));return e.signal&&n.addSignal(e.signal,n.proxy(r)),r.metadata=a.metadata||{},r},nr=function(e,n,a){var r,i,o,l,u;return e?(r=e.facet)&&(n||t.error("Only group marks can be faceted."),null!=r.field?l=u=Pe(a.getData(r.data).output):(i=a.keyRef(r.groupby),e.data?u=Pe(a.getData(e.data).aggregate):(o=tr(t.extend({type:"aggregate",groupby:t.array(r.groupby)},r.aggregate)),o.params.key=i,o.params.pulse=Pe(a.getData(r.data).output),l=u=Pe(a.add(o))))):l=Pe(a.add(ja(null,[{}]))),l||(l=e.$ref?e:Pe(e.mark?a.getData($a(e.mark)).output:a.getData(e.data).output)),{key:i,pulse:l,parent:u}};Ne.fromEntries=function(e,t){var n=t.length,a=1,r=t[0],i=t[n-1],o=t[n-2],l=null;for(e.add(t[0]);a<n;++a)t[a].params.pulse=Pe(t[a-1]),e.add(t[a]),"Aggregate"===t[a].type&&(l=t[a]);return new Ne(e,r,o,i,l)};var ar=Ne.prototype;ar.countsRef=function(e,t,n){var a,r,i,o=this,l=o.counts||(o.counts={}),u=Ye(t);return null!=u&&(e=o.scope,a=l[u]),a?n&&n.field&&He(e,a.agg.params,n):(i={groupby:e.fieldRef(t,"key"),pulse:Pe(o.output)},n&&n.field&&He(e,i,n),r=e.add(Va(i)),a=e.add(ja({pulse:Pe(r)})),a={agg:r,ref:Pe(a)},null!=u&&(l[u]=a)),a.ref},ar.tuplesRef=function(){return Pe(this.values)},ar.extentRef=function(e,t){return Ge(e,this,"extent","Extent",t,!1)},ar.domainRef=function(e,t){return Ge(e,this,"domain","Values",t,!1)},ar.valuesRef=function(e,t,n){return Ge(e,this,"vals","Values",t,n||!0)},ar.lookupRef=function(e,t){return Ge(e,this,"lookup","TupleIndex",t,!1)},ar.indataRef=function(e,t){return Ge(e,this,"indata","TupleIndex",t,!0,!0)};var rr=function(e,n,a){var r,i,o,l,u=e.from.facet,s=u.name,d=Pe(n.getData(u.data).output);u.name||t.error("Facet must have a name: "+t.stringValue(u)),u.data||t.error("Facet must reference a data set: "+t.stringValue(u)),u.field?l=n.add(Na({field:n.fieldRef(u.field),pulse:d})):u.groupby?l=n.add(Wa({key:n.keyRef(u.groupby),group:Pe(n.proxy(a.parent)),pulse:d})):t.error("Facet must specify groupby or field: "+t.stringValue(u)),r=n.fork(),i=r.add(ja()),o=r.add(Qa({pulse:Pe(i)})),r.addData(s,new Ne(r,i,i,o)),r.addSignal("parent",null),l.params.subflow={$subflow:kr(e,r).toRuntime() | ||
}},ir=function(e,t,n){var a=t.add(Na({pulse:n.pulse})),r=t.fork();r.add(Qa()),r.addSignal("parent",null),a.params.subflow={$subflow:kr(e,r).toRuntime()}},or=function(e,t,n){var a,r,i=e.remove,o=e.insert,l=e.toggle,u=e.modify,s=e.values,d=t.add(ze());a="if("+e.trigger+',modify("'+n+'",'+[o,i,l,u,s].map(function(e){return null==e?"null":e}).join(",")+"),0)",r=on(a,t),d.update=r.$expr,d.params=r.$params},lr=function(e,n){var a,r,i,o,l,u,s,d,c,f,p=za(e),g=e.type===ln,h=e.from&&e.from.facet,m=p===Xn||p===In;r=nr(e.from,g,n),a=n.add(Aa({key:r.key,pulse:r.pulse,clean:!g})),a=i=n.add(ja({pulse:Pe(a)})),a=n.add(Ba({markdef:Pa(e),scenepath:{$itempath:n.markpath()},pulse:Pe(a)})),d=Pe(a),a=n.add(Ca(xe(e.encode,e.type,p,n,{pulse:d}))),a.params.parent=n.encode(),e.transform&&e.transform.forEach(function(e){var r=tr(e,n);(r.metadata.generates||r.metadata.changes)&&t.error("Mark transforms should not generate new data."),r.params.pulse=Pe(a),n.add(a=r)}),c=Pe(a),(h||m)&&(a=n.add(Za({legendMargin:n.config.legendMargin,mark:d,pulse:c})),n.operators.pop(),n.pushState(c,Pe(a)),h?rr(e,n,r):ir(e,n,r),n.popState(),n.operators.push(a)),o=n.add(_a({mark:d,pulse:Pe(a)})),f=Pe(o),!g||h||m||(n.pushState(c,f),p===Tn?ir(e,n,r):kr(e,n),n.popState()),l=n.add(Ja({pulse:f})),u=n.add(Qa({pulse:f},void 0,n.parent())),null!=e.name&&(s=$a(e.name),n.addData(s,new Ne(n,i,l,u)),e.on&&e.on.forEach(function(e){(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),or(e,n,s)}))},ur=function(e,n){var a,r,i,o,l,u,s,d,c=e.type||"symbol",f=n.config.legend,p=e.name||void 0,g=e.encode||{},h=!!e.interactive,m=e.size||e.shape||e.fill||e.stroke||e.strokeDash||e.opacity;return m||t.error("Missing valid scale for legend."),a={orient:Je(e.orient,f.orient),title:e.title},r=Pe(n.add(ja(null,[a]))),u=be({update:{offset:ye(Je(e.offset,f.offset)),padding:ye(Je(e.padding,f.padding)),titlePadding:ye(Je(e.titlePadding,f.titlePadding))}},g.legend),s={update:{x:{field:{group:"padding"}},y:{field:{group:"padding"}},entryPadding:ye(Je(e.entryPadding,f.entryPadding))}},"gradient"===c?(i=Pe(n.add(Ua({type:"gradient",scale:n.scaleRef(m),count:n.property(e.tickCount),values:n.property(e.values),formatSpecifier:n.property(e.format)}))),d=[oa(m,f,g.gradient),xa(e,f,g.labels,i)]):(i=Pe(n.add(Ua({size:Ke(e,f,g.labels),scale:n.scaleRef(m),count:n.property(e.tickCount),values:n.property(e.values),formatSpecifier:n.property(e.formatSpecifier)}))),d=[wa(e,f,g.symbols,i),ka(e,f,g.labels,i)]),d=[Ra(Zn,null,r,h,s,d)],a.title&&(l=Sa(e,f,g.title,r),s.update.y.offset={field:{group:"titlePadding"},offset:l.encode.update.fontSize||l.encode.enter.fontSize},d.push(l)),o=Ra(Qn,p,r,h,u,d),e.zindex&&(o.zindex=e.zindex),lr(o,n)},sr=0,dr=["identity","ordinal","band","point","index","linear","pow","sqrt","log","sequential","time","utc","quantize","quantile","threshold"],cr=t.toSet(dr),fr=t.toSet(dr.slice(1,5)),pr=function(e,n){var a,r,i=e.type||"linear";cr.hasOwnProperty(i)||t.error("Unrecognized scale type: "+t.stringValue(i)),a={type:i,domain:at(e.domain,e,n)},null!=e.range&&(a.range=pt(e,n,a)),null!=e.interpolate&&ft(e.interpolate,a);for(r in e)a.hasOwnProperty(r)||"name"===r||(a[r]=et(e[r],n));n.addScale(e.name,a)},gr=function(e,n){var a=n.config,r=e.orient,i=r===la||r===da?a.axisX:a.axisY,o=a["axis"+r[0].toUpperCase()+r.slice(1)],l="band"===n.scaleType(e.scale)&&a.axisBand;return i||o||l?t.extend({},a.axis,i,o,l):a.axis},hr=function(e,t,n,a){var r,i,o,l,u,s=e.orient,d={value:0},c={};return c.enter=r={opacity:d,stroke:{value:t.tickColor},strokeWidth:{value:t.tickWidth}},c.exit={opacity:d},c.update=i={opacity:{value:1}},s===la||s===da?(o="x",u="y"):(o="y",u="x"),l=o+"2",r[u]=d,i[o]=r[o]=vt(e,0),i[l]=r[l]=vt(e,1),ia(sn,Yn,null,a,c,n)},mr=function(e,t,n,a){var r,i,o,l,u,s,d,c,f=e.orient,p=e.gridScale,g=f===ua||f===la?1:-1,h=g*e.offset||0,m={value:0},v={};return v.enter=r={opacity:m,stroke:{value:t.gridColor},strokeWidth:{value:t.gridWidth},strokeDash:{value:t.gridDash}},v.exit=i={opacity:m},v.update=o={opacity:{value:t.gridOpacity}},l={scale:e.scale,field:va,band:t.bandPosition,round:t.tickRound,extra:t.tickExtra},f===la||f===da?(u="x",s="y",c="height"):(u="y",s="x",c="width"),d=s+"2",o[u]=r[u]=i[u]=l,p?(r[s]={scale:p,range:0,mult:g,offset:h},o[d]=r[d]={scale:p,range:1,mult:g,offset:h}):(r[s]={value:h},o[d]=r[d]={signal:c,mult:g,offset:h}),ia(sn,Hn,va,a,v,n)},vr=function(e,t,n,a,r){var i,o,l,u,s,d=e.orient,c=d===ua||d===la?-1:1,f={value:0},p={};return p.enter=i={opacity:f,stroke:{value:t.tickColor},strokeWidth:{value:t.tickWidth}},p.exit=o={opacity:f},p.update=l={opacity:{value:1}},u=ye(r),u.mult=c,s={scale:e.scale,field:va,band:t.bandPosition,round:t.tickRound,extra:t.tickExtra},d===la||d===da?(l.y=i.y=f,l.y2=i.y2=u,l.x=i.x=o.x=s):(l.x=i.x=f,l.x2=i.x2=u,l.y=i.y=o.y=s),ia(sn,Jn,fa,a,p,n)},yr=function(e,t,n,a,r){var i,o,l,u,s,d=e.orient,c=d===ua||d===la?-1:1,f=null!=e.labelPadding?e.labelPadding:t.labelPadding,p={value:0},g={};return g.enter=i={opacity:p,fill:{value:t.labelColor},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},text:{field:fa}},g.exit=o={opacity:p},g.update=l={opacity:{value:1}},u=ye(r),u.mult=c,u.offset=ye(f),u.offset.mult=c,s={scale:e.scale,field:va,band:.5},d===la||d===da?(l.y=i.y=u,l.x=i.x=o.x=s,l.align={value:"center"},l.baseline={value:d===la?"bottom":"top"}):(l.x=i.x=u,l.y=i.y=o.y=s,l.align={value:d===sa?"left":"right"},l.baseline={value:"middle"}),ia(cn,Gn,fa,a,g,n)},br=function(e,t,n,a){var r,i,o=e.orient,l=o===ua||o===la?-1:1,u=o===la||o===da,s={};return s.enter={opacity:{value:0},fill:{value:t.titleColor},font:{value:t.titleFont},fontSize:{value:t.titleFontSize},fontWeight:{value:t.titleFontWeight},align:{value:t.titleAlign}},s.exit={opacity:{value:0}},s.update=r={opacity:{value:1},text:{field:"title"}},i={scale:e.scale,range:.5},u?(r.x=i,r.angle={value:0},r.baseline={value:o===la?"bottom":"top"}):(r.y=i,r.angle={value:90*l},r.baseline={value:"bottom"}),null!=t.titleAngle&&(r.angle={value:t.titleAngle}),null!=t.titleBaseline&&(r.baseline={value:t.titleBaseline}),null!=t.titleX?r.x={value:t.titleX}:u&&!we(n,"x")&&(s.enter.auto={value:!0}),null!=t.titleY?r.y={value:t.titleY}:u||we(n,"y")||(s.enter.auto={value:!0}),ia(cn,Kn,null,a,s,n)},xr=function(e,t){var n,a,r,i,o,l,u,s=gr(e,t),d=e.name||void 0,c=e.encode||{},f=!!e.interactive;return n={orient:e.orient,tick:null!=e.tick?!!e.tick:s.tick,label:null!=e.label?!!e.label:s.label,grid:null!=e.grid?!!e.grid:s.grid,domain:null!=e.domain?!!e.domain:s.domain,title:e.title},a=Pe(t.add(ja({},[n]))),l=be({update:{range:{expr:'abs(span(range("'+e.scale+'")))'},offset:ye(e.offset||0),position:ye(e.position||0),titlePadding:ye(e.titlePadding||s.titlePadding),minExtent:ye(e.minExtent||s.minExtent),maxExtent:ye(e.maxExtent||s.maxExtent)}},c.axis),r=Pe(t.add(Da({scale:t.scaleRef(e.scale),extra:s.tickExtra,count:t.property(e.tickCount),values:t.property(e.values),formatSpecifier:t.property(e.format)}))),u=[],n.grid&&u.push(mr(e,s,c.grid,r)),n.tick&&(i=null!=e.tickSize?e.tickSize:s.tickSize,u.push(vr(e,s,c.ticks,r,i))),n.label&&(i=n.tick?i:0,u.push(yr(e,s,c.labels,r,i))),n.domain&&u.push(hr(e,s,c.domain,a)),n.title&&u.push(br(e,s,c.title,a)),o=Ra(Nn,d,a,f,l,u),e.zindex&&(o.zindex=e.zindex),lr(o,t)},kr=function(e,n,a){var r=t.array(e.signals);return a||r.forEach(function(e){zt(e,n)}),t.array(e.projections).forEach(function(e){Fn(e,n)}),t.array(e.data).forEach(function(e){gt(e,n)}),t.array(e.scales).forEach(function(e){pr(e,n)}),r.forEach(function(e){On(e,n)}),n.parseLambdas(),t.array(e.axes).forEach(function(e){xr(e,n)}),t.array(e.marks).forEach(function(e){lr(e,n)}),t.array(e.legends).forEach(function(e){ur(e,n)}),n},wr=t.toSet(["width","height","padding"]),Sr=bt.prototype=xt.prototype;Sr.fork=function(){return new xt(this)},Sr.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings}},Sr.id=function(){return(this._subid?this._subid+":":0)+this._id++},Sr.add=function(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(function(t){t.$ref=e.id}),e.refs=null),e},Sr.proxy=function(e){var t=e instanceof Se?Pe(e):e;return this.add(Ha({value:t}))},Sr.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},Sr.addUpdate=function(e){return this.updates.push(e),e},Sr.finish=function(){function e(e,t,n){var a,r;e&&(a=e.data||(e.data={}),r=a[t]||(a[t]=[]),r.push(n))}var t,n;this.root&&(this.root.root=!0);for(t in this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(var a in n.index)e(n.index[a],t,"index:"+a)}return this},Sr.pushState=function(e,t){this._encode.push(Pe(this.add(Qa({pulse:e})))),this._parent.push(t),this._markpath.push(-1)},Sr.popState=function(){this._parent.pop(),this._encode.pop(),this._markpath.pop()},Sr.parent=function(){return t.peek(this._parent)},Sr.encode=function(){return t.peek(this._encode)},Sr.markpath=function(){var e=this._markpath;return++e[e.length-1],e.slice()},Sr.fieldRef=function(e,n){if(t.isString(e))return $e(e,n);e.signal||t.error("Unsupported field reference: "+t.stringValue(e));var a,r=e.signal,i=this.field[r];return i||(a={name:this.signalRef(r)},n&&(a.as=n),this.field[r]=i=Pe(this.add(qa(a)))),i},Sr.compareRef=function(e){function n(e){return De(e)?(r=!0,Pe(a[e.signal])):e}var a=this.signals,r=!1,i=t.array(e.field).map(n),o=t.array(e.order).map(n);return r?Pe(this.add(Ma({fields:i,orders:o}))):Ee(i,o)},Sr.keyRef=function(e){function n(e){return De(e)?(r=!0,Pe(a[e.signal])):e}var a=this.signals,r=!1;return e=t.array(e).map(n),r?Pe(this.add(La({fields:e}))):Oe(e)},Sr.sortRef=function(e){if(!e)return e;var t=[Ve(e.op,e.field),"_id"],n=e.order||Oa;return n.signal?Pe(this.add(Ma({fields:t,orders:[n=this.signalRef(n.signal),n]}))):Ee(t,[n,n])},Sr.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var a=this.id();this.streams.push({id:a,source:e,type:t}),this.events[n]=a}return this.events[n]},Sr.addSignal=function(e,n){this.signals.hasOwnProperty(e)&&t.error("Duplicate signal name: "+t.stringValue(e));var a=n instanceof Se?n:this.add(ze(n));return this.signals[e]=a},Sr.getSignal=function(e){return this.signals[e]||t.error("Unrecognized signal name: "+t.stringValue(e)),this.signals[e]},Sr.signalRef=function(e){return this.signals[e]?Pe(this.signals[e]):(this.lambdas[e]||(this.lambdas[e]=this.add(ze(null))),Pe(this.lambdas[e]))},Sr.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,n=e.length;t<n;++t){var a=e[t],r=on(a,this),i=this.lambdas[a];i.params=r.$params,i.update=r.$expr}},Sr.property=function(e){return e&&e.signal?this.signalRef(e.signal):e},Sr.addBinding=function(e,n){this.bindings||t.error("Nested signals do not support binding: "+t.stringValue(e)),this.bindings.push(t.extend({signal:e},n))},Sr.addScaleProj=function(e,n){this.scales.hasOwnProperty(e)&&t.error("Duplicate scale or projection name: "+t.stringValue(e)),this.scales[e]=this.add(n)},Sr.addScale=function(e,t){this.addScaleProj(e,Ka(t))},Sr.addProjection=function(e,t){this.addScaleProj(e,Ya(t))},Sr.getScale=function(e){return this.scales[e]||t.error("Unrecognized scale name: "+t.stringValue(e)),this.scales[e]},Sr.projectionRef=Sr.scaleRef=function(e){return Pe(this.getScale(e))},Sr.projectionType=Sr.scaleType=function(e){return this.getScale(e).params.type},Sr.addData=function(e,n){return this.data.hasOwnProperty(e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.data[e]=n},Sr.getData=function(e){return this.data[e]||t.error("Undefined data set name: "+t.stringValue(e)),this.data[e]},Sr.addDataPipeline=function(e,n){return this.data.hasOwnProperty(e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.addData(e,Ne.fromEntries(this,n))};var Rr=function(e){var n,a=kt();for(n in e)a[n]=t.isObject(a[n])?t.extend(a[n],e[n]):a[n]=e[n];return a},zr=function(e,t){return yt(e,new bt(Rr(t||e.config))).toRuntime()};e.parse=zr,e.selector=pn,e.signal=zt,e.signalUpdates=On,e.stream=Pn,e.codeGenerator=an,e.functionContext=Jt,e.expressionFunction=K,e.MarkRole=Tn,e.FrameRole=In,e.ScopeRole=Xn,e.AxisRole=Nn,e.AxisDomainRole=Yn,e.AxisGridRole=Hn,e.AxisLabelRole=Gn,e.AxisTickRole=Jn,e.AxisTitleRole=Kn,e.LegendRole=Qn,e.LegendEntryRole=Zn,e.LegendLabelRole=ta,e.LegendSymbolRole=na,e.LegendTitleRole=aa,e.marktypes=fn,e.isMarkType=Z,e.Scope=bt,e.DataScope=Ne,e.formatLocale=r.formatDefaultLocale,e.timeFormatLocale=i.timeFormatDefaultLocale,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression"),require("d3-color"),require("d3-array"),require("d3-format"),require("d3-time-format"),require("vega-scale"),require("vega-scenegraph"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","d3-color","d3-array","d3-format","d3-time-format","vega-scale","vega-scenegraph","vega-dataflow"],t):t(e.vega=e.vega||{},e.vega,e.vega,e.d3,e.d3,e.d3,e.d3,e.vega,e.vega,e.vega)}(this,function(e,t,n,a,r,i,o,l,u,s){"use strict";function d(e,n){t.error(e+' for "outer" push: '+t.stringValue(n))}function c(e){var t={};return function(n,a){var r=t[a]||(t[a]=e(a));return r(n)}}function f(e,t,n){return Vt.setMonth(e),Vt.setDate(t),Ft(Vt,n)}function p(e){return f(e,1,"%B")}function g(e){return f(e,1,"%b")}function h(e){return f(0,2+e,"%A")}function m(e){return f(0,2+e,"%a")}function v(e){return 1+~~(new Date(e).getMonth()/3)}function y(e){return 1+~~(new Date(e).getUTCMonth()/3)}function b(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function x(){return b(this.context.dataflow,"warn",arguments)}function k(){return b(this.context.dataflow,"info",arguments)}function w(){return b(this.context.dataflow,"debug",arguments)}function S(){return"Math.sqrt(Math.pow(event.touches[0].clientX - event.touches[1].clientX, 2) + Math.pow(event.touches[0].clientY - event.touches[1].clientY, 2))"}function R(){return"Math.atan2(event.touches[1].clientY - event.touches[0].clientY,event.touches[1].clientX - event.touches[0].clientX)"}function z(e,t){var n=this.context.dataflow;jt&&jt.open?n.loader().sanitize(e,{context:"open",name:t}).then(function(e){jt.open(e,t)}).catch(function(e){n.warn("Open url failed: "+e)}):n.warn("Open function can only be invoked in a browser.")}function P(){return jt?jt.screen:{}}function $(){return jt?[jt.innerWidth,jt.innerHeight]:[void 0,void 0]}function E(e,n){var a=t.isString(e)?n.scales[e]:t.isObject(e)&&e.signal?n.signals[e.signal]:void 0;return a&&a.value}function O(e,t,a,r){if(t[0].type===At){e=t[0].value;var i=qt+e;if(!r.hasOwnProperty(i))try{r[i]=a.scaleRef(e)}catch(e){}}else t[0].type===Ct&&(e=t[0].name,t[0]=new n.ASTNode(At),t[0].raw='{signal:"'+e+'"}')}function F(e,t){var n=E(e,(t||this).context);return n&&n.range?n.range():[0,0]}function V(e,t){var n=E(e,(t||this).context);return n?n.domain():[]}function D(e,t){var n=E(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}function _(e,t,n){return l.bandSpace(e||0,t||0,n||0)}function j(e,t){var n=E(e,(t||this).context);return n?n.copy():void 0}function M(e,t,n){var a=E(e,(n||this).context);return a?a(t):void 0}function A(e,n,a){var r=E(e,(a||this).context);return r?t.isArray(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0}function C(e){return function(t,n,a){var r=E(t,(a||this).context);return r&&r.path[e](n)}}function W(e){var t=this.context.data[e];return t?t.values.value:[]}function q(e,n,a,r){n[0].type!==At&&t.error("First argument to data functions must be a string literal.");var i=n[0].value,o=Lt+i;r.hasOwnProperty(o)||(r[o]=a.getData(i).tuplesRef())}function L(e,t,n){var a=this.context.data[e]["index:"+t],r=a?a.value.get(n):void 0;return r?r.count:r}function U(e,n,a,r){n[0].type!==At&&t.error("First argument to indata must be a string literal."),n[1].type!==At&&t.error("Second argument to indata must be a string literal.");var i=n[0].value,o=n[1].value,l=Wt+o;r.hasOwnProperty(l)||(r[l]=a.getData(i).indataRef(a,o))}function B(e){return e.data}function T(e,t){var n=W.call(t,e);return n.root&&n.root.lookup||Xt}function I(e,t,n){var a=T(e,this),r=a[t],i=a[n];return r&&i?r.path(i).map(B):void 0}function X(e,t){var n=T(e,this)[t];return n?n.ancestors().map(B):void 0}function Y(e){return function(t){for(var n in e)if("_id"!==n&&t[n]!==e[n])return!1;return!0}}function N(e,n){for(var a=n.fields,r=n.values,i=n.getter||(n.getter=[]),o=a.length,l=0;l<o;++l)if(i[l]=i[l]||t.field(a[l]),i[l](e)!==r[l])return!1;return!0}function H(e,n){for(var a,r=n.intervals,i=r.length,o=0;o<i;++o)if(a=r[o].getter||(r[o].getter=t.field(r[o].field)),!Yt(a(e),r[o].extent))return!1;return!0}function G(e,t,n,a,r,i){for(var o,l,u=this.context.data[e],s=u?u.values.value:[],d=a!==Gt,c=s.length,f=0;f<c;++f)if(o=s[f],l=t===o.unit,!(r===Kt&&l||r===Jt&&!l)&&(l=i(n,o),d^l))return l;return!c||d}function J(e,t,n,a,r){return G.call(this,e,t,n,a,r,N)}function K(e,t,n,a,r){return G.call(this,e,t,n,a,r,H)}function Q(e,t,n){return 1===arguments.length?Qt[e]:(Qt[e]=t,n&&(nn[e]=n),on&&(on.functions[e]=tn+e),this)}function Z(e){var t=n.functions(e);Zt.forEach(function(e){t[e]=en+e});for(var a in Qt)t[a]=tn+a;return t}function ee(e){return gn.hasOwnProperty(e)}function te(e,t,n,a,r){for(var i,o=0,l=e.length;t<l;++t){if(i=e[t],!o&&i===n)return t;r&&r.indexOf(i)>=0?--o:a&&a.indexOf(i)>=0&&++o}return t}function ne(e){for(var t=[],n=0,a=e.length,r=0;r<a;)r=te(e,r,wn,vn+bn,yn+xn),t.push(e.substring(n,r).trim()),n=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function ae(e){return"["===e[0]?re(e):ie(e)}function re(e){var t,n,a=1,r=e.length,i=1;if(i=te(e,i,yn,vn,yn),i===r)throw"Empty between selector: "+e;if(t=ne(e.substring(a,i)),2!==t.length)throw"Between selector must have two elements: "+e;if(e=e.slice(i+1).trim(),e[0]!==Rn)throw"Expected '>' after between selector: "+e;return t=t.map(ae),n=ae(e.slice(1).trim()),n.between?{between:t,stream:n}:(n.between=t,n)}function ie(e){var t,n,a={source:an},r=[],i=[0,0],o=0,l=0,u=e.length,s=0;if(e[u-1]===xn){if(s=e.lastIndexOf(bn),!(s>=0))throw"Unmatched right brace: "+e;try{i=oe(e.substring(s+1,u-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,s).trim(),u=e.length,s=0}if(!u)throw e;if(e[0]===Sn&&(o=++s),t=te(e,s,kn),t<u&&(r.push(e.substring(l,t).trim()),l=s=++t),s=te(e,s,vn),s===u)r.push(e.substring(l,u).trim());else if(r.push(e.substring(l,s).trim()),n=[],l=++s,l===u)throw"Unmatched left bracket: "+e;for(;s<u;){if(s=te(e,s,yn),s===u)throw"Unmatched left bracket: "+e;if(n.push(e.substring(l,s).trim()),s<u-1&&e[++s]!==vn)throw"Expected left bracket: "+e;l=++s}if(!(u=r.length)||zn.test(r[u-1]))throw"Invalid event selector: "+e;return u>1?(a.type=r[1],o?a.markname=r[0].slice(1):ee(r[0])?a.marktype=r[0]:a.source=r[0]):a.type=r[0],"!"===a.type.slice(-1)&&(a.consume=!0,a.type=a.type.slice(0,-1)),null!=n&&(a.filter=n),i[0]&&(a.throttle=i[0]),i[1]&&(a.debounce=i[1]),a}function oe(e){var t=e.split(wn);if(!e.length||t.length>2)throw e;return t.map(function(t){var n=+t;if(n!==n)throw e;return n})}function le(e){return e===$n?Pn:e||Pn}function ue(e,n){var a=e.merge?se:e.stream?de:e.type?ce:t.error("Invalid stream specification: "+t.stringValue(e));return a(e,n)}function se(e,t){var n=e.merge.map(function(e){return ue(e,t)}),a=fe({merge:n},e,t);return t.addStream(a).id}function de(e,t){var n=ue(e.stream,t),a=fe({stream:n},e,t);return t.addStream(a).id}function ce(e,t){var n=t.event(le(e.source),e.type),a=fe({stream:n},e,t);return 1===Object.keys(a).length?n:t.addStream(a).id}function fe(e,n,a){var r=n.between;return r&&(2!==r.length&&t.error('Stream "between" parameter must have 2 entries: '+t.stringValue(n)),e.between=[ue(r[0],a),ue(r[1],a)]),r=n.filter?t.array(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(pe(n.marktype,n.markname,n.markrole)),n.source===$n&&r.push("inScope(event.item)"),r.length&&(e.filter=un("("+r.join(")&&(")+")").$expr),null!=(r=n.throttle)&&(e.throttle=+r),null!=(r=n.debounce)&&(e.debounce=+r),n.consume&&(e.consume=!0),e}function pe(e,t,n){var a="event.item";return a+(e&&"*"!==e?"&&"+a+".mark.marktype==='"+e+"'":"")+(n?"&&"+a+".mark.role==='"+n+"'":"")+(t?"&&"+a+".mark.name==='"+t+"'":"")}function ge(e,n){return t.isArray(e)?e.map(function(e){return ge(e,n)}):t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported parameter object: "+t.stringValue(e)):e}function he(e,n,a,r){var i,o,l;if(e.signal)i="datum",l=Cn(e.signal,n,a,r);else if(e.group||e.parent){for(o=Math.max(1,e.level||1),i="item";o-- >0;)i+=".mark.group";e.parent?(l=e.parent,i+=".datum"):l=e.group}else e.datum?(i="datum",l=e.datum):t.error("Invalid field reference: "+t.stringValue(e));return e.signal||(t.isString(l)?(r[l]=1,l=t.splitAccessPath(l).map(t.stringValue).join("][")):l=he(l,n,a,r)),i+"["+l+"]"}function me(e,n){if(!t.isString(e))return-1;var a=n.scaleType(e);return"band"===a||"point"===a?1:0}function ve(e,n,a,r){var i;if(t.isString(e))i=qt+e,a.hasOwnProperty(i)||(a[i]=n.scaleRef(e)),i=t.stringValue(i);else{for(i in n.scales)a[qt+i]=n.scaleRef(i);i=t.stringValue(qt)+"+"+Wn(e,n,a,r)}return"_["+i+"]"}function ye(e,n,a,r){var i,o,l,u={},s="var o=item,datum=o.datum,$;";for(i in e)o=e[i],t.isArray(o)?s+=In(i,o,r,a,u):(l=Bn(i,o,r,a,u),s+=Tn("o",i,l));return s+=Mn(e,n),s+="return 1;",{$expr:s,$fields:Object.keys(u),$output:Object.keys(e)}}function be(e){return t.isObject(e)?e:{value:e}}function xe(e,n,a){for(var r in n)a&&a.hasOwnProperty(r)||(e[r]=t.extend(e[r]||{},n[r]));return e}function ke(e,t,n,a,r){var i,o;r=r||{},r.encoders={$encode:i={}},e=we(e,t,n,a.config);for(o in e)i[o]=ye(e[o],t,r,a);return r}function we(e,n,a,r){var i,o,l;if(r=a===Yn?r.group:a===Xn?t.extend({},r.mark,r[n]):null){i={};for(o in r)l=Se(o,e)||("fill"===o||"stroke"===o)&&(Se("fill",e)||Se("stroke",e)),l||(i[o]={value:r[o]});e=t.extend({},e),e.enter=t.extend(i,e.enter)}return e}function Se(e,t){return t.enter&&t.enter[e]||t.update&&t.update[e]}function Re(e,t,n,a){this.id=-1,this.type=e,this.value=t,this.params=n,a&&(this.parent=a)}function ze(e,t,n,a){return new Re(e,t,n,a)}function Pe(e,t){return ze("Operator",e,t)}function $e(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Ee(e,t){return t?{$field:e,$name:t}:{$field:e}}function Oe(e,t){return{$compare:e,$order:t}}function Fe(e){return{$key:e}}function Ve(e){return t.isObject(e)?(e.order===Da?"-":"+")+De(e.op,e.field):""}function De(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function _e(e){return e&&e.signal}function je(e){return function(t,n,a){return ze(e,n,t||void 0,a)}}function Me(e,t,n){var a,r,i,o={};for(r=0,i=e.params.length;r<i;++r)a=e.params[r],o[a.name]=Ae(a,t,n);return o}function Ae(e,n,a){var r,i=e.type;return"index"===i?We(e,n,a):"param"===i?qe(e,n,a):"projection"===i?a.projectionRef(n[e.name]):(r=n[e.name],void 0===r?void(e.required&&t.error("Missing required "+t.stringValue(n.type)+" parameter: "+t.stringValue(e.name))):e.array&&!_e(r)?r.map(function(t){return Ce(e,t,a)}):Ce(e,r,a))}function Ce(e,n,a){var r=e.type;if(_e(n))return Ie(r)?t.error("Expression references can not be signals."):Xe(r)?a.fieldRef(n):Ye(r)?a.compareRef(n):a.signalRef(n.signal);var i=e.expr||Xe(r);return i&&Ue(n)?un(n.expr,a):i&&Be(n)?Ee(n.field):Ie(r)?un(n,a):Te(r)?$e(a.getData(n).values):Xe(r)?Ee(n):Ye(r)?Oe(t.array(n.field),t.array(n.order)):n}function We(e,n,a){return t.isString(n.from)||t.error('Lookup "from" parameter must be a string literal.'),a.getData(n.from).lookupRef(a,n.key)}function qe(e,n,a){var r=n[e.name];return e.array?(t.isArray(r)||t.error("Expected an array of sub-parameters. Instead: "+t.stringValue(r)),r.map(function(t){return Le(e,t,a)})):Le(e,r,a)}function Le(e,n,a){var r,i,o,l,u;for(l=0,u=e.params.length;l<u;++l){i=e.params[l];for(o in i.key)if(i.key[o]!==n[o]){i=null;break}if(i)break}return i||t.error("Unsupported parameter: "+t.stringValue(n)),r=t.extend(Me(i,n,a),i.key),$e(a.add(Na(r)))}function Ue(e){return e&&e.expr}function Be(e){return e&&e.field}function Te(e){return"data"===e}function Ie(e){return"expr"===e}function Xe(e){return"field"===e}function Ye(e){return"compare"===e}function Ne(e,t,n,a,r){this.scope=e,this.input=t,this.output=n,this.values=a,this.aggregate=r,this.index={}}function He(e){return t.isString(e)?e:null}function Ge(e,t,n){var a,r=De(n.op,n.field);if(t.ops){for(var i=0,o=t.as.length;i<o;++i)if(t.as[i]===r)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((a=n.op.signal)?e.signalRef(a):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(r))}function Je(e,t,n,a,r,i,o){var l,u,s=t[n]||(t[n]={}),d=Ve(i),c=He(r);if(null!=c&&(e=t.scope,c+=d?"|"+d:"",l=s[c]),!l){var f=i?{field:Fa,pulse:t.countsRef(e,r,i)}:{field:e.fieldRef(r),pulse:$e(t.output)};d&&(f.sort=e.sortRef(i)),u=e.add(ze(a,void 0,f)),o&&(t.index[r]=u),l=$e(u),null!=c&&(s[c]=l)}return l}function Ke(e,t){return null!=e?e:t}function Qe(e,t,n){var a,r=+t.symbolSize;return a=n&&n.update&&n.update.fontSize,a||(a=n&&n.enter&&n.enter.fontSize),a&&(a=a.value),a||(a=+t.labelFontSize),e.size?{$expr:"Math.max(Math.ceil(Math.sqrt(_.scale(datum))),"+a+")"}:Math.max(Math.ceil(Math.sqrt(r)),a)}function Ze(e){return gr.hasOwnProperty(e)}function et(e){return"quantile"===e}function tt(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+t.stringValue(e)):e}function nt(e,t){return e.signal?t.signalRef(e.signal):e.map(function(e){return tt(e,t)})}function at(e){t.error("Can not find data set: "+t.stringValue(e))}function rt(e,n,a){return e?e.signal?a.signalRef(e.signal):(t.isArray(e)?it:e.fields?lt:ot)(e,n,a):void(null==n.domainMin&&null==n.domainMax||t.error("No scale domain defined for domainMin/domainMax to override."))}function it(e,t,n){return e.map(function(e){return tt(e,n)})}function ot(e,t,n){var a=n.getData(e.data);return a||at(e.data),Ze(t.type)?a.valuesRef(n,e.field,dt(e.sort,!1)):et(t.type)?a.domainRef(n,e.field):a.extentRef(n,e.field)}function lt(e,n,a){var r=e.data,i=e.fields.reduce(function(e,n){return n=t.isString(n)?{data:r,field:n}:t.isArray(n)||n.signal?ut(n,a):n,e.push(n),e},[]);return(Ze(n.type)?st:et(n.type)?ct:ft)(e,a,i)}function ut(e,n){var a="_:vega:_"+cr++,r=Aa({});return t.isArray(e)?r.value={$ingest:e}:e.signal&&n.signalRef("modify("+t.stringValue(a)+","+e.signal+", true)"),n.addDataPipeline(a,[r,er({})]),{data:a,field:"data"}}function st(e,t,n){var a,r,i,o;return a=n.map(function(e){var n=t.getData(e.data);return n||at(e.data),n.countsRef(t,e.field)}),r=t.add(_a({groupby:Fa,ops:["sum"],fields:[t.fieldRef("count")],as:["count"],pulse:a})),i=t.add(Aa({pulse:$e(r)})),o=t.add(nr({field:Fa,sort:t.sortRef(dt(e.sort,!0)),pulse:$e(i)})),$e(o)}function dt(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field?t.error("Multiple domain scales can not sort by field."):n&&e.op&&"count"!==e.op&&t.error("Multiple domain scales support op count only."):t.error("No field provided for sort aggregate op: "+e.op):t.isObject(e)?e.field="key":e={field:"key"}),e}function ct(e,t,n){var a=n.map(function(e){var n=t.getData(e.data);return n||at(e.data),n.domainRef(t,e.field)});return $e(t.add(Ya({values:a})))}function ft(e,t,n){var a=n.map(function(e){var n=t.getData(e.data);return n||at(e.data),n.extentRef(t,e.field)});return $e(t.add(Xa({extents:a})))}function pt(e,t){t.interpolate=tt(e.type||e),null!=e.gamma&&(t.interpolateGamma=tt(e.gamma))}function gt(e,n,a){var r=e.range,i=n.config.range;if(r.signal)return n.signalRef(r.signal);if(t.isString(r)){if(i&&i.hasOwnProperty(r))return e=t.extend({},e,{range:i[r]}),gt(e,n,a);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=Ze(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+t.stringValue(r))}else{if(r.scheme)return a.scheme=tt(r.scheme,n),r.extent&&(a.schemeExtent=nt(r.extent,n)),void(r.count&&(a.schemeCount=tt(r.count,n)));if(r.step)return void(a.rangeStep=tt(r.step,n));if(Ze(e.type)&&!t.isArray(r))return rt(r,e,n);t.isArray(r)||t.error("Unsupported range type: "+t.stringValue(r))}return r.map(function(e){return tt(e,n)})}function ht(e,t){var n=[];e.transform&&e.transform.forEach(function(e){n.push(ar(e,t))}),e.on&&e.on.forEach(function(n){ur(n,t,e.name)}),t.addDataPipeline(e.name,mt(e,t,n))}function mt(e,t,n){var a,r,i,o,l,u=[],s=null,d=!1,c=!1;for(e.values?u.push(s=vt({$ingest:e.values,$format:e.format})):e.url?u.push(s=vt({$request:e.url,$format:e.format})):e.source&&(a=t.getData(e.source),s=a.output,u.push(null)),r=0,i=n.length;r<i;++r)o=n[r],l=o.metadata,s||l.source||u.push(s=vt()),u.push(o),l.generates&&(c=!0),l.modifies&&!c&&(d=!0),l.source?s=o:l.changes&&(s=null);return a&&(u[0]=Ka({derive:d,pulse:$e(a.output)}),d&&u.splice(1,0,vt())),s||u.push(vt()),u.push(er({})),u}function vt(e){var t=Aa({},e);return t.metadata={source:!0},t}function yt(e,t){return{scale:e.scale,range:t}}function bt(e,n){var a,r,i,o,l,u=n.config;return n.background=e.background||u.background,l=$e(n.root=n.add(Pe())),n.addSignal("width",e.width||-1),n.addSignal("height",e.height||-1),n.addSignal("padding",Rt(e.padding,u)),t.array(e.signals).forEach(function(e){Rr[e.name]||$t(e,n)}),r=n.add(Aa()),i=xe({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),i=n.add(qa(ke(i,sn,Yn,n,{pulse:$e(r)}))),o=n.add(tr({legendMargin:u.legendMargin,autosize:St(e.autosize,u),mark:l,pulse:$e(i)})),n.pushState($e(i),$e(o)),Sr(e,n,!0),a=n.add(Ma({mark:l,pulse:$e(o)})),a=n.add(Qa({pulse:$e(a)})),a=n.add(er({pulse:$e(a)})),n.addData("root",new Ne(n,r,r,a)),n}function xt(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._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._markpath=[]}function kt(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._markpath=e._markpath}function wt(){return{padding:0,autosize:"pad",background:null,group:null,mark:null,arc:{fill:"steelblue"},area:{fill:"steelblue"},image:null,line:{stroke:"steelblue"},path:{stroke:"steelblue"},rect:{fill:"steelblue"},rule:{stroke:"#000"},shape:{stroke:"steelblue"},symbol:{fill:"steelblue",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:"#000",grid:!1,gridWidth:1,gridColor:"#ddd",gridDash:[],gridOpacity:1,label:!0,labelColor:"#000",labelFont:"sans-serif",labelFontSize:10,labelPadding:2,tick:!0,tickRound:!0,tickSize:5,tickWidth:1,tickColor:"#000",titleAlign:"center",titlePadding:2,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold"},legend:{orient:"right",offset:18,padding:0,entryPadding:5,titlePadding:5,gradientWidth:100,gradientHeight:20,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelBaseline:"top",gradientLabelOffset:2,labelColor:"#000",labelFontSize:10,labelFont:"sans-serif",labelAlign:"left",labelBaseline:"middle",labelOffset:8,symbolType:"circle",symbolSize:100,symbolColor:"#888",symbolStrokeWidth:1.5,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold",titleAlign:"left",titleBaseline:"top"},range:{category:{scheme:"category10"},ordinal:{scheme:"blues",extent:[.2,1]},heatmap:{scheme:"plasma"},ramp:{scheme:"greens",extent:[.2,1]},diverging:{scheme:"purpleorange"},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}var St=function(e,n){return e=e||n.autosize,t.isObject(e)?e:(e=e||"pad",{type:e})},Rt=function(e,n){return e=e||n.padding,t.isObject(e)?e:(e=+e||0,{top:e,bottom:e,left:e,right:e})},zt="outer",Pt=["value","update","react","bind"],$t=function(e,t){var n=e.name;if(e.push===zt)t.signals[n]||d("No prior signal definition",n),Pt.forEach(function(t){void 0!==e[t]&&d("Invalid property ",t)});else{var a=t.addSignal(n,e.value);e.react===!1&&(a.react=!1),e.bind&&t.addBinding(n,e.bind)}},Et=c(i.format),Ot=c(o.utcFormat),Ft=c(o.timeFormat),Vt=new Date(2e3,0,1),Dt=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},_t=function(e,t,n){var a,r=e[0],i=e[1];return i<r&&(a=i,i=r,r=a),a=i-r,a>=n-t?[t,n]:[Math.min(Math.max(r,t),n-a),Math.min(Math.max(i,a),n)]},jt="undefined"!=typeof window&&window||null,Mt=function(e){return e[e.length-1]-e[0]},At="Literal",Ct="Identifier",Wt="@",qt="%",Lt=":",Ut=function(e,t,n,a){var r=u.Gradient(t,n),i=e.domain(),o=i[0],s=i[i.length-1],d=l.scaleFraction(e,o,s);e.ticks&&(i=e.ticks(+a||15),o!==i[0]&&i.unshift(o),s!==i[i.length-1]&&i.push(s));for(var c=0,f=i.length;c<f;++c)r.stop(d(i[c]),e(i[c]));return r},Bt=C("area"),Tt=C("bounds"),It=C("centroid"),Xt={},Yt=function(e,t){var n,a=t[0],r=t[t.length-1];return a>r&&(n=a,a=r,r=n),a<=e&&e<=r},Nt=function(e,t,n){if(e){var a=this.context.dataflow,r=e.mark.source;a.pulse(r,a.changeset().encode(e,t))}return void 0!==n?n:e},Ht=function(e,n,a,r,i,o){var l,u,s=this.context.dataflow,d=this.context.data[e],c=d.input,f=d.changes,p=s.stamp();if(s._trigger===!1||!(c.value.length||n||r))return 0;if((!f||f.stamp<p)&&(d.changes=f=s.changeset(),f.stamp=p,s.runAfter(function(){d.modified=!0,s.pulse(c,f).run()})),a&&(l=a===!0?t.truthy:t.isArray(a)||null!=a._id?a:Y(a),f.remove(l)),n&&f.insert(n),r&&(l=Y(r),c.value.some(l)?f.remove(l):f.insert(r)),i)for(u in o)f.modify(i,u,o[u]);return 1},Gt="union",Jt="unit",Kt="others",Qt={pad:t.pad,truncate:t.truncate,rgb:a.rgb,lab:a.lab,hcl:a.hcl,hsl:a.hsl,sequence:r.range,format:Et,utcFormat:Ot,timeFormat:Ft,monthFormat:p,monthAbbrevFormat:g,dayFormat:h,dayAbbrevFormat:m,quarter:v,utcquarter:y,warn:x,info:k,debug:w,inScope:Dt,clampRange:_t,pinchDistance:S,pinchAngle:R,open:z,screen:P,windowsize:$,span:Mt,bandspace:_,inrange:Yt,encode:Nt,modify:Ht},Zt=["view","item","group","xy","x","y"],en="event.vega.",tn="this.",nn={};Q("bandwidth",D,O),Q("copy",j,O),Q("domain",V,O),Q("range",F,O),Q("invert",A,O),Q("scale",M,O),Q("gradient",Ut,O),Q("geoArea",Bt,O),Q("geoBounds",Tt,O),Q("geoCentroid",It,O),Q("indata",L,U),Q("data",W,q),Q("vlPoint",J,q),Q("vlInterval",K,q),Q("treePath",I,q),Q("treeAncestors",X,q);var an,rn={blacklist:["_"],whitelist:["datum","event"],fieldvar:"datum",globalvar:function(e){return"_["+t.stringValue("$"+e)+"]"},functions:Z,constants:n.constants,visitors:nn},on=n.codegen(rn),ln="$",un=function(e,a,r){var i,o,l={};try{i=n.parse(e)}catch(n){t.error("Expression parse error: "+t.stringValue(e))}return i.visit(function(e){if("CallExpression"===e.type){var t=e.callee.name,n=rn.visitors[t];n&&n(t,e.arguments,a,l)}}),o=on(i),o.globals.forEach(function(e){var t=ln+e;!l.hasOwnProperty(t)&&a.getSignal(e)&&(l[t]=a.signalRef(e))}),{$expr:r?r+"return("+o.code+");":o.code,$fields:o.fields,$params:l}},sn="group",dn="rect",cn="rule",fn="symbol",pn="text",gn=t.toSet(["*","arc","area","group","image","line","path","rect","rule","shape","symbol","text"]),hn=function(e,t){return an=t||mn,ne(e.trim()).map(ae)},mn="view",vn="[",yn="]",bn="{",xn="}",kn=":",wn=",",Sn="@",Rn=">",zn=/[\[\]\{\}]/,Pn="view",$n="scope",En=function(e,t){return e.signal?t.getSignal(e.signal).id:ue(e,t)},On="var datum=event.item&&event.item.datum;",Fn=function(e,n,a){var r,i=e.events,o=e.update,l=e.encode,u=[],s="";i||t.error("Signal update missing events specification."),t.isString(i)&&(i=hn(i)),i=t.array(i).filter(function(e){return e.signal?(u.push(e),0):1}),i.length&&u.push(i.length>1?{merge:i}:i[0]),null!=l&&(o&&t.error("Signal encode and update are mutually exclusive."),o="encode(item(),"+t.stringValue(l)+")"),s=t.isString(o)?un(o,n,On):null!=o.expr?un(o.expr,n,On):null!=o.value?o.value:null!=o.signal?{$expr:"_.value",$params:{value:n.signalRef(o.signal)}}:t.error("Invalid signal update specification."),r={target:a,update:s},e.force&&(r.options={force:!0}),u.forEach(function(e){e={source:En(e,n)},n.addUpdate(t.extend(e,r))})},Vn=function(e,t){var n=t.getSignal(e.name);if(e.update){var a=un(e.update,t);n.update=a.$expr,n.params=a.$params}e.on&&e.on.forEach(function(e){Fn(e,t,n.id)})},Dn=function(e,t){var n={};for(var a in e)"name"!==a&&(n[a]=ge(e[a],t));t.addProjection(e.name,n)},_n=t.toSet(["rule"]),jn=t.toSet(["group","image","rect"]),Mn=function(e,t){var n="";return _n[t]?n:(e.x2&&(e.x?(jn[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+=e.width?"o.x=o.x2-o.width;":"o.x=o.x2;"),e.xc&&(n+=e.width?"o.x=o.xc-o.width/2;":"o.x=o.xc;"),e.y2&&(e.y?(jn[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+=e.height?"o.y=o.y2-o.height;":"o.y=o.y2;"),e.yc&&(n+=e.height?"o.y=o.yc-o.height/2;":"o.y=o.yc;"),n)},An=function(e,t,n,a){function r(e,r,i,o){var l=Bn(null,r,t,n,a),u=Bn(null,i,t,n,a),s=Bn(null,o,t,n,a);return"this."+e+"("+[l,u,s].join(",")+").toString()"}return e.c?r("hcl",e.h,e.c,e.l):e.h||e.s?r("hsl",e.h,e.s,e.l):e.l||e.a?r("lab",e.l,e.a,e.b):e.r||e.g||e.b?r("rgb",e.r,e.g,e.b):null},Cn=function(e,n,a,r){var i=un(e,n);return i.$fields.forEach(function(e){r[e]=1}),t.extend(a,i.$params),i.$expr},Wn=function(e,n,a,r){return he(t.isObject(e)?e:{datum:e},n,a,r)},qn=function(e,t,n,a,r){var i,o,l,u=ve(e.scale,n,a,r);return null!=e.range?(i=+e.range,o=u+".range()",t=0===i?o+"[0]":"($="+o+","+(1===i?"$[$.length-1]":"$[0]+"+i+"*($[$.length-1]-$[0])")+")"):(t=null!=t?u+"("+t+")":null,e.band&&(l=me(e.scale,n))&&(o=u+".bandwidth",i=+e.band,i=o+"()"+(1===i?"":"*"+i),l<0&&(i="("+o+"?"+i+":0)"),t=(t?t+"+":"")+i,e.extra&&(t="(datum.extra?"+u+"(datum.extra.value):"+t+")")),null==t&&(t="0")),t},Ln=function(e,n,a,r){return"this.gradient("+ve(e.gradient,n,a,r)+","+t.stringValue(e.start)+","+t.stringValue(e.stop)+","+t.stringValue(e.count)+")"},Un=function(e,n,a,r){return t.isObject(e)?"("+Bn(null,e,n,a,r)+")":e},Bn=function(e,n,a,r,i){if(null!=n.gradient)return Ln(n,a,r,i);var o=null!=n.color?An(n.color,a,r,i):null!=n.field?Wn(n.field,a,r,i):null!=n.signal?Cn(n.signal,a,r,i):null!=n.value?t.stringValue(n.value):null;return null!=n.scale&&(o=qn(n,o,a,r,i)),null!=n.exponent&&(o="Math.pow("+o+","+Un(n.exponent,a,r,i)+")"),null!=n.mult&&(o+="*"+Un(n.mult,a,r,i)),null!=n.offset&&(o+="+"+Un(n.offset,a,r,i)),n.round&&(o="Math.round("+o+")"),o},Tn=function(e,n,a){return e+"["+t.stringValue(n)+"]="+a+";"},In=function(e,t,n,a,r){var i="";return t.forEach(function(t){var o=Bn(e,t,n,a,r);i+=t.test?Cn(t.test,n,a,r)+"?"+o+":":o}),Tn("o",e,i)},Xn="mark",Yn="frame",Nn="scope",Hn="axis",Gn="axis-domain",Jn="axis-grid",Kn="axis-label",Qn="axis-tick",Zn="axis-title",ea="legend",ta="legend-entry",na="legend-gradient",aa="legend-label",ra="legend-symbol",ia="legend-title",oa={name:1,interactive:1},la=function(e,t,n,a,r,i){return{type:e,name:i?i.name:void 0,role:t,key:n,from:a,interactive:!(!i||!i.interactive),encode:xe(r,i,oa)}},ua=function(e,t,n){var a={value:0},r={};return r.enter={opacity:a,x:a,y:a,width:{value:t.gradientWidth},height:{value:t.gradientHeight},stroke:{value:t.gradientStrokeColor},strokeWidth:{value:t.gradientStrokeWidth}},r.exit={opacity:a},r.update={x:a,y:a,width:{value:t.gradientWidth},height:{value:t.gradientHeight},fill:{gradient:e},opacity:{value:1}},la(dn,na,void 0,void 0,r,n)},sa="top",da="left",ca="right",fa="bottom",pa="index",ga="label",ha="offset",ma="perc",va="size",ya="total",ba="value",xa=["shape","size","fill","stroke","strokeDash","opacity"],ka="datum."+ma+'<=0?"left":datum.'+ma+'>=1?"right":"center"',wa=function(e,t,n,a){var r,i,o={value:0},l={};return l.enter=r={opacity:o,text:{field:ga},fill:{value:t.labelColor},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},baseline:{value:t.gradientLabelBaseline}},l.exit={opacity:o},l.update=i={opacity:{value:1}},r.x=i.x={field:ma,mult:t.gradientWidth},r.y=i.y={value:t.gradientHeight,offset:t.gradientLabelOffset},r.align=i.align={signal:ka},la(pn,aa,ga,a,l,n)},Sa=function(e,t,n,a){var r,i,o={value:0},l={};return l.enter=r={opacity:o,fill:{value:t.labelColor},text:{field:ga},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},align:{value:t.labelAlign},baseline:{value:t.labelBaseline}},l.exit={opacity:o},l.update=i={opacity:{value:1}},r.x=i.x={field:ha,offset:t.labelOffset},r.y=i.y={field:va,mult:.5,offset:{field:ya,offset:{field:{group:"entryPadding"},mult:{field:pa}}}},la(pn,aa,ga,a,l,n)},Ra=function(e,t,n,a){var r,i,o={value:0},l={};return l.enter=r={opacity:o,shape:{value:t.symbolType},size:{value:t.symbolSize},strokeWidth:{value:t.symbolStrokeWidth}},e.fill||(r.stroke={value:t.symbolColor}),l.exit={opacity:o},l.update=i={opacity:{value:1}},r.x=i.x={field:ha,mult:.5},r.y=i.y={field:va,mult:.5,offset:{field:ya,offset:{field:{group:"entryPadding"},mult:{field:pa}}}},xa.forEach(function(t){e[t]&&(i[t]=r[t]={scale:e[t],field:ba})}),la(fn,ra,ga,a,l,n)},za=function(e,t,n,a){var r={value:0},i={};return i.enter={x:{field:{group:"padding"}},y:{field:{group:"padding"}},opacity:r,fill:{value:t.titleColor},font:{value:t.titleFont},fontSize:{value:t.titleFontSize},fontWeight:{value:t.titleFontWeight},align:{value:t.titleAlign},baseline:{value:t.titleBaseline}},i.exit={opacity:r},i.update={opacity:{value:1},text:{field:"title"}},la(pn,ia,null,a,i,n)},Pa=function(e,t,n,a,r,i){return{type:sn,name:t,role:e,from:n,interactive:a,encode:r,marks:i}},$a=function(e){return e.role||(e.type===sn&&(e.legends||e.axes)?Nn:Xn)},Ea=function(e){return{clip:e.clip||!1,interactive:e.interactive!==!1,marktype:e.type,name:e.name||void 0,role:$a(e),zindex:+e.zindex||void 0}},Oa=function(e){return e},Fa=Ee("key"),Va="ascending",Da="descending",_a=je("Aggregate"),ja=je("AxisTicks"),Ma=je("Bound"),Aa=je("Collect"),Ca=je("Compare"),Wa=je("DataJoin"),qa=je("Encode"),La=je("Facet"),Ua=je("Field"),Ba=je("Key"),Ta=je("LegendEntries"),Ia=je("Mark"),Xa=je("MultiExtent"),Ya=je("MultiValues"),Na=je("Params"),Ha=je("PreFacet"),Ga=je("Projection"),Ja=je("Proxy"),Ka=je("Relay"),Qa=je("Render"),Za=je("Scale"),er=je("Sieve"),tr=je("ViewLayout"),nr=je("Values"),ar=function(e,n){var a=s.definition(e.type);a||t.error("Unrecognized transform type: "+t.stringValue(e.type));var r=ze(a.type,null,Me(a,e,n));return e.signal&&n.addSignal(e.signal,n.proxy(r)),r.metadata=a.metadata||{},r},rr=function(e,n,a){var r,i,o,l,u;return e?(r=e.facet)&&(n||t.error("Only group marks can be faceted."),null!=r.field?l=u=$e(a.getData(r.data).output):(i=a.keyRef(r.groupby),e.data?u=$e(a.getData(e.data).aggregate):(o=ar(t.extend({type:"aggregate",groupby:t.array(r.groupby)},r.aggregate)),o.params.key=i,o.params.pulse=$e(a.getData(r.data).output),l=u=$e(a.add(o))))):l=$e(a.add(Aa(null,[{}]))),l||(l=e.$ref?e:$e(e.mark?a.getData(Oa(e.mark)).output:a.getData(e.data).output)),{key:i,pulse:l,parent:u}};Ne.fromEntries=function(e,t){var n=t.length,a=1,r=t[0],i=t[n-1],o=t[n-2],l=null;for(e.add(t[0]);a<n;++a)t[a].params.pulse=$e(t[a-1]),e.add(t[a]),"Aggregate"===t[a].type&&(l=t[a]);return new Ne(e,r,o,i,l)};var ir=Ne.prototype;ir.countsRef=function(e,t,n){var a,r,i,o=this,l=o.counts||(o.counts={}),u=He(t);return null!=u&&(e=o.scope,a=l[u]),a?n&&n.field&&Ge(e,a.agg.params,n):(i={groupby:e.fieldRef(t,"key"),pulse:$e(o.output)},n&&n.field&&Ge(e,i,n),r=e.add(_a(i)),a=e.add(Aa({pulse:$e(r)})),a={agg:r,ref:$e(a)},null!=u&&(l[u]=a)),a.ref},ir.tuplesRef=function(){return $e(this.values)},ir.extentRef=function(e,t){return Je(e,this,"extent","Extent",t,!1)},ir.domainRef=function(e,t){return Je(e,this,"domain","Values",t,!1)},ir.valuesRef=function(e,t,n){return Je(e,this,"vals","Values",t,n||!0)},ir.lookupRef=function(e,t){return Je(e,this,"lookup","TupleIndex",t,!1)},ir.indataRef=function(e,t){return Je(e,this,"indata","TupleIndex",t,!0,!0)};var or=function(e,n,a){var r,i,o,l,u=e.from.facet,s=u.name,d=$e(n.getData(u.data).output);u.name||t.error("Facet must have a name: "+t.stringValue(u)),u.data||t.error("Facet must reference a data set: "+t.stringValue(u)),u.field?l=n.add(Ha({field:n.fieldRef(u.field),pulse:d})):u.groupby?l=n.add(La({key:n.keyRef(u.groupby),group:$e(n.proxy(a.parent)),pulse:d})):t.error("Facet must specify groupby or field: "+t.stringValue(u)),r=n.fork(),i=r.add(Aa()),o=r.add(er({ | ||
pulse:$e(i)})),r.addData(s,new Ne(r,i,i,o)),r.addSignal("parent",null),l.params.subflow={$subflow:Sr(e,r).toRuntime()}},lr=function(e,t,n){var a=t.add(Ha({pulse:n.pulse})),r=t.fork();r.add(er()),r.addSignal("parent",null),a.params.subflow={$subflow:Sr(e,r).toRuntime()}},ur=function(e,t,n){var a,r,i=e.remove,o=e.insert,l=e.toggle,u=e.modify,s=e.values,d=t.add(Pe());a="if("+e.trigger+',modify("'+n+'",'+[o,i,l,u,s].map(function(e){return null==e?"null":e}).join(",")+"),0)",r=un(a,t),d.update=r.$expr,d.params=r.$params},sr=function(e,n){var a,r,i,o,l,u,s,d,c,f,p=$a(e),g=e.type===sn,h=e.from&&e.from.facet,m=p===Nn||p===Yn;r=rr(e.from,g,n),a=n.add(Wa({key:r.key,pulse:r.pulse,clean:!g})),a=i=n.add(Aa({pulse:$e(a)})),a=n.add(Ia({markdef:Ea(e),scenepath:{$itempath:n.markpath()},pulse:$e(a)})),d=$e(a),a=n.add(qa(ke(e.encode,e.type,p,n,{pulse:d}))),a.params.parent=n.encode(),e.transform&&e.transform.forEach(function(e){var r=ar(e,n);(r.metadata.generates||r.metadata.changes)&&t.error("Mark transforms should not generate new data."),r.params.pulse=$e(a),n.add(a=r)}),c=$e(a),(h||m)&&(a=n.add(tr({legendMargin:n.config.legendMargin,mark:d,pulse:c})),n.operators.pop(),n.pushState(c,$e(a)),h?or(e,n,r):lr(e,n,r),n.popState(),n.operators.push(a)),o=n.add(Ma({mark:d,pulse:$e(a)})),f=$e(o),!g||h||m||(n.pushState(c,f),p===Xn?lr(e,n,r):Sr(e,n),n.popState()),l=n.add(Qa({pulse:f})),u=n.add(er({pulse:f},void 0,n.parent())),null!=e.name&&(s=Oa(e.name),n.addData(s,new Ne(n,i,l,u)),e.on&&e.on.forEach(function(e){(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),ur(e,n,s)}))},dr=function(e,n){var a,r,i,o,l,u,s,d,c=e.type||"symbol",f=n.config.legend,p=e.name||void 0,g=e.encode||{},h=!!e.interactive,m=e.size||e.shape||e.fill||e.stroke||e.strokeDash||e.opacity;return m||t.error("Missing valid scale for legend."),a={orient:Ke(e.orient,f.orient),title:e.title},r=$e(n.add(Aa(null,[a]))),u=xe({update:{offset:be(Ke(e.offset,f.offset)),padding:be(Ke(e.padding,f.padding)),titlePadding:be(Ke(e.titlePadding,f.titlePadding))}},g.legend),s={update:{x:{field:{group:"padding"}},y:{field:{group:"padding"}},entryPadding:be(Ke(e.entryPadding,f.entryPadding))}},"gradient"===c?(i=$e(n.add(Ta({type:"gradient",scale:n.scaleRef(m),count:n.property(e.tickCount),values:n.property(e.values),formatSpecifier:n.property(e.format)}))),d=[ua(m,f,g.gradient),wa(e,f,g.labels,i)]):(i=$e(n.add(Ta({size:Qe(e,f,g.labels),scale:n.scaleRef(m),count:n.property(e.tickCount),values:n.property(e.values),formatSpecifier:n.property(e.formatSpecifier)}))),d=[Ra(e,f,g.symbols,i),Sa(e,f,g.labels,i)]),d=[Pa(ta,null,r,h,s,d)],a.title&&(l=za(e,f,g.title,r),s.update.y.offset={field:{group:"titlePadding"},offset:l.encode.update.fontSize||l.encode.enter.fontSize},d.push(l)),o=Pa(ea,p,r,h,u,d),e.zindex&&(o.zindex=e.zindex),sr(o,n)},cr=0,fr=["identity","ordinal","band","point","linear","pow","sqrt","log","sequential","time","utc","quantize","quantile","threshold","bin-linear","bin-ordinal"],pr=t.toSet(fr),gr=t.toSet(fr.slice(1,4)),hr=function(e,n){var a,r,i=e.type||"linear";pr.hasOwnProperty(i)||t.error("Unrecognized scale type: "+t.stringValue(i)),a={type:i,domain:rt(e.domain,e,n)},null!=e.range&&(a.range=gt(e,n,a)),null!=e.interpolate&&pt(e.interpolate,a);for(r in e)a.hasOwnProperty(r)||"name"===r||(a[r]=tt(e[r],n));n.addScale(e.name,a)},mr=function(e,n){var a=n.config,r=e.orient,i=r===sa||r===fa?a.axisX:a.axisY,o=a["axis"+r[0].toUpperCase()+r.slice(1)],l="band"===n.scaleType(e.scale)&&a.axisBand;return i||o||l?t.extend({},a.axis,i,o,l):a.axis},vr=function(e,t,n,a){var r,i,o,l,u,s=e.orient,d={value:0},c={};return c.enter=r={opacity:d,stroke:{value:t.tickColor},strokeWidth:{value:t.tickWidth}},c.exit={opacity:d},c.update=i={opacity:{value:1}},s===sa||s===fa?(o="x",u="y"):(o="y",u="x"),l=o+"2",r[u]=d,i[o]=r[o]=yt(e,0),i[l]=r[l]=yt(e,1),la(cn,Gn,null,a,c,n)},yr=function(e,t,n,a){var r,i,o,l,u,s,d,c,f=e.orient,p=e.gridScale,g=f===da||f===sa?1:-1,h=g*e.offset||0,m={value:0},v={};return v.enter=r={opacity:m,stroke:{value:t.gridColor},strokeWidth:{value:t.gridWidth},strokeDash:{value:t.gridDash}},v.exit=i={opacity:m},v.update=o={opacity:{value:t.gridOpacity}},l={scale:e.scale,field:ba,band:t.bandPosition,round:t.tickRound,extra:t.tickExtra},f===sa||f===fa?(u="x",s="y",c="height"):(u="y",s="x",c="width"),d=s+"2",o[u]=r[u]=i[u]=l,p?(r[s]={scale:p,range:0,mult:g,offset:h},o[d]=r[d]={scale:p,range:1,mult:g,offset:h}):(r[s]={value:h},o[d]=r[d]={signal:c,mult:g,offset:h}),la(cn,Jn,ba,a,v,n)},br=function(e,t,n,a,r){var i,o,l,u,s,d=e.orient,c=d===da||d===sa?-1:1,f={value:0},p={};return p.enter=i={opacity:f,stroke:{value:t.tickColor},strokeWidth:{value:t.tickWidth}},p.exit=o={opacity:f},p.update=l={opacity:{value:1}},u=be(r),u.mult=c,s={scale:e.scale,field:ba,band:t.bandPosition,round:t.tickRound,extra:t.tickExtra},d===sa||d===fa?(l.y=i.y=f,l.y2=i.y2=u,l.x=i.x=o.x=s):(l.x=i.x=f,l.x2=i.x2=u,l.y=i.y=o.y=s),la(cn,Qn,ga,a,p,n)},xr=function(e,t,n,a,r){var i,o,l,u,s,d=e.orient,c=d===da||d===sa?-1:1,f=null!=e.labelPadding?e.labelPadding:t.labelPadding,p={value:0},g={};return g.enter=i={opacity:p,fill:{value:t.labelColor},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},text:{field:ga}},g.exit=o={opacity:p},g.update=l={opacity:{value:1}},u=be(r),u.mult=c,u.offset=be(f),u.offset.mult=c,s={scale:e.scale,field:ba,band:.5},d===sa||d===fa?(l.y=i.y=u,l.x=i.x=o.x=s,l.align={value:"center"},l.baseline={value:d===sa?"bottom":"top"}):(l.x=i.x=u,l.y=i.y=o.y=s,l.align={value:d===ca?"left":"right"},l.baseline={value:"middle"}),la(pn,Kn,ga,a,g,n)},kr=function(e,t,n,a){var r,i,o=e.orient,l=o===da||o===sa?-1:1,u=o===sa||o===fa,s={};return s.enter={opacity:{value:0},fill:{value:t.titleColor},font:{value:t.titleFont},fontSize:{value:t.titleFontSize},fontWeight:{value:t.titleFontWeight},align:{value:t.titleAlign}},s.exit={opacity:{value:0}},s.update=r={opacity:{value:1},text:{field:"title"}},i={scale:e.scale,range:.5},u?(r.x=i,r.angle={value:0},r.baseline={value:o===sa?"bottom":"top"}):(r.y=i,r.angle={value:90*l},r.baseline={value:"bottom"}),null!=t.titleAngle&&(r.angle={value:t.titleAngle}),null!=t.titleBaseline&&(r.baseline={value:t.titleBaseline}),null!=t.titleX?r.x={value:t.titleX}:u&&!Se(n,"x")&&(s.enter.auto={value:!0}),null!=t.titleY?r.y={value:t.titleY}:u||Se(n,"y")||(s.enter.auto={value:!0}),la(pn,Zn,null,a,s,n)},wr=function(e,t){var n,a,r,i,o,l,u,s=mr(e,t),d=e.name||void 0,c=e.encode||{},f=!!e.interactive;return n={orient:e.orient,tick:null!=e.tick?!!e.tick:s.tick,label:null!=e.label?!!e.label:s.label,grid:null!=e.grid?!!e.grid:s.grid,domain:null!=e.domain?!!e.domain:s.domain,title:e.title},a=$e(t.add(Aa({},[n]))),l=xe({update:{range:{signal:'abs(span(range("'+e.scale+'")))'},offset:be(e.offset||0),position:be(e.position||0),titlePadding:be(e.titlePadding||s.titlePadding),minExtent:be(e.minExtent||s.minExtent),maxExtent:be(e.maxExtent||s.maxExtent)}},c.axis),r=$e(t.add(ja({scale:t.scaleRef(e.scale),extra:s.tickExtra,count:t.property(e.tickCount),values:t.property(e.values),formatSpecifier:t.property(e.format)}))),u=[],n.grid&&u.push(yr(e,s,c.grid,r)),n.tick&&(i=null!=e.tickSize?e.tickSize:s.tickSize,u.push(br(e,s,c.ticks,r,i))),n.label&&(i=n.tick?i:0,u.push(xr(e,s,c.labels,r,i))),n.domain&&u.push(vr(e,s,c.domain,a)),n.title&&u.push(kr(e,s,c.title,a)),o=Pa(Hn,d,a,f,l,u),e.zindex&&(o.zindex=e.zindex),sr(o,t)},Sr=function(e,n,a){var r=t.array(e.signals);return a||r.forEach(function(e){$t(e,n)}),t.array(e.projections).forEach(function(e){Dn(e,n)}),t.array(e.data).forEach(function(e){ht(e,n)}),t.array(e.scales).forEach(function(e){hr(e,n)}),r.forEach(function(e){Vn(e,n)}),n.parseLambdas(),t.array(e.axes).forEach(function(e){wr(e,n)}),t.array(e.marks).forEach(function(e){sr(e,n)}),t.array(e.legends).forEach(function(e){dr(e,n)}),n},Rr=t.toSet(["width","height","padding"]),zr=xt.prototype=kt.prototype;zr.fork=function(){return new kt(this)},zr.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings}},zr.id=function(){return(this._subid?this._subid+":":0)+this._id++},zr.add=function(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(function(t){t.$ref=e.id}),e.refs=null),e},zr.proxy=function(e){var t=e instanceof Re?$e(e):e;return this.add(Ja({value:t}))},zr.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},zr.addUpdate=function(e){return this.updates.push(e),e},zr.finish=function(){function e(e,t,n){var a,r;e&&(a=e.data||(e.data={}),r=a[t]||(a[t]=[]),r.push(n))}var t,n;this.root&&(this.root.root=!0);for(t in this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(var a in n.index)e(n.index[a],t,"index:"+a)}return this},zr.pushState=function(e,t){this._encode.push($e(this.add(er({pulse:e})))),this._parent.push(t),this._markpath.push(-1)},zr.popState=function(){this._parent.pop(),this._encode.pop(),this._markpath.pop()},zr.parent=function(){return t.peek(this._parent)},zr.encode=function(){return t.peek(this._encode)},zr.markpath=function(){var e=this._markpath;return++e[e.length-1],e.slice()},zr.fieldRef=function(e,n){if(t.isString(e))return Ee(e,n);e.signal||t.error("Unsupported field reference: "+t.stringValue(e));var a,r=e.signal,i=this.field[r];return i||(a={name:this.signalRef(r)},n&&(a.as=n),this.field[r]=i=$e(this.add(Ua(a)))),i},zr.compareRef=function(e){function n(e){return _e(e)?(r=!0,$e(a[e.signal])):e}var a=this.signals,r=!1,i=t.array(e.field).map(n),o=t.array(e.order).map(n);return r?$e(this.add(Ca({fields:i,orders:o}))):Oe(i,o)},zr.keyRef=function(e){function n(e){return _e(e)?(r=!0,$e(a[e.signal])):e}var a=this.signals,r=!1;return e=t.array(e).map(n),r?$e(this.add(Ba({fields:e}))):Fe(e)},zr.sortRef=function(e){if(!e)return e;var t=[De(e.op,e.field),"_id"],n=e.order||Va;return n.signal?$e(this.add(Ca({fields:t,orders:[n=this.signalRef(n.signal),n]}))):Oe(t,[n,n])},zr.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var a=this.id();this.streams.push({id:a,source:e,type:t}),this.events[n]=a}return this.events[n]},zr.addSignal=function(e,n){this.signals.hasOwnProperty(e)&&t.error("Duplicate signal name: "+t.stringValue(e));var a=n instanceof Re?n:this.add(Pe(n));return this.signals[e]=a},zr.getSignal=function(e){return this.signals[e]||t.error("Unrecognized signal name: "+t.stringValue(e)),this.signals[e]},zr.signalRef=function(e){return this.signals[e]?$e(this.signals[e]):(this.lambdas[e]||(this.lambdas[e]=this.add(Pe(null))),$e(this.lambdas[e]))},zr.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,n=e.length;t<n;++t){var a=e[t],r=un(a,this),i=this.lambdas[a];i.params=r.$params,i.update=r.$expr}},zr.property=function(e){return e&&e.signal?this.signalRef(e.signal):e},zr.addBinding=function(e,n){this.bindings||t.error("Nested signals do not support binding: "+t.stringValue(e)),this.bindings.push(t.extend({signal:e},n))},zr.addScaleProj=function(e,n){this.scales.hasOwnProperty(e)&&t.error("Duplicate scale or projection name: "+t.stringValue(e)),this.scales[e]=this.add(n)},zr.addScale=function(e,t){this.addScaleProj(e,Za(t))},zr.addProjection=function(e,t){this.addScaleProj(e,Ga(t))},zr.getScale=function(e){return this.scales[e]||t.error("Unrecognized scale name: "+t.stringValue(e)),this.scales[e]},zr.projectionRef=zr.scaleRef=function(e){return $e(this.getScale(e))},zr.projectionType=zr.scaleType=function(e){return this.getScale(e).params.type},zr.addData=function(e,n){return this.data.hasOwnProperty(e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.data[e]=n},zr.getData=function(e){return this.data[e]||t.error("Undefined data set name: "+t.stringValue(e)),this.data[e]},zr.addDataPipeline=function(e,n){return this.data.hasOwnProperty(e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.addData(e,Ne.fromEntries(this,n))};var Pr=function(e){var n,a=wt();for(n in e)a[n]=t.isObject(a[n])?t.extend(a[n],e[n]):a[n]=e[n];return a},$r=function(e,t){return bt(e,new xt(Pr(t||e.config))).toRuntime()};e.parse=$r,e.selector=hn,e.signal=$t,e.signalUpdates=Vn,e.stream=En,e.codeGenerator=on,e.functionContext=Qt,e.expressionFunction=Q,e.MarkRole=Xn,e.FrameRole=Yn,e.ScopeRole=Nn,e.AxisRole=Hn,e.AxisDomainRole=Gn,e.AxisGridRole=Jn,e.AxisLabelRole=Kn,e.AxisTickRole=Qn,e.AxisTitleRole=Zn,e.LegendRole=ea,e.LegendEntryRole=ta,e.LegendLabelRole=aa,e.LegendSymbolRole=ra,e.LegendTitleRole=ia,e.marktypes=gn,e.isMarkType=ee,e.Scope=xt,e.DataScope=Ne,e.formatLocale=i.formatDefaultLocale,e.timeFormatLocale=o.timeFormatDefaultLocale,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -7,6 +7,19 @@ (function (global, factory) { | ||
var types = {"enum": ["pad", "fit", "none"]}; | ||
var autosize = { | ||
"defs": { | ||
"autosize": { | ||
"enum": ["pad", "fit", "none"], | ||
"oneOf": [ | ||
types, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": types, | ||
"resize": {"type": "boolean"} | ||
}, | ||
"required": ["type"], | ||
"additionalProperties": false | ||
} | ||
], | ||
"default": "pad" | ||
@@ -1075,2 +1088,16 @@ } | ||
"scaleField": {"$ref": "#/refs/stringOrSignal"}, | ||
"scaleInterpolate": { | ||
"oneOf": [ | ||
{"type": "string"}, | ||
{"$ref": "#/refs/signal"}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": {"$ref": "#/refs/stringOrSignal"}, | ||
"gamma": {"$ref": "#/refs/numberOrSignal"} | ||
}, | ||
"required": ["type"] | ||
} | ||
] | ||
}, | ||
"scaleData": { | ||
@@ -1283,3 +1310,3 @@ "oneOf": [ | ||
"properties": { | ||
"type": {"enum": ["quantile", "quantize", "threshold"]}, | ||
"type": {"enum": ["quantile", "quantize", "threshold", "bin-ordinal"]}, | ||
"range": {"oneOf": schemeRangeDef} | ||
@@ -1295,6 +1322,6 @@ }, | ||
"enum": [ | ||
"ordinal", "index", "band", "point", | ||
"ordinal", "band", "point", | ||
"quantile", "quantize", "threshold", | ||
"sequential", "pow", "time", "utc", | ||
"identity" | ||
"identity", "bin-ordinal", "bin-linear" | ||
] | ||
@@ -1307,16 +1334,3 @@ } | ||
"range": {"oneOf": schemeRangeDef}, | ||
"interpolate": { | ||
"oneOf": [ | ||
{"type": "string"}, | ||
{"$ref": "#/refs/signal"}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": {"$ref": "#/refs/stringOrSignal"}, | ||
"gamma": {"$ref": "#/refs/numberOrSignal"} | ||
}, | ||
"required": ["type"] | ||
} | ||
] | ||
}, | ||
"interpolate": {"$ref": "#/refs/scaleInterpolate"}, | ||
"clamp": {"$ref": "#/refs/booleanOrSignal"}, | ||
@@ -1349,2 +1363,10 @@ "nice": { | ||
"required": ["type"] | ||
}, | ||
{ | ||
"properties": { | ||
"type": {"enum": ["bin-linear"]}, | ||
"range": {"oneOf": schemeRangeDef}, | ||
"interpolate": {"$ref": "#/refs/scaleInterpolate"} | ||
}, | ||
"required": ["type"] | ||
} | ||
@@ -1351,0 +1373,0 @@ ] |
{ | ||
"name": "vega-parser", | ||
"version": "1.0.0-beta.26", | ||
"version": "1.0.0-beta.27", | ||
"description": "Parse Vega specifications to runtime dataflows.", | ||
@@ -25,3 +25,3 @@ "keywords": [ | ||
"build": "npm run test && uglifyjs build/vega-parser.js -c -m -o build/vega-parser.min.js", | ||
"rollup": "rollup -f umd -g d3-color:d3,d3-format:d3,d3-time-format:d3,vega-dataflow:vega,vega-expression:vega,vega-scale:vega,vega-scenegraph:vega,vega-util:vega -n vega -o build/vega-parser.js -- index.js", | ||
"rollup": "rollup -f umd -g d3-array:d3,d3-color:d3,d3-format:d3,d3-time-format:d3,vega-dataflow:vega,vega-expression:vega,vega-scale:vega,vega-scenegraph:vega,vega-util:vega -n vega -o build/vega-parser.js -- index.js", | ||
"schema": "rollup -f umd -g vega-dataflow:vega,vega-util:vega -n vega.schema -o build/vega-schema.js -- schema/index.js", | ||
@@ -34,2 +34,3 @@ "pretest": "rm -rf build && mkdir build && npm run rollup && npm run schema", | ||
"dependencies": { | ||
"d3-array": "1", | ||
"d3-color": "1", | ||
@@ -36,0 +37,0 @@ "d3-format": "1", |
@@ -0,5 +1,18 @@ | ||
var types = {"enum": ["pad", "fit", "none"]}; | ||
export default { | ||
"defs": { | ||
"autosize": { | ||
"enum": ["pad", "fit", "none"], | ||
"oneOf": [ | ||
types, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": types, | ||
"resize": {"type": "boolean"} | ||
}, | ||
"required": ["type"], | ||
"additionalProperties": false | ||
} | ||
], | ||
"default": "pad" | ||
@@ -6,0 +19,0 @@ } |
@@ -69,2 +69,16 @@ var rangeDef = [ | ||
"scaleField": {"$ref": "#/refs/stringOrSignal"}, | ||
"scaleInterpolate": { | ||
"oneOf": [ | ||
{"type": "string"}, | ||
{"$ref": "#/refs/signal"}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": {"$ref": "#/refs/stringOrSignal"}, | ||
"gamma": {"$ref": "#/refs/numberOrSignal"} | ||
}, | ||
"required": ["type"] | ||
} | ||
] | ||
}, | ||
"scaleData": { | ||
@@ -277,3 +291,3 @@ "oneOf": [ | ||
"properties": { | ||
"type": {"enum": ["quantile", "quantize", "threshold"]}, | ||
"type": {"enum": ["quantile", "quantize", "threshold", "bin-ordinal"]}, | ||
"range": {"oneOf": schemeRangeDef} | ||
@@ -289,6 +303,6 @@ }, | ||
"enum": [ | ||
"ordinal", "index", "band", "point", | ||
"ordinal", "band", "point", | ||
"quantile", "quantize", "threshold", | ||
"sequential", "pow", "time", "utc", | ||
"identity" | ||
"identity", "bin-ordinal", "bin-linear" | ||
] | ||
@@ -301,16 +315,3 @@ } | ||
"range": {"oneOf": schemeRangeDef}, | ||
"interpolate": { | ||
"oneOf": [ | ||
{"type": "string"}, | ||
{"$ref": "#/refs/signal"}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": {"$ref": "#/refs/stringOrSignal"}, | ||
"gamma": {"$ref": "#/refs/numberOrSignal"} | ||
}, | ||
"required": ["type"] | ||
} | ||
] | ||
}, | ||
"interpolate": {"$ref": "#/refs/scaleInterpolate"}, | ||
"clamp": {"$ref": "#/refs/booleanOrSignal"}, | ||
@@ -343,2 +344,10 @@ "nice": { | ||
"required": ["type"] | ||
}, | ||
{ | ||
"properties": { | ||
"type": {"enum": ["bin-linear"]}, | ||
"range": {"oneOf": schemeRangeDef}, | ||
"interpolate": {"$ref": "#/refs/scaleInterpolate"} | ||
}, | ||
"required": ["type"] | ||
} | ||
@@ -345,0 +354,0 @@ ] |
@@ -20,3 +20,7 @@ import {extend, isObject} from 'vega-util'; | ||
return { | ||
// default for automatic sizing; options: none, pad, fit | ||
// default padding around visualization | ||
padding: 0, | ||
// default for automatic sizing; options: "none", "pad", "fit" | ||
// or provide an object (e.g., {"type": "pad", "resize": true}) | ||
autosize: 'pad', | ||
@@ -23,0 +27,0 @@ |
@@ -35,3 +35,3 @@ import axisConfig from './guides/axis-config'; | ||
update: { | ||
range: {expr: 'abs(span(range("' + spec.scale + '")))'}, | ||
range: {signal: 'abs(span(range("' + spec.scale + '")))'}, | ||
offset: encoder(spec.offset || 0), | ||
@@ -38,0 +38,0 @@ position: encoder(spec.position || 0), |
import {codegen, constants, functions} from 'vega-expression'; | ||
import {pad, stringValue, truncate} from 'vega-util'; | ||
import {rgb, lab, hcl, hsl} from 'd3-color'; | ||
import {range as sequence} from 'd3-array'; | ||
@@ -35,2 +36,3 @@ import { | ||
hsl: hsl, | ||
sequence: sequence, | ||
format: format, | ||
@@ -37,0 +39,0 @@ utcFormat: utcFormat, |
@@ -1,7 +0,7 @@ | ||
import {isObject, isNumber} from 'vega-util'; | ||
import {isObject} from 'vega-util'; | ||
export default function(spec) { | ||
export default function(spec, config) { | ||
spec = spec || config.padding; | ||
return isObject(spec) ? spec | ||
: isNumber(spec) ? {top:spec, bottom:spec, left:spec, right:spec} | ||
: {top: 0, left: 0, bottom: 0, right: 0}; // TODO defaults | ||
} | ||
: (spec = +spec || 0, {top:spec, bottom:spec, left:spec, right:spec}); | ||
} |
@@ -9,10 +9,11 @@ import {ref, keyFieldRef} from '../util'; | ||
'identity', | ||
'ordinal', 'band', 'point', 'index', | ||
'ordinal', 'band', 'point', | ||
'linear', 'pow', 'sqrt', 'log', 'sequential', | ||
'time', 'utc', | ||
'quantize', 'quantile', 'threshold' | ||
] | ||
'quantize', 'quantile', 'threshold', | ||
'bin-linear', 'bin-ordinal' | ||
]; | ||
var allTypes = toSet(types), | ||
ordinalTypes = toSet(types.slice(1, 5)); | ||
ordinalTypes = toSet(types.slice(1, 4)); | ||
@@ -19,0 +20,0 @@ export function isOrdinal(type) { |
@@ -0,1 +1,2 @@ | ||
import parseAutosize from './autosize'; | ||
import parsePadding from './padding'; | ||
@@ -15,9 +16,10 @@ import parseSignal from './signal'; | ||
export default function parseView(spec, scope) { | ||
var op, input, encode, parent, root; | ||
var config = scope.config, | ||
op, input, encode, parent, root; | ||
scope.background = spec.background || scope.config.background; | ||
scope.background = spec.background || config.background; | ||
root = ref(scope.root = scope.add(operator())); | ||
scope.addSignal('width', spec.width || -1); | ||
scope.addSignal('height', spec.height || -1); | ||
scope.addSignal('padding', parsePadding(spec.padding)); | ||
scope.addSignal('padding', parsePadding(spec.padding, config)); | ||
@@ -43,4 +45,4 @@ array(spec.signals).forEach(function(_) { | ||
parent = scope.add(ViewLayout({ | ||
legendMargin: scope.config.legendMargin, | ||
autosize: spec.autosize || scope.config.autosize, | ||
legendMargin: config.legendMargin, | ||
autosize: parseAutosize(spec.autosize, config), | ||
mark: root, | ||
@@ -47,0 +49,0 @@ pulse: ref(encode) |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
351307
109
9928
9
+ Addedd3-array@1
+ Addedd3-array@1.2.4(transitive)