vega-parser
Advanced tools
Comparing version 5.13.1 to 5.14.0
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression"),require("vega-functions"),require("vega-event-selector"),require("vega-scale"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","vega-functions","vega-event-selector","vega-scale","vega-dataflow"],t):t((e=e||self).vega={},e.vega,e.vega,e.vega,e.vega,e.vega,e.vega)}(this,(function(e,t,n,i,a,r,l){"use strict";function o(e){return t.isObject(e)?e:{type:e||"pad"}}const s=e=>+e||0;function u(e){return t.isObject(e)?e.signal?e:{top:s(e.top),bottom:s(e.bottom),left:s(e.left),right:s(e.right)}:{top:n=s(e),bottom:n,left:n,right:n};var n}var d=["value","update","init","react","bind"];function c(e,n){t.error(e+' for "outer" push: '+t.stringValue(n))}function f(e,t){var n=e.name;if("outer"===e.push)t.signals[n]||c("No prior signal definition",n),d.forEach((function(t){void 0!==e[t]&&c("Invalid property ",t)}));else{var i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function g(e,a,r){var l,o,s={};try{e=t.isString(e)?e:t.stringValue(e)+"",l=n.parse(e)}catch(n){t.error("Expression parse error: "+e)}return l.visit((function(e){if(e.type===n.CallExpression){var t=e.callee.name,r=i.codegenParams.visitors[t];r&&r(t,e.arguments,a,s)}})),(o=i.codeGenerator(l)).globals.forEach((function(e){var n=i.SignalPrefix+e;!t.hasOwnProperty(s,n)&&a.getSignal(e)&&(s[n]=a.signalRef(e))})),{$expr:r?r+"return("+o.code+");":o.code,$fields:o.fields,$params:s}}function p(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function m(e,t,n,i){return new p(e,t,n,i)}function h(e,t){return m("operator",e,t)}function y(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function b(e,t){return t?{$field:e,$name:t}:{$field:e}}var v=b("key");function x(e,t){return{$compare:e,$order:t}}function k(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function S(e){return e&&e.signal}function O(e){if(S(e))return!0;if(t.isObject(e))for(var n in e)if(O(e[n]))return!0;return!1}function $(e,t){return null!=e?e:t}function R(e){return e&&e.signal||e}function z(e,n){return(e.merge?w:e.stream?j:e.type?P:t.error("Invalid stream specification: "+t.stringValue(e)))(e,n)}function w(e,t){var n=V({merge:e.merge.map(e=>z(e,t))},e,t);return t.addStream(n).id}function j(e,t){var n=V({stream:z(e.stream,t)},e,t);return t.addStream(n).id}function P(e,t){var n,i,a;return"timer"===e.type?(n=t.event("timer",e.throttle),e={between:e.between,filter:e.filter}):n=t.event("scope"===(a=e.source)?"view":a||"view",e.type),i=V({stream:n},e,t),1===Object.keys(i).length?n:t.addStream(i).id}function V(e,n,i){var a,r,l,o,s=n.between;return s&&(2!==s.length&&t.error('Stream "between" parameter must have 2 entries: '+t.stringValue(n)),e.between=[z(s[0],i),z(s[1],i)]),s=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&s.push((a=n.marktype,r=n.markname,l=n.markrole,(o="event.item")+(a&&"*"!==a?"&&"+o+".mark.marktype==='"+a+"'":"")+(l?"&&"+o+".mark.role==='"+l+"'":"")+(r?"&&"+o+".mark.name==='"+r+"'":""))),"scope"===n.source&&s.push("inScope(event.item)"),s.length&&(e.filter=g("("+s.join(")&&(")+")").$expr),null!=(s=n.throttle)&&(e.throttle=+s),null!=(s=n.debounce)&&(e.debounce=+s),n.consume&&(e.consume=!0),e}var D="var datum=event.item&&event.item.datum;";function W(e,n,i){var r=e.events,l=e.update,o=e.encode,s=[],u={target:i};r||t.error("Signal update missing events specification."),t.isString(r)&&(r=a.selector(r,n.isSubscope()?"scope":"view")),r=t.array(r).filter(e=>e.signal||e.scale?(s.push(e),0):1),s.length>1&&(s=[_(s)]),r.length&&s.push(r.length>1?{merge:r}:r[0]),null!=o&&(l&&t.error("Signal encode and update are mutually exclusive."),l="encode(item(),"+t.stringValue(o)+")"),u.update=t.isString(l)?g(l,n,D):null!=l.expr?g(l.expr,n,D):null!=l.value?l.value:null!=l.signal?{$expr:"_.value",$params:{value:n.signalRef(l.signal)}}:t.error("Invalid signal update specification."),e.force&&(u.options={force:!0}),s.forEach((function(e){n.addUpdate(t.extend(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):z(e,t)}}(e,n),u))}))}function _(e){return{signal:"["+e.map(e=>e.scale?'scale("'+e.scale+'")':e.signal)+"]"}}function C(e,n){var i=n.getSignal(e.name),a=e.update;e.init&&(a?t.error("Signals can not include both init and update expressions."):(a=e.init,i.initonly=!0)),a&&(a=g(a,n),i.update=a.$expr,i.params=a.$params),e.on&&e.on.forEach((function(e){W(e,n,i.id)}))}function L(e){return function(t,n,i){return m(e,n,t||void 0,i)}}var E=L("aggregate"),A=L("axisticks"),F=L("bound"),T=L("collect"),B=L("compare"),q=L("datajoin"),M=L("encode"),U=L("expression"),H=L("facet"),I=L("field"),N=L("key"),G=L("legendentries"),X=L("load"),Y=L("mark"),Q=L("multiextent"),J=L("multivalues"),K=L("overlap"),Z=L("params"),ee=L("prefacet"),te=L("projection"),ne=L("proxy"),ie=L("relay"),ae=L("render"),re=L("scale"),le=L("sieve"),oe=L("sortitems"),se=L("viewlayout"),ue=L("values"),de=0,ce={min:"min",max:"max",count:"sum"};function fe(e,n){var i,a,l=n.getScale(e.name).params;for(i in l.domain=he(e.domain,e,n),null!=e.range&&(l.range=function e(n,i,a){var l=n.range,o=i.config.range;if(l.signal)return i.signalRef(l.signal);if(t.isString(l)){if(o&&t.hasOwnProperty(o,l))return n=t.extend({},n,{range:o[l]}),e(n,i,a);"width"===l?l=[0,{signal:"width"}]:"height"===l?l=r.isDiscrete(n.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+t.stringValue(l))}else{if(l.scheme)return a.scheme=t.isArray(l.scheme)?pe(l.scheme,i):ge(l.scheme,i),l.extent&&(a.schemeExtent=pe(l.extent,i)),void(l.count&&(a.schemeCount=ge(l.count,i)));if(l.step)return void(a.rangeStep=ge(l.step,i));if(r.isDiscrete(n.type)&&!t.isArray(l))return he(l,n,i);t.isArray(l)||t.error("Unsupported range type: "+t.stringValue(l))}return l.map(e=>(t.isArray(e)?pe:ge)(e,i))}(e,n,l)),null!=e.interpolate&&function(e,t){t.interpolate=ge(e.type||e),null!=e.gamma&&(t.interpolateGamma=ge(e.gamma))}(e.interpolate,l),null!=e.nice&&(l.nice=(a=e.nice,t.isObject(a)?{interval:ge(a.interval),step:ge(a.step)}:ge(a))),null!=e.bins&&(l.bins=function(e,n){return e.signal||t.isArray(e)?pe(e,n):n.objectProperty(e)}(e.bins,n)),e)t.hasOwnProperty(l,i)||"name"===i||(l[i]=ge(e[i],n))}function ge(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+t.stringValue(e)):e}function pe(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>ge(e,t))}function me(e){t.error("Can not find data set: "+t.stringValue(e))}function he(e,n,i){if(e)return e.signal?i.signalRef(e.signal):(t.isArray(e)?ye:e.fields?ve:be)(e,n,i);null==n.domainMin&&null==n.domainMax||t.error("No scale domain defined for domainMin/domainMax to override.")}function ye(e,t,n){return e.map((function(e){return ge(e,n)}))}function be(e,t,n){var i=n.getData(e.data);return i||me(e.data),r.isDiscrete(t.type)?i.valuesRef(n,e.field,ke(e.sort,!1)):r.isQuantile(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function ve(e,n,i){var a=e.data,l=e.fields.reduce((function(e,n){return n=t.isString(n)?{data:a,field:n}:t.isArray(n)||n.signal?function(e,n){var i="_:vega:_"+de++,a=T({});if(t.isArray(e))a.value={$ingest:e};else if(e.signal){var r="setdata("+t.stringValue(i)+","+e.signal+")";a.params.input=n.signalRef(r)}return n.addDataPipeline(i,[a,le({})]),{data:i,field:"data"}}(n,i):n,e.push(n),e}),[]);return(r.isDiscrete(n.type)?xe:r.isQuantile(n.type)?Se:Oe)(e,i,l)}function xe(e,t,n){var i,a,r,l,o,s=ke(e.sort,!0);return i=n.map((function(e){var n=t.getData(e.data);return n||me(e.data),n.countsRef(t,e.field,s)})),a={groupby:v,pulse:i},s&&(r=s.op||"count",o=s.field?k(r,s.field):"count",a.ops=[ce[r]],a.fields=[t.fieldRef(o)],a.as=[o]),r=t.add(E(a)),l=t.add(T({pulse:y(r)})),o=t.add(ue({field:v,sort:t.sortRef(s),pulse:y(l)})),y(o)}function ke(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field&&e.op&&!ce[e.op]&&t.error("Multiple domain scales can not be sorted using "+e.op):t.error("No field provided for sort aggregate op: "+e.op):t.isObject(e)?e.field="key":e={field:"key"}),e}function Se(e,t,n){var i=n.map((function(e){var n=t.getData(e.data);return n||me(e.data),n.domainRef(t,e.field)}));return y(t.add(J({values:i})))}function Oe(e,t,n){var i=n.map((function(e){var n=t.getData(e.data);return n||me(e.data),n.extentRef(t,e.field)}));return y(t.add(Q({extents:i})))}function $e(e,n,i){return t.isArray(e)?e.map((function(e){return $e(e,n,i)})):t.isObject(e)?e.signal?i.signalRef(e.signal):"fit"===n?e:t.error("Unsupported parameter object: "+t.stringValue(e)):e}const Re="top",ze="left",we="value",je=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],Pe={name:1,style:1,interactive:1},Ve={value:0},De={value:1};var We=t.toSet(["rule"]),_e=t.toSet(["group","image","rect"]);function Ce(e,n,i,a){var r=g(e,n);return r.$fields.forEach((function(e){a[e]=1})),t.extend(i,r.$params),r.$expr}function Le(e,n,i,a){return function e(n,i,a,r){var l,o,s;if(n.signal)l="datum",s=Ce(n.signal,i,a,r);else if(n.group||n.parent){for(o=Math.max(1,n.level||1),l="item";o-- >0;)l+=".mark.group";n.parent?(s=n.parent,l+=".datum"):s=n.group}else n.datum?(l="datum",s=n.datum):t.error("Invalid field reference: "+t.stringValue(n));n.signal||(t.isString(s)?(r[s]=1,s=t.splitAccessPath(s).map(t.stringValue).join("][")):s=e(s,i,a,r));return l+"["+s+"]"}(t.isObject(e)?e:{datum:e},n,i,a)}function Ee(e,n,i,a){return t.isObject(e)?"("+Te(null,e,n,i,a)+")":e}function Ae(e,n,i,a,r){var l,o,s,u=Fe(e.scale,i,a,r);return null!=e.range?(o=u+".range()",n=0===(l=+e.range)?o+"[0]":"($="+o+","+(1===l?"$[$.length-1]":"$[0]+"+l+"*($[$.length-1]-$[0])")+")"):(void 0!==n&&(n=u+"("+n+")"),e.band&&(s=function(e,n){if(!t.isString(e))return-1;var i=n.scaleType(e);return"band"===i||"point"===i?1:0}(e.scale,i))&&(o=u+".bandwidth",l=e.band.signal?o+"()*"+Ee(e.band,i,a,r):o+"()"+(1===(l=+e.band)?"":"*"+l),s<0&&(l="("+o+"?"+l+":0)"),n=(n?n+"+":"")+l,e.extra&&(n="(datum.extra?"+u+"(datum.extra.value):"+n+")")),null==n&&(n="0")),n}function Fe(e,n,a,r){var l;if(t.isString(e))l=i.ScalePrefix+e,t.hasOwnProperty(a,l)||(a[l]=n.scaleRef(e)),l=t.stringValue(l);else{for(l in n.scales)a[i.ScalePrefix+l]=n.scaleRef(l);l=t.stringValue(i.ScalePrefix)+"+"+(e.signal?"("+Ce(e.signal,n,a,r)+")":Le(e,n,a,r))}return"_["+l+"]"}function Te(e,n,i,a,r){if(null!=n.gradient)return function(e,n,i,a){return"this.gradient("+Fe(e.gradient,n,i,a)+","+t.stringValue(e.start)+","+t.stringValue(e.stop)+","+t.stringValue(e.count)+")"}(n,i,a,r);var l=n.signal?Ce(n.signal,i,a,r):n.color?function(e,t,n,i){function a(e,a,r,l){return"this."+e+"("+[Te(null,a,t,n,i),Te(null,r,t,n,i),Te(null,l,t,n,i)].join(",")+").toString()"}return e.c?a("hcl",e.h,e.c,e.l):e.h||e.s?a("hsl",e.h,e.s,e.l):e.l||e.a?a("lab",e.l,e.a,e.b):e.r||e.g||e.b?a("rgb",e.r,e.g,e.b):null}(n.color,i,a,r):null!=n.field?Le(n.field,i,a,r):void 0!==n.value?t.stringValue(n.value):void 0;return null!=n.scale&&(l=Ae(n,l,i,a,r)),void 0===l&&(l=null),null!=n.exponent&&(l="Math.pow("+l+","+Ee(n.exponent,i,a,r)+")"),null!=n.mult&&(l+="*"+Ee(n.mult,i,a,r)),null!=n.offset&&(l+="+"+Ee(n.offset,i,a,r)),n.round&&(l="Math.round("+l+")"),l}function Be(e,n,i){const a=e+"["+t.stringValue(n)+"]";return`$=${i};if(${a}!==$)${a}=$,m=1;`}function qe(e,n,i,a,r){var l="";return n.forEach((function(e){var t=Te(0,e,i,a,r);l+=e.test?Ce(e.test,i,a,r)+"?"+t+":":t})),":"===t.peek(l)&&(l+="null"),Be("o",e,l)}function Me(e,n,i,a){var r,l,o={},s="var o=item,datum=o.datum,m=0,$;";for(r in e)l=e[r],t.isArray(l)?s+=qe(r,l,a,i,o):s+=Be("o",r,Te(0,l,a,i,o));return s+=function(e,t){var n="";return We[t]||(e.x2&&(e.x?(_e[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(_e[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(e,n),{$expr:s+="return m;",$fields:Object.keys(o),$output:Object.keys(e)}}function Ue(e){return t.isObject(e)&&!t.isArray(e)?t.extend({},e):{value:e}}function He(e,n,i,a){return null!=i?(t.isObject(i)&&!t.isArray(i)?e.update[n]=i:e[a||"enter"][n]={value:i},1):0}function Ie(e,t,n){for(let n in t)He(e,n,t[n]);for(let t in n)He(e,t,n[t],"update")}function Ne(e,n,i){for(var a in n)i&&t.hasOwnProperty(i,a)||(e[a]=t.extend(e[a]||{},n[a]));return e}function Ge(e,n,i,a,r,l){var o,s;for(s in(l=l||{}).encoders={$encode:o={}},e=function(e,n,i,a,r){var l,o,s,u={},d={};o="lineBreak","text"!==n||null==r[o]||Ye(o,e)||Xe(u,o,r[o]);("legend"==i||String(i).startsWith("axis"))&&(i=null);for(o in s="frame"===i?r.group:"mark"===i?t.extend({},r.mark,r[n]):null)Ye(o,e)||("fill"===o||"stroke"===o)&&(Ye("fill",e)||Ye("stroke",e))||Xe(u,o,s[o]);for(o in t.array(a).forEach((function(t){var n=r.style&&r.style[t];for(var i in n)Ye(i,e)||Xe(u,i,n[i])})),e=t.extend({},e),u)(s=u[o]).signal?(l=l||{})[o]=s:d[o]=s;e.enter=t.extend(d,e.enter),l&&(e.update=t.extend(l,e.update));return e}(e,n,i,a,r.config))o[s]=Me(e[s],n,l,r);return l}function Xe(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}function Ye(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function Qe(e,t,n,i,a,r,l){return{type:e,name:l?l.name:void 0,role:t,style:l&&l.style||n,key:i,from:a,interactive:!(!l||!l.interactive),encode:Ne(r,l,Pe)}}function Je(e,t){const n=(n,i)=>$(e[n],$(t[n],i));return n.isVertical=n=>"vertical"===$(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>$(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>$(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>$(e.columns,$(t.columns,+n.isVertical(!0))),n}function Ke(e,t){var n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function Ze(e,t,n){return`item.anchor === "start" ? ${e} : item.anchor === "end" ? ${t} : ${n}`}const et=Ze(t.stringValue(ze),t.stringValue("right"),t.stringValue("center"));function tt(e,n){return n?e?t.isObject(e)?{...e,offset:tt(e.offset,n)}:{value:e,offset:n}:n:e}function nt(e,n,i,a){var r,l,o,s,u,d,c=Je(e,i),f=c.isVertical(),g=c.gradientThickness(),p=c.gradientLength();return f?(o=[0,1],s=[0,0],u=g,d=p):(o=[0,0],s=[1,0],u=p,d=g),Ie(r={enter:l={opacity:Ve,x:Ve,y:Ve,width:Ue(u),height:Ue(d)},update:t.extend({},l,{opacity:De,fill:{gradient:n,start:o,stop:s}}),exit:{opacity:Ve}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),Qe("rect","legend-gradient",null,void 0,void 0,r,a)}function it(e,n,i,a,r){var l,o,s,u,d,c,f=Je(e,i),g=f.isVertical(),p=f.gradientThickness(),m=f.gradientLength(),h="";return g?(s="y",d="y2",u="x",c="width",h="1-"):(s="x",d="x2",u="y",c="height"),(o={opacity:Ve,fill:{scale:n,field:we}})[s]={signal:h+"datum.perc",mult:m},o[u]=Ve,o[d]={signal:h+"datum.perc2",mult:m},o[c]=Ue(p),Ie(l={enter:o,update:t.extend({},o,{opacity:De}),exit:{opacity:Ve}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),Qe("rect","legend-band",null,we,r,l,a)}function at(e,t,n,i){var a,r,l,o,s,u=Je(e,t),d=u.isVertical(),c=Ue(u.gradientThickness()),f=u.gradientLength(),g=u("labelOverlap"),p=u("labelSeparation"),m="";return Ie(a={enter:r={opacity:Ve},update:l={opacity:De,text:{field:"label"}},exit:{opacity:Ve}},{fill:u("labelColor"),fillOpacity:u("labelOpacity"),font:u("labelFont"),fontSize:u("labelFontSize"),fontStyle:u("labelFontStyle"),fontWeight:u("labelFontWeight"),limit:$(e.labelLimit,t.gradientLabelLimit)}),d?(r.align={value:"left"},r.baseline=l.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},o="y",s="x",m="1-"):(r.align=l.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},r.baseline={value:"top"},o="x",s="y"),r[o]=l[o]={signal:m+"datum.perc",mult:f},r[s]=l[s]=c,c.offset=$(e.labelOffset,t.gradientLabelOffset)||0,e=Qe("text","legend-label","guide-label",we,i,a,n),g&&(e.overlap={separation:p,method:g,order:"datum.index"}),e}function rt(e,t,n,i,a,r,l,o){return{type:"group",name:n,role:e,style:t,from:i,interactive:a||!1,encode:r,marks:l,layout:o}}function lt(e,t,n,i,a){var r,l,o,s,u,d,c,f=Je(e,t),g=n.entries,p=!(!g||!g.interactive),m=g?g.name:void 0,h=f("clipHeight"),y=f("symbolOffset"),b={data:"value"},v={},x=`(${a}) ? datum.offset : datum.size`,k=h?Ue(h):{field:"size"},S="datum.index",O=`max(1, ${a})`;k.mult=.5,v={enter:r={opacity:Ve,x:{signal:x,mult:.5,offset:y},y:k},update:l={opacity:De,x:r.x,y:r.y},exit:{opacity:Ve}};var $=null,R=null;return e.fill||($=t.symbolBaseFillColor,R=t.symbolBaseStrokeColor),Ie(v,{fill:f("symbolFillColor",$),shape:f("symbolType"),size:f("symbolSize"),stroke:f("symbolStrokeColor",R),strokeDash:f("symbolDash"),strokeDashOffset:f("symbolDashOffset"),strokeWidth:f("symbolStrokeWidth")},{opacity:f("symbolOpacity")}),je.forEach((function(t){e[t]&&(l[t]=r[t]={scale:e[t],field:we})})),s=Qe("symbol","legend-symbol",null,we,b,v,n.symbols),h&&(s.clip=!0),(o=Ue(y)).offset=f("labelOffset"),Ie(v={enter:r={opacity:Ve,x:{signal:x,offset:o},y:k},update:l={opacity:De,text:{field:"label"},x:r.x,y:r.y},exit:{opacity:Ve}},{align:f("labelAlign"),baseline:f("labelBaseline"),fill:f("labelColor"),fillOpacity:f("labelOpacity"),font:f("labelFont"),fontSize:f("labelFontSize"),fontStyle:f("labelFontStyle"),fontWeight:f("labelFontWeight"),limit:f("labelLimit")}),u=Qe("text","legend-label","guide-label",we,b,v,n.labels),v={enter:{noBound:{value:!h},width:Ve,height:h?Ue(h):Ve,opacity:Ve},exit:{opacity:Ve},update:l={opacity:De,row:{signal:null},column:{signal:null}}},f.isVertical(!0)?(d=`ceil(item.mark.items.length / ${O})`,l.row.signal=`${S}%${d}`,l.column.signal=`floor(${S} / ${d})`,c={field:["row",S]}):(l.row.signal=`floor(${S} / ${O})`,l.column.signal=`${S} % ${O}`,c={field:S}),l.column.signal=`(${a})?${l.column.signal}:${S}`,(e=rt("scope",null,m,i={facet:{data:i,name:"value",groupby:"index"}},p,Ne(v,g,Pe),[s,u])).sort=c,e}const ot='item.orient === "left"',st='item.orient === "right"',ut=`(${ot} || ${st})`,dt=`datum.vgrad && ${ut}`,ct=Ze('"top"','"bottom"','"middle"'),ft=`datum.vgrad && ${st} ? (${Ze('"right"','"left"','"center"')}) : (${ut} && !(datum.vgrad && ${ot})) ? "left" : ${et}`,gt=`item._anchor || (${ut} ? "middle" : "start")`,pt=`${dt} ? (${ot} ? -90 : 90) : 0`,mt=`${ut} ? (datum.vgrad ? (${st} ? "bottom" : "top") : ${ct}) : "top"`;function ht(e,n){var i;return t.isObject(e)&&(e.signal?i=e.signal:e.path?i="pathShape("+yt(e.path)+")":e.sphere&&(i="geoShape("+yt(e.sphere)+', {type: "Sphere"})')),i?n.signalRef(i):!!e}function yt(e){return t.isObject(e)&&e.signal?e.signal:t.stringValue(e)}function bt(e){var t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?"group"===e.type?"scope":t||"mark":t}function vt(e){return{marktype:e.type,name:e.name||void 0,role:e.role||bt(e),zindex:+e.zindex||void 0}}function xt(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function kt(e,n){var i=l.definition(e.type);i||t.error("Unrecognized transform type: "+t.stringValue(e.type));var a=m(i.type.toLowerCase(),null,St(i,e,n));return e.signal&&n.addSignal(e.signal,n.proxy(a)),a.metadata=i.metadata||{},a}function St(e,t,n){var i,a,r,l={};for(a=0,r=e.params.length;a<r;++a)l[(i=e.params[a]).name]=Ot(i,t,n);return l}function Ot(e,n,i){var a=e.type,r=n[e.name];return"index"===a?function(e,n,i){t.isString(n.from)||t.error('Lookup "from" parameter must be a string literal.');return i.getData(n.from).lookupRef(i,n.key)}(0,n,i):void 0!==r?"param"===a?function(e,n,i){var a=n[e.name];return e.array?(t.isArray(a)||t.error("Expected an array of sub-parameters. Instead: "+t.stringValue(a)),a.map((function(t){return Rt(e,t,i)}))):Rt(e,a,i)}(e,n,i):"projection"===a?i.projectionRef(n[e.name]):e.array&&!S(r)?r.map((function(t){return $t(e,t,i)})):$t(e,r,i):void(e.required&&t.error("Missing required "+t.stringValue(n.type)+" parameter: "+t.stringValue(e.name)))}function $t(e,n,i){var a=e.type;if(S(n))return zt(a)?t.error("Expression references can not be signals."):wt(a)?i.fieldRef(n):jt(a)?i.compareRef(n):i.signalRef(n.signal);var r,l=e.expr||wt(a);return l&&((r=n)&&r.expr)?i.exprRef(n.expr,n.as):l&&function(e){return e&&e.field}(n)?b(n.field,n.as):zt(a)?g(n,i):function(e){return"data"===e}(a)?y(i.getData(n).values):wt(a)?b(n):jt(a)?i.compareRef(n):n}function Rt(e,n,i){var a,r,l,o,s;for(o=0,s=e.params.length;o<s;++o){for(l in(r=e.params[o]).key)if(r.key[l]!==n[l]){r=null;break}if(r)break}return r||t.error("Unsupported parameter: "+t.stringValue(n)),a=t.extend(St(r,n,i),r.key),y(i.add(Z(a)))}function zt(e){return"expr"===e}function wt(e){return"field"===e}function jt(e){return"compare"===e}function Pt(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:y(t.getData(e.data).output)}function Vt(e,t,n,i,a){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=a,this.index={}}Vt.fromEntries=function(e,t){var n=t.length,i=1,a=t[0],r=t[n-1],l=t[n-2],o=null;for(a&&"load"===a.type&&(a=t[1]),e.add(t[0]);i<n;++i)t[i].params.pulse=y(t[i-1]),e.add(t[i]),"aggregate"===t[i].type&&(o=t[i]);return new Vt(e,a,l,r,o)};var Dt=Vt.prototype;function Wt(e){return t.isString(e)?e:null}function _t(e,t,n){var i,a=k(n.op,n.field);if(t.ops){for(var r=0,l=t.as.length;r<l;++r)if(t.as[r]===a)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((i=n.op.signal)?e.signalRef(i):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(a))}function Ct(e,n,i,a,r,l,o){var s,u,d=n[i]||(n[i]={}),c=function(e){return t.isObject(e)?("descending"===e.order?"-":"+")+k(e.op,e.field):""}(l),f=Wt(r);if(null!=f&&(e=n.scope,s=d[f+=c?"|"+c:""]),!s){var g=l?{field:v,pulse:n.countsRef(e,r,l)}:{field:e.fieldRef(r),pulse:y(n.output)};c&&(g.sort=e.sortRef(l)),u=e.add(m(a,void 0,g)),o&&(n.index[r]=u),s=y(u),null!=f&&(d[f]=s)}return s}function Lt(e,t,n){var i,a=e.remove,r=e.insert,l=e.toggle,o=e.modify,s=e.values,u=t.add(h());i=g("if("+e.trigger+',modify("'+n+'",'+[r,a,l,o,s].map((function(e){return null==e?"null":e})).join(",")+"),0)",t),u.update=i.$expr,u.params=i.$params}function Et(e,n){var i,a,r,l,o,s,u,d,c,f,g,p,m,h,v=bt(e),x="group"===e.type,k=e.from&&e.from.facet,O=e.layout||"scope"===v||"frame"===v,$="mark"===v||O||k,R=e.overlap;r=function(e,n,i){var a,r,l,o,s;return e?(a=e.facet)&&(n||t.error("Only group marks can be faceted."),null!=a.field?o=s=Pt(a,i):(e.data?s=y(i.getData(e.data).aggregate):((l=kt(t.extend({type:"aggregate",groupby:t.array(a.groupby)},a.aggregate),i)).params.key=i.keyRef(a.groupby),l.params.pulse=Pt(a,i),o=s=y(i.add(l))),r=i.keyRef(a.groupby,!0))):o=y(i.add(T(null,[{}]))),o||(o=Pt(e,i)),{key:r,pulse:o,parent:s}}(e.from,x,n),f=y(a=n.add(q({key:r.key||(e.key?b(e.key):void 0),pulse:r.pulse,clean:!x}))),a=l=n.add(T({pulse:f})),a=n.add(Y({markdef:vt(e),interactive:xt(e.interactive,n),clip:ht(e.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:y(a)})),g=y(a),(a=o=n.add(M(Ge(e.encode,e.type,v,e.style,n,{mod:!1,pulse:g})))).params.parent=n.encode(),e.transform&&e.transform.forEach((function(e){const i=kt(e,n),r=i.metadata;(r.generates||r.changes)&&t.error("Mark transforms should not generate new data."),r.nomod||(o.params.mod=!0),i.params.pulse=y(a),n.add(a=i)})),e.sort&&(a=n.add(oe({sort:n.compareRef(e.sort),pulse:y(a)}))),p=y(a),(k||O)&&(m=y(O=n.add(se({layout:n.objectProperty(e.layout),legends:n.legends,mark:g,pulse:p})))),h=y(s=n.add(F({mark:g,pulse:m||p}))),x&&($&&((i=n.operators).pop(),O&&i.pop()),n.pushState(p,m||h,f),k?function(e,n,i){var a,r,l,o,s=e.from.facet,u=s.name,d=Pt(s,n);s.name||t.error("Facet must have a name: "+t.stringValue(s)),s.data||t.error("Facet must reference a data set: "+t.stringValue(s)),s.field?o=n.add(ee({field:n.fieldRef(s.field),pulse:d})):s.groupby?o=n.add(H({key:n.keyRef(s.groupby),group:y(n.proxy(i.parent)),pulse:d})):t.error("Facet must specify groupby or field: "+t.stringValue(s)),r=(a=n.fork()).add(T()),l=a.add(le({pulse:y(r)})),a.addData(u,new Vt(a,r,r,l)),a.addSignal("parent",null),o.params.subflow={$subflow:Gt(e,a).toRuntime()}}(e,n,r):$?function(e,t,n){var i=t.add(ee({pulse:n.pulse})),a=t.fork();a.add(le()),a.addSignal("parent",null),i.params.subflow={$subflow:Gt(e,a).toRuntime()}}(e,n,r):Gt(e,n),n.popState(),$&&(O&&i.push(O),i.push(s))),R&&(h=function(e,t,n){var i,a=e.method,r=e.bound,l=e.separation,o={separation:S(l)?n.signalRef(l.signal):l,method:S(a)?n.signalRef(a.signal):a,pulse:t};e.order&&(o.sort=n.compareRef({field:e.order}));r&&(i=r.tolerance,o.boundTolerance=S(i)?n.signalRef(i.signal):+i,o.boundScale=n.scaleRef(r.scale),o.boundOrient=r.orient);return y(n.add(K(o)))}(R,h,n)),u=n.add(ae({pulse:h})),d=n.add(le({pulse:y(u)},void 0,n.parent())),null!=e.name&&(c=e.name,n.addData(c,new Vt(n,l,u,d)),e.on&&e.on.forEach((function(e){(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),Lt(e,n,c)})))}function At(e,n){var i,a,l,o,s,u,d,c,f,p=n.config.legend,m=e.encode||{},h=m.legend||{},b=h.name||void 0,v=h.interactive,x=h.style,k=Je(e,p),S=je.reduce((function(t,n){return t||e[n]}),0);return S||t.error("Missing valid scale for legend."),s=function(e,t){var n=e.type||"symbol";e.type||1!==function(e){return je.reduce((function(t,n){return t+(e[n]?1:0)}),0)}(e)||!e.fill&&!e.stroke||(n=r.isContinuous(t)?"gradient":r.isDiscretizing(t)?"discrete":"symbol");return"gradient"!==n?n:r.isDiscretizing(t)?"discrete":"gradient"}(e,n.scaleType(S)),u={title:null!=e.title,type:s,vgrad:"symbol"!==s&&k.isVertical()},d=y(n.add(T(null,[u]))),h=Ne(function(e,t){var n={enter:{},update:{}};return Ie(n,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:t.strokeWidth,strokeDash:t.strokeDash,x:e("legendX"),y:e("legendY")}),n}(k,p),h,Pe),i={enter:{x:{value:0},y:{value:0}}},c=y(n.add(G(l={type:s,scale:n.scaleRef(S),count:n.objectProperty(k("tickCount")),limit:n.property(k("symbolLimit")),values:n.objectProperty(e.values),minstep:n.property(e.tickMinStep),formatType:n.property(e.formatType),formatSpecifier:n.property(e.format)}))),"gradient"===s?(o=[nt(e,S,p,m.gradient),at(e,p,m.labels,c)],l.count=l.count||n.signalRef(`max(2,2*floor((${R(k.gradientLength())})/100))`)):"discrete"===s?o=[it(e,S,p,m.gradient,c),at(e,p,m.labels,c)]:(a=function(e,t){const n=Je(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,p),o=[lt(e,p,m,c,R(a.columns))],l.size=function(e,t,n){var i=R(Ft("size",e,n)),a=R(Ft("strokeWidth",e,n)),r=R(function(e,t,n){return Ke("fontSize",e)||function(e,t,n){var i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(n[1].encode,t,"guide-label"));return g(`max(ceil(sqrt(${i})+${a}),${r})`,t)}(e,n,o[0].marks)),o=[rt("legend-entry",null,null,d,v,i,o,a)],u.title&&o.push(function(e,t,n,i){var a,r=Je(e,t);return Ie(a={enter:{opacity:Ve},update:{opacity:De,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:Ve}},{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:gt},angle:{signal:pt},align:{signal:ft},baseline:{signal:mt},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),Qe("text","legend-title","guide-title",null,i,a,n)}(e,p,m.title,d)),f=rt("legend",x,b,d,v,h,o),e.zindex&&(f.zindex=e.zindex),Et(f,n)}function Ft(e,t,n){return t[e]?`scale("${t[e]}",datum)`:Ke(e,n[0].encode)}Dt.countsRef=function(e,t,n){var i,a,r,l=this.counts||(this.counts={}),o=Wt(t);return null!=o&&(e=this.scope,i=l[o]),i?n&&n.field&&_t(e,i.agg.params,n):(r={groupby:e.fieldRef(t,"key"),pulse:y(this.output)},n&&n.field&&_t(e,r,n),a=e.add(E(r)),i=e.add(T({pulse:y(a)})),i={agg:a,ref:y(i)},null!=o&&(l[o]=i)),i.ref},Dt.tuplesRef=function(){return y(this.values)},Dt.extentRef=function(e,t){return Ct(e,this,"extent","extent",t,!1)},Dt.domainRef=function(e,t){return Ct(e,this,"domain","values",t,!1)},Dt.valuesRef=function(e,t,n){return Ct(e,this,"vals","values",t,n||!0)},Dt.lookupRef=function(e,t){return Ct(e,this,"lookup","tupleindex",t,!1)},Dt.indataRef=function(e,t){return Ct(e,this,"indata","tupleindex",t,!0,!0)};function Tt(e,n){var i,a,r=Je(e=t.isString(e)?{text:e}:e,n.config.title),l=e.encode||{},o=l.group||{},s=o.name||void 0,u=o.interactive,d=o.style,c=[];return i=y(n.add(T(null,[{}]))),c.push(function(e,t,n,i){var a={value:0},r=e.text,l={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return Ie(l,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Qe("text","title-text","group-title",null,i,l,n)}(e,r,function(e){const n=e.encode;return n&&n.title||t.extend({name:e.name,interactive:e.interactive,style:e.style},n)}(e),i)),e.subtitle&&c.push(function(e,t,n,i){var a={value:0},r=e.subtitle,l={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return Ie(l,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Qe("text","title-subtitle","group-subtitle",null,i,l,n)}(e,r,l.subtitle,i)),a=rt("title",d,s,i,u,function(e,t){var n={enter:{},update:{}};return Ie(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:et},angle:{signal:'item.orient==="left"?-90:item.orient==="right"?90:0'},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),Ne(n,t,Pe)}(r,o),c),e.zindex&&(a.zindex=e.zindex),Et(a,n)}function Bt(e,n){var i=[];e.transform&&e.transform.forEach((function(e){i.push(kt(e,n))})),e.on&&e.on.forEach((function(t){Lt(t,n,e.name)})),n.addDataPipeline(e.name,function(e,n,i){var a,r,l,o,s,u=[],d=null,c=!1,f=!1;e.values?O(e.values)||O(e.format)?(u.push(Mt(n,e)),u.push(d=qt())):u.push(d=qt({$ingest:e.values,$format:e.format})):e.url?O(e.url)||O(e.format)?(u.push(Mt(n,e)),u.push(d=qt())):u.push(d=qt({$request:e.url,$format:e.format})):e.source&&(d=a=t.array(e.source).map((function(e){return y(n.getData(e).output)})),u.push(null));for(r=0,l=i.length;r<l;++r)o=i[r],s=o.metadata,d||s.source||u.push(d=qt()),u.push(o),s.generates&&(f=!0),s.modifies&&!f&&(c=!0),s.source?d=o:s.changes&&(d=null);a&&(l=a.length-1,u[0]=ie({derive:c,pulse:l?a:a[0]}),(c||l)&&u.splice(1,0,qt()));d||u.push(qt());return u.push(le({})),u}(e,n,i))}function qt(e){var t=T({},e);return t.metadata={source:!0},t}function Mt(e,t){return X({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}function Ut(e,t){return{scale:e.scale,range:t}}function Ht(e,n,i,a,r){var l,o,s,u,d,c,f,g,p,m=Je(e,n),h=e.orient,y=e.gridScale,b=h===ze||h===Re?1:-1,v=function(e,n){if(1===n);else if(t.isObject(e)){for(var i=e=t.extend({},e);null!=i.mult;){if(!t.isObject(i.mult))return i.mult*=n,e;i=i.mult=t.extend({},i.mult)}i.mult=n}else e=n*(e||0);return e}(e.offset,b);return Ie(l={enter:o={opacity:Ve},update:u={opacity:De},exit:s={opacity:Ve}},{stroke:m("gridColor"),strokeDash:m("gridDash"),strokeDashOffset:m("gridDashOffset"),strokeOpacity:m("gridOpacity"),strokeWidth:m("gridWidth")}),d={scale:e.scale,field:we,band:r.band,extra:r.extra,offset:r.offset,round:m("tickRound")},h===Re||"bottom"===h?(c="x",f="y",p="height"):(c="y",f="x",p="width"),g=f+"2",u[c]=o[c]=s[c]=d,y?(u[f]=o[f]={scale:y,range:0,mult:b,offset:v},u[g]=o[g]={scale:y,range:1,mult:b,offset:v}):(u[f]=o[f]={value:0,offset:v},u[g]=o[g]={signal:p,mult:b,offset:v}),Qe("rule","axis-grid",null,we,a,l,i)}function It(e,t,n,i,a){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+a+")"}}function Nt(e,n){var i,a,r,l,o,s,u=function(e,n){var i=n.config,a=e.orient,r=a===Re||"bottom"===a?i.axisX:i.axisY,l=i["axis"+a[0].toUpperCase()+a.slice(1)],o="band"===n.scaleType(e.scale)&&i.axisBand;return r||l||o?t.extend({},i.axis,r,l,o):i.axis}(e,n),d=e.encode||{},c=d.axis||{},f=c.name||void 0,g=c.interactive,p=c.style,m=Je(e,u),h=function(e){let n,i,a=e("tickBand"),r=e("tickOffset");return a?a.signal?(n={signal:`(${a.signal})==='extent'?1:0.5`},i={signal:`(${a.signal})==='extent'?true:false`},t.isObject(r)||(r={signal:`(${a.signal})==='extent'?0:${r}`})):"extent"===a?(n=1,i=!0,r=0):(n=.5,i=!1):(n=e("bandPosition"),i=e("tickExtra")),{extra:i,band:n,offset:r}}(m);return i={orient:e.orient,ticks:!!m("ticks"),labels:!!m("labels"),grid:!!m("grid"),domain:!!m("domain"),title:null!=e.title,translate:m("translate")},a=y(n.add(T({},[i]))),c=Ne({update:{offset:Ue(m("offset")||0),position:Ue($(e.position,0)),titlePadding:Ue(m("titlePadding")),minExtent:Ue(m("minExtent")),maxExtent:Ue(m("maxExtent")),range:{signal:`abs(span(range("${e.scale}")))`}}},d.axis,Pe),r=y(n.add(A({scale:n.scaleRef(e.scale),extra:n.property(h.extra),count:n.objectProperty(e.tickCount),values:n.objectProperty(e.values),minstep:n.property(e.tickMinStep),formatType:n.property(e.formatType),formatSpecifier:n.property(e.format)}))),s=[],i.grid&&s.push(Ht(e,u,d.grid,r,h)),i.ticks&&(l=m("tickSize"),s.push(function(e,t,n,i,a,r){var l,o,s,u,d,c,f=Je(e,t),g=e.orient,p=g===ze||g===Re?-1:1;return Ie(l={enter:o={opacity:Ve},update:u={opacity:De},exit:s={opacity:Ve}},{stroke:f("tickColor"),strokeDash:f("tickDash"),strokeDashOffset:f("tickDashOffset"),strokeOpacity:f("tickOpacity"),strokeWidth:f("tickWidth")}),(d=Ue(a)).mult=p,c={scale:e.scale,field:we,band:r.band,extra:r.extra,offset:r.offset,round:f("tickRound")},g===Re||"bottom"===g?(u.y=o.y=Ve,u.y2=o.y2=d,u.x=o.x=s.x=c):(u.x=o.x=Ve,u.x2=o.x2=d,u.y=o.y=s.y=c),Qe("rule","axis-tick",null,we,i,l,n)}(e,u,d.ticks,r,l,h))),i.labels&&(l=i.ticks?l:0,s.push(function(e,t,n,i,a,r){var l,o,s,u,d,c,f,g,p,m,h=Je(e,t),y=e.orient,b=y===ze||y===Re?-1:1,v=y===Re||"bottom"===y,x=e.scale,k=R(h("labelFlush")),S=R(h("labelFlushOffset")),O=0===k||!!k,$=h("labelAlign"),z=h("labelBaseline");return(s=Ue(a)).mult=b,s.offset=Ue(h("labelPadding")||0),s.offset.mult=b,u={scale:x,field:we,band:.5,offset:tt(r.offset,h("labelOffset"))},v?(d=$||(O?It(x,k,'"left"','"right"','"center"'):"center"),c=z||(y===Re?"bottom":"top"),f=!$):(d=$||("right"===y?"left":"right"),c=z||(O?It(x,k,'"top"','"bottom"','"middle"'):"middle"),f=!z),f=f&&O&&S?It(x,k,"-("+S+")",S,0):null,Ie(l={enter:o={opacity:Ve,x:v?u:s,y:v?s:u},update:{opacity:De,text:{field:"label"},x:o.x,y:o.y},exit:{opacity:Ve,x:o.x,y:o.y}},{[v?"dx":"dy"]:f,align:d,baseline:c,angle:h("labelAngle"),fill:h("labelColor"),fillOpacity:h("labelOpacity"),font:h("labelFont"),fontSize:h("labelFontSize"),fontWeight:h("labelFontWeight"),fontStyle:h("labelFontStyle"),limit:h("labelLimit"),lineHeight:h("labelLineHeight")}),g=h("labelBound"),p=h("labelOverlap"),m=h("labelSeparation"),e=Qe("text","axis-label","guide-label",we,i,l,n),(p||g)&&(e.overlap={separation:m,method:p,order:"datum.index",bound:g?{scale:x,orient:y,tolerance:g}:null}),e}(e,u,d.labels,r,l,h))),i.domain&&s.push(function(e,t,n,i){var a,r,l,o,s,u,d=Je(e,t),c=e.orient;return Ie(a={enter:r={opacity:Ve},update:l={opacity:De},exit:{opacity:Ve}},{stroke:d("domainColor"),strokeDash:d("domainDash"),strokeDashOffset:d("domainDashOffset"),strokeWidth:d("domainWidth"),strokeOpacity:d("domainOpacity")}),c===Re||"bottom"===c?(o="x",u="y"):(o="y",u="x"),s=o+"2",r[u]=Ve,l[o]=r[o]=Ut(e,0),l[s]=r[s]=Ut(e,1),Qe("rule","axis-domain",null,null,i,a,n)}(e,u,d.domain,a)),i.title&&s.push(function(e,n,i,a){var r,l,o,s,u=Je(e,n),d=e.orient,c=d===ze||d===Re?-1:1,f=d===Re||"bottom"===d;return r={enter:l={opacity:Ve,anchor:Ue(u("titleAnchor")),align:{signal:et}},update:o=t.extend({},l,{opacity:De,text:Ue(e.title)}),exit:{opacity:Ve}},s={signal:`lerp(range("${e.scale}"), ${Ze(0,1,.5)})`},f?(o.x=s,l.angle={value:0},l.baseline={value:d===Re?"bottom":"top"}):(o.y=s,l.angle={value:90*c},l.baseline={value:"bottom"}),Ie(r,{angle:u("titleAngle"),baseline:u("titleBaseline"),fill:u("titleColor"),fillOpacity:u("titleOpacity"),font:u("titleFont"),fontSize:u("titleFontSize"),fontStyle:u("titleFontStyle"),fontWeight:u("titleFontWeight"),limit:u("titleLimit"),lineHeight:u("titleLineHeight")},{align:u("titleAlign")}),!He(r,"x",u("titleX"),"update")&&!f&&!Ye("x",i)&&(r.enter.auto={value:!0}),!He(r,"y",u("titleY"),"update")&&f&&!Ye("y",i)&&(r.enter.auto={value:!0}),Qe("text","axis-title","guide-title",null,a,r,i)}(e,u,d.title,a)),o=rt("axis",p,f,a,g,c,s),e.zindex&&(o.zindex=e.zindex),Et(o,n)}function Gt(e,n,i){var a=t.array(e.signals),l=t.array(e.scales);return i||a.forEach(e=>f(e,n)),t.array(e.projections).forEach(e=>function(e,t){var n=t.config.projection||{},i={};for(var a in e)"name"!==a&&(i[a]=$e(e[a],a,t));for(a in n)null==i[a]&&(i[a]=$e(n[a],a,t));t.addProjection(e.name,i)}(e,n)),l.forEach(e=>function(e,n){var i=e.type||"linear";r.isValidScaleType(i)||t.error("Unrecognized scale type: "+t.stringValue(i)),n.addScale(e.name,{type:i,domain:void 0})}(e,n)),t.array(e.data).forEach(e=>Bt(e,n)),l.forEach(e=>fe(e,n)),(i||a).forEach(e=>C(e,n)),t.array(e.axes).forEach(e=>Nt(e,n)),t.array(e.marks).forEach(e=>Et(e,n)),t.array(e.legends).forEach(e=>At(e,n)),e.title&&Tt(e.title,n),n.parseLambdas(),n}function Xt(e,n){var i,a,r,l,s,d,c=n.config;return s=y(n.root=n.add(h())),(d=function(e,n){const i=t=>$(e[t],n[t]),a=[Yt("background",i("background")),Yt("autosize",o(i("autosize"))),Yt("padding",u(i("padding"))),Yt("width",i("width")||0),Yt("height",i("height")||0)],r=a.reduce((e,t)=>(e[t.name]=t,e),{}),l={};return t.array(e.signals).forEach(e=>{t.hasOwnProperty(r,e.name)?e=t.extend(r[e.name],e):a.push(e),l[e.name]=e}),t.array(n.signals).forEach(e=>{t.hasOwnProperty(l,e.name)||t.hasOwnProperty(r,e.name)||a.push(e)}),a}(e,c)).forEach(e=>f(e,n)),n.description=e.description||c.description,n.eventConfig=c.events,n.legends=n.objectProperty(c.legend&&c.legend.layout),a=n.add(T()),r=Ne({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),r=n.add(M(Ge(r,"group","frame",e.style,n,{pulse:y(a)}))),l=n.add(se({layout:n.objectProperty(e.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:s,pulse:y(r)})),n.operators.pop(),n.pushState(y(r),y(l),null),Gt(e,n,d),n.operators.push(l),i=n.add(F({mark:s,pulse:y(l)})),i=n.add(ae({pulse:y(i)})),i=n.add(le({pulse:y(i)})),n.addData("root",new Vt(n,a,a,i)),n}function Yt(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function Qt(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.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function Jt(e){this.config=e.config,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}var Kt=Qt.prototype=Jt.prototype;function Zt(e){return(t.isArray(e)?en:tn)(e)}function en(e){for(var n,i="[",a=0,r=e.length;a<r;++a)n=e[a],i+=(a>0?",":"")+(t.isObject(n)?n.signal||Zt(n):t.stringValue(n));return i+"]"}function tn(e){var n,i,a="{",r=0;for(n in e)i=e[n],a+=(++r>1?",":"")+t.stringValue(n)+":"+(t.isObject(i)?i.signal||Zt(i):t.stringValue(i));return a+"}"}Kt.fork=function(){return new Jt(this)},Kt.isSubscope=function(){return this._subid>0},Kt.toRuntime=function(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},Kt.id=function(){return(this._subid?this._subid+":":0)+this._id++},Kt.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},Kt.proxy=function(e){var t=e instanceof p?y(e):e;return this.add(ne({value:t}))},Kt.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},Kt.addUpdate=function(e){return this.updates.push(e),e},Kt.finish=function(){var e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){var i;e&&((i=e.data||(e.data={}))[t]||(i[t]=[])).push(n)}for(e in this.data)for(var i in n((t=this.data[e]).input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values"),t.index)n(t.index[i],e,"index:"+i);return this},Kt.pushState=function(e,t,n){this._encode.push(y(this.add(le({pulse:e})))),this._parent.push(t),this._lookup.push(n?y(this.proxy(n)):null),this._markpath.push(-1)},Kt.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},Kt.parent=function(){return t.peek(this._parent)},Kt.encode=function(){return t.peek(this._encode)},Kt.lookup=function(){return t.peek(this._lookup)},Kt.markpath=function(){var e=this._markpath;return++e[e.length-1]},Kt.fieldRef=function(e,n){if(t.isString(e))return b(e,n);e.signal||t.error("Unsupported field reference: "+t.stringValue(e));var i,a=e.signal,r=this.field[a];return r||(i={name:this.signalRef(a)},n&&(i.as=n),this.field[a]=r=y(this.add(I(i)))),r},Kt.compareRef=function(e){function n(e){return S(e)?(a=!0,i.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(a=!0,i.exprRef(e.expr)):e}var i=this,a=!1,r=t.array(e.field).map(n),l=t.array(e.order).map(n);return a?y(this.add(B({fields:r,orders:l}))):x(r,l)},Kt.keyRef=function(e,n){var i=this.signals,a=!1;return e=t.array(e).map((function(e){return S(e)?(a=!0,y(i[e.signal])):e})),a?y(this.add(N({fields:e,flat:n}))):function(e,t){var n={$key:e};return t&&(n.$flat=!0),n}(e,n)},Kt.sortRef=function(e){if(!e)return e;var t=k(e.op,e.field),n=e.order||"ascending";return n.signal?y(this.add(B({fields:t,orders:this.signalRef(n.signal)}))):x(t,n)},Kt.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},Kt.hasOwnSignal=function(e){return t.hasOwnProperty(this.signals,e)},Kt.addSignal=function(e,n){this.hasOwnSignal(e)&&t.error("Duplicate signal name: "+t.stringValue(e));var i=n instanceof p?n:this.add(h(n));return this.signals[e]=i},Kt.getSignal=function(e){return this.signals[e]||t.error("Unrecognized signal name: "+t.stringValue(e)),this.signals[e]},Kt.signalRef=function(e){return this.signals[e]?y(this.signals[e]):(t.hasOwnProperty(this.lambdas,e)||(this.lambdas[e]=this.add(h(null))),y(this.lambdas[e]))},Kt.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,n=e.length;t<n;++t){var i=e[t],a=g(i,this),r=this.lambdas[i];r.params=a.$params,r.update=a.$expr}},Kt.property=function(e){return e&&e.signal?this.signalRef(e.signal):e},Kt.objectProperty=function(e){return e&&t.isObject(e)?this.signalRef(e.signal||Zt(e)):e},Kt.exprRef=function(e,t){var n={expr:g(e,this)};return t&&(n.expr.$name=t),y(this.add(U(n)))},Kt.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))},Kt.addScaleProj=function(e,n){t.hasOwnProperty(this.scales,e)&&t.error("Duplicate scale or projection name: "+t.stringValue(e)),this.scales[e]=this.add(n)},Kt.addScale=function(e,t){this.addScaleProj(e,re(t))},Kt.addProjection=function(e,t){this.addScaleProj(e,te(t))},Kt.getScale=function(e){return this.scales[e]||t.error("Unrecognized scale name: "+t.stringValue(e)),this.scales[e]},Kt.projectionRef=Kt.scaleRef=function(e){return y(this.getScale(e))},Kt.projectionType=Kt.scaleType=function(e){return this.getScale(e).params.type},Kt.addData=function(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.data[e]=n},Kt.getData=function(e){return this.data[e]||t.error("Undefined data set name: "+t.stringValue(e)),this.data[e]},Kt.addDataPipeline=function(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.addData(e,Vt.fromEntries(this,n))};function nn(){return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:"#4c78a8"},area:{fill:"#4c78a8"},image:null,line:{stroke:"#4c78a8",strokeWidth:2},path:{stroke:"#4c78a8"},rect:{fill:"#4c78a8"},rule:{stroke:"#000"},shape:{stroke:"#4c78a8"},symbol:{fill:"#4c78a8",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11},trail:{fill:"#4c78a8",size:2},style:{"guide-label":{fill:"#000",font:"sans-serif",fontSize:10},"guide-title":{fill:"#000",font:"sans-serif",fontSize:11,fontWeight:"bold"},"group-title":{fill:"#000",font:"sans-serif",fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:"#000",font:"sans-serif",fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:"#ddd"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:"#888",grid:!1,gridWidth:1,gridColor:"#ddd",labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:"#888",tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:"#888",titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}e.AxisDomainRole="axis-domain",e.AxisGridRole="axis-grid",e.AxisLabelRole="axis-label",e.AxisRole="axis",e.AxisTickRole="axis-tick",e.AxisTitleRole="axis-title",e.DataScope=Vt,e.FrameRole="frame",e.LegendEntryRole="legend-entry",e.LegendLabelRole="legend-label",e.LegendRole="legend",e.LegendSymbolRole="legend-symbol",e.LegendTitleRole="legend-title",e.MarkRole="mark",e.Scope=Qt,e.ScopeRole="scope",e.config=nn,e.parse=function(e,n){return t.isObject(e)||t.error("Input Vega specification must be an object."),Xt(e,new Qt(n=t.mergeConfig({description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:"#4c78a8"},area:{fill:"#4c78a8"},image:null,line:{stroke:"#4c78a8",strokeWidth:2},path:{stroke:"#4c78a8"},rect:{fill:"#4c78a8"},rule:{stroke:"#000"},shape:{stroke:"#4c78a8"},symbol:{fill:"#4c78a8",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11},trail:{fill:"#4c78a8",size:2},style:{"guide-label":{fill:"#000",font:"sans-serif",fontSize:10},"guide-title":{fill:"#000",font:"sans-serif",fontSize:11,fontWeight:"bold"},"group-title":{fill:"#000",font:"sans-serif",fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:"#000",font:"sans-serif",fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:"#ddd"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:"#888",grid:!1,gridWidth:1,gridColor:"#ddd",labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:"#888",tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:"#888",titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}},n,e.config))).toRuntime()},e.signal=f,e.signalUpdates=C,e.stream=z,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression"),require("vega-functions"),require("vega-event-selector"),require("vega-scale"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","vega-functions","vega-event-selector","vega-scale","vega-dataflow"],t):t((e=e||self).vega={},e.vega,e.vega,e.vega,e.vega,e.vega,e.vega)}(this,(function(e,t,i,n,a,r,o){"use strict";function l(e){return t.isObject(e)?e:{type:e||"pad"}}const s=e=>+e||0;function u(e){return t.isObject(e)?e.signal?e:{top:s(e.top),bottom:s(e.bottom),left:s(e.left),right:s(e.right)}:{top:i=s(e),bottom:i,left:i,right:i};var i}var d=["value","update","init","react","bind"];function c(e,i){t.error(e+' for "outer" push: '+t.stringValue(i))}function f(e,t){var i=e.name;if("outer"===e.push)t.signals[i]||c("No prior signal definition",i),d.forEach((function(t){void 0!==e[t]&&c("Invalid property ",t)}));else{var n=t.addSignal(i,e.value);!1===e.react&&(n.react=!1),e.bind&&t.addBinding(i,e.bind)}}function p(e,a,r){var o,l,s={};try{e=t.isString(e)?e:t.stringValue(e)+"",o=i.parse(e)}catch(i){t.error("Expression parse error: "+e)}return o.visit((function(e){if(e.type===i.CallExpression){var t=e.callee.name,r=n.codegenParams.visitors[t];r&&r(t,e.arguments,a,s)}})),(l=n.codeGenerator(o)).globals.forEach((function(e){var i=n.SignalPrefix+e;!t.hasOwnProperty(s,i)&&a.getSignal(e)&&(s[i]=a.signalRef(e))})),{$expr:r?r+"return("+l.code+");":l.code,$fields:l.fields,$params:s}}function g(e,t,i,n){this.id=-1,this.type=e,this.value=t,this.params=i,n&&(this.parent=n)}function m(e,t,i,n){return new g(e,t,i,n)}function h(e,t){return m("operator",e,t)}function y(e){var t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function b(e,t){return t?{$field:e,$name:t}:{$field:e}}var v=b("key");function x(e,t){return{$compare:e,$order:t}}function k(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function S(e){return e&&e.signal}function O(e){if(S(e))return!0;if(t.isObject(e))for(var i in e)if(O(e[i]))return!0;return!1}function $(e,t){return null!=e?e:t}function R(e){return e&&e.signal||e}function z(e,i){return(e.merge?w:e.stream?j:e.type?P:t.error("Invalid stream specification: "+t.stringValue(e)))(e,i)}function w(e,t){var i=V({merge:e.merge.map(e=>z(e,t))},e,t);return t.addStream(i).id}function j(e,t){var i=V({stream:z(e.stream,t)},e,t);return t.addStream(i).id}function P(e,t){var i,n,a;return"timer"===e.type?(i=t.event("timer",e.throttle),e={between:e.between,filter:e.filter}):i=t.event("scope"===(a=e.source)?"view":a||"view",e.type),n=V({stream:i},e,t),1===Object.keys(n).length?i:t.addStream(n).id}function V(e,i,n){var a,r,o,l,s=i.between;return s&&(2!==s.length&&t.error('Stream "between" parameter must have 2 entries: '+t.stringValue(i)),e.between=[z(s[0],n),z(s[1],n)]),s=i.filter?[].concat(i.filter):[],(i.marktype||i.markname||i.markrole)&&s.push((a=i.marktype,r=i.markname,o=i.markrole,(l="event.item")+(a&&"*"!==a?"&&"+l+".mark.marktype==='"+a+"'":"")+(o?"&&"+l+".mark.role==='"+o+"'":"")+(r?"&&"+l+".mark.name==='"+r+"'":""))),"scope"===i.source&&s.push("inScope(event.item)"),s.length&&(e.filter=p("("+s.join(")&&(")+")").$expr),null!=(s=i.throttle)&&(e.throttle=+s),null!=(s=i.debounce)&&(e.debounce=+s),i.consume&&(e.consume=!0),e}var D="var datum=event.item&&event.item.datum;";function W(e,i,n){var r=e.events,o=e.update,l=e.encode,s=[],u={target:n};r||t.error("Signal update missing events specification."),t.isString(r)&&(r=a.selector(r,i.isSubscope()?"scope":"view")),r=t.array(r).filter(e=>e.signal||e.scale?(s.push(e),0):1),s.length>1&&(s=[C(s)]),r.length&&s.push(r.length>1?{merge:r}:r[0]),null!=l&&(o&&t.error("Signal encode and update are mutually exclusive."),o="encode(item(),"+t.stringValue(l)+")"),u.update=t.isString(o)?p(o,i,D):null!=o.expr?p(o.expr,i,D):null!=o.value?o.value:null!=o.signal?{$expr:"_.value",$params:{value:i.signalRef(o.signal)}}:t.error("Invalid signal update specification."),e.force&&(u.options={force:!0}),s.forEach((function(e){i.addUpdate(t.extend(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):z(e,t)}}(e,i),u))}))}function C(e){return{signal:"["+e.map(e=>e.scale?'scale("'+e.scale+'")':e.signal)+"]"}}function _(e,i){var n=i.getSignal(e.name),a=e.update;e.init&&(a?t.error("Signals can not include both init and update expressions."):(a=e.init,n.initonly=!0)),a&&(a=p(a,i),n.update=a.$expr,n.params=a.$params),e.on&&e.on.forEach((function(e){W(e,i,n.id)}))}function E(e){return function(t,i,n){return m(e,i,t||void 0,n)}}var L=E("aggregate"),A=E("axisticks"),F=E("bound"),T=E("collect"),B=E("compare"),q=E("datajoin"),M=E("encode"),U=E("expression"),H=E("facet"),I=E("field"),N=E("key"),G=E("legendentries"),X=E("load"),Y=E("mark"),Q=E("multiextent"),J=E("multivalues"),K=E("overlap"),Z=E("params"),ee=E("prefacet"),te=E("projection"),ie=E("proxy"),ne=E("relay"),ae=E("render"),re=E("scale"),oe=E("sieve"),le=E("sortitems"),se=E("viewlayout"),ue=E("values"),de=0,ce={min:"min",max:"max",count:"sum"};function fe(e,i){var n,a,o=i.getScale(e.name).params;for(n in o.domain=he(e.domain,e,i),null!=e.range&&(o.range=function e(i,n,a){var o=i.range,l=n.config.range;if(o.signal)return n.signalRef(o.signal);if(t.isString(o)){if(l&&t.hasOwnProperty(l,o))return i=t.extend({},i,{range:l[o]}),e(i,n,a);"width"===o?o=[0,{signal:"width"}]:"height"===o?o=r.isDiscrete(i.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+t.stringValue(o))}else{if(o.scheme)return a.scheme=t.isArray(o.scheme)?ge(o.scheme,n):pe(o.scheme,n),o.extent&&(a.schemeExtent=ge(o.extent,n)),void(o.count&&(a.schemeCount=pe(o.count,n)));if(o.step)return void(a.rangeStep=pe(o.step,n));if(r.isDiscrete(i.type)&&!t.isArray(o))return he(o,i,n);t.isArray(o)||t.error("Unsupported range type: "+t.stringValue(o))}return o.map(e=>(t.isArray(e)?ge:pe)(e,n))}(e,i,o)),null!=e.interpolate&&function(e,t){t.interpolate=pe(e.type||e),null!=e.gamma&&(t.interpolateGamma=pe(e.gamma))}(e.interpolate,o),null!=e.nice&&(o.nice=(a=e.nice,t.isObject(a)?{interval:pe(a.interval),step:pe(a.step)}:pe(a))),null!=e.bins&&(o.bins=function(e,i){return e.signal||t.isArray(e)?ge(e,i):i.objectProperty(e)}(e.bins,i)),e)t.hasOwnProperty(o,n)||"name"===n||(o[n]=pe(e[n],i))}function pe(e,i){return t.isObject(e)?e.signal?i.signalRef(e.signal):t.error("Unsupported object: "+t.stringValue(e)):e}function ge(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>pe(e,t))}function me(e){t.error("Can not find data set: "+t.stringValue(e))}function he(e,i,n){if(e)return e.signal?n.signalRef(e.signal):(t.isArray(e)?ye:e.fields?ve:be)(e,i,n);null==i.domainMin&&null==i.domainMax||t.error("No scale domain defined for domainMin/domainMax to override.")}function ye(e,t,i){return e.map((function(e){return pe(e,i)}))}function be(e,t,i){var n=i.getData(e.data);return n||me(e.data),r.isDiscrete(t.type)?n.valuesRef(i,e.field,ke(e.sort,!1)):r.isQuantile(t.type)?n.domainRef(i,e.field):n.extentRef(i,e.field)}function ve(e,i,n){var a=e.data,o=e.fields.reduce((function(e,i){return i=t.isString(i)?{data:a,field:i}:t.isArray(i)||i.signal?function(e,i){var n="_:vega:_"+de++,a=T({});if(t.isArray(e))a.value={$ingest:e};else if(e.signal){var r="setdata("+t.stringValue(n)+","+e.signal+")";a.params.input=i.signalRef(r)}return i.addDataPipeline(n,[a,oe({})]),{data:n,field:"data"}}(i,n):i,e.push(i),e}),[]);return(r.isDiscrete(i.type)?xe:r.isQuantile(i.type)?Se:Oe)(e,n,o)}function xe(e,t,i){var n,a,r,o,l,s=ke(e.sort,!0);return n=i.map((function(e){var i=t.getData(e.data);return i||me(e.data),i.countsRef(t,e.field,s)})),a={groupby:v,pulse:n},s&&(r=s.op||"count",l=s.field?k(r,s.field):"count",a.ops=[ce[r]],a.fields=[t.fieldRef(l)],a.as=[l]),r=t.add(L(a)),o=t.add(T({pulse:y(r)})),l=t.add(ue({field:v,sort:t.sortRef(s),pulse:y(o)})),y(l)}function ke(e,i){return e&&(e.field||e.op?e.field||"count"===e.op?i&&e.field&&e.op&&!ce[e.op]&&t.error("Multiple domain scales can not be sorted using "+e.op):t.error("No field provided for sort aggregate op: "+e.op):t.isObject(e)?e.field="key":e={field:"key"}),e}function Se(e,t,i){var n=i.map((function(e){var i=t.getData(e.data);return i||me(e.data),i.domainRef(t,e.field)}));return y(t.add(J({values:n})))}function Oe(e,t,i){var n=i.map((function(e){var i=t.getData(e.data);return i||me(e.data),i.extentRef(t,e.field)}));return y(t.add(Q({extents:n})))}function $e(e,i,n){return t.isArray(e)?e.map((function(e){return $e(e,i,n)})):t.isObject(e)?e.signal?n.signalRef(e.signal):"fit"===i?e:t.error("Unsupported parameter object: "+t.stringValue(e)):e}const Re="top",ze="left",we="value",je=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],Pe={name:1,style:1,interactive:1},Ve={value:0},De={value:1};var We=t.toSet(["rule"]),Ce=t.toSet(["group","image","rect"]);function _e(e,i,n,a){var r=p(e,i);return r.$fields.forEach((function(e){a[e]=1})),t.extend(n,r.$params),r.$expr}function Ee(e,i,n,a){return function e(i,n,a,r){var o,l,s;if(i.signal)o="datum",s=_e(i.signal,n,a,r);else if(i.group||i.parent){for(l=Math.max(1,i.level||1),o="item";l-- >0;)o+=".mark.group";i.parent?(s=i.parent,o+=".datum"):s=i.group}else i.datum?(o="datum",s=i.datum):t.error("Invalid field reference: "+t.stringValue(i));i.signal||(t.isString(s)?(r[s]=1,s=t.splitAccessPath(s).map(t.stringValue).join("][")):s=e(s,n,a,r));return o+"["+s+"]"}(t.isObject(e)?e:{datum:e},i,n,a)}function Le(e,i,n,a){return t.isObject(e)?"("+Te(null,e,i,n,a)+")":e}function Ae(e,i,n,a,r){var o,l,s,u=Fe(e.scale,n,a,r);return null!=e.range?(l=u+".range()",i=0===(o=+e.range)?l+"[0]":"($="+l+","+(1===o?"$[$.length-1]":"$[0]+"+o+"*($[$.length-1]-$[0])")+")"):(void 0!==i&&(i=u+"("+i+")"),e.band&&(s=function(e,i){if(!t.isString(e))return-1;var n=i.scaleType(e);return"band"===n||"point"===n?1:0}(e.scale,n))&&(l=u+".bandwidth",o=e.band.signal?l+"()*"+Le(e.band,n,a,r):l+"()"+(1===(o=+e.band)?"":"*"+o),s<0&&(o="("+l+"?"+o+":0)"),i=(i?i+"+":"")+o,e.extra&&(i="(datum.extra?"+u+"(datum.extra.value):"+i+")")),null==i&&(i="0")),i}function Fe(e,i,a,r){var o;if(t.isString(e))o=n.ScalePrefix+e,t.hasOwnProperty(a,o)||(a[o]=i.scaleRef(e)),o=t.stringValue(o);else{for(o in i.scales)a[n.ScalePrefix+o]=i.scaleRef(o);o=t.stringValue(n.ScalePrefix)+"+"+(e.signal?"("+_e(e.signal,i,a,r)+")":Ee(e,i,a,r))}return"_["+o+"]"}function Te(e,i,n,a,r){if(null!=i.gradient)return function(e,i,n,a){return"this.gradient("+Fe(e.gradient,i,n,a)+","+t.stringValue(e.start)+","+t.stringValue(e.stop)+","+t.stringValue(e.count)+")"}(i,n,a,r);var o=i.signal?_e(i.signal,n,a,r):i.color?function(e,t,i,n){function a(e,a,r,o){return"this."+e+"("+[Te(null,a,t,i,n),Te(null,r,t,i,n),Te(null,o,t,i,n)].join(",")+").toString()"}return e.c?a("hcl",e.h,e.c,e.l):e.h||e.s?a("hsl",e.h,e.s,e.l):e.l||e.a?a("lab",e.l,e.a,e.b):e.r||e.g||e.b?a("rgb",e.r,e.g,e.b):null}(i.color,n,a,r):null!=i.field?Ee(i.field,n,a,r):void 0!==i.value?t.stringValue(i.value):void 0;return null!=i.scale&&(o=Ae(i,o,n,a,r)),void 0===o&&(o=null),null!=i.exponent&&(o="Math.pow("+o+","+Le(i.exponent,n,a,r)+")"),null!=i.mult&&(o+="*"+Le(i.mult,n,a,r)),null!=i.offset&&(o+="+"+Le(i.offset,n,a,r)),i.round&&(o="Math.round("+o+")"),o}function Be(e,i,n){const a=e+"["+t.stringValue(i)+"]";return`$=${n};if(${a}!==$)${a}=$,m=1;`}function qe(e,i,n,a,r){var o="";return i.forEach((function(e){var t=Te(0,e,n,a,r);o+=e.test?_e(e.test,n,a,r)+"?"+t+":":t})),":"===t.peek(o)&&(o+="null"),Be("o",e,o)}function Me(e,i,n,a){var r,o,l={},s="var o=item,datum=o.datum,m=0,$;";for(r in e)o=e[r],t.isArray(o)?s+=qe(r,o,a,n,l):s+=Be("o",r,Te(0,o,a,n,l));return s+=function(e,t){var i="";return We[t]||(e.x2&&(e.x?(Ce[t]&&(i+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),i+="o.width=o.x2-o.x;"):i+="o.x=o.x2-(o.width||0);"),e.xc&&(i+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(Ce[t]&&(i+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),i+="o.height=o.y2-o.y;"):i+="o.y=o.y2-(o.height||0);"),e.yc&&(i+="o.y=o.yc-(o.height||0)/2;")),i}(e,i),{$expr:s+="return m;",$fields:Object.keys(l),$output:Object.keys(e)}}function Ue(e){return t.isObject(e)&&!t.isArray(e)?t.extend({},e):{value:e}}function He(e,i,n,a){return null!=n?(t.isObject(n)&&!t.isArray(n)?e.update[i]=n:e[a||"enter"][i]={value:n},1):0}function Ie(e,t,i){for(let i in t)He(e,i,t[i]);for(let t in i)He(e,t,i[t],"update")}function Ne(e,i,n){for(var a in i)n&&t.hasOwnProperty(n,a)||(e[a]=t.extend(e[a]||{},i[a]));return e}function Ge(e,i,n,a,r,o){var l,s;for(s in(o=o||{}).encoders={$encode:l={}},e=function(e,i,n,a,r){var o,l,s,u={},d={};l="lineBreak","text"!==i||null==r[l]||Ye(l,e)||Xe(u,l,r[l]);("legend"==n||String(n).startsWith("axis"))&&(n=null);for(l in s="frame"===n?r.group:"mark"===n?t.extend({},r.mark,r[i]):null)Ye(l,e)||("fill"===l||"stroke"===l)&&(Ye("fill",e)||Ye("stroke",e))||Xe(u,l,s[l]);for(l in t.array(a).forEach((function(t){var i=r.style&&r.style[t];for(var n in i)Ye(n,e)||Xe(u,n,i[n])})),e=t.extend({},e),u)(s=u[l]).signal?(o=o||{})[l]=s:d[l]=s;e.enter=t.extend(d,e.enter),o&&(e.update=t.extend(o,e.update));return e}(e,i,n,a,r.config))l[s]=Me(e[s],i,o,r);return o}function Xe(e,t,i){e[t]=i&&i.signal?{signal:i.signal}:{value:i}}function Ye(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function Qe(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=Ne(e.encode,t,Pe)):e.interactive=!1,e}function Je(e,t){const i=(i,n)=>$(e[i],$(t[i],n));return i.isVertical=i=>"vertical"===$(e.direction,t.direction||(i?t.symbolDirection:t.gradientDirection)),i.gradientLength=()=>$(e.gradientLength,t.gradientLength||t.gradientWidth),i.gradientThickness=()=>$(e.gradientThickness,t.gradientThickness||t.gradientHeight),i.entryColumns=()=>$(e.columns,$(t.columns,+i.isVertical(!0))),i}function Ke(e,t){var i=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return i&&i.signal?i:i?i.value:null}function Ze(e,t,i){return`item.anchor === "start" ? ${e} : item.anchor === "end" ? ${t} : ${i}`}const et=Ze(t.stringValue(ze),t.stringValue("right"),t.stringValue("center"));function tt(e,i){return i?e?t.isObject(e)?{...e,offset:tt(e.offset,i)}:{value:e,offset:i}:i:e}function it(e,i,n,a){var r,o,l,s,u,d,c=Je(e,n),f=c.isVertical(),p=c.gradientThickness(),g=c.gradientLength();return f?(l=[0,1],s=[0,0],u=p,d=g):(l=[0,0],s=[1,0],u=g,d=p),Ie(r={enter:o={opacity:Ve,x:Ve,y:Ve,width:Ue(u),height:Ue(d)},update:t.extend({},o,{opacity:De,fill:{gradient:i,start:l,stop:s}}),exit:{opacity:Ve}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),Qe({type:"rect",role:"legend-gradient",encode:r},a)}function nt(e,i,n,a,r){var o,l,s,u,d,c,f=Je(e,n),p=f.isVertical(),g=f.gradientThickness(),m=f.gradientLength(),h="";return p?(s="y",d="y2",u="x",c="width",h="1-"):(s="x",d="x2",u="y",c="height"),(l={opacity:Ve,fill:{scale:i,field:we}})[s]={signal:h+"datum.perc",mult:m},l[u]=Ve,l[d]={signal:h+"datum.perc2",mult:m},l[c]=Ue(g),Ie(o={enter:l,update:t.extend({},l,{opacity:De}),exit:{opacity:Ve}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),Qe({type:"rect",role:"legend-band",key:we,from:r,encode:o},a)}function at(e,t,i,n){var a,r,o,l,s,u=Je(e,t),d=u.isVertical(),c=Ue(u.gradientThickness()),f=u.gradientLength(),p=u("labelOverlap"),g="";return Ie(a={enter:r={opacity:Ve},update:o={opacity:De,text:{field:"label"}},exit:{opacity:Ve}},{fill:u("labelColor"),fillOpacity:u("labelOpacity"),font:u("labelFont"),fontSize:u("labelFontSize"),fontStyle:u("labelFontStyle"),fontWeight:u("labelFontWeight"),limit:$(e.labelLimit,t.gradientLabelLimit)}),d?(r.align={value:"left"},r.baseline=o.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},l="y",s="x",g="1-"):(r.align=o.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},r.baseline={value:"top"},l="x",s="y"),r[l]=o[l]={signal:g+"datum.perc",mult:f},r[s]=o[s]=c,c.offset=$(e.labelOffset,t.gradientLabelOffset)||0,p=p?{separation:u("labelSeparation"),method:p,order:"datum.index"}:void 0,Qe({type:"text",role:"legend-label",style:"guide-label",key:we,from:n,encode:a,overlap:p},i)}function rt(e){return e.type="group",e.interactive=e.interactive||!1,e}function ot(e,t,i,n,a){var r,o,l,s,u,d,c,f=Je(e,t),p=i.entries,g=!(!p||!p.interactive),m=p?p.name:void 0,h=f("clipHeight"),y=f("symbolOffset"),b={data:"value"},v={},x=`(${a}) ? datum.offset : datum.size`,k=h?Ue(h):{field:"size"},S="datum.index",O=`max(1, ${a})`;k.mult=.5,v={enter:r={opacity:Ve,x:{signal:x,mult:.5,offset:y},y:k},update:o={opacity:De,x:r.x,y:r.y},exit:{opacity:Ve}};var $=null,R=null;return e.fill||($=t.symbolBaseFillColor,R=t.symbolBaseStrokeColor),Ie(v,{fill:f("symbolFillColor",$),shape:f("symbolType"),size:f("symbolSize"),stroke:f("symbolStrokeColor",R),strokeDash:f("symbolDash"),strokeDashOffset:f("symbolDashOffset"),strokeWidth:f("symbolStrokeWidth")},{opacity:f("symbolOpacity")}),je.forEach((function(t){e[t]&&(o[t]=r[t]={scale:e[t],field:we})})),s=Qe({type:"symbol",role:"legend-symbol",key:we,from:b,clip:!!h||void 0,encode:v},i.symbols),(l=Ue(y)).offset=f("labelOffset"),Ie(v={enter:r={opacity:Ve,x:{signal:x,offset:l},y:k},update:o={opacity:De,text:{field:"label"},x:r.x,y:r.y},exit:{opacity:Ve}},{align:f("labelAlign"),baseline:f("labelBaseline"),fill:f("labelColor"),fillOpacity:f("labelOpacity"),font:f("labelFont"),fontSize:f("labelFontSize"),fontStyle:f("labelFontStyle"),fontWeight:f("labelFontWeight"),limit:f("labelLimit")}),u=Qe({type:"text",role:"legend-label",style:"guide-label",key:we,from:b,encode:v},i.labels),v={enter:{noBound:{value:!h},width:Ve,height:h?Ue(h):Ve,opacity:Ve},exit:{opacity:Ve},update:o={opacity:De,row:{signal:null},column:{signal:null}}},f.isVertical(!0)?(d=`ceil(item.mark.items.length / ${O})`,o.row.signal=`${S}%${d}`,o.column.signal=`floor(${S} / ${d})`,c={field:["row",S]}):(o.row.signal=`floor(${S} / ${O})`,o.column.signal=`${S} % ${O}`,c={field:S}),o.column.signal=`(${a})?${o.column.signal}:${S}`,rt({role:"scope",from:n={facet:{data:n,name:"value",groupby:"index"}},encode:Ne(v,p,Pe),marks:[s,u],name:m,interactive:g,sort:c})}const lt='item.orient === "left"',st='item.orient === "right"',ut=`(${lt} || ${st})`,dt="datum.vgrad && "+ut,ct=Ze('"top"','"bottom"','"middle"'),ft=`datum.vgrad && ${st} ? (${Ze('"right"','"left"','"center"')}) : (${ut} && !(datum.vgrad && ${lt})) ? "left" : ${et}`,pt=`item._anchor || (${ut} ? "middle" : "start")`,gt=`${dt} ? (${lt} ? -90 : 90) : 0`,mt=`${ut} ? (datum.vgrad ? (${st} ? "bottom" : "top") : ${ct}) : "top"`;function ht(e,i){var n;return t.isObject(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+yt(e.path)+")":e.sphere&&(n="geoShape("+yt(e.sphere)+', {type: "Sphere"})')),n?i.signalRef(n):!!e}function yt(e){return t.isObject(e)&&e.signal?e.signal:t.stringValue(e)}function bt(e){var t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?"group"===e.type?"scope":t||"mark":t}function vt(e){return{marktype:e.type,name:e.name||void 0,role:e.role||bt(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function xt(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function kt(e,i){var n=o.definition(e.type);n||t.error("Unrecognized transform type: "+t.stringValue(e.type));var a=m(n.type.toLowerCase(),null,St(n,e,i));return e.signal&&i.addSignal(e.signal,i.proxy(a)),a.metadata=n.metadata||{},a}function St(e,t,i){var n,a,r,o={};for(a=0,r=e.params.length;a<r;++a)o[(n=e.params[a]).name]=Ot(n,t,i);return o}function Ot(e,i,n){var a=e.type,r=i[e.name];return"index"===a?function(e,i,n){t.isString(i.from)||t.error('Lookup "from" parameter must be a string literal.');return n.getData(i.from).lookupRef(n,i.key)}(0,i,n):void 0!==r?"param"===a?function(e,i,n){var a=i[e.name];return e.array?(t.isArray(a)||t.error("Expected an array of sub-parameters. Instead: "+t.stringValue(a)),a.map((function(t){return Rt(e,t,n)}))):Rt(e,a,n)}(e,i,n):"projection"===a?n.projectionRef(i[e.name]):e.array&&!S(r)?r.map((function(t){return $t(e,t,n)})):$t(e,r,n):void(e.required&&t.error("Missing required "+t.stringValue(i.type)+" parameter: "+t.stringValue(e.name)))}function $t(e,i,n){var a=e.type;if(S(i))return zt(a)?t.error("Expression references can not be signals."):wt(a)?n.fieldRef(i):jt(a)?n.compareRef(i):n.signalRef(i.signal);var r,o=e.expr||wt(a);return o&&((r=i)&&r.expr)?n.exprRef(i.expr,i.as):o&&function(e){return e&&e.field}(i)?b(i.field,i.as):zt(a)?p(i,n):function(e){return"data"===e}(a)?y(n.getData(i).values):wt(a)?b(i):jt(a)?n.compareRef(i):i}function Rt(e,i,n){var a,r,o,l,s;for(l=0,s=e.params.length;l<s;++l){for(o in(r=e.params[l]).key)if(r.key[o]!==i[o]){r=null;break}if(r)break}return r||t.error("Unsupported parameter: "+t.stringValue(i)),a=t.extend(St(r,i,n),r.key),y(n.add(Z(a)))}function zt(e){return"expr"===e}function wt(e){return"field"===e}function jt(e){return"compare"===e}function Pt(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:y(t.getData(e.data).output)}function Vt(e,t,i,n,a){this.scope=e,this.input=t,this.output=i,this.values=n,this.aggregate=a,this.index={}}Vt.fromEntries=function(e,t){var i=t.length,n=1,a=t[0],r=t[i-1],o=t[i-2],l=null;for(a&&"load"===a.type&&(a=t[1]),e.add(t[0]);n<i;++n)t[n].params.pulse=y(t[n-1]),e.add(t[n]),"aggregate"===t[n].type&&(l=t[n]);return new Vt(e,a,o,r,l)};var Dt=Vt.prototype;function Wt(e){return t.isString(e)?e:null}function Ct(e,t,i){var n,a=k(i.op,i.field);if(t.ops){for(var r=0,o=t.as.length;r<o;++r)if(t.as[r]===a)return}else t.ops=["count"],t.fields=[null],t.as=["count"];i.op&&(t.ops.push((n=i.op.signal)?e.signalRef(n):i.op),t.fields.push(e.fieldRef(i.field)),t.as.push(a))}function _t(e,i,n,a,r,o,l){var s,u,d=i[n]||(i[n]={}),c=function(e){return t.isObject(e)?("descending"===e.order?"-":"+")+k(e.op,e.field):""}(o),f=Wt(r);if(null!=f&&(e=i.scope,s=d[f+=c?"|"+c:""]),!s){var p=o?{field:v,pulse:i.countsRef(e,r,o)}:{field:e.fieldRef(r),pulse:y(i.output)};c&&(p.sort=e.sortRef(o)),u=e.add(m(a,void 0,p)),l&&(i.index[r]=u),s=y(u),null!=f&&(d[f]=s)}return s}function Et(e,t,i){var n,a=e.remove,r=e.insert,o=e.toggle,l=e.modify,s=e.values,u=t.add(h());n=p("if("+e.trigger+',modify("'+i+'",'+[r,a,o,l,s].map((function(e){return null==e?"null":e})).join(",")+"),0)",t),u.update=n.$expr,u.params=n.$params}function Lt(e,i){var n,a,r,o,l,s,u,d,c,f,p,g,m,h,v=bt(e),x="group"===e.type,k=e.from&&e.from.facet,O=e.layout||"scope"===v||"frame"===v,$="mark"===v||O||k,R=e.overlap;r=function(e,i,n){var a,r,o,l,s;return e?(a=e.facet)&&(i||t.error("Only group marks can be faceted."),null!=a.field?l=s=Pt(a,n):(e.data?s=y(n.getData(e.data).aggregate):((o=kt(t.extend({type:"aggregate",groupby:t.array(a.groupby)},a.aggregate),n)).params.key=n.keyRef(a.groupby),o.params.pulse=Pt(a,n),l=s=y(n.add(o))),r=n.keyRef(a.groupby,!0))):l=y(n.add(T(null,[{}]))),l||(l=Pt(e,n)),{key:r,pulse:l,parent:s}}(e.from,x,i),f=y(a=i.add(q({key:r.key||(e.key?b(e.key):void 0),pulse:r.pulse,clean:!x}))),a=o=i.add(T({pulse:f})),a=i.add(Y({markdef:vt(e),interactive:xt(e.interactive,i),clip:ht(e.clip,i),context:{$context:!0},groups:i.lookup(),parent:i.signals.parent?i.signalRef("parent"):null,index:i.markpath(),pulse:y(a)})),p=y(a),(a=l=i.add(M(Ge(e.encode,e.type,v,e.style,i,{mod:!1,pulse:p})))).params.parent=i.encode(),e.transform&&e.transform.forEach((function(e){const n=kt(e,i),r=n.metadata;(r.generates||r.changes)&&t.error("Mark transforms should not generate new data."),r.nomod||(l.params.mod=!0),n.params.pulse=y(a),i.add(a=n)})),e.sort&&(a=i.add(le({sort:i.compareRef(e.sort),pulse:y(a)}))),g=y(a),(k||O)&&(m=y(O=i.add(se({layout:i.objectProperty(e.layout),legends:i.legends,mark:p,pulse:g})))),h=y(s=i.add(F({mark:p,pulse:m||g}))),x&&($&&((n=i.operators).pop(),O&&n.pop()),i.pushState(g,m||h,f),k?function(e,i,n){var a,r,o,l,s=e.from.facet,u=s.name,d=Pt(s,i);s.name||t.error("Facet must have a name: "+t.stringValue(s)),s.data||t.error("Facet must reference a data set: "+t.stringValue(s)),s.field?l=i.add(ee({field:i.fieldRef(s.field),pulse:d})):s.groupby?l=i.add(H({key:i.keyRef(s.groupby),group:y(i.proxy(n.parent)),pulse:d})):t.error("Facet must specify groupby or field: "+t.stringValue(s)),r=(a=i.fork()).add(T()),o=a.add(oe({pulse:y(r)})),a.addData(u,new Vt(a,r,r,o)),a.addSignal("parent",null),l.params.subflow={$subflow:Xt(e,a).toRuntime()}}(e,i,r):$?function(e,t,i){var n=t.add(ee({pulse:i.pulse})),a=t.fork();a.add(oe()),a.addSignal("parent",null),n.params.subflow={$subflow:Xt(e,a).toRuntime()}}(e,i,r):Xt(e,i),i.popState(),$&&(O&&n.push(O),n.push(s))),R&&(h=function(e,t,i){var n,a=e.method,r=e.bound,o=e.separation,l={separation:S(o)?i.signalRef(o.signal):o,method:S(a)?i.signalRef(a.signal):a,pulse:t};e.order&&(l.sort=i.compareRef({field:e.order}));r&&(n=r.tolerance,l.boundTolerance=S(n)?i.signalRef(n.signal):+n,l.boundScale=i.scaleRef(r.scale),l.boundOrient=r.orient);return y(i.add(K(l)))}(R,h,i)),u=i.add(ae({pulse:h})),d=i.add(oe({pulse:y(u)},void 0,i.parent())),null!=e.name&&(c=e.name,i.addData(c,new Vt(i,o,u,d)),e.on&&e.on.forEach((function(e){(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),Et(e,i,c)})))}function At(e,i){var n,a,o,l,s,u,d,c,f=i.config.legend,g=e.encode||{},m=g.legend||{},h=m.name||void 0,b=m.interactive,v=m.style,x=Je(e,f),k={},S=0;return je.forEach(t=>e[t]?(k[t]=e[t],S=S||e[t]):0),S||t.error("Missing valid scale for legend."),s=function(e,t){var i=e.type||"symbol";e.type||1!==function(e){return je.reduce((function(t,i){return t+(e[i]?1:0)}),0)}(e)||!e.fill&&!e.stroke||(i=r.isContinuous(t)?"gradient":r.isDiscretizing(t)?"discrete":"symbol");return"gradient"!==i?i:r.isDiscretizing(t)?"discrete":"gradient"}(e,i.scaleType(S)),u={title:null!=e.title,scales:k,type:s,vgrad:"symbol"!==s&&x.isVertical()},d=y(i.add(T(null,[u]))),m=Ne(function(e,t,i){var n={enter:{},update:{}};return Ie(n,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:i.strokeWidth,strokeDash:i.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),n}(x,e,f),m,Pe),n={enter:{x:{value:0},y:{value:0}}},c=y(i.add(G(o={type:s,scale:i.scaleRef(S),count:i.objectProperty(x("tickCount")),limit:i.property(x("symbolLimit")),values:i.objectProperty(e.values),minstep:i.property(e.tickMinStep),formatType:i.property(e.formatType),formatSpecifier:i.property(e.format)}))),"gradient"===s?(l=[it(e,S,f,g.gradient),at(e,f,g.labels,c)],o.count=o.count||i.signalRef(`max(2,2*floor((${R(x.gradientLength())})/100))`)):"discrete"===s?l=[nt(e,S,f,g.gradient,c),at(e,f,g.labels,c)]:(a=function(e,t){const i=Je(e,t);return{align:i("gridAlign"),columns:i.entryColumns(),center:{row:!0,column:!1},padding:{row:i("rowPadding"),column:i("columnPadding")}}}(e,f),l=[ot(e,f,g,c,R(a.columns))],o.size=function(e,t,i){var n=R(Ft("size",e,i)),a=R(Ft("strokeWidth",e,i)),r=R(function(e,t,i){return Ke("fontSize",e)||function(e,t,i){var n=t.config.style[i];return n&&n[e]}("fontSize",t,i)}(i[1].encode,t,"guide-label"));return p(`max(ceil(sqrt(${n})+${a}),${r})`,t)}(e,i,l[0].marks)),l=[rt({role:"legend-entry",from:d,encode:n,marks:l,layout:a,interactive:b})],u.title&&l.push(function(e,t,i,n){var a,r=Je(e,t);return Ie(a={enter:{opacity:Ve},update:{opacity:De,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:Ve}},{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:pt},angle:{signal:gt},align:{signal:ft},baseline:{signal:mt},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),Qe({type:"text",role:"legend-title",style:"guide-title",from:n,encode:a},i)}(e,f,g.title,d)),Lt(rt({role:"legend",from:d,encode:m,marks:l,aria:x("aria"),description:x("description"),zindex:x("zindex"),name:h,interactive:b,style:v}),i)}function Ft(e,t,i){return t[e]?`scale("${t[e]}",datum)`:Ke(e,i[0].encode)}Dt.countsRef=function(e,t,i){var n,a,r,o=this.counts||(this.counts={}),l=Wt(t);return null!=l&&(e=this.scope,n=o[l]),n?i&&i.field&&Ct(e,n.agg.params,i):(r={groupby:e.fieldRef(t,"key"),pulse:y(this.output)},i&&i.field&&Ct(e,r,i),a=e.add(L(r)),n=e.add(T({pulse:y(a)})),n={agg:a,ref:y(n)},null!=l&&(o[l]=n)),n.ref},Dt.tuplesRef=function(){return y(this.values)},Dt.extentRef=function(e,t){return _t(e,this,"extent","extent",t,!1)},Dt.domainRef=function(e,t){return _t(e,this,"domain","values",t,!1)},Dt.valuesRef=function(e,t,i){return _t(e,this,"vals","values",t,i||!0)},Dt.lookupRef=function(e,t){return _t(e,this,"lookup","tupleindex",t,!1)},Dt.indataRef=function(e,t){return _t(e,this,"indata","tupleindex",t,!0,!0)};function Tt(e,i){var n,a,r=Je(e=t.isString(e)?{text:e}:e,i.config.title),o=e.encode||{},l=o.group||{},s=l.name||void 0,u=l.interactive,d=l.style,c=[];return n={},a=y(i.add(T(null,[n]))),c.push(function(e,t,i,n){var a={value:0},r=e.text,o={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return Ie(o,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Qe({type:"text",role:"title-text",style:"group-title",from:n,encode:o},i)}(e,r,function(e){const i=e.encode;return i&&i.title||t.extend({name:e.name,interactive:e.interactive,style:e.style},i)}(e),a)),e.subtitle&&c.push(function(e,t,i,n){var a={value:0},r=e.subtitle,o={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return Ie(o,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Qe({type:"text",role:"title-subtitle",style:"group-subtitle",from:n,encode:o},i)}(e,r,o.subtitle,a)),Lt(rt({role:"title",from:a,encode:Bt(r,l),marks:c,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:s,interactive:u,style:d}),i)}function Bt(e,t){var i={enter:{},update:{}};return Ie(i,{orient:e("orient"),anchor:e("anchor"),align:{signal:et},angle:{signal:'item.orient==="left"?-90:item.orient==="right"?90:0'},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),Ne(i,t,Pe)}function qt(e,i){var n=[];e.transform&&e.transform.forEach((function(e){n.push(kt(e,i))})),e.on&&e.on.forEach((function(t){Et(t,i,e.name)})),i.addDataPipeline(e.name,function(e,i,n){var a,r,o,l,s,u=[],d=null,c=!1,f=!1;e.values?O(e.values)||O(e.format)?(u.push(Ut(i,e)),u.push(d=Mt())):u.push(d=Mt({$ingest:e.values,$format:e.format})):e.url?O(e.url)||O(e.format)?(u.push(Ut(i,e)),u.push(d=Mt())):u.push(d=Mt({$request:e.url,$format:e.format})):e.source&&(d=a=t.array(e.source).map((function(e){return y(i.getData(e).output)})),u.push(null));for(r=0,o=n.length;r<o;++r)l=n[r],s=l.metadata,d||s.source||u.push(d=Mt()),u.push(l),s.generates&&(f=!0),s.modifies&&!f&&(c=!0),s.source?d=l:s.changes&&(d=null);a&&(o=a.length-1,u[0]=ne({derive:c,pulse:o?a:a[0]}),(c||o)&&u.splice(1,0,Mt()));d||u.push(Mt());return u.push(oe({})),u}(e,i,n))}function Mt(e){var t=T({},e);return t.metadata={source:!0},t}function Ut(e,t){return X({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}function Ht(e,t){return{scale:e.scale,range:t}}function It(e,i,n,a,r){var o,l,s,u,d,c,f,p,g,m=Je(e,i),h=e.orient,y=e.gridScale,b=h===ze||h===Re?1:-1,v=function(e,i){if(1===i);else if(t.isObject(e)){for(var n=e=t.extend({},e);null!=n.mult;){if(!t.isObject(n.mult))return n.mult*=i,e;n=n.mult=t.extend({},n.mult)}n.mult=i}else e=i*(e||0);return e}(e.offset,b);return Ie(o={enter:l={opacity:Ve},update:u={opacity:De},exit:s={opacity:Ve}},{stroke:m("gridColor"),strokeCap:m("gridCap"),strokeDash:m("gridDash"),strokeDashOffset:m("gridDashOffset"),strokeOpacity:m("gridOpacity"),strokeWidth:m("gridWidth")}),d={scale:e.scale,field:we,band:r.band,extra:r.extra,offset:r.offset,round:m("tickRound")},h===Re||"bottom"===h?(c="x",f="y",g="height"):(c="y",f="x",g="width"),p=f+"2",u[c]=l[c]=s[c]=d,y?(u[f]=l[f]={scale:y,range:0,mult:b,offset:v},u[p]=l[p]={scale:y,range:1,mult:b,offset:v}):(u[f]=l[f]={value:0,offset:v},u[p]=l[p]={signal:g,mult:b,offset:v}),Qe({type:"rule",role:"axis-grid",key:we,from:a,encode:o},n)}function Nt(e,t,i,n,a){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+i+","+n+","+a+")"}}function Gt(e,i){var n,a,r,o,l,s=function(e,i){var n=i.config,a=e.orient,r=a===Re||"bottom"===a?n.axisX:n.axisY,o=n["axis"+a[0].toUpperCase()+a.slice(1)],l="band"===i.scaleType(e.scale)&&n.axisBand;return r||o||l?t.extend({},n.axis,r,o,l):n.axis}(e,i),u=e.encode||{},d=u.axis||{},c=d.name||void 0,f=d.interactive,p=d.style,g=Je(e,s),m=function(e){let i,n,a=e("tickBand"),r=e("tickOffset");return a?a.signal?(i={signal:`(${a.signal})==='extent'?1:0.5`},n={signal:`(${a.signal})==='extent'?true:false`},t.isObject(r)||(r={signal:`(${a.signal})==='extent'?0:${r}`})):"extent"===a?(i=1,n=!0,r=0):(i=.5,n=!1):(i=e("bandPosition"),n=e("tickExtra")),{extra:n,band:i,offset:r}}(g);return n={orient:e.orient,scale:e.scale,ticks:!!g("ticks"),labels:!!g("labels"),grid:!!g("grid"),domain:!!g("domain"),title:null!=e.title,translate:g("translate")},a=y(i.add(T({},[n]))),d=Ne(function(e,t){var i={enter:{},update:{}};return Ie(i,{offset:e("offset")||0,position:$(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},format:t.format,formatType:t.formatType}),i}(g,e),d,Pe),r=y(i.add(A({scale:i.scaleRef(e.scale),extra:i.property(m.extra),count:i.objectProperty(e.tickCount),values:i.objectProperty(e.values),minstep:i.property(e.tickMinStep),formatType:i.property(e.formatType),formatSpecifier:i.property(e.format)}))),l=[],n.grid&&l.push(It(e,s,u.grid,r,m)),n.ticks&&(o=g("tickSize"),l.push(function(e,t,i,n,a,r){var o,l,s,u,d,c,f=Je(e,t),p=e.orient,g=p===ze||p===Re?-1:1;return Ie(o={enter:l={opacity:Ve},update:u={opacity:De},exit:s={opacity:Ve}},{stroke:f("tickColor"),strokeCap:f("tickCap"),strokeDash:f("tickDash"),strokeDashOffset:f("tickDashOffset"),strokeOpacity:f("tickOpacity"),strokeWidth:f("tickWidth")}),(d=Ue(a)).mult=g,c={scale:e.scale,field:we,band:r.band,extra:r.extra,offset:r.offset,round:f("tickRound")},p===Re||"bottom"===p?(u.y=l.y=Ve,u.y2=l.y2=d,u.x=l.x=s.x=c):(u.x=l.x=Ve,u.x2=l.x2=d,u.y=l.y=s.y=c),Qe({type:"rule",role:"axis-tick",key:we,from:n,encode:o},i)}(e,s,u.ticks,r,o,m))),n.labels&&(o=n.ticks?o:0,l.push(function(e,t,i,n,a,r){var o,l,s,u,d,c,f,p,g,m=Je(e,t),h=e.orient,y=h===ze||h===Re?-1:1,b=h===Re||"bottom"===h,v=e.scale,x=R(m("labelFlush")),k=R(m("labelFlushOffset")),S=0===x||!!x,O=m("labelAlign"),$=m("labelBaseline");return(s=Ue(a)).mult=y,s.offset=Ue(m("labelPadding")||0),s.offset.mult=y,u={scale:v,field:we,band:.5,offset:tt(r.offset,m("labelOffset"))},b?(d=O||(S?Nt(v,x,'"left"','"right"','"center"'):"center"),c=$||(h===Re?"bottom":"top"),f=!O):(d=O||("right"===h?"left":"right"),c=$||(S?Nt(v,x,'"top"','"bottom"','"middle"'):"middle"),f=!$),f=f&&S&&k?Nt(v,x,"-("+k+")",k,0):null,Ie(o={enter:l={opacity:Ve,x:b?u:s,y:b?s:u},update:{opacity:De,text:{field:"label"},x:l.x,y:l.y},exit:{opacity:Ve,x:l.x,y:l.y}},{[b?"dx":"dy"]:f,align:d,baseline:c,angle:m("labelAngle"),fill:m("labelColor"),fillOpacity:m("labelOpacity"),font:m("labelFont"),fontSize:m("labelFontSize"),fontWeight:m("labelFontWeight"),fontStyle:m("labelFontStyle"),limit:m("labelLimit"),lineHeight:m("labelLineHeight")}),p=m("labelBound"),g=(g=m("labelOverlap"))||p?{separation:m("labelSeparation"),method:g,order:"datum.index",bound:p?{scale:v,orient:h,tolerance:p}:null}:void 0,Qe({type:"text",role:"axis-label",style:"guide-label",key:we,from:n,encode:o,overlap:g},i)}(e,s,u.labels,r,o,m))),n.domain&&l.push(function(e,t,i,n){var a,r,o,l,s,u,d=Je(e,t),c=e.orient;return Ie(a={enter:r={opacity:Ve},update:o={opacity:De},exit:{opacity:Ve}},{stroke:d("domainColor"),strokeCap:d("domainCap"),strokeDash:d("domainDash"),strokeDashOffset:d("domainDashOffset"),strokeWidth:d("domainWidth"),strokeOpacity:d("domainOpacity")}),c===Re||"bottom"===c?(l="x",u="y"):(l="y",u="x"),s=l+"2",r[u]=Ve,o[l]=r[l]=Ht(e,0),o[s]=r[s]=Ht(e,1),Qe({type:"rule",role:"axis-domain",from:n,encode:a},i)}(e,s,u.domain,a)),n.title&&l.push(function(e,i,n,a){var r,o,l,s,u=Je(e,i),d=e.orient,c=d===ze||d===Re?-1:1,f=d===Re||"bottom"===d;return r={enter:o={opacity:Ve,anchor:Ue(u("titleAnchor")),align:{signal:et}},update:l=t.extend({},o,{opacity:De,text:Ue(e.title)}),exit:{opacity:Ve}},s={signal:`lerp(range("${e.scale}"), ${Ze(0,1,.5)})`},f?(l.x=s,o.angle={value:0},o.baseline={value:d===Re?"bottom":"top"}):(l.y=s,o.angle={value:90*c},o.baseline={value:"bottom"}),Ie(r,{angle:u("titleAngle"),baseline:u("titleBaseline"),fill:u("titleColor"),fillOpacity:u("titleOpacity"),font:u("titleFont"),fontSize:u("titleFontSize"),fontStyle:u("titleFontStyle"),fontWeight:u("titleFontWeight"),limit:u("titleLimit"),lineHeight:u("titleLineHeight")},{align:u("titleAlign")}),!He(r,"x",u("titleX"),"update")&&!f&&!Ye("x",n)&&(r.enter.auto={value:!0}),!He(r,"y",u("titleY"),"update")&&f&&!Ye("y",n)&&(r.enter.auto={value:!0}),Qe({type:"text",role:"axis-title",style:"guide-title",from:a,encode:r},n)}(e,s,u.title,a)),Lt(rt({role:"axis",from:a,encode:d,marks:l,aria:g("aria"),description:g("description"),zindex:g("zindex"),name:c,interactive:f,style:p}),i)}function Xt(e,i,n){var a=t.array(e.signals),o=t.array(e.scales);return n||a.forEach(e=>f(e,i)),t.array(e.projections).forEach(e=>function(e,t){var i=t.config.projection||{},n={};for(var a in e)"name"!==a&&(n[a]=$e(e[a],a,t));for(a in i)null==n[a]&&(n[a]=$e(i[a],a,t));t.addProjection(e.name,n)}(e,i)),o.forEach(e=>function(e,i){var n=e.type||"linear";r.isValidScaleType(n)||t.error("Unrecognized scale type: "+t.stringValue(n)),i.addScale(e.name,{type:n,domain:void 0})}(e,i)),t.array(e.data).forEach(e=>qt(e,i)),o.forEach(e=>fe(e,i)),(n||a).forEach(e=>_(e,i)),t.array(e.axes).forEach(e=>Gt(e,i)),t.array(e.marks).forEach(e=>Lt(e,i)),t.array(e.legends).forEach(e=>At(e,i)),e.title&&Tt(e.title,i),i.parseLambdas(),i}function Yt(e,i){var n,a,r,o,s,d,c=i.config;return s=y(i.root=i.add(h())),(d=function(e,i){const n=t=>$(e[t],i[t]),a=[Qt("background",n("background")),Qt("autosize",l(n("autosize"))),Qt("padding",u(n("padding"))),Qt("width",n("width")||0),Qt("height",n("height")||0)],r=a.reduce((e,t)=>(e[t.name]=t,e),{}),o={};return t.array(e.signals).forEach(e=>{t.hasOwnProperty(r,e.name)?e=t.extend(r[e.name],e):a.push(e),o[e.name]=e}),t.array(i.signals).forEach(e=>{t.hasOwnProperty(o,e.name)||t.hasOwnProperty(r,e.name)||a.push(e)}),a}(e,c)).forEach(e=>f(e,i)),i.description=e.description||c.description,i.eventConfig=c.events,i.legends=i.objectProperty(c.legend&&c.legend.layout),a=i.add(T()),r=Ne({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),r=i.add(M(Ge(r,"group","frame",e.style,i,{pulse:y(a)}))),o=i.add(se({layout:i.objectProperty(e.layout),legends:i.legends,autosize:i.signalRef("autosize"),mark:s,pulse:y(r)})),i.operators.pop(),i.pushState(y(r),y(o),null),Xt(e,i,d),i.operators.push(o),n=i.add(F({mark:s,pulse:y(o)})),n=i.add(ae({pulse:y(n)})),n=i.add(oe({pulse:y(n)})),i.addData("root",new Vt(i,a,a,n)),i}function Qt(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function Jt(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.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function Kt(e){this.config=e.config,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}var Zt=Jt.prototype=Kt.prototype;function ei(e){return(t.isArray(e)?ti:ii)(e)}function ti(e){for(var i,n="[",a=0,r=e.length;a<r;++a)i=e[a],n+=(a>0?",":"")+(t.isObject(i)?i.signal||ei(i):t.stringValue(i));return n+"]"}function ii(e){var i,n,a="{",r=0;for(i in e)n=e[i],a+=(++r>1?",":"")+t.stringValue(i)+":"+(t.isObject(n)?n.signal||ei(n):t.stringValue(n));return a+"}"}Zt.fork=function(){return new Kt(this)},Zt.isSubscope=function(){return this._subid>0},Zt.toRuntime=function(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},Zt.id=function(){return(this._subid?this._subid+":":0)+this._id++},Zt.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},Zt.proxy=function(e){var t=e instanceof g?y(e):e;return this.add(ie({value:t}))},Zt.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},Zt.addUpdate=function(e){return this.updates.push(e),e},Zt.finish=function(){var e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function i(e,t,i){var n;e&&((n=e.data||(e.data={}))[t]||(n[t]=[])).push(i)}for(e in this.data)for(var n in i((t=this.data[e]).input,e,"input"),i(t.output,e,"output"),i(t.values,e,"values"),t.index)i(t.index[n],e,"index:"+n);return this},Zt.pushState=function(e,t,i){this._encode.push(y(this.add(oe({pulse:e})))),this._parent.push(t),this._lookup.push(i?y(this.proxy(i)):null),this._markpath.push(-1)},Zt.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},Zt.parent=function(){return t.peek(this._parent)},Zt.encode=function(){return t.peek(this._encode)},Zt.lookup=function(){return t.peek(this._lookup)},Zt.markpath=function(){var e=this._markpath;return++e[e.length-1]},Zt.fieldRef=function(e,i){if(t.isString(e))return b(e,i);e.signal||t.error("Unsupported field reference: "+t.stringValue(e));var n,a=e.signal,r=this.field[a];return r||(n={name:this.signalRef(a)},i&&(n.as=i),this.field[a]=r=y(this.add(I(n)))),r},Zt.compareRef=function(e){function i(e){return S(e)?(a=!0,n.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(a=!0,n.exprRef(e.expr)):e}var n=this,a=!1,r=t.array(e.field).map(i),o=t.array(e.order).map(i);return a?y(this.add(B({fields:r,orders:o}))):x(r,o)},Zt.keyRef=function(e,i){var n=this.signals,a=!1;return e=t.array(e).map((function(e){return S(e)?(a=!0,y(n[e.signal])):e})),a?y(this.add(N({fields:e,flat:i}))):function(e,t){var i={$key:e};return t&&(i.$flat=!0),i}(e,i)},Zt.sortRef=function(e){if(!e)return e;var t=k(e.op,e.field),i=e.order||"ascending";return i.signal?y(this.add(B({fields:t,orders:this.signalRef(i.signal)}))):x(t,i)},Zt.event=function(e,t){var i=e+":"+t;if(!this.events[i]){var n=this.id();this.streams.push({id:n,source:e,type:t}),this.events[i]=n}return this.events[i]},Zt.hasOwnSignal=function(e){return t.hasOwnProperty(this.signals,e)},Zt.addSignal=function(e,i){this.hasOwnSignal(e)&&t.error("Duplicate signal name: "+t.stringValue(e));var n=i instanceof g?i:this.add(h(i));return this.signals[e]=n},Zt.getSignal=function(e){return this.signals[e]||t.error("Unrecognized signal name: "+t.stringValue(e)),this.signals[e]},Zt.signalRef=function(e){return this.signals[e]?y(this.signals[e]):(t.hasOwnProperty(this.lambdas,e)||(this.lambdas[e]=this.add(h(null))),y(this.lambdas[e]))},Zt.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,i=e.length;t<i;++t){var n=e[t],a=p(n,this),r=this.lambdas[n];r.params=a.$params,r.update=a.$expr}},Zt.property=function(e){return e&&e.signal?this.signalRef(e.signal):e},Zt.objectProperty=function(e){return e&&t.isObject(e)?this.signalRef(e.signal||ei(e)):e},Zt.exprRef=function(e,t){var i={expr:p(e,this)};return t&&(i.expr.$name=t),y(this.add(U(i)))},Zt.addBinding=function(e,i){this.bindings||t.error("Nested signals do not support binding: "+t.stringValue(e)),this.bindings.push(t.extend({signal:e},i))},Zt.addScaleProj=function(e,i){t.hasOwnProperty(this.scales,e)&&t.error("Duplicate scale or projection name: "+t.stringValue(e)),this.scales[e]=this.add(i)},Zt.addScale=function(e,t){this.addScaleProj(e,re(t))},Zt.addProjection=function(e,t){this.addScaleProj(e,te(t))},Zt.getScale=function(e){return this.scales[e]||t.error("Unrecognized scale name: "+t.stringValue(e)),this.scales[e]},Zt.projectionRef=Zt.scaleRef=function(e){return y(this.getScale(e))},Zt.projectionType=Zt.scaleType=function(e){return this.getScale(e).params.type},Zt.addData=function(e,i){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.data[e]=i},Zt.getData=function(e){return this.data[e]||t.error("Undefined data set name: "+t.stringValue(e)),this.data[e]},Zt.addDataPipeline=function(e,i){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.addData(e,Vt.fromEntries(this,i))};function ni(){return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:"#4c78a8"},area:{fill:"#4c78a8"},image:null,line:{stroke:"#4c78a8",strokeWidth:2},path:{stroke:"#4c78a8"},rect:{fill:"#4c78a8"},rule:{stroke:"#000"},shape:{stroke:"#4c78a8"},symbol:{fill:"#4c78a8",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11},trail:{fill:"#4c78a8",size:2},style:{"guide-label":{fill:"#000",font:"sans-serif",fontSize:10},"guide-title":{fill:"#000",font:"sans-serif",fontSize:11,fontWeight:"bold"},"group-title":{fill:"#000",font:"sans-serif",fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:"#000",font:"sans-serif",fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:"#ddd"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:"#888",grid:!1,gridWidth:1,gridColor:"#ddd",labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:"#888",tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:"#888",titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}e.AxisDomainRole="axis-domain",e.AxisGridRole="axis-grid",e.AxisLabelRole="axis-label",e.AxisRole="axis",e.AxisTickRole="axis-tick",e.AxisTitleRole="axis-title",e.DataScope=Vt,e.FrameRole="frame",e.LegendEntryRole="legend-entry",e.LegendLabelRole="legend-label",e.LegendRole="legend",e.LegendSymbolRole="legend-symbol",e.LegendTitleRole="legend-title",e.MarkRole="mark",e.Scope=Jt,e.ScopeRole="scope",e.config=ni,e.parse=function(e,i){return t.isObject(e)||t.error("Input Vega specification must be an object."),Yt(e,new Jt(i=t.mergeConfig({description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:"#4c78a8"},area:{fill:"#4c78a8"},image:null,line:{stroke:"#4c78a8",strokeWidth:2},path:{stroke:"#4c78a8"},rect:{fill:"#4c78a8"},rule:{stroke:"#000"},shape:{stroke:"#4c78a8"},symbol:{fill:"#4c78a8",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11},trail:{fill:"#4c78a8",size:2},style:{"guide-label":{fill:"#000",font:"sans-serif",fontSize:10},"guide-title":{fill:"#000",font:"sans-serif",fontSize:11,fontWeight:"bold"},"group-title":{fill:"#000",font:"sans-serif",fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:"#000",font:"sans-serif",fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:"#ddd"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:"#888",grid:!1,gridWidth:1,gridColor:"#ddd",labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:"#888",tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:"#888",titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}},i,e.config))).toRuntime()},e.signal=f,e.signalUpdates=_,e.stream=z,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "vega-parser", | ||
"version": "5.13.1", | ||
"version": "5.14.0", | ||
"description": "Parse Vega specifications to runtime dataflows.", | ||
@@ -22,3 +22,3 @@ "keywords": [ | ||
"pretest": "yarn prebuild && yarn rollup", | ||
"test": "tape 'test/**/*-test.js' && eslint index.js src test", | ||
"test": "tape 'test/**/*-test.js'", | ||
"prepublishOnly": "yarn test && yarn build", | ||
@@ -28,10 +28,10 @@ "postpublish": "git push && git push --tags" | ||
"dependencies": { | ||
"vega-dataflow": "^5.5.0", | ||
"vega-event-selector": "^2.0.2", | ||
"vega-expression": "^2.6.3", | ||
"vega-functions": "^5.5.1", | ||
"vega-scale": "^6.0.0", | ||
"vega-util": "^1.13.1" | ||
"vega-dataflow": "^5.5.1", | ||
"vega-event-selector": "^2.0.3", | ||
"vega-expression": "^2.6.4", | ||
"vega-functions": "^5.6.0", | ||
"vega-scale": "^6.1.0", | ||
"vega-util": "^1.13.2" | ||
}, | ||
"gitHead": "2485e6f68a1cec25260c8c07b812f24925c5d726" | ||
"gitHead": "35e31c5c6b54db9dc3a577b5adad8d15ec274d32" | ||
} |
@@ -44,16 +44,28 @@ var defaultFont = 'sans-serif', | ||
mark: null, | ||
arc: { fill: defaultColor }, | ||
area: { fill: defaultColor }, | ||
arc: { | ||
fill: defaultColor, | ||
}, | ||
area: { | ||
fill: defaultColor, | ||
}, | ||
image: null, | ||
line: { | ||
stroke: defaultColor, | ||
strokeWidth: defaultStrokeWidth | ||
strokeWidth: defaultStrokeWidth, | ||
}, | ||
path: { stroke: defaultColor }, | ||
rect: { fill: defaultColor }, | ||
rule: { stroke: black }, | ||
shape: { stroke: defaultColor }, | ||
path: { | ||
stroke: defaultColor, | ||
}, | ||
rect: { | ||
fill: defaultColor, | ||
}, | ||
rule: { | ||
stroke: black, | ||
}, | ||
shape: { | ||
stroke: defaultColor, | ||
}, | ||
symbol: { | ||
fill: defaultColor, | ||
size: 64 | ||
size: 64, | ||
}, | ||
@@ -63,7 +75,7 @@ text: { | ||
font: defaultFont, | ||
fontSize: 11 | ||
fontSize: 11, | ||
}, | ||
trail: { | ||
fill: defaultColor, | ||
size: defaultStrokeWidth | ||
size: defaultStrokeWidth, | ||
}, | ||
@@ -70,0 +82,0 @@ |
@@ -1,2 +0,2 @@ | ||
import {entry, ref, keyFieldRef, aggrField, sortKey} from './util'; | ||
import {aggrField, entry, keyFieldRef, ref, sortKey} from './util'; | ||
import {Aggregate, Collect} from './transforms'; | ||
@@ -3,0 +3,0 @@ import {isString} from 'vega-util'; |
@@ -11,6 +11,6 @@ import axisConfig from './guides/axis-config'; | ||
import parseMark from './mark'; | ||
import {encoder, extendEncode} from './encode/encode-util'; | ||
import {addEncoders, extendEncode} from './encode/encode-util'; | ||
import {Skip} from './guides/constants'; | ||
import {ref, value} from '../util'; | ||
import {Collect, AxisTicks} from '../transforms'; | ||
import {AxisTicks, Collect} from '../transforms'; | ||
@@ -26,3 +26,3 @@ export default function(spec, scope) { | ||
band = tickBand(_), | ||
datum, dataRef, ticksRef, size, group, children; | ||
datum, dataRef, ticksRef, size, children; | ||
@@ -32,2 +32,3 @@ // single-element data source for axis group | ||
orient: spec.orient, | ||
scale: spec.scale, | ||
ticks: !!_('ticks'), | ||
@@ -43,12 +44,5 @@ labels: !!_('labels'), | ||
// encoding properties for axis group item | ||
axisEncode = extendEncode({ | ||
update: { | ||
offset: encoder(_('offset') || 0), | ||
position: encoder(value(spec.position, 0)), | ||
titlePadding: encoder(_('titlePadding')), | ||
minExtent: encoder(_('minExtent')), | ||
maxExtent: encoder(_('maxExtent')), | ||
range: {signal: `abs(span(range("${spec.scale}")))`} | ||
} | ||
}, encode.axis, Skip); | ||
axisEncode = extendEncode( | ||
buildAxisEncode(_, spec), axisEncode, Skip | ||
); | ||
@@ -96,8 +90,37 @@ // data source for axis ticks | ||
// build axis specification | ||
group = guideGroup(AxisRole, style, name, dataRef, interactive, axisEncode, children); | ||
if (spec.zindex) group.zindex = spec.zindex; | ||
// parse axis specification | ||
return parseMark(group, scope); | ||
return parseMark( | ||
guideGroup({ | ||
role: AxisRole, | ||
from: dataRef, | ||
encode: axisEncode, | ||
marks: children, | ||
aria: _('aria'), | ||
description: _('description'), | ||
zindex: _('zindex'), | ||
name, | ||
interactive, | ||
style | ||
}), | ||
scope | ||
); | ||
} | ||
function buildAxisEncode(_, spec) { | ||
var encode = {enter: {}, update: {}}; | ||
addEncoders(encode, { | ||
offset: _('offset') || 0, | ||
position: value(spec.position, 0), | ||
titlePadding: _('titlePadding'), | ||
minExtent: _('minExtent'), | ||
maxExtent: _('maxExtent'), | ||
range: {signal: `abs(span(range("${spec.scale}")))`}, | ||
// accessibility support | ||
format: spec.format, | ||
formatType: spec.formatType, | ||
}); | ||
return encode; | ||
} |
@@ -111,3 +111,3 @@ import parseEncode from '../encode'; | ||
? {signal: value.signal} | ||
: {value: value} | ||
: {value: value}; | ||
} | ||
@@ -114,0 +114,0 @@ |
import expression from './expression'; | ||
import {error, isString, isObject, splitAccessPath, stringValue} from 'vega-util'; | ||
import {error, isObject, isString, splitAccessPath, stringValue} from 'vega-util'; | ||
@@ -4,0 +4,0 @@ export default function(ref, scope, params, fields) { |
import {CallExpression, parse} from 'vega-expression'; | ||
import {codeGenerator, codegenParams, SignalPrefix} from 'vega-functions'; | ||
import {SignalPrefix, codeGenerator, codegenParams} from 'vega-functions'; | ||
import {error, hasOwnProperty, isString, stringValue} from 'vega-util'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,2 +0,2 @@ | ||
import {Top, Bottom} from './constants'; | ||
import {Bottom, Top} from './constants'; | ||
import {extend} from 'vega-util'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
import {Top, Bottom, zero, one} from './constants'; | ||
import {Bottom, Top, one, zero} from './constants'; | ||
import guideMark from './guide-mark'; | ||
@@ -21,2 +21,3 @@ import {lookup} from './guide-util'; | ||
stroke: _('domainColor'), | ||
strokeCap: _('domainCap'), | ||
strokeDash: _('domainDash'), | ||
@@ -41,3 +42,8 @@ strokeDashOffset: _('domainDashOffset'), | ||
return guideMark(RuleMark, AxisDomainRole, null, null, dataRef, encode, userEncode); | ||
return guideMark({ | ||
type: RuleMark, | ||
role: AxisDomainRole, | ||
from: dataRef, | ||
encode | ||
}, userEncode); | ||
} | ||
@@ -44,0 +50,0 @@ |
@@ -1,2 +0,2 @@ | ||
import {Left, Top, Bottom, Value, zero, one} from './constants'; | ||
import {Bottom, Left, Top, Value, one, zero} from './constants'; | ||
import guideMark from './guide-mark'; | ||
@@ -25,2 +25,3 @@ import {lookup} from './guide-util'; | ||
stroke: _('gridColor'), | ||
strokeCap: _('gridCap'), | ||
strokeDash: _('gridDash'), | ||
@@ -62,3 +63,9 @@ strokeDashOffset: _('gridDashOffset'), | ||
return guideMark(RuleMark, AxisGridRole, null, Value, dataRef, encode, userEncode); | ||
return guideMark({ | ||
type: RuleMark, | ||
role: AxisGridRole, | ||
key: Value, | ||
from: dataRef, | ||
encode | ||
}, userEncode); | ||
} | ||
@@ -65,0 +72,0 @@ |
@@ -1,2 +0,2 @@ | ||
import {Top, Bottom, Left, Right, Label, Value, GuideLabelStyle, zero, one} from './constants'; | ||
import {Bottom, GuideLabelStyle, Label, Left, Right, Top, Value, one, zero} from './constants'; | ||
import guideMark from './guide-mark'; | ||
@@ -29,3 +29,3 @@ import {extendOffset, lookup} from './guide-util'; | ||
encode, enter, tickSize, tickPos, align, baseline, offset, | ||
bound, overlap, separation; | ||
bound, overlap; | ||
@@ -98,17 +98,20 @@ tickSize = encoder(size); | ||
overlap = _('labelOverlap'); | ||
separation = _('labelSeparation'); | ||
spec = guideMark(TextMark, AxisLabelRole, GuideLabelStyle, Value, dataRef, encode, userEncode); | ||
// if overlap method or bound defined, request label overlap removal | ||
if (overlap || bound) { | ||
spec.overlap = { | ||
separation: separation, | ||
method: overlap, | ||
order: 'datum.index', | ||
bound: bound ? {scale: scale, orient: orient, tolerance: bound} : null | ||
}; | ||
} | ||
overlap = overlap || bound ? { | ||
separation: _('labelSeparation'), | ||
method: overlap, | ||
order: 'datum.index', | ||
bound: bound ? {scale, orient, tolerance: bound} : null | ||
} : undefined; | ||
return spec; | ||
return guideMark({ | ||
type: TextMark, | ||
role: AxisLabelRole, | ||
style: GuideLabelStyle, | ||
key: Value, | ||
from: dataRef, | ||
encode, | ||
overlap | ||
}, userEncode); | ||
} |
@@ -1,2 +0,2 @@ | ||
import {Top, Left, Bottom, Value, zero, one} from './constants'; | ||
import {Bottom, Left, Top, Value, one, zero} from './constants'; | ||
import guideMark from './guide-mark'; | ||
@@ -22,2 +22,3 @@ import {lookup} from './guide-util'; | ||
stroke: _('tickColor'), | ||
strokeCap: _('tickCap'), | ||
strokeDash: _('tickDash'), | ||
@@ -51,3 +52,9 @@ strokeDashOffset: _('tickDashOffset'), | ||
return guideMark(RuleMark, AxisTickRole, null, Value, dataRef, encode, userEncode); | ||
return guideMark({ | ||
type: RuleMark, | ||
role: AxisTickRole, | ||
key: Value, | ||
from: dataRef, | ||
encode | ||
}, userEncode); | ||
} |
@@ -1,2 +0,2 @@ | ||
import {Top, Bottom, Left, GuideTitleStyle, zero, one} from './constants'; | ||
import {Bottom, GuideTitleStyle, Left, Top, one, zero} from './constants'; | ||
import guideMark from './guide-mark'; | ||
@@ -69,3 +69,9 @@ import {alignExpr, anchorExpr, lookup} from './guide-util'; | ||
return guideMark(TextMark, AxisTitleRole, GuideTitleStyle, null, dataRef, encode, userEncode); | ||
return guideMark({ | ||
type: TextMark, | ||
role: AxisTitleRole, | ||
style: GuideTitleStyle, | ||
from: dataRef, | ||
encode | ||
}, userEncode); | ||
} |
@@ -18,3 +18,2 @@ export const Top = 'top'; | ||
export const Perc2 = 'perc2'; | ||
export const Size = 'size'; | ||
export const Value = 'value'; | ||
@@ -31,12 +30,20 @@ | ||
export const Size = 'size'; | ||
export const Shape = 'shape'; | ||
export const Fill = 'fill'; | ||
export const Stroke = 'stroke'; | ||
export const StrokeWidth = 'strokeWidth'; | ||
export const StrokeDash = 'strokeDash'; | ||
export const Opacity = 'opacity'; | ||
// Encoding channels supported by legends | ||
// In priority order of 'canonical' scale | ||
export const LegendScales = [ | ||
'size', | ||
'shape', | ||
'fill', | ||
'stroke', | ||
'strokeWidth', | ||
'strokeDash', | ||
'opacity' | ||
Size, | ||
Shape, | ||
Fill, | ||
Stroke, | ||
StrokeWidth, | ||
StrokeDash, | ||
Opacity | ||
]; | ||
@@ -43,0 +50,0 @@ |
import {GroupMark} from '../marks/marktypes'; | ||
export default function(role, style, name, dataRef, interactive, encode, marks, layout) { | ||
return { | ||
type: GroupMark, | ||
name: name, | ||
role: role, | ||
style: style, | ||
from: dataRef, | ||
interactive: interactive || false, | ||
encode: encode, | ||
marks: marks, | ||
layout: layout | ||
}; | ||
export default function(mark) { | ||
mark.type = GroupMark; | ||
mark.interactive = mark.interactive || false; | ||
return mark; | ||
} |
import {Skip} from './constants'; | ||
import {extendEncode} from '../encode/encode-util'; | ||
export default function(type, role, style, key, dataRef, encode, extras) { | ||
return { | ||
type: type, | ||
name: extras ? extras.name : undefined, | ||
role: role, | ||
style: (extras && extras.style) || style, | ||
key: key, | ||
from: dataRef, | ||
interactive: !!(extras && extras.interactive), | ||
encode: extendEncode(encode, extras, Skip) | ||
}; | ||
export default function(mark, extras) { | ||
if (extras) { | ||
mark.name = extras.name; | ||
mark.style = extras.style || mark.style; | ||
mark.interactive = !!extras.interactive; | ||
mark.encode = extendEncode(mark.encode, extras, Skip); | ||
} else { | ||
mark.interactive = false; | ||
} | ||
return mark; | ||
} |
@@ -1,2 +0,2 @@ | ||
import {Left, Right, Center, Start, End, Vertical} from './constants'; | ||
import {Center, End, Left, Right, Start, Vertical} from './constants'; | ||
import {value} from '../../util'; | ||
@@ -3,0 +3,0 @@ import {isObject, stringValue} from 'vega-util'; |
@@ -1,2 +0,2 @@ | ||
import {Value, Perc, Perc2, zero, one} from './constants'; | ||
import {Perc, Perc2, Value, one, zero} from './constants'; | ||
import guideMark from './guide-mark'; | ||
@@ -42,3 +42,9 @@ import {lookup} from './guide-util'; | ||
return guideMark(RectMark, LegendBandRole, null, Value, dataRef, encode, userEncode); | ||
return guideMark({ | ||
type: RectMark, | ||
role: LegendBandRole, | ||
key: Value, | ||
from: dataRef, | ||
encode | ||
}, userEncode); | ||
} |
import { | ||
Index, Label, Perc, Value, GuideLabelStyle, zero, one, | ||
Top, Bottom, Left, Right, Center, Middle | ||
Bottom, Center, GuideLabelStyle, Index, Label, Left, Middle, | ||
Perc, Right, Top, Value, one, zero | ||
} from './constants'; | ||
@@ -21,3 +21,2 @@ import guideMark from './guide-mark'; | ||
overlap = _('labelOverlap'), | ||
separation = _('labelSeparation'), | ||
encode, enter, update, u, v, adjust = ''; | ||
@@ -63,11 +62,18 @@ | ||
spec = guideMark(TextMark, LegendLabelRole, GuideLabelStyle, Value, dataRef, encode, userEncode); | ||
if (overlap) { | ||
spec.overlap = { | ||
separation: separation, | ||
method: overlap, | ||
order: 'datum.' + Index | ||
}; | ||
} | ||
return spec; | ||
overlap = overlap ? { | ||
separation: _('labelSeparation'), | ||
method: overlap, | ||
order: 'datum.' + Index | ||
} : undefined; | ||
// type, role, style, key, dataRef, encode, extras | ||
return guideMark({ | ||
type: TextMark, | ||
role: LegendLabelRole, | ||
style: GuideLabelStyle, | ||
key: Value, | ||
from: dataRef, | ||
encode, | ||
overlap | ||
}, userEncode); | ||
} |
@@ -1,2 +0,2 @@ | ||
import {zero, one} from './constants'; | ||
import {one, zero} from './constants'; | ||
import guideMark from './guide-mark'; | ||
@@ -52,3 +52,7 @@ import {lookup} from './guide-util'; | ||
return guideMark(RectMark, LegendGradientRole, null, undefined, undefined, encode, userEncode); | ||
return guideMark({ | ||
type: RectMark, | ||
role: LegendGradientRole, | ||
encode | ||
}, userEncode); | ||
} |
import { | ||
Index, Label, Offset, Size, Value, zero, one, | ||
Skip, GuideLabelStyle, LegendScales | ||
GuideLabelStyle, Index, Label, LegendScales, Offset, Size, Skip, | ||
Value, one, zero | ||
} from './constants'; | ||
@@ -9,3 +9,3 @@ import guideGroup from './guide-group'; | ||
import {SymbolMark, TextMark} from '../marks/marktypes'; | ||
import {ScopeRole, LegendSymbolRole, LegendLabelRole} from '../marks/roles'; | ||
import {LegendLabelRole, LegendSymbolRole, ScopeRole} from '../marks/roles'; | ||
import {addEncoders, encoder, extendEncode} from '../encode/encode-util'; | ||
@@ -73,7 +73,10 @@ | ||
symbols = guideMark( | ||
SymbolMark, LegendSymbolRole, null, | ||
Value, valueRef, encode, userEncode.symbols | ||
); | ||
if (height) symbols.clip = true; | ||
symbols = guideMark({ | ||
type: SymbolMark, | ||
role: LegendSymbolRole, | ||
key: Value, | ||
from: valueRef, | ||
clip: height ? true : undefined, | ||
encode | ||
}, userEncode.symbols); | ||
@@ -113,6 +116,10 @@ // -- LEGEND LABELS -- | ||
labels = guideMark( | ||
TextMark, LegendLabelRole, GuideLabelStyle, | ||
Value, valueRef, encode, userEncode.labels | ||
); | ||
labels = guideMark({ | ||
type: TextMark, | ||
role: LegendLabelRole, | ||
style: GuideLabelStyle, | ||
key: Value, | ||
from: valueRef, | ||
encode | ||
}, userEncode.labels); | ||
@@ -152,8 +159,11 @@ // -- LEGEND ENTRY GROUPS -- | ||
spec = guideGroup( | ||
ScopeRole, null, name, dataRef, interactive, | ||
extendEncode(encode, entries, Skip), [symbols, labels] | ||
); | ||
spec.sort = sort; | ||
return spec; | ||
return guideGroup({ | ||
role: ScopeRole, | ||
from: dataRef, | ||
encode: extendEncode(encode, entries, Skip), | ||
marks: [symbols, labels], | ||
name, | ||
interactive, | ||
sort | ||
}); | ||
} | ||
@@ -160,0 +170,0 @@ |
@@ -1,4 +0,4 @@ | ||
import {GuideTitleStyle, zero, one} from './constants'; | ||
import {GuideTitleStyle, one, zero} from './constants'; | ||
import guideMark from './guide-mark'; | ||
import {lookup, alignExpr, anchorExpr} from './guide-util'; | ||
import {alignExpr, anchorExpr, lookup} from './guide-util'; | ||
import {TextMark} from '../marks/marktypes'; | ||
@@ -54,3 +54,9 @@ import {LegendTitleRole} from '../marks/roles'; | ||
return guideMark(TextMark, LegendTitleRole, GuideTitleStyle, null, dataRef, encode, userEncode); | ||
return guideMark({ | ||
type: TextMark, | ||
role: LegendTitleRole, | ||
style: GuideTitleStyle, | ||
from: dataRef, | ||
encode | ||
}, userEncode); | ||
} |
import { | ||
GuideLabelStyle, Skip, | ||
Symbols, Gradient, Discrete, LegendScales | ||
Discrete, Gradient, | ||
GuideLabelStyle, LegendScales, Skip, Symbols | ||
} from './guides/constants'; | ||
@@ -8,3 +8,3 @@ import legendGradient from './guides/legend-gradient'; | ||
import legendGradientLabels from './guides/legend-gradient-labels'; | ||
import {default as legendSymbolGroups, legendSymbolLayout} from './guides/legend-symbol-groups'; | ||
import legendSymbolGroups, {legendSymbolLayout} from './guides/legend-symbol-groups'; | ||
import legendTitle from './guides/legend-title'; | ||
@@ -15,5 +15,5 @@ import guideGroup from './guides/guide-group'; | ||
import parseMark from './mark'; | ||
import {LegendRole, LegendEntryRole} from './marks/roles'; | ||
import {LegendEntryRole, LegendRole} from './marks/roles'; | ||
import {addEncoders, extendEncode} from './encode/encode-util'; | ||
import {ref, deref} from '../util'; | ||
import {deref, ref} from '../util'; | ||
import {Collect, LegendEntries} from '../transforms'; | ||
@@ -32,7 +32,10 @@ | ||
_ = lookup(spec, config), | ||
scales = {}, scale = 0, | ||
entryEncode, entryLayout, params, children, | ||
type, datum, dataRef, entryRef, group; | ||
type, datum, dataRef, entryRef; | ||
// resolve 'canonical' scale name | ||
var scale = LegendScales.reduce(function(a, b) { return a || spec[b]; }, 0); | ||
// resolve scales and 'canonical' scale name | ||
LegendScales.forEach(s => spec[s] | ||
? (scales[s] = spec[s], scale = scale || spec[s]) : 0 | ||
); | ||
if (!scale) error('Missing valid scale for legend.'); | ||
@@ -46,2 +49,3 @@ | ||
title: spec.title != null, | ||
scales: scales, | ||
type: type, | ||
@@ -54,3 +58,3 @@ vgrad: type !== 'symbol' && _.isVertical() | ||
legendEncode = extendEncode( | ||
buildLegendEncode(_, config), legendEncode, Skip | ||
buildLegendEncode(_, spec, config), legendEncode, Skip | ||
); | ||
@@ -106,4 +110,10 @@ | ||
children = [ | ||
guideGroup(LegendEntryRole, null, null, dataRef, interactive, | ||
entryEncode, children, entryLayout) | ||
guideGroup({ | ||
role: LegendEntryRole, | ||
from: dataRef, | ||
encode: entryEncode, | ||
marks: children, | ||
layout: entryLayout, | ||
interactive | ||
}) | ||
]; | ||
@@ -116,8 +126,18 @@ | ||
// build legend specification | ||
group = guideGroup(LegendRole, style, name, dataRef, interactive, legendEncode, children); | ||
if (spec.zindex) group.zindex = spec.zindex; | ||
// parse legend specification | ||
return parseMark(group, scope); | ||
return parseMark( | ||
guideGroup({ | ||
role: LegendRole, | ||
from: dataRef, | ||
encode: legendEncode, | ||
marks: children, | ||
aria: _('aria'), | ||
description: _('description'), | ||
zindex: _('zindex'), | ||
name, | ||
interactive, | ||
style | ||
}), | ||
scope | ||
); | ||
} | ||
@@ -145,3 +165,3 @@ | ||
function buildLegendEncode(_, config) { | ||
function buildLegendEncode(_, spec, config) { | ||
var encode = {enter: {}, update: {}}; | ||
@@ -161,2 +181,6 @@ | ||
y: _('legendY'), | ||
// accessibility support | ||
format: spec.format, | ||
formatType: spec.formatType, | ||
}); | ||
@@ -163,0 +187,0 @@ |
@@ -17,3 +17,3 @@ import clip from './marks/clip'; | ||
import {error} from 'vega-util'; | ||
import {Bound, Collect, DataJoin, Mark, Encode, Overlap, Render, Sieve, SortItems, ViewLayout} from '../transforms'; | ||
import {Bound, Collect, DataJoin, Encode, Mark, Overlap, Render, Sieve, SortItems, ViewLayout} from '../transforms'; | ||
@@ -20,0 +20,0 @@ export default function(spec, scope) { |
@@ -5,7 +5,9 @@ import role from './role'; | ||
return { | ||
marktype: spec.type, | ||
name: spec.name || undefined, | ||
role: spec.role || role(spec), | ||
zindex: +spec.zindex || undefined | ||
marktype: spec.type, | ||
name: spec.name || undefined, | ||
role: spec.role || role(spec), | ||
zindex: +spec.zindex || undefined, | ||
aria: spec.aria, | ||
description: spec.description, | ||
}; | ||
} |
import {GroupMark} from './marktypes'; | ||
import {ScopeRole, MarkRole} from './roles'; | ||
import {MarkRole, ScopeRole} from './roles'; | ||
@@ -4,0 +4,0 @@ export default function(spec) { |
import parseSpec from '../spec'; | ||
import {Sieve, PreFacet} from '../../transforms'; | ||
import {PreFacet, Sieve} from '../../transforms'; | ||
@@ -4,0 +4,0 @@ export default function(spec, scope, input) { |
@@ -1,7 +0,7 @@ | ||
import {ref, keyFieldRef, aggrField} from '../util'; | ||
import {aggrField, keyFieldRef, ref} from '../util'; | ||
import { | ||
Collect, Aggregate, MultiExtent, MultiValues, Sieve, Values | ||
Aggregate, Collect, MultiExtent, MultiValues, Sieve, Values | ||
} from '../transforms'; | ||
import {isValidScaleType, isDiscrete, isQuantile} from 'vega-scale'; | ||
import {isDiscrete, isQuantile, isValidScaleType} from 'vega-scale'; | ||
import { | ||
@@ -249,7 +249,7 @@ error, extend, hasOwnProperty, isArray, isObject, isString, stringValue | ||
} else if (range === 'width') { | ||
range = [0, {signal: 'width'}] | ||
range = [0, {signal: 'width'}]; | ||
} else if (range === 'height') { | ||
range = isDiscrete(spec.type) | ||
? [0, {signal: 'height'}] | ||
: [{signal: 'height'}, 0] | ||
: [{signal: 'height'}, 0]; | ||
} else { | ||
@@ -256,0 +256,0 @@ error('Unrecognized scale range value: ' + stringValue(range)); |
import parseExpression from './expression'; | ||
import {View, Scope} from '../util'; | ||
import {Scope, View} from '../util'; | ||
import {error, stringValue} from 'vega-util'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,2 +0,2 @@ | ||
import {Left, Right, GroupSubtitleStyle, GroupTitleStyle, Skip} from './guides/constants'; | ||
import {GroupSubtitleStyle, GroupTitleStyle, Left, Right, Skip} from './guides/constants'; | ||
import guideGroup from './guides/guide-group'; | ||
@@ -7,3 +7,3 @@ import guideMark from './guides/guide-mark'; | ||
import {TextMark} from './marks/marktypes'; | ||
import {TitleRole, TitleTextRole, TitleSubtitleRole} from './marks/roles'; | ||
import {TitleRole, TitleSubtitleRole, TitleTextRole} from './marks/roles'; | ||
import {addEncoders, extendEncode} from './encode/encode-util'; | ||
@@ -26,6 +26,7 @@ import {ref} from '../util'; | ||
children = [], | ||
dataRef, group; | ||
datum, dataRef; | ||
// single-element data source for group title | ||
dataRef = ref(scope.add(Collect(null, [{}]))); | ||
datum = {}; | ||
dataRef = ref(scope.add(Collect(null, [datum]))); | ||
@@ -40,9 +41,18 @@ // include title text | ||
// build title specification | ||
group = guideGroup(TitleRole, style, name, dataRef, interactive, | ||
groupEncode(_, userEncode), children); | ||
if (spec.zindex) group.zindex = spec.zindex; | ||
// parse title specification | ||
return parseMark(group, scope); | ||
return parseMark( | ||
guideGroup({ | ||
role: TitleRole, | ||
from: dataRef, | ||
encode: groupEncode(_, userEncode), | ||
marks: children, | ||
aria: _('aria'), | ||
description: _('description'), | ||
zindex: _('zindex'), | ||
name, | ||
interactive, | ||
style | ||
}), | ||
scope | ||
); | ||
} | ||
@@ -65,10 +75,10 @@ | ||
addEncoders(encode, { | ||
orient: _('orient'), | ||
anchor: _('anchor'), | ||
align: {signal: alignExpr}, | ||
angle: {signal: angleExpr}, | ||
limit: _('limit'), | ||
frame: _('frame'), | ||
offset: _('offset') || 0, | ||
padding: _('subtitlePadding') | ||
orient: _('orient'), | ||
anchor: _('anchor'), | ||
align: {signal: alignExpr}, | ||
angle: {signal: angleExpr}, | ||
limit: _('limit'), | ||
frame: _('frame'), | ||
offset: _('offset') || 0, | ||
padding: _('subtitlePadding') | ||
}); | ||
@@ -108,4 +118,9 @@ | ||
return guideMark(TextMark, TitleTextRole, GroupTitleStyle, | ||
null, dataRef, encode, userEncode); | ||
return guideMark({ | ||
type: TextMark, | ||
role: TitleTextRole, | ||
style: GroupTitleStyle, | ||
from: dataRef, | ||
encode | ||
}, userEncode); | ||
} | ||
@@ -142,4 +157,9 @@ | ||
return guideMark(TextMark, TitleSubtitleRole, GroupSubtitleStyle, | ||
null, dataRef, encode, userEncode); | ||
return guideMark({ | ||
type: TextMark, | ||
role: TitleSubtitleRole, | ||
style: GroupSubtitleStyle, | ||
from: dataRef, | ||
encode | ||
}, userEncode); | ||
} |
@@ -155,3 +155,3 @@ import parseExpression from './expression'; | ||
export function isCompare(_) { | ||
return _ === 'compare' | ||
return _ === 'compare'; | ||
} |
import DataScope from './DataScope'; | ||
import { | ||
aggrField, Ascending, compareRef, Entry, isExpr, isSignal, | ||
fieldRef, keyRef, operator, ref | ||
Ascending, Entry, aggrField, compareRef, fieldRef, isExpr, | ||
isSignal, keyRef, operator, ref | ||
} from './util'; | ||
@@ -12,3 +12,3 @@ import parseExpression from './parsers/expression'; | ||
array, error, extend, hasOwnProperty, | ||
isArray, isString, isObject, peek, stringValue | ||
isArray, isObject, isString, peek, stringValue | ||
} from 'vega-util'; | ||
@@ -377,3 +377,3 @@ | ||
return ref(this.add(Expression(params))); | ||
} | ||
}; | ||
@@ -380,0 +380,0 @@ prototype.addBinding = function(name, bind) { |
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
285762
7150
Updatedvega-dataflow@^5.5.1
Updatedvega-event-selector@^2.0.3
Updatedvega-expression@^2.6.4
Updatedvega-functions@^5.6.0
Updatedvega-scale@^6.1.0
Updatedvega-util@^1.13.2