vega-parser
Advanced tools
Comparing version 6.0.4 to 6.1.0
@@ -1,1 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-functions"),require("vega-event-selector"),require("vega-scale"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-functions","vega-event-selector","vega-scale","vega-dataflow"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega,e.vega,e.vega,e.vega)}(this,(function(e,t,n,i,a,r){"use strict";function s(e){return t.isObject(e)?e:{type:e||"pad"}}const l=e=>+e||0;function o(e){return t.isObject(e)?e.signal?e:{top:l(e.top),bottom:l(e.bottom),left:l(e.left),right:l(e.right)}:{top:n=l(e),bottom:n,left:n,right:n};var n}const u=e=>t.isObject(e)&&!t.isArray(e)?t.extend({},e):{value:e};function c(e,n,i,a){if(null!=i){return t.isObject(i)&&!t.isArray(i)||t.isArray(i)&&i.length&&t.isObject(i[0])?e.update[n]=i:e[a||"enter"][n]={value:i},1}return 0}function d(e,t,n){for(const n in t)c(e,n,t[n]);for(const t in n)c(e,t,n[t],"update")}function p(e,n,i){for(const a in n)i&&t.hasOwnProperty(i,a)||(e[a]=t.extend(e[a]||{},n[a]));return e}function f(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const g="mark",m="frame",h="scope",y="axis",b="axis-domain",x="axis-grid",k="axis-label",v="axis-tick",$="axis-title",S="legend",O="legend-entry",R="legend-label",j="legend-symbol",w="legend-title",z="title-text",D="title-subtitle";function V(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const P=e=>t.isString(e)?t.stringValue(e):e.signal?`(${e.signal})`:W(e);function E(e){if(null!=e.gradient)return function(e){const n=[e.start,e.stop,e.count].map(e=>null==e?null:t.stringValue(e));for(;n.length&&null==t.peek(n);)n.pop();return n.unshift(P(e.gradient)),`gradient(${n.join(",")})`}(e);let n=e.signal?`(${e.signal})`:e.color?function(e){return e.c?_("hcl",e.h,e.c,e.l):e.h||e.s?_("hsl",e.h,e.s,e.l):e.l||e.a?_("lab",e.l,e.a,e.b):e.r||e.g||e.b?_("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?W(e.field):void 0!==e.value?t.stringValue(e.value):void 0;return null!=e.scale&&(n=function(e,t){const n=P(e.scale);null!=e.range?t=`lerp(_range(${n}), ${+e.range})`:(void 0!==t&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(1==+e.band?"":"*"+C(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0"));return t}(e,n)),void 0===n&&(n=null),null!=e.exponent&&(n=`pow(${n},${C(e.exponent)})`),null!=e.mult&&(n+="*"+C(e.mult)),null!=e.offset&&(n+="+"+C(e.offset)),e.round&&(n=`round(${n})`),n}const _=(e,t,n,i)=>`(${e}(${[t,n,i].map(E).join(",")})+'')`;function C(e){return t.isObject(e)?"("+E(e)+")":e}function W(e){return function e(n){let i,a,r;if(n.signal)i="datum",r=n.signal;else if(n.group||n.parent){for(a=Math.max(1,n.level||1),i="item";a-- >0;)i+=".mark.group";n.parent?(r=n.parent,i+=".datum"):r=n.group}else n.datum?(i="datum",r=n.datum):t.error("Invalid field reference: "+t.stringValue(n));n.signal||(r=t.isString(r)?t.splitAccessPath(r).map(t.stringValue).join("]["):e(r));return i+"["+r+"]"}(t.isObject(e)?e:{datum:e})}function L(e,n,i,a,r,s){const l={};(s=s||{}).encoders={$encode:l},e=function(e,n,i,a,r){const s={},l={};let o,u,c,d;for(u in u="lineBreak","text"!==n||null==r[u]||f(u,e)||V(s,u,r[u]),("legend"==i||String(i).startsWith("axis"))&&(i=null),d=i===m?r.group:i===g?t.extend({},r.mark,r[n]):null,d)c=f(u,e)||("fill"===u||"stroke"===u)&&(f("fill",e)||f("stroke",e)),c||V(s,u,d[u]);for(u in t.array(a).forEach(t=>{const n=r.style&&r.style[t];for(const t in n)f(t,e)||V(s,t,n[t])}),e=t.extend({},e),s)d=s[u],d.signal?(o=o||{})[u]=d:l[u]=d;return e.enter=t.extend(l,e.enter),o&&(e.update=t.extend(o,e.update)),e}(e,n,i,a,r.config);for(const t in e)l[t]=F(e[t],n,s,r);return s}function F(e,n,i,a){const r={},s={};for(const n in e)null!=e[n]&&(r[n]=A((l=e[n],t.isArray(l)?function(e){let n="";return e.forEach(e=>{const t=E(e);n+=e.test?`(${e.test})?${t}:`:t}),":"===t.peek(n)&&(n+="null"),n}(l):E(l)),a,i,s));var l;return{$expr:{marktype:n,channels:r},$fields:Object.keys(s),$output:Object.keys(e)}}function A(e,i,a,r){const s=n.parseExpression(e,i);return s.$fields.forEach(e=>r[e]=1),t.extend(a,s.$params),s.$expr}const T=["value","update","init","react","bind"];function B(e,n){t.error(e+' for "outer" push: '+t.stringValue(n))}function U(e,t){const n=e.name;if("outer"===e.push)t.signals[n]||B("No prior signal definition",n),T.forEach(t=>{void 0!==e[t]&&B("Invalid property ",t)});else{const i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function M(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function q(e,t,n,i){return new M(e,t,n,i)}function H(e,t){return q("operator",e,t)}function I(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function X(e,t){return t?{$field:e,$name:t}:{$field:e}}const Y=X("key");function N(e,t){return{$compare:e,$order:t}}function G(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const Q="scope",J="view";function K(e){return e&&e.signal}function Z(e){if(K(e))return!0;if(t.isObject(e))for(const t in e)if(Z(e[t]))return!0;return!1}function ee(e,t){return null!=e?e:t}function te(e){return e&&e.signal||e}const ne="timer";function ie(e,n){return(e.merge?ae:e.stream?re:e.type?se:t.error("Invalid stream specification: "+t.stringValue(e)))(e,n)}function ae(e,t){const n=le({merge:e.merge.map(e=>ie(e,t))},e,t);return t.addStream(n).id}function re(e,t){const n=le({stream:ie(e.stream,t)},e,t);return t.addStream(n).id}function se(e,t){let n;var i;e.type===ne?(n=t.event(ne,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===Q?J:i||J,e.type);const a=le({stream:n},e,t);return 1===Object.keys(a).length?n:t.addStream(a).id}function le(e,i,a){let r=i.between;return r&&(2!==r.length&&t.error('Stream "between" parameter must have 2 entries: '+t.stringValue(i)),e.between=[ie(r[0],a),ie(r[1],a)]),r=i.filter?[].concat(i.filter):[],(i.marktype||i.markname||i.markrole)&&r.push(function(e,t,n){const i="event.item";return i+(e&&"*"!==e?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}(i.marktype,i.markname,i.markrole)),i.source===Q&&r.push("inScope(event.item)"),r.length&&(e.filter=n.parseExpression("("+r.join(")&&(")+")",a).$expr),null!=(r=i.throttle)&&(e.throttle=+r),null!=(r=i.debounce)&&(e.debounce=+r),i.consume&&(e.consume=!0),e}const oe={code:"_.$value",ast:{type:"Identifier",value:"value"}};function ue(e,a,r){const s=e.encode,l={target:r};let o=e.events,u=e.update,c=[];o||t.error("Signal update missing events specification."),t.isString(o)&&(o=i.selector(o,a.isSubscope()?Q:J)),o=t.array(o).filter(e=>e.signal||e.scale?(c.push(e),0):1),c.length>1&&(c=[ce(c)]),o.length&&c.push(o.length>1?{merge:o}:o[0]),null!=s&&(u&&t.error("Signal encode and update are mutually exclusive."),u="encode(item(),"+t.stringValue(s)+")"),l.update=t.isString(u)?n.parseExpression(u,a):null!=u.expr?n.parseExpression(u.expr,a):null!=u.value?u.value:null!=u.signal?{$expr:oe,$params:{$value:a.signalRef(u.signal)}}:t.error("Invalid signal update specification."),e.force&&(l.options={force:!0}),c.forEach(e=>a.addUpdate(t.extend(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):ie(e,t)}}(e,a),l)))}function ce(e){return{signal:"["+e.map(e=>e.scale?'scale("'+e.scale+'")':e.signal)+"]"}}function de(e,i){const a=i.getSignal(e.name);let r=e.update;e.init&&(r?t.error("Signals can not include both init and update expressions."):(r=e.init,a.initonly=!0)),r&&(r=n.parseExpression(r,i),a.update=r.$expr,a.params=r.$params),e.on&&e.on.forEach(e=>ue(e,i,a.id))}const pe=e=>(t,n,i)=>q(e,n,t||void 0,i),fe=pe("aggregate"),ge=pe("axisticks"),me=pe("bound"),he=pe("collect"),ye=pe("compare"),be=pe("datajoin"),xe=pe("encode"),ke=pe("expression"),ve=pe("facet"),$e=pe("field"),Se=pe("key"),Oe=pe("legendentries"),Re=pe("load"),je=pe("mark"),we=pe("multiextent"),ze=pe("multivalues"),De=pe("overlap"),Ve=pe("params"),Pe=pe("prefacet"),Ee=pe("projection"),_e=pe("proxy"),Ce=pe("relay"),We=pe("render"),Le=pe("scale"),Fe=pe("sieve"),Ae=pe("sortitems"),Te=pe("viewlayout"),Be=pe("values");let Ue=0;const Me={min:"min",max:"max",count:"sum"};function qe(e,n){const i=n.getScale(e.name).params;let r;var s;for(r in i.domain=Ye(e.domain,e,n),null!=e.range&&(i.range=function e(n,i,r){const s=i.config.range;let l=n.range;if(l.signal)return i.signalRef(l.signal);if(t.isString(l)){if(s&&t.hasOwnProperty(s,l))return e(n=t.extend({},n,{range:s[l]}),i,r);"width"===l?l=[0,{signal:"width"}]:"height"===l?l=a.isDiscrete(n.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+t.stringValue(l))}else{if(l.scheme)return r.scheme=t.isArray(l.scheme)?Ie(l.scheme,i):He(l.scheme,i),l.extent&&(r.schemeExtent=Ie(l.extent,i)),void(l.count&&(r.schemeCount=He(l.count,i)));if(l.step)return void(r.rangeStep=He(l.step,i));if(a.isDiscrete(n.type)&&!t.isArray(l))return Ye(l,n,i);t.isArray(l)||t.error("Unsupported range type: "+t.stringValue(l))}return l.map(e=>(t.isArray(e)?Ie:He)(e,i))}(e,n,i)),null!=e.interpolate&&function(e,t){t.interpolate=He(e.type||e),null!=e.gamma&&(t.interpolateGamma=He(e.gamma))}(e.interpolate,i),null!=e.nice&&(i.nice=(s=e.nice,t.isObject(s)?{interval:He(s.interval),step:He(s.step)}:He(s))),null!=e.bins&&(i.bins=function(e,n){return e.signal||t.isArray(e)?Ie(e,n):n.objectProperty(e)}(e.bins,n)),e)t.hasOwnProperty(i,r)||"name"===r||(i[r]=He(e[r],n))}function He(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+t.stringValue(e)):e}function Ie(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>He(e,t))}function Xe(e){t.error("Can not find data set: "+t.stringValue(e))}function Ye(e,n,i){if(e)return e.signal?i.signalRef(e.signal):(t.isArray(e)?Ne:e.fields?Qe:Ge)(e,n,i);null==n.domainMin&&null==n.domainMax||t.error("No scale domain defined for domainMin/domainMax to override.")}function Ne(e,t,n){return e.map(e=>He(e,n))}function Ge(e,t,n){const i=n.getData(e.data);return i||Xe(e.data),a.isDiscrete(t.type)?i.valuesRef(n,e.field,Ke(e.sort,!1)):a.isQuantile(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function Qe(e,n,i){const r=e.data,s=e.fields.reduce((e,n)=>(n=t.isString(n)?{data:r,field:n}:t.isArray(n)||n.signal?function(e,n){const i="_:vega:_"+Ue++,a=he({});if(t.isArray(e))a.value={$ingest:e};else if(e.signal){const r="setdata("+t.stringValue(i)+","+e.signal+")";a.params.input=n.signalRef(r)}return n.addDataPipeline(i,[a,Fe({})]),{data:i,field:"data"}}(n,i):n,e.push(n),e),[]);return(a.isDiscrete(n.type)?Je:a.isQuantile(n.type)?Ze:et)(e,i,s)}function Je(e,t,n){const i=Ke(e.sort,!0);let a,r;const s=n.map(e=>{const n=t.getData(e.data);return n||Xe(e.data),n.countsRef(t,e.field,i)}),l={groupby:Y,pulse:s};i&&(a=i.op||"count",r=i.field?G(a,i.field):"count",l.ops=[Me[a]],l.fields=[t.fieldRef(r)],l.as=[r]),a=t.add(fe(l));const o=t.add(he({pulse:I(a)}));return r=t.add(Be({field:Y,sort:t.sortRef(i),pulse:I(o)})),I(r)}function Ke(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field&&e.op&&!Me[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 Ze(e,t,n){const i=n.map(e=>{const n=t.getData(e.data);return n||Xe(e.data),n.domainRef(t,e.field)});return I(t.add(ze({values:i})))}function et(e,t,n){const i=n.map(e=>{const n=t.getData(e.data);return n||Xe(e.data),n.extentRef(t,e.field)});return I(t.add(we({extents:i})))}function tt(e,n,i){return t.isArray(e)?e.map(e=>tt(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 nt="top",it="left",at="right",rt="bottom",st="center",lt="index",ot="label",ut="perc",ct="value",dt="guide-label",pt="guide-title",ft="group-title",gt="group-subtitle",mt="symbol",ht="gradient",yt="discrete",bt="size",xt=[bt,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],kt={name:1,style:1,interactive:1},vt={value:0},$t={value:1},St="group",Ot="rect",Rt="rule",jt="text";function wt(e){return e.type=St,e.interactive=e.interactive||!1,e}function zt(e,t){const n=(n,i)=>ee(e[n],ee(t[n],i));return n.isVertical=n=>"vertical"===ee(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>ee(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>ee(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>ee(e.columns,ee(t.columns,+n.isVertical(!0))),n}function Dt(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function Vt(e,t,n){return`item.anchor === 'start' ? ${e} : item.anchor === 'end' ? ${t} : ${n}`}const Pt=Vt(t.stringValue(it),t.stringValue(at),t.stringValue(st));function Et(e,n){return n?e?t.isObject(e)?Object.assign({},e,{offset:Et(e.offset,n)}):{value:e,offset:n}:n:e}function _t(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=p(e.encode,t,kt)):e.interactive=!1,e}function Ct(e,n,i,a){const r=zt(e,i),s=r.isVertical(),l=r.gradientThickness(),o=r.gradientLength();let c,p,f,g,m;s?(p=[0,1],f=[0,0],g=l,m=o):(p=[0,0],f=[1,0],g=o,m=l);const h={enter:c={opacity:vt,x:vt,y:vt,width:u(g),height:u(m)},update:t.extend({},c,{opacity:$t,fill:{gradient:n,start:p,stop:f}}),exit:{opacity:vt}};return d(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),_t({type:Ot,role:"legend-gradient",encode:h},a)}function Wt(e,n,i,a,r){const s=zt(e,i),l=s.isVertical(),o=s.gradientThickness(),c=s.gradientLength();let p,f,g,m,h="";l?(p="y",g="y2",f="x",m="width",h="1-"):(p="x",g="x2",f="y",m="height");const y={opacity:vt,fill:{scale:n,field:ct}};y[p]={signal:h+"datum."+ut,mult:c},y[f]=vt,y[g]={signal:h+"datum.perc2",mult:c},y[m]=u(o);const b={enter:y,update:t.extend({},y,{opacity:$t}),exit:{opacity:vt}};return d(b,{stroke:s("gradientStrokeColor"),strokeWidth:s("gradientStrokeWidth")},{opacity:s("gradientOpacity")}),_t({type:Ot,role:"legend-band",key:ct,from:r,encode:b},a)}function Lt(e,t,n,i){const a=zt(e,t),r=a.isVertical(),s=u(a.gradientThickness()),l=a.gradientLength();let o,c,p,f,g=a("labelOverlap"),m="";const h={enter:o={opacity:vt},update:c={opacity:$t,text:{field:ot}},exit:{opacity:vt}};return d(h,{fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontStyle:a("labelFontStyle"),fontWeight:a("labelFontWeight"),limit:ee(e.labelLimit,t.gradientLabelLimit)}),r?(o.align={value:"left"},o.baseline=c.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},p="y",f="x",m="1-"):(o.align=c.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},o.baseline={value:"top"},p="x",f="y"),o[p]=c[p]={signal:m+"datum."+ut,mult:l},o[f]=c[f]=s,s.offset=ee(e.labelOffset,t.gradientLabelOffset)||0,g=g?{separation:a("labelSeparation"),method:g,order:"datum.index"}:void 0,_t({type:jt,role:R,style:dt,key:ct,from:i,encode:h,overlap:g},n)}function Ft(e,t,n,i,a){const r=zt(e,t),s=n.entries,l=!(!s||!s.interactive),o=s?s.name:void 0,c=r("clipHeight"),f=r("symbolOffset"),g={data:"value"},m=`(${a}) ? datum.offset : datum.size`,y=c?u(c):{field:bt},b="datum.index",x=`max(1, ${a})`;let k,v,$,S,O;y.mult=.5,k={enter:v={opacity:vt,x:{signal:m,mult:.5,offset:f},y:y},update:$={opacity:$t,x:v.x,y:v.y},exit:{opacity:vt}};let w=null,z=null;e.fill||(w=t.symbolBaseFillColor,z=t.symbolBaseStrokeColor),d(k,{fill:r("symbolFillColor",w),shape:r("symbolType"),size:r("symbolSize"),stroke:r("symbolStrokeColor",z),strokeDash:r("symbolDash"),strokeDashOffset:r("symbolDashOffset"),strokeWidth:r("symbolStrokeWidth")},{opacity:r("symbolOpacity")}),xt.forEach(t=>{e[t]&&($[t]=v[t]={scale:e[t],field:ct})});const D=_t({type:"symbol",role:j,key:ct,from:g,clip:!!c||void 0,encode:k},n.symbols),V=u(f);V.offset=r("labelOffset"),k={enter:v={opacity:vt,x:{signal:m,offset:V},y:y},update:$={opacity:$t,text:{field:ot},x:v.x,y:v.y},exit:{opacity:vt}},d(k,{align:r("labelAlign"),baseline:r("labelBaseline"),fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:r("labelLimit")});const P=_t({type:jt,role:R,style:dt,key:ct,from:g,encode:k},n.labels);return k={enter:{noBound:{value:!c},width:vt,height:c?u(c):vt,opacity:vt},exit:{opacity:vt},update:$={opacity:$t,row:{signal:null},column:{signal:null}}},r.isVertical(!0)?(S=`ceil(item.mark.items.length / ${x})`,$.row.signal=`${b}%${S}`,$.column.signal=`floor(${b} / ${S})`,O={field:["row",b]}):($.row.signal=`floor(${b} / ${x})`,$.column.signal=`${b} % ${x}`,O={field:b}),$.column.signal=`(${a})?${$.column.signal}:${b}`,wt({role:h,from:i={facet:{data:i,name:"value",groupby:lt}},encode:p(k,s,kt),marks:[D,P],name:o,interactive:l,sort:O})}const At='item.orient === "left"',Tt='item.orient === "right"',Bt=`(${At} || ${Tt})`,Ut="datum.vgrad && "+Bt,Mt=Vt('"top"','"bottom"','"middle"'),qt=`datum.vgrad && ${Tt} ? (${Vt('"right"','"left"','"center"')}) : (${Bt} && !(datum.vgrad && ${At})) ? "left" : ${Pt}`,Ht=`item._anchor || (${Bt} ? "middle" : "start")`,It=`${Ut} ? (${At} ? -90 : 90) : 0`,Xt=`${Bt} ? (datum.vgrad ? (${Tt} ? "bottom" : "top") : ${Mt}) : "top"`;function Yt(e,n){let i;return t.isObject(e)&&(e.signal?i=e.signal:e.path?i="pathShape("+Nt(e.path)+")":e.sphere&&(i="geoShape("+Nt(e.sphere)+', {type: "Sphere"})')),i?n.signalRef(i):!!e}function Nt(e){return t.isObject(e)&&e.signal?e.signal:t.stringValue(e)}function Gt(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===St?h:t||g:t}function Qt(e){return{marktype:e.type,name:e.name||void 0,role:e.role||Gt(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function Jt(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function Kt(e,n){const i=r.definition(e.type);i||t.error("Unrecognized transform type: "+t.stringValue(e.type));const a=q(i.type.toLowerCase(),null,Zt(i,e,n));return e.signal&&n.addSignal(e.signal,n.proxy(a)),a.metadata=i.metadata||{},a}function Zt(e,t,n){const i={},a=e.params.length;for(let r=0;r<a;++r){const a=e.params[r];i[a.name]=en(a,t,n)}return i}function en(e,n,i){const 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){const a=n[e.name];return e.array?(t.isArray(a)||t.error("Expected an array of sub-parameters. Instead: "+t.stringValue(a)),a.map(t=>nn(e,t,i))):nn(e,a,i)}(e,n,i):"projection"===a?i.projectionRef(n[e.name]):e.array&&!K(r)?r.map(t=>tn(e,t,i)):tn(e,r,i):void(e.required&&t.error("Missing required "+t.stringValue(n.type)+" parameter: "+t.stringValue(e.name)))}function tn(e,i,a){const r=e.type;if(K(i))return ln(r)?t.error("Expression references can not be signals."):on(r)?a.fieldRef(i):un(r)?a.compareRef(i):a.signalRef(i.signal);{const t=e.expr||on(r);return t&&an(i)?a.exprRef(i.expr,i.as):t&&rn(i)?X(i.field,i.as):ln(r)?n.parseExpression(i,a):sn(r)?I(a.getData(i).values):on(r)?X(i):un(r)?a.compareRef(i):i}}function nn(e,n,i){const a=e.params.length;let r;for(let t=0;t<a;++t){r=e.params[t];for(const e in r.key)if(r.key[e]!==n[e]){r=null;break}if(r)break}r||t.error("Unsupported parameter: "+t.stringValue(n));const s=t.extend(Zt(r,n,i),r.key);return I(i.add(Ve(s)))}const an=e=>e&&e.expr,rn=e=>e&&e.field,sn=e=>"data"===e,ln=e=>"expr"===e,on=e=>"field"===e,un=e=>"compare"===e;function cn(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:I(t.getData(e.data).output)}function dn(e,t,n,i,a){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=a,this.index={}}function pn(e){return t.isString(e)?e:null}function fn(e,t,n){const i=G(n.op,n.field);let a;if(t.ops){for(let e=0,n=t.as.length;e<n;++e)if(t.as[e]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((a=n.op.signal)?e.signalRef(a):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function gn(e,n,i,a,r,s,l){const o=n[i]||(n[i]={}),u=function(e){return t.isObject(e)?("descending"===e.order?"-":"+")+G(e.op,e.field):""}(s);let c,d,p=pn(r);if(null!=p&&(e=n.scope,p+=u?"|"+u:"",c=o[p]),!c){const t=s?{field:Y,pulse:n.countsRef(e,r,s)}:{field:e.fieldRef(r),pulse:I(n.output)};u&&(t.sort=e.sortRef(s)),d=e.add(q(a,void 0,t)),l&&(n.index[r]=d),c=I(d),null!=p&&(o[p]=c)}return c}function mn(e,t,i){const a=e.remove,r=e.insert,s=e.toggle,l=e.modify,o=e.values,u=t.add(H()),c="if("+e.trigger+',modify("'+i+'",'+[r,a,s,l,o].map(e=>null==e?"null":e).join(",")+"),0)",d=n.parseExpression(c,t);u.update=d.$expr,u.params=d.$params}function hn(e,n){const i=Gt(e),a=e.type===St,r=e.from&&e.from.facet,s=e.overlap;let l,o,u,c,d,p,f,y=e.layout||i===h||i===m;const b=i===g||y||r,x=function(e,n,i){let a,r,s,l,o;return e?(a=e.facet)&&(n||t.error("Only group marks can be faceted."),null!=a.field?l=o=cn(a,i):(e.data?o=I(i.getData(e.data).aggregate):(s=Kt(t.extend({type:"aggregate",groupby:t.array(a.groupby)},a.aggregate),i),s.params.key=i.keyRef(a.groupby),s.params.pulse=cn(a,i),l=o=I(i.add(s))),r=i.keyRef(a.groupby,!0))):l=I(i.add(he(null,[{}]))),l||(l=cn(e,i)),{key:r,pulse:l,parent:o}}(e.from,a,n);o=n.add(be({key:x.key||(e.key?X(e.key):void 0),pulse:x.pulse,clean:!a}));const k=I(o);o=u=n.add(he({pulse:k})),o=n.add(je({markdef:Qt(e),interactive:Jt(e.interactive,n),clip:Yt(e.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:I(o)}));const v=I(o);o=c=n.add(xe(L(e.encode,e.type,i,e.style,n,{mod:!1,pulse:v}))),o.params.parent=n.encode(),e.transform&&e.transform.forEach(e=>{const i=Kt(e,n),a=i.metadata;(a.generates||a.changes)&&t.error("Mark transforms should not generate new data."),a.nomod||(c.params.mod=!0),i.params.pulse=I(o),n.add(o=i)}),e.sort&&(o=n.add(Ae({sort:n.compareRef(e.sort),pulse:I(o)})));const $=I(o);(r||y)&&(y=n.add(Te({layout:n.objectProperty(e.layout),legends:n.legends,mark:v,pulse:$})),p=I(y));const S=n.add(me({mark:v,pulse:p||$}));f=I(S),a&&(b&&(l=n.operators,l.pop(),y&&l.pop()),n.pushState($,p||f,k),r?function(e,n,i){const a=e.from.facet,r=a.name,s=cn(a,n);let l;a.name||t.error("Facet must have a name: "+t.stringValue(a)),a.data||t.error("Facet must reference a data set: "+t.stringValue(a)),a.field?l=n.add(Pe({field:n.fieldRef(a.field),pulse:s})):a.groupby?l=n.add(ve({key:n.keyRef(a.groupby),group:I(n.proxy(i.parent)),pulse:s})):t.error("Facet must specify groupby or field: "+t.stringValue(a));const o=n.fork(),u=o.add(he()),c=o.add(Fe({pulse:I(u)}));o.addData(r,new dn(o,u,u,c)),o.addSignal("parent",null),l.params.subflow={$subflow:o.parse(e).toRuntime()}}(e,n,x):b?function(e,t,n){const i=t.add(Pe({pulse:n.pulse})),a=t.fork();a.add(Fe()),a.addSignal("parent",null),i.params.subflow={$subflow:a.parse(e).toRuntime()}}(e,n,x):n.parse(e),n.popState(),b&&(y&&l.push(y),l.push(S))),s&&(f=function(e,t,n){const i=e.method,a=e.bound,r=e.separation,s={separation:K(r)?n.signalRef(r.signal):r,method:K(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(s.sort=n.compareRef({field:e.order}));if(a){const e=a.tolerance;s.boundTolerance=K(e)?n.signalRef(e.signal):+e,s.boundScale=n.scaleRef(a.scale),s.boundOrient=a.orient}return I(n.add(De(s)))}(s,f,n));const O=n.add(We({pulse:f})),R=n.add(Fe({pulse:I(O)},void 0,n.parent()));null!=e.name&&(d=e.name,n.addData(d,new dn(n,u,O,R)),e.on&&e.on.forEach(e=>{(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),mn(e,n,d)}))}function yn(e,i){const r=i.config.legend,s=e.encode||{},l=zt(e,r),o=s.legend||{},u=o.name||void 0,c=o.interactive,f=o.style,g={};let m,h,y,b=0;xt.forEach(t=>e[t]?(g[t]=e[t],b=b||e[t]):0),b||t.error("Missing valid scale for legend.");const x=function(e,t){let n=e.type||mt;e.type||1!==function(e){return xt.reduce((t,n)=>t+(e[n]?1:0),0)}(e)||!e.fill&&!e.stroke||(n=a.isContinuous(t)?ht:a.isDiscretizing(t)?yt:mt);return n!==ht?n:a.isDiscretizing(t)?yt:ht}(e,i.scaleType(b)),k={title:null!=e.title,scales:g,type:x,vgrad:"symbol"!==x&&l.isVertical()},v=I(i.add(he(null,[k]))),$=I(i.add(Oe(h={type:x,scale:i.scaleRef(b),count:i.objectProperty(l("tickCount")),limit:i.property(l("symbolLimit")),values:i.objectProperty(e.values),minstep:i.property(e.tickMinStep),formatType:i.property(e.formatType),formatSpecifier:i.property(e.format)})));return x===ht?(y=[Ct(e,b,r,s.gradient),Lt(e,r,s.labels,$)],h.count=h.count||i.signalRef(`max(2,2*floor((${te(l.gradientLength())})/100))`)):x===yt?y=[Wt(e,b,r,s.gradient,$),Lt(e,r,s.labels,$)]:(m=function(e,t){const n=zt(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,r),y=[Ft(e,r,s,$,te(m.columns))],h.size=function(e,t,i){const a=te(xn("size",e,i)),r=te(xn("strokeWidth",e,i)),s=te(function(e,t,n){return Dt("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(i[1].encode,t,dt));return n.parseExpression(`max(ceil(sqrt(${a})+${r}),${s})`,t)}(e,i,y[0].marks)),y=[wt({role:O,from:v,encode:{enter:{x:{value:0},y:{value:0}}},marks:y,layout:m,interactive:c})],k.title&&y.push(function(e,t,n,i){const a=zt(e,t),r={enter:{opacity:vt},update:{opacity:$t,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:vt}};return d(r,{orient:a("titleOrient"),_anchor:a("titleAnchor"),anchor:{signal:Ht},angle:{signal:It},align:{signal:qt},baseline:{signal:Xt},text:e.title,fill:a("titleColor"),fillOpacity:a("titleOpacity"),font:a("titleFont"),fontSize:a("titleFontSize"),fontStyle:a("titleFontStyle"),fontWeight:a("titleFontWeight"),limit:a("titleLimit"),lineHeight:a("titleLineHeight")},{align:a("titleAlign"),baseline:a("titleBaseline")}),_t({type:jt,role:w,style:pt,from:i,encode:r},n)}(e,r,s.title,v)),hn(wt({role:S,from:v,encode:p(bn(l,e,r),o,kt),marks:y,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:u,interactive:c,style:f}),i)}function bn(e,t,n){const i={enter:{},update:{}};return d(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function xn(e,t,n){return t[e]?`scale("${t[e]}",datum)`:Dt(e,n[0].encode)}dn.fromEntries=function(e,t){const n=t.length,i=t[n-1],a=t[n-2];let r=t[0],s=null,l=1;for(r&&"load"===r.type&&(r=t[1]),e.add(t[0]);l<n;++l)t[l].params.pulse=I(t[l-1]),e.add(t[l]),"aggregate"===t[l].type&&(s=t[l]);return new dn(e,r,a,i,s)},dn.prototype={countsRef(e,t,n){const i=this,a=i.counts||(i.counts={}),r=pn(t);let s,l,o;return null!=r&&(e=i.scope,s=a[r]),s?n&&n.field&&fn(e,s.agg.params,n):(o={groupby:e.fieldRef(t,"key"),pulse:I(i.output)},n&&n.field&&fn(e,o,n),l=e.add(fe(o)),s=e.add(he({pulse:I(l)})),s={agg:l,ref:I(s)},null!=r&&(a[r]=s)),s.ref},tuplesRef(){return I(this.values)},extentRef(e,t){return gn(e,this,"extent","extent",t,!1)},domainRef(e,t){return gn(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return gn(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return gn(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return gn(e,this,"indata","tupleindex",t,!0,!0)}};function kn(e,n){const i=zt(e=t.isString(e)?{text:e}:e,n.config.title),a=e.encode||{},r=a.group||{},s=r.name||void 0,l=r.interactive,o=r.style,u=[],c=I(n.add(he(null,[{}])));return u.push(function(e,t,n,i){const a={value:0},r=e.text,s={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return d(s,{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")}),_t({type:jt,role:z,style:ft,from:i,encode:s},n)}(e,i,function(e){const n=e.encode;return n&&n.title||t.extend({name:e.name,interactive:e.interactive,style:e.style},n)}(e),c)),e.subtitle&&u.push(function(e,t,n,i){const a={value:0},r=e.subtitle,s={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return d(s,{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")}),_t({type:jt,role:D,style:gt,from:i,encode:s},n)}(e,i,a.subtitle,c)),hn(wt({role:"title",from:c,encode:vn(i,r),marks:u,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:s,interactive:l,style:o}),n)}function vn(e,t){const n={enter:{},update:{}};return d(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:Pt},angle:{signal:'item.orient==="left"?-90:item.orient==="right"?90:0'},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),p(n,t,kt)}function $n(e,n){const i=[];e.transform&&e.transform.forEach(e=>{i.push(Kt(e,n))}),e.on&&e.on.forEach(t=>{mn(t,n,e.name)}),n.addDataPipeline(e.name,function(e,n,i){const a=[];let r,s,l,o,u,c=null,d=!1,p=!1;e.values?Z(e.values)||Z(e.format)?(a.push(On(n,e)),a.push(c=Sn())):a.push(c=Sn({$ingest:e.values,$format:e.format})):e.url?Z(e.url)||Z(e.format)?(a.push(On(n,e)),a.push(c=Sn())):a.push(c=Sn({$request:e.url,$format:e.format})):e.source&&(c=r=t.array(e.source).map(e=>I(n.getData(e).output)),a.push(null));for(s=0,l=i.length;s<l;++s)o=i[s],u=o.metadata,c||u.source||a.push(c=Sn()),a.push(o),u.generates&&(p=!0),u.modifies&&!p&&(d=!0),u.source?c=o:u.changes&&(c=null);r&&(l=r.length-1,a[0]=Ce({derive:d,pulse:l?r:r[0]}),(d||l)&&a.splice(1,0,Sn()));c||a.push(Sn());return a.push(Fe({})),a}(e,n,i))}function Sn(e){const t=he({},e);return t.metadata={source:!0},t}function On(e,t){return Re({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)})}const Rn=e=>e===rt||e===nt,jn=(e,t,n)=>K(e)?En(e.signal,t,n):e===it||e===nt?t:n,wn=(e,t,n)=>K(e)?Vn(e.signal,t,n):Rn(e)?t:n,zn=(e,t,n)=>K(e)?Pn(e.signal,t,n):Rn(e)?n:t,Dn=(e,t,n)=>K(e)?_n(e.signal,t,n):e===nt?{value:t}:{value:n},Vn=(e,t,n)=>Wn(`${e} === 'top' || ${e} === 'bottom'`,t,n),Pn=(e,t,n)=>Wn(`${e} !== 'top' && ${e} !== 'bottom'`,t,n),En=(e,t,n)=>Fn(`${e} === 'left' || ${e} === 'top'`,t,n),_n=(e,t,n)=>Fn(e+" === 'top'",t,n),Cn=(e,t,n)=>Fn(e+" === 'right'",t,n),Wn=(e,n,i)=>(n=null!=n?u(n):n,i=null!=i?u(i):i,Ln(n)&&Ln(i)?{signal:`${e} ? (${n=n?n.signal||t.stringValue(n.value):null}) : (${i=i?i.signal||t.stringValue(i.value):null})`}:[t.extend({test:e},n)].concat(i||[])),Ln=e=>null==e||1===Object.keys(e).length,Fn=(e,t,n)=>({signal:`${e} ? (${An(t)}) : (${An(n)})`}),An=e=>K(e)?e.signal:null==e?null:t.stringValue(e),Tn=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function Bn(e,n,i,a){let r;if(n&&t.hasOwnProperty(n,e))return n[e];if(t.hasOwnProperty(i,e))return i[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return a["guide-title"][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return a["guide-label"][r]}return null}function Un(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function Mn(e,t){return{scale:e.scale,range:t}}function qn(e,n,i,a,r){const s=zt(e,n),l=e.orient,o=e.gridScale,u=jn(l,1,-1),c=function(e,n){if(1===n);else if(t.isObject(e)){let i=e=t.extend({},e);for(;null!=i.mult;){if(!t.isObject(i.mult))return i.mult=K(n)?{signal:`(${i.mult}) * (${n.signal})`}:i.mult*n,e;i=i.mult=t.extend({},i.mult)}i.mult=n}else e=K(n)?{signal:`(${n.signal}) * (${e||0})`}:n*(e||0);return e}(e.offset,u);let p,f,g;const m={enter:p={opacity:vt},update:g={opacity:$t},exit:f={opacity:vt}};d(m,{stroke:s("gridColor"),strokeCap:s("gridCap"),strokeDash:s("gridDash"),strokeDashOffset:s("gridDashOffset"),strokeOpacity:s("gridOpacity"),strokeWidth:s("gridWidth")});const h={scale:e.scale,field:ct,band:r.band,extra:r.extra,offset:r.offset,round:s("tickRound")},y=wn(l,{signal:"height"},{signal:"width"}),b=o?{scale:o,range:0,mult:u,offset:c}:{value:0,offset:c},k=o?{scale:o,range:1,mult:u,offset:c}:t.extend(y,{mult:u,offset:c});return p.x=g.x=wn(l,h,b),p.y=g.y=zn(l,h,b),p.x2=g.x2=zn(l,k),p.y2=g.y2=wn(l,k),f.x=wn(l,h),f.y=zn(l,h),_t({type:Rt,role:x,key:ct,from:a,encode:m},i)}function Hn(e,t,n,i,a){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+a+")"}}function In(e,t,n,i,a,r){const s=zt(e,t),l=e.orient,o=e.scale,c=jn(l,-1,1),p=te(s("labelFlush")),f=te(s("labelFlushOffset")),g=s("labelAlign"),m=s("labelBaseline");let h,y=0===p||!!p;const b=u(a);b.mult=c,b.offset=u(s("labelPadding")||0),b.offset.mult=c;const x={scale:o,field:ct,band:.5,offset:Et(r.offset,s("labelOffset"))},v=wn(l,y?Hn(o,p,'"left"','"right"','"center"'):{value:"center"},((e,t,n)=>K(e)?Cn(e.signal,t,n):e===at?{value:t}:{value:n})(l,"left","right")),$=wn(l,Dn(l,"bottom","top"),y?Hn(o,p,'"top"','"bottom"','"middle"'):{value:"middle"}),S=Hn(o,p,`-(${f})`,f,0);y=y&&f;const O={opacity:vt,x:wn(l,x,b),y:zn(l,x,b)},R={enter:O,update:h={opacity:$t,text:{field:ot},x:O.x,y:O.y,align:v,baseline:$},exit:{opacity:vt,x:O.x,y:O.y}};d(R,{dx:!g&&y?wn(l,S):null,dy:!m&&y?zn(l,S):null}),d(R,{angle:s("labelAngle"),fill:s("labelColor"),fillOpacity:s("labelOpacity"),font:s("labelFont"),fontSize:s("labelFontSize"),fontWeight:s("labelFontWeight"),fontStyle:s("labelFontStyle"),limit:s("labelLimit"),lineHeight:s("labelLineHeight")},{align:g,baseline:m});const j=s("labelBound");let w=s("labelOverlap");return w=w||j?{separation:s("labelSeparation"),method:w,order:"datum.index",bound:j?{scale:o,orient:l,tolerance:j}:null}:void 0,h.align!==v&&(h.align=Tn(h.align,v)),h.baseline!==$&&(h.baseline=Tn(h.baseline,$)),_t({type:jt,role:k,style:dt,key:ct,from:i,encode:R,overlap:w},n)}function Xn(e,n,i,a){const r=zt(e,n),s=e.orient,l=jn(s,-1,1);let o,c;const p={enter:o={opacity:vt,anchor:u(r("titleAnchor",null)),align:{signal:Pt}},update:c=t.extend({},o,{opacity:$t,text:u(e.title)}),exit:{opacity:vt}},g={signal:`lerp(range("${e.scale}"), ${Vt(0,1,.5)})`};return c.x=wn(s,g),c.y=zn(s,g),o.angle=wn(s,vt,((e,t)=>0===t?0:K(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t})(l,90)),o.baseline=wn(s,Dn(s,rt,nt),{value:rt}),c.angle=o.angle,c.baseline=o.baseline,d(p,{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"),angle:r("titleAngle"),baseline:r("titleBaseline")}),function(e,t,n,i){const a=(e,t)=>null!=e?(n.update[t]=Tn(u(e),n.update[t]),!1):!f(t,i),r=a(e("titleX"),"x"),s=a(e("titleY"),"y");n.enter.auto=s===r?u(s):wn(t,u(s),u(r))}(r,s,p,i),p.update.align=Tn(p.update.align,o.align),p.update.angle=Tn(p.update.angle,o.angle),p.update.baseline=Tn(p.update.baseline,o.baseline),_t({type:jt,role:$,style:pt,from:a,encode:p},i)}function Yn(e,n){const i=function(e,n){var i,a,r,s,l,o,u,c,d=n.config,p=d.style,f=d.axis,g="band"===n.scaleType(e.scale)&&d.axisBand,m=e.orient;if(K(m)){const e=Un([d.axisX,d.axisY]),t=Un([d.axisTop,d.axisBottom,d.axisLeft,d.axisRight]);for(r of(i={},e))i[r]=wn(m,Bn(r,d.axisX,f,p),Bn(r,d.axisY,f,p));for(r of(a={},t))a[r]=(s=m.signal,l=Bn(r,d.axisTop,f,p),o=Bn(r,d.axisBottom,f,p),u=Bn(r,d.axisLeft,f,p),c=Bn(r,d.axisRight,f,p),{signal:(null!=u?`${s} === 'left' ? (${An(u)}) : `:"")+(null!=o?`${s} === 'bottom' ? (${An(o)}) : `:"")+(null!=c?`${s} === 'right' ? (${An(c)}) : `:"")+(null!=l?`${s} === 'top' ? (${An(l)}) : `:"")+"(null)"})}else i=m===nt||m===rt?d.axisX:d.axisY,a=d["axis"+m[0].toUpperCase()+m.slice(1)];return i||a||g?t.extend({},f,i,a,g):f}(e,n),a=e.encode||{},r=a.axis||{},s=r.name||void 0,l=r.interactive,o=r.style,c=zt(e,i),f=function(e){const n=e("tickBand");let i,a,r=e("tickOffset");return n?n.signal?(i={signal:`(${n.signal}) === 'extent' ? 1 : 0.5`},a={signal:`(${n.signal}) === 'extent'`},t.isObject(r)||(r={signal:`(${n.signal}) === 'extent' ? 0 : ${r}`})):"extent"===n?(i=1,a=!0,r=0):(i=.5,a=!1):(i=e("bandPosition"),a=e("tickExtra")),{extra:a,band:i,offset:r}}(c),g={scale:e.scale,ticks:!!c("ticks"),labels:!!c("labels"),grid:!!c("grid"),domain:!!c("domain"),title:null!=e.title},m=I(n.add(he({},[g]))),h=I(n.add(ge({scale:n.scaleRef(e.scale),extra:n.property(f.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)}))),x=[];let k;return g.grid&&x.push(qn(e,i,a.grid,h,f)),g.ticks&&(k=c("tickSize"),x.push(function(e,t,n,i,a,r){const s=zt(e,t),l=e.orient,o=jn(l,-1,1);let c,p,f;const g={enter:c={opacity:vt},update:f={opacity:$t},exit:p={opacity:vt}};d(g,{stroke:s("tickColor"),strokeCap:s("tickCap"),strokeDash:s("tickDash"),strokeDashOffset:s("tickDashOffset"),strokeOpacity:s("tickOpacity"),strokeWidth:s("tickWidth")});const m=u(a);m.mult=o;const h={scale:e.scale,field:ct,band:r.band,extra:r.extra,offset:r.offset,round:s("tickRound")};return f.y=c.y=wn(l,vt,h),f.y2=c.y2=wn(l,m),p.x=wn(l,h),f.x=c.x=zn(l,vt,h),f.x2=c.x2=zn(l,m),p.y=zn(l,h),_t({type:Rt,role:v,key:ct,from:i,encode:g},n)}(e,i,a.ticks,h,k,f))),g.labels&&(k=g.ticks?k:0,x.push(In(e,i,a.labels,h,k,f))),g.domain&&x.push(function(e,t,n,i){const a=zt(e,t),r=e.orient;let s,l;const o={enter:s={opacity:vt},update:l={opacity:$t},exit:{opacity:vt}};d(o,{stroke:a("domainColor"),strokeCap:a("domainCap"),strokeDash:a("domainDash"),strokeDashOffset:a("domainDashOffset"),strokeWidth:a("domainWidth"),strokeOpacity:a("domainOpacity")});const u=Mn(e,0),c=Mn(e,1);return s.x=l.x=wn(r,u,vt),s.x2=l.x2=wn(r,c),s.y=l.y=zn(r,u,vt),s.y2=l.y2=zn(r,c),_t({type:Rt,role:b,from:i,encode:o},n)}(e,i,a.domain,m)),g.title&&x.push(Xn(e,i,a.title,m)),hn(wt({role:y,from:m,encode:p(Nn(c,e),r,kt),marks:x,aria:c("aria"),description:c("description"),zindex:c("zindex"),name:s,interactive:l,style:o}),n)}function Nn(e,t){const n={enter:{},update:{}};return d(n,{orient:e("orient"),offset:e("offset")||0,position:ee(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function Gn(e,n,i){const r=t.array(e.signals),s=t.array(e.scales);return i||r.forEach(e=>U(e,n)),t.array(e.projections).forEach(e=>function(e,t){const n=t.config.projection||{},i={};for(const n in e)"name"!==n&&(i[n]=tt(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=tt(n[e],e,t));t.addProjection(e.name,i)}(e,n)),s.forEach(e=>function(e,n){const i=e.type||"linear";a.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=>$n(e,n)),s.forEach(e=>qe(e,n)),(i||r).forEach(e=>de(e,n)),t.array(e.axes).forEach(e=>Yn(e,n)),t.array(e.marks).forEach(e=>hn(e,n)),t.array(e.legends).forEach(e=>yn(e,n)),e.title&&kn(e.title,n),n.parseLambdas(),n}function Qn(e,n){const i=n.config,a=I(n.root=n.add(H())),r=function(e,n){const i=t=>ee(e[t],n[t]),a=[Jn("background",i("background")),Jn("autosize",s(i("autosize"))),Jn("padding",o(i("padding"))),Jn("width",i("width")||0),Jn("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,i);r.forEach(e=>U(e,n)),n.description=e.description||i.description,n.eventConfig=i.events,n.legends=n.objectProperty(i.legend&&i.legend.layout),n.locale=i.locale;const l=n.add(he()),u=n.add(xe(L((e=>p({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e))(e.encode),St,m,e.style,n,{pulse:I(l)}))),c=n.add(Te({layout:n.objectProperty(e.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:a,pulse:I(u)}));n.operators.pop(),n.pushState(I(u),I(c),null),Gn(e,n,r),n.operators.push(c);let d=n.add(me({mark:a,pulse:I(c)}));return d=n.add(We({pulse:I(d)})),d=n.add(Fe({pulse:I(d)})),n.addData("root",new dn(n,l,l,d)),n}function Jn(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function Kn(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function Zn(e){this.config=e.config,this.options=e.options,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}function ei(e){return(t.isArray(e)?ti:ni)(e)}function ti(e){const n=e.length;let i="[";for(let a=0;a<n;++a){const n=e[a];i+=(a>0?",":"")+(t.isObject(n)?n.signal||ei(n):t.stringValue(n))}return i+"]"}function ni(e){let n,i,a="{",r=0;for(n in e)i=e[n],a+=(++r>1?",":"")+t.stringValue(n)+":"+(t.isObject(i)?i.signal||ei(i):t.stringValue(i));return a+"}"}function ii(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",a="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,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:a}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:i,grid:!1,gridWidth:1,gridColor:a,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:i,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:a,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:i,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"]}}}Kn.prototype=Zn.prototype={parse(e){return Gn(e,this)},fork(){return new Zn(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(t=>{t.$ref=e.id}),e.refs=null),e},proxy(e){const t=e instanceof M?I(e):e;return this.add(_e({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let 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){let i,a;e&&(i=e.data||(e.data={}),a=i[t]||(i[t]=[]),a.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(I(this.add(Fe({pulse:e})))),this._parent.push(t),this._lookup.push(n?I(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return t.peek(this._parent)},encode(){return t.peek(this._encode)},lookup(){return t.peek(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,n){if(t.isString(e))return X(e,n);e.signal||t.error("Unsupported field reference: "+t.stringValue(e));const i=e.signal;let a=this.field[i];if(!a){const e={name:this.signalRef(i)};n&&(e.as=n),this.field[i]=a=I(this.add($e(e)))}return a},compareRef(e){let n=!1;const i=e=>K(e)?(n=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(n=!0,this.exprRef(e.expr)):e,a=t.array(e.field).map(i),r=t.array(e.order).map(i);return n?I(this.add(ye({fields:a,orders:r}))):N(a,r)},keyRef(e,n){let i=!1;const a=this.signals;return e=t.array(e).map(e=>K(e)?(i=!0,I(a[e.signal])):e),i?I(this.add(Se({fields:e,flat:n}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,n)},sortRef(e){if(!e)return e;const t=G(e.op,e.field),n=e.order||"ascending";return n.signal?I(this.add(ye({fields:t,orders:this.signalRef(n.signal)}))):N(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return t.hasOwnProperty(this.signals,e)},addSignal(e,n){this.hasOwnSignal(e)&&t.error("Duplicate signal name: "+t.stringValue(e));const i=n instanceof M?n:this.add(H(n));return this.signals[e]=i},getSignal(e){return this.signals[e]||t.error("Unrecognized signal name: "+t.stringValue(e)),this.signals[e]},signalRef(e){return this.signals[e]?I(this.signals[e]):(t.hasOwnProperty(this.lambdas,e)||(this.lambdas[e]=this.add(H(null))),I(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,i=e.length;t<i;++t){const i=e[t],a=n.parseExpression(i,this),r=this.lambdas[i];r.params=a.$params,r.update=a.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&t.isObject(e)?this.signalRef(e.signal||ei(e)):e},exprRef(e,t){const i={expr:n.parseExpression(e,this)};return t&&(i.expr.$name=t),I(this.add(ke(i)))},addBinding(e,n){this.bindings||t.error("Nested signals do not support binding: "+t.stringValue(e)),this.bindings.push(t.extend({signal:e},n))},addScaleProj(e,n){t.hasOwnProperty(this.scales,e)&&t.error("Duplicate scale or projection name: "+t.stringValue(e)),this.scales[e]=this.add(n)},addScale(e,t){this.addScaleProj(e,Le(t))},addProjection(e,t){this.addScaleProj(e,Ee(t))},getScale(e){return this.scales[e]||t.error("Unrecognized scale name: "+t.stringValue(e)),this.scales[e]},scaleRef(e){return I(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.data[e]=n},getData(e){return this.data[e]||t.error("Undefined data set name: "+t.stringValue(e)),this.data[e]},addDataPipeline(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.addData(e,dn.fromEntries(this,n))}},e.AxisDomainRole=b,e.AxisGridRole=x,e.AxisLabelRole=k,e.AxisRole=y,e.AxisTickRole=v,e.AxisTitleRole=$,e.DataScope=dn,e.FrameRole=m,e.LegendEntryRole=O,e.LegendLabelRole=R,e.LegendRole=S,e.LegendSymbolRole=j,e.LegendTitleRole=w,e.MarkRole=g,e.Scope=Kn,e.ScopeRole=h,e.config=ii,e.parse=function(e,n,i){return t.isObject(e)||t.error("Input Vega specification must be an object."),Qn(e,new Kn(n=t.mergeConfig(ii(),n,e.config),i)).toRuntime()},e.signal=U,e.signalUpdates=de,e.stream=ie,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
var vega=function(e,t,n,a,i,r){"use strict";function o(e){return t.isObject(e)?e:{type:e||"pad"}}const s=e=>+e||0;function l(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}const c=e=>t.isObject(e)&&!t.isArray(e)?t.extend({},e):{value:e};function u(e,n,a,i){if(null!=a){return t.isObject(a)&&!t.isArray(a)||t.isArray(a)&&a.length&&t.isObject(a[0])?e.update[n]=a:e[i||"enter"][n]={value:a},1}return 0}function d(e,t,n){for(const n in t)u(e,n,t[n]);for(const t in n)u(e,t,n[t],"update")}function p(e,n,a){for(const i in n)a&&t.hasOwnProperty(a,i)||(e[i]=t.extend(e[i]||{},n[i]));return e}function f(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const g="mark",m="frame",h="scope",y="axis",b="axis-domain",x="axis-grid",k="axis-label",v="axis-tick",S="axis-title",O="legend",R="legend-entry",j="legend-label",w="legend-symbol",z="legend-title",D="title-text",V="title-subtitle";function E(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const P=e=>t.isString(e)?t.stringValue(e):e.signal?"(".concat(e.signal,")"):L(e);function C(e){if(null!=e.gradient)return function(e){const n=[e.start,e.stop,e.count].map(e=>null==e?null:t.stringValue(e));for(;n.length&&null==t.peek(n);)n.pop();return n.unshift(P(e.gradient)),"gradient(".concat(n.join(","),")")}(e);let n=e.signal?"(".concat(e.signal,")"):e.color?function(e){return e.c?W("hcl",e.h,e.c,e.l):e.h||e.s?W("hsl",e.h,e.s,e.l):e.l||e.a?W("lab",e.l,e.a,e.b):e.r||e.g||e.b?W("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?L(e.field):void 0!==e.value?t.stringValue(e.value):void 0;return null!=e.scale&&(n=function(e,t){const n=P(e.scale);null!=e.range?t="lerp(_range(".concat(n,"), ").concat(+e.range,")"):(void 0!==t&&(t="_scale(".concat(n,", ").concat(t,")")),e.band&&(t=(t?t+"+":"")+"_bandwidth(".concat(n,")")+(1==+e.band?"":"*"+_(e.band)),e.extra&&(t="(datum.extra ? _scale(".concat(n,", datum.extra.value) : ").concat(t,")"))),null==t&&(t="0"));return t}(e,n)),void 0===n&&(n=null),null!=e.exponent&&(n="pow(".concat(n,",").concat(_(e.exponent),")")),null!=e.mult&&(n+="*".concat(_(e.mult))),null!=e.offset&&(n+="+".concat(_(e.offset))),e.round&&(n="round(".concat(n,")")),n}const W=(e,t,n,a)=>"(".concat(e,"(").concat([t,n,a].map(C).join(","),")+'')");function _(e){return t.isObject(e)?"("+C(e)+")":e}function L(e){return $(t.isObject(e)?e:{datum:e})}function $(e){let n,a,i;if(e.signal)n="datum",i=e.signal;else if(e.group||e.parent){for(a=Math.max(1,e.level||1),n="item";a-- >0;)n+=".mark.group";e.parent?(i=e.parent,n+=".datum"):i=e.group}else e.datum?(n="datum",i=e.datum):t.error("Invalid field reference: "+t.stringValue(e));return e.signal||(i=t.isString(i)?t.splitAccessPath(i).map(t.stringValue).join("]["):$(i)),n+"["+i+"]"}function F(e,n,a,i,r,o){const s={};(o=o||{}).encoders={$encode:s},e=function(e,n,a,i,r){const o={},s={};let l,c,u,d;for(c in c="lineBreak","text"!==n||null==r[c]||f(c,e)||E(o,c,r[c]),("legend"==a||String(a).startsWith("axis"))&&(a=null),d=a===m?r.group:a===g?t.extend({},r.mark,r[n]):null,d)u=f(c,e)||("fill"===c||"stroke"===c)&&(f("fill",e)||f("stroke",e)),u||E(o,c,d[c]);for(c in t.array(i).forEach(t=>{const n=r.style&&r.style[t];for(const t in n)f(t,e)||E(o,t,n[t])}),e=t.extend({},e),o)d=o[c],d.signal?(l=l||{})[c]=d:s[c]=d;return e.enter=t.extend(s,e.enter),l&&(e.update=t.extend(l,e.update)),e}(e,n,a,i,r.config);for(const t in e)s[t]=A(e[t],n,o,r);return o}function A(e,n,a,i){const r={},o={};for(const n in e)null!=e[n]&&(r[n]=T((s=e[n],t.isArray(s)?function(e){let n="";return e.forEach(e=>{const t=C(e);n+=e.test?"(".concat(e.test,")?").concat(t,":"):t}),":"===t.peek(n)&&(n+="null"),n}(s):C(s)),i,a,o));var s;return{$expr:{marktype:n,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function T(e,a,i,r){const o=n.parseExpression(e,a);return o.$fields.forEach(e=>r[e]=1),t.extend(i,o.$params),o.$expr}const B=["value","update","init","react","bind"];function U(e,n){t.error(e+' for "outer" push: '+t.stringValue(n))}function M(e,t){const n=e.name;if("outer"===e.push)t.signals[n]||U("No prior signal definition",n),B.forEach(t=>{void 0!==e[t]&&U("Invalid property ",t)});else{const a=t.addSignal(n,e.value);!1===e.react&&(a.react=!1),e.bind&&t.addBinding(n,e.bind)}}function H(e,t,n,a){this.id=-1,this.type=e,this.value=t,this.params=n,a&&(this.parent=a)}function q(e,t,n,a){return new H(e,t,n,a)}function I(e,t){return q("operator",e,t)}function X(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Y(e,t){return t?{$field:e,$name:t}:{$field:e}}const N=Y("key");function G(e,t){return{$compare:e,$order:t}}function Q(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const J="scope",K="view";function Z(e){return e&&e.signal}function ee(e){if(Z(e))return!0;if(t.isObject(e))for(const t in e)if(ee(e[t]))return!0;return!1}function te(e,t){return null!=e?e:t}function ne(e){return e&&e.signal||e}const ae="timer";function ie(e,n){return(e.merge?re:e.stream?oe:e.type?se:t.error("Invalid stream specification: "+t.stringValue(e)))(e,n)}function re(e,t){const n=le({merge:e.merge.map(e=>ie(e,t))},e,t);return t.addStream(n).id}function oe(e,t){const n=le({stream:ie(e.stream,t)},e,t);return t.addStream(n).id}function se(e,t){let n;var a;e.type===ae?(n=t.event(ae,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((a=e.source)===J?K:a||K,e.type);const i=le({stream:n},e,t);return 1===Object.keys(i).length?n:t.addStream(i).id}function le(e,a,i){let r=a.between;return r&&(2!==r.length&&t.error('Stream "between" parameter must have 2 entries: '+t.stringValue(a)),e.between=[ie(r[0],i),ie(r[1],i)]),r=a.filter?[].concat(a.filter):[],(a.marktype||a.markname||a.markrole)&&r.push(function(e,t,n){const a="event.item";return a+(e&&"*"!==e?"&&"+a+".mark.marktype==='"+e+"'":"")+(n?"&&"+a+".mark.role==='"+n+"'":"")+(t?"&&"+a+".mark.name==='"+t+"'":"")}(a.marktype,a.markname,a.markrole)),a.source===J&&r.push("inScope(event.item)"),r.length&&(e.filter=n.parseExpression("("+r.join(")&&(")+")",i).$expr),null!=(r=a.throttle)&&(e.throttle=+r),null!=(r=a.debounce)&&(e.debounce=+r),a.consume&&(e.consume=!0),e}const ce={code:"_.$value",ast:{type:"Identifier",value:"value"}};function ue(e,i,r){const o=e.encode,s={target:r};let l=e.events,c=e.update,u=[];l||t.error("Signal update missing events specification."),t.isString(l)&&(l=a.selector(l,i.isSubscope()?J:K)),l=t.array(l).filter(e=>e.signal||e.scale?(u.push(e),0):1),u.length>1&&(u=[de(u)]),l.length&&u.push(l.length>1?{merge:l}:l[0]),null!=o&&(c&&t.error("Signal encode and update are mutually exclusive."),c="encode(item(),"+t.stringValue(o)+")"),s.update=t.isString(c)?n.parseExpression(c,i):null!=c.expr?n.parseExpression(c.expr,i):null!=c.value?c.value:null!=c.signal?{$expr:ce,$params:{$value:i.signalRef(c.signal)}}:t.error("Invalid signal update specification."),e.force&&(s.options={force:!0}),u.forEach(e=>i.addUpdate(t.extend(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):ie(e,t)}}(e,i),s)))}function de(e){return{signal:"["+e.map(e=>e.scale?'scale("'+e.scale+'")':e.signal)+"]"}}function pe(e,a){const i=a.getSignal(e.name);let r=e.update;e.init&&(r?t.error("Signals can not include both init and update expressions."):(r=e.init,i.initonly=!0)),r&&(r=n.parseExpression(r,a),i.update=r.$expr,i.params=r.$params),e.on&&e.on.forEach(e=>ue(e,a,i.id))}const fe=e=>(t,n,a)=>q(e,n,t||void 0,a),ge=fe("aggregate"),me=fe("axisticks"),he=fe("bound"),ye=fe("collect"),be=fe("compare"),xe=fe("datajoin"),ke=fe("encode"),ve=fe("expression"),Se=fe("facet"),Oe=fe("field"),Re=fe("key"),je=fe("legendentries"),we=fe("load"),ze=fe("mark"),De=fe("multiextent"),Ve=fe("multivalues"),Ee=fe("overlap"),Pe=fe("params"),Ce=fe("prefacet"),We=fe("projection"),_e=fe("proxy"),Le=fe("relay"),$e=fe("render"),Fe=fe("scale"),Ae=fe("sieve"),Te=fe("sortitems"),Be=fe("viewlayout"),Ue=fe("values");let Me=0;const He={min:"min",max:"max",count:"sum"};function qe(e,n){const a=n.getScale(e.name).params;let i;var r;for(i in a.domain=Ne(e.domain,e,n),null!=e.range&&(a.range=nt(e,n,a)),null!=e.interpolate&&function(e,t){t.interpolate=Ie(e.type||e),null!=e.gamma&&(t.interpolateGamma=Ie(e.gamma))}(e.interpolate,a),null!=e.nice&&(a.nice=(r=e.nice,t.isObject(r)?{interval:Ie(r.interval),step:Ie(r.step)}:Ie(r))),null!=e.bins&&(a.bins=function(e,n){return e.signal||t.isArray(e)?Xe(e,n):n.objectProperty(e)}(e.bins,n)),e)t.hasOwnProperty(a,i)||"name"===i||(a[i]=Ie(e[i],n))}function Ie(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+t.stringValue(e)):e}function Xe(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>Ie(e,t))}function Ye(e){t.error("Can not find data set: "+t.stringValue(e))}function Ne(e,n,a){if(e)return e.signal?a.signalRef(e.signal):(t.isArray(e)?Ge:e.fields?Je:Qe)(e,n,a);null==n.domainMin&&null==n.domainMax||t.error("No scale domain defined for domainMin/domainMax to override.")}function Ge(e,t,n){return e.map(e=>Ie(e,n))}function Qe(e,t,n){const a=n.getData(e.data);return a||Ye(e.data),i.isDiscrete(t.type)?a.valuesRef(n,e.field,Ze(e.sort,!1)):i.isQuantile(t.type)?a.domainRef(n,e.field):a.extentRef(n,e.field)}function Je(e,n,a){const r=e.data,o=e.fields.reduce((e,n)=>(n=t.isString(n)?{data:r,field:n}:t.isArray(n)||n.signal?function(e,n){const a="_:vega:_"+Me++,i=ye({});if(t.isArray(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+t.stringValue(a)+","+e.signal+")";i.params.input=n.signalRef(r)}return n.addDataPipeline(a,[i,Ae({})]),{data:a,field:"data"}}(n,a):n,e.push(n),e),[]);return(i.isDiscrete(n.type)?Ke:i.isQuantile(n.type)?et:tt)(e,a,o)}function Ke(e,t,n){const a=Ze(e.sort,!0);let i,r;const o=n.map(e=>{const n=t.getData(e.data);return n||Ye(e.data),n.countsRef(t,e.field,a)}),s={groupby:N,pulse:o};a&&(i=a.op||"count",r=a.field?Q(i,a.field):"count",s.ops=[He[i]],s.fields=[t.fieldRef(r)],s.as=[r]),i=t.add(ge(s));const l=t.add(ye({pulse:X(i)}));return r=t.add(Ue({field:N,sort:t.sortRef(a),pulse:X(l)})),X(r)}function Ze(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field&&e.op&&!He[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 et(e,t,n){const a=n.map(e=>{const n=t.getData(e.data);return n||Ye(e.data),n.domainRef(t,e.field)});return X(t.add(Ve({values:a})))}function tt(e,t,n){const a=n.map(e=>{const n=t.getData(e.data);return n||Ye(e.data),n.extentRef(t,e.field)});return X(t.add(De({extents:a})))}function nt(e,n,a){const r=n.config.range;let o=e.range;if(o.signal)return n.signalRef(o.signal);if(t.isString(o)){if(r&&t.hasOwnProperty(r,o))return nt(e=t.extend({},e,{range:r[o]}),n,a);"width"===o?o=[0,{signal:"width"}]:"height"===o?o=i.isDiscrete(e.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)?Xe(o.scheme,n):Ie(o.scheme,n),o.extent&&(a.schemeExtent=Xe(o.extent,n)),void(o.count&&(a.schemeCount=Ie(o.count,n)));if(o.step)return void(a.rangeStep=Ie(o.step,n));if(i.isDiscrete(e.type)&&!t.isArray(o))return Ne(o,e,n);t.isArray(o)||t.error("Unsupported range type: "+t.stringValue(o))}return o.map(e=>(t.isArray(e)?Xe:Ie)(e,n))}function at(e,n,a){return t.isArray(e)?e.map(e=>at(e,n,a)):t.isObject(e)?e.signal?a.signalRef(e.signal):"fit"===n?e:t.error("Unsupported parameter object: "+t.stringValue(e)):e}const it="top",rt="left",ot="right",st="bottom",lt="center",ct="index",ut="label",dt="perc",pt="value",ft="guide-label",gt="guide-title",mt="group-title",ht="group-subtitle",yt="symbol",bt="gradient",xt="discrete",kt="size",vt=[kt,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],St={name:1,style:1,interactive:1},Ot={value:0},Rt={value:1},jt="group",wt="rect",zt="rule",Dt="text";function Vt(e){return e.type=jt,e.interactive=e.interactive||!1,e}function Et(e,t){const n=(n,a)=>te(e[n],te(t[n],a));return n.isVertical=n=>"vertical"===te(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>te(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>te(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>te(e.columns,te(t.columns,+n.isVertical(!0))),n}function Pt(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function Ct(e,t,n){return"item.anchor === '".concat("start","' ? ").concat(e," : item.anchor === '").concat("end","' ? ").concat(t," : ").concat(n)}const Wt=Ct(t.stringValue(rt),t.stringValue(ot),t.stringValue(lt));function _t(e,n){return n?e?t.isObject(e)?Object.assign({},e,{offset:_t(e.offset,n)}):{value:e,offset:n}:n:e}function Lt(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=p(e.encode,t,St)):e.interactive=!1,e}function $t(e,n,a,i){const r=Et(e,a),o=r.isVertical(),s=r.gradientThickness(),l=r.gradientLength();let u,p,f,g,m;o?(p=[0,1],f=[0,0],g=s,m=l):(p=[0,0],f=[1,0],g=l,m=s);const h={enter:u={opacity:Ot,x:Ot,y:Ot,width:c(g),height:c(m)},update:t.extend({},u,{opacity:Rt,fill:{gradient:n,start:p,stop:f}}),exit:{opacity:Ot}};return d(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),Lt({type:wt,role:"legend-gradient",encode:h},i)}function Ft(e,n,a,i,r){const o=Et(e,a),s=o.isVertical(),l=o.gradientThickness(),u=o.gradientLength();let p,f,g,m,h="";s?(p="y",g="y2",f="x",m="width",h="1-"):(p="x",g="x2",f="y",m="height");const y={opacity:Ot,fill:{scale:n,field:pt}};y[p]={signal:h+"datum."+dt,mult:u},y[f]=Ot,y[g]={signal:h+"datum.perc2",mult:u},y[m]=c(l);const b={enter:y,update:t.extend({},y,{opacity:Rt}),exit:{opacity:Ot}};return d(b,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),Lt({type:wt,role:"legend-band",key:pt,from:r,encode:b},i)}const At="datum.".concat(dt,'<=0?"').concat(rt,'":datum.').concat(dt,'>=1?"').concat(ot,'":"').concat(lt,'"'),Tt="datum.".concat(dt,'<=0?"').concat(st,'":datum.').concat(dt,'>=1?"').concat(it,'":"').concat("middle",'"');function Bt(e,t,n,a){const i=Et(e,t),r=i.isVertical(),o=c(i.gradientThickness()),s=i.gradientLength();let l,u,p,f,g=i("labelOverlap"),m="";const h={enter:l={opacity:Ot},update:u={opacity:Rt,text:{field:ut}},exit:{opacity:Ot}};return d(h,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:te(e.labelLimit,t.gradientLabelLimit)}),r?(l.align={value:"left"},l.baseline=u.baseline={signal:Tt},p="y",f="x",m="1-"):(l.align=u.align={signal:At},l.baseline={value:"top"},p="x",f="y"),l[p]=u[p]={signal:m+"datum."+dt,mult:s},l[f]=u[f]=o,o.offset=te(e.labelOffset,t.gradientLabelOffset)||0,g=g?{separation:i("labelSeparation"),method:g,order:"datum.index"}:void 0,Lt({type:Dt,role:j,style:ft,key:pt,from:a,encode:h,overlap:g},n)}function Ut(e,t,n,a,i){const r=Et(e,t),o=n.entries,s=!(!o||!o.interactive),l=o?o.name:void 0,u=r("clipHeight"),f=r("symbolOffset"),g={data:"value"},m="(".concat(i,") ? datum.").concat("offset"," : datum.").concat(kt),y=u?c(u):{field:kt},b="datum.".concat(ct),x="max(1, ".concat(i,")");let k,v,S,O,R;y.mult=.5,k={enter:v={opacity:Ot,x:{signal:m,mult:.5,offset:f},y:y},update:S={opacity:Rt,x:v.x,y:v.y},exit:{opacity:Ot}};let z=null,D=null;e.fill||(z=t.symbolBaseFillColor,D=t.symbolBaseStrokeColor),d(k,{fill:r("symbolFillColor",z),shape:r("symbolType"),size:r("symbolSize"),stroke:r("symbolStrokeColor",D),strokeDash:r("symbolDash"),strokeDashOffset:r("symbolDashOffset"),strokeWidth:r("symbolStrokeWidth")},{opacity:r("symbolOpacity")}),vt.forEach(t=>{e[t]&&(S[t]=v[t]={scale:e[t],field:pt})});const V=Lt({type:"symbol",role:w,key:pt,from:g,clip:!!u||void 0,encode:k},n.symbols),E=c(f);E.offset=r("labelOffset"),k={enter:v={opacity:Ot,x:{signal:m,offset:E},y:y},update:S={opacity:Rt,text:{field:ut},x:v.x,y:v.y},exit:{opacity:Ot}},d(k,{align:r("labelAlign"),baseline:r("labelBaseline"),fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:r("labelLimit")});const P=Lt({type:Dt,role:j,style:ft,key:pt,from:g,encode:k},n.labels);return k={enter:{noBound:{value:!u},width:Ot,height:u?c(u):Ot,opacity:Ot},exit:{opacity:Ot},update:S={opacity:Rt,row:{signal:null},column:{signal:null}}},r.isVertical(!0)?(O="ceil(item.mark.items.length / ".concat(x,")"),S.row.signal="".concat(b,"%").concat(O),S.column.signal="floor(".concat(b," / ").concat(O,")"),R={field:["row",b]}):(S.row.signal="floor(".concat(b," / ").concat(x,")"),S.column.signal="".concat(b," % ").concat(x),R={field:b}),S.column.signal="(".concat(i,")?").concat(S.column.signal,":").concat(b),Vt({role:h,from:a={facet:{data:a,name:"value",groupby:ct}},encode:p(k,o,St),marks:[V,P],name:l,interactive:s,sort:R})}const Mt='item.orient === "left"',Ht='item.orient === "right"',qt="(".concat(Mt," || ").concat(Ht,")"),It="datum.vgrad && ".concat(qt),Xt=Ct('"top"','"bottom"','"middle"'),Yt=Ct('"right"','"left"','"center"'),Nt="datum.vgrad && ".concat(Ht," ? (").concat(Yt,") : (").concat(qt," && !(datum.vgrad && ").concat(Mt,')) ? "left" : ').concat(Wt),Gt="item._anchor || (".concat(qt,' ? "middle" : "start")'),Qt="".concat(It," ? (").concat(Mt," ? -90 : 90) : 0"),Jt="".concat(qt," ? (datum.vgrad ? (").concat(Ht,' ? "bottom" : "top") : ').concat(Xt,') : "top"');function Kt(e,n){let a;return t.isObject(e)&&(e.signal?a=e.signal:e.path?a="pathShape("+Zt(e.path)+")":e.sphere&&(a="geoShape("+Zt(e.sphere)+', {type: "Sphere"})')),a?n.signalRef(a):!!e}function Zt(e){return t.isObject(e)&&e.signal?e.signal:t.stringValue(e)}function en(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===jt?h:t||g:t}function tn(e){return{marktype:e.type,name:e.name||void 0,role:e.role||en(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function nn(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function an(e,n){const a=r.definition(e.type);a||t.error("Unrecognized transform type: "+t.stringValue(e.type));const i=q(a.type.toLowerCase(),null,rn(a,e,n));return e.signal&&n.addSignal(e.signal,n.proxy(i)),i.metadata=a.metadata||{},i}function rn(e,t,n){const a={},i=e.params.length;for(let r=0;r<i;++r){const i=e.params[r];a[i.name]=on(i,t,n)}return a}function on(e,n,a){const i=e.type,r=n[e.name];return"index"===i?function(e,n,a){t.isString(n.from)||t.error('Lookup "from" parameter must be a string literal.');return a.getData(n.from).lookupRef(a,n.key)}(0,n,a):void 0!==r?"param"===i?function(e,n,a){const i=n[e.name];return e.array?(t.isArray(i)||t.error("Expected an array of sub-parameters. Instead: "+t.stringValue(i)),i.map(t=>ln(e,t,a))):ln(e,i,a)}(e,n,a):"projection"===i?a.projectionRef(n[e.name]):e.array&&!Z(r)?r.map(t=>sn(e,t,a)):sn(e,r,a):void(e.required&&t.error("Missing required "+t.stringValue(n.type)+" parameter: "+t.stringValue(e.name)))}function sn(e,a,i){const r=e.type;if(Z(a))return pn(r)?t.error("Expression references can not be signals."):fn(r)?i.fieldRef(a):gn(r)?i.compareRef(a):i.signalRef(a.signal);{const t=e.expr||fn(r);return t&&cn(a)?i.exprRef(a.expr,a.as):t&&un(a)?Y(a.field,a.as):pn(r)?n.parseExpression(a,i):dn(r)?X(i.getData(a).values):fn(r)?Y(a):gn(r)?i.compareRef(a):a}}function ln(e,n,a){const i=e.params.length;let r;for(let t=0;t<i;++t){r=e.params[t];for(const e in r.key)if(r.key[e]!==n[e]){r=null;break}if(r)break}r||t.error("Unsupported parameter: "+t.stringValue(n));const o=t.extend(rn(r,n,a),r.key);return X(a.add(Pe(o)))}const cn=e=>e&&e.expr,un=e=>e&&e.field,dn=e=>"data"===e,pn=e=>"expr"===e,fn=e=>"field"===e,gn=e=>"compare"===e;function mn(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:X(t.getData(e.data).output)}function hn(e,t,n,a,i){this.scope=e,this.input=t,this.output=n,this.values=a,this.aggregate=i,this.index={}}function yn(e){return t.isString(e)?e:null}function bn(e,t,n){const a=Q(n.op,n.field);let i;if(t.ops){for(let e=0,n=t.as.length;e<n;++e)if(t.as[e]===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 xn(e,n,a,i,r,o,s){const l=n[a]||(n[a]={}),c=function(e){return t.isObject(e)?("descending"===e.order?"-":"+")+Q(e.op,e.field):""}(o);let u,d,p=yn(r);if(null!=p&&(e=n.scope,p+=c?"|"+c:"",u=l[p]),!u){const t=o?{field:N,pulse:n.countsRef(e,r,o)}:{field:e.fieldRef(r),pulse:X(n.output)};c&&(t.sort=e.sortRef(o)),d=e.add(q(i,void 0,t)),s&&(n.index[r]=d),u=X(d),null!=p&&(l[p]=u)}return u}function kn(e,t,a){const i=e.remove,r=e.insert,o=e.toggle,s=e.modify,l=e.values,c=t.add(I()),u="if("+e.trigger+',modify("'+a+'",'+[r,i,o,s,l].map(e=>null==e?"null":e).join(",")+"),0)",d=n.parseExpression(u,t);c.update=d.$expr,c.params=d.$params}function vn(e,n){const a=en(e),i=e.type===jt,r=e.from&&e.from.facet,o=e.overlap;let s,l,c,u,d,p,f,y=e.layout||a===h||a===m;const b=a===g||y||r,x=function(e,n,a){let i,r,o,s,l;return e?(i=e.facet)&&(n||t.error("Only group marks can be faceted."),null!=i.field?s=l=mn(i,a):(e.data?l=X(a.getData(e.data).aggregate):(o=an(t.extend({type:"aggregate",groupby:t.array(i.groupby)},i.aggregate),a),o.params.key=a.keyRef(i.groupby),o.params.pulse=mn(i,a),s=l=X(a.add(o))),r=a.keyRef(i.groupby,!0))):s=X(a.add(ye(null,[{}]))),s||(s=mn(e,a)),{key:r,pulse:s,parent:l}}(e.from,i,n);l=n.add(xe({key:x.key||(e.key?Y(e.key):void 0),pulse:x.pulse,clean:!i}));const k=X(l);l=c=n.add(ye({pulse:k})),l=n.add(ze({markdef:tn(e),interactive:nn(e.interactive,n),clip:Kt(e.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:X(l)}));const v=X(l);l=u=n.add(ke(F(e.encode,e.type,a,e.style,n,{mod:!1,pulse:v}))),l.params.parent=n.encode(),e.transform&&e.transform.forEach(e=>{const a=an(e,n),i=a.metadata;(i.generates||i.changes)&&t.error("Mark transforms should not generate new data."),i.nomod||(u.params.mod=!0),a.params.pulse=X(l),n.add(l=a)}),e.sort&&(l=n.add(Te({sort:n.compareRef(e.sort),pulse:X(l)})));const S=X(l);(r||y)&&(y=n.add(Be({layout:n.objectProperty(e.layout),legends:n.legends,mark:v,pulse:S})),p=X(y));const O=n.add(he({mark:v,pulse:p||S}));f=X(O),i&&(b&&(s=n.operators,s.pop(),y&&s.pop()),n.pushState(S,p||f,k),r?function(e,n,a){const i=e.from.facet,r=i.name,o=mn(i,n);let s;i.name||t.error("Facet must have a name: "+t.stringValue(i)),i.data||t.error("Facet must reference a data set: "+t.stringValue(i)),i.field?s=n.add(Ce({field:n.fieldRef(i.field),pulse:o})):i.groupby?s=n.add(Se({key:n.keyRef(i.groupby),group:X(n.proxy(a.parent)),pulse:o})):t.error("Facet must specify groupby or field: "+t.stringValue(i));const l=n.fork(),c=l.add(ye()),u=l.add(Ae({pulse:X(c)}));l.addData(r,new hn(l,c,c,u)),l.addSignal("parent",null),s.params.subflow={$subflow:l.parse(e).toRuntime()}}(e,n,x):b?function(e,t,n){const a=t.add(Ce({pulse:n.pulse})),i=t.fork();i.add(Ae()),i.addSignal("parent",null),a.params.subflow={$subflow:i.parse(e).toRuntime()}}(e,n,x):n.parse(e),n.popState(),b&&(y&&s.push(y),s.push(O))),o&&(f=function(e,t,n){const a=e.method,i=e.bound,r=e.separation,o={separation:Z(r)?n.signalRef(r.signal):r,method:Z(a)?n.signalRef(a.signal):a,pulse:t};e.order&&(o.sort=n.compareRef({field:e.order}));if(i){const e=i.tolerance;o.boundTolerance=Z(e)?n.signalRef(e.signal):+e,o.boundScale=n.scaleRef(i.scale),o.boundOrient=i.orient}return X(n.add(Ee(o)))}(o,f,n));const R=n.add($e({pulse:f})),j=n.add(Ae({pulse:X(R)},void 0,n.parent()));null!=e.name&&(d=e.name,n.addData(d,new hn(n,c,R,j)),e.on&&e.on.forEach(e=>{(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),kn(e,n,d)}))}function Sn(e,a){const r=a.config.legend,o=e.encode||{},s=Et(e,r),l=o.legend||{},c=l.name||void 0,u=l.interactive,f=l.style,g={};let m,h,y,b=0;vt.forEach(t=>e[t]?(g[t]=e[t],b=b||e[t]):0),b||t.error("Missing valid scale for legend.");const x=function(e,t){let n=e.type||yt;e.type||1!==function(e){return vt.reduce((t,n)=>t+(e[n]?1:0),0)}(e)||!e.fill&&!e.stroke||(n=i.isContinuous(t)?bt:i.isDiscretizing(t)?xt:yt);return n!==bt?n:i.isDiscretizing(t)?xt:bt}(e,a.scaleType(b)),k={title:null!=e.title,scales:g,type:x,vgrad:"symbol"!==x&&s.isVertical()},v=X(a.add(ye(null,[k]))),S=X(a.add(je(h={type:x,scale:a.scaleRef(b),count:a.objectProperty(s("tickCount")),limit:a.property(s("symbolLimit")),values:a.objectProperty(e.values),minstep:a.property(e.tickMinStep),formatType:a.property(e.formatType),formatSpecifier:a.property(e.format)})));return x===bt?(y=[$t(e,b,r,o.gradient),Bt(e,r,o.labels,S)],h.count=h.count||a.signalRef("max(2,2*floor((".concat(ne(s.gradientLength()),")/100))"))):x===xt?y=[Ft(e,b,r,o.gradient,S),Bt(e,r,o.labels,S)]:(m=function(e,t){const n=Et(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,r),y=[Ut(e,r,o,S,ne(m.columns))],h.size=function(e,t,a){const i=ne(Rn("size",e,a)),r=ne(Rn("strokeWidth",e,a)),o=ne(function(e,t,n){return Pt("fontSize",e)||function(e,t,n){const a=t.config.style[n];return a&&a[e]}("fontSize",t,n)}(a[1].encode,t,ft));return n.parseExpression("max(ceil(sqrt(".concat(i,")+").concat(r,"),").concat(o,")"),t)}(e,a,y[0].marks)),y=[Vt({role:R,from:v,encode:{enter:{x:{value:0},y:{value:0}}},marks:y,layout:m,interactive:u})],k.title&&y.push(function(e,t,n,a){const i=Et(e,t),r={enter:{opacity:Ot},update:{opacity:Rt,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:Ot}};return d(r,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:Gt},angle:{signal:Qt},align:{signal:Nt},baseline:{signal:Jt},text:e.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),Lt({type:Dt,role:z,style:gt,from:a,encode:r},n)}(e,r,o.title,v)),vn(Vt({role:O,from:v,encode:p(On(s,e,r),l,St),marks:y,aria:s("aria"),description:s("description"),zindex:s("zindex"),name:c,interactive:u,style:f}),a)}function On(e,t,n){const a={enter:{},update:{}};return d(a,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),a}function Rn(e,t,n){return t[e]?'scale("'.concat(t[e],'",datum)'):Pt(e,n[0].encode)}hn.fromEntries=function(e,t){const n=t.length,a=t[n-1],i=t[n-2];let r=t[0],o=null,s=1;for(r&&"load"===r.type&&(r=t[1]),e.add(t[0]);s<n;++s)t[s].params.pulse=X(t[s-1]),e.add(t[s]),"aggregate"===t[s].type&&(o=t[s]);return new hn(e,r,i,a,o)},hn.prototype={countsRef(e,t,n){const a=this,i=a.counts||(a.counts={}),r=yn(t);let o,s,l;return null!=r&&(e=a.scope,o=i[r]),o?n&&n.field&&bn(e,o.agg.params,n):(l={groupby:e.fieldRef(t,"key"),pulse:X(a.output)},n&&n.field&&bn(e,l,n),s=e.add(ge(l)),o=e.add(ye({pulse:X(s)})),o={agg:s,ref:X(o)},null!=r&&(i[r]=o)),o.ref},tuplesRef(){return X(this.values)},extentRef(e,t){return xn(e,this,"extent","extent",t,!1)},domainRef(e,t){return xn(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return xn(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return xn(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return xn(e,this,"indata","tupleindex",t,!0,!0)}};const jn='item.orient==="'.concat(rt,'"?-90:item.orient==="').concat(ot,'"?90:0');function wn(e,n){const a=Et(e=t.isString(e)?{text:e}:e,n.config.title),i=e.encode||{},r=i.group||{},o=r.name||void 0,s=r.interactive,l=r.style,c=[],u=X(n.add(ye(null,[{}])));return c.push(function(e,t,n,a){const i={value:0},r=e.text,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return d(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")}),Lt({type:Dt,role:D,style:mt,from:a,encode:o},n)}(e,a,function(e){const n=e.encode;return n&&n.title||t.extend({name:e.name,interactive:e.interactive,style:e.style},n)}(e),u)),e.subtitle&&c.push(function(e,t,n,a){const i={value:0},r=e.subtitle,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return d(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")}),Lt({type:Dt,role:V,style:ht,from:a,encode:o},n)}(e,a,i.subtitle,u)),vn(Vt({role:"title",from:u,encode:zn(a,r),marks:c,aria:a("aria"),description:a("description"),zindex:a("zindex"),name:o,interactive:s,style:l}),n)}function zn(e,t){const n={enter:{},update:{}};return d(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:Wt},angle:{signal:jn},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),p(n,t,St)}function Dn(e,n){const a=[];e.transform&&e.transform.forEach(e=>{a.push(an(e,n))}),e.on&&e.on.forEach(t=>{kn(t,n,e.name)}),n.addDataPipeline(e.name,function(e,n,a){const i=[];let r,o,s,l,c,u=null,d=!1,p=!1;e.values?ee(e.values)||ee(e.format)?(i.push(En(n,e)),i.push(u=Vn())):i.push(u=Vn({$ingest:e.values,$format:e.format})):e.url?ee(e.url)||ee(e.format)?(i.push(En(n,e)),i.push(u=Vn())):i.push(u=Vn({$request:e.url,$format:e.format})):e.source&&(u=r=t.array(e.source).map(e=>X(n.getData(e).output)),i.push(null));for(o=0,s=a.length;o<s;++o)l=a[o],c=l.metadata,u||c.source||i.push(u=Vn()),i.push(l),c.generates&&(p=!0),c.modifies&&!p&&(d=!0),c.source?u=l:c.changes&&(u=null);r&&(s=r.length-1,i[0]=Le({derive:d,pulse:s?r:r[0]}),(d||s)&&i.splice(1,0,Vn()));u||i.push(Vn());return i.push(Ae({})),i}(e,n,a))}function Vn(e){const t=ye({},e);return t.metadata={source:!0},t}function En(e,t){return we({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)})}const Pn=e=>e===st||e===it,Cn=(e,t,n)=>Z(e)?An(e.signal,t,n):e===rt||e===it?t:n,Wn=(e,t,n)=>Z(e)?$n(e.signal,t,n):Pn(e)?t:n,_n=(e,t,n)=>Z(e)?Fn(e.signal,t,n):Pn(e)?n:t,Ln=(e,t,n)=>Z(e)?Tn(e.signal,t,n):e===it?{value:t}:{value:n},$n=(e,t,n)=>Un("".concat(e," === '").concat(it,"' || ").concat(e," === '").concat(st,"'"),t,n),Fn=(e,t,n)=>Un("".concat(e," !== '").concat(it,"' && ").concat(e," !== '").concat(st,"'"),t,n),An=(e,t,n)=>Hn("".concat(e," === '").concat(rt,"' || ").concat(e," === '").concat(it,"'"),t,n),Tn=(e,t,n)=>Hn("".concat(e," === '").concat(it,"'"),t,n),Bn=(e,t,n)=>Hn("".concat(e," === '").concat(ot,"'"),t,n),Un=(e,n,a)=>(n=null!=n?c(n):n,a=null!=a?c(a):a,Mn(n)&&Mn(a)?(n=n?n.signal||t.stringValue(n.value):null,a=a?a.signal||t.stringValue(a.value):null,{signal:"".concat(e," ? (").concat(n,") : (").concat(a,")")}):[t.extend({test:e},n)].concat(a||[])),Mn=e=>null==e||1===Object.keys(e).length,Hn=(e,t,n)=>({signal:"".concat(e," ? (").concat(qn(t),") : (").concat(qn(n),")")}),qn=e=>Z(e)?e.signal:null==e?null:t.stringValue(e),In=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function Xn(e,n,a,i){let r;if(n&&t.hasOwnProperty(n,e))return n[e];if(t.hasOwnProperty(a,e))return a[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return i["guide-title"][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i["guide-label"][r]}return null}function Yn(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function Nn(e,t){return{scale:e.scale,range:t}}function Gn(e,n,a,i,r){const o=Et(e,n),s=e.orient,l=e.gridScale,c=Cn(s,1,-1),u=function(e,n){if(1===n);else if(t.isObject(e)){let a=e=t.extend({},e);for(;null!=a.mult;){if(!t.isObject(a.mult))return a.mult=Z(n)?{signal:"(".concat(a.mult,") * (").concat(n.signal,")")}:a.mult*n,e;a=a.mult=t.extend({},a.mult)}a.mult=n}else e=Z(n)?{signal:"(".concat(n.signal,") * (").concat(e||0,")")}:n*(e||0);return e}(e.offset,c);let p,f,g;const m={enter:p={opacity:Ot},update:g={opacity:Rt},exit:f={opacity:Ot}};d(m,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const h={scale:e.scale,field:pt,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},y=Wn(s,{signal:"height"},{signal:"width"}),b=l?{scale:l,range:0,mult:c,offset:u}:{value:0,offset:u},k=l?{scale:l,range:1,mult:c,offset:u}:t.extend(y,{mult:c,offset:u});return p.x=g.x=Wn(s,h,b),p.y=g.y=_n(s,h,b),p.x2=g.x2=_n(s,k),p.y2=g.y2=Wn(s,k),f.x=Wn(s,h),f.y=_n(s,h),Lt({type:zt,role:x,key:pt,from:i,encode:m},a)}function Qn(e,t,n,a,i){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+a+","+i+")"}}function Jn(e,t,n,a,i,r){const o=Et(e,t),s=e.orient,l=e.scale,u=Cn(s,-1,1),p=ne(o("labelFlush")),f=ne(o("labelFlushOffset")),g=o("labelAlign"),m=o("labelBaseline");let h,y=0===p||!!p;const b=c(i);b.mult=u,b.offset=c(o("labelPadding")||0),b.offset.mult=u;const x={scale:l,field:pt,band:.5,offset:_t(r.offset,o("labelOffset"))},v=Wn(s,y?Qn(l,p,'"left"','"right"','"center"'):{value:"center"},((e,t,n)=>Z(e)?Bn(e.signal,t,n):e===ot?{value:t}:{value:n})(s,"left","right")),S=Wn(s,Ln(s,"bottom","top"),y?Qn(l,p,'"top"','"bottom"','"middle"'):{value:"middle"}),O=Qn(l,p,"-(".concat(f,")"),f,0);y=y&&f;const R={opacity:Ot,x:Wn(s,x,b),y:_n(s,x,b)},j={enter:R,update:h={opacity:Rt,text:{field:ut},x:R.x,y:R.y,align:v,baseline:S},exit:{opacity:Ot,x:R.x,y:R.y}};d(j,{dx:!g&&y?Wn(s,O):null,dy:!m&&y?_n(s,O):null}),d(j,{angle:o("labelAngle"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontWeight:o("labelFontWeight"),fontStyle:o("labelFontStyle"),limit:o("labelLimit"),lineHeight:o("labelLineHeight")},{align:g,baseline:m});const w=o("labelBound");let z=o("labelOverlap");return z=z||w?{separation:o("labelSeparation"),method:z,order:"datum.index",bound:w?{scale:l,orient:s,tolerance:w}:null}:void 0,h.align!==v&&(h.align=In(h.align,v)),h.baseline!==S&&(h.baseline=In(h.baseline,S)),Lt({type:Dt,role:k,style:ft,key:pt,from:a,encode:j,overlap:z},n)}function Kn(e,n,a,i){const r=Et(e,n),o=e.orient,s=Cn(o,-1,1);let l,u;const p={enter:l={opacity:Ot,anchor:c(r("titleAnchor",null)),align:{signal:Wt}},update:u=t.extend({},l,{opacity:Rt,text:c(e.title)}),exit:{opacity:Ot}},g={signal:'lerp(range("'.concat(e.scale,'"), ').concat(Ct(0,1,.5),")")};return u.x=Wn(o,g),u.y=_n(o,g),l.angle=Wn(o,Ot,((e,t)=>0===t?0:Z(e)?{signal:"(".concat(e.signal,") * ").concat(t)}:{value:e*t})(s,90)),l.baseline=Wn(o,Ln(o,st,it),{value:st}),u.angle=l.angle,u.baseline=l.baseline,d(p,{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"),angle:r("titleAngle"),baseline:r("titleBaseline")}),function(e,t,n,a){const i=(e,t)=>null!=e?(n.update[t]=In(c(e),n.update[t]),!1):!f(t,a),r=i(e("titleX"),"x"),o=i(e("titleY"),"y");n.enter.auto=o===r?c(o):Wn(t,c(o),c(r))}(r,o,p,a),p.update.align=In(p.update.align,l.align),p.update.angle=In(p.update.angle,l.angle),p.update.baseline=In(p.update.baseline,l.baseline),Lt({type:Dt,role:S,style:gt,from:i,encode:p},a)}function Zn(e,n){const a=function(e,n){var a,i,r,o,s,l,c,u,d=n.config,p=d.style,f=d.axis,g="band"===n.scaleType(e.scale)&&d.axisBand,m=e.orient;if(Z(m)){const e=Yn([d.axisX,d.axisY]),t=Yn([d.axisTop,d.axisBottom,d.axisLeft,d.axisRight]);for(r of(a={},e))a[r]=Wn(m,Xn(r,d.axisX,f,p),Xn(r,d.axisY,f,p));for(r of(i={},t))i[r]=(o=m.signal,s=Xn(r,d.axisTop,f,p),l=Xn(r,d.axisBottom,f,p),c=Xn(r,d.axisLeft,f,p),u=Xn(r,d.axisRight,f,p),{signal:(null!=c?"".concat(o," === '").concat(rt,"' ? (").concat(qn(c),") : "):"")+(null!=l?"".concat(o," === '").concat(st,"' ? (").concat(qn(l),") : "):"")+(null!=u?"".concat(o," === '").concat(ot,"' ? (").concat(qn(u),") : "):"")+(null!=s?"".concat(o," === '").concat(it,"' ? (").concat(qn(s),") : "):"")+"(null)"})}else a=m===it||m===st?d.axisX:d.axisY,i=d["axis"+m[0].toUpperCase()+m.slice(1)];return a||i||g?t.extend({},f,a,i,g):f}(e,n),i=e.encode||{},r=i.axis||{},o=r.name||void 0,s=r.interactive,l=r.style,u=Et(e,a),f=function(e){const n=e("tickBand");let a,i,r=e("tickOffset");return n?n.signal?(a={signal:"(".concat(n.signal,") === 'extent' ? 1 : 0.5")},i={signal:"(".concat(n.signal,") === 'extent'")},t.isObject(r)||(r={signal:"(".concat(n.signal,") === 'extent' ? 0 : ").concat(r)})):"extent"===n?(a=1,i=!0,r=0):(a=.5,i=!1):(a=e("bandPosition"),i=e("tickExtra")),{extra:i,band:a,offset:r}}(u),g={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:null!=e.title},m=X(n.add(ye({},[g]))),h=X(n.add(me({scale:n.scaleRef(e.scale),extra:n.property(f.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)}))),x=[];let k;return g.grid&&x.push(Gn(e,a,i.grid,h,f)),g.ticks&&(k=u("tickSize"),x.push(function(e,t,n,a,i,r){const o=Et(e,t),s=e.orient,l=Cn(s,-1,1);let u,p,f;const g={enter:u={opacity:Ot},update:f={opacity:Rt},exit:p={opacity:Ot}};d(g,{stroke:o("tickColor"),strokeCap:o("tickCap"),strokeDash:o("tickDash"),strokeDashOffset:o("tickDashOffset"),strokeOpacity:o("tickOpacity"),strokeWidth:o("tickWidth")});const m=c(i);m.mult=l;const h={scale:e.scale,field:pt,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")};return f.y=u.y=Wn(s,Ot,h),f.y2=u.y2=Wn(s,m),p.x=Wn(s,h),f.x=u.x=_n(s,Ot,h),f.x2=u.x2=_n(s,m),p.y=_n(s,h),Lt({type:zt,role:v,key:pt,from:a,encode:g},n)}(e,a,i.ticks,h,k,f))),g.labels&&(k=g.ticks?k:0,x.push(Jn(e,a,i.labels,h,k,f))),g.domain&&x.push(function(e,t,n,a){const i=Et(e,t),r=e.orient;let o,s;const l={enter:o={opacity:Ot},update:s={opacity:Rt},exit:{opacity:Ot}};d(l,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const c=Nn(e,0),u=Nn(e,1);return o.x=s.x=Wn(r,c,Ot),o.x2=s.x2=Wn(r,u),o.y=s.y=_n(r,c,Ot),o.y2=s.y2=_n(r,u),Lt({type:zt,role:b,from:a,encode:l},n)}(e,a,i.domain,m)),g.title&&x.push(Kn(e,a,i.title,m)),vn(Vt({role:y,from:m,encode:p(ea(u,e),r,St),marks:x,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:o,interactive:s,style:l}),n)}function ea(e,t){const n={enter:{},update:{}};return d(n,{orient:e("orient"),offset:e("offset")||0,position:te(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:'abs(span(range("'.concat(t.scale,'")))')},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function ta(e,n,a){const r=t.array(e.signals),o=t.array(e.scales);return a||r.forEach(e=>M(e,n)),t.array(e.projections).forEach(e=>function(e,t){const n=t.config.projection||{},a={};for(const n in e)"name"!==n&&(a[n]=at(e[n],n,t));for(const e in n)null==a[e]&&(a[e]=at(n[e],e,t));t.addProjection(e.name,a)}(e,n)),o.forEach(e=>function(e,n){const a=e.type||"linear";i.isValidScaleType(a)||t.error("Unrecognized scale type: "+t.stringValue(a)),n.addScale(e.name,{type:a,domain:void 0})}(e,n)),t.array(e.data).forEach(e=>Dn(e,n)),o.forEach(e=>qe(e,n)),(a||r).forEach(e=>pe(e,n)),t.array(e.axes).forEach(e=>Zn(e,n)),t.array(e.marks).forEach(e=>vn(e,n)),t.array(e.legends).forEach(e=>Sn(e,n)),e.title&&wn(e.title,n),n.parseLambdas(),n}function na(e,n){const a=n.config,i=X(n.root=n.add(I())),r=function(e,n){const a=t=>te(e[t],n[t]),i=[aa("background",a("background")),aa("autosize",o(a("autosize"))),aa("padding",l(a("padding"))),aa("width",a("width")||0),aa("height",a("height")||0)],r=i.reduce((e,t)=>(e[t.name]=t,e),{}),s={};return t.array(e.signals).forEach(e=>{t.hasOwnProperty(r,e.name)?e=t.extend(r[e.name],e):i.push(e),s[e.name]=e}),t.array(n.signals).forEach(e=>{t.hasOwnProperty(s,e.name)||t.hasOwnProperty(r,e.name)||i.push(e)}),i}(e,a);r.forEach(e=>M(e,n)),n.description=e.description||a.description,n.eventConfig=a.events,n.legends=n.objectProperty(a.legend&&a.legend.layout),n.locale=a.locale;const s=n.add(ye()),c=n.add(ke(F((e=>p({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e))(e.encode),jt,m,e.style,n,{pulse:X(s)}))),u=n.add(Be({layout:n.objectProperty(e.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:i,pulse:X(c)}));n.operators.pop(),n.pushState(X(c),X(u),null),ta(e,n,r),n.operators.push(u);let d=n.add(he({mark:i,pulse:X(u)}));return d=n.add($e({pulse:X(d)})),d=n.add(Ae({pulse:X(d)})),n.addData("root",new hn(n,s,s,d)),n}function aa(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function ia(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function ra(e){this.config=e.config,this.options=e.options,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}function oa(e){return(t.isArray(e)?sa:la)(e)}function sa(e){const n=e.length;let a="[";for(let i=0;i<n;++i){const n=e[i];a+=(i>0?",":"")+(t.isObject(n)?n.signal||oa(n):t.stringValue(n))}return a+"]"}function la(e){let n,a,i="{",r=0;for(n in e)a=e[n],i+=(++r>1?",":"")+t.stringValue(n)+":"+(t.isObject(a)?a.signal||oa(a):t.stringValue(a));return i+"}"}function ca(){const e="sans-serif",t="#4c78a8",n="#000",a="#888",i="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,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:i}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:a,grid:!1,gridWidth:1,gridColor:i,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:a,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:i,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:a,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"]}}}return ia.prototype=ra.prototype={parse(e){return ta(e,this)},fork(){return new ra(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(t=>{t.$ref=e.id}),e.refs=null),e},proxy(e){const t=e instanceof H?X(e):e;return this.add(_e({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let 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){let a,i;e&&(a=e.data||(e.data={}),i=a[t]||(a[t]=[]),i.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const a in t.index)n(t.index[a],e,"index:"+a)}return this},pushState(e,t,n){this._encode.push(X(this.add(Ae({pulse:e})))),this._parent.push(t),this._lookup.push(n?X(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return t.peek(this._parent)},encode(){return t.peek(this._encode)},lookup(){return t.peek(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,n){if(t.isString(e))return Y(e,n);e.signal||t.error("Unsupported field reference: "+t.stringValue(e));const a=e.signal;let i=this.field[a];if(!i){const e={name:this.signalRef(a)};n&&(e.as=n),this.field[a]=i=X(this.add(Oe(e)))}return i},compareRef(e){let n=!1;const a=e=>Z(e)?(n=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(n=!0,this.exprRef(e.expr)):e,i=t.array(e.field).map(a),r=t.array(e.order).map(a);return n?X(this.add(be({fields:i,orders:r}))):G(i,r)},keyRef(e,n){let a=!1;const i=this.signals;return e=t.array(e).map(e=>Z(e)?(a=!0,X(i[e.signal])):e),a?X(this.add(Re({fields:e,flat:n}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,n)},sortRef(e){if(!e)return e;const t=Q(e.op,e.field),n=e.order||"ascending";return n.signal?X(this.add(be({fields:t,orders:this.signalRef(n.signal)}))):G(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const a=this.id();this.streams.push({id:a,source:e,type:t}),this.events[n]=a}return this.events[n]},hasOwnSignal(e){return t.hasOwnProperty(this.signals,e)},addSignal(e,n){this.hasOwnSignal(e)&&t.error("Duplicate signal name: "+t.stringValue(e));const a=n instanceof H?n:this.add(I(n));return this.signals[e]=a},getSignal(e){return this.signals[e]||t.error("Unrecognized signal name: "+t.stringValue(e)),this.signals[e]},signalRef(e){return this.signals[e]?X(this.signals[e]):(t.hasOwnProperty(this.lambdas,e)||(this.lambdas[e]=this.add(I(null))),X(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,a=e.length;t<a;++t){const a=e[t],i=n.parseExpression(a,this),r=this.lambdas[a];r.params=i.$params,r.update=i.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&t.isObject(e)?this.signalRef(e.signal||oa(e)):e},exprRef(e,t){const a={expr:n.parseExpression(e,this)};return t&&(a.expr.$name=t),X(this.add(ve(a)))},addBinding(e,n){this.bindings||t.error("Nested signals do not support binding: "+t.stringValue(e)),this.bindings.push(t.extend({signal:e},n))},addScaleProj(e,n){t.hasOwnProperty(this.scales,e)&&t.error("Duplicate scale or projection name: "+t.stringValue(e)),this.scales[e]=this.add(n)},addScale(e,t){this.addScaleProj(e,Fe(t))},addProjection(e,t){this.addScaleProj(e,We(t))},getScale(e){return this.scales[e]||t.error("Unrecognized scale name: "+t.stringValue(e)),this.scales[e]},scaleRef(e){return X(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.data[e]=n},getData(e){return this.data[e]||t.error("Undefined data set name: "+t.stringValue(e)),this.data[e]},addDataPipeline(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.addData(e,hn.fromEntries(this,n))}},e.AxisDomainRole=b,e.AxisGridRole=x,e.AxisLabelRole=k,e.AxisRole=y,e.AxisTickRole=v,e.AxisTitleRole=S,e.DataScope=hn,e.FrameRole=m,e.LegendEntryRole=R,e.LegendLabelRole=j,e.LegendRole=O,e.LegendSymbolRole=w,e.LegendTitleRole=z,e.MarkRole=g,e.Scope=ia,e.ScopeRole=h,e.config=ca,e.parse=function(e,n,a){return t.isObject(e)||t.error("Input Vega specification must be an object."),na(e,new ia(n=t.mergeConfig(ca(),n,e.config),a)).toRuntime()},e.signal=M,e.signalUpdates=pe,e.stream=ie,e}({},vega,vega,vega,vega,vega); | ||
//# sourceMappingURL=vega-parser.min.js.map |
{ | ||
"name": "vega-parser", | ||
"version": "6.0.4", | ||
"version": "6.1.0", | ||
"description": "Parse Vega specifications to runtime dataflows.", | ||
@@ -14,22 +14,20 @@ "keywords": [ | ||
"main": "build/vega-parser.js", | ||
"module": "index", | ||
"module": "build/vega-parser.module.js", | ||
"unpkg": "build/vega-parser.min.js", | ||
"repository": "vega/vega", | ||
"scripts": { | ||
"rollup": "rollup -f umd -g vega-dataflow:vega,vega-event-selector:vega,vega-functions:vega,vega-scale:vega,vega-util:vega -n vega -o build/vega-parser.js -- index.js", | ||
"prebuild": "rimraf build && mkdir build", | ||
"build": "yarn rollup", | ||
"postbuild": "terser build/vega-parser.js -c -m -o build/vega-parser.min.js", | ||
"pretest": "yarn prebuild && yarn rollup", | ||
"prebuild": "rimraf build", | ||
"build": "rollup -c", | ||
"pretest": "yarn build --config-test", | ||
"test": "tape 'test/**/*-test.js'", | ||
"prepublishOnly": "yarn test && yarn build", | ||
"postpublish": "git push && git push --tags" | ||
"prepublishOnly": "yarn test && yarn build" | ||
}, | ||
"dependencies": { | ||
"vega-dataflow": "^5.7.2", | ||
"vega-event-selector": "^2.0.5", | ||
"vega-functions": "^5.7.2", | ||
"vega-scale": "^7.1.0", | ||
"vega-util": "^1.15.1" | ||
"vega-dataflow": "^5.7.3", | ||
"vega-event-selector": "^2.0.6", | ||
"vega-functions": "^5.8.0", | ||
"vega-scale": "^7.1.1", | ||
"vega-util": "^1.15.2" | ||
}, | ||
"gitHead": "8d6793f4ca7eaaf2d22186764e9ce2dae687cf52" | ||
"gitHead": "4affcbedb9d14815dbb6d3b250ed231b54fc95c0" | ||
} |
@@ -92,3 +92,3 @@ import {ifOrient, ifX} from './axis-util'; | ||
var result = (xy || or || band) | ||
const result = (xy || or || band) | ||
? extend({}, axis, xy, or, band) | ||
@@ -95,0 +95,0 @@ : axis; |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
585170
62
10837
1
Updatedvega-dataflow@^5.7.3
Updatedvega-event-selector@^2.0.6
Updatedvega-functions@^5.8.0
Updatedvega-scale@^7.1.1
Updatedvega-util@^1.15.2