import{error as p,stringValue as y,isString as q,peek as dt,array as w,hasOwnProperty as F,isObject as R,isArray as j,extend as v,mergeConfig as bn,splitAccessPath as xn}from"/-/vega-util@v1.17.2-LUfkDhormMyfWqy3Ts6U/dist=es2020,mode=imports,min/optimized/vega-util.js";import{parseExpression as Y}from"/-/vega-functions@v5.15.0-Bjrw9nnQutKMtsMi1DSI/dist=es2020,mode=imports,min/optimized/vega-functions.js";import{parseSelector as kn}from"/-/vega-event-selector@v3.0.1-UgiEAWJA4WQL4DTKnV4R/dist=es2020,mode=imports,min/optimized/vega-event-selector.js";import{isValidScaleType as Sn,isDiscrete as kt,isQuantile as de,isDiscretizing as ge,isContinuous as $n}from"/-/vega-scale@v7.4.1-M0T9Gn9zHGGuV6XhZsTO/dist=es2020,mode=imports,min/optimized/vega-scale.js";import{definition as Rn}from"/-/vega-dataflow@v5.7.6-WDoszrJUyhTwz7sPwzda/dist=es2020,mode=imports,min/optimized/vega-dataflow.js";function vn(t){return R(t)?t:{type:t||"pad"}}const gt=t=>+t||0,En=t=>({top:t,bottom:t,left:t,right:t});function On(t){return R(t)?t.signal?t:{top:gt(t.top),bottom:gt(t.bottom),left:gt(t.left),right:gt(t.right)}:En(gt(t))}const z=t=>R(t)&&!j(t)?v({},t):{value:t};function ce(t,e,n,i){if(n!=null){const a=R(n)&&!j(n)||j(n)&&n.length&&R(n[0]);return a?t.update[e]=n:t[i||"enter"][e]={value:n},1}else return 0}function L(t,e,n){for(const i in e)ce(t,i,e[i]);for(const i in n)ce(t,i,n[i],"update")}function nt(t,e,n){for(const i in e){if(n&&F(n,i))continue;t[i]=v(t[i]||{},e[i])}return t}function it(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}const St="mark",$t="frame",Rt="scope",he="axis",me="axis-domain",ye="axis-grid",pe="axis-label",be="axis-tick",xe="axis-title",ke="legend",zn="legend-band",Se="legend-entry",Dn="legend-gradient",Ut="legend-label",$e="legend-symbol",Re="legend-title",Ln="title",wn="title-text",Pn="title-subtitle";function jn(t,e,n,i,a){const l={},r={};let o,s,u,f;s="lineBreak",e==="text"&&a[s]!=null&&!it(s,t)&&Vt(l,s,a[s]),(n=="legend"||String(n).startsWith("axis"))&&(n=null),f=n===$t?a.group:n===St?v({},a.mark,a[e]):null;for(s in f)u=it(s,t)||(s==="fill"||s==="stroke")&&(it("fill",t)||it("stroke",t)),u||Vt(l,s,f[s]);w(i).forEach(d=>{const c=a.style&&a.style[d];for(const m in c)it(m,t)||Vt(l,m,c[m])}),t=v({},t);for(s in l)f=l[s],f.signal?(o=o||{})[s]=f:r[s]=f;return t.enter=v(r,t.enter),o&&(t.update=v(o,t.update)),t}function Vt(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}const ve=t=>q(t)?y(t):t.signal?`(${t.signal})`:Ee(t);function vt(t){if(t.gradient!=null)return Wn(t);let e=t.signal?`(${t.signal})`:t.color?Tn(t.color):t.field!=null?Ee(t.field):t.value!==void 0?y(t.value):void 0;return t.scale!=null&&(e=Fn(t,e)),e===void 0&&(e=null),t.exponent!=null&&(e=`pow(${e},${Ot(t.exponent)})`),t.mult!=null&&(e+=`*${Ot(t.mult)}`),t.offset!=null&&(e+=`+${Ot(t.offset)}`),t.round&&(e=`round(${e})`),e}const Et=(t,e,n,i)=>`(${t}(${[e,n,i].map(vt).join(",")})+'')`;function Tn(t){return t.c?Et("hcl",t.h,t.c,t.l):t.h||t.s?Et("hsl",t.h,t.s,t.l):t.l||t.a?Et("lab",t.l,t.a,t.b):t.r||t.g||t.b?Et("rgb",t.r,t.g,t.b):null}function Wn(t){const e=[t.start,t.stop,t.count].map(n=>n==null?null:y(n));for(;e.length&&dt(e)==null;)e.pop();return e.unshift(ve(t.gradient)),`gradient(${e.join(",")})`}function Ot(t){return R(t)?"("+vt(t)+")":t}function Ee(t){return Oe(R(t)?t:{datum:t})}function Oe(t){let e,n,i;if(t.signal)e="datum",i=t.signal;else if(t.group||t.parent){for(n=Math.max(1,t.level||1),e="item";n-- >0;)e+=".mark.group";t.parent?(i=t.parent,e+=".datum"):i=t.group}else t.datum?(e="datum",i=t.datum):p("Invalid field reference: "+y(t));return t.signal||(i=q(i)?xn(i).map(y).join("]["):Oe(i)),e+"["+i+"]"}function Fn(t,e){const n=ve(t.scale);return t.range!=null?e=`lerp(_range(${n}), ${+t.range})`:(e!==void 0&&(e=`_scale(${n}, ${e})`),t.band&&(e=(e?e+"+":"")+`_bandwidth(${n})`+(+t.band===1?"":"*"+Ot(t.band)),t.extra&&(e=`(datum.extra ? _scale(${n}, datum.extra.value) : ${e})`)),e==null&&(e="0")),e}function Cn(t){let e="";return t.forEach(n=>{const i=vt(n);e+=n.test?`(${n.test})?${i}:`:i}),dt(e)===":"&&(e+="null"),e}function ze(t,e,n,i,a,l){const r={};l=l||{},l.encoders={$encode:r},t=jn(t,e,n,i,a.config);for(const o in t)r[o]=An(t[o],e,l,a);return l}function An(t,e,n,i){const a={},l={};for(const r in t)t[r]!=null&&(a[r]=Bn(Mn(t[r]),i,n,l));return{$expr:{marktype:e,channels:a},$fields:Object.keys(l),$output:Object.keys(t)}}function Mn(t){return j(t)?Cn(t):vt(t)}function Bn(t,e,n,i){const a=Y(t,e);return a.$fields.forEach(l=>i[l]=1),v(n,a.$params),a.$expr}const Un="outer",Vn=["value","update","init","react","bind"];function De(t,e){p(t+' for "outer" push: '+y(e))}function Gt(t,e){const n=t.name;if(t.push===Un)e.signals[n]||De("No prior signal definition",n),Vn.forEach(i=>{t[i]!==void 0&&De("Invalid property ",i)});else{const i=e.addSignal(n,t.value);t.react===!1&&(i.react=!1),t.bind&&e.addBinding(n,t.bind)}}function It(t,e,n,i){this.id=-1,this.type=t,this.value=e,this.params=n,i&&(this.parent=i)}function zt(t,e,n,i){return new It(t,e,n,i)}function Dt(t,e){return zt("operator",t,e)}function g(t){const e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function ct(t,e){return e?{$field:t,$name:e}:{$field:t}}const Ht=ct("key");function Le(t,e){return{$compare:t,$order:e}}function Gn(t,e){const n={$key:t};return e&&(n.$flat=!0),n}const In="ascending",Hn="descending";function Xn(t){return R(t)?(t.order===Hn?"-":"+")+Lt(t.op,t.field):""}function Lt(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}const Xt="scope",qt="view";function O(t){return t&&t.signal}function qn(t){return t&&t.expr}function wt(t){if(O(t))return!0;if(R(t)){for(const e in t)if(wt(t[e]))return!0}return!1}function V(t,e){return t??e}function Z(t){return t&&t.signal||t}const we="timer";function at(t,e){const n=t.merge?Kn:t.stream?Nn:t.type?Jn:p("Invalid stream specification: "+y(t));return n(t,e)}function Yn(t){return t===Xt?qt:t||qt}function Kn(t,e){const n=t.merge.map(a=>at(a,e)),i=Yt({merge:n},t,e);return e.addStream(i).id}function Nn(t,e){const n=at(t.stream,e),i=Yt({stream:n},t,e);return e.addStream(i).id}function Jn(t,e){let n;t.type===we?(n=e.event(we,t.throttle),t={between:t.between,filter:t.filter}):n=e.event(Yn(t.source),t.type);const i=Yt({stream:n},t,e);return Object.keys(i).length===1?n:e.addStream(i).id}function Yt(t,e,n){let i=e.between;return i&&(i.length!==2&&p('Stream "between" parameter must have 2 entries: '+y(e)),t.between=[at(i[0],n),at(i[1],n)]),i=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&i.push(Qn(e.marktype,e.markname,e.markrole)),e.source===Xt&&i.push("inScope(event.item)"),i.length&&(t.filter=Y("("+i.join(")&&(")+")",n).$expr),(i=e.throttle)!=null&&(t.throttle=+i),(i=e.debounce)!=null&&(t.debounce=+i),e.consume&&(t.consume=!0),t}function Qn(t,e,n){const i="event.item";return i+(t&&t!=="*"?"&&"+i+".mark.marktype==='"+t+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(e?"&&"+i+".mark.name==='"+e+"'":"")}const Zn={code:"_.$value",ast:{type:"Identifier",value:"value"}};function _n(t,e,n){const i=t.encode,a={target:n};let l=t.events,r=t.update,o=[];l||p("Signal update missing events specification."),q(l)&&(l=kn(l,e.isSubscope()?Xt:qt)),l=w(l).filter(s=>s.signal||s.scale?(o.push(s),0):1),o.length>1&&(o=[ei(o)]),l.length&&o.push(l.length>1?{merge:l}:l[0]),i!=null&&(r&&p("Signal encode and update are mutually exclusive."),r="encode(item(),"+y(i)+")"),a.update=q(r)?Y(r,e):r.expr!=null?Y(r.expr,e):r.value!=null?r.value:r.signal!=null?{$expr:Zn,$params:{$value:e.signalRef(r.signal)}}:p("Invalid signal update specification."),t.force&&(a.options={force:!0}),o.forEach(s=>e.addUpdate(v(ti(s,e),a)))}function ti(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):at(t,e)}}function ei(t){return{signal:"["+t.map(e=>e.scale?'scale("'+e.scale+'")':e.signal)+"]"}}function Pe(t,e){const n=e.getSignal(t.name);let i=t.update;t.init&&(i?p("Signals can not include both init and update expressions."):(i=t.init,n.initonly=!0)),i&&(i=Y(i,e),n.update=i.$expr,n.params=i.$params),t.on&&t.on.forEach(a=>_n(a,e,n.id))}const x=t=>(e,n,i)=>zt(t,n,e||void 0,i),je=x("aggregate"),ni=x("axisticks"),Te=x("bound"),G=x("collect"),We=x("compare"),ii=x("datajoin"),Fe=x("encode"),ai=x("expression"),li=x("facet"),ri=x("field"),oi=x("key"),si=x("legendentries"),ui=x("load"),fi=x("mark"),di=x("multiextent"),gi=x("multivalues"),ci=x("overlap"),hi=x("params"),Ce=x("prefacet"),mi=x("projection"),yi=x("proxy"),pi=x("relay"),Ae=x("render"),bi=x("scale"),_=x("sieve"),xi=x("sortitems"),Me=x("viewlayout"),ki=x("values");let Si=0;const Be={min:"min",max:"max",count:"sum"};function $i(t,e){const n=t.type||"linear";Sn(n)||p("Unrecognized scale type: "+y(n)),e.addScale(t.name,{type:n,domain:void 0})}function Ri(t,e){const n=e.getScale(t.name).params;let i;n.domain=Ue(t.domain,t,e),t.range!=null&&(n.range=Ge(t,e,n)),t.interpolate!=null&&Ti(t.interpolate,n),t.nice!=null&&(n.nice=ji(t.nice,e)),t.bins!=null&&(n.bins=Pi(t.bins,e));for(i in t){if(F(n,i)||i==="name")continue;n[i]=A(t[i],e)}}function A(t,e){return R(t)?t.signal?e.signalRef(t.signal):p("Unsupported object: "+y(t)):t}function Pt(t,e){return t.signal?e.signalRef(t.signal):t.map(n=>A(n,e))}function jt(t){p("Can not find data set: "+y(t))}function Ue(t,e,n){if(!t){(e.domainMin!=null||e.domainMax!=null)&&p("No scale domain defined for domainMin/domainMax to override.");return}return t.signal?n.signalRef(t.signal):(j(t)?vi:t.fields?Oi:Ei)(t,e,n)}function vi(t,e,n){return t.map(i=>A(i,n))}function Ei(t,e,n){const i=n.getData(t.data);return i||jt(t.data),kt(e.type)?i.valuesRef(n,t.field,Ve(t.sort,!1)):de(e.type)?i.domainRef(n,t.field):i.extentRef(n,t.field)}function Oi(t,e,n){const i=t.data,a=t.fields.reduce((l,r)=>(r=q(r)?{data:i,field:r}:j(r)||r.signal?zi(r,n):r,l.push(r),l),[]);return(kt(e.type)?Di:de(e.type)?Li:wi)(t,n,a)}function zi(t,e){const n="_:vega:_"+Si++,i=G({});if(j(t))i.value={$ingest:t};else if(t.signal){const a="setdata("+y(n)+","+t.signal+")";i.params.input=e.signalRef(a)}return e.addDataPipeline(n,[i,_({})]),{data:n,field:"data"}}function Di(t,e,n){const i=Ve(t.sort,!0);let a,l;const r=n.map(u=>{const f=e.getData(u.data);return f||jt(u.data),f.countsRef(e,u.field,i)}),o={groupby:Ht,pulse:r};i&&(a=i.op||"count",l=i.field?Lt(a,i.field):"count",o.ops=[Be[a]],o.fields=[e.fieldRef(l)],o.as=[l]),a=e.add(je(o));const s=e.add(G({pulse:g(a)}));return l=e.add(ki({field:Ht,sort:e.sortRef(i),pulse:g(s)})),g(l)}function Ve(t,e){return t&&(!t.field&&!t.op?R(t)?t.field="key":t={field:"key"}:!t.field&&t.op!=="count"?p("No field provided for sort aggregate op: "+t.op):e&&t.field&&(t.op&&!Be[t.op]&&p("Multiple domain scales can not be sorted using "+t.op))),t}function Li(t,e,n){const i=n.map(a=>{const l=e.getData(a.data);return l||jt(a.data),l.domainRef(e,a.field)});return g(e.add(gi({values:i})))}function wi(t,e,n){const i=n.map(a=>{const l=e.getData(a.data);return l||jt(a.data),l.extentRef(e,a.field)});return g(e.add(di({extents:i})))}function Pi(t,e){return t.signal||j(t)?Pt(t,e):e.objectProperty(t)}function ji(t,e){return t.signal?e.signalRef(t.signal):R(t)?{interval:A(t.interval),step:A(t.step)}:A(t)}function Ti(t,e){e.interpolate=A(t.type||t),t.gamma!=null&&(e.interpolateGamma=A(t.gamma))}function Ge(t,e,n){const i=e.config.range;let a=t.range;if(a.signal)return e.signalRef(a.signal);if(q(a)){if(i&&F(i,a))return t=v({},t,{range:i[a]}),Ge(t,e,n);a==="width"?a=[0,{signal:"width"}]:a==="height"?a=kt(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:p("Unrecognized scale range value: "+y(a))}else if(a.scheme){n.scheme=j(a.scheme)?Pt(a.scheme,e):A(a.scheme,e),a.extent&&(n.schemeExtent=Pt(a.extent,e)),a.count&&(n.schemeCount=A(a.count,e));return}else if(a.step){n.rangeStep=A(a.step,e);return}else{if(kt(t.type)&&!j(a))return Ue(a,t,e);j(a)||p("Unsupported range type: "+y(a))}return a.map(l=>(j(l)?Pt:A)(l,e))}function Wi(t,e){const n=e.config.projection||{},i={};for(const a in t){if(a==="name")continue;i[a]=Kt(t[a],a,e)}for(const a in n)i[a]==null&&(i[a]=Kt(n[a],a,e));e.addProjection(t.name,i)}function Kt(t,e,n){return j(t)?t.map(i=>Kt(i,e,n)):R(t)?t.signal?n.signalRef(t.signal):e==="fit"?t:p("Unsupported parameter object: "+y(t)):t}const I="top",lt="left",rt="right",J="bottom",Ie="center",Fi="vertical",Ci="start",Ai="middle",Mi="end",Nt="index",Jt="label",Bi="offset",ot="perc",Ui="perc2",M="value",ht="guide-label",Qt="guide-title",Vi="group-title",Gi="group-subtitle",He="symbol",Tt="gradient",Zt="discrete",_t="size",Ii="shape",Hi="fill",Xi="stroke",qi="strokeWidth",Yi="strokeDash",Ki="opacity",te=[_t,Ii,Hi,Xi,qi,Yi,Ki],mt={name:1,style:1,interactive:1},b={value:0},B={value:1},Wt="group",Xe="rect",ee="rule",Ni="symbol",tt="text";function yt(t){return t.type=Wt,t.interactive=t.interactive||!1,t}function T(t,e){const n=(i,a)=>V(t[i],V(e[i],a));return n.isVertical=i=>Fi===V(t.direction,e.direction||(i?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>V(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>V(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>V(t.columns,V(e.columns,+n.isVertical(!0))),n}function qe(t,e){const n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function Ji(t,e,n){const i=e.config.style[n];return i&&i[t]}function Ft(t,e,n){return`item.anchor === '${Ci}' ? ${t} : item.anchor === '${Mi}' ? ${e} : ${n}`}const ne=Ft(y(lt),y(rt),y(Ie));function Qi(t){const e=t("tickBand");let n=t("tickOffset"),i,a;return e?e.signal?(i={signal:`(${e.signal}) === 'extent' ? 1 : 0.5`},a={signal:`(${e.signal}) === 'extent'`},R(n)||(n={signal:`(${e.signal}) === 'extent' ? 0 : ${n}`})):e==="extent"?(i=1,a=!0,n=0):(i=.5,a=!1):(i=t("bandPosition"),a=t("tickExtra")),{extra:a,band:i,offset:n}}function Ye(t,e){return e?t?R(t)?Object.assign({},t,{offset:Ye(t.offset,e)}):{value:t,offset:e}:e:t}function C(t,e){return e?(t.name=e.name,t.style=e.style||t.style,t.interactive=!!e.interactive,t.encode=nt(t.encode,e,mt)):t.interactive=!1,t}function Zi(t,e,n,i){const a=T(t,n),l=a.isVertical(),r=a.gradientThickness(),o=a.gradientLength();let s,u,f,d,c;l?(u=[0,1],f=[0,0],d=r,c=o):(u=[0,0],f=[1,0],d=o,c=r);const m={enter:s={opacity:b,x:b,y:b,width:z(d),height:z(c)},update:v({},s,{opacity:B,fill:{gradient:e,start:u,stop:f}}),exit:{opacity:b}};return L(m,{stroke:a("gradientStrokeColor"),strokeWidth:a("gradientStrokeWidth")},{opacity:a("gradientOpacity")}),C({type:Xe,role:Dn,encode:m},i)}function _i(t,e,n,i,a){const l=T(t,n),r=l.isVertical(),o=l.gradientThickness(),s=l.gradientLength();let u,f,d,c,m="";r?(u="y",d="y2",f="x",c="width",m="1-"):(u="x",d="x2",f="y",c="height");const h={opacity:b,fill:{scale:e,field:M}};h[u]={signal:m+"datum."+ot,mult:s},h[f]=b,h[d]={signal:m+"datum."+Ui,mult:s},h[c]=z(o);const k={enter:h,update:v({},h,{opacity:B}),exit:{opacity:b}};return L(k,{stroke:l("gradientStrokeColor"),strokeWidth:l("gradientStrokeWidth")},{opacity:l("gradientOpacity")}),C({type:Xe,role:zn,key:M,from:a,encode:k},i)}const ta=`datum.${ot}<=0?"${lt}":datum.${ot}>=1?"${rt}":"${Ie}"`,ea=`datum.${ot}<=0?"${J}":datum.${ot}>=1?"${I}":"${Ai}"`;function Ke(t,e,n,i){const a=T(t,e),l=a.isVertical(),r=z(a.gradientThickness()),o=a.gradientLength();let s=a("labelOverlap"),u,f,d,c,m="";const h={enter:u={opacity:b},update:f={opacity:B,text:{field:Jt}},exit:{opacity:b}};return L(h,{fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontStyle:a("labelFontStyle"),fontWeight:a("labelFontWeight"),limit:V(t.labelLimit,e.gradientLabelLimit)}),l?(u.align={value:"left"},u.baseline=f.baseline={signal:ea},d="y",c="x",m="1-"):(u.align=f.align={signal:ta},u.baseline={value:"top"},d="x",c="y"),u[d]=f[d]={signal:m+"datum."+ot,mult:o},u[c]=f[c]=r,r.offset=V(t.labelOffset,e.gradientLabelOffset)||0,s=s?{separation:a("labelSeparation"),method:s,order:"datum."+Nt}:void 0,C({type:tt,role:Ut,style:ht,key:M,from:i,encode:h,overlap:s},n)}function na(t,e,n,i,a){const l=T(t,e),r=n.entries,o=!!(r&&r.interactive),s=r?r.name:void 0,u=l("clipHeight"),f=l("symbolOffset"),d={data:"value"},c=`(${a}) ? datum.${Bi} : datum.${_t}`,m=u?z(u):{field:_t},h=`datum.${Nt}`,k=`max(1, ${a})`;let S,E,$,P,K;m.mult=.5,S={enter:E={opacity:b,x:{signal:c,mult:.5,offset:f},y:m},update:$={opacity:B,x:E.x,y:E.y},exit:{opacity:b}};let X=null,W=null;t.fill||(X=e.symbolBaseFillColor,W=e.symbolBaseStrokeColor),L(S,{fill:l("symbolFillColor",X),shape:l("symbolType"),size:l("symbolSize"),stroke:l("symbolStrokeColor",W),strokeDash:l("symbolDash"),strokeDashOffset:l("symbolDashOffset"),strokeWidth:l("symbolStrokeWidth")},{opacity:l("symbolOpacity")}),te.forEach(xt=>{t[xt]&&($[xt]=E[xt]={scale:t[xt],field:M})});const N=C({type:Ni,role:$e,key:M,from:d,clip:u?!0:void 0,encode:S},n.symbols),U=z(f);U.offset=l("labelOffset"),S={enter:E={opacity:b,x:{signal:c,offset:U},y:m},update:$={opacity:B,text:{field:Jt},x:E.x,y:E.y},exit:{opacity:b}},L(S,{align:l("labelAlign"),baseline:l("labelBaseline"),fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:l("labelLimit")});const pn=C({type:tt,role:Ut,style:ht,key:M,from:d,encode:S},n.labels);return S={enter:{noBound:{value:!u},width:b,height:u?z(u):b,opacity:b},exit:{opacity:b},update:$={opacity:B,row:{signal:null},column:{signal:null}}},l.isVertical(!0)?(P=`ceil(item.mark.items.length / ${k})`,$.row.signal=`${h}%${P}`,$.column.signal=`floor(${h} / ${P})`,K={field:["row",h]}):($.row.signal=`floor(${h} / ${k})`,$.column.signal=`${h} % ${k}`,K={field:h}),$.column.signal=`(${a})?${$.column.signal}:${h}`,i={facet:{data:i,name:"value",groupby:Nt}},yt({role:Rt,from:i,encode:nt(S,r,mt),marks:[N,pn],name:s,interactive:o,sort:K})}function ia(t,e){const n=T(t,e);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}const ie='item.orient === "left"',ae='item.orient === "right"',Ct=`(${ie} || ${ae})`,aa=`datum.vgrad && ${Ct}`,la=Ft('"top"','"bottom"','"middle"'),ra=Ft('"right"','"left"','"center"'),oa=`datum.vgrad && ${ae} ? (${ra}) : (${Ct} && !(datum.vgrad && ${ie})) ? "left" : ${ne}`,sa=`item._anchor || (${Ct} ? "middle" : "start")`,ua=`${aa} ? (${ie} ? -90 : 90) : 0`,fa=`${Ct} ? (datum.vgrad ? (${ae} ? "bottom" : "top") : ${la}) : "top"`;function da(t,e,n,i){const a=T(t,e),l={enter:{opacity:b},update:{opacity:B,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:b}};return L(l,{orient:a("titleOrient"),_anchor:a("titleAnchor"),anchor:{signal:sa},angle:{signal:ua},align:{signal:oa},baseline:{signal:fa},text:t.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")}),C({type:tt,role:Re,style:Qt,from:i,encode:l},n)}function ga(t,e){let n;return R(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+Ne(t.path)+")":t.sphere&&(n="geoShape("+Ne(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function Ne(t){return R(t)&&t.signal?t.signal:y(t)}function Je(t){const e=t.role||"";return e.startsWith("axis")||e.startsWith("legend")||e.startsWith("title")?e:t.type===Wt?Rt:e||St}function ca(t){return{marktype:t.type,name:t.name||void 0,role:t.role||Je(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function ha(t,e){return t&&t.signal?e.signalRef(t.signal):!(t===!1)}function le(t,e){const n=Rn(t.type);n||p("Unrecognized transform type: "+y(t.type));const i=zt(n.type.toLowerCase(),null,Qe(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(i)),i.metadata=n.metadata||{},i}function Qe(t,e,n){const i={},a=t.params.length;for(let l=0;lZe(t,l,n)):Ze(t,a,n)}function Ze(t,e,n){const i=t.type;if(O(e))return tn(i)?p("Expression references can not be signals."):re(i)?n.fieldRef(e):en(i)?n.compareRef(e):n.signalRef(e.signal);{const a=t.expr||re(i);return a&&ba(e)?n.exprRef(e.expr,e.as):a&&xa(e)?ct(e.field,e.as):tn(i)?Y(e,n):ka(i)?g(n.getData(e).values):re(i)?ct(e):en(i)?n.compareRef(e):e}}function ya(t,e,n){return q(e.from)||p('Lookup "from" parameter must be a string literal.'),n.getData(e.from).lookupRef(n,e.key)}function pa(t,e,n){const i=e[t.name];return t.array?(j(i)||p("Expected an array of sub-parameters. Instead: "+y(i)),i.map(a=>_e(t,a,n))):_e(t,i,n)}function _e(t,e,n){const i=t.params.length;let a;for(let r=0;rt&&t.expr,xa=t=>t&&t.field,ka=t=>t==="data",tn=t=>t==="expr",re=t=>t==="field",en=t=>t==="compare";function Sa(t,e,n){let i,a,l,r,o;return t?(i=t.facet)&&(e||p("Only group marks can be faceted."),i.field!=null?r=o=At(i,n):(t.data?o=g(n.getData(t.data).aggregate):(l=le(v({type:"aggregate",groupby:w(i.groupby)},i.aggregate),n),l.params.key=n.keyRef(i.groupby),l.params.pulse=At(i,n),r=o=g(n.add(l))),a=n.keyRef(i.groupby,!0))):r=g(n.add(G(null,[{}]))),r||(r=At(t,n)),{key:a,pulse:r,parent:o}}function At(t,e){return t.$ref?t:t.data&&t.data.$ref?t.data:g(e.getData(t.data).output)}function Q(t,e,n,i,a){this.scope=t,this.input=e,this.output=n,this.values=i,this.aggregate=a,this.index={}}Q.fromEntries=function(t,e){const n=e.length,i=e[n-1],a=e[n-2];let l=e[0],r=null,o=1;for(l&&l.type==="load"&&(l=e[1]),t.add(e[0]);od??"null").join(",")+"),0)",f=Y(u,e);s.update=f.$expr,s.params=f.$params}function Mt(t,e){const n=Je(t),i=t.type===Wt,a=t.from&&t.from.facet,l=t.overlap;let r=t.layout||n===Rt||n===$t,o,s,u,f,d,c,m;const h=n===St||r||a,k=Sa(t.from,i,e);s=e.add(ii({key:k.key||(t.key?ct(t.key):void 0),pulse:k.pulse,clean:!i}));const S=g(s);s=u=e.add(G({pulse:S})),s=e.add(fi({markdef:ca(t),interactive:ha(t.interactive,e),clip:ga(t.clip,e),context:{$context:!0},groups:e.lookup(),parent:e.signals.parent?e.signalRef("parent"):null,index:e.markpath(),pulse:g(s)}));const E=g(s);s=f=e.add(Fe(ze(t.encode,t.type,n,t.style,e,{mod:!1,pulse:E}))),s.params.parent=e.encode(),t.transform&&t.transform.forEach(W=>{const N=le(W,e),U=N.metadata;(U.generates||U.changes)&&p("Mark transforms should not generate new data."),U.nomod||(f.params.mod=!0),N.params.pulse=g(s),e.add(s=N)}),t.sort&&(s=e.add(xi({sort:e.compareRef(t.sort),pulse:g(s)})));const $=g(s);(a||r)&&(r=e.add(Me({layout:e.objectProperty(t.layout),legends:e.legends,mark:E,pulse:$})),c=g(r));const P=e.add(Te({mark:E,pulse:c||$}));m=g(P),i&&(h&&(o=e.operators,o.pop(),r&&o.pop()),e.pushState($,c||m,S),a?$a(t,e,k):h?Ra(t,e,k):e.parse(t),e.popState(),h&&(r&&o.push(r),o.push(P))),l&&(m=va(l,m,e));const K=e.add(Ae({pulse:m})),X=e.add(_({pulse:g(K)},void 0,e.parent()));t.name!=null&&(d=t.name,e.addData(d,new Q(e,u,K,X)),t.on&&t.on.forEach(W=>{(W.insert||W.remove||W.toggle)&&p("Marks only support modify triggers."),ln(W,e,d)}))}function va(t,e,n){const i=t.method,a=t.bound,l=t.separation,r={separation:O(l)?n.signalRef(l.signal):l,method:O(i)?n.signalRef(i.signal):i,pulse:e};if(t.order&&(r.sort=n.compareRef({field:t.order})),a){const o=a.tolerance;r.boundTolerance=O(o)?n.signalRef(o.signal):+o,r.boundScale=n.scaleRef(a.scale),r.boundOrient=a.orient}return g(n.add(ci(r)))}function Ea(t,e){const n=e.config.legend,i=t.encode||{},a=T(t,n),l=i.legend||{},r=l.name||void 0,o=l.interactive,s=l.style,u={};let f=0,d,c,m;te.forEach(P=>t[P]?(u[P]=t[P],f=f||t[P]):0),f||p("Missing valid scale for legend.");const h=Oa(t,e.scaleType(f)),k={title:t.title!=null,scales:u,type:h,vgrad:h!=="symbol"&&a.isVertical()},S=g(e.add(G(null,[k]))),E={enter:{x:{value:0},y:{value:0}}},$=g(e.add(si(c={type:h,scale:e.scaleRef(f),count:e.objectProperty(a("tickCount")),limit:e.property(a("symbolLimit")),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)})));return h===Tt?(m=[Zi(t,f,n,i.gradient),Ke(t,n,i.labels,$)],c.count=c.count||e.signalRef(`max(2,2*floor((${Z(a.gradientLength())})/100))`)):h===Zt?m=[_i(t,f,n,i.gradient,$),Ke(t,n,i.labels,$)]:(d=ia(t,n),m=[na(t,n,i,$,Z(d.columns))],c.size=La(t,e,m[0].marks)),m=[yt({role:Se,from:S,encode:E,marks:m,layout:d,interactive:o})],k.title&&m.push(da(t,n,i.title,S)),Mt(yt({role:ke,from:S,encode:nt(Da(a,t,n),l,mt),marks:m,aria:a("aria"),description:a("description"),zindex:a("zindex"),name:r,interactive:o,style:s}),e)}function Oa(t,e){let n=t.type||He;return!t.type&&za(t)===1&&(t.fill||t.stroke)&&(n=$n(e)?Tt:ge(e)?Zt:He),n!==Tt?n:ge(e)?Zt:Tt}function za(t){return te.reduce((e,n)=>e+(t[n]?1:0),0)}function Da(t,e,n){const i={enter:{},update:{}};return L(i,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:t("legendX"),y:t("legendY"),format:e.format,formatType:e.formatType}),i}function La(t,e,n){const i=Z(rn("size",t,n)),a=Z(rn("strokeWidth",t,n)),l=Z(wa(n[1].encode,e,ht));return Y(`max(ceil(sqrt(${i})+${a}),${l})`,e)}function rn(t,e,n){return e[t]?`scale("${e[t]}",datum)`:qe(t,n[0].encode)}function wa(t,e,n){return qe("fontSize",t)||Ji("fontSize",e,n)}const Pa=`item.orient==="${lt}"?-90:item.orient==="${rt}"?90:0`;function ja(t,e){t=q(t)?{text:t}:t;const n=T(t,e.config.title),i=t.encode||{},a=i.group||{},l=a.name||void 0,r=a.interactive,o=a.style,s=[],u={},f=g(e.add(G(null,[u])));return s.push(Fa(t,n,Ta(t),f)),t.subtitle&&s.push(Ca(t,n,i.subtitle,f)),Mt(yt({role:Ln,from:f,encode:Wa(n,a),marks:s,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:l,interactive:r,style:o}),e)}function Ta(t){const e=t.encode;return e&&e.title||v({name:t.name,interactive:t.interactive,style:t.style},e)}function Wa(t,e){const n={enter:{},update:{}};return L(n,{orient:t("orient"),anchor:t("anchor"),align:{signal:ne},angle:{signal:Pa},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),nt(n,e,mt)}function Fa(t,e,n,i){const a={value:0},l=t.text,r={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return L(r,{text:l,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("color"),font:e("font"),fontSize:e("fontSize"),fontStyle:e("fontStyle"),fontWeight:e("fontWeight"),lineHeight:e("lineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),C({type:tt,role:wn,style:Vi,from:i,encode:r},n)}function Ca(t,e,n,i){const a={value:0},l=t.subtitle,r={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return L(r,{text:l,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("subtitleColor"),font:e("subtitleFont"),fontSize:e("subtitleFontSize"),fontStyle:e("subtitleFontStyle"),fontWeight:e("subtitleFontWeight"),lineHeight:e("subtitleLineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),C({type:tt,role:Pn,style:Gi,from:i,encode:r},n)}function Aa(t,e){const n=[];t.transform&&t.transform.forEach(i=>{n.push(le(i,e))}),t.on&&t.on.forEach(i=>{ln(i,e,t.name)}),e.addDataPipeline(t.name,Ma(t,e,n))}function Ma(t,e,n){const i=[];let a=null,l=!1,r=!1,o,s,u,f,d;for(t.values?O(t.values)||wt(t.format)?(i.push(on(e,t)),i.push(a=et())):i.push(a=et({$ingest:t.values,$format:t.format})):t.url?wt(t.url)||wt(t.format)?(i.push(on(e,t)),i.push(a=et())):i.push(a=et({$request:t.url,$format:t.format})):t.source&&(a=o=w(t.source).map(c=>g(e.getData(c).output)),i.push(null)),s=0,u=n.length;st===J||t===I,Bt=(t,e,n)=>O(t)?Ga(t.signal,e,n):t===lt||t===I?e:n,D=(t,e,n)=>O(t)?Ua(t.signal,e,n):sn(t)?e:n,H=(t,e,n)=>O(t)?Va(t.signal,e,n):sn(t)?n:e,un=(t,e,n)=>O(t)?Ia(t.signal,e,n):t===I?{value:e}:{value:n},Ba=(t,e,n)=>O(t)?Ha(t.signal,e,n):t===rt?{value:e}:{value:n},Ua=(t,e,n)=>fn(`${t} === '${I}' || ${t} === '${J}'`,e,n),Va=(t,e,n)=>fn(`${t} !== '${I}' && ${t} !== '${J}'`,e,n),Ga=(t,e,n)=>oe(`${t} === '${lt}' || ${t} === '${I}'`,e,n),Ia=(t,e,n)=>oe(`${t} === '${I}'`,e,n),Ha=(t,e,n)=>oe(`${t} === '${rt}'`,e,n),fn=(t,e,n)=>(e=e!=null?z(e):e,n=n!=null?z(n):n,dn(e)&&dn(n)?(e=e?e.signal||y(e.value):null,n=n?n.signal||y(n.value):null,{signal:`${t} ? (${e}) : (${n})`}):[v({test:t},e)].concat(n||[])),dn=t=>t==null||Object.keys(t).length===1,oe=(t,e,n)=>({signal:`${t} ? (${st(e)}) : (${st(n)})`}),Xa=(t,e,n,i,a)=>({signal:(i!=null?`${t} === '${lt}' ? (${st(i)}) : `:"")+(n!=null?`${t} === '${J}' ? (${st(n)}) : `:"")+(a!=null?`${t} === '${rt}' ? (${st(a)}) : `:"")+(e!=null?`${t} === '${I}' ? (${st(e)}) : `:"")+"(null)"}),st=t=>O(t)?t.signal:t==null?null:y(t),qa=(t,e)=>e===0?0:O(t)?{signal:`(${t.signal}) * ${e}`}:{value:t*e},ut=(t,e)=>{const n=t.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+e.signal}:t};function ft(t,e,n,i){let a;if(e&&F(e,t))return e[t];if(F(n,t))return n[t];if(t.startsWith("title")){switch(t){case"titleColor":a="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":a=t[5].toLowerCase()+t.slice(6)}return i[Qt][a]}else if(t.startsWith("label")){switch(t){case"labelColor":a="fill";break;case"labelFont":case"labelFontSize":a=t[5].toLowerCase()+t.slice(6)}return i[ht][a]}return null}function gn(t){const e={};for(const n of t){if(!n)continue;for(const i in n)e[i]=1}return Object.keys(e)}function Ya(t,e){var n=e.config,i=n.style,a=n.axis,l=e.scaleType(t.scale)==="band"&&n.axisBand,r=t.orient,o,s,u;if(O(r)){const d=gn([n.axisX,n.axisY]),c=gn([n.axisTop,n.axisBottom,n.axisLeft,n.axisRight]);o={};for(u of d)o[u]=D(r,ft(u,n.axisX,a,i),ft(u,n.axisY,a,i));s={};for(u of c)s[u]=Xa(r.signal,ft(u,n.axisTop,a,i),ft(u,n.axisBottom,a,i),ft(u,n.axisLeft,a,i),ft(u,n.axisRight,a,i))}else o=r===I||r===J?n.axisX:n.axisY,s=n["axis"+r[0].toUpperCase()+r.slice(1)];const f=o||s||l?v({},a,o,s,l):a;return f}function Ka(t,e,n,i){const a=T(t,e),l=t.orient;let r,o;const s={enter:r={opacity:b},update:o={opacity:B},exit:{opacity:b}};L(s,{stroke:a("domainColor"),strokeCap:a("domainCap"),strokeDash:a("domainDash"),strokeDashOffset:a("domainDashOffset"),strokeWidth:a("domainWidth"),strokeOpacity:a("domainOpacity")});const u=cn(t,0),f=cn(t,1);return r.x=o.x=D(l,u,b),r.x2=o.x2=D(l,f),r.y=o.y=H(l,u,b),r.y2=o.y2=H(l,f),C({type:ee,role:me,from:i,encode:s},n)}function cn(t,e){return{scale:t.scale,range:e}}function Na(t,e,n,i,a){const l=T(t,e),r=t.orient,o=t.gridScale,s=Bt(r,1,-1),u=Ja(t.offset,s);let f,d,c;const m={enter:f={opacity:b},update:c={opacity:B},exit:d={opacity:b}};L(m,{stroke:l("gridColor"),strokeCap:l("gridCap"),strokeDash:l("gridDash"),strokeDashOffset:l("gridDashOffset"),strokeOpacity:l("gridOpacity"),strokeWidth:l("gridWidth")});const h={scale:t.scale,field:M,band:a.band,extra:a.extra,offset:a.offset,round:l("tickRound")},k=D(r,{signal:"height"},{signal:"width"}),S=o?{scale:o,range:0,mult:s,offset:u}:{value:0,offset:u},E=o?{scale:o,range:1,mult:s,offset:u}:v(k,{mult:s,offset:u});return f.x=c.x=D(r,h,S),f.y=c.y=H(r,h,S),f.x2=c.x2=H(r,E),f.y2=c.y2=D(r,E),d.x=D(r,h),d.y=H(r,h),C({type:ee,role:ye,key:M,from:i,encode:m},n)}function Ja(t,e){if(!(e===1))if(!R(t))t=O(e)?{signal:`(${e.signal}) * (${t||0})`}:e*(t||0);else{let n=t=v({},t);for(;n.mult!=null;)if(R(n.mult))n=n.mult=v({},n.mult);else return n.mult=O(e)?{signal:`(${n.mult}) * (${e.signal})`}:n.mult*e,t;n.mult=e}return t}function Qa(t,e,n,i,a,l){const r=T(t,e),o=t.orient,s=Bt(o,-1,1);let u,f,d;const c={enter:u={opacity:b},update:d={opacity:B},exit:f={opacity:b}};L(c,{stroke:r("tickColor"),strokeCap:r("tickCap"),strokeDash:r("tickDash"),strokeDashOffset:r("tickDashOffset"),strokeOpacity:r("tickOpacity"),strokeWidth:r("tickWidth")});const m=z(a);m.mult=s;const h={scale:t.scale,field:M,band:l.band,extra:l.extra,offset:l.offset,round:r("tickRound")};return d.y=u.y=D(o,b,h),d.y2=u.y2=D(o,m),f.x=D(o,h),d.x=u.x=H(o,b,h),d.x2=u.x2=H(o,m),f.y=H(o,h),C({type:ee,role:be,key:M,from:i,encode:c},n)}function se(t,e,n,i,a){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+i+","+a+")"}}function Za(t,e,n,i,a,l){const r=T(t,e),o=t.orient,s=t.scale,u=Bt(o,-1,1),f=Z(r("labelFlush")),d=Z(r("labelFlushOffset")),c=r("labelAlign"),m=r("labelBaseline");let h=f===0||!!f,k;const S=z(a);S.mult=u,S.offset=z(r("labelPadding")||0),S.offset.mult=u;const E={scale:s,field:M,band:.5,offset:Ye(l.offset,r("labelOffset"))},$=D(o,h?se(s,f,'"left"','"right"','"center"'):{value:"center"},Ba(o,"left","right")),P=D(o,un(o,"bottom","top"),h?se(s,f,'"top"','"bottom"','"middle"'):{value:"middle"}),K=se(s,f,`-(${d})`,d,0);h=h&&d;const X={opacity:b,x:D(o,E,S),y:H(o,E,S)},W={enter:X,update:k={opacity:B,text:{field:Jt},x:X.x,y:X.y,align:$,baseline:P},exit:{opacity:b,x:X.x,y:X.y}};L(W,{dx:!c&&h?D(o,K):null,dy:!m&&h?H(o,K):null}),L(W,{angle:r("labelAngle"),fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontWeight:r("labelFontWeight"),fontStyle:r("labelFontStyle"),limit:r("labelLimit"),lineHeight:r("labelLineHeight")},{align:c,baseline:m});const N=r("labelBound");let U=r("labelOverlap");return U=U||N?{separation:r("labelSeparation"),method:U,order:"datum.index",bound:N?{scale:s,orient:o,tolerance:N}:null}:void 0,k.align!==$&&(k.align=ut(k.align,$)),k.baseline!==P&&(k.baseline=ut(k.baseline,P)),C({type:tt,role:pe,style:ht,key:M,from:i,encode:W,overlap:U},n)}function _a(t,e,n,i){const a=T(t,e),l=t.orient,r=Bt(l,-1,1);let o,s;const u={enter:o={opacity:b,anchor:z(a("titleAnchor",null)),align:{signal:ne}},update:s=v({},o,{opacity:B,text:z(t.title)}),exit:{opacity:b}},f={signal:`lerp(range("${t.scale}"), ${Ft(0,1,.5)})`};return s.x=D(l,f),s.y=H(l,f),o.angle=D(l,b,qa(r,90)),o.baseline=D(l,un(l,J,I),{value:J}),s.angle=o.angle,s.baseline=o.baseline,L(u,{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"),angle:a("titleAngle"),baseline:a("titleBaseline")}),tl(a,l,u,n),u.update.align=ut(u.update.align,o.align),u.update.angle=ut(u.update.angle,o.angle),u.update.baseline=ut(u.update.baseline,o.baseline),C({type:tt,role:xe,style:Qt,from:i,encode:u},n)}function tl(t,e,n,i){const a=(o,s)=>o!=null?(n.update[s]=ut(z(o),n.update[s]),!1):!it(s,i),l=a(t("titleX"),"x"),r=a(t("titleY"),"y");n.enter.auto=r===l?z(r):D(e,z(r),z(l))}function el(t,e){const n=Ya(t,e),i=t.encode||{},a=i.axis||{},l=a.name||void 0,r=a.interactive,o=a.style,s=T(t,n),u=Qi(s),f={scale:t.scale,ticks:!!s("ticks"),labels:!!s("labels"),grid:!!s("grid"),domain:!!s("domain"),title:t.title!=null},d=g(e.add(G({},[f]))),c=g(e.add(ni({scale:e.scaleRef(t.scale),extra:e.property(u.extra),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),m=[];let h;return f.grid&&m.push(Na(t,n,i.grid,c,u)),f.ticks&&(h=s("tickSize"),m.push(Qa(t,n,i.ticks,c,h,u))),f.labels&&(h=f.ticks?h:0,m.push(Za(t,n,i.labels,c,h,u))),f.domain&&m.push(Ka(t,n,i.domain,d)),f.title&&m.push(_a(t,n,i.title,d)),Mt(yt({role:he,from:d,encode:nt(nl(s,t),a,mt),marks:m,aria:s("aria"),description:s("description"),zindex:s("zindex"),name:l,interactive:r,style:o}),e)}function nl(t,e){const n={enter:{},update:{}};return L(n,{orient:t("orient"),offset:t("offset")||0,position:V(e.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${e.scale}")))`},translate:t("translate"),format:e.format,formatType:e.formatType}),n}function hn(t,e,n){const i=w(t.signals),a=w(t.scales);return n||i.forEach(l=>Gt(l,e)),w(t.projections).forEach(l=>Wi(l,e)),a.forEach(l=>$i(l,e)),w(t.data).forEach(l=>Aa(l,e)),a.forEach(l=>Ri(l,e)),(n||i).forEach(l=>Pe(l,e)),w(t.axes).forEach(l=>el(l,e)),w(t.marks).forEach(l=>Mt(l,e)),w(t.legends).forEach(l=>Ea(l,e)),t.title&&ja(t.title,e),e.parseLambdas(),e}const il=t=>nt({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t);function al(t,e){const n=e.config,i=g(e.root=e.add(Dt())),a=ll(t,n);a.forEach(u=>Gt(u,e)),e.description=t.description||n.description,e.eventConfig=n.events,e.legends=e.objectProperty(n.legend&&n.legend.layout),e.locale=n.locale;const l=e.add(G()),r=e.add(Fe(ze(il(t.encode),Wt,$t,t.style,e,{pulse:g(l)}))),o=e.add(Me({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:i,pulse:g(r)}));e.operators.pop(),e.pushState(g(r),g(o),null),hn(t,e,a),e.operators.push(o);let s=e.add(Te({mark:i,pulse:g(o)}));return s=e.add(Ae({pulse:g(s)})),s=e.add(_({pulse:g(s)})),e.addData("root",new Q(e,l,l,s)),e}function bt(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function ll(t,e){const n=r=>V(t[r],e[r]),i=[bt("background",n("background")),bt("autosize",vn(n("autosize"))),bt("padding",On(n("padding"))),bt("width",n("width")||0),bt("height",n("height")||0)],a=i.reduce((r,o)=>(r[o.name]=o,r),{}),l={};return w(t.signals).forEach(r=>{F(a,r.name)?r=v(a[r.name],r):i.push(r),l[r.name]=r}),w(e.signals).forEach(r=>{!F(l,r.name)&&!F(a,r.name)&&i.push(r)}),i}function ue(t,e){this.config=t||{},this.options=e||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function mn(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}ue.prototype=mn.prototype={parse(t){return hn(t,this)},fork(){return new mn(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(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach(e=>{e.$ref=t.id}),t.refs=null),t},proxy(t){const e=t instanceof It?g(t):t;return this.add(yi({value:e}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,e;this.root&&(this.root.root=!0);for(t in this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(i,a,l){let r,o;i&&(r=i.data||(i.data={}),o=r[a]||(r[a]=[]),o.push(l))}for(t in this.data){e=this.data[t],n(e.input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values");for(const i in e.index)n(e.index[i],t,"index:"+i)}return this},pushState(t,e,n){this._encode.push(g(this.add(_({pulse:t})))),this._parent.push(e),this._lookup.push(n?g(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return dt(this._parent)},encode(){return dt(this._encode)},lookup(){return dt(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,e){if(q(t))return ct(t,e);t.signal||p("Unsupported field reference: "+y(t));const n=t.signal;let i=this.field[n];if(!i){const a={name:this.signalRef(n)};e&&(a.as=e),this.field[n]=i=g(this.add(ri(a)))}return i},compareRef(t){let e=!1;const n=l=>O(l)?(e=!0,this.signalRef(l.signal)):qn(l)?(e=!0,this.exprRef(l.expr)):l,i=w(t.field).map(n),a=w(t.order).map(n);return e?g(this.add(We({fields:i,orders:a}))):Le(i,a)},keyRef(t,e){let n=!1;const i=l=>O(l)?(n=!0,g(a[l.signal])):l,a=this.signals;return t=w(t).map(i),n?g(this.add(oi({fields:t,flat:e}))):Gn(t,e)},sortRef(t){if(!t)return t;const e=Lt(t.op,t.field),n=t.order||In;return n.signal?g(this.add(We({fields:e,orders:this.signalRef(n.signal)}))):Le(e,n)},event(t,e){const n=t+":"+e;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:t,type:e}),this.events[n]=i}return this.events[n]},hasOwnSignal(t){return F(this.signals,t)},addSignal(t,e){this.hasOwnSignal(t)&&p("Duplicate signal name: "+y(t));const n=e instanceof It?e:this.add(Dt(e));return this.signals[t]=n},getSignal(t){return this.signals[t]||p("Unrecognized signal name: "+y(t)),this.signals[t]},signalRef(t){return this.signals[t]?g(this.signals[t]):(F(this.lambdas,t)||(this.lambdas[t]=this.add(Dt(null))),g(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let e=0,n=t.length;e0?",":"")+(R(a)?a.signal||fe(a):y(a))}return n+"]"}function ol(t){let e="{",n=0,i,a;for(i in t)a=t[i],e+=(++n>1?",":"")+y(i)+":"+(R(a)?a.signal||fe(a):y(a));return e+"}"}function yn(){const t="sans-serif",e=30,n=2,i="#4c78a8",a="#000",l="#888",r="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:i},area:{fill:i},image:null,line:{stroke:i,strokeWidth:n},path:{stroke:i},rect:{fill:i},rule:{stroke:a},shape:{stroke:i},symbol:{fill:i,size:64},text:{fill:a,font:t,fontSize:11},trail:{fill:i,size:n},style:{"guide-label":{fill:a,font:t,fontSize:10},"guide-title":{fill:a,font:t,fontSize:11,fontWeight:"bold"},"group-title":{fill:a,font:t,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:a,font:t,fontSize:12},point:{size:e,strokeWidth:n,shape:"circle"},circle:{size:e,strokeWidth:n},square:{size:e,strokeWidth:n,shape:"square"},cell:{fill:"transparent",stroke:r},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:l,grid:!1,gridWidth:1,gridColor:r,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:l,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:r,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:l,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"]}}}function sl(t,e,n){return R(t)||p("Input Vega specification must be an object."),e=bn(yn(),e,t.config),al(t,new ue(e,n)).toRuntime()}export{me as AxisDomainRole,ye as AxisGridRole,pe as AxisLabelRole,he as AxisRole,be as AxisTickRole,xe as AxisTitleRole,Q as DataScope,$t as FrameRole,Se as LegendEntryRole,Ut as LegendLabelRole,ke as LegendRole,$e as LegendSymbolRole,Re as LegendTitleRole,St as MarkRole,ue as Scope,Rt as ScopeRole,yn as config,sl as parse,Gt as signal,Pe as signalUpdates,at as stream};export default null;